greenemm42

Implementing a Unique Value Renderer for Graphics Layers

Discussion created by greenemm42 on Mar 9, 2017
Latest reply on Mar 17, 2017 by norbert.thoden

Hi QT SDK community,

I'm looking to use a Unique Value Renderer in order to display different colored lines connecting from the ground to points in the sky. I have read ESRI's webpage about different rendering processes, and I think the Unique Value Renderer is what I need to be using. I've created a unique value denoted as "QString uniqueString", which I think I need as a unique ID in order to render properly. uniqueString contains unique values to the objects in the sky that I am trying to project lines from. "Qcolor lineColor" contain the unique colors that I want the lines to be. Below is the code I am using that does not compile.

 

void addLineOfSightToMapFunc(Point deviceLocation, Point satLocation,Esri::ArcGISRuntime::SceneGraphicsView* m_sceneView, QColor lineColor,QString uniqueString,mn::GraphicsOverlay* lineGraphicOverlay, MapRay *thisF )
{
    mn::UniqueValueRenderer* LOS= new mn:: UniqueValueRenderer(thisF);
    // create a graphics overlay for the lines
    lineGraphicOverlay->sceneProperties().setSurfacePlacement(mn::SurfacePlacement::Absolute);
    lineGraphicOverlay->setSceneProperties(mn::LayerSceneProperties(mn::SurfacePlacement::Absolute));
    // add the overlay to the mapview
    m_sceneView->graphicsOverlays()->append(LOS);
    // create line geometry
    mn::PolygonBuilder polylineBuilder(m_sceneView->spatialReference());
    // build the polyline
    polylineBuilder.addPoint(deviceLocation.x,deviceLocation.y,deviceLocation.z);
    polylineBuilder.addPoint(satLocation.x,satLocation.y,satLocation.z);
    // tells renderer what type of symbol to use.
    mn::SimpleLineSymbol* sls = new mn::SimpleLineSymbol(mn::SimpleLineSymbolStyle::Solid, lineColor, 5, thisF);
    // creates graphic from the polylineBuilder
    mn::Graphic* lineGraphic = new mn::Graphic(polylineBuilder.toGeometry(), thisF);
    // set the renderer of the graphic overlay to be the line symbol
    lineGraphicOverlay->setRenderer(UniqueValueRenderer);
    // add the graphic to the overlay
    lineGraphicOverlay->graphics()->append(lineGraphic);
}
Any help would be greatly appreciated.

Outcomes