]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Issue #2982: Display Expression and Values for Point attributes
authorvsv <vsv@opencascade.com>
Thu, 22 Aug 2019 10:04:10 +0000 (13:04 +0300)
committervsv <vsv@opencascade.com>
Thu, 22 Aug 2019 10:04:10 +0000 (13:04 +0300)
src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp

index a08b1572bd5d343b85e313cd1fdb33c99c4cec64..d03062163d77941b0130eac26b983f5a6b7e2953 100644 (file)
@@ -33,6 +33,9 @@
 #include <ModelAPI_Tools.h>
 #include <ModelAPI_Expression.h>
 
+#include <GeomDataAPI_Point.h>
+#include <GeomDataAPI_Point2D.h>
+
 #include <ModuleBase_Tools.h>
 
 #include <Events_Loop.h>
@@ -374,18 +377,40 @@ QList<QStringList> ParametersPlugin_WidgetParamsMgr::
             QStringList aValNames;
             aValNames << aReferenced->data()->name().c_str();
 
-            AttributeDoublePtr aDouble =
-              std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aAttr);
-            if (aDouble.get()) {
+            std::string aId = aAttr->attributeType();
+            if (aId == ModelAPI_AttributeDouble::typeId()) {
+              AttributeDoublePtr aDouble =
+                std::dynamic_pointer_cast<ModelAPI_AttributeDouble>(aAttr);
               aValNames << aDouble->text().c_str();
               aValNames << QString::number(aDouble->value());
-            } else {
+            }
+            else if (aId == ModelAPI_AttributeInteger::typeId()) {
               AttributeIntegerPtr aInt =
                 std::dynamic_pointer_cast<ModelAPI_AttributeInteger>(aAttr);
-              if (aInt.get()) {
-                aValNames << aInt->text().c_str();
-                aValNames << QString::number(aInt->value());
-              }
+              aValNames << aInt->text().c_str();
+              aValNames << QString::number(aInt->value());
+            }
+            else if (aId == GeomDataAPI_Point::typeId()) {
+              std::shared_ptr<GeomDataAPI_Point> aPnt =
+                std::dynamic_pointer_cast<GeomDataAPI_Point>(aAttr);
+
+              QString aExpr = QString("%1,%2,%3").arg(aPnt->textX().c_str()).
+                arg(aPnt->textY().c_str()).arg(aPnt->textZ().c_str());
+              aValNames << aExpr;
+
+              QString aRes = QString("%1,%2,%3").arg(aPnt->x()).arg(aPnt->y()).arg(aPnt->z());
+              aValNames << aRes;
+            }
+            else if (aId == GeomDataAPI_Point2D::typeId()) {
+              std::shared_ptr<GeomDataAPI_Point2D> aPnt =
+                std::dynamic_pointer_cast<GeomDataAPI_Point2D>(aAttr);
+
+              QString aExpr = QString("%1,%2").arg(aPnt->textX().c_str()).
+                arg(aPnt->textY().c_str());
+              aValNames << aExpr;
+
+              QString aRes = QString("%1,%2").arg(aPnt->x()).arg(aPnt->y());
+              aValNames << aRes;
             }
             aItemsList.append(aValNames);
             theFeatureList.append(aReferenced);