ArcGIS Runtime SDK for Qt

OpenStreetMap layer

Loading

Code

#include "OSM_Layer.h"

#include "Map.h"
#include "MapQuickView.h"
#include "OpenStreetMapLayer.h"
#include "Basemap.h"

using namespace Esri::ArcGISRuntime;

OSM_Layer::OSM_Layer(QQuickItem* parent /* = nullptr */):
  QQuickItem(parent)
{
}

void OSM_Layer::init()
{
  // Register the map view for QML
  qmlRegisterType<MapQuickView>("Esri.Samples", 1, 0, "MapView");
  qmlRegisterType<OSM_Layer>("Esri.Samples", 1, 0, "OSM_LayerSample");
}

void OSM_Layer::componentComplete()
{
  QQuickItem::componentComplete();

  // find QML MapView component
  m_mapView = findChild<MapQuickView*>("mapView");

  // Create a map using the OpenStreetMap basemap
  m_map = new Map(Basemap::openStreetMap(this), this);

  // Set map to map view
  m_mapView->setMap(m_map);
}


In this topic
  1. Code