<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>繪制點(diǎn)狀圖形</title>
<script type="text/javascript"> djConfig = { parseOnLoad: true }</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.7"></script>
<link rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="reference.css" />
<script type="text/javascript">
//將資源導(dǎo)入到頁(yè)面中
dojo.require("esri.map");
dojo.require("esri.toolbars.draw");
var map, toolbar, symbol, geomTask;
function init() {
//創(chuàng)建地圖對(duì)象
map = new esri.Map("map");
//注冊(cè)地圖加載完成事件
dojo.connect(map, "onLoad", createToolbar);
//向地圖中添加一個(gè)切片服務(wù)圖層
var baseLayer = new esri.layers.ArcGISTiledMapServiceLayer("http://gis.jl.gov.cn/RemoteRest/services/JLS_DLG_L6_L17/MapServer");
map.addLayer(baseLayer);
}
function createToolbar(map) {
//創(chuàng)建一個(gè)繪圖工具對(duì)象
toolbar = new esri.toolbars.Draw(map);
//注冊(cè)繪制完成事件
dojo.connect(toolbar, "onDrawEnd", addToMap);
}
function addToMap(geometry) {
//定義點(diǎn)狀圖形的符號(hào)
var symbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_CIRCLE, 10, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0]), 1), new dojo.Color([255, 0, 0, 0.75]));
//將繪制的點(diǎn)包裝成圖形對(duì)象并添加到地圖中
var graphic = new esri.Graphic(geometry, symbol);
map.graphics.add(graphic);
//取消繪圖操作
toolbar.deactivate();
}
function closeDiv() {
document.getElementById("div_float").style.display = "none";
toolbar.deactivate();
}
dojo.addOnLoad(init);
</script>
</head>
<body class="tundra">
<div id="map" style="width: 834px; height: 539px; border: 1px solid #000; float: left;">
<div class="none" id="div_float">
<div class="div_float_head">
<img src="images/ico_close.jpg" alt="" onclick="closeDiv()" />
<div class="div_float_logo" />
</div>
<div class="div_float_content" id="condition">
<table>
<tr>
<td style="width: auto">
<input class="btnbg" style="width: 80px;" onclick="toolbar.activate(esri.toolbars.Draw.POINT);"
type="button" value="添加點(diǎn)" />
</td>
</tr>
</table>
</div>
</div>
</div>
</body>
</html>