Imported Upstream version 1.57.0
[platform/upstream/boost.git] / libs / polygon / doc / gtl_custom_polygon_set.htm
index 13d80af..66f6ba8 100644 (file)
@@ -59,7 +59,7 @@ namespace boost { namespace polygon {<br>
 &nbsp;&nbsp;&nbsp; typedef int coordinate_type;<br>
 <br>
 &nbsp;&nbsp;&nbsp; static inline coordinate_type get(const CPoint&amp; point, <br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 orientation_2d orient) {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(orient == HORIZONTAL)<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return point.x;<br>
@@ -69,7 +69,9 @@ orientation_2d orient) {<br>
 <br>
 &nbsp; template &lt;&gt;<br>
 &nbsp; struct point_mutable_traits&lt;CPoint&gt; {<br>
-&nbsp;&nbsp;&nbsp; static inline void set(CPoint&amp; point, orientation_2d orient, 
+&nbsp;&nbsp;&nbsp; typedef int coordinate_type;<br>
+<br>
+&nbsp;&nbsp;&nbsp; static inline void set(CPoint&amp; point, orientation_2d orient,
 int value) {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(orient == HORIZONTAL)<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; point.x = value;<br>
@@ -126,7 +128,7 @@ namespace boost { namespace polygon {<br>
 &nbsp;&nbsp;&nbsp; //expects stl style iterators<br>
 &nbsp;&nbsp;&nbsp; template &lt;typename iT&gt;<br>
 &nbsp;&nbsp;&nbsp; static inline CPolygon&amp; set_points(CPolygon&amp; t, <br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 iT input_begin, iT input_end) {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t.clear();<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while(input_begin != input_end) {<br>
@@ -150,7 +152,7 @@ typedef std::deque&lt;CPolygon&gt; CPolygonSet;<br>
 namespace boost { namespace polygon {<br>
 &nbsp; //first we register CPolygonSet as a polygon set<br>
 &nbsp; template &lt;&gt;<br>
-&nbsp; struct geometry_concept&lt;CPolygonSet&gt; { typedef polygon_set_concept type; 
+&nbsp; struct geometry_concept&lt;CPolygonSet&gt; { typedef polygon_set_concept type;
 };<br>
 <br>
 &nbsp; //next we map to the concept through traits<br>
@@ -160,40 +162,40 @@ namespace boost { namespace polygon {<br>
 &nbsp;&nbsp;&nbsp; typedef CPolygonSet::const_iterator iterator_type;<br>
 &nbsp;&nbsp;&nbsp; typedef CPolygonSet operator_arg_type;<br>
 <br>
-&nbsp;&nbsp;&nbsp; static inline iterator_type begin(const CPolygonSet&amp; 
+&nbsp;&nbsp;&nbsp; static inline iterator_type begin(const CPolygonSet&amp;
 polygon_set) {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return polygon_set.begin();<br>
 &nbsp;&nbsp;&nbsp; }<br>
 <br>
-&nbsp;&nbsp;&nbsp; static inline iterator_type end(const CPolygonSet&amp; 
+&nbsp;&nbsp;&nbsp; static inline iterator_type end(const CPolygonSet&amp;
 polygon_set) {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return polygon_set.end();<br>
 &nbsp;&nbsp;&nbsp; }<br>
 <br>
 &nbsp;&nbsp;&nbsp; //don't worry about these, just return false from them<br>
-&nbsp;&nbsp;&nbsp; static inline bool clean(const CPolygonSet&amp; polygon_set) { 
+&nbsp;&nbsp;&nbsp; static inline bool clean(const CPolygonSet&amp; polygon_set) {
 return false; }<br>
-&nbsp;&nbsp;&nbsp; static inline bool sorted(const CPolygonSet&amp; polygon_set) { 
+&nbsp;&nbsp;&nbsp; static inline bool sorted(const CPolygonSet&amp; polygon_set) {
 return false; }<br>
 &nbsp; };<br>
 <br>
 &nbsp; template &lt;&gt;<br>
 &nbsp; struct polygon_set_mutable_traits&lt;CPolygonSet&gt; {<br>
 &nbsp;&nbsp;&nbsp; template &lt;typename input_iterator_type&gt;<br>
-&nbsp;&nbsp;&nbsp; static inline void set(CPolygonSet&amp; polygon_set, 
+&nbsp;&nbsp;&nbsp; static inline void set(CPolygonSet&amp; polygon_set,
 input_iterator_type input_begin, input_iterator_type input_end) {<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; polygon_set.clear();<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //this is kind of cheesy. I am copying the 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //this is kind of cheesy. I am copying the
 unknown input geometry<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //into my own polygon set and then calling get to 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //into my own polygon set and then calling get to
 populate the<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //deque<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; polygon_set_data&lt;int&gt; ps;<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ps.insert(input_begin, input_end);<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ps.get(polygon_set);<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //if you had your own odd-ball polygon set you 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //if you had your own odd-ball polygon set you
 would probably have<br>
-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //to iterate through each polygon at this point 
+&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //to iterate through each polygon at this point
 and do something<br>
 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //extra<br>
 &nbsp;&nbsp;&nbsp; }<br>
@@ -211,14 +213,14 @@ int main() {<br>
 &nbsp; long long diff1 = c2 - c1;<br>
 &nbsp; long long diff2 = c3 - c2;<br>
 &nbsp; if(diff1 &gt; 0 &amp;&amp; diff2)<br>
-&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;library polygon_set_data is &quot; &lt;&lt; 
-float(diff1)/float(diff2) &lt;&lt; &quot;X faster than custom polygon set deque of CPolygon&quot; 
+&nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;library polygon_set_data is &quot; &lt;&lt;
+float(diff1)/float(diff2) &lt;&lt; &quot;X faster than custom polygon set deque of CPolygon&quot;
 &lt;&lt; std::endl;<br>
 &nbsp; else<br>
 &nbsp;&nbsp;&nbsp; std::cout &lt;&lt; &quot;operation was too fast&quot; &lt;&lt; std::endl;<br>
 &nbsp; return 0;<br>
 }</font></p>
-<p><font face="Courier New">//Now you know how to map your own data type to 
+<p><font face="Courier New">//Now you know how to map your own data type to
 polygon set concept<br>
 //Now you also know how to make your application code that operates on geometry<br>
 //data type agnostic from point through polygon set
@@ -236,7 +238,7 @@ polygon set concept<br>
                </tr>
                <tr class="field">
                        <th class="docinfo-name">License:</th>
-                       <td class="field-body">Distributed under the Boost Software License, 
+                       <td class="field-body">Distributed under the Boost Software License,
                        Version 1.0. (See accompanying file <tt class="literal">
                        <span class="pre">LICENSE_1_0.txt</span></tt> or copy at
                        <a class="reference" target="_top" href="http://www.boost.org/LICENSE_1_0.txt">