示例#1
0
        private void comboBoxLayer_SelectedIndexChanged(object sender, EventArgs e)
        {
            string selectedLayerName = this.comboBoxLayer.SelectedItem.ToString();

            if (!selectedLayerName.Equals("none"))
            {
                this.labelChooseLayer.Visible = false;
                string requestAddressCapabiliteies = "";
                ReadOnlyCollection <Layer> layers  = MapView.Active.Map.Layers;
                List <Layer> activeLayers          = (layers.Where((layer) => { return(layer.IsVisible); })).ToList();
                foreach (Layer activeLayer in activeLayers)
                {
                    Task taskConnectionActiveLayer = QueuedTask.Run(() =>
                    {
                        CIMDataConnection connection = activeLayer.GetDataConnection();
                        string typeConnections       = connection.GetType().Name;
                        if (typeConnections.Equals("CIMWMSServiceConnection") || typeConnections.Equals("CIMWMTSServiceConnection"))
                        {
                            XmlDocument xmlLayer = new XmlDocument();
                            xmlLayer.LoadXml(connection.ToXml());
                            string layerName = xmlLayer.SelectSingleNode(typeConnections + "/LayerName").InnerText;
                            if (layerName.Equals(selectedLayerName))
                            {
                                selestedLayerInfo.setLayerInfo(layerName, typeConnections, xmlLayer);
                                requestAddressCapabiliteies = selestedLayerInfo.getRequestAddressCapabiliteies();
                            }
                        }
                    });
                    taskConnectionActiveLayer.Wait();
                    if (!requestAddressCapabiliteies.Equals(""))
                    {
                        if (selestedLayerInfo.serverType.Equals("WMTS"))
                        {
                            this.comboBoxResolution.Text     = "90.71428571429";
                            this.comboBoxResolution.Enabled  = false;
                            this.labelOutputImageSPX.Visible = false;
                            this.labelOutputIS.Visible       = false;
                        }
                        else
                        {
                            this.comboBoxResolution.Text     = "96";
                            this.comboBoxResolution.Enabled  = true;
                            this.labelOutputImageSPX.Visible = true;
                            this.labelOutputIS.Visible       = true;
                        }
                        addCRS(requestAddressCapabiliteies);

                        if (correctCoordinateTopX && correctCoordinateTopX && correctCoordinateBottomX && correctCoordinateBottomY && correctScale)
                        {
                            buttonNext.Enabled = true;
                        }
                        else
                        {
                            buttonNext.Enabled = false;
                        }
                        break;
                    }
                }
            }
        }
 private static string GetServiceUrl(CIMDataConnection dataConnection)
 {
     if (dataConnection is CIMStandardDataConnection)
     {
         // Feature service
         string connectStr = (dataConnection as CIMStandardDataConnection)?.WorkspaceConnectionString; // e.g.  "URL=http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0".
         if (connectStr?.Length > 4)
         {
             return(connectStr.Substring(4)); // e.g. "http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0".
         }
         return(null);
     }
     if (dataConnection is CIMAGSServiceConnection)
     {
         // Imager service
         if ((dataConnection as CIMAGSServiceConnection)?.ObjectType == "ImageServer")
         {
             string url = (dataConnection as CIMAGSServiceConnection)?.URL; // e.g. "http://services.arcgisonline.com/arcgis/services/World_Imagery/MapServer".
             if (url.Contains("services"))
             {
                 string[] splitStr = url.Split(new string[] { "services" }, StringSplitOptions.None);
                 if (splitStr?.Length >= 2 && splitStr.FirstOrDefault() != null)
                 {
                     return(splitStr[0] + "rest/" + "services" + splitStr[1]); // e.g. "http://services.arcgisonline.com/arcgis/rest/services/World_Imagery/MapServer".
                 }
             }
             return(null);
         }
         // Other services
         return((dataConnection as CIMAGSServiceConnection).URL);
     }
     return(null);
 }
示例#3
0
 private string BuildConnectionClassName(CIMDataConnection connection)
 {
     if (connection == null)
     {
         return("No Connection");
     }
     return(AddSpacesToClassName(connection.GetType().Name.Replace("CIM", "").Replace("DataConnection", "").Replace("ServiceConnection", " Service")));
 }
示例#4
0
 private void comboBoxProjectionEPSGcode_SelectedIndexChanged(object sender, EventArgs e)
 {
     formData.epsg = this.comboBoxProjectionEPSGcode.Text;
     if (!comboBoxExtendFromLayer.Text.Equals("none"))
     {
         string selectedLayerName = this.comboBoxExtendFromLayer.Text;
         if (!selectedLayerName.Equals("none"))
         {
             bool coordinateHasBeenSet         = false;
             ReadOnlyCollection <Layer> layers = MapView.Active.Map.Layers;
             List <Layer> activeLayers         = (layers.Where((layer) => { return(layer.IsVisible); })).ToList();
             foreach (Layer activeLayer in activeLayers)
             {
                 if (activeLayer.Name.Equals(selectedLayerName))
                 {
                     coordinateHasBeenSet = true;
                     break;
                 }
             }
             if (!coordinateHasBeenSet)
             {
                 string crs = this.comboBoxProjectionEPSGcode.Text;
                 if (!crs.Equals(""))
                 {
                     foreach (Layer activeLayer in activeLayers)
                     {
                         String      layerName   = "";
                         XmlDocument xmlDocument = new XmlDocument();
                         Task        t           = QueuedTask.Run(() =>
                         {
                             CIMDataConnection cimDataConnection = activeLayer.GetDataConnection();
                             xmlDocument.LoadXml(cimDataConnection.ToXml());
                             try
                             {
                                 layerName = xmlDocument.SelectSingleNode("CIMWMSServiceConnection/LayerName").InnerText;
                             }
                             catch { }
                         });
                         t.Wait();
                         if (layerName.Equals(selectedLayerName))
                         {
                             setCoordinateFromLayerXml(activeLayer);
                             coordinateHasBeenSet = true;
                             break;
                         }
                     }
                 }
             }
         }
     }
     addTileSize();
 }
示例#5
0
        private void addActiveLayer()
        {
            this.comboBoxLayer.Text           = "none";
            this.comboBoxExtendFromLayer.Text = "none";
            this.comboBoxExtendFromLayer.Items.Insert(comboBoxExtendFromLayer.Items.Count, "none");
            ReadOnlyCollection <Layer> layers = MapView.Active.Map.Layers;
            List <Layer> activeLayers         = (layers.Where((layer) => { return(layer.IsVisible); })).ToList();

            foreach (Layer activeLayer in activeLayers)
            {
                Task taskConnectionActiveLayer = QueuedTask.Run(() =>
                {
                    CIMDataConnection connection = activeLayer.GetDataConnection();
                    string typeConnections       = connection.GetType().Name;
                    switch (typeConnections)
                    {
                    case "CIMWMSServiceConnection":     //WMS
                        XmlDocument xmlActiveLayerWMS = new XmlDocument();
                        xmlActiveLayerWMS.LoadXml(connection.ToXml());
                        string activeLayerWMSName = xmlActiveLayerWMS.SelectSingleNode("CIMWMSServiceConnection/LayerName").InnerText;
                        this.comboBoxLayer.Items.Insert(comboBoxLayer.Items.Count, activeLayerWMSName);
                        this.comboBoxExtendFromLayer.Items.Insert(comboBoxExtendFromLayer.Items.Count, activeLayerWMSName);
                        break;

                    case "CIMWMTSServiceConnection":    //WMTS
                        XmlDocument xmlActiveLayerWMTS = new XmlDocument();
                        xmlActiveLayerWMTS.LoadXml(connection.ToXml());
                        string activeLayerWMTSName = xmlActiveLayerWMTS.SelectSingleNode("CIMWMTSServiceConnection/LayerName").InnerText;
                        this.comboBoxLayer.Items.Insert(comboBoxLayer.Items.Count, activeLayerWMTSName);

                        break;

                    case "CIMStandardDataConnection":     //Polygon
                        XmlDocument xmlActiveLayerPolygon = new XmlDocument();
                        xmlActiveLayerPolygon.LoadXml(connection.ToXml());
                        string workspaceFactory = xmlActiveLayerPolygon.SelectSingleNode("CIMStandardDataConnection/WorkspaceFactory").InnerText;
                        if (workspaceFactory.Equals("Shapefile"))
                        {
                            this.comboBoxExtendFromLayer.Items.Insert(comboBoxExtendFromLayer.Items.Count, activeLayer.Name);
                        }
                        break;

                    default:
                        break;
                    }
                });
                taskConnectionActiveLayer.Wait();
            }
        }
 public static string GetDataSource(CIMDataConnection dataConnection)
 {
     // For more information about CIMDataConnect class and its derived classes, please refer to http://pro.arcgis.com/en/pro-app/sdk/api-reference/#topic943.html.
     if (dataConnection != null)
     {
         //  DataConnection of Shapefile, Raster, TPK and Feature Layer.
         if (dataConnection is CIMStandardDataConnection)
         {
             WorkspaceFactory factory = (dataConnection as CIMStandardDataConnection).WorkspaceFactory;
             if (factory == WorkspaceFactory.FeatureService)
             {
                 // Get url of Feature Layer.
                 return(GetServiceUrl(dataConnection as CIMStandardDataConnection));
             }
             if (factory == WorkspaceFactory.Shapefile || factory == WorkspaceFactory.Raster)
             {
                 // Get path name of Shapefile or Rater.
                 return(GetStandardDataPathName(dataConnection as CIMStandardDataConnection));
             }
         }
         // DataConnection of Kml and Kmz.
         if (dataConnection is CIMKMLDataConnection)
         {
             // Get path name of Kml and Kmz.
             return(GetKMLDataPathName(dataConnection as CIMKMLDataConnection));
         }
         // DataConnection of SPK and SLPK.
         if (dataConnection is CIMSceneDataConnection)
         {
             // Get path name of SPK and SLPK.
             return(GetSceneDataPathName(dataConnection as CIMSceneDataConnection));
         }
         // DataConnection of Imagary Layer, Map Image Layer, Tile Layer , Scene Layer.
         if (dataConnection is CIMAGSServiceConnection)
         {
             // Get url of Imagary Layer, Map Image Layer, Tile Layer , Scene Layer.
             return(GetServiceUrl(dataConnection as CIMAGSServiceConnection));
         }
         // DataConnection of WMS
         if (dataConnection is CIMWMSServiceConnection)
         {
             // Get url of WMS.
             return(GetWmsUrl(dataConnection as CIMWMSServiceConnection));
         }
     }
     return(null);
 }
        private Task ChangeUSHighwaysLayerDataConnectionAsync(FeatureLayer featureLayer, string catalogPath)
        {
            return(QueuedTask.Run(() => {
                CIMDataConnection currentDataConnection = featureLayer.GetDataConnection();

                string connection = System.IO.Path.GetDirectoryName(catalogPath);
                string suffix = System.IO.Path.GetExtension(connection).ToLower();

                var workspaceConnectionString = string.Empty;
                WorkspaceFactory wf = WorkspaceFactory.FileGDB;
                if (suffix == ".sde")
                {
                    wf = WorkspaceFactory.SDE;
                    var dbGdbConnection = new DatabaseConnectionFile(new Uri(connection, UriKind.Absolute));
                    workspaceConnectionString = new Geodatabase(dbGdbConnection).GetConnectionString();
                }
                else
                {
                    var dbGdbConnectionFile = new FileGeodatabaseConnectionPath(new Uri(connection, UriKind.Absolute));
                    workspaceConnectionString = new Geodatabase(dbGdbConnectionFile).GetConnectionString();
                }

                string dataset = System.IO.Path.GetFileName(catalogPath);
                // provide a replace data connection method
                CIMStandardDataConnection updatedDataConnection = new CIMStandardDataConnection()
                {
                    WorkspaceConnectionString = workspaceConnectionString,
                    WorkspaceFactory = wf,
                    Dataset = dataset,
                    DatasetType = esriDatasetType.esriDTFeatureClass
                };

                featureLayer.SetDataConnection(updatedDataConnection);

                //For a RDBMS, it might look like this:
                //string connection = "C:\\Work\\temp.sde";
                //Geodatabase sde = new Geodatabase(connection);

                //// provide a replace data connection method
                //CIMStandardDataConnection updatedDataConnection = new CIMStandardDataConnection();
                //updatedDataConnection.WorkspaceConnectionString = sde.GetConnectionString();
                //updatedDataConnection.WorkspaceFactory = WorkspaceFactory.SDE;
                //updatedDataConnection.Dataset = "vtest.usa.states";
                //updatedDataConnection.DatasetType = esriDatasetType.esriDTFeatureClass;



                //// Alternatively, use Layer.FindAndReplaceWorkspacePath()
                ////Note: this will not allow changing the dataset name or workspace type
                ////
                ////string connection = "C:\\Work\\temp.sde";
                ////Geodatabase sde = new Geodatabase(connection);
                ////featureLayer.FindAndReplaceWorkspacePath(((CIMStandardDataConnection)currentDataConnection).WorkspaceConnectionString,
                ////                        sde.GetConnectionString(), true);


                //////////////////////////////////////////////
                ////Please Read
                ////
                //ok, so at this point we have a couple of bugs at 1.1 AND 1.2.....
                //
                //#1: if you switched to a Datasource that invalidates the Renderer, the Renderer does
                //not get invalidated in the UI
                //(eg You had a UniqueValueRenderer on a Field called "CATEGORY", the new datasource
                //does NOT have that field and so the renderer is invalid).
                //
                //#2: By default, Layers are added with a permanent cache. The cache is NOT automatically
                //invalidated so data (eg in the Attribute table, on the screen for draws) does NOT get
                //Refreshed so you have to invalidate the cache manually...

                //So, Bug #1 - we arbitrarily switch the Renderer to a simple renderer as a work around for that...
                featureLayer.SetRenderer(featureLayer.CreateRenderer(new SimpleRendererDefinition()));

                //Bug #2, we manually invalidate the cache
                featureLayer.ClearDisplayCache();
            }));
        }
        // Do a Query request on the selected point to get the list of overlapping scenes
        private Task ExtractInfoAsync(string X, string Y)
        {
            return(Application.Current.Dispatcher.Invoke(async() =>
            {
                try
                {
                    if (Scenes != null)
                    {
                        Scenes.Clear();
                        _selection.Clear();
                    }
                    // Get the image service URL from the current layer
                    SelectedLayer = MapView.Active.GetSelectedLayers().FirstOrDefault();
                    if (SelectedLayer is ImageServiceLayer)
                    {
                        string ImageServiceURL = null;
                        ImageServiceLayer imageServiceLayer = (ImageServiceLayer)SelectedLayer;
                        await QueuedTask.Run(() =>
                        {
                            CIMDataConnection DataConnection = imageServiceLayer.GetDataConnection();
                            string DataConnectionXMLString = DataConnection.ToXml();
                            var ParsedDataConnectionString = XElement.Parse(DataConnectionXMLString);
                            var URLNode = ParsedDataConnectionString.Elements("URL");
                            foreach (XElement nodeValue in URLNode)
                            {
                                ImageServiceURL = nodeValue.ToString();
                            }
                        });

                        // Send a request to the REST end point to get information
                        var point = "{x:" + X + ",y:" + Y + "}";
                        string[] URLSplit = Regex.Split(ImageServiceURL, "arcgis/");
                        //string ServiceURL = "https://landsat2.arcgis.com/";
                        string ServiceURL = URLSplit[0].Replace("<URL>", string.Empty);
                        string url = ServiceURL + "query";
                        var ubldr = new UriBuilder(ServiceURL);
                        string path = "arcgis/rest/" + URLSplit[1].Replace("</URL>", string.Empty) + "/query";
                        ubldr.Path = path;
                        //ubldr.Path = $"arcgis/rest/services/Landsat/MS/ImageServer/query";

                        // Allows to give parameters as dictionary key,pair values rather than manually constructing a json
                        var query = HttpUtility.ParseQueryString(ubldr.Query);
                        query["f"] = "json";
                        query["geometry"] = point;
                        query["geometryType"] = "esriGeometryPoint";
                        query["spatialRel"] = "esriSpatialRelIntersects";
                        query["outFields"] = "*";
                        query["pixelSize"] = "30";
                        query["returnGeometry"] = "false";
                        ubldr.Query = query.ToString();
                        var httpClient = new EsriHttpClient();
                        var response = httpClient?.Get(ubldr.Uri.ToString());
                        var respstr = await response?.Content?.ReadAsStringAsync();
                        var SceneList = JObject.Parse(respstr);
                        var SceneListInfo = (JArray)SceneList["features"];
                        foreach (JObject value in SceneListInfo)
                        {
                            foreach (var property in value.Properties())
                            {
                                if (property.Name == "attributes")
                                {
                                    {
                                        // Add obtained json response as a dictionary to a list of dictionaries
                                        var attribute = property.Value.ToString();
                                        var attributeValue = JObject.Parse(attribute);
                                        var category = Int32.Parse(attributeValue["Category"].ToString());
                                        var attributeValueDict = attributeValue.ToObject <Dictionary <string, string> >();
                                        if (category == 1)
                                        {
                                            _selection.Add(attributeValueDict);
                                        }
                                    }
                                }
                            }
                        }

                        foreach (var value in _selection)
                        {
                            // Extract and convert epoch time to dd/MM/yyyy format
                            double UnixTime = Convert.ToDouble(value["AcquisitionDate"].ToString());
                            var epoch = new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc);
                            DateTime date = epoch.AddMilliseconds(UnixTime);
                            var AcqDate = date.ToString("dd / MM / yyyy");
                            var objID = value["OBJECTID"].ToString();
                            var ClCover = value["CloudCover"].ToString();
                            var SceneName = value["Name"].ToString();
                            Scenes.Add(new Scene {
                                AcqDate = AcqDate, Name = SceneName, CloudCover = ClCover, ObjectID = objID
                            });
                        }
                        // Add recieved information to an Observable Collection and notfy UI
                        NotifyPropertyChanged(() => Scenes);
                    }
                }
                catch (Exception ex)
                {
                    System.Diagnostics.Trace.WriteLine(ex.Message);
                }
            }));
        }
示例#9
0
 private void AddLayerToEarth(LayerEventsArgs args)
 {
     try
     {
         // Get list of added layer.
         List <Layer> layerList = args.Layers as List <Layer>;
         if (layerList?.Count != 0 && !IsCreateNewGroupLayer(layerList))
         {
             foreach (var layer in layerList)
             {
                 QueuedTask.Run(async() =>
                 {
                     // GetDataConnection method must be called within the lambda passed to QueuedTask.Run.
                     CIMDataConnection dataConnection = layer.GetDataConnection();
                     // Get layer url.
                     string url = ToolHelper.GetDataSource(dataConnection);
                     if (!string.IsNullOrWhiteSpace(url))
                     {
                         JObject addLayerJson = new JObject
                         {
                             ["URI"] = url
                         };
                         if (dataConnection is CIMWMSServiceConnection)
                         {
                             // Specify layer type for wms service. API is limited to automatically recognized wms service.
                             addLayerJson["type"] = "WMS";
                         }
                         if (layer.MapLayerType == MapLayerType.Operational)
                         {
                             addLayerJson["target"] = "operationalLayers";
                         }
                         if (layer.MapLayerType == MapLayerType.BasemapBackground)
                         {
                             addLayerJson["target"] = "baseMaps";
                         }
                         string currentJson   = addLayerJson.ToString();
                         string[] nameAndType = new string[3]
                         {
                             layer.Name,
                             layer.MapLayerType.ToString(),
                             null
                         };
                         // Add layer to ArcGIS Earth.
                         // Return layer id when use adding layer, whether it's succeed or failed.
                         string id = await AutomationAPIHelper.AddLayer(currentJson);
                         if (!ToolHelper.IdInfoDictionary.Keys.Contains(id))
                         {
                             // Use IdInfoDictionary to save layer id and layer information.
                             ToolHelper.IdInfoDictionary.Add(id, nameAndType);
                         }
                     }
                     else
                     {
                         ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to add layer to ArcGIS Earth" + " : " + layer.Name);
                     }
                 });
             }
         }
     }
     catch
     {
         ArcGIS.Desktop.Framework.Dialogs.MessageBox.Show("Failed to add layer to ArcGIS Earth.");
     }
 }
示例#10
0
        private void comboBoxExtendFromLayer_SelectedIndexChanged(object sender, EventArgs e)
        {
            string selectedLayerName = this.comboBoxExtendFromLayer.Text;

            if (!selectedLayerName.Equals("none"))
            {
                bool coordinateHasBeenSet         = false;
                ReadOnlyCollection <Layer> layers = MapView.Active.Map.Layers;
                List <Layer> activeLayers         = (layers.Where((layer) => { return(layer.IsVisible); })).ToList();
                foreach (Layer activeLayer in activeLayers)
                {
                    if (activeLayer.Name.Equals(selectedLayerName))
                    {
                        this.labelChooseLayer.Visible = false;
                        Envelope envelope = null;
                        Task     task     = QueuedTask.Run(() =>
                        {
                            envelope = activeLayer.QueryExtent();
                        });
                        task.Wait();
                        this.textBoxCoTopX.Text    = envelope.XMin.ToString();
                        formData.coordinateTopX    = envelope.XMin;
                        this.textBoxCoTopY.Text    = envelope.YMax.ToString();
                        formData.coordinateTopY    = envelope.YMax;
                        this.textBoxCoBottomX.Text = envelope.XMax.ToString();
                        formData.coordinateBottomX = envelope.XMax;
                        this.textBoxCoBottomY.Text = envelope.YMin.ToString();
                        formData.coordinateBottomY = envelope.YMin;
                        coordinateHasBeenSet       = true;
                        break;
                    }
                }
                if (!coordinateHasBeenSet)
                {
                    string crs = this.comboBoxProjectionEPSGcode.Text;
                    if (!crs.Equals(""))
                    {
                        foreach (Layer activeLayer in activeLayers)
                        {
                            String      layerName   = "";
                            XmlDocument xmlDocument = new XmlDocument();
                            Task        t           = QueuedTask.Run(() =>
                            {
                                CIMDataConnection cimDataConnection = activeLayer.GetDataConnection();
                                xmlDocument.LoadXml(cimDataConnection.ToXml());
                                try
                                {
                                    layerName = xmlDocument.SelectSingleNode("CIMWMSServiceConnection/LayerName").InnerText;
                                }
                                catch { }
                            });
                            t.Wait();
                            if (layerName.Equals(selectedLayerName))
                            {
                                setCoordinateFromLayerXml(activeLayer);
                                coordinateHasBeenSet = true;
                                break;
                            }
                        }
                    }
                    else
                    {
                        this.comboBoxExtendFromLayer.Text = "none";
                        this.labelChooseLayer.Visible     = true;
                    }
                }
            }
            else
            {
                this.labelChooseLayer.Visible = false;
                setCurrentView();
            }
        }
示例#11
0
        /*
         * Useful properties on sub classes of CIMDataConnection (an abstract base class with no useful members)
         * Those marked with a * have these standard properties:
         *  string CustomWorkspaceFactoryCLSID,
         *  WorkspaceFactory WorkspaceFactory, string WorkspaceConnectionString,
         *  esriDatasetType DatasetType, string Dataset
         *
         * ArcGIS.Core.CIM.CIMFeatureDatasetDataConnection - * + string FeatureDataset
         * ArcGIS.Core.CIM.CIMGADataConnection - CIMDataConnection[] DataConnections
         * ArcGIS.Core.CIM.CIMInMemoryDatasetDataConnection - N/A
         * ArcGIS.Core.CIM.CIMInMemoryWorkspaceDataConnection - N/A
         * ArcGIS.Core.CIM.CIMKMLDataConnection - string KMLURI
         * ArcGIS.Core.CIM.CIMKnowledgeGraphDataConnection - * + string DefinitionQuery
         * ArcGIS.Core.CIM.CIMKnowledgeGraphTableDataConnection - * + string DefinitionQuery, string ExclusionSetURI, string InclusionSetURI
         * ArcGIS.Core.CIM.CIMNetCDFRasterDataConnection - * + lots of other special properties
         * ArcGIS.Core.CIM.CIMNetCDFStandardDataConnection - * + lots of other special properties
         * ArcGIS.Core.CIM.CIMNITFDataConnection - string URI
         * ArcGIS.Core.CIM.CIMRasterBandDataConnection - * + string RasterBandName
         * ArcGIS.Core.CIM.CIMRelQueryTableDataConnection - CIMDataConnection SourceTable, DestinationTable, string PrimaryKey, ForeignKey and others
         * ArcGIS.Core.CIM.CIMRouteEventDataConnection - CIMDataConnection EventTable, CIMDataConnection RouteFeatureClass
         * ArcGIS.Core.CIM.CIMSceneDataConnection - string URI
         * ArcGIS.Core.CIM.CIMServiceConnection (abstract base class) - string Description
         *  ArcGIS.Core.CIM.CIMAGSServiceConnection - string URL + CIMServerConnection ServerConnection
         *  ArcGIS.Core.CIM.CIMOGCAPIServiceConnection  - CIMInternetServerConnectionBase ServerConnection + string ServiceName
         *  ArcGIS.Core.CIM.CIMStandardServiceConnection - string URL
         *  ArcGIS.Core.CIM.CIMWCSServiceConnection - CIMInternetServerConnectionBase ServerConnection + string CoverageName
         *  ArcGIS.Core.CIM.CIMWFSServiceConnection - CIMInternetServerConnectionBase ServerConnection + string LayerName
         *  ArcGIS.Core.CIM.CIMWMSServiceConnection - CIMInternetServerConnectionBase ServerConnection + string LayerName
         *  ArcGIS.Core.CIM.CIMWMTSServiceConnection - CIMInternetServerConnectionBase ServerConnection + string LayerName
         * ArcGIS.Core.CIM.CIMSqlQueryDataConnection - * + string SqlQuery,  string OIDFields, and others
         * ArcGIS.Core.CIM.CIMStandardDataConnection - *
         * ArcGIS.Core.CIM.CIMStreamServiceDataConnection - * + age and expiration members
         * ArcGIS.Core.CIM.CIMTableQueryNameDataConnection - * + string WhereClause and others
         * ArcGIS.Core.CIM.CIMTemporalDataConnection - * + temporal members
         * ArcGIS.Core.CIM.CIMTrackingServerDataConnection - * + purge members
         * ArcGIS.Core.CIM.CIMVectorTileDataConnection - string URI, string ResourcesURI
         * ArcGIS.Core.CIM.CIMVideoDataConnection - string URI
         * ArcGIS.Core.CIM.CIMVoxelDataConnection - string URI
         * ArcGIS.Core.CIM.CIMWorkspaceConnection - * less DatasetType and Dataset
         * ArcGIS.Core.CIM.CIMXYEventDataConnection - CIMDataConnection XYEventTableDataConnection
         *
         * ArcGIS.Core.CIM.CIMInternetServerConnectionBase - string URL, bool Anonymous, string User, string Password
         *  ArcGIS.Core.CIM.CIMServerConnection - no additional properties
         */

        private void InitDataConnection(CIMDataConnection connection)
        {
            ConnectionClassName = BuildConnectionClassName(connection);
            if (connection == null)
            {
                return;
            }
            if (connection is CIMFeatureDatasetDataConnection conn1)
            {
                InitDataConnection(conn1);
            }
            if (connection is CIMGADataConnection conn2)
            {
                InitDataConnection(conn2);
            }
            if (connection is CIMInMemoryDatasetDataConnection conn3)
            {
                InitDataConnection(conn3);
            }
            if (connection is CIMInMemoryWorkspaceDataConnection conn4)
            {
                InitDataConnection(conn4);
            }
            if (connection is CIMKMLDataConnection conn5)
            {
                InitDataConnection(conn5);
            }
            if (connection is CIMNetCDFRasterDataConnection conn8)
            {
                InitDataConnection(conn8);
            }
            if (connection is CIMNetCDFStandardDataConnection conn9)
            {
                InitDataConnection(conn9);
            }
            if (connection is CIMRasterBandDataConnection conn11)
            {
                InitDataConnection(conn11);
            }
            if (connection is CIMRelQueryTableDataConnection conn12)
            {
                InitDataConnection(conn12);
            }
            if (connection is CIMRouteEventDataConnection conn13)
            {
                InitDataConnection(conn13);
            }
            if (connection is CIMSceneDataConnection conn32)
            {
                InitDataConnection(conn32);
            }
            if (connection is CIMAGSServiceConnection conn14)
            {
                InitDataConnection(conn14);
            }
            if (connection is CIMStandardServiceConnection conn16)
            {
                InitDataConnection(conn16);
            }
            if (connection is CIMWCSServiceConnection conn17)
            {
                InitDataConnection(conn17);
            }
            if (connection is CIMWFSServiceConnection conn18)
            {
                InitDataConnection(conn18);
            }
            if (connection is CIMWMSServiceConnection conn19)
            {
                InitDataConnection(conn19);
            }
            if (connection is CIMWMTSServiceConnection conn20)
            {
                InitDataConnection(conn20);
            }
            if (connection is CIMSqlQueryDataConnection conn21)
            {
                InitDataConnection(conn21);
            }
            if (connection is CIMStandardDataConnection conn22)
            {
                InitDataConnection(conn22);
            }
            if (connection is CIMStreamServiceDataConnection conn23)
            {
                InitDataConnection(conn23);
            }
            if (connection is CIMTableQueryNameDataConnection conn24)
            {
                InitDataConnection(conn24);
            }
            if (connection is CIMTemporalDataConnection conn25)
            {
                InitDataConnection(conn25);
            }
            if (connection is CIMTrackingServerDataConnection conn26)
            {
                InitDataConnection(conn26);
            }
            if (connection is CIMVectorTileDataConnection conn27)
            {
                InitDataConnection(conn27);
            }
            if (connection is CIMVideoDataConnection conn28)
            {
                InitDataConnection(conn28);
            }
            if (connection is CIMWorkspaceConnection conn30)
            {
                InitDataConnection(conn30);
            }
            if (connection is CIMXYEventDataConnection conn31)
            {
                InitDataConnection(conn31);
            }
            // Versions before 2.5 are not supported
#if !Pro25
            // Added in 2.6
            if (connection is CIMNITFDataConnection conn10)
            {
                InitDataConnection(conn10);
            }
#if !Pro26
            // Added in 2.7
            if (connection is CIMKnowledgeGraphDataConnection conn6)
            {
                InitDataConnection(conn6);
            }
            if (connection is CIMKnowledgeGraphTableDataConnection conn7)
            {
                InitDataConnection(conn7);
            }
            if (connection is CIMOGCAPIServiceConnection conn15)
            {
                InitDataConnection(conn15);
            }
            if (connection is CIMVoxelDataConnection conn29)
            {
                InitDataConnection(conn29);
            }
#endif
#endif
        }