POST
|
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); graphicsOverlay->sceneProperties().setSurfacePlacement(mn::SurfacePlacement::Absolute); m_sceneView->graphicsOverlays()->append(graphicsOverlay); 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); graphicsOverlay->graphics()->append(graphic); } 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)); lineGraphicOverlay->graphics()->append(lineGraphic); m_sceneView->graphicsOverlays()->append(lineGraphicOverlay); } Seems like it should be a simple process, but it's not working. Any help would be much appreciated!
... View more
02-09-2017
12:41 PM
|
0
|
4
|
3241
|
Online Status |
Offline
|
Date Last Visited |
11-11-2020
02:25 AM
|