arcgis javascript api学习6

Class: ImageParameters   

Description

Represents the image parameter options used when calling ArcGISDynamicMapServiceLayer.exportMapImage, Geoprocessor.getResultImage, and Geoprocessor.getResultImageLayer.  

Class hierarchy

esri.layers.ImageParameters

Constructor

Constructor Description
esri.layers.ImageParameters()

  Creates a new ImageParameters object. The constructor takes no parameters.

Properties

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.

Constants

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)



————————————————————————————————————————————————————————————

Description

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.

Code

<!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&nbsp;&nbsp;
          <input type='checkbox' class='list_item' id='1' value=1 onclick='updateLayerVisibility();'/>Rivers&nbsp;&nbsp;
        </span><br />
        <br />
    <div id="map" class="claro" style="width:600px; height:400px; border:1px solid #000;"></div>
  </body>
</html>

______________________________________________________________________________________________________________________

Class: InfoTemplate   

Description

An InfoTemplate contains a title and content template string used to transform  Graphic.attributes into an HTML representation (InfoTemplate包含标题和内容模板字符串,InfoTemplate用于把graphic.attributes翻译成html表达形式). The Dojo syntax ${<key>} performs the parameter substitution. In addition, a wildcard ${*} can be used as the template string. The wildcard prints out all of the attribute's name value pairs. The default behavior on a Graphic is to show the Map's  InfoWindow after a click on the Graphic (graphic上默认的行为是展示map的infowindow在点击这个graphic之后). An InfoTemplate is required for this default behavior (对于默认的行为InfoTemplate是必须的).

Class hierarchy

esri.InfoTemplate

Constructor

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.

Properties

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.
(infotemplate定义在infowindow中使用的内容如何展现)
(infotemplate定义在infowindow中使用的标题如何展现)
————————————————————————————————————————————————————————————————————————————
Class: InfoWindow   

Description

An InfoWindow is an HTML popup (InfoWindow是一个HTML的弹出框). It often contains the attributes of a  Graphic. (它常常包含一个graphic的attributes) The default behavior on a Graphic is to show the InfoWindow after a click on the Graphic (一个graphic的默认行为是在点击它之后展示infowindow). An  InfoTemplate is required for this default behavior. In addition, the InfoWindow can be used to display custom content on the map (除此之外,infowindow能被用来在地图上展示客户化的内容).

Class hierarchy

esri.dijit.InfoWindow

你可能感兴趣的:(JavaScript)