<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
I'm finding that I'm spending lots of time trying to figure out
method parameters in Python. <br>
<br>
The documented QGIS API apparently does not match the Python API.
See question in email below. Compare the documents with the
statement I ended up with and you see the differences.<br>
<br>
It seems that I'm having to experiment to figure out what to do for
many objects. <br>
<br>
This is frustrating and I wonder if I am just missing something.<br>
<br>
<br>
<div class="moz-signature"><b>Worth Lutz</b><br>
<br>
<br>
</div>
<div class="moz-cite-prefix">On 5/5/2016 12:25 PM, Worth Lutz wrote:<br>
</div>
<blockquote
cite="mid:1845b515-fbc4-bd48-29bc-1dd69d6812b0@mindspring.com"
type="cite">
<meta http-equiv="content-type" content="text/html; charset=utf-8">
I'm trying to use "closestSegmentWithContext" method of
QgsGeometry in a plugin. I don't seem to be getting what I'm
expecting.<br>
<br>
Comparing
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="http://qgis.org/api/classQgsGeometry.html#ac09505a6a8a29f244a37c6f336cd98e7">http://qgis.org/api/classQgsGeometry.html#ac09505a6a8a29f244a37c6f336cd98e7</a><br>
<br>
with the following from:
<a moz-do-not-send="true" class="moz-txt-link-freetext"
href="https://github.com/qgis/QGIS/blob/master/python/core/geometry/qgsgeometry.sip">https://github.com/qgis/QGIS/blob/master/python/core/geometry/qgsgeometry.sip</a><br>
<br>
/**<br>
* Searches for the closest segment of geometry to the given
point<br>
* @param point Specifies the point for search<br>
* @param minDistPoint Receives the nearest point on the
segment<br>
* @param afterVertex Receives index of the vertex after the
closest segment. The vertex<br>
* before the closest segment is always afterVertex - 1<br>
* @param leftOf Out: Returns if the point lies on the left of
right side of the segment ( < 0 means left, > 0 means right
)<br>
* @param epsilon epsilon for segment snapping (added in 1.8)<br>
* @return The squared cartesian distance is also returned in
sqrDist, negative number on error<br>
*/<br>
double closestSegmentWithContext( const QgsPoint& point,
QgsPoint& minDistPoint /Out/, int& afterVertex /Out/ )
const;<br>
<br>
<br>
When I try: <br>
<blockquote><tt>results =
self.selectedStreetSegment.geometry().closestSegmentWithContext(point)</tt><br>
</blockquote>
<br>
I get a results as:<br>
<blockquote>(2560.365846544, (2106395, 746610), 1)<br>
</blockquote>
I take this to be (sqrDist, minDistPoint, afterVertex ). It does
not seem to be returning "leftOf" which is the value I'm looking
for.<br>
<br>
Is something missing in that "sip" definition? I do not know what
I'm looking at so I may be looking at the wrong thing. In any
case, I cannot seem to find the results I need.<br>
<br>
Thanks,<br>
--<br>
<div class="moz-signature"><b>Worth Lutz</b><br>
<br>
<br>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<br>
<pre wrap="">_______________________________________________
Qgis-developer mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Qgis-developer@lists.osgeo.org">Qgis-developer@lists.osgeo.org</a>
List info: <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a>
Unsubscribe: <a class="moz-txt-link-freetext" href="http://lists.osgeo.org/mailman/listinfo/qgis-developer">http://lists.osgeo.org/mailman/listinfo/qgis-developer</a></pre>
</blockquote>
<br>
</body>
</html>