20 #ifndef PartSet_Tools_H
21 #define PartSet_Tools_H
31 #include <ModelAPI_CompositeFeature.h>
32 #include <ModelAPI_Object.h>
33 #include <ModelAPI_Attribute.h>
34 #include <ModelAPI_AttributeSelection.h>
36 #include <Events_Message.h>
38 #include <TopoDS_Shape.hxx>
78 static int getAISDefaultWidth();
83 static gp_Pnt convertClickToPoint(QPoint thePoint, Handle(V3d_View) theView);
91 static void convertTo2D(
const gp_Pnt& thePoint, FeaturePtr theSketch,
92 Handle(V3d_View) theView,
93 double& theX,
double& theY);
99 static std::shared_ptr<GeomAPI_Pnt2d> convertTo2D(FeaturePtr theSketch,
100 const std::shared_ptr<GeomAPI_Pnt>& thePnt);
106 static std::shared_ptr<GeomAPI_Pnt> convertTo3D(
const double theX,
const double theY,
107 FeaturePtr theSketch);
110 static std::shared_ptr<ModelAPI_Document> document();
116 static void setFeatureValue(FeaturePtr theFeature,
double theX,
const std::string& theAttribute);
123 static double featureValue(FeaturePtr theFeature,
const std::string& theAttribute,
bool& isValid);
131 static FeaturePtr feature(FeaturePtr theFeature,
const std::string& theAttribute,
132 const std::string& theKind);
138 static void createConstraint(CompositeFeaturePtr theSketch,
139 std::shared_ptr<GeomDataAPI_Point2D> thePoint1,
140 std::shared_ptr<GeomDataAPI_Point2D> thePoint2);
145 static std::shared_ptr<GeomAPI_Pln> sketchPlane(CompositeFeaturePtr theSketch);
150 static void nullifySketchPlane(CompositeFeaturePtr theSketch);
156 static std::shared_ptr<GeomAPI_Pnt> point3D(std::shared_ptr<GeomAPI_Pnt2d> thePoint2D,
157 CompositeFeaturePtr theSketch);
164 static std::shared_ptr<ModelAPI_Result> findFixedObjectByExternal(
165 const TopoDS_Shape& theShape,
166 const ObjectPtr& theObject,
167 CompositeFeaturePtr theSketch);
177 static std::shared_ptr<ModelAPI_Result> createFixedObjectByExternal(
178 const std::shared_ptr<GeomAPI_Shape>& theShape,
179 const ObjectPtr& theObject,
180 CompositeFeaturePtr theSketch,
181 const bool theTemporary,
182 FeaturePtr& theCreatedFeature);
188 static bool isContainPresentation(
const QList<std::shared_ptr<ModuleBase_ViewerPrs>>& theSelected,
189 const std::shared_ptr<ModuleBase_ViewerPrs>& thePrs);
198 static std::pair<AttributePtr, int> findAttributeBy2dPoint(ObjectPtr theObj,
199 const TopoDS_Shape theShape,
200 FeaturePtr theSketch);
208 static std::shared_ptr<GeomAPI_Shape> findShapeBy2DPoint(
const AttributePtr& theAttribute,
216 static std::shared_ptr<GeomAPI_Pnt2d> getPoint(std::shared_ptr<ModelAPI_Feature>& theFeature,
217 const std::string& theAttribute);
225 static std::shared_ptr<GeomAPI_Pnt2d> getPnt2d(QMouseEvent* theEvent,
227 const FeaturePtr& theSketch);
235 static std::shared_ptr<GeomAPI_Pnt2d> getPnt2d(
const Handle(V3d_View)& theView,
236 const TopoDS_Shape& theShape,
237 const FeaturePtr& theSketch);
247 static FeaturePtr findFirstCoincidence(
const FeaturePtr& theFeature,
248 std::shared_ptr<GeomAPI_Pnt2d> thePoint);
257 static void findCoincidences(FeaturePtr theStartCoin, QList<FeaturePtr>& theList,
258 QList<FeaturePtr>& theCoincidencies,
259 std::string theAttr, QList<bool>& theIsAttributes);
266 static FeaturePtr findRefsToMeFeature(FeaturePtr theFeature,
const std::string& theFeatureId)
268 if (!theFeature.get())
272 const std::set<AttributePtr>& aRefsList = theFeature->data()->refsToMe();
273 std::set<AttributePtr>::const_iterator anIt;
274 for (anIt = aRefsList.cbegin(); anIt != aRefsList.cend(); ++anIt) {
275 FeaturePtr aRefFeature = std::dynamic_pointer_cast<ModelAPI_Feature>((*anIt)->owner());
276 if (aRefFeature && aRefFeature->getKind() == theFeatureId)
286 static std::shared_ptr<GeomAPI_Pnt2d> getCoincedencePoint(FeaturePtr theStartCoin);
289 static void sendSubFeaturesEvent(
const CompositeFeaturePtr& theComposite,
297 static bool isAuxiliarySketchEntity(
const ObjectPtr& theObject);
303 static bool isIncludeIntoSketchResult(
const ObjectPtr& theObject);
305 static ResultPtr createFixedByExternalCenter(
const ObjectPtr& theObject,
306 const std::shared_ptr<GeomAPI_Edge>& theEdge,
308 const CompositeFeaturePtr& theSketch,
310 FeaturePtr& theCreatedFeature);
313 static void getFirstAndLastIndexInFolder(
const ObjectPtr& theFolder,
314 int& theFirst,
int& theLast);
320 static void getDefaultColor(ObjectPtr theObject,
const bool isEmptyColorValid,
321 std::vector<int>& theColor);
326 static double getDefaultDeflection(
const ObjectPtr& theObject);
332 static double getDefaultTransparency();
337 static QCursor getOperationCursor();
Identifier of the event kind.
Definition: Events_Message.h:36
Interface to the edge object.
Definition: GeomAPI_Edge.h:38
3D point defined by three coordinates
Definition: GeomAPI_Pln.h:37
2D point defined by two coordinates
Definition: GeomAPI_Pnt2d.h:36
3D point defined by three coordinates
Definition: GeomAPI_Pnt.h:38
Interface to the topological shape object.
Definition: GeomAPI_Shape.h:43
Interface to the vertex object.
Definition: GeomAPI_Vertex.h:31
Attribute that contains 2D point coordinates.
Definition: GeomDataAPI_Point2D.h:37
CenterType
Type of the center of the circular of elliptic edge.
Definition: ModelAPI_AttributeSelection.h:38
The result of a feature.
Definition: ModelAPI_Result.h:35
Interface to ViewWindow object which contains 3d scene.
Definition: ModuleBase_IViewWindow.h:34
Class which provides access to Workshop object services.
Definition: ModuleBase_IWorkshop.h:48
Presentation.
Definition: ModuleBase_ViewerPrs.h:37