Salome HOME
Move GeomSelectionTools from BLSURF module to SMESH
authorvsr <vsr@opencascade.com>
Mon, 23 Nov 2009 14:50:16 +0000 (14:50 +0000)
committervsr <vsr@opencascade.com>
Mon, 23 Nov 2009 14:50:16 +0000 (14:50 +0000)
configure.ac
src/GUI/Makefile.am
src/Makefile.am
src/PluginUtils/GeomSelectionTools.cxx [deleted file]
src/PluginUtils/GeomSelectionTools.h [deleted file]
src/PluginUtils/Makefile.am [deleted file]

index d4de494358b6fb8a88467766c1c929d08de38ecb..88f2e4d4de35223298fe90af3fca380e4db1e891 100644 (file)
@@ -417,7 +417,6 @@ AC_OUTPUT([ \
   idl/Makefile \
   resources/Makefile \
   src/Makefile \
-  src/PluginUtils/Makefile \
   src/BLSURFPlugin/Makefile \
   src/GUI/Makefile \
   BLSURFPLUGIN_version.h \
index c2d5b2ec4686fffd0f7d2db7db322f11885d841c..8ffd461eee321f897ec3a11825882bd2ee769135 100644 (file)
@@ -56,14 +56,12 @@ libBLSURFPluginGUI_la_CPPFLAGS =    \
        $(CORBA_INCLUDES)               \
        $(BLSURF_INCLUDES)              \
        -I$(srcdir)/../BLSURFPlugin     \
-       -I$(srcdir)/../PluginUtils      \
        -I$(top_builddir)/idl
 
 libBLSURFPluginGUI_la_LDFLAGS =                        \
        ../BLSURFPlugin/libBLSURFEngine.la      \
-       ../PluginUtils/libGeomSelectionTools.la \
-       $(GUI_LDFLAGS) -lqtx -lSalomeApp \
-       ${SMESH_LDFLAGS} -lSMESH                \
+       $(GUI_LDFLAGS) -lqtx -lSalomeApp        \
+       ${SMESH_LDFLAGS} -lSMESH -lGeomSelectionTools \
        $(CAS_KERNEL) $(BLSURF_LIBS)
 
 # resources files
index 01a228ad6c6efcad62c1c5fa082283c620765916..23b6bb17fc956092c6f7963a7113a4b6256a3895 100644 (file)
@@ -26,7 +26,7 @@ include $(top_srcdir)/adm_local/unix/make_common_starter.am
 SUBDIRS = BLSURFPlugin
 
 if BLSURFPLUGIN_ENABLE_GUI
-  SUBDIRS += PluginUtils GUI
+  SUBDIRS += GUI
 endif
 
-DIST_SUBDIRS = PluginUtils BLSURFPlugin GUI
+DIST_SUBDIRS = BLSURFPlugin GUI
diff --git a/src/PluginUtils/GeomSelectionTools.cxx b/src/PluginUtils/GeomSelectionTools.cxx
deleted file mode 100644 (file)
index 74a5f64..0000000
+++ /dev/null
@@ -1,302 +0,0 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-//
-//  This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// ---
-// File    : GeomSelectionTools.cxx
-// Authors : Nicolas GEIMER (OCC)
-// ---
-//
-
-
-#include "GeomSelectionTools.h"
-
-#include <LightApp_SelectionMgr.h>
-#include <SalomeApp_Application.h>
-#include <SUIT_Session.h>
-
-#include <SALOME_ListIteratorOfListIO.hxx>
-#include <GEOM_Client.hxx>
-#include <SMESHGUI_Utils.h>
-#include <boost/shared_ptr.hpp>
-#include <GEOMImpl_Types.hxx>
-
-#include <TopoDS.hxx>
-#include <BRep_Tool.hxx>
-#include <Handle_Geom_Surface.hxx>
-#include <BRepAdaptor_Surface.hxx>
-
-#include "utilities.h"
-
-#include "SALOME_LifeCycleCORBA.hxx"
-#include <sstream>
-
-/*!
- * Constructor
- * @param aStudy pointer to the Study
- *
- */
-GeomSelectionTools::GeomSelectionTools(_PTR(Study) aStudy)
-{
-  myStudy = aStudy;
-}
-
-/*!
- * Accessor to the Study used by this GeomSelectionTools object
- * @return The study used by the GeomSelectionTools class
- */
-_PTR(Study) GeomSelectionTools::getMyStudy()
-{
-    return myStudy;
-}
-
-/*!
- * Allows to get the Salome Application
- * @return A LightApp_SelectionMgr Pointer or 0 if it can't get it.
- */
-SalomeApp_Application*  GeomSelectionTools::GetSalomeApplication()
-{
-  SalomeApp_Application* anApp = dynamic_cast<SalomeApp_Application*>( SUIT_Session::session()->activeApplication() );
-  if (anApp)
-    return anApp;
-  else
-    return 0;
-}
-
-/*!
- * Allows to get the selection manager from LightApp
- * @return A LightApp_SelectionMgr Pointer or 0 if it can't get it.
- */
-LightApp_SelectionMgr*  GeomSelectionTools::selectionMgr()
-{
-   SalomeApp_Application* anApp = GetSalomeApplication();
-   if (anApp)
-     return dynamic_cast<LightApp_SelectionMgr*>( anApp->selectionMgr() );
-   else
-     return 0;
-}
-
-/*!
- * Return the list of the selected Salome Interactive Object (SALOME_ListIO*)
- * @return the list of the selected Salome Interactive Object
- */
-SALOME_ListIO* GeomSelectionTools::getSelectedSalomeObjects()
-{
-  SALOME_ListIO* selected;
-  LightApp_SelectionMgr* aSel = selectionMgr();
-  aSel->selectedObjects( *selected, NULL, false );
-  return selected;
-}
-
-/*!
- * Return the first selected Salome Interactive Object (Handle(Salome_InteractiveObject))
- * @return the first selected Salome Interactive Object
- */
-Handle(SALOME_InteractiveObject) GeomSelectionTools::getFirstSelectedSalomeObject()
-{
-  SALOME_ListIO selected;
-  LightApp_SelectionMgr* aSel = selectionMgr();
-  aSel->selectedObjects( selected, NULL, false );
-  if (!selected.IsEmpty()){
-    SALOME_ListIteratorOfListIO anIt(selected);
-    Handle(SALOME_InteractiveObject) anIO;
-    anIO = anIt.Value();
-    return anIO;
-  }
-  return NULL;
-}
-
-/*!
- * Return the entry of the first selected Object
- * @return the entry of the first selected Object
- */
-std::string GeomSelectionTools::getFirstSelectedEntry()
-{
-  Handle(SALOME_InteractiveObject) anIO;
-  std::string entry="";
-  anIO=GeomSelectionTools::getFirstSelectedSalomeObject();
-  return GeomSelectionTools::getEntryOfObject(anIO);
-}
-
-/*!
- * Return the entry of a Salome Interactive Object
- * @param anIO the Handle of the Salome Interactive Object
- * @return the entry of the Salome Interactive Object
- */
-std::string GeomSelectionTools::getEntryOfObject(Handle(SALOME_InteractiveObject) anIO){
-  std::string entry="";
-  _PTR(SObject) aSO = myStudy->FindObjectID(anIO->getEntry());
-  if (aSO){
-    _PTR(SObject) aRefSObj;
-    // If selected object is a reference
-    if ( aSO->ReferencedObject( aRefSObj ))
-      entry = aRefSObj->GetID();
-    // If selected object is a reference is not a reference
-    else
-      entry= anIO->getEntry();
-  }
-  return entry;
-}
-
-/*!
- * Retrieve the name from the entry of the object
- * @param entry the entry of the object
- * @return the name of the object
- */
-std::string GeomSelectionTools::getNameFromEntry(std::string entry){
-  std::string name = "";
-  _PTR(SObject) aSO = myStudy->FindObjectID(entry);
-  if (aSO){
-    _PTR(SObject) aRefSObj;
-    // If selected object is a reference
-    if ( aSO->ReferencedObject( aRefSObj ))
-      name = aRefSObj->GetName();
-    // If selected object is a reference is not a reference
-    else
-      name = aSO->GetName();
-   }
-  return name;
-}
-
-
-/*!
- * Retrieve the component type of the first selected object, it manages successfully references.
- * @return the component type of the first selected object
- */
-std::string GeomSelectionTools::getFirstSelectedComponentDataType()
-{
-  Handle(SALOME_InteractiveObject) anIO;
-  std::string DataType="";
-  anIO=GeomSelectionTools::getFirstSelectedSalomeObject();
-  _PTR(SObject) aSO = myStudy->FindObjectID(anIO->getEntry());
-  if (aSO){
-    _PTR(SObject) aRefSObj;
-    // If selected object is a reference
-    if ( aSO->ReferencedObject( aRefSObj ))
-      DataType= aRefSObj->GetFatherComponent()->ComponentDataType();
-    // If selected object is a reference is not a reference
-    else
-      DataType=anIO->getComponentDataType();
- }
- return DataType;
-}
-
-/*!
- * Retrieve the shape type from the entry
- * @return the shape type from the entry, return TopAbs_SHAPE if the object does not define a shape or a group.
- */
-TopAbs_ShapeEnum GeomSelectionTools::entryToShapeType(std::string entry){
-//   MESSAGE("GeomSelectionTools::entryToShapeType"<<entry );
-  TopoDS_Shape S = TopoDS_Shape();
-  TopAbs_ShapeEnum ShapeType = TopAbs_SHAPE;
-   _PTR(SObject) aSO = myStudy->FindObjectID(entry);
-  if (aSO){
-    _PTR(SObject) aRefSObj;
-    GEOM::GEOM_Object_var aShape;
-    // MESSAGE("Got a SO");
-    // If selected object is a reference
-    if ( aSO->ReferencedObject( aRefSObj ))
-      aSO = aRefSObj;
-    // MESSAGE("aSO->GetFatherComponent()->ComponentDataType(): " << aSO->GetFatherComponent()->ComponentDataType());
-    if (  strcmp(aSO->GetFatherComponent()->ComponentDataType().c_str(),"GEOM") == 0)
-      aShape = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aSO);
-    if ( !aShape->_is_nil() ){
-      // MESSAGE("Got the Geom Object ");
-      // MESSAGE("Geom Object Type "<< aShape->GetType());
-      SalomeApp_Application* anApp = GetSalomeApplication();
-      if (anApp) {
-//         MESSAGE("Got Application");
-        Engines::Component_var component = anApp->lcc()->FindOrLoad_Component( "FactoryServer","GEOM" );
-        GEOM::GEOM_Gen_var _geomEngine = GEOM::GEOM_Gen::_narrow(component);
-//         MESSAGE("Got GEOM engine");
-        // if the Geom Object is a group
-        if (aShape->GetType() == GEOM_GROUP){
-//           MESSAGE("It's a group");  
-          GEOM::GEOM_IGroupOperations_var aGroupOp = _geomEngine->GetIGroupOperations(myStudy->StudyId());
-          ShapeType= (TopAbs_ShapeEnum)aGroupOp->GetType(aShape);
-        } 
-        // if not
-        else { 
-          GEOM_Client* aClient = new GEOM_Client();
-          if ( aClient && !_geomEngine->_is_nil() ) {
-//             MESSAGE("GEOM client is OK and GEOM engine is not null");
-            S = aClient->GetShape( _geomEngine, aShape );
-            ShapeType=S.ShapeType();
-          }
-        }
-      }
-    }
-  }
-//   MESSAGE("ShapeType returned is " << ShapeType);
-  return ShapeType;
-}
-
-/*!
- * Gives the ShapeType of the first Selected Object, return TopAbs_SHAPE if the first selected object does not define a shape.
- * @return the ShapeType of the first Selected Object, return TopAbs_SHAPE if the first selected object does not define a shape.
- */
-TopAbs_ShapeEnum GeomSelectionTools:: getFirstSelectedShapeType()
-{
- Handle(SALOME_InteractiveObject) anIO;
- anIO=GeomSelectionTools::getFirstSelectedSalomeObject();
- return entryToShapeType(anIO->getEntry());
-}
-
-/*!
- *  Print information to std output of the face
- *  and return the OCC type of face: Plane, Cylinder,Cone, Sphere, Torus, BezierSurface,BSplineSurface, SurfaceOfRevolution,SurfaceOfExtrusion, OtherSurface
- *  @param TopoDS_Shape S Face we want information about.
- *  @return the OCC type of face: Plane, Cylinder,Cone, Sphere, Torus, BezierSurface,BSplineSurface, SurfaceOfRevolution,SurfaceOfExtrusion, OtherSurface
- *  return Other_Surface if the selected face is not a face.
- *  Information printed is :
- *  U and V degrees
- *  U and V number of poles
- *  U and V number of knots
- *  U or V is Rational ?
- *
- */
-GeomAbs_SurfaceType GeomSelectionTools::getFaceInformation(TopoDS_Shape S)
-{
-  GeomAbs_SurfaceType surf_type=GeomAbs_OtherSurface ;
-  if (!S.IsNull() &&  S.ShapeType()==TopAbs_FACE){
-    TopoDS_Face f=TopoDS::Face(S);
-    Handle(Geom_Surface) surf = BRep_Tool::Surface(f);
-    BRepAdaptor_Surface surf_adap=BRepAdaptor_Surface::BRepAdaptor_Surface(f);
-
-    /* Global Information */
-    std::cout << "GLOBAL INFORMATION" << std::endl;
-    std::cout << "******************" << std::endl;
-    std::stringstream buffer;
-    buffer << "Degre U : " <<  surf_adap.UDegree();
-   //conversion nĂ©cessaire pour affichage
-    std::cout << buffer.str() << std::endl;
-    std::cout <<  " Degre V : " <<  surf_adap.VDegree() << std::endl;
-    std::cout <<  " Nb Poles U : " <<  surf_adap.NbUPoles() << std::endl;
-    std::cout <<  " Nb Poles V : " <<  surf_adap.NbVPoles() << std::endl;
-    std::cout <<  " Nb Noeuds U : " <<  surf_adap.NbUKnots() << std::endl;
-    std::cout <<  " Nb Noeuds V : " <<  surf_adap.NbVKnots() << std::endl;
-    std::cout <<  " U Rationnel ? " <<  surf_adap.IsURational() << std::endl;
-    std::cout <<  " V Rationnel ? " <<  surf_adap.IsVRational() << std::endl;
-
-    surf_type=surf_adap.GetType();
-  }
-  return surf_type;
-}
-
-
-
-
diff --git a/src/PluginUtils/GeomSelectionTools.h b/src/PluginUtils/GeomSelectionTools.h
deleted file mode 100644 (file)
index 2ec4e9f..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-//  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
-//
-//  This library is free software; you can redistribute it and/or
-//  modify it under the terms of the GNU Lesser General Public
-//  License as published by the Free Software Foundation; either
-//  version 2.1 of the License.
-// This library is distributed in the hope that it will be useful,
-//  but WITHOUT ANY WARRANTY; without even the implied warranty of
-//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-//  Lesser General Public License for more details.
-//
-//  You should have received a copy of the GNU Lesser General Public
-//  License along with this library; if not, write to the Free Software
-//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-//
-//  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-//
-// ---
-// File    : GeomSelectionTools.h
-// Authors : Nicolas GEIMER (OCC)
-// ---
-#ifndef _GEOMSELECTIONTOOLS_H_
-#define _GEOMSELECTIONTOOLS_H_
-
-#ifdef WIN32
-#  ifdef GeomSelectionTools_EXPORTS
-#    define GEOMSELECTIONTOOLS_EXPORT __declspec( dllexport )
-#  else
-#    define GEOMSELECTIONTOOLS_EXPORT __declspec( dllimport )
-#  endif
-#else
-#  define GEOMSELECTIONTOOLS_EXPORT
-#endif
-
-#include "SALOMEDSClient.hxx"
-#include "SALOME_InteractiveObject.hxx"
-#include <SALOME_ListIO.hxx>
-#include <SalomeApp_Application.h>
-
-#include <TopoDS_Shape.hxx>
-#include <GeomAbs_SurfaceType.hxx>
-
-class LightApp_SelectionMgr;
-
-
-/*!
- * The GeomSelectionTools class gives high level tools to select Geom (and other objects)
- * A specific attention has been given to analyze selected GEOM objects.
- *
- * @param myStudy This class is specific to the study !
- *
- */
-
-class GEOMSELECTIONTOOLS_EXPORT GeomSelectionTools
-{
-
-private:
-
-  _PTR(Study) myStudy;
-
-public:
-
-  GeomSelectionTools(_PTR(Study));
-  static SalomeApp_Application*  GetSalomeApplication();
-  static LightApp_SelectionMgr* selectionMgr();
-  SALOME_ListIO* getSelectedSalomeObjects();
-  Handle(SALOME_InteractiveObject) getFirstSelectedSalomeObject();
-  std::string getFirstSelectedEntry();
-  std::string getEntryOfObject(Handle(SALOME_InteractiveObject));
-  std::string getNameFromEntry(std::string);
-  std::string getFirstSelectedComponentDataType();
-  TopAbs_ShapeEnum getFirstSelectedShapeType();
-  TopAbs_ShapeEnum entryToShapeType(std::string );
-  GeomAbs_SurfaceType getFaceInformation(TopoDS_Shape);
-  _PTR(Study) getMyStudy();
-};
-
-
-#endif // _GEOMSELECTIONTOOLS_H_
-
diff --git a/src/PluginUtils/Makefile.am b/src/PluginUtils/Makefile.am
deleted file mode 100644 (file)
index 7b35669..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
-#
-#  This library is free software; you can redistribute it and/or
-#  modify it under the terms of the GNU Lesser General Public
-#  License as published by the Free Software Foundation; either
-#  version 2.1 of the License.
-#
-#  This library is distributed in the hope that it will be useful,
-#  but WITHOUT ANY WARRANTY; without even the implied warranty of
-#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-#  Lesser General Public License for more details.
-#
-#  You should have received a copy of the GNU Lesser General Public
-#  License along with this library; if not, write to the Free Software
-#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
-#
-#  See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
-#
-# ---
-# File   : Makefile.am
-# Author : Nicolas GEIMER (OCC)
-# ---
-#
-include $(top_srcdir)/adm_local/unix/make_common_starter.am
-
-# header files 
-salomeinclude_HEADERS =
-
-# Libraries targets
-lib_LTLIBRARIES = libGeomSelectionTools.la
-
-dist_libGeomSelectionTools_la_SOURCES =                \
-       GeomSelectionTools.h                    \
-       GeomSelectionTools.cxx
-
-# additionnal information to compil and link file
-
-libGeomSelectionTools_la_CPPFLAGS =    \
-       $(QT_INCLUDES)                  \
-       $(CAS_CPPFLAGS)                 \
-       $(PYTHON_INCLUDES)              \
-       $(KERNEL_CXXFLAGS)              \
-       $(GUI_CXXFLAGS)                 \
-       $(GEOM_CXXFLAGS)                \
-       $(SMESH_CXXFLAGS)               \
-       $(MED_CXXFLAGS)                 \
-       $(BOOST_CPPFLAGS)               \
-       $(CORBA_CXXFLAGS)               \
-       $(CORBA_INCLUDES)               \
-       -I$(top_builddir)/idl
-
-libGeomSelectionTools_la_LDFLAGS =             \
-       $(QT_LIBS) \
-       $(CORBA_LIBS) \
-       $(KERNEL_LDFLAGS) -lSalomeIDLKernel -lSALOMELocalTrace -lSalomeLifeCycleCORBA \
-       $(GUI_LDFLAGS) -lSalomeObject -lsuit -lLightApp -lSalomeApp \
-       $(GEOM_LDFLAGS) -lSalomeIDLGEOM -lGEOMClient \
-       ${SMESH_LDFLAGS} -lSMESH                \
-       $(CAS_KERNEL) -lTKBRep -lTKG3d
-
-# resources files
-#nodist_salomeres_DATA =               \
-#      BLSURFPlugin_images.qm  \
-#      BLSURFPlugin_msg_en.qm