ESRI.ArcGIS.ADF.IMS
PixelLimit Property
See Also  Example
ESRI.ArcGIS.ADF.IMS.Carto Namespace > ImageDescriptor Class : PixelLimit Property




Gets the maximum number of allowed pixels for the image.

Syntax

Visual Basic (Declaration) 
Public ReadOnly Property PixelLimit As Integer
Visual Basic (Usage)Copy Code
Dim instance As ImageDescriptor
Dim value As Integer
 
value = instance.PixelLimit
C# 
public int PixelLimit {get;}

Example

The following example sets the map image to a large size, then checks to see whether it fits within the pixel limit. If not, it sets the map to automatically resize. Then when the map is drawn, if it was resized, it resizes the image control to the dimensions of the resized map. Note that the Height and Width in ImageDescriptor are changed during the map draw when the map is resized.
C#Copy Code
// Create a map image with large height/width 

ESRI.ArcGIS.ADF.IMS.Carto.ImageDescriptor imageDescrip = mapView.ImageDescriptor; 

imageDescrip.Width = 5000; 

imageDescrip.Height = 5000; 

  

// Automatically resize the image if necessary 

imageDescrip.AutoResize = true; 

  

// Check whether image will be resized - store value which we'll use later 

bool imageResized = !imageDescrip.IsImageSizeValid; 

  

CartoImage resultImage = mapView.Draw(); 

  

// If the image was resized during draw, resize the image control where 

//    map is displayed, and show a warning message. 

if (imageResized) 



    imgMap.Height = new Unit(Convert.ToDouble(imageDescrip.Height)); 

    imgMap.Width = new Unit(Convert.ToDouble(imageDescrip.Width)); 

    lblOutputInfo.Text = String.Format("Warning: map image was resized to fit within " 

        + "image limits of {0} pixels.", imageDescrip.PixelLimit); 



imgMap.ImageUrl = resultImage.Url; 

    
Visual BasicCopy Code
' Create a map image With large height/width

Dim imageDescrip As ESRI.ArcGIS.ADF.IMS.Carto.ImageDescriptor = mapView.ImageDescriptor

imageDescrip.Width = 5000

imageDescrip.Height = 5000



' Automatically resize the image If necessary

imageDescrip.AutoResize = True



' Check whether image will be resized - store value which we'll use later

Dim imageResized As Boolean = Not(imageDescrip.IsImageSizeValid)



Dim resultImage As CartoImage = mapView.Draw()



' If the image was resized during draw, resize the image control where

' map Is displayed, And show a warning message.

If imageResized Then



    imgMap.Height = New Unit(Convert.ToDouble(imageDescrip.Height))

    imgMap.Width = New Unit(Convert.ToDouble(imageDescrip.Width))

    lblOutputInfo.Text = String.Format("Warning: map image was resized to fit within "

        + "image limits of {0} pixels.", imageDescrip.PixelLimit)

End If

imgMap.ImageUrl = resultImage.Url

Remarks

This read-only property is the maximum size for images, in pixels. The size is the Height times the Width. If the requested size, based on Height and Width, is larger than PixelLimit, the behavior depends on AutoResize. If AutoResize is true, then the map or image generated will be resized to fit within the PixelLimit size. If AutoResize is false, then an exception is thrown. If your application allows users to set output size, it is recommended to verify the size is within PixelLimit, or at minimum to catch errors that may be thrown. The image size can be checked with the IsImageSizeValid property.

This limit does not apply when generating layouts with a LayoutView and the ImageFormat is set to AI, EMF, EPS, PDF, or SVG.

The ArcIMS administrator sets the value for PixelLimit when creating the service, by setting the Image Memory Limit in the advanced properties of the map service. For more information on adjusting this limit, see ArcIMS Help.

See Also

© 2010 All Rights Reserved.