20 #ifndef PartSet_PreviewSketchPlane_H
21 #define PartSet_PreviewSketchPlane_H
25 #include <Standard_Handle.hxx>
26 #include <Aspect_GridType.hxx>
27 #include <Aspect_GridDrawMode.hxx>
28 #include <ModelAPI_CompositeFeature.h>
31 #include "PartSet_Tools.h"
37 class AIS_PlaneTrihedron;
53 inline static bool SketchAccessoryDbg()
55 #ifdef SKETCH_ACCESSORY_DBG
62 static bool SketchAccessoryDbg(
const QString& theString);
63 static bool SketchAccessoryDbg(
const char* theString);
64 static bool SketchAccessoryDbg(
const char* theCSDescription,
const gp_Ax3& theCS);
65 static bool SketchAccessoryDbg(
const char* theCSDescription,
const gp_Pnt& thePoint);
66 static bool SketchAccessoryDbg(
const char* theCSDescription,
const gp_Trsf& theMatrix);
68 enum GridSnappingMode {
80 void savePreferencesIntoSketchData(std::shared_ptr<ModelAPI_CompositeFeature> theSketch)
const;
81 void saveRectangularGridPreferencesIntoSketchData(std::shared_ptr<ModelAPI_CompositeFeature> theSketch)
const;
82 void saveCircularGridPreferencesIntoSketchData(std::shared_ptr<ModelAPI_CompositeFeature> theSketch)
const;
112 bool setGridType(PartSet_Tools::SketchPlaneGridType::Enum theType);
114 PartSet_Tools::SketchPlaneGridType::Enum getGridType()
const {
return myGridType; }
122 bool isShowAxes()
const {
return myShowTrihedron; }
123 bool isShowSubstrate()
const {
return myShowSubstrate; }
124 bool isShowGrid()
const {
return myGridType != PartSet_Tools::SketchPlaneGridType::No; }
126 GridSnappingMode getGridSnappingMode()
const {
return mySnappingMode; };
127 void setGridSnappingMode(GridSnappingMode theMode) { mySnappingMode = theMode; };
132 void setRectangularGridStepX(
double theStepX);
133 void setRectangularGridStepY(
double theStepY);
134 std::pair<double, double> getRectangularGridSteps()
const {
return myRectangularGridSteps; }
136 void setRectangularGridOffsetX(
double theOffsetX);
137 void setRectangularGridOffsetY(
double theOffsetY);
138 void setRectangularGridOffsetA(
double theOffsetAngle);
139 std::pair<std::pair<double, double>,
double> getRectangularGridOffsets()
const;
140 int getRectangularGridDimOfNodeSpace()
const {
return myRectangularGridDimOfNodeSpace; }
145 void setCircularGridRadialStep(
double theStep);
146 void setCircularGridNumOfAngularSegments(
int theNum);
147 std::pair<double, int> getCircularGrid_dR_and_NAS()
const;
149 void setCircularGridOffsetX(
double theOffset);
150 void setCircularGridOffsetY(
double theOffset);
151 void setCircularGridOffsetA(
double theOffset);
152 std::pair<std::pair<double, double>,
double> getCircularGridOffsets()
const;
153 int getCircularGridDimOfNodeSpace()
const {
return myCircularGridDimOfNodeSpace; }
155 void setUseSizeOfView(
const bool isUseSizeOfView) { myIsUseSizeOfView = isUseSizeOfView; }
156 bool isUseSizeOfView()
const {
return myIsUseSizeOfView; }
159 void configureTrihedron();
160 void initSubstrate(std::shared_ptr<GeomAPI_Face> theFace);
162 opencascade::handle<V3d_Viewer> getV3DViewer()
const;
163 bool isValid()
const;
167 double getDefaultSize()
const;
169 double getCircularGridRaduis(
const std::pair<double, double>& theBBox2Dimensions)
const;
173 static std::pair<double, double> dimsOfRectangleFittingRectangle(
double wInner,
double hInner,
double angle,
double cX,
double cY);
179 static const double DEFAULT_RELATIVE_STEP_INVERSE;
180 static const int DEFAULT_NUM_OF_ANGULAR_SECTIONS;
181 static const int SNAP_PROXIMITY_P;
185 static const double DEFAULT_SKETCH_SIZE;
191 std::pair<double, double> mySketchDimensions;
192 double mySketchDefaultSize;
193 bool myIsUseSizeOfView =
false;
195 bool myShowTrihedron;
196 opencascade::handle<AIS_PlaneTrihedron> myTrihedron;
198 bool myShowSubstrate;
199 std::shared_ptr<GeomAPI_AISObject> mySubstrate;
201 PartSet_Tools::SketchPlaneGridType::Enum myGridType;
202 Aspect_GridDrawMode myGridDrawMode;
203 GridSnappingMode mySnappingMode;
205 std::pair<double, double> myRectangularGridSteps;
206 std::pair<double, double> myRectangularGridTransOffset;
207 double myRectangularGridOffsetAngle;
208 int myRectangularGridDimOfNodeSpace;
210 double myCircularGridRadialStep;
211 int myCircularGridNumOfAngularSections;
212 std::pair<double, double> myCircularGridTransOffset;
213 double myCircularGridOffsetAngle;
214 int myCircularGridDimOfNodeSpace;
Interface for AIS_InteractiveObject.
Definition: GeomAPI_AISObject.h:39
Interface to the face object.
Definition: GeomAPI_Face.h:36
Feature that consists of other features: like sketcher with edges inside.
Definition: ModelAPI_CompositeFeature.h:33
Visualization of 2D-bluebrint' accessories: translucent rectangular substrate, basis axes,...
Definition: PartSet_PreviewSketchPlane.h:51
bool reconfigureGrid()
Call it, after any preference of grid, except grid type, is changed using methods of this instance....
Definition: PartSet_PreviewSketchPlane.cpp:395
bool setGridType(PartSet_Tools::SketchPlaneGridType::Enum theType)
Changes grid type and reconfigures grid. Shows grid, if theType != SketchPlaneGridType::No.
Definition: PartSet_PreviewSketchPlane.cpp:574
bool showSubstrate(bool theShow)
Definition: PartSet_PreviewSketchPlane.cpp:559
bool setAllUsingSketch(std::shared_ptr< ModelAPI_CompositeFeature > theSketch)
Updates CS (coordinate system), dimensions and accessories' configuration. Updates visibility of acce...
Definition: PartSet_PreviewSketchPlane.cpp:205
void resetCircularGrid()
Sets default steps and zero offsets.
Definition: PartSet_PreviewSketchPlane.cpp:663
PartSet_PreviewSketchPlane(PartSet_SketcherMgr *theManager)
Definition: PartSet_PreviewSketchPlane.cpp:131
bool showAxes(bool theShow)
Definition: PartSet_PreviewSketchPlane.cpp:544
void hideAll()
Hides all accessories.
Definition: PartSet_PreviewSketchPlane.cpp:603
static double defaultSketchSize()
Definition: PartSet_PreviewSketchPlane.cpp:815
void setCSAndSize(const gp_Ax3 &theCS, double theSize)
Updates CS (coordinate system), dimensions and accessories' configuration.
Definition: PartSet_PreviewSketchPlane.cpp:183
std::pair< double, double > getDimensions() const
Substrate dimensions. Substrate dimension coincides with one of the sketch face, if the latter is non...
Definition: PartSet_PreviewSketchPlane.cpp:610
bool reconfigureGridUsingSketch(std::shared_ptr< ModelAPI_CompositeFeature > theSketch)
Call it, after any preference of grid is changed in theSketch data directly. Updates grid configurati...
Definition: PartSet_PreviewSketchPlane.cpp:400
void resetRectangularGrid()
Sets default steps and zero offsets.
Definition: PartSet_PreviewSketchPlane.cpp:623
A class for management of sketch operations At the time of the sketcher operation active,...
Definition: PartSet_SketcherMgr.h:107