SHAPER  9.12.0
SketchAPI_Line.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 SRC_SKETCHAPI_SKETCHAPI_LINE_H_
21 #define SRC_SKETCHAPI_SKETCHAPI_LINE_H_
22 
23 //--------------------------------------------------------------------------------------
24 #include "SketchAPI.h"
25 
26 #include <GeomDataAPI_Point2D.h>
27 
28 #include <SketchPlugin_Line.h>
29 
30 #include "SketchAPI_SketchEntity.h"
31 //--------------------------------------------------------------------------------------
33 //--------------------------------------------------------------------------------------
39 {
40 public:
42  SKETCHAPI_EXPORT
43  explicit SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature);
45  SKETCHAPI_EXPORT
46  SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
47  double theX1, double theY1, double theX2, double theY2);
49  SKETCHAPI_EXPORT
50  SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
51  const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
52  const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
54  SKETCHAPI_EXPORT
55  SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
56  const ModelHighAPI_Selection & theExternal);
58  SKETCHAPI_EXPORT
59  SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
60  const std::wstring & theExternalName);
62  SKETCHAPI_EXPORT
63  virtual ~SketchAPI_Line();
64 
65  INTERFACE_3(SketchPlugin_Line::ID(),
72  )
73 
74 
75  SKETCHAPI_EXPORT
76  void setByCoordinates(double theX1, double theY1, double theX2, double theY2);
77 
79  SKETCHAPI_EXPORT
80  void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
81  const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
82 
84  SKETCHAPI_EXPORT
85  void setByExternal(const ModelHighAPI_Selection & theExternal);
86 
88  SKETCHAPI_EXPORT
89  void setByExternalName(const std::wstring & theExternalName);
90 
92  SKETCHAPI_EXPORT
93  void setStartPoint(double theX, double theY);
94 
96  SKETCHAPI_EXPORT
97  void setStartPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
98 
100  SKETCHAPI_EXPORT
101  void setEndPoint(double theX, double theY);
102 
104  SKETCHAPI_EXPORT
105  void setEndPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
106 
108  SKETCHAPI_EXPORT
109  virtual void dump(ModelHighAPI_Dumper& theDumper) const;
110 };
111 
113 typedef std::shared_ptr<SketchAPI_Line> LinePtr;
114 
115 //--------------------------------------------------------------------------------------
116 //--------------------------------------------------------------------------------------
117 #endif /* SRC_SKETCHAPI_SKETCHAPI_LINE_H_ */
2D point defined by two coordinates
Definition: GeomAPI_Pnt2d.h:36
Attribute that contains 2D point coordinates.
Definition: GeomDataAPI_Point2D.h:37
Attribute that contains reference to the sub-shape of some result, the selected shape.
Definition: ModelAPI_AttributeSelection.h:35
Dump engine for the model.
Definition: ModelHighAPI_Dumper.h:81
Class for filling ModelAPI_AttributeSelection.
Definition: ModelHighAPI_Selection.h:49
Interface for Line feature.
Definition: SketchAPI_Line.h:39
void setByExternal(const ModelHighAPI_Selection &theExternal)
Set by external.
Definition: SketchAPI_Line.cpp:101
void setByExternalName(const std::wstring &theExternalName)
Set by external name.
Definition: SketchAPI_Line.cpp:108
void setEndPoint(double theX, double theY)
Set end point.
Definition: SketchAPI_Line.cpp:128
void setByPoints(const std::shared_ptr< GeomAPI_Pnt2d > &theStartPoint, const std::shared_ptr< GeomAPI_Pnt2d > &theEndPoint)
Set by points.
Definition: SketchAPI_Line.cpp:91
void setStartPoint(double theX, double theY)
Set start point.
Definition: SketchAPI_Line.cpp:116
virtual std::shared_ptr< ModelAPI_AttributeSelection > external() const
External.
Definition: SketchAPI_Line.h:72
virtual std::shared_ptr< GeomDataAPI_Point2D > startPoint() const
Start point.
Definition: SketchAPI_Line.h:72
virtual ~SketchAPI_Line()
Destructor.
Definition: SketchAPI_Line.cpp:76
virtual void dump(ModelHighAPI_Dumper &theDumper) const
Dump wrapped feature.
Definition: SketchAPI_Line.cpp:143
void setByCoordinates(double theX1, double theY1, double theX2, double theY2)
Set by coordinates.
Definition: SketchAPI_Line.cpp:82
virtual std::shared_ptr< GeomDataAPI_Point2D > endPoint() const
End point.
Definition: SketchAPI_Line.h:72
SketchAPI_Line(const std::shared_ptr< ModelAPI_Feature > &theFeature)
Constructor without values.
Definition: SketchAPI_Line.cpp:28
Base class for Sketch feature interfaces.
Definition: SketchAPI_SketchEntity.h:38
static const std::string & ID()
Arc feature kind.
Definition: SketchPlugin_Line.h:41
static const std::string & END_ID()
End 2D point of the line.
Definition: SketchPlugin_Line.h:53
static const std::string & START_ID()
Start 2D point of the line.
Definition: SketchPlugin_Line.h:47
static const std::string & EXTERNAL_ID()
Reference to the external edge or vertex as a AttributeSelection.
Definition: SketchPlugin_SketchEntity.h:55