Label.h

00001 /**********************************************************************
00002  * $Id: Label.h 1820 2006-09-06 16:54:23Z mloskot $
00003  *
00004  * GEOS - Geometry Engine Open Source
00005  * http://geos.refractions.net
00006  *
00007  * Copyright (C) 2005-2006 Refractions Research Inc.
00008  * Copyright (C) 2001-2002 Vivid Solutions Inc.
00009  *
00010  * This is free software; you can redistribute and/or modify it under
00011  * the terms of the GNU Lesser General Public Licence as published
00012  * by the Free Software Foundation. 
00013  * See the COPYING file for more information.
00014  *
00015  **********************************************************************
00016  *
00017  * Last port: geomgraph/Label.java rev. 1.6 (JTS-1.7)
00018  *
00019  **********************************************************************/
00020 
00021 
00022 #ifndef GEOS_GEOMGRAPH_LABEL_H
00023 #define GEOS_GEOMGRAPH_LABEL_H
00024 
00025 #include <geos/geomgraph/TopologyLocation.h> 
00026 
00027 #include <geos/inline.h>
00028 
00029 #include <iosfwd> // for operator<<
00030 
00031 namespace geos {
00032 namespace geomgraph { // geos.geomgraph
00033 
00057 class Label {
00058 
00059 public:
00060 
00061         friend std::ostream& operator<< (std::ostream&, const Label&);
00062 
00070         static Label* toLineLabel(const Label& label);
00071 
00075         Label(int onLoc);
00076 
00084         Label(int geomIndex, int onLoc);
00085 
00091         Label(int onLoc, int leftLoc, int rightLoc);
00092 
00094         Label(const Label &l);
00095 
00099         Label();
00100 
00102         virtual ~Label();
00103 
00110         Label(int geomIndex, int onLoc, int leftLoc, int rightLoc);
00111 
00112         void flip();
00113 
00114         int getLocation(int geomIndex, int posIndex) const;
00115 
00116         int getLocation(int geomIndex) const;
00117 
00118         void setLocation(int geomIndex, int posIndex, int location);
00119 
00120         void setLocation(int geomIndex, int location);
00121 
00122         void setAllLocations(int geomIndex, int location);
00123 
00124         void setAllLocationsIfNull(int geomIndex, int location);
00125 
00126         void setAllLocationsIfNull(int location);
00127 
00134         void merge(const Label &lbl);
00135 
00136         int getGeometryCount() const;
00137 
00138         bool isNull(int geomIndex) const;
00139 
00140         bool isAnyNull(int geomIndex) const;
00141 
00142         bool isArea() const;
00143 
00144         bool isArea(int geomIndex) const;
00145 
00146         bool isLine(int geomIndex) const;
00147 
00148         bool isEqualOnSide(const Label &lbl, int side) const;
00149 
00150         bool allPositionsEqual(int geomIndex, int loc) const;
00151 
00155         void toLine(int geomIndex);
00156 
00157         std::string toString() const;
00158 
00159 protected:
00160 
00161         TopologyLocation elt[2];
00162 };
00163 
00164 std::ostream& operator<< (std::ostream&, const Label&);
00165 
00166 } // namespace geos.geomgraph
00167 } // namespace geos
00168 
00169 
00170 //#ifdef GEOS_INLINE
00171 //# include "geos/geomgraph/Label.inl"
00172 //#endif
00173 
00174 #endif // ifndef GEOS_GEOMGRAPH_LABEL_H
00175 
00176 /**********************************************************************
00177  * $Log$
00178  * Revision 1.3  2006/04/06 09:01:37  strk
00179  * Doxygen comments, port info, operator<<, assertion checking
00180  *
00181  * Revision 1.2  2006/03/24 09:52:41  strk
00182  * USE_INLINE => GEOS_INLINE
00183  *
00184  * Revision 1.1  2006/03/09 16:46:49  strk
00185  * geos::geom namespace definition, first pass at headers split
00186  *
00187  **********************************************************************/
00188 

Generated on Fri Mar 27 04:52:48 2009 for GEOS by  doxygen 1.5.4