<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/> <title>GEOS: PrecisionModel.h Source File</title> <link href="tabs.css" rel="stylesheet" type="text/css"/> <link href="doxygen.css" rel="stylesheet" type="text/css"/> </head> <body> <!-- Generated by Doxygen 1.7.1 --> <div class="navigation" id="top"> <div class="tabs"> <ul class="tablist"> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="pages.html"><span>Related Pages</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li><a href="annotated.html"><span>Classes</span></a></li> <li class="current"><a href="files.html"><span>Files</span></a></li> </ul> </div> <div class="tabs2"> <ul class="tablist"> <li><a href="files.html"><span>File List</span></a></li> </ul> </div> <div class="header"> <div class="headertitle"> <h1>PrecisionModel.h</h1> </div> </div> <div class="contents"> <div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">/**********************************************************************</span> <a name="l00002"></a>00002 <span class="comment"> * $Id: PrecisionModel.h 2556 2009-06-06 22:22:28Z strk $</span> <a name="l00003"></a>00003 <span class="comment"> *</span> <a name="l00004"></a>00004 <span class="comment"> * GEOS - Geometry Engine Open Source</span> <a name="l00005"></a>00005 <span class="comment"> * http://geos.refractions.net</span> <a name="l00006"></a>00006 <span class="comment"> *</span> <a name="l00007"></a>00007 <span class="comment"> * Copyright (C) 2006 Refractions Research Inc.</span> <a name="l00008"></a>00008 <span class="comment"> *</span> <a name="l00009"></a>00009 <span class="comment"> * This is free software; you can redistribute and/or modify it under</span> <a name="l00010"></a>00010 <span class="comment"> * the terms of the GNU Lesser General Public Licence as published</span> <a name="l00011"></a>00011 <span class="comment"> * by the Free Software Foundation. </span> <a name="l00012"></a>00012 <span class="comment"> * See the COPYING file for more information.</span> <a name="l00013"></a>00013 <span class="comment"> *</span> <a name="l00014"></a>00014 <span class="comment"> **********************************************************************</span> <a name="l00015"></a>00015 <span class="comment"> *</span> <a name="l00016"></a>00016 <span class="comment"> * Last port: geom/PrecisionModel.java rev. 1.51 (JTS-1.7)</span> <a name="l00017"></a>00017 <span class="comment"> *</span> <a name="l00018"></a>00018 <span class="comment"> **********************************************************************/</span> <a name="l00019"></a>00019 <a name="l00020"></a>00020 <span class="preprocessor">#ifndef GEOS_GEOM_PRECISIONMODEL_H</span> <a name="l00021"></a>00021 <span class="preprocessor"></span><span class="preprocessor">#define GEOS_GEOM_PRECISIONMODEL_H</span> <a name="l00022"></a>00022 <span class="preprocessor"></span> <a name="l00023"></a>00023 <span class="preprocessor">#include <geos/export.h></span> <a name="l00024"></a>00024 <span class="preprocessor">#include <geos/inline.h></span> <a name="l00025"></a>00025 <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="preprocessor">#include <string></span> <a name="l00028"></a>00028 <a name="l00029"></a>00029 <span class="comment">// Forward declarations</span> <a name="l00030"></a>00030 <span class="keyword">namespace </span>geos { <a name="l00031"></a>00031 <span class="keyword">namespace </span>io { <a name="l00032"></a>00032 <span class="keyword">class </span>Unload; <a name="l00033"></a>00033 } <a name="l00034"></a>00034 <span class="keyword">namespace </span>geom { <a name="l00035"></a>00035 <span class="keyword">class </span>Coordinate; <a name="l00036"></a>00036 } <a name="l00037"></a>00037 } <a name="l00038"></a>00038 <a name="l00039"></a>00039 <span class="keyword">namespace </span>geos { <a name="l00040"></a>00040 <span class="keyword">namespace </span>geom { <span class="comment">// geos::geom</span> <a name="l00041"></a>00041 <a name="l00083"></a><a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html">00083</a> <span class="keyword">class </span>GEOS_DLL <a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html" title="Specifies the precision model of the Coordinate in a Geometry.">PrecisionModel</a> { <a name="l00084"></a>00084 <span class="keyword">friend</span> <span class="keyword">class </span>io::Unload; <a name="l00085"></a>00085 <a name="l00086"></a>00086 <span class="keyword">public</span>: <a name="l00087"></a>00087 <a name="l00089"></a><a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html#aa32be4a02d1faf45306fee75d68a2e12">00089</a> <span class="keyword">typedef</span> <span class="keyword">enum</span> { <a name="l00090"></a>00090 <a name="l00097"></a><a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html#aa32be4a02d1faf45306fee75d68a2e12a702c5051872b1eae28e5f8d3c0f2e8af">00097</a> FIXED, <a name="l00098"></a>00098 <a name="l00104"></a><a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html#aa32be4a02d1faf45306fee75d68a2e12a871d90e033044acdd1db738dc2934aaf">00104</a> FLOATING, <a name="l00105"></a>00105 <a name="l00111"></a><a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html#aa32be4a02d1faf45306fee75d68a2e12aec6ecfa3e6b4087810606e2a41111035">00111</a> FLOATING_SINGLE <a name="l00112"></a>00112 <a name="l00113"></a>00113 } Type; <a name="l00114"></a>00114 <a name="l00116"></a>00116 <a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html" title="Specifies the precision model of the Coordinate in a Geometry.">PrecisionModel</a>(<span class="keywordtype">void</span>); <a name="l00117"></a>00117 <a name="l00119"></a>00119 <span class="comment">//</span> <a name="l00124"></a>00124 <span class="comment"></span> <a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html" title="Specifies the precision model of the Coordinate in a Geometry.">PrecisionModel</a>(Type nModelType); <a name="l00125"></a>00125 <a name="l00142"></a>00142 <a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html" title="Specifies the precision model of the Coordinate in a Geometry.">PrecisionModel</a>(<span class="keywordtype">double</span> newScale, <span class="keywordtype">double</span> newOffsetX, <span class="keywordtype">double</span> newOffsetY); <a name="l00143"></a>00143 <a name="l00155"></a>00155 <a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html" title="Specifies the precision model of the Coordinate in a Geometry.">PrecisionModel</a>(<span class="keywordtype">double</span> newScale); <a name="l00156"></a>00156 <a name="l00157"></a>00157 <span class="comment">// copy constructor</span> <a name="l00158"></a>00158 <a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html" title="Specifies the precision model of the Coordinate in a Geometry.">PrecisionModel</a>(<span class="keyword">const</span> <a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html" title="Specifies the precision model of the Coordinate in a Geometry.">PrecisionModel</a> &pm); <a name="l00159"></a>00159 <a name="l00161"></a>00161 ~<a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html" title="Specifies the precision model of the Coordinate in a Geometry.">PrecisionModel</a>(<span class="keywordtype">void</span>); <a name="l00162"></a>00162 <a name="l00163"></a>00163 <a name="l00165"></a>00165 <span class="comment">//</span> <a name="l00170"></a><a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html#a92ff29ac9cd8f93f1ab9283788313a5e">00170</a> <span class="comment"></span> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">double</span> maximumPreciseValue; <a name="l00171"></a>00171 <a name="l00182"></a>00182 <span class="keywordtype">double</span> makePrecise(<span class="keywordtype">double</span> val) <span class="keyword">const</span>; <a name="l00183"></a>00183 <a name="l00185"></a>00185 <span class="keywordtype">void</span> makePrecise(<a class="code" href="classgeos_1_1geom_1_1Coordinate.html" title="Coordinate is the lightweight class used to store coordinates.">Coordinate</a>& coord) <span class="keyword">const</span>; <a name="l00186"></a>00186 <a name="l00187"></a>00187 <span class="keywordtype">void</span> makePrecise(<a class="code" href="classgeos_1_1geom_1_1Coordinate.html" title="Coordinate is the lightweight class used to store coordinates.">Coordinate</a>* coord) <span class="keyword">const</span>; <a name="l00188"></a>00188 <a name="l00190"></a>00190 <span class="comment">//</span> <a name="l00194"></a>00194 <span class="comment"></span> <span class="keywordtype">bool</span> isFloating() <span class="keyword">const</span>; <a name="l00195"></a>00195 <a name="l00199"></a>00199 <span class="comment">//</span> <a name="l00206"></a>00206 <span class="comment"></span> <span class="keywordtype">int</span> getMaximumSignificantDigits() <span class="keyword">const</span>; <a name="l00207"></a>00207 <a name="l00209"></a>00209 <span class="comment">//</span> <a name="l00212"></a>00212 <span class="comment"></span> <a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html#aa32be4a02d1faf45306fee75d68a2e12" title="The types of Precision Model which GEOS supports.">Type</a> getType() <span class="keyword">const</span>; <a name="l00213"></a>00213 <a name="l00215"></a>00215 <span class="keywordtype">double</span> getScale() <span class="keyword">const</span>; <a name="l00216"></a>00216 <a name="l00218"></a>00218 <span class="comment">//</span> <a name="l00223"></a>00223 <span class="comment"></span> <span class="keywordtype">double</span> getOffsetX() <span class="keyword">const</span>; <a name="l00224"></a>00224 <a name="l00226"></a>00226 <span class="comment">//</span> <a name="l00231"></a>00231 <span class="comment"></span> <span class="keywordtype">double</span> getOffsetY() <span class="keyword">const</span>; <a name="l00232"></a>00232 <a name="l00242"></a>00242 <span class="comment">//void toInternal(const Coordinate& external, Coordinate* internal) const;</span> <a name="l00243"></a>00243 <a name="l00244"></a>00244 <span class="comment">/*</span> <a name="l00245"></a>00245 <span class="comment"> * Returns the precise representation of <code>external</code>.</span> <a name="l00246"></a>00246 <span class="comment"> *</span> <a name="l00247"></a>00247 <span class="comment"> *@param external the original coordinate</span> <a name="l00248"></a>00248 <span class="comment"> *@return</span> <a name="l00249"></a>00249 <span class="comment"> * the coordinate whose values will be changed to the precise</span> <a name="l00250"></a>00250 <span class="comment"> * representation of <code>external</code></span> <a name="l00251"></a>00251 <span class="comment"> * @deprecated use makePrecise instead</span> <a name="l00252"></a>00252 <span class="comment"> */</span> <a name="l00253"></a>00253 <span class="comment">//Coordinate* toInternal(const Coordinate& external) const;</span> <a name="l00254"></a>00254 <a name="l00255"></a>00255 <span class="comment">/*</span> <a name="l00256"></a>00256 <span class="comment"> * Returns the external representation of <code>internal</code>.</span> <a name="l00257"></a>00257 <span class="comment"> *</span> <a name="l00258"></a>00258 <span class="comment"> *@param internal the original coordinate</span> <a name="l00259"></a>00259 <span class="comment"> *@return the coordinate whose values will be changed to the</span> <a name="l00260"></a>00260 <span class="comment"> * external representation of <code>internal</code></span> <a name="l00261"></a>00261 <span class="comment"> * @deprecated no longer needed, since internal representation is same as external representation</span> <a name="l00262"></a>00262 <span class="comment"> */</span> <a name="l00263"></a>00263 <span class="comment">//Coordinate* toExternal(const Coordinate& internal) const;</span> <a name="l00264"></a>00264 <a name="l00265"></a>00265 <span class="comment">/*</span> <a name="l00266"></a>00266 <span class="comment"> * Sets <code>external</code> to the external representation of</span> <a name="l00267"></a>00267 <span class="comment"> * <code>internal</code>.</span> <a name="l00268"></a>00268 <span class="comment"> *</span> <a name="l00269"></a>00269 <span class="comment"> * @param internal the original coordinate</span> <a name="l00270"></a>00270 <span class="comment"> * @param external</span> <a name="l00271"></a>00271 <span class="comment"> * the coordinate whose values will be changed to the</span> <a name="l00272"></a>00272 <span class="comment"> * external representation of <code>internal</code></span> <a name="l00273"></a>00273 <span class="comment"> * @deprecated no longer needed, since internal representation is same as external representation</span> <a name="l00274"></a>00274 <span class="comment"> */</span> <a name="l00275"></a>00275 <span class="comment">//void toExternal(const Coordinate& internal, Coordinate* external) const;</span> <a name="l00276"></a>00276 <a name="l00277"></a>00277 std::string toString() <span class="keyword">const</span>; <a name="l00278"></a>00278 <a name="l00282"></a>00282 <span class="comment">//</span> <a name="l00298"></a>00298 <span class="comment"></span> <span class="keywordtype">int</span> compareTo(<span class="keyword">const</span> <a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html" title="Specifies the precision model of the Coordinate in a Geometry.">PrecisionModel</a>* other) <span class="keyword">const</span>; <a name="l00299"></a>00299 <a name="l00300"></a>00300 <span class="keyword">private</span>: <a name="l00301"></a>00301 <a name="l00309"></a>00309 <span class="keywordtype">void</span> setScale(<span class="keywordtype">double</span> newScale); <a name="l00310"></a>00310 <span class="comment">// throw IllegalArgumentException</span> <a name="l00311"></a>00311 <a name="l00312"></a>00312 <a class="code" href="classgeos_1_1geom_1_1PrecisionModel.html#aa32be4a02d1faf45306fee75d68a2e12" title="The types of Precision Model which GEOS supports.">Type</a> modelType; <a name="l00313"></a>00313 <a name="l00314"></a>00314 <span class="keywordtype">double</span> scale; <a name="l00315"></a>00315 <a name="l00316"></a>00316 }; <a name="l00317"></a>00317 <a name="l00318"></a>00318 <span class="comment">// Equality operator for PrecisionModel, deprecate it ?</span> <a name="l00319"></a>00319 <span class="comment">//inline bool operator==(const PrecisionModel& a, const PrecisionModel& b);</span> <a name="l00320"></a>00320 <a name="l00321"></a>00321 } <span class="comment">// namespace geos::geom</span> <a name="l00322"></a>00322 } <span class="comment">// namespace geos</span> <a name="l00323"></a>00323 <a name="l00324"></a>00324 <span class="preprocessor">#ifdef GEOS_INLINE</span> <a name="l00325"></a>00325 <span class="preprocessor"></span><span class="preprocessor"># include "geos/geom/PrecisionModel.inl"</span> <a name="l00326"></a>00326 <span class="preprocessor">#endif</span> <a name="l00327"></a>00327 <span class="preprocessor"></span> <a name="l00328"></a>00328 <span class="preprocessor">#endif // ndef GEOS_GEOM_PRECISIONMODEL_H</span> <a name="l00329"></a>00329 <span class="preprocessor"></span> <a name="l00330"></a>00330 <span class="comment">/**********************************************************************</span> <a name="l00331"></a>00331 <span class="comment"> * $Log$</span> <a name="l00332"></a>00332 <span class="comment"> * Revision 1.6 2006/04/06 12:34:07 strk</span> <a name="l00333"></a>00333 <span class="comment"> * Port info, more debugging lines, doxygen comments</span> <a name="l00334"></a>00334 <span class="comment"> *</span> <a name="l00335"></a>00335 <span class="comment"> * Revision 1.5 2006/04/03 14:07:32 strk</span> <a name="l00336"></a>00336 <span class="comment"> * Commented out obsoleted toInternal() method</span> <a name="l00337"></a>00337 <span class="comment"> *</span> <a name="l00338"></a>00338 <span class="comment"> * Revision 1.4 2006/03/28 08:57:37 strk</span> <a name="l00339"></a>00339 <span class="comment"> * Comments cleanup, system headers included after project headers</span> <a name="l00340"></a>00340 <span class="comment"> *</span> <a name="l00341"></a>00341 <span class="comment"> * Revision 1.3 2006/03/24 09:52:41 strk</span> <a name="l00342"></a>00342 <span class="comment"> * USE_INLINE => GEOS_INLINE</span> <a name="l00343"></a>00343 <span class="comment"> *</span> <a name="l00344"></a>00344 <span class="comment"> * Revision 1.2 2006/03/22 16:58:35 strk</span> <a name="l00345"></a>00345 <span class="comment"> * Removed (almost) all inclusions of geom.h.</span> <a name="l00346"></a>00346 <span class="comment"> * Removed obsoleted .cpp files.</span> <a name="l00347"></a>00347 <span class="comment"> * Fixed a bug in WKTReader not using the provided CoordinateSequence</span> <a name="l00348"></a>00348 <span class="comment"> * implementation, optimized out some memory allocations.</span> <a name="l00349"></a>00349 <span class="comment"> *</span> <a name="l00350"></a>00350 <span class="comment"> * Revision 1.1 2006/03/09 16:46:49 strk</span> <a name="l00351"></a>00351 <span class="comment"> * geos::geom namespace definition, first pass at headers split</span> <a name="l00352"></a>00352 <span class="comment"> *</span> <a name="l00353"></a>00353 <span class="comment"> **********************************************************************/</span> </pre></div></div> </div> <hr class="footer"/><address class="footer"><small>Generated on Thu Jul 22 2010 for GEOS by <a href="http://www.doxygen.org/index.html"> <img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.7.1 </small></address> </body> </html>