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
31 class INTERPKERNEL_EXPORT ElementaryEdge
34 ElementaryEdge(Edge *ptr, bool direction):_direction(direction),_ptr(ptr) { }
35 ElementaryEdge(const ElementaryEdge& other);
37 bool isThereStartPoint() const { return _iterator.isValid(); }
38 IteratorOnComposedEdge& getIterator() { return _iterator; }
39 bool completed() const { return false; }
40 void declareOn() const { _ptr->declareOn(); }
41 void declareIn() const { _ptr->declareIn(); }
42 void declareOut() const { _ptr->declareOut(); }
43 TypeOfEdgeLocInPolygon getLoc() const { return _ptr->getLoc(); }
44 Edge *getPtr() const { return _ptr; }
45 void reverse() { _direction=(!_direction); }
46 bool isNodeIn(Node *n) const;
47 double getAreaOfZone() const { double ret=_ptr->getAreaOfZone(); return _direction?ret:-ret; }
48 void getBarycenterOfZone(double *bary) const;
49 void fillBounds(Bounds& output) const;
50 void applySimilarity(double xBary, double yBary, double dimChar) { _ptr->applySimilarity(xBary,yBary,dimChar); }
51 void unApplySimilarity(double xBary, double yBary, double dimChar) { _ptr->unApplySimilarity(xBary,yBary,dimChar); }
52 void getAllNodes(std::set<Node *>& output) const;
53 void getBarycenter(double *bary, double& weigh) const;
54 ElementaryEdge *clone() const;
55 void initLocations() const;
57 TypeOfEdgeLocInPolygon locateFullyMySelfAbsolute(const ComposedEdge& pol) const;
58 TypeOfEdgeLocInPolygon locateFullyMySelf(const ComposedEdge& pol, TypeOfEdgeLocInPolygon precEdgeLoc) const;
59 Node *getEndNode() const;
60 Node *getStartNode() const;
61 double getCurveLength() const { return _ptr->getCurveLength(); }
62 bool changeEndNodeWith(Node *node) const;
63 bool changeStartNodeWith(Node *node) const;
64 bool intresicEqual(const ElementaryEdge *other) const;
65 bool intresicEqualDirSensitive(const ElementaryEdge *other) const;
66 void dumpInXfigFile(std::ostream& stream, int resolution, const Bounds& box) const;
67 bool getDirection() const { return _direction; }
68 bool intresincEqCoarse(const Edge *other) const;
69 bool isEqual(const ElementaryEdge& other) const;
71 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 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 static ElementaryEdge *BuildEdgeFromCrudeDataArray(bool direction, INTERP_KERNEL::Node *start, INTERP_KERNEL::Node *end);
79 IteratorOnComposedEdge _iterator;