[Jderobot-admin] jderobot-r953 - in trunk: . Deps Deps/libxml++ src/components src/components/remoteConfiguration src/components/remoteConfiguration/build src/components/remoteConfiguration/build-independent src/interfaces/slice/jderobot

frivas en jderobot.org frivas en jderobot.org
Mie Jul 24 11:30:17 CEST 2013


Author: frivas
Date: 2013-07-24 11:29:17 +0200 (Wed, 24 Jul 2013)
New Revision: 953

Added:
   trunk/Deps/libxml++/
   trunk/Deps/libxml++/CMakeLists.txt
   trunk/src/components/remoteConfiguration/
   trunk/src/components/remoteConfiguration/CMakeLists.txt
   trunk/src/components/remoteConfiguration/build-independent/
   trunk/src/components/remoteConfiguration/build-independent/CMakeLists.txt
   trunk/src/components/remoteConfiguration/build/
   trunk/src/components/remoteConfiguration/build/CMakeLists.txt
   trunk/src/components/remoteConfiguration/build/cmake_uninstall.cmake.in
   trunk/src/components/remoteConfiguration/myGUIconfig.xml
   trunk/src/components/remoteConfiguration/myparser.cpp
   trunk/src/components/remoteConfiguration/myparser.h
   trunk/src/components/remoteConfiguration/remoteConfiguration.cfg
   trunk/src/components/remoteConfiguration/remoteConfiguration.cpp
Modified:
   trunk/CMakeLists.txt
   trunk/src/interfaces/slice/jderobot/body.ice
   trunk/src/interfaces/slice/jderobot/bodyencoders.ice
   trunk/src/interfaces/slice/jderobot/bodymotors.ice
   trunk/src/interfaces/slice/jderobot/bodymovements.ice
   trunk/src/interfaces/slice/jderobot/motors.ice
   trunk/src/interfaces/slice/jderobot/ptencoders.ice
   trunk/src/interfaces/slice/jderobot/ptmotors.ice
Log:
modificadas las cabeceras de algunos interfaces ice, a?\195?\177adida la dependencia libxml++ y a?\195?\177adido el nuevo componente remoteConfiguration


Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2013-07-24 08:35:13 UTC (rev 952)
+++ trunk/CMakeLists.txt	2013-07-24 09:29:17 UTC (rev 953)
@@ -36,6 +36,7 @@
 		colortuner 
 		replayController 
 		basic_server
+		remoteConfiguration
 		
 ) #Componentes que forman JDErobot
 
@@ -125,6 +126,7 @@
 include(${DEPS_DIR}/openni2/CMakeLists.txt)
 include(${DEPS_DIR}/nite2/CMakeLists.txt)
 include(${DEPS_DIR}/pthread/CMakeLists.txt)
+include(${DEPS_DIR}/libxml++/CMakeLists.txt)
 #include(${CMAKE_CURRENT_SOURCE_DIR}/../../../libs/CMakeLists.txt)
 
 

Added: trunk/Deps/libxml++/CMakeLists.txt
===================================================================
--- trunk/Deps/libxml++/CMakeLists.txt	                        (rev 0)
+++ trunk/Deps/libxml++/CMakeLists.txt	2013-07-24 09:29:17 UTC (rev 953)
@@ -0,0 +1,14 @@
+include(FindPkgConfig)
+PKG_CHECK_MODULES(libxmlpp REQUIRED libxml++-2.6)
+
+include_directories(${libxmlpp_INCLUDE_DIRS})
+link_directories(${libxmlpp_LIBRARY_DIRS})
+
+IF (libxmlpp_INCLUDE_DIRS) 
+	MESSAGE("Libxml++ libraries found at ${libxmlpp_LIBRARY_DIRS}")
+ELSE()
+	MESSAGE ("*** Libxml++ not found")
+ENDIF()
+
+
+

Added: trunk/src/components/remoteConfiguration/CMakeLists.txt
===================================================================
--- trunk/src/components/remoteConfiguration/CMakeLists.txt	                        (rev 0)
+++ trunk/src/components/remoteConfiguration/CMakeLists.txt	2013-07-24 09:29:17 UTC (rev 953)
@@ -0,0 +1,33 @@
+
+
+IF (libxmlpp_INCLUDE_DIRS) 
+
+	SET(SOURCE_FILES remoteConfiguration.cpp myparser.cpp)
+
+	add_definitions(-DGLADE_DIR="${gladedir}")
+
+	set( CMAKE_CXX_FLAGS "-Wno-deprecated" ) # Opciones para el compilador-lgsl -lgslcblas -lGL -lGLU -lglut -lgazebo
+
+	include_directories(
+		${INTERFACES_CPP_DIR}
+		${LIBS_DIR}/
+		${CMAKE_CURRENT_SOURCE_DIR}
+		${CMAKE_CURRENT_SOURCE_DIR}/cameras
+	)
+
+	add_executable (remoteConfiguration ${SOURCE_FILES})
+
+
+	TARGET_LINK_LIBRARIES(remoteConfiguration
+
+		 ${gsl_LIBRARIES}
+		  ${libxmlpp_LIBRARIES}
+		  ${gtkglextmm_LIBRARIES}
+		  ${libglademm_LIBRARIES}
+		  ${gtkmm_LIBRARIES}
+		  ${INTERFACES_CPP_DIR}/jderobot/libJderobotInterfaces.so
+		  ${LIBS_DIR}/jderobotutil/libjderobotutil.so
+		${CMAKE_THREAD_LIBS_INIT} 
+		${ZeroCIce_LIBRARIES}
+	)
+endif()

Added: trunk/src/components/remoteConfiguration/build/CMakeLists.txt
===================================================================
--- trunk/src/components/remoteConfiguration/build/CMakeLists.txt	                        (rev 0)
+++ trunk/src/components/remoteConfiguration/build/CMakeLists.txt	2013-07-24 09:29:17 UTC (rev 953)
@@ -0,0 +1,106 @@
+project (JDEROBOT_REMOTECONFIGURATION)
+
+cmake_minimum_required(VERSION 2.8)
+
+# ENV VARS
+SET(gladedir ./)
+
+SET( INTERFACES_CPP_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../interfaces/cpp) # Directorio con las interfaces ICE en C++
+SET( LIBS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../libs) # Directorio donde se encuentran las librerias propias de jderobot
+SET( SLICE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../interfaces/slice) # Directorio donde se encuentran las interfaces ICE
+SET( LIBS_NEEDED jderobotutil ) # Librerias de las que depende el componente
+SET( DEPS_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../../Deps) # Directorio donde se encuentran las dependencias
+
+###################
+#                 #
+#  CHECK SYSTEM   #
+#                 #
+###################
+
+  # FIND & CHECK PRINCIPAL LIBRARIES
+
+include(FindPkgConfig)
+
+
+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(gtkglextmm REQUIRED gtkglextmm-1.2)
+include_directories(${gtkglextmm_INCLUDE_DIRS})
+link_directories(${gtkglextmm_LIBRARY_DIRS})
+
+PKG_CHECK_MODULES(gsl REQUIRED gsl)
+include_directories(${gsl_INCLUDE_DIRS})
+link_directories(${gsl_LIBRARIES_DIRS})
+
+# FIND AND CHECK OTHER DEPENDENCES
+include(${DEPS_DIR}/ice/CMakeLists.txt)
+include(${DEPS_DIR}/opencv/CMakeLists.txt)
+include(${DEPS_DIR}/opengl/CMakeLists.txt)
+include(${DEPS_DIR}/libxml++/CMakeLists.txt)
+
+# START RECURSIVE
+add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/../../.. ${CMAKE_CURRENT_SOURCE_DIR}/../../..)
+add_subdirectory (${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_SOURCE_DIR}/..)
+
+###################
+#                 #
+#    INSTALL      #
+#                 #
+###################
+
+# Install libraries
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/interfaces/cpp/jderobot/libJderobotInterfaces.so DESTINATION /usr/local/lib/jderobot)
+
+FOREACH(currentLibFile ${LIBS_NEEDED})
+    SET (new_lib "lib${currentLibFile}.so")
+    MESSAGE("${new_lib}")    
+    INSTALL (FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libs/${currentLibFile}/${new_lib} DESTINATION /usr/local/lib/jderobot)
+ENDFOREACH(currentLibFile)
+
+# Install libraries headers
+FILE(GLOB_RECURSE HEADERS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/libs/*.h)
+FOREACH(currentSourceFile ${HEADERS_FILES})
+    string(REGEX REPLACE ".*/(.*/).*.h" "\\1" new_source1 ${currentSourceFile})
+    INSTALL (FILES ${currentSourceFile} DESTINATION /usr/local/include/jderobot/${new_source1})
+ENDFOREACH(currentSourceFile)
+
+# Install Executables
+FILE(GLOB_RECURSE BIN_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../*cfg)
+    string(REGEX REPLACE ".*/(.*).cfg" "\\1" new_source1 ${BIN_FILES})
+INSTALL (FILES ../${new_source1}  DESTINATION /usr/local/bin PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE)
+
+# Install interfaces headers
+FILE(GLOB HEADER_INTERFACE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/interfaces/cpp/jderobot/*.h)
+INSTALL (FILES ${HEADER_INTERFACE_FILES} DESTINATION /usr/local/include/jderobot/jderobot)
+
+# Install slice
+FILE(GLOB SLICE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../../src/interfaces/slice/jderobot/*.ice)
+INSTALL (FILES ${SLICE_FILES} DESTINATION /usr/local/include/jderobot/slice)
+
+# Install CONF
+FILE(GLOB_RECURSE CONF_FILES  ${CMAKE_CURRENT_SOURCE_DIR}/../*cfg)
+INSTALL (FILES ${CONF_FILES} DESTINATION /usr/local/share/jderobot/conf)
+
+# Install Glade
+FILE(GLOB_RECURSE GLADE_FILES ${CMAKE_CURRENT_SOURCE_DIR}/../*.glade)
+INSTALL (FILES ${GLADE_FILES} DESTINATION /usr/local/share/jderobot/glade)
+
+###################
+#                 #
+#    UNINSTALL    #
+#                 #
+###################
+
+configure_file(
+    "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in"
+    "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
+    IMMEDIATE @ONLY)
+
+add_custom_target(uninstall
+    COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake)

Added: trunk/src/components/remoteConfiguration/build/cmake_uninstall.cmake.in
===================================================================
--- trunk/src/components/remoteConfiguration/build/cmake_uninstall.cmake.in	                        (rev 0)
+++ trunk/src/components/remoteConfiguration/build/cmake_uninstall.cmake.in	2013-07-24 09:29:17 UTC (rev 953)
@@ -0,0 +1,22 @@
+if (NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+    message(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
+endif(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
+
+file(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
+string(REGEX REPLACE "\n" ";" files "${files}")
+list(REVERSE files)
+foreach (file ${files})
+    message(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
+    if (EXISTS "$ENV{DESTDIR}${file}")
+        execute_process(
+            COMMAND @CMAKE_COMMAND@ -E remove "$ENV{DESTDIR}${file}"
+            OUTPUT_VARIABLE rm_out
+            RESULT_VARIABLE rm_retval
+        )
+        if(NOT ${rm_retval} EQUAL 0)
+            message(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
+        endif (NOT ${rm_retval} EQUAL 0)
+    else (EXISTS "$ENV{DESTDIR}${file}")
+        message(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
+    endif (EXISTS "$ENV{DESTDIR}${file}")
+endforeach(file)
\ No newline at end of file

Added: trunk/src/components/remoteConfiguration/build-independent/CMakeLists.txt
===================================================================
--- trunk/src/components/remoteConfiguration/build-independent/CMakeLists.txt	                        (rev 0)
+++ trunk/src/components/remoteConfiguration/build-independent/CMakeLists.txt	2013-07-24 09:29:17 UTC (rev 953)
@@ -0,0 +1,70 @@
+ cmake_minimum_required(VERSION 2.8)
+SET( SOURCE_FILES ../remoteConfiguration.cpp ../myparser.cpp)
+SET( LIBS_DIR /usr/local/lib/jderobot/)
+
+include_directories(
+	  /usr/local/include/jderobot
+)
+
+add_executable (remoteConfiguration  ${SOURCE_FILES})
+include(FindPkgConfig)
+#automated gsl
+PKG_CHECK_MODULES(gsl REQUIRED gsl)
+include_directories(${gsl_INCLUDE_DIRS})
+link_directories(${gsl_LIBRARY_DIRS})
+#automated libxml++
+PKG_CHECK_MODULES(libxmlpp REQUIRED libxml++-2.6)
+include_directories(${libxmlpp_INCLUDE_DIRS})
+link_directories(${libxmlpp_LIBRARY_DIRS})
+
+#automated gtk
+PKG_CHECK_MODULES(gtkmm REQUIRED gtkmm-2.4)
+include_directories(${gtkmm_INCLUDE_DIRS})
+link_directories(${gtkmm_LIBRARY_DIRS})
+#automated glademm
+PKG_CHECK_MODULES(libglademm REQUIRED libglademm-2.4)
+include_directories(${libglademm_INCLUDE_DIRS})
+link_directories(${libglademm_LIBRARY_DIRS})
+#automated gtkglextmm
+PKG_CHECK_MODULES(gtkglextmm REQUIRED gtkglextmm-x11-1.2)
+include_directories(${gtkglextmm_INCLUDE_DIRS})
+link_directories(${gtkglextmm_LIBRARY_DIRS})
+
+
+
+#manual ICE
+FIND_PATH( Ice_INCLUDE_DIR NAMES Ice/Ice.h  PATHS ENV C++LIB ENV)
+ 
+IF( Ice_INCLUDE_DIR )
+    FIND_LIBRARY( Ice_LIBRARY1 NAMES Ice PATHS ENV C++LIB ENV PATH PATH_SUFFIXES lib lib64 )
+    FIND_LIBRARY( Ice_LIBRARY2 NAMES IceUtil PATHS ENV C++LIB ENV PATH PATH_SUFFIXES lib lib64)
+    SET (Ice_LIBRARIES ${Ice_LIBRARY1} ${Ice_LIBRARY2})
+    IF( Ice_LIBRARIES )
+		MESSAGE ("-- Ice found at ${Ice_LIBRARIES}")
+		include_directories(${Ice_INCLUDE_DIR})
+		link_directories(${Ice_LIBRARIES})
+    ENDIF( Ice_LIBRARIES )
+ENDIF(Ice_INCLUDE_DIR)
+
+IF(NOT Ice_LIBRARIES)
+		MESSAGE ("*** Ice not found")
+ENDIF()
+
+
+
+
+set( CMAKE_CXX_FLAGS "-Wno-deprecated " ) # Opciones para el compilador
+
+
+
+
+TARGET_LINK_LIBRARIES(remoteConfiguration
+  ${gsl_LIBRARIES}
+  ${Ice_LIBRARIES}
+  ${libxmlpp_LIBRARIES}
+  ${gtkglextmm_LIBRARIES}
+  ${libglademm_LIBRARIES}
+  ${gtkmm_LIBRARIES}
+  ${LIBS_DIR}/libJderobotInterfaces.so
+  ${LIBS_DIR}/libjderobotutil.so
+)

Added: trunk/src/components/remoteConfiguration/myGUIconfig.xml
===================================================================
--- trunk/src/components/remoteConfiguration/myGUIconfig.xml	                        (rev 0)
+++ trunk/src/components/remoteConfiguration/myGUIconfig.xml	2013-07-24 09:29:17 UTC (rev 953)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<myComponent>
+	<Configuration>
+		<GUI_options>
+			<GUI_active>toggle</GUI_active>
+			<show_opengl>toggle</show_opengl>
+			<debug>toggle</debug>
+		</GUI_options>
+	</Configuration>
+	<Segmentation>
+		<filter>
+			<color>
+				<r>inputbox</r>
+				<g>inputbox</g>
+				<b>inputbox</b>
+			</color>	
+		</filter>
+	</Segmentation>	
+	<save>button</save>	
+</myComponent>

Added: trunk/src/components/remoteConfiguration/myparser.cpp
===================================================================
--- trunk/src/components/remoteConfiguration/myparser.cpp	                        (rev 0)
+++ trunk/src/components/remoteConfiguration/myparser.cpp	2013-07-24 09:29:17 UTC (rev 953)
@@ -0,0 +1,379 @@
+/*
+ *  Copyright (C) 1997-2012 JDE Developers Teameldercare.camRGB
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see http://www.gnu.org/licenses/.
+ *
+ *  Authors : Jose María Cañas <jmplaza en gsyc.es>
+			Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+			
+ */
+
+#include "myparser.h"
+#include <iostream>
+#include "libglademm.h"
+#include <iostream>
+#include <fstream>
+
+
+std::string typeInputBox="inputbox";
+std::string typeToggle="toggle";
+std::string typeButton="button";
+Gtk::Button *button;
+Gtk::HBox * w_main ;
+std::ofstream outFile("salida.xml"); 
+
+
+namespace eldercare{
+	myparser::myparser(jderobot::remoteConfigPrx configPrx, int id){
+		this->prx=configPrx;
+		this->id=id;
+	
+	}
+
+	myparser::~myparser(){
+	}
+
+
+
+void myparser::parse_sec_nodes(const xmlpp::Node* node, Gtk::VBox *parent)
+{
+  
+	const xmlpp::ContentNode* nodeContent = dynamic_cast<const xmlpp::ContentNode*>(node);
+	const xmlpp::TextNode* nodeText = dynamic_cast<const xmlpp::TextNode*>(node);
+	const xmlpp::CommentNode* nodeComment = dynamic_cast<const xmlpp::CommentNode*>(node);
+
+	if(nodeText && nodeText->is_white_space()) 
+    	return;
+    
+  	const Glib::ustring nodename = node->get_name();
+	//std::cout << nodename << std::endl;
+
+  	if(!nodeText && !nodeComment && !nodename.empty()) 
+  	{
+		const Glib::ustring namespace_prefix = node->get_namespace_prefix();
+		if(namespace_prefix.empty()){
+			xmlpp::Node::NodeList list = node->get_children();
+			//std::cout << "size: " << list.size() << std::endl;
+			if (list.size() > 1){
+				Gtk::VBox * w_temp = new Gtk::VBox();
+				w_temp->set_name(node->get_name());
+				parent->pack_start(*w_temp,true, true, 0);
+				Gtk::Label *label= new Gtk::Label(nodename.c_str());
+				w_temp->pack_start(*label,true, true, 0);
+				for(xmlpp::Node::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter)
+				{
+	  				parse_sec_nodes(*iter, w_temp); 
+				}
+				Gtk::HSeparator *w_Hseparator=new Gtk::HSeparator();
+				w_temp->pack_start(*w_Hseparator,true, true, 0);
+			}
+			else{
+				const xmlpp::TextNode* nodeTextValue = dynamic_cast<const xmlpp::TextNode*>(*((node)->get_children().begin()));
+				std::istringstream sTemp(nodeTextValue->get_content());
+				//std::cout << "test: " << sTemp.str() << std::endl;
+				if (typeInputBox.compare(sTemp.str().c_str()) == 0 ){
+					Gtk::HBox * hbox = new Gtk::HBox();
+					hbox->set_name(nodename.c_str());
+					parent->pack_start(*hbox,true, true, 0);
+					Gtk::Label *label= new Gtk::Label(nodename.c_str());
+					Gtk::VSeparator *w_Vseparator=new Gtk::VSeparator();
+					hbox->pack_start(*label,true, true, 0);
+					hbox->pack_start(*w_Vseparator,true, true, 0);
+					Gtk::Entry* entry = new Gtk::Entry();
+					hbox->pack_start(*entry,false, false, 0);
+				}
+				else if (typeToggle.compare(sTemp.str().c_str()) == 0 ){
+					Gtk::HBox * hbox = new Gtk::HBox();
+					hbox->set_name(nodename.c_str());
+					parent->pack_start(*hbox,true, true, 0);
+					Gtk::Label *label= new Gtk::Label(nodename.c_str());
+					Gtk::VSeparator *w_Vseparator=new Gtk::VSeparator();
+					hbox->pack_start(*label,true, true, 0);
+					hbox->pack_start(*w_Vseparator,true, true, 0);
+					Gtk::CheckButton*button = new Gtk::CheckButton("checka");
+					hbox->pack_start(*button,true, true, 0);
+				}
+				else if (typeButton.compare(sTemp.str().c_str()) == 0 ){
+					//std::cout << "_-------------------------------" << std::endl;
+					Gtk::HBox * hbox = new Gtk::HBox();
+					hbox->set_name(nodename.c_str());
+					parent->pack_start(*hbox,true, true, 0);
+					Gtk::Label *label= new Gtk::Label(nodename.c_str());
+					Gtk::VSeparator *w_Vseparator=new Gtk::VSeparator();
+					hbox->pack_start(*label,true, true, 0);
+					hbox->pack_start(*w_Vseparator,true, true, 0);
+					//Gtk::Button *button  //test para prueba acceso jerarquico
+					button = new Gtk::Button("save");
+					hbox->pack_start(*button,true, true, 0);
+				}
+				else{
+					//std::cout << "Invalid widget" << std::endl;
+				}
+			}
+		}
+    	else{
+    		//std::cout << "Node name = " << namespace_prefix << ":" << nodename << std::endl;
+		}
+  	}
+}
+
+
+
+
+void myparser::parse_ppal_nodes(const xmlpp::Node* node, Gtk::HBox *parent)
+{
+  
+	const xmlpp::ContentNode* nodeContent = dynamic_cast<const xmlpp::ContentNode*>(node);
+	const xmlpp::TextNode* nodeText = dynamic_cast<const xmlpp::TextNode*>(node);
+	const xmlpp::CommentNode* nodeComment = dynamic_cast<const xmlpp::CommentNode*>(node);
+
+	if(nodeText && nodeText->is_white_space()) 
+    	return;
+    
+  	const Glib::ustring nodename = node->get_name();
+	//std::cout << nodename << std::endl;
+
+  	if(!nodeText && !nodeComment && !nodename.empty()) 
+  	{
+		const Glib::ustring namespace_prefix = node->get_namespace_prefix();
+		if(namespace_prefix.empty()){
+			xmlpp::Node::NodeList list = node->get_children();
+			//std::cout << "size: " << list.size() << std::endl;
+			if (list.size() > 1){
+				Gtk::VBox * w_temp = new Gtk::VBox();
+				w_temp->set_name(node->get_name());
+				parent->pack_start(*w_temp,true, true, 0);
+				Gtk::Label *label= new Gtk::Label(nodename.c_str());
+				w_temp->pack_start(*label,true, true, 0);
+				for(xmlpp::Node::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter)
+				{
+	  				parse_sec_nodes(*iter, w_temp); 
+				}
+				Gtk::HSeparator *w_Hseparator=new Gtk::HSeparator();
+				w_temp->pack_start(*w_Hseparator,true, true, 0);
+			}
+			else{
+				const xmlpp::TextNode* nodeTextValue = dynamic_cast<const xmlpp::TextNode*>(*((node)->get_children().begin()));
+				std::istringstream sTemp(nodeTextValue->get_content());
+				//std::cout << "test: " << sTemp.str() << std::endl;
+				if (typeInputBox.compare(sTemp.str().c_str()) == 0 ){
+					Gtk::HBox * hbox = new Gtk::HBox();
+					hbox->set_name(nodename.c_str());
+					parent->pack_start(*hbox,true, true, 0);
+					Gtk::Label *label= new Gtk::Label(nodename.c_str());
+					Gtk::VSeparator *w_Vseparator=new Gtk::VSeparator();
+					hbox->pack_start(*label,true, true, 0);
+					hbox->pack_start(*w_Vseparator,true, true, 0);
+					Gtk::Entry* entry = new Gtk::Entry();
+					hbox->pack_start(*entry,false, false, 0);
+				}
+				else if (typeToggle.compare(sTemp.str().c_str()) == 0 ){
+					Gtk::HBox * hbox = new Gtk::HBox();
+					hbox->set_name(nodename.c_str());
+					parent->pack_start(*hbox,true, true, 0);
+					Gtk::Label *label= new Gtk::Label(nodename.c_str());
+					Gtk::VSeparator *w_Vseparator=new Gtk::VSeparator();
+					hbox->pack_start(*label,true, true, 0);
+					hbox->pack_start(*w_Vseparator,true, true, 0);
+					Gtk::CheckButton*button = new Gtk::CheckButton("checka");
+					hbox->pack_start(*button,true, true, 0);
+				}
+				else if (typeButton.compare(sTemp.str().c_str()) == 0 ){
+					//std::cout << "_-------------------------------" << std::endl;
+					Gtk::HBox * hbox = new Gtk::HBox();
+					hbox->set_name(nodename.c_str());
+					parent->pack_start(*hbox,true, true, 0);
+					Gtk::Label *label= new Gtk::Label(nodename.c_str());
+					Gtk::VSeparator *w_Vseparator=new Gtk::VSeparator();
+					hbox->pack_start(*label,true, true, 0);
+					hbox->pack_start(*w_Vseparator,true, true, 0);
+					//Gtk::Button *button  //test para prueba acceso jerarquico
+					button = new Gtk::Button("save");
+					hbox->pack_start(*button,true, true, 0);
+				}
+				else{
+					//std::cout << "Invalid widget" << std::endl;
+				}
+			}
+		}
+    	else{
+    		//std::cout << "Node name = " << namespace_prefix << ":" << nodename << std::endl;
+		}
+  	}
+}
+
+
+
+
+int myparser::parsePath(std::string filepath)
+{
+
+	/*	set_border_width(10);
+	Gtk::VBox * w_main = new Gtk::VBox();
+	Gtk::Button* m_button = new Gtk::Button("Hello World");
+	Gtk::ToggleButton *w_reconstruct = new Gtk::ToggleButton("test");
+	Gtk::HSeparator *w_Hseparator=new Gtk::HSeparator();
+
+
+  // When the button receives the "clicked" signal, it will call the
+  // on_button_clicked() method defined below.
+  	
+
+	add(*w_main);
+
+  // This packs the button into the Window (a container).
+  	//add(*m_button);
+	w_main->pack_start(*m_button,true, true, 0);
+	w_main->pack_start(*w_Hseparator,true, true, 0);
+	w_main->pack_start(*w_reconstruct,true, true, 0);
+
+	show_all_children();*/
+
+	
+	std::cout << "File to parse: " << filepath << std::endl;
+
+
+	w_main = new Gtk::HBox();
+	//w_main->set_name("main");
+	add(*w_main);
+  
+	#ifdef LIBXMLCPP_EXCEPTIONS_ENABLED
+	try
+	{
+  		#endif //LIBXMLCPP_EXCEPTIONS_ENABLED 	
+
+
+		xmlpp::DomParser parser;
+    	parser.set_substitute_entities();
+    	parser.parse_file(filepath);
+    	if(parser)
+    	{
+      		const xmlpp::Node* pNode = parser.get_document()->get_root_node(); 
+			set_title(pNode->get_name().c_str());
+			w_main->set_name(pNode->get_name().c_str());
+
+			xmlpp::Node::NodeList list = pNode->get_children();
+			
+			for(xmlpp::Node::NodeList::iterator iter = list.begin(); iter != list.end(); ++iter)
+			{
+  				parse_ppal_nodes(*iter, w_main); 
+			}
+   	 	}
+	#ifdef LIBXMLCPP_EXCEPTIONS_ENABLED
+  	}
+  	catch(const std::exception& ex)
+  	{
+    	std::cout << "Exception caught: " << ex.what() << std::endl;
+  	}
+  	#endif //LIBXMLCPP_EXCEPTIONS_ENABLED 
+
+	show_all_children();
+
+
+	std::cout <<  get_is_toplevel () << std::endl;
+	std::cout <<  w_main->get_is_toplevel () << std::endl;
+
+	button->signal_clicked().connect(sigc::mem_fun(this,&myparser::testF));
+
+
+  	return 0;
+}
+
+int
+myparser::imprime(Gtk::Container* w, int tab){
+	Gtk::VBox compType; 
+	std::string no1="gtkmm__GtkLabel";
+	std::string no2="gtkmm__GtkVSeparator";
+	std::string no3="GtkLabel";
+	std::string no4="gtkmm__GtkHSeparator";
+	/*std::string no2="";
+	std::string no2="";
+	std::string no2="";*/
+	std::string checkString="gtkmm__GtkCheckButton";
+	std::string entryString="gtkmm__GtkEntry";
+ 	std::string saveString="save";
+
+	
+	std::vector< Gtk::Widget*> ninos=w->get_children();
+	for(std::vector< Gtk::Widget*>::iterator iter = ninos.begin(); iter != ninos.end(); ++iter)
+	{
+		if ((no1.compare((*iter)->get_name())) == 0 ){
+			//std::cout << std::endl;
+			continue;
+		}
+		else if ((no2.compare((*iter)->get_name())) == 0 ){
+			//std::cout << std::endl;
+			continue;
+		}
+		else if ((no3.compare((*iter)->get_name())) == 0 ){
+			//std::cout << std::endl;
+			continue;
+		}
+		else if ((no4.compare((*iter)->get_name())) == 0 ){
+			//std::cout << std::endl;
+			continue;
+		}
+		else if ((saveString.compare((*iter)->get_name())) == 0 ){
+			//std::cout << std::endl;
+			continue;
+		}
+		else if (((checkString.compare((*iter)->get_name())) == 0 )){
+			if (((Gtk::CheckButton*)(*iter))->get_active())
+				outFile << "1";					
+			else
+				outFile << "0";
+			return 0;
+		}
+		else if (((entryString.compare((*iter)->get_name())) == 0 )){
+			outFile << ((Gtk::Entry*)(*iter))->get_buffer()->get_text();
+			return 0;
+		}
+		else{
+			outFile << std::endl;
+
+			for (int i=0;  i< tab; i++)
+				outFile << "\t";
+			outFile << "<" <<  (*iter)->get_name() << ">";
+			if (imprime((Gtk::Container*)(*iter),tab+1)){
+				for (int i=0;  i< tab; i++)
+				outFile << "\t";
+			}
+
+			outFile << "</" <<  (*iter)->get_name() << ">"; //<< std::endl;
+		}
+	}
+	outFile << std::endl;
+	return 1;
+}
+
+
+void
+myparser::testF(){
+	//std::cout << "check" << std::endl;
+	outFile << "<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>" << std::endl;
+	outFile << "<" << w_main->get_name() << ">";
+	imprime(w_main,1);
+	outFile << "</" << w_main->get_name() << ">" << std::endl;
+	outFile.close();
+	char line[255];
+	std::ifstream fileTest("out.xml");
+	while(!fileTest.eof()){
+		fileTest.getline(line, 255);
+		std::cout << line << std::endl;
+		this->prx->write(line,id);
+	}
+	this->prx->setConfiguration(id);
+}
+
+} //namespace

Added: trunk/src/components/remoteConfiguration/myparser.h
===================================================================
--- trunk/src/components/remoteConfiguration/myparser.h	                        (rev 0)
+++ trunk/src/components/remoteConfiguration/myparser.h	2013-07-24 09:29:17 UTC (rev 953)
@@ -0,0 +1,72 @@
+/*
+ *  Copyright (C) 1997-2012 JDE Developers Teameldercare.camRGB
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see http://www.gnu.org/licenses/.
+ *
+ *  Authors : Jose María Cañas <jmplaza en gsyc.es>
+			Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+			
+ */
+#ifndef eldercare_XMLPARSER_H
+#define eldercare_XMLPARSER_H
+
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <libxml++/libxml++.h>
+#include <iostream>
+#include <gtkmm.h>
+#include <gtkmm/button.h>
+#include <gtkmm/window.h>
+#include <jderobot/remoteConfig.h>
+
+
+
+namespace eldercare{
+	class myparser: public Gtk::Window{
+		public:
+			myparser(jderobot::remoteConfigPrx configPrx, int id);
+			virtual ~myparser();
+			int parsePath(std::string filepath);
+			int xmlBuild(std::string path);
+
+		private:
+
+			//callbacks
+			void parse_sec_nodes(const xmlpp::Node* node, Gtk::VBox *parent);
+			void parse_ppal_nodes(const xmlpp::Node* node, Gtk::HBox *parent);
+			void alarmsParser(const xmlpp::Node* node);
+			void guiParser(const xmlpp::Node* node);
+
+			//alarms callbacks
+			void configParser(const xmlpp::Node* node);
+			void alarmVolumeParser(const xmlpp::Node* node);
+			void alarmPositionParser(const xmlpp::Node* node);
+			void alarmPresenceParser(const xmlpp::Node* node);
+			void alarmFallParser(const xmlpp::Node* node);
+			void testF();
+			int imprime(Gtk::Container* w, int tab);
+
+			//prx
+			jderobot::remoteConfigPrx prx;
+			int id;
+		
+	};
+
+
+
+} //namespace
+#endif

Added: trunk/src/components/remoteConfiguration/remoteConfiguration.cfg
===================================================================
--- trunk/src/components/remoteConfiguration/remoteConfiguration.cfg	                        (rev 0)
+++ trunk/src/components/remoteConfiguration/remoteConfiguration.cfg	2013-07-24 09:29:17 UTC (rev 953)
@@ -0,0 +1,2 @@
+remoteConfiguration.Path=myGUIconfig.xml
+remoteConfiguration.Proxy=remoteConfiguration1:tcp -h 127.0.0.1 -p 9997

Added: trunk/src/components/remoteConfiguration/remoteConfiguration.cpp
===================================================================
--- trunk/src/components/remoteConfiguration/remoteConfiguration.cpp	                        (rev 0)
+++ trunk/src/components/remoteConfiguration/remoteConfiguration.cpp	2013-07-24 09:29:17 UTC (rev 953)
@@ -0,0 +1,138 @@
+/*
+ *  Copyright (C) 1997-2012 JDE Developers Teameldercare.camRGB
+ *
+ *  This program is free software: you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation, either version 3 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program.  If not, see http://www.gnu.org/licenses/.
+ *
+ *  Authors : Jose María Cañas <jmplaza en gsyc.es>
+			Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>
+			
+ */
+
+/** \file remoteConfiguration.cpp
+ * \brief remoteConfiguration component master file
+ */
+
+
+#include <iostream>
+#include <Ice/Ice.h>
+#include <IceUtil/IceUtil.h>
+#include <jderobot/remoteConfig.h>
+#include <gtkmm.h>
+#include <libglademm.h>
+#include <gtkmm/main.h>
+#include "myparser.h"
+
+
+
+void *gui_thread(void* arg){
+
+	try{
+		while(1){
+				//eldercaregui_ptx->update();
+			usleep(100);
+		}
+	
+	}catch (const Ice::Exception& ex) {
+		std::cerr << ex << std::endl;
+	}
+	catch (const char* msg) {
+		std::cerr << msg << std::endl;
+	}
+	pthread_exit(NULL);
+}
+
+
+
+
+
+
+/**
+ * \brief Main program function code
+ */
+int main(int argc, char** argv){
+
+	int status,i;
+	Ice::CommunicatorPtr ic;
+	int n_components=0;
+	Ice::PropertiesPtr prop;
+	std::string path;
+	jderobot::remoteConfigPrx configPrx;
+
+	try{
+		ic = Ice::initialize(argc,argv);
+		prop = ic->getProperties();
+	}catch (const Ice::Exception& ex) {
+		std::cerr << ex << std::endl;
+		return 1;
+	}
+	catch (const char* msg) {
+		std::cerr <<"Error :" << msg << std::endl;
+		return 1;
+	}
+	path=prop->getProperty("remoteConfiguration.Path");
+	try{
+		Ice::ObjectPrx baseConfig= ic->propertyToProxy("remoteConfiguration.Proxy");
+		if (0==baseConfig){
+			throw "remoteConfiguration: Could not create proxy with remoteConfiguration";
+		}
+		else {
+			configPrx= jderobot::remoteConfigPrx::checkedCast(baseConfig);
+			if (0==configPrx)
+				throw "Invalid proxy eldercare.remoteConfiguration.Proxy";
+		}
+	}
+	catch (const Ice::Exception& ex) {
+		std::cerr << ex << std::endl;
+		status = 1;
+	}
+	catch (const char* msg) {
+		std::cerr << msg << std::endl;
+		std::cout << "remoteConfigturation: Not remoteConfiguration provided" << std::endl;
+		status = 1;
+	}
+
+	int id=configPrx->initConfiguration();
+	std::cout << "id: " << id << std::endl;
+	/*configPrx->write("hola mundo",id);
+	configPrx->setConfiguration(id);
+	*/
+
+	pthread_t thread_gui;
+	pthread_attr_t attr;
+
+	pthread_attr_init(&attr);
+	pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_JOINABLE);
+
+	pthread_create(&thread_gui, &attr, gui_thread,NULL);
+
+
+	//Gtk::Window mainwindow;
+	//mainwindow.show();
+
+	Gtk::Main kit(argc, argv);
+
+ 	//MyWindow myw;
+	eldercare::myparser myp(configPrx, id);
+	myp.parsePath(path);
+  	//Shows the window and returns when it is closed.
+  	Gtk::Main::run(myp);
+
+
+	pthread_join(thread_gui, NULL);
+		
+
+	if (ic)
+		ic->destroy();
+	return status;
+}

Modified: trunk/src/interfaces/slice/jderobot/body.ice
===================================================================
--- trunk/src/interfaces/slice/jderobot/body.ice	2013-07-24 08:35:13 UTC (rev 952)
+++ trunk/src/interfaces/slice/jderobot/body.ice	2013-07-24 09:29:17 UTC (rev 953)
@@ -15,7 +15,7 @@
  *  along with this program.  If not, see http://www.gnu.org/licenses/.
  *
  *  Authors : Jose María Cañas <jmplaza en gsyc.es>
- *            Francisco Miguel Rivas Montero <fm.rivas en alumnos.urjc.es>	
+ *            Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>	
  */
 
 #ifndef BODY_ICE

Modified: trunk/src/interfaces/slice/jderobot/bodyencoders.ice
===================================================================
--- trunk/src/interfaces/slice/jderobot/bodyencoders.ice	2013-07-24 08:35:13 UTC (rev 952)
+++ trunk/src/interfaces/slice/jderobot/bodyencoders.ice	2013-07-24 09:29:17 UTC (rev 953)
@@ -15,7 +15,7 @@
  *  along with this program.  If not, see http://www.gnu.org/licenses/.
  *
  *  Authors : Jose María Cañas <jmplaza en gsyc.es>
- *            Francisco Miguel Rivas Montero <fm.rivas en alumnos.urjc.es>	
+ *            Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>	
  */
 
 #ifndef BODYENCODERS_ICE

Modified: trunk/src/interfaces/slice/jderobot/bodymotors.ice
===================================================================
--- trunk/src/interfaces/slice/jderobot/bodymotors.ice	2013-07-24 08:35:13 UTC (rev 952)
+++ trunk/src/interfaces/slice/jderobot/bodymotors.ice	2013-07-24 09:29:17 UTC (rev 953)
@@ -15,7 +15,7 @@
  *  along with this program.  If not, see http://www.gnu.org/licenses/.
  *
  *  Authors : Jose María Cañas <jmplaza en gsyc.es>
- *            Francisco Miguel Rivas Montero <fm.rivas en alumnos.urjc.es>	
+ *            Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>	
  */
 
 #ifndef BODYMOTORS_ICE

Modified: trunk/src/interfaces/slice/jderobot/bodymovements.ice
===================================================================
--- trunk/src/interfaces/slice/jderobot/bodymovements.ice	2013-07-24 08:35:13 UTC (rev 952)
+++ trunk/src/interfaces/slice/jderobot/bodymovements.ice	2013-07-24 09:29:17 UTC (rev 953)
@@ -15,7 +15,7 @@
  *  along with this program.  If not, see http://www.gnu.org/licenses/.
  *
  *  Authors : Jose María Cañas <jmplaza en gsyc.es>
- *            Francisco Miguel Rivas Montero <fm.rivas en alumnos.urjc.es>	
+ *            Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>	
  */
 
 #ifndef BODYMOVEMENTS_ICE

Modified: trunk/src/interfaces/slice/jderobot/motors.ice
===================================================================
--- trunk/src/interfaces/slice/jderobot/motors.ice	2013-07-24 08:35:13 UTC (rev 952)
+++ trunk/src/interfaces/slice/jderobot/motors.ice	2013-07-24 09:29:17 UTC (rev 953)
@@ -15,7 +15,7 @@
  *  along with this program.  If not, see http://www.gnu.org/licenses/.
  *
  *  Authors : Jose María Cañas <jmplaza en gsyc.es>
- *            Francisco Miguel Rivas Montero <fm.rivas en alumnos.urjc.es>	
+ *            Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>	
  *  		 Javier Vazquez Pereda <javiervarper en yahoo.es>
  */
 

Modified: trunk/src/interfaces/slice/jderobot/ptencoders.ice
===================================================================
--- trunk/src/interfaces/slice/jderobot/ptencoders.ice	2013-07-24 08:35:13 UTC (rev 952)
+++ trunk/src/interfaces/slice/jderobot/ptencoders.ice	2013-07-24 09:29:17 UTC (rev 953)
@@ -15,7 +15,7 @@
  *  along with this program.  If not, see http://www.gnu.org/licenses/.
  *
  *  Authors : Jose María Cañas <jmplaza en gsyc.es>
- *            Francisco Miguel Rivas Montero <fm.rivas en alumnos.urjc.es>	
+ *            Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>	
  *  		 Javier Vazquez Pereda <javiervarper en yahoo.es>
  */
 

Modified: trunk/src/interfaces/slice/jderobot/ptmotors.ice
===================================================================
--- trunk/src/interfaces/slice/jderobot/ptmotors.ice	2013-07-24 08:35:13 UTC (rev 952)
+++ trunk/src/interfaces/slice/jderobot/ptmotors.ice	2013-07-24 09:29:17 UTC (rev 953)
@@ -15,7 +15,7 @@
  *  along with this program.  If not, see http://www.gnu.org/licenses/.
  *
  *  Authors : Jose María Cañas <jmplaza en gsyc.es>
- *            Francisco Miguel Rivas Montero <fm.rivas en alumnos.urjc.es>	
+ *            Francisco Miguel Rivas Montero <franciscomiguel.rivas en urjc.es>	
  *  		 Javier Vazquez Pereda <javiervarper en yahoo.es>
  */
 



More information about the Jderobot-admin mailing list