Displaying Geodesic Ellipse with Graphics Layer

459
2
04-18-2017 03:10 PM
MichaelGreene2
New Contributor II

I'm trying to write a simple function that draws ellipses at certain device locations as seen in my code below.  

void theellipse(const mn:: Point deviceLocation,mn::SceneGraphicsView* m_sceneView,QColor lineColor,mn::GraphicsOverlay* ellipseGraphicOverlay, MapRay *thisF)
{
    const mn::Point normalizedPt = mn::GeometryEngine::normalizeCentralMeridian(deviceLocation);
    mn::GeodesicEllipseParameters parameters(/*angle*/90,mn::AngularUnit(mn::AngularUnitId::Degrees),normalizedPt,
                   /*unit*/ mn::LinearUnit(mn::LinearUnitId::Kilometers),
                  /*maxpointCount*/10,
                 /*maxSegmentLength*/10000,
                /*geometryType*/mn::GeometryType::Polygon,
               /*SemiAxislength*/120,
              /*SemiAxisLength*/210);
ellipseGraphicOverlay->sceneProperties().setSurfacePlacement(mn::SurfacePlacement::Draped);
m_sceneView->graphicsOverlays()->append(ellipseGraphicOverlay);
mn::PolygonBuilder PolygonBuilder(m_sceneView->spatialReference());
PolygonBuilder.addPoint(deviceLocation);
mn::Polygon ellipse1= mn::GeometryEngine::ellipseGeodesic(parameters);


It's not clear for me through looking at documentation how to turn geodesic ellipse parameters into scene symbols that are graphic layers. 
Any help would be much appreciated. Thanks.

~mike
0 Kudos
2 Replies
LukeSmallwood
Esri Contributor

Hi Mike,

You can use the type returned by ellipseGeodesic (in this case a Polygon) as the geometry for a Graphic and then add the graphic to the GraphicsOverlay. To symbolise the graphic in the overlay you can either set a Symbol directly or set a Renderer using a symbol for the entire overlay.

If you take a look at these two samples from our github repository you should see some examples of different approaches to displaying graphics:

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/DisplayInformation/Simple_Renderer at v.next... 

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/DisplayInformation/Simple_Marker_Symbol at v... 

this sample shows the use of symbols in a scene:

arcgis-runtime-samples-qt/ArcGISRuntimeSDKQt_CppSamples/Scenes/Symbols at v.next · Esri/arcgis-runti... 

I hope that helps,

Luke

0 Kudos
MichaelGreene2
New Contributor II

I will look into this. 

Thanks Luke,

Mike

0 Kudos