Lucas,
As always, the hardest part is getting started. You have to spend time learning an API. If I can't get your API to work, I'll have to give up. I'll give you the example I just made:
void Gui_MainWindow::createMapView()
{
// Create a map
m_Map = new Map(Basemap::streetsWithReliefVector(this), this); // streetsWithReliefVector
m_MapView = new MapGraphicsView(this); // Create the Widget view
m_MapView->setMap(m_Map); // Set map to map view
m_GraphicsOverlay = new GraphicsOverlay(this);
m_GraphicsOverlay->setRenderingMode(GraphicsRenderingMode::Dynamic);
m_MapView->graphicsOverlays()->append(m_GraphicsOverlay);
// Load Dictionary
DictionarySymbolStyle *dictionarySymbolStyle = DictionarySymbolStyle::createFromFile( QDir::homePath() + "/ArcGIS/Runtime/Data/styles/arcade_style/mil2525d.stylx", this );
DictionaryRenderer *renderer = new DictionaryRenderer(dictionarySymbolStyle, this);
m_GraphicsOverlay->setRenderer(renderer);
// Creation of the point of origin of the graph
Point *point = new Point( -57.675, -51.641, SpatialReference::wgs84() );
m_MapView->setViewpointCenter( *point, 150000 );
m_pointGraphic = new Graphic( *point, this );
// Draw symbol NATO
QVariantMap *elementValues = new QVariantMap();
elementValues->begin();
elementValues->insert("identity","5"); // Affiliation
elementValues->insert("symbolset","30"); // symbolset
elementValues->insert("symbolentity", "120202"); // symbolentity
elementValues->insert("echelon", "1"); // echelon
elementValues->insert("uniquedesignation","S001"); // uniquedesignation
elementValues->end();
Graphic *graphic = new Graphic( *point, *elementValues, this );
m_GraphicsOverlay->graphics()->append( graphic );
// Draw Motion vector
SimpleLineSymbol *line_symbol = new SimpleLineSymbol( SimpleLineSymbolStyle::Solid, QColor(Qt::black), 1.0f, this );
line_symbol->setAntiAlias( true );
PolylineBuilder *polyline_builder = new PolylineBuilder( SpatialReference::wgs84(), this );
polyline_builder->addPoint( *point );
polyline_builder->addPoint( -57.68, -51.645 ); // here we have a problem: I want 10 pixels in length in one direction ?
Graphic *polyline_graphic = new Graphic( polyline_builder->toGeometry(), line_symbol, this );
m_GraphicsOverlay->graphics()->append(polyline_graphic);
m_MapView->graphicsOverlays()->append(m_GraphicsOverlay);
// Creation of a surface radar range
SimpleMarkerSymbol *surfaceRadar = new SimpleMarkerSymbol( SimpleMarkerSymbolStyle::Circle, QColor("transparent"), 100.0f /*range*/, this ); // here too, I want a radius in km ?
surfaceRadar->setOutline( new SimpleLineSymbol( SimpleLineSymbolStyle::Solid, QColor("green"), 1.0f, this) );
// Creation of an air radar range
SimpleMarkerSymbol *airRadar = new SimpleMarkerSymbol( SimpleMarkerSymbolStyle::Circle, QColor("transparent"), 300.0f /*range*/, this ); // same here, a radius in km ?
airRadar->setOutline( new SimpleLineSymbol( SimpleLineSymbolStyle::Solid, QColor("red"), 1.0f, this) );
m_pointSymbol = dynamic_cast<MultilayerPointSymbol*>( surfaceRadar->toMultilayerSymbol(this) );
auto outlineSymbol = dynamic_cast<MultilayerPointSymbol*>( airRadar->toMultilayerSymbol(this) );
if (outlineSymbol) {
if (!outlineSymbol->symbolLayers()->isEmpty()) {
outlineSymbol->symbolLayers()->at(0)->setColorLocked( true );
m_pointSymbol->symbolLayers()->append( outlineSymbol->symbolLayers()->at(0) );
}
}
m_pointGraphic->setSymbol( m_pointSymbol ); // set symbol on the graphic
m_GraphicsOverlay->graphics()->append( m_pointGraphic ); // add graphic to overlay
}
I don't know how to make a circle with a radius in km, and draw a line of 10 pixels on the screen?
Best regards
Michel Guenin