QString dataPath = pathSampleData + "mpks" + QDir::separator() + "mpk_blank.mpk"; m_localMapService = EsriRuntimeQt::LocalMapService(dataPath); m_localMapService.setEnableDynamicLayers(true);
// Get the WorkspaceInfoSet from the LocalMapService... EsriRuntimeQt::WorkspaceInfoSet& workspaceInfoSet = m_localMapService.dynamicWorkspaces(); // create a workspace info via the static method according to data type m_workspaceId = QString("1"); EsriRuntimeQt::WorkspaceInfo workspaceInfo = EsriRuntimeQt::WorkspaceInfo::CreateSDEConnection(m_workspaceId, QString("INSTANCE=sde:sqlserver:bedrock4;DATABASE=nongdb;USER=map;PASSWORD=map")); workspaceInfo.setEditable(true); workspaceInfoSet.add(workspaceInfo); m_localMapService.setDynamicWorkspaces(workspaceInfoSet); // You are ready to start the map service m_localMapService.start();
void Sde_workspace_sample::onLocalServiceCreationSuccess(const QString& url, const QString& name) { // create the ArcGISDynamicMapServiceLayer using the LocalMapService's url m_dynamicLocalServiceLayer = EsriRuntimeQt::ArcGISDynamicMapServiceLayer(m_localMapService.urlMapService()); m_dynamicLocalServiceLayer.setName("MySDELayer"); m_map.addLayer(m_dynamicLocalServiceLayer); m_dynamicLocalServiceLayer.setVisible(true); EsriRuntimeQt::DynamicLayerInfoCollection& layerInfos = m_dynamicLocalServiceLayer.dynamicLayerInfos(); EsriRuntimeQt::DynamicLayerInfo& layerInfo = layerInfos[0]; // Create some symbology for the added layer EsriRuntimeQt::SimpleRenderer simpleRenderer(EsriRuntimeQt::SimpleFillSymbol(QColor("yellow"),EsriRuntimeQt::SimpleFillSymbolStyle::Solid, EsriRuntimeQt::SimpleLineSymbol(QColor("black"), 1, EsriRuntimeQt::SimpleLineSymbolStyle::Solid))); EsriRuntimeQt::DrawingInfo countriesDrawingInfo(simpleRenderer, 20); layerInfo.setDrawingInfo(countriesDrawingInfo); // set dynamic workspaces for our local map service EsriRuntimeQt::TableDataSource sdeDataSource; sdeDataSource.setWorkspaceId(m_workspaceId); // Here is where you identify the feature class you want to add sdeDataSource.setDataSourceName(QString("nongdb.map.CALIFORNIA")); // Set the layer's datasource EsriRuntimeQt::LayerDataSource layerDataSource; layerDataSource.setDataSource(sdeDataSource); layerInfo.setLayerSource(layerDataSource); m_dynamicLocalServiceLayer.refresh(); }
Hi,Thanks for your feedbacks. Depending on what you would like to achieve, there are a few samples from the ArcGIS Runtime SDK for Qt 10.2 that can help you get started:http://developers.arcgis.com/en/qt/sample-code/local_geodatabase_editing_sample.htmhttp://developers.arcgis.com/en/qt/sample-code/local_query_sample.htmRegards,
Les membres connectés peuvent publier, suivre les mises à jour, et plus encore. Nouveau ici ? Inscrivez-vous gratuitement.
Find useful guides, FAQs, and documents to help you navigate and make the most of Esri Community.