SHAPER  9.12.0
SketchPlugin_ConstraintDistanceAlongDir.h
1 // Copyright (C) 2017-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 // File: SketchPlugin_ConstraintDistanceAlongDir.h
21 // Created: 24 October 2017
22 // Author: Artem ZHIDKOV
23 
24 #ifndef SketchPlugin_ConstraintDistanceAlongDir_H_
25 #define SketchPlugin_ConstraintDistanceAlongDir_H_
26 
27 #include <SketchPlugin.h>
28 #include <SketchPlugin_ConstraintDistance.h>
29 
39 {
40 public:
42  inline static const std::string& LOCATION_TYPE_ID()
43  {
44  static const std::string MY_LOCATION_TYPE_ID("LocationType");
45  return MY_LOCATION_TYPE_ID;
46  }
47 
49  inline static const std::string& DISTANCE_VALUE_ID()
50  {
51  static const std::string& MY_DISTANCE_VALUE("DistanceValue");
52  return MY_DISTANCE_VALUE;
53  }
54 
56  inline static const std::string& NEGATIVE_TYPE_ID()
57  {
58  static const std::string MY_NEGATIVE_VALUE("NegativeValue");
59  return MY_NEGATIVE_VALUE;
60  }
61 
63  SKETCHPLUGIN_EXPORT virtual void execute();
64 
66  SKETCHPLUGIN_EXPORT virtual void initAttributes();
67 
69  SKETCHPLUGIN_EXPORT virtual AISObjectPtr getAISObject(AISObjectPtr thePrevious);
70 
73  SKETCHPLUGIN_EXPORT virtual void attributeChanged(const std::string& theID);
74 
77 
78 protected:
80  virtual double calculateCurrentDistance() = 0;
81 
83  virtual void updateFlyoutPoint() = 0;
84 
85 protected:
86  double myValue;
87  bool myValueUpdate;
88 };
89 
90 #endif
Feature for creation of a new constraint which defines a distance along direction.
Definition: SketchPlugin_ConstraintDistanceAlongDir.h:39
SketchPlugin_ConstraintDistanceAlongDir()
Use plugin manager for features creation.
Definition: SketchPlugin_ConstraintDistanceAlongDir.cpp:44
virtual void updateFlyoutPoint()=0
Update flyout point.
virtual SKETCHPLUGIN_EXPORT void initAttributes()
Request for initialization of data model of the feature: adding all attributes.
Definition: SketchPlugin_ConstraintDistanceAlongDir.cpp:52
virtual SKETCHPLUGIN_EXPORT AISObjectPtr getAISObject(AISObjectPtr thePrevious)
Returns the AIS preview.
Definition: SketchPlugin_ConstraintDistanceAlongDir.cpp:80
virtual SKETCHPLUGIN_EXPORT void execute()
Creates a new part document if needed.
Definition: SketchPlugin_ConstraintDistanceAlongDir.cpp:69
static const std::string & DISTANCE_VALUE_ID()
attribute name of the distance value shown to the user
Definition: SketchPlugin_ConstraintDistanceAlongDir.h:49
virtual double calculateCurrentDistance()=0
Returns the current distance between the feature attributes.
static const std::string & NEGATIVE_TYPE_ID()
attribute name of the sign of distance
Definition: SketchPlugin_ConstraintDistanceAlongDir.h:56
static const std::string & LOCATION_TYPE_ID()
attribute name of dimension location type
Definition: SketchPlugin_ConstraintDistanceAlongDir.h:42
virtual SKETCHPLUGIN_EXPORT void attributeChanged(const std::string &theID)
Called on change of any argument-attribute of this object.
Definition: SketchPlugin_ConstraintDistanceAlongDir.cpp:93
Feature for creation of a new constraint which defines a distance between a point and another feature...
Definition: SketchPlugin_ConstraintDistance.h:44