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

- File List

# PrecisionModel.h

    00001 /**********************************************************************
    00002  * $Id: PrecisionModel.h 2556 2009-06-06 22:22:28Z 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  * Last port: geom/PrecisionModel.java rev. 1.51 (JTS-1.7)
    00017  *
    00018  **********************************************************************/
    00019
    00020 #ifndef GEOS_GEOM_PRECISIONMODEL_H
    00021 #define GEOS_GEOM_PRECISIONMODEL_H
    00022
    00023 #include <geos/export.h>
    00024 #include <geos/inline.h>
    00025
    00026
    00027 #include <string>
    00028
    00029 // Forward declarations
    00030 namespace geos {
    00031         namespace io {
    00032                 class Unload;
    00033         }
    00034         namespace geom {
    00035                 class Coordinate;
    00036         }
    00037 }
    00038
    00039 namespace geos {
    00040 namespace geom { // geos::geom
    00041
    00083 class GEOS_DLL PrecisionModel {
    00084 friend class io::Unload;
    00085
    00086 public:
    00087
    00089         typedef enum {
    00090
    00097                 FIXED,
    00098
    00104                 FLOATING,
    00105
    00111                 FLOATING_SINGLE
    00112
    00113         } Type;
    00114
    00116         PrecisionModel(void);
    00117
    00119         //
    00124         PrecisionModel(Type nModelType);
    00125
    00142         PrecisionModel(double newScale, double newOffsetX, double newOffsetY);
    00143
    00155         PrecisionModel(double newScale);
    00156
    00157         // copy constructor
    00158         PrecisionModel(const PrecisionModel &pm);
    00159
    00161         ~PrecisionModel(void);
    00162
    00163
    00165         //
    00170         static const double maximumPreciseValue;
    00171
    00182         double makePrecise(double val) const;
    00183
    00185         void makePrecise(Coordinate& coord) const;
    00186
    00187         void makePrecise(Coordinate* coord) const;
    00188
    00190         //
    00194         bool isFloating() const;
    00195
    00199         //
    00206         int getMaximumSignificantDigits() const;
    00207
    00209         //
    00212         Type getType() const;
    00213
    00215         double getScale() const;
    00216
    00218         //
    00223         double getOffsetX() const;
    00224
    00226         //
    00231         double getOffsetY() const;
    00232
    00242         //void toInternal(const Coordinate& external, Coordinate* internal) const;
    00243
    00244         /*
    00245          *  Returns the precise representation of <code>external</code>.
    00246          *
    00247          *@param  external  the original coordinate
    00248          *@return
    00249          *      the coordinate whose values will be changed to the precise
    00250          *      representation of <code>external</code>
    00251          * @deprecated use makePrecise instead
    00252          */
    00253         //Coordinate* toInternal(const Coordinate& external) const;
    00254
    00255         /*
    00256          *  Returns the external representation of <code>internal</code>.
    00257          *
    00258          *@param  internal  the original coordinate
    00259          *@return           the coordinate whose values will be changed to the
    00260          *      external representation of <code>internal</code>
    00261          * @deprecated no longer needed, since internal representation is same as external representation
    00262          */
    00263         //Coordinate* toExternal(const Coordinate& internal) const;
    00264
    00265         /*
    00266          *  Sets <code>external</code> to the external representation of
    00267          *  <code>internal</code>.
    00268          *
    00269          * @param  internal  the original coordinate
    00270          * @param  external
    00271          *      the coordinate whose values will be changed to the
    00272          *      external representation of <code>internal</code>
    00273          * @deprecated no longer needed, since internal representation is same as external representation
    00274          */
    00275         //void toExternal(const Coordinate& internal, Coordinate* external) const;
    00276
    00277         std::string toString() const;
    00278
    00282         //
    00298         int compareTo(const PrecisionModel* other) const;
    00299
    00300 private:
    00301
    00309         void setScale(double newScale);
    00310                         // throw IllegalArgumentException
    00311
    00312         Type modelType;
    00313
    00314         double scale;
    00315
    00316 };
    00317
    00318 // Equality operator for PrecisionModel, deprecate it ?
    00319 //inline bool operator==(const PrecisionModel& a, const PrecisionModel& b);
    00320
    00321 } // namespace geos::geom
    00322 } // namespace geos
    00323
    00324 #ifdef GEOS_INLINE
    00325 # include "geos/geom/PrecisionModel.inl"
    00326 #endif
    00327
    00328 #endif // ndef GEOS_GEOM_PRECISIONMODEL_H
    00329
    00330 /**********************************************************************
    00331  * $Log$
    00332  * Revision 1.6  2006/04/06 12:34:07  strk
    00333  * Port info, more debugging lines, doxygen comments
    00334  *
    00335  * Revision 1.5  2006/04/03 14:07:32  strk
    00336  * Commented out obsoleted toInternal() method
    00337  *
    00338  * Revision 1.4  2006/03/28 08:57:37  strk
    00339  * Comments cleanup, system headers included after project headers
    00340  *
    00341  * Revision 1.3  2006/03/24 09:52:41  strk
    00342  * USE_INLINE => GEOS_INLINE
    00343  *
    00344  * Revision 1.2  2006/03/22 16:58:35  strk
    00345  * Removed (almost) all inclusions of geom.h.
    00346  * Removed obsoleted .cpp files.
    00347  * Fixed a bug in WKTReader not using the provided CoordinateSequence
    00348  * implementation, optimized out some memory allocations.
    00349  *
    00350  * Revision 1.1  2006/03/09 16:46:49  strk
    00351  * geos::geom namespace definition, first pass at headers split
    00352  *
    00353  **********************************************************************/