MESSAGE("blsurf_set_sizeMap(): " << smIt->first << " = " << smIt->second);
GeomShape = entryToShape(smIt->first);
GeomType = GeomShape.ShapeType();
+ MESSAGE("Geomtype is " << GeomType);
+ // Group Management
+ if (GeomType == TopAbs_COMPOUND){
+ for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){
+ if (it.Value().ShapeType() == TopAbs_FACE){
+ HasSizeMapOnFace = true;
+ FaceId2SizeMap[TopoDS::Face(it.Value()).HashCode(471662)] = smIt->second;
+ }
+ if (it.Value().ShapeType() == TopAbs_EDGE){
+ HasSizeMapOnEdge = true;
+ HasSizeMapOnFace = true;
+ EdgeId2SizeMap[TopoDS::Edge(it.Value()).HashCode(471662)] = smIt->second;
+ }
+ if (it.Value().ShapeType() == TopAbs_VERTEX){
+ HasSizeMapOnVertex = true;
+ HasSizeMapOnEdge = true;
+ HasSizeMapOnFace = true;
+ VertexId2SizeMap[TopoDS::Vertex(it.Value()).HashCode(471662)] = smIt->second;
+ }
+ }
+ }
if (GeomType == TopAbs_FACE){
HasSizeMapOnFace = true;
FaceId2SizeMap[TopoDS::Face(GeomShape).HashCode(471662)] = smIt->second;
QString sizeMap = QString::fromStdString(fullSizeMap.substr(pos, fullSizeMap.size()-pos));
that->mySMPMap[fullSizeMapList[0]] = sizeMap;
MESSAGE("mySMPMap[" << fullSizeMapList[0].toStdString() << "] = " << sizeMap.toStdString());
- that->mySMPShapeTypeMap[fullSizeMapList[0]] = myGeomToolSelected->entryToShape(fullSizeMapList[0].toStdString()).ShapeType();
+ that->mySMPShapeTypeMap[fullSizeMapList[0]] = myGeomToolSelected->entryToShapeType(fullSizeMapList[0].toStdString());
MESSAGE("mySMPShapeTypeMap[" << fullSizeMapList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[fullSizeMapList[0]]);
}
}
QStringList fullCustomSizeMapList = fullCustomSizeMaps.split( "|", QString::KeepEmptyParts );
if ( fullCustomSizeMapList.count() > 1 ) {
that->mySMPMap[fullCustomSizeMapList[0]] = fullCustomSizeMapList[1];
- that->mySMPShapeTypeMap[fullCustomSizeMapList[0]] = GeomToolSelected->entryToShape(fullCustomSizeMapList[0].toStdString()).ShapeType();
+ that->mySMPShapeTypeMap[fullCustomSizeMapList[0]] = GeomToolSelected->entryToShapeType(fullCustomSizeMapList[0].toStdString());
MESSAGE("mySMPMap[" << fullCustomSizeMapList[0].toStdString() << "] = " << fullCustomSizeMapList[1].toStdString());
MESSAGE("mySMPShapeTypeMap[" << fullCustomSizeMapList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[fullCustomSizeMapList[0]]);
}
QStringList myAttractorList = myAttractors.split( "|", QString::KeepEmptyParts );
if ( myAttractorList.count() > 1 ) {
that->mySMPMap[myAttractorList[0]] = myAttractorList[1];
- that->mySMPShapeTypeMap[myAttractorList[0]] = myGeomToolSelected->entryToShape(myAttractorList[0].toStdString()).ShapeType();
+ that->mySMPShapeTypeMap[myAttractorList[0]] = myGeomToolSelected->entryToShapeType(myAttractorList[0].toStdString());
MESSAGE("mySMPMap[" << myAttractorList[0].toStdString() << "] = " << myAttractorList[1].toStdString());
MESSAGE("mySMPShapeTypeMap[" << myAttractorList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[myAttractorList[0]]);
}
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
- TopoDS_Shape S;
+ TopAbs_ShapeEnum shapeType;
string entry, shapeName;
GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool();
Handle(SALOME_InteractiveObject) anObject = Object_It.Value();
entry = myGeomToolSelected->getEntryOfObject(anObject);
shapeName = anObject->getName();
- S = myGeomToolSelected->entryToShape(entry);
- if ((! S.IsNull()) && (S.ShapeType() == typeShapeAsked))
+ shapeType = myGeomToolSelected->entryToShapeType(entry);
+ MESSAGE("Object Name = " << shapeName << "& Type is " << anObject->getComponentDataType() << " & ShapeType is " << shapeType);
+ if (shapeType == typeShapeAsked)
{
mySizeMapTable->setFocus();
QString shapeEntry;
#include <GEOM_Client.hxx>
#include <SMESHGUI_Utils.h>
#include <boost/shared_ptr.hpp>
+#include <GEOMImpl_Types.hxx>
#include <TopoDS.hxx>
#include <BRep_Tool.hxx>
}
/*!
- * Retrieve the TopoDS shape from the first selected object
- * @return the TopoDS shape from the first selected object, empty TopoDS Shape if a shape is not selected.
+ * 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.
*/
-TopoDS_Shape GeomSelectionTools::getFirstSelectedTopoDSShape()
-{
- Handle(SALOME_InteractiveObject) anIO;
- anIO=GeomSelectionTools::getFirstSelectedSalomeObject();
- return entryToShape(anIO->getEntry());
-}
-
-/*!
- * Retrieve the TopoDS shape from the entry
- * @return the TopoDS shape from the entry, empty TopoDS Shape if the entry does not define a shape.
- */
-TopoDS_Shape GeomSelectionTools::entryToShape(std::string entry){
- MESSAGE("GeomSelectionTools::entryToShape"<<entry );
+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;
if ( strcmp(aSO->GetFatherComponent()->ComponentDataType().c_str(),"GEOM") == 0)
aShape = SMESH::SObjectToInterface<GEOM::GEOM_Object>(aSO);
if ( !aShape->_is_nil() ){
- MESSAGE("Got a Shape as Geom Object ");
-
- 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");
- 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 );
- }
- }
+ 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();
+ }
+ }
+ }
}
}
- return S;
+ 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()
{
- TopoDS_Shape S=getFirstSelectedTopoDSShape();
- if (!S.IsNull())
- return S.ShapeType();
- else
- return TopAbs_SHAPE;
+ Handle(SALOME_InteractiveObject) anIO;
+ anIO=GeomSelectionTools::getFirstSelectedSalomeObject();
+ return entryToShapeType(anIO->getEntry());
}
/*!
- * Print information to std output of the face (if the first selected object is a face)
+ * 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 or V is Rational ?
*
*/
-GeomAbs_SurfaceType GeomSelectionTools::getFaceInformation()
+GeomAbs_SurfaceType GeomSelectionTools::getFaceInformation(TopoDS_Shape S)
{
- TopoDS_Shape S=getFirstSelectedTopoDSShape();
GeomAbs_SurfaceType surf_type=GeomAbs_OtherSurface ;
if (!S.IsNull() && S.ShapeType()==TopAbs_FACE){
TopoDS_Face f=TopoDS::Face(S);