Hi James ,
We tried this pseudo code but still we are not able to load two mmpk data for single screen.Please go through this code if i am doing any mistak
void CTacticalViewClass::LoadingOfmmpkfile(const QUrl &file,const QUrl &file2)
{
QString dataPath = file.toString();
QString dataPath2 = file2.toString();
m_mobileMapPackage = new MobileMapPackage(dataPath, this);
m_mobileMapPackage1 = new MobileMapPackage(dataPath2, this);
connect(m_mobileMapPackage, &MobileMapPackage::doneLoading, this, [this](Error error)
{
if (error.isEmpty())
{
m_mapView->setMap(m_mobileMapPackage->maps().at(0));
qDebug()<<"m_mapView->map()->operationalLayers()"<<m_mapView->map()->operationalLayers()->size()<<m_mobileMapPackage->maps().at(0)->operationalLayers()->size();
m_mobileMapPackage1->load();
}
});
/*
* tried but not working completely
connect(m_mobileMapPackage1, &MobileMapPackage::doneLoading, this, [this](Error) {
auto* map2 = m_mobileMapPackage1->maps().at(0);
qDebug()<<"Operational layer count ------>>"<<m_mobileMapPackage1->maps().at(0)->operationalLayers()->size()<<"map2"<<map2->operationalLayers()->size();
QList<Layer*> layersFromMap2;
LayerListModel* layerFromMap2;
for (int i = 0;i<m_mobileMapPackage1->maps().at(0)->operationalLayers()->size();i++)
{
qDebug()<<"i - "<<i;
layersFromMap2.append(m_mobileMapPackage1->maps().at(0)->operationalLayers()->at(i));
layerFromMap2 = map2->operationalLayers();
layerFromMap2->setParent(this); // re-parent the layers
}
qDebug()<<"layersFromMap2"<<layersFromMap2.size()<<"layerFromMap2 "<<layerFromMap2->size();
// delete the map
delete map2;
// // add all the layers to the mapView's map
for (int i = 0;i<layersFromMap2.size();i++)
{
m_mapView->map()->operationalLayers()->append(layersFromMap2.at(i));
qDebug()<<"operationalLayers "<<m_mapView->map()->operationalLayers()->size();
}
auto* operationalLayers = m_mapView->map()->operationalLayers();
for (auto* layer : layersFromMap2)
operationalLayers->append(layer);
qDebug()<<"total layers "<<operationalLayers->size();
});