<!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: LinearLocation.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>LinearLocation.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: LinearLocation.h 2809 2009-12-06 01:05:24Z mloskot $</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) 2005-2006 Refractions Research Inc.</span> <a name="l00008"></a>00008 <span class="comment"> * Copyright (C) 2001-2002 Vivid Solutions Inc.</span> <a name="l00009"></a>00009 <span class="comment"> *</span> <a name="l00010"></a>00010 <span class="comment"> * This is free software; you can redistribute and/or modify it under</span> <a name="l00011"></a>00011 <span class="comment"> * the terms of the GNU Lesser General Public Licence as published</span> <a name="l00012"></a>00012 <span class="comment"> * by the Free Software Foundation.</span> <a name="l00013"></a>00013 <span class="comment"> * See the COPYING file for more information.</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"> *</span> <a name="l00017"></a>00017 <span class="comment"> * Last port: linearref/LinearLocation.java rev. 1.10</span> <a name="l00018"></a>00018 <span class="comment"> *</span> <a name="l00019"></a>00019 <span class="comment"> **********************************************************************/</span> <a name="l00020"></a>00020 <a name="l00021"></a>00021 <span class="preprocessor">#ifndef GEOS_LINEARREF_LINEARLOCATION_H</span> <a name="l00022"></a>00022 <span class="preprocessor"></span><span class="preprocessor">#define GEOS_LINEARREF_LINEARLOCATION_H</span> <a name="l00023"></a>00023 <span class="preprocessor"></span> <a name="l00024"></a>00024 <span class="preprocessor">#include <string></span> <a name="l00025"></a>00025 <span class="preprocessor">#include <memory></span> <span class="comment">// for std::auto_ptr</span> <a name="l00026"></a>00026 <a name="l00027"></a>00027 <span class="preprocessor">#include <geos/geom/Coordinate.h></span> <a name="l00028"></a>00028 <span class="preprocessor">#include <geos/geom/Geometry.h></span> <a name="l00029"></a>00029 <span class="preprocessor">#include <geos/geom/LineSegment.h></span> <a name="l00030"></a>00030 <a name="l00031"></a>00031 <span class="keyword">namespace </span>geos { <a name="l00032"></a>00032 <span class="keyword">namespace </span>linearref { <span class="comment">// geos::linearref</span> <a name="l00033"></a>00033 <a name="l00034"></a>00034 <a name="l00043"></a><a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html">00043</a> <span class="keyword">class </span><a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html" title="Represents a location along a LineString or MultiLineString.">LinearLocation</a> <a name="l00044"></a>00044 { <a name="l00045"></a>00045 <span class="keyword">private</span>: <a name="l00046"></a>00046 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> componentIndex; <a name="l00047"></a>00047 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> segmentIndex; <a name="l00048"></a>00048 <span class="keywordtype">double</span> segmentFraction; <a name="l00049"></a>00049 <a name="l00057"></a>00057 <span class="keywordtype">void</span> normalize(); <a name="l00058"></a>00058 <a name="l00059"></a>00059 <span class="keyword">public</span>: <a name="l00065"></a>00065 <span class="keyword">static</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html" title="Represents a location along a LineString or MultiLineString.">LinearLocation</a> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#a017a305a4c32502bb87ab61cd569fbc7">getEndLocation</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>* linear); <a name="l00066"></a>00066 <a name="l00082"></a>00082 <span class="keyword">static</span> <a class="code" href="classgeos_1_1geom_1_1Coordinate.html" title="Coordinate is the lightweight class used to store coordinates.">geom::Coordinate</a> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#ae9137b3ee11b144d01d928a2ad85ac14">pointAlongSegmentByFraction</a>(<span class="keyword">const</span> <a class="code" href="classgeos_1_1geom_1_1Coordinate.html" title="Coordinate is the lightweight class used to store coordinates.">geom::Coordinate</a>& p0, <span class="keyword">const</span> <a class="code" href="classgeos_1_1geom_1_1Coordinate.html" title="Coordinate is the lightweight class used to store coordinates.">geom::Coordinate</a>& p1, <span class="keywordtype">double</span> frac); <a name="l00083"></a>00083 <a name="l00084"></a>00084 <a name="l00088"></a>00088 <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#a2982685aadfd7bdce29215db3a653780">LinearLocation</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> segmentIndex = 0, <span class="keywordtype">double</span> segmentFraction = 0.0); <a name="l00089"></a>00089 <a name="l00090"></a>00090 <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#a2982685aadfd7bdce29215db3a653780">LinearLocation</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> componentIndex, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> segmentIndex, <span class="keywordtype">double</span> segmentFraction); <a name="l00091"></a>00091 <a name="l00097"></a>00097 <span class="keywordtype">void</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#ac1de5d7e436b7249e57c2227c566eafa">clamp</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>* linear); <a name="l00098"></a>00098 <a name="l00107"></a>00107 <span class="keywordtype">void</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#abe73a6c5d10b6bc8f2dbfa5bd25ddc82">snapToVertex</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>* linearGeom, <span class="keywordtype">double</span> minDistance); <a name="l00108"></a>00108 <a name="l00116"></a>00116 <span class="keywordtype">double</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#ad85594096af5010d17cfa365b90c5fc6">getSegmentLength</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>* linearGeom) <span class="keyword">const</span>; <a name="l00117"></a>00117 <a name="l00124"></a>00124 <span class="keywordtype">void</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#a9480d64cb462dc9ae0aacb9489f2d71a">setToEnd</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>* linear); <a name="l00125"></a>00125 <a name="l00131"></a>00131 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#a4dd16e05c60395709cad76135d9dcc28">getComponentIndex</a>() <span class="keyword">const</span>; <a name="l00132"></a>00132 <a name="l00138"></a>00138 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#ad81d3625cbf3aac3979b6a5ef1856150">getSegmentIndex</a>() <span class="keyword">const</span>; <a name="l00139"></a>00139 <a name="l00145"></a>00145 <span class="keywordtype">double</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#ab2ecfec59697bdd38274173e5fb847e4">getSegmentFraction</a>() <span class="keyword">const</span>; <a name="l00146"></a>00146 <a name="l00152"></a>00152 <span class="keywordtype">bool</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#aa8492cc339a966a44c2db8a0446110fb">isVertex</a>() <span class="keyword">const</span>; <a name="l00153"></a>00153 <a name="l00162"></a>00162 <a class="code" href="classgeos_1_1geom_1_1Coordinate.html" title="Coordinate is the lightweight class used to store coordinates.">geom::Coordinate</a> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#a50df7142413e9e0f71c08a17e44fb53a">getCoordinate</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>* linearGeom) <span class="keyword">const</span>; <a name="l00163"></a>00163 <a name="l00171"></a>00171 std::auto_ptr<geom::LineSegment> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#a0a4580505787da9f9e6a89eea69590cd">getSegment</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>* linearGeom) <span class="keyword">const</span>; <a name="l00172"></a>00172 <a name="l00180"></a>00180 <span class="keywordtype">bool</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#a0a7f6a53225266e50cd5e9f74aacd975">isValid</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>* linearGeom) <span class="keyword">const</span>; <a name="l00181"></a>00181 <a name="l00190"></a>00190 <span class="keywordtype">int</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#aeb879ed9f26e208b409a5911bbd181fc">compareTo</a>(<span class="keyword">const</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html" title="Represents a location along a LineString or MultiLineString.">LinearLocation</a>& other) <span class="keyword">const</span>; <a name="l00191"></a>00191 <a name="l00201"></a>00201 <span class="keywordtype">int</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#a863ac8110072aedd8df6acf3e2cbe3e3">compareLocationValues</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> componentIndex1, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> segmentIndex1, <span class="keywordtype">double</span> segmentFraction1) <span class="keyword">const</span>; <a name="l00202"></a>00202 <a name="l00216"></a>00216 <span class="keyword">static</span> <span class="keywordtype">int</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#a863ac8110072aedd8df6acf3e2cbe3e3">compareLocationValues</a>( <a name="l00217"></a>00217 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> componentIndex0, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> segmentIndex0, <span class="keywordtype">double</span> segmentFraction0, <a name="l00218"></a>00218 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> componentIndex1, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> segmentIndex1, <span class="keywordtype">double</span> segmentFraction1); <a name="l00219"></a>00219 <a name="l00227"></a>00227 <span class="keywordtype">bool</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html#aa2afb586307fce0af72b060354f1c78c">isOnSameSegment</a>(<span class="keyword">const</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html" title="Represents a location along a LineString or MultiLineString.">LinearLocation</a>& loc) <span class="keyword">const</span>; <a name="l00228"></a>00228 <a name="l00229"></a>00229 <a name="l00230"></a>00230 <span class="keyword">friend</span> std::ostream& operator<< (std::ostream& out, <span class="keyword">const</span> <a class="code" href="classgeos_1_1linearref_1_1LinearLocation.html" title="Represents a location along a LineString or MultiLineString.">LinearLocation</a>& obj ); <a name="l00231"></a>00231 <a name="l00232"></a>00232 }; <a name="l00233"></a>00233 <a name="l00234"></a>00234 <a name="l00235"></a>00235 } <span class="comment">// namespace geos.linearref</span> <a name="l00236"></a>00236 } <span class="comment">// namespace geos</span> <a name="l00237"></a>00237 <a name="l00238"></a>00238 <span class="preprocessor">#endif</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>