public bool AddService(AGSExportOptions eo)
        {
            bool result;

            try
            {
                base.ErrorMessage = null;
                this.InitializeImageService();
                eo.OutputFile   = Utility.TemporaryFilePath();
                eo.AcadDocument = AfaDocData.ActiveDocData.Document;
                Size size = Application.ToSystemDrawingSize(eo.AcadDocument.Window.DeviceIndependentSize);
                eo.Width  = size.Width;
                eo.Height = size.Height;
                bool flag = this.ExportMapNow(eo, new ExportImageEventHandler(this.AddImageService), null);
                result = flag;
            }
            catch (SystemException ex)
            {
                if (this.CommandEnded != null)
                {
                    this.CommandEnded(this, EventArgs.Empty);
                }
                ErrorReport.ShowErrorMessage(ex.Message);
                result = false;
            }
            return(result);
        }
        public void RequestNewRasterNow(Extent newExtent)
        {
            this.CancelRequests = true;
            AGSExportOptions aGSExportOptions = (AGSExportOptions)Utility.CloneObject(this.ExportOptions);

            aGSExportOptions.BoundingBox = newExtent;
            System.Drawing.Size size = Autodesk.AutoCAD.ApplicationServices.Application.ToSystemDrawingSize(this.ParentDataset.ParentDocument.Window.DeviceIndependentSize);
            this.ExportOptions.Width    = size.Width;
            this.ExportOptions.Height   = size.Height;
            aGSExportOptions.OutputFile = Utility.TemporaryFilePath();
            try
            {
                string text = MSCPrj.ReadWKT(this.ParentDataset.ParentDocument);
                if (!string.IsNullOrEmpty(text))
                {
                    aGSExportOptions.OutputWKT = text;
                }
            }
            catch
            {
            }
            newExtent.SpatialReference = aGSExportOptions.OutputWKT;
            this.SetParentLayerVisibility();
            this.PendingImage = null;
            this.ParentService.ExportMapNow(aGSExportOptions, new ExportImageEventHandler(this.UpdateExistingRaster), this.LastRequested);
            this.LastRequested  = (AGSExportOptions)Utility.CloneObject(aGSExportOptions);
            this.CancelRequests = false;
        }
 private void btnOK_Click(object sender, RoutedEventArgs e)
 {
     if (this.localRasterService != null)
     {
         AGSExportOptions aGSExportOptions = this.InitExportOptions(this.localRasterService);
         this.mscRasterService.ExportOptions = aGSExportOptions;
         this.mscRasterService.SetTransparency((int)aGSExportOptions.Transparency);
         this.mscRasterService.BoundaryExtent = aGSExportOptions.BoundingBox;
         this.mscRasterService.Dynamic        = aGSExportOptions.Dynamic;
         this.mscRasterService.Write();
         base.Close();
         this.mscRasterService.RefreshService();
     }
     if (this.localFeatureService != null)
     {
         AGSExportOptions aGSExportOptions2 = this.InitExportOptions(this.localFeatureService);
         this.mscFeatureService.ExportOptions = aGSExportOptions2;
         if (!aGSExportOptions2.Dynamic)
         {
             this.mscFeatureService.QueryOnly = true;
             this.mscFeatureService.SetLayerLock(true);
         }
         else
         {
             this.mscFeatureService.QueryOnly = false;
             this.mscFeatureService.SetLayerLock(false);
         }
         this.mscFeatureService.Write();
         base.Close();
         string cmdString = ".esri_Synchronize ";
         CmdLine.ExecuteQuietCommand(cmdString);
     }
 }
        private AGSExportOptions InitExportOptions(object srcObject)
        {
            AGSExportOptions aGSExportOptions = new AGSExportOptions();

            aGSExportOptions.AcadDocument = AfaDocData.ActiveDocData.Document;
            Extent extent = this.spProps.ctrlBoundingBoxExtent.Content as Extent;

            aGSExportOptions.BoundingBox = extent;
            aGSExportOptions.OutputWKT   = AfaDocData.ActiveDocData.DocPRJ.WKT;
            aGSExportOptions.WhereClause = "";
            System.Drawing.Size size = Application.ToSystemDrawingSize(AfaDocData.ActiveDocData.Document.Window.DeviceIndependentSize);
            aGSExportOptions.Width        = size.Width;
            aGSExportOptions.Height       = size.Height;
            aGSExportOptions.DPI          = 96;
            aGSExportOptions.Transparency = this.spProps.ExportOptions.Transparency;
            aGSExportOptions.Format       = this.spProps.ExportOptions.Format;
            aGSExportOptions.Dynamic      = this.spProps.ExportOptions.Dynamic;
            if (aGSExportOptions.Format == null)
            {
                aGSExportOptions.Format = "PNG24";
            }
            AGSService aGSService = srcObject as AGSService;
            AGSLayer   aGSLayer   = srcObject as AGSLayer;
            string     text       = "";

            if (aGSService != null)
            {
                text = aGSService.GetWKT();
            }
            else if (aGSLayer != null)
            {
                text = aGSLayer.GetWKT();
            }
            if (string.IsNullOrEmpty(text))
            {
                text = "PROJCS[\"WGS_1984_Web_Mercator_Auxiliary_Sphere\",GEOGCS[\"GCS_WGS_1984\",DATUM[\"D_WGS_1984\",SPHEROID[\"WGS_1984\",6378137.0,298.257223563]],PRIMEM[\"Greenwich\",0.0],UNIT[\"Degree\",0.0174532925199433]],PROJECTION[\"Mercator_Auxiliary_Sphere\"],PARAMETER[\"False_Easting\",0.0],PARAMETER[\"False_Northing\",0.0],PARAMETER[\"Central_Meridian\",0.0],PARAMETER[\"Standard_Parallel_1\",0.0],PARAMETER[\"Auxiliary_Sphere_Type\",0.0],UNIT[\"Meter\",1.0],AUTHORITY[\"EPSG\",3857]]";
            }
            if (string.IsNullOrEmpty(extent.SpatialReference))
            {
                extent.SpatialReference = text;
            }
            aGSExportOptions.OutputWKT = MSCPrj.CurrentWKT(AfaDocData.ActiveDocData.Document, text);
            try
            {
                aGSExportOptions.Interpolation    = this.spProps.ExportOptions.Interpolation;
                aGSExportOptions.Quality          = this.spProps.ExportOptions.Quality;
                aGSExportOptions.TransCompression = this.spProps.ExportOptions.TransCompression;
                aGSExportOptions.MosaicMethod     = this.spProps.ExportOptions.MosaicMethod;
                aGSExportOptions.OrderField       = this.spProps.ExportOptions.OrderField;
                aGSExportOptions.OrderBaseValue   = this.spProps.ExportOptions.OrderBaseValue;
                aGSExportOptions.MosaicOperator   = this.spProps.ExportOptions.MosaicOperator;
                aGSExportOptions.LockRasterID     = this.spProps.ExportOptions.LockRasterID;
                aGSExportOptions.Ascending        = this.spProps.ExportOptions.Ascending;
            }
            catch
            {
                return(aGSExportOptions);
            }
            return(aGSExportOptions);
        }
 public ExportedImageEventArgs(AGSService mapService, AGSExportOptions eo, PointN[] points)
 {
     this.MapName       = mapService.Name;
     this.MapService    = mapService;
     this.ExportOptions = (AGSExportOptions)Utility.CloneObject(eo);
     this.Points        = points;
     this.ErrorMessage  = "";
 }
예제 #6
0
 public void SetService(object o, AGSExportOptions localExportOptions)
 {
     try
     {
         if (localExportOptions != null)
         {
             this.ExportOptions = localExportOptions;
         }
         this.SetService(o);
     }
     catch
     {
     }
 }
        public override ITask GetExportTask(AGSExportOptions eo, HiddenUpdateForm form)
        {
            string        arg        = base.Parent.URL + "/" + base.FullName + "/ImageServer/exportImage";
            StringBuilder arg2       = this.BuildURIRequest(eo);
            string        requestURL = arg + arg2;

            return(new UpdateRasterImageTask(base.Parent)
            {
                RequestURL = requestURL,
                UpdateForm = form,
                OutputFile = eo.OutputFile,
                OutputSpatialReference = AGSSpatialReference.SpRefFromString(eo.OutputWKT)
            });
        }
예제 #8
0
 public MSCImageService(MSCDataset parentDataset, AGSImageService parentMap, AGSExportOptions eo)
 {
     this.ParentService = (AGSImageService)Utility.CloneObject(parentMap);
     base.ParentDataset = parentDataset;
     try
     {
         base.ConnectionURL   = this.ParentService.Parent.Soap_URL;
         base.UserName        = this.ParentService.Parent.UserName;
         base.ExportOptions   = eo;
         this.ServiceFullName = this.ParentService.FullName;
         base.ConnectionURL   = this.ParentService.Parent.Soap_URL;
         base.UserName        = this.ParentService.Parent.UserName;
         base.ConnectionName  = this.ParentService.Parent.Name;
         base.ExportOptions   = eo;
         base.CurrentFileName = eo.OutputFile;
         this.UpdateForm      = new HiddenUpdateForm(base.ParentDataset.ParentDocument);
         base.StartReactors();
         AfaDocData.ActiveDocData.CurrentImageService = this;
     }
     catch (SystemException ex)
     {
         this.ErrorMessage = ex.Message;
     }
 }
예제 #9
0
 public void SetService(object o)
 {
     try
     {
         if (!object.Equals(o, this.ThisService))
         {
             this.ThisService = o;
             this.exServiceInfo.Visibility = Visibility.Collapsed;
             this.exExportProps.Visibility = Visibility.Collapsed;
             bool dynamic = true;
             if (this.ExportOptions != null)
             {
                 dynamic = this.ExportOptions.Dynamic;
             }
             if (o != this.lbServiceInfo.ItemsSource)
             {
                 AGSObject aGSObject = o as AGSObject;
                 if (aGSObject != null)
                 {
                     this.IgnoreTextBoxChange       = true;
                     this.lbServiceInfo.ItemsSource = aGSObject.Properties;
                     string text = "";
                     if (this.cbBoundingBoxTypes.SelectedItem != null)
                     {
                         text = this.cbBoundingBoxTypes.SelectedItem.ToString();
                     }
                     this.ExtentOptions = this.BuildExtentOptions(aGSObject);
                     this.cbBoundingBoxTypes.ItemsSource = this.ExtentOptions.Keys;
                     Extent obj;
                     if (this.ExtentOptions.TryGetValue(text, out obj))
                     {
                         this.cbBoundingBoxTypes.SelectedValue = text;
                         this.ctrlBoundingBoxExtent.Content    = Utility.CloneObject(obj);
                     }
                     else
                     {
                         this.cbBoundingBoxTypes.SelectedIndex = 0;
                         this.ctrlBoundingBoxExtent.Content    = Utility.CloneObject(this.ExtentOptions.Values.ElementAt(0));
                     }
                     this.IgnoreTextBoxChange = false;
                 }
                 AGSLayer aGSLayer = o as AGSLayer;
                 if (aGSLayer != null)
                 {
                     this.IgnoreTextBoxChange       = true;
                     this.lbServiceInfo.ItemsSource = aGSLayer.Properties;
                     this.exServiceInfo.Visibility  = Visibility.Visible;
                     string text2 = "";
                     if (this.cbBoundingBoxTypes.SelectedItem != null)
                     {
                         text2 = this.cbBoundingBoxTypes.SelectedItem.ToString();
                     }
                     this.ExtentOptions = this.BuildExtentOptions(aGSLayer.Service);
                     this.cbBoundingBoxTypes.ItemsSource = this.ExtentOptions.Keys;
                     Extent obj2;
                     if (this.ExtentOptions.TryGetValue(text2, out obj2))
                     {
                         this.cbBoundingBoxTypes.SelectedValue = text2;
                         this.ctrlBoundingBoxExtent.Content    = Utility.CloneObject(obj2);
                     }
                     else
                     {
                         this.cbBoundingBoxTypes.SelectedIndex = 0;
                         this.ctrlBoundingBoxExtent.Content    = Utility.CloneObject(this.ExtentOptions.Values.ElementAt(0));
                     }
                     this.IgnoreTextBoxChange      = false;
                     this.exExportProps.Visibility = Visibility.Visible;
                     this.ctrlExportProps.Content  = aGSLayer;
                     this.ExportOptions            = aGSLayer.Service.ExportOptions;
                     this.ExportOptions.Dynamic    = dynamic;
                 }
                 else
                 {
                     AGSFeatureServiceLayer aGSFeatureServiceLayer = o as AGSFeatureServiceLayer;
                     if (aGSFeatureServiceLayer == null)
                     {
                         AGSFeatureService aGSFeatureService = o as AGSFeatureService;
                         if (aGSFeatureService != null)
                         {
                             this.lbServiceInfo.ItemsSource = aGSFeatureService.Properties;
                             this.exServiceInfo.Visibility  = Visibility.Visible;
                             this.exExportProps.Visibility  = Visibility.Visible;
                             this.ctrlExportProps.Content   = aGSFeatureService;
                             this.ExportOptions             = aGSFeatureService.ExportOptions;
                             this.ExportOptions.Dynamic     = dynamic;
                         }
                         AGSService aGSService = o as AGSService;
                         if (aGSService != null)
                         {
                             this.lbServiceInfo.ItemsSource = aGSService.Properties;
                             this.exServiceInfo.Visibility  = Visibility.Visible;
                             this.exExportProps.Visibility  = Visibility.Visible;
                             this.ctrlExportProps.Content   = aGSService;
                             this.ExportOptions             = aGSService.ExportOptions;
                             this.ExportOptions.Dynamic     = dynamic;
                         }
                         AGSImageService aGSImageService = o as AGSImageService;
                         if (aGSImageService != null)
                         {
                             foreach (AGSField current in aGSImageService.Fields.Values)
                             {
                                 if (!(current.Type == "esriFieldTypeOID") && !(current.Type == "esriFieldTypeGeometry"))
                                 {
                                     this.OrderFieldChoices.Add(current.Name);
                                 }
                             }
                             string version = aGSImageService.Version;
                             if (version.StartsWith("9"))
                             {
                                 this.LimitedImageSupport = true;
                             }
                         }
                     }
                 }
             }
         }
     }
     catch
     {
         MessageBox.Show("In Catch of SetService");
     }
 }
 public void ExportImage(AGSExportOptions eo, ExportImageEventHandler action)
 {
     try
     {
         string        arg  = base.Parent.URL + "/" + base.FullName + "/ImageServer/exportImage";
         StringBuilder arg2 = this.BuildURIRequest(eo);
         Mouse.OverrideCursor = Cursors.Wait;
         IDictionary <string, object> dictionary = base.Parent.MakeDictionaryRequest(arg + arg2);
         if (dictionary == null)
         {
             Mouse.OverrideCursor = null;
             if (string.IsNullOrEmpty(base.Parent.ErrorMessage))
             {
                 ErrorReport.ShowErrorMessage(AfaStrings.AnUnexpectedErrorOccured);
             }
             else
             {
                 ErrorReport.ShowErrorMessage(base.Parent.ErrorMessage);
             }
             return;
         }
         SpatialReference spatialReference = null;
         if (dictionary != null)
         {
             object obj;
             if (!dictionary.TryGetValue("href", out obj))
             {
                 string text = AfaStrings.Error;
                 if (dictionary.ContainsKey("error"))
                 {
                     IDictionary <string, object> dictionary2 = dictionary["error"] as IDictionary <string, object>;
                     if (dictionary2.ContainsKey("details"))
                     {
                         object obj2;
                         if (dictionary2.TryGetValue("details", out obj2))
                         {
                             object[] array = obj2 as object[];
                             if (array != null)
                             {
                                 text = text + " - " + array[0].ToString();
                             }
                         }
                     }
                     else
                     {
                         text += AfaStrings.UnknownError;
                     }
                 }
                 Mouse.OverrideCursor = null;
                 ErrorReport.ShowErrorMessage(text);
                 return;
             }
             string text2 = obj as string;
             if (text2.Length > 0)
             {
                 ExportedImage exportedImage = new ExportedImage(this, text2);
                 if (dictionary.TryGetValue("width", out obj))
                 {
                     exportedImage.Properties.Add("width", obj);
                 }
                 if (dictionary.TryGetValue("height", out obj))
                 {
                     exportedImage.Properties.Add("height", obj);
                 }
                 if (dictionary.TryGetValue("scale", out obj))
                 {
                     exportedImage.Properties.Add("scale", obj);
                 }
                 if (dictionary.TryGetValue("extent", out obj))
                 {
                     IDictionary <string, object> dictionary3 = obj as IDictionary <string, object>;
                     object obj3;
                     if (dictionary3.TryGetValue("xmin", out obj3))
                     {
                         exportedImage.Properties.Add("xmin", obj3);
                     }
                     if (dictionary3.TryGetValue("xmax", out obj3))
                     {
                         exportedImage.Properties.Add("xmax", obj3);
                     }
                     if (dictionary3.TryGetValue("ymax", out obj3))
                     {
                         exportedImage.Properties.Add("ymax", obj3);
                     }
                     if (dictionary3.TryGetValue("ymin", out obj3))
                     {
                         exportedImage.Properties.Add("ymin", obj3);
                     }
                     if (dictionary3.TryGetValue("spatialReference", out obj3))
                     {
                         IDictionary <string, object> dictionary4 = obj3 as IDictionary <string, object>;
                         object obj4;
                         if (dictionary4.TryGetValue("wkid", out obj4))
                         {
                             exportedImage.Properties.Add("spatialReference", obj4);
                             int num = int.Parse(obj4.ToString());
                             spatialReference = AGSSpatialReference.SpRefFromWKID(ref num);
                         }
                         else if (dictionary4.TryGetValue("wkt", out obj4))
                         {
                             exportedImage.Properties.Add("spatialReference", obj4);
                             string text3 = obj4.ToString();
                             spatialReference = AGSSpatialReference.SpRefFromWKT(ref text3);
                         }
                     }
                     PointN pointN = new PointN();
                     if (spatialReference != null)
                     {
                         pointN.SpatialReference = spatialReference;
                     }
                     double num2 = double.Parse(exportedImage.Properties["xmin"].ToString());
                     double num3 = double.Parse(exportedImage.Properties["ymin"].ToString());
                     double num4 = double.Parse(exportedImage.Properties["xmax"].ToString());
                     double num5 = double.Parse(exportedImage.Properties["ymax"].ToString());
                     pointN.X = num2;
                     pointN.Y = num3;
                     pointN.Z = 0.0;
                     PointN[] points = new PointN[]
                     {
                         pointN,
                         new PointN
                         {
                             SpatialReference = spatialReference,
                             X = num4,
                             Y = num3,
                             Z = 0.0
                         },
                         new PointN
                         {
                             SpatialReference = spatialReference,
                             X = num2,
                             Y = num5,
                             Z = 0.0
                         }
                     };
                     try
                     {
                         if (File.Exists(eo.OutputFile))
                         {
                             File.Delete(eo.OutputFile);
                             if (App.TempFiles.Contains(eo.OutputFile))
                             {
                                 App.TempFiles.Remove(eo.OutputFile);
                             }
                         }
                         new WebClient();
                         if (!base.Parent.DownloadFile(text2, eo.OutputFile))
                         {
                             eo.OutputFile = text2;
                             if (string.IsNullOrEmpty(eo.OutputFile))
                             {
                                 ErrorReport.ShowErrorMessage(AfaStrings.ErrorCreatingOutputFile);
                             }
                         }
                     }
                     catch
                     {
                         eo.OutputFile = text2;
                         if (string.IsNullOrEmpty(eo.OutputFile))
                         {
                             ErrorReport.ShowErrorMessage(AfaStrings.ErrorCreatingOutputFile);
                         }
                     }
                     finally
                     {
                         if (action != null)
                         {
                             action(this, new ExportedImageEventArgs(this, eo, points));
                         }
                     }
                     Mouse.OverrideCursor = null;
                     return;
                 }
             }
         }
     }
     catch
     {
         Mouse.OverrideCursor = null;
     }
     Mouse.OverrideCursor = null;
 }
        public StringBuilder BuildURIRequest(AGSExportOptions eo)
        {
            StringBuilder stringBuilder = new StringBuilder();

            stringBuilder.AppendFormat("?f={0}", "json");
            stringBuilder.AppendFormat("&size={0},{1}", eo.Width, eo.Height);
            stringBuilder.AppendFormat("&format={0}", eo.Format.ToLower());
            stringBuilder.AppendFormat("&compressionQuality={0}", eo.Quality);
            stringBuilder.AppendFormat("&compression={0}", eo.TransCompression);
            if (eo.Interpolation != "Default")
            {
                stringBuilder.AppendFormat("&interpoloation={0}", eo.Interpolation);
            }
            if (string.IsNullOrEmpty(eo.OutputWKT))
            {
                eo.OutputWKT = this.GetWKT();
            }
            stringBuilder.Append(this.BuildRequestSpatialRefString("imageSR", eo.OutputWKT));
            if (eo.BoundingBox == null)
            {
                if (this.ExportOptions.BoundingBox == null)
                {
                    Extent extent = null;
                    if (base.Properties.ContainsKey("Full Extent"))
                    {
                        extent = (base.Properties["Full Extent"] as Extent);
                        if (extent.IsValid())
                        {
                            eo.BoundingBox = extent;
                        }
                    }
                    else if (extent == null && base.Properties.ContainsKey("Initial Extent"))
                    {
                        extent = (base.Properties["Initial Extent"] as Extent);
                        if (extent.IsValid())
                        {
                            eo.BoundingBox = extent;
                        }
                    }
                    else if (base.Properties.ContainsKey("Extent"))
                    {
                        extent = (base.Properties["Extent"] as Extent);
                        if (extent.IsValid())
                        {
                            eo.BoundingBox = extent;
                        }
                    }
                }
                eo.BoundingBox = this.ExportOptions.BoundingBox;
            }
            if (eo.BoundingBox != null && eo.BoundingBox.IsValid())
            {
                stringBuilder.AppendFormat("&bbox={0},{1},{2},{3}", new object[]
                {
                    eo.BoundingBox.XMin,
                    eo.BoundingBox.YMin,
                    eo.BoundingBox.XMax,
                    eo.BoundingBox.YMax
                });
                stringBuilder.Append(this.BuildRequestSpatialRefString("bBoxSR", eo.BoundingBox.SpatialReference));
            }
            StringBuilder stringBuilder2 = new StringBuilder();

            stringBuilder2.Append("&mosaicRule={\"mosaicMethod\" : \"");
            stringBuilder2.Append(eo.MosaicMethod);
            stringBuilder2.Append("\"");
            string arg = "true";

            if (eo.MosaicOperator != "<None>")
            {
                stringBuilder2.AppendFormat(", \"mosaicOperation\" : \"{0}\"", eo.MosaicOperator);
            }
            if (eo.MosaicMethod == "esriMosaicLockRaster" && !string.IsNullOrEmpty(eo.LockRasterID))
            {
                stringBuilder2.AppendFormat(", \"lockRasterIds\" : [{0}]", eo.LockRasterID);
            }
            if (eo.MosaicMethod == "esriMosaicAttribute" && !string.IsNullOrEmpty(eo.OrderField))
            {
                stringBuilder2.AppendFormat(", \"sortField\" : \"{0}\"", eo.OrderField);
                if (!string.IsNullOrEmpty(eo.OrderBaseValue))
                {
                    stringBuilder2.AppendFormat(", \"sortValue\" : \"{0}\"", eo.OrderBaseValue);
                }
            }
            if (!eo.Ascending)
            {
                arg = "false";
            }
            stringBuilder2.AppendFormat(", \"ascending\" : {0}", arg);
            stringBuilder2.Append("}");
            stringBuilder.AppendFormat("{0}", stringBuilder2.ToString());
            return(stringBuilder);
        }
        public void RequestNewRaster(Extent newExtent)
        {
            AGSExportOptions localEO = null;

            try
            {
                if (this.CancelRequests)
                {
                    return;
                }
                if (!this.ReconnectService())
                {
                    ErrorReport.ShowErrorMessage(AfaStrings.UnableToConnectService + this.Name);
                    return;
                }
                localEO             = (AGSExportOptions)Utility.CloneObject(this.ExportOptions);
                localEO.BoundingBox = newExtent;
                System.Drawing.Size size = Autodesk.AutoCAD.ApplicationServices.Application.ToSystemDrawingSize(this.ParentDataset.ParentDocument.Window.DeviceIndependentSize);
                localEO.Width  = size.Width;
                localEO.Height = size.Height;
                this.SetParentLayerVisibility();
                localEO.OutputFile         = Utility.TemporaryFilePath();
                newExtent.SpatialReference = localEO.OutputWKT;
            }
            catch
            {
            }
            try
            {
                this.UpdateForm._rasterID = this.RasterObjectId;
                ITask            exportTask       = this.ParentService.GetExportTask(localEO, this.UpdateForm);
                AsyncTaskManager asyncTaskManager = new AsyncTaskManager();
                asyncTaskManager.TasksExecutionCompleted += new EventHandler(MSCRasterService.taskManager_TasksExecutionCompleted);
                asyncTaskManager.AddTask(exportTask);
                this.PendingRequestCount++;
                if (App.UseBeep)
                {
                    Console.Beep(196, 800);
                }
                asyncTaskManager.RunTasks();
                int   times    = 0;
                int   maxTimes = 200000;
                Timer timer    = new Timer
                {
                    Interval = 10,
                    Enabled  = true
                };
                timer.Tick += delegate(object s, EventArgs e)
                {
                    if (times++ >= maxTimes)
                    {
                        timer.Stop();
                        timer.Dispose();
                        timer = null;
                        times = 0;
                        this.PendingRequestCount--;
                        return;
                    }
                    if (!this.UpdateForm.IsReady())
                    {
                        return;
                    }
                    if (!this.CancelRequests && this.PendingRequestCount < 4)
                    {
                        if (this.UpdateForm.UpdateRasterNow())
                        {
                            this.CurrentExtent   = localEO.BoundingBox;
                            this.CurrentFileName = localEO.OutputFile;
                        }
                        this.OutstandingRequestInfo = null;
                        this.PendingRequestCount--;
                        timer.Stop();
                        timer.Dispose();
                        timer = null;
                        return;
                    }
                    this.OutstandingRequestInfo = null;
                    this.PendingRequestCount--;
                    timer.Stop();
                    timer.Dispose();
                    timer = null;
                };
                this.UpdateForm.SetReady(false);
            }
            catch (Exception)
            {
            }
        }
예제 #13
0
 public virtual ITask GetExportTask(AGSExportOptions eo, HiddenUpdateForm form)
 {
     throw new NotImplementedException();
 }
예제 #14
0
 public virtual bool ExportMapNow(AGSExportOptions eo, ExportImageEventHandler action, AGSExportOptions cancelOptions)
 {
     throw new NotImplementedException();
 }
        public object ESRI_FeatureService_set(ResultBuffer rb)
        {
            object result;

            try
            {
                if (null == Application.DocumentManager.MdiActiveDocument)
                {
                    result = null;
                }
                else
                {
                    string            argument = LspUtil.GetArgument(rb, 0, null);
                    MSCFeatureService mSCFeatureService;
                    if (!string.IsNullOrEmpty(argument))
                    {
                        mSCFeatureService = this.GetFeatureService(argument);
                    }
                    else
                    {
                        mSCFeatureService = this.GetCurrentFeatureService();
                    }
                    if (mSCFeatureService == null)
                    {
                        result = null;
                    }
                    else
                    {
                        AGSExportOptions exportOptions = mSCFeatureService.ExportOptions;
                        bool             assocParam    = LspUtil.GetAssocParam(rb, "EDITMODE", exportOptions.Dynamic);
                        Point2d          assocParam2   = LspUtil.GetAssocParam(rb, "EXTMIN", exportOptions.BoundingBox.MinPoint);
                        Point2d          assocParam3   = LspUtil.GetAssocParam(rb, "EXTMAX", exportOptions.BoundingBox.MaxPoint);
                        string           text          = MSCPrj.ReadWKT(Application.DocumentManager.MdiActiveDocument);
                        if (mSCFeatureService != null)
                        {
                            if (assocParam)
                            {
                                mSCFeatureService.QueryOnly = false;
                                mSCFeatureService.SetLayerLock(false);
                            }
                            else
                            {
                                mSCFeatureService.QueryOnly = true;
                                mSCFeatureService.SetLayerLock(true);
                            }
                            mSCFeatureService.ExportOptions.Dynamic   = assocParam;
                            mSCFeatureService.ExportOptions.OutputWKT = text;
                            Extent extent = new Extent(assocParam2, assocParam3);
                            if (extent.IsValid())
                            {
                                extent.SetWKTFrom(text);
                                mSCFeatureService.UpdateExtentLimit(extent);
                            }
                            mSCFeatureService.Write();
                            Mouse.OverrideCursor = null;
                            result = true;
                        }
                        else
                        {
                            result = null;
                        }
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }