GEOS: SegmentStringUtil.h Source File

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

- File List

# SegmentStringUtil.h

    00001 /**********************************************************************
    00002  * $Id: SegmentStringUtil.h 2325 2009-04-08 13:02:06Z 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 Public Licence as published
    00011  * by the Free Software Foundation.
    00012  * See the COPYING file for more information.
    00013  *
    00014  *
    00015  **********************************************************************
    00016  *
    00017  * Last port: noding/SegmentStringUtil.java rev. 1.2 (JTS-1.9)
    00018  *
    00019  **********************************************************************/
    00020
    00021 #ifndef GEOS_NODING_SEGMENTSTRINGUTIL_H
    00022 #define GEOS_NODING_SEGMENTSTRINGUTIL_H
    00023
    00024 #include <geos/noding/NodedSegmentString.h>
    00025 #include <geos/geom/LineString.h>
    00026 #include <geos/geom/CoordinateSequence.h>
    00027 #include <geos/geom/util/LinearComponentExtracter.h>
    00028
    00029 namespace geos {
    00030 namespace noding { // geos::noding
    00031
    00038 class SegmentStringUtil
    00039 {
    00040 public:
    00059         static void extractSegmentStrings(const geom::Geometry * g,
    00060                                           SegmentString::ConstVect& segStr)
    00061         {
    00062                 geom::LineString::ConstVect lines;
    00063                 geom::util::LinearComponentExtracter::getLines(*g, lines);
    00064
    00065                 for (size_t i=0, n=lines.size(); i<n; i++)
    00066                 {
    00067                         geom::LineString* line = (geom::LineString*)(lines[i]);
    00068
    00069                         // we take ownership of the coordinates here
    00070                         // TODO: check if this can be optimized by getting
    00071                         //       the internal CS.
    00072                         geom::CoordinateSequence* pts = line->getCoordinates();
    00073
    00074                         segStr.push_back(new NodedSegmentString(pts, g));
    00075                 }
    00076         }
    00077
    00078 };
    00079
    00080 } // geos::noding
    00081 } // geos
    00082
    00083 #endif // GEOS_NODING_SEGMENTSTRINGUTIL_H
    00084 /**********************************************************************
    00085  * $Log$
    00086  **********************************************************************/
    00087