50 #include "MeshObjectSelectionPlugin.hh" 60 if(_halfedgeList.empty() )
return;
64 emit log(
LOGERR,tr(
"selectHalfedges: unable to get object"));
73 emit log(
LOGERR,tr(
"selectHalfedges: Unsupported object Type"));
77 QString selection =
"selectHalfedges(ObjectId(" + QString::number(objectId) +
") , [ " + QString::number(_halfedgeList[0]);
79 for (uint i = 1 ; i < _halfedgeList.size(); ++i) {
80 selection +=
" , " + QString::number(_halfedgeList[i]);
86 emit scriptInfo(selection);
93 if(_halfedgeList.empty() )
return;
97 emit log(
LOGERR,tr(
"unselectHalfedges: unable to get object"));
106 emit log(
LOGERR,tr(
"unselectHalfedges: Unsupported object Type"));
110 QString selection =
"unselectVertices(ObjectId(" + QString::number(objectId) +
") , [ " + QString::number(_halfedgeList[0]);
112 for (uint i = 1 ; i < _halfedgeList.size(); ++i) {
113 selection +=
" , " + QString::number(_halfedgeList[i]);
119 emit scriptInfo(selection);
128 emit log(
LOGERR,tr(
"selectAllVertices: unable to get object"));
137 emit log(
LOGERR,tr(
"selectAllHalfedges: Unsupported object Type"));
142 emit scriptInfo(
"selectAllHalfedges(ObjectId(" + QString::number(objectId) +
"))");
151 emit log(
LOGERR,tr(
"clearHalfedgeSelection: unable to get object"));
160 emit log(
LOGERR,tr(
"clearHalfedgeSelection: Unsupported object Type"));
165 emit scriptInfo(
"clearHalfedgeSelection(ObjectId(" + QString::number(objectId) +
"))");
174 emit log(
LOGERR,tr(
"invertHalfedgeSelection: unable to get object"));
183 emit log(
LOGERR,tr(
"invertHalfedgeSelection: Unsupported object Type"));
188 emit scriptInfo(
"invertHalfedgeSelection(ObjectId(" + QString::number(objectId) +
"))");
197 emit log(
LOGERR,tr(
"selectBoundaryHalfedges: unable to get object"));
206 emit log(
LOGERR,tr(
"selectBoundaryHalfedges: Unsupported object Type"));
211 emit scriptInfo(
"selectBoundaryHalfedges(ObjectId(" + QString::number(objectId) +
"))");
220 emit log(
LOGERR,tr(
"getHalfedgeSelection: unable to get object"));
224 emit scriptInfo(
"getHalfedgeSelection(ObjectId(" + QString::number(objectId) +
"))");
231 emit log(
LOGERR,tr(
"getHalfedgeSelection: Unsupported object Type"));
247 emit log(
LOGERR,tr(
"Cannot find object for id ") + QString::number(_id));
255 emit log(
LOGERR,
"Could not get mesh object!");
261 for(IdList::const_iterator it = _halfedges.begin(); it != _halfedges.end(); ++it) {
262 vertex_pairs.push_back(mesh->from_vertex_handle(TriMesh::HalfedgeHandle(*it)).idx());
263 vertex_pairs.push_back(mesh->to_vertex_handle(TriMesh::HalfedgeHandle(*it)).idx());
270 emit log(
LOGERR,
"Could not get mesh object!");
276 for(IdList::const_iterator it = _halfedges.begin(); it != _halfedges.end(); ++it) {
277 vertex_pairs.push_back(mesh->from_vertex_handle(PolyMesh::HalfedgeHandle(*it)).idx());
278 vertex_pairs.push_back(mesh->to_vertex_handle(PolyMesh::HalfedgeHandle(*it)).idx());
289 if(_vertices.size() % 2 != 0) {
290 emit log(
LOGERR,
"Number of vertices is not even!");
298 emit log(
LOGERR,tr(
"Cannot find object for id ") + QString::number(_id));
306 emit log(
LOGERR,
"Could not get mesh object!");
312 for(IdList::const_iterator it = _vertices.begin(); it != _vertices.end(); it+=2) {
314 if(!vh.is_valid())
continue;
316 voh_it.is_valid(); ++voh_it) {
317 if(mesh->to_vertex_handle(*voh_it).idx() == *(it+1)) {
318 halfedges.push_back(voh_it->idx());
328 emit log(
LOGERR,
"Could not get mesh object!");
334 for(IdList::const_iterator it = _vertices.begin(); it != _vertices.end(); it+=2) {
336 if(!vh.is_valid())
continue;
338 voh_it.is_valid(); ++voh_it) {
339 if(mesh->to_vertex_handle(*voh_it).idx() == *(it+1)) {
340 halfedges.push_back(voh_it->idx());
357 emit log(
LOGERR,
"colorizeHalfedgeSelection: unable to get object");
366 emit log(
LOGERR,
"colorizeHalfedgeSelection: Unsupported object Type");
370 emit scriptInfo(
"colorizeHalfedgeSelection(ObjectId(" + QString::number(objectId) +
"), " 371 + QString::number(r) +
", " + QString::number(g) +
", " + QString::number(b) +
")");
Type for a MeshObject containing a triangle mesh.
IdList convertHalfedgesToVertexPairs(int _id, const IdList &_halfedges)
Convert halfedge ids to vertex pairs.
bool getObject(int _identifier, BSplineCurveObject *&_object)
void clearHalfedgeSelection(int objectId)
Invert the current edge selection.
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
void selectAllHalfedges(int objectId)
Select all Halfedges.
bool dataType(DataType _type) const
SelectionInterface::PrimitiveType halfedgeType_
Handle to selection environment.
MeshT * mesh()
return a pointer to the mesh
const UpdateType UPDATE_COLOR(UpdateTypeSet(1)<< 10)
Colors have changed.
void selectBoundaryHalfedges(int objectId)
Select boundary edges.
Functions for selection on a mesh.
void selectHalfedges(int objectId, IdList _vertexList)
Select given Halfedges.
void unselectHalfedges(int objectId, IdList _vertexList)
Unselect given Halfedges.
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
std::vector< int > IdList
Standard Type for id Lists used for scripting.
IdList getHalfedgeSelection(int objectId)
Return a list of all selected edges.
void invertHalfedgeSelection(int objectId)
Unselect all Halfedges.
Type for a Meshobject containing a poly mesh.
Kernel::VertexOHalfedgeIter VertexOHalfedgeIter
Circulator.
void colorizeHalfedgeSelection(int objectId, int r, int g, int b, int a)
Colorize the edge selection.
const UpdateType UPDATE_SELECTION_EDGES(UpdateTypeSet(1)<< 6)
Edge selection has changed.
#define DATA_TRIANGLE_MESH
void colorizeSelection(MeshT *_mesh, PrimitiveType _primitiveTypes, int _red, int _green, int _blue, int _alpha)
Colorize the selection.
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
IdList convertVertexPairsToHalfedges(int _id, const IdList &_vertices)
Inverse of function above.