Example for TimeSlider

291
2
Jump to solution
02-26-2021 04:29 AM
nikschm00
New Contributor II

I currently try to implement the TimeSlider Widget with QtQuick. For a better understanding of this TimeAware things i want to know if there is any example for the TimeSlider from Toolkit. I look for something like the first animation/gif here:

https://community.esri.com/t5/arcgis-runtime-sdks-blog/building-a-better-toolkit/ba-p/888826 

I am satisfied too, if there is any other example to understand the TimeAware Feature a bit better?

Best regards

Tags (2)
0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

You can get TimeSlider up and running by doing the following:

 

- Create a new Qt Quick C++ project from our template

- include the toolkit PRI in your pro file - 

include(/path/to/arcgis-runtime-qt-toolkit/uitools/toolkitcpp.pri)

-  register your components in the main.cpp - 

#include <Esri/ArcGISRuntime/Toolkit/register.h>
Esri::ArcGISRuntime::Toolkit::registerComponents(engine);

- Add a timeslider to your qml:

    MapView {
        id: view
        anchors.fill: parent
        // set focus to enable keyboard navigation
        focus: true

        TimeSlider {
            anchors {
                left: parent.left
                right: parent.right
                bottom: parent.bottom
            }

            geoView: view
        }
    }

- Add a time enabled layer, such as this map image layer

ToolkitTestCppQuick::ToolkitTestCppQuick(QObject* parent /* = nullptr */):
    QObject(parent),
    m_map(new Map(Basemap::streets(this), this))
{
    auto imgLyr = new ArcGISMapImageLayer(QUrl("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Hurricanes/MapServer"), this);
    m_map->operationalLayers()->append(imgLyr);
}

- The time slider will automatically get the time extent, and you can manipulate/filter the time:

time.gif

View solution in original post

2 Replies
LucasDanzinger
Esri Frequent Contributor

You can get TimeSlider up and running by doing the following:

 

- Create a new Qt Quick C++ project from our template

- include the toolkit PRI in your pro file - 

include(/path/to/arcgis-runtime-qt-toolkit/uitools/toolkitcpp.pri)

-  register your components in the main.cpp - 

#include <Esri/ArcGISRuntime/Toolkit/register.h>
Esri::ArcGISRuntime::Toolkit::registerComponents(engine);

- Add a timeslider to your qml:

    MapView {
        id: view
        anchors.fill: parent
        // set focus to enable keyboard navigation
        focus: true

        TimeSlider {
            anchors {
                left: parent.left
                right: parent.right
                bottom: parent.bottom
            }

            geoView: view
        }
    }

- Add a time enabled layer, such as this map image layer

ToolkitTestCppQuick::ToolkitTestCppQuick(QObject* parent /* = nullptr */):
    QObject(parent),
    m_map(new Map(Basemap::streets(this), this))
{
    auto imgLyr = new ArcGISMapImageLayer(QUrl("https://sampleserver6.arcgisonline.com/arcgis/rest/services/Hurricanes/MapServer"), this);
    m_map->operationalLayers()->append(imgLyr);
}

- The time slider will automatically get the time extent, and you can manipulate/filter the time:

time.gif

View solution in original post

nikschm00
New Contributor II

Perfect, thanks

0 Kudos