Skip to content
Snippets Groups Projects
Commit e29a3ba2 authored by Joseph Mirabel's avatar Joseph Mirabel Committed by Joseph Mirabel
Browse files

Add GraphicalInterface::getWindowID.

parent 7e0bb44d
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,7 @@ typedef double Color [4]; ...@@ -36,6 +36,7 @@ typedef double Color [4];
/// \param input name : name of the new window. /// \param input name : name of the new window.
/// return the ID of the newly create window. /// return the ID of the newly create window.
unsigned long createWindow(in string name) raises (Error); unsigned long createWindow(in string name) raises (Error);
unsigned long getWindowID (in string name) raises (Error);
/// Print names of nodes on the SceneViewer-corbaserver terminal. /// Print names of nodes on the SceneViewer-corbaserver terminal.
......
...@@ -180,6 +180,7 @@ namespace graphics { ...@@ -180,6 +180,7 @@ namespace graphics {
std::string windowName (windowNameCorba); std::string windowName (windowNameCorba);
WindowManagerPtr_t newWindow = WindowManager::create (); WindowManagerPtr_t newWindow = WindowManager::create ();
WindowID windowId = windowManagers_.size (); WindowID windowId = windowManagers_.size ();
windowIDmap_ [windowNameCorba] = windowId;
windowManagers_.push_back (newWindow); windowManagers_.push_back (newWindow);
boost::thread refreshThread (boost::bind boost::thread refreshThread (boost::bind
(&GraphicalInterface::threadRefreshing, (&GraphicalInterface::threadRefreshing,
...@@ -190,6 +191,20 @@ namespace graphics { ...@@ -190,6 +191,20 @@ namespace graphics {
} }
} }
GraphicalInterface::WindowID GraphicalInterface::getWindowID (const char* windowNameCorba)
throw (Error)
{
try {
std::string windowName (windowNameCorba);
WindowIDMap_t::iterator it = windowIDmap_.find (windowName);
if (it == windowIDmap_.end ())
throw Error ("There is no windows with that name");
return it->second;
} catch (const std::exception& exc) {
throw Error (exc.what ());
}
}
void GraphicalInterface::refresh () throw (Error) void GraphicalInterface::refresh () throw (Error)
{ {
try { try {
......
...@@ -49,7 +49,9 @@ private: ...@@ -49,7 +49,9 @@ private:
typedef gepetto::Error Error; typedef gepetto::Error Error;
typedef CORBA::ULong WindowID; typedef CORBA::ULong WindowID;
typedef std::vector <WindowManagerPtr_t> WindowManagers_t; typedef std::vector <WindowManagerPtr_t> WindowManagers_t;
typedef std::map <std::string, WindowID> WindowIDMap_t;
WindowManagers_t windowManagers_; WindowManagers_t windowManagers_;
WindowIDMap_t windowIDmap_;
std::map<std::string, NodePtr_t> nodes_; std::map<std::string, NodePtr_t> nodes_;
std::map<std::string, GroupNodePtr_t> groupNodes_; std::map<std::string, GroupNodePtr_t> groupNodes_;
corbaServer::Server* server_; corbaServer::Server* server_;
...@@ -85,6 +87,7 @@ public: ...@@ -85,6 +87,7 @@ public:
virtual void refresh() throw (Error); virtual void refresh() throw (Error);
virtual WindowID createWindow(const char* windowNameCorba) throw (Error); virtual WindowID createWindow(const char* windowNameCorba) throw (Error);
virtual WindowID getWindowID (const char* windowNameCorba) throw (Error);
virtual void createScene(const char* sceneNameCorba) throw (Error); virtual void createScene(const char* sceneNameCorba) throw (Error);
virtual void createSceneWithFloor(const char* sceneNameCorba) throw (Error); virtual void createSceneWithFloor(const char* sceneNameCorba) throw (Error);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment