1 // Copyright (C) 2007-2008 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 #ifndef __ELEMENTARYEDGE_HXX__
20 #define __ELEMENTARYEDGE_HXX__
22 #include "INTERPKERNELGEOMETRIC2DDefines.hxx"
23 #include "InterpKernelException.hxx"
24 #include "AbstractEdge.hxx"
27 namespace INTERP_KERNEL
29 class INTERPKERNELGEOMETRIC2D_EXPORT ElementaryEdge
32 ElementaryEdge(Edge *ptr, bool direction):_direction(direction),_ptr(ptr) { }
33 ElementaryEdge(const ElementaryEdge& other);
35 bool isThereStartPoint() const { return _iterator.isValid(); }
36 IteratorOnComposedEdge& getIterator() { return _iterator; }
37 bool completed() const { return false; }
38 void declareOn() const { _ptr->declareOn(); }
39 void declareIn() const { _ptr->declareIn(); }
40 void declareOut() const { _ptr->declareOut(); }
41 TypeOfEdgeLocInPolygon getLoc() const { return _ptr->getLoc(); }
42 Edge *getPtr() const { return _ptr; }
43 void reverse() { _direction=(!_direction); }
44 bool isNodeIn(Node *n) const;
45 double getAreaOfZone() const { double ret=_ptr->getAreaOfZone(); return _direction?ret:-ret; }
46 void getBarycenterOfZone(double *bary) const;
47 void fillBounds(Bounds& output) const;
48 void applySimilarity(double xBary, double yBary, double dimChar) { _ptr->applySimilarity(xBary,yBary,dimChar); }
49 void getAllNodes(std::set<Node *>& output) const;
50 void getBarycenter(double *bary, double& weigh) const;
51 ElementaryEdge *clone() const;
52 void initLocations() const;
54 TypeOfEdgeLocInPolygon locateFullyMySelfAbsolute(const ComposedEdge& pol) const;
55 TypeOfEdgeLocInPolygon locateFullyMySelf(const ComposedEdge& pol, TypeOfEdgeLocInPolygon precEdgeLoc) const;
56 Node *getEndNode() const;
57 Node *getStartNode() const;
58 double getCurveLength() const { return _ptr->getCurveLength(); }
59 bool changeEndNodeWith(Node *node) const;
60 bool changeStartNodeWith(Node *node) const;
61 bool intresicEqual(const ElementaryEdge *other) const;
62 bool intresicEqualDirSensitive(const ElementaryEdge *other) const;
63 void dumpInXfigFile(std::ostream& stream, int resolution, const Bounds& box) const;
64 bool getDirection() const { return _direction; }
65 bool intresincEqCoarse(const Edge *other) const;
69 IteratorOnComposedEdge _iterator;