GEOS: SegmentStringUtil.h Source File

GEOS 3.5.0

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

- File List

SegmentStringUtil.h
1 /**********************************************************************
2 *
3 * GEOS - Geometry Engine Open Source
4 * http://geos.osgeo.org
5 *
6 * Copyright (C) 2006 Refractions Research Inc.
7 *
8 * This is free software; you can redistribute and/or modify it under
9 * the terms of the GNU Lesser General Public Licence as published
10 * by the Free Software Foundation.
11 * See the COPYING file for more information.
12 *
13 *
14 **********************************************************************
15 *
16 * Last port: noding/SegmentStringUtil.java rev. 1.2 (JTS-1.9)
17 *
18 **********************************************************************/
19
20 #ifndef GEOS_NODING_SEGMENTSTRINGUTIL_H
21 #define GEOS_NODING_SEGMENTSTRINGUTIL_H
22
23 #include <geos/noding/NodedSegmentString.h>
24 #include <geos/geom/LineString.h>
25 #include <geos/geom/CoordinateSequence.h>
26 #include <geos/geom/util/LinearComponentExtracter.h>
27
28 namespace geos {
29 namespace noding { // geos::noding
30
37 class SegmentStringUtil
38 {
39 public:
51 static void extractSegmentStrings(const geom::Geometry * g,
52 SegmentString::ConstVect& segStr)
53 {
54 geom::LineString::ConstVect lines;
55 geom::util::LinearComponentExtracter::getLines(*g, lines);
56
57 for (std::size_t i=0, n=lines.size(); i<n; i++)
58 {
59 geom::LineString* line = (geom::LineString*)(lines[i]);
60
61 // we take ownership of the coordinates here
62 // TODO: check if this can be optimized by getting
63 // the internal CS.
64 geom::CoordinateSequence* pts = line->getCoordinates();
65
66 segStr.push_back(new NodedSegmentString(pts, g));
67 }
68 }
69
70 };
71
72 } // geos::noding
73 } // geos
74
75 #endif // GEOS_NODING_SEGMENTSTRINGUTIL_H
geos::geom::LineString::getCoordinates
virtual CoordinateSequence * getCoordinates() const
Returns this Geometry vertices. Caller takes ownership of the returned object.
geos::noding::NodedSegmentString
Represents a list of contiguous line segments, and supports noding the segments.
Definition: NodedSegmentString.h:57
geos::geom::Geometry
Basic implementation of Geometry, constructed and destructed by GeometryFactory.
Definition: Geometry.h:167
geos::geom::LineString
Definition: LineString.h:70
geos::geom::LineString::ConstVect
std::vector< const LineString * > ConstVect
A vector of const LineString pointers.
Definition: LineString.h:77
geos::noding::SegmentStringUtil::extractSegmentStrings
static void extractSegmentStrings(const geom::Geometry *g, SegmentString::ConstVect &segStr)
Extracts all linear components from a given Geometry to SegmentStrings.
Definition: SegmentStringUtil.h:51
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::geom::util::LinearComponentExtracter::getLines
static void getLines(const Geometry &geom, std::vector< const LineString * > &ret)
geos::noding::SegmentStringUtil
Utility methods for processing SegmentStrings.
Definition: SegmentStringUtil.h:37
geos::geom::CoordinateSequence
The internal representation of a list of coordinates inside a Geometry.
Definition: CoordinateSequence.h:59