Select to view content in your preferred language

Qt C++ Widgets Samples

2934
13
Jump to solution
07-27-2022 01:13 AM
RitvikRanadive
Emerging Contributor

Hi,

Are there any Qt C++ Widgets samples for -

1. Generating offline map for preplanned area and storing it locally

2. Generating offline map on-demand and storing it locally

3. Loading a stored offline map

4. Get GPS coordinates from user inputs like mouse click 

 

Tags (3)
0 Kudos
1 Solution

Accepted Solutions
LucasDanzinger
Esri Frequent Contributor

The directory with the mmap and various other files is an "unpacked" mobile map package. The constructor to MobileMapPackage takes either the path to a file with .mmpk extension or to the directory of an unpacked mobile map package. https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-mobilemappackage.html#MobileMa... 

View solution in original post

13 Replies
LucasDanzinger
Esri Frequent Contributor

We don't have specific Widgets samples for these, but we have C++ Qt Quick samples. The actual code to perform these is nearly identical (the only difference between Widgets and Qt Quick is MapQuickView and MapGraphicsView class). 

Offline map on demand - https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_CppSamples/Maps/Gener... 

 

Preplanned offline map - https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_CppSamples/Maps/Downl... 

 

Load mobile map package - https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_CppSamples/Maps/OpenM... 

 

Get coordinates from mouse click - connect to the mouse clicked signal (https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-mapgraphicsview.html#mouseClic...) and then call screenToLocation to convert the screen point to map point https://developers.arcgis.com/qt/cpp/api-reference/esri-arcgisruntime-mapview.html#screenToLocation 

0 Kudos
RitvikRanadive
Emerging Contributor

Hi @LucasDanzinger thanks for the response, I was looking for Widgets samples as I didn't want to involve QMLs. Is this actually even possible?

0 Kudos
LucasDanzinger
Esri Frequent Contributor

Yes, it's definitely possible. The actual C++ back end code will be nearly identical. You can disregard the QML portions of the samples, as those are just the UI - you'd use Qt Widgets for your UI instead.

0 Kudos
RitvikRanadive
Emerging Contributor

Does the GenerateOfflineMap example actually create the .mmpk which the OpenMobileMap_MapPackage example requires..?

Since the GenerateOfflineMap example was generating the files in tmp, I updated the path to a different path on my drive. When I check this path after running the example, there is no .mmpk file in this path. There is a .mmap file in the one of the subdirectories but this does not work with the OpenMobileMap_MapPackage example.

What am I doing wrong here?

 

0 Kudos
LucasDanzinger
Esri Frequent Contributor

The data is available for download on ArcGIS Online. Details are in the sample readme - https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_CppSamples/Maps/OpenM... 

0 Kudos
RitvikRanadive
Emerging Contributor

Hi, the details from the sample readme file are only for the Yellowstone map that is in the example. How can I generate this .mmpk file for any other map that I have created on my account in Map Viewer?

 

0 Kudos
RitvikRanadive
Emerging Contributor

Hi @LucasDanzinger

Please correct me if I am wrong but I need to have ArcGIS Pro in order to create an .mmpk file for a map that I have created?

0 Kudos
LucasDanzinger
Esri Frequent Contributor

You can create a MMPK in Pro.

 

You can also generate one on-demand from a web map using our OfflineMapTask. This sample demonstrates how to do this https://github.com/Esri/arcgis-runtime-samples-qt/tree/main/ArcGISRuntimeSDKQt_CppSamples/Maps/Gener... 

0 Kudos
RitvikRanadive
Emerging Contributor

yeah but the on demand web map using the OfflineMapTask gets deleted after the program exits, I would like to store the maps in a location on my hard drive from where I can load them completely offline at a later point.

0 Kudos