Developer Documentation
BSplineCurveSelectionPlugin.cc
1 /*===========================================================================*\
2  * *
3  * OpenFlipper *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openflipper.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenFlipper. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40 \*===========================================================================*/
41 
42 /*===========================================================================*\
43  * *
44  * $Revision$ *
45  * $Author$ *
46  * $Date$ *
47  * *
48 \*===========================================================================*/
49 
50 #include "BSplineCurveSelectionPlugin.hh"
51 
53 
54 // Primitive type icons
55 #define CONTROL_POINT_TYPE "controlpointselection.png"
56 #define KNOT_TYPE "knotselection.png"
57 // =======================================
58 // Define operations
59 // =======================================
60 // General Operations:
61 #define G_CP_MODE "Control Point Selection View"
62 #define G_K_MODE "Knot Selection View"
63 
64 // Control points:
65 #define CP_SELECT_ALL "Select All Control Points"
66 #define CP_DESELECT_ALL "Deselect All Control Points"
67 #define CP_INVERT "Invert Control Point Selection"
68 #define CP_DELETE "Delete Selected Control Points"
69 
70 // Knots:
71 #define K_SELECT_ALL "Select All Knots"
72 #define K_DESELECT_ALL "Deselect All Knots"
73 #define K_INVERT "Invert Knot Selection"
74 #define K_DELETE "Delete Selected Knots"
75 
78 controlPointType_(0),
79 knotType_(0),
80 allSupportedTypes_(0) {
81 }
82 
83 //==============================================================================================
84 
86 }
87 
88 //==============================================================================================
89 
90 void BSplineCurveSelectionPlugin::initializePlugin() {
91 
92  // Tell core about all scriptable slots
94 }
95 
96 //==============================================================================================
97 
98 void BSplineCurveSelectionPlugin::pluginsInitialized() {
99  // Create new selection environment for skeletons
100  // and register skeleton data type for the environment.
101 
102  QString iconPath = OpenFlipper::Options::iconDirStr() + OpenFlipper::Options::dirSeparator();
103 
104  emit addSelectionEnvironment("B-Spline Curve Selections", "Select B-Spline curve primitives.",
105  iconPath + "bsplinecurve.png", environmentHandle_);
106 
107  // Register mesh object types
108  emit registerType(environmentHandle_, DATA_BSPLINE_CURVE);
109 
110  emit addPrimitiveType(environmentHandle_, "Select Control Points", iconPath + CONTROL_POINT_TYPE, controlPointType_);
111  emit addPrimitiveType(environmentHandle_, "Select Knots", iconPath + KNOT_TYPE, knotType_);
112 
114 
115  // Determine, which selection modes are requested
116  emit showToggleSelectionMode(environmentHandle_, true, allSupportedTypes_);
117  emit showVolumeLassoSelectionMode(environmentHandle_, true, allSupportedTypes_);
118 
119  QStringList generalOperations;
120  generalOperations.append(G_CP_MODE);
121  generalOperations.append(G_K_MODE);
122 
123  // Define control point and knot operations
124  QStringList controlPointOperations;
125  controlPointOperations.append(CP_SELECT_ALL);
126  controlPointOperations.append(CP_DESELECT_ALL);
127  controlPointOperations.append(CP_INVERT);
128  controlPointOperations.append(CP_DELETE);
129 
130  QStringList knotOperations;
131  knotOperations.append(K_SELECT_ALL);
132  knotOperations.append(K_DESELECT_ALL);
133  knotOperations.append(K_INVERT);
134  knotOperations.append(K_DELETE);
135 
136  emit addSelectionOperations(environmentHandle_, generalOperations, "Selection Operations");
137  emit addSelectionOperations(environmentHandle_, controlPointOperations, "Control Point Operations", controlPointType_);
138  emit addSelectionOperations(environmentHandle_, knotOperations, "Knot Operations", knotType_);
139 
140  // Register key shortcuts:
141 
142  // Select (a)ll
143  emit registerKeyShortcut(Qt::Key_A, Qt::ControlModifier);
144  // (C)lear selection
145  emit registerKeyShortcut(Qt::Key_C, Qt::NoModifier);
146  // (I)nvert selection
147  emit registerKeyShortcut(Qt::Key_I, Qt::NoModifier);
148  // Delete selected entities
149  emit registerKeyShortcut(Qt::Key_Delete, Qt::NoModifier);
150 }
151 
152 //==============================================================================================
153 
155 
156  emit setSlotDescription("selectAllControlPoints(int)", tr("Select all control points of a B-spline curve"),
157  QStringList("objectId"), QStringList("Id of object"));
158  emit setSlotDescription("deselectAllControlPoints(int)", tr("Deselect all control points of a B-spline curve"),
159  QStringList("objectId"), QStringList("Id of object"));
160  emit setSlotDescription("invertControlPointSelection(int)", tr("Invert control point selection"),
161  QStringList("objectId"), QStringList("Id of object"));
162  emit setSlotDescription("deleteSelectedControlPoints(int)", tr("Delete selected control points"),
163  QStringList("objectId"), QStringList("Id of object"));
164  emit setSlotDescription("selectControlPoints(int,IdList)", tr("Select the specified control points"),
165  QString("objectId,control pointList").split(","), QString("Id of object,List of control points").split(","));
166 
167  emit setSlotDescription("loadSelection(int,QString)", tr("Load selection from selection file"),
168  QString("objectId,filename").split(","), QString("Id of an object,Selection file").split(","));
169 
170  emit setSlotDescription("selectAllKnots(int)", tr("Select all knots of a B-spline curve"),
171  QStringList("objectId"), QStringList("Id of object"));
172  emit setSlotDescription("deselectAllKnots(int)", tr("Deselect all knots of a B-spline curve"),
173  QStringList("objectId"), QStringList("Id of object"));
174  emit setSlotDescription("invertKnotSelection(int)", tr("Invert knot selection"),
175  QStringList("objectId"), QStringList("Id of object"));
176  emit setSlotDescription("deleteSelectedKnots(int)", tr("Delete selected knots"),
177  QStringList("objectId"), QStringList("Id of object"));
178  emit setSlotDescription("selectKnots(int,IdList)", tr("Select the specified knots"),
179  QString("objectId,knotList").split(","), QString("Id of object,List of knots").split(","));
180 }
181 
182 //==============================================================================================
183 
185 
186  SelectionInterface::PrimitiveType type = 0u;
187  emit getActivePrimitiveType(type);
188 
189  if((type & allSupportedTypes_) == 0)
190  return;
191 
192  // Test if operation should be applied to target objects only
193  bool targetsOnly = false;
194  emit targetObjectsOnly(targetsOnly);
197 
198  if(_operation == G_CP_MODE) {
199  // Set selection view mode
201  } else if(_operation == G_K_MODE) {
202  // Set selection view mode
204  } else if(_operation == CP_SELECT_ALL) {
205  // Select all control points
207  o_it != PluginFunctions::objectsEnd(); ++o_it) {
208  if (o_it->visible()) {
209  selectAllControlPoints(o_it->id());
210  }
211 
212  emit updatedObject(o_it->id(), UPDATE_SELECTION);
213  emit createBackup(o_it->id(), "Select All Controlpoints", UPDATE_SELECTION);
214  }
215  } else if (_operation == CP_DESELECT_ALL) {
216  // Deselect all control points
218  o_it != PluginFunctions::objectsEnd(); ++o_it) {
219  if (o_it->visible()) {
220  deselectAllControlPoints(o_it->id());
221  }
222 
223  emit updatedObject(o_it->id(), UPDATE_SELECTION);
224  emit createBackup(o_it->id(), "Deselect All Controlpoints", UPDATE_SELECTION);
225  }
226  } else if (_operation == CP_INVERT) {
227  // Invert control point selection
229  o_it != PluginFunctions::objectsEnd(); ++o_it) {
230  if (o_it->visible()) {
231  invertControlPointSelection(o_it->id());
232  }
233 
234  emit updatedObject(o_it->id(), UPDATE_SELECTION);
235  emit createBackup(o_it->id(), "Invert Controlpoint Selection", UPDATE_SELECTION);
236  }
237  } else if (_operation == CP_DELETE) {
238  // Delete control point selection
240  o_it != PluginFunctions::objectsEnd(); ++o_it) {
241  if (o_it->visible()) {
242  deleteSelectedControlPoints(o_it->id());
243  }
244 
245  emit updatedObject(o_it->id(), UPDATE_SELECTION);
246  emit createBackup(o_it->id(), "Delete Controlpoint Selection", UPDATE_SELECTION);
247  }
248  } else if(_operation == K_SELECT_ALL) {
249  // Select all control points
251  o_it != PluginFunctions::objectsEnd(); ++o_it) {
252  if (o_it->visible()) {
253  selectAllKnots(o_it->id());
254  }
255 
256  emit updatedObject(o_it->id(), UPDATE_SELECTION);
257  emit createBackup(o_it->id(), "Select All Knots", UPDATE_SELECTION);
258  }
259  } else if (_operation == K_DESELECT_ALL) {
260  // Deselect all control points
262  o_it != PluginFunctions::objectsEnd(); ++o_it) {
263  if (o_it->visible()) {
264  deselectAllKnots(o_it->id());
265  }
266 
267  emit updatedObject(o_it->id(), UPDATE_SELECTION);
268  emit createBackup(o_it->id(), "Deselect All Knots", UPDATE_SELECTION);
269  }
270  } else if (_operation == K_INVERT) {
271  // Invert knot selection
273  o_it != PluginFunctions::objectsEnd(); ++o_it) {
274  if (o_it->visible()) {
275  invertKnotSelection(o_it->id());
276  }
277 
278  emit updatedObject(o_it->id(), UPDATE_SELECTION);
279  emit createBackup(o_it->id(), "Invert Knot Selection", UPDATE_SELECTION);
280  }
281  } else if (_operation == K_DELETE) {
282  // Delete knot selection
284  o_it != PluginFunctions::objectsEnd(); ++o_it) {
285  if (o_it->visible()) {
286  deleteSelectedKnots(o_it->id());
287  }
288 
289  emit updatedObject(o_it->id(), UPDATE_ALL);
290  emit createBackup(o_it->id(), "Delete Knot Selection", UPDATE_ALL);
291  }
292  }
293 }
294 
295 //==============================================================================================
296 
297 void BSplineCurveSelectionPlugin::slotToggleSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect) {
298 
299  // Return if none of the currently active types is handled by this plugin
300  if((_currentType & allSupportedTypes_) == 0) return;
301 
302  unsigned int node_idx, target_idx;
303  ACG::Vec3d hit_point;
304 
305  BaseObjectData* object = 0;
306 
307  ACG::SceneGraph::PickTarget pickTarget;
308  if(_currentType & controlPointType_) {
309  // Control point selection
310  pickTarget = ACG::SceneGraph::PICK_VERTEX;
311  } else {
312  // Knot selection
313  pickTarget = ACG::SceneGraph::PICK_SPLINE;
314  }
315 
316  // Perform picking
317  bool successfullyPicked = PluginFunctions::scenegraphPick(pickTarget, _event->pos(), node_idx,
318  target_idx, &hit_point) && PluginFunctions::getPickedObject(node_idx, object);
319 
320  if(successfullyPicked) {
323 
324  if(!curve)
325  return;
326 
327  if(_currentType & controlPointType_) {
328  // Control point selection
329  if(!curve->controlpoint_selections_available()) return;
330 
331  // Enable control point texture mode
333 
334  if(curve->controlpoint_selected(target_idx))
335  curve->deselect_controlpoint(target_idx);
336  else
337  curve->select_controlpoint(target_idx);
338  }
339 
340  if(_currentType & knotType_) {
341  // Knot selection
342  if(!curve->get_knotvector_ref()->selections_available()) return;
343 
344  // Enable control point texture mode
346 
347  int numKnots = curve->n_knots();
348  int order = curve->degree() + 1;
349 
350  Knotvector* knotvec = curve->get_knotvector_ref();
351 
352  double minu = knotvec->getKnot(curve->degree());
353  double maxu = knotvec->getKnot(numKnots - order);
354  double udiff = maxu - minu;
355 
356  int texres = co->splineCurveNode()->pick_texture_res();
357  double param = ((double)target_idx/(double)texres) * udiff + minu;
358 
359  ACG::Vec2i interval = curve->interval(param);
360 
361  int knotIdx = interval[0];
362 
363  if(knotvec->selected(knotIdx)) {
364  knotvec->deselect(knotIdx);
365  } else {
366  knotvec->select(knotIdx);
367  }
368  }
369 
370  emit updatedObject(object->id(), UPDATE_SELECTION);
371  emit createBackup(object->id(), "Toogle Selection", UPDATE_SELECTION);
372  }
373 }
374 
375 //==============================================================================================
376 
377 void BSplineCurveSelectionPlugin::slotVolumeLassoSelection(QMouseEvent* _event, SelectionInterface::PrimitiveType _currentType, bool _deselect) {
378 
379  // Return if none of the currently active types is handled by this plugin
380  if((_currentType & allSupportedTypes_) == 0) return;
381 
382  ACG::Vec3d hit_point;
383 
384  if(_event->type() == QEvent::MouseButtonPress) {
385 
387  QPoint p(_event->pos().x(), state.viewport_height() - _event->pos().y());
388 
389  volumeLassoPoints_.append(p);
390 
391  return;
392 
393  } else if(_event->type() == QEvent::MouseButtonDblClick) {
394 
396 
397  QPolygon polygon(volumeLassoPoints_);
398 
399  bool targetsOnly = false;
400  emit targetObjectsOnly(targetsOnly);
403 
404  // Select all primitives that lie in this region
406  o_it != PluginFunctions::objectsEnd(); ++o_it) {
407 
408  if (o_it->visible()) {
409 
412 
413  if(curve) {
414 
415  if(_currentType & controlPointType_) {
416  // Select control points
417  if(!curve->controlpoint_selections_available()) return;
418 
419  // Enable control point texture mode
421 
422  for(unsigned int i = 0; i < curve->n_control_points(); ++i) {
423  ACG::Vec3d c = curve->get_control_point(i);
424  ACG::Vec3d pc = state.project(c);
425  QPoint p((int)pc[0], (int)pc[1]);
426  if(polygon.containsPoint(p, Qt::OddEvenFill)) {
427  if(_deselect)
428  curve->deselect_controlpoint(i);
429  else
430  curve->select_controlpoint(i);
431  }
432  }
433  }
434 
435  if(_currentType & knotType_) {
436  // Select knots
437  if(!curve->get_knotvector_ref()->selections_available()) return;
438 
439  // Enable knot texture mode
441 
442  int numKnots = curve->n_knots();
443  int order = curve->degree() + 1;
444 
445  Knotvector* knotvec = curve->get_knotvector_ref();
446 
447  // Go over all B-spline knot midpoints and test
448  // if computed position on curve lies within the polygon
449  if(curve->degree() == 0) return;
450  if((int)curve->n_knots() <= ((numKnots - order) + 1)) return;
451 
452  for(int i = curve->degree()-1; i < (numKnots - order)-1; ++i) {
453 
454  double baseKnot = knotvec->getKnot(i+1);
455  double dhalf = 0.5*(knotvec->getKnot(i+2) - baseKnot);
456 
457  double t = baseKnot + dhalf;
458 
459  // Project curve point
460  ACG::Vec3d pcp = state.project(curve->curvePoint(t));
461 
462  QPoint p((int)pcp[0], (int)pcp[1]);
463 
464  if(polygon.containsPoint(p, Qt::OddEvenFill)) {
465  if(_deselect) {
466  knotvec->deselect(i+1);
467  } else {
468  knotvec->select(i+1);
469  }
470  }
471  }
472  }
473  }
474  }
475 
476  emit updatedObject(o_it->id(), UPDATE_SELECTION);
477  emit createBackup(o_it->id(), "Lasso Selection", UPDATE_SELECTION);
478  }
479 
480  // Clear lasso points
481  volumeLassoPoints_.clear();
482  }
483 }
484 
485 //==============================================================================================
486 
487 void BSplineCurveSelectionPlugin::loadSelection(int _objId, const QString& _filename) {
488 
489  // Load ini file
490  INIFile file;
491 
492  if(!file.connect(_filename, false)) {
493  emit log(LOGERR, QString("Could not read file '%1'!").arg(_filename));
494  return;
495  }
496 
497  // Load selection from file
498  loadIniFile(file, _objId);
499 }
500 
501 //==============================================================================================
502 
503 void BSplineCurveSelectionPlugin::loadIniFile(INIFile& _ini, int _id) {
504  // From INI Interface
505  // Load plugin specific settings
506 }
507 
508 //==============================================================================================
509 
510 void BSplineCurveSelectionPlugin::saveIniFile(INIFile& _ini, int _id) {
511  // From INI Interface
512  // Save plugin specific settings
513 }
514 
515 //==============================================================================================
516 
518 
519  // Iterate over all B-spline curves in the scene and save
520  // the selections for all supported entity types
522  o_it != PluginFunctions::objectsEnd(); ++o_it) {
523 
524  // Read section for each object
525  // Append object name to section identifier
526  QString section = QString("BSplineCurveSelection") + "//" + o_it->name();
527  if(!_file.section_exists(section)) {
528  continue;
529  }
530 
531  std::vector<int> ids;
532  // Read control point selection:
533  _file.get_entry(ids, section, "ControlPointSelection");
534  selectControlPoints(o_it->id(), ids);
535  ids.clear();
536  // Read knot selection:
537  _file.get_entry(ids, section, "KnotSelection");
538  selectKnots(o_it->id(), ids);
539  ids.clear();
540 
541  emit updatedObject(o_it->id(), UPDATE_SELECTION);
542  emit createBackup(o_it->id(), "Load Selection", UPDATE_SELECTION);
543  }
544 
546 }
547 
548 //==============================================================================================
549 
551 
552  // Iterate over all B-spline curves in the scene and save
553  // the selections for all entity types
555  o_it != PluginFunctions::objectsEnd(); ++o_it) {
556 
557  // Create section for each object
558  // Append object name to section identifier
559  QString section = QString("BSplineCurveSelection") + "//" + o_it->name();
560 
561  // Store control point selection
562  _file.add_entry(section, "ControlPointSelection", getControlPointSelection(o_it->id()));
563  _file.add_entry(section, "KnotSelection", getKnotSelection(o_it->id()));
564  }
565 }
566 
567 //==============================================================================================
568 
569 void BSplineCurveSelectionPlugin::slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers) {
570 
571  SelectionInterface::PrimitiveType type = 0u;
572  emit getActivePrimitiveType(type);
573 
574  if((type & allSupportedTypes_) == 0) {
575  // No supported type is active
576  return;
577  }
578 
579  bool targetsOnly = false;
580  emit targetObjectsOnly(targetsOnly);
583 
584  if(_key == Qt::Key_A && _modifiers == Qt::ControlModifier) {
585  // Select all
587  o_it != PluginFunctions::objectsEnd(); ++o_it) {
588  if (o_it->visible()) {
589  if(type & controlPointType_) selectAllControlPoints(o_it->id());
590  if(type & knotType_) selectAllKnots(o_it->id());
591  }
592  emit updatedObject(o_it->id(), UPDATE_SELECTION);
593  emit createBackup(o_it->id(), "Select All", UPDATE_SELECTION);
594  }
595  } else if(_key == Qt::Key_C && _modifiers == Qt::NoModifier) {
596  // Deselect all
598  o_it != PluginFunctions::objectsEnd(); ++o_it) {
599  if (o_it->visible()) {
600  if(type & controlPointType_) deselectAllControlPoints(o_it->id());
601  if(type & knotType_) deselectAllKnots(o_it->id());
602  }
603  emit updatedObject(o_it->id(), UPDATE_SELECTION);
604  emit createBackup(o_it->id(), "Clear Selection", UPDATE_SELECTION);
605  }
606  } else if(_key == Qt::Key_I && _modifiers == Qt::NoModifier) {
607  // Invert selection
609  o_it != PluginFunctions::objectsEnd(); ++o_it) {
610  if (o_it->visible()) {
611  if(type & controlPointType_) invertControlPointSelection(o_it->id());
612  if(type & knotType_) invertKnotSelection(o_it->id());
613  }
614  emit updatedObject(o_it->id(), UPDATE_SELECTION);
615  emit createBackup(o_it->id(), "Invert Selection", UPDATE_SELECTION);
616  }
617  } else if(_key == Qt::Key_Delete && _modifiers == Qt::NoModifier) {
618  // Delete selection
620  o_it != PluginFunctions::objectsEnd(); ++o_it) {
621  if (o_it->visible()) {
622  if(type & controlPointType_) deleteSelectedControlPoints(o_it->id());
623  if(type & knotType_) deleteSelectedKnots(o_it->id());
624  }
625  emit updatedObject(o_it->id(), UPDATE_ALL);
626  emit createBackup(o_it->id(), "Delete Selection", UPDATE_ALL);
627  }
628  }
629 }
630 
632 
634  o_it != PluginFunctions::objectsEnd(); ++o_it) {
635 
637  if(_mode == CP) {
639  }
640  else {
642  }
643 
644  emit updatedObject(o_it->id(), UPDATE_SELECTION);
645  }
646 }
647 
648 //==============================================================================================
649 
650 #if QT_VERSION < 0x050000
651  Q_EXPORT_PLUGIN2(bsplinecurveselectionplugin, BSplineCurveSelectionPlugin);
652 #endif
653 
654 
void slotLoadSelection(const INIFile &_file)
Load selection for specific objects in the scene.
void slotSelectionOperation(QString _operation)
A specific operation is requested.
SelectionViewMode
Change selection view mode for every B-spline curve in the scene.
bool scenegraphPick(ACG::SceneGraph::PickTarget _pickTarget, const QPoint &_mousePos, unsigned int &_nodeIdx, unsigned int &_targetIdx, ACG::Vec3d *_hitPointPtr=0)
Execute picking operation on scenegraph.
void setSelectionViewMode(const SelectionViewMode _mode)
Change selection view mode for every B-spline curve in the scene.
QStringList IteratorRestriction
Iterable object range.
IdList getKnotSelection(int _objectId)
Get current knot selection.
Predefined datatypes.
Definition: DataTypes.hh:96
BSplineCurveSelectionPlugin()
Default constructor.
ACG::Vec2i interval(double _t)
ACG::GLState & glState()
Get the glState of the Viewer.
void slotKeyShortcutEvent(int _key, Qt::KeyboardModifiers _modifiers)
One of the previously registered keys has been pressed.
void selectKnots(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific knots of a curve.
void selectAllKnots(int _objectId)
Select all knots of a curve.
QString environmentHandle_
Handle to selection environment.
const QStringList TARGET_OBJECTS("target")
Iterable object range.
BSplineCurve * splineCurve(BaseObjectData *_object)
Get a Bspline curve from an object.
Point & get_control_point(int _i)
get control point i
unsigned int n_control_points() const
Returns the number of control points.
void slotVolumeLassoSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a volume lasso selection.
unsigned int n_knots() const
Returns the number of knots.
int id() const
Definition: BaseObject.cc:201
void deleteSelectedKnots(int _objectId)
Delete selected knots.
const QStringList ALL_OBJECTS
Iterable object range.
bool getPickedObject(const unsigned int _node_idx, BaseObjectData *&_object)
Get the picked mesh.
Vec3d project(const Vec3d &_point) const
project point in world coordinates to window coordinates
Definition: GLState.cc:638
PickTarget
What target to use for picking.
Definition: BaseNode.hh:99
unsigned int degree() const
Returns the spline degree.
IdList getControlPointSelection(int _objectId)
Get current control point selection.
Point curvePoint(Scalar _u)
bool get_entry(QString &_val, const QString &_section, const QString &_key) const
Access to a string entry.
Definition: INIFile.cc:439
void slotSaveSelection(INIFile &_file)
Save selection for all objects in the scene.
Viewer::ViewerProperties & viewerProperties(int _id)
Get the viewer properties Use this functions to get basic viewer properties such as backgroundcolor o...
QVector< QPoint > volumeLassoPoints_
Keep volume lasso points.
BSplineCurveObject * bsplineCurveObject(BaseObjectData *_object)
Cast an BaseObject to a BSplineCurveObject if possible.
bool section_exists(const QString &_section) const
Check if given section exists in the current INI file.
Definition: INIFile.cc:233
bool connect(const QString &name, const bool create)
Connect INIFile object with given filename.
Definition: INIFile.cc:76
Class for the handling of simple configuration files.
Definition: INIFile.hh:105
ACG::SceneGraph::BSplineCurveNodeT< BSplineCurve > * splineCurveNode()
Get the scenegraph Node.
void deselectAllKnots(int _objectId)
Deselect all knots of a curve.
void selectAllControlPoints(int _objectId)
Select all control points of a curve.
picks verices (may not be implemented for all nodes)
Definition: BaseNode.hh:108
Pick spline curve or surface (picks u or u,v coords respectively)
Definition: BaseNode.hh:118
void slotToggleSelection(QMouseEvent *_event, SelectionInterface::PrimitiveType _currentType, bool _deselect)
Called whenever the user performs a toggle selection.
void selectControlPoints(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific control points of a curve.
Knotvector * get_knotvector_ref()
get a reference to the knotvector
const UpdateType UPDATE_SELECTION(UpdateTypeSet(1)<< 4)
Selection updated.
#define DATA_BSPLINE_CURVE
Definition: BSplineCurve.hh:73
unsigned int controlPointType_
Primitive type handles:
void updateSlotDescriptions()
Set slot descriptions for scripting functions.
const UpdateType UPDATE_ALL(UpdateTypeSet(1))
Identifier for all updates.
int viewport_height() const
get viewport height
Definition: GLState.hh:827
void deleteSelectedControlPoints(int _objectId)
Delete selected control points.
unsigned int knotType_
Handle to selection environment.
void deselectAllControlPoints(int _objectId)
Deselect all control points of a curve.
void add_entry(const QString &_section, const QString &_key, const QString &_value)
Addition / modification of a string entry.
Definition: INIFile.cc:263
void invertControlPointSelection(int _objectId)
Invert control point selection.
unsigned int allSupportedTypes_
Handle to selection environment.
DLLEXPORT ObjectIterator objectsEnd()
Return Iterator to Object End.
void invertKnotSelection(int _objectId)
Invert knot selection.
~BSplineCurveSelectionPlugin()
Default destructor.