Class hierarchy
esri.layers.ImageParameters
Constructor | Description |
---|---|
esri.layers.ImageParameters() | Creates a new ImageParameters object. The constructor takes no parameters. |
Property | Type | Description |
---|---|---|
bbox | Extent | Extent of map to be exported. |
dpi | Number | Dots per inch setting for an ArcGISDynamicMapServiceLayer. |
format | String | Map image format. |
height | Number | Requested image height in pixels. |
imageSpatialReference | SpatialReference | Spatial reference of exported map. See Projected Coordinate Systems and Geographic Coordinate Systems for the list of supported spatial references. |
layerDefinitions | String[] | Array of layer definition expressions that allows you to filter the features of individual layers in the exported map image. Layer definitions with semicolons or colons are supported if using a map service published using ArcGIS Server 10. |
layerIds | Number[] | A list of layer ID's, that represent which layers to include in the exported map.Use in combination with layerOption to specify how layer visiblity is handled. (一个图层ids的列表,用于表达哪些layer包含在导出的map中。常常和layerOption结合使用来指定layer的可视性如何处理) |
layerOption | String | The option for displaying or hiding the layer. See the Constants table for valid values. (用于表达展现或者隐藏的选项,请查看常量表来确认合法的值) |
layerTimeOptions | LayerTimeOptions[] | Array of LayerTimeOptions objects that allow you to override how a layer is exported in reference to the map's time extent. There is one object per sub-layer. |
timeExtent | TimeExtent | The time extent for the map image. |
transparent | Boolean | Whether or not background of dynamic image is transparent. |
width | Number | Requested image width in pixels. |
Constant | Description |
---|---|
LAYER_OPTION_EXCLUDE | Shows all layers visible by default except the specified layer ID's. (默认展现所有的图层,除了指定的layer ids) |
LAYER_OPTION_HIDE | Shows all layers except the specified layer ID's. (展现所有的图层,除了指定的layer ids) |
LAYER_OPTION_INCLUDE | Shows specified layer ID's in addition to layers visible by default. (展现指定的图层,除了默认的图层) |
LAYER_OPTION_SHOW | Shows only the specified layer ID's. (仅仅展现指定的layer ids) |
————————————————————————————————————————————————————————————
This sample demonstrates how to explicitly create a list of layers in a map service. The list is comprised of HTML checkboxes that you can use to toggle the layers' visibility.
The function updateLayerVisibility() contains the logic that turns the layers on and off. It loops through each layer in the list, records whether the layer should be visible depending on the checkbox status, and updates the visibility accordingly using ArcGISDynamicMapServiceLayer.setVisibleLayers().
If you are interested in creating a layer list automatically from all the layers in the map service, see the sample Dynamically create layer list.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=7" />
<!--The viewport meta tag is used to improve the presentation and behavior of the samples
on iOS devices-->
<meta name="viewport" content="initial-scale=1, maximum-scale=1,user-scalable=no"/>
<title>Explicitly Create Map Service Layer List</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/2.1/js/dojo/dijit/themes/claro/claro.css">
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1"></script>
<script type="text/javascript">
dojo.require("esri.map");
var layer, map, visible = [];
function init() {
map = new esri.Map("map");
//Use the ImageParameters to set the visible layers in the map service during ArcGISDynamicMapServiceLayer construction.
(在
ArcGISDynamicMapServiceLayer的构造函数中
使用ImageParameters来设置map service中图层的可视性)
var imageParameters = new esri.layers.ImageParameters();
imageParameters.layerIds = [2];
imageParameters.layerOption = esri.layers.ImageParameters.LAYER_OPTION_SHOW;
//can also be: LAYER_OPTION_EXCLUDE, LAYER_OPTION_HIDE, LAYER_OPTION_INCLUDE
(也可以是:
LAYER_OPTION_EXCLUDE, LAYER_OPTION_HIDE, LAYER_OPTION_INCLUDE
)
layer = new esri.layers.ArcGISDynamicMapServiceLayer("http://sampleserver1.arcgisonline.com/ArcGIS/rest/services/Specialty/ESRI_StatesCitiesRivers_USA/MapServer", {"imageParameters":imageParameters});
map.addLayer(layer);
}
function updateLayerVisibility() {
var inputs = dojo.query(".list_item"), input;
//in this application layer 2 is always on.
visible = [2];
for (var i=0, il=inputs.length; i<il; i++) {
if (inputs[i].checked) {
visible.push(inputs[i].id);
}
}
layer.setVisibleLayers(visible);
}
dojo.addOnLoad(init);
</script>
</head>
<body>
This sample loads an ArcGISDynamicMapServiceLayer and presents check boxes for only the layers that should be toggled on and off by users. <br />
<br />
Layer List : <span id="layer_list"><input type='checkbox' class='list_item' id='0' value=0 onclick='updateLayerVisibility();'/>Cities
<input type='checkbox' class='list_item' id='1' value=1 onclick='updateLayerVisibility();'/>Rivers
</span><br />
<br />
<div id="map" class="claro" style="width:600px; height:400px; border:1px solid #000;"></div>
</body>
</html>
______________________________________________________________________________________________________________________
esri.InfoTemplate
Constructor | Description |
---|---|
esri.InfoTemplate() | Creates a new empty InfoTemplate object. |
esri.InfoTemplate(title, content) | Creates a new InfoTemplate object. All parameters are required and must be specified in the order given. |
esri.InfoTemplate(json) | Creates a new InfoTemplate object using a JSON object. |
Property | Type | Description |
---|---|---|
content | String | The template for defining how to format the content used in an InfoWindow. |
title | String | The template for defining how to format the title used in an InfoWindow. |
esri.dijit.InfoWindow