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