• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List

TaggedLineString.h

00001 /**********************************************************************
00002  * $Id: TaggedLineString.h 2785 2009-12-03 19:55:11Z mloskot $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2006 Refractions Research Inc.
00008  *
00009  * This is free software; you can redistribute and/or modify it under
00010  * the terms of the GNU Lesser General Licence as published
00011  * by the Free Software Foundation. 
00012  * See the COPYING file for more information.
00013  *
00014  **********************************************************************
00015  *
00016  * Last port: simplify/TaggedLineString.java rev. 1.2 (JTS-1.7.1)
00017  *
00018  **********************************************************************
00019  *
00020  * NOTES: This class can be optimized to work with vector<Coordinate*>
00021  *        rather then with CoordinateSequence. Also, LineSegment should
00022  *        be replaced with a class not copying Coordinates.
00023  *
00024  **********************************************************************/
00025 
00026 #ifndef GEOS_SIMPLIFY_TAGGEDLINESTRING_H
00027 #define GEOS_SIMPLIFY_TAGGEDLINESTRING_H
00028 
00029 #include <geos/export.h>
00030 #include <vector>
00031 #include <memory>
00032 
00033 // Forward declarations
00034 namespace geos {
00035         namespace geom {
00036                 class Coordinate;
00037                 class CoordinateSequence;
00038                 class Geometry;
00039                 class LineString;
00040                 class LinearRing;
00041         }
00042         namespace simplify {
00043                 class TaggedLineSegment;
00044         }
00045 }
00046 
00047 namespace geos {
00048 namespace simplify { // geos::simplify
00049 
00050 
00056 class GEOS_DLL TaggedLineString {
00057 
00058 public:
00059 
00060         typedef std::vector<geom::Coordinate> CoordVect;
00061         
00062         typedef std::auto_ptr<CoordVect> CoordVectPtr;
00063 
00064         typedef geom::CoordinateSequence CoordSeq;
00065 
00066         typedef std::auto_ptr<geom::CoordinateSequence> CoordSeqPtr;
00067 
00068         TaggedLineString(const geom::LineString* nParentLine,
00069                         size_t minimumSize=2);
00070 
00071         ~TaggedLineString();
00072 
00073         size_t getMinimumSize() const;
00074 
00075         const geom::LineString* getParent() const;
00076 
00077         const CoordSeq* getParentCoordinates() const;
00078 
00079         CoordSeqPtr getResultCoordinates() const;
00080 
00081         size_t getResultSize() const;
00082 
00083         TaggedLineSegment* getSegment(size_t);
00084 
00085         const TaggedLineSegment* getSegment(size_t) const;
00086 
00087         std::vector<TaggedLineSegment*>& getSegments();
00088 
00089         const std::vector<TaggedLineSegment*>& getSegments() const;
00090 
00091         void addToResult(std::auto_ptr<TaggedLineSegment> seg);
00092 
00093         std::auto_ptr<geom::Geometry> asLineString() const;
00094 
00095         std::auto_ptr<geom::Geometry> asLinearRing() const;
00096 
00097 private:
00098 
00099         const geom::LineString* parentLine;
00100 
00101         // TaggedLineSegments owned by this object
00102         std::vector<TaggedLineSegment*> segs;
00103 
00104         // TaggedLineSegments owned by this object
00105         std::vector<TaggedLineSegment*> resultSegs;
00106 
00107         size_t minimumSize;
00108 
00109         void init();
00110 
00111         static CoordVectPtr extractCoordinates(
00112                         const std::vector<TaggedLineSegment*>& segs);
00113 
00114         // Copying is turned off
00115         TaggedLineString(const TaggedLineString&);
00116         TaggedLineString& operator= (const TaggedLineString&);
00117 
00118 };
00119 
00120 } // namespace geos::simplify
00121 } // namespace geos
00122 
00123 #endif // GEOS_SIMPLIFY_TAGGEDLINESTRING_H
00124 
00125 /**********************************************************************
00126  * $Log$
00127  * Revision 1.7  2006/06/12 11:29:23  strk
00128  * unsigned int => size_t
00129  *
00130  * Revision 1.6  2006/04/13 21:52:34  strk
00131  * Many debugging lines and assertions added. Fixed bug in TaggedLineString class.
00132  *
00133  * Revision 1.5  2006/04/13 16:04:10  strk
00134  * Made TopologyPreservingSimplifier implementation successfully build
00135  *
00136  * Revision 1.4  2006/04/13 09:21:45  mloskot
00137  * Removed definition of copy ctor and assignment operator for TaggedLineString class.
00138  * According to following rule: Declaring, but not defining, private copy operations has
00139  * the effect of "turning off" copying for the class.
00140  *
00141  * Revision 1.3  2006/04/12 17:19:57  strk
00142  * Ported TaggedLineStringSimplifier class, made LineSegment class
00143  * polymorphic to fix derivation of TaggedLineSegment
00144  *
00145  * Revision 1.2  2006/04/12 15:20:37  strk
00146  * LineSegmentIndex class
00147  *
00148  * Revision 1.1  2006/04/12 14:22:12  strk
00149  * Initial implementation of TaggedLineSegment and TaggedLineString classes
00150  *
00151  **********************************************************************/

Generated on Thu Jul 22 2010 for GEOS by  doxygen 1.7.1