コード例 #1
0
        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);
        }
コード例 #2
0
 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  = "";
 }
コード例 #3
0
 public AGSMapLayer(int id, AGSService map)
 {
     base.Id            = id;
     base.Service       = map;
     this.Map           = (base.Service as AGSMapService);
     this.ChildLayerIds = new List <int>();
     this.RefreshProperties();
 }
コード例 #4
0
        private static bool SpRefCompareAuthority(string aWKT, string bWKT)
        {
            int wKIDFromWKT = AGSService.GetWKIDFromWKT(aWKT);

            if (wKIDFromWKT == 0)
            {
                return(false);
            }
            int wKIDFromWKT2 = AGSService.GetWKIDFromWKT(bWKT);

            return(wKIDFromWKT2 != 0 && AGSService.SpWKIDAreEquivalent(wKIDFromWKT, wKIDFromWKT2));
        }
コード例 #5
0
 public static bool SpRefAreEquivalent(SpatialReference a, SpatialReference b)
 {
     if (a == null && b == null)
     {
         return(true);
     }
     if (a == null || b == null)
     {
         return(false);
     }
     if (a.WKIDSpecified && b.WKIDSpecified)
     {
         return(AGSService.SpWKIDAreEquivalent(a.WKID, b.WKID));
     }
     return(!string.IsNullOrEmpty(a.WKT) && !string.IsNullOrEmpty(b.WKT) && (a.WKT == b.WKT || AGSService.SpRefCompareAuthority(a.WKT, b.WKT)));
 }
コード例 #6
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");
     }
 }
コード例 #7
0
 public ExportedImage(AGSService map, string path)
 {
     this.Properties = new Dictionary <string, object>();
     this.Path       = path;
     this.Parent     = map;
 }
コード例 #8
0
        public RecordSet ProjectRecordSet(Envelope env, RecordSet rs, int geomFieldIndex, SpatialReference inSR, SpatialReference outSR)
        {
            if (geomFieldIndex < 0)
            {
                return(null);
            }
            if (rs == null)
            {
                return(null);
            }
            if (inSR == null || outSR == null)
            {
                return(rs);
            }
            if (AGSService.SpRefAreEquivalent(inSR, outSR))
            {
                return(rs);
            }
            RecordSet result;

            try
            {
                List <Geometry> list    = new List <Geometry>(rs.Records.Length);
                Record[]        records = rs.Records;
                for (int i = 0; i < records.Length; i++)
                {
                    Record   record   = records[i];
                    Geometry geometry = record.Values[geomFieldIndex] as Geometry;
                    if (geometry != null)
                    {
                        list.Add(geometry);
                    }
                }
                try
                {
                    Geometry[] inGeometryArray = list.ToArray();
                    Geometry[] array           = this._GeomServer.Project(inSR, outSR, true, null, env, inGeometryArray);
                    int        num             = 0;
                    Record[]   records2        = rs.Records;
                    for (int j = 0; j < records2.Length; j++)
                    {
                        Record record2 = records2[j];
                        record2.Values[geomFieldIndex] = array[num++];
                    }
                    result = rs;
                }
                catch
                {
                    if (base.Parent.Challenge())
                    {
                        this._GeomServer.Proxy       = WebRequest.DefaultWebProxy;
                        this._GeomServer.Credentials = base.Parent.Credentials;
                        if (this._GeomServer.Credentials == null)
                        {
                            this._GeomServer.UseDefaultCredentials = true;
                        }
                        try
                        {
                            Geometry[] inGeometryArray2 = list.ToArray();
                            Geometry[] array2           = this._GeomServer.Project(inSR, outSR, true, null, env, inGeometryArray2);
                            int        num2             = 0;
                            Record[]   records3         = rs.Records;
                            for (int k = 0; k < records3.Length; k++)
                            {
                                Record record3 = records3[k];
                                record3.Values[geomFieldIndex] = array2[num2++];
                            }
                            result = rs;
                            return(result);
                        }
                        catch
                        {
                            result = this.ProjectRecordSetCarefully(env, rs, geomFieldIndex, inSR, outSR);
                            return(result);
                        }
                    }
                    result = null;
                }
            }
            catch (Exception ex)
            {
                string arg_190_0 = ex.Message;
                result = this.ProjectRecordSetCarefully(env, rs, geomFieldIndex, inSR, outSR);
            }
            return(result);
        }