AnsweredAssumed Answered

How to implement draw functionality of polylines/polygons in ArcGIS SDK 100.0

Question asked by Dark.rider85 on Jun 22, 2017
Latest reply on Jun 22, 2017 by LSmallwood-esristaff

In ArcGIS 10.2.6 there was sample code about drawing polylines. I am now using the ArcGIS 100.0 SDK trying to implment the same functionality there but it does not work somehow. Nothing is shown on the map.

This is the code I am currently using:

 

When clicking left on the map, this code is executed:

if(!m_currentPolylineStarted)
        {
            m_currentPolyLineBuilder.addPoint(mapPointMouse);
            m_currentPolylineGraphic = new Esri::ArcGISRuntime::Graphic(m_currentPolyLineBuilder.toGeometry(), this);           
            m_graphicsLayer->graphics()->append(m_currentPolylineGraphic);
            
m_currentPolylineStarted = true;
//            m_currentPolyline.startPath(mapPointMouse);
//            m_currentPolyline.lineTo(mapPointMouse);
//            Esri::ArcGISRuntime::Graphic* graphic = new Esri::ArcGISRuntime::Graphic(Esri::ArcGISRuntime::Polyline(m_currentPolyline), Esri::ArcGISRuntime::SimpleLineSymbol(Qt::red, 1));
//            m_currentPolylineId = m_graphicsLayer->graphics()->append(graphic);
}
        else
        {
            m_currentPolyLineBuilder.addPoint(mapPointMouse);
            m_currentPolylineGraphic->setGeometry(m_currentPolyLineBuilder.toGeometry());
//            m_currentPolyline.lineTo(mapPointMouse);
//            m_graphicsLayer->updateGraphic(m_currentPolylineId, new Esri::ArcGISRuntime::Graphic(Esri::ArcGISRuntime::Polyline(m_currentPolyline), Esri::ArcGISRuntime::SimpleLineSymbol(Qt::red, 1)));
        }

where mapPointMouse is the current mouse point position. The commented code was the old way (using ArcGIS SDK 10.2.6 which worked fine.

 

What am I doing wrong?

Are there samples providing the same functionality on the new ArcGIS SDK 100.0?

 

Thanks in advance

Outcomes