private string BuildRequestSpatialRefString(string tag, string spRefString)
        {
            string result;

            try
            {
                StringBuilder stringBuilder = new StringBuilder();
                if (!string.IsNullOrEmpty(spRefString) && spRefString != "<Unknown>" && spRefString != "<Undefined>")
                {
                    if (AGSImageService.IsInteger(spRefString))
                    {
                        stringBuilder.AppendFormat("&{0}={1}", tag, spRefString);
                    }
                    else
                    {
                        stringBuilder.AppendFormat("&{0}={{\"wkt\" : \"{1}\"}}", tag, this.ReplaceQuotes(spRefString));
                    }
                }
                string text = "";
                text  += stringBuilder;
                result = text;
            }
            catch
            {
                result = "";
            }
            return(result);
        }
        public static AGSImageService BuildImageServiceFromURL(string Name, string URL)
        {
            AGSImageService aGSImageService = null;
            AGSImageService result;

            try
            {
                string text = AGSConnection.BuildConnectionURL(URL);
                if (string.IsNullOrEmpty(text))
                {
                    result = aGSImageService;
                }
                else
                {
                    AGSConnection aGSConnection = AGSConnection.ReestablishConnection(text, null, "");
                    if (aGSConnection != null)
                    {
                        try
                        {
                            string name = AGSImageService.BuildFullNameFromURL(URL);
                            if (string.IsNullOrEmpty(Name))
                            {
                                Name = AGSImageService.BuildNameFromURL(URL);
                            }
                            aGSImageService      = new AGSImageService(name, aGSConnection);
                            aGSImageService.Name = Name;
                            if (aGSImageService.IsValid)
                            {
                                result = aGSImageService;
                                return(result);
                            }
                            result = null;
                            return(result);
                        }
                        catch
                        {
                            result = null;
                            return(result);
                        }
                    }
                    result = null;
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }
示例#3
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;
     }
 }
示例#4
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");
     }
 }
示例#5
0
        private bool PopulateChildren(IDictionary <string, object> results)
        {
            if (results == null)
            {
                return(false);
            }
            if (this.Parent.ReportCheckCancel())
            {
                this.EmptyChildren();
                return(true);
            }
            bool result;

            try
            {
                if (results.ContainsKey("services"))
                {
                    string text = "";
                    IEnumerable <object> enumerable = results["services"] as IEnumerable <object>;
                    using (IEnumerator <object> enumerator = enumerable.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            IDictionary <string, object> dictionary = (IDictionary <string, object>)enumerator.Current;
                            if (this.Parent.ReportCheckCancel())
                            {
                                this.EmptyChildren();
                                result = true;
                                return(result);
                            }
                            if (dictionary.ContainsKey("url"))
                            {
                                text = AGSFolder.RestToSoapURL(dictionary["url"] as string);
                            }
                            if (dictionary.ContainsKey("name"))
                            {
                                string text2    = dictionary["name"] as string;
                                string fileName = Path.GetFileName(text2);
                                this.Parent.ReportExportStatus(AfaStrings.ReadingServiceDetailsFrom + fileName);
                                IAGSService iAGSService = null;
                                try
                                {
                                    string a = dictionary["type"] as string;
                                    if (a == "MapServer")
                                    {
                                        iAGSService = new AGSMapService(text2, text, this.Parent);
                                    }
                                    else if (a == "FeatureServer")
                                    {
                                        iAGSService = new AGSFeatureService(text2, text, this.Parent);
                                    }
                                    else if (a == "ImageServer")
                                    {
                                        iAGSService = new AGSImageService(text2, this.Parent);
                                    }
                                    else if (a == "GeometryServer")
                                    {
                                        if (string.IsNullOrEmpty(text))
                                        {
                                            text = this.Parent.Soap_URL + "/" + text2 + "/GeometryServer";
                                        }
                                        this.Parent.GeometryService = new AGSGeometryServer(this.Parent, text);
                                    }
                                }
                                catch
                                {
                                    iAGSService = null;
                                }
                                if (iAGSService != null)
                                {
                                    this.Children.Add(iAGSService);
                                }
                            }
                        }
                    }
                }
                if (results.ContainsKey("folders"))
                {
                    IEnumerable <object> enumerable2 = results["folders"] as IEnumerable <object>;
                    using (IEnumerator <object> enumerator2 = enumerable2.GetEnumerator())
                    {
                        while (enumerator2.MoveNext())
                        {
                            string     text3      = (string)enumerator2.Current;
                            string     uRL        = this.URL + "/" + text3;
                            IAGSFolder iAGSFolder = new AGSFolder(text3, uRL, this.Parent);
                            this.Parent.ReportExportStatus(AfaStrings.ReadingServicesInFolder + text3);
                            if (this.Parent.ReportCheckCancel())
                            {
                                this.EmptyChildren();
                                result = true;
                                return(result);
                            }
                            iAGSFolder.LoadChildren();
                            if (this.Parent.ReportCheckCancel())
                            {
                                this.EmptyChildren();
                                result = true;
                                return(result);
                            }
                            this.Children.Add(iAGSFolder);
                        }
                    }
                }
                result = true;
            }
            catch (SystemException)
            {
                this.EmptyChildren();
                result = false;
            }
            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);
        }