1 /**********************************************************************
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
6 * Copyright (C) 2006 Refractions Research Inc.
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
13 **********************************************************************
15 * Last port: simplify/TaggedLineString.java rev. 1.2 (JTS-1.7.1)
17 **********************************************************************
19 * NOTES: This class can be optimized to work with vector<Coordinate*>
20 * rather then with CoordinateSequence. Also, LineSegment should
21 * be replaced with a class not copying Coordinates.
23 **********************************************************************/
25 #ifndef GEOS_SIMPLIFY_TAGGEDLINESTRING_H
26 #define GEOS_SIMPLIFY_TAGGEDLINESTRING_H
28 #include <geos/export.h>
34 #pragma warning(disable: 4251) // warning C4251: needs to have dll-interface to be used by clients of class
37 // Forward declarations
41 class CoordinateSequence
;
47 class TaggedLineSegment
;
52 namespace simplify
{ // geos::simplify
57 * Contains and owns a list of TaggedLineSegments
60 class GEOS_DLL TaggedLineString
{
64 typedef std::vector
<geom::Coordinate
> CoordVect
;
66 typedef std::auto_ptr
<CoordVect
> CoordVectPtr
;
68 typedef geom::CoordinateSequence CoordSeq
;
70 typedef std::auto_ptr
<geom::CoordinateSequence
> CoordSeqPtr
;
72 TaggedLineString(const geom::LineString
* nParentLine
,
73 std::size_t minimumSize
=2);
77 std::size_t getMinimumSize() const;
79 const geom::LineString
* getParent() const;
81 const CoordSeq
* getParentCoordinates() const;
83 CoordSeqPtr
getResultCoordinates() const;
85 std::size_t getResultSize() const;
87 TaggedLineSegment
* getSegment(std::size_t i
);
89 const TaggedLineSegment
* getSegment(std::size_t i
) const;
91 std::vector
<TaggedLineSegment
*>& getSegments();
93 const std::vector
<TaggedLineSegment
*>& getSegments() const;
95 void addToResult(std::auto_ptr
<TaggedLineSegment
> seg
);
97 std::auto_ptr
<geom::Geometry
> asLineString() const;
99 std::auto_ptr
<geom::Geometry
> asLinearRing() const;
103 const geom::LineString
* parentLine
;
105 // TaggedLineSegments owned by this object
106 std::vector
<TaggedLineSegment
*> segs
;
108 // TaggedLineSegments owned by this object
109 std::vector
<TaggedLineSegment
*> resultSegs
;
111 std::size_t minimumSize
;
115 static CoordVectPtr
extractCoordinates(
116 const std::vector
<TaggedLineSegment
*>& segs
);
118 // Copying is turned off
119 TaggedLineString(const TaggedLineString
&);
120 TaggedLineString
& operator= (const TaggedLineString
&);
124 } // namespace geos::simplify
131 #endif // GEOS_SIMPLIFY_TAGGEDLINESTRING_H