| TerraLib 4.1

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files
- Examples

- File List
- File Members

E:/Projetos_Primeiro_Semestre_2012/TerraView/terralib/src/terralib/kernel/TeOverlayUtils.h
Go to the documentation of this file.

    00001 /************************************************************************************
    00002 TerraLib - a library for developing GIS applications.
    00003 Copyright © 2001-2007 INPE and Tecgraf/PUC-Rio.
    00004
    00005 This code is part of the TerraLib library.
    00006 This library is free software; you can redistribute it and/or
    00007 modify it under the terms of the GNU Lesser General Public
    00008 License as published by the Free Software Foundation; either
    00009 version 2.1 of the License, or (at your option) any later version.
    00010
    00011 You should have received a copy of the GNU Lesser General Public
    00012 License along with this library.
    00013
    00014 The authors reassure the license terms regarding the warranties.
    00015 They specifically disclaim any warranties, including, but not limited to,
    00016 the implied warranties of merchantability and fitness for a particular purpose.
    00017 The library provided hereunder is on an "as is" basis, and the authors have no
    00018 obligation to provide maintenance, support, updates, enhancements, or modifications.
    00019 In no event shall INPE and Tecgraf / PUC-Rio be held liable to any party for direct,
    00020 indirect, special, incidental, or consequential damages arising out of the use
    00021 of this library and its documentation.
    00022 *************************************************************************************/
    00035 #ifndef  __TERRALIB_INTERNAL_OVERLAYUTILS_H
    00036 #define  __TERRALIB_INTERNAL_OVERLAYUTILS_H
    00037
    00038 // STL's include
    00039 #include <map>
    00040 #include <vector>
    00041 #include <algorithm>
    00042 using namespace std;
    00043
    00044 #include "TeGeometry.h"
    00045 #include "TeIntersector.h"
    00046
    00047
    00048 namespace TeOVERLAY
    00049 {
    00050
    00051 //---------------- Auxiliary structures ----------------//
    00053 struct TL_DLL xyOrder
    00054 {
    00056            bool operator()(const TeCoord2D& c1, const TeCoord2D& c2) const
    00057            {
    00058                       if(c1.x_ < c2.x_)
    00059                                  return true;
    00060
    00061                       if(c1.x_ > c2.x_)
    00062                                  return false;
    00063
    00064                       if(c1.y_ < c2.y_)
    00065                                  return true;
    00066
    00067                       return false;
    00068            }
    00069 };
    00070
    00072 typedef multimap<TeCoord2D, pair<unsigned int, TeLine2D>, xyOrder> TeLineIndex;
    00073
    00075 struct TL_DLL segOrder
    00076 {
    00078            bool operator()(const TeINTERSECTOR2::TeSegIdInPolygonSet& ip1, const TeINTERSECTOR2::TeSegIdInPolygonSet& ip2) const
    00079            {
    00080                       if(ip1.polId_ < ip2.polId_)
    00081                                  return true;
    00082
    00083                       return false;
    00084            }
    00085 };
    00086 //---------------- Auxiliary operations for overlay ----------------//
    00087
    00089 TL_DLL void TeFixOrientation(TePolygonSet& polSet, const short& outerOrientationToReverse, const short& innerOrientationToReverse);
    00090
    00091
    00093 TL_DLL void TeChooseBoundaryLocation(const short& operation, short& locationRedFragments, short& locationBlueFragments);
    00094
    00095
    00097 TL_DLL void TeRemoveOpositeBoundaryFragments(TeLineIndex& fragmentsIndex);
    00098
    00099
    00101 TL_DLL void TeRemoveSameBoundaryFragments(TeLineIndex& fragmentsIndex);
    00102
    00104 TL_DLL void TeJoinFragments(TeLineIndex& fragmentsIndex, TeLineIndex& boundaryFragmentsIndex);
    00105
    00107 TL_DLL void TeFindAndMoveClosedRings(TeLineIndex& fragmentsIndex, vector<TeLinearRing>& rings);
    00108
    00110 TL_DLL bool TeMountTopology(TePolygonSet& polysOut, vector<TeLinearRing>& holes);
    00111
    00113 TL_DLL bool TeMergeFragments(TeLineIndex& fragmentsIndex, vector<TeLinearRing>& rings, const bool& doExaustive = false);
    00114
    00116 TL_DLL bool TeClassifyRings(vector<TeLinearRing>& rings, TePolygonSet& polsOut, vector<TeLinearRing>& holes);
    00117
    00119 TL_DLL void TeRtreeGetFragments(const TePolygonSet& bluePolygons, TeINTERSECTOR2::TeSegmentRTree& blueTree, TeLineSet& redFragments, const short& locationFragments, short& mask, TeLineIndex& redFragmentsIndex, vector<TeLinearRing>& rings);
    00120
    00122 TL_DLL void TeRtreeGetFragments(const TePolygonSet& polygons, TeINTERSECTOR2::TeSegmentRTree& tree, TeLineSet& fragments, vector<pair<unsigned int, unsigned int> >& fragmentsIds, const short& locationFragments, short& mask, TeLineIndex& fragmentsIndex, vector<TeLinearRing>& rings);
    00123
    00125 TL_DLL void TeRtreeRemoveFragments(const TePolygonSet& polygons, TeINTERSECTOR2::TeSegmentRTree& tree, TeLineIndex &lineIndex, vector<pair<unsigned int, unsigned int> >& fragmentsIds, const short& locationFragments, short& mask, vector<TeLinearRing>& rings);
    00126
    00128 /*
    00129            \param  ring                     Ring to be broken.
    00130            \param  ringsOut      Resulting rings.
    00131            \return                                     Returns true if the operation successed otherwise returns false.
    00132  */
    00133 TL_DLL bool TeSplitRing(TeLinearRing& ring, TeLineSet& ringsOut);
    00134
    00136 /*
    00137            \param  rings                    A vector of linear rings to be broken.
    00138            \param  ringsOut      Resulting rings.
    00139            \return                                     Returns true if the operation successed otherwise returns false.
    00140  */
    00141 TL_DLL bool TeSplitRings(vector<TeLinearRing>& rings, vector<TeLinearRing>& ringsOut);
    00142
    00144 /*
    00145            \param lineIn   Line to ble cloned.
    00146            \param lineOut  Cloned line without repeated points.
    00147            \param minPts         This is a constant to check if the cloned line has the minimum number of points.
    00148            \return         Returns true if the operation successed otherwise returns false.
    00149  */
    00150 TL_DLL bool TeCloneLine(const TeLine2D& lineIn, TeLine2D& lineOut, const unsigned int& minPts);
    00151
    00153 /*
    00154            \param polIn       Polygon to be cloned.
    00155            \param polOut      Cloned polygon without repeated points.
    00156            \return            Returns true if the operation successed otherwise returns false.
    00157  */
    00158 TL_DLL bool TeClonePolygon(const TePolygon& polIn, TePolygon& polOut);
    00159
    00161 /*
    00162            \param polsIn       Polygons to be cloned.
    00163            \param polsOut      Cloned polygons without repeated points.
    00164            \return             Returns true if the operation successed otherwise returns false.
    00165  */
    00166 TL_DLL bool TeClonePolygonSet(const TePolygonSet& polsIn, TePolygonSet& polsOut);
    00167
    00168 }          // end namespace TeOVERLAY
    00169
    00170 #endif     // __TERRALIB_INTERNAL_OVERLAYUTILS_H
    00171
    00172

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines