Example #1
0
        private MapImage GetMapImage(esriImageReturnType returnType)
        {
            MapDescription mapDescription = ((AgsDataFrame)DataFrame).MapServerInfo.NewMapDescription(Extent);

            mapDescription.SetAllLayersNotVisible();

            for (int i = 0; i < _layerList.Count; ++i)
            {
                AgsLayer layer = _layerList[i];
                string   query = _queryList[i];

                MapLayerInfo mapLayerInfo = layer.MapLayerInfo;

                while (mapLayerInfo != null)
                {
                    LayerDescription layerDescription = mapDescription.LayerDescriptions.First(ld => ld.LayerID == mapLayerInfo.LayerID);
                    layerDescription.Visible = true;

                    if (!String.IsNullOrEmpty(query))
                    {
                        layerDescription.DefinitionExpression = query;
                    }

                    mapLayerInfo = mapLayerInfo.Parent;
                    query        = null;
                }
            }

            ImageDescription imageDescription = new ImageDescription();

            imageDescription.ImageDisplay = new ImageDisplay(Convert.ToInt32(Width * Resolution), Convert.ToInt32(Height * Resolution), DataFrame.Dpi * Resolution);
            imageDescription.ImageType    = new ImageType(returnType);

            switch (ImageType)
            {
            case CommonImageType.Png:
                imageDescription.ImageType.ImageFormat = esriImageFormat.esriImagePNG32;

                if (TransparentBackground)
                {
                    mapDescription.TransparentColor = mapDescription.BackgroundSymbol.Color;
                }
                break;

            default:
                imageDescription.ImageType.ImageFormat = esriImageFormat.esriImageJPG;
                break;
            }

            return(_service.MapServer.ExportMapImage(mapDescription, imageDescription));
        }
Example #2
0
 public ImageType(esriImageReturnType returnType)
     : this(esriImageFormat.esriImageJPG, returnType)
 {
 }
Example #3
0
 public ImageType(esriImageFormat format, esriImageReturnType returnType)
 {
     ImageFormat     = format;
     ImageReturnType = returnType;
 }