25 #ifndef WFIBERHANDLER_H
26 #define WFIBERHANDLER_H
32 #include <boost/lexical_cast.hpp>
35 #include "WMPointConnector.h"
36 #include "action/WActionHandler.h"
37 #include "core/common/WItemSelectionItem.h"
38 #include "core/common/WItemSelectionItemTyped.h"
39 #include "core/common/WItemSelector.h"
40 #include "core/common/WPropertyGroup.h"
41 #include "core/kernel/WModule.h"
53 typedef std::shared_ptr< WFiberHandler >
SPtr;
93 void addVertexToFiber( osg::Vec3 vertex,
size_t fiberIdx,
bool silent =
false );
101 void addVerticesToFiber( std::vector< osg::Vec3 > vertices,
size_t fiberIdx,
bool silent =
false );
110 void addVertexToFiberAt( osg::Vec3 vertex,
size_t fiberIdx,
size_t position,
bool silent =
false );
134 void addFiber( std::string name,
bool silent =
false,
bool updateSelector =
true );
152 void removeFiber(
size_t idx,
bool silent =
false,
bool updateSelector =
true );
159 void toggleFiber(
size_t idx,
bool silent =
false );
std::shared_ptr< WActionHandler > SPtr
A shared_ptr to this class.
Handles the fibers of the WMPointsConnector.
void addVertexToFiber(osg::Vec3 vertex, size_t fiberIdx, bool silent=false)
Adds a vertex to the currently selected fiber.
void removeVerticesFromFiber(std::vector< osg::Vec3 > vertices, size_t fiberIdx, bool silent=false)
Removes multiple vertices from the currently selected fiber.
void selectLastPoint()
Selects the last point of the currently selected fiber.
WPropTrigger m_undoTrigger
Property (button) to undo the last action.
WActionHandler::SPtr getActionHandler()
void setFiberCount(size_t fiberCount)
Sets the fiber count.
void updateProperty(WPropertyBase::SPtr property)
Update handler for the properties.
WItemSelectionItemTyped< std::string > ItemType
Type of selectable items.
WPropTrigger m_addFiber
Property (button) to add a new fiber.
void toggleFiber(size_t idx, bool silent=false)
Toggles the visibility of a fiber.
std::vector< osg::Vec3 > PCFiber
Vector of 3D vectors, representing points.
void addVertexToFiberAt(osg::Vec3 vertex, size_t fiberIdx, size_t position, bool silent=false)
Adds a vertex to the currently selected fiber.
PCFiberListSPtr getFibers()
void addFiber(std::string name, bool silent=false, bool updateSelector=true)
Adds a new fiber.
WActionHandler::SPtr m_actionHandler
Handles the undo and redo action.
void selectorUpdate(size_t idx)
Updates the UI selector.
bool isHidden(size_t idx)
Checks if a fiber is hidden.
WPropTrigger m_removeFiber
Property (button) to remove a fiber.
bool getFiberOfPoint(osg::Vec3 vertex, size_t *idx=NULL)
Gets the index of the fiber of a point.
void removeVertexFromFiber(osg::Vec3 vertex, size_t fiberIdx, bool silent=false)
Removes a vertex from the currently selected fiber.
size_t getSelectedFiber()
WPropTrigger m_redoTrigger
Property (button) to redo the last action.
void createNewFiber()
Creates a new fiber.
WMPointConnector * m_pointConnector
A reference to the WMPointConnector this belongs to.
std::vector< PCFiber > PCFiberList
Vector, that could contain multiple fibers.
void addVerticesToFiber(std::vector< osg::Vec3 > vertices, size_t fiberIdx, bool silent=false)
Adds multiple vertices to the currently selected fiber.
std::shared_ptr< PCFiberList > PCFiberListSPtr
Shared pointer to fibers-vector.
WPropSelection m_selectionType
The type of the selection.
std::shared_ptr< std::vector< char > > m_hidden
Vector for the visibility of the fibers.
void sortVertices()
Sorts the vertices by their z value.
bool isPointHidden(osg::Vec3 vertex)
Checks whether a point is in a hidden fiber.
int m_fiberCount
Stores the amount of new created fibers.
void selectFiber(size_t idx)
Selects a fiber by its index in the fibers vector.
void removeFiber(size_t idx, bool silent=false, bool updateSelector=true)
Removes a fiber at an index in the fibers vector.
WFiberHandler(WMPointConnector *pointConnector)
Creates the list of fibers.
size_t m_selectedFiber
Represents the index of the current active fiber.
PCFiberListSPtr m_fibers
A pointer to the list of fibers.
std::shared_ptr< WItemSelection > m_possibleFiberSelections
The list of possible fibers, which can be selected.
WPropSelection m_fiberSelection
Represents the current active fiber selection property.
WPropTrigger m_toggleFiber
Property (button) to toggle the visibility of a fiber.
std::shared_ptr< WFiberHandler > SPtr
A shared_ptr to this class.
void createProperties(WPropertyGroup::SPtr properties)
Creates the properties for this handler.
void addFiberAt(std::string name, size_t position, bool hidden, bool silent=false, PCFiber fiber=PCFiber())
Adds a new or an old fiber at a specific position.
void clear()
Clears the data in this handler.
WMPointConnector * getPointConnector()
A derivation of WItemSelection which can store a value of any type.
This module connects the points in a point dataset.
std::shared_ptr< WPropertyBase > SPtr
Convenience typedef for a std::shared_ptr< WPropertyBase >
std::shared_ptr< WPropertyGroup > SPtr
shared pointer to object of this type