GEOS  3.3.3
SegmentString.h
1 /**********************************************************************
2  * $Id: SegmentString.h 3255 2011-03-01 17:56:10Z 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  * Last port: noding/SegmentString.java rev. 1.6 (JTS-1.9)
17  *
18  **********************************************************************/
19 
20 #ifndef GEOS_NODING_SEGMENTSTRING_H
21 #define GEOS_NODING_SEGMENTSTRING_H
22 
23 #include <geos/export.h>
24 #include <geos/noding/SegmentNodeList.h>
25 #include <geos/inline.h>
26 
27 #include <vector>
28 
29 // Forward declarations
30 namespace geos {
31  namespace algorithm {
32  class LineIntersector;
33  }
34 }
35 
36 namespace geos {
37 namespace noding { // geos.noding
38 
46 class GEOS_DLL SegmentString {
47 public:
48  typedef std::vector<const SegmentString*> ConstVect;
49  typedef std::vector<SegmentString *> NonConstVect;
50 
51  friend std::ostream& operator<< (std::ostream& os,
52  const SegmentString& ss);
53 
55  //
58  SegmentString(const void* newContext)
59  :
60  context(newContext)
61  {}
62 
63  virtual ~SegmentString() {}
64 
70  const void* getData() const { return context; }
71 
77  void setData(const void* data) { context=data; }
78 
79 
80  virtual unsigned int size() const=0;
81 
82  virtual const geom::Coordinate& getCoordinate(unsigned int i) const=0;
83 
87  //
91  virtual geom::CoordinateSequence* getCoordinates() const=0;
92 
93  // Return a read-only pointer to this SegmentString CoordinateSequence
94  //const CoordinateSequence* getCoordinatesRO() const { return pts; }
95 
96  virtual bool isClosed() const=0;
97 
98  virtual std::ostream& print(std::ostream& os) const;
99 
100 private:
101 
102  const void* context;
103 
104  // Declare type as noncopyable
105  SegmentString(const SegmentString& other);
106  SegmentString& operator=(const SegmentString& rhs);
107 };
108 
109 std::ostream& operator<< (std::ostream& os, const SegmentString& ss);
110 
111 } // namespace geos.noding
112 } // namespace geos
113 
114 #ifdef GEOS_INLINE
115 # include "geos/noding/SegmentString.inl"
116 #endif
117 
118 #endif
119 
120 /**********************************************************************
121  * $Log$
122  * Revision 1.10 2006/05/05 14:25:05 strk
123  * moved getSegmentOctant out of .inl into .cpp, renamed private eiList to nodeList as in JTS, added more assertion checking and fixed doxygen comments
124  *
125  * Revision 1.9 2006/05/05 10:19:06 strk
126  * droppped SegmentString::getContext(), new name is getData() to reflect change in JTS
127  *
128  * Revision 1.8 2006/05/04 08:29:07 strk
129  * * source/noding/ScaledNoder.cpp: removed use of SegmentString::setCoordinates().
130  * * source/headers/geos/noding/SegmentStrign.{h,inl}: removed new setCoordinates() interface.
131  *
132  * Revision 1.7 2006/05/04 07:43:44 strk
133  * output operator for SegmentString class
134  *
135  * Revision 1.6 2006/05/03 18:04:49 strk
136  * added SegmentString::setCoordinates() interface
137  *
138  * Revision 1.5 2006/05/03 16:19:39 strk
139  * fit in 80 columns
140  *
141  * Revision 1.4 2006/05/03 15:26:02 strk
142  * testInvariant made public and always inlined
143  *
144  * Revision 1.3 2006/03/24 09:52:41 strk
145  * USE_INLINE => GEOS_INLINE
146  *
147  * Revision 1.2 2006/03/13 21:14:24 strk
148  * Added missing forward declarations
149  *
150  * Revision 1.1 2006/03/09 16:46:49 strk
151  * geos::geom namespace definition, first pass at headers split
152  *
153  **********************************************************************/
154