public MSCMapService(MSCDataset parentDataset, AGSMapService parentMap, AGSExportOptions eo)
 {
     this.ParentService = (AGSMapService)Utility.CloneObject(parentMap);
     base.ParentDataset = parentDataset;
     try
     {
         base.ConnectionURL   = this.ParentService.Parent.Soap_URL;
         base.UserName        = this.ParentService.Parent.UserName;
         this.ServiceFullName = this.ParentService.FullName;
         base.ConnectionURL   = this.ParentService.Parent.Soap_URL;
         base.UserName        = this.ParentService.Parent.UserName;
         base.ConnectionName  = this.ParentService.Parent.Name;
         this.InitializeLayers();
         base.ExportOptions   = eo;
         base.CurrentFileName = eo.OutputFile;
         this.UpdateForm      = new HiddenUpdateForm(base.ParentDataset.ParentDocument);
         base.StartReactors();
         AfaDocData.ActiveDocData.CurrentMapService = this;
     }
     catch (SystemException ex)
     {
         this.ErrorMessage = ex.Message;
     }
 }
Ejemplo n.º 2
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_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);
        }