[Jderobot-admin] jderobot-r876 - trunk/src/components/visualHFSM-3.1
bmenendez en jderobot.org
bmenendez en jderobot.org
Mar Mar 5 14:52:16 CET 2013
Author: bmenendez
Date: 2013-03-05 14:51:16 +0100 (Tue, 05 Mar 2013)
New Revision: 876
Added:
trunk/src/components/visualHFSM-3.1/CMakeLists.txt
trunk/src/components/visualHFSM-3.1/tipos.h
Modified:
trunk/src/components/visualHFSM-3.1/Makefile
trunk/src/components/visualHFSM-3.1/imprimir.cpp
trunk/src/components/visualHFSM-3.1/imprimir.h
trunk/src/components/visualHFSM-3.1/int2string.cpp
trunk/src/components/visualHFSM-3.1/int2string.h
trunk/src/components/visualHFSM-3.1/interfaz.cpp
trunk/src/components/visualHFSM-3.1/interfaz.h
trunk/src/components/visualHFSM-3.1/nodo.cpp
trunk/src/components/visualHFSM-3.1/nodo.h
trunk/src/components/visualHFSM-3.1/recta.h
trunk/src/components/visualHFSM-3.1/transicion.cpp
trunk/src/components/visualHFSM-3.1/transicion.h
trunk/src/components/visualHFSM-3.1/ventanas.cpp
trunk/src/components/visualHFSM-3.1/ventanas.h
trunk/src/components/visualHFSM-3.1/xml.cpp
trunk/src/components/visualHFSM-3.1/xml.h
Log:
[bmenendez] Refactorizadas las cabeceras de todos los ficheros para que
pudiera compilar con cmake. Ya est?\195?\161 creado el CMakeLists. Se ha a?\195?\177adido
un nuevo fichero de cabeceras llamado tipos.h donde est?\195?\161n todas las
definiciones de tipos que hacen falta en todo el programa.
Added: trunk/src/components/visualHFSM-3.1/CMakeLists.txt
===================================================================
--- trunk/src/components/visualHFSM-3.1/CMakeLists.txt (rev 0)
+++ trunk/src/components/visualHFSM-3.1/CMakeLists.txt 2013-03-05 13:51:16 UTC (rev 876)
@@ -0,0 +1,72 @@
+cmake_minimum_required(VERSION 2.8)
+include(FindPkgConfig)
+
+SET( SOURCE_FILES_GENERATE reemplazar.cpp generate.cpp )
+SET( SOURCE_FILES_VISUALHFSM int2string.cpp recta.cpp nodo.cpp transicion.cpp ventanas.cpp xml.cpp imprimir.cpp interfaz.cpp )
+
+SET( INTERFACES_CPP_DIR /usr/local/lib )
+SET( LIBS_DIR /usr/include )
+
+SET( CMAKE_CXX_FLAGS "-g -Wall" ) # Opciones para el compilador
+
+include_directories (
+ /usr/include/gtksourceview-2.0
+ ${INTERFACES_CPP_DIR}
+ ${LIBS_DIR}
+)
+
+PKG_CHECK_MODULES(gtk20 REQUIRED gtk+-2.0)
+include_directories(${gtk20_INCLUDE_DIRS})
+link_directories(${gtk20_LIBRARY_DIRS})
+
+PKG_CHECK_MODULES(gtkmm REQUIRED gtkmm-2.4)
+include_directories(${gtkmm_INCLUDE_DIRS})
+link_directories(${gtkmm_LIBRARY_DIRS})
+
+PKG_CHECK_MODULES(libglademm REQUIRED libglademm-2.4)
+include_directories(${libglademm_INCLUDE_DIRS})
+link_directories(${libglademm_LIBRARY_DIRS})
+
+PKG_CHECK_MODULES(libglade REQUIRED libglade-2.0)
+include_directories(${libglade_INCLUDE_DIRS})
+link_directories(${libglade_LIBRARY_DIRS})
+
+PKG_CHECK_MODULES(libgnomecanvas REQUIRED libgnomecanvas-2.0)
+include_directories(${libgnomecanvas_INCLUDE_DIRS})
+link_directories(${libgnomecanvas_LIBRARY_DIRS})
+
+
+PKG_CHECK_MODULES(libgnomecanvasmm REQUIRED libgnomecanvasmm-2.6)
+include_directories(${libgnomecanvasmm_INCLUDE_DIRS})
+link_directories(${libgnomecanvasmm_LIBRARY_DIRS})
+
+
+PKG_CHECK_MODULES(libxml REQUIRED libxml-2.0)
+include_directories(${libxml_INCLUDE_DIRS})
+link_directories(${libxml_LIBRARY_DIRS})
+
+PKG_CHECK_MODULES(gtk+-unix-print REQUIRED gtk+-unix-print-2.0)
+include_directories(${gtk+-unix-print_INCLUDE_DIRS})
+link_directories(${gtk+-unix-print_LIBRARY_DIRS})
+
+message(${gtk20_LIBRARIES})
+
+add_executable (generate ${SOURCE_FILES_GENERATE})
+
+TARGET_LINK_LIBRARIES ( generate
+ ${libxml_LIBRARIES}
+)
+
+add_executable (visualHFSM ${SOURCE_FILES_VISUALHFSM})
+
+TARGET_LINK_LIBRARIES ( visualHFSM
+ ${gtkmm_LIBRARIES}
+ ${libglademm_LIBRARIES}
+ ${libglade_LIBRARIES}
+ ${libgnomecanvasmm_LIBRARIES}
+ ${libgnomecanvas_LIBRARIES}
+ ${gtk+-unix-print_LIBRARIES}
+ ${gtk20_LIBRARIES}
+ ${libxml_LIBRARIES}
+ /usr/lib/libgtksourceview-2.0.so
+)
Modified: trunk/src/components/visualHFSM-3.1/Makefile
===================================================================
--- trunk/src/components/visualHFSM-3.1/Makefile 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/Makefile 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,48 +1,125 @@
-LIBS = -I/usr/include/gtk-2.0/gdk/ -I/usr/include/gtk-2.0/gtk/ -I/usr/include/gtk-2.0/gdk-pixbuf/ -I/usr/include/libgnomecanvas-2.0/libgnomecanvas/ -I/usr/include/libxml2/libxml/
-SRC = src
-LIB_DIR = `pkg-config --cflags --libs gtk+-2.0 libgnomecanvas-2.0 libglade-2.0 gtksourceview-2.0 gtk+-unix-print-2.0`
-GPP = g++
-CFLAGS = -g -Wall
-SOURCES = int2string.o ./recta/recta.o nodo.o transicion.o ventanas.o xml.o imprimir.o
+# CMAKE generated file: DO NOT EDIT!
+# Generated by "Unix Makefiles" Generator, CMake Version 2.8
-#g++ -g -Wall -c transicion.cpp `pkg-config --cflags --libs gtk+-2.0 libgnomecanvas-2.0`
-#g++ -g -Wall interfaz.cpp -o interfaz ./src/recta/recta.o ./src/nodo.o ./src/transicion.o ./src/ventanas.o `pkg-config --cflags --libs gtk+-2.0 libgnomecanvas-2.0 libglade-2.0 gtksourceview-1.0`
+# Default target executed when no arguments are given to make.
+default_target: all
+.PHONY : default_target
-ALL: visualHFSM
+#=============================================================================
+# Special targets provided by cmake.
-generate.o: generate.cpp reemplazar.o
- $(GPP) $(CFLAGS) $(LIB_DIR) $(LIBS) generate.cpp -o generate reemplazar.o
-
-reemplazar.o: reemplazar.cpp
- $(GPP) $(CFLAGS) $(LIB_DIR) $(LIBS) -c reemplazar.cpp -o reemplazar.o
+# Disable implicit rules so canonical targets will work.
+.SUFFIXES:
-visualHFSM: generate.o $(SOURCES) interfaz.o
- $(GPP) $(CFLAGS) $(LIB_DIR) $(LIBS) -o visualHFSM interfaz.o $(SOURCES)
+# Remove some rules from gmake that .SUFFIXES does not remove.
+SUFFIXES =
-interfaz.o: interfaz.cpp
- $(GPP) $(CFLAGS) -c interfaz.cpp $(LIB_DIR)
+.SUFFIXES: .hpux_make_needs_suffix_list
-imprimir.o: imprimir.cpp imprimir.h
- $(GPP) $(CFLAGS) $(LIB_DIR) -c imprimir.cpp
+# Suppress display of executed commands.
+$(VERBOSE).SILENT:
-xml.o: xml.cpp xml.h transicion.o nodo.o
- $(GPP) $(CFLAGS) $(LIB_DIR) -c xml.cpp
+# A target that is always out of date.
+cmake_force:
+.PHONY : cmake_force
-ventanas.o: ventanas.cpp transicion.o nodo.o
- $(GPP) $(CFLAGS) $(LIB_DIR) -c ventanas.cpp
+#=============================================================================
+# Set environment variables for the build.
-nodo.o: nodo.cpp ./recta/recta.o
- $(GPP) $(CFLAGS) $(LIB_DIR) -c nodo.cpp
+# The shell in which to execute make rules.
+SHELL = /bin/sh
-transicion.o: transicion.cpp ./recta/recta.o
- $(GPP) $(CFLAGS) $(LIB_DIR) -c transicion.cpp
+# The CMake executable.
+CMAKE_COMMAND = /usr/bin/cmake
-./recta/recta.o: ./recta/recta.c ./recta/recta.h
- $(GPP) $(CFLAGS) $(LIB_DIR) -c recta/recta.c -o ./recta/recta.o
+# The command to remove a file.
+RM = /usr/bin/cmake -E remove -f
-int2string.o: int2string.cpp int2string.h
- $(GPP) $(CFLAGS) $(LIB_DIR) -c int2string.cpp
+# Escaping for special characters.
+EQUALS = =
+# The program to use to edit the cache.
+CMAKE_EDIT_COMMAND = /usr/bin/ccmake
+
+# The top-level source directory on which CMake was run.
+CMAKE_SOURCE_DIR = /home/borjamon/jderobot/trunk/src/components
+
+# The top-level build directory on which CMake was run.
+CMAKE_BINARY_DIR = /home/borjamon/jderobot/trunk/src/components/visualHFSM-3.1
+
+#=============================================================================
+# Targets provided globally by CMake.
+
+# Special rule for the target edit_cache
+edit_cache:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake cache editor..."
+ /usr/bin/ccmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : edit_cache
+
+# Special rule for the target edit_cache
+edit_cache/fast: edit_cache
+.PHONY : edit_cache/fast
+
+# Special rule for the target rebuild_cache
+rebuild_cache:
+ @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --cyan "Running CMake to regenerate build system..."
+ /usr/bin/cmake -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR)
+.PHONY : rebuild_cache
+
+# Special rule for the target rebuild_cache
+rebuild_cache/fast: rebuild_cache
+.PHONY : rebuild_cache/fast
+
+# The main all target
+all: cmake_check_build_system
+ $(CMAKE_COMMAND) -E cmake_progress_start /home/borjamon/jderobot/trunk/src/components/visualHFSM-3.1/CMakeFiles /home/borjamon/jderobot/trunk/src/components/visualHFSM-3.1/CMakeFiles/progress.marks
+ $(MAKE) -f CMakeFiles/Makefile2 all
+ $(CMAKE_COMMAND) -E cmake_progress_start /home/borjamon/jderobot/trunk/src/components/visualHFSM-3.1/CMakeFiles 0
+.PHONY : all
+
+# The main clean target
clean:
- rm -f *.o *~
-
+ $(MAKE) -f CMakeFiles/Makefile2 clean
+.PHONY : clean
+
+# The main clean target
+clean/fast: clean
+.PHONY : clean/fast
+
+# Prepare targets for installation.
+preinstall: all
+ $(MAKE) -f CMakeFiles/Makefile2 preinstall
+.PHONY : preinstall
+
+# Prepare targets for installation.
+preinstall/fast:
+ $(MAKE) -f CMakeFiles/Makefile2 preinstall
+.PHONY : preinstall/fast
+
+# clear depends
+depend:
+ $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 1
+.PHONY : depend
+
+# Help Target
+help:
+ @echo "The following are some of the valid targets for this Makefile:"
+ @echo "... all (the default if no target is provided)"
+ @echo "... clean"
+ @echo "... depend"
+ @echo "... edit_cache"
+ @echo "... rebuild_cache"
+.PHONY : help
+
+
+
+#=============================================================================
+# Special targets to cleanup operation of make.
+
+# Special rule to run CMake to check the build system integrity.
+# No rule that depends on this can have commands that come from listfiles
+# because they might be regenerated.
+cmake_check_build_system:
+ $(CMAKE_COMMAND) -H$(CMAKE_SOURCE_DIR) -B$(CMAKE_BINARY_DIR) --check-build-system CMakeFiles/Makefile.cmake 0
+.PHONY : cmake_check_build_system
+
Modified: trunk/src/components/visualHFSM-3.1/imprimir.cpp
===================================================================
--- trunk/src/components/visualHFSM-3.1/imprimir.cpp 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/imprimir.cpp 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,39 +1,5 @@
-
-#include <libgnomecanvas/libgnomecanvas.h>
-
-
-#include <gtk/gtk.h>
-//#include <gdk_imlib_types.h>
-#include <gtk/gtkprintunixdialog.h>
-#include <gtk/gtkpagesetupunixdialog.h>
-#include <string.h>
-#include <png.h>
-#include <gdk/gdk.h>
-//#include <gdk_imlib.h>
-//#include <gdk_imlib_types.h>
-#include <sys/stat.h>
-#ifndef __G_LIB_H__
-# include <glib.h>
-#endif
-
-#ifndef __GDK_H__
-# include <gdk/gdk.h>
-#endif
-
-#ifndef __GTK_H__
-# define GTK_ENABLE_BROKEN 1
-# include <gtk/gtk.h>
-#endif
-
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#include <stdio.h>
#include "imprimir.h"
-
-
void
cerrarDialogoImprimir(GtkWidget *widget)
{
Modified: trunk/src/components/visualHFSM-3.1/imprimir.h
===================================================================
--- trunk/src/components/visualHFSM-3.1/imprimir.h 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/imprimir.h 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,5 +1,37 @@
+#ifndef IMPRIMIR_H
+#define IMPRIMIR_H
+
#include <gtk/gtk.h>
+#include <libgnomecanvas/libgnomecanvas.h>
+
+//#include <gdk_imlib_types.h>
+#include <gtk/gtkprintunixdialog.h>
+#include <gtk/gtkpagesetupunixdialog.h>
+#include <string.h>
+#include <png.h>
+#include <gdk/gdk.h>
+//#include <gdk_imlib.h>
+//#include <gdk_imlib_types.h>
+#include <sys/stat.h>
+#ifndef __G_LIB_H__
+# include <glib.h>
+#endif
+
+#ifndef __GDK_H__
+# include <gdk/gdk.h>
+#endif
+
+#ifndef __GTK_H__
+# define GTK_ENABLE_BROKEN 1
+# include <gtk/gtk.h>
+#endif
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
//void
//dialogoImpresion(gchar *file);
@@ -12,4 +44,5 @@
sp_png_write_rgba (const unsigned char *filename, const unsigned char *px, int width, int height, int rowstride);
void exportar (GnomeCanvas *canvas);
void exportar2 (GnomeCanvas *canvas);
+#endif
Modified: trunk/src/components/visualHFSM-3.1/int2string.cpp
===================================================================
--- trunk/src/components/visualHFSM-3.1/int2string.cpp 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/int2string.cpp 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,7 +1,5 @@
-#include <sstream>
+#include "int2string.h"
-using namespace std;
-
string int2string(int n){
std:: stringstream flujo;
Modified: trunk/src/components/visualHFSM-3.1/int2string.h
===================================================================
--- trunk/src/components/visualHFSM-3.1/int2string.h 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/int2string.h 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,5 +1,8 @@
+#ifndef IN2STRING_H
+#define IN2STRING_H
+
#include <sstream>
+using namespace std;
+string int2string(int n);
-
-
-string int2string(int n);
+#endif
Modified: trunk/src/components/visualHFSM-3.1/interfaz.cpp
===================================================================
--- trunk/src/components/visualHFSM-3.1/interfaz.cpp 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/interfaz.cpp 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,36 +1,3 @@
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <string.h>
-
-#include <sstream>
-#include <iostream>
-#include <string>
-#include <fstream>
-#include <list>
-
-#include <gdk/gdkkeysyms.h> //NOMBRES TECLAS
-
-#include <gtk/gtk.h>
-#include <gtksourceview/gtksourceview.h>
-#include <gtksourceview/gtksourcebuffer.h>
-#include <gtksourceview/gtksourcelanguage.h>
-#include <gtksourceview/gtksourcelanguagemanager.h>
-
-#include <libgnomecanvas/libgnomecanvas.h>
-#include <libglade-2.0/glade/glade.h>
-#include <libxml/tree.h>
-
-#include <sys/types.h>
-#include <unistd.h>
-
-#include "transicion.h"
-#include "recta.h"
-//#include "nodo.h"
-//#include "ventanas.h"
-#include "xml.h"
-#include "int2string.h"
-#include "imprimir.h"
#include "interfaz.h"
//#include <gtkmm.h>
@@ -2568,6 +2535,7 @@
GnomeCanvasItem *
pinta_transicion (GnomeCanvasItem *origen, GnomeCanvasItem *destino)
{
+
GnomeCanvasPoints *pointsPoligono = gnome_canvas_points_new (2);
GnomeCanvasGroup *group;
GnomeCanvasItem *item1, *item2;
@@ -2587,7 +2555,7 @@
printf("origen, x1: %f, y1: %f, x2: %f, y2: %f \n", I1x1, I1y1, I1x2, I1y2);
- /* Resolver desequilibrio */
+ // Resolver desequilibrio //
I1x1 += 1.5;
I1y1 += 1.5;
@@ -2607,7 +2575,7 @@
g_object_get (G_OBJECT (destino), "y2", &I2y2, NULL);
printf("destino, x1: %f, y1: %f, x2: %f, y2: %f \n", I2x1, I2y1, I2x2, I2y2);
- /* Resolver desequilibrio */
+ // Resolver desequilibrio //
I2x1 += 1.5;
I2y1 += 1.5;
@@ -2699,6 +2667,7 @@
create_drag_box (group, (char *)"box", pMedioX, pMedioY, G_CALLBACK (highlight_box));
return GNOME_CANVAS_ITEM(group);
+
}
Modified: trunk/src/components/visualHFSM-3.1/interfaz.h
===================================================================
--- trunk/src/components/visualHFSM-3.1/interfaz.h 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/interfaz.h 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,21 +1,45 @@
+#ifndef INTERFAZ_H
+#define INTERFAZ_H
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+#include <sstream>
#include <iostream>
+#include <string>
+#include <fstream>
#include <list>
-#include "nodo.h"
+
+#include <gdk/gdkkeysyms.h> //NOMBRES TECLAS
+
+#include <gtk/gtk.h>
+#include <gtksourceview/gtksourceview.h>
+#include <gtksourceview/gtksourcebuffer.h>
+#include <gtksourceview/gtksourcelanguage.h>
+#include <gtksourceview/gtksourcelanguagemanager.h>
+
+#include <libgnomecanvas/libgnomecanvas.h>
+#include <libglade-2.0/glade/glade.h>
+#include <libxml/tree.h>
+
+#include <sys/types.h>
+#include <unistd.h>
+
+#include "transicion.h"
+#include "xml.h"
+#include "int2string.h"
+#include "imprimir.h"
+
+#include "tipos.h"
#include "ventanas.h"
+#include "recta.h"
+
//#include <gtk/gtk.h>
using namespace std;
-typedef struct tSubAut {
- list <tNodo> ListaElementosSub;
- list <tTransicion> ListaTransicionesSub;
- int tiempoIteracionSub;
- string variablesSub;
- string funcionesSub;
- importar impSub;
- int idSub;
- int idPadre;
-} tSubAut;
void
@@ -72,3 +96,5 @@
/*
static GtkWidget *
create_view_and_model();*/
+
+#endif
Modified: trunk/src/components/visualHFSM-3.1/nodo.cpp
===================================================================
--- trunk/src/components/visualHFSM-3.1/nodo.cpp 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/nodo.cpp 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,12 +1,4 @@
-#include <iostream>
-#include <list>
-
-#include "recta.h"
#include "nodo.h"
-#include "transicion.h"
-
-#include <gtk/gtk.h>
-#include <libgnomecanvas/libgnomecanvas.h>
//int cont_nodos = 0;
Modified: trunk/src/components/visualHFSM-3.1/nodo.h
===================================================================
--- trunk/src/components/visualHFSM-3.1/nodo.h 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/nodo.h 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,25 +1,17 @@
+#ifndef NODO_H
+#define NODO_H
+
#include <iostream>
#include <list>
-
+
#include <gtk/gtk.h>
#include <libgnomecanvas/libgnomecanvas.h>
+#include "tipos.h"
+
using namespace std;
-typedef struct tipoNodo {
-
- GnomeCanvasItem * item;
- GnomeCanvasItem * estado_inicial;
-// int origenX, origenY; // Punto (x,y) donde se dibujara en el canvas
-// int destinoX, destinoY; // Punto (x,y) donde se dibujara en el canvas
- string nombre; // Nombre del nodo. "" por defecto
- string codigo; // Codigo del estado
- GnomeCanvasItem * item_nombre; // item que muestra el nombre del estado
- list <GnomeCanvasItem *> listaAdyacentes; // Para estados -- Lista de lineas adyacentes
- int idHijo; //Id. que indica el subautomata dentro de la lista de subautomatas que se corresponde con el hijo de este estado
-} tNodo;
-
/* Copia y añade un nodo a la lista */
void copiar_nodo (GnomeCanvasItem * item, GnomeCanvasItem * item_cp);
@@ -38,3 +30,5 @@
void get_bounds (GnomeCanvasItem *nodo, double *x1, double *y1, double *x2, double *y2);
gint item_event2 (GnomeCanvasItem *item_group, GdkEvent *event, gpointer data);
+
+#endif
Modified: trunk/src/components/visualHFSM-3.1/recta.h
===================================================================
--- trunk/src/components/visualHFSM-3.1/recta.h 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/recta.h 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,34 +1,27 @@
-#include <stdio.h>
-
-
-typedef struct punto {
- double x;
- double y;
-} punto;
-
-typedef struct recta {
- double A;
- double B;
- double C;
-} recta;
-
-punto crear_punto (double x, double y);
-punto punto_medio (punto p1, punto p2);
-void punto_get_values (punto p, double *x, double *y);
-
-/*Ax + By + C = 0
-A=y2-y1 B=x2-x1 C=((y2-y1)*x1)+((x2-x1)*y1) */
-recta crear_recta (punto p1, punto p2);
-
-/* Recta perpendicular a otra y que pase por un punto
- A'=-B B=A C=-((A*x)+(B*y));*/
-recta recta_perpendicular (recta r1, punto p1);
-
-/* Recta paralela a otra a una distancia
- d(p,R)=|Ax+By+C|/((A^2)+(B^2))^1/2 // A'=A B'=B*/
-recta recta_paralela (recta r1, punto p1, double distancia);
-
-punto interseccion_rectas (recta r1, recta r2);
-
-
-
+#ifndef RECTA_H
+#define RECTA_H
+
+#include "tipos.h"
+#include <math.h>
+
+
+punto crear_punto (double x, double y);
+punto punto_medio (punto p1, punto p2);
+void punto_get_values (punto p, double *x, double *y);
+
+/*Ax + By + C = 0
+A=y2-y1 B=x2-x1 C=((y2-y1)*x1)+((x2-x1)*y1) */
+recta crear_recta (punto p1, punto p2);
+
+/* Recta perpendicular a otra y que pase por un punto
+ A'=-B B=A C=-((A*x)+(B*y));*/
+recta recta_perpendicular (recta r1, punto p1);
+
+/* Recta paralela a otra a una distancia
+ d(p,R)=|Ax+By+C|/((A^2)+(B^2))^1/2 // A'=A B'=B*/
+recta recta_paralela (recta r1, punto p1, double distancia);
+
+punto interseccion_rectas (recta r1, recta r2);
+
+
+#endif
Added: trunk/src/components/visualHFSM-3.1/tipos.h
===================================================================
--- trunk/src/components/visualHFSM-3.1/tipos.h (rev 0)
+++ trunk/src/components/visualHFSM-3.1/tipos.h 2013-03-05 13:51:16 UTC (rev 876)
@@ -0,0 +1,100 @@
+#ifndef TIPOS_H
+#define TIPOS_H
+
+#include <libgnomecanvas/libgnomecanvas.h>
+#include <list>
+#include <string>
+using namespace std;
+
+typedef struct punto {
+ double x;
+ double y;
+} punto;
+
+typedef struct recta {
+ double A;
+ double B;
+ double C;
+} recta;
+
+
+typedef struct tipoNodo {
+
+ GnomeCanvasItem * item;
+ GnomeCanvasItem * estado_inicial;
+// int origenX, origenY; // Punto (x,y) donde se dibujara en el canvas
+// int destinoX, destinoY; // Punto (x,y) donde se dibujara en el canvas
+ string nombre; // Nombre del nodo. "" por defecto
+ string codigo; // Codigo del estado
+ GnomeCanvasItem * item_nombre; // item que muestra el nombre del estado
+ list <GnomeCanvasItem *> listaAdyacentes; // Para estados -- Lista de lineas adyacentes
+ int idHijo; //Id. que indica el subautomata dentro de la lista de subautomatas que se corresponde con el hijo de este estado
+} tNodo;
+
+typedef struct tipoTransicion {
+ //int id;
+ GnomeCanvasItem * item; // Item que representa la transición. Está formado a su vez por 3 item: 2 líneas y un punto de acción en la unión de ambas (box).
+ // Posicion 0 inicio recta, posicion 1 final recta, posicion 2 box.
+ //int origenX, origenY;
+ //int destinoX, destinoY;
+ //double pMedioX, pMedioY; // Posición del punto de acción de la transición.
+ GnomeCanvasItem * origen; // Nodo origen
+ GnomeCanvasItem * destino; // Nodo destino
+ string nombre; // Nombre de la transicion. "" por defecto
+ GnomeCanvasItem * item_nombre; // Item del nombre de la transición.
+ //GnomeCanvasItem * orientacion; // Triangulo flecha
+ string codigo;
+ int tiempo;
+} tTransicion;
+
+extern list <tNodo> ListaElementos;
+extern list <tTransicion> ListaTransiciones;
+
+typedef struct transicion_aux { // Transiciones temporales. Usadas para pintar las transiciones despues de cargar un fichero.
+ GnomeCanvasItem *origen;
+ GnomeCanvasItem *destino;
+ int origen_xml;
+ int destino_id;
+ int tiempo;
+ string codigo;
+ string nombre;
+ GnomeCanvasItem *item;
+} transicion_aux;
+
+typedef struct importar {
+ bool laser;
+ bool motor;
+ bool radar;
+ bool encoders;
+ bool lat_lon;
+ bool camara;
+ bool ptencoders;
+} importar;
+
+
+typedef enum TYPE_VENTANA {
+ NOMBRAR,
+ EDITAR,
+ CODIGO,
+ LIBRERIAS,
+ TIMER
+}tVentana;
+
+typedef struct nodoVentana {
+ GnomeCanvasItem * item; // item correspondiente a la ventana
+ tVentana tipo; // Nombre del nodo. "" por defecto
+ GtkWidget *ventana; // Ventana
+} nVentana;
+
+typedef struct tSubAut {
+ list <tNodo> ListaElementosSub;
+ list <tTransicion> ListaTransicionesSub;
+ int tiempoIteracionSub;
+ string variablesSub;
+ string funcionesSub;
+ importar impSub;
+ int idSub;
+ int idPadre;
+} tSubAut;
+
+#endif
Modified: trunk/src/components/visualHFSM-3.1/transicion.cpp
===================================================================
--- trunk/src/components/visualHFSM-3.1/transicion.cpp 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/transicion.cpp 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,21 +1,8 @@
-#include <iostream>
-#include <list>
-#include <cstring>
-
#include "transicion.h"
-#include "interfaz.h"
-#include "recta.h"
-
-//#include "nodo.h"
-
-#include <gtk/gtk.h>
-#include <libgnomecanvas/libgnomecanvas.h>
-
int cont_transiciones = 0;
-extern list <tNodo> ListaElementos;
-extern list <tTransicion> ListaTransiciones;
+
//extern list <transicion_aux> ListaTransicionesTemporales;
//extern list <GtkWidget *> ListaBotones;
//extern GnomeCanvasGroup *root;
@@ -161,6 +148,7 @@
GnomeCanvasGroup * repintar_transicion (GnomeCanvasGroup *root, GnomeCanvasItem *origen, GnomeCanvasItem *destino, double x, double y)
{
+
GnomeCanvasItem *item1,*item2;
GnomeCanvasGroup *group;
@@ -262,11 +250,13 @@
return group;
+
}
GnomeCanvasGroup * repintar_transicion_nodo (GnomeCanvasGroup *root, GnomeCanvasItem *transicion, GnomeCanvasItem *nodo, char * direccion)
{
+
GList * list_items, *list_aux;
GnomeCanvasItem *item, *box, *arrow;
GnomeCanvasGroup *group;
@@ -374,6 +364,7 @@
//gnome_canvas_item_reparent (box, transicion);
return GNOME_CANVAS_GROUP (group);
+
}
Modified: trunk/src/components/visualHFSM-3.1/transicion.h
===================================================================
--- trunk/src/components/visualHFSM-3.1/transicion.h 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/transicion.h 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,3 +1,6 @@
+#ifndef TRANSICION_H
+#define TRANSICION_H
+
#include <iostream>
#include <gtk/gtk.h>
@@ -3,36 +6,13 @@
#include <libgnomecanvas/libgnomecanvas.h>
+#include <list>
+#include <cstring>
+#include "recta.h"
+#include "nodo.h"
+#include "interfaz.h"
using namespace std;
-
-typedef struct tipoTransicion {
- //int id;
- GnomeCanvasItem * item; // Item que representa la transición. Está formado a su vez por 3 item: 2 líneas y un punto de acción en la unión de ambas (box).
- // Posicion 0 inicio recta, posicion 1 final recta, posicion 2 box.
- //int origenX, origenY;
- //int destinoX, destinoY;
- //double pMedioX, pMedioY; // Posición del punto de acción de la transición.
- GnomeCanvasItem * origen; // Nodo origen
- GnomeCanvasItem * destino; // Nodo destino
- string nombre; // Nombre de la transicion. "" por defecto
- GnomeCanvasItem * item_nombre; // Item del nombre de la transición.
- //GnomeCanvasItem * orientacion; // Triangulo flecha
- string codigo;
- int tiempo;
-} tTransicion;
-
-typedef struct transicion_aux { // Transiciones temporales. Usadas para pintar las transiciones despues de cargar un fichero.
- GnomeCanvasItem *origen;
- GnomeCanvasItem *destino;
- int origen_xml;
- int destino_id;
- int tiempo;
- string codigo;
- string nombre;
- GnomeCanvasItem *item;
-} transicion_aux;
-
/* Devuelve el identificador de la transición */
int id_transicion ();
@@ -75,3 +55,5 @@
int numero_transiciones (GnomeCanvasItem *estado1, GnomeCanvasItem *estado2);
void eliminar_nombre (GnomeCanvasItem *transicion);
+
+#endif
Modified: trunk/src/components/visualHFSM-3.1/ventanas.cpp
===================================================================
--- trunk/src/components/visualHFSM-3.1/ventanas.cpp 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/ventanas.cpp 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,22 +1,5 @@
-#include <iostream>
-#include <list>
-#include <string.h>
-
-#include "nodo.h"
-#include "transicion.h"
#include "ventanas.h"
-#include "int2string.h"
-
-#include <gtk/gtk.h>
-#include <libgnomecanvas/libgnomecanvas.h>
-#include <libglade-2.0/glade/glade.h>
-#include <gtksourceview/gtksourceview.h>
-#include <gtksourceview/gtksourcebuffer.h>
-#include <gtksourceview/gtksourcelanguage.h>
-#include <gtksourceview/gtksourcelanguagemanager.h>
-
-
list <nVentana> ListaVentanas;
extern list <tNodo> ListaElementos;
Modified: trunk/src/components/visualHFSM-3.1/ventanas.h
===================================================================
--- trunk/src/components/visualHFSM-3.1/ventanas.h 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/ventanas.h 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,32 +1,24 @@
+#ifndef VENTANAS_H
+#define VENTANAS_H
+#include <iostream>
+#include <list>
+#include <string.h>
-typedef struct importar {
- bool laser;
- bool motor;
- bool radar;
- bool encoders;
- bool lat_lon;
- bool camara;
- bool ptencoders;
-} importar;
-
+#include "transicion.h"
+#include "int2string.h"
+
+#include <gtk/gtk.h>
+#include <libgnomecanvas/libgnomecanvas.h>
+#include <libglade-2.0/glade/glade.h>
-typedef enum TYPE_VENTANA {
- NOMBRAR,
- EDITAR,
- CODIGO,
- LIBRERIAS,
- TIMER
-}tVentana;
+#include <gtksourceview/gtksourceview.h>
+#include <gtksourceview/gtksourcebuffer.h>
+#include <gtksourceview/gtksourcelanguage.h>
+#include <gtksourceview/gtksourcelanguagemanager.h>
-typedef struct nodoVentana {
- GnomeCanvasItem * item; // item correspondiente a la ventana
- tVentana tipo; // Nombre del nodo. "" por defecto
- GtkWidget *ventana; // Ventana
-} nVentana;
+#include "tipos.h"
-
-
/****EDICION DE ESTADOS****/
void cancelar (GtkWidget *widget, gpointer data);
@@ -61,3 +53,4 @@
* del canvas aleatoriamente
*/
void change_item_color (GnomeCanvasItem *item, int color);
+#endif
Modified: trunk/src/components/visualHFSM-3.1/xml.cpp
===================================================================
--- trunk/src/components/visualHFSM-3.1/xml.cpp 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/xml.cpp 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,19 +1,5 @@
-
-#include <iostream>
-#include <string>
-#include <list>
-#include <string.h>
-
-//#include "nodo.h"
-#include "transicion.h"
-//#include "ventanas.h"
-#include "int2string.h"
#include "xml.h"
-#include "interfaz.h"
-
-#include <libxml/tree.h>
-
int cont_nodos = 0;
//************************Añadida lista de subautomatas
extern list <tSubAut> ListaSubAutomatas;
Modified: trunk/src/components/visualHFSM-3.1/xml.h
===================================================================
--- trunk/src/components/visualHFSM-3.1/xml.h 2013-03-05 12:43:59 UTC (rev 875)
+++ trunk/src/components/visualHFSM-3.1/xml.h 2013-03-05 13:51:16 UTC (rev 876)
@@ -1,4 +1,19 @@
+#ifndef XML_H
+#define XML_H
+#include <iostream>
+#include <string>
+#include <list>
+#include <string.h>
+
+//#include "nodo.h"
+#include "transicion.h"
+//#include "ventanas.h"
+#include "int2string.h"
+
+#include "interfaz.h"
+
+
#include <libxml/tree.h>
@@ -22,3 +37,5 @@
/* Recupera la informacion de un estado y lo representa en el canvas */
void xml_get_entry (xmlNodePtr child);
+
+#endif
More information about the Jderobot-admin
mailing list