SHAPER  9.12.0
SketcherPrs_LengthDimension.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 SketcherPrs_LinearDimension_H
21 #define SketcherPrs_LinearDimension_H
22 
23 #include <GeomAPI_Ax3.h>
24 #include <ModelAPI_Feature.h>
25 #include <PrsDim_LengthDimension.hxx>
26 #include <Standard_DefineHandle.hxx>
27 #include <SketchPlugin_Sketch.h>
28 
29 #include <gp_Pnt.hxx>
30 #include <gp_Pln.hxx>
31 #include <string>
32 
33 #include <SketcherPrs_DimensionStyle.h>
34 
36 
37 
43 {
44 public:
48  Standard_EXPORT SketcherPrs_LengthDimension(ModelAPI_Feature* theConstraint,
49  SketchPlugin_Sketch* theSketcher);
50 
52  Standard_EXPORT ~SketcherPrs_LengthDimension();
53 
55 
56 
61  static bool IsReadyToDisplay(ModelAPI_Feature* theConstraint,
62  const std::shared_ptr<GeomAPI_Ax3>& thePlane);
63 
65  Standard_EXPORT std::shared_ptr<GeomAPI_Ax3> plane() const
66  {
67  return mySketcher->coordinatePlane();
68  }
69 
70 protected:
72  Standard_EXPORT virtual void Compute(
73  const Handle(PrsMgr_PresentationManager3d)& thePresentationManager,
74  const Handle(Prs3d_Presentation)& thePresentation,
75  const Standard_Integer theMode = 0);
76 
78  Standard_EXPORT virtual void ComputeSelection(const Handle(SelectMgr_Selection)& aSelection,
79  const Standard_Integer aMode);
80 
81 private:
82  static bool readyToDisplay(ModelAPI_Feature* theConstraint,
83  const std::shared_ptr<GeomAPI_Ax3>& thePlane,
84  gp_Pnt2d& thePnt1, gp_Pnt2d& thePnt2);
85 
87  void setDirection(ModelAPI_Feature* theConstraint,
88  const std::shared_ptr<GeomAPI_Ax3>& thePlane);
89 
91  ModelAPI_Feature* myConstraint;
92 
94  SketchPlugin_Sketch* mySketcher;
95 
96  //Handle(Prs3d_DimensionAspect) myAspect;
97 
99  SketcherPrs_DimensionStyle* myStyleListener;
100 
103  gp_Pnt myFirstPoint;
104  gp_Pnt mySecondPoint;
105  gp_Pln myPlane;
106  double myDistance;
107 
110 };
111 
112 #endif
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:39
Feature for creation of the new part in PartSet.
Definition: SketchPlugin_Sketch.h:47
Definition: SketcherPrs_DimensionStyle.h:43
Definition: SketcherPrs_DimensionStyle.h:41
A class for representation of linear dimension constraint.
Definition: SketcherPrs_LengthDimension.h:43
std::shared_ptr< GeomAPI_Ax3 > plane() const
Returns sketcher plane.
Definition: SketcherPrs_LengthDimension.h:65
DEFINE_STANDARD_RTTIEXT(SketcherPrs_LengthDimension, PrsDim_LengthDimension) static bool IsReadyToDisplay(ModelAPI_Feature *theConstraint
Returns true if the constraint feature arguments are correcly filled to build AIS presentation.