]> SALOME platform Git repositories - plugins/blsurfplugin.git/commitdiff
Salome HOME
- Gradation usable for sizemaps
authornge <nge>
Tue, 1 Sep 2009 12:25:25 +0000 (12:25 +0000)
committernge <nge>
Tue, 1 Sep 2009 12:25:25 +0000 (12:25 +0000)
- Attractor available using ATTRACTOR(x;y;z;a;b;createNode) with:
  * x,y,z: coordinates of attractor point
  * a,b  : parameters of attractor point (see BlSurf plugin doc)
  * createNode: boolean for creation of node on projection of attractor point on surface

src/GUI/BLSURFPluginGUI_HypothesisCreator.cxx

index 4a75b4441e1f257696c9b25205d7ee7c50e5114b..36079d6aa4f0fd3ecc62a55336b54a07d494f2b5 100644 (file)
@@ -408,6 +408,13 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
     aStdLayout->addWidget( myName, row++, 1, 1, 1 );
   }
 
+  aStdLayout->addWidget( new QLabel( tr( "BLSURF_GRADATION" ), myStdGroup ), row, 0, 1, 1 );
+  myGradation = new QtxDoubleSpinBox( myStdGroup );
+  aStdLayout->addWidget( myGradation, row++, 1, 1, 1 );
+  myGradation->setMinimum( 1.1 );
+  myGradation->setMaximum( 2.5 );
+  myGradation->setSingleStep( 0.1 );
+
   aStdLayout->addWidget( new QLabel( tr( "BLSURF_PHY_MESH" ), myStdGroup ), row, 0, 1, 1 );
   myPhysicalMesh = new QComboBox( myStdGroup );
   aStdLayout->addWidget( myPhysicalMesh, row++, 1, 1, 1 );
@@ -450,13 +457,6 @@ QFrame* BLSURFPluginGUI_HypothesisCreator::buildFrame()
   myAngleMeshC->setMaximum( 16 );
   myAngleMeshC->setSingleStep( 0.5 );
 
-  aStdLayout->addWidget( new QLabel( tr( "BLSURF_GRADATION" ), myStdGroup ), row, 0, 1, 1 );
-  myGradation = new QtxDoubleSpinBox( myStdGroup );
-  aStdLayout->addWidget( myGradation, row++, 1, 1, 1 );
-  myGradation->setMinimum( 1.1 );
-  myGradation->setMaximum( 2.5 );
-  myGradation->setSingleStep( 0.1 );
-
 #ifdef WITH_SIZE_BOUNDARIES
   aStdLayout->addWidget( new QLabel( tr( "BLSURF_HGEOMIN" ), myStdGroup ), row, 0, 1, 1 );
   myGeoMin = new QLineEdit( myStdGroup );
@@ -721,7 +721,14 @@ bool BLSURFPluginGUI_HypothesisCreator::readParamsFromHypo( BlsurfHypothesisData
     if ( fullSizeMapList.count() > 1 ) {
       string fullSizeMap = fullSizeMapList[1].toStdString();
       int pos = fullSizeMap.find("return")+7;
-      QString sizeMap = QString::fromStdString(fullSizeMap.substr(pos, fullSizeMap.size()-pos));
+      MESSAGE("pos:" << pos);
+      QString sizeMap;
+      try {
+        sizeMap = QString::fromStdString(fullSizeMap.substr(pos, fullSizeMap.size()-pos));
+      }
+      catch (...) {
+        continue;
+      }
       that->mySMPMap[fullSizeMapList[0]] = sizeMap;
       MESSAGE("mySMPMap[" << fullSizeMapList[0].toStdString() << "] = " << sizeMap.toStdString());
       that->mySMPShapeTypeMap[fullSizeMapList[0]] = myGeomToolSelected->entryToShapeType(fullSizeMapList[0].toStdString());
@@ -935,11 +942,27 @@ QString BLSURFPluginGUI_HypothesisCreator::readParamsFromWidgets( BlsurfHypothes
 
 void BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged() {
   MESSAGE("BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged");
-  bool isCustom = ((myPhysicalMesh->currentIndex() == PhysicalUserDefined) || (myPhysicalMesh->currentIndex() == SizeMap)) ;
+  bool isPhysicalUserDefined = (myPhysicalMesh->currentIndex() == PhysicalUserDefined);
+  bool isSizeMap = (myPhysicalMesh->currentIndex() == SizeMap);
+  bool isCustom = (isPhysicalUserDefined || isSizeMap) ;
+  bool geomIsCustom = (myGeometricMesh->currentIndex() == UserDefined);
+  
+  myGradation->setEnabled(not isPhysicalUserDefined || geomIsCustom);
   myPhySize->setEnabled(isCustom);
   myPhyMax->setEnabled(isCustom);
   myPhyMin->setEnabled(isCustom);
 
+  if ( !isSizeMap) {
+    double gradation;
+    switch( myPhysicalMesh->currentIndex() ) {
+      case DefaultSize:
+      default:
+        gradation = 1.1;
+        break;
+    }
+    myGradation->setValue( gradation );
+  }
+      
   if ( !isCustom ) {
     QString aPhySize = "";
     switch( myPhysicalMesh->currentIndex() ) {
@@ -963,8 +986,11 @@ void BLSURFPluginGUI_HypothesisCreator::onPhysicalMeshChanged() {
 void BLSURFPluginGUI_HypothesisCreator::onGeometricMeshChanged() {
   MESSAGE("BLSURFPluginGUI_HypothesisCreator::onGeometricMeshChanged");
   bool isCustom = (myGeometricMesh->currentIndex() == UserDefined);
+  bool phyIsSizemap = (myPhysicalMesh->currentIndex() == SizeMap);
+  
   myAngleMeshS->setEnabled(isCustom);
   myAngleMeshC->setEnabled(isCustom);
+  myGradation->setEnabled(isCustom || phyIsSizemap);
   myGeoMax->setEnabled(isCustom);
   myGeoMin->setEnabled(isCustom);
 
@@ -1255,13 +1281,13 @@ bool BLSURFPluginGUI_HypothesisCreator::sizeMapValidationFromEntry(QString myEnt
   }
   else if (that->mySMPMap[myEntry].startsWith("ATTRACTOR")) {
     MESSAGE("Attractor" );
-//    if ((that->mySMPMap[myEntry].count(QRegExp("ATTRACTOR([0-9])")) != 1))
-    if ((that->mySMPMap[myEntry].count('(') != 1) or
-        (that->mySMPMap[myEntry].count(')') != 1) or
-        (that->mySMPMap[myEntry].count(';') != 4) or
-        (that->mySMPMap[myEntry].size() == 15)){
+    if ((that->mySMPMap[myEntry].count(QRegExp("^ATTRACTOR\\((?:(-?0(\\.\\d*)*|-?[1-9]+\\d*(\\.\\d*)*|-?\\.(\\d)+);){5}(True|False)\\)$")) != 1)) {
+//     if ((that->mySMPMap[myEntry].count('(') != 1) or
+//         (that->mySMPMap[myEntry].count(')') != 1) or
+//         (that->mySMPMap[myEntry].count(';') != 4) or
+//         (that->mySMPMap[myEntry].size() == 15)){
       if (displayError)
-        SUIT_MessageBox::warning( dlg(),"Definition of attractor : Error" ,"An attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b)" );
+        SUIT_MessageBox::warning( dlg(),"Definition of attractor : Error" ,"An attractor is defined with the following pattern: ATTRACTOR(xa;ya;za;a;b;True|False)" );
       return false;
     }
     return true;