45 #include "PolyLineSelectionPlugin.hh" 52 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
59 for(
unsigned int i = 0; i < polyline->
n_vertices(); ++i) {
60 polyline->select_vertex(i);
64 emit scriptInfo(
"selectAllVertices(ObjectId)");
72 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
79 for(
unsigned int i = 0; i < polyline->
n_vertices(); ++i) {
80 polyline->deselect_vertex(i);
84 emit scriptInfo(
"deselectAllVertices(ObjectId)");
92 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
99 for(
unsigned int i = 0; i < polyline->
n_vertices(); ++i) {
101 if(polyline->vertex_selected(i))
102 polyline->deselect_vertex(i);
104 polyline->select_vertex(i);
108 emit scriptInfo(
"invertVertexSelection(ObjectId)");
116 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
123 bool breakWhile =
false;
127 bool oneFound =
false;
131 if(polyline->vertex_selected(i)) {
139 if(i == polyline->
n_vertices() && !oneFound) {
146 emit scriptInfo(
"deleteSelectedVertices(ObjectId)");
151 if(_ids.empty() )
return;
156 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
162 for(IdList::const_iterator it = _ids.begin(); it != _ids.end(); ++it) {
164 if(_deselect) polyline->deselect_vertex(*it);
165 else polyline->select_vertex(*it);
170 QString selection =
"selectVertices(ObjectId, [ " + QString::number(_ids[0]);
172 for (uint i = 1 ; i < _ids.size(); ++i) {
173 selection +=
", " + QString::number(_ids[i]);
178 emit scriptInfo(selection);
188 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
195 for(
unsigned int i = 0; i < polyline->
n_vertices(); ++i) {
196 if(polyline->vertex_selected(i))
211 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
218 for(
unsigned int i = 0; i < polyline->
n_edges(); ++i) {
219 polyline->select_edge(i);
223 emit scriptInfo(
"selectAllEdges(ObjectId)");
231 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
238 for(
unsigned int i = 0; i < polyline->
n_edges(); ++i) {
239 polyline->deselect_edge(i);
243 emit scriptInfo(
"deselectAllEdges(ObjectId)");
251 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
258 for(
unsigned int i = 0; i < polyline->
n_edges(); ++i) {
259 if(polyline->edge_selected(i))
260 polyline->deselect_edge(i);
262 polyline->select_edge(i);
266 emit scriptInfo(
"deselectAllEdges(ObjectId)");
274 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
281 bool breakWhile =
false;
285 bool oneFound =
false;
287 for(; i < polyline->
n_edges(); ++i) {
289 if(polyline->edge_selected(i)) {
317 if(i == polyline->
n_edges() && !oneFound) {
324 emit scriptInfo(
"deleteSelectedEdges(ObjectId)");
329 if(_ids.empty() )
return;
334 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
340 for (IdList::const_iterator it = _ids.begin(); it != _ids.end(); ++it) {
342 if(*it < (
int)polyline->
n_edges()) {
343 if(_deselect) polyline->deselect_edge(*it);
344 else polyline->select_edge(*it);
349 QString selection =
"selectEdges(ObjectId, [ " + QString::number(_ids[0]);
351 for (uint i = 1 ; i < _ids.size(); ++i) {
352 selection +=
", " + QString::number(_ids[i]);
357 emit scriptInfo(selection);
367 emit log(
LOGERR, tr(
"Could not get object with id %1").arg(_objectId));
374 for(
unsigned int i = 0; i < polyline->
n_edges(); ++i) {
375 if(polyline->edge_selected(i))
void deleteSelectedVertices(int _objectId)
Delete selected vertices.
IdList getVertexSelection(int _objectId)
Get current vertex selection.
void delete_point(int _idx)
Delete point at _idx.
void invertVertexSelection(int _objectId)
Invert vertex selection.
IdList getEdgeSelection(int _objectId)
Get current edge selection.
size_t n_vertices() const
Get number of vertices.
void deselectAllEdges(int _objectId)
Deselect all edges of a skeleton.
void invertEdgeSelection(int _objectId)
Invert edge selection.
void selectAllVertices(int _objectId)
Select all vertices of a skeleton.
void deselectAllVertices(int _objectId)
Deselect all vertices of a skeleton.
void deleteSelectedEdges(int _objectId)
Delete selected edges.
void selectAllEdges(int _objectId)
Select all edges of a skeleton.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
void selectEdges(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific edges of a skeleton.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
size_t n_edges() const
Get number of edges.
void selectVertices(int _objectId, const IdList &_ids, bool _deselect=false)
Select specific vertices of a skeleton.
PolyLine * polyLine(BaseObjectData *_object)
Get a poly Line from an object.
bool is_closed() const
Check if the polyline is marked as closed.