GEOS  3.3.3
Label.h
1 /**********************************************************************
2  * $Id: Label.h 2557 2009-06-08 09:30:55Z strk $
3  *
4  * GEOS - Geometry Engine Open Source
5  * http://geos.refractions.net
6  *
7  * Copyright (C) 2005-2006 Refractions Research Inc.
8  * Copyright (C) 2001-2002 Vivid Solutions Inc.
9  *
10  * This is free software; you can redistribute and/or modify it under
11  * the terms of the GNU Lesser General Public Licence as published
12  * by the Free Software Foundation.
13  * See the COPYING file for more information.
14  *
15  **********************************************************************
16  *
17  * Last port: geomgraph/Label.java rev. 1.8 (JTS-1.10)
18  *
19  **********************************************************************/
20 
21 
22 #ifndef GEOS_GEOMGRAPH_LABEL_H
23 #define GEOS_GEOMGRAPH_LABEL_H
24 
25 #include <geos/export.h>
26 #include <geos/geomgraph/TopologyLocation.h>
27 
28 #include <geos/inline.h>
29 
30 #include <iosfwd> // for operator<<
31 
32 namespace geos {
33 namespace geomgraph { // geos.geomgraph
34 
58 class GEOS_DLL Label {
59 
60 public:
61 
62  friend std::ostream& operator<< (std::ostream&, const Label&);
63 
71  static Label* toLineLabel(const Label& label);
72 
76  Label(int onLoc);
77 
85  Label(int geomIndex, int onLoc);
86 
92  Label(int onLoc, int leftLoc, int rightLoc);
93 
95  Label(const Label &l);
96 
100  Label();
101 
103  virtual ~Label();
104 
111  Label(int geomIndex, int onLoc, int leftLoc, int rightLoc);
112 
113  void flip();
114 
115  int getLocation(int geomIndex, int posIndex) const;
116 
117  int getLocation(int geomIndex) const;
118 
119  void setLocation(int geomIndex, int posIndex, int location);
120 
121  void setLocation(int geomIndex, int location);
122 
123  void setAllLocations(int geomIndex, int location);
124 
125  void setAllLocationsIfNull(int geomIndex, int location);
126 
127  void setAllLocationsIfNull(int location);
128 
135  void merge(const Label &lbl);
136 
137  int getGeometryCount() const;
138 
139  bool isNull(int geomIndex) const;
140 
141  bool isAnyNull(int geomIndex) const;
142 
143  bool isArea() const;
144 
145  bool isArea(int geomIndex) const;
146 
147  bool isLine(int geomIndex) const;
148 
149  bool isEqualOnSide(const Label &lbl, int side) const;
150 
151  bool allPositionsEqual(int geomIndex, int loc) const;
152 
156  void toLine(int geomIndex);
157 
158  std::string toString() const;
159 
160 protected:
161 
162  TopologyLocation elt[2];
163 };
164 
165 std::ostream& operator<< (std::ostream&, const Label&);
166 
167 } // namespace geos.geomgraph
168 } // namespace geos
169 
170 
171 //#ifdef GEOS_INLINE
172 //# include "geos/geomgraph/Label.inl"
173 //#endif
174 
175 #endif // ifndef GEOS_GEOMGRAPH_LABEL_H
176 
177 /**********************************************************************
178  * $Log$
179  * Revision 1.3 2006/04/06 09:01:37 strk
180  * Doxygen comments, port info, operator<<, assertion checking
181  *
182  * Revision 1.2 2006/03/24 09:52:41 strk
183  * USE_INLINE => GEOS_INLINE
184  *
185  * Revision 1.1 2006/03/09 16:46:49 strk
186  * geos::geom namespace definition, first pass at headers split
187  *
188  **********************************************************************/
189