module BLSURFPlugin
{
typedef sequence<string> string_array;
- typedef sequence<double,3> TEnforcedVertex;
- typedef sequence<TEnforcedVertex> TEnforcedVertexList;
- struct TEnforcedVertexMapElement {
- string entry;
- TEnforcedVertexList vertexList;
+
+ // Entry
+ typedef string TEnfEntry;
+ // Enforced vertex = 3 coordinates
+ typedef sequence<double,3> TEnfVertex;
+ // List of enforced vertices
+ typedef sequence<TEnfVertex> TEnfVertexList;
+ // Map Entry / List of enforced vertices
+ struct TEntryEnfVertexListMapElement {
+ TEnfEntry entry;
+ TEnfVertexList vertexList;
+ };
+ typedef sequence<TEntryEnfVertexListMapElement> TEntryEnfVertexListMap;
+ /* TODO GROUPS
+ // Group name
+ typedef string TEnfGroupName;
+ // Map Group Name / List of enforced vertices
+ struct TGroupNameEnfVertexListMapElement {
+ TEnfGroupName groupName;
+ TEnfVertexList vertexList;
};
- typedef sequence<TEnforcedVertexMapElement> TEnforcedVertexMap;
+ typedef sequence<TGroupNameEnfVertexListMapElement> TGroupNameEnfVertexListMap;
+ // Map Enforced vertex / Group Name
+ struct TEnfVertexGroupNameMapElement {
+ TEnfVertex vertex;
+ TEnfGroupName groupName;
+ };
+ typedef sequence<TEnfVertexGroupNameMapElement> TEnfVertexGroupNameMap;
+ */
+
/*!
* BLSURFPlugin_BLSURF: interface of BLSURF algorithm
// ENFORCED VERTEXES //
///////////////////////
- TEnforcedVertexMap GetAllEnforcedVertices();
- void ClearAllEnforcedVertices();
+ TEntryEnfVertexListMap GetAllEnforcedVertices();
+ void ClearAllEnforcedVertices();
- /*!
- * Set/get/unset an enforced vertex on geom object
- */
- void SetEnforcedVertex(in GEOM::GEOM_Object GeomObj, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
-// void SetEnforcedVertexList(in GEOM::GEOM_Object GeomObj, in TEnforcedVertexList vertexList) raises (SALOME::SALOME_Exception);
+ /*!
+ * Set/get/unset an enforced vertex on geom object
+ */
+ void SetEnforcedVertex(in GEOM::GEOM_Object GeomObj, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+ /* TODO GROUPS
+ void SetEnforcedVertexWithGroup(in GEOM::GEOM_Object GeomObj, in double x, in double y, in double z, in TEnfGroupName groupName) raises (SALOME::SALOME_Exception);
+ */
+// void SetEnforcedVertexList(in GEOM::GEOM_Object GeomObj, in TEnfVertexList vertexList) raises (SALOME::SALOME_Exception);
- TEnforcedVertexList GetEnforcedVertices(in GEOM::GEOM_Object GeomObj) raises (SALOME::SALOME_Exception);
+ TEnfVertexList GetEnforcedVertices(in GEOM::GEOM_Object GeomObj) raises (SALOME::SALOME_Exception);
- void UnsetEnforcedVertex(in GEOM::GEOM_Object GeomObj, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
-// void UnsetEnforcedVertexList(in GEOM::GEOM_Object GeomObj, in TEnforcedVertexList vertexList) raises (SALOME::SALOME_Exception);
- void UnsetEnforcedVertices(in GEOM::GEOM_Object GeomObj) raises (SALOME::SALOME_Exception);
+ void UnsetEnforcedVertex(in GEOM::GEOM_Object GeomObj, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+// void UnsetEnforcedVertexList(in GEOM::GEOM_Object GeomObj, in TEnfVertexList vertexList) raises (SALOME::SALOME_Exception);
+ void UnsetEnforcedVertices(in GEOM::GEOM_Object GeomObj) raises (SALOME::SALOME_Exception);
/*!
* Set/get/unset an enforced vertex on geom object given by entry
*/
- void SetEnforcedVertexEntry(in string entry, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
-// void SetEnforcedVertexListEntry(in string entry, in TEnforcedVertexList vertexList) raises (SALOME::SALOME_Exception);
+ void SetEnforcedVertexEntry(in TEnfEntry entry, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+ /* TODO GROUPS
+ void SetEnforcedVertexEntryWithGroup(in TEnfEntry entry, in double x, in double y, in double z, in TEnfGroupName groupName)
+ raises (SALOME::SALOME_Exception);
+ */
+// void SetEnforcedVertexListEntry(in TEnfEntry entry, in TEnfVertexList vertexList) raises (SALOME::SALOME_Exception);
//
- TEnforcedVertexList GetEnforcedVerticesEntry(in string entry) raises (SALOME::SALOME_Exception);
+ TEnfVertexList GetEnforcedVerticesEntry(in TEnfEntry entry) raises (SALOME::SALOME_Exception);
//
- void UnsetEnforcedVertexEntry(in string entry, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
-// void UnsetEnforcedVertexListEntry(in string entry, in TEnforcedVertexList vertexList) raises (SALOME::SALOME_Exception);
- void UnsetEnforcedVerticesEntry(in string entry) raises (SALOME::SALOME_Exception);
-
+ void UnsetEnforcedVertexEntry(in TEnfEntry entry, in double x, in double y, in double z) raises (SALOME::SALOME_Exception);
+// void UnsetEnforcedVertexListEntry(in TEnfEntry entry, in TEnfVertexList vertexList) raises (SALOME::SALOME_Exception);
+ void UnsetEnforcedVerticesEntry(in TEnfEntry entry) 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);
+ */
///////////////////////
};
if BLSURFPLUGIN_ENABLE_GUI
dist_salomeres_DATA += \
BLSURF.png \
+ mesh_select_BLSURF.png \
mesh_algo_BLSURF.png \
mesh_hypo_BLSURF.png \
mesh_tree_algo_BLSURF.png \
#include <SMESH_Gen.hxx>
#include <SMESH_Mesh.hxx>
#include <SMESH_ControlsDef.hxx>
+#include <SMDSAbs_ElementType.hxx>
+#include "SMESHDS_Group.hxx"
+#include "SMESH_Group.hxx"
#include <utilities.h>
TopTools_IndexedMapOfShape FacesWithEnforcedVertices;
std::map< int, std::set< std::vector<double> > > FaceId2EnforcedVertexCoords;
+std::map< std::vector<double>, std::vector<double> > EnfVertex2ProjVertex;
bool HasSizeMapOnFace=false;
bool HasSizeMapOnEdge=false;
FaceId2AttractorCoords.clear();
FacesWithEnforcedVertices.Clear();
FaceId2EnforcedVertexCoords.clear();
-
+ EnfVertex2ProjVertex.clear();
}
//=============================================================================
}
/////////////////////////////////////////////////////////
-void createEnforcedVertexOnFace(TopoDS_Shape GeomShape, BLSURFPlugin_Hypothesis::TEnforcedVertexList enforcedVertexList)
+void createEnforcedVertexOnFace(TopoDS_Shape GeomShape, BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList)
{
double xe, ye, ze;
std::vector<double> coords;
- BLSURFPlugin_Hypothesis::TEnforcedVertex enforcedVertex;
- BLSURFPlugin_Hypothesis::TEnforcedVertexList::const_iterator evlIt = enforcedVertexList.begin();
+ std::vector<double> s_coords;
+ std::vector<double> enfVertex;
+// BLSURFPlugin_Hypothesis::TEnfVertex enfVertex;
+ BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
- for( ; evlIt != enforcedVertexList.end() ; ++evlIt ) {
+ for( ; evlIt != enfVertexList.end() ; ++evlIt ) {
coords.clear();
- enforcedVertex = *evlIt;
- xe = enforcedVertex[0];
- ye = enforcedVertex[1];
- ze = enforcedVertex[2];
+ s_coords.clear();
+ enfVertex = *evlIt;
+ xe = enfVertex[0];
+ ye = enfVertex[1];
+ ze = enfVertex[2];
MESSAGE("Enforced Vertex: " << xe << ", " << ye << ", " << ze);
// Get the (u,v) values of the enforced vertex on the face
projectionPoint myPoint = getProjectionPoint(TopoDS::Face(GeomShape),gp_XYZ(xe,ye,ze));
coords.push_back(x0);
coords.push_back(y0);
coords.push_back(z0);
-
+
+ s_coords.push_back(x0);
+ s_coords.push_back(y0);
+ s_coords.push_back(z0);
+
+ // Save pair projected vertex / enf vertex
+ MESSAGE("Storing pair projected vertex / enf vertex:");
+ MESSAGE("("<< x0 << ", " << y0 << ", " << z0 <<") / (" << xe << ", " << ye << ", " << ze<<")");
+ EnfVertex2ProjVertex[s_coords] = enfVertex;
+
int key = 0;
if (! FacesWithEnforcedVertices.Contains(TopoDS::Face(GeomShape))) {
key = FacesWithEnforcedVertices.Add(TopoDS::Face(GeomShape));
// Enforced Vertices
//
MESSAGE("Setting Enforced Vertices");
- const BLSURFPlugin_Hypothesis::TEnforcedVertexMap enforcedVertexMap = BLSURFPlugin_Hypothesis::GetAllEnforcedVertices(hyp);
- BLSURFPlugin_Hypothesis::TEnforcedVertexMap::const_iterator enfIt = enforcedVertexMap.begin();
- for ( ; enfIt != enforcedVertexMap.end(); ++enfIt ) {
+ const BLSURFPlugin_Hypothesis::TEntryEnfVertexListMap entryEnfVertexListMap = BLSURFPlugin_Hypothesis::GetAllEnforcedVertices(hyp);
+ BLSURFPlugin_Hypothesis::TEntryEnfVertexListMap::const_iterator enfIt = entryEnfVertexListMap.begin();
+ for ( ; enfIt != entryEnfVertexListMap.end(); ++enfIt ) {
if ( !enfIt->second.empty() ) {
GeomShape = entryToShape(enfIt->first);
GeomType = GeomShape.ShapeType();
int iface = 0;
string bad_end = "return";
int faceKey = -1;
+ int ienf = 0;
for (TopExp_Explorer face_iter(aShape,TopAbs_FACE);face_iter.More();face_iter.Next()) {
TopoDS_Face f=TopoDS::Face(face_iter.Current());
}
if (HasSizeMapOnFace){
- std::cout << "A size map is defined on a face" << std::endl;
+// std::cout << "A size map is defined on a face" << std::endl;
// Classic size map
faceKey = FacesWithSizeMap.FindIndex(f);
faceKey = FacesWithEnforcedVertices.FindIndex(f);
std::map<int,std::set<std::vector<double> > >::const_iterator evmIt = FaceId2EnforcedVertexCoords.find(faceKey);
if (evmIt != FaceId2EnforcedVertexCoords.end()) {
- std::cout << "Some enforced vertices are defined" << std::endl;
- int ienf = 0;
+ MESSAGE("Some enforced vertices are defined");
+// int ienf = 0;
std::set<std::vector<double> > evl;
// std::vector<double> ev;
MESSAGE("Face indice: " << iface);
MESSAGE("Number of vertices to add: "<< evl.size());
std::set< std::vector<double> >::const_iterator evlIt = evl.begin();
for (; evlIt != evl.end(); ++evlIt) {
-// ev = *evlIt;
-// for (int i=0; i<evl.size() ; i++) {
-// ev = evl[i];
-
-// double xyzCoords[3] = {ev[2], ev[3], ev[4]};
- double xyzCoords[3] = {evlIt->at(2), evlIt->at(3), evlIt->at(4)};
+ std::vector<double> xyzCoords;
+ xyzCoords.push_back(evlIt->at(2));
+ xyzCoords.push_back(evlIt->at(3));
+ xyzCoords.push_back(evlIt->at(4));
+// double xyzCoords[3] = {evlIt->at(2), evlIt->at(3), 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);
BRepClass_FaceClassifierPerform(&scl,f,P,1e-7);
TopAbs_State result = scl.State();
MESSAGE("Position of point on face: "<<result);
- if ( result == TopAbs_OUT )
+ if ( result == TopAbs_OUT ) {
MESSAGE("Point is out of face: node is not created");
- if ( result == TopAbs_UNKNOWN )
- MESSAGE("Point position on face is unknown: node is not created");
- if ( result == TopAbs_ON )
- MESSAGE("Point is on border of face: node is not created");
+ if (EnfVertex2ProjVertex.find(xyzCoords) != EnfVertex2ProjVertex.end())
+ EnfVertex2ProjVertex.erase(xyzCoords);
+ }
+ if ( result == TopAbs_UNKNOWN ) {
+ MESSAGE("Point position on face is unknown: node is not created");
+ if (EnfVertex2ProjVertex.find(xyzCoords) != EnfVertex2ProjVertex.end())
+ EnfVertex2ProjVertex.erase(xyzCoords);
+ }
+ if ( result == TopAbs_ON ) {
+ MESSAGE("Point is on border of face: node is not created");
+ if (EnfVertex2ProjVertex.find(xyzCoords) != EnfVertex2ProjVertex.end())
+ EnfVertex2ProjVertex.erase(xyzCoords);
+ }
if ( result == TopAbs_IN )
{
// Point is inside face and not on border
}
FaceId2EnforcedVertexCoords.erase(faceKey);
}
- else
- std::cout << "No enforced vertex defined" << std::endl;
+// else
+// std::cout << "No enforced vertex defined" << std::endl;
}
tag = 0; // enforced or attracted vertex
}
nodes[iv] = meshDS->AddNode(xyz[0], xyz[1], xyz[2]);
+
+ /* TODO GROUPS
+ // Create group of enforced vertices if requested
+ if(_hypothesis) {
+ std::vector<double> projVertex;
+ projVertex.push_back((double)xyz[0]);
+ projVertex.push_back((double)xyz[1]);
+ projVertex.push_back((double)xyz[2]);
+ std::map< std::vector<double>, std::vector<double> >::const_iterator projIt = EnfVertex2ProjVertex.find(projVertex);
+ if (projIt != EnfVertex2ProjVertex.end()) {
+ double x = (projIt->second)[0];
+ double y = (projIt->second)[1];
+ double z = (projIt->second)[2];
+ BLSURFPlugin_Hypothesis::TEnfVertex enfVertex;
+ enfVertex.push_back(x);
+ enfVertex.push_back(y);
+ enfVertex.push_back(z);
+
+ BLSURFPlugin_Hypothesis::TEnfVertexGroupNameMap groupNameMap = _hypothesis->_GetEnforcedVertexGroupNameMap();
+ BLSURFPlugin_Hypothesis::TEnfVertexGroupNameMap::const_iterator groupNameMapIt = groupNameMap.find(enfVertex);
+ if (groupNameMapIt != groupNameMap.end()) {
+ MESSAGE("Found enforced vertex @ " << xyz[0] << ", " << xyz[1] << ", " << xyz[2])
+ BLSURFPlugin_Hypothesis::TEnfGroupName groupName = groupNameMapIt->second;
+ if (groupName != "") {
+ bool groupDone = false;
+ const set<SMESHDS_GroupBase*>& allGroups = meshDS->GetGroups();
+ set<SMESHDS_GroupBase*>::const_iterator grIt;
+ MESSAGE("Parsing the groups of the mesh");
+ for ( grIt = allGroups.begin(); grIt != allGroups.end(); ++grIt ) {
+ SMESHDS_Group* group = dynamic_cast<SMESHDS_Group*>( *grIt );
+ MESSAGE("Group: " << group->GetStoreName());
+ if ( group && group->SMDSGroup().GetType()==SMDSAbs_Node
+ && groupName.compare(group->GetStoreName())==0) {
+ group->SMDSGroup().Add(nodes[iv]);
+// int id = // recuperer l'id SMESH du noeud
+// _hypothesis->AddEnfVertexIDs(groupName,id)
+ groupDone = true;
+ MESSAGE("Successfully added enforced vertex to existing group " << groupName);
+ break;
+ }
+ }
+ if (!groupDone)
+ {
+ int groupId;
+ SMESH_Group* aGroup = aMesh.AddGroup(SMDSAbs_Node, groupName.c_str(), groupId);
+ if ( aGroup ) {
+ SMESHDS_Group* aGroupDS = dynamic_cast<SMESHDS_Group*>( aGroup->GetGroupDS() );
+ if ( aGroupDS ) {
+ aGroupDS->SetStoreName( groupName.c_str() );
+ aGroupDS->SMDSGroup().Add(nodes[iv]);
+ MESSAGE("Successfully created enforced vertex group " << groupName);
+ groupDone = true;
+ }
+ }
+ }
+ if (!groupDone)
+ throw SALOME_Exception(LOCALIZED("A enforced vertex node was not added to a group"));
+ }
+ else
+ MESSAGE("Group name is empty: '"<<groupName<<"' => group is not created");
+ }
+ else
+ MESSAGE("No group name for projected vertex ("<<x<<","<<y<<","<<z<<")")
+ }
+// else
+// MESSAGE("No group name for vertex ("<<xyz[0]<<","<<xyz[1]<<","<<xyz[2]<<")")
+ }
+ */
+
// internal point are tagged to zero
if(tag > 0 && tag <= pmap.Extent() ){
meshDS->SetNodeOnVertex(nodes[iv], TopoDS::Vertex(pmap(tag)));
_verb( GetDefaultVerbosity() ),
_sizeMap(GetDefaultSizeMap()),
_attractors(GetDefaultSizeMap()),
- _enforcedVertices(GetDefaultEnforcedVertexMap())
+ _enfVertexList(GetDefaultEnfVertexList()),
+ _entryEnfVertexListMap(GetDefaultEntryEnfVertexListMap())
+ /* TODO GROUPS
+ _groupNameEnfVertexListMap(GetDefaultGroupNameEnfVertexListMap()),
+ _enfVertexGroupNameMap(GetDefaultEnfVertexGroupNameMap())
+ */
{
_name = "BLSURF_Parameters";
_param_algo_dim = 2;
}
_sizeMap.clear();
+ _attractors.clear();
+ _enfVertexList.clear();
+ _entryEnfVertexListMap.clear();
+ /* TODO GROUPS
+ _groupNameEnfVertexListMap.clear();
+ _enfVertexGroupNameMap.clear();
+ */
}
//=============================================================================
return hyp ? hyp->_GetAttractorEntries():GetDefaultSizeMap();
}
-
-
+//=======================================================================
+//function : ClearEntry
+//=======================================================================
void BLSURFPlugin_Hypothesis::ClearEntry(const std::string& entry)
{
TSizeMap::iterator it = _sizeMap.find( entry );
}
}
-
+//=======================================================================
+//function : ClearSizeMaps
+//=======================================================================
void BLSURFPlugin_Hypothesis::ClearSizeMaps()
{
_sizeMap.clear();
//=======================================================================
//function : SetEnforcedVertex
//=======================================================================
-
-void BLSURFPlugin_Hypothesis::SetEnforcedVertex(const std::string& entry, double x, double y, double z)
+/* TODO GROUPS
+void BLSURFPlugin_Hypothesis::SetEnforcedVertex(const TEnfEntry& entry,
+ double x, double y, double z,
+ const TEnfGroupName& groupName)
+*/
+void BLSURFPlugin_Hypothesis::SetEnforcedVertex(const TEnfEntry& entry,
+ double x, double y, double z)
{
- BLSURFPlugin_Hypothesis::TEnforcedVertex coord;
- coord.push_back(x);
- coord.push_back(y);
- coord.push_back(z);
+ /* TODO GROUPS
+ MESSAGE("BLSURFPlugin_Hypothesis::SetEnforcedVertex START - entry: " << entry << " vertex: " << x << " " << y << " " << z << " group name: " << groupName);
+ */
+ MESSAGE("BLSURFPlugin_Hypothesis::SetEnforcedVertex START - entry: " << entry << " vertex: " << x << " " << y << " " << z);
+ TEnfVertex enfVertex;
+ enfVertex.push_back(x);
+ enfVertex.push_back(y);
+ enfVertex.push_back(z);
+
bool toNotify = false;
- if (_enforcedVertices.count(entry)>0)
- if (_enforcedVertices[entry].count(coord)==0)
+ if (_entryEnfVertexListMap.count(entry)>0)
+ if (_entryEnfVertexListMap[entry].count(enfVertex)==0)
toNotify = true;
else
toNotify = true;
-
- _enforcedVertices[entry].insert(coord);
+
+ _enfVertexList.insert(enfVertex);
+// _entryEnfVertexListMap[entry].insert(enfVertex);
+ TEnfVertexList& entryEnfVertexList = _entryEnfVertexListMap[entry];
+ entryEnfVertexList.insert(enfVertex);
+
+ /* TODO GROUPS
+ bool toNotify2 = _setEnfVertexWithGroup(x,y,z,groupName);
+
+ if (toNotify || toNotify2)
+ NotifySubMeshesHypothesisModification();
+ */
if (toNotify)
NotifySubMeshesHypothesisModification();
+
+ MESSAGE("BLSURFPlugin_Hypothesis::SetEnforcedVertex END");
}
+/* TODO GROUPS
+bool BLSURFPlugin_Hypothesis::_setEnfVertexWithGroup(double x, double y, double z, const std::string groupName) throw (std::invalid_argument)
+{
+ bool isModified = false;
+ std::vector<double> enfVertex;
+ enfVertex.push_back(x);
+ enfVertex.push_back(y);
+ enfVertex.push_back(z);
+ if (_enfVertexList.find(enfVertex) != _enfVertexList.end()) {
+ TEnfGroupName oldGroupName = _enfVertexGroupNameMap[enfVertex];
+ _enfVertexGroupNameMap[enfVertex] = groupName;
+ if ((groupName != "") && (groupName != oldGroupName)) {
+ MESSAGE("Group name is not empty");
+ TEnfVertexList& enfVertexList = _groupNameEnfVertexListMap[groupName];
+ enfVertexList.insert(enfVertex);
+ isModified = true;
+ }
+ else {
+ if (oldGroupName != "") {
+ // groupName = "" => remove group name
+ TGroupNameEnfVertexListMap::iterator it = _groupNameEnfVertexListMap.find(oldGroupName);
+ if (it != _groupNameEnfVertexListMap.end()) {
+ _groupNameEnfVertexListMap[oldGroupName].erase(enfVertex);
+ if (_groupNameEnfVertexListMap[oldGroupName].size() == 0)
+ _groupNameEnfVertexListMap.erase(oldGroupName);
+ isModified = true;
+ }
+ }
+ }
+ return isModified;
+ }
+
+ std::ostringstream msg ;
+ msg << "No enforced vertex at (" << x << "," << y << "," << z << ")" ;
+ throw std::invalid_argument(msg.str());
+}
+
+//=======================================================================
+//function : SetEnforcedVertexGroupName
+//=======================================================================
+void BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(double x, double y, double z,
+ const TEnfGroupName& groupName)
+ throw (std::invalid_argument)
+{
+ bool toNotify = _setEnfVertexWithGroup(x,y,z,groupName);
+ if (toNotify)
+ NotifySubMeshesHypothesisModification();
+// bool toNotify = false;
+// TEnfVertex enfVertex;
+// enfVertex.push_back(x);
+// enfVertex.push_back(y);
+// enfVertex.push_back(z);
+//
+// if (_enfVertexList.find(enfVertex) != _enfVertexList.end()) {
+// TEnfGroupName oldGroupName = _enfVertexGroupNameMap[enfVertex];
+// _enfVertexGroupNameMap[enfVertex] = groupName;
+// if ((groupName != "") && (groupName != oldGroupName)) {
+// MESSAGE("Group name is not empty");
+// TEnfVertexList& enfVertexList = _groupNameEnfVertexListMap[groupName];
+// enfVertexList.insert(enfVertex);
+// toNotify = true;
+// }
+// else {
+// if (oldGroupName != "") {
+// // groupName = "" => remove group name
+// TGroupNameEnfVertexListMap::iterator it = _groupNameEnfVertexListMap.find(oldGroupName);
+// if (it != _groupNameEnfVertexListMap.end()) {
+// _groupNameEnfVertexListMap[oldGroupName].erase(enfVertex);
+// if (_groupNameEnfVertexListMap[oldGroupName].size() == 0)
+// _groupNameEnfVertexListMap.erase(oldGroupName);
+// toNotify = true;
+// }
+// }
+// }
+// if (toNotify)
+// NotifySubMeshesHypothesisModification();
+// return;
+// }
+
+// // std::ostringstream msg ;
+// // msg << "No enforced vertex at (" << x << "," << y << "," << z << ")" ;
+// // throw std::invalid_argument(msg.str());
+}
+
+
+//=======================================================================
+//function : GetEnforcedVertexGroupName
+//=======================================================================
+BLSURFPlugin_Hypothesis::TEnfGroupName BLSURFPlugin_Hypothesis::GetEnforcedVertexGroupName(double x, double y, double z)
+ throw (std::invalid_argument)
+{
+ TEnfVertex enfVertex;
+ enfVertex.push_back(x);
+ enfVertex.push_back(y);
+ enfVertex.push_back(z);
+
+ if (_enfVertexGroupNameMap.find(enfVertex) != _enfVertexGroupNameMap.end())
+ return _enfVertexGroupNameMap[enfVertex];
+
+ std::ostringstream msg ;
+ msg << "No enforced vertex at (" << x << "," << y << "," << z << ")" ;
+ throw std::invalid_argument(msg.str());
+}
+*/
+
/*
//=======================================================================
//function : SetEnforcedVertexList
//=======================================================================
-void BLSURFPlugin_Hypothesis::SetEnforcedVertexList(const std::string& entry, const BLSURFPlugin_Hypothesis::TEnforcedVertexList vertexList)
+void BLSURFPlugin_Hypothesis::SetEnforcedVertexList(const TEnfEntry& entry,
+ const TEnfVertexList vertexList)
{
- BLSURFPlugin_Hypothesis::TEnforcedVertexList::const_iterator it;
+ TEnfVertexList::const_iterator it;
bool toNotify = false;
for(it = vertexList.begin();it!=vertexList.end();++it) {
- if (_enforcedVertices.count(entry)>0)
- if (_enforcedVertices[entry].count(*it)==0)
+ if (_entryEnfVertexListMap.count(entry)>0)
+ if (_entryEnfVertexListMap[entry].count(*it)==0)
toNotify = true;
else
toNotify = true;
- _enforcedVertices[entry].insert(*it);
+ _entryEnfVertexListMap[entry].insert(*it);
+ _enfVertexList.insert(*it);
}
if (toNotify)
NotifySubMeshesHypothesisModification();
//function : GetEnforcedVertices
//=======================================================================
-BLSURFPlugin_Hypothesis::TEnforcedVertexList BLSURFPlugin_Hypothesis::GetEnforcedVertices(const std::string& entry)
+BLSURFPlugin_Hypothesis::TEnfVertexList BLSURFPlugin_Hypothesis::GetEnforcedVertices(const TEnfEntry& entry)
throw (std::invalid_argument)
{
- if (_enforcedVertices.count(entry)>0)
- return _enforcedVertices[entry];
+ if (_entryEnfVertexListMap.count(entry)>0)
+ return _entryEnfVertexListMap[entry];
std::ostringstream msg ;
msg << "No enforced vertex for entry " << entry ;
throw std::invalid_argument(msg.str());
//function : ClearEnforcedVertex
//=======================================================================
-void BLSURFPlugin_Hypothesis::ClearEnforcedVertex(const std::string& entry, double x, double y, double z)
+void BLSURFPlugin_Hypothesis::ClearEnforcedVertex(const TEnfEntry& entry, double x, double y, double z)
throw (std::invalid_argument)
{
- BLSURFPlugin_Hypothesis::TEnforcedVertex coord;
- coord.push_back(x);
- coord.push_back(y);
- coord.push_back(z);
- BLSURFPlugin_Hypothesis::TEnforcedVertexList::iterator it;
- bool toNotify = false;
+ std::ostringstream msg ;
+
+ TEnfVertex enfVertex;
+ enfVertex.push_back(x);
+ enfVertex.push_back(y);
+ enfVertex.push_back(z);
+
+ // check that enf vertex with given coords exists
+ if (_enfVertexList.count(enfVertex) == 0) {
+ msg << "No enforced vertex for " << entry;
+ throw std::invalid_argument(msg.str());
+ }
+
- BLSURFPlugin_Hypothesis::TEnforcedVertexMap::iterator it_enf = _enforcedVertices.find(entry);
- if (it_enf != _enforcedVertices.end()) {
- it = _enforcedVertices[entry].find(coord);
- if (it != _enforcedVertices[entry].end()) {
+ TEntryEnfVertexListMap::iterator it_enf = _entryEnfVertexListMap.find(entry);
+ if (it_enf != _entryEnfVertexListMap.end()) {
+ bool toNotify = false;
+ TEnfVertexList::iterator it = _entryEnfVertexListMap[entry].find(enfVertex);
+ if (it != _entryEnfVertexListMap[entry].end()) {
toNotify = true;
- _enforcedVertices[entry].erase(it);
- if (_enforcedVertices[entry].size() == 0)
- _enforcedVertices.erase(it_enf);
+
+ // Update entry2enfList map
+ _entryEnfVertexListMap[entry].erase(it);
+ if (_entryEnfVertexListMap[entry].size() == 0)
+ _entryEnfVertexListMap.erase(it_enf);
+
+ /* TODO GROUPS
+ // Update groupName2enfCoord map
+ TEnfGroupName groupName = _enfVertexGroupNameMap[enfVertex];
+ if (groupName != "") {
+ TGroupNameEnfVertexListMap::iterator it_grp =_groupNameEnfVertexListMap.find(groupName);
+ if (it_grp != _groupNameEnfVertexListMap.end()) {
+ _groupNameEnfVertexListMap[groupName].erase(enfVertex);
+ if (_groupNameEnfVertexListMap[groupName].size() == 0)
+ _groupNameEnfVertexListMap.erase(it_grp);
+ }
+ }
+
+ // Update _enfVertexGroupNameMap
+ _enfVertexGroupNameMap.erase(enfVertex);
+ */
+
+ // Update _enfVertexList
+ _enfVertexList.erase(enfVertex);
+
}
if (toNotify)
NotifySubMeshesHypothesisModification();
return;
}
- std::ostringstream msg ;
msg << "No enforced vertex for " << entry;
throw std::invalid_argument(msg.str());
}
//function : ClearEnforcedVertexList
//=======================================================================
-void BLSURFPlugin_Hypothesis::ClearEnforcedVertexList(const std::string& entry, BLSURFPlugin_Hypothesis::TEnforcedVertexList vertexList)
+void BLSURFPlugin_Hypothesis::ClearEnforcedVertexList(const std::string& entry, TEnfVertexList vertexList)
throw (std::invalid_argument)
{
- BLSURFPlugin_Hypothesis::TEnforcedVertex coord;
- BLSURFPlugin_Hypothesis::TEnforcedVertexList::const_iterator it_toRemove;
- BLSURFPlugin_Hypothesis::TEnforcedVertexList::iterator it;
+ TEnfVertex coord;
+ TEnfVertexList::const_iterator it_toRemove;
+ TEnfVertexList::iterator it;
bool toNotify = false;
- BLSURFPlugin_Hypothesis::TEnforcedVertexMap::iterator it_enf = _enforcedVertices.find(entry);
- if (it_enf != _enforcedVertices.end()) {
+ TEntryEnfVertexListMap::iterator it_enf = _entryEnfVertexListMap.find(entry);
+ if (it_enf != _entryEnfVertexListMap.end()) {
for (it_toRemove = vertexList.begin() ; it_toRemove != vertexList.end() ; ++it_toRemove) {
coord = *it_toRemove;
- it = _enforcedVertices[entry].find(coord);
- if (it != _enforcedVertices[entry].end()) {
+ it = _entryEnfVertexListMap[entry].find(coord);
+ if (it != _entryEnfVertexListMap[entry].end()) {
toNotify = true;
- _enforcedVertices[entry].erase(it);
+ _entryEnfVertexListMap[entry].erase(it);
+ _enfVertexList.erase(it);
}
}
- if (_enforcedVertices[entry].size() == 0) {
+ if (_entryEnfVertexListMap[entry].size() == 0) {
toNotify = true;
- _enforcedVertices.erase(it_enf);
+ _entryEnfVertexListMap.erase(it_enf);
}
if (toNotify)
NotifySubMeshesHypothesisModification();
//function : ClearEnforcedVertices
//=======================================================================
-void BLSURFPlugin_Hypothesis::ClearEnforcedVertices(const std::string& entry)
+void BLSURFPlugin_Hypothesis::ClearEnforcedVertices(const TEnfEntry& entry)
throw (std::invalid_argument)
{
- BLSURFPlugin_Hypothesis::TEnforcedVertexMap::iterator it_enf = _enforcedVertices.find(entry);
- if (it_enf != _enforcedVertices.end()) {
- _enforcedVertices.erase(it_enf);
+ TEntryEnfVertexListMap::iterator it_enf = _entryEnfVertexListMap.find(entry);
+ if (it_enf != _entryEnfVertexListMap.end()) {
+ TEnfVertexList enfList = it_enf->second;
+ TEnfVertexList::iterator it;
+ for(it = enfList.begin();it!=enfList.end();++it) {
+ /* TODO GROUPS
+ TEnfGroupName groupName = _enfVertexGroupNameMap[*it];
+ if (groupName != "") {
+ TGroupNameEnfVertexListMap::iterator it_grp =_groupNameEnfVertexListMap.find(groupName);
+ if (it_grp != _groupNameEnfVertexListMap.end()) {
+ _groupNameEnfVertexListMap[groupName].erase(it);
+ if (_groupNameEnfVertexListMap[groupName].size() == 0)
+ _groupNameEnfVertexListMap.erase(it_grp);
+ }
+ }
+ _enfVertexGroupNameMap.erase(*it);
+ */
+ _enfVertexList.erase(it);
+ }
+ _entryEnfVertexListMap.erase(it_enf);
NotifySubMeshesHypothesisModification();
return;
}
//=======================================================================
void BLSURFPlugin_Hypothesis::ClearAllEnforcedVertices()
{
- _enforcedVertices.clear();
+ _enfVertexList.clear();
+ _entryEnfVertexListMap.clear();
+ /* TODO GROUPS
+ _groupNameEnfVertexListMap.clear();
+ _enfVertexGroupNameMap.clear();
+ */
NotifySubMeshesHypothesisModification();
}
*/
//================================================================================
-BLSURFPlugin_Hypothesis::TEnforcedVertexMap BLSURFPlugin_Hypothesis::GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp)
+BLSURFPlugin_Hypothesis::TEntryEnfVertexListMap BLSURFPlugin_Hypothesis::GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp)
{
- return hyp ? hyp->_GetAllEnforcedVertices():GetDefaultEnforcedVertexMap();
+ return hyp ? hyp->_GetAllEnforcedVertices():GetDefaultEntryEnfVertexListMap();
}
save << " " << "__ATTRACTORS_END__";
}
- TEnforcedVertexMap::const_iterator it_enf = _enforcedVertices.begin();
- if (it_enf != _enforcedVertices.end()) {
+ TEntryEnfVertexListMap::const_iterator it_enf = _entryEnfVertexListMap.begin();
+ if (it_enf != _entryEnfVertexListMap.end()) {
save << " " << "__ENFORCED_VERTICES_BEGIN__";
- for ( ; it_enf != _enforcedVertices.end(); ++it_enf ) {
+ for ( ; it_enf != _entryEnfVertexListMap.end(); ++it_enf ) {
save << " " << it_enf->first;
- TEnforcedVertexList evl = it_enf->second;
- TEnforcedVertexList::const_iterator it_evl = evl.begin();
- if (it_evl != evl.end()) {
- for ( ; it_evl != evl.end() ; ++it_evl) {
- save << " " << (*it_evl)[0];
- save << " " << (*it_evl)[1];
- save << " " << (*it_evl)[2];
- save << "$"; // "$" is a mark of enforced vertex end
+ TEnfVertexList evl = it_enf->second;
+ TEnfVertexList::const_iterator it_evl = evl.begin();
+ for ( ; it_evl != evl.end() ; ++it_evl) {
+ save << " " << (*it_evl)[0];
+ save << " " << (*it_evl)[1];
+ save << " " << (*it_evl)[2];
+ /* TODO GROUPS
+ TEnfVertexGroupNameMap::const_iterator it_enfGroup = _enfVertexGroupNameMap.find(*it_evl);
+ if (it_enfGroup != _enfVertexGroupNameMap.end()) {
+ save << " " << "__ENF_GROUP_BEGIN__";
+ save << " " << it_enfGroup->second ;
+ save << " " << "__ENF_GROUP_END__";
}
+ */
+ save << " " << "$"; // "$" is a mark of enforced vertex end
}
save << "#"; // "#" is a mark of enforced shape end
}
hasEnforcedVertex = true;
}
- std::string enfEntry, enfValue, trace;
+ std::string enfEntry, enfValue, enfGroup, trace;
std::ostringstream oss;
while (isOK && hasEnforcedVertex) {
isOK = (load >> enfEntry);
if (isOK) {
+ MESSAGE("enfEntry: " <<enfEntry);
if (enfEntry == "__ENFORCED_VERTICES_END__")
break;
+ /* TODO GROUPS
+ bool hasGroup = false;
+ */
enfValue = "begin";
int len4 = enfValue.size();
- TEnforcedVertexList & evl = _enforcedVertices[enfEntry];
+ TEnfVertexList & evl = _entryEnfVertexListMap[enfEntry];
evl.clear();
- TEnforcedVertex enfVertex;
+ TEnfVertex enfVertex;
// continue reading until "#" encountered
while ( enfValue[len4-1] != '#') {
while ( enfValue[len4-1] != '$') {
isOK = (load >> enfValue);
if (isOK) {
+ MESSAGE("enfValue: " <<enfValue);
len4 = enfValue.size();
// End of vertex list
if (enfValue[len4-1] == '#')
break;
+ /* TODO GROUPS
+ if (enfValue == "__ENF_GROUP_BEGIN__") {
+ hasGroup = true;
+ isOK = (load >> enfGroup);
+ MESSAGE("enfGroup: " <<enfGroup);
+ TEnfGroupName& groupName = _enfVertexGroupNameMap[ enfVertex ];
+ groupName = enfGroup;
+ while ( isOK) {
+ isOK = (load >> enfGroup);
+ if (isOK) {
+ MESSAGE("enfGroup: " <<enfGroup);
+ if (enfGroup == "__ENF_GROUP_END__")
+ break;
+ groupName += " ";
+ groupName += enfGroup;
+ }
+ }
+ }
+ else {
+ // Add to vertex
+ enfVertex.push_back(atof(enfValue.c_str()));
+ }
+ */
if (enfValue[len4-1] != '$') {
// Add to vertex
enfVertex.push_back(atof(enfValue.c_str()));
break;
}
if (enfValue[len4-1] == '$') {
- // Remove '$' and add to vertex
+ MESSAGE("enfValue is $");
+ enfValue[len4-1] = '\0'; //cut off "$"
+ /* TODO GROUPS
+ if (!hasGroup) {
+ MESSAGE("no group: remove $");
+ // Remove '$' and add to vertex
+// enfValue[len4-1] = '\0'; //cut off "$#"
+ enfVertex.push_back(atof(enfValue.c_str()));
+ }
+ */
enfValue[len4-1] = '\0'; //cut off "$#"
enfVertex.push_back(atof(enfValue.c_str()));
+ MESSAGE("Add vertex to list");
// Add vertex to list of vertex
evl.insert(enfVertex);
}
}
if (enfValue[len4-1] == '#') {
+ /* TODO GROUPS
+ if (!hasGroup) {
+ // Remove '$#' and add to vertex
+ enfValue[len4-2] = '\0'; //cut off "$#"
+ enfVertex.push_back(atof(enfValue.c_str()));
+ }
+ */
// Remove '$#' and add to vertex
enfValue[len4-2] = '\0'; //cut off "$#"
enfVertex.push_back(atof(enfValue.c_str()));
/*!
* To set/get/unset an enforced vertex
*/
- typedef std::vector<double> TEnforcedVertex;
- typedef std::set< TEnforcedVertex > TEnforcedVertexList;
- typedef std::map< std::string, TEnforcedVertexList > TEnforcedVertexMap;
+ // Entry
+ typedef std::string TEnfEntry;
+ // Enforced vertex = 3 coordinates
+ typedef std::vector<double> TEnfVertex;
+ // List of enforced vertices
+ typedef std::set< TEnfVertex > TEnfVertexList;
+ // Map Entry / List of enforced vertices
+ typedef std::map< TEnfEntry , TEnfVertexList > TEntryEnfVertexListMap;
+ /* TODO GROUPS
+ // Group name
+ typedef std::string TEnfGroupName;
+ // Map Group Name / List of enforced vertices
+ typedef std::map< TEnfGroupName , TEnfVertexList > TGroupNameEnfVertexListMap;
+ // Map Enforced vertex / Group Name
+ typedef std::map< TEnfVertex , TEnfGroupName > TEnfVertexGroupNameMap;
+ */
+
- void SetEnforcedVertex(const std::string& entry, double x, double y, double z);
-// void SetEnforcedVertexList(const std::string& entry, const TEnforcedVertexList vertexList);
- TEnforcedVertexList GetEnforcedVertices(const std::string& entry) throw (std::invalid_argument);
- void ClearEnforcedVertex(const std::string& entry, double x, double y, double z) throw (std::invalid_argument);
-// void ClearEnforcedVertexList(const std::string& entry, TEnforcedVertexList vertexList) throw (std::invalid_argument);
- void ClearEnforcedVertices(const std::string& entry) throw (std::invalid_argument);
+ /* TODO GROUPS
+ void SetEnforcedVertex(const TEnfEntry& entry, double x, double y, double z, const TEnfGroupName& groupName="");
+ */
+ void SetEnforcedVertex(const TEnfEntry& entry, double x, double y, double z);
+// void SetEnforcedVertexList(const TEnfEntry& entry, const TEnfVertexList vertexList);
+ TEnfVertexList GetEnforcedVertices(const TEnfEntry& entry) throw (std::invalid_argument);
+ void ClearEnforcedVertex(const TEnfEntry& entry, double x, double y, double z) throw (std::invalid_argument);
+// void ClearEnforcedVertexList(const TEnfEntry& entry, TEnfVertexList vertexList) throw (std::invalid_argument);
+ void ClearEnforcedVertices(const TEnfEntry& entry) throw (std::invalid_argument);
void ClearAllEnforcedVertices();
- const TEnforcedVertexMap _GetAllEnforcedVertices() const { return _enforcedVertices; }
+ const TEntryEnfVertexListMap _GetAllEnforcedVertices() const { return _entryEnfVertexListMap; }
+ /* TODO GROUPS
+ const TEnfVertexGroupNameMap _GetEnforcedVertexGroupNameMap() const { return _enfVertexGroupNameMap; }
+ */
/*!
* \brief Return the enforced vertices
*/
- static TEnforcedVertexMap GetAllEnforcedVertices(const BLSURFPlugin_Hypothesis* hyp);
-
+ static TEntryEnfVertexListMap GetAllEnforcedVertices(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);
+ */
static Topology GetDefaultTopology();
static PhysicalMesh GetDefaultPhysicalMesh();
static bool GetDefaultDecimesh();
static int GetDefaultVerbosity() { return 10; }
static TSizeMap GetDefaultSizeMap() { return TSizeMap();}
- static TEnforcedVertexMap GetDefaultEnforcedVertexMap() { return TEnforcedVertexMap(); }
+ static TEnfVertexList GetDefaultEnfVertexList() { return TEnfVertexList(); }
+ static TEntryEnfVertexListMap GetDefaultEntryEnfVertexListMap() { return TEntryEnfVertexListMap(); }
+ /* TODO GROUPS
+ static TGroupNameEnfVertexListMap GetDefaultGroupNameEnfVertexListMap() { return TGroupNameEnfVertexListMap(); }
+ static TEnfVertexGroupNameMap GetDefaultEnfVertexGroupNameMap() { return TEnfVertexGroupNameMap(); }
+ */
static double undefinedDouble() { return -1.0; }
*/
virtual bool SetParametersByDefaults(const TDefaults& dflts, const SMESH_Mesh* theMesh=0);
+/* TODO GROUPS
+private:
+ bool _setEnfVertexWithGroup(double x, double y, double z, const std::string groupName) throw (std::invalid_argument);
+*/
+
private:
Topology _topology;
PhysicalMesh _physicalMesh;
TOptionNames _doubleOptions, _charOptions;
TSizeMap _sizeMap;
TSizeMap _attractors;
- TEnforcedVertexMap _enforcedVertices;
-/*
- TSizeMap _customSizeMap;
-*/
+ TEnfVertexList _enfVertexList;
+ TEntryEnfVertexListMap _entryEnfVertexListMap;
+ /* TODO GROUPS
+ TGroupNameEnfVertexListMap _groupNameEnfVertexListMap;
+ TEnfVertexGroupNameMap _enfVertexGroupNameMap;
+ */
+// TSizeMap _customSizeMap;
};
#endif
#include "utilities.h"
#include <stdexcept>
+#include <cstring>
#include "boost/regex.hpp"
//=============================================================================
// ENFORCED VERTEXES //
///////////////////////
-BLSURFPlugin::TEnforcedVertexMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices()
+BLSURFPlugin::TEntryEnfVertexListMap* BLSURFPlugin_Hypothesis_i::GetAllEnforcedVertices()
{
MESSAGE("IDL: GetAllEnforcedVertices()");
ASSERT(myBaseImpl);
- BLSURFPlugin::TEnforcedVertexMap_var resultMap = new BLSURFPlugin::TEnforcedVertexMap();
- const ::BLSURFPlugin_Hypothesis::TEnforcedVertexMap enforcedVertexMap = this->GetImpl()->_GetAllEnforcedVertices();
- resultMap->length(enforcedVertexMap.size());
- MESSAGE("Enforced Vertex map size is " << enforcedVertexMap.size());
-
- ::BLSURFPlugin_Hypothesis::TEnforcedVertexList enforcedVertexList;
- ::BLSURFPlugin_Hypothesis::TEnforcedVertexMap::const_iterator evmIt = enforcedVertexMap.begin();
- for ( int i = 0 ; evmIt != enforcedVertexMap.end(); ++evmIt, ++i ) {
- string entry = evmIt->first;
+ BLSURFPlugin::TEntryEnfVertexListMap_var resultMap = new BLSURFPlugin::TEntryEnfVertexListMap();
+ const ::BLSURFPlugin_Hypothesis::TEntryEnfVertexListMap entryEnfVertexListMap = this->GetImpl()->_GetAllEnforcedVertices();
+ resultMap->length(entryEnfVertexListMap.size());
+ MESSAGE("Enforced Vertex map size is " << entryEnfVertexListMap.size());
+
+ ::BLSURFPlugin_Hypothesis::TEnfVertexList enfVertexList;
+ ::BLSURFPlugin_Hypothesis::TEntryEnfVertexListMap::const_iterator evmIt = entryEnfVertexListMap.begin();
+ for ( int i = 0 ; evmIt != entryEnfVertexListMap.end(); ++evmIt, ++i ) {
+ std::string entry = evmIt->first;
MESSAGE("Entry: " << entry);
- enforcedVertexList = evmIt->second;
+ enfVertexList = evmIt->second;
- BLSURFPlugin::TEnforcedVertexMapElement_var mapElement = new BLSURFPlugin::TEnforcedVertexMapElement();
+ BLSURFPlugin::TEntryEnfVertexListMapElement_var mapElement = new BLSURFPlugin::TEntryEnfVertexListMapElement();
- BLSURFPlugin::TEnforcedVertexList_var vertexList = new BLSURFPlugin::TEnforcedVertexList();
- vertexList->length(enforcedVertexList.size());
- MESSAGE("Number of enforced vertices: " << enforcedVertexList.size());
+ BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
+ vertexList->length(enfVertexList.size());
+ MESSAGE("Number of enforced vertices: " << enfVertexList.size());
- ::BLSURFPlugin_Hypothesis::TEnforcedVertexList::const_iterator evlIt = enforcedVertexList.begin();
- for ( int j = 0 ; evlIt != enforcedVertexList.end(); ++evlIt, ++j ) {
+ ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = enfVertexList.begin();
+ for ( int j = 0 ; evlIt != enfVertexList.end(); ++evlIt, ++j ) {
MESSAGE("Enforced Vertex #" << j);
- BLSURFPlugin::TEnforcedVertex_var enforcedVertex = new BLSURFPlugin::TEnforcedVertex();
- enforcedVertex->length(3);
- enforcedVertex[0] = (*evlIt)[0];
- enforcedVertex[1] = (*evlIt)[1];
- enforcedVertex[2] = (*evlIt)[2];
- vertexList[j] = enforcedVertex;
- MESSAGE("Enforced vertex: " << enforcedVertex[0] << ", " << enforcedVertex[1] << ", " << enforcedVertex[2]);
+ BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
+ enfVertex->length(3);
+ enfVertex[0] = (*evlIt)[0];
+ enfVertex[1] = (*evlIt)[1];
+ enfVertex[2] = (*evlIt)[2];
+ vertexList[j] = enfVertex;
+ MESSAGE("Enforced vertex: " << enfVertex[0] << ", " << enfVertex[1] << ", " << enfVertex[2]);
}
mapElement->entry = CORBA::string_dup(entry.c_str());
{
ASSERT(myBaseImpl);
// TODO check that GeomObj is a face => in engine ?
+ // TODO Affecter un nom de groupe vide
string entry = GeomObj->GetStudyEntry();
MESSAGE("IDL : GetName : " << GeomObj->GetName());
MESSAGE("IDL : SetEnforcedVertex ( "<< entry << ", " << x << ", " << y << ", " << z << ")");
}
}
-
-BLSURFPlugin::TEnforcedVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr GeomObj)
+/*!
+ * Set/get/unset an enforced vertex on geom object with group name
+ */
+/* TODO GROUPS
+void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr GeomObj,
+ CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+ // TODO check that GeomObj is a face => in engine ?
+ string entry = GeomObj->GetStudyEntry();
+ MESSAGE("IDL : GetName : " << GeomObj->GetName());
+ MESSAGE("IDL : SetEnforcedVertexWithGroup ( "<< entry << ", " << x << ", " << y << ", " << z << ", " << groupName <<")");
+ try {
+ SetEnforcedVertexEntryWithGroup(entry.c_str(), x, y, z, groupName);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+}
+*/
+BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVertices(GEOM::GEOM_Object_ptr GeomObj)
throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
bool newValue = false;
try {
- ::BLSURFPlugin_Hypothesis::TEnforcedVertexList vertexList = this->GetImpl()->GetEnforcedVertices(entry);
- ::BLSURFPlugin_Hypothesis::TEnforcedVertex vertex;
+ ::BLSURFPlugin_Hypothesis::TEnfVertexList vertexList = this->GetImpl()->GetEnforcedVertices(entry);
+ ::BLSURFPlugin_Hypothesis::TEnfVertex vertex;
vertex.push_back(x);
vertex.push_back(y);
vertex.push_back(z);
}
MESSAGE("IDL : SETENFORCEDVERTEX END - ENTRY: " << entry);
}
+
+/*!
+ * Set/get/unset an enforced vertex on geom object given by entry
+ */
+/* TODO GROUPS
+void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexEntryWithGroup(const char* entry,
+ double x, double y, double z, const char* groupName)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+ MESSAGE("IDL : SETENFORCEDVERTEXWITHGROUP START - ENTRY: " << entry << " VERTEX: "
+ << x << " " << y << " " << z << " group name: " << groupName);
+ bool newValue = false;
+ bool newGroupName = false;
+ try {
+ ::BLSURFPlugin_Hypothesis::TEnfVertexList vertexList = this->GetImpl()->GetEnforcedVertices(entry);
+ ::BLSURFPlugin_Hypothesis::TEnfVertex vertex;
+ vertex.push_back(x);
+ vertex.push_back(y);
+ vertex.push_back(z);
+ if (vertexList.find(vertex) == vertexList.end()) {
+ MESSAGE("Vertex not found: add it in vertexList");
+ newValue = true;
+ }
+ else {
+ MESSAGE("Vertex already found");
+ std::string oldGroupName = this->GetImpl()->GetEnforcedVertexGroupName(x,y,z);
+ if (strcmp(oldGroupName.c_str(),groupName)!=0)
+ newGroupName = true;
+ }
+ }
+ catch (const std::invalid_argument& ex) {
+ // no enforced vertex for entry
+ MESSAGE("Entry not found : add it to the list");
+ newValue = true;
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+
+ if ( newValue ) {
+ this->GetImpl()->SetEnforcedVertex(entry, x, y, z, groupName);
+ SMESH::TPythonDump() << _this() << ".SetEnforcedVertexWithGroup("
+ << entry << ", "
+ << x << ", "
+ << y << ", "
+ << z << ", '"
+ << groupName << "')";
+ }
+ else {
+ if (newGroupName) {
+ this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
+ SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
+ << x << ", "
+ << y << ", "
+ << z << ", '"
+ << groupName << "')";
+ }
+ }
+ MESSAGE("IDL : SETENFORCEDVERTEXWITHGROUP END - ENTRY: " << entry);
+}
+*/
/*
-void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexListEntry(const char* entry, BLSURFPlugin::TEnforcedVertexList& vertexList)
+void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexListEntry(const char* entry, BLSURFPlugin::TEnfVertexList& vertexList)
throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
}
*/
-BLSURFPlugin::TEnforcedVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
+BLSURFPlugin::TEnfVertexList* BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(const char* entry)
throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
MESSAGE("ENGINE : GETENFORCEDVERTICES START ENTRY : " << entry);
try {
- BLSURFPlugin::TEnforcedVertexList_var vertexList = new BLSURFPlugin::TEnforcedVertexList();
- ::BLSURFPlugin_Hypothesis::TEnforcedVertexList _vList = this->GetImpl()->GetEnforcedVertices(entry);
+ BLSURFPlugin::TEnfVertexList_var vertexList = new BLSURFPlugin::TEnfVertexList();
+ ::BLSURFPlugin_Hypothesis::TEnfVertexList _vList = this->GetImpl()->GetEnforcedVertices(entry);
vertexList->length(_vList.size());
MESSAGE("Number of enforced vertices: " << _vList.size());
- ::BLSURFPlugin_Hypothesis::TEnforcedVertexList::const_iterator evlIt = _vList.begin();
+ ::BLSURFPlugin_Hypothesis::TEnfVertexList::const_iterator evlIt = _vList.begin();
for ( int i = 0; evlIt != _vList.end() ; ++evlIt, ++i ) {
- BLSURFPlugin::TEnforcedVertex_var enforcedVertex = new BLSURFPlugin::TEnforcedVertex();
- enforcedVertex->length(3);
+ BLSURFPlugin::TEnfVertex_var enfVertex = new BLSURFPlugin::TEnfVertex();
+ enfVertex->length(3);
MESSAGE("Enforced vertex #" << i << ": "<< (*evlIt)[0] << ", " << (*evlIt)[1] << ", " << (*evlIt)[2]);
- enforcedVertex[0] = (*evlIt)[0];
- enforcedVertex[1] = (*evlIt)[1];
- enforcedVertex[2] = (*evlIt)[2];
- vertexList[i] = enforcedVertex;
+ enfVertex[0] = (*evlIt)[0];
+ enfVertex[1] = (*evlIt)[1];
+ enfVertex[2] = (*evlIt)[2];
+ vertexList[i] = enfVertex;
}
return vertexList._retn();
}
ExDescription.text = ex.what();
ExDescription.type = SALOME::BAD_PARAM;
ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVerticesEntry(entry)";
- ExDescription.lineNumber = 945;
+ ExDescription.lineNumber = 1048;
throw SALOME::SALOME_Exception(ExDescription);
}
catch(const std::exception& ex) {
ExDescription.text = ex.what();
ExDescription.type = SALOME::BAD_PARAM;
ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexEntry(entry,x,y,z)";
- ExDescription.lineNumber = 1003;
+ ExDescription.lineNumber = 1086;
throw SALOME::SALOME_Exception(ExDescription);
}
catch(const std::exception& ex) {
MESSAGE("ENGINE : UNSETENFORCEDVERTEX END ENTRY : " << entry);
}
/*
-void BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexListEntry(const char* entry, BLSURFPlugin::TEnforcedVertexList& vertexList)
+void BLSURFPlugin_Hypothesis_i::UnsetEnforcedVertexListEntry(const char* entry, BLSURFPlugin::TEnfVertexList& vertexList)
throw (SALOME::SALOME_Exception)
{
ASSERT(myBaseImpl);
ExDescription.text = ex.what();
ExDescription.type = SALOME::BAD_PARAM;
ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::UnsetEnforcedVerticesEntry(entry)";
- ExDescription.lineNumber = 1051;
+ ExDescription.lineNumber = 1121;
throw SALOME::SALOME_Exception(ExDescription);
}
catch(const std::exception& ex) {
MESSAGE("ENGINE : UNSETENFORCEDVERTICES END ENTRY : " << entry);
}
+/* TODO GROUPS
+char* BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+ MESSAGE("ENGINE : GetEnforcedVertexGroupName START ");
+ try {
+ return CORBA::string_dup( this->GetImpl()->GetEnforcedVertexGroupName(x, y, z).c_str());
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "BLSURFPlugin_Hypothesis_i::GetEnforcedVertexGroupName(entry)";
+ ExDescription.lineNumber = 1146;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+ MESSAGE("ENGINE : GetEnforcedVertexGroupName END ");
+ return 0;
+}
+
+void BLSURFPlugin_Hypothesis_i::SetEnforcedVertexGroupName(CORBA::Double x, CORBA::Double y, CORBA::Double z, const char* groupName)
+ throw (SALOME::SALOME_Exception)
+{
+ ASSERT(myBaseImpl);
+ MESSAGE("ENGINE : SetEnforcedVertexGroupName START ");
+ try {
+ this->GetImpl()->SetEnforcedVertexGroupName(x, y, z, groupName);
+ }
+ catch (const std::invalid_argument& ex) {
+ SALOME::ExceptionStruct ExDescription;
+ ExDescription.text = ex.what();
+ ExDescription.type = SALOME::BAD_PARAM;
+ ExDescription.sourceFile = "BLSURFPlugin_Hypothesis::SetEnforcedVertexGroupName(x,y,z)";
+ ExDescription.lineNumber = 1170;
+ throw SALOME::SALOME_Exception(ExDescription);
+ }
+ catch (SALOME_Exception& ex) {
+ THROW_SALOME_CORBA_EXCEPTION( ex.what() ,SALOME::BAD_PARAM );
+ }
+
+ SMESH::TPythonDump() << _this() << ".SetEnforcedVertexGroupName("
+ << x << ", " << y << ", " << z << ", '" << groupName << "' )";
+
+ MESSAGE("ENGINE : SetEnforcedVertexGroupName END ");
+}
+*/
///////////////////////
// ENFORCED VERTEXES //
///////////////////////
- BLSURFPlugin::TEnforcedVertexMap* GetAllEnforcedVertices();
- void ClearAllEnforcedVertices();
+ BLSURFPlugin::TEntryEnfVertexListMap* GetAllEnforcedVertices();
+ void ClearAllEnforcedVertices();
/*!
* Set/get/unset an enforced vertex on geom object
*/
- void SetEnforcedVertex(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception);
-// void SetEnforcedVertexList(GEOM::GEOM_Object_ptr GeomObj, const BLSURFPlugin::TEnforcedVertexList& vertexList) throw (SALOME::SALOME_Exception);
- BLSURFPlugin::TEnforcedVertexList* GetEnforcedVertices(GEOM::GEOM_Object_ptr GeomObj) throw (SALOME::SALOME_Exception);
- void UnsetEnforcedVertex(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception);
-// void UnsetEnforcedVertexList(GEOM::GEOM_Object_ptr GeomObj, BLSURFPlugin::TEnforcedVertexList& vertexList) throw (SALOME::SALOME_Exception);
- void UnsetEnforcedVertices(GEOM::GEOM_Object_ptr GeomObj) throw (SALOME::SALOME_Exception);
+ void SetEnforcedVertex(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double x, CORBA::Double y, CORBA::Double z)
+ throw (SALOME::SALOME_Exception);
+ /* TODO GROUPS
+ void SetEnforcedVertexWithGroup(GEOM::GEOM_Object_ptr GeomObj,
+ CORBA::Double x, CORBA::Double y, CORBA::Double z,
+ const char* groupName)
+ throw (SALOME::SALOME_Exception);
+ */
+// void SetEnforcedVertexList(GEOM::GEOM_Object_ptr GeomObj, const BLSURFPlugin::TEnfVertexList& vertexList)
+// throw (SALOME::SALOME_Exception);
+
+ BLSURFPlugin::TEnfVertexList* GetEnforcedVertices(GEOM::GEOM_Object_ptr GeomObj)
+ throw (SALOME::SALOME_Exception);
+
+ void UnsetEnforcedVertex(GEOM::GEOM_Object_ptr GeomObj, CORBA::Double x, CORBA::Double y, CORBA::Double z)
+ throw (SALOME::SALOME_Exception);
+
+// void UnsetEnforcedVertexList(GEOM::GEOM_Object_ptr GeomObj, BLSURFPlugin::TEnfVertexList& vertexList)
+// throw (SALOME::SALOME_Exception);
+
+ void UnsetEnforcedVertices(GEOM::GEOM_Object_ptr GeomObj)
+ throw (SALOME::SALOME_Exception);
/*!
* Set/get/unset an enforced vertex on geom object given by entry
*/
- void SetEnforcedVertexEntry(const char* entry, double x, double y, double z) throw (SALOME::SALOME_Exception);
-// void SetEnforcedVertexListEntry(const char* entry, BLSURFPlugin::TEnforcedVertexList& vertexList) throw (SALOME::SALOME_Exception);
- BLSURFPlugin::TEnforcedVertexList* GetEnforcedVerticesEntry(const char* entry) throw (SALOME::SALOME_Exception);
- void UnsetEnforcedVertexEntry(const char* entry, CORBA::Double x, CORBA::Double y, CORBA::Double z) throw (SALOME::SALOME_Exception);
-// void UnsetEnforcedVertexListEntry(const char* entry, BLSURFPlugin::TEnforcedVertexList& vertexList) throw (SALOME::SALOME_Exception);
- void UnsetEnforcedVerticesEntry(const char* entry) throw (SALOME::SALOME_Exception);
+ void SetEnforcedVertexEntry(const char* entry, CORBA::Double x, CORBA::Double y, CORBA::Double z)
+ throw (SALOME::SALOME_Exception);
+ /* TODO GROUPS
+ void SetEnforcedVertexEntryWithGroup(const char* entry, CORBA::Double x, CORBA::Double y, CORBA::Double z,
+ const char* groupName)
+ throw (SALOME::SALOME_Exception);
+ */
+// void SetEnforcedVertexListEntry(const char* entry, BLSURFPlugin::TEnfVertexList& vertexList)
+// throw (SALOME::SALOME_Exception);
+
+ BLSURFPlugin::TEnfVertexList* GetEnforcedVerticesEntry(const char* entry)
+ throw (SALOME::SALOME_Exception);
+
+ void UnsetEnforcedVertexEntry(const char* entry, CORBA::Double x, CORBA::Double y, CORBA::Double z)
+ throw (SALOME::SALOME_Exception);
+// void UnsetEnforcedVertexListEntry(const char* entry, BLSURFPlugin::TEnfVertexList& vertexList)
+// throw (SALOME::SALOME_Exception);
+ void UnsetEnforcedVerticesEntry(const char* entry)
+ 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);
+ */
///////////////////////
// Get implementation
// ---
//
#include "BLSURFPluginGUI_HypothesisCreator.h"
+// #include <DlgBlSurfHyp_Enforced.h>
#include <SMESHGUI_Utils.h>
#include <SMESHGUI_HypothesesUtils.h>
#include <SMESHGUI_Dialog.h>
+#include "SMESHGUI_SpinBox.h"
#include <SUIT_Session.h>
#include <SUIT_MessageBox.h>
#include <SUIT_ResourceMgr.h>
#include <SalomeApp_Tools.h>
-#include <SalomeApp_DoubleSpinBox.h>
#include <QComboBox>
#include <QLabel>
#include <TopoDS_Shape.hxx>
#include <SMESH_Gen_i.hxx>
#include <boost/shared_ptr.hpp>
+#include <boost/algorithm/string.hpp>
#include <structmember.h>
-// #include <GeomSelectionTools.h>
#define WITH_SIZE_BOUNDARIES
enum Topology {
SMP_ENTRY_COLUMN = 0,
SMP_NAME_COLUMN,
SMP_SIZEMAP_COLUMN,
- SMP_NB_COLUMNS
+ SMP_NB_COLUMNS,
+// Enforced vertices array columns
+ ENF_VER_NAME_COLUMN = 0,
+ ENF_VER_ENTRY_COLUMN,
+ ENF_VER_X_COLUMN,
+ ENF_VER_Y_COLUMN,
+ ENF_VER_Z_COLUMN,
+// ENF_VER_GROUP_COLUMN,
+ ENF_VER_NB_COLUMNS
};
enum {
SMP_SURFACE_BTN,
SMP_SEPARATOR2,
SMP_REMOVE_BTN,
+ SMP_NB_LINES
};
// Enforced vertices inputs
enum {
- ENF_VER_BTNS = 0,
+// ENF_VER_FACE = 0,
+// ENF_VER_VERTEX,
ENF_VER_X_COORD = 0,
ENF_VER_Y_COORD,
ENF_VER_Z_COORD,
+// ENF_VER_GROUP,
ENF_VER_VERTEX_BTN,
- ENF_VER_SEPARATOR,
ENF_VER_REMOVE_BTN,
-};
-
-// Enforced vertices array columns
-enum {
- ENF_VER_NAME_COLUMN = 0,
- ENF_VER_ENTRY_COLUMN,
- ENF_VER_X_COLUMN,
- ENF_VER_Y_COLUMN,
- ENF_VER_Z_COLUMN,
- ENF_VER_NB_COLUMNS
+// ENF_VER_SEPARATOR,
+// ENF_VER_GROUP_CHECK,
+ ENF_VER_NB_LINES
};
const QStyleOptionViewItem & option ,
const QModelIndex & index ) const
{
- QLineEdit *editor = new QLineEdit(parent);
+// QLineEdit *editor = new QLineEdit(parent);
if (index.column() == ENF_VER_X_COLUMN || \
index.column() == ENF_VER_Y_COLUMN || \
index.column() == ENF_VER_Z_COLUMN)
- editor->setValidator(new QDoubleValidator(parent));
+ {
+ SMESHGUI_SpinBox *editor = new SMESHGUI_SpinBox(parent);
+ editor->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
+ return editor;
+ }
+// editor->setValidator(new QDoubleValidator(parent));
+ else
+ {
+ QLineEdit *editor = new QLineEdit(parent);
+ return editor;
+ }
- return editor;
+// return editor;
}
void EnforcedTreeWidgetDelegate::setEditorData(QWidget *editor,
const QModelIndex &index) const
{
QString value = index.model()->data(index, Qt::EditRole).toString();
-
- QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
- lineEdit->setText(value);
+ if (index.column() == ENF_VER_X_COLUMN || \
+ index.column() == ENF_VER_Y_COLUMN || \
+ index.column() == ENF_VER_Z_COLUMN) {
+ SMESHGUI_SpinBox *lineEdit = static_cast<SMESHGUI_SpinBox*>(editor);
+ lineEdit->setText(value);
+// lineEdit->editor()->setText(value);
+ }
+ else {
+ QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
+ lineEdit->setText(value);
+ }
}
void EnforcedTreeWidgetDelegate::setModelData(QWidget *editor, QAbstractItemModel *model,
const QModelIndex &index) const
{
- QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
+// QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
if (index.column() == ENF_VER_X_COLUMN || \
index.column() == ENF_VER_Y_COLUMN || \
index.column() == ENF_VER_Z_COLUMN)
{
- if (! vertexExists(model, index, lineEdit->text())) {
- bool ok;
- double value = lineEdit->text().toDouble(&ok);
- if (ok)
- model->setData(index, value, Qt::EditRole);
+ SMESHGUI_SpinBox *lineEdit = static_cast<SMESHGUI_SpinBox*>(editor);
+ if (! vertexExists(model, index, lineEdit->GetString())) {
+ model->setData(index, lineEdit->GetValue(), Qt::EditRole);
}
}
else if (index.column() == ENF_VER_NAME_COLUMN) {
+ QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
QString value = lineEdit->text();
- if (! vertexExists(model, index, value))
+ if (! vertexExists(model, index, value)) {
model->setData(index, value, Qt::EditRole);
+ }
+// MESSAGE("Value " << value.toString().toStdString() << " was set at index(" << index.row() << "," << index.column() << ")");
+ }
+ /* TODO GROUPS
+ else if (index.column() == ENF_VER_GROUP_COLUMN) {
+ QLineEdit *lineEdit = static_cast<QLineEdit*>(editor);
+ model->setData(index, lineEdit->text(), Qt::EditRole);
// MESSAGE("Value " << value.toString().toStdString() << " was set at index(" << index.row() << "," << index.column() << ")");
}
+ */
}
void EnforcedTreeWidgetDelegate::updateEditorGeometry(QWidget *editor,
{
MESSAGE("BLSURFPluginGUI_HypothesisCreator::checkParams");
bool ok = true;
- if ( !isDouble( myPhySize->text(), false )) {
- if ( myPhySize->text().isEmpty() )
- myPhySize->setText(tr("OBLIGATORY_VALUE"));
- myPhySize->selectAll();
- ok = false;
- }
- if ( !isDouble( myPhyMin->text(), true )) {
- myPhyMin->selectAll();
- ok = false;
- }
- if ( !isDouble( myPhyMax->text(), true )) {
- myPhyMax->selectAll();
- ok = false;
- }
- if ( !isDouble( myGeoMin->text(), true )) {
- myGeoMin->selectAll();
- ok = false;
- }
- if ( !isDouble( myGeoMin->text(), true )) {
- myGeoMin->selectAll();
- ok = false;
- }
+// if ( !isDouble( myPhySize->text(), false )) {
+// if ( myPhySize->text().isEmpty() )
+// myPhySize->setText(tr("OBLIGATORY_VALUE"));
+// myPhySize->selectAll();
+// ok = false;
+// }
+// if ( !isDouble( myPhyMin->text(), true )) {
+// myPhyMin->selectAll();
+// ok = false;
+// }
+// if ( !isDouble( myPhyMax->text(), true )) {
+// myPhyMax->selectAll();
+// ok = false;
+// }
+// if ( !isDouble( myGeoMin->text(), true )) {
+// myGeoMin->selectAll();
+// ok = false;
+// }
+// if ( !isDouble( myGeoMin->text(), true )) {
+// myGeoMin->selectAll();
+// ok = false;
+// }
if ( ok )
{
myOptionTable->setFocus();
QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
{
MESSAGE("BLSURFPluginGUI_HypothesisCreator::buildFrame");
+
QFrame* fr = new QFrame( 0 );
QVBoxLayout* lay = new QVBoxLayout( fr );
lay->setMargin( 5 );
aStdLayout->setSpacing( 6 );
aStdLayout->setMargin( 11 );
- int row = 0;
myName = 0;
- if( isCreation() ) {
- aStdLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), myStdGroup ), row, 0, 1, 1 );
+ if( isCreation() )
myName = new QLineEdit( myStdGroup );
- aStdLayout->addWidget( myName, row++, 1, 1, 1 );
- }
- aStdLayout->addWidget( new QLabel( tr( "BLSURF_GRADATION" ), myStdGroup ), row, 0, 1, 1 );
- myGradation = new SalomeApp_DoubleSpinBox( myStdGroup );
- aStdLayout->addWidget( myGradation, row++, 1, 1, 1 );
- myGradation->setMinimum( 1.1 );
- myGradation->setMaximum( 2.5 );
- myGradation->setSingleStep( 0.1 );
+ myGradation = new SMESHGUI_SpinBox( myStdGroup );
+ myGradation->RangeStepAndValidator(1.1, 2.5, 0.1, "length_precision");
- aStdLayout->addWidget( new QLabel( tr( "BLSURF_PHY_MESH" ), myStdGroup ), row, 0, 1, 1 );
myPhysicalMesh = new QComboBox( myStdGroup );
- aStdLayout->addWidget( myPhysicalMesh, row++, 1, 1, 1 );
QStringList physicalTypes;
physicalTypes << tr( "BLSURF_DEFAULT_USER" ) << tr( "BLSURF_CUSTOM_USER" ) << tr( "BLSURF_SIZE_MAP");
myPhysicalMesh->addItems( physicalTypes );
- aStdLayout->addWidget( new QLabel( tr( "BLSURF_HPHYDEF" ), myStdGroup), row, 0, 1, 1 );
- myPhySize = new QLineEdit( myStdGroup );
- aStdLayout->addWidget( myPhySize, row++, 1, 1, 1 );
+ myPhySize = new SMESHGUI_SpinBox( myStdGroup );
+ myPhySize->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
#ifdef WITH_SIZE_BOUNDARIES
- aStdLayout->addWidget( new QLabel( tr( "BLSURF_HPHYMIN" ), myStdGroup ), row, 0, 1, 1 );
- myPhyMin = new QLineEdit( myStdGroup );
- aStdLayout->addWidget( myPhyMin, row++, 1, 1, 1 );
-
- aStdLayout->addWidget( new QLabel( tr( "BLSURF_HPHYMAX" ), myStdGroup ), row, 0, 1, 1 );
- myPhyMax = new QLineEdit( myStdGroup );
- aStdLayout->addWidget( myPhyMax, row++, 1, 1, 1 );
+ myPhyMin = new SMESHGUI_SpinBox( myStdGroup );
+ myPhyMin->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
+ myPhyMin->setText("");
+ myPhyMax = new SMESHGUI_SpinBox( myStdGroup );
+ myPhyMax->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
+ myPhyMax->setText("");
#endif
- aStdLayout->addWidget( new QLabel( tr( "BLSURF_GEOM_MESH" ), myStdGroup ), row, 0, 1, 1 );
myGeometricMesh = new QComboBox( myStdGroup );
- aStdLayout->addWidget( myGeometricMesh, row++, 1, 1, 1 );
QStringList types;
types << tr( "BLSURF_DEFAULT_GEOM" ) << tr( "BLSURF_CUSTOM_GEOM" );
myGeometricMesh->addItems( types );
- aStdLayout->addWidget( new QLabel( tr( "BLSURF_ANGLE_MESH_S" ), myStdGroup ), row, 0, 1, 1 );
- myAngleMeshS = new SalomeApp_DoubleSpinBox( myStdGroup );
- aStdLayout->addWidget( myAngleMeshS, row++, 1, 1, 1 );
- myAngleMeshS->setMinimum( 0 );
- myAngleMeshS->setMaximum( 16 );
- myAngleMeshS->setSingleStep( 0.5 );
+ myAngleMeshS = new SMESHGUI_SpinBox( myStdGroup );
+ myAngleMeshS->RangeStepAndValidator(0, 16, 0.5, "angular_precision");
- aStdLayout->addWidget( new QLabel( tr( "BLSURF_ANGLE_MESH_C" ), myStdGroup ), row, 0, 1, 1 );
- myAngleMeshC = new SalomeApp_DoubleSpinBox( myStdGroup );
- aStdLayout->addWidget( myAngleMeshC, row++, 1, 1, 1 );
- myAngleMeshC->setMinimum( 0 );
- myAngleMeshC->setMaximum( 16 );
- myAngleMeshC->setSingleStep( 0.5 );
+ myAngleMeshC = new SMESHGUI_SpinBox( myStdGroup );
+ myAngleMeshC->RangeStepAndValidator(0, 16, 0.5, "angular_precision");
#ifdef WITH_SIZE_BOUNDARIES
- aStdLayout->addWidget( new QLabel( tr( "BLSURF_HGEOMIN" ), myStdGroup ), row, 0, 1, 1 );
- myGeoMin = new QLineEdit( myStdGroup );
- aStdLayout->addWidget( myGeoMin, row++, 1, 1, 1 );
-
- aStdLayout->addWidget( new QLabel( tr( "BLSURF_HGEOMAX" ), myStdGroup ), row, 0, 1, 1 );
- myGeoMax = new QLineEdit( myStdGroup );
- aStdLayout->addWidget( myGeoMax, row++, 1, 1, 1 );
+ myGeoMin = new SMESHGUI_SpinBox( myStdGroup );
+ myGeoMin->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
+ myGeoMin->setText("");
+ myGeoMax = new SMESHGUI_SpinBox( myStdGroup );
+ myGeoMax->RangeStepAndValidator(0, COORD_MAX, 10.0, "length_precision");
+ myGeoMax->setText("");
#endif
-
myAllowQuadrangles = new QCheckBox( tr( "BLSURF_ALLOW_QUADRANGLES" ), myStdGroup );
- aStdLayout->addWidget( myAllowQuadrangles, row++, 0, 1, 2 );
-
myDecimesh = new QCheckBox( tr( "BLSURF_DECIMESH" ), myStdGroup );
- aStdLayout->addWidget( myDecimesh, row++, 0, 1, 2 );
+
+ // ADD WIDGETS (STANDARD TAB)
+ int row = 0;
+ if( isCreation() ) {
+ aStdLayout->addWidget( new QLabel( tr( "SMESH_NAME" ), myStdGroup ), row, 0, 1, 1 );
+ aStdLayout->addWidget( myName, row++, 1, 1, 1 );
+ }
+ aStdLayout->addWidget( new QLabel( tr( "BLSURF_GRADATION" ), myStdGroup ), row, 0, 1, 1 );
+ aStdLayout->addWidget( myGradation, row++, 1, 1, 1 );
+ aStdLayout->addWidget( new QLabel( tr( "BLSURF_PHY_MESH" ), myStdGroup ), row, 0, 1, 1 );
+ aStdLayout->addWidget( myPhysicalMesh, row++, 1, 1, 1 );
+ aStdLayout->addWidget( new QLabel( tr( "BLSURF_HPHYDEF" ), myStdGroup), row, 0, 1, 1 );
+ aStdLayout->addWidget( myPhySize, row++, 1, 1, 1 );
+#ifdef WITH_SIZE_BOUNDARIES
+ aStdLayout->addWidget( new QLabel( tr( "BLSURF_HPHYMIN" ), myStdGroup ), row, 0, 1, 1 );
+ aStdLayout->addWidget( myPhyMin, row++, 1, 1, 1 );
+ aStdLayout->addWidget( new QLabel( tr( "BLSURF_HPHYMAX" ), myStdGroup ), row, 0, 1, 1 );
+ aStdLayout->addWidget( myPhyMax, row++, 1, 1, 1 );
+#endif
+ aStdLayout->addWidget( new QLabel( tr( "BLSURF_GEOM_MESH" ), myStdGroup ), row, 0, 1, 1 );
+ aStdLayout->addWidget( myGeometricMesh, row++, 1, 1, 1 );
+ aStdLayout->addWidget( new QLabel( tr( "BLSURF_ANGLE_MESH_S" ), myStdGroup ), row, 0, 1, 1 );
+ aStdLayout->addWidget( myAngleMeshS, row++, 1, 1, 1 );
+ aStdLayout->addWidget( new QLabel( tr( "BLSURF_ANGLE_MESH_C" ), myStdGroup ), row, 0, 1, 1 );
+ aStdLayout->addWidget( myAngleMeshC, row++, 1, 1, 1 );
+#ifdef WITH_SIZE_BOUNDARIES
+ aStdLayout->addWidget( new QLabel( tr( "BLSURF_HGEOMIN" ), myStdGroup ), row, 0, 1, 1 );
+ aStdLayout->addWidget( myGeoMin, row++, 1, 1, 1 );
+ aStdLayout->addWidget( new QLabel( tr( "BLSURF_HGEOMAX" ), myStdGroup ), row, 0, 1, 1 );
+ aStdLayout->addWidget( myGeoMax, row++, 1, 1, 1 );
+#endif
+ aStdLayout->addWidget( myAllowQuadrangles, row++, 0, 1, 2 );
+ aStdLayout->addWidget( myDecimesh, row++, 0, 1, 2 );
// advanced parameters
myAdvGroup = new QWidget();
QGridLayout* anAdvLayout = new QGridLayout( myAdvGroup );
anAdvLayout->setSpacing( 6 );
anAdvLayout->setMargin( 11 );
+ anAdvLayout->setRowStretch( 4, 5 );
+ anAdvLayout->setColumnStretch( 1, 5 );
- anAdvLayout->addWidget( new QLabel( tr( "BLSURF_TOPOLOGY" ), myAdvGroup ), 0, 0, 1, 1 );
myTopology = new QComboBox( myAdvGroup );
- anAdvLayout->addWidget( myTopology, 0, 1, 1, 1 );
QStringList topologyTypes;
topologyTypes << tr( "BLSURF_TOPOLOGY_CAD" ) << tr( "BLSURF_TOPOLOGY_PROCESS" ) << tr( "BLSURF_TOPOLOGY_PROCESS2" );
myTopology->addItems( topologyTypes );
- anAdvLayout->addWidget( new QLabel( tr( "BLSURF_VERBOSITY" ), myAdvGroup ), 1, 0, 1, 1 );
myVerbosity = new QSpinBox( myAdvGroup );
- anAdvLayout->addWidget( myVerbosity, 1, 1, 1, 1 );
myVerbosity->setMinimum( 0 );
myVerbosity->setMaximum( 100 );
myVerbosity->setSingleStep( 5 );
myOptionTable = new QTableWidget( 0, NB_COLUMNS, myAdvGroup );
- anAdvLayout->addWidget( myOptionTable, 2, 0, 3, 2 );
QStringList headers;
headers << tr( "OPTION_ID_COLUMN" ) << tr( "OPTION_NAME_COLUMN" ) << tr( "OPTION_VALUE_COLUMN" );
myOptionTable->setHorizontalHeaderLabels( headers );
//myOptionTable->setSelectionBehavior( QAbstractItemView::SelectRows );
QPushButton* addBtn = new QPushButton( tr( "ADD_OPTION"), myAdvGroup );
- anAdvLayout->addWidget( addBtn, 2, 2, 1, 1 );
addBtn->setMenu( new QMenu() );
-
QPushButton* rmBtn = new QPushButton( tr( "REMOVE_OPTION"), myAdvGroup );
- anAdvLayout->addWidget( rmBtn, 3, 2, 1, 1 );
+
+
+ // ADD WIDGETS (ADVANCED TAB)
+ anAdvLayout->addWidget( new QLabel( tr( "BLSURF_TOPOLOGY" ), myAdvGroup ), 0, 0, 1, 1 );
+ anAdvLayout->addWidget( myTopology, 0, 1, 1, 1 );
+ anAdvLayout->addWidget( new QLabel( tr( "BLSURF_VERBOSITY" ), myAdvGroup ), 1, 0, 1, 1 );
+ anAdvLayout->addWidget( myVerbosity, 1, 1, 1, 1 );
+ anAdvLayout->addWidget( myOptionTable, 2, 0, 3, 2 );
+ anAdvLayout->addWidget( addBtn, 2, 2, 1, 1 );
+ anAdvLayout->addWidget( rmBtn, 3, 2, 1, 1 );
- anAdvLayout->setRowStretch( 4, 5 );
- anAdvLayout->setColumnStretch( 1, 5 );
// Size Maps parameters
QGridLayout* anSmpLayout = new QGridLayout(mySmpGroup);
mySizeMapTable = new QTableWidget( 0, SMP_NB_COLUMNS, mySmpGroup );
- anSmpLayout->addWidget(mySizeMapTable, 1, 0, 8, 1);
QStringList sizeMapHeaders;
sizeMapHeaders << tr( "SMP_ENTRY_COLUMN" )<< tr( "SMP_NAME_COLUMN" ) << tr( "SMP_SIZEMAP_COLUMN" );
mySizeMapTable->setHorizontalHeaderLabels(sizeMapHeaders);
mySizeMapTable->horizontalHeader()->hideSection( SMP_ENTRY_COLUMN );
mySizeMapTable->horizontalHeader()->setResizeMode(QHeaderView::Interactive);
-// mySizeMapTable->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
mySizeMapTable->resizeColumnToContents(SMP_NAME_COLUMN);
mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
mySizeMapTable->setAlternatingRowColors(true);
mySizeMapTable->verticalHeader()->hide();
-
/*
addAttractorButton = new QPushButton(tr("BLSURF_SM_ATTRACTOR"),mySmpGroup);
- anSmpLayout->addWidget(addAttractorButton, SMP_ATTRACTOR_BTN, 1, 1, 1);
-
QFrame *line = new QFrame(mySmpGroup);
line->setFrameShape(QFrame::HLine);
line->setFrameShadow(QFrame::Sunken);
- anSmpLayout->addWidget(line, SMP_SEPARATOR1, 1, 1, 1);
*/
addSurfaceButton = new QPushButton(tr("BLSURF_SM_SURFACE"),mySmpGroup);
- anSmpLayout->addWidget(addSurfaceButton, SMP_SURFACE_BTN, 1, 1, 1);
-
addEdgeButton = new QPushButton(tr("BLSURF_SM_EDGE"),mySmpGroup);
- anSmpLayout->addWidget(addEdgeButton, SMP_EDGE_BTN, 1, 1, 1);
-
addPointButton = new QPushButton(tr("BLSURF_SM_POINT"),mySmpGroup);
- anSmpLayout->addWidget(addPointButton, SMP_POINT_BTN, 1, 1, 1);
-
QFrame *line2 = new QFrame(mySmpGroup);
line2->setFrameShape(QFrame::HLine);
line2->setFrameShadow(QFrame::Sunken);
- anSmpLayout->addWidget(line2, SMP_SEPARATOR2, 1, 1, 1);
-
removeButton = new QPushButton(tr("BLSURF_SM_REMOVE"),mySmpGroup);
- anSmpLayout->addWidget(removeButton, SMP_REMOVE_BTN, 1, 1, 1);
+
+
+ // ADD WIDGETS (SIZEMAP TAB)
+ anSmpLayout->addWidget(mySizeMapTable, SMP_POINT_BTN, 0, SMP_NB_LINES+1, 1);
+// anSmpLayout->addWidget(addAttractorButton, SMP_ATTRACTOR_BTN, 1, 1, 1);
+// anSmpLayout->addWidget(line, SMP_SEPARATOR1, 1, 1, 1);
+ anSmpLayout->addWidget(addPointButton, SMP_POINT_BTN, 1, 1, 1);
+ anSmpLayout->addWidget(addEdgeButton, SMP_EDGE_BTN, 1, 1, 1);
+ anSmpLayout->addWidget(addSurfaceButton, SMP_SURFACE_BTN, 1, 1, 1);
+ anSmpLayout->addWidget(line2, SMP_SEPARATOR2, 1, 1, 1);
+ anSmpLayout->addWidget(removeButton, SMP_REMOVE_BTN, 1, 1, 1);
- // Enforced vertices parameters
+ // Enforced vertices parameters
myEnfGroup = new QWidget();
QGridLayout* anEnfLayout = new QGridLayout(myEnfGroup);
-
+//
+// myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced(myEnfGroup);
+// anEnfLayout->addWidget(myEnforcedVertexWidget);
+// MESSAGE("Creating DlgBlSurfHyp_Enforced widget instance");
+// myEnforcedVertexWidget = new DlgBlSurfHyp_Enforced();
+
myEnforcedTreeWidget = new QTreeWidget(myEnfGroup);
myEnforcedTreeWidget->setColumnCount( ENF_VER_NB_COLUMNS );
myEnforcedTreeWidget->setSortingEnabled(true);
QStringList enforcedHeaders;
- enforcedHeaders << tr("BLSURF_ENF_VER_NAME_COLUMN") << tr("BLSURF_ENF_VER_ENTRY_COLUMN") << tr( "BLSURF_ENF_VER_X_COLUMN" )<< tr( "BLSURF_ENF_VER_Y_COLUMN" ) << tr( "BLSURF_ENF_VER_Z_COLUMN" ) ;
+ enforcedHeaders << tr("BLSURF_ENF_VER_NAME_COLUMN") << tr("BLSURF_ENF_VER_ENTRY_COLUMN") << tr( "BLSURF_ENF_VER_X_COLUMN" )<< tr( "BLSURF_ENF_VER_Y_COLUMN" ) << tr( "BLSURF_ENF_VER_Z_COLUMN" );
+ /* TODO GROUPS
+ enforcedHeaders << tr("BLSURF_ENF_VER_NAME_COLUMN") << tr("BLSURF_ENF_VER_ENTRY_COLUMN") << tr( "BLSURF_ENF_VER_X_COLUMN" )<< tr( "BLSURF_ENF_VER_Y_COLUMN" ) << tr( "BLSURF_ENF_VER_Z_COLUMN" ) << tr( "BLSURF_ENF_VER_GROUP_COLUMN" );
+ */
myEnforcedTreeWidget->setHeaderLabels(enforcedHeaders);
myEnforcedTreeWidget->setAlternatingRowColors(true);
myEnforcedTreeWidget->setUniformRowHeights(true);
}
myEnforcedTreeWidget->hideColumn(ENF_VER_ENTRY_COLUMN);
myEnforcedTreeWidget->setItemDelegate(new EnforcedTreeWidgetDelegate());
- anEnfLayout->addWidget(myEnforcedTreeWidget, 0, 0, 8, 1);
+ /* TODO FACE AND VERTEX SELECTION
+ selectFaceButton = new QPushButton(myEnfGroup);
+ QPixmap imageSel1(SUIT_Session::session()->resourceMgr()->loadPixmap( "BLSURFPlugin", tr( "BLSURF_ICON_SELECT")));
+ selectFaceButton->setIcon(imageSel1);
+
+ mySelectedFace = new QLineEdit(myEnfGroup);
+ mySelectedFace->setReadOnly(true);
+ mySelectedFace->setText(tr( "BLSURF_ENF_SELECT_FACE"));
+ mySelectedFace->setStyleSheet("QLineEdit { color: grey }");
+
+ selectVertexButton = new QPushButton(myEnfGroup);
+ QPixmap imageSel2(SUIT_Session::session()->resourceMgr()->loadPixmap( "BLSURFPlugin", tr( "BLSURF_ICON_SELECT")));
+ selectVertexButton->setIcon(imageSel2);
+
+ mySelectedEnforcedVertex = new QLineEdit(myEnfGroup);
+ mySelectedEnforcedVertex->setReadOnly(true);
+ mySelectedEnforcedVertex->setText(tr( "BLSURF_ENF_SELECT_VERTEX"));
+ mySelectedEnforcedVertex->setStyleSheet("QLineEdit { color: grey }");
+ */
QLabel* myXCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_X_LABEL" ), myEnfGroup );
- anEnfLayout->addWidget(myXCoordLabel, ENF_VER_X_COORD, 1, 1, 1);
- myXCoord = new QLineEdit(myEnfGroup);
- myXCoord->setValidator(new QDoubleValidator(myEnfGroup));
- anEnfLayout->addWidget(myXCoord, ENF_VER_X_COORD, 2, 1, 1);
+ myXCoord = new SMESHGUI_SpinBox(myEnfGroup);
+ myXCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
QLabel* myYCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_Y_LABEL" ), myEnfGroup );
- anEnfLayout->addWidget(myYCoordLabel, ENF_VER_Y_COORD, 1, 1, 1);
- myYCoord = new QLineEdit(myEnfGroup);
- myYCoord->setValidator(new QDoubleValidator(myEnfGroup));
- anEnfLayout->addWidget(myYCoord, ENF_VER_Y_COORD, 2, 1, 1);
+ myYCoord = new SMESHGUI_SpinBox(myEnfGroup);
+ myYCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
QLabel* myZCoordLabel = new QLabel( tr( "BLSURF_ENF_VER_Z_LABEL" ), myEnfGroup );
- anEnfLayout->addWidget(myZCoordLabel, ENF_VER_Z_COORD, 1, 1, 1);
- myZCoord = new QLineEdit(myEnfGroup);
- myZCoord->setValidator(new QDoubleValidator(myEnfGroup));
- anEnfLayout->addWidget(myZCoord, ENF_VER_Z_COORD, 2, 1, 1);
+ myZCoord = new SMESHGUI_SpinBox(myEnfGroup);
+ myZCoord->RangeStepAndValidator(COORD_MIN, COORD_MAX, 10.0, "length_precision");
+ /* TODO GROUPS
+ QLabel* myGroupNameLabel = new QLabel( tr( "BLSURF_ENF_VER_GROUP_LABEL" ), myEnfGroup );
+ myGroupName = new QLineEdit(myEnfGroup);
+ */
+
addVertexButton = new QPushButton(tr("BLSURF_ENF_VER_VERTEX"),myEnfGroup);
- anEnfLayout->addWidget(addVertexButton, ENF_VER_VERTEX_BTN, 1, 1, 2);
-
- QFrame *line = new QFrame(myEnfGroup);
- line->setFrameShape(QFrame::HLine);
- line->setFrameShadow(QFrame::Sunken);
- anEnfLayout->addWidget(line, ENF_VER_SEPARATOR, 1, 1, 2);
-
+// QFrame *line = new QFrame(myEnfGroup);
+// line->setFrameShape(QFrame::HLine);
+// line->setFrameShadow(QFrame::Sunken);
removeVertexButton = new QPushButton(tr("BLSURF_ENF_VER_REMOVE"),myEnfGroup);
- anEnfLayout->addWidget(removeVertexButton, ENF_VER_REMOVE_BTN, 1, 1, 2);
+ /* TODO GROUPS
+ // CheckBox for groups generation
+ makeGroupsCheck = new QGroupBox(tr("BLSURF_ENF_VER_GROUPS"), myEnfGroup);
+ makeGroupsCheck->setCheckable(true);
+ makeGroupsCheck->setChecked(false);
+ QGridLayout* aGroupLayout = new QGridLayout(makeGroupsCheck);
+ myGlobalGroupName = new QLineEdit(makeGroupsCheck);
+ aGroupLayout->addWidget(myGlobalGroupName);
+ */
+
+
+ anEnfLayout->addWidget(myEnforcedTreeWidget, 0, 0, ENF_VER_NB_LINES+1, 1);
+ /* TODO FACE AND VERTEX SELECTION
+ anEnfLayout->addWidget(selectFaceButton, ENF_VER_FACE, 1, 1, 1);
+ anEnfLayout->addWidget(mySelectedFace, ENF_VER_FACE, 2, 1, 1);
+ anEnfLayout->addWidget(selectVertexButton, ENF_VER_VERTEX, 1, 1, 1);
+ anEnfLayout->addWidget(mySelectedEnforcedVertex, ENF_VER_VERTEX, 2, 1, 1);
+ */
+ anEnfLayout->addWidget(myXCoordLabel, ENF_VER_X_COORD, 1, 1, 1);
+ anEnfLayout->addWidget(myXCoord, ENF_VER_X_COORD, 2, 1, 1);
+ anEnfLayout->addWidget(myYCoordLabel, ENF_VER_Y_COORD, 1, 1, 1);
+ anEnfLayout->addWidget(myYCoord, ENF_VER_Y_COORD, 2, 1, 1);
+ anEnfLayout->addWidget(myZCoordLabel, ENF_VER_Z_COORD, 1, 1, 1);
+ anEnfLayout->addWidget(myZCoord, ENF_VER_Z_COORD, 2, 1, 1);
+ /* TODO GROUPS
+ anEnfLayout->addWidget(myGroupNameLabel, ENF_VER_GROUP, 1, 1, 1);
+ anEnfLayout->addWidget(myGroupName, ENF_VER_GROUP, 2, 1, 1);
+ */
+ anEnfLayout->addWidget(addVertexButton, ENF_VER_VERTEX_BTN, 1, 1, 2);
+ anEnfLayout->addWidget(removeVertexButton, ENF_VER_REMOVE_BTN, 1, 1, 2);
+// anEnfLayout->addWidget(line, ENF_VER_SEPARATOR, 1, 1, 2);
+ /* TODO GROUPS
+ anEnfLayout->addWidget(makeGroupsCheck, ENF_VER_GROUP_CHECK, 1, 1, 2);
+ */
+
// ---
tab->insertTab( STD_TAB, myStdGroup, tr( "SMESH_ARGUMENTS" ) );
tab->insertTab( ADV_TAB, myAdvGroup, tr( "BLSURF_ADV_ARGS" ) );
tab->insertTab( SMP_TAB, mySmpGroup, tr( "BLSURF_SIZE_MAP" ) );
tab->insertTab( ENF_TAB, myEnfGroup, tr( "BLSURF_ENF_VER" ) );
+// tab->insertTab( ENF_TAB, myEnforcedVertexWidget, tr( "BLSURF_ENF_VER" ) );
tab->setCurrentIndex( STD_TAB );
QVariant y = item->data(ENF_VER_Y_COLUMN, Qt::EditRole);
QVariant z = item->data(ENF_VER_Z_COLUMN, Qt::EditRole);
QVariant vertexName = item->data(ENF_VER_NAME_COLUMN, Qt::EditRole);
+ /* TODO GROUPS
+ QString groupName = item->data(ENF_VER_GROUP_COLUMN, Qt::EditRole).toString();
+ */
QTreeWidgetItem* parent = item->parent();
if (parent) {
toolTip += QString(")");
item->setToolTip(ENF_VER_NAME_COLUMN,toolTip);
}
-
- myXCoord->setText(x.toString());
- myYCoord->setText(y.toString());
- myZCoord->setText(z.toString());
+ myXCoord->SetValue(x.toDouble());
+ myYCoord->SetValue(y.toDouble());
+ myZCoord->SetValue(z.toDouble());
+ /* TODO GROUPS
+ myGroupName->setText(groupName);
+ */
}
}
/** BLSURFPluginGUI_HypothesisCreator::synchronizeCoords()
-This method synchronizes the QLineEdit widgets content with the coordinates
+This method synchronizes the QLineEdit/SMESHGUI_SpinBox widgets content with the coordinates
of the enforced vertex clicked in the tree widget.
*/
void BLSURFPluginGUI_HypothesisCreator::synchronizeCoords() {
if (! x.isNull()) {
QVariant y = item->data(ENF_VER_Y_COLUMN, Qt::EditRole);
QVariant z = item->data(ENF_VER_Z_COLUMN, Qt::EditRole);
- myXCoord->setText(x.toString());
- myYCoord->setText(y.toString());
- myZCoord->setText(z.toString());
+ myXCoord->SetValue(x.toDouble());
+ myYCoord->SetValue(y.toDouble());
+ myZCoord->SetValue(z.toDouble());
+ /* TODO GROUPS
+ myGroupName->setText(item->data(ENF_VER_GROUP_COLUMN, Qt::EditRole).toString());
+ */
break;
}
}
/** 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(std::string entry, std::string shapeName, double x, double y, double z) {
+/* TODO GROUPS
+void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(std::string entry, std::string shapeName,
+ double x, double y, double z, std::string groupName) {
+*/
+void BLSURFPluginGUI_HypothesisCreator::addEnforcedVertex(std::string entry, std::string shapeName,
+ double x, double y, double z) {
// Find entry item
QList<QTreeWidgetItem* > theItemList = myEnforcedTreeWidget->findItems(QString(entry.c_str()),Qt::MatchExactly,ENF_VER_ENTRY_COLUMN);
QTreeWidgetItem* theItem;
// MESSAGE("Number of child rows: " << nbVert);
if (nbVert >0) {
double childValueX,childValueY,childValueZ;
+// QString childGrouName;
QTreeWidgetItem* child;
for (int row = 0;row<nbVert;row++) {
child = theItem->child(row);
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)) {
+ /* TODO GROUPS
+ // update group name
+ child->setData(ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
+ */
okToCreate = false;
break;
}
vertexItem->setData( ENF_VER_X_COLUMN, Qt::EditRole, QVariant(x) );
vertexItem->setData( ENF_VER_Y_COLUMN, Qt::EditRole, QVariant(y) );
vertexItem->setData( ENF_VER_Z_COLUMN, Qt::EditRole, QVariant(z) );
+ /* TODO GROUPS
+ vertexItem->setData( ENF_VER_GROUP_COLUMN, Qt::EditRole, QVariant(groupName.c_str()));
+ */
QString toolTip = QString(shapeName.c_str())+QString(": ")+vertexName;
toolTip += QString(" (%1, ").arg(x);
toolTip += QString("%1, ").arg(y);
myEnforcedTreeWidget->setCurrentItem(vertexItem,ENF_VER_NAME_COLUMN);
}
else
- MESSAGE("In " << shapeName << " vertex with coords " << x << ", " << y << ", " << z<< " already exist: dont create again");
+ /* TODO GROUPS
+ MESSAGE("In " << shapeName << " vertex with coords " << x << ", " << y << ", " << z <<
+ " already exist: dont create again, only group name is updated with " << groupName);
+ */
+ MESSAGE("In " << shapeName << " vertex with coords " << x << ", " << y << ", " << z << " already exist: dont create again");
}
/** BLSURFPluginGUI_HypothesisCreator::onAddEnforcedVertices()
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
- if ((myXCoord->text().isEmpty()) || (myYCoord->text().isEmpty()) || (myZCoord->text().isEmpty())) return;
-
- double x = myXCoord->text().toDouble();
- double y = myYCoord->text().toDouble();
- double z = myZCoord->text().toDouble();
+ if ((myXCoord->text().isEmpty()) ||
+ (myYCoord->text().isEmpty()) ||
+ (myZCoord->text().isEmpty())) return;
+
+ double x = myXCoord->GetValue();
+ double y = myYCoord->GetValue();
+ double z = myZCoord->GetValue();
+
+ /* TODO GROUPS
+ std::string groupName = myGroupName->text().toStdString();
+ if (makeGroupsCheck->isChecked())
+ groupName = myGlobalGroupName->text().toStdString();
+
+ if (boost::trim_copy(groupName) == "")
+ groupName = "";
+ */
TopAbs_ShapeEnum shapeType;
string entry, shapeName;
shapeType = myGeomToolSelected->entryToShapeType(entry);
// MESSAGE("Object Name = " << shapeName << "& Type is " << anObject->getComponentDataType() << " & ShapeType is " << shapeType);
if (shapeType == TopAbs_FACE) {
+ /* TODO GROUPS
+ addEnforcedVertex(entry, shapeName, x, y, z, groupName);
+ */
addEnforcedVertex(entry, shapeName, x, y, z);
}
}
}
myTopology->setCurrentIndex( data.myTopology );
myPhysicalMesh->setCurrentIndex( data.myPhysicalMesh );
- myPhySize->setText( data.myPhySize );
+ myPhySize->SetValue( data.myPhySize );
#ifdef WITH_SIZE_BOUNDARIES
- myPhyMin->setText( data.myPhyMin );
- myPhyMax->setText( data.myPhyMax );
- myGeoMin->setText( data.myGeoMin );
- myGeoMax->setText( data.myGeoMax );
+ MESSAGE("data.myPhyMin: "<<data.myPhyMin)
+ if (data.myPhyMin < 0)
+ myPhyMin->setText("");
+ else
+ myPhyMin->SetValue( data.myPhyMin );
+ MESSAGE("data.myPhyMax: "<<data.myPhyMax)
+ if (data.myPhyMax < 0)
+ myPhyMax->setText("");
+ else
+ myPhyMax->SetValue( data.myPhyMax );
+ MESSAGE("data.myGeoMin: "<<data.myGeoMin)
+ if (data.myGeoMin < 0)
+ myGeoMin->setText("");
+ else
+ myGeoMin->SetValue( data.myGeoMin );
+ MESSAGE("data.myGeoMax: "<<data.myGeoMax)
+ if (data.myGeoMax < 0)
+ myGeoMax->setText("");
+ else
+ myGeoMax->SetValue( data.myGeoMax );
#endif
myGeometricMesh->setCurrentIndex( data.myGeometricMesh );
- myAngleMeshS->setValue( data.myAngleMeshS );
- myAngleMeshC->setValue( data.myAngleMeshC );
- myGradation->setValue( data.myGradation );
+// myAngleMeshS->setValue( data.myAngleMeshS );
+// myAngleMeshC->setValue( data.myAngleMeshC );
+// myGradation->setValue( data.myGradation );
+ myAngleMeshS->SetValue( data.myAngleMeshS );
+ myAngleMeshC->SetValue( data.myAngleMeshC );
+ myGradation->SetValue( data.myGradation );
myAllowQuadrangles->setChecked( data.myAllowQuadrangles );
myDecimesh->setChecked( data.myDecimesh );
myVerbosity->setValue( data.myVerbosity );
mySizeMapTable->resizeColumnToContents(SMP_SIZEMAP_COLUMN);
// Enforced vertices
-// MESSAGE("retrieveParams(): data.enfVertMap.size() = " << data.enfVertMap.size());
- std::map<std::string, std::set<std::vector<double> > >::const_iterator evmIt = data.enfVertMap.begin();
- for ( ; evmIt != data.enfVertMap.end() ; ++evmIt) {
+// MESSAGE("retrieveParams(): data.entryEnfVertexListMap.size() = " << data.entryEnfVertexListMap.size());
+ std::map<std::string, std::set<std::vector<double> > >::const_iterator evmIt = data.entryEnfVertexListMap.begin();
+ for ( ; evmIt != data.entryEnfVertexListMap.end() ; ++evmIt) {
std::string entry = (*evmIt).first;
std::string shapeName = myGeomToolSelected->getNameFromEntry(entry);
x = (*evsIt)[0];
y = (*evsIt)[1];
z = (*evsIt)[2];
+ /* TODO GROUPS
+ std::string groupName = data.enfVertexGroupNameMap[(*evsIt)];
+ MESSAGE("Vertex "<<x<<" "<<y<<" "<<z<<" has group name "<<groupName);
+ that->addEnforcedVertex(entry, shapeName, x, y, z, groupName);
+ */
that->addEnforcedVertex(entry, shapeName, x, y, z);
}
}
h_data.myTopology = (int) h->GetTopology();
h_data.myPhysicalMesh = (int) h->GetPhysicalMesh();
- h_data.myPhySize = QString::number( h->GetPhySize() );
+ h_data.myPhySize = h->GetPhySize();
h_data.myGeometricMesh = (int) h->GetGeometricMesh();
h_data.myAngleMeshS = h->GetAngleMeshS();
h_data.myAngleMeshC = h->GetAngleMeshC();
double PhyMax = h->GetPhyMax();
double GeoMin = h->GetGeoMin();
double GeoMax = h->GetGeoMax();
- if ( PhyMin > 0 )
- h_data.myPhyMin = PhyMin > 0 ? QString::number( h->GetPhyMin() ) : QString("");
- h_data.myPhyMax = PhyMax > 0 ? QString::number( h->GetPhyMax() ) : QString("");
- h_data.myGeoMin = GeoMin > 0 ? QString::number( h->GetGeoMin() ) : QString("");
- h_data.myGeoMax = GeoMax > 0 ? QString::number( h->GetGeoMax() ) : QString("");
+// if ( PhyMin > 0 )
+// h_data.myPhyMin = PhyMin > 0 ? QString::number( h->GetPhyMin() ) : QString("");
+// h_data.myPhyMax = PhyMax > 0 ? QString::number( h->GetPhyMax() ) : QString("");
+// h_data.myGeoMin = GeoMin > 0 ? QString::number( h->GetGeoMin() ) : QString("");
+// h_data.myGeoMax = GeoMax > 0 ? QString::number( h->GetGeoMax() ) : QString("");
+ h_data.myPhyMin = PhyMin > 0 ? PhyMin : -1.0;
+ h_data.myPhyMax = PhyMax > 0 ? PhyMax : -1.0;
+ h_data.myGeoMin = GeoMin > 0 ? GeoMin : -1.0;
+ h_data.myGeoMax = GeoMax > 0 ? GeoMax : -1.0;
#endif
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
}
// Enforced vertices
- BLSURFPlugin::TEnforcedVertexMap_var enforcedVertexMap = h->GetAllEnforcedVertices();
-// MESSAGE("enforcedVertexMap->length() = " << enforcedVertexMap->length());
+ h_data.enfVertexList.clear();
+ h_data.entryEnfVertexListMap.clear();
+ /* TODO GROUPS
+ h_data.groupNameEnfVertexListMap.clear();
+// h_data.enfVertexGroupNameMap.clear();
+ */
- for ( int i = 0;i<enforcedVertexMap->length(); ++i ) {
- std::string entry = enforcedVertexMap[i].entry.in();
-// BLSURFPlugin::TEnforcedVertexList_var vertexList = enforcedVertexMap[i].vertexList;
- BLSURFPlugin::TEnforcedVertexList vertexList = enforcedVertexMap[i].vertexList;
+ BLSURFPlugin::TEntryEnfVertexListMap_var entryEnfVertexListMap = h->GetAllEnforcedVertices();
+// MESSAGE("entryEnfVertexListMap->length() = " << entryEnfVertexListMap->length());
+
+ for ( int i = 0;i<entryEnfVertexListMap->length(); ++i ) {
+ std::string entry = entryEnfVertexListMap[i].entry.in();
+ BLSURFPlugin::TEnfVertexList_var vertexList = h->GetEnforcedVerticesEntry(entry.c_str());
std::set<std::vector<double> > evs;
- for (int j=0 ; j<vertexList.length(); ++j) {
+ /* TODO GROUPS
+ std::string groupName = "";
+ */
+ for (int j=0 ; j<vertexList->length(); ++j) {
double x = vertexList[j][0];
double y = vertexList[j][1];
double z = vertexList[j][2];
ev.push_back(y);
ev.push_back(z);
evs.insert(ev);
+ h_data.enfVertexList.insert(ev);
+ /* TODO GROUPS
+ groupName.assign(h->GetEnforcedVertexGroupName(x, y, z));
+ MESSAGE("readParamsFromHypo, groupName = "<<groupName)
+ h_data.enfVertexGroupNameMap[ev] = groupName;
+ if (groupName != "") {
+ h_data.groupNameEnfVertexListMap[groupName].insert(ev);
+ }
+ */
// MESSAGE("New enf vertex for entry " << entry << ": " << x << ", " << y << ", " << z);
}
- h_data.enfVertMap[entry] = evs;
+// h_data.enfVertMap[entry] = evs;
+ h_data.entryEnfVertexListMap[entry] = evs;
if (evs.size() == 0) {
// MESSAGE("No enf vertex for entry " << entry << ": key is erased");
- h_data.enfVertMap.erase(entry);
+// h_data.enfVertMap.erase(entry);
+ h_data.entryEnfVertexListMap.erase(entry);
}
}
h->SetVerbosity( h_data.myVerbosity );
if( ((int) h_data.myPhysicalMesh == PhysicalUserDefined)||((int) h_data.myPhysicalMesh == SizeMap) ) {
- if ( h->GetPhySize() != h_data.myPhySize.toDouble() )
- h->SetPhySize( h_data.myPhySize.toDouble() );
+ if ( h->GetPhySize() != h_data.myPhySize )
+ h->SetPhySize( h_data.myPhySize );
}
if( (int) h_data.myGeometricMesh == UserDefined ) {
if ( h->GetAngleMeshS() != h_data.myAngleMeshS )
h->SetAngleMeshC( h_data.myAngleMeshC );
}
#ifdef WITH_SIZE_BOUNDARIES
- if ( !isDouble( h_data.myPhyMin ))
- h->SetPhyMin( -1 );
- else if ( h->GetPhyMin() != h_data.myPhyMin.toDouble() )
- h->SetPhyMin( h_data.myPhyMin.toDouble() );
- if ( !isDouble( h_data.myPhyMax ))
- h->SetPhyMax( -1 );
- else if ( h->GetPhyMax() != h_data.myPhyMax.toDouble() )
- h->SetPhyMax( h_data.myPhyMax.toDouble() );
- if ( !isDouble( h_data.myGeoMin ))
- h->SetGeoMin( -1 );
- else if ( h->GetGeoMin() != h_data.myGeoMin.toDouble() )
- h->SetGeoMin( h_data.myGeoMin.toDouble() );
- if ( !isDouble( h_data.myGeoMax ))
- h->SetGeoMax( -1 );
- else if ( h->GetGeoMax() != h_data.myGeoMax.toDouble() )
- h->SetGeoMax( h_data.myGeoMax.toDouble() );
+// if ( !isDouble( h_data.myPhyMin ))
+// h->SetPhyMin( -1 );
+// else if ( h->GetPhyMin() != h_data.myPhyMin.toDouble() )
+// h->SetPhyMin( h_data.myPhyMin.toDouble() );
+// if ( !isDouble( h_data.myPhyMax ))
+// h->SetPhyMax( -1 );
+// else if ( h->GetPhyMax() != h_data.myPhyMax.toDouble() )
+// h->SetPhyMax( h_data.myPhyMax.toDouble() );
+// if ( !isDouble( h_data.myGeoMin ))
+// h->SetGeoMin( -1 );
+// else if ( h->GetGeoMin() != h_data.myGeoMin.toDouble() )
+// h->SetGeoMin( h_data.myGeoMin.toDouble() );
+// if ( !isDouble( h_data.myGeoMax ))
+// h->SetGeoMax( -1 );
+// else if ( h->GetGeoMax() != h_data.myGeoMax.toDouble() )
+// h->SetGeoMax( h_data.myGeoMax.toDouble() );
+ if (h_data.myPhyMin > 0)
+ h->SetPhyMin( h_data.myPhyMin );
+ if (h_data.myPhyMax > 0)
+ h->SetPhyMax( h_data.myPhyMax );
+ if (h_data.myGeoMin > 0)
+ h->SetGeoMin( h_data.myGeoMin );
+ if (h_data.myGeoMax > 0)
+ h->SetGeoMax( h_data.myGeoMax );
#endif
//printf("storeParamsToHypo():myOptions->length()=%d\n",myOptions->length());
}
// Enforced vertices
- std::map<std::string, std::set<std::vector<double> > >::const_iterator evmIt = h_data.enfVertMap.begin();
- for ( ; evmIt != h_data.enfVertMap.end() ; ++evmIt) {
+ std::map<std::string, std::set<std::vector<double> > >::const_iterator evmIt = h_data.entryEnfVertexListMap.begin();
+ for ( ; evmIt != h_data.entryEnfVertexListMap.end() ; ++evmIt) {
std::string entry = evmIt->first;
std::set<std::vector<double> > evs;
std::set<std::vector<double> >::const_iterator evsIt;
double x, y, z;
- BLSURFPlugin::TEnforcedVertexList_var hypVertexList;
+ /* TODO GROUPS
+ std::string groupName = "";
+ */
+ BLSURFPlugin::TEnfVertexList_var hypVertexList;
int hypNbVertex = 0;
try {
hypVertexList = h->GetEnforcedVerticesEntry(entry.c_str());
x = (*evsIt)[0];
y = (*evsIt)[1];
z = (*evsIt)[2];
+
+ /* TODO GROUPS
+ std::map<std::vector<double> , std::string >::const_iterator grpIt = h_data.enfVertexGroupNameMap.find(*evsIt);
+ if (grpIt != h_data.enfVertexGroupNameMap.end())
+ groupName = grpIt->second;
// MESSAGE("SetEnforcedVertexEntry("<<entry<<", "<<x<<", "<<y<<", "<<z<<")");
+ h->SetEnforcedVertexEntryWithGroup( entry.c_str(), x, y, z, groupName.c_str() );
+ */
h->SetEnforcedVertexEntry( entry.c_str(), x, y, z );
}
// Remove old vertices
h_data.myName = myName ? myName->text() : "";
h_data.myTopology = myTopology->currentIndex();
h_data.myPhysicalMesh = myPhysicalMesh->currentIndex();
- h_data.myPhySize = myPhySize->text();
+ h_data.myPhySize = myPhySize->GetValue();
#ifdef WITH_SIZE_BOUNDARIES
- h_data.myPhyMin = myPhyMin->text();
- h_data.myPhyMax = myPhyMax->text();
- h_data.myGeoMin = myGeoMin->text();
- h_data.myGeoMax = myGeoMax->text();
+ h_data.myPhyMin = myPhyMin->GetValue();
+ h_data.myPhyMax = myPhyMax->GetValue();
+ h_data.myGeoMin = myGeoMin->GetValue();
+ h_data.myGeoMax = myGeoMax->GetValue();
#endif
h_data.myGeometricMesh = myGeometricMesh->currentIndex();
- h_data.myAngleMeshS = myAngleMeshS->value();
- h_data.myAngleMeshC = myAngleMeshC->value();
- h_data.myGradation = myGradation->value();
+ h_data.myAngleMeshS = myAngleMeshS->GetValue();
+ h_data.myAngleMeshC = myAngleMeshC->GetValue();
+ h_data.myGradation = myGradation->GetValue();
h_data.myAllowQuadrangles = myAllowQuadrangles->isChecked();
h_data.myDecimesh = myDecimesh->isChecked();
h_data.myVerbosity = myVerbosity->value();
QString guiHyp;
guiHyp += tr("BLSURF_TOPOLOGY") + " = " + QString::number( h_data.myTopology ) + "; ";
guiHyp += tr("BLSURF_PHY_MESH") + " = " + QString::number( h_data.myPhysicalMesh ) + "; ";
- guiHyp += tr("BLSURF_HPHYDEF") + " = " + h_data.myPhySize + "; ";
+ guiHyp += tr("BLSURF_HPHYDEF") + " = " + QString::number( h_data.myPhySize ) + "; ";
guiHyp += tr("BLSURF_GEOM_MESH") + " = " + QString::number( h_data.myGeometricMesh ) + "; ";
guiHyp += tr("BLSURF_ANGLE_MESH_S") + " = " + QString::number( h_data.myAngleMeshS ) + "; ";
guiHyp += tr("BLSURF_GRADATION") + " = " + QString::number( h_data.myGradation ) + "; ";
guiHyp += tr("BLSURF_ALLOW_QUADRANGLES") + " = " + QString(h_data.myAllowQuadrangles ? "yes" : "no") + "; ";
guiHyp += tr("BLSURF_DECIMESH") + " = " + QString(h_data.myDecimesh ? "yes" : "no") + "; ";
#ifdef WITH_SIZE_BOUNDARIES
- if ( isDouble( h_data.myPhyMin )) guiHyp += "hphymin = " + h_data.myPhyMin + "; ";
- if ( isDouble( h_data.myPhyMax )) guiHyp += "hphymax = " + h_data.myPhyMax + "; ";
- if ( isDouble( h_data.myGeoMin )) guiHyp += "hgeomin = " + h_data.myGeoMin + "; ";
- if ( isDouble( h_data.myGeoMax )) guiHyp += "hgeomax = " + h_data.myGeoMax + "; ";
+ guiHyp += "hphymin = " + QString::number( h_data.myPhyMin ) + "; ";
+ guiHyp += "hphymax = " + QString::number( h_data.myPhyMax ) + "; ";
+ guiHyp += "hgeomin = " + QString::number( h_data.myGeoMin ) + "; ";
+ guiHyp += "hgeomax = " + QString::number( h_data.myGeoMax ) + "; ";
#endif
BLSURFPluginGUI_HypothesisCreator* that = (BLSURFPluginGUI_HypothesisCreator*)this;
}
// Enforced vertices
- // h_data.enfVertMap
-
+ h_data.enfVertexList.clear();
+ h_data.entryEnfVertexListMap.clear();
+ /* TODO GROUPS
+ h_data.groupNameEnfVertexListMap.clear();
+ h_data.enfVertexGroupNameMap.clear();
+ */
+
int nbEnforcedShapes = myEnforcedTreeWidget->topLevelItemCount();
int nbEnforcedVertices = 0;
+ std::string groupName = "";
// MESSAGE("Nb of enforced shapes: " << nbEnforcedShapes);
for (int i=0 ; i<nbEnforcedShapes ; i++) {
QTreeWidgetItem* shapeItem = myEnforcedTreeWidget->topLevelItem(i);
vertex.push_back(childValueY);
vertex.push_back(childValueZ);
evs.insert(vertex);
+ h_data.enfVertexList.insert(vertex);
+ /* TODO GROUPS
+ groupName = child->data(ENF_VER_GROUP_COLUMN,Qt::EditRole).toString().toStdString();
+ // Group
+ if (makeGroupsCheck->isChecked())
+ groupName = myGlobalGroupName->text().toStdString();
+ h_data.enfVertexGroupNameMap[vertex] = groupName;
+ if (groupName != "")
+ h_data.groupNameEnfVertexListMap[groupName].insert(vertex);
+ */
}
- h_data.enfVertMap[entry] = evs;
+ h_data.entryEnfVertexListMap[entry] = evs;
}
}
}
myPhyMin->setEnabled(isCustom);
if ( !myGradation->isEnabled())
- myGradation->setValue( 1.1 );
+// myGradation->setValue( 1.1 );
+ myGradation->SetValue( 1.1 );
if ( !isCustom ) {
- QString aPhySize = "";
- switch( myPhysicalMesh->currentIndex() ) {
- case DefaultSize:
- default:
- aPhySize = "10";
- break;
- }
- myPhySize->setText( aPhySize );
- if ( !isDouble( myPhyMin->text(), true ))
- myPhyMin->setText("");
- if ( !isDouble( myPhyMax->text(), true ))
- myPhyMax->setText("");
+// QString aPhySize = "";
+// switch( myPhysicalMesh->currentIndex() ) {
+// case DefaultSize:
+// default:
+// aPhySize = "10";
+// break;
+// }
+// myPhySize->setText( aPhySize );
+// if ( !isDouble( myPhyMin->text(), true ))
+// myPhyMin->setText("");
+// if ( !isDouble( myPhyMax->text(), true ))
+// myPhyMax->setText("");
if ( myGeometricMesh->currentIndex() == DefaultGeom ) {
myGeometricMesh->setCurrentIndex( UserDefined );
onGeometricMeshChanged();
myGeoMin->setEnabled(isCustom);
if ( !myGradation->isEnabled())
- myGradation->setValue( 1.1 );
+ myGradation->SetValue( 1.1 );
if ( ! isCustom ) {
- double aAngleMeshS;
- switch( myGeometricMesh->currentIndex() ) {
- case DefaultGeom:
- default:
- aAngleMeshS = 8;
- break;
- }
- myAngleMeshS->setValue( aAngleMeshS );
- myAngleMeshC->setValue( aAngleMeshS );
- if ( !isDouble( myGeoMin->text(), true ))
- myGeoMin->setText("");
- if ( !isDouble( myGeoMax->text(), true ))
- myGeoMax->setText("");
+// double aAngleMeshS;
+// switch( myGeometricMesh->currentIndex() ) {
+// case DefaultGeom:
+// default:
+// aAngleMeshS = 8;
+// break;
+// }
+// myAngleMeshS->SetValue( aAngleMeshS );
+// myAngleMeshC->SetValue( aAngleMeshS );
+// if ( !isDouble( myGeoMin->text(), true ))
+// myGeoMin->setText("");
+// if ( !isDouble( myGeoMax->text(), true ))
+// myGeoMax->setText("");
// hphy_flag = 0 and hgeo_flag = 0 is not allowed (spec)
if ( myPhysicalMesh->currentIndex() == DefaultSize ) {
myPhysicalMesh->setCurrentIndex( PhysicalUserDefined );
class QAction;
class QTreeWidgetItem;
-class SalomeApp_DoubleSpinBox;
+class SMESHGUI_SpinBox;
class LightApp_SelectionMgr;
+// class DlgBlSurfHyp_Enforced;
typedef struct
{
int myTopology, myVerbosity;
int myPhysicalMesh, myGeometricMesh;
double myAngleMeshS, myAngleMeshC, myGradation;
- QString myPhySize, myGeoMin, myGeoMax, myPhyMin,myPhyMax;
+ double myPhySize, myGeoMin, myGeoMax, myPhyMin,myPhyMax;
bool myAllowQuadrangles, myDecimesh,mySmpsurface,mySmpedge,mySmppoint,myEnforcedVertex;
- std::map<std::string, std::set<std::vector<double> > > enfVertMap;
+ std::set<std::vector<double> > enfVertexList;
+ std::map<std::string, std::set<std::vector<double> > > entryEnfVertexListMap;
+ /* TODO GROUPS
+ std::map<std::string, std::set<std::vector<double> > > groupNameEnfVertexListMap;
+ std::map<std::vector<double> , std::string > enfVertexGroupNameMap;
+ */
QString myName;
} BlsurfHypothesisData;
void onRemoveMap();
void onSetSizeMap(int,int);
+ /* TODO GROUPS
+ void addEnforcedVertex(std::string, std::string, double, double, double, std::string);
+ */
void addEnforcedVertex(std::string, std::string, double, double, double);
void onAddEnforcedVertices();
void onRemoveEnforcedVertex();
QWidget* myStdGroup;
QLineEdit* myName;
QComboBox* myPhysicalMesh;
- QLineEdit* myPhySize;
- QLineEdit* myPhyMin;
- QLineEdit* myPhyMax;
+ SMESHGUI_SpinBox* myPhySize;
+ SMESHGUI_SpinBox* myPhyMin;
+ SMESHGUI_SpinBox* myPhyMax;
QComboBox* myGeometricMesh;
- SalomeApp_DoubleSpinBox* myAngleMeshS;
- SalomeApp_DoubleSpinBox* myAngleMeshC;
- QLineEdit* myGeoMin;
- QLineEdit* myGeoMax;
- SalomeApp_DoubleSpinBox* myGradation;
+ SMESHGUI_SpinBox* myAngleMeshS;
+ SMESHGUI_SpinBox* myAngleMeshC;
+ SMESHGUI_SpinBox* myGeoMin;
+ SMESHGUI_SpinBox* myGeoMax;
+ SMESHGUI_SpinBox* myGradation;
QCheckBox* myAllowQuadrangles;
QCheckBox* myDecimesh;
QPushButton *removeButton;
QWidget* myEnfGroup;
+ /* TODO FACE AND VERTEX SELECTION
+ QPushButton* selectFaceButton;
+ QLineEdit* mySelectedFace;
+// GEOM::GEOM_Object_var myEnfFace;
+ QPushButton* selectVertexButton;
+ QLineEdit* mySelectedEnforcedVertex;
+// GEOM::GEOM_Object_var myEnfVertex;
+ */
+// DlgBlSurfHyp_Enforced* myEnforcedVertexWidget;
QTreeWidget* myEnforcedTreeWidget;
- QLineEdit* myXCoord;
- QLineEdit* myYCoord;
- QLineEdit* myZCoord;
+ SMESHGUI_SpinBox* myXCoord;
+ SMESHGUI_SpinBox* myYCoord;
+ SMESHGUI_SpinBox* myZCoord;
+ /* TODO GROUPS
+ QLineEdit* myGroupName;
+ QGroupBox* makeGroupsCheck;
+ QLineEdit* myGlobalGroupName;
+ */
QPushButton* addVertexButton;
QPushButton* removeVertexButton;
<TS version="1.1" >
<context>
<name>@default</name>
+ <message>
+ <source>BLSURF_ICON_SELECT</source>
+ <translation>mesh_select_BLSURF.png</translation>
+ </message>
<message>
<source>ICON_DLG_BLSURF_PARAMETERS</source>
<translation>mesh_hypo_BLSURF.png</translation>
<source>BLSURF_ENF_VER_Z_COLUMN</source>
<translation>Z</translation>
</message>
+ <message>
+ <source>BLSURF_ENF_VER_GROUP_COLUMN</source>
+ <translation>Group</translation>
+ </message>
+ <message>
+ <source>BLSURF_ENF_SELECT_FACE</source>
+ <translation>Select a face</translation>
+ </message>
+ <message>
+ <source>BLSURF_ENF_SELECT_VERTEX</source>
+ <translation>Select a vertex</translation>
+ </message>
<message>
<source>BLSURF_ENF_VER_X_LABEL</source>
<translation>X:</translation>
<source>BLSURF_ENF_VER_Z_LABEL</source>
<translation>Z:</translation>
</message>
+ <message>
+ <source>BLSURF_ENF_VER_GROUP_LABEL</source>
+ <translation>Group:</translation>
+ </message>
<message>
<source>BLSURF_ENF_VER_VERTEX</source>
<translation>Add enforced vertex</translation>
<source>BLSURF_ENF_VER_REMOVE</source>
<translation>Remove vertex</translation>
</message>
+ <message>
+ <source>BLSURF_ENF_VER_GROUPS</source>
+ <translation>Unique group</translation>
+ </message>
</context>
</TS>
</message>
<message>
<source>BLSURF_ALLOW_QUADRANGLES</source>
- <translation>Permettre les Quadrangles (Teste)</translation>
+ <translation>Permettre les Quadrangles (Test)</translation>
</message>
<message>
<source>BLSURF_ANGLE_MESH_C</source>
</message>
<message>
<source>BLSURF_TOPOLOGY_CAD</source>
- <translation>A partir de CAD</translation>
+ <translation>A partir de la CAO</translation>
</message>
<message>
<source>BLSURF_TOPOLOGY_PROCESS</source>
</message>
<message>
<source>SMP_SIZEMAP_COLUMN</source>
- <translation>Carte des tailles</translation>
+ <translation>Carte de taille</translation>
</message>
<message>
<source>BLSURF_SM_SURFACE</source>
</message>
<message>
<source>BLSURF_SM_SURF_VALUE</source>
- <translation>Valeur sur la Surface(s)</translation>
+ <translation>Taille sur la Surface</translation>
</message>
<message>
<source>BLSURF_SM_EDGE_VALUE</source>
</message>
<message>
<source>BLSURF_SM_POINT_VALUE</source>
- <translation>Taille sur le Point(s)</translation>
+ <translation>Taille sur le Point</translation>
</message>
<message>
<source>BLSURF_ENF_VER</source>
- <translation>Points Enforcés</translation>
+ <translation>Points de Passage</translation>
</message>
<message>
<source>BLSURF_ENF_VER_ENTRY_COLUMN</source>
<source>BLSURF_ENF_VER_Z_COLUMN</source>
<translation>Z</translation>
</message>
+ <message>
+ <source>BLSURF_ENF_VER_GROUP_COLUMN</source>
+ <translation>Groupe</translation>
+ </message>
+ <message>
+ <source>BLSURF_ENF_SELECT_FACE</source>
+ <translation>Sélectionner une face</translation>
+ </message>
+ <message>
+ <source>BLSURF_ENF_SELECT_VERTEX</source>
+ <translation>Sélectionner un point</translation>
+ </message>
<message>
<source>BLSURF_ENF_VER_X_LABEL</source>
<translation>X:</translation>
<source>BLSURF_ENF_VER_Z_LABEL</source>
<translation>Z:</translation>
</message>
+ <message>
+ <source>BLSURF_ENF_VER_GROUP_LABEL</source>
+ <translation>Groupe:</translation>
+ </message>
<message>
<source>BLSURF_ENF_VER_VERTEX</source>
- <translation>Ajouter un point enforcé</translation>
+ <translation>Ajouter un point de passage</translation>
</message>
<message>
<source>BLSURF_ENF_VER_REMOVE</source>
<translation>Supprimer un point</translation>
</message>
+ <message>
+ <source>BLSURF_ENF_VER_GROUPS</source>
+ <translation>Groupe unique</translation>
+ </message>
</context>
</TS>