55 #ifndef POLYLINEPLUGIN_HH
56 #define POLYLINEPLUGIN_HH
58 #define CGAL_NO_AUTOLINK_MPFR
59 #define CGAL_NO_AUTOLINK_GMP
84 #include "PolyLineToolbarWidget.hh"
86 #include <ObjectTypes/Plane/QtPlaneSelect.hh>
88 #include <ACG/Scenegraph/GlutPrimitiveNode.hh>
90 #include <ObjectTypes/PolyLine/PolyLineCircleData.hh>
91 #include <ObjectTypes/PolyLine/PolyLineBezierSplineData.hh>
93 #define CREATE_CUT_POLYLINE "Create Polyline"
94 #define CREATE_CUT_POLYLINES "Create Polylines"
126 #if QT_VERSION >= 0x050000
127 Q_PLUGIN_METADATA(IID
"org.OpenFlipper.Plugins.Plugin-PolyLine")
134 void updatedObject(
int _identifier,
const UpdateType& _type);
135 void nodeVisibilityChanged(
int _id);
138 void addPickMode(
const std::string& _mode );
139 void addHiddenPickMode(
const std::string& _mode );
140 void setPickModeToolbar (
const std::string& _mode, QToolBar * _toolbar);
141 void setPickModeMouseTracking(
const std::string& _mode ,
bool _mouseTracking);
144 void log(
Logtype _type, QString _message);
145 void log(QString _message);
148 void addToolbar(QToolBar* _toolbar);
149 void getToolBar( QString _name, QToolBar*& _toolbar);
152 void scriptInfo( QString _functionName );
155 void addToolbox( QString _name , QWidget* _widget, QIcon* _icon);
157 void deleteObject(
int _id );
158 void addEmptyObject(
DataType _type,
int& _id);
160 void registerKey(
int _key, Qt::KeyboardModifiers _modifiers, QString _description,
bool _multiUse =
false);
161 void showStatusMessage(QString _message,
int _timeout = 0);
162 void clearStatusMessage();
169 void initializePlugin();
171 void slotEditModeChanged();
173 void slotMouseEvent( QMouseEvent* _event );
174 void slotKeyEvent(QKeyEvent* _event);
176 void slotPickModeChanged(
const std::string& _mode);
178 void pluginsInitialized();
180 bool pick_triangle_mesh( QPoint mPos,
183 void slotUpdateContextMenu(
int objectId);
186 void slotEnablePickMode(QString _name);
209 QString
name(){
return (QString(
"PolyLine")); };
212 QString
description() {
return (QString(
"Handling of PolyLines (Insertion/Deletion/Modeling/...")); };
216 #ifdef EXTENDED_POLY_LINE
217 void slot_resample_on_edges();
222 void slot_subdivide();
223 void slot_subdivide_percent(
bool _checked);
224 void slot_decimate();
225 void slot_decimate_percent(
bool _checked);
231 void slot_smooth_project();
234 void slot_smart_move_timer();
236 void slot_setCirclePointNum(
int i);
237 void slot_setSplinePointNum(
int i);
239 virtual void slotObjectUpdated(
int _identifier,
const UpdateType &_type );
241 void slot_duplicate();
242 void slot_instanciate();
249 void me_insert ( QMouseEvent* _event );
250 void me_insertCircle( QMouseEvent* _event );
251 void me_insertSpline( QMouseEvent* _event );
252 void me_delete ( QMouseEvent* _event );
253 void me_move ( QMouseEvent* _event );
254 void me_split ( QMouseEvent* _event );
255 void me_merge ( QMouseEvent* _event );
256 void me_smart_move ( QMouseEvent* _event );
323 template<
class MeshT > std::vector< ACG::Vec3d >
328 template<
class MeshT > std::vector< std::vector< ACG::Vec3d > >
332 template<
class MeshT >
333 typename MeshT::EdgeHandle
340 QString version() {
return QString(
"1.02"); };
366 PolyLine::Point* move_point_ref_;
367 PolyLine::Point* create_point_ref_;
368 PolyLine::Point move_point_orig_;
379 bool moveCircle_IsLocked;
380 bool moveCircle_IsFloating;
382 QAction* copyPaste_Action_;
383 int copyPaste_ObjectId_;
384 int copyPaste_ActionType_;
385 int copyPaste_NewObjectId_;
386 std::vector<ACG::Vec3d> copyPaste_RelativePoints_;
387 QPoint copyPaste_LastMouse;
395 void me_copyPasteMouse(QMouseEvent* _event);
446 void createCircle_createUI(
int _polyLineObjectID);
451 void createSpline_createUI(
int _polyLineObjectID);
505 QTimer* smart_move_timer_;
514 #if defined(INCLUDE_TEMPLATES) && !defined(POLYLINEPLUGIN_CC)
515 #define POLYLINEPLUGIN_TEMPLATES
516 #include "PolyLinePluginT.cc"
519 #endif //MOVEPLUGIN_HH
int createSpline_CurrSelIndex_
The index of the currently created spline.
QAction * deleteAction_
Called by pick Toolbar.
PolyLinePlugin()
default constructor
void slotSetPolyLineMode(QAction *_action)
Called by Toolbar to enable pick mode.
Interface class from which all plugins have to be created.
void slotScissorLinesButton()
Scissor Button for multiple polylines was hit.
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
int createCircle_LastSelIndex_
Use this one to mark the last index to update the number of points.
Keyboard Event Interface.
int generatePolyLineFromCut(int _objectId, Vector _planePoint, Vector _planeNormal, int _polyLineId=-1)
Generates a polyLine of a plane intersection.
Logtype
Log types for Message Window.
MeshT::EdgeHandle getCuttedEdge(MeshT &_mesh, ACG::Vec3d &_planeNormal, ACG::Vec3d &_planePoint)
get an edge of the mesh that is cut by the plane
Type for a MeshObject containing a triangle mesh.
void updatePolyEllipse(PolyLineObject *_lineObject, unsigned int _pointCount)
Generates points for the ellipse.
QAction * polyLineAction_
Called by Toolbar to enable pick mode.
void updatePolyBezierHandles(PolyLineObject *_lineObject, ACG::SceneGraph::LineNode *_line)
Updates all the handles on the PolyBezier.
QAction * cutMultipleAction_
Called by pick Toolbar.
Interface for all Plugins which do logging to the logging window of the framework.
QAction * splitAction_
Called by pick Toolbar.
QActionGroup * toolBarActions_
Called by Toolbar to enable pick mode.
bool createCircle_getHitInfo(PolyLineCircleData *_circleData, ACG::Vec3d _hit_Point, ACG::Vec3d *_pOut=0, double *_r=0, ACG::Vec3d *_onPlane=0)
Calculates common info.
void slotPickToolbarAction(QAction *_action)
Called by pick Toolbar.
EditMode
Edit Mode of PolyLinePlugin.
QToolBar * pickToolbar_
Called by pick Toolbar.
QAction * insertCircleAction_
Called by pick Toolbar.
QAction * mergeAction_
Called by pick Toolbar.
void updateHandles(PolyLineObject *_lineObject)
Updates the center, forward and side handle of the Poly ellipse.
QString description()
Description of the Plugin.
QAction * insertAction_
Called by pick Toolbar.
std::vector< ACG::Vec3d > getIntersectionPoints(MeshT *_mesh, uint _fh, ACG::Vec3d _planeNormal, ACG::Vec3d _planePoint, bool &_closed)
get the points from the closest connected intersection between mesh and plane
std::vector< int > IdList
Standard Type for id Lists used for scripting.
bool createCircle_getPointOnMesh(TriMeshObject *_triMeshObject, ACG::Vec3d _center, ACG::Vec3d _pOnPlane, ACG::Vec3d _n, ACG::Vec3d *_pOut)
Calculates a point on the mesh.
void updatePolyBezierSpline(PolyLineObject *_lineObject, unsigned int _pointsPerSegment)
Generates points for the spline, updates handles.
Interface for all Plugins which provide scriptable Functions.
Add a toolbox to OpenFlipper.
void slotTriggerCutPlaneSelect()
Generate PolyLine after the cutPlane has been drawn.
QAction * moveAction_
Called by pick Toolbar.
ACG::SceneGraph::GlutPrimitiveNode * moveBezSpline_SelNode_
The handle which is being dragged.
~PolyLinePlugin()
default destructor
Interface for all plugins which want to Load or Save files and create Objects.
IdList generatePolyLinesFromCut(int _objectId, Vector _planePoint, Vector _planeNormal)
Generates a polyLine of a plane intersection.
ACG::Vec3d createCircle_getHit(PolyLineCircleData *_circleData, ACG::Vec3d _hit_point)
Returns point on mesh or point on the normal plane.
ACG::SceneGraph::GlutPrimitiveNode * moveCircle_SelNode_
The handle which is being dragged.
QAction * insertSplineAction_
Called by pick Toolbar.
QtPlaneSelect * planeSelect_
Plane selection tool.
int createCircle_CurrSelIndex_
The object which is being modified(created, dragged)
int moveBezSpline_SelIndex_
The object which is being moved.
Allow access to picking functions.
Control OpenFlippers status bar.
void slotScissorButton()
Scissor Button was hit.
Interface class for creating custom context menus.
Interface class for receiving mouse events.
QAction * cutAction_
Called by pick Toolbar.
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
PolyLineToolbarWidget * tool_
Widget for Toolbox.
QActionGroup * pickToolBarActions_
Called by pick Toolbar.
int createSpline_LastSelIndex_
Use this one to mark the last index to update the number of points.
QToolBar * toolbar_
Called by Toolbar to enable pick mode.
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.
ACG::Vec3d moveCircle_LastHitPos_
The last valid hit on the mesh.
QString name()
Name of the Plugin.
int moveBezSpline_SelSubIndex_
The index of the control or handle being moved.
QAction * smartMoveAction_
Called by pick Toolbar.