ScalebarController Class

Scalebar view."> ScalebarController Class | ArcGISQtToolkit 200.0
  • ScalebarController
  • class Esri::ArcGISRuntime::Toolkit::ScalebarController

    In MVC architecture, this is the controller for the corresponding Scalebar view. More...

    Header: #include <ScalebarController>
    Inherits: QObject

    Properties

    Public Functions

    ScalebarController(QObject *parent = nullptr)
    virtual ~ScalebarController()
    double calculateBestScalebarLength(double maxLength, Esri::ArcGISRuntime::LinearUnit unit)
    double calculateBestScalebarLength(double maxLength)
    double calculateDisplayWidth(double displayDistance, double maximumDistance, double availableWidth)
    double calculateDistance(double width)
    QString calculateDistanceInDisplayUnits(double distance, Esri::ArcGISRuntime::UnitSystem unitSystem)
    QObject *mapView() const
    void setMapView(QObject *mapView)
    void setUnitSystem(Esri::ArcGISRuntime::UnitSystem unitSystem)
    Esri::ArcGISRuntime::UnitSystem unitSystem()

    Signals

    Detailed Description

    This controller object handles the Scalebar calculations for a Scalebar's width and display units, based on a given mapview and owning scalebar's bounds.

    Property Documentation

    mapView : QObject*

    This property holds the MapView object which scalebar calculations are based on.

    Access functions:

    QObject *mapView() const
    void setMapView(QObject *mapView)

    Notifier signal:

    unitSystem : Esri::ArcGISRuntime::UnitSystem

    This property holds the current units system of this controller. Can be imperial or metric.

    Access functions:

    Esri::ArcGISRuntime::UnitSystem unitSystem()
    void setUnitSystem(Esri::ArcGISRuntime::UnitSystem unitSystem)

    Notifier signal:

    Member Function Documentation

    [invokable] ScalebarController::ScalebarController(QObject *parent = nullptr)

    Constructor

    • parent Parent owning QObject.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [virtual] ScalebarController::~ScalebarController()

    Destructor.

    double ScalebarController::calculateBestScalebarLength(double maxLength, Esri::ArcGISRuntime::LinearUnit unit)

    Given a maximum length maxLength and unit system unit, calculate the best length value to display, which will be equal to or less than maxLength, rounded appropriately.

    [invokable] double ScalebarController::calculateBestScalebarLength(double maxLength)

    Given a maximum length maxLength, calculate the appropriate length value to display, which will be equal to or less than maxLength, rounded appropriately.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] double ScalebarController::calculateDisplayWidth(double displayDistance, double maximumDistance, double availableWidth)

    Returns the width a scalebar should be, based on a fraction of availableWidth calculated by the ratio of displayDistance by maximumDistance.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] double ScalebarController::calculateDistance(double width)

    Given the width of a scalebar in screen coordinates, returns the distance the width represents by projecting that width onto the mapView and returning the result.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    [invokable] QString ScalebarController::calculateDistanceInDisplayUnits(double distance, Esri::ArcGISRuntime::UnitSystem unitSystem)

    Returns the distance text to display in a scaleBar, given a distance and unitSystem.

    If unitSystem is metric, distance is assumed to be in meters, if unitSystem is imperial, distance is assumed to be in feet.

    Will appropriately return miles/feet or kilometers/meters based on size of distance given.

    Note: This function can be invoked via the meta-object system and from QML. See Q_INVOKABLE.

    QObject *ScalebarController::mapView() const

    Returns the MapView as a QObject.

    Note: Getter function for property mapView.

    See also setMapView().

    [signal] void ScalebarController::mapViewChanged()

    Emitted when the geoView changes.

    Note: Notifier signal for property mapView.

    void ScalebarController::setMapView(QObject *mapView)

    Set the MapView object this Controller uses.

    Internally this is cast to a MapView using qobject_cast.

    • mapView MapView Object.

    Note: Setter function for property mapView.

    See also mapView().

    void ScalebarController::setUnitSystem(Esri::ArcGISRuntime::UnitSystem unitSystem)

    Sets the active UnitSystem to unitSystem. This affects width and distance calculations.

    Note: Setter function for property unitSystem.

    See also unitSystem().

    Esri::ArcGISRuntime::UnitSystem ScalebarController::unitSystem()

    Returns thee UnitSystem this controller uses for calculations.

    Note: Getter function for property unitSystem.

    See also setUnitSystem().

    [signal] void ScalebarController::unitSystemChanged()

    Emitted when the unitsSystem changes.

    Note: Notifier signal for property unitSystem.

    [signal] void ScalebarController::viewpointChanged()

    Emitted when the viewpoint changes.

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