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

# SegmentString.h

    00001 /**********************************************************************
    00002  * $Id: SegmentString.h 1872 2006-10-20 11:18:39Z 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 #ifndef GEOS_NODING_SEGMENTSTRING_H
    00017 #define GEOS_NODING_SEGMENTSTRING_H
    00018
    00019 #include <geos/noding/SegmentNodeList.h>
    00020 #include <geos/geom/CoordinateSequence.h> // for testInvariant
    00021
    00022 #include <geos/inline.h>
    00023
    00024 #include <vector>
    00025
    00026 // Forward declarations
    00027 namespace geos {
    00028         namespace algorithm {
    00029                 class LineIntersector;
    00030         }
    00031 }
    00032
    00033 namespace geos {
    00034 namespace noding { // geos.noding
    00035
    00055 class SegmentString {
    00056 public:
    00057         typedef std::vector<const SegmentString*> ConstVect;
    00058         typedef std::vector<SegmentString *> NonConstVect;
    00059
    00060         friend std::ostream& operator<< (std::ostream& os,
    00061                         const SegmentString& ss);
    00062
    00063 private:
    00064         SegmentNodeList nodeList;
    00065         geom::CoordinateSequence *pts;
    00066         mutable unsigned int npts; // this is a cache
    00067         const void* context;
    00068         bool isIsolatedVar;
    00069
    00070 public:
    00071
    00072         void testInvariant() const;
    00073
    00075         //
    00081         SegmentString(geom::CoordinateSequence *newPts, const void* newContext);
    00082
    00083         ~SegmentString();
    00084
    00085         //const void* getContext() const { return getData(); }
    00086
    00087         const void* getData() const;
    00088
    00089         const SegmentNodeList& getNodeList() const;
    00090
    00091         SegmentNodeList& getNodeList();
    00092
    00093         unsigned int size() const;
    00094
    00095         const geom::Coordinate& getCoordinate(unsigned int i) const;
    00096
    00100         //
    00104         geom::CoordinateSequence* getCoordinates() const;
    00105
    00109         //
    00113         void notifyCoordinatesChange() const;
    00114
    00115         // Return a read-only pointer to this SegmentString CoordinateSequence
    00116         //const CoordinateSequence* getCoordinatesRO() const { return pts; }
    00117
    00118         void setIsolated(bool isIsolated);
    00119
    00120         bool isIsolated() const;
    00121
    00122         bool isClosed() const;
    00123
    00132         int getSegmentOctant(unsigned int index) const;
    00133
    00139         void addIntersections(algorithm::LineIntersector *li,
    00140                         unsigned int segmentIndex, int geomIndex);
    00141
    00149         void addIntersection(algorithm::LineIntersector *li,
    00150                         unsigned int segmentIndex,
    00151                         int geomIndex, int intIndex);
    00152
    00160         void addIntersection(const geom::Coordinate& intPt,
    00161                         unsigned int segmentIndex);
    00162
    00163         static void getNodedSubstrings(
    00164                         const SegmentString::NonConstVect& segStrings,
    00165                         SegmentString::NonConstVect* resultEdgeList);
    00166
    00167         static SegmentString::NonConstVect* getNodedSubstrings(
    00168                         const SegmentString::NonConstVect& segStrings);
    00169 };
    00170
    00171 inline void
    00172 SegmentString::testInvariant() const
    00173 {
    00174         assert(pts);
    00175         assert(pts->size() > 1);
    00176         assert(pts->size() == npts);
    00177 }
    00178
    00179 std::ostream& operator<< (std::ostream& os, const SegmentString& ss);
    00180
    00181 } // namespace geos.noding
    00182 } // namespace geos
    00183
    00184 #ifdef GEOS_INLINE
    00185 # include "geos/noding/SegmentString.inl"
    00186 #endif
    00187
    00188 #endif
    00189
    00190 /**********************************************************************
    00191  * $Log$
    00192  * Revision 1.10  2006/05/05 14:25:05  strk
    00193  * moved getSegmentOctant out of .inl into .cpp, renamed private eiList to nodeList as in JTS, added more assertion checking and fixed doxygen comments
    00194  *
    00195  * Revision 1.9  2006/05/05 10:19:06  strk
    00196  * droppped SegmentString::getContext(), new name is getData() to reflect change in JTS
    00197  *
    00198  * Revision 1.8  2006/05/04 08:29:07  strk
    00199  * * source/noding/ScaledNoder.cpp: removed use of SegmentString::setCoordinates().
    00200  * * source/headers/geos/noding/SegmentStrign.{h,inl}: removed new setCoordinates() interface.
    00201  *
    00202  * Revision 1.7  2006/05/04 07:43:44  strk
    00203  * output operator for SegmentString class
    00204  *
    00205  * Revision 1.6  2006/05/03 18:04:49  strk
    00206  * added SegmentString::setCoordinates() interface
    00207  *
    00208  * Revision 1.5  2006/05/03 16:19:39  strk
    00209  * fit in 80 columns
    00210  *
    00211  * Revision 1.4  2006/05/03 15:26:02  strk
    00212  * testInvariant made public and always inlined
    00213  *
    00214  * Revision 1.3  2006/03/24 09:52:41  strk
    00215  * USE_INLINE => GEOS_INLINE
    00216  *
    00217  * Revision 1.2  2006/03/13 21:14:24  strk
    00218  * Added missing forward declarations
    00219  *
    00220  * Revision 1.1  2006/03/09 16:46:49  strk
    00221  * geos::geom namespace definition, first pass at headers split
    00222  *
    00223  **********************************************************************/
    00224