public object ESRI_Map_SetCurrent(ResultBuffer rb) { object result; try { string argument = LspUtil.GetArgument(rb, 0, null); MSCMapService mapService = this.GetMapService(argument); if (mapService == null) { result = null; } else { AfaDocData.ActiveDocData.CurrentMapService = mapService; ArcGISRibbon.SetActiveRasterService(mapService); result = LspUtil.LispTrue; } } catch { result = null; } return(result); }
public object ESRI_Map_Remove(ResultBuffer rb) { object result; try { string argument = LspUtil.GetArgument(rb, 0, null); if (string.IsNullOrEmpty(argument)) { result = null; } else { MSCMapService mapService = this.GetMapService(argument); if (mapService == null) { result = null; } else if (mapService.DeleteService()) { result = LspUtil.LispTrue; } else { result = null; } } } catch { result = null; } return(result); }
public object ESRI_Map_GetCurrent(ResultBuffer rb) { object result; try { MSCMapService currentMapService = AfaDocData.ActiveDocData.CurrentMapService; if (currentMapService == null) { result = null; } else { result = currentMapService.Name; } } catch { result = null; } return(result); }
public bool CreateExportImage(string outputFileName) { bool result; try { this.StopReactors(); if (!File.Exists(this.CurrentFileName)) { this.RequestNewRasterNow(this.DrawnViewInfo); } File.Copy(this.CurrentFileName, outputFileName, true); DocUtil.UpdateRasterImage(this.ParentDataset.ParentDocument, this.RasterObjectId, outputFileName); this.RasterObjectId = ObjectId.Null; if (base.GetType() == typeof(MSCMapService)) { AfaDocData.ActiveDocData.DocDataset.MapServices.Remove(this.Name); MSCMapService mSCMapService = (MSCMapService)this; mSCMapService.RemoveDictionary(); this.ParentDataset.MapServices.Remove(this.Name); MSCDataset.SetDefaultActiveRasterServices(); } if (base.GetType() == typeof(MSCImageService)) { AfaDocData.ActiveDocData.DocDataset.ImageServices.Remove(this.Name); MSCImageService mSCImageService = (MSCImageService)this; mSCImageService.RemoveDictionary(); this.ParentDataset.ImageServices.Remove(this.Name); MSCDataset.SetDefaultActiveRasterServices(); } result = true; } catch (SystemException) { result = false; } return(result); }
private void db_ObjectErased(object sender, ObjectErasedEventArgs e) { try { if (e.DBObject.Id == this.RasterObjectId) { if (base.GetType() == typeof(MSCMapService)) { MSCMapService mSCMapService = this as MSCMapService; mSCMapService.DeleteService(); } else if (base.GetType() == typeof(MSCImageService)) { MSCImageService mSCImageService = this as MSCImageService; mSCImageService.DeleteService(); } } this.CheckForUpdates(); } catch { System.Windows.MessageBox.Show("DEBUG: Catch in MSCRasterService.db_ObjectErased"); } }
public object ESRI_Map_Get(ResultBuffer rb) { object result; try { string argument = LspUtil.GetArgument(rb, 0, null); MSCMapService mSCMapService = null; if (!string.IsNullOrEmpty(argument)) { mSCMapService = this.GetMapService(argument); } else { mSCMapService = AfaDocData.ActiveDocData.CurrentMapService; } if (mSCMapService == null) { result = null; } else { List <TypedValue> list = new List <TypedValue>(); list.Add(new TypedValue(5016, null)); if (mSCMapService.ExportOptions != null) { LspUtil.AppendDottedPair(ref list, 5005, "DYNAMIC", 5003, mSCMapService.ExportOptions.Dynamic); LspUtil.AppendDottedPair(ref list, 5005, "TRANSPARENCY", 5003, mSCMapService.ExportOptions.Transparency); try { if (mSCMapService.BoundaryExtent.IsValid()) { LspUtil.AppendDottedPair(ref list, "EXT", mSCMapService.BoundaryExtent); } } catch { } if (!string.IsNullOrEmpty(mSCMapService.ExportOptions.Format)) { LspUtil.AppendDottedPair(ref list, 5005, "FORMAT", 5005, mSCMapService.ExportOptions.Format); } } LspUtil.AppendDottedPair(ref list, 5005, "VISIBILE", 5003, mSCMapService.GetVisibility()); LspUtil.AppendDottedPair(ref list, 5005, "NAME", 5005, mSCMapService.Name); LspUtil.AppendDottedPair(ref list, 5005, "ENAME", 5006, mSCMapService.RasterObjectId); if (!string.IsNullOrEmpty(mSCMapService.ConnectionURL)) { LspUtil.AppendDottedPair(ref list, 5005, "URL", 5005, mSCMapService.ConnectionURL); } if (!string.IsNullOrEmpty(mSCMapService.RestEndpoint)) { LspUtil.AppendDottedPair(ref list, 5005, "RESTURL", 5005, mSCMapService.RestEndpoint); } try { AGSConnection parent = mSCMapService.ParentService.Parent; if (!string.IsNullOrEmpty(parent.Name)) { LspUtil.AppendDottedPair(ref list, 5005, "CONNECTION_NAME", 5005, parent.Name); } } catch { } try { if (!string.IsNullOrEmpty(mSCMapService.CurrentFileName)) { LspUtil.AppendDottedPair(ref list, "CURRENTFILE", 5005, mSCMapService.CurrentFileName); } mSCMapService.ParentService.GetWKT(); if (mSCMapService.ParentService != null) { foreach (KeyValuePair <string, object> current in mSCMapService.ParentService.Properties) { try { LspUtil.AppendDottedPair(ref list, current.Key, current.Value); } catch { } } } } catch { } list.Add(new TypedValue(5017, null)); ResultBuffer resultBuffer = new ResultBuffer(list.ToArray()); result = resultBuffer; } } catch { result = null; } return(result); }
public object ESRI_Map_Add(ResultBuffer rb) { object result; try { if (null == Application.DocumentManager.MdiActiveDocument) { result = null; } else { string assocParam = LspUtil.GetAssocParam(rb, "URL", null); bool assocParam2 = LspUtil.GetAssocParam(rb, "DYNAMIC", true); bool assocParam3 = LspUtil.GetAssocParam(rb, "VISISBLE", true); short num = LspUtil.GetAssocParam(rb, "TRANSPARENCY", 0); Point2d assocParam4 = LspUtil.GetAssocParam(rb, "EXTMIN", Point2d.Origin); Point2d assocParam5 = LspUtil.GetAssocParam(rb, "EXTMAX", Point2d.Origin); string assocParam6 = LspUtil.GetAssocParam(rb, "FORMAT", "PNG24"); if (string.IsNullOrEmpty(assocParam)) { result = null; } else { Mouse.OverrideCursor = Cursors.Wait; AGSMapService aGSMapService = AGSMapService.BuildMapServiceFromURL(null, assocParam); if (aGSMapService != null) { string text = MSCPrj.ReadWKT(Application.DocumentManager.MdiActiveDocument); if (string.IsNullOrEmpty(text)) { text = MSCPrj.AssignWKT(AfaDocData.ActiveDocData.Document, aGSMapService.GetWKT()); } aGSMapService.IsVisible = assocParam3; aGSMapService.ExportOptions.Dynamic = assocParam2; aGSMapService.ExportOptions.Format = assocParam6; if (num == 100) { num = 99; } aGSMapService.ExportOptions.Transparency = byte.Parse(num.ToString()); aGSMapService.ExportOptions.OutputWKT = text; Extent extent = new Extent(assocParam4, assocParam5); if (extent.IsValid()) { extent.SetWKTFrom(text); aGSMapService.ExportOptions.BoundingBox = extent; } if (!aGSMapService.AddService()) { Mouse.OverrideCursor = null; result = null; } else { Mouse.OverrideCursor = null; MSCMapService currentMapService = AfaDocData.ActiveDocData.CurrentMapService; if (!assocParam3) { currentMapService.Visible = false; } result = currentMapService.Name; } } else { result = null; } } } } catch { result = null; } return(result); }