Skip To Content ArcGIS for Developers Sign In Dashboard

MapView Class

(Esri::ArcGISRuntime::MapView)

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

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

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

Public Functions

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

Protected Functions

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

Detailed Description

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

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.

MapView::~MapView()

Destructor.

BackgroundGrid MapView::backgroundGrid() const

Gets the view's background grid.

The map is displayed on top of this background grid.

See also setBackgroundGrid().

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.

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.

ViewLabelProperties MapView::labeling() const

Gets the current labeling settings.

See also setLabeling().

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 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.

Map *MapView::map() const

Gets the map. Returns the map associated with this map view.

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.

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 BackgroundGrid &backgroundGrid)

Sets the view's background grid to backgroundGrid.

See also backgroundGrid().

void MapView::setGrid(Grid *grid)

Sets the map view's grid to grid.

See also grid().

void MapView::setLabeling(const ViewLabelProperties &viewLabelProperties)

Sets the current labeling settings.

See also labeling().

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(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().

TaskWatcher MapView::setViewpointAnimated(const Viewpoint &viewpoint, float durationSeconds, 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.

TaskWatcher MapView::setViewpointCenter(const Point &center)

Set the viewpoint asynchronously with a center point.

  • center - The center point to set.

Returns a TaskWatcher for the asynchronous task.

TaskWatcher MapView::setViewpointCenter(const 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.

TaskWatcher MapView::setViewpointGeometry(const Geometry &boundingGeometry)

Set the viewpoint asynchronously with a bounding geometry.

  • boundingGeometry - The bounding geometry to set.

Returns a TaskWatcher for the asynchronous task.

TaskWatcher MapView::setViewpointGeometry(const 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.

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.

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(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().

double MapView::unitsPerDIP() const

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

Polygon MapView::visibleArea() const

Gets the current visible area of the map view.

WrapAroundMode MapView::wrapAroundMode() const

Gets the current WrapAroundMode.

See also setWrapAroundMode().


Feedback on this topic?