1 // Copyright (C) 2007-2013 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.
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 email : webmaster.salome@opencascade.com
19 // Author : Anthony Geay (CEA/DEN)
21 #ifndef __INTERPKERNELGEO2DELEMENTARYEDGE_HXX__
22 #define __INTERPKERNELGEO2DELEMENTARYEDGE_HXX__
24 #include "INTERPKERNELDefines.hxx"
25 #include "InterpKernelException.hxx"
26 #include "InterpKernelGeo2DAbstractEdge.hxx"
27 #include "InterpKernelGeo2DEdge.hxx"
29 namespace INTERP_KERNEL
34 INTERPKERNEL_EXPORT ElementaryEdge(Edge *ptr, bool direction):_direction(direction),_ptr(ptr) { }
35 INTERPKERNEL_EXPORT ElementaryEdge(const ElementaryEdge& other);
36 INTERPKERNEL_EXPORT ~ElementaryEdge();
37 INTERPKERNEL_EXPORT bool isThereStartPoint() const { return _iterator.isValid(); }
38 INTERPKERNEL_EXPORT IteratorOnComposedEdge& getIterator() { return _iterator; }
39 INTERPKERNEL_EXPORT bool completed() const { return false; }
40 INTERPKERNEL_EXPORT void declareOn() const { _ptr->declareOn(); }
41 INTERPKERNEL_EXPORT void declareIn() const { _ptr->declareIn(); }
42 INTERPKERNEL_EXPORT void declareOut() const { _ptr->declareOut(); }
43 INTERPKERNEL_EXPORT TypeOfEdgeLocInPolygon getLoc() const { return _ptr->getLoc(); }
44 INTERPKERNEL_EXPORT Edge *getPtr() const { return _ptr; }
45 INTERPKERNEL_EXPORT void reverse() { _direction=(!_direction); }
46 INTERPKERNEL_EXPORT bool isNodeIn(Node *n) const;
47 INTERPKERNEL_EXPORT double getAreaOfZone() const { double ret=_ptr->getAreaOfZone(); return _direction?ret:-ret; }
48 INTERPKERNEL_EXPORT void getBarycenterOfZone(double *bary) const;
49 INTERPKERNEL_EXPORT void fillBounds(Bounds& output) const;
50 INTERPKERNEL_EXPORT void applySimilarity(double xBary, double yBary, double dimChar) { _ptr->applySimilarity(xBary,yBary,dimChar); }
51 INTERPKERNEL_EXPORT void unApplySimilarity(double xBary, double yBary, double dimChar) { _ptr->unApplySimilarity(xBary,yBary,dimChar); }
52 INTERPKERNEL_EXPORT void getAllNodes(std::set<Node *>& output) const;
53 INTERPKERNEL_EXPORT void getBarycenter(double *bary, double& weigh) const;
54 INTERPKERNEL_EXPORT ElementaryEdge *clone() const;
55 INTERPKERNEL_EXPORT void initLocations() const;
56 INTERPKERNEL_EXPORT int size() const;
57 INTERPKERNEL_EXPORT TypeOfEdgeLocInPolygon locateFullyMySelfAbsolute(const ComposedEdge& pol) const;
58 INTERPKERNEL_EXPORT TypeOfEdgeLocInPolygon locateFullyMySelf(const ComposedEdge& pol, TypeOfEdgeLocInPolygon precEdgeLoc) const;
59 INTERPKERNEL_EXPORT Node *getEndNode() const;
60 INTERPKERNEL_EXPORT Node *getStartNode() const;
61 INTERPKERNEL_EXPORT double getCurveLength() const { return _ptr->getCurveLength(); }
62 INTERPKERNEL_EXPORT bool changeEndNodeWith(Node *node) const;
63 INTERPKERNEL_EXPORT bool changeStartNodeWith(Node *node) const;
64 INTERPKERNEL_EXPORT bool intresicEqual(const ElementaryEdge *other) const;
65 INTERPKERNEL_EXPORT bool intresicEqualDirSensitive(const ElementaryEdge *other) const;
66 INTERPKERNEL_EXPORT void dumpInXfigFile(std::ostream& stream, int resolution, const Bounds& box) const;
67 INTERPKERNEL_EXPORT bool getDirection() const { return _direction; }
68 INTERPKERNEL_EXPORT bool intresincEqCoarse(const Edge *other) const;
69 INTERPKERNEL_EXPORT bool isEqual(const ElementaryEdge& other) const;
71 INTERPKERNEL_EXPORT void fillGlobalInfoAbs(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
72 std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const;
73 INTERPKERNEL_EXPORT void fillGlobalInfoAbs2(const std::map<INTERP_KERNEL::Node *,int>& mapThis, const std::map<INTERP_KERNEL::Node *,int>& mapOther, int offset1, int offset2, double fact, double baryX, double baryY,
74 std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;
75 INTERPKERNEL_EXPORT static ElementaryEdge *BuildEdgeFromCrudeDataArray(bool direction, INTERP_KERNEL::Node *start, INTERP_KERNEL::Node *end);
79 IteratorOnComposedEdge _iterator;