1 // Copyright (C) 2014-2017 CEA/DEN, EDF R&D
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.
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.
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
17 // See http://www.salome-platform.org/ or
18 // email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
21 #ifndef SRC_SKETCHAPI_SKETCHAPI_LINE_H_
22 #define SRC_SKETCHAPI_SKETCHAPI_LINE_H_
24 //--------------------------------------------------------------------------------------
25 #include "SketchAPI.h"
27 #include <GeomDataAPI_Point2D.h>
29 #include <SketchPlugin_Line.h>
31 #include "SketchAPI_SketchEntity.h"
32 //--------------------------------------------------------------------------------------
33 class ModelHighAPI_Selection;
34 //--------------------------------------------------------------------------------------
35 /**\class SketchAPI_Line
37 * \brief Interface for Line feature
39 class SketchAPI_Line : public SketchAPI_SketchEntity
42 /// Constructor without values
44 explicit SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature);
45 /// Constructor with values
47 SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
48 double theX1, double theY1, double theX2, double theY2);
49 /// Constructor with values
51 SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
52 const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
53 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
54 /// Constructor with values
56 SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
57 const ModelHighAPI_Selection & theExternal);
58 /// Constructor with values
60 SketchAPI_Line(const std::shared_ptr<ModelAPI_Feature> & theFeature,
61 const std::string & theExternalName);
64 virtual ~SketchAPI_Line();
66 INTERFACE_3(SketchPlugin_Line::ID(),
67 startPoint, SketchPlugin_Line::START_ID(),
68 GeomDataAPI_Point2D, /** Start point */,
69 endPoint, SketchPlugin_Line::END_ID(),
70 GeomDataAPI_Point2D, /** End point */,
71 external, SketchPlugin_Line::EXTERNAL_ID(),
72 ModelAPI_AttributeSelection, /** External */
75 /// Set by coordinates
77 void setByCoordinates(double theX1, double theY1, double theX2, double theY2);
81 void setByPoints(const std::shared_ptr<GeomAPI_Pnt2d> & theStartPoint,
82 const std::shared_ptr<GeomAPI_Pnt2d> & theEndPoint);
86 void setByExternal(const ModelHighAPI_Selection & theExternal);
88 /// Set by external name
90 void setByExternalName(const std::string & theExternalName);
94 void setStartPoint(double theX, double theY);
98 void setStartPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
102 void setEndPoint(double theX, double theY);
106 void setEndPoint(const std::shared_ptr<GeomAPI_Pnt2d> & thePoint);
108 /// Dump wrapped feature
110 virtual void dump(ModelHighAPI_Dumper& theDumper) const;
113 //! Pointer on Line object
114 typedef std::shared_ptr<SketchAPI_Line> LinePtr;
116 //--------------------------------------------------------------------------------------
117 //--------------------------------------------------------------------------------------
118 #endif /* SRC_SKETCHAPI_SKETCHAPI_LINE_H_ */