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

# PrecisionModel.h

    00001 /**********************************************************************
    00002  * $Id: PrecisionModel.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) 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/inline.h>
    00024
    00025 #include <string>
    00026
    00027 // Forward declarations
    00028 namespace geos {
    00029         namespace io {
    00030                 class Unload;
    00031         }
    00032         namespace geom {
    00033                 class Coordinate;
    00034         }
    00035 }
    00036
    00037 namespace geos {
    00038 namespace geom { // geos::geom
    00039
    00081 class PrecisionModel {
    00082 friend class io::Unload;
    00083
    00084 public:
    00085
    00087         typedef enum {
    00088
    00095                 FIXED,
    00096
    00102                 FLOATING,
    00103
    00109                 FLOATING_SINGLE
    00110
    00111         } Type;
    00112
    00114         PrecisionModel(void);
    00115
    00117         //
    00122         PrecisionModel(Type nModelType);
    00123
    00140         PrecisionModel(double newScale, double newOffsetX, double newOffsetY);
    00141
    00153         PrecisionModel(double newScale);
    00154
    00155         // copy constructor
    00156         PrecisionModel(const PrecisionModel &pm);
    00157
    00159         ~PrecisionModel(void);
    00160
    00161
    00163         //
    00168         static const double maximumPreciseValue;
    00169
    00180         double makePrecise(double val) const;
    00181
    00183         void makePrecise(Coordinate& coord) const;
    00184
    00185         void makePrecise(Coordinate* coord) const;
    00186
    00188         //
    00192         bool isFloating() const;
    00193
    00197         //
    00204         int getMaximumSignificantDigits() const;
    00205
    00207         //
    00210         Type getType() const;
    00211
    00213         double getScale() const;
    00214
    00216         //
    00221         double getOffsetX() const;
    00222
    00224         //
    00229         double getOffsetY() const;
    00230
    00240         //void toInternal(const Coordinate& external, Coordinate* internal) const;
    00241
    00242         /*
    00243          *  Returns the precise representation of <code>external</code>.
    00244          *
    00245          *@param  external  the original coordinate
    00246          *@return
    00247          *      the coordinate whose values will be changed to the precise
    00248          *      representation of <code>external</code>
    00249          * @deprecated use makePrecise instead
    00250          */
    00251         //Coordinate* toInternal(const Coordinate& external) const;
    00252
    00253         /*
    00254          *  Returns the external representation of <code>internal</code>.
    00255          *
    00256          *@param  internal  the original coordinate
    00257          *@return           the coordinate whose values will be changed to the
    00258          *      external representation of <code>internal</code>
    00259          * @deprecated no longer needed, since internal representation is same as external representation
    00260          */
    00261         //Coordinate* toExternal(const Coordinate& internal) const;
    00262
    00263         /*
    00264          *  Sets <code>external</code> to the external representation of
    00265          *  <code>internal</code>.
    00266          *
    00267          * @param  internal  the original coordinate
    00268          * @param  external
    00269          *      the coordinate whose values will be changed to the
    00270          *      external representation of <code>internal</code>
    00271          * @deprecated no longer needed, since internal representation is same as external representation
    00272          */
    00273         //void toExternal(const Coordinate& internal, Coordinate* external) const;
    00274
    00275         std::string toString() const;
    00276
    00280         //
    00296         int compareTo(const PrecisionModel* other) const;
    00297
    00298 private:
    00299
    00307         void setScale(double newScale);
    00308                         // throw IllegalArgumentException
    00309
    00310         Type modelType;
    00311
    00312         double scale;
    00313
    00314 };
    00315
    00316 // Equality operator for PrecisionModel, deprecate it ?
    00317 //inline bool operator==(const PrecisionModel& a, const PrecisionModel& b);
    00318
    00319 } // namespace geos::geom
    00320 } // namespace geos
    00321
    00322 #ifdef GEOS_INLINE
    00323 # include "geos/geom/PrecisionModel.inl"
    00324 #endif
    00325
    00326 #endif // ndef GEOS_GEOM_PRECISIONMODEL_H
    00327
    00328 /**********************************************************************
    00329  * $Log$
    00330  * Revision 1.6  2006/04/06 12:34:07  strk
    00331  * Port info, more debugging lines, doxygen comments
    00332  *
    00333  * Revision 1.5  2006/04/03 14:07:32  strk
    00334  * Commented out obsoleted toInternal() method
    00335  *
    00336  * Revision 1.4  2006/03/28 08:57:37  strk
    00337  * Comments cleanup, system headers included after project headers
    00338  *
    00339  * Revision 1.3  2006/03/24 09:52:41  strk
    00340  * USE_INLINE => GEOS_INLINE
    00341  *
    00342  * Revision 1.2  2006/03/22 16:58:35  strk
    00343  * Removed (almost) all inclusions of geom.h.
    00344  * Removed obsoleted .cpp files.
    00345  * Fixed a bug in WKTReader not using the provided CoordinateSequence
    00346  * implementation, optimized out some memory allocations.
    00347  *
    00348  * Revision 1.1  2006/03/09 16:46:49  strk
    00349  * geos::geom namespace definition, first pass at headers split
    00350  *
    00351  **********************************************************************/