From: vsv Date: Thu, 22 Aug 2019 10:04:10 +0000 (+0300) Subject: Issue #2982: Display Expression and Values for Point attributes X-Git-Tag: VEDF2019Lot4~36 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=888697a7b67cd56ec3b4f7f408741cf1299863a5;p=modules%2Fshaper.git Issue #2982: Display Expression and Values for Point attributes --- diff --git a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp index a08b1572b..d03062163 100644 --- a/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp +++ b/src/ParametersPlugin/ParametersPlugin_WidgetParamsMgr.cpp @@ -33,6 +33,9 @@ #include #include +#include +#include + #include #include @@ -374,18 +377,40 @@ QList ParametersPlugin_WidgetParamsMgr:: QStringList aValNames; aValNames << aReferenced->data()->name().c_str(); - AttributeDoublePtr aDouble = - std::dynamic_pointer_cast(aAttr); - if (aDouble.get()) { + std::string aId = aAttr->attributeType(); + if (aId == ModelAPI_AttributeDouble::typeId()) { + AttributeDoublePtr aDouble = + std::dynamic_pointer_cast(aAttr); aValNames << aDouble->text().c_str(); aValNames << QString::number(aDouble->value()); - } else { + } + else if (aId == ModelAPI_AttributeInteger::typeId()) { AttributeIntegerPtr aInt = std::dynamic_pointer_cast(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 aPnt = + std::dynamic_pointer_cast(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 aPnt = + std::dynamic_pointer_cast(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);