SHAPER  9.12.0
SketchPlugin_ConstraintDistance.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef SketchPlugin_ConstraintDistance_H_
21 #define SketchPlugin_ConstraintDistance_H_
22 
23 #include "SketchPlugin.h"
24 #include "SketchPlugin_ConstraintBase.h"
25 #include "SketchPlugin_Sketch.h"
26 #include "ModelAPI_Data.h"
27 
28 #include <GeomAPI_ICustomPrs.h>
29 
30 #include <list>
31 
32 class SketchPlugin_Line;
34 
44 {
45  public:
47  inline static const std::string& ID()
48  {
49  static const std::string MY_CONSTRAINT_DISTANCE_ID("SketchConstraintDistance");
50  return MY_CONSTRAINT_DISTANCE_ID;
51  }
52 
54  SKETCHPLUGIN_EXPORT virtual const std::string& getKind()
55  {
56  static std::string MY_KIND = SketchPlugin_ConstraintDistance::ID();
57  return MY_KIND;
58  }
59 
61  inline static const std::string& SIGNED()
62  {
63  static const std::string MY_SIGNED("SignedDistance");
64  return MY_SIGNED;
65  }
66 
69  inline static const std::string& DIRECTION_ID()
70  {
71  static const std::string MY_DIRECTION_ID("DistanceDirection");
72  return MY_DIRECTION_ID;
73  }
74 
76  inline static const std::string& LOCATION_TYPE_ID()
77  {
78  static const std::string MY_LOCATION_TYPE_ID("LocationType");
79  return MY_LOCATION_TYPE_ID;
80  }
81 
83  SKETCHPLUGIN_EXPORT virtual void execute();
84 
86  SKETCHPLUGIN_EXPORT virtual void initAttributes();
87 
89  SKETCHPLUGIN_EXPORT virtual void colorConfigInfo(std::string& theSection, std::string& theName,
90  std::string& theDefault);
91 
93  SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
94 
97  SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
98 
101 
102 protected:
104  virtual double calculateCurrentDistance();
105 
108 
109 protected:
111 };
112 
113 #endif
Attribute that contains 2D point coordinates.
Definition: GeomDataAPI_Point2D.h:37
Feature for creation of a new constraint between other features.
Definition: SketchPlugin_ConstraintBase.h:56
Feature for creation of a new constraint which defines a distance between a point and another feature...
Definition: SketchPlugin_ConstraintDistance.h:44
virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious)
Returns the AIS preview.
Definition: SketchPlugin_ConstraintDistance.cpp:97
static const std::string & DIRECTION_ID()
The direction from the first object to the second.
Definition: SketchPlugin_ConstraintDistance.h:69
virtual void execute()
Creates a new part document if needed.
Definition: SketchPlugin_ConstraintDistance.cpp:82
static const std::string & LOCATION_TYPE_ID()
attribute name of dimension location type
Definition: SketchPlugin_ConstraintDistance.h:76
static const std::string & ID()
Distance constraint kind.
Definition: SketchPlugin_ConstraintDistance.h:47
virtual void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: SketchPlugin_ConstraintDistance.cpp:55
virtual void attributeChanged(const std::string &theID)
Called on change of any argument-attribute of this object.
Definition: SketchPlugin_ConstraintDistance.cpp:197
virtual void colorConfigInfo(std::string &theSection, std::string &theName, std::string &theDefault)
Retuns the parameters of color definition in the resources config manager.
Definition: SketchPlugin_ConstraintDistance.cpp:73
SketchPlugin_ConstraintDistance()
Use plugin manager for features creation.
Definition: SketchPlugin_ConstraintDistance.cpp:49
virtual double calculateCurrentDistance()
Returns the current distance between the feature attributes.
Definition: SketchPlugin_ConstraintDistance.cpp:124
static const std::string & SIGNED()
Shows whether the point-line distance should keep its sign.
Definition: SketchPlugin_ConstraintDistance.h:61
virtual const std::string & getKind()
Returns the kind of a feature.
Definition: SketchPlugin_ConstraintDistance.h:54
bool areAttributesInitialized()
Check the attributes related to distanced points/features are initialized.
Definition: SketchPlugin_ConstraintDistance.cpp:171
bool myFlyoutUpdate
to avoid cyclic dependencies on automatic updates of flyout point
Definition: SketchPlugin_ConstraintDistance.h:110
Feature for creation of the new part in PartSet.
Definition: SketchPlugin_Line.h:38