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);
100 if(_halfedgeList.empty() )
return;
104 emit log(
LOGERR,tr(
"unselectHalfedges: unable to get object"));
113 emit log(
LOGERR,tr(
"unselectHalfedges: Unsupported object Type"));
117 QString selection =
"unselectVertices(ObjectId(" + QString::number(objectId) +
") , [ " + QString::number(_halfedgeList[0]);
119 for (uint i = 1 ; i < _halfedgeList.size(); ++i) {
120 selection +=
" , " + QString::number(_halfedgeList[i]);
126 emit scriptInfo(selection);
135 emit log(
LOGERR,tr(
"selectAllVertices: unable to get object"));
144 emit log(
LOGERR,tr(
"selectAllHalfedges: Unsupported object Type"));
149 emit scriptInfo(
"selectAllHalfedges(ObjectId(" + QString::number(objectId) +
"))");
158 emit log(
LOGERR,tr(
"clearHalfedgeSelection: unable to get object"));
167 emit log(
LOGERR,tr(
"clearHalfedgeSelection: Unsupported object Type"));
172 emit scriptInfo(
"clearHalfedgeSelection(ObjectId(" + QString::number(objectId) +
"))");
181 emit log(
LOGERR,tr(
"invertHalfedgeSelection: unable to get object"));
190 emit log(
LOGERR,tr(
"invertHalfedgeSelection: Unsupported object Type"));
195 emit scriptInfo(
"invertHalfedgeSelection(ObjectId(" + QString::number(objectId) +
"))");
204 emit log(
LOGERR,tr(
"selectBoundaryHalfedges: unable to get object"));
213 emit log(
LOGERR,tr(
"selectBoundaryHalfedges: Unsupported object Type"));
218 emit scriptInfo(
"selectBoundaryHalfedges(ObjectId(" + QString::number(objectId) +
"))");
227 emit log(
LOGERR,tr(
"getHalfedgeSelection: unable to get object"));
231 emit scriptInfo(
"getHalfedgeSelection(ObjectId(" + QString::number(objectId) +
"))");
238 emit log(
LOGERR,tr(
"getHalfedgeSelection: Unsupported object Type"));
254 emit log(
LOGERR,tr(
"Cannot find object for id ") + QString::number(_id));
262 emit log(
LOGERR,
"Could not get mesh object!");
268 for(IdList::const_iterator it = _halfedges.begin(); it != _halfedges.end(); ++it) {
269 vertex_pairs.push_back(mesh->from_vertex_handle(TriMesh::HalfedgeHandle(*it)).idx());
270 vertex_pairs.push_back(mesh->to_vertex_handle(TriMesh::HalfedgeHandle(*it)).idx());
277 emit log(
LOGERR,
"Could not get mesh object!");
283 for(IdList::const_iterator it = _halfedges.begin(); it != _halfedges.end(); ++it) {
284 vertex_pairs.push_back(mesh->from_vertex_handle(PolyMesh::HalfedgeHandle(*it)).idx());
285 vertex_pairs.push_back(mesh->to_vertex_handle(PolyMesh::HalfedgeHandle(*it)).idx());
296 if(_vertices.size() % 2 != 0) {
297 emit log(
LOGERR,
"Number of vertices is not even!");
305 emit log(
LOGERR,tr(
"Cannot find object for id ") + QString::number(_id));
313 emit log(
LOGERR,
"Could not get mesh object!");
319 for(IdList::const_iterator it = _vertices.begin(); it != _vertices.end(); it+=2) {
321 if(!vh.is_valid())
continue;
323 voh_it.is_valid(); ++voh_it) {
324 if(mesh->to_vertex_handle(*voh_it).idx() == *(it+1)) {
325 halfedges.push_back(voh_it->idx());
335 emit log(
LOGERR,
"Could not get mesh object!");
341 for(IdList::const_iterator it = _vertices.begin(); it != _vertices.end(); it+=2) {
343 if(!vh.is_valid())
continue;
345 voh_it.is_valid(); ++voh_it) {
346 if(mesh->to_vertex_handle(*voh_it).idx() == *(it+1)) {
347 halfedges.push_back(voh_it->idx());
364 emit log(
LOGERR,
"colorizeHalfedgeSelection: unable to get object");
373 emit log(
LOGERR,
"colorizeHalfedgeSelection: Unsupported object Type");
377 emit scriptInfo(
"colorizeHalfedgeSelection(ObjectId(" + QString::number(objectId) +
"), " 378 + QString::number(r) +
", " + QString::number(g) +
", " + QString::number(b) +
")");
#define DATA_TRIANGLE_MESH
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
Type for a Meshobject containing a poly mesh.
void unselectHalfedges(int objectId, IdList _vertexList)
Unselect given Halfedges.
Handle for a halfedge entity.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
void selectAllHalfedges(int objectId)
Select all Halfedges.
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
void invertHalfedgeSelection(int objectId)
Unselect all Halfedges.
MeshT * mesh()
return a pointer to the mesh
bool dataType(DataType _type) const
std::vector< int > IdList
Standard Type for id Lists used for scripting.
Kernel::VertexOHalfedgeIter VertexOHalfedgeIter
Circulator.
IdList convertHalfedgesToVertexPairs(int _id, const IdList &_halfedges)
Convert halfedge ids to vertex pairs.
void selectBoundaryHalfedges(int objectId)
Select boundary edges.
Functions for selection on a mesh.
void clearHalfedgeSelection(int objectId)
Invert the current edge selection.
IdList convertVertexPairsToHalfedges(int _id, const IdList &_vertices)
Inverse of function above.
Type for a MeshObject containing a triangle mesh.
const UpdateType UPDATE_SELECTION_EDGES(UpdateTypeSet(1)<< 6)
Edge selection has changed.
IdList getHalfedgeSelection(int objectId)
Return a list of all selected edges.
void colorizeSelection(MeshT *_mesh, PrimitiveType _primitiveTypes, int _red, int _green, int _blue, int _alpha)
Colorize the selection.
bool selectElement(int _objectId, HandleT _handle, bool _fly_to_element)
set dihedral angle threshold for edge selection
SelectionInterface::PrimitiveType halfedgeType_
Handle to selection environment.
bool selectHalfedge(int _objectId, int _idx, bool _fly_to_halfedge)
Select halfedge with id _idx and maybe fly to it.
void selectHalfedges(int objectId, IdList _vertexList)
Select given Halfedges.
void colorizeHalfedgeSelection(int objectId, int r, int g, int b, int a)
Colorize the edge selection.
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
const UpdateType UPDATE_COLOR(UpdateTypeSet(1)<< 10)
Colors have changed.