]> SALOME platform Git repositories - tools/medcoupling.git/blob - src/INTERP_KERNEL/Geometric2D/ComposedEdge.hxx
Salome HOME
Merge from BR_V5_DEV 16Feb09
[tools/medcoupling.git] / src / INTERP_KERNEL / Geometric2D / ComposedEdge.hxx
1 //  Copyright (C) 2007-2008  CEA/DEN, EDF R&D
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.
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 #ifndef __COMPOSEDNODE_HXX__
20 #define __COMPOSEDNODE_HXX__
21
22 #include "INTERPKERNELGEOMETRIC2DDefines.hxx"
23
24 #include <set>
25 #include <list>
26 #include <vector>
27
28 namespace INTERP_KERNEL
29 {
30   class Node;
31   class Edge;
32   class Bounds;
33   class ElementaryEdge;
34   class IteratorOnComposedEdge;
35
36   class INTERPKERNELGEOMETRIC2D_EXPORT ComposedEdge
37   {
38     friend class IteratorOnComposedEdge;
39   public:
40     ComposedEdge() { }
41     ComposedEdge(const ComposedEdge& other);
42     ComposedEdge(int size):_sub_edges(size) { }
43     static void Delete(ComposedEdge *pt) { delete pt; }
44     static void SoftDelete(ComposedEdge *pt) { pt->_sub_edges.clear(); delete pt; }
45     void reverse();
46     int recursiveSize() const { return _sub_edges.size(); }
47     void initLocations() const;
48     ComposedEdge *clone() const;
49     bool isNodeIn(Node *n) const;
50     double getArea() const;
51     double getPerimeter() const;
52     double getHydraulicDiameter() const;
53     void getBarycenter(double *bary) const;
54     double normalize(ComposedEdge *other);
55     void fillBounds(Bounds& output) const;
56     void applySimilarity(double xBary, double yBary, double dimChar);
57     void applyGlobalSimilarity(double xBary, double yBary, double dimChar);
58     void dispatchPerimeter(double& partConsidered) const;
59     void dispatchPerimeterExcl(double& partConsidered, double& commonPart) const;
60     double dispatchPerimeterAdv(const ComposedEdge& father, std::vector<double>& result) const;
61     void getAllNodes(std::set<Node *>& output) const;
62     void getBarycenter(double *bary, double& weigh) const;
63     bool completed() const { return getEndNode()==getStartNode(); }
64     void setValueAt(int i, Edge *e, bool direction=true);
65     double getCommonLengthWith(const ComposedEdge& other) const;
66     void clear();
67     bool empty() const { return _sub_edges.empty(); }
68     ElementaryEdge *front() const { return _sub_edges.front(); }
69     ElementaryEdge *back() const { return _sub_edges.back(); }
70     void resize(int i) { _sub_edges.resize(i); }
71     void pushBack(Edge *edge, bool direction=true);
72     void pushBack(ElementaryEdge *elem);
73     void pushBack(ComposedEdge *elem);
74     int size() const { return _sub_edges.size(); }
75     ElementaryEdge *operator[](int i) const;
76     Node *getEndNode() const;
77     Node *getStartNode() const;
78     bool changeEndNodeWith(Node *node) const;
79     bool changeStartNodeWith(Node *node) const;
80     void dumpInXfigFile(std::ostream& stream, int resolution, const Bounds& box) const;
81     bool isInOrOut(Node *nodeToTest) const;
82     bool getDirection() const;
83     bool intresincEqCoarse(const Edge *other) const;
84   private:
85     std::list<ElementaryEdge *>* getListBehind() { return &_sub_edges; }
86   protected:
87     ~ComposedEdge();
88   private:
89     void clearAll(std::list<ElementaryEdge *>::iterator startToDel);
90   protected:
91     std::list<ElementaryEdge *> _sub_edges;
92   };
93 }
94
95 #endif