arcgis javascript api學習6

來源:互聯網
上載者:User
Class: ImageParameters  Description Represents the image parameter options used when calling ArcGISDynamicMapServiceLayer.exportMapImage, Geoprocessor.getResultImage, and Geoprocessor.getResultImageLayer. (在調用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  DescriptionAn 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  DescriptionAn 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
相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.