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(
auto it : _halfedges) {
277 emit log(
LOGERR,
"Could not get mesh object!");
283 for(
auto it : _halfedges) {
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) {
323 if(voh_it.to().idx() == *(it+1)) {
324 halfedges.push_back(voh_it.idx());
334 emit log(
LOGERR,
"Could not get mesh object!");
340 for(IdList::const_iterator it = _vertices.begin(); it != _vertices.end(); it+=2) {
344 if(voh_it.to().idx() == *(it+1)) {
345 halfedges.push_back(voh_it.idx());
362 emit log(
LOGERR,
"colorizeHalfedgeSelection: unable to get object");
371 emit log(
LOGERR,
"colorizeHalfedgeSelection: Unsupported object Type");
375 emit scriptInfo(
"colorizeHalfedgeSelection(ObjectId(" + QString::number(objectId) +
"), "
376 + QString::number(r) +
", " + QString::number(g) +
", " + QString::number(b) +
")");
std::vector< int > IdList
Standard Type for id Lists used for scripting.
Functions for selection on a mesh.
#define DATA_TRIANGLE_MESH
bool dataType(DataType _type) const
void colorizeSelection(MeshT *_mesh, PrimitiveType _primitiveTypes, int _red, int _green, int _blue, int _alpha)
Colorize the selection.
void selectBoundaryHalfedges(int objectId)
Select boundary edges.
bool selectHalfedge(int _objectId, int _idx, bool _fly_to_halfedge)
Select halfedge with id _idx and maybe fly to it.
bool selectElement(int _objectId, HandleT _handle, bool _fly_to_element)
set dihedral angle threshold for edge selection
void selectAllHalfedges(int objectId)
Select all Halfedges.
IdList getHalfedgeSelection(int objectId)
Return a list of all selected edges.
void invertHalfedgeSelection(int objectId)
Unselect all Halfedges.
IdList convertVertexPairsToHalfedges(int _id, const IdList &_vertices)
Inverse of function above.
void selectHalfedges(int objectId, IdList _vertexList)
Select given Halfedges.
void clearHalfedgeSelection(int objectId)
Invert the current edge selection.
IdList convertHalfedgesToVertexPairs(int _id, const IdList &_halfedges)
Convert halfedge ids to vertex pairs.
SelectionInterface::PrimitiveType halfedgeType_
Handle to selection environment.
void colorizeHalfedgeSelection(int objectId, int r, int g, int b, int a)
Colorize the edge selection.
void unselectHalfedges(int objectId, IdList _vertexList)
Unselect given Halfedges.
MeshT * mesh()
return a pointer to the mesh
bool is_valid() const
The handle is valid iff the index is not negative.
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Kernel::HalfedgeHandle HalfedgeHandle
Scalar type.
Type for a Meshobject containing a poly mesh.
Type for a MeshObject containing a triangle mesh.
const UpdateType UPDATE_SELECTION_EDGES(UpdateTypeSet(64))
Edge selection has changed.
const UpdateType UPDATE_COLOR(UpdateTypeSet(1024))
Colors have changed.
SmartVertexHandle make_smart(VertexHandle _vh, const PolyConnectivity *_mesh)
Creats a SmartVertexHandle from a VertexHandle and a Mesh.
bool getObject(const int _identifier, BaseObject *&_object)
Get the object which has the given identifier.
TriMesh * triMesh(BaseObjectData *_object)
Get a triangle mesh from an object.
PolyMesh * polyMesh(BaseObjectData *_object)
Get a poly mesh from an object.
Handle for a halfedge entity.
Smart version of VertexHandle contains a pointer to the corresponding mesh and allows easier access t...
PolyConnectivity::ConstVertexOHalfedgeRange outgoing_halfedges() const
Returns a range of incoming halfedges incident to the vertex (PolyConnectivity::voh_range())