]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #1157: Using parameters in point coordinates
authorspo <sergey.pokhodenko@opencascade.com>
Mon, 21 Dec 2015 12:00:57 +0000 (15:00 +0300)
committerspo <sergey.pokhodenko@opencascade.com>
Tue, 22 Dec 2015 06:42:19 +0000 (09:42 +0300)
src/Config/Config_Keywords.h
src/ModuleBase/ModuleBase_WidgetDoubleValue.cpp
src/PartSet/PartSet_WidgetPoint2d.cpp
src/SketchPlugin/plugin-Sketch.xml

index 7bbeef48e5eeee31aae1f066ef35645556f82611..609d7907a211c9428ff3815fe6abb5679c038f81 100644 (file)
@@ -80,6 +80,7 @@ const static char* DOUBLE_WDG_MIN = "min";
 const static char* DOUBLE_WDG_MAX = "max";
 const static char* DOUBLE_WDG_STEP = "step";
 const static char* DOUBLE_WDG_DEFAULT_COMPUTED = "computed";
+const static char* DOUBLE_WDG_ACCEPT_EXPRESSIONS = "accept_expressions";
 // WDG_TOOLBOX/WDG_SWITCH properties
 const static char* CONTAINER_PAGE_NAME = "title";
 const static char* CONTAINER_PAGE_ICON = "icon";
index bd42f784430dfbe6bad2cc3224e5588556de7eea..141abdd39f2902731bc583403242e592988f8457 100644 (file)
@@ -45,7 +45,10 @@ ModuleBase_WidgetDoubleValue::ModuleBase_WidgetDoubleValue(QWidget* theParent,
   if (!aLabelIcon.isEmpty())
     myLabel->setPixmap(QPixmap(aLabelIcon));
 
+  bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true);
+
   mySpinBox = new ModuleBase_ParamSpinBox(this);
+  mySpinBox->setAcceptVariables(aAcceptVariables);
   QString anObjName = QString::fromStdString(attributeID());
   mySpinBox->setObjectName(anObjName);
 
index 1e9f5f6856518bbf73c3c2598405391a01bf19e0..5af914ad35e967b8fe2b14a4d347cfcff11a2c62 100644 (file)
@@ -71,6 +71,8 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent,
   myGroupBox = new QGroupBox(aPageName, theParent);
   myGroupBox->setFlat(false);
 
+  bool aAcceptVariables = theData->getBooleanAttribute(DOUBLE_WDG_ACCEPT_EXPRESSIONS, true);
+
   QGridLayout* aGroupLay = new QGridLayout(myGroupBox);
   ModuleBase_Tools::adjustMargins(aGroupLay);
   aGroupLay->setSpacing(2);
@@ -81,6 +83,7 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent,
     aGroupLay->addWidget(aLabel, 0, 0);
 
     myXSpin = new ModuleBase_ParamSpinBox(myGroupBox);
+    myXSpin->setAcceptVariables(aAcceptVariables);
     myXSpin->setMinimum(-DBL_MAX);
     myXSpin->setMaximum(DBL_MAX);
     myXSpin->setToolTip(tr("X"));
@@ -94,6 +97,7 @@ PartSet_WidgetPoint2D::PartSet_WidgetPoint2D(QWidget* theParent,
     aGroupLay->addWidget(aLabel, 1, 0);
 
     myYSpin = new ModuleBase_ParamSpinBox(myGroupBox);
+    myYSpin->setAcceptVariables(aAcceptVariables);
     myYSpin->setMinimum(-DBL_MAX);
     myYSpin->setMaximum(DBL_MAX);
     myYSpin->setToolTip(tr("Y"));
index b38f14995ab3b4afba8aa7139b91e84a26e85f4a..eaf7601d398e6225c40797422391989a8b99f129 100644 (file)
       <!--icon=":pictures/x_point.png"-->
       </feature>
       <feature id="SketchPoint" title="Point" tooltip="Create point" icon=":icons/point.png">
-        <sketch-2dpoint_selector id="PointCoordindates" title="Point" tooltip="Point coordinates"/>
+        <sketch-2dpoint_selector id="PointCoordindates" accept_expressions="0" title="Point" tooltip="Point coordinates"/>
         <boolvalue id="Auxiliary" label="Auxiliary" default="false" tooltip="Construction element" obligatory="0"/>
       </feature>
       <feature id="SketchLine" title="Line" tooltip="Create line" icon=":icons/line.png">
-        <sketch-2dpoint_selector id="StartPoint" title="Start point" tooltip="Start point coordinates" previous_feature_param="EndPoint"/>
-        <sketch-2dpoint_selector id="EndPoint" title="End point" tooltip="End point coordinates"/>
+        <sketch-2dpoint_selector id="StartPoint" accept_expressions="0" title="Start point" tooltip="Start point coordinates" previous_feature_param="EndPoint"/>
+        <sketch-2dpoint_selector id="EndPoint" accept_expressions="0" title="End point" tooltip="End point coordinates"/>
         <boolvalue id="Auxiliary" label="Auxiliary" default="false" tooltip="Construction element" obligatory="0"/>
         <validator id="GeomValidators_Different" parameters="StartPoint,EndPoint"/>
       </feature>
       <feature id="SketchCircle" title="Circle" tooltip="Create circle" icon=":icons/circle.png">
-        <sketch-2dpoint_selector id="CircleCenter" title="Center" tooltip="Center coordinates"/>
-        <point2ddistance id="CircleRadius" first_point="CircleCenter" label="Radius:" min="0" step="1.0" default="0" icon=":icons/radius.png" tooltip="Set radius">
+        <sketch-2dpoint_selector id="CircleCenter" accept_expressions="0" title="Center" tooltip="Center coordinates"/>
+        <point2ddistance id="CircleRadius" accept_expressions="0" first_point="CircleCenter" label="Radius:" min="0" step="1.0" default="0" icon=":icons/radius.png" tooltip="Set radius">
           <validator id="GeomValidators_Positive"/>
         </point2ddistance>
         <boolvalue id="Auxiliary" label="Auxiliary" default="false" tooltip="Construction element" obligatory="0"/>
       </feature>
       <feature id="SketchArc" title="Arc" tooltip="Create arc" icon=":icons/arc.png">
-        <sketch-2dpoint_selector id="ArcCenter" title="Center" tooltip="Center of a circle"/>
-        <sketch-2dpoint_selector id="ArcStartPoint" title="Start point" tooltip="Start point"/>
-        <sketch-2dpoint_selector id="ArcEndPoint" title="End point" tooltip="End point"/>
+        <sketch-2dpoint_selector id="ArcCenter" accept_expressions="0" title="Center" tooltip="Center of a circle"/>
+        <sketch-2dpoint_selector id="ArcStartPoint" accept_expressions="0" title="Start point" tooltip="Start point"/>
+        <sketch-2dpoint_selector id="ArcEndPoint" accept_expressions="0" title="End point" tooltip="End point"/>
         <boolvalue id="Auxiliary" label="Auxiliary" default="false" tooltip="Construction element" obligatory="0"/>
         <validator id="GeomValidators_Different" parameters="ArcCenter,ArcStartPoint,ArcEndPoint"/>
       </feature>
@@ -47,7 +47,7 @@
             label="Point" tooltip="Select point for fillet (should be shared by two entities only)" shape_types="vertex">
           <validator id="SketchPlugin_FilletVertexValidator"/>
         </sketch_shape_selector>
-        <doublevalue label="Radius" tooltip="Fillet arc radius" id="ConstraintValue" min="0" default="1" use_reset="false">
+        <doublevalue label="Radius" tooltip="Fillet arc radius" id="ConstraintValue" accept_expressions="0" min="0" default="1" use_reset="false">
           <validator id="GeomValidators_Positive"/>
         </doublevalue>
         <validator id="PartSet_FilletSelection"/>