SHAPER 9.16.0
ModelGeomAlgo_Point2D.h
1// Copyright (C) 2014-2026 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 ModelGeomAlgo_Point2D_H
21#define ModelGeomAlgo_Point2D_H
22
23#include "ModelGeomAlgo.h"
24#include "ModelAPI_Feature.h"
25
27class ModelAPI_Object;
28class GeomAPI_Shape;
29class GeomAPI_Pnt;
30class GeomAPI_Dir;
31
33
34#include <memory>
35#include <string>
36#include <set>
37#include <map>
38
39
41{
42public:
50 static MODELGEOMALGO_EXPORT std::shared_ptr<GeomDataAPI_Point2D> getPointOfRefAttr(
51 ModelAPI_Feature* theFeature,
52 const std::string& theAttribute,
53 const std::string& theObjectFeatureKind = "",
54 const std::string& theObjectFeatureAttribute = "");
55
67 static MODELGEOMALGO_EXPORT
68 void getPointsOfReference(const std::shared_ptr<ModelAPI_Object>& theObject,
69 const std::string& theReferenceFeatureKind,
70 std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
71 const std::string& theObjectFeatureKind = "",
72 const std::string& theObjectFeatureAttribute = "",
73 const bool isSkipFeatureAttributes = true);
74
80 typedef std::map<std::shared_ptr<GeomAPI_Pnt>,
81 std::pair<std::list<std::shared_ptr<GeomDataAPI_Point2D> >,
82 std::list<std::shared_ptr<ModelAPI_Object> > > > PointToRefsMap;
83
84 static MODELGEOMALGO_EXPORT void getPointsIntersectedShape(
85 const std::shared_ptr<ModelAPI_Feature>& theBaseFeature,
86 const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures,
87 PointToRefsMap& thePointToAttributeOrObject);
88
89 static MODELGEOMALGO_EXPORT std::list<std::shared_ptr<GeomAPI_Pnt> > getSetOfPntIntersectedShape(
90 const std::shared_ptr<ModelAPI_Feature>& theBaseFeature,
91 const std::list<std::shared_ptr<ModelAPI_Feature> >& theFeatures);
92
101 static MODELGEOMALGO_EXPORT void getPointsInsideShape(
102 const std::shared_ptr<GeomAPI_Shape> theBaseShape,
103 const std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
104 const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
105 const std::shared_ptr<GeomAPI_Dir>& theDirX,
106 const std::shared_ptr<GeomAPI_Dir>& theDirY,
107 PointToRefsMap& thePointToAttributeOrObject);
108
117 static MODELGEOMALGO_EXPORT void getPointsInsideShape_p(
118 const std::shared_ptr<GeomAPI_Shape> theBaseShape,
119 const std::set<std::shared_ptr<GeomDataAPI_Point2D> >& theAttributes,
120 const std::shared_ptr<GeomAPI_Pnt>& theOrigin,
121 const std::shared_ptr<GeomAPI_Dir>& theDirX,
122 const std::shared_ptr<GeomAPI_Dir>& theDirY,
123 std::list<std::shared_ptr<GeomAPI_Pnt> >& thePoints,
124 std::map<std::shared_ptr<GeomDataAPI_Point2D>,
125 std::shared_ptr<GeomAPI_Pnt> >& theAttributeToPoint);
130 static MODELGEOMALGO_EXPORT bool isPointOnEdge(const std::shared_ptr<GeomAPI_Shape> theBaseShape,
131 const std::shared_ptr<GeomAPI_Pnt>& thePoint,
132 std::shared_ptr<GeomAPI_Pnt>& theProjectedPoint);
133
138 static MODELGEOMALGO_EXPORT bool isInnerPointOnEdge(
139 const std::shared_ptr<GeomAPI_Shape> theBaseShape,
140 const std::shared_ptr<GeomAPI_Pnt>& thePoint,
141 std::shared_ptr<GeomAPI_Pnt>& theProjectedPoint);
142
143#ifdef _DEBUG
148 static MODELGEOMALGO_EXPORT std::string getPontAttributesInfo(
149 const std::shared_ptr<ModelAPI_Feature>& theFeature,
150 const std::set<std::shared_ptr<ModelAPI_Attribute> >& theAttributesOnly);
151
155 static MODELGEOMALGO_EXPORT std::string getPointAttributeInfo(
156 const std::shared_ptr<ModelAPI_Attribute>& theAttribute);
157
158#endif
159};
160
161#endif
3D direction defined by three normalized coordinates
Definition: GeomAPI_Dir.h:34
3D point defined by three coordinates
Definition: GeomAPI_Pnt.h:38
Interface to the topological shape object.
Definition: GeomAPI_Shape.h:43
Attribute that contains 2D point coordinates.
Definition: GeomDataAPI_Point2D.h:37
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:41
Represents any object in the data model and in the object browser.
Definition: ModelAPI_Object.h:45
Definition: ModelGeomAlgo_Point2D.h:41
static bool isInnerPointOnEdge(const std::shared_ptr< GeomAPI_Shape > theBaseShape, const std::shared_ptr< GeomAPI_Pnt > &thePoint, std::shared_ptr< GeomAPI_Pnt > &theProjectedPoint)
Finds projected point to the given shape, which does not placed on the shape boundaries.
Definition: ModelGeomAlgo_Point2D.cpp:364
static void getPointsOfReference(const std::shared_ptr< ModelAPI_Object > &theObject, const std::string &theReferenceFeatureKind, std::set< std::shared_ptr< GeomDataAPI_Point2D > > &theAttributes, const std::string &theObjectFeatureKind="", const std::string &theObjectFeatureAttribute="", const bool isSkipFeatureAttributes=true)
Fills container of point 2D attributes, which refer to the feature through the references features wi...
Definition: ModelGeomAlgo_Point2D.cpp:84
static void getPointsInsideShape_p(const std::shared_ptr< GeomAPI_Shape > theBaseShape, const std::set< std::shared_ptr< GeomDataAPI_Point2D > > &theAttributes, const std::shared_ptr< GeomAPI_Pnt > &theOrigin, const std::shared_ptr< GeomAPI_Dir > &theDirX, const std::shared_ptr< GeomAPI_Dir > &theDirY, std::list< std::shared_ptr< GeomAPI_Pnt > > &thePoints, std::map< std::shared_ptr< GeomDataAPI_Point2D >, std::shared_ptr< GeomAPI_Pnt > > &theAttributeToPoint)
Removes attributes which points are out of the base shape.
Definition: ModelGeomAlgo_Point2D.cpp:322
std::map< std::shared_ptr< GeomAPI_Pnt >, std::pair< std::list< std::shared_ptr< GeomDataAPI_Point2D > >, std::list< std::shared_ptr< ModelAPI_Object > > > > PointToRefsMap
Find points of intersection between the shape of the feature and all features in the sketch.
Definition: ModelGeomAlgo_Point2D.h:82
static bool isPointOnEdge(const std::shared_ptr< GeomAPI_Shape > theBaseShape, const std::shared_ptr< GeomAPI_Pnt > &thePoint, std::shared_ptr< GeomAPI_Pnt > &theProjectedPoint)
Finds projected point to the given shape line.
Definition: ModelGeomAlgo_Point2D.cpp:346
static void getPointsInsideShape(const std::shared_ptr< GeomAPI_Shape > theBaseShape, const std::set< std::shared_ptr< GeomDataAPI_Point2D > > &theAttributes, const std::shared_ptr< GeomAPI_Pnt > &theOrigin, const std::shared_ptr< GeomAPI_Dir > &theDirX, const std::shared_ptr< GeomAPI_Dir > &theDirY, PointToRefsMap &thePointToAttributeOrObject)
Removes attributes which points are out of the base shape.
Definition: ModelGeomAlgo_Point2D.cpp:280
static std::shared_ptr< GeomDataAPI_Point2D > getPointOfRefAttr(ModelAPI_Feature *theFeature, const std::string &theAttribute, const std::string &theObjectFeatureKind="", const std::string &theObjectFeatureAttribute="")
Searches Point2D attribute of reference of the attribute of given feature.
Definition: ModelGeomAlgo_Point2D.cpp:53