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

- File List

# TaggedLineString.h

    00001 /**********************************************************************
    00002  * $Id: TaggedLineString.h 3275 2011-03-26 14:02:32Z strk $
    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 #ifdef _MSC_VER
    00034 #pragma warning(push)
    00035 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
    00036 #endif
    00037
    00038 // Forward declarations
    00039 namespace geos {
    00040         namespace geom {
    00041                 class Coordinate;
    00042                 class CoordinateSequence;
    00043                 class Geometry;
    00044                 class LineString;
    00045                 class LinearRing;
    00046         }
    00047         namespace simplify {
    00048                 class TaggedLineSegment;
    00049         }
    00050 }
    00051
    00052 namespace geos {
    00053 namespace simplify { // geos::simplify
    00054
    00055
    00061 class GEOS_DLL TaggedLineString {
    00062
    00063 public:
    00064
    00065         typedef std::vector<geom::Coordinate> CoordVect;
    00066
    00067         typedef std::auto_ptr<CoordVect> CoordVectPtr;
    00068
    00069         typedef geom::CoordinateSequence CoordSeq;
    00070
    00071         typedef std::auto_ptr<geom::CoordinateSequence> CoordSeqPtr;
    00072
    00073         TaggedLineString(const geom::LineString* nParentLine,
    00074                         std::size_t minimumSize=2);
    00075
    00076         ~TaggedLineString();
    00077
    00078         std::size_t getMinimumSize() const;
    00079
    00080         const geom::LineString* getParent() const;
    00081
    00082         const CoordSeq* getParentCoordinates() const;
    00083
    00084         CoordSeqPtr getResultCoordinates() const;
    00085
    00086         std::size_t getResultSize() const;
    00087
    00088         TaggedLineSegment* getSegment(std::size_t i);
    00089
    00090         const TaggedLineSegment* getSegment(std::size_t i) const;
    00091
    00092         std::vector<TaggedLineSegment*>& getSegments();
    00093
    00094         const std::vector<TaggedLineSegment*>& getSegments() const;
    00095
    00096         void addToResult(std::auto_ptr<TaggedLineSegment> seg);
    00097
    00098         std::auto_ptr<geom::Geometry> asLineString() const;
    00099
    00100         std::auto_ptr<geom::Geometry> asLinearRing() const;
    00101
    00102 private:
    00103
    00104         const geom::LineString* parentLine;
    00105
    00106         // TaggedLineSegments owned by this object
    00107         std::vector<TaggedLineSegment*> segs;
    00108
    00109         // TaggedLineSegments owned by this object
    00110         std::vector<TaggedLineSegment*> resultSegs;
    00111
    00112         std::size_t minimumSize;
    00113
    00114         void init();
    00115
    00116         static CoordVectPtr extractCoordinates(
    00117                         const std::vector<TaggedLineSegment*>& segs);
    00118
    00119         // Copying is turned off
    00120         TaggedLineString(const TaggedLineString&);
    00121         TaggedLineString& operator= (const TaggedLineString&);
    00122
    00123 };
    00124
    00125 } // namespace geos::simplify
    00126 } // namespace geos
    00127
    00128 #ifdef _MSC_VER
    00129 #pragma warning(pop)
    00130 #endif
    00131
    00132 #endif // GEOS_SIMPLIFY_TAGGEDLINESTRING_H
    00133
    00134 /**********************************************************************
    00135  * $Log$
    00136  * Revision 1.7  2006/06/12 11:29:23  strk
    00137  * unsigned int => size_t
    00138  *
    00139  * Revision 1.6  2006/04/13 21:52:34  strk
    00140  * Many debugging lines and assertions added. Fixed bug in TaggedLineString class.
    00141  *
    00142  * Revision 1.5  2006/04/13 16:04:10  strk
    00143  * Made TopologyPreservingSimplifier implementation successfully build
    00144  *
    00145  * Revision 1.4  2006/04/13 09:21:45  mloskot
    00146  * Removed definition of copy ctor and assignment operator for TaggedLineString class.
    00147  * According to following rule: Declaring, but not defining, private copy operations has
    00148  * the effect of "turning off" copying for the class.
    00149  *
    00150  * Revision 1.3  2006/04/12 17:19:57  strk
    00151  * Ported TaggedLineStringSimplifier class, made LineSegment class
    00152  * polymorphic to fix derivation of TaggedLineSegment
    00153  *
    00154  * Revision 1.2  2006/04/12 15:20:37  strk
    00155  * LineSegmentIndex class
    00156  *
    00157  * Revision 1.1  2006/04/12 14:22:12  strk
    00158  * Initial implementation of TaggedLineSegment and TaggedLineString classes
    00159  *
    00160  **********************************************************************/