X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchAPI%2FSketchAPI_MacroEllipse.h;h=113b2e95e59996f1d9f9e82484b8f6e32897425e;hb=44b3aa1055279520a1b3d7a6a77f90bf8db5d087;hp=6f74bbc98437ac6ff86cd002151ffa40c612e1d3;hpb=d74c5f916e2c7d0eb1ee2fa128f0458c3d22675f;p=modules%2Fshaper.git diff --git a/src/SketchAPI/SketchAPI_MacroEllipse.h b/src/SketchAPI/SketchAPI_MacroEllipse.h index 6f74bbc98..113b2e95e 100644 --- a/src/SketchAPI/SketchAPI_MacroEllipse.h +++ b/src/SketchAPI/SketchAPI_MacroEllipse.h @@ -1,4 +1,4 @@ -// Copyright (C) 2014-2019 CEA/DEN, EDF R&D +// Copyright (C) 2014-2020 CEA/DEN, EDF R&D // // This library is free software; you can redistribute it and/or // modify it under the terms of the GNU Lesser General Public @@ -26,6 +26,8 @@ #include class ModelHighAPI_RefAttr; +class SketchAPI_Point; +class SketchAPI_Line; /// \class SketchAPI_MacroEllipse /// \ingroup CPPHighAPI @@ -35,7 +37,8 @@ class SketchAPI_MacroEllipse: public SketchAPI_SketchEntity public: /// Constructor without values. SKETCHAPI_EXPORT - explicit SketchAPI_MacroEllipse(const std::shared_ptr& theFeature); + explicit SketchAPI_MacroEllipse(const std::shared_ptr& theFeature, + bool callInitialize = true); /// Constructor with values. SKETCHAPI_EXPORT @@ -68,49 +71,63 @@ public: SKETCHAPI_EXPORT virtual ~SketchAPI_MacroEllipse(); - INTERFACE_9(SketchPlugin_MacroEllipse::ID(), + INTERFACE_1(SketchPlugin_MacroEllipse::ID(), ellipseType, SketchPlugin_MacroEllipse::ELLIPSE_TYPE(), - ModelAPI_AttributeString, /** Ellipse type */, - centerPoint, SketchPlugin_MacroEllipse::FIRST_POINT_ID(), - GeomDataAPI_Point2D, /** Center point */, - centerPointRef, SketchPlugin_MacroEllipse::FIRST_POINT_REF_ID(), - ModelAPI_AttributeRefAttr, /** Reference to a center point */, - majorAxisNegativePoint, SketchPlugin_MacroEllipse::FIRST_POINT_ID(), - GeomDataAPI_Point2D, /** Major axis negative point point */, - majorAxisNegativePointRef, SketchPlugin_MacroEllipse::FIRST_POINT_REF_ID(), - ModelAPI_AttributeRefAttr, /** Reference to the negative point on a major axis */, - majorAxisPositivePoint, SketchPlugin_MacroEllipse::SECOND_POINT_ID(), - GeomDataAPI_Point2D, /** Major axis positive point point */, - majorAxisPositivePointRef, SketchPlugin_MacroEllipse::SECOND_POINT_REF_ID(), - ModelAPI_AttributeRefAttr, /** Reference to the positive point on a major axis */, - passedPoint, SketchPlugin_MacroEllipse::PASSED_POINT_ID(), - GeomDataAPI_Point2D, /** Passed point */, - passedPointRef, SketchPlugin_MacroEllipse::PASSED_POINT_REF_ID(), - ModelAPI_AttributeRefAttr, /** Reference to a passed point */) + ModelAPI_AttributeString, /** Ellipse type */) + + /// Return created auxiliary center point + SKETCHAPI_EXPORT std::shared_ptr center(); + /// Return created auxiliary focus in the positive direction of major axis + SKETCHAPI_EXPORT std::shared_ptr focus1(); + /// Return created auxiliary focus in the negative direction of major axis + SKETCHAPI_EXPORT std::shared_ptr focus2(); + /// Return created auxiliary point - start of major axis + SKETCHAPI_EXPORT std::shared_ptr majorAxisStart(); + /// Return created auxiliary point - end of major axis + SKETCHAPI_EXPORT std::shared_ptr majorAxisEnd(); + /// Return created auxiliary point - start of minor axis + SKETCHAPI_EXPORT std::shared_ptr minorAxisStart(); + /// Return created auxiliary point - end of minor axis + SKETCHAPI_EXPORT std::shared_ptr minorAxisEnd(); + /// Return created auxiliary major axis + SKETCHAPI_EXPORT std::shared_ptr majorAxis(); + /// Return created auxiliary minor axis + SKETCHAPI_EXPORT std::shared_ptr minorAxis(); + +protected: + // find a parent sketch + void storeSketch(const std::shared_ptr& theFeature); private: /// Set flag of creation by center, major semi-axis and passed point. - void setByCenterAndPassedPoints(); + void setByCenterAndPassedPoints(const std::shared_ptr& theCenter, + const ModelHighAPI_RefAttr& theCenterRef, + const std::shared_ptr& theMajorAxisPoint, + const ModelHighAPI_RefAttr& theMajorAxisPointRef, + const std::shared_ptr& thePassedPoint, + const ModelHighAPI_RefAttr& thePassedPointRef); /// Set flag of creation by major axis and passed point. - void setByMajorAxisAndPassedPoint(); - - /// Set points of ellipse. - void initializePoints(double theMajorAxisX1, double theMajorAxisY1, - double theMajorAxisX2, double theMajorAxisY2, - double thePassedX, double thePassedY); - - /// Set points of ellipse. - void initializePoints(const std::shared_ptr& theMajorAxisPoint1, - const std::shared_ptr& theMajorAxisPoint2, - const std::shared_ptr& thePassedPoint); - - /// Set points of ellipse. - void initializePoints(const std::shared_ptr& theMajorAxisPoint1, - const ModelHighAPI_RefAttr& theMajorAxisPoint1Ref, - const std::shared_ptr& theMajorAxisPoint2, - const ModelHighAPI_RefAttr& theMajorAxisPoint2Ref, - const std::shared_ptr& thePassedPoint, - const ModelHighAPI_RefAttr& thePassedPointRef); + void setByMajorAxisAndPassedPoint(const std::shared_ptr& theMajorAxisStart, + const ModelHighAPI_RefAttr& theMajorAxisStartRef, + const std::shared_ptr& theMajorAxisEnd, + const ModelHighAPI_RefAttr& theMajorAxisEndRef, + const std::shared_ptr& thePassedPoint, + const ModelHighAPI_RefAttr& thePassedPointRef); + + /// Collect auxiliary features + void collectAuxiliary(); + +private: + CompositeFeaturePtr mySketch; + std::shared_ptr myCenter; + std::shared_ptr myFocus1; + std::shared_ptr myFocus2; + std::shared_ptr myMajorAxisStart; + std::shared_ptr myMajorAxisEnd; + std::shared_ptr myMinorAxisStart; + std::shared_ptr myMinorAxisEnd; + std::shared_ptr myMajorAxis; + std::shared_ptr myMinorAxis; }; /// Pointer on Circle object.