GEOS  3.7.2
Label.h
1 /**********************************************************************
2  *
3  * GEOS - Geometry Engine Open Source
4  * http://geos.osgeo.org
5  *
6  * Copyright (C) 2005-2006 Refractions Research Inc.
7  * Copyright (C) 2001-2002 Vivid Solutions 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: geomgraph/Label.java r428 (JTS-1.12+)
17  *
18  **********************************************************************/
19 
20 
21 #ifndef GEOS_GEOMGRAPH_LABEL_H
22 #define GEOS_GEOMGRAPH_LABEL_H
23 
24 #include <geos/export.h>
25 #include <geos/geomgraph/TopologyLocation.h>
26 
27 #include <geos/inline.h>
28 
29 #include <iosfwd> // for operator<<
30 
31 namespace geos {
32 namespace geomgraph { // geos.geomgraph
33 
57 class GEOS_DLL Label {
58 
59 public:
60 
61  friend std::ostream& operator<< (std::ostream&, const Label&);
62 
68  static Label toLineLabel(const Label& label);
69 
73  Label(int onLoc);
74 
82  Label(int geomIndex, int onLoc);
83 
89  Label(int onLoc, int leftLoc, int rightLoc);
90 
92  Label(const Label &l);
93 
94  Label& operator= (const Label& l);
95 
101  Label();
102 
109  Label(int geomIndex, int onLoc, int leftLoc, int rightLoc);
110 
111  void flip();
112 
113  int getLocation(int geomIndex, int posIndex) const;
114 
115  int getLocation(int geomIndex) const;
116 
117  void setLocation(int geomIndex, int posIndex, int location);
118 
119  void setLocation(int geomIndex, int location);
120 
121  void setAllLocations(int geomIndex, int location);
122 
123  void setAllLocationsIfNull(int geomIndex, int location);
124 
125  void setAllLocationsIfNull(int location);
126 
133  void merge(const Label &lbl);
134 
135  int getGeometryCount() const;
136 
137  bool isNull() 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 private:
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 
geos::geomgraph::Label::toLine
void toLine(int geomIndex)
Converts one GeometryLocation to a Line location.
geos::geomgraph::Label::Label
Label(int geomIndex, int onLoc)
Construct a Label with the location specified for the given Geometry.
geos::geomgraph::Label
A Label indicates the topological relationship of a component of a topology graph to a given Geometry...
Definition: Label.h:57
geos::geomgraph::Label::Label
Label(int geomIndex, int onLoc, int leftLoc, int rightLoc)
Construct a Label with On, Left and Right locations for the given Geometries. Initialize the location...
geos
Basic namespace for all GEOS functionalities.
Definition: IndexedNestedRingTester.h:25
geos::geomgraph::TopologyLocation
A TopologyLocation is the labelling of a GraphComponent's topological relationship to a single Geomet...
Definition: TopologyLocation.h:58
geos::geomgraph::Label::Label
Label(int onLoc, int leftLoc, int rightLoc)
Construct a Label with On, Left and Right locations for both Geometries.
geos::geomgraph::Label::toLineLabel
static Label toLineLabel(const Label &label)
Converts a Label to a Line label (that is, one with no side Locations)
geos::geomgraph::Label::Label
Label()
Initialize both locations to Location::UNDEF.
geos::geomgraph::Label::Label
Label(const Label &l)
Copy ctor.
geos::geomgraph::Label::merge
void merge(const Label &lbl)
Merge this label with another one.
geos::geomgraph::Label::Label
Label(int onLoc)
Construct a Label with a single location for both Geometries.