<!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: BufferOp.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>BufferOp.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: BufferOp.h 2605 2009-06-26 21:59:14Z 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) 2009 Sandro Santilli <strk@keybit.net></span> <a name="l00008"></a>00008 <span class="comment"> * Copyright (C) 2005-2007 Refractions Research Inc.</span> <a name="l00009"></a>00009 <span class="comment"> * Copyright (C) 2001-2002 Vivid Solutions Inc.</span> <a name="l00010"></a>00010 <span class="comment"> *</span> <a name="l00011"></a>00011 <span class="comment"> * This is free software; you can redistribute and/or modify it under</span> <a name="l00012"></a>00012 <span class="comment"> * the terms of the GNU Lesser General Public Licence as published</span> <a name="l00013"></a>00013 <span class="comment"> * by the Free Software Foundation. </span> <a name="l00014"></a>00014 <span class="comment"> * See the COPYING file for more information.</span> <a name="l00015"></a>00015 <span class="comment"> *</span> <a name="l00016"></a>00016 <span class="comment"> **********************************************************************</span> <a name="l00017"></a>00017 <span class="comment"> *</span> <a name="l00018"></a>00018 <span class="comment"> * Last port: operation/buffer/BufferOp.java rev. 1.43 (JTS-1.10)</span> <a name="l00019"></a>00019 <span class="comment"> *</span> <a name="l00020"></a>00020 <span class="comment"> **********************************************************************/</span> <a name="l00021"></a>00021 <a name="l00022"></a>00022 <span class="preprocessor">#ifndef GEOS_OP_BUFFER_BUFFEROP_H</span> <a name="l00023"></a>00023 <span class="preprocessor"></span><span class="preprocessor">#define GEOS_OP_BUFFER_BUFFEROP_H</span> <a name="l00024"></a>00024 <span class="preprocessor"></span> <a name="l00025"></a>00025 <span class="preprocessor">#include <geos/export.h></span><span class="comment">//#include <geos/operation/buffer/OffsetCurveBuilder.h> // for enum values </span> <a name="l00026"></a>00026 <span class="preprocessor">#include <geos/operation/buffer/BufferParameters.h></span> <span class="comment">// for enum values </span> <a name="l00027"></a>00027 <a name="l00028"></a>00028 <span class="preprocessor">#include <geos/util/TopologyException.h></span> <span class="comment">// for composition</span> <a name="l00029"></a>00029 <a name="l00030"></a>00030 <span class="comment">// Forward declarations</span> <a name="l00031"></a>00031 <span class="keyword">namespace </span>geos { <a name="l00032"></a>00032 <span class="keyword">namespace </span>geom { <a name="l00033"></a>00033 <span class="keyword">class </span>PrecisionModel; <a name="l00034"></a>00034 <span class="keyword">class </span>Geometry; <a name="l00035"></a>00035 } <a name="l00036"></a>00036 } <a name="l00037"></a>00037 <a name="l00038"></a>00038 <span class="keyword">namespace </span>geos { <a name="l00039"></a>00039 <span class="keyword">namespace </span>operation { <span class="comment">// geos.operation</span> <a name="l00040"></a>00040 <span class="keyword">namespace </span>buffer { <span class="comment">// geos.operation.buffer</span> <a name="l00041"></a>00041 <a name="l00072"></a><a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html">00072</a> <span class="keyword">class </span>GEOS_DLL <a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html" title="Computes the buffer of a geometry, for both positive and negative buffer distances.">BufferOp</a> { <a name="l00073"></a>00073 <a name="l00074"></a>00074 <a name="l00075"></a>00075 <span class="keyword">private</span>: <a name="l00076"></a>00076 <a name="l00083"></a>00083 <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">int</span> MAX_PRECISION_DIGITS = 12; <a name="l00084"></a>00084 <a name="l00101"></a>00101 <span class="keyword">static</span> <span class="keywordtype">double</span> precisionScaleFactor(<span class="keyword">const</span> <a class="code" href="classgeos_1_1geom_1_1Geometry.html" title="Basic implementation of Geometry, constructed and destructed by GeometryFactory.">geom::Geometry</a> *g, <a name="l00102"></a>00102 <span class="keywordtype">double</span> distance, <span class="keywordtype">int</span> maxPrecisionDigits); <a name="l00103"></a>00103 <a name="l00104"></a>00104 <span class="keyword">const</span> <a class="code" href="classgeos_1_1geom_1_1Geometry.html" title="Basic implementation of Geometry, constructed and destructed by GeometryFactory.">geom::Geometry</a> *argGeom; <a name="l00105"></a>00105 <a name="l00106"></a>00106 <a class="code" href="classgeos_1_1util_1_1TopologyException.html" title="Indicates an invalid or inconsistent topological situation encountered during processing.">util::TopologyException</a> saveException; <a name="l00107"></a>00107 <a name="l00108"></a>00108 <span class="keywordtype">double</span> distance; <a name="l00109"></a>00109 <a name="l00110"></a>00110 <span class="comment">//int quadrantSegments;</span> <a name="l00111"></a>00111 <span class="comment">//int endCapStyle;</span> <a name="l00112"></a>00112 <a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferParameters.html" title="Contains the parameters which describe how a buffer should be constructed.">BufferParameters</a> bufParams; <a name="l00113"></a>00113 <a name="l00114"></a>00114 <a class="code" href="classgeos_1_1geom_1_1Geometry.html" title="Basic implementation of Geometry, constructed and destructed by GeometryFactory.">geom::Geometry</a>* resultGeometry; <a name="l00115"></a>00115 <a name="l00116"></a>00116 <span class="keywordtype">void</span> computeGeometry(); <a name="l00117"></a>00117 <a name="l00118"></a>00118 <span class="keywordtype">void</span> bufferOriginalPrecision(); <a name="l00119"></a>00119 <a name="l00120"></a>00120 <span class="keywordtype">void</span> bufferReducedPrecision(<span class="keywordtype">int</span> precisionDigits); <a name="l00121"></a>00121 <a name="l00122"></a>00122 <span class="keywordtype">void</span> bufferReducedPrecision(); <a name="l00123"></a>00123 <a name="l00124"></a>00124 <span class="keywordtype">void</span> bufferFixedPrecision(<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.">geom::PrecisionModel</a>& fixedPM); <a name="l00125"></a>00125 <a name="l00126"></a>00126 <span class="keyword">public</span>: <a name="l00127"></a>00127 <a name="l00128"></a>00128 <span class="keyword">enum</span> { <a name="l00131"></a><a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html#afeb8f104361eeee3800eb1ba675803eba3dab8f3b3b9c9d389597710b380bbd50">00131</a> CAP_ROUND = BufferParameters::CAP_ROUND, <a name="l00132"></a>00132 <a name="l00135"></a><a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html#afeb8f104361eeee3800eb1ba675803eba49120ca8a988672bd4e07c410e60298d">00135</a> CAP_BUTT = BufferParameters::CAP_FLAT, <a name="l00136"></a>00136 <a name="l00139"></a><a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html#afeb8f104361eeee3800eb1ba675803eba8757a3afe464e96cf13526aba63530fa">00139</a> CAP_SQUARE = <a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferParameters.html#a4712bec3a5a2bb5c28ab43b3fe327950a1915b38145310e6c86cb0dc5231dd545" title="Specifies a square line buffer end cap style.">BufferParameters::CAP_SQUARE</a> <a name="l00140"></a>00140 }; <a name="l00141"></a>00141 <a name="l00153"></a>00153 <span class="keyword">static</span> <a class="code" href="classgeos_1_1geom_1_1Geometry.html" title="Basic implementation of Geometry, constructed and destructed by GeometryFactory.">geom::Geometry</a>* bufferOp(<span class="keyword">const</span> <a class="code" href="classgeos_1_1geom_1_1Geometry.html" title="Basic implementation of Geometry, constructed and destructed by GeometryFactory.">geom::Geometry</a> *g, <a name="l00154"></a>00154 <span class="keywordtype">double</span> distance, <a name="l00155"></a>00155 <span class="keywordtype">int</span> quadrantSegments= <a name="l00156"></a>00156 <a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferParameters.html#ab0a64ab1030d5dc576449dbf9ecde9e8" title="The default number of facets into which to divide a fillet of 90 degrees.">BufferParameters::DEFAULT_QUADRANT_SEGMENTS</a>, <a name="l00157"></a>00157 <span class="keywordtype">int</span> endCapStyle=<a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferParameters.html#a4712bec3a5a2bb5c28ab43b3fe327950a2115b456f33264168ae298f31cd10e84" title="Specifies a round line buffer end cap style.">BufferParameters::CAP_ROUND</a>); <a name="l00158"></a>00158 <a name="l00164"></a><a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html#ace333176e7988e78d32941397df0c4ec">00164</a> <a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html" title="Computes the buffer of a geometry, for both positive and negative buffer distances.">BufferOp</a>(<span class="keyword">const</span> <a class="code" href="classgeos_1_1geom_1_1Geometry.html" title="Basic implementation of Geometry, constructed and destructed by GeometryFactory.">geom::Geometry</a> *g) <a name="l00165"></a>00165 : <a name="l00166"></a>00166 argGeom(g), <a name="l00167"></a>00167 bufParams(), <a name="l00168"></a>00168 resultGeometry(NULL) <a name="l00169"></a>00169 { <a name="l00170"></a>00170 } <a name="l00171"></a>00171 <a name="l00180"></a><a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html#ac57e331af7062eac25d7e563af0d234a">00180</a> <a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html" title="Computes the buffer of a geometry, for both positive and negative buffer distances.">BufferOp</a>(<span class="keyword">const</span> <a class="code" href="classgeos_1_1geom_1_1Geometry.html" title="Basic implementation of Geometry, constructed and destructed by GeometryFactory.">geom::Geometry</a>* g, <span class="keyword">const</span> <a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferParameters.html" title="Contains the parameters which describe how a buffer should be constructed.">BufferParameters</a>& params) <a name="l00181"></a>00181 : <a name="l00182"></a>00182 argGeom(g), <a name="l00183"></a>00183 bufParams(params), <a name="l00184"></a>00184 resultGeometry(NULL) <a name="l00185"></a>00185 { <a name="l00186"></a>00186 } <a name="l00187"></a>00187 <a name="l00188"></a>00188 <a name="l00196"></a>00196 <span class="keyword">inline</span> <span class="keywordtype">void</span> setEndCapStyle(<span class="keywordtype">int</span> nEndCapStyle); <a name="l00197"></a>00197 <a name="l00205"></a>00205 <span class="keyword">inline</span> <span class="keywordtype">void</span> setQuadrantSegments(<span class="keywordtype">int</span> nQuadrantSegments); <a name="l00206"></a>00206 <a name="l00215"></a>00215 <a class="code" href="classgeos_1_1geom_1_1Geometry.html" title="Basic implementation of Geometry, constructed and destructed by GeometryFactory.">geom::Geometry</a>* getResultGeometry(<span class="keywordtype">double</span> nDistance); <a name="l00216"></a>00216 <a name="l00217"></a>00217 }; <a name="l00218"></a>00218 <a name="l00219"></a>00219 <span class="comment">// BufferOp inlines</span> <a name="l00220"></a>00220 <span class="keywordtype">void</span> <a name="l00221"></a><a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html#a15d1764170db5d95abe50cff8fef747f">00221</a> <a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html#a15d1764170db5d95abe50cff8fef747f">BufferOp::setQuadrantSegments</a>(<span class="keywordtype">int</span> q) <a name="l00222"></a>00222 { <a name="l00223"></a>00223 bufParams.<a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferParameters.html#adc5559aa27d60c7b40aba6d5c13c0c45" title="Sets the number of line segments used to approximate an angle fillet.">setQuadrantSegments</a>(q); <a name="l00224"></a>00224 } <a name="l00225"></a>00225 <a name="l00226"></a>00226 <span class="keywordtype">void</span> <a name="l00227"></a><a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html#aa566f0c9ba6aabc903adb9898a196961">00227</a> <a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferOp.html#aa566f0c9ba6aabc903adb9898a196961">BufferOp::setEndCapStyle</a>(<span class="keywordtype">int</span> s) <a name="l00228"></a>00228 { <a name="l00229"></a>00229 bufParams.<a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferParameters.html#a1b884eaa4f6bb49cb7547f6cbf2035f7" title="Specifies the end cap style of the generated buffer.">setEndCapStyle</a>((<a class="code" href="classgeos_1_1operation_1_1buffer_1_1BufferParameters.html#a4712bec3a5a2bb5c28ab43b3fe327950" title="End cap styles.">BufferParameters::EndCapStyle</a>)s); <a name="l00230"></a>00230 } <a name="l00231"></a>00231 <a name="l00232"></a>00232 <a name="l00233"></a>00233 } <span class="comment">// namespace geos::operation::buffer</span> <a name="l00234"></a>00234 } <span class="comment">// namespace geos::operation</span> <a name="l00235"></a>00235 } <span class="comment">// namespace geos</span> <a name="l00236"></a>00236 <a name="l00237"></a>00237 <span class="preprocessor">#endif // ndef GEOS_OP_BUFFER_BUFFEROP_H</span> <a name="l00238"></a>00238 <span class="preprocessor"></span> <a name="l00239"></a>00239 <span class="comment">/**********************************************************************</span> <a name="l00240"></a>00240 <span class="comment"> * $Log$</span> <a name="l00241"></a>00241 <span class="comment"> * Revision 1.1 2006/03/14 00:19:40 strk</span> <a name="l00242"></a>00242 <span class="comment"> * opBuffer.h split, streamlined headers in some (not all) files in operation/buffer/</span> <a name="l00243"></a>00243 <span class="comment"> *</span> <a name="l00244"></a>00244 <span class="comment"> **********************************************************************/</span> <a name="l00245"></a>00245 </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>