Back to index

salome-med  6.5.0
InterpKernelGeo2DElementaryEdge.hxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 #ifndef __INTERPKERNELGEO2DELEMENTARYEDGE_HXX__
00021 #define __INTERPKERNELGEO2DELEMENTARYEDGE_HXX__
00022 
00023 #include "INTERPKERNELDefines.hxx"
00024 #include "InterpKernelException.hxx"
00025 #include "InterpKernelGeo2DAbstractEdge.hxx"
00026 #include "InterpKernelGeo2DEdge.hxx"
00027 
00028 namespace INTERP_KERNEL
00029 {
00030   class INTERPKERNEL_EXPORT ElementaryEdge
00031   {
00032   public:
00033     ElementaryEdge(Edge *ptr, bool direction):_direction(direction),_ptr(ptr) { }
00034     ElementaryEdge(const ElementaryEdge& other);
00035     ~ElementaryEdge();
00036     bool isThereStartPoint() const { return _iterator.isValid(); }
00037     IteratorOnComposedEdge& getIterator() { return _iterator; }
00038     bool completed() const { return false; }
00039     void declareOn() const { _ptr->declareOn(); }
00040     void declareIn() const { _ptr->declareIn(); }
00041     void declareOut() const { _ptr->declareOut(); }
00042     TypeOfEdgeLocInPolygon getLoc() const { return _ptr->getLoc(); }
00043     Edge *getPtr() const { return _ptr; }
00044     void reverse() { _direction=(!_direction); }
00045     bool isNodeIn(Node *n) const;
00046     double getAreaOfZone() const { double ret=_ptr->getAreaOfZone(); return _direction?ret:-ret; }
00047     void getBarycenterOfZone(double *bary) const;
00048     void fillBounds(Bounds& output) const;
00049     void applySimilarity(double xBary, double yBary, double dimChar) { _ptr->applySimilarity(xBary,yBary,dimChar); }
00050     void unApplySimilarity(double xBary, double yBary, double dimChar) { _ptr->unApplySimilarity(xBary,yBary,dimChar); }
00051     void getAllNodes(std::set<Node *>& output) const;
00052     void getBarycenter(double *bary, double& weigh) const;
00053     ElementaryEdge *clone() const;
00054     void initLocations() const;
00055     int size() const;
00056     TypeOfEdgeLocInPolygon locateFullyMySelfAbsolute(const ComposedEdge& pol) const;
00057     TypeOfEdgeLocInPolygon locateFullyMySelf(const ComposedEdge& pol, TypeOfEdgeLocInPolygon precEdgeLoc) const;
00058     Node *getEndNode() const;
00059     Node *getStartNode() const;
00060     double getCurveLength() const { return _ptr->getCurveLength(); }
00061     bool changeEndNodeWith(Node *node) const;
00062     bool changeStartNodeWith(Node *node) const;
00063     bool intresicEqual(const ElementaryEdge *other) const;
00064     bool intresicEqualDirSensitive(const ElementaryEdge *other) const;
00065     void dumpInXfigFile(std::ostream& stream, int resolution, const Bounds& box) const;
00066     bool getDirection() const { return _direction; }
00067     bool intresincEqCoarse(const Edge *other) const;
00068     bool isEqual(const ElementaryEdge& other) const;
00069   public:
00070     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,
00071                            std::vector<int>& edgesThis, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int> mapAddCoo) const;
00072     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,
00073                             std::vector<int>& edgesOther, std::vector<double>& addCoo, std::map<INTERP_KERNEL::Node *,int>& mapAddCoo) const;
00074     static ElementaryEdge *BuildEdgeFromCrudeDataArray(bool direction, INTERP_KERNEL::Node *start, INTERP_KERNEL::Node *end);
00075   private:
00076     bool _direction;
00077     Edge *_ptr;
00078     IteratorOnComposedEdge _iterator;
00079   };
00080 }
00081 
00082 #endif