AnsweredAssumed Answered

Creating a polyline from points in C++ with QT creator

Question asked by Cleachroic on Feb 9, 2017
Latest reply on Mar 6, 2017 by norbert.thoden

Hi fellow GIS persons,


I’m trying to implement some C++ code to start putting some basic features on a projection of a globe using QT creator.  My code compiles and displays my projected points on a map within the application I’m building, but my polyline code does not seem to be projecting.


Here is the code that produces the points, but will not produce lines.


void MapRay::addSymbols(vector<Point> *locations)
mn::GraphicsOverlay* graphicsOverlay = new mn::GraphicsOverlay(this);


for (int i=0; i < locations->size(); i++)
Point loc = locations->at(i);

mn::SimpleMarkerSceneSymbol* smss = new mn::SimpleMarkerSceneSymbol(mn::SimpleMarkerSceneSymbolStyle::Sphere, QColor(255,0,0), 200, 200, 200, mn::SceneSymbolAnchorPosition::Center, this);

mn::Graphic* graphic = new mn::Graphic(mn::Point(loc.y, loc.x, loc.z, m_sceneView->spatialReference()), smss, this);



mn::PolygonBuilder polylineBuilder(mn::SpatialReference::webMercator());

for (int i=0; i < 2; i++)
Point loc = locations->at(i);
polylineBuilder.addPoint(loc.y, loc.x, loc.z);

mn::SimpleLineSymbol* sls = new mn::SimpleLineSymbol(mn::SimpleLineSymbolStyle::Solid, QColor("blue"), 5, this);

mn::Graphic* lineGraphic = new mn::Graphic(polylineBuilder.toGeometry(), this);

mn::GraphicsOverlay* lineGraphicOverlay = new mn::GraphicsOverlay(this);

lineGraphicOverlay->setRenderer(new mn::SimpleRenderer(sls, this));




Seems like it should be a simple process, but it's not working.

Any help would be much appreciated!