51 #include "PolyLineSelectionPlugin.hh"
58 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
65 for(
unsigned int i = 0; i < polyline->
n_vertices(); ++i) {
66 polyline->select_vertex(i);
70 emit scriptInfo(
"selectAllVertices(ObjectId)");
78 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
85 for(
unsigned int i = 0; i < polyline->
n_vertices(); ++i) {
86 polyline->deselect_vertex(i);
90 emit scriptInfo(
"deselectAllVertices(ObjectId)");
98 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
105 for(
unsigned int i = 0; i < polyline->
n_vertices(); ++i) {
107 if(polyline->vertex_selected(i))
108 polyline->deselect_vertex(i);
110 polyline->select_vertex(i);
114 emit scriptInfo(
"invertVertexSelection(ObjectId)");
122 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
129 bool breakWhile =
false;
133 bool oneFound =
false;
137 if(polyline->vertex_selected(i)) {
145 if(i == polyline->
n_vertices() && !oneFound) {
152 emit scriptInfo(
"deleteSelectedVertices(ObjectId)");
157 if(_ids.empty() )
return;
162 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
168 for(IdList::const_iterator it = _ids.begin(); it != _ids.end(); ++it) {
170 if(_deselect) polyline->deselect_vertex(*it);
171 else polyline->select_vertex(*it);
176 QString selection =
"selectVertices(ObjectId, [ " + QString::number(_ids[0]);
178 for (uint i = 1 ; i < _ids.size(); ++i) {
179 selection +=
", " + QString::number(_ids[i]);
184 emit scriptInfo(selection);
194 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
201 for(
unsigned int i = 0; i < polyline->
n_vertices(); ++i) {
202 if(polyline->vertex_selected(i))
217 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
224 for(
unsigned int i = 0; i < polyline->
n_edges(); ++i) {
225 polyline->select_edge(i);
229 emit scriptInfo(
"selectAllEdges(ObjectId)");
237 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
244 for(
unsigned int i = 0; i < polyline->
n_edges(); ++i) {
245 polyline->deselect_edge(i);
249 emit scriptInfo(
"deselectAllEdges(ObjectId)");
257 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
264 for(
unsigned int i = 0; i < polyline->
n_edges(); ++i) {
265 if(polyline->edge_selected(i))
266 polyline->deselect_edge(i);
268 polyline->select_edge(i);
272 emit scriptInfo(
"deselectAllEdges(ObjectId)");
280 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
287 bool breakWhile =
false;
291 bool oneFound =
false;
293 for(; i < polyline->
n_edges(); ++i) {
295 if(polyline->edge_selected(i)) {
323 if(i == polyline->
n_edges() && !oneFound) {
330 emit scriptInfo(
"deleteSelectedEdges(ObjectId)");
335 if(_ids.empty() )
return;
340 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
346 for (IdList::const_iterator it = _ids.begin(); it != _ids.end(); ++it) {
348 if(*it < (
int)polyline->
n_edges()) {
349 if(_deselect) polyline->deselect_edge(*it);
350 else polyline->select_edge(*it);
355 QString selection =
"selectEdges(ObjectId, [ " + QString::number(_ids[0]);
357 for (uint i = 1 ; i < _ids.size(); ++i) {
358 selection +=
", " + QString::number(_ids[i]);
363 emit scriptInfo(selection);
373 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
380 for(
unsigned int i = 0; i < polyline->
n_edges(); ++i) {
381 if(polyline->edge_selected(i))
size_t n_vertices() const
Get number of vertices.
void invertEdgeSelection(int _objectId)
Invert edge selection.
PolyLine * polyLine(BaseObjectData *_object)
Get a poly Line from an object.
bool getObject(int _identifier, BSplineCurveObject *&_object)
size_t n_edges() const
Get number of edges.
void selectAllEdges(int _objectId)
Select all edges of a skeleton.
bool is_closed() const
Check if the polyline is marked as closed.
void delete_point(int _idx)
Delete point at _idx.
IdList getEdgeSelection(int _objectId)
Get current edge selection.
void selectAllVertices(int _objectId)
Select all vertices of a skeleton.
void deleteSelectedEdges(int _objectId)
Delete selected edges.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
void deselectAllEdges(int _objectId)
Deselect all edges of a skeleton.
void invertVertexSelection(int _objectId)
Invert vertex selection.
void selectVertices(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific vertices of a skeleton.
void deselectAllVertices(int _objectId)
Deselect all vertices of a skeleton.
IdList getVertexSelection(int _objectId)
Get current vertex selection.
void selectEdges(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific edges of a skeleton.
void deleteSelectedVertices(int _objectId)
Delete selected vertices.