MapView Class

  • MapView
  • class Esri::ArcGISRuntime::MapView

    A MapView renders data in a map and allows users to interact with the map. More...

    Header: #include <MapView.h>
    Since: Esri::ArcGISRuntime 100.0
    Inherits: Esri::ArcGISRuntime::GeoView
    Inherited By:

    Esri::ArcGISRuntime::MapGraphicsView and Esri::ArcGISRuntime::MapQuickView

    This class was introduced in Esri::ArcGISRuntime 100.0.

    Public Functions

    virtual ~MapView() override
    Esri::ArcGISRuntime::BackgroundGrid backgroundGrid() const
    Esri::ArcGISRuntime::CalloutData *calloutData() const
    Esri::ArcGISRuntime::Grid *grid() const
    bool isMagnifierEnabled() const
    bool isMagnifierMapPanningEnabled() const
    bool isRotationByPinchingEnabled() const
    bool isZoomByPinchingEnabled() const
    Esri::ArcGISRuntime::LocationDisplay *locationDisplay() const
    QPointF locationToScreen(const Esri::ArcGISRuntime::Point &mapPoint) const
    Esri::ArcGISRuntime::Map *map() const
    double mapRotation() const
    double mapScale() const
    Esri::ArcGISRuntime::Point screenToLocation(double screenX, double screenY) const
    void setBackgroundGrid(const Esri::ArcGISRuntime::BackgroundGrid &backgroundGrid)
    void setGrid(Esri::ArcGISRuntime::Grid *grid)
    void setMagnifierEnabled(bool magnifierEnabled)
    void setMagnifierMapPanningEnabled(bool magnifierMapPanningEnabled)
    void setMap(Esri::ArcGISRuntime::Map *map)
    void setRotationByPinchingEnabled(bool rotationByPinching)
    void setSketchEditor(Esri::ArcGISRuntime::SketchEditor *sketchEditor)
    Esri::ArcGISRuntime::TaskWatcher setViewpointAnimated(const Esri::ArcGISRuntime::Viewpoint &viewpoint, float durationSeconds, Esri::ArcGISRuntime::AnimationCurve curve)
    Esri::ArcGISRuntime::TaskWatcher setViewpointCenter(const Esri::ArcGISRuntime::Point &center)
    Esri::ArcGISRuntime::TaskWatcher setViewpointCenter(const Esri::ArcGISRuntime::Point &center, double scale)
    Esri::ArcGISRuntime::TaskWatcher setViewpointGeometry(const Esri::ArcGISRuntime::Geometry &boundingGeometry)
    Esri::ArcGISRuntime::TaskWatcher setViewpointGeometry(const Esri::ArcGISRuntime::Geometry &boundingGeometry, double paddingInDIPS)
    Esri::ArcGISRuntime::TaskWatcher setViewpointRotation(double angleDegrees)
    Esri::ArcGISRuntime::TaskWatcher setViewpointScale(double scale)
    void setWrapAroundMode(Esri::ArcGISRuntime::WrapAroundMode wrapAroundMode)
    void setZoomByPinchingEnabled(bool zoomByPinching)
    Esri::ArcGISRuntime::SketchEditor *sketchEditor() const
    double unitsPerDIP() const
    Esri::ArcGISRuntime::Polygon visibleArea() const
    Esri::ArcGISRuntime::WrapAroundMode wrapAroundMode() const

    Protected Functions

    MapView(int width, int height)
    virtual void mapRotationChangedEvent()
    virtual void mapScaleChangedEvent()

    Detailed Description

    In a Model-View-Controller (MVC) architecture, a map view represents the view and a map represents the model.

    Note: MapView is a virtual class that can be reimplemented to a desired Qt type. For example, MapQuickView implements the map view as a QQuickItem, and MapGraphicsView implements the map view as a QGraphicsView. Beyond this, one could implement the map view as another desired type, such as QGraphicsWidget.

    See also Map, GeoView, MapGraphicsView, and MapQuickView.

    Member Function Documentation

    [protected] MapView::MapView(int width, int height)

    Constructs a MapView with a certain width and height.

    [override virtual] MapView::~MapView()

    Destructor.

    Esri::ArcGISRuntime::BackgroundGrid MapView::backgroundGrid() const

    Gets the map view's background grid.

    See also setBackgroundGrid.

    Esri::ArcGISRuntime::CalloutData *MapView::calloutData() const

    Gets the callout data from the map view.

    The callout data that is returned can be modified, and then used with a view for display.

    Views available for use with this and other models are available in the ArcGIS Runtime SDK for Qt Toolkit. See the Toolkit API reference for details.

    Esri::ArcGISRuntime::Grid *MapView::grid() const

    Gets the map view's grid.

    The grid displays over the map.

    See also setGrid().

    bool MapView::isMagnifierEnabled() const

    Gets whether the magnifier is enabled. Returns true if the magnifier is enabled.

    bool MapView::isMagnifierMapPanningEnabled() const

    Gets whether panning the map with the magifier is enabled. Returns true if panning the map with the magnifier is enabled.

    bool MapView::isRotationByPinchingEnabled() const

    Gets whether the map view rotates using a two-finger twist gesture.

    Rotation by pinching is disabled by default. Returns true if the map view rotates with a two-finger twist gestures.

    bool MapView::isZoomByPinchingEnabled() const

    Gets whether the map view zooms with a pinch gesture.

    The default is true. Returns true if the map view zooms with a pinch gesture.

    Esri::ArcGISRuntime::LocationDisplay *MapView::locationDisplay() const

    Gets the location display used for displaying device location from a datasource such as a GPS sensor.

    QPointF MapView::locationToScreen(const Esri::ArcGISRuntime::Point &mapPoint) const

    Converts mapPoint within the map view's spatial reference to a screen coordinate.

    If the WrapAroundMode on the map view is enabled, this method returns the closest screen location matching the specified map location. If the closest screen coordinate is visible then that location is returned. Otherwise, the screen coordinate for the frame where the location is the closest to the center of the view is returned.

    This method cannot be called until a map has been given to the map view by calling setMap on the map view. If this method is called before the map view is ready, an error will occur.

    Esri::ArcGISRuntime::Map *MapView::map() const

    Gets the map. Returns the map that is currently set to the map view.

    Setting a non-loaded map to a view starts the load process of the map so the map can be displayed once loaded.

    See also setMap().

    double MapView::mapRotation() const

    Gets the rotation in degrees.

    [virtual protected] void MapView::mapRotationChangedEvent()

    Override this method to perform custom logic when the mapRotation changes.

    double MapView::mapScale() const

    Gets the scale.

    [virtual protected] void MapView::mapScaleChangedEvent()

    Override this method to perform custom logic when the mapScale changes.

    Esri::ArcGISRuntime::Point MapView::screenToLocation(double screenX, double screenY) const

    Converts screenX and screenY screen coordinates to a Point in coordinates of the geo view.

    void MapView::setBackgroundGrid(const Esri::ArcGISRuntime::BackgroundGrid &backgroundGrid)

    Sets the map view's background grid to backgroundGrid.

    The background grid determines the color and context grid of a map view when no MapView::map has been set.

    The Map displays on top of the background grid or the optional Map::backgroundColor to determine what is displayed under transparent areas of the map.

    If Map::backgroundColor is not nullptr, then backgroundGrid is ignored and Map::backgroundColor will be used as the background color of the map.

    See also backgroundGrid().

    void MapView::setGrid(Esri::ArcGISRuntime::Grid *grid)

    Sets the map view's grid to grid.

    See also grid().

    void MapView::setMagnifierEnabled(bool magnifierEnabled)

    Sets whether the magnifier is enabled.

    • magnifierEnabled true to enable the magnifier.

    See also isMagnifierEnabled().

    void MapView::setMagnifierMapPanningEnabled(bool magnifierMapPanningEnabled)

    Sets whether panning the map with the magifier is enabled.

    • magnifierMapPanningEnabled true to enable map panning with the magnifier.

    See also isMagnifierMapPanningEnabled().

    void MapView::setMap(Esri::ArcGISRuntime::Map *map)

    Sets the map.

    • map - The map to associate with this map view.

    See also map().

    void MapView::setRotationByPinchingEnabled(bool rotationByPinching)

    Sets whether the map view rotates using a two-finger twist gesture.

    Rotation by pinching is disabled by default.

    • rotationByPinching - Whether the map view rotates with a two-finger twist gesture.

    See also isRotationByPinchingEnabled().

    void MapView::setSketchEditor(Esri::ArcGISRuntime::SketchEditor *sketchEditor)

    Sets the map view's sketch editor to sketchEditor.

    This function was introduced in Esri::ArcGISRuntime 100.12.

    See also sketchEditor().

    Esri::ArcGISRuntime::TaskWatcher MapView::setViewpointAnimated(const Esri::ArcGISRuntime::Viewpoint &viewpoint, float durationSeconds, Esri::ArcGISRuntime::AnimationCurve curve)

    Set the viewpoint asynchronously with custom animation options.

    • viewpoint - The viewpoint to set.
    • durationSeconds - The number of seconds for the animation to run from beginning to end.
    • curve - The type of animation to use.

    Returns a TaskWatcher for the asynchronous task.

    Esri::ArcGISRuntime::TaskWatcher MapView::setViewpointCenter(const Esri::ArcGISRuntime::Point &center)

    Set the viewpoint asynchronously with a center point.

    • center - The center point to set.

    Returns a TaskWatcher for the asynchronous task.

    Esri::ArcGISRuntime::TaskWatcher MapView::setViewpointCenter(const Esri::ArcGISRuntime::Point &center, double scale)

    Set the viewpoint asynchronously with a center point and scale.

    • center - The center point to set.
    • scale - The scale to zoom to.

    Returns a TaskWatcher for the asynchronous task.

    Esri::ArcGISRuntime::TaskWatcher MapView::setViewpointGeometry(const Esri::ArcGISRuntime::Geometry &boundingGeometry)

    Set the viewpoint asynchronously with a bounding geometry.

    • boundingGeometry - The bounding geometry to set.

    Returns a TaskWatcher for the asynchronous task.

    Esri::ArcGISRuntime::TaskWatcher MapView::setViewpointGeometry(const Esri::ArcGISRuntime::Geometry &boundingGeometry, double paddingInDIPS)

    Set the viewpoint asynchronously with a bounding geometry and padding.

    • boundingGeometry - The bounding geometry to set.
    • paddingInDIPS - The space in device independent pixels (DIPS) to expand the viewport by.

    Returns a TaskWatcher for the asynchronous task.

    Esri::ArcGISRuntime::TaskWatcher MapView::setViewpointRotation(double angleDegrees)

    Set the viewpoint asynchronously with rotation.

    • angleDegrees - The angle of the rotation in degrees.

    Returns a TaskWatcher for the asynchronous task.

    Esri::ArcGISRuntime::TaskWatcher MapView::setViewpointScale(double scale)

    Set the viewpoint asynchronously with scale.

    • scale - The scale to zoom to.

    Returns a TaskWatcher for the asynchronous task.

    void MapView::setWrapAroundMode(Esri::ArcGISRuntime::WrapAroundMode wrapAroundMode)

    Sets the WrapAroundMode.

    See also wrapAroundMode().

    void MapView::setZoomByPinchingEnabled(bool zoomByPinching)

    Sets whether the map view zooms with a pinch gesture.

    By default, zooming the map view with a pinch gesture is enabled.

    • zoomByPinching - Whether the map view zooms with a pinch gesture.

    See also isZoomByPinchingEnabled().

    Esri::ArcGISRuntime::SketchEditor *MapView::sketchEditor() const

    Returns a sketch editor that allows users to interactively sketch geometries on the view.

    Returns the sketch editor associated with this map view if it exists.

    See also setSketchEditor().

    double MapView::unitsPerDIP() const

    Gets the units per device independent pixel value (resolution).

    Esri::ArcGISRuntime::Polygon MapView::visibleArea() const

    Gets the current visible area of the map view.

    Esri::ArcGISRuntime::WrapAroundMode MapView::wrapAroundMode() const

    Gets the current WrapAroundMode.

    See also setWrapAroundMode().

    Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.