ArcGIS Runtime SDK for Qt

Find a route

Loading

Code

#ifndef FIND_ROUTE_H
#define FIND_ROUTE_H

namespace Esri
{
  namespace ArcGISRuntime
  {
    class Map;
    class MapQuickView;
    class GraphicsOverlay;
    class PictureMarkerSymbol;
    class RouteTask;
  }
}

#include <RouteParameters.h>
#include <QQuickItem>
#include <QUrl>

class FindRoute : public QQuickItem
{
  Q_OBJECT

  Q_PROPERTY(QAbstractListModel* directions READ directions NOTIFY directionsChanged)

public:
  explicit FindRoute(QQuickItem* parent = nullptr);
  ~FindRoute();

  void componentComplete() Q_DECL_OVERRIDE;
  static void init();
  Q_INVOKABLE void solveRoute();

signals:
  void directionsChanged();
  void solveRouteComplete();

private:
  void addStopGraphics();
  void setupRouteTask();
  QAbstractListModel* directions();
  Esri::ArcGISRuntime::PictureMarkerSymbol* getPictureMarkerSymbol(QUrl imageUrl);

private:
  Esri::ArcGISRuntime::Map* m_map = nullptr;
  Esri::ArcGISRuntime::MapQuickView* m_mapView = nullptr;
  Esri::ArcGISRuntime::GraphicsOverlay* m_routeGraphicsOverlay = nullptr;
  Esri::ArcGISRuntime::GraphicsOverlay* m_stopsGraphicsOverlay = nullptr;
  Esri::ArcGISRuntime::RouteTask* m_routeTask = nullptr;
  Esri::ArcGISRuntime::RouteParameters m_routeParameters;
  QAbstractListModel* m_directions = nullptr;
};

#endif // FIND_ROUTE_H


In this topic
  1. Code