|
From: <jfa...@us...> - 2008-11-07 18:32:43
|
Revision: 6382
http://personalrobots.svn.sourceforge.net/personalrobots/?rev=6382&view=rev
Author: jfaustwg
Date: 2008-11-07 18:32:40 +0000 (Fri, 07 Nov 2008)
Log Message:
-----------
r11742@iad: jfaust | 2008-11-06 16:57:36 -0800
First pass at renaming "visualizer" to "display" to make the code terminology the same as the UI/docs
Added Paths:
-----------
pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/display.cpp
pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/display.h
pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/display.i
pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/displays/
Removed Paths:
-------------
pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.cpp
pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.h
pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.i
pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizers/
Property Changed:
----------------
pkg/trunk/
Property changes on: pkg/trunk
___________________________________________________________________
Modified: svk:merge
- 920d6130-5740-4ec1-bb1a-45963d5fd813:/frameidpr:7015
920d6130-5740-4ec1-bb1a-45963d5fd813:/users/josh-pr:11741
920d6130-5740-4ec1-bb1a-45963d5fd813:/wgpkgtrunk:5865
f5854215-dd47-0410-b2c4-cdd35faa7885:/pkg/branches/rosbus:261
+ 920d6130-5740-4ec1-bb1a-45963d5fd813:/frameidpr:7015
920d6130-5740-4ec1-bb1a-45963d5fd813:/users/josh-pr:11742
920d6130-5740-4ec1-bb1a-45963d5fd813:/wgpkgtrunk:5865
f5854215-dd47-0410-b2c4-cdd35faa7885:/pkg/branches/rosbus:261
Copied: pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/display.cpp (from rev 6082, pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.cpp)
===================================================================
--- pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/display.cpp (rev 0)
+++ pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/display.cpp 2008-11-07 18:32:40 UTC (rev 6382)
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2008, Willow Garage, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Willow Garage, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "visualizer_base.h"
+#include "visualization_manager.h"
+#include "properties/property_manager.h"
+#include "properties/property.h"
+
+namespace ogre_vis
+{
+
+VisualizerBase::VisualizerBase( const std::string& name, VisualizationManager* manager )
+: vis_manager_( manager )
+, scene_manager_( manager->getSceneManager() )
+, name_( name )
+, enabled_( false )
+, target_frame_( "base" )
+, ros_node_( manager->getROSNode() )
+, tf_( manager->getTFClient() )
+, property_prefix_( name_ + "." )
+, property_manager_( NULL )
+, parent_category_( NULL )
+{
+}
+
+VisualizerBase::~VisualizerBase()
+{
+ if ( property_manager_ )
+ {
+ property_manager_->deleteByUserData( this );
+ }
+}
+
+void VisualizerBase::enable( bool force )
+{
+ if ( enabled_ && !force )
+ {
+ return;
+ }
+
+ enabled_ = true;
+
+ onEnable();
+}
+
+void VisualizerBase::disable( bool force )
+{
+ if ( !enabled_ && !force )
+ {
+ return;
+ }
+
+ enabled_ = false;
+
+ onDisable();
+}
+
+void VisualizerBase::setRenderCallback( boost::function<void ()> func )
+{
+ render_callback_ = func;
+}
+
+void VisualizerBase::setLockRenderCallback( boost::function<void ()> func )
+{
+ render_lock_ = func;
+}
+
+void VisualizerBase::setUnlockRenderCallback( boost::function<void ()> func )
+{
+ render_unlock_ = func;
+}
+
+
+void VisualizerBase::causeRender()
+{
+ if ( render_callback_ )
+ {
+ render_callback_();
+ }
+}
+
+void VisualizerBase::lockRender()
+{
+ if ( render_lock_ )
+ {
+ render_lock_();
+ }
+}
+
+void VisualizerBase::unlockRender()
+{
+ if ( render_unlock_ )
+ {
+ render_unlock_();
+ }
+}
+
+void VisualizerBase::setTargetFrame( const std::string& frame )
+{
+ target_frame_ = frame;
+
+ if ( isEnabled() )
+ {
+ targetFrameChanged();
+ }
+}
+
+void VisualizerBase::setFixedFrame( const std::string& frame )
+{
+ fixed_frame_ = frame;
+
+ if ( isEnabled() )
+ {
+ fixedFrameChanged();
+ }
+}
+
+void VisualizerBase::setPropertyManager( PropertyManager* manager, CategoryProperty* parent )
+{
+ property_manager_ = manager;
+ parent_category_ = parent;
+
+ property_manager_->createProperty<BoolProperty>( "Enabled", property_prefix_, boost::bind( &VisualizerBase::isEnabled, this ),
+ boost::bind( &VisualizationManager::setVisualizerEnabled, vis_manager_, this, _1 ), parent, this );
+
+ createProperties();
+}
+
+} // namespace ogre_vis
Copied: pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/display.h (from rev 6082, pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.h)
===================================================================
--- pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/display.h (rev 0)
+++ pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/display.h 2008-11-07 18:32:40 UTC (rev 6382)
@@ -0,0 +1,236 @@
+/*
+ * Copyright (c) 2008, Willow Garage, Inc.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * * Neither the name of the Willow Garage, Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ * POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef OGRE_VISUALIZER_VISUALIZER_BASE
+#define OGRE_VISUALIZER_VISUALIZER_BASE
+
+#include <string>
+#include <boost/function.hpp>
+
+#include <wx/string.h>
+
+namespace Ogre
+{
+class SceneManager;
+class MovableObject;
+}
+
+namespace ros
+{
+class node;
+}
+
+namespace tf
+{
+class TransformListener;
+}
+
+class wxPanel;
+class wxWindow;
+class wxPropertyGrid;
+class wxPropertyGridEvent;
+class wxPGProperty;
+class wxConfigBase;
+class wxString;
+
+namespace ogre_vis
+{
+
+class PropertyManager;
+class CategoryProperty;
+class BoolProperty;
+
+class VisualizationManager;
+
+/**
+ * \class VisualizerBase
+ * \brief Abstract base class for all visualizers.
+ *
+ * Provides a common interface for the visualization panel to interact with,
+ * so that new visualizers can be added without the visualization panel knowing anything about them.
+ */
+class VisualizerBase
+{
+public:
+ VisualizerBase( const std::string& name, VisualizationManager* manager );
+ virtual ~VisualizerBase();
+
+ /**
+ * \brief Enable this visualizer
+ * @param force If false, does not re-enable if this visualizer is already enabled. If true, it does.
+ */
+ void enable( bool force = false );
+ /**
+ * \brief Disable this visualizer
+ * @param force If false, does not re-disable if this visualizer is already disabled. If true, it does.
+ */
+ void disable( bool force = false );
+
+ bool isEnabled() { return enabled_; }
+ const std::string& getName() { return name_; }
+
+ /**
+ * \brief Called periodically by the visualization panel
+ * @param dt Time, in seconds, since the last time the update list was run through.
+ */
+ virtual void update( float dt ) {}
+
+ ///
+ /**
+ * \brief Set the callback used for causing a render to happen
+ * @param func a void(void) function that will cause a render to happen from the correct thread
+ */
+ void setRenderCallback( boost::function<void ()> func );
+
+ /// Set the callback used to lock the renderer
+ void setLockRenderCallback( boost::function<void ()> func );
+ /// Set the callback used to unlock the renderer
+ void setUnlockRenderCallback( boost::function<void ()> func );
+
+ /**
+ * \brief Sets the property manager and parent category for this visualizer
+ * @param manager The property manager
+ * @param parent The parent category
+ */
+ void setPropertyManager( PropertyManager* manager, CategoryProperty* parent );
+
+ /**
+ * \brief Called from setPropertyManager, gives the visualizer a chance to create some properties immediately.
+ *
+ * Once this function is called, the property_manager_ member is valid and will stay valid
+ */
+ virtual void createProperties() {}
+
+ /// Set the target frame of this visualizer. This is a frame id which should match something being broadcast through TF.
+ void setTargetFrame( const std::string& frame );
+
+ /**
+ * \brief Called from within setTargetFrame, notifying child classes that the target frame has changed
+ */
+ virtual void targetFrameChanged() = 0;
+
+ /**
+ * \brief Set the fixed frame of this visualizer. This is a frame id which should generally be the top-level frame being broadcast through TF
+ * @param frame The fixed frame
+ */
+ void setFixedFrame( const std::string& frame );
+
+ /**
+ * \brief Called from within setFixedFrame, notifying child classes that the fixed frame has changed
+ */
+ virtual void fixedFrameChanged() = 0;
+
+ /**
+ * \brief Returns whether an object owned by this visualizer is pickable/mouse selectable
+ * @param object The Ogre::MovableObject to check
+ */
+ virtual bool isObjectPickable( const Ogre::MovableObject* object ) const { return false; }
+
+ /**
+ * \brief Returns the type name of this visualizer. Does not need to be exactly the same as the class name. Can contains spaces/punctuation, etc.
+ * @return The type name
+ */
+ virtual const char* getType() = 0;
+
+ /**
+ * \brief Called to tell the visualizer to clear its state
+ */
+ virtual void reset() {}
+
+protected:
+ /// Derived classes override this to do the actual work of enabling themselves
+ virtual void onEnable() = 0;
+ /// Derived classes override this to do the actual work of disabling themselves
+ virtual void onDisable() = 0;
+
+ ///
+ /**
+ * \brief Cause the scene we're in to be rendered.
+ * \note This does not immediately cause a render -- instead, one is queued and happens next run through the event loop.
+ */
+ void causeRender();
+
+ /// Lock the renderer
+ void lockRender();
+ /// Unlock the renderer
+ void unlockRender();
+
+ VisualizationManager* vis_manager_;
+
+ Ogre::SceneManager* scene_manager_; ///< The scene manager we're associated with
+ std::string name_; ///< The name of this visualizer
+ bool enabled_; ///< Are we enabled?
+
+ std::string target_frame_; ///< The frame we should transform all periodically-updated data into
+ std::string fixed_frame_; ///< The frame we should transform all fixed data into
+
+ boost::function<void ()> render_callback_; ///< Render callback
+ boost::function<void ()> render_lock_; ///< Render lock callback
+ boost::function<void ()> render_unlock_; ///< Render unlock callback
+
+ ros::node* ros_node_; ///< ros node
+ tf::TransformListener* tf_; ///< tf client
+
+ std::string property_prefix_; ///< Prefix to prepend to our properties
+
+ PropertyManager* property_manager_; ///< The property manager to use to create properties
+ CategoryProperty* parent_category_; ///< The parent category to use when creating properties
+ BoolProperty* enabled_property_;
+
+ friend class RenderAutoLock;
+};
+
+/**
+ * \class RenderAutoLock
+ * \brief A scoped lock on the renderer
+ *
+ * Constructor calls VisualizerBase::lockRender<br>
+ * Destructor calls VisualizerBase::unlockRender
+ */
+class RenderAutoLock
+{
+public:
+ RenderAutoLock( VisualizerBase* visualizer )
+ : visualizer_( visualizer )
+ {
+ visualizer_->lockRender();
+ }
+
+ ~RenderAutoLock()
+ {
+ visualizer_->unlockRender();
+ }
+
+private:
+ VisualizerBase* visualizer_;
+};
+
+} // namespace ogre_vis
+
+#endif
Copied: pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/display.i (from rev 6082, pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.i)
===================================================================
--- pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/display.i (rev 0)
+++ pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/display.i 2008-11-07 18:32:40 UTC (rev 6382)
@@ -0,0 +1,19 @@
+%{
+#include "visualizer_base.h"
+%}
+
+%include typemaps.i
+%include my_typemaps.i
+
+%import core.i
+%import windows.i
+
+%pythonAppend VisualizerBase "self._setOORInfo(self)"
+
+%include "visualizer_base.h"
+
+%init %{
+
+%}
+
+
Deleted: pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.cpp
===================================================================
--- pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.cpp 2008-11-07 18:31:21 UTC (rev 6381)
+++ pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.cpp 2008-11-07 18:32:40 UTC (rev 6382)
@@ -1,155 +0,0 @@
-/*
- * Copyright (c) 2008, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "visualizer_base.h"
-#include "visualization_manager.h"
-#include "properties/property_manager.h"
-#include "properties/property.h"
-
-namespace ogre_vis
-{
-
-VisualizerBase::VisualizerBase( const std::string& name, VisualizationManager* manager )
-: vis_manager_( manager )
-, scene_manager_( manager->getSceneManager() )
-, name_( name )
-, enabled_( false )
-, target_frame_( "base" )
-, ros_node_( manager->getROSNode() )
-, tf_( manager->getTFClient() )
-, property_prefix_( name_ + "." )
-, property_manager_( NULL )
-, parent_category_( NULL )
-{
-}
-
-VisualizerBase::~VisualizerBase()
-{
- if ( property_manager_ )
- {
- property_manager_->deleteByUserData( this );
- }
-}
-
-void VisualizerBase::enable( bool force )
-{
- if ( enabled_ && !force )
- {
- return;
- }
-
- enabled_ = true;
-
- onEnable();
-}
-
-void VisualizerBase::disable( bool force )
-{
- if ( !enabled_ && !force )
- {
- return;
- }
-
- enabled_ = false;
-
- onDisable();
-}
-
-void VisualizerBase::setRenderCallback( boost::function<void ()> func )
-{
- render_callback_ = func;
-}
-
-void VisualizerBase::setLockRenderCallback( boost::function<void ()> func )
-{
- render_lock_ = func;
-}
-
-void VisualizerBase::setUnlockRenderCallback( boost::function<void ()> func )
-{
- render_unlock_ = func;
-}
-
-
-void VisualizerBase::causeRender()
-{
- if ( render_callback_ )
- {
- render_callback_();
- }
-}
-
-void VisualizerBase::lockRender()
-{
- if ( render_lock_ )
- {
- render_lock_();
- }
-}
-
-void VisualizerBase::unlockRender()
-{
- if ( render_unlock_ )
- {
- render_unlock_();
- }
-}
-
-void VisualizerBase::setTargetFrame( const std::string& frame )
-{
- target_frame_ = frame;
-
- if ( isEnabled() )
- {
- targetFrameChanged();
- }
-}
-
-void VisualizerBase::setFixedFrame( const std::string& frame )
-{
- fixed_frame_ = frame;
-
- if ( isEnabled() )
- {
- fixedFrameChanged();
- }
-}
-
-void VisualizerBase::setPropertyManager( PropertyManager* manager, CategoryProperty* parent )
-{
- property_manager_ = manager;
- parent_category_ = parent;
-
- property_manager_->createProperty<BoolProperty>( "Enabled", property_prefix_, boost::bind( &VisualizerBase::isEnabled, this ),
- boost::bind( &VisualizationManager::setVisualizerEnabled, vis_manager_, this, _1 ), parent, this );
-
- createProperties();
-}
-
-} // namespace ogre_vis
Deleted: pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.h
===================================================================
--- pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.h 2008-11-07 18:31:21 UTC (rev 6381)
+++ pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.h 2008-11-07 18:32:40 UTC (rev 6382)
@@ -1,236 +0,0 @@
-/*
- * Copyright (c) 2008, Willow Garage, Inc.
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- *
- * * Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * * Neither the name of the Willow Garage, Inc. nor the names of its
- * contributors may be used to endorse or promote products derived from
- * this software without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- * POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef OGRE_VISUALIZER_VISUALIZER_BASE
-#define OGRE_VISUALIZER_VISUALIZER_BASE
-
-#include <string>
-#include <boost/function.hpp>
-
-#include <wx/string.h>
-
-namespace Ogre
-{
-class SceneManager;
-class MovableObject;
-}
-
-namespace ros
-{
-class node;
-}
-
-namespace tf
-{
-class TransformListener;
-}
-
-class wxPanel;
-class wxWindow;
-class wxPropertyGrid;
-class wxPropertyGridEvent;
-class wxPGProperty;
-class wxConfigBase;
-class wxString;
-
-namespace ogre_vis
-{
-
-class PropertyManager;
-class CategoryProperty;
-class BoolProperty;
-
-class VisualizationManager;
-
-/**
- * \class VisualizerBase
- * \brief Abstract base class for all visualizers.
- *
- * Provides a common interface for the visualization panel to interact with,
- * so that new visualizers can be added without the visualization panel knowing anything about them.
- */
-class VisualizerBase
-{
-public:
- VisualizerBase( const std::string& name, VisualizationManager* manager );
- virtual ~VisualizerBase();
-
- /**
- * \brief Enable this visualizer
- * @param force If false, does not re-enable if this visualizer is already enabled. If true, it does.
- */
- void enable( bool force = false );
- /**
- * \brief Disable this visualizer
- * @param force If false, does not re-disable if this visualizer is already disabled. If true, it does.
- */
- void disable( bool force = false );
-
- bool isEnabled() { return enabled_; }
- const std::string& getName() { return name_; }
-
- /**
- * \brief Called periodically by the visualization panel
- * @param dt Time, in seconds, since the last time the update list was run through.
- */
- virtual void update( float dt ) {}
-
- ///
- /**
- * \brief Set the callback used for causing a render to happen
- * @param func a void(void) function that will cause a render to happen from the correct thread
- */
- void setRenderCallback( boost::function<void ()> func );
-
- /// Set the callback used to lock the renderer
- void setLockRenderCallback( boost::function<void ()> func );
- /// Set the callback used to unlock the renderer
- void setUnlockRenderCallback( boost::function<void ()> func );
-
- /**
- * \brief Sets the property manager and parent category for this visualizer
- * @param manager The property manager
- * @param parent The parent category
- */
- void setPropertyManager( PropertyManager* manager, CategoryProperty* parent );
-
- /**
- * \brief Called from setPropertyManager, gives the visualizer a chance to create some properties immediately.
- *
- * Once this function is called, the property_manager_ member is valid and will stay valid
- */
- virtual void createProperties() {}
-
- /// Set the target frame of this visualizer. This is a frame id which should match something being broadcast through TF.
- void setTargetFrame( const std::string& frame );
-
- /**
- * \brief Called from within setTargetFrame, notifying child classes that the target frame has changed
- */
- virtual void targetFrameChanged() = 0;
-
- /**
- * \brief Set the fixed frame of this visualizer. This is a frame id which should generally be the top-level frame being broadcast through TF
- * @param frame The fixed frame
- */
- void setFixedFrame( const std::string& frame );
-
- /**
- * \brief Called from within setFixedFrame, notifying child classes that the fixed frame has changed
- */
- virtual void fixedFrameChanged() = 0;
-
- /**
- * \brief Returns whether an object owned by this visualizer is pickable/mouse selectable
- * @param object The Ogre::MovableObject to check
- */
- virtual bool isObjectPickable( const Ogre::MovableObject* object ) const { return false; }
-
- /**
- * \brief Returns the type name of this visualizer. Does not need to be exactly the same as the class name. Can contains spaces/punctuation, etc.
- * @return The type name
- */
- virtual const char* getType() = 0;
-
- /**
- * \brief Called to tell the visualizer to clear its state
- */
- virtual void reset() {}
-
-protected:
- /// Derived classes override this to do the actual work of enabling themselves
- virtual void onEnable() = 0;
- /// Derived classes override this to do the actual work of disabling themselves
- virtual void onDisable() = 0;
-
- ///
- /**
- * \brief Cause the scene we're in to be rendered.
- * \note This does not immediately cause a render -- instead, one is queued and happens next run through the event loop.
- */
- void causeRender();
-
- /// Lock the renderer
- void lockRender();
- /// Unlock the renderer
- void unlockRender();
-
- VisualizationManager* vis_manager_;
-
- Ogre::SceneManager* scene_manager_; ///< The scene manager we're associated with
- std::string name_; ///< The name of this visualizer
- bool enabled_; ///< Are we enabled?
-
- std::string target_frame_; ///< The frame we should transform all periodically-updated data into
- std::string fixed_frame_; ///< The frame we should transform all fixed data into
-
- boost::function<void ()> render_callback_; ///< Render callback
- boost::function<void ()> render_lock_; ///< Render lock callback
- boost::function<void ()> render_unlock_; ///< Render unlock callback
-
- ros::node* ros_node_; ///< ros node
- tf::TransformListener* tf_; ///< tf client
-
- std::string property_prefix_; ///< Prefix to prepend to our properties
-
- PropertyManager* property_manager_; ///< The property manager to use to create properties
- CategoryProperty* parent_category_; ///< The parent category to use when creating properties
- BoolProperty* enabled_property_;
-
- friend class RenderAutoLock;
-};
-
-/**
- * \class RenderAutoLock
- * \brief A scoped lock on the renderer
- *
- * Constructor calls VisualizerBase::lockRender<br>
- * Destructor calls VisualizerBase::unlockRender
- */
-class RenderAutoLock
-{
-public:
- RenderAutoLock( VisualizerBase* visualizer )
- : visualizer_( visualizer )
- {
- visualizer_->lockRender();
- }
-
- ~RenderAutoLock()
- {
- visualizer_->unlockRender();
- }
-
-private:
- VisualizerBase* visualizer_;
-};
-
-} // namespace ogre_vis
-
-#endif
Deleted: pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.i
===================================================================
--- pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.i 2008-11-07 18:31:21 UTC (rev 6381)
+++ pkg/trunk/visualization/ogre_visualizer/src/ogre_visualizer/visualizer_base.i 2008-11-07 18:32:40 UTC (rev 6382)
@@ -1,19 +0,0 @@
-%{
-#include "visualizer_base.h"
-%}
-
-%include typemaps.i
-%include my_typemaps.i
-
-%import core.i
-%import windows.i
-
-%pythonAppend VisualizerBase "self._setOORInfo(self)"
-
-%include "visualizer_base.h"
-
-%init %{
-
-%}
-
-
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|