コード例 #1
0
        protected bool RequestUpdate(Extent viewExtent, bool forceRefresh)
        {
            if (!this.ParentServiceConnected)
            {
                return(false);
            }
            Extent extent = Extent.Intersect(viewExtent, this.BoundaryExtent);

            if (!extent.IsValid())
            {
                return(false);
            }
            if (string.IsNullOrEmpty(extent.SpatialReference))
            {
                extent.SpatialReference = this.BoundaryExtent.SpatialReference;
            }
            if (!forceRefresh && this.CurrentExtent != null && this.CurrentExtent.Equals(extent))
            {
                return(false);
            }
            if (!this.ParentDataset.ParentDocument.Editor.IsQuiescent && DocUtil.GetDimensionalInputEnabled())
            {
                return(false);
            }
            this.RequestNewRaster(extent);
            this.OutstandingRequestInfo = viewExtent;
            return(true);
        }
コード例 #2
0
 public bool UpdateExtentLimit(Extent ext)
 {
     if (ext.IsValid() && ext.SpatialReference != null)
     {
         this.BoundaryExtent = ext;
         return(true);
     }
     return(false);
 }
コード例 #3
0
        private bool ValidateExtent(Extent ext)
        {
            bool result;

            try
            {
                result = ext.IsValid();
            }
            catch
            {
                result = false;
            }
            return(result);
        }
コード例 #4
0
        protected bool RequestUpdateNow()
        {
            if (!this.ParentServiceConnected)
            {
                return(false);
            }
            Extent extent  = new Extent(this.ParentDataset.ParentDocument);
            Extent extent2 = Extent.Intersect(extent, this.BoundaryExtent);

            if (!extent2.IsValid())
            {
                return(false);
            }
            this.RequestNewRasterNow(extent2);
            this.OutstandingRequestInfo = extent;
            return(true);
        }
コード例 #5
0
 public bool PopulateProperties(IDictionary <string, object> results)
 {
     try
     {
         this.Properties.Add("ID", this.Id);
         object obj;
         if (results.TryGetValue("name", out obj))
         {
             this.Properties.Add("Layer Name", obj);
         }
         if (results.TryGetValue("type", out obj))
         {
             this.Properties.Add("Type", obj);
             if (obj.ToString() == "Feature Layer")
             {
                 this.IsFeatureLayer = true;
             }
             else
             {
                 this.IsFeatureLayer = false;
             }
         }
         if (results.TryGetValue("geometryType", out obj) && obj != null)
         {
             this.Properties.Add("Geometry Type", obj);
             this.GeometryType = (obj as string);
         }
         if (results.TryGetValue("capabilities", out obj))
         {
             string value = obj as string;
             this.Properties.Add("Capabilities", value);
         }
     }
     catch
     {
         bool result = false;
         return(result);
     }
     try
     {
         object obj;
         if (results.TryGetValue("description", out obj))
         {
             string value2 = obj as string;
             if (!string.IsNullOrEmpty(value2))
             {
                 this.Properties.Add("Description", obj);
             }
         }
         if (results.TryGetValue("copyrightText", out obj))
         {
             string value3 = obj as string;
             if (!string.IsNullOrEmpty(value3))
             {
                 this.Properties.Add("Copyright", obj);
             }
         }
         if (results.TryGetValue("definitionExpression", out obj))
         {
             this.Properties.Add("Definition Expression", obj);
         }
         if (results.TryGetValue("parentLayer", out obj))
         {
             IDictionary <string, object> dictionary = obj as IDictionary <string, object>;
             if (dictionary != null)
             {
                 StringBuilder stringBuilder = new StringBuilder();
                 foreach (KeyValuePair <string, object> arg_196_0 in dictionary)
                 {
                     object obj2;
                     if (dictionary.TryGetValue("id", out obj2))
                     {
                         stringBuilder.AppendFormat("ID: {0}", obj2);
                         this.parentLayerId = (int)obj2;
                     }
                     if (dictionary.TryGetValue("name", out obj2))
                     {
                         stringBuilder.AppendFormat(", Name: {0}", obj2);
                     }
                 }
                 if (stringBuilder.Length > 0)
                 {
                     this.Properties.Add("Parent Layer", stringBuilder);
                 }
             }
         }
         results.TryGetValue("relationships", out obj);
         if (results.TryGetValue("minScale", out obj))
         {
             this.Properties.Add("Minimum Scale", obj);
         }
         if (results.TryGetValue("maxScale", out obj))
         {
             this.Properties.Add("Maximum Scale", obj);
         }
         if (results.TryGetValue("extent", out obj))
         {
             try
             {
                 IDictionary <string, object> dictionary2 = obj as IDictionary <string, object>;
                 if (dictionary2 != null)
                 {
                     Extent extent = new Extent(dictionary2);
                     if (extent.IsValid())
                     {
                         this.Properties.Add("Extent", extent);
                     }
                 }
             }
             catch
             {
             }
         }
         if (results.TryGetValue("drawingInfo", out obj))
         {
             try
             {
                 if (obj != null)
                 {
                     IDictionary <string, object> dictionary3 = obj as IDictionary <string, object>;
                     foreach (KeyValuePair <string, object> current in dictionary3)
                     {
                         if (current.Key == "renderer")
                         {
                             IDictionary <string, object> dictionary4 = current.Value as IDictionary <string, object>;
                             object obj3;
                             if (dictionary4.TryGetValue("type", out obj3))
                             {
                                 string a = obj3 as string;
                                 this.Renderer = null;
                                 if (a == "simple")
                                 {
                                     this.Renderer = new AGSSimpleRenderer(dictionary4);
                                 }
                                 else if (a == "uniqueValue")
                                 {
                                     this.Renderer = new AGSUniqueValueRenderer(dictionary4);
                                 }
                                 else if (a == "classBreaks")
                                 {
                                     this.Renderer = new AGSClassBreaksRenderer(dictionary4);
                                 }
                                 if (this.Renderer != null)
                                 {
                                     this.Properties.Add("Renderer", this.Renderer);
                                 }
                             }
                         }
                         else if (current.Key == "transparency")
                         {
                             this.Properties.Add("Transparency", current.Value);
                         }
                         else if (current.Key == "labellingInfo")
                         {
                             IDictionary <string, object> dictionary5 = current.Value as IDictionary <string, object>;
                             foreach (KeyValuePair <string, object> current2 in dictionary5)
                             {
                                 if (current2.Key == "labelPlacement")
                                 {
                                     this.Properties.Add("Renderer Label Placement", current2.Value);
                                 }
                                 else if (current2.Key == "labelExpression")
                                 {
                                     this.Properties.Add("Renderer Label Expression", current2.Value);
                                 }
                                 else if (current2.Key == "useCodedValues")
                                 {
                                     this.Properties.Add("Renderer Label Uses Coded Values", current2.Value);
                                 }
                             }
                         }
                     }
                 }
             }
             catch
             {
             }
         }
         if (results.TryGetValue("htmlPopupType", out obj))
         {
             this.Properties.Add("HTML Popup Type", obj);
         }
         if (results.TryGetValue("objectIdField", out obj))
         {
             this.Properties.Add("Object Id Field", obj);
         }
         if (results.TryGetValue("globalIdField", out obj))
         {
             string value4 = obj as string;
             if (!string.IsNullOrEmpty(value4))
             {
                 this.Properties.Add("Global Id Field", obj);
             }
         }
         if (results.TryGetValue("displayField", out obj))
         {
             this.Properties.Add("Display Field", obj);
             this.DisplayField = (obj as string);
         }
         if (results.TryGetValue("fields", out obj) && obj != null)
         {
             this.BuildFields(obj as IList <object>);
             int num = 1;
             foreach (KeyValuePair <string, AGSField> current3 in this.Fields)
             {
                 if (current3.Value != null)
                 {
                     this.Properties.Add("Field " + num.ToString(), current3.Value.ToString());
                     num++;
                 }
             }
         }
         if (results.TryGetValue("typeIdField", out obj))
         {
             this.Properties.Add("Type Id Field", obj);
             this.TypeIDField = (string)obj;
         }
         if (results.TryGetValue("types", out obj) && obj != null)
         {
             IList <object> list = obj as IList <object>;
             this.Subtypes = new SubTypeDictionary();
             using (IEnumerator <object> enumerator5 = list.GetEnumerator())
             {
                 while (enumerator5.MoveNext())
                 {
                     IDictionary <string, object> dictionary6 = (IDictionary <string, object>)enumerator5.Current;
                     if (dictionary6 != null)
                     {
                         AGSSubType aGSSubType = new AGSSubType();
                         aGSSubType.Initialize(dictionary6 as Dictionary <string, object>);
                         this.Subtypes.Add(aGSSubType.Name, aGSSubType);
                     }
                 }
             }
             this.Properties.Add("Subtypes", this.Subtypes);
         }
         if (this.Fields != null && !string.IsNullOrEmpty(this.TypeIDField) && this.Fields.ContainsKey(this.TypeIDField))
         {
             this.Fields[this.TypeIDField].IsTypeField = true;
         }
     }
     catch (SystemException)
     {
         bool result = false;
         return(result);
     }
     return(true);
 }
コード例 #6
0
        private void PopulateProperties(IDictionary <string, object> results)
        {
            string text = "";

            base.Properties.Add("Type", "Image Server");
            object obj;

            if (results.TryGetValue("serviceDescription", out obj))
            {
                string value = obj as string;
                if (!string.IsNullOrEmpty(value))
                {
                    base.Properties.Add("Service Description", value);
                }
            }
            if (results.TryGetValue("name", out obj))
            {
                string value2 = obj as string;
                if (!string.IsNullOrEmpty(value2))
                {
                    base.Properties.Add("Image Name", value2);
                }
            }
            if (results.TryGetValue("description", out obj))
            {
                string value3 = obj as string;
                if (!string.IsNullOrEmpty(value3))
                {
                    base.Properties.Add("Description", value3);
                }
            }
            if (results.TryGetValue("copyrightText", out obj))
            {
                string value4 = obj as string;
                if (!string.IsNullOrEmpty(value4))
                {
                    base.Properties.Add("Copyright", value4);
                }
            }
            if (results.TryGetValue("objectIdField", out obj))
            {
                string value5 = (string)obj;
                if (!string.IsNullOrEmpty(value5))
                {
                    base.Properties.Add("Object ID Field", value5);
                }
                this.Version = "10.0";
            }
            if (results.TryGetValue("currentVersion", out obj))
            {
                string text2 = obj.ToString();
                if (!string.IsNullOrEmpty(text2))
                {
                    this.Version = text2;
                }
            }
            if (results.TryGetValue("initialExtent", out obj))
            {
                IDictionary <string, object> dict = obj as IDictionary <string, object>;
                Extent extent = new Extent(dict);
                if (extent.IsValid())
                {
                    base.Properties.Add("Initial Extent", extent);
                }
            }
            if (results.TryGetValue("fullExtent", out obj))
            {
                IDictionary <string, object> dict2 = obj as IDictionary <string, object>;
                Extent extent2 = new Extent(dict2);
                if (extent2.IsValid())
                {
                    base.Properties.Add("Full Extent", extent2);
                }
            }
            if (results.TryGetValue("extent", out obj) && obj != null)
            {
                IDictionary <string, object> dict3 = obj as IDictionary <string, object>;
                Extent extent3 = new Extent(dict3);
                text = extent3.SpatialReference;
                if (extent3.IsValid())
                {
                    base.Properties.Add("Extent", extent3);
                }
            }
            if (results.TryGetValue("pixelSizeX", out obj))
            {
                try
                {
                    base.Properties.Add("Pixel Size X", obj.ToString());
                }
                catch
                {
                }
            }
            if (results.TryGetValue("pixelSizeY", out obj))
            {
                try
                {
                    base.Properties.Add("Pixel Size Y", obj.ToString());
                }
                catch
                {
                }
            }
            if (results.TryGetValue("bandCount", out obj))
            {
                try
                {
                    int num = (int)obj;
                    base.Properties.Add("Band Count", num.ToString());
                }
                catch
                {
                }
            }
            if (results.TryGetValue("pixelType", out obj))
            {
                try
                {
                    string value6 = obj as string;
                    base.Properties.Add("Pixel Type", value6);
                }
                catch
                {
                }
            }
            if (results.TryGetValue("minPixelSize", out obj))
            {
                try
                {
                    base.Properties.Add("Min Pixel Size", obj.ToString());
                }
                catch
                {
                }
            }
            if (results.TryGetValue("maxPixelSize", out obj))
            {
                try
                {
                    base.Properties.Add("Max Pixel Size", obj.ToString());
                }
                catch
                {
                }
            }
            if (results.TryGetValue("serviceDataType", out obj))
            {
                try
                {
                    string value7 = (string)obj;
                    if (!string.IsNullOrEmpty(value7))
                    {
                        base.Properties.Add("Service Data Type", value7);
                    }
                }
                catch
                {
                }
            }
            if (results.TryGetValue("supportedImageFormatTypes", out obj))
            {
                StringList stringList = new StringList();
                string     text3      = obj as string;
                string[]   array      = text3.Split(new char[]
                {
                    ','
                });
                string[] array2 = array;
                for (int i = 0; i < array2.Length; i++)
                {
                    string text4 = array2[i];
                    if (DocUtil.CADSupportedImageFormats.Contains(text4.ToUpper()))
                    {
                        stringList.Add(text4);
                    }
                }
                base.SupportedImageTypes = stringList;
            }
            else
            {
                base.SupportedImageTypes = new StringList();
                string[] cADSupportedImageFormats = DocUtil.CADSupportedImageFormats;
                for (int j = 0; j < cADSupportedImageFormats.Length; j++)
                {
                    string item = cADSupportedImageFormats[j];
                    base.SupportedImageTypes.Add(item);
                }
            }
            if (results.TryGetValue("capabilities", out obj))
            {
                string value8 = obj as string;
                base.Properties.Add("Capabilities", value8);
            }
            if (results.TryGetValue("fields", out obj) && obj != null)
            {
                this.BuildFields(obj as IList <object>);
                int num2 = 1;
                foreach (KeyValuePair <string, AGSField> current in this.Fields)
                {
                    if (current.Value != null)
                    {
                        base.Properties.Add("Field " + num2.ToString(), current.Value.ToString());
                        num2++;
                    }
                }
            }
            if (results.TryGetValue("spatialReference", out obj))
            {
                IDictionary <string, object> dictionary = obj as IDictionary <string, object>;
                if (dictionary.ContainsKey("wkid"))
                {
                    object value9;
                    dictionary.TryGetValue("wkid", out value9);
                    base.Properties.Add("WKID", value9);
                }
                if (dictionary.ContainsKey("wkt"))
                {
                    object value10;
                    dictionary.TryGetValue("wkt", out value10);
                    base.Properties.Add("WKT", value10);
                    return;
                }
            }
            else if (!string.IsNullOrEmpty(text))
            {
                int num3;
                if (int.TryParse(text, out num3))
                {
                    base.Properties.Add("WKID", num3);
                    return;
                }
                base.Properties.Add("WKT", text);
            }
        }
コード例 #7
0
        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);
        }
コード例 #8
0
        public object ESRI_Image_Update(ResultBuffer rb)
        {
            object result;

            try
            {
                if (null == Application.DocumentManager.MdiActiveDocument)
                {
                    result = null;
                }
                else
                {
                    string          argument = LspUtil.GetArgument(rb, 0, null);
                    MSCImageService mSCImageService;
                    if (!string.IsNullOrEmpty(argument))
                    {
                        mSCImageService = this.GetImageService(argument);
                    }
                    else
                    {
                        mSCImageService = AfaDocData.ActiveDocData.CurrentImageService;
                    }
                    if (mSCImageService == null)
                    {
                        result = null;
                    }
                    else
                    {
                        short   num         = short.Parse(mSCImageService.GetTransparency().ToString());
                        Point2d minPoint    = mSCImageService.ExportOptions.BoundingBox.MinPoint;
                        Point2d maxPoint    = mSCImageService.ExportOptions.BoundingBox.MaxPoint;
                        bool    assocParam  = LspUtil.GetAssocParam(rb, "DYNAMIC", mSCImageService.Dynamic);
                        bool    assocParam2 = LspUtil.GetAssocParam(rb, "VISIBLE", mSCImageService.GetVisibility());
                        short   assocParam3 = LspUtil.GetAssocParam(rb, "TRANSPARENCY", num);
                        Point2d assocParam4 = LspUtil.GetAssocParam(rb, "EXTMIN", minPoint);
                        Point2d assocParam5 = LspUtil.GetAssocParam(rb, "EXTMAX", maxPoint);
                        string  assocParam6 = LspUtil.GetAssocParam(rb, "FORMAT", mSCImageService.ExportOptions.Format);
                        string  text        = MSCPrj.ReadWKT(Application.DocumentManager.MdiActiveDocument);
                        if (mSCImageService != null)
                        {
                            mSCImageService.SetVisbility(assocParam2);
                            if (assocParam3 != num)
                            {
                                mSCImageService.SetTransparency((int)assocParam3);
                            }
                            if (assocParam != mSCImageService.Dynamic)
                            {
                                mSCImageService.Dynamic = assocParam;
                            }
                            mSCImageService.ExportOptions.Format    = assocParam6;
                            mSCImageService.ExportOptions.OutputWKT = text;
                            Extent extent = new Extent(assocParam4, assocParam5);
                            if (extent.IsValid())
                            {
                                extent.SetWKTFrom(text);
                                mSCImageService.UpdateExtentLimit(extent);
                            }
                            mSCImageService.Write();
                            mSCImageService.RefreshService();
                            Mouse.OverrideCursor = null;
                            result = true;
                        }
                        else
                        {
                            result = null;
                        }
                    }
                }
            }
            catch
            {
                result = null;
            }
            return(result);
        }
コード例 #9
0
        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);
        }
コード例 #10
0
        public object ESRI_AddFeatureService(ResultBuffer rb)
        {
            if (null == Application.DocumentManager.MdiActiveDocument)
            {
                return(null);
            }
            string  assocParam  = LspUtil.GetAssocParam(rb, "URL", null);
            string  assocParam2 = LspUtil.GetAssocParam(rb, "EDITMODE", "EDIT");
            Point2d assocParam3 = LspUtil.GetAssocParam(rb, "EXTMIN", Point2d.Origin);
            Point2d assocParam4 = LspUtil.GetAssocParam(rb, "EXTMAX", Point2d.Origin);
            string  assocParam5 = LspUtil.GetAssocParam(rb, "LAYERIDS", "");
            bool    assocParam6 = LspUtil.GetAssocParam(rb, "EXTRACT", false);

            if (string.IsNullOrEmpty(assocParam))
            {
                return(null);
            }
            object result;

            try
            {
                Mouse.OverrideCursor = Cursors.Wait;
                string            text = MSCPrj.ReadWKT(Application.DocumentManager.MdiActiveDocument);
                AGSFeatureService aGSFeatureService = AGSFeatureService.BuildFeatureServiceFromURL(null, assocParam);
                if (aGSFeatureService != null)
                {
                    if (string.IsNullOrEmpty(text))
                    {
                        text = MSCPrj.AssignWKT(AfaDocData.ActiveDocData.Document, aGSFeatureService.GetWKT());
                    }
                    if (assocParam2 != "EDIT")
                    {
                        aGSFeatureService.ExportOptions.Dynamic = false;
                    }
                    Extent extent = new Extent(assocParam3, assocParam4);
                    aGSFeatureService.ExportOptions.OutputWKT = text;
                    if (extent.IsValid())
                    {
                        extent.SetWKTFrom(text);
                        aGSFeatureService.ExportOptions.BoundingBox = extent;
                    }
                    List <int> layerList = null;
                    bool       flag;
                    if (!string.IsNullOrEmpty(assocParam5))
                    {
                        string[] array = assocParam5.Split(new char[]
                        {
                            ','
                        });
                        int[] collection = Array.ConvertAll <string, int>(array, new Converter <string, int>(int.Parse));
                        layerList = new List <int>(collection);
                        if (assocParam6)
                        {
                            flag = aGSFeatureService.ExtractService(layerList);
                        }
                        else
                        {
                            flag = aGSFeatureService.AddService(layerList);
                        }
                    }
                    else if (assocParam6)
                    {
                        flag = aGSFeatureService.ExtractService(layerList);
                    }
                    else
                    {
                        flag = aGSFeatureService.AddService(layerList);
                    }
                    Mouse.OverrideCursor = null;
                    if (flag)
                    {
                        result = true;
                    }
                    else
                    {
                        result = false;
                    }
                }
                else
                {
                    Mouse.OverrideCursor = null;
                    result = null;
                }
            }
            catch
            {
                Mouse.OverrideCursor = null;
                result = null;
            }
            return(result);
        }
コード例 #11
0
        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);
        }