Developer Documentation
PolyLinePlugin Class Reference

#include <Plugin-PolyLine/PolyLinePlugin.hh>

Inheritance diagram for PolyLinePlugin:
ContextMenuInterface ScriptInterface KeyInterface StatusbarInterface ToolbarInterface LoadSaveInterface LoggingInterface ToolboxInterface PickingInterface MouseInterface BaseInterface

Public Types

enum  EditMode {
  PL_NONE =0, PL_INSERT =1, PL_INSERTCIRCLE, PL_INSERTSPLINE,
  PL_DELETE, PL_MOVE, PL_SPLIT, PL_MERGE,
  PL_SMART_MOVE, PL_COPY_PASTE
}
 Edit Mode of PolyLinePlugin.
 

Public Slots

void slotEnablePickMode (QString _name)
 
QString version ()
 
void createCircle_createUI (int _polyLineObjectID)
 
void createSpline_createUI (int _polyLineObjectID)
 

Signals

void updateView ()
 
void updatedObject (int _identifier, const UpdateType &_type)
 
void nodeVisibilityChanged (int _id)
 
void addPickMode (const std::string &_mode)
 
void addHiddenPickMode (const std::string &_mode)
 
void setPickModeToolbar (const std::string &_mode, QToolBar *_toolbar)
 
void setPickModeMouseTracking (const std::string &_mode, bool _mouseTracking)
 
void log (Logtype _type, QString _message)
 
void log (QString _message)
 
void addToolbar (QToolBar *_toolbar)
 
void getToolBar (QString _name, QToolBar *&_toolbar)
 
void scriptInfo (QString _functionName)
 
void addToolbox (QString _name, QWidget *_widget, QIcon *_icon)
 
void deleteObject (int _id)
 
void addEmptyObject (DataType _type, int &_id)
 
void registerKey (int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse=false)
 
void showStatusMessage (QString _message, int _timeout=0)
 
void clearStatusMessage ()
 
void addContextMenuItem (QAction *_action, DataType _objectType, ContextMenuType _type)
 
- Signals inherited from BaseInterface
virtual void updateView ()
 Update current view in Main Application. More...
 
virtual void setSlotDescription (QString _slotName, QString _slotDescription, QStringList _parameters, QStringList _descriptions)
 Set a description for a public slot. More...
 
virtual void setRenderer (unsigned int _viewer, QString _rendererName)
 Set a renderer for the given viewer. More...
 
- Signals inherited from PickingInterface
virtual void addPickMode (const std::string &_mode)
 Add a new picking mode to the examiner. More...
 
- Signals inherited from ToolboxInterface
virtual void addToolbox (QString _name, QWidget *_widget)
 Add a toolbox widget to the gui with the given name. More...
 
- Signals inherited from LoggingInterface
virtual void log (Logtype _type, QString _message)=0
 
virtual void log (QString _message)=0
 
- Signals inherited from LoadSaveInterface
virtual void save (int _id, QString _filename)
 Save object to a file. More...
 
virtual void load (QString _filename, DataType _type, int &_id)
 Load object from file with a specific DataType. More...
 
- Signals inherited from ToolbarInterface
virtual void addToolbar (QToolBar *_toolbar)
 Adds a Toolbar to the main widget. More...
 
- Signals inherited from StatusbarInterface
virtual void showStatusMessage (QString _message, int _timeout=0)
 Show a message in the status bar. More...
 
- Signals inherited from KeyInterface
virtual void registerKey (int _key, Qt::KeyboardModifiers _modifiers, QString _description, bool _multiUse=false)
 Register a key-combination for your plugin. More...
 
- Signals inherited from ScriptInterface
virtual void scriptInfo (QString _functionWithParameters)
 Emit this signal if a scriptable function is executed. More...
 
virtual void getScriptingEngine (QScriptEngine *&_engine)
 
virtual void executeScript (QString _script)
 
virtual void getAvailableFunctions (QStringList &_functions)
 
- Signals inherited from ContextMenuInterface
virtual void addContextMenuItem (QAction *_action, ContextMenuType _type)
 Add an entry for a context Menu. More...
 

Public Member Functions

 PolyLinePlugin ()
 default constructor
 
 ~PolyLinePlugin ()
 default destructor
 
QString name ()
 Name of the Plugin.
 
QString description ()
 Description of the Plugin.
 
int generatePolyLineFromCut (int _objectId, Vector _planePoint, Vector _planeNormal, int _polyLineId=-1)
 Generates a polyLine of a plane intersection. More...
 
IdList generatePolyLinesFromCut (int _objectId, Vector _planePoint, Vector _planeNormal)
 Generates a polyLine of a plane intersection. More...
 

Private Slots

void initializePlugin ()
 
void slotEditModeChanged ()
 
void slotMouseEvent (QMouseEvent *_event)
 
void slotKeyEvent (QKeyEvent *_event)
 
void slotPickModeChanged (const std::string &_mode)
 
void pluginsInitialized ()
 
bool pick_triangle_mesh (QPoint mPos, TriMeshObject *&_mesh_object_, TriMesh::FaceHandle &_fh, TriMesh::VertexHandle &_vh, ACG::Vec3d &_hitPoint)
 
void slotUpdateContextMenu (int objectId)
 
void slot_subdivide ()
 
void slot_subdivide_percent (bool _checked)
 
void slot_decimate ()
 
void slot_decimate_percent (bool _checked)
 
void slot_smooth ()
 
void slot_smooth (PolyLineObject *&_pol)
 
void slot_project ()
 
void slot_project (PolyLineObject *&_pol)
 
void slot_smooth_project ()
 
void slot_smooth_project (PolyLineObject *&_pol)
 
void slot_smart_move_timer ()
 
void slot_setCirclePointNum (int i)
 
void slot_setSplinePointNum (int i)
 
virtual void slotObjectUpdated (int _identifier, const UpdateType &_type)
 
void slot_duplicate ()
 
void slot_instanciate ()
 
void finishSpline ()
 
void slotScissorButton ()
 Scissor Button was hit. More...
 
void slotScissorLinesButton ()
 Scissor Button for multiple polylines was hit. More...
 
void slotTriggerCutPlaneSelect ()
 Generate PolyLine after the cutPlane has been drawn. More...
 
- Private Slots inherited from BaseInterface
virtual void exit ()
 
virtual QString version ()
 Return a version string for your plugin. More...
 
- Private Slots inherited from KeyInterface
virtual void slotKeyEvent (QKeyEvent *_event)
 Key Event from Main App. More...
 

Private Member Functions

EditMode mode ()
 
void me_insert (QMouseEvent *_event)
 
void me_insertCircle (QMouseEvent *_event)
 
void me_insertSpline (QMouseEvent *_event)
 
void me_delete (QMouseEvent *_event)
 
void me_move (QMouseEvent *_event)
 
void me_split (QMouseEvent *_event)
 
void me_merge (QMouseEvent *_event)
 
void me_smart_move (QMouseEvent *_event)
 
void me_copyPasteMouse (QMouseEvent *_event)
 
bool createCircle_getPointOnMesh (TriMeshObject *_triMeshObject, ACG::Vec3d _center, ACG::Vec3d _pOnPlane, ACG::Vec3d _n, ACG::Vec3d *_pOut)
 Calculates a point on the mesh. More...
 
bool createCircle_getHitInfo (PolyLineCircleData *_circleData, ACG::Vec3d _hit_Point, ACG::Vec3d *_pOut=0, double *_r=0, ACG::Vec3d *_onPlane=0)
 Calculates common info. More...
 
ACG::Vec3d createCircle_getHit (PolyLineCircleData *_circleData, ACG::Vec3d _hit_point)
 Returns point on mesh or point on the normal plane. More...
 
void updatePolyEllipse (PolyLineObject *_lineObject, unsigned int _pointCount)
 Generates points for the ellipse. More...
 
void updateHandles (PolyLineObject *_lineObject)
 Updates the center, forward and side handle of the Poly ellipse. More...
 
void updatePolyBezierSpline (PolyLineObject *_lineObject, unsigned int _pointsPerSegment)
 Generates points for the spline, updates handles. More...
 
void updatePolyBezierHandles (PolyLineObject *_lineObject, ACG::SceneGraph::LineNode *_line)
 Updates all the handles on the PolyBezier. More...
 
ACG::Vec3d getPointOnMesh (PolyLineBezierSplineData *_SplineData, ACG::Vec3d _point, ACG::Vec3d *_nor=0)
 Returns the nearest point on the mesh or if none could be found the input. More...
 
Template Functions
template<class MeshT >
std::vector< ACG::Vec3dgetIntersectionPoints (MeshT *_mesh, uint _fh, ACG::Vec3d _planeNormal, ACG::Vec3d _planePoint, bool &_closed)
 get the points from the closest connected intersection between mesh and plane More...
 
template<class MeshT >
std::vector< std::vector< ACG::Vec3d > > getMultipleIntersectionPoints (MeshT *_mesh, ACG::Vec3d _planeNormal, ACG::Vec3d _planePoint)
 get all points from the intersection between mesh and plane More...
 
template<class MeshT >
MeshT::EdgeHandle getCuttedEdge (MeshT &_mesh, ACG::Vec3d &_planeNormal, ACG::Vec3d &_planePoint)
 get an edge of the mesh that is cut by the plane More...
 
- Private Member Functions inherited from BaseInterface
virtual void noguiSupported ()
 
virtual ~BaseInterface ()
 Destructor.
 
virtual void blockScenegraphUpdates (bool _block)
 Tell the core to prevent scenegraph updates. More...
 
virtual void updatedObject (int _objectId)
 An object has been changed or added by this plugin. More...
 
virtual void updatedObject (int _identifier, const UpdateType &_type)
 An object has been changed or added by this plugin. More...
 
virtual void nodeVisibilityChanged (int _identifier)
 A scenegraph node has been shown or hidden. More...
 
virtual void getCurrentRenderer (unsigned int _viewer, QString &_rendererName)
 Get the current renderer for the given viewer. More...
 
- Private Member Functions inherited from MouseInterface
virtual ~MouseInterface ()
 Destructor.
 
- Private Member Functions inherited from PickingInterface
virtual void addHiddenPickMode (const std::string &_mode)
 Add a new picking mode to the examiner which will be invisible. More...
 
virtual void setPickModeCursor (const std::string &_mode, QCursor _cursor)
 Set the cursor of the given PickMode. More...
 
virtual void setPickModeMouseTracking (const std::string &_mode, bool _mouseTracking)
 Set mouse tracking for the given PickMode. More...
 
virtual void setPickModeToolbar (const std::string &_mode, QToolBar *_toolbar)
 Set the additional toolbar of the given PickMode. More...
 
virtual void removePickModeToolbar (const std::string &_mode)
 Removes the additional toolbar of the given PickMode. More...
 
virtual ~PickingInterface ()
 Destructor.
 
- Private Member Functions inherited from ToolboxInterface
virtual ~ToolboxInterface ()
 Destructor.
 
virtual void addToolbox (QString _name, QWidget *_widget, QIcon *_icon)
 Add a toolbox widget to the gui with the given name and an icon. More...
 
virtual void addToolbox (QString _name, QWidget *_widget, QIcon *_icon, QWidget *_headerAreaWidget)
 Add a toolbox widget to the gui with the given name, icon and header area widget. More...
 
- Private Member Functions inherited from LoggingInterface
virtual ~LoggingInterface ()
 Destructor.
 
- Private Member Functions inherited from LoadSaveInterface
virtual ~LoadSaveInterface ()
 Destructor.
 
virtual void addEmptyObject (DataType _type, int &_id)
 
virtual void copyObject (int _oldId, int &_newId)
 
virtual void emptyObjectAdded (int _id)
 DEPRECATED HERE (Moved to Type Interface)! Emit this signal if an empty object has been created. More...
 
virtual void deleteObject (int _id)
 Delete an object
This signal can be called from any thread.
. More...
 
virtual void deleteAllObjects ()
 Delete all Objects. More...
 
virtual void getAllFileFilters (QStringList &_filters)
 Get all file filters that are registered. More...
 
- Private Member Functions inherited from ToolbarInterface
virtual ~ToolbarInterface ()
 Destructor.
 
virtual void removeToolbar (QToolBar *_toolbar)
 Remove a Toolbar from the main widget. More...
 
virtual void getToolBar (QString _name, QToolBar *&_toolbar)
 Get a pointer to a Toolbar of the given name or 0 if it does not exist. More...
 
- Private Member Functions inherited from StatusbarInterface
virtual ~StatusbarInterface ()
 Destructor.
 
void setStatus (ApplicationStatus::applicationStatus _status)
 Sets the status icon of the StatusBar. More...
 
void clearStatusMessage ()
 Removes the current message from the statusBar. More...
 
void addWidgetToStatusbar (QWidget *_widget)
 Add a widget on the right side of the statusBar. More...
 
- Private Member Functions inherited from KeyInterface
virtual void slotKeyReleaseEvent (QKeyEvent *_event)
 Key Release Event from Main App. More...
 
virtual ~KeyInterface ()
 Destructor.
 
- Private Member Functions inherited from ScriptInterface
virtual ~ScriptInterface ()
 Destructor.
 
virtual void executeFileScript (QString _filename)
 
virtual void getDescription (QString _function, QString &_description, QStringList &_parameters, QStringList &_descriptions)
 
- Private Member Functions inherited from ContextMenuInterface
virtual ~ContextMenuInterface ()
 Destructor.
 
virtual void addContextMenuItem (QAction *_action, DataType _objectType, ContextMenuType _type)
 Add an entry for a context Menu. More...
 
virtual void hideContextMenu ()
 hide the main context menu
 

Private Attributes

int cur_insert_id_
 
PolyLineObjectcur_polyline_obj_
 
int cur_move_id_
 
PolyLine::Point * move_point_ref_
 
PolyLine::Point * create_point_ref_
 
PolyLine::Point move_point_orig_
 
int createCircle_CurrSelIndex_
 The object which is being modified(created, dragged)
 
int createCircle_LastSelIndex_
 Use this one to mark the last index to update the number of points.
 
ACG::SceneGraph::GlutPrimitiveNodemoveCircle_SelNode_
 The handle which is being dragged.
 
ACG::Vec3d moveCircle_LastHitPos_
 The last valid hit on the mesh.
 
ACG::Vec3d moveCircle_LastHitNor_
 
bool moveCircle_IsLocked
 
bool moveCircle_IsFloating
 
QAction * copyPaste_Action_
 
int copyPaste_ObjectId_
 
int copyPaste_ActionType_
 
int copyPaste_NewObjectId_
 
std::vector< ACG::Vec3dcopyPaste_RelativePoints_
 
QPoint copyPaste_LastMouse
 
int createSpline_CurrSelIndex_
 The index of the currently created spline.
 
int createSpline_LastSelIndex_
 Use this one to mark the last index to update the number of points.
 
ACG::SceneGraph::GlutPrimitiveNodemoveBezSpline_SelNode_
 The handle which is being dragged.
 
int moveBezSpline_SelIndex_
 The object which is being moved.
 
int moveBezSpline_SelSubIndex_
 The index of the control or handle being moved.
 
int cur_merge_id_
 
QTimer * smart_move_timer_
 
PolyLineObjectcur_smart_move_obj_
 
QtPlaneSelectplaneSelect_
 Plane selection tool.
 
ToolBox
PolyLineToolbarWidgettool_
 Widget for Toolbox.
 

ToolBar

QAction * polyLineAction_
 Called by Toolbar to enable pick mode.
 
QActionGroup * toolBarActions_
 Called by Toolbar to enable pick mode.
 
QToolBar * toolbar_
 Called by Toolbar to enable pick mode.
 
void slotSetPolyLineMode (QAction *_action)
 Called by Toolbar to enable pick mode.
 

PickToolBar

QToolBar * pickToolbar_
 Called by pick Toolbar.
 
QActionGroup * pickToolBarActions_
 Called by pick Toolbar.
 
QAction * insertAction_
 Called by pick Toolbar.
 
QAction * insertCircleAction_
 Called by pick Toolbar.
 
QAction * insertSplineAction_
 Called by pick Toolbar.
 
QAction * deleteAction_
 Called by pick Toolbar.
 
QAction * moveAction_
 Called by pick Toolbar.
 
QAction * smartMoveAction_
 Called by pick Toolbar.
 
QAction * mergeAction_
 Called by pick Toolbar.
 
QAction * splitAction_
 Called by pick Toolbar.
 
QAction * cutAction_
 Called by pick Toolbar.
 
QAction * cutMultipleAction_
 Called by pick Toolbar.
 
void slotPickToolbarAction (QAction *_action)
 Called by pick Toolbar.
 

Detailed Description

Plugin for PolyLine Support

Definition at line 101 of file PolyLinePlugin.hh.

Member Function Documentation

◆ createCircle_getHit()

ACG::Vec3d PolyLinePlugin::createCircle_getHit ( PolyLineCircleData _circleData,
ACG::Vec3d  _hit_point 
)
private

Returns point on mesh or point on the normal plane.

Helper function which returns the point on the mesh or if none could be found the point on the plane

Parameters
_circleDataThe circle to use.
_hit_pointThe point to "project".
Returns
Point on the mesh if one was found or on the normal plane.

Definition at line 127 of file PolyLinePlugin_Circle.cc.

◆ createCircle_getHitInfo()

bool PolyLinePlugin::createCircle_getHitInfo ( PolyLineCircleData _circleData,
ACG::Vec3d  _hit_Point,
ACG::Vec3d _pOut = 0,
double *  _r = 0,
ACG::Vec3d _onPlane = 0 
)
private

Calculates common info.

Calculates common info like point on the mesh, point on the normal plane and the distance from the circle center

Parameters
_circleDataThe circle to use.
_hit_PointThe point which to "project".
_pOut(optional)Point on the mesh.
_rThe distance between circle center and point on the plane.
_onPlanePoint on the normal plane regarding the hit_point.

Definition at line 109 of file PolyLinePlugin_Circle.cc.

◆ createCircle_getPointOnMesh()

bool PolyLinePlugin::createCircle_getPointOnMesh ( TriMeshObject _triMeshObject,
ACG::Vec3d  _center,
ACG::Vec3d  _pOnPlane,
ACG::Vec3d  _n,
ACG::Vec3d _pOut 
)
private

Calculates a point on the mesh.

Finds the nearest point on the mesh given a point on the normal plane

Parameters
_triMeshObjectThe mesh to use
_centerThe center of the ellipse
_pOnPlaneThe projection of the hit point on the plane
_nThe normal of the ellipse
_pOutThe point on the mesh if one could be found.
Returns
True if a point could be found.

Definition at line 82 of file PolyLinePlugin_Circle.cc.

◆ generatePolyLineFromCut()

int PolyLinePlugin::generatePolyLineFromCut ( int  _objectId,
Vector  _planePoint,
Vector  _planeNormal,
int  _polyLineId = -1 
)

Generates a polyLine of a plane intersection.

Parameters
_objectIdid of the target object
_planePointa point on the cut plane
_planeNormalthe normal of the cut plane
_polyLineIdSpecify this if you don't want a new polyline to be generated but to reuse an existing one
Returns
returns the id of the polyLine

Definition at line 55 of file PolyLineScripting.cc.

◆ generatePolyLinesFromCut()

IdList PolyLinePlugin::generatePolyLinesFromCut ( int  _objectId,
Vector  _planePoint,
Vector  _planeNormal 
)

Generates a polyLine of a plane intersection.

Generates polyLines from a plane intersection.

Parameters
_objectIdid of the target object
_planePointa point on the cut plane
_planeNormalthe normal of the cut plane
Returns
returns the ids of the polyLine

Definition at line 163 of file PolyLineScripting.cc.

◆ getCuttedEdge()

template<class MeshT >
MeshT::EdgeHandle PolyLinePlugin::getCuttedEdge ( MeshT &  _mesh,
ACG::Vec3d _planeNormal,
ACG::Vec3d _planePoint 
)
private

get an edge of the mesh that is cut by the plane

Parameters
_meshthe mesh
_planeNormalnormal of the cut plane
_planePointpoint on the cut plane
Returns
the edge that is intersected and closest to _planePoint

Definition at line 234 of file PolyLinePluginT_impl.hh.

◆ getIntersectionPoints()

template<class MeshT >
std::vector< ACG::Vec3d > PolyLinePlugin::getIntersectionPoints ( MeshT *  _mesh,
uint  _fh,
ACG::Vec3d  _planeNormal,
ACG::Vec3d  _planePoint,
bool &  _closed 
)
private

get the points from the closest connected intersection between mesh and plane

Parameters
_meshthe mesh
_fha starting face that is intersected
_planeNormalnormal of the cut plane
_planePointpoint on the cut plane
_closedTODO find out what it's good for
Returns
a list of intersection points

Definition at line 204 of file PolyLinePluginT_impl.hh.

◆ getMultipleIntersectionPoints()

template<class MeshT >
std::vector< std::vector< ACG::Vec3d > > PolyLinePlugin::getMultipleIntersectionPoints ( MeshT *  _mesh,
ACG::Vec3d  _planeNormal,
ACG::Vec3d  _planePoint 
)
private

get all points from the intersection between mesh and plane

Parameters
_meshthe mesh
_planeNormalnormal of the cut plane
_planePointpoint on the cut plane
Returns
a list of intersection points for each connected intersection ring

Definition at line 287 of file PolyLinePluginT_impl.hh.

◆ getPointOnMesh()

ACG::Vec3d PolyLinePlugin::getPointOnMesh ( PolyLineBezierSplineData _SplineData,
ACG::Vec3d  _point,
ACG::Vec3d _nor = 0 
)
private

Returns the nearest point on the mesh or if none could be found the input.

Parameters
_SplineDataThe spline which is being used.
_pointThe input point.
_nor(Optional)Normal at nearest point.
Returns
The nearest point on the mesh from _point

Definition at line 63 of file PolyLinePlugin_BezierSpline.cc.

◆ slotScissorButton

void PolyLinePlugin::slotScissorButton ( )
privateslot

Scissor Button was hit.

Definition at line 454 of file PolyLinePlugin.cc.

◆ slotScissorLinesButton

void PolyLinePlugin::slotScissorLinesButton ( )
privateslot

Scissor Button for multiple polylines was hit.

Scissor Button was hit.

Definition at line 465 of file PolyLinePlugin.cc.

◆ slotTriggerCutPlaneSelect

void PolyLinePlugin::slotTriggerCutPlaneSelect ( )
privateslot

Generate PolyLine after the cutPlane has been drawn.

Definition at line 476 of file PolyLinePlugin.cc.

◆ updateHandles()

void PolyLinePlugin::updateHandles ( PolyLineObject _lineObject)
private

Updates the center, forward and side handle of the Poly ellipse.

Parameters
_lineObjectThe object containing the handles.

Definition at line 2046 of file PolyLinePlugin.cc.

◆ updatePolyBezierHandles()

void PolyLinePlugin::updatePolyBezierHandles ( PolyLineObject _lineObject,
ACG::SceneGraph::LineNode _line 
)
private

Updates all the handles on the PolyBezier.

Parameters
_lineObjectThe object to update.
_linethe line node containing all the handles

Definition at line 82 of file PolyLinePlugin_BezierSpline.cc.

◆ updatePolyBezierSpline()

void PolyLinePlugin::updatePolyBezierSpline ( PolyLineObject _lineObject,
unsigned int  _pointsPerSegment 
)
private

Generates points for the spline, updates handles.

Parameters
_lineObjectThe object to generate points for.
_pointsPerSegmentThe number of points per segment.

Definition at line 105 of file PolyLinePlugin_BezierSpline.cc.

◆ updatePolyEllipse()

void PolyLinePlugin::updatePolyEllipse ( PolyLineObject _lineObject,
unsigned int  _pointCount 
)
private

Generates points for the ellipse.

Parameters
_lineObjectThe object to generate points for.
_pointCountThe number of points to generate.

Definition at line 138 of file PolyLinePlugin_Circle.cc.


The documentation for this class was generated from the following files: