43 #include "MeshObjectSelectionPlugin.hh" 46 #include <OpenMesh/Core/Geometry/MathDefs.hh> 56 template<
typename MeshT>
62 typename MeshT::VertexIter v_it, v_end=_mesh->vertices_end();
64 for(v_it=_mesh->vertices_begin(); v_it!=v_end; ++v_it) {
65 if(_mesh->status(*v_it).selected()) {
66 _mesh->delete_vertex(*v_it);
73 typename MeshT::EdgeIter e_it, e_end(_mesh->edges_end());
75 for(e_it=_mesh->edges_begin(); e_it!=e_end; ++e_it) {
76 if(_mesh->status(*e_it).selected()) {
77 _mesh->delete_edge(*e_it);
84 typename MeshT::FaceIter f_it, f_end(_mesh->faces_end());
86 for(f_it=_mesh->faces_begin(); f_it!=f_end; ++f_it) {
87 if(_mesh->status(*f_it).selected()) {
88 _mesh->delete_face(*f_it);
94 _mesh->garbage_collection();
105 template<
typename MeshType>
109 typename MeshType::FaceIter f_it, f_end=_mesh->faces_end();
110 typename MeshType::FaceVertexIter fv_it;
111 typename MeshType::VertexHandle v0, v1, v2;
113 for(f_it=_mesh->faces_begin(); f_it!=f_end; ++f_it) {
114 fv_it = _mesh->fv_iter(*f_it);
119 const bool a =(_mesh->status(v0).is_bit_set(AREA)|| _mesh->status(v1).is_bit_set(AREA)|| _mesh->status(v2).is_bit_set(AREA));
120 bool h =(_mesh->status(v0).is_bit_set(HANDLEAREA)&&
121 _mesh->status(v1).is_bit_set(HANDLEAREA)&&
122 _mesh->status(v2).is_bit_set(HANDLEAREA));
125 if(_mesh->status(v0).is_bit_set(HANDLEAREA)||
126 _mesh->status(v1).is_bit_set(HANDLEAREA)||
127 _mesh->status(v2).is_bit_set(HANDLEAREA))
130 _mesh->status(*f_it).change_bit(AREA , a);
131 _mesh->status(*f_it).change_bit(HANDLEAREA, h);
145 template<
class MeshT>
148 typename MeshT::FaceHandle fh = _mesh->face_handle(_fh);
156 typename MeshT::FaceVertexIter fv_it(*_mesh, fh);
157 typename MeshT::VertexHandle closest = *fv_it;
158 typename MeshT::Scalar shortest_distance =(_mesh->point(closest)- _hit_point).sqrnorm();
161 if((_mesh->point(*fv_it)- _hit_point).sqrnorm()<shortest_distance) {
162 shortest_distance =(_mesh->point(*fv_it)- _hit_point).sqrnorm();
168 }
while( fv_it.is_valid() );
170 _mesh->status(closest).set_selected(!_mesh->status(closest).selected());
172 if(_mesh->status(closest).selected())
173 emit scriptInfo(
"selectVertices(ObjectId(" + QString::number(_objectId) +
") , [" + QString::number(closest.idx())+
"])");
175 emit scriptInfo(
"unselectVertices(ObjectId(" + QString::number(_objectId) +
") , [" + QString::number(closest.idx())+
"])");
182 typename MeshT::FaceHalfedgeIter fhe_it(*_mesh, fh);
184 typename MeshT::HalfedgeHandle closest(-1);
185 typename MeshT::Scalar closest_dist(-1);
187 typename MeshT::Point pp =(
typename MeshT::Point)_hit_point;
189 for(; fhe_it.is_valid(); ++fhe_it) {
194 typename MeshT::Point lp0 = _mesh->point(_mesh->to_vertex_handle (*fhe_it));
195 typename MeshT::Point lp1 = _mesh->point(_mesh->from_vertex_handle(*fhe_it));
199 if(dist_new <closest_dist || closest_dist == -1) {
202 closest_dist = dist_new;
207 typename MeshT::EdgeHandle closest_eh = _mesh->edge_handle(closest);
209 if(_primitiveType & edgeType_) {
211 _mesh->status(closest_eh).set_selected(!_mesh->status(closest_eh).selected());
213 if(_mesh->status(closest_eh).selected())
214 emit scriptInfo(
"selectEdges(ObjectId(" + QString::number(_objectId) +
") , [" + QString::number(closest_eh.idx())+
"])");
216 emit scriptInfo(
"unselectEdges(ObjectId(" + QString::number(_objectId) +
") , [" + QString::number(closest_eh.idx())+
"])");
219 _mesh->status(closest).set_selected(!_mesh->status(closest).selected());
221 if(_mesh->status(closest).selected())
222 emit scriptInfo(
"selectHalfedges(ObjectId(" + QString::number(_objectId) +
") , [" + QString::number(closest.idx())+
"])");
224 emit scriptInfo(
"unselectHalfedges(ObjectId(" + QString::number(_objectId) +
") , [" + QString::number(closest.idx())+
"])");
231 _mesh->status(fh).set_selected(!_mesh->status(fh).selected());
233 if(_mesh->status(fh).selected())
234 emit scriptInfo(
"selectFaces(ObjectId(" + QString::number(_objectId) +
") , [" + QString::number(fh.idx())+
"])");
236 emit scriptInfo(
"unselectFaces(ObjectId(" + QString::number(_objectId) +
") , [" + QString::number(fh.idx())+
"])");
253 template <
class MeshT>
257 typename MeshT::Point _hitpoint,
259 PrimitiveType _primitiveType,
263 const float sqr_radius = _radius * _radius;
266 const bool sel = !_deselection;
269 std::set< typename MeshT::FaceHandle > visited;
271 typename MeshT::FaceHandle hitface = _mesh->face_handle(_target_idx);
273 if(!hitface.is_valid())
276 visited.insert(hitface);
279 std::vector<typename MeshT::FaceHandle> face_handles;
280 face_handles.reserve(50);
281 face_handles.push_back(hitface);
285 while(!face_handles.empty()) {
286 typename MeshT::FaceHandle fh = face_handles.back();
288 face_handles.pop_back();
292 unsigned int fVertices = 0;
295 std::vector<typename MeshT::EdgeHandle> edge_handles;
297 for(
typename MeshT::FaceHalfedgeIter fh_it(*_mesh,fh); fh_it.is_valid(); ++fh_it) {
299 const typename MeshT::VertexHandle vh = _mesh->from_vertex_handle(*fh_it);
301 if((_mesh->point(vh) - _hitpoint).sqrnorm() <= sqr_radius) {
305 _mesh->status(vh).set_selected(sel);
308 if((_mesh->point(_mesh->to_vertex_handle(*fh_it))- _hitpoint).sqrnorm()<= sqr_radius)
309 edge_handles.push_back(_mesh->edge_handle(*fh_it));
320 for(
size_t i=0; i < edge_handles.size(); i++) {
322 _mesh->status( _mesh->halfedge_handle(edge_handles[i],0) ).set_selected(sel) ;
323 _mesh->status( _mesh->halfedge_handle(edge_handles[i],1) ).set_selected(sel) ;
326 if (_primitiveType & edgeType_)
327 _mesh->status(edge_handles[i]).set_selected(sel);
335 if( _mesh->valence(fh ) == fVertices) {
336 _mesh->status(fh).set_selected(sel);
344 for(
typename MeshT::FaceFaceIter ff_it(*_mesh,fh); ff_it.is_valid(); ++ff_it) {
345 if ( visited.count(*ff_it) == 0 )
346 face_handles.push_back(*ff_it);
370 emit updatedObject(_objectId, update);
386 template<
class MeshT>
388 PrimitiveType _primitiveType,
bool _deselection) {
393 typename MeshT::VertexIter v_it, v_end(_mesh->vertices_end());
394 for(v_it=_mesh->vertices_begin(); v_it!=v_end; ++v_it)
395 _mesh->status(*v_it).set_tagged(
false);
398 for(v_it=_mesh->vertices_begin(); v_it!=v_end; ++v_it) {
400 proj = _state.
project(_mesh->point(*v_it));
402 if(_region->contains(QPoint((
int)proj[0], _state.
context_height()- (int)proj[1]))) {
404 _mesh->status(*v_it).set_tagged(
true);
407 _mesh->status(*v_it).set_selected(!_deselection);
413 typename MeshT::EdgeIter e_it, e_end(_mesh->edges_end());
414 for(e_it=_mesh->edges_begin(); e_it!=e_end; ++e_it) {
416 if(_mesh->status(_mesh->to_vertex_handle(_mesh->halfedge_handle(*e_it, 0))).tagged()||
417 _mesh->status(_mesh->to_vertex_handle(_mesh->halfedge_handle(*e_it, 1))).tagged()) {
419 if(_primitiveType & edgeType_)
420 _mesh->status(*e_it).set_selected(!_deselection);
422 if(_primitiveType & halfedgeType_) {
424 _mesh->status(_mesh->halfedge_handle(*e_it,0)).set_selected(!_deselection);
425 _mesh->status(_mesh->halfedge_handle(*e_it,1)).set_selected(!_deselection);
432 typename MeshT::FaceIter f_it, f_end(_mesh->faces_end());
433 for(f_it=_mesh->faces_begin(); f_it!=f_end; ++f_it) {
436 for(
typename MeshT::FaceVertexIter fv_it(*_mesh,*f_it); fv_it.is_valid(); ++fv_it)
437 if(_mesh->status(*fv_it).tagged())
441 _mesh->status(*f_it).set_selected(!_deselection);
447 if(_primitiveType & edgeType_)
449 if(_primitiveType & halfedgeType_)
451 if(_primitiveType & faceType_)
466 template<
class MeshT>
469 typename MeshT::VertexHandle vh = _mesh->vertex_handle(_vh);
473 typename MeshT::VertexHandle vhBound = MeshNavigation::findClosestBoundary(_mesh , vh);
474 if(vhBound.is_valid()) {
478 if(!_mesh->get_property_handle(visited,
"Visited Vertices"))
479 _mesh->add_property(visited,
"Visited Vertices");
481 typename MeshT::VertexIter v_it, v_end = _mesh->vertices_end();
482 for(v_it = _mesh->vertices_begin(); v_it != v_end; ++v_it)
483 _mesh->property(visited, *v_it)=
false;
485 std::stack<typename MeshT::VertexHandle> stack;
488 while(!stack.empty()) {
490 typename MeshT::VertexHandle vh = stack.top();
493 if(_mesh->property(visited,vh))
497 for(
typename MeshT::VertexOHalfedgeIter voh_it(*_mesh,vh); voh_it.is_valid(); ++voh_it) {
499 if(_mesh->is_boundary(_mesh->edge_handle(*voh_it))) {
501 stack.push(_mesh->to_vertex_handle(*voh_it));
504 _mesh->status(_mesh->edge_handle(*voh_it)).set_selected(!_deselection);
507 typename MeshT::HalfedgeHandle heh = *voh_it;
508 if(!_mesh->is_boundary(heh))heh = _mesh->opposite_halfedge_handle(heh);
509 _mesh->status(heh).set_selected(!_deselection);
514 typename MeshT::FaceHandle f1 = _mesh->face_handle(*voh_it);
515 typename MeshT::FaceHandle f2 = _mesh->face_handle(_mesh->opposite_halfedge_handle(*voh_it));
516 if(f1.is_valid())_mesh->status(f1).set_selected(!_deselection);
517 if(f2.is_valid())_mesh->status(f2).set_selected(!_deselection);
521 _mesh->property(visited,vh)=
true;
524 _mesh->status(vh).set_selected(!_deselection);
526 _mesh->remove_property(visited);
530 emit log(
LOGERR, tr(
"Unable to find boundary."));
533 emit log(
LOGERR, tr(
"Invalid vertex handle."));
548 template<
class MeshT>
550 MeshT* _mesh,
int _objectId, uint _fh,
double _maxAngle,
551 PrimitiveType _primitiveTypes,
bool _deselection) {
554 typename MeshT::FaceIter f_it, f_end(_mesh->faces_end());
555 for (f_it=_mesh->faces_begin(); f_it!=f_end; ++f_it)
556 _mesh->status(*f_it).set_tagged(
false);
558 std::vector<typename MeshT::FaceHandle> face_handles;
561 typename MeshT::FaceHandle hitFace =
typename MeshT::FaceHandle(_fh);
562 face_handles.reserve(50);
563 face_handles.push_back(hitFace);
564 _mesh->status(hitFace).set_tagged(
true);
566 typename MeshT::Point n1 = _mesh->normal(hitFace);
568 double maxAngle = OpenMesh::deg_to_rad(_maxAngle);
570 while (!face_handles.empty()) {
571 typename MeshT::FaceHandle fh = face_handles.back();
572 face_handles.pop_back();
574 for (
typename MeshT::FaceFaceIter ff_it(*_mesh,fh) ; ff_it.is_valid() ; ++ff_it) {
577 if (_mesh->status(*ff_it).tagged())
580 typename MeshT::Point n2 = _mesh->normal(*ff_it);
582 double angle = acos(n1 | n2);
584 if (angle <= maxAngle) {
585 _mesh->status(*ff_it).set_tagged(
true);
586 face_handles.push_back(*ff_it);
592 for (f_it=_mesh->faces_begin(); f_it!=f_end; ++f_it) {
593 if (_mesh->status(*f_it).tagged()) {
596 for (
typename MeshT::FaceVertexIter fv_it(*_mesh,*f_it) ; fv_it.is_valid(); ++fv_it)
597 _mesh->status(*fv_it).set_selected(!_deselection);
601 for (
typename MeshT::FaceEdgeIter fe_it(*_mesh,*f_it) ; fe_it.is_valid(); ++fe_it)
602 _mesh->status(*fe_it).set_selected(!_deselection);
606 for (
typename MeshT::FaceHalfedgeIter fhe_it(*_mesh,*f_it) ; fhe_it.is_valid(); ++fhe_it)
607 _mesh->status(*fhe_it).set_selected(!_deselection);
611 _mesh->status(*f_it).set_selected(!_deselection);
637 template<
class MeshT>
639 MeshT* _mesh,
int _objectId, uint _fh,
ACG::Vec3d& _hit_point,
640 PrimitiveType _primitiveType) {
642 typename MeshT::FaceHandle fh = _mesh->face_handle(_fh);
651 _mesh->add_property(visited);
653 typename MeshT::VertexIter v_it;
654 typename MeshT::VertexIter v_end = _mesh->vertices_end();
657 for (v_it = _mesh->vertices_begin(); v_it != v_end; ++v_it)
658 _mesh->property(visited, *v_it) =
false;
661 typename MeshT::VertexHandle current = *(_mesh->fv_iter(fh));
662 if(!current.is_valid())
665 std::set<typename MeshT::VertexHandle> unprocessed;
666 unprocessed.insert(current);
668 while( !unprocessed.empty() ) {
671 current = *unprocessed.begin();
672 _mesh->status(current).set_selected(!(_mesh->status(current)).selected());
673 _mesh->property(visited, current) =
true;
674 unprocessed.erase(current);
677 for(
typename MeshT::VertexVertexIter vv_it = _mesh->vv_iter(current); vv_it.is_valid(); ++vv_it) {
678 if(_mesh->property(visited, *vv_it) ==
true)
continue;
679 unprocessed.insert(*vv_it);
684 _mesh->remove_property(visited);
691 _mesh->add_property(visited);
693 typename MeshT::FaceIter f_it;
694 typename MeshT::FaceIter f_end = _mesh->faces_end();
697 for (f_it = _mesh->faces_begin(); f_it != f_end; ++f_it)
698 _mesh->property(visited, *f_it) =
false;
701 typename MeshT::FaceHandle current = fh;
703 std::set<typename MeshT::FaceHandle> unprocessed;
704 unprocessed.insert(current);
706 typename MeshT::EdgeHandle firstEdge = *(_mesh->fe_iter(fh));
707 if(!firstEdge.is_valid())
return;
708 bool selected = _mesh->status(firstEdge).selected();
710 while( !unprocessed.empty() ) {
713 current = *unprocessed.begin();
714 for(
typename MeshT::FaceHalfedgeIter fh_it = _mesh->fh_iter(current); fh_it.is_valid(); ++fh_it) {
715 if(_primitiveType & halfedgeType_) {
716 _mesh->status(*fh_it).set_selected(!(_mesh->status(*fh_it)).selected());
718 if(_primitiveType & edgeType_) {
719 _mesh->status(_mesh->edge_handle(*fh_it)).set_selected(!selected);
723 _mesh->property(visited, current) =
true;
724 unprocessed.erase(current);
727 for(
typename MeshT::FaceFaceIter ff_it = _mesh->ff_iter(current); ff_it.is_valid(); ++ff_it) {
728 if(_mesh->property(visited, *ff_it) ==
true)
continue;
729 unprocessed.insert(*ff_it);
734 _mesh->remove_property(visited);
741 _mesh->add_property(visited);
743 typename MeshT::FaceIter f_it;
744 typename MeshT::FaceIter f_end = _mesh->faces_end();
747 for (f_it = _mesh->faces_begin(); f_it != f_end; ++f_it)
748 _mesh->property(visited, *f_it) =
false;
751 typename MeshT::FaceHandle current = fh;
753 std::set<typename MeshT::FaceHandle> unprocessed;
754 unprocessed.insert(current);
756 while( !unprocessed.empty() ) {
759 current = *unprocessed.begin();
760 _mesh->status(current).set_selected(!(_mesh->status(current)).selected());
761 _mesh->property(visited, current) =
true;
762 unprocessed.erase(current);
765 for(
typename MeshT::FaceFaceIter ff_it = _mesh->ff_iter(current); ff_it.is_valid(); ++ff_it) {
766 if(_mesh->property(visited, *ff_it) ==
true)
continue;
767 unprocessed.insert(*ff_it);
772 _mesh->remove_property(visited);
774 if(_primitiveType & vertexType_)
776 if(_primitiveType & edgeType_)
778 if(_primitiveType & halfedgeType_)
780 if(_primitiveType & faceType_)
795 template<
typename MeshT >
797 PrimitiveType _primitiveTypes,
811 typename MeshT::VertexIter v_it, v_end=_mesh->vertices_end();
814 if ( !_mesh->has_vertex_colors() )
815 _mesh->request_vertex_colors();
817 for (v_it=_mesh->vertices_begin(); v_it!=v_end; ++v_it)
818 if ( _mesh->status(*v_it).selected() )
819 _mesh->set_color(*v_it, color);
823 typename MeshT::FaceIter f_it, f_end( _mesh->faces_end() );
826 if ( !_mesh->has_face_colors() )
827 _mesh->request_face_colors();
829 for (f_it=_mesh->faces_begin(); f_it!=f_end; ++f_it)
830 if ( _mesh->status(*f_it).selected() )
831 _mesh->set_color(*f_it, color);
835 typename MeshT::EdgeIter e_it, e_end( _mesh->edges_end() );
838 if ( !_mesh->has_edge_colors() )
839 _mesh->request_edge_colors();
841 for (e_it=_mesh->edges_begin(); e_it!=e_end; ++e_it)
842 if ( _mesh->status(*e_it).selected() )
843 _mesh->set_color(*e_it, color);
847 typename MeshT::HalfedgeIter h_it, h_end( _mesh->halfedges_end() );
850 if ( !_mesh->has_halfedge_colors() )
851 _mesh->request_halfedge_colors();
853 for (h_it=_mesh->halfedges_begin(); h_it!=h_end; ++h_it)
854 if ( _mesh->status(*h_it).selected() )
855 _mesh->set_color(*h_it, color);
869 template<
class MeshT>
875 _mesh.add_property(copyHandle,
"copyHandle Property");
878 typename MeshT::VertexIter v_it, v_end = _mesh.vertices_end();
879 for (v_it = _mesh.vertices_begin(); v_it != v_end; ++v_it) {
885 copy = _mesh.status(*v_it).selected();
888 for (
typename MeshT::VertexOHalfedgeIter voh_it(_mesh, *v_it); voh_it.is_valid(); ++voh_it)
889 if (_mesh.status(_mesh.edge_handle(*voh_it)).selected()) {
895 for (
typename MeshT::VertexFaceIter vf_it(_mesh, *v_it); vf_it.is_valid(); ++vf_it)
896 if (_mesh.status(*vf_it).selected()) {
904 _mesh.property(copyHandle, *v_it) = _newMesh.add_vertex(_mesh.point(*v_it));
906 _mesh.property(copyHandle, *v_it) =
typename MeshT::VertexHandle(-1);
912 typename MeshT::FaceIter f_it, f_end = _mesh.faces_end();
913 for (f_it = _mesh.faces_begin(); f_it != f_end; ++f_it) {
915 std::vector<typename MeshT::VertexHandle> v;
919 for (
typename MeshT::FaceVertexIter fv_it(_mesh, *f_it); fv_it.is_valid(); ++fv_it)
920 if (_mesh.property(copyHandle, *fv_it).is_valid())
921 v.push_back(_mesh.property(copyHandle, *fv_it));
928 _newMesh.add_face(v);
931 _newMesh.update_normals();
933 _mesh.remove_property(copyHandle);
937 template<
class MeshT>
942 typename MeshT::VertexIter v_it, v_end = _mesh->vertices_end();
943 for (v_it = _mesh->vertices_begin(); v_it != v_end; ++v_it) {
944 const typename MeshT::Point p = _mesh->point(*v_it);
948 if (_component.contains(
"x",Qt::CaseInsensitive) ) {
949 select = (p[0] > _value);
950 }
else if (_component.contains(
"y",Qt::CaseInsensitive) ) {
951 select = (p[1] > _value);
952 }
else if (_component.contains(
"z",Qt::CaseInsensitive) ) {
953 select = (p[2] > _value);
955 emit log(
LOGERR,tr(
"selectVerticesByValue, undefined component ") + _component );
964 if ( ! _mesh->status(*v_it).selected() )
965 _mesh->status(*v_it).set_selected(select);
bool deleteSelection(MeshT *_mesh, PrimitiveType _primitiveType)
Delete all selected elements of a mesh.
void paintSphereSelection(MeshT *_mesh, int _objectId, int _target_idx, typename MeshT::Point _hitpoint, double _radius, PrimitiveType _primitiveTypes, bool _deselection)
Use the event to paint selection with a sphere.
int context_height() const
get gl context height
Vec::value_type distPointLineSquared(const Vec &_p, const Vec &_v0, const Vec &_v1, Vec *_min_v)
squared distance from point _p to line segment (_v0,_v1)
const UpdateType UPDATE_SELECTION_HALFEDGES(UpdateTypeSet(1)<< 7)
Halfedge selection has changed.
SelectionInterface::PrimitiveType edgeType_
Handle to selection environment.
SelectionInterface::PrimitiveType halfedgeType_
Handle to selection environment.
const UpdateType UPDATE_SELECTION_FACES(UpdateTypeSet(1)<< 8)
Face selection has changed.
void createMeshFromSelection(MeshT &_mesh, MeshT &_newMesh, PrimitiveType _primitiveType)
Create a new mesh from the selection.
Vec3d project(const Vec3d &_point) const
project point in world coordinates to window coordinates
void closestBoundarySelection(MeshT *_mesh, int _vh, PrimitiveType _primitiveTypes, bool _deselection)
Select all entities that are incident to closest boundary.
SelectionInterface::PrimitiveType faceType_
Handle to selection environment.
void floodFillSelection(MeshT *_mesh, int _objectId, uint _fh, double _maxAngle, PrimitiveType _primitiveTypes, bool _deselection)
Select all entities that are connected (and do not exceed the maximum dihedral angle) ...
VectorT< float, 4 > Vec4f
Functions for getting information about a mesh.
bool volumeSelection(MeshT *_mesh, int _objectId, ACG::GLState &_state, QRegion *_region, PrimitiveType _primitiveTypes, bool _deselection)
Surface volume selection tool.
void selectVerticesByValue(int _objectId, QString _component, bool _greater, double _value)
Select vertices by their value.
VectorT< unsigned char, 4 > Vec4uc
Add colors to mesh item (vertices/faces/edges)
const UpdateType UPDATE_SELECTION_VERTICES(UpdateTypeSet(1)<< 5)
Vertex selection has changed.
SelectionInterface::PrimitiveType vertexType_
Primitive type handles:
const UpdateType UPDATE_NONE(UpdateTypeSet(0))
Empty update for empty initialization of update type.
void update_regions(MeshT *_mesh)
Update face selection to correspond to the vertex selection.
void toggleMeshSelection(int _objectId, MeshT *_mesh, uint _fh, ACG::Vec3d &_hit_point, PrimitiveType _primitiveType)
Toggle mesh selection.
void componentsMeshSelection(MeshT *_mesh, int _objectId, uint _fh, ACG::Vec3d &_hit_point, PrimitiveType _primitiveType)
Connected component mesh selection.
const UpdateType UPDATE_SELECTION_EDGES(UpdateTypeSet(1)<< 6)
Edge selection has changed.
void colorizeSelection(MeshT *_mesh, PrimitiveType _primitiveTypes, int _red, int _green, int _blue, int _alpha)
Colorize the selection.