From: eap Date: Wed, 26 Oct 2016 16:56:09 +0000 (+0300) Subject: 23370: [CEA 632] Impose enforced vertices without indicate the face on which the... X-Git-Tag: V8_2_0a1~1 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=954619f5f0632bf86d23984f0fd005372d6628e8;p=plugins%2Fblsurfplugin.git 23370: [CEA 632] Impose enforced vertices without indicate the face on which the node is --- diff --git a/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_enforced_vertices.png b/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_enforced_vertices.png index 8fa2954..1dbdd01 100644 Binary files a/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_enforced_vertices.png and b/doc/salome/gui/BLSURFPLUGIN/images/blsurf_parameters_enforced_vertices.png differ diff --git a/doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc b/doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc index 21b80db..ad2770a 100644 --- a/doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc +++ b/doc/salome/gui/BLSURFPLUGIN/input/blsurf_hypo.doc @@ -330,22 +330,22 @@ shape. The distance is the geodesic distance (i.e. calculated by following the s \image html blsurf_parameters_enforced_vertices.png It is possible to define some enforced vertices to MG-CADSurf algorithm. -An enforced vertex is defined on a Face or a Compound by +An enforced vertex is defined by - selecting an existing Vertex or Compound, -- or creating a new vertex given its coordinates. +- or by its coordinates. The enforced vertex is the projection of a point defined by its -(x,y,z) coordinates on the selected face. +(x,y,z) coordinates on the closest face found by the application. -- It is possible to define several enforced vertices on a face or a group of faces. +- It is possible to define several enforced vertices. - If the projected point is on the boundary or outside of the face, it will be ignored. -- If a group name is specified : If the group exists, the enforced nodes will be added in the existing group, if the group does not exist it will be created. +- If a group name is specified : if the group exists, the enforced nodes will be added in the existing group, if the group does not exist it will be created. -All the internal vertices of the faces can be considered as enforced vertices if the corresponding checkbox is checked. +All the internal vertices of faces can be considered as enforced vertices if the corresponding checkbox is checked. A group can optionnaly be defined on those enforced vertices. \sa Sample TUI Script of the \ref tui_blsurf "creation of a MG-CADSurf hypothesis", including enforced vertices. diff --git a/idl/BLSURFPlugin_Algorithm.idl b/idl/BLSURFPlugin_Algorithm.idl index d7f9c11..9846997 100644 --- a/idl/BLSURFPlugin_Algorithm.idl +++ b/idl/BLSURFPlugin_Algorithm.idl @@ -579,6 +579,7 @@ module BLSURFPlugin /*! * Set/get/unset an enforced vertex on geom face */ + // OBSOLETE boolean SetEnforcedVertex(in GEOM::GEOM_Object theFace, in double x, in double y, in double z) raises (SALOME::SALOME_Exception); boolean SetEnforcedVertexNamed(in GEOM::GEOM_Object theFace, in double x, in double y, in double z, in TEnfName theVertexName) raises (SALOME::SALOME_Exception); boolean SetEnforcedVertexGeom(in GEOM::GEOM_Object theFace, in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception); @@ -586,17 +587,27 @@ module BLSURFPlugin boolean SetEnforcedVertexNamedWithGroup(in GEOM::GEOM_Object theFace, in double x, in double y, in double z, in TEnfName theVertexName, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception); boolean SetEnforcedVertexGeomWithGroup(in GEOM::GEOM_Object theFace, in GEOM::GEOM_Object theVertex, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception); - TEnfVertexList GetEnforcedVertices(in GEOM::GEOM_Object theFace) raises (SALOME::SALOME_Exception); - boolean UnsetEnforcedVertex(in GEOM::GEOM_Object theFace, in double x, in double y, in double z) raises (SALOME::SALOME_Exception); boolean UnsetEnforcedVertexGeom(in GEOM::GEOM_Object theFace, in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception); boolean UnsetEnforcedVertices(in GEOM::GEOM_Object theFace) raises (SALOME::SALOME_Exception); - /*! - * Set/get/unset an enforced vertex on geom face given by entry - */ - boolean SetEnforcedVertexEntry(in TEntry theFaceEntry, in double x, in double y, in double z, + // NEW - no face + boolean AddEnforcedVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception); + boolean AddEnforcedVertexNamed(in double x, in double y, in double z, in TEnfName theVertexName) raises (SALOME::SALOME_Exception); + boolean AddEnforcedVertexGeom(in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception); + boolean AddEnforcedVertexWithGroup(in double x, in double y, in double z, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception); + boolean AddEnforcedVertexNamedWithGroup(in double x, in double y, in double z, in TEnfName theVertexName, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception); + boolean AddEnforcedVertexGeomWithGroup(in GEOM::GEOM_Object theVertex, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception); + + boolean RemoveEnforcedVertex(in double x, in double y, in double z) raises (SALOME::SALOME_Exception); + boolean RemoveEnforcedVertexGeom(in GEOM::GEOM_Object theVertex) raises (SALOME::SALOME_Exception); + boolean RemoveEnforcedVertices() raises (SALOME::SALOME_Exception); + + /*! + * Set/get/unset an enforced vertex on geom face given by entry + */ + boolean SetEnforcedVertexEntry(in TEntry theFaceEntry, in double x, in double y, in double z, in TEnfName theVertexName, in TEntry theVertexEntry, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception); TEnfVertexList GetEnforcedVerticesEntry(in TEntry theFaceEntry) raises (SALOME::SALOME_Exception); diff --git a/resources/BLSURFPlugin.xml b/resources/BLSURFPlugin.xml index 5fd562f..d436037 100644 --- a/resources/BLSURFPlugin.xml +++ b/resources/BLSURFPlugin.xml @@ -59,6 +59,15 @@ UnsetEnforcedVertex, UnsetEnforcedVertexGeom, UnsetEnforcedVertices, + AddEnforcedVertex, + AddEnforcedVertexNamed, + AddEnforcedVertexGeom, + AddEnforcedVertexWithGroup, + AddEnforcedVertexNamedWithGroup, + AddEnforcedVertexGeomWithGroup, + RemoveEnforcedVertex, + RemoveEnforcedVertexGeom, + RemoveEnforcedVertices, AddPreCadFacesPeriodicity diff --git a/src/BLSURFPlugin/BLSURFPluginBuilder.py b/src/BLSURFPlugin/BLSURFPluginBuilder.py index a1833a5..f61279b 100644 --- a/src/BLSURFPlugin/BLSURFPluginBuilder.py +++ b/src/BLSURFPlugin/BLSURFPluginBuilder.py @@ -495,6 +495,42 @@ class BLSURF_Algorithm(Mesh_Algorithm): return self.Parameters().SetEnforcedVertexGeomWithGroup(theFace, theVertex,groupName) pass + ## Set an enforced vertex on a face given the coordinates of a point. + # The face if found by the application. + # @param x : x coordinate + # @param y : y coordinate + # @param z : z coordinate + # @param vertexName : name of the enforced vertex + # @param groupName : name of the group + def AddEnforcedVertex(self, x, y, z, vertexName = "", groupName = ""): + from salome.smesh.smeshBuilder import AssureGeomPublished + if vertexName == "": + if groupName == "": + return self.Parameters().AddEnforcedVertex(x, y, z) + else: + return self.Parameters().AddEnforcedVertexWithGroup(x, y, z, groupName) + pass + else: + if groupName == "": + return self.Parameters().AddEnforcedVertexNamed(x, y, z, vertexName) + else: + return self.Parameters().AddEnforcedVertexNamedWithGroup( x, y, z, vertexName, groupName) + pass + pass + + ## To set an enforced vertex on a face given a GEOM vertex, group or compound. + # The face if found by the application. + # @param theVertex : GEOM vertex (or group, compound). + # @param groupName : name of the group + def AddEnforcedVertexGeom(self, theVertex, groupName = ""): + from salome.smesh.smeshBuilder import AssureGeomPublished + AssureGeomPublished( self.mesh, theVertex ) + if groupName == "": + return self.Parameters().AddEnforcedVertexGeom(theVertex) + else: + return self.Parameters().AddEnforcedVertexGeomWithGroup(theVertex,groupName) + pass + ## To remove an enforced vertex on a given GEOM face (or group, compound) given the coordinates. # @param theFace : GEOM face (or group, compound) on which to remove the enforced vertex # @param x : x coordinate diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx index 655aa9c..9c59492 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.cxx @@ -242,8 +242,6 @@ BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId, int studyId, SMESH_Gen* gen) : SMESH_2D_Algo(hypId, studyId, gen) { - MESSAGE("BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF"); - _name = "MG-CADSurf";//"BLSURF"; _shapeType = (1 << TopAbs_FACE); // 1 bit /shape type _compatibleHypothesis.push_back(BLSURFPlugin_Hypothesis::GetHypType()); @@ -257,12 +255,8 @@ BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId, int studyId, CORBA::Object_var anObject = smeshGen_i->GetNS()->Resolve("/myStudyManager"); SALOMEDS::StudyManager_var aStudyMgr = SALOMEDS::StudyManager::_narrow(anObject); - MESSAGE("studyid = " << _studyId); - myStudy = NULL; myStudy = aStudyMgr->GetStudyByID(_studyId); - if ( !myStudy->_is_nil() ) - MESSAGE("myStudy->StudyId() = " << myStudy->StudyId()); /* Initialize the Python interpreter */ assert(Py_IsInitialized()); @@ -306,7 +300,6 @@ BLSURFPlugin_BLSURF::BLSURFPlugin_BLSURF(int hypId, int studyId, BLSURFPlugin_BLSURF::~BLSURFPlugin_BLSURF() { - MESSAGE("BLSURFPlugin_BLSURF::~BLSURFPlugin_BLSURF"); } @@ -442,34 +435,29 @@ double getT(const TopoDS_Edge& edge, const gp_Pnt& point) ///////////////////////////////////////////////////////// TopoDS_Shape BLSURFPlugin_BLSURF::entryToShape(std::string entry) { - MESSAGE("BLSURFPlugin_BLSURF::entryToShape "<FindObjectID( entry.c_str() ); - if (!aSObj->_is_nil()) { - CORBA::Object_var obj = aSObj->GetObject(); - aGeomObj = GEOM::GEOM_Object::_narrow(obj); - aSObj->UnRegister(); - } - if ( !aGeomObj->_is_nil() ) - S = smeshGen_i->GeomObjectToShape( aGeomObj.in() ); + TopoDS_Shape S; + if ( !entry.empty() ) + { + GEOM::GEOM_Object_var aGeomObj; + SALOMEDS::SObject_var aSObj = myStudy->FindObjectID( entry.c_str() ); + if (!aSObj->_is_nil()) { + CORBA::Object_var obj = aSObj->GetObject(); + aGeomObj = GEOM::GEOM_Object::_narrow(obj); + aSObj->UnRegister(); + } + if ( !aGeomObj->_is_nil() ) + S = smeshGen_i->GeomObjectToShape( aGeomObj.in() ); + } return S; } void _createEnforcedVertexOnFace(TopoDS_Face faceShape, gp_Pnt aPnt, BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex) { BLSURFPlugin_Hypothesis::TEnfVertexCoords enf_coords, coords, s_coords; - enf_coords.clear(); - coords.clear(); - s_coords.clear(); // Get the (u,v) values of the enforced vertex on the face projectionPoint myPoint = getProjectionPoint(faceShape,aPnt); - MESSAGE("Enforced Vertex: " << aPnt.X() << ", " << aPnt.Y() << ", " << aPnt.Z()); - MESSAGE("Projected Vertex: " << myPoint.xyz.X() << ", " << myPoint.xyz.Y() << ", " << myPoint.xyz.Z()); - MESSAGE("Parametric coordinates: " << myPoint.uv.X() << ", " << myPoint.uv.Y() ); - enf_coords.push_back(aPnt.X()); enf_coords.push_back(aPnt.Y()); enf_coords.push_back(aPnt.Z()); @@ -485,10 +473,7 @@ void _createEnforcedVertexOnFace(TopoDS_Face faceShape, gp_Pnt aPnt, BLSURFPlugi s_coords.push_back(myPoint.xyz.Z()); // Save pair projected vertex / enf vertex - MESSAGE("Storing pair projected vertex / enf vertex:"); - MESSAGE("("<< myPoint.xyz.X() << ", " << myPoint.xyz.Y() << ", " << myPoint.xyz.Z() <<") / (" << aPnt.X() << ", " << aPnt.Y() << ", " << aPnt.Z()<<")"); EnfVertexCoords2ProjVertex[s_coords] = enf_coords; - MESSAGE("Group name is: \"" << enfVertex->grpName << "\""); pair ret; BLSURFPlugin_Hypothesis::TEnfVertexList::iterator it; ret = EnfVertexCoords2EnfVertexList[s_coords].insert(enfVertex); @@ -514,24 +499,121 @@ void _createEnforcedVertexOnFace(TopoDS_Face faceShape, gp_Pnt aPnt, BLSURFPlugi sameAttractor = true; if (FaceId2EnforcedVertexCoords.find(key) != FaceId2EnforcedVertexCoords.end()) { - MESSAGE("Map of enf. vertex has key " << key) - MESSAGE("Enf. vertex list size is: " << FaceId2EnforcedVertexCoords[key].size()) if (! sameAttractor) FaceId2EnforcedVertexCoords[key].insert(coords); // there should be no redondant coords here (see std::set management) - else - MESSAGE("An attractor node is already defined: I don't add the enforced vertex"); - MESSAGE("New Enf. vertex list size is: " << FaceId2EnforcedVertexCoords[key].size()) } else { - MESSAGE("Map of enf. vertex has not key " << key << ": creating it") if (! sameAttractor) { BLSURFPlugin_Hypothesis::TEnfVertexCoordsList ens; ens.insert(coords); FaceId2EnforcedVertexCoords[key] = ens; } + } +} + +/*! + * \brief Find geom faces supporting given points + */ +TopoDS_Shape BLSURFPlugin_BLSURF:: +findFaces( const BLSURFPlugin_Hypothesis::TEnfVertexList& enfVertexList ) +{ + // get points from enfVertexList + vector< gp_Pnt > points; + BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator enfVertexListIt = enfVertexList.begin(); + for( ; enfVertexListIt != enfVertexList.end() ; ++enfVertexListIt ) + { + BLSURFPlugin_Hypothesis::TEnfVertex * enfVertex = *enfVertexListIt; + if ( enfVertex->coords.size() >= 3 ) + { + points.push_back( gp_Pnt( enfVertex->coords[0], enfVertex->coords[1], enfVertex->coords[2])); + } else - MESSAGE("An attractor node is already defined: I don't add the enforced vertex"); + { + TopoDS_Shape GeomShape = entryToShape( enfVertex->geomEntry ); + if ( !GeomShape.IsNull() ) + { + if ( GeomShape.ShapeType() == TopAbs_VERTEX ) + points.push_back( BRep_Tool::Pnt( TopoDS::Vertex( GeomShape ))); + + else if ( GeomShape.ShapeType() == TopAbs_COMPOUND) + for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()) + if ( it.Value().ShapeType() == TopAbs_VERTEX ) + points.push_back( BRep_Tool::Pnt( TopoDS::Vertex( it.Value() ))); + } + } } + + TopoDS_Shape resultShape, myShape = myHelper->GetSubShape(); + TopoDS_Compound compound; + + for ( size_t i = 0; i <= points.size(); ++i ) + { + TopoDS_Face foundFace; + TopTools_MapOfShape checkedFaces; + std::map< double, std::pair< TopoDS_Face, gp_Pnt2d > > dist2face; + + for ( TopExp_Explorer exp ( myShape, TopAbs_FACE ); exp.More(); exp.Next()) + { + const TopoDS_Face& face = TopoDS::Face( exp.Current() ); + if ( !checkedFaces.Add( face )) continue; + + // check distance to face + Handle(ShapeAnalysis_Surface) surface = myHelper->GetSurface( face ); + gp_Pnt2d uv = surface->ValueOfUV( points[i], Precision::Confusion()); + double distance = surface->Gap(); + if ( distance > Precision::Confusion() ) + { + // the face is far, store for future analysis + dist2face.insert( std::make_pair( distance, std::make_pair( face, uv ))); + } + else + { + // check location on the face + BRepClass_FaceClassifier FC( face, uv, Precision::Confusion()); + if ( FC.State() == TopAbs_IN ) + { + foundFace = face; + break; + } + } + } + if ( foundFace.IsNull() ) + { + // find the closest face + std::map< double, std::pair< TopoDS_Face, gp_Pnt2d > >::iterator d2f = dist2face.begin(); + for ( ; d2f != dist2face.end(); ++d2f ) + { + const TopoDS_Face& face = d2f->second.first; + const gp_Pnt2d & uv = d2f->second.second; + BRepClass_FaceClassifier FC( face, uv, Precision::Confusion()); + if ( FC.State() == TopAbs_IN ) + { + foundFace = face; + break; + } + } + } + // set the resultShape + if ( !foundFace.IsNull() ) + { + if ( resultShape.IsNull() ) + { + resultShape = foundFace; + } + else + { + BRep_Builder builder; + if ( compound.IsNull() ) + { + builder.MakeCompound( compound ); + resultShape = compound; + } + builder.Add( compound, foundFace ); + } + } + } // loop on points + + return resultShape; } ///////////////////////////////////////////////////////// @@ -574,7 +656,6 @@ void BLSURFPlugin_BLSURF::createEnforcedVertexOnFace(TopoDS_Shape faceShape, BLS ///////////////////////////////////////////////////////// void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction, double defaultSize) { - MESSAGE("Attractor function: "<< AttractorFunction); double xa, ya, za; // Coordinates of attractor point double a, b; // Attractor parameter double d = 0.; @@ -622,7 +703,6 @@ void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction pos2 = AttractorFunction.find(sep, pos1+1); if (pos2!=string::npos) { string createNodeStr = AttractorFunction.substr(pos1+1, pos2-pos1-1); - MESSAGE("createNode: " << createNodeStr); createNode = (AttractorFunction.substr(pos1+1, pos2-pos1-1) == "True"); pos1=pos2; } @@ -657,8 +737,6 @@ void createAttractorOnFace(TopoDS_Shape GeomShape, std::string AttractorFunction // of r-d where r is the distance to (u0,v0) attractorFunctionStream << "*exp(-(0.5*(sqrt((u-"< &theVerticesEntries, std::vector &theVerticesCoords) { for (std::vector::const_iterator it = theVerticesEntries.begin(); it != theVerticesEntries.end(); it++) - { - BLSURFPlugin_Hypothesis::TEntry theVertexEntry = *it; - MESSAGE("Vertex entry " << theVertexEntry); - addCoordsFromVertex(theVertexEntry, theVerticesCoords); - } + { + BLSURFPlugin_Hypothesis::TEntry theVertexEntry = *it; + addCoordsFromVertex(theVertexEntry, theVerticesCoords); + } } void BLSURFPlugin_BLSURF::addCoordsFromVertex(BLSURFPlugin_Hypothesis::TEntry theVertexEntry, std::vector &theVerticesCoords) { if (theVertexEntry!="") - { - TopoDS_Shape aShape = entryToShape(theVertexEntry); + { + TopoDS_Shape aShape = entryToShape(theVertexEntry); - gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); - double theX, theY, theZ; - theX = aPnt.X(); - theY = aPnt.Y(); - theZ = aPnt.Z(); + gp_Pnt aPnt = BRep_Tool::Pnt( TopoDS::Vertex( aShape ) ); + double theX, theY, theZ; + theX = aPnt.X(); + theY = aPnt.Y(); + theZ = aPnt.Z(); - theVerticesCoords.push_back(theX); - theVerticesCoords.push_back(theY); - theVerticesCoords.push_back(theZ); - } + theVerticesCoords.push_back(theX); + theVerticesCoords.push_back(theY); + theVerticesCoords.push_back(theZ); + } } ///////////////////////////////////////////////////////// void BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity) { - MESSAGE("BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity"); - TopoDS_Shape geomShape1 = entryToShape(preCadPeriodicity.shape1Entry); TopoDS_Shape geomShape2 = entryToShape(preCadPeriodicity.shape2Entry); @@ -779,26 +844,15 @@ void BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape preCadFacesPeriodicityIDs.shape1IDs = theFace1_ids; preCadFacesPeriodicityIDs.shape2IDs = theFace2_ids; - MESSAGE("preCadPeriodicity.theSourceVerticesEntries.size(): " << preCadPeriodicity.theSourceVerticesEntries.size()); - MESSAGE("preCadPeriodicity.theTargetVerticesEntries.size(): " << preCadPeriodicity.theTargetVerticesEntries.size()); - addCoordsFromVertices(preCadPeriodicity.theSourceVerticesEntries, preCadFacesPeriodicityIDs.theSourceVerticesCoords); addCoordsFromVertices(preCadPeriodicity.theTargetVerticesEntries, preCadFacesPeriodicityIDs.theTargetVerticesCoords); - MESSAGE("preCadFacesPeriodicityIDs.theSourceVerticesCoords.size(): " << preCadFacesPeriodicityIDs.theSourceVerticesCoords.size()); - MESSAGE("preCadFacesPeriodicityIDs.theTargetVerticesCoords.size(): " << preCadFacesPeriodicityIDs.theTargetVerticesCoords.size()); - _preCadFacesIDsPeriodicityVector.push_back(preCadFacesPeriodicityIDs); - MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size()); - MESSAGE("BLSURFPlugin_BLSURF::createPreCadFacesPeriodicity END"); - } ///////////////////////////////////////////////////////// void BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity) { - MESSAGE("BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity"); - TopoDS_Shape geomShape1 = entryToShape(preCadPeriodicity.shape1Entry); TopoDS_Shape geomShape2 = entryToShape(preCadPeriodicity.shape2Entry); @@ -813,9 +867,6 @@ void BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape addCoordsFromVertices(preCadPeriodicity.theTargetVerticesEntries, preCadEdgesPeriodicityIDs.theTargetVerticesCoords); _preCadEdgesIDsPeriodicityVector.push_back(preCadEdgesPeriodicityIDs); - MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size()); - MESSAGE("BLSURFPlugin_BLSURF::createPreCadEdgesPeriodicity END"); - } @@ -871,7 +922,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, if (hyp) { - MESSAGE("BLSURFPlugin_BLSURF::SetParameters"); _physicalMesh = (int) hyp->GetPhysicalMesh(); _geometricMesh = (int) hyp->GetGeometricMesh(); if (hyp->GetPhySize() > 0) { @@ -930,21 +980,18 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, BLSURFPlugin_Hypothesis::TOptionValues::const_iterator opIt; for ( opIt = opts.begin(); opIt != opts.end(); ++opIt ) if ( !opIt->second.empty() ) { - MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second); set_param(css, opIt->first.c_str(), opIt->second.c_str()); } const BLSURFPlugin_Hypothesis::TOptionValues& custom_opts = hyp->GetCustomOptionValues(); for ( opIt = custom_opts.begin(); opIt != custom_opts.end(); ++opIt ) if ( !opIt->second.empty() ) { - MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second); set_param(css, opIt->first.c_str(), opIt->second.c_str()); } const BLSURFPlugin_Hypothesis::TOptionValues& preCADopts = hyp->GetPreCADOptionValues(); for ( opIt = preCADopts.begin(); opIt != preCADopts.end(); ++opIt ) if ( !opIt->second.empty() ) { - MESSAGE("cadsurf_set_param(): " << opIt->first << " = " << opIt->second); set_param(css, opIt->first.c_str(), opIt->second.c_str()); } } @@ -1053,22 +1100,20 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, if ( _verb > 0 ) std::cout << "_smp_phy_size = " << _smp_phy_size << std::endl; - if (_physicalMesh == BLSURFPlugin_Hypothesis::PhysicalLocalSize){ + if (_physicalMesh == BLSURFPlugin_Hypothesis::PhysicalLocalSize) + { TopoDS_Shape GeomShape; TopoDS_Shape AttShape; TopAbs_ShapeEnum GeomType; // // Standard Size Maps // - MESSAGE("Setting a Size Map"); const BLSURFPlugin_Hypothesis::TSizeMap sizeMaps = BLSURFPlugin_Hypothesis::GetSizeMapEntries(hyp); BLSURFPlugin_Hypothesis::TSizeMap::const_iterator smIt = sizeMaps.begin(); for ( ; smIt != sizeMaps.end(); ++smIt ) { if ( !smIt->second.empty() ) { - MESSAGE("cadsurf_set_sizeMap(): " << smIt->first << " = " << smIt->second); GeomShape = entryToShape(smIt->first); GeomType = GeomShape.ShapeType(); - MESSAGE("Geomtype is " << GeomType); int key = -1; // Group Management if (GeomType == TopAbs_COMPOUND) { @@ -1081,7 +1126,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, } else { key = FacesWithSizeMap.FindIndex(TopoDS::Face(it.Value())); -// MESSAGE("Face with key " << key << " already in map"); } FaceId2SizeMap[key] = smIt->second; } @@ -1094,7 +1138,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, } else { key = EdgesWithSizeMap.FindIndex(TopoDS::Edge(it.Value())); -// MESSAGE("Edge with key " << key << " already in map"); } EdgeId2SizeMap[key] = smIt->second; } @@ -1108,9 +1151,7 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, } else { key = VerticesWithSizeMap.FindIndex(TopoDS::Vertex(it.Value())); - MESSAGE("Group of vertices with key " << key << " already in map"); } - MESSAGE("Group of vertices with key " << key << " has a size map: " << smIt->second); VertexId2SizeMap[key] = smIt->second; } } @@ -1123,7 +1164,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, } else { key = FacesWithSizeMap.FindIndex(TopoDS::Face(GeomShape)); -// MESSAGE("Face with key " << key << " already in map"); } FaceId2SizeMap[key] = smIt->second; } @@ -1136,7 +1176,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, } else { key = EdgesWithSizeMap.FindIndex(TopoDS::Edge(GeomShape)); -// MESSAGE("Edge with key " << key << " already in map"); } EdgeId2SizeMap[key] = smIt->second; } @@ -1150,9 +1189,7 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, } else { key = VerticesWithSizeMap.FindIndex(TopoDS::Vertex(GeomShape)); - MESSAGE("Vertex with key " << key << " already in map"); } - MESSAGE("Vertex with key " << key << " has a size map: " << smIt->second); VertexId2SizeMap[key] = smIt->second; } } @@ -1162,13 +1199,11 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, // Attractors // // TODO appeler le constructeur des attracteurs directement ici - MESSAGE("Setting Attractors"); // if ( !_phySizeRel ) { const BLSURFPlugin_Hypothesis::TSizeMap attractors = BLSURFPlugin_Hypothesis::GetAttractorEntries(hyp); BLSURFPlugin_Hypothesis::TSizeMap::const_iterator atIt = attractors.begin(); for ( ; atIt != attractors.end(); ++atIt ) { if ( !atIt->second.empty() ) { - MESSAGE("cadsurf_set_attractor(): " << atIt->first << " = " << atIt->second); GeomShape = entryToShape(atIt->first); GeomType = GeomShape.ShapeType(); // Group Management @@ -1201,8 +1236,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, } } // } -// else -// MESSAGE("Impossible to create the attractors when the physical size is relative"); // Class Attractors // temporary commented out for testing @@ -1221,7 +1254,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, BLSURFPlugin_Hypothesis::TAttractorMap::const_iterator AtIt = class_attractors.begin(); for ( ; AtIt != class_attractors.end(); ++AtIt ) { if ( !AtIt->second->Empty() ) { - // MESSAGE("cadsurf_set_attractor(): " << AtIt->first << " = " << AtIt->second); GeomShape = entryToShape(AtIt->first); if ( !SMESH_MesherHelper::IsSubShape( GeomShape, theGeomShape )) continue; @@ -1260,15 +1292,19 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, // // Enforced Vertices // - MESSAGE("Setting Enforced Vertices"); const BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap entryEnfVertexListMap = BLSURFPlugin_Hypothesis::GetAllEnforcedVerticesByFace(hyp); BLSURFPlugin_Hypothesis::TFaceEntryEnfVertexListMap::const_iterator enfIt = entryEnfVertexListMap.begin(); for ( ; enfIt != entryEnfVertexListMap.end(); ++enfIt ) { if ( !enfIt->second.empty() ) { GeomShape = entryToShape(enfIt->first); - GeomType = GeomShape.ShapeType(); + if ( GeomShape.IsNull() ) + { + GeomShape = findFaces( enfIt->second ); + if ( GeomShape.IsNull() ) + continue; + } // Group Management - if (GeomType == TopAbs_COMPOUND){ + if ( GeomShape.ShapeType() == TopAbs_COMPOUND){ for (TopoDS_Iterator it (GeomShape); it.More(); it.Next()){ if (it.Value().ShapeType() == TopAbs_FACE){ HasSizeMapOnFace = true; @@ -1276,8 +1312,7 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, } } } - - if (GeomType == TopAbs_FACE){ + if ( GeomShape.ShapeType() == TopAbs_FACE){ HasSizeMapOnFace = true; createEnforcedVertexOnFace(GeomShape, enfIt->second); } @@ -1288,11 +1323,9 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, bool useInternalVertexAllFaces = BLSURFPlugin_Hypothesis::GetInternalEnforcedVertexAllFaces(hyp); if (useInternalVertexAllFaces) { std::string grpName = BLSURFPlugin_Hypothesis::GetInternalEnforcedVertexAllFacesGroup(hyp); - MESSAGE("Setting Internal Enforced Vertices"); gp_Pnt aPnt; TopExp_Explorer exp (theGeomShape, TopAbs_FACE); for (; exp.More(); exp.Next()){ - MESSAGE("Iterating shapes. Shape type is " << exp.Current().ShapeType()); TopExp_Explorer exp_face (exp.Current(), TopAbs_VERTEX, TopAbs_EDGE); for (; exp_face.More(); exp_face.Next()) { @@ -1300,7 +1333,6 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, // Check if current coords is already in enfVertexList // If coords not in enfVertexList, add new enfVertex aPnt = BRep_Tool::Pnt(TopoDS::Vertex(exp_face.Current())); - MESSAGE("Found vertex on face at " << aPnt.X() <<", "<coords.push_back(aPnt.X()); enfVertex->coords.push_back(aPnt.Y()); @@ -1316,15 +1348,12 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, } } - MESSAGE("Setting Size Map on FACES "); cadsurf_set_sizemap_iso_cad_face(css, size_on_surface, &_smp_phy_size); if (HasSizeMapOnEdge){ - MESSAGE("Setting Size Map on EDGES "); cadsurf_set_sizemap_iso_cad_edge(css, size_on_edge, &_smp_phy_size); } if (HasSizeMapOnVertex){ - MESSAGE("Setting Size Map on VERTICES "); cadsurf_set_sizemap_iso_cad_point(css, size_on_vertex, &_smp_phy_size); } } @@ -1335,24 +1364,17 @@ void BLSURFPlugin_BLSURF::SetParameters(const BLSURFPlugin_Hypothesis* hyp, _preCadFacesIDsPeriodicityVector.clear(); _preCadEdgesIDsPeriodicityVector.clear(); - MESSAGE("SetParameters preCadFacesPeriodicityVector"); const BLSURFPlugin_Hypothesis::TPreCadPeriodicityVector preCadFacesPeriodicityVector = BLSURFPlugin_Hypothesis::GetPreCadFacesPeriodicityVector(hyp); for (std::size_t i = 0; i TSubMeshSet; @@ -1868,11 +1888,7 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, // an object that correctly deletes all cadsurf objects at destruction BLSURF_Cleaner cleaner( ctx,css,c,dcad ); - MESSAGE("BEGIN SetParameters"); SetParameters(_hypothesis, css, aShape); - MESSAGE("END SetParameters"); - - MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size()); haveQuadraticSubMesh = haveQuadraticSubMesh || (_hypothesis != NULL && _hypothesis->GetQuadraticMesh()); helper.SetIsQuadratic( haveQuadraticSubMesh ); @@ -1962,8 +1978,8 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, faceKey = FacesWithSizeMap.FindIndex(f); - if (FaceId2SizeMap.find(faceKey)!=FaceId2SizeMap.end()) { - MESSAGE("A size map is defined on face :"< >::iterator attractor_iter = FaceId2AttractorCoords.begin(); for (; attractor_iter != FaceId2AttractorCoords.end(); ++attractor_iter) { - if (attractor_iter->first == faceKey) { - MESSAGE("Face indice: " << iface); - MESSAGE("Adding attractor"); - + if (attractor_iter->first == faceKey) + { double xyzCoords[3] = {attractor_iter->second[2], attractor_iter->second[3], attractor_iter->second[4]}; - MESSAGE("Check position of vertex =(" << xyzCoords[0] << "," << xyzCoords[1] << "," << xyzCoords[2] << ")"); gp_Pnt P(xyzCoords[0],xyzCoords[1],xyzCoords[2]); BRepClass_FaceClassifier scl(f,P,1e-7); - // OCC 6.3sp6 : scl.Perform() is bugged. The function was rewritten - // BRepClass_FaceClassifierPerform(&scl,f,P,1e-7); - // OCC 6.5.2: scl.Perform() is not bugged anymore scl.Perform(f, P, 1e-7); TopAbs_State result = scl.State(); - MESSAGE("Position of point on face: "<second[0],attractor_iter->second[1]}; ienf++; - MESSAGE("Add cad point on (u,v)=(" << uvCoords[0] << "," << uvCoords[1] << ") with id = " << ienf); cad_point_t* point_p = cad_point_new(fce, ienf, uvCoords); cad_point_set_tag(point_p, ienf); } @@ -2026,8 +2033,6 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, // ----------------- TId2ClsAttractorVec::iterator clAttractor_iter = FaceId2ClassAttractor.find(faceKey); if (clAttractor_iter != FaceId2ClassAttractor.end()){ - MESSAGE("Face indice: " << iface); - MESSAGE("Adding attractor"); std::vector< BLSURFPlugin_Attractor* > & attVec = clAttractor_iter->second; for ( size_t i = 0; i < attVec.size(); ++i ) if ( !attVec[i]->IsMapBuilt() ) { @@ -2045,19 +2050,14 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, faceKey = FacesWithEnforcedVertices.FindIndex(f); std::map::const_iterator evmIt = FaceId2EnforcedVertexCoords.find(faceKey); if (evmIt != FaceId2EnforcedVertexCoords.end()) { - MESSAGE("Some enforced vertices are defined"); BLSURFPlugin_Hypothesis::TEnfVertexCoordsList evl; - MESSAGE("Face indice: " << iface); - MESSAGE("Adding enforced vertices"); evl = evmIt->second; - MESSAGE("Number of vertices to add: "<< evl.size()); BLSURFPlugin_Hypothesis::TEnfVertexCoordsList::const_iterator evlIt = evl.begin(); for (; evlIt != evl.end(); ++evlIt) { BLSURFPlugin_Hypothesis::TEnfVertexCoords xyzCoords; xyzCoords.push_back(evlIt->at(2)); xyzCoords.push_back(evlIt->at(3)); xyzCoords.push_back(evlIt->at(4)); - MESSAGE("Check position of vertex =(" << xyzCoords[0] << "," << xyzCoords[1] << "," << xyzCoords[2] << ")"); gp_Pnt P(xyzCoords[0],xyzCoords[1],xyzCoords[2]); BRepClass_FaceClassifier scl(f,P,1e-7); // OCC 6.3sp6 : scl.Perform() is bugged. The function was rewritten @@ -2065,9 +2065,7 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, // OCC 6.5.2: scl.Perform() is not bugged anymore scl.Perform(f, P, 1e-7); TopAbs_State result = scl.State(); - MESSAGE("Position of point on face: "<at(0),evlIt->at(1)}; ienf++; - MESSAGE("Add cad point on (u,v)=(" << uvCoords[0] << "," << uvCoords[1] << ") with id = " << ienf); cad_point_t* point_p = cad_point_new(fce, ienf, uvCoords); int tag = 0; std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(xyzCoords); @@ -2143,8 +2137,8 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, if (HasSizeMapOnEdge){ edgeKey = EdgesWithSizeMap.FindIndex(e); - if (EdgeId2SizeMap.find(edgeKey)!=EdgeId2SizeMap.end()) { - MESSAGE("Sizemap defined on edge with index " << edgeKey); + if (EdgeId2SizeMap.find(edgeKey)!=EdgeId2SizeMap.end()) + { theSizeMapStr = EdgeId2SizeMap[edgeKey]; if (theSizeMapStr.find(bad_end) == (theSizeMapStr.size()-bad_end.size()-1)) continue; @@ -2280,7 +2274,6 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, vertexKey = VerticesWithSizeMap.FindIndex(v); if (VertexId2SizeMap.find(vertexKey)!=VertexId2SizeMap.end()){ theSizeMapStr = VertexId2SizeMap[vertexKey]; - //MESSAGE("VertexId2SizeMap[faceKey]: " << VertexId2SizeMap[vertexKey]); if (theSizeMapStr.find(bad_end) == (theSizeMapStr.size()-bad_end.size()-1)) continue; // Expr To Python function, verification is performed at validation in GUI @@ -2356,10 +2349,8 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, // PERIODICITY // /////////////////////// - MESSAGE("BEFORE PERIODICITY"); - MESSAGE("_preCadFacesIDsPeriodicityVector.size() = " << _preCadFacesIDsPeriodicityVector.size()); - if (! _preCadFacesIDsPeriodicityVector.empty()) { - MESSAGE("INTO PRECAD FACES PERIODICITY"); + if (! _preCadFacesIDsPeriodicityVector.empty()) + { for (std::size_t i=0; i < _preCadFacesIDsPeriodicityVector.size(); i++){ std::vector theFace1_ids = _preCadFacesIDsPeriodicityVector[i].shape1IDs; std::vector theFace2_ids = _preCadFacesIDsPeriodicityVector[i].shape2IDs; @@ -2373,43 +2364,33 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, for (std::size_t j=0; j < theFace2_ids.size(); j++) o << theFace2_ids[j] << ", "; o << "]"; - MESSAGE(o.str()); - MESSAGE("theFace1_ids.size(): " << theFace1_ids.size()); - MESSAGE("theFace2_ids.size(): " << theFace2_ids.size()); if (_preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords.empty()) - { - // If no source points, call peridoicity without transformation function - MESSAGE("periodicity without transformation function"); - meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL; - status = cad_add_face_multiple_periodicity_with_transformation_function(c, theFace1_ids_c, theFace1_ids.size(), - theFace2_ids_c, theFace2_ids.size(), periodicity_transformation, NULL); - if(status != STATUS_OK) - cout << "cad_add_face_multiple_periodicity_with_transformation_function failed with error code " << status << "\n"; - } + { + // If no source points, call peridoicity without transformation function + meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL; + status = cad_add_face_multiple_periodicity_with_transformation_function(c, theFace1_ids_c, theFace1_ids.size(), + theFace2_ids_c, theFace2_ids.size(), periodicity_transformation, NULL); + if(status != STATUS_OK) + cout << "cad_add_face_multiple_periodicity_with_transformation_function failed with error code " << status << "\n"; + } else - { - // get the transformation vertices - MESSAGE("periodicity with transformation vertices"); - double* theSourceVerticesCoords_c = &_preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords[0]; - double* theTargetVerticesCoords_c = &_preCadFacesIDsPeriodicityVector[i].theTargetVerticesCoords[0]; - int nbSourceVertices = _preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords.size()/3; - int nbTargetVertices = _preCadFacesIDsPeriodicityVector[i].theTargetVerticesCoords.size()/3; - - MESSAGE("nbSourceVertices: " << nbSourceVertices << ", nbTargetVertices: " << nbTargetVertices); - - status = cad_add_face_multiple_periodicity_with_transformation_function_by_points(c, theFace1_ids_c, theFace1_ids.size(), - theFace2_ids_c, theFace2_ids.size(), theSourceVerticesCoords_c, nbSourceVertices, theTargetVerticesCoords_c, nbTargetVertices); - if(status != STATUS_OK) - cout << "cad_add_face_multiple_periodicity_with_transformation_function_by_points failed with error code " << status << "\n"; - } + { + // get the transformation vertices + double* theSourceVerticesCoords_c = &_preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords[0]; + double* theTargetVerticesCoords_c = &_preCadFacesIDsPeriodicityVector[i].theTargetVerticesCoords[0]; + int nbSourceVertices = _preCadFacesIDsPeriodicityVector[i].theSourceVerticesCoords.size()/3; + int nbTargetVertices = _preCadFacesIDsPeriodicityVector[i].theTargetVerticesCoords.size()/3; + + status = cad_add_face_multiple_periodicity_with_transformation_function_by_points(c, theFace1_ids_c, theFace1_ids.size(), + theFace2_ids_c, theFace2_ids.size(), theSourceVerticesCoords_c, nbSourceVertices, theTargetVerticesCoords_c, nbTargetVertices); + if(status != STATUS_OK) + cout << "cad_add_face_multiple_periodicity_with_transformation_function_by_points failed with error code " << status << "\n"; + } } - - MESSAGE("END PRECAD FACES PERIODICITY"); } - MESSAGE("_preCadEdgesIDsPeriodicityVector.size() = " << _preCadEdgesIDsPeriodicityVector.size()); - if (! _preCadEdgesIDsPeriodicityVector.empty()) { - MESSAGE("INTO PRECAD EDGES PERIODICITY"); + if (! _preCadEdgesIDsPeriodicityVector.empty()) + { for (std::size_t i=0; i < _preCadEdgesIDsPeriodicityVector.size(); i++){ std::vector theEdge1_ids = _preCadEdgesIDsPeriodicityVector[i].shape1IDs; std::vector theEdge2_ids = _preCadEdgesIDsPeriodicityVector[i].shape2IDs; @@ -2425,41 +2406,30 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, for (std::size_t j=0; j < theEdge2_ids.size(); j++) o << theEdge2_ids[j] << ", "; o << "]"; - MESSAGE(o.str()); - MESSAGE("theEdge1_ids.size(): " << theEdge1_ids.size()); - MESSAGE("theEdge2_ids.size(): " << theEdge2_ids.size()); if (_preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords.empty()) - { - // If no source points, call peridoicity without transformation function - MESSAGE("periodicity without transformation function"); - meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL; - status = cad_add_edge_multiple_periodicity_with_transformation_function(c, theEdge1_ids_c, theEdge1_ids.size(), - theEdge2_ids_c, theEdge2_ids.size(), periodicity_transformation, NULL); - if(status != STATUS_OK) - cout << "cad_add_edge_multiple_periodicity_with_transformation_function failed with error code " << status << "\n"; - } + { + // If no source points, call peridoicity without transformation function + meshgems_cad_periodicity_transformation_t periodicity_transformation = NULL; + status = cad_add_edge_multiple_periodicity_with_transformation_function(c, theEdge1_ids_c, theEdge1_ids.size(), + theEdge2_ids_c, theEdge2_ids.size(), periodicity_transformation, NULL); + if(status != STATUS_OK) + cout << "cad_add_edge_multiple_periodicity_with_transformation_function failed with error code " << status << "\n"; + } else - { - // get the transformation vertices - MESSAGE("periodicity with transformation vertices"); - double* theSourceVerticesCoords_c = &_preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords[0]; - double* theTargetVerticesCoords_c = &_preCadEdgesIDsPeriodicityVector[i].theTargetVerticesCoords[0]; - int nbSourceVertices = _preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords.size()/3; - int nbTargetVertices = _preCadEdgesIDsPeriodicityVector[i].theTargetVerticesCoords.size()/3; - - MESSAGE("nbSourceVertices: " << nbSourceVertices << ", nbTargetVertices: " << nbTargetVertices); - - status = cad_add_edge_multiple_periodicity_with_transformation_function_by_points(c, theEdge1_ids_c, theEdge1_ids.size(), - theEdge2_ids_c, theEdge2_ids.size(), theSourceVerticesCoords_c, nbSourceVertices, theTargetVerticesCoords_c, nbTargetVertices); - if(status != STATUS_OK) - cout << "cad_add_edge_multiple_periodicity_with_transformation_function_by_points failed with error code " << status << "\n"; - else - MESSAGE("cad_add_edge_multiple_periodicity_with_transformation_function_by_points succeeded.\n"); - } + { + // get the transformation vertices + double* theSourceVerticesCoords_c = &_preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords[0]; + double* theTargetVerticesCoords_c = &_preCadEdgesIDsPeriodicityVector[i].theTargetVerticesCoords[0]; + int nbSourceVertices = _preCadEdgesIDsPeriodicityVector[i].theSourceVerticesCoords.size()/3; + int nbTargetVertices = _preCadEdgesIDsPeriodicityVector[i].theTargetVerticesCoords.size()/3; + + status = cad_add_edge_multiple_periodicity_with_transformation_function_by_points(c, theEdge1_ids_c, theEdge1_ids.size(), + theEdge2_ids_c, theEdge2_ids.size(), theSourceVerticesCoords_c, nbSourceVertices, theTargetVerticesCoords_c, nbTargetVertices); + if(status != STATUS_OK) + cout << "cad_add_edge_multiple_periodicity_with_transformation_function_by_points failed with error code " << status << "\n"; + } } - - MESSAGE("END PRECAD EDGES PERIODICITY"); } @@ -2565,8 +2535,8 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, projVertex.push_back((double)xyz[1]); projVertex.push_back((double)xyz[2]); std::map< BLSURFPlugin_Hypothesis::TEnfVertexCoords, BLSURFPlugin_Hypothesis::TEnfVertexList >::const_iterator enfCoordsIt = EnfVertexCoords2EnfVertexList.find(projVertex); - if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end()) { - MESSAGE("Found enforced vertex @ " << xyz[0] << ", " << xyz[1] << ", " << xyz[2]); + if (enfCoordsIt != EnfVertexCoords2EnfVertexList.end()) + { BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator enfListIt = enfCoordsIt->second.begin(); BLSURFPlugin_Hypothesis::TEnfVertex *currentEnfVertex; for (; enfListIt != enfCoordsIt->second.end(); ++enfListIt) { @@ -2574,25 +2544,17 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, if (currentEnfVertex->grpName != "") { bool groupDone = false; SMESH_Mesh::GroupIteratorPtr grIt = aMesh.GetGroups(); - MESSAGE("currentEnfVertex->grpName: " << currentEnfVertex->grpName); - MESSAGE("Parsing the groups of the mesh"); while (grIt->more()) { SMESH_Group * group = grIt->next(); if ( !group ) continue; - MESSAGE("Group: " << group->GetName()); SMESHDS_GroupBase* groupDS = group->GetGroupDS(); if ( !groupDS ) continue; - MESSAGE("group->SMDSGroup().GetType(): " << (groupDS->GetType())); - MESSAGE("group->SMDSGroup().GetType()==SMDSAbs_Node: " << (groupDS->GetType()==SMDSAbs_Node)); - MESSAGE("currentEnfVertex->grpName.compare(group->GetStoreName())==0: " << (currentEnfVertex->grpName.compare(group->GetName())==0)); if ( groupDS->GetType()==SMDSAbs_Node && currentEnfVertex->grpName.compare(group->GetName())==0) { SMESHDS_Group* aGroupDS = static_cast( groupDS ); aGroupDS->SMDSGroup().Add(nodes[iv]); - MESSAGE("Node ID: " << nodes[iv]->GetID()); // How can I inform the hypothesis ? // _hypothesis->AddEnfVertexNodeID(currentEnfVertex->grpName,nodes[iv]->GetID()); groupDone = true; - MESSAGE("Successfully added enforced vertex to existing group " << currentEnfVertex->grpName); break; } } @@ -2603,7 +2565,6 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, aGroup->SetName( currentEnfVertex->grpName.c_str() ); SMESHDS_Group* aGroupDS = static_cast( aGroup->GetGroupDS() ); aGroupDS->SMDSGroup().Add(nodes[iv]); - MESSAGE("Successfully created enforced vertex group " << currentEnfVertex->grpName); groupDone = true; } if (!groupDone) @@ -2869,7 +2830,6 @@ bool BLSURFPlugin_BLSURF::compute(SMESH_Mesh& aMesh, FacesWithEnforcedVertices.Statistics(std::cout); */ - MESSAGE("END OF BLSURFPlugin_BLSURF::Compute()"); return ( status == STATUS_OK && !quadraticSubMeshAndViscousLayer ); } @@ -3027,7 +2987,7 @@ status_t size_on_surface(integer face_id, real *uv, real *size, void *user_data) if ( pyresult != NULL) { result = PyFloat_AsDouble(pyresult); Py_DECREF(pyresult); -// *size = result; + // *size = result; } else{ fflush(stderr); @@ -3045,10 +3005,8 @@ status_t size_on_surface(integer face_id, real *uv, real *size, void *user_data) *size = result; PyGILState_Release(gstate); } - else if (( f2attVec = FaceIndex2ClassAttractor.find(face_id)) != FaceIndex2ClassAttractor.end() && !f2attVec->second.empty()){ -// MESSAGE("attractor used on face :"<Empty()) + else if (( f2attVec = FaceIndex2ClassAttractor.find(face_id)) != FaceIndex2ClassAttractor.end() && !f2attVec->second.empty()) + { real result = 0; result = 1e100; std::vector< BLSURFPlugin_Attractor* > & attVec = f2attVec->second; @@ -3061,10 +3019,9 @@ status_t size_on_surface(integer face_id, real *uv, real *size, void *user_data) *size = result; } else { - // MESSAGE("List of attractor is empty !!!") *size = *((real*)user_data); } -// std::cout << "Size_on_surface sur la face " << face_id << " donne une size de: " << *size << std::endl; + // std::cout << "Size_on_surface sur la face " << face_id << " donne une size de: " << *size << std::endl; return STATUS_OK; } @@ -3222,7 +3179,6 @@ bool BLSURFPlugin_BLSURF::Evaluate(SMESH_Mesh& aMesh, //0020968: EDF1545 SMESH: Problem in the creation of a mesh group on geometry // GetDefaultPhySize() sometimes leads to computation failure _phySize = aMesh.GetShapeDiagonalSize() / _gen->GetBoundaryBoxSegmentation(); - MESSAGE("BLSURFPlugin_BLSURF::SetParameters using defaults"); } bool IsQuadratic = _quadraticMesh; diff --git a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx index 1a98332..5f162cf 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_BLSURF.hxx @@ -148,6 +148,7 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo { TopoDS_Shape entryToShape(std::string entry); void addCoordsFromVertices(const std::vector &theVerticesEntries, std::vector &theVerticesCoords); void addCoordsFromVertex(BLSURFPlugin_Hypothesis::TEntry theVertexEntry, std::vector &theVerticesCoords); + TopoDS_Shape findFaces( const BLSURFPlugin_Hypothesis::TEnfVertexList& enfVertexList ); void createEnforcedVertexOnFace(TopoDS_Shape FaceShape, BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList); void createPreCadFacesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity); void createPreCadEdgesPeriodicity(TopoDS_Shape theGeomShape, const BLSURFPlugin_Hypothesis::TPreCadPeriodicity &preCadPeriodicity); @@ -157,7 +158,7 @@ class BLSURFPlugin_BLSURF: public SMESH_2D_Algo { private: PyObject * main_mod; PyObject * main_dict; - SMESH_Mesh* myMesh; + SMESH_MesherHelper* myHelper; SALOMEDS::Study_var myStudy; SMESH_Gen_i* smeshGen_i; diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx index 5e8c8cd..7d2be5b 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis.cxx @@ -244,7 +244,6 @@ BLSURFPlugin_Hypothesis::BLSURFPlugin_Hypothesis(int hypId, int studyId, SMESH_G TopoDS_Shape BLSURFPlugin_Hypothesis::entryToShape(std::string entry) { - MESSAGE("BLSURFPlugin_Hypothesis::entryToShape "<GetCurrentStudy(); @@ -290,7 +289,6 @@ void BLSURFPlugin_Hypothesis::SetPhySize(double theVal, bool isRelative) { _phySizeRel = isRelative; if (theVal == 0) { _phySize = GetMaxSize(); - MESSAGE("Warning: nul physical size is not allowed"); } else _phySize = theVal; @@ -1228,7 +1226,6 @@ void BLSURFPlugin_Hypothesis::ClearEntry(const std::string& entry, ++it_clAt; } while ( it_clAt != _classAttractors.end() ); - MESSAGE("_classAttractors.size() = "<<_classAttractors.size()) NotifySubMeshesHypothesisModification(); } else @@ -1255,7 +1252,6 @@ void BLSURFPlugin_Hypothesis::ClearSizeMaps() { // bool toEnforceInternalVertices, // TEnfGroupName theGroupName) { -// MESSAGE("BLSURFPlugin_Hypothesis::SetInternalEnforcedVertex("<< theFaceEntry << ", " // << toEnforceInternalVertices << ", " << theGroupName << ")"); // TFaceEntryInternalVerticesList::iterator it = _faceEntryInternalVerticesList.find(theFaceEntry); @@ -1278,15 +1274,14 @@ void BLSURFPlugin_Hypothesis::ClearSizeMaps() { //======================================================================= //function : SetEnforcedVertex //======================================================================= -bool BLSURFPlugin_Hypothesis::SetEnforcedVertex(TEntry theFaceEntry, TEnfName theVertexName, TEntry theVertexEntry, - TEnfGroupName theGroupName, double x, double y, double z) { - - MESSAGE("BLSURFPlugin_Hypothesis::SetEnforcedVertex("<< theFaceEntry << ", " - << x << ", " << y << ", " << z << ", " << theVertexName << ", " << theVertexEntry << ", " << theGroupName << ")"); - +bool BLSURFPlugin_Hypothesis::SetEnforcedVertex(TEntry theFaceEntry, + TEnfName theVertexName, + TEntry theVertexEntry, + TEnfGroupName theGroupName, + double x, double y, double z) +{ SetPhysicalMesh(PhysicalLocalSize); - // TEnfVertexList::iterator it; bool toNotify = false; bool toCreate = true; @@ -1303,27 +1298,23 @@ bool BLSURFPlugin_Hypothesis::SetEnforcedVertex(TEntry theFaceEntry, TEnfName th newEnfVertex->grpName = theGroupName; newEnfVertex->faceEntries.clear(); newEnfVertex->faceEntries.insert(theFaceEntry); - - + + // update _enfVertexList TEnfVertexList::iterator it = _enfVertexList.find(newEnfVertex); if (it != _enfVertexList.end()) { toCreate = false; oldEnVertex = (*it); - MESSAGE("Enforced Vertex was found => Update"); if (oldEnVertex->name != theVertexName) { - MESSAGE("Update name from \"" << oldEnVertex->name << "\" to \"" << theVertexName << "\""); oldEnVertex->name = theVertexName; toNotify = true; } if (oldEnVertex->grpName != theGroupName) { - MESSAGE("Update group name from \"" << oldEnVertex->grpName << "\" to \"" << theGroupName << "\""); oldEnVertex->grpName = theGroupName; toNotify = true; } TEntryList::iterator it_faceEntries = oldEnVertex->faceEntries.find(theFaceEntry); if (it_faceEntries == oldEnVertex->faceEntries.end()) { - MESSAGE("Update face list by adding \"" << theFaceEntry << "\""); oldEnVertex->faceEntries.insert(theFaceEntry); _faceEntryEnfVertexListMap[theFaceEntry].insert(oldEnVertex); toNotify = true; @@ -1346,7 +1337,6 @@ bool BLSURFPlugin_Hypothesis::SetEnforcedVertex(TEntry theFaceEntry, TEnfName th // //////// CREATE //////////// if (toCreate) { toNotify = true; - MESSAGE("Creating new enforced vertex"); _faceEntryEnfVertexListMap[theFaceEntry].insert(newEnfVertex); _enfVertexList.insert(newEnfVertex); if (theVertexEntry == "") { @@ -1362,7 +1352,6 @@ bool BLSURFPlugin_Hypothesis::SetEnforcedVertex(TEntry theFaceEntry, TEnfName th if (toNotify) NotifySubMeshesHypothesisModification(); - MESSAGE("BLSURFPlugin_Hypothesis::SetEnforcedVertex END"); return toNotify; } @@ -1476,7 +1465,6 @@ bool BLSURFPlugin_Hypothesis::ClearEnforcedVertex(const TEntry& theFaceEntry, do TEnfVertexEntryEnfVertexMap::iterator it_enfVertexEntry = _enfVertexEntryEnfVertexMap.find(theVertexEntry); if (it_enfVertexEntry != _enfVertexEntryEnfVertexMap.end()) { // Success - MESSAGE("Found enforced vertex with geom entry " << theVertexEntry); oldEnfVertex = it_enfVertexEntry->second; _enfVertexEntryEnfVertexMap.erase(it_enfVertexEntry); @@ -1498,7 +1486,6 @@ bool BLSURFPlugin_Hypothesis::ClearEnforcedVertex(const TEntry& theFaceEntry, do TCoordsEnfVertexMap::iterator it_coords_enf = _coordsEnfVertexMap.find(coords); if (it_coords_enf != _coordsEnfVertexMap.end()) { // Success - MESSAGE("Found enforced vertex with coords " << x << ", " << y << ", " << z); oldEnfVertex = it_coords_enf->second; _coordsEnfVertexMap.erase(it_coords_enf); @@ -1521,8 +1508,6 @@ bool BLSURFPlugin_Hypothesis::ClearEnforcedVertex(const TEntry& theFaceEntry, do } } - MESSAGE("Remove enf vertex from _enfVertexList"); - // update _enfVertexList TEnfVertexList::iterator it = _enfVertexList.find(oldEnfVertex); if (it != _enfVertexList.end()) { @@ -1531,7 +1516,6 @@ bool BLSURFPlugin_Hypothesis::ClearEnforcedVertex(const TEntry& theFaceEntry, do _enfVertexList.erase(it); toNotify = true; } - MESSAGE("Done"); } // update _faceEntryEnfVertexListMap @@ -1539,9 +1523,7 @@ bool BLSURFPlugin_Hypothesis::ClearEnforcedVertex(const TEntry& theFaceEntry, do currentEnfVertexList.erase(oldEnfVertex); if (currentEnfVertexList.size() == 0) { - MESSAGE("Remove _faceEntryEnfVertexListMap[" << theFaceEntry <<"]"); _faceEntryEnfVertexListMap.erase(theFaceEntry); - MESSAGE("Done"); } if (toNotify) @@ -1576,7 +1558,6 @@ bool BLSURFPlugin_Hypothesis::ClearEnforcedVertices(const TEntry& theFaceEntry) _enfVertexList.erase(it); toNotify = true; } - MESSAGE("Done"); } } _faceEntryCoordsListMap.erase(it_entry_coords); @@ -1600,7 +1581,6 @@ bool BLSURFPlugin_Hypothesis::ClearEnforcedVertices(const TEntry& theFaceEntry) _enfVertexList.erase(it); toNotify = true; } - MESSAGE("Done"); } } _faceEntryEnfVertexEntryListMap.erase(it_entry_entry); @@ -1920,7 +1900,6 @@ std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) { } save << " " << "__NEW_ATTRACTORS_END__"; test << " " << "__NEW_ATTRACTORS_END__"; - MESSAGE(" Attractor hypothesis saved as "<faceEntries.end(); ++faceEntriesIt) - save << " " << (*faceEntriesIt); + if ( faceEntriesIt->empty() ) + save << " _no_face_"; + else + save << " " << (*faceEntriesIt); if (hasFaces) save << " " << "__END_FACELIST__"; save << " " << "__END_VERTEX__"; @@ -1981,7 +1963,6 @@ void BLSURFPlugin_Hypothesis::SaveFacesPeriodicity(std::ostream & save){ TFacesPeriodicityVector::const_iterator it_faces_periodicity = _facesPeriodicityVector.begin(); if (it_faces_periodicity != _facesPeriodicityVector.end()) { - MESSAGE("__FACES_PERIODICITY_BEGIN__"); save << " " << "__FACES_PERIODICITY_BEGIN__"; for (; it_faces_periodicity != _facesPeriodicityVector.end(); ++it_faces_periodicity) { TFacesPeriodicity periodicity_i = (*it_faces_periodicity); @@ -1995,7 +1976,6 @@ void BLSURFPlugin_Hypothesis::SaveFacesPeriodicity(std::ostream & save){ save << " " << "__END_PERIODICITY_DESCRIPTION__"; } save << " " << "__FACES_PERIODICITY_END__"; - MESSAGE("__FACES_PERIODICITY_END__"); } } @@ -2004,7 +1984,6 @@ void BLSURFPlugin_Hypothesis::SaveEdgesPeriodicity(std::ostream & save){ TEdgesPeriodicityVector::const_iterator it_edges_periodicity = _edgesPeriodicityVector.begin(); if (it_edges_periodicity != _edgesPeriodicityVector.end()) { save << " " << "__EDGES_PERIODICITY_BEGIN__"; - MESSAGE("__EDGES_PERIODICITY_BEGIN__"); for (; it_edges_periodicity != _edgesPeriodicityVector.end(); ++it_edges_periodicity) { TEdgePeriodicity periodicity_i = (*it_edges_periodicity); save << " " << "__BEGIN_PERIODICITY_DESCRIPTION__"; @@ -2030,7 +2009,6 @@ void BLSURFPlugin_Hypothesis::SaveEdgesPeriodicity(std::ostream & save){ save << " " << "__END_PERIODICITY_DESCRIPTION__"; } save << " " << "__EDGES_PERIODICITY_END__"; - MESSAGE("__EDGES_PERIODICITY_END__"); } } @@ -2038,7 +2016,6 @@ void BLSURFPlugin_Hypothesis::SaveVerticesPeriodicity(std::ostream & save){ TVerticesPeriodicityVector::const_iterator it_vertices_periodicity = _verticesPeriodicityVector.begin(); if (it_vertices_periodicity != _verticesPeriodicityVector.end()) { - MESSAGE("__VERTICES_PERIODICITY_BEGIN__"); save << " " << "__VERTICES_PERIODICITY_BEGIN__"; for (; it_vertices_periodicity != _verticesPeriodicityVector.end(); ++it_vertices_periodicity) { TVertexPeriodicity periodicity_i = (*it_vertices_periodicity); @@ -2058,7 +2035,6 @@ void BLSURFPlugin_Hypothesis::SaveVerticesPeriodicity(std::ostream & save){ save << " " << "__END_PERIODICITY_DESCRIPTION__"; } save << " " << "__VERTICES_PERIODICITY_END__"; - MESSAGE("__VERTICES_PERIODICITY_END__"); } } @@ -2735,7 +2711,6 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { isOK = static_cast(load >> attParams[0]>>attParams[1]>>attParams[2]>>attParams[3]); //>>step); } if (isOK) { - MESSAGE(" LOADING ATTRACTOR HYPOTHESIS ") const TopoDS_Shape attractorShape = BLSURFPlugin_Hypothesis::entryToShape(newAtShapeEntry); const TopoDS_Face faceShape = TopoDS::Face(BLSURFPlugin_Hypothesis::entryToShape(newAtFaceEntry)); BLSURFPlugin_Attractor* attractor = new BLSURFPlugin_Attractor(faceShape, attractorShape, newAtShapeEntry);//, step); @@ -2801,7 +2776,6 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { while (isOK && hasEnforcedVertex) { isOK = static_cast(load >> enfSeparator); // __BEGIN_VERTEX__ TEnfVertex *enfVertex = new TEnfVertex(); -// MESSAGE("enfSeparator: " <(load >> enfSeparator); - MESSAGE("enfSeparator: " <name = enfName; @@ -2854,7 +2827,6 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { enfName += enfSeparator; } } - MESSAGE("enfName: " <(load >> enfSeparator); // __END_ENTRY__ if (enfSeparator != "__END_ENTRY__") throw std::exception(); - MESSAGE("enfGeomEntry: " <(load >> enfSeparator); // __END_COORDS__ if (enfSeparator != "__END_COORDS__") throw std::exception(); - MESSAGE("enfCoords: " << enfCoords[0] <<","<< enfCoords[1] <<","<< enfCoords[2]); } if (enfSeparator == "__BEGIN_FACELIST__") { // __BEGIN_FACELIST__ @@ -2891,7 +2860,6 @@ std::istream & BLSURFPlugin_Hypothesis::LoadFrom(std::istream & load) { isOK = static_cast(load >> enfSeparator); if (enfSeparator != "__END_FACELIST__") { enfFaceEntryList.insert(enfSeparator); - MESSAGE(enfSeparator << " was inserted into enfFaceEntryList"); } } } @@ -2969,18 +2937,15 @@ void BLSURFPlugin_Hypothesis::LoadFacesPeriodicity(std::istream & load){ while (isOK) { isOK = static_cast(load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__ - MESSAGE("periodicitySeparator 1: " <(load >> periodicitySeparator); - MESSAGE("periodicitySeparator 2: " <first = shape1Entry; @@ -2996,7 +2961,6 @@ void BLSURFPlugin_Hypothesis::LoadFacesPeriodicity(std::istream & load){ isOK = static_cast(load >> periodicitySeparator); // __END_ENTRY1__ if (periodicitySeparator != "__END_ENTRY1__") throw std::exception(); - MESSAGE("shape1Entry: " <(load >> periodicitySeparator); // __END_ENTRY2__ if (periodicitySeparator != "__END_ENTRY2__") throw std::exception(); - MESSAGE("shape2Entry: " <(load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__ - MESSAGE("periodicitySeparator 1: " <(load >> periodicitySeparator); - MESSAGE("periodicitySeparator 2: " <theFace1Entry = theFace1Entry; @@ -3053,13 +3013,10 @@ void BLSURFPlugin_Hypothesis::LoadEdgesPeriodicity(std::istream & load){ if (periodicitySeparator == "__BEGIN_FACE1__") { // __BEGIN_FACE1__ isOK = static_cast(load >> theFace1Entry); - MESSAGE("//" << theFace1Entry << "//"); isOK = static_cast(load >> periodicitySeparator); // __END_FACE1__ if (periodicitySeparator != "__END_FACE1__"){ - MESSAGE("//" << periodicitySeparator << "//"); throw std::exception(); } - MESSAGE("theFace1Entry: " <(load >> periodicitySeparator); // __END_EDGE1__ if (periodicitySeparator != "__END_EDGE1__") throw std::exception(); - MESSAGE("theEdge1Entry: " <(load >> periodicitySeparator); // __END_FACE2__ if (periodicitySeparator != "__END_FACE2__") throw std::exception(); - MESSAGE("theFace2Entry: " <(load >> periodicitySeparator); // __END_EDGE2__ if (periodicitySeparator != "__END_EDGE2__") throw std::exception(); - MESSAGE("theEdge2Entry: " <(load >> periodicitySeparator); // __END_EDGE_ORIENTATION__ if (periodicitySeparator != "__END_EDGE_ORIENTATION__") throw std::exception(); - MESSAGE("edge_orientation: " <(load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__ - MESSAGE("periodicitySeparator 1: " <(load >> periodicitySeparator); - MESSAGE("periodicitySeparator 2: " <theEdge1Entry = theEdge1Entry; @@ -3140,7 +3090,6 @@ void BLSURFPlugin_Hypothesis::LoadVerticesPeriodicity(std::istream & load){ isOK = static_cast(load >> periodicitySeparator); // __END_EDGE1__ if (periodicitySeparator != "__END_EDGE1__") throw std::exception(); - MESSAGE("theEdge1Entry: " <(load >> periodicitySeparator); // __END_VERTEX1__ if (periodicitySeparator != "__END_VERTEX1__") throw std::exception(); - MESSAGE("theVertex1Entry: " <(load >> periodicitySeparator); // __END_EDGE2__ if (periodicitySeparator != "__END_EDGE2__") throw std::exception(); - MESSAGE("theEdge2Entry: " <(load >> periodicitySeparator); // __END_VERTEX2__ if (periodicitySeparator != "__END_VERTEX2__") throw std::exception(); - MESSAGE("theVertex2Entry: " <(load >> periodicitySeparator); // __BEGIN_PERIODICITY_DESCRIPTION__ - MESSAGE("periodicitySeparator 1: " <(load >> periodicitySeparator); - MESSAGE("periodicitySeparator 2: " <shape1Entry = shape1Entry; periodicity_i->shape2Entry = shape2Entry; - MESSAGE("theSourceVerticesEntries.size(): " << theSourceVerticesEntries.size()); - MESSAGE("theTargetVerticesEntries.size(): " << theTargetVerticesEntries.size()); - if (hasSourceVertices) periodicity_i->theSourceVerticesEntries = theSourceVerticesEntries; if (hasTargetVertices) @@ -3236,7 +3174,6 @@ void BLSURFPlugin_Hypothesis::LoadPreCADPeriodicity(std::istream & load, const c isOK = static_cast(load >> periodicitySeparator); // __END_ENTRY1__ if (periodicitySeparator != "__END_ENTRY1__") throw std::exception(); - MESSAGE("shape1Entry: " <(load >> periodicitySeparator); // __END_ENTRY2__ if (periodicitySeparator != "__END_ENTRY2__") throw std::exception(); - MESSAGE("shape2Entry: " <(load >> periodicitySeparator); if (periodicitySeparator != "__END_SOURCE_VERTICES_LIST__") { theSourceVerticesEntries.push_back(periodicitySeparator); - MESSAGE("theSourceVerticesEntries: " <(load >> periodicitySeparator); if (periodicitySeparator != "__END_TARGET_VERTICES_LIST__") { theTargetVerticesEntries.push_back(periodicitySeparator); - MESSAGE("theTargetVerticesEntries: " <GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) { + MESSAGE("theVertex shape type is not VERTEX or COMPOUND"); + THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM); + } + string theVertexEntry = theVertex->GetStudyEntry(); + + GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); + SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); + string aName; + + if (theVertexEntry.empty()) { + if (theVertex->GetShapeType() == GEOM::VERTEX) + aName = "Vertex_"; + if (theVertex->GetShapeType() == GEOM::COMPOUND) + aName = "Compound_"; + aName += theVertex->GetEntry(); + SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + if (!theSVertex->_is_nil()) + theVertexEntry = theSVertex->GetID(); + } + if (theVertexEntry.empty()) + THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM ); + + string theVertexName = theVertex->GetName(); + try { + return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str()); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } +} + +/*! + * Set an enforced vertex with group name on face + */ +bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName) + throw (SALOME::SALOME_Exception) +{ + ASSERT(myBaseImpl); + + try { + return SetEnforcedVertexEntry("", x, y, z, "", "", theGroupName); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } +} + +/*! + * Set an enforced vertex with name and group name on face + */ +bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, + const char* theVertexName, const char* theGroupName) + throw (SALOME::SALOME_Exception) +{ ASSERT(myBaseImpl); - MESSAGE("IDL : SetEnforcedVertexEntry(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theVertexEntry << "\", \"" << theGroupName << "\")"); + + try { + return SetEnforcedVertexEntry("", x, y, z, theVertexName, "", theGroupName); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } +} + +/*! + * Set an enforced vertex with geom entry and group name on face + */ +bool BLSURFPlugin_Hypothesis_i::AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName) + throw (SALOME::SALOME_Exception) +{ + if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) { + MESSAGE("theVertex shape type is not VERTEX or COMPOUND"); + THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM); + } + + string theVertexEntry = theVertex->GetStudyEntry(); + + GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); + SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); + string aName; + + if (theVertexEntry.empty()) { + if (theVertex->GetShapeType() == GEOM::VERTEX) + aName = "Vertex_"; + if (theVertex->GetShapeType() == GEOM::COMPOUND) + aName = "Compound_"; + aName += theVertex->GetEntry(); + SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + if (!theSVertex->_is_nil()) + theVertexEntry = theSVertex->GetID(); + } + if (theVertexEntry.empty()) + THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM ); + + string theVertexName = theVertex->GetName(); + try { + return SetEnforcedVertexEntry("", 0, 0, 0, theVertexName.c_str(), theVertexEntry.c_str(), theGroupName); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } +} + +bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) +{ + try { + return UnsetEnforcedVertexEntry("", x, y, z); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } +} + +bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex) + throw (SALOME::SALOME_Exception) +{ + if ((theVertex->GetShapeType() != GEOM::VERTEX) && (theVertex->GetShapeType() != GEOM::COMPOUND)) { + MESSAGE("theVertex shape type is not VERTEX or COMPOUND"); + THROW_SALOME_CORBA_EXCEPTION("theVertex shape type is not VERTEX or COMPOUND", SALOME::BAD_PARAM); + } + std::string theVertexEntry = theVertex->GetStudyEntry(); + + GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine(); + SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen(); + string aName; + + if (theVertexEntry.empty()) { + if (theVertex->GetShapeType() == GEOM::VERTEX) + aName = "Vertex_"; + if (theVertex->GetShapeType() == GEOM::COMPOUND) + aName = "Compound_"; + aName += theVertex->GetEntry(); + SALOMEDS::SObject_wrap theSVertex = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theVertex, aName.c_str()); + if (!theSVertex->_is_nil()) + theVertexEntry = theSVertex->GetID(); + } + if (theVertexEntry.empty()) + THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM ); + + try { + return UnsetEnforcedVertexEntry("", 0, 0, 0, theVertexEntry.c_str()); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } +} + +bool BLSURFPlugin_Hypothesis_i::RemoveEnforcedVertices() throw (SALOME::SALOME_Exception) +{ + try { + return UnsetEnforcedVerticesEntry(""); + } catch (SALOME_Exception& ex) { + THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); + } +} + +/*! + * Set/get/unset an enforced vertex on geom object given by entry + */ +bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, + CORBA::Double x, + CORBA::Double y, + CORBA::Double z, + const char* theVertexName, + const char* theVertexEntry, + const char* theGroupName) + throw (SALOME::SALOME_Exception) +{ bool newValue = false; if (string(theVertexEntry).empty()) { try { @@ -2999,37 +3186,29 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, coords.push_back(y); coords.push_back(z); if (coordsList.find(coords) == coordsList.end()) { - MESSAGE("Coords not found: add it in coordsList"); newValue = true; } else { - MESSAGE("Coords already found, compare names"); ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex(coords); if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) { - MESSAGE("The names are different: update"); - // this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z); newValue = true; } - else { - MESSAGE("The names are identical"); - } } } catch (const std::invalid_argument& ex) { // no enforced vertex for entry - MESSAGE("Face entry not found : add it to the list"); newValue = true; } if (newValue) { if (string(theVertexName).empty()) { if (string(theGroupName).empty()) - SMESH::TPythonDump() << _this() << ".SetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ")"; + SMESH::TPythonDump() << _this() << ".AddEnforcedVertex(" << x << ", " << y << ", " << z << ")"; else - SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")"; + SMESH::TPythonDump() << _this() << ".AddEnforcedVertexWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theGroupName << "\")"; } else { if (string(theGroupName).empty()) - SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamed(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")"; + SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamed(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\")"; else - SMESH::TPythonDump() << _this() << ".SetEnforcedVertexNamedWithGroup(" << theFaceEntry << ", " << x << ", " << y << ", " << z << ", \"" + SMESH::TPythonDump() << _this() << ".AddEnforcedVertexNamedWithGroup(" << x << ", " << y << ", " << z << ", \"" << theVertexName << "\", \"" << theGroupName << "\")"; } } @@ -3038,58 +3217,35 @@ bool BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntry(const char* theFaceEntry, ::BLSURFPlugin_Hypothesis::TEntryList enfVertexEntryList = this->GetImpl()->GetEnfVertexEntryList(theFaceEntry); ::BLSURFPlugin_Hypothesis::TEntryList::const_iterator it = enfVertexEntryList.find(theVertexEntry); if ( it == enfVertexEntryList.end()) { - MESSAGE("Geom entry not found: add it in enfVertexEntryList"); newValue = true; } else { - MESSAGE("Geom entry already found, compare names"); ::BLSURFPlugin_Hypothesis::TEnfVertex *enfVertex = this->GetImpl()->GetEnfVertex((*it)); if ((enfVertex->name != theVertexName) || (enfVertex->grpName != theGroupName)) { - MESSAGE("The names are different: update"); -// this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z); newValue = true; } - else { - MESSAGE("The names are identical"); - } } } catch (const std::invalid_argument& ex) { // no enforced vertex for entry - MESSAGE("Face entry not found : add it to the list"); newValue = true; } if (newValue) { if (string(theGroupName).empty()) - SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")"; + SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeom(" << theVertexEntry << ")"; else - SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGeomWithGroup(" << theFaceEntry << ", " << theVertexEntry << ", \"" << theGroupName << "\")"; + SMESH::TPythonDump() << _this() << ".AddEnforcedVertexGeomWithGroup(" << theVertexEntry << ", \"" << theGroupName << "\")"; } } if (newValue) this->GetImpl()->SetEnforcedVertex(theFaceEntry, theVertexName, theVertexEntry, theGroupName, x, y, z); - MESSAGE("IDL : SetEnforcedVertexEntry END"); return newValue; } -//Enable internal enforced vertices on specific face if requested by user -//CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexEntry(const char* theFaceEntry) -// throw (SALOME::SALOME_Exception) { -// ASSERT(myBaseImpl); -// try { -// return this->GetImpl()->GetInternalEnforcedVertex(theFaceEntry); -// } catch (const std::exception& ex) { -// std::cout << "Exception: " << ex.what() << std::endl; -// THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); -// } -//} - BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry) - throw (SALOME::SALOME_Exception) { - ASSERT(myBaseImpl); - MESSAGE("ENGINE : GetEnforcedVerticesEntry START ENTRY : " << entry); - + throw (SALOME::SALOME_Exception) +{ try { BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList(); ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnfVertexList(entry); @@ -3138,20 +3294,19 @@ BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntr } } -bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, - CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) { +bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntry, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexEntry) throw (SALOME::SALOME_Exception) +{ ASSERT(myBaseImpl); - MESSAGE("IDL : UnsetEnforcedVertexEntry(" << theFaceEntry << "," << x << "," << y << "," << z << ", " << theVertexEntry << ")"); bool res = false; try { res = this->GetImpl()->ClearEnforcedVertex(theFaceEntry, x, y, z, theVertexEntry); if (string(theVertexEntry).empty()) - SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertex(" << theFaceEntry << ", " << x << ", " << y << ", " << z + SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertex(" << x << ", " << y << ", " << z << ")"; else - SMESH::TPythonDump() << "isDone = " << _this() << ".UnsetEnforcedVertexGeom(" << theFaceEntry << ", " << theVertexEntry << ")"; + SMESH::TPythonDump() << "isDone = " << _this() << ".RemoveEnforcedVertexGeom(" << theVertexEntry << ")"; } catch (const std::invalid_argument& ex) { return false; @@ -3163,41 +3318,19 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(const char* theFaceEntr MESSAGE("ENGINE : UnsetEnforcedVertexEntry END ENTRY : " << theFaceEntry); return res; } - -//bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntryWithPoint(const char* theFaceEntry, const char* theVertexEntry, -// CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception) { -// MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint START theFaceEntry=" << theFaceEntry << ", theVertexEntry=" << theVertexEntry); -// -// bool ret = false; -// -// try { -// ret = _unsetEnfVertex(theFaceEntry, x, y, z); -// } catch (SALOME_Exception& ex) { -// THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); -// } -// -// if (ret) -// SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertexWithPoint(" << theFaceEntry << ", " << theVertexEntry -// << ")"; -// -// MESSAGE("IDL : UnsetEnforcedVertexEntryWithPoint END ENTRY : " << theFaceEntry); -// return ret; -//} - -bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) { +bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception) +{ ASSERT(myBaseImpl); - MESSAGE("IDL : UnsetEnforcedVerticesEntry(" << theFaceEntry << ")"); try { this->GetImpl()->ClearEnforcedVertices(theFaceEntry); - SMESH::TPythonDump() << _this() << ".UnsetEnforcedVertices(" << theFaceEntry << ")"; + SMESH::TPythonDump() << _this() << ".RemoveEnforcedVertices()"; } catch (const std::invalid_argument& ex) { return false; } catch (const std::exception& ex) { THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM ); } - MESSAGE("IDL : UnsetEnforcedVerticesEntry END ENTRY : " << theFaceEntry); return true; } @@ -3208,8 +3341,8 @@ bool BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(const char* theFaceEn * Set true or false */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) { - MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces"); +void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) +{ ASSERT(myBaseImpl); this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue); std::string theValueStr = theValue ? "True" : "False"; @@ -3223,8 +3356,8 @@ void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean * Get true or false */ //============================================================================= -CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() { - MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces"); +CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() +{ ASSERT(myBaseImpl); return this->GetImpl()->_GetInternalEnforcedVertexAllFaces(); } @@ -3236,8 +3369,8 @@ CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() { * Set group name */ //============================================================================= -void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) { - MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup"); +void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) +{ ASSERT(myBaseImpl); this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName); SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )"; @@ -3250,8 +3383,8 @@ void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const cha * Get group name */ //============================================================================= -char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() { - MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup"); +char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() +{ ASSERT(myBaseImpl); return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str()); } diff --git a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx index eeb20c3..5cfc3d9 100644 --- a/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx +++ b/src/BLSURFPlugin/BLSURFPlugin_Hypothesis_i.hxx @@ -276,6 +276,7 @@ public: /*! * Set/get/unset an enforced vertex on geom object */ + // OBSOLETE bool SetEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception); bool SetEnforcedVertexNamed(GEOM::GEOM_Object_ptr theFace, CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) @@ -297,6 +298,26 @@ public: throw (SALOME::SALOME_Exception); bool UnsetEnforcedVertices(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception); + // NEW - no face + bool AddEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) + throw (SALOME::SALOME_Exception); + bool AddEnforcedVertexNamed(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName) + throw (SALOME::SALOME_Exception); + bool AddEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex) + throw (SALOME::SALOME_Exception); + bool AddEnforcedVertexWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theGroupName) + throw (SALOME::SALOME_Exception); + bool AddEnforcedVertexNamedWithGroup(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* theVertexName, const char* theGroupName) + throw (SALOME::SALOME_Exception); + bool AddEnforcedVertexGeomWithGroup(GEOM::GEOM_Object_ptr theVertex, const char* theGroupName) + throw (SALOME::SALOME_Exception); + + bool RemoveEnforcedVertex(CORBA::Double x, CORBA::Double y, CORBA::Double z) + throw (SALOME::SALOME_Exception); + bool RemoveEnforcedVertexGeom(GEOM::GEOM_Object_ptr theVertex) + throw (SALOME::SALOME_Exception); + bool RemoveEnforcedVertices() throw (SALOME::SALOME_Exception); + /*! * Set/get/unset an enforced vertex on geom object given by entry */ diff --git a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx index e8c27d1..d4075da 100644 --- a/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx +++ b/src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx @@ -163,7 +163,7 @@ enum { // Enforced vertices inputs enum { ENF_VER_FACE = 0, - ENF_VER_VERTEX, + ENF_VER_VERTEX = 0, ENF_VER_X_COORD, ENF_VER_Y_COORD, ENF_VER_Z_COORD, @@ -443,7 +443,6 @@ bool EnforcedTreeWidgetDelegate::vertexExists(QAbstractItemModel *model, BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator( const QString& theHypType ) : SMESHGUI_GenericHypothesisCreator( theHypType ) { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::BLSURFPluginGUI_HypothesisCreator"); this->mySMPMap.clear(); GeomToolSelected = NULL; @@ -518,7 +517,6 @@ void BLSURFPluginGUI_HypothesisCreator::avoidSimultaneousSelection(ListOfWidgets bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::checkParams"); bool ok = true; BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = @@ -590,19 +588,12 @@ bool BLSURFPluginGUI_HypothesisCreator::checkParams(QString& msg) const { QString entry = mySizeMapTable->topLevelItem( row )->data(SMP_ENTRY_COLUMN, Qt::EditRole).toString(); QString sizeMap = mySizeMapTable->topLevelItem( row )->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString(); - MESSAGE("entry ="<sizeMapValidationFromRow(row)) { try { - MESSAGE("entry ="< setMinimumSize(600,400); QVBoxLayout* lay = new QVBoxLayout( fr ); @@ -851,7 +840,6 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() // // myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced(myEnfGroup); // anEnfLayout->addWidget(myEnforcedVertexWidget); -// MESSAGE("Creating DlgBlSurfHyp_Enforced widget instance"); // myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced(); myEnforcedTreeWidget = new QTreeWidget(myEnfGroup); @@ -888,15 +876,15 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() shapeTypes2.Add( TopAbs_VERTEX ); shapeTypes2.Add( TopAbs_COMPOUND ); - SMESH_NumberFilter* faceFilter = new SMESH_NumberFilter("GEOM", TopAbs_FACE, 0, shapeTypes1); - myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true); - myEnfFaceWdg->SetDefaultText(tr("BLS_SEL_FACES"), "QLineEdit { color: grey }"); + // SMESH_NumberFilter* faceFilter = new SMESH_NumberFilter("GEOM", TopAbs_FACE, 0, shapeTypes1); + // myEnfFaceWdg = new StdMeshersGUI_ObjectReferenceParamWdg( faceFilter, 0, /*multiSel=*/true); + // myEnfFaceWdg->SetDefaultText(tr("BLS_SEL_FACES"), "QLineEdit { color: grey }"); SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes2); myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true); myEnfVertexWdg->SetDefaultText(tr("BLS_SEL_VERTICES"), "QLineEdit { color: grey }"); - myEnfVertexWdg->AvoidSimultaneousSelection(myEnfFaceWdg); + //myEnfVertexWdg->AvoidSimultaneousSelection(myEnfFaceWdg); QLabel* myXCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_X_LABEL" ), myEnfGroup ); myXCoord = new SMESHGUI_SpinBox(myEnfGroup); @@ -927,7 +915,7 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame() anEnfLayout->addWidget(myEnforcedTreeWidget, 0, 0, ENF_VER_NB_LINES, 1); QGridLayout* anEnfLayout2 = new QGridLayout(myEnfGroup); // FACE AND VERTEX SELECTION - anEnfLayout2->addWidget(myEnfFaceWdg, ENF_VER_FACE, 0, 1, 2); + //anEnfLayout2->addWidget(myEnfFaceWdg, ENF_VER_FACE, 0, 1, 2); anEnfLayout2->addWidget(myEnfVertexWdg, ENF_VER_VERTEX, 0, 1, 2); anEnfLayout2->addWidget(myXCoordLabel, ENF_VER_X_COORD, 0, 1, 1); anEnfLayout2->addWidget(myXCoord, ENF_VER_X_COORD, 1, 1, 1); @@ -1235,7 +1223,6 @@ This method updates the tooltip of a modified item. The QLineEdit widgets conten is synchronized with the coordinates of the enforced vertex clicked in the tree widget. */ void BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues(QTreeWidgetItem* item, int column) { -// MESSAGE("BLSURFPluginGUI_HypothesisCreator::updateEnforcedVertexValues"); QVariant vertexName = item->data(ENF_VER_NAME_COLUMN, Qt::EditRole); QVariant x = item->data(ENF_VER_X_COLUMN, Qt::EditRole); QVariant y = item->data(ENF_VER_Y_COLUMN, Qt::EditRole); @@ -1348,62 +1335,45 @@ QTreeWidgetItem* BLSURFPluginGUI_HypothesisCreator::addEnforcedFace(std::string } /** BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(entry, shapeName, x, y, z) -This method adds an enforced vertex (x,y,z) to shapeName in the tree widget. + This method adds an enforced vertex (x,y,z) to shapeName in the tree widget. */ -void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(QTreeWidgetItem* theItem, double x, double y, double z, - std::string vertexName, std::string geomEntry, std::string groupName) { - - std::string theFaceName = theItem->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString(); -// MESSAGE("theItemName is " << theItem->text(ENF_VER_NAME_COLUMN).toStdString()); +void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, double z, + std::string vertexName, + std::string geomEntry, + std::string groupName) +{ bool okToCreate = true; - const int nbVert = theItem->childCount(); -// MESSAGE("Number of child rows: " << nbVert); - if (nbVert >0) { - double childValueX,childValueY,childValueZ; - QString childEntry, childGroupName; - QTreeWidgetItem* child; - for (int row = 0;rowchild(row); - childGroupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString(); - childEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString(); - childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble(); - childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble(); - childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble(); - if (((childValueX == x) && (childValueY == y) && (childValueZ == z)) || ( (childEntry.toStdString() != "") && (childEntry.toStdString() == geomEntry))) { - // update group name - if (childGroupName.toStdString() != groupName) { - MESSAGE("Group is updated from \"" << childGroupName.toStdString() << "\" to \"" << groupName << "\""); - child->setData(ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str())); - } - okToCreate = false; - break; - } // if - } // for - } // if + const int nbVert = myEnforcedTreeWidget->topLevelItemCount(); + for (int row = 0; row < nbVert; row++ ) + { + QTreeWidgetItem* child = myEnforcedTreeWidget->topLevelItem( row ); + QString childGroupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString(); + QString childEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString(); + double childX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble(); + double childY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble(); + double childZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble(); + if (((childEntry.isEmpty()) && (childX == x) && (childY == y) && (childZ == z)) || + ( !childEntry.isEmpty() && childEntry == geomEntry.c_str() )) + { + // update group name + if ( childGroupName != groupName.c_str() ) { + child->setData(ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str())); + } + okToCreate = false; + break; + } // if + } // for if (!okToCreate) { - if (geomEntry.empty()) { - MESSAGE("In " << theFaceName << " vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again"); - } - else { - MESSAGE("In " << theFaceName << " vertex with entry " << geomEntry << " already exist: dont create again"); - } return; } - - if (geomEntry.empty()) { - MESSAGE("In " << theFaceName << " vertex with coords " << x << ", " << y << ", " << z<< " is created"); - } - else { - MESSAGE("In " << theFaceName << " vertex with geom entry " << geomEntry << " is created"); - } - QTreeWidgetItem *vertexItem = new QTreeWidgetItem( theItem); + QTreeWidgetItem *vertexItem = new QTreeWidgetItem( myEnforcedTreeWidget ); vertexItem->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsEnabled); QPixmap iconSelect (SUIT_Session::session()->resourceMgr()->loadPixmap("SMESH", tr("ICON_SELECT"))); QSize iconSize = iconSelect.size()*0.7; - - int vertexIndex=myEnforcedTreeWidget->indexOfTopLevelItem(theItem); + + int vertexIndex=nbVert; QString myVertexName; int indexRef = -1; while(indexRef != vertexIndex) { @@ -1414,7 +1384,7 @@ void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(QTreeWidgetItem* theIt myVertexName = QString(vertexName.c_str()); for (int row = 0;rowchild(row)->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString(); + QString name = myEnforcedTreeWidget->topLevelItem(row)->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString(); if (myVertexName == name) { vertexIndex++; break; @@ -1434,17 +1404,14 @@ void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(QTreeWidgetItem* theIt if (groupName != "") vertexItem->setData( ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str())); - QString toolTip = QString(theFaceName.c_str())+QString(": ")+myVertexName; + QString toolTip = myVertexName; if (geomEntry.empty()) { - toolTip += QString(" (%1, ").arg(x); - toolTip += QString("%1, ").arg(y); - toolTip += QString("%1)").arg(z); + toolTip += QString(" (%1, %2, %3").arg(x).arg(y).arg(z); } if (groupName != "") toolTip += QString(" [%1]").arg(groupName.c_str()); vertexItem->setToolTip(ENF_VER_NAME_COLUMN,toolTip); - theItem->setExpanded(true); myEnforcedTreeWidget->setCurrentItem(vertexItem,ENF_VER_NAME_COLUMN); } @@ -1452,36 +1419,36 @@ void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(QTreeWidgetItem* theIt This method is called when a item is added into the enforced vertices tree widget */ void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices() { -// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices"); BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; getGeomSelectionTool()->selectionMgr()->clearFilters(); - myEnfFaceWdg->deactivateSelection(); + //myEnfFaceWdg->deactivateSelection(); myEnfVertexWdg->deactivateSelection(); for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column) myEnforcedTreeWidget->resizeColumnToContents(column); // Vertex selection - int selEnfFace = myEnfFaceWdg->NbObjects(); + //int selEnfFace = myEnfFaceWdg->NbObjects(); int selEnfVertex = myEnfVertexWdg->NbObjects(); bool coordsEmpty = (myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty()); - if (selEnfFace == 0) - return; + // if (selEnfFace == 0) + // return; if ((selEnfVertex == 0) && coordsEmpty) return; string entry, shapeName; - for (int i = 0 ; i < selEnfFace ; i++) { - myEnfFace = myEnfFaceWdg->GetObject< GEOM::GEOM_Object >(i); - entry = myEnfFace->GetStudyEntry(); - shapeName = myEnfFace->GetName(); + //for (int i = 0 ; i < selEnfVertex + !coordsEmpty; i++) + { + //myEnfFace = myEnfFaceWdg->GetObject< GEOM::GEOM_Object >(i); + //entry = myEnfFace->GetStudyEntry(); + //shapeName = myEnfFace->GetName(); - QTreeWidgetItem * faceItem = addEnforcedFace(entry, shapeName); + //QTreeWidgetItem * faceItem = addEnforcedFace(entry, shapeName); std::string groupName = myGroupName->text().toStdString(); @@ -1496,10 +1463,10 @@ void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices() { z = myZCoord->GetValue(); if (selEnfVertex == 1) { myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >(); - addEnforcedVertex(faceItem, x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName); + addEnforcedVertex(x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName); } else - addEnforcedVertex(faceItem, x, y, z, "", "", groupName); + addEnforcedVertex(x, y, z, "", "", groupName); } else { @@ -1518,15 +1485,15 @@ void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices() { if (myEnfVertex->GetShapeType() == GEOM::VERTEX) { measureOp->PointCoordinates (myEnfVertex, x, y, z); if ( measureOp->IsDone() ) - addEnforcedVertex(faceItem, x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName); + addEnforcedVertex(x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName); } else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) { - addEnforcedVertex(faceItem, 0, 0, 0, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName); + addEnforcedVertex(0, 0, 0, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName); } } } } - myEnfFaceWdg->SetObject(GEOM::GEOM_Object::_nil()); + //myEnfFaceWdg->SetObject(GEOM::GEOM_Object::_nil()); myEnfVertexWdg->SetObject(GEOM::GEOM_Object::_nil()); for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column) @@ -1542,7 +1509,6 @@ void BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices() { This method is called when a item is removed from the enforced vertices tree widget */ void BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex() { -// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex"); QList selectedItems = myEnforcedTreeWidget->selectedItems(); QList selectedVertices; QSet selectedEntries; @@ -1563,10 +1529,10 @@ void BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex() { foreach(item,selectedVertices) { QTreeWidgetItem* parent = item->parent(); -// MESSAGE("From geometry "<< parent->text(ENF_VER_NAME_COLUMN).toStdString()<<" remove " << item->text(ENF_VER_NAME_COLUMN).toStdString()); - parent->removeChild(item); + if ( parent ) + parent->removeChild(item); delete item; - if (parent->childCount() == 0) { + if ( parent && parent->childCount() == 0) { if (selectedEntries.contains(parent)) selectedEntries.remove(parent); delete parent; @@ -1574,7 +1540,6 @@ void BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex() { } foreach(item,selectedEntries) { -// MESSAGE("Remove " << item->text(ENF_VER_NAME_COLUMN).toStdString()); delete item; } @@ -1591,7 +1556,6 @@ void BLSURFPluginGUI_HypothesisCreator::onInternalVerticesClicked(int state) This method is called when a item is added into the periodicity table widget */ void BLSURFPluginGUI_HypothesisCreator::onAddPeriodicity() { -// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices"); BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; @@ -1673,12 +1637,10 @@ void BLSURFPluginGUI_HypothesisCreator::onAddPeriodicity() { This method is called when a item is removed from the periodicity tree widget */ void BLSURFPluginGUI_HypothesisCreator::onRemovePeriodicity() { -// MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveEnforcedVertex"); QList selectedItems = myPeriodicityTreeWidget->selectedItems(); QTreeWidgetItem* item; foreach(item,selectedItems) { - MESSAGE("Remove " << item->text(0).toStdString()); delete item; } @@ -1708,7 +1670,6 @@ This method enable the proper shape selection widget to Face or Edge shapes //{ // if (myPeriodicityOnFaceRadioButton->isChecked()) // { -// MESSAGE("Show Face"); // myPeriodicitySourceEdgeWdg->hide(); // myPeriodicityTargetEdgeWdg->hide(); // myPeriodicitySourceFaceWdg->show(); @@ -1716,7 +1677,6 @@ This method enable the proper shape selection widget to Face or Edge shapes // } // else // { -// MESSAGE("Show Edge"); // myPeriodicitySourceFaceWdg->hide(); // myPeriodicityTargetFaceWdg->hide(); // myPeriodicitySourceEdgeWdg->show(); @@ -1790,7 +1750,6 @@ This method updates the GUI widgets with the hypothesis data */ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::retrieveParams"); BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; BlsurfHypothesisData data; @@ -1887,7 +1846,6 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const // myGMFFileMode->setChecked(data.myGMFFileMode); // Sizemaps - MESSAGE("retrieveParams():that->mySMPMap.size() = " << that->mySMPMap.size()); QMapIterator i(that->mySMPMap); GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool(); while (i.hasNext()) { @@ -1931,16 +1889,13 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN); // Enforced vertices - MESSAGE("retrieveParams(): data.entryCoordsListMap.size() = " << data.faceEntryEnfVertexListMap.size()); TFaceEntryEnfVertexListMap::const_iterator evmIt = data.faceEntryEnfVertexListMap.begin(); for ( ; evmIt != data.faceEntryEnfVertexListMap.end() ; ++evmIt) { TEntry entry = (*evmIt).first; std::string shapeName = myGeomToolSelected->getNameFromEntry(entry); - MESSAGE("Face entry: " << entry); - MESSAGE("Face name: " << shapeName); - QTreeWidgetItem* faceItem = that->addEnforcedFace(entry, shapeName); + //QTreeWidgetItem* faceItem = that->addEnforcedFace(entry, shapeName); TEnfVertexList evs = (*evmIt).second; @@ -1948,14 +1903,13 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const TEnfVertex *enfVertex; for ( ; evsIt != evs.end() ; ++evsIt) { enfVertex = (*evsIt); - MESSAGE("Name: " << enfVertex->name); double x = 0, y = 0, z = 0; if (enfVertex->coords.size()) { x = enfVertex->coords[0]; y = enfVertex->coords[1]; z = enfVertex->coords[2]; } - that->addEnforcedVertex(faceItem, x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName); + that->addEnforcedVertex(x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName); } } @@ -1967,7 +1921,6 @@ void BLSURFPluginGUI_HypothesisCreator::retrieveParams() const myInternalEnforcedVerticesAllFacesGroup->setEnabled(data.myInternalEnforcedVerticesAllFaces); // Periodicity - MESSAGE("retrieveParams(): periodicity "); // Add an item in the tree widget for each association @@ -1997,7 +1950,6 @@ This method updates the hypothesis data with the GUI widgets content. */ QString BLSURFPluginGUI_HypothesisCreator::storeParams() const { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParams"); BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this; BlsurfHypothesisData data; @@ -2012,7 +1964,6 @@ Updates the hypothesis data from hypothesis values. */ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData& h_data ) const { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo"); BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis() ); @@ -2077,18 +2028,15 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData // classic size maps BLSURFPlugin::string_array_var mySizeMaps = h->GetSizeMapEntries(); -// MESSAGE("mySizeMaps->length() = " << mySizeMaps->length()); QString fullSizeMaps; QStringList fullSizeMapList; GeomSelectionTools* myGeomToolSelected = that->getGeomSelectionTool(); for ( CORBA::ULong i = 0;ilength(); ++i ) { fullSizeMaps = mySizeMaps[i].in(); -// MESSAGE("fullSizeMaps: " << fullSizeMaps.toStdString()); fullSizeMapList = fullSizeMaps.split( "|", QString::KeepEmptyParts ); if ( fullSizeMapList.count() > 1 ) { string fullSizeMap = fullSizeMapList[1].toStdString(); int pos = fullSizeMap.find("return")+7; -// MESSAGE("pos:" << pos); QString sizeMap; try { sizeMap = QString::fromStdString(fullSizeMap.substr(pos, fullSizeMap.size()-pos)); @@ -2097,16 +2045,13 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData continue; } that->mySMPMap[fullSizeMapList[0]] = sizeMap; -// MESSAGE("mySMPMap[" << fullSizeMapList[0].toStdString() << "] = " << sizeMap.toStdString()); that->mySMPShapeTypeMap[fullSizeMapList[0]] = myGeomToolSelected->entryToShapeType(fullSizeMapList[0].toStdString()); -// MESSAGE("mySMPShapeTypeMap[" << fullSizeMapList[0].toStdString() << "] = " << that->mySMPShapeTypeMap[fullSizeMapList[0]]); } } // custom size maps /* BLSURFPlugin::string_array_var myCustomSizeMaps = h->GetCustomSizeMapEntries(); - MESSAGE("myCustomSizeMaps->length() = " << myCustomSizeMaps->length()); for ( int i = 0;ilength(); ++i ) { QString fullCustomSizeMaps = myCustomSizeMaps[i].in(); @@ -2114,14 +2059,11 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData if ( fullCustomSizeMapList.count() > 1 ) { that->mySMPMap[fullCustomSizeMapList[0]] = fullCustomSizeMapList[1]; 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]]); } } */ // attractor BLSURFPlugin::string_array_var allMyAttractors = h->GetAttractorEntries(); -// MESSAGE("myAttractors->length() = " << allMyAttractors->length()); for ( CORBA::ULong i = 0;ilength(); ++i ) { QString myAttractors = allMyAttractors[i].in(); @@ -2129,19 +2071,15 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData if ( myAttractorList.count() > 1 ) { that->mySMPMap[myAttractorList[0]] = myAttractorList[1]; 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]]); } } // attractor new version - MESSAGE("readParamsFromHypo, Attractors") BLSURFPlugin::TAttParamsMap_var allMyAttractorParams = h->GetAttractorParams(); for ( CORBA::ULong i = 0;ilength(); ++i ) { BLSURFPlugin::TAttractorParams myAttractorParams = allMyAttractorParams[i]; QString faceEntry = myAttractorParams.faceEntry.in(); QString attEntry = myAttractorParams.attEntry.in(); - MESSAGE("attEntry = "<mySMPMap[faceEntry] = QString::number( myAttractorParams.startSize, 'g', 6 ); // TODO utiliser les préférences ici (cf. sketcher) that->mySMPShapeTypeMap[faceEntry] = myGeomToolSelected->entryToShapeType(faceEntry.toStdString()); that->myATTMap[faceEntry].push_back( TAttractor( myAttractorParams.attEntry.in(), @@ -2158,22 +2096,18 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData */ BLSURFPlugin::TFaceEntryEnfVertexListMap_var faceEntryEnfVertexListMap = h->GetAllEnforcedVerticesByFace(); - MESSAGE("faceEntryEnfVertexListMap->length() = " << faceEntryEnfVertexListMap->length()); - for ( CORBA::ULong i = 0;ilength(); ++i ) { - std::string entry = faceEntryEnfVertexListMap[i].faceEntry.in(); -// BLSURFPlugin::TEnfVertexList vertexList = faceEntryEnfVertexListMap[i].enfVertexList.in(); + for ( CORBA::ULong i = 0;ilength(); ++i ) + { + std::string entry = faceEntryEnfVertexListMap[i].faceEntry.in(); BLSURFPlugin::TEnfVertexList vertexList = faceEntryEnfVertexListMap[i].enfVertexList; -// BLSURFPlugin::TEnfVertexList_var vertexList = h->GetEnforcedVerticesEntry(entry.c_str()); - -// TEnfVertexList& enfVertexList = h_data.faceEntryEnfVertexListMap[entry]; - for (CORBA::ULong j=0 ; jname = CORBA::string_dup(vertexList[j].name.in()); - enfVertex->geomEntry = CORBA::string_dup(vertexList[j].geomEntry.in()); - enfVertex->grpName = CORBA::string_dup(vertexList[j].grpName.in()); + enfVertex->name = vertexList[j].name.in(); + enfVertex->geomEntry = vertexList[j].geomEntry.in(); + enfVertex->grpName = vertexList[j].grpName.in(); for (CORBA::ULong k=0 ; k< vertexList[j].coords.length();k++) enfVertex->coords.push_back(vertexList[j].coords[k]); @@ -2196,7 +2130,6 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData h_data.myInternalEnforcedVerticesAllFacesGroup = h->GetInternalEnforcedVertexAllFacesGroup(); // Periodicity - MESSAGE("readParamsFromHypo, Periodicity") h_data.preCadPeriodicityVector.clear(); @@ -2249,7 +2182,6 @@ Saves the hypothesis data to hypothesis values. */ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesisData& h_data ) const { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo"); BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( hypothesis() ); @@ -2364,15 +2296,12 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi const QString sizeMap = i.value(); if (sizeMap == "__TO_DELETE__") { - MESSAGE("Delete entry " << entry.toStdString() << " from engine"); h->UnsetEntry(entry.toLatin1().constData()); } else if (sizeMap.startsWith("ATTRACTOR")) { -// MESSAGE("SetAttractorEntry(" << entry.toStdString() << ")= " << sizeMap.toStdString()); h->SetAttractorEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData()); } else if (sizeMap.startsWith("def")) { -// MESSAGE("SetCustomSizeMapEntry(" << entry.toStdString() << ")= " << sizeMap.toStdString()); // h->SetCustomSizeMapEntry( entry.toLatin1().constData(), sizeMap.toLatin1().constData() ); } else { @@ -2401,7 +2330,6 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi fullSizeMap = QString("def f(t): return ") + sizeMap; else if (that->mySMPShapeTypeMap[entry] == TopAbs_VERTEX) fullSizeMap = QString("def f(): return ") + sizeMap; - MESSAGE("SetSizeMapEntry("<SetSizeMapEntry( entry.toLatin1().constData(), fullSizeMap.toLatin1().constData() ); } } @@ -2428,7 +2356,6 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi { faceEntry = evmIt->first; evs = evmIt->second; - MESSAGE("Number of enforced vertices for face entry " << faceEntry << ": " << evs.size()); evsIt = evs.begin(); for ( ; evsIt != evs.end() ; ++evsIt) { @@ -2452,7 +2379,6 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi if ( h->GetPreCadFacesPeriodicityVector()->length() > 0 || h->GetPreCadEdgesPeriodicityVector()->length() > 0 ) h->ClearPreCadPeriodicityVectors(); - MESSAGE("h_data.preCadPeriodicityVector.size(): " << h_data.preCadPeriodicityVector.size()); TPreCadPeriodicityVector::const_iterator pIt = h_data.preCadPeriodicityVector.begin(); for ( ; pIt != h_data.preCadPeriodicityVector.end() ; ++pIt) { @@ -2492,7 +2418,6 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi h->AddPreCadEdgesPeriodicityEntry(source.c_str(), target.c_str(), sourceVertices, targetVertices); } - MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo end periodicity"); } // try @@ -2506,7 +2431,6 @@ bool BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo( const BlsurfHypothesi // // SalomeApp_Tools::QtCatchCorbaException(ex); // // ok = false; // } - MESSAGE("BLSURFPluginGUI_HypothesisCreator::storeParamsToHypo end"); return ok; } @@ -2515,7 +2439,6 @@ Stores the widgets content to the hypothesis data. */ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothesisData& h_data ) const { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets"); h_data.myName = myName ? myName->text() : ""; h_data.myPhysicalMesh = myStdWidget->myPhysicalMesh->currentIndex(); h_data.myGeometricMesh = myStdWidget->myGeometricMesh->currentIndex(); @@ -2588,9 +2511,9 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes int row = 0, nbRows = mySizeMapTable->topLevelItemCount(); for ( ; row < nbRows; ++row ) { - QString entry = mySizeMapTable->topLevelItem(row)->data(SMP_ENTRY_COLUMN ,Qt::EditRole).toString(); - if ( that->mySMPMap.contains(entry) ) - guiHyp += "SetSizeMapEntry(" + entry + ", " + that->mySMPMap[entry] + "); "; + QString entry = mySizeMapTable->topLevelItem(row)->data(SMP_ENTRY_COLUMN ,Qt::EditRole).toString(); + if ( that->mySMPMap.contains(entry) ) + guiHyp += "SetSizeMapEntry(" + entry + ", " + that->mySMPMap[entry] + "); "; } // Enforced vertices @@ -2598,54 +2521,42 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes h_data.faceEntryEnfVertexListMap.clear(); int nbEnforcedShapes = myEnforcedTreeWidget->topLevelItemCount(); - int nbEnforcedVertices = 0; - std::string groupName = ""; -// MESSAGE("Nb of enforced shapes: " << nbEnforcedShapes); - for (int i=0 ; itopLevelItem(i); - if (shapeItem) { - std::string faceEntry = shapeItem->data(ENF_VER_FACE_ENTRY_COLUMN,Qt::EditRole).toString().toStdString(); - nbEnforcedVertices = shapeItem->childCount(); - if (nbEnforcedVertices >0) { - double childValueX,childValueY,childValueZ; - std::string childName, vertexEntry; - QTreeWidgetItem* child; - TEnfVertexList evs; - evs.clear(); - for (row = 0;rowchild(row); - childName = child->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString(); - childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble(); - childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble(); - childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble(); - vertexEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString().toStdString(); -// if (myGlobalGroupName->isChecked()) -// groupName = myGlobalGroupName->text().toStdString(); -// else - groupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString().toStdString(); - - TEnfVertex *enfVertex = new TEnfVertex(); - enfVertex->name = childName; - if (vertexEntry.empty()) { - enfVertex->coords.push_back(childValueX); - enfVertex->coords.push_back(childValueY); - enfVertex->coords.push_back(childValueZ); - } - else - enfVertex->geomEntry = vertexEntry; - enfVertex->grpName = groupName; -// TEnfVertexList::iterator it = h_data.enfVertexList.find(enfVertex); -// if (it == h_data.enfVertexList.end()) - h_data.enfVertexList.insert(enfVertex); - evs.insert(enfVertex); - /* TODO GROUPS - if (groupName != "") - h_data.groupNameEnfVertexListMap[groupName].insert(vertex); - */ - } - h_data.faceEntryEnfVertexListMap[faceEntry] = evs; - } + std::string groupName = "", faceEntry = ""; + for (int i=0 ; itopLevelItem(i); + childName = child->data(ENF_VER_NAME_COLUMN,Qt::EditRole).toString().toStdString(); + childValueX = child->data(ENF_VER_X_COLUMN,Qt::EditRole).toDouble(); + childValueY = child->data(ENF_VER_Y_COLUMN,Qt::EditRole).toDouble(); + childValueZ = child->data(ENF_VER_Z_COLUMN,Qt::EditRole).toDouble(); + vertexEntry = child->data(ENF_VER_ENTRY_COLUMN,Qt::EditRole).toString().toStdString(); + // if (myGlobalGroupName->isChecked()) + // groupName = myGlobalGroupName->text().toStdString(); + // else + groupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString().toStdString(); + + TEnfVertex *enfVertex = new TEnfVertex(); + enfVertex->name = childName; + if (vertexEntry.empty()) { + enfVertex->coords.push_back(childValueX); + enfVertex->coords.push_back(childValueY); + enfVertex->coords.push_back(childValueZ); } + else + enfVertex->geomEntry = vertexEntry; + enfVertex->grpName = groupName; + // TEnfVertexList::iterator it = h_data.enfVertexList.find(enfVertex); + // if (it == h_data.enfVertexList.end()) + h_data.enfVertexList.insert(enfVertex); + /* TODO GROUPS + if (groupName != "") + h_data.groupNameEnfVertexListMap[groupName].insert(vertex); + */ + h_data.faceEntryEnfVertexListMap[faceEntry].insert( enfVertex ); } h_data.myInternalEnforcedVerticesAllFaces = myInternalEnforcedVerticesAllFaces->isChecked(); @@ -2661,9 +2572,7 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes if (item) { for (int k=0; kcolumnCount(); ++k) { - MESSAGE(k); std::string entry = item->data(k, Qt::UserRole).toString().toStdString(); - MESSAGE(entry); periodicity_i.push_back(entry); } h_data.preCadPeriodicityVector.push_back(periodicity_i); @@ -2671,7 +2580,6 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes guiHyp += "PERIODICITY = yes; "; } - MESSAGE("guiHyp : " << guiHyp.toLatin1().data()); return guiHyp; } @@ -2726,7 +2634,6 @@ void BLSURFPluginGUI_HypothesisCreator::onMapGeomContentModified() void BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked(QTreeWidgetItem * item, int col) { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSmpItemClicked("<data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString(); @@ -2800,7 +2707,7 @@ void BLSURFPluginGUI_HypothesisCreator::onTabChanged(int tab) myGeomSelWdg1 ->deactivateSelection(); myGeomSelWdg2 ->deactivateSelection(); myAttSelWdg ->deactivateSelection(); - myEnfFaceWdg ->deactivateSelection(); + //myEnfFaceWdg ->deactivateSelection(); myEnfVertexWdg ->deactivateSelection(); myPeriodicitySourceFaceWdg->deactivateSelection(); myPeriodicityTargetFaceWdg->deactivateSelection(); @@ -2892,7 +2799,6 @@ void BLSURFPluginGUI_HypothesisCreator::onConstSizeClicked(int state) void BLSURFPluginGUI_HypothesisCreator::onRemoveMap() { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::onRemoveMap()"); QList selectedRows; QList selected = mySizeMapTable->selectedItems(); QTreeWidgetItem* item; @@ -2940,15 +2846,11 @@ void BLSURFPluginGUI_HypothesisCreator::onRemoveMap() void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(QTreeWidgetItem* item, int col) { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::onSetSizeMap("<< col << ")"); - MESSAGE("mySMPMap.size() = "<data(SMP_ENTRY_COLUMN, Qt::EditRole).toString(); QString sizeMap = item->data(SMP_SIZEMAP_COLUMN, Qt::EditRole).toString(); - MESSAGE("entry: " << entry.toStdString() << ", sizeMap: " << sizeMap.toStdString()); if (! that->mySMPShapeTypeMap.contains(entry)) - MESSAGE("no such entry in mySMPShapeTypeMap") return; if (that->mySMPMap.contains(entry)) if (that->mySMPMap[entry] == sizeMap @@ -2961,7 +2863,6 @@ void BLSURFPluginGUI_HypothesisCreator::onSetSizeMap(QTreeWidgetItem* item, int sizeMapValidationFromEntry(entry); } else { - MESSAGE("Size map empty: reverse to precedent value" ); item->setData(SMP_SIZEMAP_COLUMN, Qt::EditRole, QVariant(that->mySMPMap[entry]) ); } mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN); @@ -3007,7 +2908,6 @@ void BLSURFPluginGUI_HypothesisCreator::onAddMap() void BLSURFPluginGUI_HypothesisCreator::onModifyMap() { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::onModifyMap()"); bool res = false; if ( smpTab->currentIndex() == ATT_TAB ){ if ( myGeomSelWdg2->IsObjectSelected() && myAttSelWdg->IsObjectSelected() ){ @@ -3045,7 +2945,6 @@ void BLSURFPluginGUI_HypothesisCreator::onModifyMap() bool BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anObject, bool modify) { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertElement()"); // BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = // BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis()); @@ -3054,7 +2953,6 @@ bool BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anOb TopAbs_ShapeEnum shapeType; string entry, shapeName; entry = (string) anObject->GetStudyEntry(); - MESSAGE("entry = "<GetName(); shapeType = SMESH_Gen_i::GetSMESHGen()->GeomObjectToShape( anObject ).ShapeType(); // Group management : the type of entities in the group is stored in the SMPShapeTypeMap @@ -3092,7 +2990,6 @@ bool BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anOb else{ if (that->mySMPMap.contains(shapeEntry)) { if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") { - // MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")"); return false; } } @@ -3119,7 +3016,6 @@ bool BLSURFPluginGUI_HypothesisCreator::insertElement(GEOM::GEOM_Object_var anOb bool BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aFace, GEOM::GEOM_Object_var anAttractor, bool modify) { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::insertAttractor()"); BLSURFPlugin::BLSURFPlugin_Hypothesis_var h = BLSURFPlugin::BLSURFPlugin_Hypothesis::_narrow( initParamsHypothesis()); @@ -3180,7 +3076,6 @@ bool BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF else{ // if (that->mySMPMap.contains(shapeEntry)) { // if (that->mySMPMap[shapeEntry] != "__TO_DELETE__") { - // // MESSAGE("Size map for shape with name(entry): "<< shapeName << "(" << entry << ")"); // return false; // } // } @@ -3232,13 +3127,11 @@ bool BLSURFPluginGUI_HypothesisCreator::insertAttractor(GEOM::GEOM_Object_var aF myStdWidget->myPhysicalMesh->setCurrentIndex( PhysicalLocalSize ); myStdWidget->onPhysicalMeshChanged(); } - MESSAGE("mySMPMap.size() = "<topLevelItemCount(); for ( ; row < nbRows; ++row ) if (! sizeMapValidationFromRow(row)) @@ -3248,7 +3141,6 @@ bool BLSURFPluginGUI_HypothesisCreator::sizeMapsValidation() bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(int myRow, bool displayError) { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(), row = "<topLevelItem( myRow )->data( SMP_ENTRY_COLUMN, Qt::EditRole ).toString(); bool res = sizeMapValidationFromEntry(myEntry,displayError); mySizeMapTable->setFocus(); @@ -3257,28 +3149,22 @@ bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromRow(int myRow, bool bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEntry, bool displayError) { - MESSAGE("BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry()"); - MESSAGE("myEntry = "<mySMPMap.contains(myEntry)) { -// MESSAGE("Geometry with entry "<mySMPShapeTypeMap.contains(myEntry)) { -// MESSAGE("Shape type with entry "<mySMPMap[myEntry].startsWith("def")) { -// MESSAGE("custom function" ); expr = that->mySMPMap[myEntry].toStdString(); } else if (that->mySMPMap[myEntry].startsWith("ATTRACTOR")) { -// MESSAGE("Attractor" ); if ((that->mySMPMap[myEntry].count(QRegExp("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)(?:;(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+))?\\)$")) != 1)) { if (displayError) @@ -3347,7 +3233,6 @@ bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEnt PyGILState_Release(gstate); -// MESSAGE("SizeMap expression "<