X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSketchPlugin%2FSketchPlugin_Projection.h;h=6bfd107666b614afea21dfcb2ea1082e8b3070d0;hb=eed8986352c64d13fe05eed6c42c36902ddddf52;hp=b9ae2611f049a1269254581afb075e1c52ef105b;hpb=947de864e5ab5bb127e34c316b9ac37a5418cc4b;p=modules%2Fshaper.git diff --git a/src/SketchPlugin/SketchPlugin_Projection.h b/src/SketchPlugin/SketchPlugin_Projection.h index b9ae2611f..6bfd10766 100644 --- a/src/SketchPlugin/SketchPlugin_Projection.h +++ b/src/SketchPlugin/SketchPlugin_Projection.h @@ -1,14 +1,29 @@ -// Copyright (C) 2014-20xx CEA/DEN, EDF R&D --> - -// File: SketchPlugin_Projection.h -// Created: 20 April 2016 -// Author: Artem ZHIDKOV +// Copyright (C) 2014-2021 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 +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// #ifndef SketchPlugin_Projection_H_ #define SketchPlugin_Projection_H_ #include "SketchPlugin_SketchEntity.h" +class GeomAPI_Curve; + /** \class SketchPlugin_Projection * \ingroup Plugins * \brief Feature for creation of external feature as a projection onto the sketch plane. @@ -41,25 +56,52 @@ public: return MY_PROJ_FEATURE_ID; } + static const std::string& INCLUDE_INTO_RESULT() + { + static std::string MY_INCLUDE("IncludeToResult"); + return MY_INCLUDE; + } + + static const std::string& KEEP_REFERENCE_ID() + { + static std::string ID("keep_reference"); + return ID; + } + + static const std::string& MAKE_FIXED() + { + static std::string ID("make_fixed"); + return ID; + } + + static const std::string& FIXED_CONSTRAINT_ID() + { + static std::string ID("fixed_constraint"); + return ID; + } + /// Returns true because projected feature is always external virtual bool isFixed() { return true; } - /// Returns true if object must be displayed in the viewer - virtual bool isDisplayed() - { return false; } + /// Returns true if the feature and the feature results can be displayed. + /// \return false + SKETCHPLUGIN_EXPORT virtual bool canBeDisplayed() const + { + return false; + } /// Creates a new part document if needed SKETCHPLUGIN_EXPORT virtual void execute(); - /// Moves the feature - /// \param theDeltaX the delta for X coordinate is moved - /// \param theDeltaY the delta for Y coordinate is moved - SKETCHPLUGIN_EXPORT virtual void move(const double theDeltaX, const double theDeltaY); - /// Called on change of any argument-attribute of this object: for external point SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID); + /// Returns true if this feature is used as macro: creates other features and then removed. + /// This feature may change its macro-state according to selected item. + /// \returns false by default + SKETCHPLUGIN_EXPORT virtual bool isMacro() const; + /// Use plugin manager for features creation SketchPlugin_Projection(); @@ -67,10 +109,53 @@ protected: /// \brief Initializes attributes of derived class. virtual void initDerivedClassAttributes(); + /// \brief Initializes attributes of keeping the reference to the original shape. + virtual void initDerivedClassAttributes2(); + private: /// \brief Find projection of a feature onto sketch plane void computeProjection(const std::string& theID); + /// \brief Project point to the sketch plane + bool projectPoint(FeaturePtr& theProjection, const std::shared_ptr& thePoint); + /// \brief Project segment to the sketch plane + bool projectSegment(FeaturePtr& theProjection, const std::shared_ptr& theEdge); + /// \brief Project any edge to sketch plane + bool projectEdge(FeaturePtr& theProjection, const std::shared_ptr& theEdge); + + /// \brief Fill attributes of the Arc feature + bool fillArc(FeaturePtr& theProjection, + const std::shared_ptr& theArc, + const std::shared_ptr& thePlane, + const std::shared_ptr& theOriginalEdge); + /// \brief Fill attributes of the Circle feature + bool fillCircle(FeaturePtr& theProjection, + const std::shared_ptr& theCircle, + const std::shared_ptr& thePlane); + /// \brief Fill attributes of the Ellipse feature + bool fillEllipse(FeaturePtr& theProjection, + const std::shared_ptr& theEllipse, + const std::shared_ptr& thePlane); + /// \brief Fill attributes of the EllipticArc feature + bool fillEllipticArc(FeaturePtr& theProjection, + const std::shared_ptr& theEllipticArc, + const std::shared_ptr& thePlane, + const std::shared_ptr& theOriginalEdge); + /// \brief Fill attributes of the B-spline feature + bool fillBSpline(FeaturePtr& theProjection, + const std::shared_ptr& theCurve, + const std::shared_ptr& thePlane); + + /// \brief Delete already calculated projected feature + /// if the selection of the projection is changed + /// \param[in/out] theProjection projected feature + /// \param[in] theSupportedTypes types supported relatively to the base selection + /// \param[in] theRequestedFeature type of the new feature to be created + /// (remove only if empty string). + bool rebuildProjectedFeature(FeaturePtr& theProjection, + const std::set& theSupportedTypes, + const std::string& theRequestedFeature = std::string()); + bool myIsComputing; };