33 #include <osg/MatrixTransform>
34 #include <osg/PositionAttitudeTransform>
35 #include <osgText/Text>
37 #include "WMGridRenderer.h"
38 #include "WMGridRenderer.xpm"
39 #include "WMGridRenderer_boundary.xpm"
40 #include "WMGridRenderer_grid.xpm"
41 #include "WMGridRenderer_label.xpm"
42 #include "core/common/WAssert.h"
43 #include "core/common/WBoundingBox.h"
44 #include "core/common/WStringUtils.h"
45 #include "core/common/math/linearAlgebra/WVectorFixed.h"
46 #include "core/dataHandler/WDataSetFibers.h"
47 #include "core/dataHandler/WDataSetPoints.h"
48 #include "core/dataHandler/WDataSetSingle.h"
49 #include "core/dataHandler/WGridRegular3D.h"
50 #include "core/graphicsEngine/WGEGeodeUtils.h"
51 #include "core/graphicsEngine/callbacks/WGENodeMaskCallback.h"
52 #include "core/kernel/WKernel.h"
78 return WMGridRenderer_xpm;
83 return "Grid Renderer";
88 return "Shows the bounding box and grid of a data set.";
104 debugLog() <<
"Waiting for data ...";
108 bool dataValid = ( dataSet != NULL );
138 regGrid = std::dynamic_pointer_cast< WGridRegular3D >( dsSingle->getGrid() );
149 WGridTransformOrtho gridTransform( bb.xMax() - bb.xMin(), bb.yMax() - bb.yMin(), bb.zMax() - bb.zMin() );
163 const double makeFakeNonZero = 0.000001;
165 bb.yMax() - bb.yMin() + makeFakeNonZero,
166 bb.zMax() - bb.zMin() + makeFakeNonZero );
174 debugLog() <<
"Creating grid geode.";
181 debugLog() <<
"Removing grid geode.";
204 m_input = std::shared_ptr< WModuleInputData < WDataSet > >(
206 "in",
"The dataset to show" )
220 m_bboxColor =
m_properties->addProperty(
"Bounding box color",
"The color of the bounding box.", WColor( 0.3, 0.3, 0.3, 1.0 ), notifier );
225 m_gridColor =
m_properties->addProperty(
"Grid color",
"The color of the grid.", WColor( 0.1, 0.1, 0.1, 1.0 ), notifier );
231 m_possibleModes->addItem(
"Labels",
"Show the boundary labels.", WMGridRenderer_label_xpm );
232 m_possibleModes->addItem(
"Bounding box",
"Show the bounding box.", WMGridRenderer_boundary_xpm );
233 m_possibleModes->addItem(
"Grid",
"Show the inner grid.", WMGridRenderer_grid_xpm );
283 for(
size_t i = 0; i < s.
size(); ++i )
288 labels = labels || ( idx == 0 );
289 bbox = bbox || ( idx == 1 );
290 grid = grid || ( idx == 2 );
virtual void wait() const
Wait for the condition.
void setResetable(bool resetable=true, bool autoReset=true)
Sets the resetable flag.
virtual void add(std::shared_ptr< WCondition > condition)
Adds another condition to the set of conditions to wait for.
Class to encapsulate boost::condition_variable_any.
std::shared_ptr< WDataSetFibers > SPtr
Pointer to dataset.
std::shared_ptr< WDataSetPoints > SPtr
Pointer to dataset.
std::shared_ptr< WDataSetSingle > SPtr
Convenience typedef for a std::shared_ptr.
std::shared_ptr< WDataSet > SPtr
Shared pointer abbreviation to a instance of this class.
This node is able to represent a grid in certain ways.
This callback is useful to en-/disable nodes using the node mask based on properties.
static std::shared_ptr< WGraphicsEngine > getGraphicsEngine()
Returns instance of the graphics engine.
A grid that has parallelepiped cells which all have the same proportion.
std::shared_ptr< WGridRegular3DTemplate > SPtr
Convenience typedef for a std::shared_ptr< WGridRegular3DTemplate >.
A class containing a list of named items.
std::shared_ptr< WItemSelection > SPtr
Convenience typedef for a std::shared_ptr< WItemSelection >
This class represents a subset of a WItemSelection.
WItemSelector newSelector(IndexList selected) const
Creates a new valid instance with the specified items selected.
virtual size_t size() const
The number of selected items.
virtual size_t getItemIndexOfSelected(size_t index) const
Helps to get the index of an selected item in the WItemSelection.
Show the bounding box and grid of a WDataSetSingle.
virtual std::shared_ptr< WModule > factory() const
Due to the prototype design pattern used to build modules, this method returns a new instance of this...
virtual const std::string getDescription() const
Gives back a description of this module.
~WMGridRenderer()
Destructor.
WPropColor m_gridColor
the color of the grid
virtual void properties()
Initialize the properties for this module.
std::shared_ptr< WCondition > m_recompute
This condition denotes whether we need to recompute the surface.
WPropColor m_bboxColor
the color of the bounding box
std::shared_ptr< WModuleInputData< WDataSet > > m_input
Input connector required by this module.
WMGridRenderer()
Standard constructor.
virtual const std::string getName() const
Gives back the name of this module.
virtual void moduleMain()
Entry point after loading the module.
void updateNode(WPropertyBase::SPtr property)
Handles updates in properties.
virtual const char ** getXPMIcon() const
Get the icon for this module in XPM format.
WDataSet::SPtr m_dataSetOld
The currently handled data.
WItemSelection::SPtr m_possibleModes
the modes available.
virtual void connectors()
Initialize the connectors this module is using.
WPropSelection m_mode
the mode (bbox, grid, both)
WGEGridNode::SPtr m_gridNode
The node actually drawing the grid.
WPropInt m_boxLineWidth
the width of the boundary lines
WPropInt m_gridLineWidth
the width of the grid lines
std::shared_ptr< WProperties > currentDataInfoProperties
Kept reference to current data infos as properties.
Class representing a single module of OpenWalnut.
virtual void properties()
Initialize properties in this function.
wlog::WStreamedLogger debugLog() const
Logger instance for comfortable debug logging.
void removeConnectors()
Removes all connectors properly.
void addConnector(std::shared_ptr< WModuleInputConnector > con)
Adds the specified connector to the list of inputs.
std::shared_ptr< WProperties > m_properties
The property object for the module.
std::shared_ptr< WProperties > m_infoProperties
The property object for the module containing only module whose purpose is "PV_PURPOSE_INFORMNATION".
void ready()
Call this whenever your module is ready and can react on property changes.
WConditionSet m_moduleState
The internal state of the module.
WPropBool m_active
True whenever the module should be active.
virtual void connectors()
Initialize connectors in this function.
boost::function< void(std::shared_ptr< WPropertyBase >)> PropertyChangeNotifierType
Signal signature emitted during set operations.
std::shared_ptr< WPropertyBase > SPtr
Convenience typedef for a std::shared_ptr< WPropertyBase >
WBoolFlag m_shutdownFlag
Condition getting fired whenever the thread should quit.
void addTo(WPropSelection prop)
Add the PC_NOTEMPTY constraint to the property.