};
typedef sequence<TEnfVertexEntryEnfVertexElement> TEnfVertexEntryEnfVertexMap;
+ // List of Face Entry with internal enforced vertices activated
+ typedef sequence<TEntry> TFaceEntryInternalVerticesList;
+
// Attractors
struct TAttractorParams {
string faceEntry;
void SetClassAttractorEntry(in string entry, in string att_entry, in double StartSize, in double EndSize, in double ActionRadius, in double ConstantRadius );
BLSURFPlugin::TAttParamsMap GetAttractorParams();
-
-
/*
void SetCustomSizeMapEntry(in string entry, in string sizeMap);
string GetCustomSizeMapEntry(in string entry);
* 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 string groupName) raises (SALOME::SALOME_Exception);
-// boolean SetEnforcedVertexEntryNamed(in TEntry theFaceEntry, in double x, in double y, in double z, in TEnfName theVertexName) raises (SALOME::SALOME_Exception);
-// boolean SetEnforcedVertexEntryGeom(in TEntry theFaceEntry, in TEntry theVertexEntry, in TEnfName theVertexName) raises (SALOME::SALOME_Exception);
- /* TODO GROUPS
- void SetEnforcedVertexEntryWithGroup(in string theFaceEntry, in double x, in double y, in double z, in TEnfGroupName groupName)
- raises (SALOME::SALOME_Exception);
- */
-//
+ in TEnfName theVertexName, in TEntry theVertexEntry, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
+
TEnfVertexList GetEnforcedVerticesEntry(in TEntry theFaceEntry) raises (SALOME::SALOME_Exception);
-//
boolean UnsetEnforcedVertexEntry(in TEntry theFaceEntry, in double x, in double y, in double z, in TEntry theVertexEntry) raises (SALOME::SALOME_Exception);
// boolean UnsetEnforcedVertexEntryGeom(in TEntry theFaceEntry, in TEntry theVertexEntry) raises (SALOME::SALOME_Exception);
boolean UnsetEnforcedVerticesEntry(in TEntry theFaceEntry) raises (SALOME::SALOME_Exception);
- /*!
- * Set/get an enforced vertex on geom object and add it to a group
- */
- /* TODO GROUPS
- void SetEnforcedVertexGroupName(in double x, in double y, in double z, in TEnfGroupName groupName)
- raises (SALOME::SALOME_Exception);
- string GetEnforcedVertexGroupName(in double x, in double y, in double z)
- raises (SALOME::SALOME_Exception);
- */
+ /*!
+ * To get/set internal vertices as enforced vertices
+ */
+ void SetInternalEnforcedVertexAllFaces(in boolean toEnforceInternalVertices);
+ boolean GetInternalEnforcedVertexAllFaces();
+ void SetInternalEnforcedVertexAllFacesGroup(in TEnfGroupName groupName);
+ TEnfGroupName GetInternalEnforcedVertexAllFacesGroup();
+
+// Enable internal enforced vertices on specific face if requested by user
+// void SetInternalEnforcedVertex(in GEOM::GEOM_Object theFace,in boolean toEnforceInternalVertices) raises (SALOME::SALOME_Exception);
+// void SetInternalEnforcedVertexWithGroup(in GEOM::GEOM_Object theFace, in boolean toEnforceInternalVertices, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
+// void SetInternalEnforcedVertexEntry(in TEntry theFaceEntry, in boolean toEnforceInternalVertices, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
+// boolean GetInternalEnforcedVertex(in GEOM::GEOM_Object theFace) raises (SALOME::SALOME_Exception);
+// boolean GetInternalEnforcedVertexEntry(in TEntry theFaceEntry) raises (SALOME::SALOME_Exception);
+// TFaceEntryInternalVerticesList GetAllInternalEnforcedVerticesFaces();
///////////////////////
/*!
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 << "\"");
- EnfVertexCoords2EnfVertexList[s_coords].insert(enfVertex);
+ pair<BLSURFPlugin_Hypothesis::TEnfVertexList::iterator,bool> ret;
+ BLSURFPlugin_Hypothesis::TEnfVertexList::iterator it;
+ ret = EnfVertexCoords2EnfVertexList[s_coords].insert(enfVertex);
+ if (ret.second == false) {
+ it = ret.first;
+ (*it)->grpName = enfVertex->grpName;
+ }
int key = 0;
if (! FacesWithEnforcedVertices.Contains(faceShape)) {
}
}
+ // Internal vertices
+ bool useInternalVertexAllFaces = BLSURFPlugin_Hypothesis::GetInternalEnforcedVertexAllFaces(hyp);
+ if (useInternalVertexAllFaces) {
+ std::string grpName = BLSURFPlugin_Hypothesis::GetInternalEnforcedVertexAllFacesGroup(hyp);
+ MESSAGE("Setting Internal Enforced Vertices");
+ GeomShape = mesh.GetShapeToMesh();
+ gp_Pnt aPnt;
+ TopExp_Explorer exp (GeomShape, TopAbs_FACE);
+ for (; exp.More(); exp.Next()){
+ MESSAGE("Iterating shapes. Shape type is " << exp.Current().ShapeType());
+ TopExp_Explorer exp_face (exp.Current(), TopAbs_VERTEX);
+ for (; exp_face.More(); exp_face.Next())
+ {
+ // Get coords of vertex
+ // 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() <<", "<<aPnt.Y()<<", "<<aPnt.Z());
+ BLSURFPlugin_Hypothesis::TEnfVertex* enfVertex = new BLSURFPlugin_Hypothesis::TEnfVertex();
+ enfVertex->coords.push_back(aPnt.X());
+ enfVertex->coords.push_back(aPnt.Y());
+ enfVertex->coords.push_back(aPnt.Z());
+ enfVertex->name = "";
+ enfVertex->faceEntries.clear();
+ enfVertex->geomEntry = "";
+ enfVertex->grpName = grpName;
+ _createEnforcedVertexOnFace( TopoDS::Face(exp.Current()), aPnt, enfVertex);
+ HasSizeMapOnFace = true;
+ }
+ }
+ }
+
MESSAGE("Setting Size Map on FACES ");
// #if BLSURF_VERSION_LONG < "3.1.1"
blsurf_data_set_sizemap_iso_cad_face(bls, size_on_surface, &_smp_phy_size);
groupDone = true;
}
if (!groupDone)
- throw SALOME_Exception(LOCALIZED("A enforced vertex node was not added to a group"));
+ throw SALOME_Exception(LOCALIZED("An enforced vertex node was not added to a group"));
}
else
MESSAGE("Group name is empty: '"<<currentEnfVertex->grpName<<"' => group is not created");
_faceEntryEnfVertexEntryListMap(GetDefaultFaceEntryEnfVertexEntryListMap()),
_enfVertexEntryEnfVertexMap(GetDefaultEnfVertexEntryEnfVertexMap()),
_groupNameNodeIDMap(GetDefaultGroupNameNodeIDMap()),
- _GMFFileName(GetDefaultGMFFile())
-/* TODO GROUPS
- _groupNameEnfVertexListMap(GetDefaultGroupNameEnfVertexListMap()),
- _enfVertexGroupNameMap(GetDefaultEnfVertexGroupNameMap())
- */
+ _GMFFileName(GetDefaultGMFFile()),
+ _enforcedInternalVerticesAllFaces(GetDefaultInternalEnforcedVertex())
{
_name = "BLSURF_Parameters";
_param_algo_dim = 2;
_classAttractors.clear();
}
+// Enable internal enforced vertices on specific face if requested by user
+
+////=======================================================================
+////function : SetInternalEnforcedVertex
+////=======================================================================
+//void BLSURFPlugin_Hypothesis::SetInternalEnforcedVertex(TEntry theFaceEntry,
+// bool toEnforceInternalVertices,
+// TEnfGroupName theGroupName) {
+
+// MESSAGE("BLSURFPlugin_Hypothesis::SetInternalEnforcedVertex("<< theFaceEntry << ", "
+// << toEnforceInternalVertices << ", " << theGroupName << ")");
+
+// TFaceEntryInternalVerticesList::iterator it = _faceEntryInternalVerticesList.find(theFaceEntry);
+// if (it != _faceEntryInternalVerticesList.end()) {
+// if (!toEnforceInternalVertices) {
+// _faceEntryInternalVerticesList.erase(it);
+// }
+// }
+// else {
+// if (toEnforceInternalVertices) {
+// _faceEntryInternalVerticesList.insert(theFaceEntry);
+// }
+// }
+
+// // TODO
+// // Take care of groups
+//}
+
+
//=======================================================================
//function : SetEnforcedVertex
//=======================================================================
throw std::invalid_argument(msg.str());
}
+//Enable internal enforced vertices on specific face if requested by user
+////=======================================================================
+////function : GetInternalEnforcedVertex
+////=======================================================================
+
+//bool BLSURFPlugin_Hypothesis::GetInternalEnforcedVertex(const TEntry& theFaceEntry)
+//{
+// if (_faceEntryInternalVerticesList.count(theFaceEntry) > 0)
+// return true;
+// return false;
+//}
+
//=======================================================================
//function : ClearEnforcedVertex
//=======================================================================
_coordsEnfVertexMap.clear();
_faceEntryEnfVertexEntryListMap.clear();
_enfVertexEntryEnfVertexMap.clear();
+// Enable internal enforced vertices on specific face if requested by user
+// _faceEntryInternalVerticesList.clear();
NotifySubMeshesHypothesisModification();
}
return hyp ? hyp->_GetAllEnforcedVerticesByFace() : GetDefaultFaceEntryEnfVertexListMap();
}
+//Enable internal enforced vertices on specific face if requested by user
+//BLSURFPlugin_Hypothesis::TFaceEntryInternalVerticesList BLSURFPlugin_Hypothesis::GetAllInternalEnforcedVerticesByFace(
+// const BLSURFPlugin_Hypothesis* hyp) {
+// return hyp ? hyp->_GetAllInternalEnforcedVerticesByFace() : GetDefaultFaceEntryInternalVerticesMap();
+//}
+
+bool BLSURFPlugin_Hypothesis::GetInternalEnforcedVertexAllFaces(const BLSURFPlugin_Hypothesis* hyp)
+{
+ return hyp ? hyp->_GetInternalEnforcedVertexAllFaces() : GetDefaultInternalEnforcedVertex();
+}
+
+BLSURFPlugin_Hypothesis::TEnfGroupName BLSURFPlugin_Hypothesis::GetInternalEnforcedVertexAllFacesGroup(const BLSURFPlugin_Hypothesis* hyp)
+{
+ return hyp ? hyp->_GetInternalEnforcedVertexAllFacesGroup() : BLSURFPlugin_Hypothesis::TEnfGroupName();
+}
+
BLSURFPlugin_Hypothesis::TEnfVertexList BLSURFPlugin_Hypothesis::GetAllEnforcedVertices(
const BLSURFPlugin_Hypothesis* hyp) {
return hyp ? hyp->_GetAllEnforcedVertices() : GetDefaultEnfVertexList();
throw std::invalid_argument(msg.str());
}
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices) {
+ if (toEnforceInternalVertices != _enforcedInternalVerticesAllFaces) {
+ _enforcedInternalVerticesAllFaces = toEnforceInternalVertices;
+ if (toEnforceInternalVertices)
+ SetPhysicalMesh(SizeMap);
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
+
+//=============================================================================
+void BLSURFPlugin_Hypothesis::SetInternalEnforcedVertexAllFacesGroup(BLSURFPlugin_Hypothesis::TEnfGroupName theGroupName) {
+ if (string(theGroupName) != string(_enforcedInternalVerticesAllFacesGroup)) {
+ _enforcedInternalVerticesAllFacesGroup = theGroupName;
+ NotifySubMeshesHypothesisModification();
+ }
+}
+
//=============================================================================
std::ostream & BLSURFPlugin_Hypothesis::SaveTo(std::ostream & save) {
save << " " << (int) _topology << " " << (int) _physicalMesh << " " << (int) _geometricMesh << " " << _phySize << " "
std::string BLSURFPlugin_Hypothesis::GetDefaultGMFFile() {
return "";
}
+
+//=============================================================================
+bool BLSURFPlugin_Hypothesis::GetDefaultInternalEnforcedVertex() {
+ return false;
+}
+
// Map Face Entry / List of enforced vertices
typedef std::map< TEntry, TEnfVertexList > TFaceEntryEnfVertexListMap;
+ // List of Face Entry with internal enforced vertices activated
+ typedef std::set< TEntry > TFaceEntryInternalVerticesList;
+
// Map Face Entry / List of coords
typedef std::map< TEntry, TEnfVertexCoordsList > TFaceEntryCoordsListMap;
static TFaceEntryEnfVertexEntryListMap GetAllEnfVertexEntriesByFace(const BLSURFPlugin_Hypothesis* hyp);
static TEnfVertexEntryEnfVertexMap GetAllEnforcedVerticesByEnfVertexEntry(const BLSURFPlugin_Hypothesis* hyp);
-
/*!
- * \brief Set/get node group to an enforced vertex
- */
- /* TODO GROUPS
- void SetEnforcedVertexGroupName(double x, double y, double z, const TEnfGroupName& groupName) throw (std::invalid_argument);
- TEnfGroupName GetEnforcedVertexGroupName(double x, double y, double z) throw (std::invalid_argument);
- TEnfVertexList GetEnforcedVertexByGroupName(TEnfGroupName& groupName) throw (std::invalid_argument);
- */
+ * \brief Internal enforced vertices
+ */
+ void SetInternalEnforcedVertexAllFaces(bool toEnforceInternalVertices);
+ const bool _GetInternalEnforcedVertexAllFaces() const { return _enforcedInternalVerticesAllFaces; }
+ static bool GetInternalEnforcedVertexAllFaces( const BLSURFPlugin_Hypothesis* hyp );
+ void SetInternalEnforcedVertexAllFacesGroup(TEnfGroupName theGroupName);
+ const TEnfGroupName _GetInternalEnforcedVertexAllFacesGroup() const { return _enforcedInternalVerticesAllFacesGroup; }
+ static TEnfGroupName GetInternalEnforcedVertexAllFacesGroup( const BLSURFPlugin_Hypothesis* hyp );
+
+// Enable internal enforced vertices on specific face if requested by user
+// static TFaceEntryInternalVerticesList GetDefaultFaceEntryInternalVerticesMap() { return TFaceEntryInternalVerticesList(); }
+// const TFaceEntryInternalVerticesList _GetAllInternalEnforcedVerticesByFace() const { return _faceEntryInternalVerticesList; }
+// static TFaceEntryInternalVerticesList GetAllInternalEnforcedVerticesByFace(const BLSURFPlugin_Hypothesis* hyp);
+// void SetInternalEnforcedVertex(TEntry theFaceEntry, bool toEnforceInternalVertices, TEnfGroupName theGroupName);
+// bool GetInternalEnforcedVertex(const TEntry& theFaceEntry);
static Topology GetDefaultTopology();
static PhysicalMesh GetDefaultPhysicalMesh();
static TEnfVertexEntryEnfVertexMap GetDefaultEnfVertexEntryEnfVertexMap() { return TEnfVertexEntryEnfVertexMap(); }
static TGroupNameNodeIDMap GetDefaultGroupNameNodeIDMap() { return TGroupNameNodeIDMap(); }
+ static bool GetDefaultInternalEnforcedVertex();
+
/* TODO GROUPS
static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
static TEnfVertexGroupNameMap GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
TEnfVertexEntryEnfVertexMap _enfVertexEntryEnfVertexMap;
TGroupNameNodeIDMap _groupNameNodeIDMap;
+// Enable internal enforced vertices on specific face if requested by user
+// TFaceEntryInternalVerticesList _faceEntryInternalVerticesList;
+ bool _enforcedInternalVerticesAllFaces;
+ TEnfGroupName _enforcedInternalVerticesAllFacesGroup;
+
std::string _GMFFileName;
// bool _GMFFileMode;
-
- /* TODO GROUPS
- TGroupNameEnfVertexListMap _groupNameEnfVertexListMap;
- */
+
// TSizeMap _customSizeMap;
};
// MESSAGE("BLSURFPlugin_Hypothesis_i::SetQuadAllowed");
ASSERT(myBaseImpl);
this->GetImpl()->SetQuadAllowed(theValue);
- SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValue << " )";
+ std::string theValueStr = theValue ? "True" : "False";
+ SMESH::TPythonDump() << _this() << ".SetQuadAllowed( " << theValueStr.c_str() << " )";
}
//=============================================================================
// MESSAGE("BLSURFPlugin_Hypothesis_i::SetDecimesh");
ASSERT(myBaseImpl);
this->GetImpl()->SetDecimesh(theValue);
- SMESH::TPythonDump() << _this() << ".SetDecimesh( " << theValue << " )";
+ std::string theValueStr = theValue ? "True" : "False";
+ SMESH::TPythonDump() << _this() << ".SetDecimesh( " << theValueStr.c_str() << " )";
}
//=============================================================================
// MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADMergeEdges");
ASSERT(myBaseImpl);
this->GetImpl()->SetPreCADMergeEdges(theValue);
- SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValue << " )";
+ std::string theValueStr = theValue ? "True" : "False";
+ SMESH::TPythonDump() << _this() << ".SetPreCADMergeEdges( " << theValueStr.c_str() << " )";
}
//=============================================================================
// MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADRemoveNanoEdges");
ASSERT(myBaseImpl);
this->GetImpl()->SetPreCADRemoveNanoEdges(theValue);
- SMESH::TPythonDump() << _this() << ".SetPreCADRemoveNanoEdges( " << theValue << " )";
+ std::string theValueStr = theValue ? "True" : "False";
+ SMESH::TPythonDump() << _this() << ".SetPreCADRemoveNanoEdges( " << theValueStr.c_str() << " )";
}
//=============================================================================
// MESSAGE("BLSURFPlugin_Hypothesis_i::SetPreCADDiscardInput");
ASSERT(myBaseImpl);
this->GetImpl()->SetPreCADDiscardInput(theValue);
- SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValue << " )";
+ std::string theValueStr = theValue ? "True" : "False";
+ SMESH::TPythonDump() << _this() << ".SetPreCADDiscardInput( " << theValueStr.c_str() << " )";
}
//=============================================================================
}
}
+//Enable internal enforced vertices on specific face if requested by user
+///*!
+// * Are internal enforced vertices used for a face ?
+// */
+//CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace)
+// throw (SALOME::SALOME_Exception) {
+// ASSERT(myBaseImpl);
+
+// if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
+// MESSAGE("theFace shape type is not FACE or COMPOUND");
+// THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
+// }
+
+// string theFaceEntry = theFace->GetStudyEntry();
+
+// if (theFaceEntry.empty()) {
+// GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+// SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+// string aName;
+// if (theFace->GetShapeType() == GEOM::FACE)
+// aName = "Face_";
+// if (theFace->GetShapeType() == GEOM::COMPOUND)
+// aName = "Compound_";
+// aName += theFace->GetEntry();
+// SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+// if (!theSFace->_is_nil())
+// theFaceEntry = theSFace->GetID();
+// }
+// if (theFaceEntry.empty())
+// THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+// MESSAGE("IDL : GetName : " << theFace->GetName());
+// MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
+// try {
+// return GetInternalEnforcedVertexEntry(theFaceEntry.c_str());
+// } catch (SALOME_Exception& ex) {
+// THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+// }
+//}
+
/*!
* Get the list of all enforced vertices
*/
THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
MESSAGE("IDL : GetName : " << theFace->GetName());
- MESSAGE("IDL : GetEnforcedVertexList ( "<< theFaceEntry << ")");
+ MESSAGE("IDL : GetEnforcedVerticesEntry ( "<< theFaceEntry << ")");
try {
return GetEnforcedVerticesEntry(theFaceEntry.c_str());
} catch (SALOME_Exception& ex) {
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);
return true;
}
+//=============================================================================
+/*!
+ * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces
+ *
+ * Set true or false
+ */
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces(CORBA::Boolean theValue) {
+ MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFaces");
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetInternalEnforcedVertexAllFaces(theValue);
+ std::string theValueStr = theValue ? "True" : "False";
+ SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFaces( " << theValueStr.c_str() << " )";
+}
+
+//=============================================================================
+/*!
+ * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces
+ *
+ * Get true or false
+ */
+//=============================================================================
+CORBA::Boolean BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces() {
+ MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFaces");
+ ASSERT(myBaseImpl);
+ return this->GetImpl()->_GetInternalEnforcedVertexAllFaces();
+}
+
+//=============================================================================
+/*!
+ * BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup
+ *
+ * Set group name
+ */
+//=============================================================================
+void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup(const char* groupName) {
+ MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexAllFacesGroup");
+ ASSERT(myBaseImpl);
+ this->GetImpl()->SetInternalEnforcedVertexAllFacesGroup(groupName);
+ SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexAllFacesGroup( \"" << groupName << "\" )";
+}
+
+//=============================================================================
+/*!
+ * BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup
+ *
+ * Get group name
+ */
+//=============================================================================
+char* BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup() {
+ MESSAGE("BLSURFPlugin_Hypothesis_i::GetInternalEnforcedVertexAllFacesGroup");
+ ASSERT(myBaseImpl);
+ return CORBA::string_dup(this->GetImpl()->_GetInternalEnforcedVertexAllFacesGroup().c_str());
+}
+
+/*
+ * Enable internal enforced vertices on specific face if requested by user
+ *
+void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices)
+ throw (SALOME::SALOME_Exception)
+{
+ MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFace");
+ try {
+ SetInternalEnforcedVertexWithGroup(theFace, toEnforceInternalVertices);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
+ MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceWithGroup");
+
+ if ((theFace->GetShapeType() != GEOM::FACE) && (theFace->GetShapeType() != GEOM::COMPOUND)) {
+ MESSAGE("theFace shape type is not FACE or COMPOUND");
+ THROW_SALOME_CORBA_EXCEPTION("theFace shape type is not FACE or COMPOUND", SALOME::BAD_PARAM);
+ }
+
+ string theFaceEntry = theFace->GetStudyEntry();
+
+ if (theFaceEntry.empty()) {
+ GEOM::GEOM_Gen_ptr geomGen = SMESH_Gen_i::GetGeomEngine();
+ SMESH_Gen_i *smeshGen = SMESH_Gen_i::GetSMESHGen();
+ string aName;
+ if (theFace->GetShapeType() == GEOM::FACE)
+ aName = "Face_";
+ if (theFace->GetShapeType() == GEOM::COMPOUND)
+ aName = "Compound_";
+ aName += theFace->GetEntry();
+ SALOMEDS::SObject_ptr theSFace = geomGen->PublishInStudy(smeshGen->GetCurrentStudy(), NULL, theFace, aName.c_str());
+ if (!theSFace->_is_nil())
+ theFaceEntry = theSFace->GetID();
+ }
+ if (theFaceEntry.empty())
+ THROW_SALOME_CORBA_EXCEPTION( "Geom object is not published in study" ,SALOME::BAD_PARAM );
+
+ MESSAGE("IDL : GetName : " << theFace->GetName());
+ MESSAGE("IDL : GetInternalEnforcedVertexEntry ( "<< theFaceEntry << ")");
+ try {
+ SetInternalEnforcedVertexEntry(theFaceEntry.c_str(), toEnforceInternalVertices, theGroupName);
+ } catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+void BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName)
+ throw (SALOME::SALOME_Exception)
+{
+ MESSAGE("BLSURFPlugin_Hypothesis_i::SetInternalEnforcedVertexForFaceEntry");
+ ASSERT(myBaseImpl);
+ try {
+ this->GetImpl()->SetInternalEnforcedVertex(theFaceEntry, toEnforceInternalVertices, theGroupName);
+ std::string theValueStr = toEnforceInternalVertices ? "True" : "False";
+ if (string(theGroupName).empty())
+ SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertex( " << theFaceEntry << ", " << theValueStr.c_str() << " )";
+ else
+ SMESH::TPythonDump() << _this() << ".SetInternalEnforcedVertexWithGroup( " << theFaceEntry << ", " << theValueStr.c_str() << ", \"" << theGroupName << "\" )";
+ } catch (const std::exception& ex) {
+ std::cout << "Exception: " << ex.what() << std::endl;
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+
+*/
+
/* TODO GROUPS
char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
throw (SALOME::SALOME_Exception)
bool UnsetEnforcedVerticesEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
/*!
- * Set/get node group to an enforced vertex
- */
- /* TODO GROUPS
- void SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName) throw (SALOME::SALOME_Exception);
- char* GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception);
+ * To add internal vertices as enforced vertices
*/
+ void SetInternalEnforcedVertexAllFaces(CORBA::Boolean toEnforceInternalVertices);
+ CORBA::Boolean GetInternalEnforcedVertexAllFaces();
+ void SetInternalEnforcedVertexAllFacesGroup(const char* groupName = "");
+ char* GetInternalEnforcedVertexAllFacesGroup();
+
+// Enable internal enforced vertices on specific face if requested by user
+// void SetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices) throw (SALOME::SALOME_Exception);
+// void SetInternalEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr theFace, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "") throw (SALOME::SALOME_Exception);
+// void SetInternalEnforcedVertexEntry(const char* theFaceEntry, CORBA::Boolean toEnforceInternalVertices, const char* theGroupName = "") throw (SALOME::SALOME_Exception);
+// CORBA::Boolean GetInternalEnforcedVertex(GEOM::GEOM_Object_ptr theFace) throw (SALOME::SALOME_Exception);
+// CORBA::Boolean GetInternalEnforcedVertexEntry(const char* theFaceEntry) throw (SALOME::SALOME_Exception);
+
///////////////////////
/*!
// ENF_VER_GROUP_CHECK,
// ENF_VER_SPACE,
ENF_VER_BTN,
+ ENF_VER_SEPARATOR,
+ ENF_VER_INTERNAL_ALL_FACES,
+ ENF_VER_INTERNAL_ALL_FACES_GROUP,
// ENF_VER_VERTEX_BTN,
// ENF_VER_REMOVE_BTN,
// ENF_VER_SEPARATOR,
addVertexButton = new QPushButton(tr("BLSURF_ENF_VER_VERTEX"),myEnfGroup);
removeVertexButton = new QPushButton(tr("BLSURF_ENF_VER_REMOVE"),myEnfGroup);
+ myInternalEnforcedVerticesAllFaces = new QCheckBox(tr("Use internal vertices of all faces"),myEnfGroup);
+
+ QLabel* myInternalEnforcedVerticesAllFacesGroupLabel = new QLabel( tr( "BLSURF_ENF_VER_GROUP_LABEL" ), myEnfGroup );
+ myInternalEnforcedVerticesAllFacesGroup = new QLineEdit(myEnfGroup);
+
// myGlobalGroupName = new QCheckBox(tr("BLSURF_ENF_VER_GROUPS"), myEnfGroup);
// myGlobalGroupName->setChecked(false);
// anEnfLayout2->setRowStretch( ENF_VER_SPACE, 1);
anEnfLayout2->addWidget(addVertexButton, ENF_VER_BTN, 0, 1, 1);
anEnfLayout2->addWidget(removeVertexButton, ENF_VER_BTN, 1, 1, 1);
+ anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFaces, ENF_VER_INTERNAL_ALL_FACES, 0, 1, 2);
+ anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFacesGroupLabel, ENF_VER_INTERNAL_ALL_FACES_GROUP, 0, 1, 1);
+ anEnfLayout2->addWidget(myInternalEnforcedVerticesAllFacesGroup, ENF_VER_INTERNAL_ALL_FACES_GROUP, 1, 1, 1);
anEnfLayout2->setRowStretch(ENF_VER_NB_LINES+1, 1);
// anEnfLayout2->addWidget(makeGroupsCheck, ENF_VER_GROUP_CHECK, 0, 1, 2);
anEnfLayout->addLayout(anEnfLayout2, 0,1,ENF_VER_NB_LINES+1,2);
connect( addVertexButton, SIGNAL( clicked()), this, SLOT( onAddEnforcedVertices() ) );
connect( removeVertexButton, SIGNAL( clicked()), this, SLOT( onRemoveEnforcedVertex() ) );
connect( myEnfVertexWdg, SIGNAL( contentModified()), this, SLOT( onSelectEnforcedVertex() ) );
+ connect( myInternalEnforcedVerticesAllFaces, SIGNAL( stateChanged ( int )), this, SLOT( onInternalVerticesClicked( int ) ) );
// connect( myEnfVertexWdg, SIGNAL( selectionActivated()), this, SLOT( onVertexSelectionActivated() ) );
// connect( myEnfFaceWdg, SIGNAL( selectionActivated()), this, SLOT( onFaceSelectionActivated() ) );
// }
/**
- * This method resets the content of the X, Y, Z and GroupName widgets;
+ * This method resets the content of the X, Y, Z widgets;
**/
void BLSURFPluginGUI_HypothesisCreator::clearEnforcedVertexWidgets()
{
}
}
-/** BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(entry, shapeName, x, y, z)
-This method adds an enforced vertex (x,y,z) to shapeName in the tree widget.
+/** BLSURFPluginGUI_HypothesisCreator::addEnforcedFace(entry, shapeName, useInternalVertices)
+This method adds a face containing enforced vertices in the tree widget.
*/
-void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(std::string theFaceEntry, std::string theFaceName,
- double x, double y, double z, std::string vertexName, std::string geomEntry, std::string groupName) {
+QTreeWidgetItem* BLSURFPluginGUI_HypothesisCreator::addEnforcedFace(std::string theFaceEntry, std::string theFaceName) {
// Find theFaceEntry item
QList<QTreeWidgetItem* > theItemList = myEnforcedTreeWidget->findItems(QString(theFaceEntry.c_str()),Qt::MatchExactly,ENF_VER_FACE_ENTRY_COLUMN);
QTreeWidgetItem* theItem;
else {
theItem = theItemList[0];
}
+ return theItem;
+}
+/** BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(entry, shapeName, x, y, z)
+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());
bool okToCreate = true;
myEnfFace = myEnfFaceWdg->GetObject< GEOM::GEOM_Object >(i);
entry = myEnfFace->GetStudyEntry();
shapeName = myEnfFace->GetName();
-
+
+ QTreeWidgetItem * faceItem = addEnforcedFace(entry, shapeName);
+
std::string groupName = myGroupName->text().toStdString();
-// if (myGlobalGroupName->isChecked())
-// groupName = myGlobalGroupName->text().toStdString();
if (boost::trim_copy(groupName).empty())
groupName = "";
- if (selEnfVertex <= 1)
+ if (selEnfVertex == 1)
{
double x,y,z;
x = myXCoord->GetValue();
z = myZCoord->GetValue();
if (selEnfVertex == 1) {
myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
- addEnforcedVertex(entry, shapeName, x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ addEnforcedVertex(faceItem, x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
}
else
- addEnforcedVertex(entry, shapeName, x, y, z, "", "", groupName);
+ addEnforcedVertex(faceItem, x, y, z, "", "", groupName);
}
else
{
if (myEnfVertex->GetShapeType() == GEOM::VERTEX) {
measureOp->PointCoordinates (myEnfVertex, x, y, z);
if ( measureOp->IsDone() )
- addEnforcedVertex(entry, shapeName, x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ addEnforcedVertex(faceItem, x, y, z, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
} else if (myEnfVertex->GetShapeType() == GEOM::COMPOUND) {
- addEnforcedVertex(entry, shapeName, 0, 0, 0, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
+ addEnforcedVertex(faceItem, 0, 0, 0, myEnfVertex->GetName(),myEnfVertex->GetStudyEntry(), groupName);
}
}
}
myEnforcedTreeWidget->selectionModel()->clearSelection();
}
+
+void BLSURFPluginGUI_HypothesisCreator::onInternalVerticesClicked(int state)
+{
+ if (state == Qt::Checked) {
+ myInternalEnforcedVerticesAllFacesGroup->setEnabled(true);
+ }
+ if (state == Qt::Unchecked) {
+ myInternalEnforcedVerticesAllFacesGroup->setEnabled(false);
+ }
+}
+
/** BLSURFPluginGUI_HypothesisCreator::retrieveParams()
This method updates the GUI widgets with the hypothesis data
*/
// 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);
TEnfVertexList evs = (*evmIt).second;
-// try {
-// evs = (*evmIt).second;
-// }
-// catch(...) {
-// MESSAGE("evs = (*evmIt).second: FAIL");
-// break;
-// }
TEnfVertexList::const_iterator evsIt = evs.begin();
TEnfVertex *enfVertex;
y = enfVertex->coords[1];
z = enfVertex->coords[2];
}
- that->addEnforcedVertex(entry, shapeName, x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName);
+ that->addEnforcedVertex(faceItem, x, y, z, enfVertex->name, enfVertex->geomEntry, enfVertex->grpName);
}
}
for (int column = 0; column < myEnforcedTreeWidget->columnCount(); ++column)
myEnforcedTreeWidget->resizeColumnToContents(column);
+ myInternalEnforcedVerticesAllFaces->setChecked(data.myInternalEnforcedVerticesAllFaces);
+ myInternalEnforcedVerticesAllFacesGroup->setText(QString(data.myInternalEnforcedVerticesAllFacesGroup.c_str()));
+ myInternalEnforcedVerticesAllFacesGroup->setEnabled(data.myInternalEnforcedVerticesAllFaces);
+
// update widgets
that->onPhysicalMeshChanged();
that->onGeometricMeshChanged();
h_data.faceEntryEnfVertexListMap.erase(entry);
}
}
+ h_data.myInternalEnforcedVerticesAllFaces = h->GetInternalEnforcedVertexAllFaces();
+ h_data.myInternalEnforcedVerticesAllFacesGroup = h->GetInternalEnforcedVertexAllFacesGroup();
return true;
}
ret = h->SetEnforcedVertexEntry( faceEntry.c_str(), x, y, z, (*evsIt)->name.c_str(), (*evsIt)->geomEntry.c_str(), (*evsIt)->grpName.c_str());
} // for
} // for
+
+ if ( h->GetInternalEnforcedVertexAllFaces() != h_data.myInternalEnforcedVerticesAllFaces )
+ h->SetInternalEnforcedVertexAllFaces( h_data.myInternalEnforcedVerticesAllFaces );
+ if ( h->GetInternalEnforcedVertexAllFacesGroup() != h_data.myInternalEnforcedVerticesAllFacesGroup )
+ h->SetInternalEnforcedVertexAllFacesGroup( h_data.myInternalEnforcedVerticesAllFacesGroup.c_str() );
+
} // try
catch(const std::exception& ex) {
std::cout << "Exception: " << ex.what() << std::endl;
}
}
+ h_data.myInternalEnforcedVerticesAllFaces = myInternalEnforcedVerticesAllFaces->isChecked();
+ h_data.myInternalEnforcedVerticesAllFacesGroup = myInternalEnforcedVerticesAllFacesGroup->text().toStdString();
+
MESSAGE("guiHyp : " << guiHyp.toLatin1().data());
return guiHyp;
}
// Map Face Entry / List of enforced vertices
typedef std::map< TEntry, TEnfVertexList > TFaceEntryEnfVertexListMap;
+// Map Face Entry / InternalEnforcedVertices
+typedef std::map< TEntry, bool > TFaceEntryInternalVerticesMap;
+
typedef struct
{
int myTopology, myVerbosity;
int myPhysicalMesh, myGeometricMesh;
double myAngleMeshS, myAngleMeshC, myGradation;
double myPhySize, myGeoMin, myGeoMax, myPhyMin,myPhyMax;
- bool myAllowQuadrangles, myDecimesh,mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex;
+ bool myAllowQuadrangles, myDecimesh,mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex,myInternalEnforcedVerticesAllFaces;
bool myPreCADMergeEdges, myPreCADRemoveNanoEdges, myPreCADDiscardInput;
double myPreCADEpsNano;
// bool myGMFFileMode;
- std::string myGMFFileName;
+ std::string myGMFFileName, myInternalEnforcedVerticesAllFacesGroup;
TEnfVertexList enfVertexList;
TFaceEntryEnfVertexListMap faceEntryEnfVertexListMap;
/* TODO GROUPS
void onModifyMap();
void onSetSizeMap(QTreeWidgetItem *, int);
- void addEnforcedVertex(std::string theFaceEntry, std::string theFaceName, double x=0, double y=0, double z=0,
+ QTreeWidgetItem* addEnforcedFace(std::string theFaceEntry, std::string theFaceName);
+
+ void addEnforcedVertex(QTreeWidgetItem * theFaceItem, double x=0, double y=0, double z=0,
std::string vertexName = "", std::string geomEntry = "", std::string groupName = "");
+
void onAddEnforcedVertices();
void onRemoveEnforcedVertex();
void synchronizeCoords();
void onSelectEnforcedVertex();
// void deactivateSelection(QWidget*, QWidget*);
void clearEnforcedVertexWidgets();
+ void onInternalVerticesClicked(int);
private:
bool readParamsFromHypo( BlsurfHypothesisData& ) const;
QPushButton* addVertexButton;
QPushButton* removeVertexButton;
+ QCheckBox *myInternalEnforcedVerticesAllFaces;
+ QLineEdit *myInternalEnforcedVerticesAllFacesGroup;
+
// map = entry , size map
QMap<QString, QString> mySMPMap; // Map <face entry, size>
QMap<QString, QString> myATTMap; // Map <face entry, att. entry>
<translation>Supprimer</translation>
</message>
<message>
- <source>BLSURF_ENF_VER_GROUPS</source>
- <translation>Groupe unique</translation>
+ <source>Use internal vertices</source>
+ <translation>Utiliser les points internes</translation>
+ </message>
+ <message>
+ <source>Use internal vertices of all faces</source>
+ <translation>Utiliser les points internes de toutes les faces</translation>
</message>
</context>
</TS>