# TaggedLineString.h

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