I've been waiting years for this capability, so when it appeared in Maps 200.7, I thought I should try it out, but I'm not having much success.
The setup/environment is:
- ArcGIS Maps for Qt 200.7
- Qt 6.8.3
- VS: 2022
As the intended use is with an application that uses offline maps, I changed the DisplayMap sample (arcgis-maps-sdk-samples-qt-200.7.0.4560\CppWidgetsSamples\Maps\DisplayMap) to use an offline map and show a QImage using an ImageFrame and ImageOverlay.
Other than adding the additional include files needed, the code is unchanged except the DisplayMap constructor, which now looks like this:
DisplayMap::DisplayMap(QWidget* parent) :
QWidget(parent)
{
const QString tileBasemapFile("C:/MapData/Map.tpk");
ArcGISTiledLayer* tileBasemapLayer = new ArcGISTiledLayer(new TileCache(tileBasemapFile, this), this);
tileBasemapLayer->setName(tileBasemapFile);
tileBasemapLayer->load();
// Create a map using the offline basemap
m_map = new Map(this);
m_map->basemap()->baseLayers()->append(tileBasemapLayer);
// Create a map view, and pass in the map
m_mapView = new MapGraphicsView(m_map, this);
// Create image
QImage image(500, 500, QImage::Format_RGB32);
image.fill(qRgb(255, 0, 0));
// Define the envelope to be used for the image on the map
const Envelope env(-50.0, -50.0, 50.0, 50.0);
std::unique_ptr<ImageFrame> imageFrame = std::make_unique<ImageFrame>(image, env);
ImageOverlay* imageOverlay = new ImageOverlay(imageFrame.get(), this);
m_mapView->imageOverlays()->append(imageOverlay);
// Set up the UI
QVBoxLayout *vBoxLayout = new QVBoxLayout();
vBoxLayout->addWidget(m_mapView);
setLayout(vBoxLayout);
}
The use of std::unique_ptr<ImageFrame> was taken from the 3D scene sample code that uses ImageFrame/ImageOverlay.
The application runs, displays the basemap and allows panning/zooming as would be expected, but the ImageFrame (i.e. a big solid red area) is not shown. The application shows as "Licensed for Developer Use Only", but applying a "lite" license code makes no difference to the application's appearance/behaviour other than the message being removed.
I've checked that the ImageOverlay reports that it is visible and the opacity is 1, also after being set as the frame for the ImageOverlay, the ImageFrame retrieved from the ImageOverlay reports the correct extent.
Any suggestions as to what I'm missing/doing wrong?