From: dbv Date: Wed, 27 Jun 2018 15:06:50 +0000 (+0300) Subject: Some improvements in GUI X-Git-Tag: SHAPER_V9_1_0RC1~150 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=481c77d3cff0c7580fca0967926d2378120f6a98;p=modules%2Fshaper.git Some improvements in GUI --- diff --git a/src/ConstructionAPI/ConstructionAPI_Point.cpp b/src/ConstructionAPI/ConstructionAPI_Point.cpp index 350c8857e..fd6d468ec 100644 --- a/src/ConstructionAPI/ConstructionAPI_Point.cpp +++ b/src/ConstructionAPI/ConstructionAPI_Point.cpp @@ -128,9 +128,11 @@ void ConstructionAPI_Point::setByOffsetOnEdge(const ModelHighAPI_Selection& theE void ConstructionAPI_Point::setByProjectionOnEdge(const ModelHighAPI_Selection& theVertex, const ModelHighAPI_Selection& theEdge) { - fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION_ON_EDGE(), + fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION(), mycreationMethod); - fillAttribute(theVertex, mypoinToProjectOnEdge); + fillAttribute(ConstructionPlugin_Point::PROJECTION_TYPE_ON_EDGE(), + myprojectionType); + fillAttribute(theVertex, mypoinToProject); fillAttribute(theEdge, myedgeForPointProjection); execute(); @@ -140,9 +142,11 @@ void ConstructionAPI_Point::setByProjectionOnEdge(const ModelHighAPI_Selection& void ConstructionAPI_Point::setByProjectionOnFace(const ModelHighAPI_Selection& theVertex, const ModelHighAPI_Selection& theFace) { - fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION_ON_FACE(), + fillAttribute(ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION(), mycreationMethod); - fillAttribute(theVertex, mypoinToProjectOnFace); + fillAttribute(ConstructionPlugin_Point::PROJECTION_TYPE_ON_FACE(), + myprojectionType); + fillAttribute(theVertex, mypoinToProject); fillAttribute(theFace, myfaceForPointProjection); execute(); @@ -200,10 +204,13 @@ void ConstructionAPI_Point::dump(ModelHighAPI_Dumper& theDumper) const theDumper << ratio() << ", " << true; } theDumper << ", " << reverse()->value(); - } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION_ON_EDGE()) { - theDumper << mypoinToProjectOnEdge << ", " << myedgeForPointProjection; - } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION_ON_FACE()) { - theDumper << mypoinToProjectOnFace << ", " << myfaceForPointProjection; + } else if (aMeth == ConstructionPlugin_Point::CREATION_METHOD_BY_PROJECTION()) { + theDumper << mypoinToProject << ", "; + if (projectionType()->value() == ConstructionPlugin_Point::PROJECTION_TYPE_ON_EDGE()) { + theDumper << myedgeForPointProjection; + } else { + theDumper << myfaceForPointProjection; + } } theDumper << ")" << std::endl; diff --git a/src/ConstructionAPI/ConstructionAPI_Point.h b/src/ConstructionAPI/ConstructionAPI_Point.h index f028db192..a6145dc47 100644 --- a/src/ConstructionAPI/ConstructionAPI_Point.h +++ b/src/ConstructionAPI/ConstructionAPI_Point.h @@ -93,11 +93,11 @@ public: ModelAPI_AttributeDouble, /** Ratio */, reverse, ConstructionPlugin_Point::REVERSE(), ModelAPI_AttributeBoolean, /** Reverse */, - poinToProjectOnFace, ConstructionPlugin_Point::POINT_TO_PROJECT_ON_FACE(), - ModelAPI_AttributeSelection, /** Point to project on face */, + poinToProject, ConstructionPlugin_Point::POINT_TO_PROJECT(), + ModelAPI_AttributeSelection, /** Point to project*/, + projectionType, ConstructionPlugin_Point::PROJECTION_TYPE(), + ModelAPI_AttributeString, /** Type of the point projection */, faceForPointProjection, ConstructionPlugin_Point::FACE_FOR_POINT_PROJECTION(), - ModelAPI_AttributeSelection, /** Face for point projection */, - poinToProjectOnEdge, ConstructionPlugin_Point::POINT_TO_PROJECT_ON_EDGE(), ModelAPI_AttributeSelection, /** Point to project on edge */, edgeForPointProjection, ConstructionPlugin_Point::EDGE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection, /** Edge for point projection */) diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp index 60b0af1c5..400824b7d 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.cpp +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.cpp @@ -73,10 +73,9 @@ void ConstructionPlugin_Point::initAttributes() data()->addAttribute(RATIO(), ModelAPI_AttributeDouble::typeId()); data()->addAttribute(REVERSE(), ModelAPI_AttributeBoolean::typeId()); - data()->addAttribute(POINT_TO_PROJECT_ON_EDGE(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(POINT_TO_PROJECT(), ModelAPI_AttributeSelection::typeId()); + data()->addAttribute(PROJECTION_TYPE(), ModelAPI_AttributeString::typeId()); data()->addAttribute(EDGE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection::typeId()); - - data()->addAttribute(POINT_TO_PROJECT_ON_FACE(), ModelAPI_AttributeSelection::typeId()); data()->addAttribute(FACE_FOR_POINT_PROJECTION(), ModelAPI_AttributeSelection::typeId()); } @@ -93,10 +92,12 @@ void ConstructionPlugin_Point::execute() aShape = createByXYZ(); } else if(aCreationMethod == CREATION_METHOD_BY_DISTANCE_ON_EDGE()) { aShape = createByDistanceOnEdge(); - } else if(aCreationMethod == CREATION_METHOD_BY_PROJECTION_ON_EDGE()) { - aShape = createByProjectionOnEdge(); - } else if(aCreationMethod == CREATION_METHOD_BY_PROJECTION_ON_FACE()) { - aShape = createByProjectionOnFace(); + } else if(aCreationMethod == CREATION_METHOD_BY_PROJECTION()) { + if (string(PROJECTION_TYPE())->value() == PROJECTION_TYPE_ON_EDGE()) { + aShape = createByProjectionOnEdge(); + } else { + aShape = createByProjectionOnFace(); + } } /* else if(aCreationMethod == CREATION_METHOD_BY_LINES_INTERSECTION()) { aShape = createByLinesIntersection(); } */ else if(aCreationMethod == CREATION_METHOD_BY_LINE_AND_PLANE_INTERSECTION()) { @@ -178,7 +179,7 @@ std::shared_ptr ConstructionPlugin_Point::createByDistanceOnEdge std::shared_ptr ConstructionPlugin_Point::createByProjectionOnEdge() { // Get point. - AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT_ON_EDGE()); + AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT()); GeomShapePtr aPointShape = aPointSelection->value(); if (!aPointShape.get()) { aPointShape = aPointSelection->context()->shape(); @@ -200,7 +201,7 @@ std::shared_ptr ConstructionPlugin_Point::createByProjectionOnEd std::shared_ptr ConstructionPlugin_Point::createByProjectionOnFace() { // Get point. - AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT_ON_FACE()); + AttributeSelectionPtr aPointSelection = selection(POINT_TO_PROJECT()); GeomShapePtr aPointShape = aPointSelection->value(); if(!aPointShape.get()) { aPointShape = aPointSelection->context()->shape(); diff --git a/src/ConstructionPlugin/ConstructionPlugin_Point.h b/src/ConstructionPlugin/ConstructionPlugin_Point.h index 4be62ccde..0f4103b49 100644 --- a/src/ConstructionPlugin/ConstructionPlugin_Point.h +++ b/src/ConstructionPlugin/ConstructionPlugin_Point.h @@ -69,16 +69,9 @@ public: } /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_PROJECTION_ON_EDGE() + inline static const std::string& CREATION_METHOD_BY_PROJECTION() { - static const std::string MY_CREATION_METHOD_ID("by_projection_on_edge"); - return MY_CREATION_METHOD_ID; - } - - /// Attribute name for creation method. - inline static const std::string& CREATION_METHOD_BY_PROJECTION_ON_FACE() - { - static const std::string MY_CREATION_METHOD_ID("by_projection_on_face"); + static const std::string MY_CREATION_METHOD_ID("by_projection"); return MY_CREATION_METHOD_ID; } @@ -168,24 +161,38 @@ public: return ATTR_ID; } - /// Attribute name for point to project on edge. - inline static const std::string& POINT_TO_PROJECT_ON_EDGE() + /// Attribute name for point to projection. + inline static const std::string& POINT_TO_PROJECT() { - static const std::string ATTR_ID("point_to_project_on_edge"); + static const std::string ATTR_ID("point_to_project"); return ATTR_ID; } - /// Attribute name for edge for point projection. - inline static const std::string& EDGE_FOR_POINT_PROJECTION() + /// Attribute name for projection type. + inline static const std::string& PROJECTION_TYPE() { - static const std::string ATTR_ID("edge_for_point_projection"); + static const std::string ATTR_ID("projection_type"); return ATTR_ID; } - /// Attribute name for point to project on surface. - inline static const std::string& POINT_TO_PROJECT_ON_FACE() + /// Attribute name for projection type on edge. + inline static const std::string& PROJECTION_TYPE_ON_EDGE() { - static const std::string ATTR_ID("point_to_project_on_face"); + static const std::string ATTR_ID("projection_type_on_edge"); + return ATTR_ID; + } + + /// Attribute name for projection type on face. + inline static const std::string& PROJECTION_TYPE_ON_FACE() + { + static const std::string ATTR_ID("projection_type_on_face"); + return ATTR_ID; + } + + /// Attribute name for edge for point projection. + inline static const std::string& EDGE_FOR_POINT_PROJECTION() + { + static const std::string ATTR_ID("edge_for_point_projection"); return ATTR_ID; } diff --git a/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py b/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py index 2cc5ecf09..af44576ac 100644 --- a/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py +++ b/src/ConstructionPlugin/Test/TestPoint_ProjectOnEdge.py @@ -45,6 +45,6 @@ assert(rightPosition.isEqual(Point_2.results()[0].resultSubShapePair()[0].shape( assert (len(Point_3.results()) > 0) rightPosition = GeomAPI_Vertex(50, 50, 0) -assert(rightPosition.isEqual(Point_4.results()[0].resultSubShapePair()[0].shape())) +assert(rightPosition.isEqual(Point_3.results()[0].resultSubShapePair()[0].shape())) assert(model.checkPythonDump()) diff --git a/src/ConstructionPlugin/icons/point_by_projection_32x32.png b/src/ConstructionPlugin/icons/point_by_projection_32x32.png new file mode 100644 index 000000000..2cc179da6 Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_projection_32x32.png differ diff --git a/src/ConstructionPlugin/icons/point_by_projection_on_edge_24x24.png b/src/ConstructionPlugin/icons/point_by_projection_on_edge_24x24.png new file mode 100644 index 000000000..4364ed01d Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_projection_on_edge_24x24.png differ diff --git a/src/ConstructionPlugin/icons/point_by_projection_on_face_24x24.png b/src/ConstructionPlugin/icons/point_by_projection_on_face_24x24.png new file mode 100644 index 000000000..c16d2d0e0 Binary files /dev/null and b/src/ConstructionPlugin/icons/point_by_projection_on_face_24x24.png differ diff --git a/src/ConstructionPlugin/point_widget.xml b/src/ConstructionPlugin/point_widget.xml index 55e09a759..8fb77b2a7 100644 --- a/src/ConstructionPlugin/point_widget.xml +++ b/src/ConstructionPlugin/point_widget.xml @@ -82,40 +82,41 @@ email : webmaster.salome@opencascade.com - - + - - - - - - - - - + + + + + + + + + + +