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
Add a toolbox to OpenFlipper.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
Control OpenFlippers status bar.
Interface class for receiving mouse events.
int createSpline_CurrSelIndex_
The index of the currently created spline.
QtPlaneSelect * planeSelect_
Plane selection tool.
void slotScissorButton()
Scissor Button was hit.
int moveBezSpline_SelSubIndex_
The index of the control or handle being moved.
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.
QActionGroup * pickToolBarActions_
Called by pick Toolbar.
QAction * cutMultipleAction_
Called by pick Toolbar.
Interface for all plugins which want to Load or Save files and create Objects.
Interface for all Plugins which provide scriptable Functions.
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< std::vector< ACG::Vec3d > > getMultipleIntersectionPoints(MeshT *_mesh, ACG::Vec3d _planeNormal, ACG::Vec3d _planePoint)
get all points from the intersection between mesh and plane
Plugins can add its own toolbox to the main widget's toolbox area by using this interface.
QAction * mergeAction_
Called by pick Toolbar.
Interface class for creating custom context menus.
Type for a MeshObject containing a triangle mesh.
QString description()
Description of the Plugin.
Interface for all Plugins which do logging to the logging window of the framework.
QAction * splitAction_
Called by pick Toolbar.
int createSpline_LastSelIndex_
Use this one to mark the last index to update the number of points.
QAction * insertCircleAction_
Called by pick Toolbar.
int generatePolyLineFromCut(int _objectId, Vector _planePoint, Vector _planeNormal, int _polyLineId=-1)
Generates a polyLine of a plane intersection.
void slotPickToolbarAction(QAction *_action)
Called by pick Toolbar.
void updatePolyBezierHandles(PolyLineObject *_lineObject, ACG::SceneGraph::LineNode *_line)
Updates all the handles on the PolyBezier.
Keyboard Event Interface.
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.
QAction * polyLineAction_
Called by Toolbar to enable pick mode.
QString name()
Name of the Plugin.
int createCircle_CurrSelIndex_
The object which is being modified(created, dragged)
bool createCircle_getPointOnMesh(TriMeshObject *_triMeshObject, ACG::Vec3d _center, ACG::Vec3d _pOnPlane, ACG::Vec3d _n, ACG::Vec3d *_pOut)
Calculates a point on the mesh.
QToolBar * toolbar_
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.
Interface class from which all plugins have to be created.
~PolyLinePlugin()
default destructor
Logtype
Log types for Message Window.
PolyLineToolbarWidget * tool_
Widget for Toolbox.
QActionGroup * toolBarActions_
Called by Toolbar to enable pick mode.
void slotTriggerCutPlaneSelect()
Generate PolyLine after the cutPlane has been drawn.
QAction * insertAction_
Called by pick Toolbar.
EditMode
Edit Mode of PolyLinePlugin.
QAction * smartMoveAction_
Called by pick Toolbar.
QAction * cutAction_
Called by pick Toolbar.
void updatePolyBezierSpline(PolyLineObject *_lineObject, unsigned int _pointsPerSegment)
Generates points for the spline, updates handles.
void slotScissorLinesButton()
Scissor Button for multiple polylines was hit.
PolyLinePlugin()
default constructor
ACG::SceneGraph::GlutPrimitiveNode * moveCircle_SelNode_
The handle which is being dragged.
QAction * moveAction_
Called by pick Toolbar.
QAction * deleteAction_
Called by pick Toolbar.
MeshT::EdgeHandle getCuttedEdge(MeshT &_mesh, ACG::Vec3d &_planeNormal, ACG::Vec3d &_planePoint)
get an edge of the mesh that is cut by the plane
QToolBar * pickToolbar_
Called by pick Toolbar.
int moveBezSpline_SelIndex_
The object which is being moved.
int createCircle_LastSelIndex_
Use this one to mark the last index to update the number of points.
void updateHandles(PolyLineObject *_lineObject)
Updates the center, forward and side handle of the Poly ellipse.
ACG::SceneGraph::GlutPrimitiveNode * moveBezSpline_SelNode_
The handle which is being dragged.
ACG::Vec3d moveCircle_LastHitPos_
The last valid hit on the mesh.
Allow access to picking functions.
QAction * insertSplineAction_
Called by pick Toolbar.
void updatePolyEllipse(PolyLineObject *_lineObject, unsigned int _pointCount)
Generates points for the ellipse.
void slotSetPolyLineMode(QAction *_action)
Called by Toolbar to enable pick mode.