<meta name="qrichtext" content="1"><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><style type="text/css">
p, li { white-space: pre-wrap; }
</style>
<p style="margin: 0px; text-indent: 0px;">Hello Developers,</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">I am working on a little application using QGIS and am having trouble using the QgsGeometry contains(QgsPoint *p) function.  I have included the section of code that is not working for me as well as the error message I am getting.  It appears that currentGeometry2 is not of type QgsGeometry*, but I can&#39;t figure out why.  This is the first application I have tried to write using C++ so the solution may be more of a C++ question than a QGIS problem...not sure.</p>
<p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">Any help or pointers would be greatly appreciated.</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">
Thanks,<br></p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">Matt<br></p><br><p style="margin: 0px; text-indent: 0px;">CODE:</p><p style="margin: 0px; text-indent: 0px;">  // Instantiate Provider Register</p>

<p style="margin: 0px; text-indent: 0px;">   QgsProviderRegistry::instance(myPluginsDir);<br></p>


<p style="margin: 0px; text-indent: 0px;">  //Open the shapefile vector layer from file</p>
<p style="margin: 0px; text-indent: 0px;">  QgsVectorLayer * mypVectorLayer  = new QgsVectorLayer(myLayerPath, myLayerBaseName, myProviderName);</p>
<p style="margin: 0px; text-indent: 0px;">  QgsVectorLayer * mypVectorLayer2  = new QgsVectorLayer(myLayerPath3, myLayerBaseName, myProviderName);</p>
<p style="margin: 0px; text-indent: 0px;"></p>


<p style="margin: 0px; text-indent: 0px;">  //create a holder for retrieving point features from the provider</p>
<p style="margin: 0px; text-indent: 0px;">  QgsFeature currentFeature;</p>
<p style="margin: 0px; text-indent: 0px;">  QgsVectorDataProvider * dataProvider = mypVectorLayer-&gt;dataProvider();</p>

<p style="margin: 0px; text-indent: 0px;">  mypVectorLayer-&gt;select(dataProvider-&gt;attributeIndexes());</p><p style="margin: 0px; text-indent: 0px;"><br></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">  //create a holder for retrieving mask features from the provider</p>
<p style="margin: 0px; text-indent: 0px;">  QgsFeature currentFeature2;</p>

<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">  QgsVectorDataProvider * dataProvider2 = mypVectorLayer2-&gt;dataProvider();</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">  mypVectorLayer2-&gt;select(dataProvider2-&gt;attributeIndexes());</p><p style="margin: 0px; text-indent: 0px;"><br></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">    //now iterate through each point feature</p>
<p style="margin: 0px; text-indent: 0px;">    while (mypVectorLayer-&gt;nextFeature(currentFeature))</p>
<p style="margin: 0px; text-indent: 0px;">    {</p>
<p style="margin: 0px; text-indent: 0px;">        //get point geometry for current feature</p>
<p style="margin: 0px; text-indent: 0px;">        QgsGeometry * currentGeometry = currentFeature.geometry();</p>
<p style="margin: 0px; text-indent: 0px;">        QgsPoint currentPoint = currentGeometry-&gt;asPoint();</p><p style="margin: 0px; text-indent: 0px;"><br></p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">        //now interate through each polygon feature</p>
<p style="margin: 0px; text-indent: 0px;">        while (mypVectorLayer2-&gt;nextFeature(currentFeature2))</p>
<p style="margin: 0px; text-indent: 0px;">        {</p>
<p style="margin: 0px; text-indent: 0px;">            //get polygon geometry for current feature</p>
<p style="margin: 0px; text-indent: 0px;">            QgsGeometry * currentGeometry2 = currentFeature2.geometry();</p>
<p style="margin: 0px; text-indent: 0px;">            QgsPolygon currentPolygon = currentGeometry2-&gt;asPolygon();</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">            //check if point is contained in polygon<br>
</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">            if(currentGeometry2.contains(currentPoint))</p>
<p style="margin: 0px; text-indent: 0px;">            {</p>
<p style="margin: 0px; text-indent: 0px;"></p>
<p style="margin: 0px; text-indent: 0px;">                //do something with points that are within the current polygon</p><p style="margin: 0px; text-indent: 0px;">            }</p>
<p style="margin: 0px; text-indent: 0px;">        }</p>
<p style="margin: 0px; text-indent: 0px;">    }</p><p style="margin: 0px; text-indent: 0px;"><br></p><p style="margin: 0px; text-indent: 0px;">ERROR:</p><p style="margin: 0px; text-indent: 0px;"><br></p>
<p style="margin: 0px; text-indent: 0px;">/home/matt/Programming/TestingCreator/delaunay_intersect.h:87:<br>error: request for member ‘contains’ in ‘currentGeometry2’, which is of<br>non-class type ‘QgsGeometry*’</p>
<p style="margin: 0px; text-indent: 0px;"></p>