Commit a6bae368 authored by schurade's avatar schurade

[ADD] module for drawing a profile of the dataset between control points

parent 1447bde9
FILE( GLOB_RECURSE MODULES_SRC "*.cpp" "*.h" )
# Grab module name and setup target directories
GET_FILENAME_COMPONENT( MODULE_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME )
SET( MODULE_TARGET_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/modules/${MODULE_NAME} )
SET( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${MODULE_TARGET_DIR} )
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MODULE_TARGET_DIR} )
SET( MODULE_DIRNAME ${MODULE_NAME} )
SET( MODULE_NAME "${OWmodulesPrefix}_${MODULE_NAME}" ) # prefix all module names with "OWmodule_" to separate them from other libs
SET( ${MODULE_NAME}_COMBINER_SRC ${MODULES_SRC} )
SET( ${MODULE_NAME}_ALL_CPP ${MODULES_SRC} )
FILE( GLOB_RECURSE ${MODULE_NAME}_REMOVE_H "*.h" )
LIST( REMOVE_ITEM ${MODULE_NAME}_ALL_CPP ${${MODULE_NAME}_REMOVE_H} )
IF( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/" )
FILE( GLOB_RECURSE ${MODULE_NAME}_REMOVE_TEST "test/*.cpp" "test/*.h" )
LIST( REMOVE_ITEM ${MODULE_NAME}_ALL_CPP ${${MODULE_NAME}_REMOVE_TEST} )
LIST( REMOVE_ITEM ${MODULE_NAME}_COMBINER_SRC ${${MODULE_NAME}_REMOVE_TEST} )
ENDIF( EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/" )
LIST( LENGTH ${MODULE_NAME}_ALL_CPP cpp_count )
IF( ${cpp_count} GREATER 3 )
IF( OW_BUILD_AS_ONE_BIG_FILE )
SET( UNITY_BUILD_FILE_NAME "${MODULE_NAME}UnityBuildFile.cpp" )
GENERATE_UNITY_BUILD_FILE( ${MODULE_NAME}_ALL_CPP )
ADD_LIBRARY( ${MODULE_NAME} SHARED ${UNITY_BUILD_FILE_NAME} ${${MODULE_NAME}_COMBINER_SRC} )
ENDIF( OW_BUILD_AS_ONE_BIG_FILE )
ENDIF( ${cpp_count} GREATER 3 )
IF( ( NOT OW_BUILD_AS_ONE_BIG_FILE ) OR NOT ( ${cpp_count} GREATER 3 ) )
ADD_LIBRARY( ${MODULE_NAME} SHARED ${${MODULE_NAME}_COMBINER_SRC} )
ENDIF( ( NOT OW_BUILD_AS_ONE_BIG_FILE ) OR NOT ( ${cpp_count} GREATER 3 ) )
# Build module lib
#ADD_LIBRARY( ${MODULE_NAME} SHARED ${MODULES_SRC} )
TARGET_LINK_LIBRARIES( ${MODULE_NAME} ${OWKernelName} )
IF(MSVC_IDE)
SET_TARGET_PROPERTIES( ${MODULE_NAME} PROPERTIES PREFIX "../")
ENDIF(MSVC_IDE)
# Copy local shaders to module target directory
IF( OW_COPY_SHADERS AND EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/shaders ) # copy shaders only if the user wants it
ADD_CUSTOM_TARGET( ${MODULE_NAME}_CopyShaders
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/shaders ${MODULE_TARGET_DIR}/shaders/
COMMENT "Copy shaders of ${MODULE_NAME}"
)
ADD_DEPENDENCIES( ${MODULE_NAME} ${MODULE_NAME}_CopyShaders )
ENDIF()
# Build unit tests
IF( OW_COMPILE_TESTS )
# This ensures that the test is copied to the module directory
SET( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${MODULE_TARGET_DIR} )
CXXTEST_ADD_TESTS_FROM_LIST( "${MODULES_SRC}"
"${OWKernelName};${MODULE_NAME}"
)
# Copy fixtures if they exist
IF( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/fixtures )
ADD_CUSTOM_TARGET( ${MODULE_NAME}_CopyFixtures
# as the "test" target runs in CMakes temporary build dir, the fixtures need to be placed there too.
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_SOURCE_DIR}/test/fixtures ${CMAKE_BINARY_DIR}/modules/${MODULE_DIRNAME}/fixtures/
COMMENT "Copy fixtures of ${MODULE_NAME}"
)
ADD_DEPENDENCIES( ${MODULE_NAME} ${MODULE_NAME}_CopyFixtures )
ENDIF( EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/test/fixtures )
ENDIF( OW_COMPILE_TESTS )
This diff is collapsed.
//---------------------------------------------------------------------------
//
// Project: OpenWalnut ( http://www.openwalnut.org )
//
// Copyright 2009 OpenWalnut Community, BSV-Leipzig and CNCF-CBS
// For more information see http://www.openwalnut.org/copying
//
// This file is part of OpenWalnut.
//
// OpenWalnut is free software: you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// OpenWalnut 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 Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public License
// along with OpenWalnut. If not, see <http://www.gnu.org/licenses/>.
//
//---------------------------------------------------------------------------
#ifndef WMDATASETPROFILE_H
#define WMDATASETPROFILE_H
#include <osgWidget/WindowManager>
#include <string>
#include <vector>
#include <osg/Geode>
#include "../../graphicsEngine/WGEManagedGroupNode.h"
#include "../../graphicsEngine/WROISphere.h"
#include "../../kernel/WModule.h"
#include "../../kernel/WModuleInputData.h"
#include "../../kernel/WModuleOutputData.h"
const unsigned int MASK_2D = 0xF0000000; //!< used for osgWidget stuff
const unsigned int MASK_3D = 0x0F000000; //!< used for osgWidget stuff
/**
* Someone should add some documentation here.
* Probably the best person would be the module's
* creator, i.e. "schurade".
*
* This is only an empty template for a new module. For
* an example module containing many interesting concepts
* and extensive documentation have a look at "src/modules/template"
*
* \ingroup modules
*/
class WMDatasetProfile: public WModule
{
public:
/**
*
*/
WMDatasetProfile();
/**
*
*/
virtual ~WMDatasetProfile();
/**
* Gives back the name of this module.
* \return the module's name.
*/
virtual const std::string getName() const;
/**
* Gives back a description of this module.
* \return description to module.
*/
virtual const std::string getDescription() const;
/**
* Due to the prototype design pattern used to build modules, this method returns a new instance of this method. NOTE: it
* should never be initialized or modified in some other way. A simple new instance is required.
*
* \return the prototype used to create every module in OpenWalnut.
*/
virtual boost::shared_ptr< WModule > factory() const;
/**
* Get the icon for this module in XPM format.
*/
virtual const char** getXPMIcon() const;
protected:
/**
* Entry point after loading the module. Runs in separate thread.
*/
virtual void moduleMain();
/**
* Initialize the connectors this module is using.
*/
virtual void connectors();
/**
* Initialize the properties for this module.
*/
virtual void properties();
/**
* Initialize requirements for this module.
*/
virtual void requirements();
/**
* update function, called with each update pass of the osg render loop
*/
void updateCallback();
private:
/**
* initializes the controls and osg nodes
*/
void init();
/**
* updates the osg nodes
*/
void update();
/**
* sets the dirty flag, used as callback for control knob changes
*/
void setDirty();
/**
* dirty flag to indicate that redrawing is needed
*/
bool m_dirty;
/**
* creates an osg node that contains the underlying grid
* \return osg::ref_ptr< osg::Geode >
*/
osg::ref_ptr< osg::Geode > createGraphGridGeode();
/**
* creates an osg node that contains the graph
* \return osg::ref_ptr< osg::Geode >
*/
osg::ref_ptr< osg::Geode > createGraphGeode();
/**
* adds a control knob
* \param pos Position of the new knob
*/
void addKnob( wmath::WPosition pos );
/**
* An input connector that accepts order 1 datasets.
*/
boost::shared_ptr< WModuleInputData< WDataSetSingle > > m_input;
/**
* This is a pointer to the dataset the module is currently working on.
*/
boost::shared_ptr< WDataSetSingle > m_dataSet;
/**
* stores a pointer to the grid we use;
*/
boost::shared_ptr< WGridRegular3D > m_grid;
/**
* A condition used to notify about changes in several properties.
*/
boost::shared_ptr< WCondition > m_propCondition;
/**
* A list of cluster selection methods
*/
boost::shared_ptr< WItemSelection > m_snapSelectionsList;
/**
* Selection property for clusters
*/
WPropSelection m_snapSelection;
WPropTrigger m_propAddKnobTrigger; //!< Adds a knob
WPropColor m_graphColor; //!< color of the graph
WPropDouble m_propLength; //!< length between knobs
WPropBool m_propUseLength; //!< enforce lengths
/**
* The root node used for this modules graphics.
*/
osg::ref_ptr< WGEManagedGroupNode > m_rootNode;
osg::ref_ptr< WGEManagedGroupNode > m_graphNode; //!< Pointer to the graph group node.
/**
* The geometry rendered by this module.
*/
osg::ref_ptr< osg::Geode > m_lineGeode;
/**
* osg node for the grid
*/
osg::ref_ptr< osg::Geode > m_graphGridGeode;
/**
* osg node for the graph
*/
osg::ref_ptr< osg::Geode > m_graphGeode;
/**
* stores pointers to the control knobs
*/
std::vector< osg::ref_ptr<WROISphere> >knobs;
boost::shared_ptr< boost::function< void() > > m_changeRoiSignal; //!< Signal that can be used to update the graph
int m_oldViewHeight; //!< stores the old viewport resolution to check whether a resize happened
int m_oldViewWidth; //!< stores the old viewport resolution to check whether a resize happened
osgWidget::WindowManager* m_wm; //!< stores a pointer to the window manager used for osg wdgets and overlay stuff
osg::Camera* m_camera; //!< stores the camera object
};
#endif // WMDATASETPROFILE_H
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment