public object ESRI_Image_Remove(ResultBuffer rb) { object result; try { string argument = LspUtil.GetArgument(rb, 0, null); if (string.IsNullOrEmpty(argument)) { result = null; } else { MSCImageService imageService = this.GetImageService(argument); if (imageService == null) { result = null; } else if (imageService.DeleteService()) { result = LspUtil.LispTrue; } else { result = null; } } } catch { result = null; } return(result); }
public object ESRI_Image_SetCurrent(ResultBuffer rb) { object result; try { string argument = LspUtil.GetArgument(rb, 0, null); MSCImageService imageService = this.GetImageService(argument); if (imageService == null) { result = null; } else { AfaDocData.ActiveDocData.CurrentImageService = imageService; ArcGISRibbon.SetActiveRasterService(imageService); result = LspUtil.LispTrue; } } catch { result = null; } return(result); }
private void AddImageService(object sender, ExportedImageEventArgs e) { try { if (!string.IsNullOrEmpty(e.ErrorMessage)) { ErrorReport.ShowErrorMessage(e.ErrorMessage); } else if (e.Points != null && !string.IsNullOrEmpty(e.ExportOptions.OutputFile)) { Point3d point3d = new Point3d(e.Points[0].X, e.Points[0].Y, 0.0); Point3d point3d2 = new Point3d(e.Points[1].X, e.Points[1].Y, 0.0); Point3d point3d3 = new Point3d(e.Points[2].X, e.Points[2].Y, 0.0); Point3d p = new Point3d(e.Points[1].X, e.Points[2].Y, 0.0); Vector3d v = point3d2 - point3d; Vector3d v2 = point3d3 - point3d; ObjectId objectId = DocUtil.DefineRasterImage(AfaDocData.ActiveDocData.Document, e.ExportOptions.OutputFile, point3d, v, v2, "ESRI_" + e.MapName, e.ExportOptions.Transparency); if (!objectId.IsNull) { DocUtil.SetEntityDisableUndo(AfaDocData.ActiveDocData.Document, objectId, true); e.ExportOptions.BoundingBox = new Extent(point3d, p); e.ExportOptions.BoundingBox.SpatialReference = e.ExportOptions.OutputWKT; MSCImageService mSCImageService = MSCDataset.AddImageService((AGSImageService)e.MapService, objectId, e.ExportOptions); if (mSCImageService != null) { DocUtil.AttachHyperlink(AfaDocData.ActiveDocData.Document, objectId, mSCImageService.Name, mSCImageService.RestEndpoint); mSCImageService.UpdateToCurrentView(); mSCImageService.CheckForUpdates(); } } } } catch { if (string.IsNullOrEmpty(base.ErrorMessage)) { base.ErrorMessage = AfaStrings.ErrorGeneratingImage; } throw; } }
public object ESRI_Image_GetCurrent(ResultBuffer rb) { object result; try { MSCImageService currentImageService = AfaDocData.ActiveDocData.CurrentImageService; if (currentImageService == null) { result = null; } else { result = currentImageService.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_Image_Get(ResultBuffer rb) { object result; try { string argument = LspUtil.GetArgument(rb, 0, null); MSCImageService mSCImageService = null; if (!string.IsNullOrEmpty(argument)) { mSCImageService = this.GetImageService(argument); } else { mSCImageService = AfaDocData.ActiveDocData.CurrentImageService; } if (mSCImageService == null) { result = null; } else { List <TypedValue> list = new List <TypedValue>(); list.Add(new TypedValue(5016, null)); if (mSCImageService.ExportOptions != null) { LspUtil.AppendDottedPair(ref list, 5005, "DYNAMIC", 5003, mSCImageService.ExportOptions.Dynamic); LspUtil.AppendDottedPair(ref list, 5005, "TRANSPARENCY", 5003, mSCImageService.ExportOptions.Transparency); try { if (mSCImageService.BoundaryExtent.IsValid()) { LspUtil.AppendDottedPair(ref list, "EXT", mSCImageService.BoundaryExtent); } } catch { } LspUtil.AppendDottedPair(ref list, 5005, "VISIBILE", 5003, mSCImageService.GetVisibility()); if (!string.IsNullOrEmpty(mSCImageService.ExportOptions.Format)) { LspUtil.AppendDottedPair(ref list, 5005, "FORMAT", 5005, mSCImageService.ExportOptions.Format); } if (!string.IsNullOrEmpty(mSCImageService.ConnectionURL)) { LspUtil.AppendDottedPair(ref list, 5005, "URL", 5005, mSCImageService.RestEndpoint); } if (!string.IsNullOrEmpty(mSCImageService.RestEndpoint)) { LspUtil.AppendDottedPair(ref list, 5005, "RESTURL", 5005, mSCImageService.RestEndpoint); } LspUtil.AppendDottedPair(ref list, "COMPRESSION", mSCImageService.ExportOptions.TransCompression); LspUtil.AppendDottedPair(ref list, "MOSAICMETHOD", mSCImageService.ExportOptions.MosaicMethod); LspUtil.AppendDottedPair(ref list, "MOSAICOPERATOR", mSCImageService.ExportOptions.MosaicOperator); LspUtil.AppendDottedPair(ref list, "MOSAICRULE", mSCImageService.ExportOptions.MosaicRule); LspUtil.AppendDottedPair(ref list, "ASCENDING", mSCImageService.ExportOptions.Ascending); LspUtil.AppendDottedPair(ref list, "BANDIDS", mSCImageService.ExportOptions.BandIds); LspUtil.AppendDottedPair(ref list, "INTERPOLATION", mSCImageService.ExportOptions.Interpolation); LspUtil.AppendDottedPair(ref list, "LOCKRASTERID", mSCImageService.ExportOptions.LockRasterID); LspUtil.AppendDottedPair(ref list, "NODATAVALUE", mSCImageService.ExportOptions.NoDataValue); LspUtil.AppendDottedPair(ref list, "ORDERBASEVALUE", mSCImageService.ExportOptions.OrderBaseValue); LspUtil.AppendDottedPair(ref list, "ORDERFIELD", mSCImageService.ExportOptions.OrderField); LspUtil.AppendDottedPair(ref list, "RENDERINGRULE", mSCImageService.ExportOptions.RenderingRule); LspUtil.AppendDottedPair(ref list, "PIXELTYPE", mSCImageService.ExportOptions.PixelType); LspUtil.AppendDottedPair(ref list, "QUALITY", mSCImageService.ExportOptions.Quality); } LspUtil.AppendDottedPair(ref list, 5005, "NAME", 5005, mSCImageService.Name); LspUtil.AppendDottedPair(ref list, 5005, "ENAME", 5006, mSCImageService.RasterObjectId); if (!string.IsNullOrEmpty(mSCImageService.ConnectionURL)) { LspUtil.AppendDottedPair(ref list, 5005, "URL", 5005, mSCImageService.ConnectionURL); } try { AGSConnection parent = mSCImageService.ParentService.Parent; if (!string.IsNullOrEmpty(parent.Name)) { LspUtil.AppendDottedPair(ref list, 5005, "CONNECTION_NAME", 5005, parent.Name); } } catch { } try { if (!string.IsNullOrEmpty(mSCImageService.CurrentFileName)) { LspUtil.AppendDottedPair(ref list, "CURRENTFILE", 5005, mSCImageService.CurrentFileName); } mSCImageService.ParentService.GetWKT(); if (mSCImageService.ParentService != null) { foreach (KeyValuePair <string, object> current in mSCImageService.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_Image_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, "VISIBLE", 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; AGSImageService aGSImageService = AGSImageService.BuildImageServiceFromURL(null, assocParam); if (aGSImageService != null) { string text = MSCPrj.ReadWKT(Application.DocumentManager.MdiActiveDocument); if (string.IsNullOrEmpty(text)) { text = MSCPrj.AssignWKT(AfaDocData.ActiveDocData.Document, aGSImageService.GetWKT()); } aGSImageService.ExportOptions.Dynamic = assocParam2; aGSImageService.ExportOptions.Format = assocParam6; if (num == 100) { num = 99; } aGSImageService.ExportOptions.Transparency = byte.Parse(num.ToString()); Extent extent = new Extent(assocParam4, assocParam5); if (extent.IsValid()) { extent.SetWKTFrom(text); aGSImageService.ExportOptions.BoundingBox = extent; } aGSImageService.ExportOptions.OutputWKT = text; if (!aGSImageService.AddService(aGSImageService.ExportOptions)) { Mouse.OverrideCursor = null; result = null; } else { Mouse.OverrideCursor = null; MSCImageService currentImageService = AfaDocData.ActiveDocData.CurrentImageService; if (!assocParam3) { currentImageService.Visible = false; } result = currentImageService.Name; } } else { result = null; } } } } catch { result = null; } return(result); }