private void InitializeLayers() { this.Layers = new List <MSCMapLayer>(); AGSMapService aGSMapService = (AGSMapService)this.ParentService; using (IEnumerator <object> enumerator = aGSMapService.MapLayers.Values.GetEnumerator()) { while (enumerator.MoveNext()) { AGSMapLayer aGSMapLayer = (AGSMapLayer)enumerator.Current; MSCMapLayer mSCMapLayer = new MSCMapLayer(); if (aGSMapLayer.parentLayerId == -1) { mSCMapLayer.ParentLayerID = aGSMapLayer.parentLayerId; mSCMapLayer.Name = aGSMapLayer.Name; mSCMapLayer.ID = aGSMapLayer.Id; mSCMapLayer.Visible = aGSMapLayer.IsVisible; mSCMapLayer.ParentMap = this; mSCMapLayer.Layers = new List <MSCMapLayer>(); mSCMapLayer.ChildLayerIDs = new List <int>(aGSMapLayer.ChildLayerIds); this.InitializeChildLayers(mSCMapLayer); this.Layers.Add(mSCMapLayer); } } } }
private void InitializeChildLayers(MSCMapLayer parentLyr) { AGSMapService aGSMapService = (AGSMapService)this.ParentService; if (parentLyr.ChildLayerIDs.Count == 0) { return; } using (IEnumerator <object> enumerator = aGSMapService.MapLayers.Values.GetEnumerator()) { while (enumerator.MoveNext()) { AGSMapLayer aGSMapLayer = (AGSMapLayer)enumerator.Current; if (aGSMapLayer.parentLayerId == parentLyr.ID) { MSCMapLayer mSCMapLayer = new MSCMapLayer(); mSCMapLayer.Name = aGSMapLayer.Name; mSCMapLayer.ID = aGSMapLayer.Id; mSCMapLayer.Visible = aGSMapLayer.IsVisible; mSCMapLayer.Layers = new List <MSCMapLayer>(); mSCMapLayer.ParentMap = this; mSCMapLayer.ChildLayerIDs = new List <int>(aGSMapLayer.ChildLayerIds); if (mSCMapLayer.ChildLayerIDs.Count != 0) { this.InitializeChildLayers(mSCMapLayer); } parentLyr.Layers.Add(mSCMapLayer); } } } }
public void ReadMapLayer(Transaction t, ObjectId lyrDictionaryID) { DBDictionary dBDictionary = (DBDictionary)t.GetObject(lyrDictionaryID, 0); this.ID = (int)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)90, "ID"); this.ParentLayerID = (int)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)90, "ParentID"); this.Visible = false; if (dBDictionary.Contains("MapLayerName")) { Xrecord xrecord = (Xrecord)t.GetObject(dBDictionary.GetAt("MapLayerName"), 0); TypedValue[] array = xrecord.Data.AsArray(); for (int i = 0; i < array.Length; i++) { TypedValue typedValue = array[i]; if (typedValue.TypeCode == 1) { this.Name = typedValue.Value.ToString(); break; } } } if (dBDictionary.Contains("Visible")) { Xrecord xrecord2 = (Xrecord)t.GetObject(dBDictionary.GetAt("Visible"), 0); TypedValue[] array2 = xrecord2.Data.AsArray(); for (int j = 0; j < array2.Length; j++) { TypedValue typedValue2 = array2[j]; if (typedValue2.TypeCode == 290) { this.Visible = (0 != Convert.ToInt16(typedValue2.Value)); break; } } } this.Layers = new List <MSCMapLayer>(); if (dBDictionary.Contains("ChildLayers")) { DBDictionary dBDictionary2 = (DBDictionary)t.GetObject(dBDictionary.GetAt("ChildLayers"), 0); using (DbDictionaryEnumerator enumerator = dBDictionary2.GetEnumerator()) { while (enumerator.MoveNext()) { DBDictionaryEntry current = enumerator.Current; MSCMapLayer item = new MSCMapLayer(t, current.Key, current.Value); this.Layers.Add(item); } } } }
private void UpdateChildIdentifyResults(MSCMapLayer parentLayer) { AGSMapService aGSMapService = (AGSMapService)this.ParentService; foreach (MSCMapLayer current in parentLayer.Layers) { if (current.Visible) { AGSMapLayer aGSMapLayer = aGSMapService.FindMapLayer(current.ID); if (aGSMapLayer != null) { current.IdentifyResults = aGSMapLayer.IdentifyResults; this.UpdateChildIdentifyResults(current); } } } }
private void AppendVisibleChildLayer(MSCMapLayer parentLayer, ref List <int> layerIdList) { foreach (MSCMapLayer current in parentLayer.Layers) { if (current.Visible) { if (current.ChildLayerIDs.Count > 0) { this.AppendVisibleChildLayer(current, ref layerIdList); } else { layerIdList.Add(current.ID); } } } }
private void SetParentSubLayerVisibility(MSCMapLayer parentLayer) { if (parentLayer.Layers.Count == 0) { return; } AGSMapService aGSMapService = (AGSMapService)this.ParentService; foreach (MSCMapLayer current in parentLayer.Layers) { AGSMapLayer aGSMapLayer = aGSMapService.FindMapLayer(current.ID); if (aGSMapLayer != null) { aGSMapLayer.IsVisible = current.Visible; } if (current.Layers.Count > 0) { this.SetParentSubLayerVisibility(current); } } }
protected void Read(ObjectId id, Transaction t) { try { DBDictionary dBDictionary = (DBDictionary)t.GetObject(this.AcadDictionaryID, 0); base.RasterObjectId = (ObjectId)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)330, "AutoCADID"); this.ServiceFullName = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "ServiceFullName"); base.ConnectionName = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "ConnectionName"); base.ConnectionURL = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "ConnectionURL"); base.UserName = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "UserName"); base.BoundaryExtent = DocUtil.ReadBoundingBox(t, dBDictionary); base.ExportOptions = new AGSExportOptions(); this.InitExportOptions(); base.ExportOptions.Format = (string)DocUtil.ReadXRecord(t, dBDictionary, (DxfCode)1, "ImageFormat"); base.ExportOptions.BoundingBox = new Extent(base.BoundaryExtent); base.ExportOptions.OutputWKT = MSCPrj.ReadWKT(base.ParentDataset.ParentDocument); try { base.Dynamic = false; if (dBDictionary.Contains("Dynamic")) { Xrecord xrecord = (Xrecord)t.GetObject(dBDictionary.GetAt("Dynamic"), 0); TypedValue[] array = xrecord.Data.AsArray(); for (int i = 0; i < array.Length; i++) { TypedValue typedValue = array[i]; if (typedValue.TypeCode == 290) { base.Dynamic = (0 != Convert.ToInt16(typedValue.Value)); } } } base.ExportOptions.Dynamic = base.Dynamic; } catch { base.ExportOptions.Dynamic = false; } if (dBDictionary.Contains("ESRI_Layers")) { DBDictionary dBDictionary2 = (DBDictionary)t.GetObject(dBDictionary.GetAt("ESRI_Layers"), 0); using (DbDictionaryEnumerator enumerator = dBDictionary2.GetEnumerator()) { while (enumerator.MoveNext()) { DBDictionaryEntry current = enumerator.Current; MSCMapLayer mSCMapLayer = new MSCMapLayer(t, current.Key, current.Value); mSCMapLayer.ParentMap = this; if (mSCMapLayer.Layers != null) { foreach (MSCMapLayer current2 in mSCMapLayer.Layers) { current2.ParentMap = this; } } this.Layers.Add(mSCMapLayer); } } } if (this.ReconnectService()) { base.RefreshConnectedService(); } } catch { } }