Commit b8796916 authored by Henrik Zimmer's avatar Henrik Zimmer
Browse files

Added TSplineMesh type

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@8431 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 85eb40fe
......@@ -4,4 +4,8 @@ if (EXISTS ${CMAKE_SOURCE_DIR}/ObjectTypes/PolyLine)
add_definitions (-DENABLE_POLYLINE_SUPPORT)
endif ()
openflipper_plugin (DIRS PolyLine BSplineCurve widgets TRANSLATION_LANGUAGES de_DE)
\ No newline at end of file
if (EXISTS ${CMAKE_SOURCE_DIR}/ObjectTypes/TSplineMesh)
add_definitions (-DENABLE_TSPLINEMESH_SUPPORT)
endif ()
openflipper_plugin (DIRS PolyLine BSplineCurve TSplineMesh widgets TRANSLATION_LANGUAGES de_DE)
......@@ -80,6 +80,11 @@ void SelectionPlugin::selectEdges( int objectId , IdList _edgeList ) {
MeshSelection::selectEdges(PluginFunctions::triMesh(object), _edgeList);
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::selectEdges(PluginFunctions::polyMesh(object), _edgeList);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::selectEdges(PluginFunctions::tsplineMesh(object), _edgeList);
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
else if ( object->dataType() == DATA_POLY_LINE )
PolyLineSelection::selectEdges( PluginFunctions::polyLine(object) , _edgeList );
......@@ -121,6 +126,10 @@ void SelectionPlugin::unselectEdges( int objectId , IdList _edgeList ) {
MeshSelection::unselectEdges(PluginFunctions::triMesh(object), _edgeList);
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::unselectEdges(PluginFunctions::polyMesh(object), _edgeList);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::unselectEdges(PluginFunctions::tsplineMesh(object), _edgeList);
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
else if ( object->dataType() == DATA_POLY_LINE )
PolyLineSelection::unselectEdges( PluginFunctions::polyLine(object) , _edgeList );
......@@ -160,6 +169,10 @@ void SelectionPlugin::selectAllEdges( int objectId )
MeshSelection::selectAllEdges(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::selectAllEdges(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::selectAllEdges(PluginFunctions::tsplineMesh(object));
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
else if ( object->dataType() == DATA_POLY_LINE )
PolyLineSelection::selectAllEdges( PluginFunctions::polyLine(object) );
......@@ -191,6 +204,10 @@ void SelectionPlugin::clearEdgeSelection( int objectId )
MeshSelection::clearEdgeSelection(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::clearEdgeSelection(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::clearEdgeSelection(PluginFunctions::tsplineMesh(object));
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
else if ( object->dataType() == DATA_POLY_LINE )
PolyLineSelection::clearEdgeSelection( PluginFunctions::polyLine(object) );
......@@ -222,6 +239,10 @@ void SelectionPlugin::invertEdgeSelection( int objectId )
MeshSelection::invertEdgeSelection(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::invertEdgeSelection(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::invertEdgeSelection(PluginFunctions::tsplineMesh(object));
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
else if ( object->dataType() == DATA_POLY_LINE )
PolyLineSelection::invertEdgeSelection( PluginFunctions::polyLine(object) );
......@@ -253,6 +274,10 @@ void SelectionPlugin::selectBoundaryEdges( int objectId )
MeshSelection::selectBoundaryEdges(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::selectBoundaryEdges(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::selectBoundaryEdges(PluginFunctions::tsplineMesh(object));
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
else if ( object->dataType() == DATA_POLY_LINE )
emit log(LOGERR,tr("selectBoundaryEdges : Not implemented on PolyLines") );
......@@ -287,6 +312,10 @@ IdList SelectionPlugin::getEdgeSelection( int objectId )
return MeshSelection::getEdgeSelection(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
return MeshSelection::getEdgeSelection(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
return MeshSelection::getEdgeSelection(PluginFunctions::tsplineMesh(object));
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
else if ( object->dataType() == DATA_POLY_LINE )
return PolyLineSelection::getEdgeSelection( PluginFunctions::polyLine(object) );
......@@ -319,6 +348,10 @@ void SelectionPlugin::colorizeEdgeSelection(int objectId, int r, int g, int b )
colorizeSelection(PluginFunctions::triMesh(object), EDGE, r, g, b);
else if ( object->dataType() == DATA_POLY_MESH )
colorizeSelection(PluginFunctions::polyMesh(object), EDGE, r, g, b);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
colorizeSelection(PluginFunctions::tsplineMesh(object), EDGE, r, g, b);
#endif
else {
emit log(LOGERR,"colorizeEdgeSelection : Unsupported object Type" );
return;
......
......@@ -69,6 +69,10 @@ void SelectionPlugin::selectFaces( int objectId , IdList _faceList ) {
MeshSelection::selectFaces(PluginFunctions::triMesh(object), _faceList);
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::selectFaces(PluginFunctions::polyMesh(object), _faceList);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::selectFaces(PluginFunctions::tsplineMesh(object), _faceList);
#endif
else{
emit log(LOGERR,tr("selectFaces : Unsupported object Type") );
return;
......@@ -102,6 +106,10 @@ void SelectionPlugin::unselectFaces( int objectId , IdList _faceList ) {
MeshSelection::unselectFaces(PluginFunctions::triMesh(object), _faceList);
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::unselectFaces(PluginFunctions::polyMesh(object), _faceList);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::unselectFaces(PluginFunctions::tsplineMesh(object), _faceList);
#endif
else{
emit log(LOGERR,tr("unselectFaces : Unsupported object Type") );
return;
......@@ -133,6 +141,10 @@ void SelectionPlugin::selectAllFaces( int objectId )
MeshSelection::selectAllFaces(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::selectAllFaces(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::selectAllFaces(PluginFunctions::tsplineMesh(object));
#endif
else{
emit log(LOGERR,tr("selectAllFaces : Unsupported object Type") );
return;
......@@ -156,6 +168,10 @@ void SelectionPlugin::clearFaceSelection( int objectId )
MeshSelection::clearFaceSelection(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::clearFaceSelection(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::clearFaceSelection(PluginFunctions::tsplineMesh(object));
#endif
else{
emit log(LOGERR,tr("clearFaceSelection : Unsupported object Type") );
return;
......@@ -179,6 +195,10 @@ void SelectionPlugin::invertFaceSelection( int objectId )
MeshSelection::invertFaceSelection(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::invertFaceSelection(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::invertFaceSelection(PluginFunctions::tsplineMesh(object));
#endif
else{
emit log(LOGERR,tr("invertFaceSelection : Unsupported object Type") );
return;
......@@ -202,6 +222,10 @@ void SelectionPlugin::selectBoundaryFaces( int objectId )
MeshSelection::selectBoundaryFaces(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::selectBoundaryFaces(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::selectBoundaryFaces(PluginFunctions::tsplineMesh(object));
#endif
else{
emit log(LOGERR,tr("selectBoundaryFaces : Unsupported object Type") );
return;
......@@ -226,6 +250,10 @@ void SelectionPlugin::shrinkFaceSelection( int objectId )
MeshSelection::shrinkFaceSelection(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::shrinkFaceSelection(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::shrinkFaceSelection(PluginFunctions::tsplineMesh(object));
#endif
else{
emit log(LOGERR,tr("shrinkFaceSelection : Unsupported object Type") );
return;
......@@ -249,6 +277,10 @@ void SelectionPlugin::growFaceSelection( int objectId )
MeshSelection::growFaceSelection(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::growFaceSelection(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::growFaceSelection(PluginFunctions::tsplineMesh(object));
#endif
else{
emit log(LOGERR,tr("growFaceSelection : Unsupported object Type") );
return;
......@@ -274,6 +306,10 @@ IdList SelectionPlugin::getFaceSelection( int objectId )
return MeshSelection::getFaceSelection(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
return MeshSelection::getFaceSelection(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
return MeshSelection::getFaceSelection(PluginFunctions::tsplineMesh(object));
#endif
else{
emit log(LOGERR,tr("getFaceSelection : Unsupported object Type") );
return IdList(0);
......@@ -297,6 +333,10 @@ void SelectionPlugin::colorizeFaceSelection(int objectId, int r, int g, int b )
colorizeSelection(PluginFunctions::triMesh(object), FACE, r, g, b);
else if ( object->dataType() == DATA_POLY_MESH )
colorizeSelection(PluginFunctions::polyMesh(object), FACE, r, g, b);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
colorizeSelection(PluginFunctions::tsplineMesh(object), FACE, r, g, b);
#endif
else {
emit log(LOGERR,"colorizeFaceSelection : Unsupported object Type" );
return;
......
......@@ -70,6 +70,11 @@ void SelectionPlugin::selectHandleVertices( int objectId , IdList _vertexList )
} else if ( object->dataType() == DATA_POLY_MESH ){
MeshSelection::setArea(PluginFunctions::polyMesh(object) , _vertexList , HANDLEAREA, true);
update_regions( PluginFunctions::polyMesh(object) );
#ifdef ENABLE_TSPLINEMESH_SUPPORT
} else if ( object->dataType() == DATA_TSPLINE_MESH ){
MeshSelection::setArea(PluginFunctions::tsplineMesh(object) , _vertexList , HANDLEAREA, true);
update_regions( PluginFunctions::tsplineMesh(object) );
#endif
} else {
emit log(LOGERR,tr("selectHandleVertices : Unsupported object Type") );
return;
......@@ -103,6 +108,10 @@ void SelectionPlugin::unselectHandleVertices( int objectId , IdList _vertexList
MeshSelection::setArea(PluginFunctions::triMesh(object) , _vertexList , HANDLEAREA, false);
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::setArea(PluginFunctions::polyMesh(object) , _vertexList , HANDLEAREA, false);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::setArea(PluginFunctions::tsplineMesh(object) , _vertexList , HANDLEAREA, false);
#endif
else {
emit log(LOGERR,tr("unselectHandleVertices : Unsupported object Type") );
return;
......@@ -133,6 +142,10 @@ void SelectionPlugin::clearHandleVertices( int objectId ) {
MeshSelection::setArea(PluginFunctions::triMesh(object) , HANDLEAREA, false);
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::setArea(PluginFunctions::polyMesh(object) , HANDLEAREA, false);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::setArea(PluginFunctions::tsplineMesh(object) , HANDLEAREA, false);
#endif
else {
emit log(LOGERR,tr("clearHandleVertices : Unsupported object Type") );
return;
......@@ -155,6 +168,10 @@ void SelectionPlugin::setAllHandleVertices( int objectId ) {
MeshSelection::setArea(PluginFunctions::triMesh(object) , HANDLEAREA, true);
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::setArea(PluginFunctions::polyMesh(object) , HANDLEAREA, true);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::setArea(PluginFunctions::tsplineMesh(object) , HANDLEAREA, true);
#endif
else {
emit log(LOGERR,tr("setAllHandleVertices : Unsupported object Type") );
return;
......@@ -179,6 +196,10 @@ IdList SelectionPlugin::getHandleVertices( int objectId ) {
return MeshSelection::getArea(PluginFunctions::triMesh(object) , HANDLEAREA);
else if ( object->dataType() == DATA_POLY_MESH )
return MeshSelection::getArea(PluginFunctions::polyMesh(object) , HANDLEAREA);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
return MeshSelection::getArea(PluginFunctions::tsplineMesh(object) , HANDLEAREA);
#endif
else {
emit log(LOGERR,tr("getHandleVertices : Unsupported object Type") );
return IdList(0);;
......
......@@ -70,6 +70,11 @@ void SelectionPlugin::selectModelingVertices( int objectId , IdList _vertexList
} else if ( object->dataType() == DATA_POLY_MESH ){
MeshSelection::setArea(PluginFunctions::polyMesh(object) , _vertexList , AREA, true);
update_regions( PluginFunctions::polyMesh(object) );
#ifdef ENABLE_TSPLINEMESH_SUPPORT
} else if ( object->dataType() == DATA_TSPLINE_MESH ){
MeshSelection::setArea(PluginFunctions::tsplineMesh(object) , _vertexList , AREA, true);
update_regions( PluginFunctions::tsplineMesh(object) );
#endif
} else {
emit log(LOGERR,tr("selectModelingVertices : Unsupported object Type") );
return;
......@@ -103,6 +108,10 @@ void SelectionPlugin::unselectModelingVertices( int objectId , IdList _vertexLis
MeshSelection::setArea(PluginFunctions::triMesh(object) , _vertexList , AREA, false);
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::setArea(PluginFunctions::polyMesh(object) , _vertexList , AREA, false);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::setArea(PluginFunctions::tsplineMesh(object) , _vertexList , AREA, false);
#endif
else{
emit log(LOGERR,tr("unselectModelingVertices : Unsupported object Type") );
return;
......@@ -133,6 +142,10 @@ void SelectionPlugin::clearModelingVertices( int objectId ) {
MeshSelection::setArea(PluginFunctions::triMesh(object) , AREA, false);
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::setArea(PluginFunctions::polyMesh(object) , AREA, false);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::setArea(PluginFunctions::tsplineMesh(object) , AREA, false);
#endif
else{
emit log(LOGERR,tr("clearModelingVertices : Unsupported object Type") );
return;
......@@ -155,6 +168,10 @@ void SelectionPlugin::setAllModelingVertices( int objectId ) {
MeshSelection::setArea(PluginFunctions::triMesh(object) , AREA, true);
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::setArea(PluginFunctions::polyMesh(object) , AREA, true);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::setArea(PluginFunctions::tsplineMesh(object) , AREA, true);
#endif
else{
emit log(LOGERR,tr("setAllModelingVertices : Unsupported object Type") );
return;
......@@ -178,6 +195,10 @@ IdList SelectionPlugin::getModelingVertices( int objectId ) {
return MeshSelection::getArea(PluginFunctions::triMesh(object) , AREA);
else if ( object->dataType() == DATA_POLY_MESH )
return MeshSelection::getArea(PluginFunctions::polyMesh(object) , AREA);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
return MeshSelection::getArea(PluginFunctions::tsplineMesh(object) , AREA);
#endif
else{
emit log(LOGERR,tr("getModelingVertices : Unsupported object Type") );
return IdList(0);
......@@ -230,6 +251,11 @@ void SelectionPlugin::loadFlipperModelingSelection( int _objectId , QString _fil
} else if ( object->dataType() == DATA_POLY_MESH ){
if ( PluginFunctions::polyMesh(object)->n_vertices() != vertexCount )
return;
#ifdef ENABLE_TSPLINEMESH_SUPPORT
} else if ( object->dataType() == DATA_TSPLINE_MESH ){
if ( PluginFunctions::tsplineMesh(object)->n_vertices() != vertexCount )
return;
#endif
} else {
return;
}
......@@ -329,6 +355,31 @@ void SelectionPlugin::saveFlipperModelingSelection( int _objectId , QString _fil
for (uint i=0; i < mesh->n_vertices(); i++)
input << (int) modelingAll[i] << " " << (int) handleAll[i] << endl;
#ifdef ENABLE_TSPLINEMESH_SUPPORT
} else if ( object->dataType() == DATA_TSPLINE_MESH){
TSplineMesh* mesh = PluginFunctions::tsplineMesh(object);
//header
input << "Selection" << endl;
input << mesh->n_vertices() << endl;
std::vector< int > modelingVertices = MeshSelection::getArea(mesh, AREA);
std::vector< int > handleVertices = MeshSelection::getArea(mesh, HANDLEAREA);
std::vector< bool > modelingAll(mesh->n_vertices(), false);
std::vector< bool > handleAll(mesh->n_vertices(), false);
for (uint i=0; i < modelingVertices.size(); i++)
modelingAll[ modelingVertices[i] ] = true;
for (uint i=0; i < handleVertices.size(); i++)
handleAll[ handleVertices[i] ] = true;
for (uint i=0; i < mesh->n_vertices(); i++)
input << (int) modelingAll[i] << " " << (int) handleAll[i] << endl;
#endif
} else {
emit log(LOGERR, tr("saveFlipperModelingSelection : Unsupported Type."));
}
......
......@@ -98,6 +98,18 @@ void SelectionPlugin::toggleSelection(QMouseEvent* _event)
toggleMeshSelection(PluginFunctions::polyMesh(object), target_idx, hit_point);
emit updatedObject(object->id());
}
#ifdef ENABLE_TSPLINEMESH_SUPPORT
}else if (object->dataType() == DATA_TSPLINE_MESH) {
if (PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_FACE, _event->pos(),node_idx, target_idx, &hit_point))
if ( PluginFunctions::getPickedObject(node_idx, object) )
if ( object->dataType(DATA_TSPLINE_MESH) ) {
toggleMeshSelection(PluginFunctions::tsplineMesh(object), target_idx, hit_point);
emit updatedObject(object->id());
}
#endif
}
#ifdef ENABLE_POLYLINE_SUPPORT
// POLYLINES
......@@ -185,7 +197,11 @@ void SelectionPlugin::paintSphereSelection(QMouseEvent* _event) {
if ( object->picked(node_idx) && object->dataType(DATA_POLY_MESH) ) {
paintSphereSelection(PluginFunctions::polyMesh(object), target_idx, hit_point);
}
#ifdef ENABLE_TSPLINEMESH_SUPPORT
if ( object->picked(node_idx) && object->dataType(DATA_TSPLINE_MESH) ) {
paintSphereSelection(PluginFunctions::tsplineMesh(object), target_idx, hit_point);
}
#endif
object->update();
}
......@@ -244,7 +260,17 @@ void SelectionPlugin::closestBoundarySelection(QMouseEvent* _event){
emit updatedObject(-1);
PluginFunctions::polyMeshObject(object)->updateSelection();
#ifdef ENABLE_TSPLINEMESH_SUPPORT
} else if ( object->dataType(DATA_TSPLINE_MESH) ) {
TSplineMesh* m = PluginFunctions::tsplineMesh(object);
TSplineMesh::VertexHandle vh = m->fv_iter(m->face_handle(target_idx)).handle();
closestBoundarySelection(m, vh.idx(), selectionType_ );
emit updatedObject(-1);
PluginFunctions::tsplineMeshObject(object)->updateSelection();
#endif
}
emit updateView();
}
......@@ -278,6 +304,12 @@ void SelectionPlugin::componentSelection(QMouseEvent* _event) {
componentSelection(PluginFunctions::polyMesh(object), target_idx);
}
#ifdef ENABLE_TSPLINEMESH_SUPPORT
if ( object->picked(node_idx) && object->dataType(DATA_TSPLINE_MESH) ) {
componentSelection(PluginFunctions::tsplineMesh(object), target_idx);
}
#endif
object->update();
emit createBackup(object->id(),tr("Component Selection"));
......@@ -341,6 +373,18 @@ void SelectionPlugin::floodFillSelection(QMouseEvent* _event)
floodFillSelection(PluginFunctions::polyMesh(object), target_idx);
emit updatedObject(object->id());
}
#ifdef ENABLE_TSPLINEMESH_SUPPORT
}else if (object->dataType() == DATA_TSPLINE_MESH) {
if (PluginFunctions::scenegraphPick(ACG::SceneGraph::PICK_FACE, _event->pos(),node_idx, target_idx, &hit_point))
if ( PluginFunctions::getPickedObject(node_idx, object) )
if ( object->dataType(DATA_TSPLINE_MESH) ) {
floodFillSelection(PluginFunctions::tsplineMesh(object), target_idx);
emit updatedObject(object->id());
}
#endif
}
else{
emit log(LOGERR,tr("floodFillSelection : Unsupported dataType"));
......@@ -423,6 +467,18 @@ void SelectionPlugin::surfaceLassoSelection(QMouseEvent* _event){
PluginFunctions::pickMode("PolyLine");
return;
#ifdef ENABLE_TSPLINEMESH_SUPPORT
} else if ( object->dataType(DATA_TSPLINE_MESH) ) {
emit log(LOGERR,tr("PolyLine on tspline meshes not fully supported!! "));
polyLineID_ = -1;
//switch back to PolyLine drawing
PluginFunctions::actionMode( Viewer::PickingMode );
waitingForPolyLineSelection_ = true;
PluginFunctions::pickMode("PolyLine");
return;
#endif
}
}
......@@ -715,7 +771,42 @@ int SelectionPlugin::createMeshFromSelection( int _objectId ){
emit updatedObject(id);
return id;
#ifdef ENABLE_TSPLINEMESH_SUPPORT
} else if( obj->dataType(DATA_TSPLINE_MESH) ) {
TSplineMesh* mesh = PluginFunctions::tsplineMesh(obj);
if ( mesh == 0 ) {
emit log(LOGERR, tr("Unable to get mesh"));
return -1;
}
//add an empty mesh
int id;
emit addEmptyObject(DATA_TSPLINE_MESH, id);
if (id == -1){
emit log(LOGERR, tr("Unable to add empty object"));
return -1;
}
BaseObjectData *newObj;
PluginFunctions::getObject(id, newObj);
TSplineMesh* newMesh = PluginFunctions::tsplineMesh(newObj);
if ( newMesh == 0 ) {
emit log(LOGERR, tr("Unable to get mesh"));
return -1;
}
//fill the empty mesh with the selection
createMeshFromSelection( *mesh, *newMesh);
emit updatedObject(_objectId);
emit updatedObject(id);
return id;
#endif
}else {
emit log(LOGERR, tr("DataType not supported"));
return -1;
......@@ -740,6 +831,12 @@ bool SelectVolumeAction::operator()(BaseNode* _node, ACG::GLState& _state)
PolyMesh* m = PluginFunctions::polyMesh(object);
selected = plugin_->volumeSelection (m, _state, region_);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
} else if ( object->dataType(DATA_TSPLINE_MESH) ) {
TSplineMesh* m = PluginFunctions::tsplineMesh(object);
selected = plugin_->volumeSelection (m, _state, region_);
#endif
}
if (selected && plugin_->selectionType_ & OBJECT) {
......
This diff is collapsed.
......@@ -68,6 +68,10 @@
#include <ObjectTypes/PolyMesh/PolyMesh.hh>
#include <ObjectTypes/TriangleMesh/TriangleMesh.hh>
#ifdef ENABLE_TSPLINEMESH_SUPPORT
#include <ObjectTypes/TSplineMesh/TSplineMesh.hh>
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
#include <ObjectTypes/PolyLine/PolyLine.hh>
#endif
......
......@@ -76,6 +76,10 @@ void SelectionPlugin::selectVertices( int objectId , IdList _vertexList ) {
MeshSelection::selectVertices(PluginFunctions::triMesh(object), _vertexList);
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::selectVertices(PluginFunctions::polyMesh(object), _vertexList);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::selectVertices(PluginFunctions::tsplineMesh(object), _vertexList);
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
else if ( object->dataType() == DATA_POLY_LINE )
PolyLineSelection::selectVertices( PluginFunctions::polyLine(object) , _vertexList );
......@@ -117,6 +121,10 @@ void SelectionPlugin::unselectVertices( int objectId , IdList _vertexList ) {
MeshSelection::unselectVertices(PluginFunctions::triMesh(object), _vertexList);
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::unselectVertices(PluginFunctions::polyMesh(object), _vertexList);
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::unselectVertices(PluginFunctions::tsplineMesh(object), _vertexList);
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
else if ( object->dataType() == DATA_POLY_LINE )
PolyLineSelection::unselectVertices( PluginFunctions::polyLine(object) , _vertexList );
......@@ -158,6 +166,10 @@ void SelectionPlugin::selectAllVertices( int objectId )
MeshSelection::selectAllVertices(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::selectAllVertices(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::selectAllVertices(PluginFunctions::tsplineMesh(object));
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
else if ( object->dataType() == DATA_POLY_LINE )
PolyLineSelection::selectAllVertices( PluginFunctions::polyLine(object) );
......@@ -189,6 +201,10 @@ void SelectionPlugin::clearVertexSelection( int objectId )
MeshSelection::clearVertexSelection(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::clearVertexSelection(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::clearVertexSelection(PluginFunctions::tsplineMesh(object));
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
else if ( object->dataType() == DATA_POLY_LINE )
PolyLineSelection::clearVertexSelection( PluginFunctions::polyLine(object) );
......@@ -220,6 +236,10 @@ void SelectionPlugin::invertVertexSelection( int objectId )
MeshSelection::invertVertexSelection(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::invertVertexSelection(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::invertVertexSelection(PluginFunctions::tsplineMesh(object));
#endif
#ifdef ENABLE_POLYLINE_SUPPORT
else if ( object->dataType() == DATA_POLY_LINE )
PolyLineSelection::invertVertexSelection( PluginFunctions::polyLine(object) );
......@@ -251,6 +271,10 @@ void SelectionPlugin::selectBoundaryVertices( int objectId )
MeshSelection::selectBoundaryVertices(PluginFunctions::triMesh(object));
else if ( object->dataType() == DATA_POLY_MESH )
MeshSelection::selectBoundaryVertices(PluginFunctions::polyMesh(object));
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
MeshSelection::selectBoundaryVertices(PluginFunctions::tsplineMesh(object));
#endif
else {
emit log(LOGERR,tr("selectBoundaryVertices : Unsupported object Type") );
return;
......@@ -274,6 +298,10 @@ void SelectionPlugin::selectClosestBoundaryVertices( int objectId, int VertexId
closestBoundarySelection(PluginFunctions::triMesh(object), VertexId , VERTEX );
else if ( object->dataType() == DATA_POLY_MESH )
closestBoundarySelection(PluginFunctions::polyMesh(object), VertexId, VERTEX );
#ifdef ENABLE_TSPLINEMESH_SUPPORT
else if ( object->dataType() == DATA_TSPLINE_MESH )
closestBoundarySelection(PluginFunctions::tsplineMesh(object), VertexId, VERTEX );
#endif