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 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");
     }
 }