arcgis几何对象

时间:2022-12-01 19:55:24
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>几何对象测试</title>
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/dojo/dijit/themes/tundra/tundra.css" />
<link rel="stylesheet" href="http://js.arcgis.com/3.8/js/esri/css/esri.css" />
<link rel="stylesheet" href="js/webgis2book/widgets/themes/darkangel/darkangel.css" />
<link rel="stylesheet" href="js/webgis2book/widgets/themes/darkangel/override.css" />
<style>
html, body, #mapDiv {
padding: 0;
margin: 0;
width: 100%;
height: 100%;
}
</style>
<script>
var dojoConfig = {
isDebug: true,
async: true,
packages: [{
"name": "webgis2book",
"location": location.pathname.replace(/\/[^/]+$/, "") + "/js/webgis2book"
}]
};
</script>
<script src="http://js.arcgis.com/3.8/"></script>
<script>
var map, drawWidget = null; require(["dojo/parser", "dojo/topic", "dijit/registry",
"esri/map", "esri/layers/ArcGISTiledMapServiceLayer",
"webgis2book/widgets/DrawWidget", "webgis2book/widgets/Menu", "webgis2book/widgets/MenuItem",
"webgis2book/widgets/WidgetContainer", "webgis2book/widgets/MenuFrame",
"dojo/domReady!"],
function (parser, topic, registry, Map, ArcGISTiledMapServiceLayer, DrawWidget, Menu) {
parser.parse(); map = new Map("mapDiv");
var agoServiceURL = "http://server.arcgisonline.com/ArcGIS/rest/services/ESRI_StreetMap_World_2D/MapServer";
var agoLayer = new ArcGISTiledMapServiceLayer(agoServiceURL);
map.addLayer(agoLayer); createWidget();
createMenu(); function createWidget() {
drawWidget = new DrawWidget();
drawWidget.setTitle("绘图工具");
drawWidget.setMap(map);
drawWidget.startup();
} function createMenu() {
var menuFrame = registry.byId('menuFrame');
var logoUrl = require.toUrl("webgis2book/widgets/assets/images/logo.png");
menuFrame.setFrameIcon(logoUrl);
menuFrame.setTitle("菜单"); var params = { label: "工具", icon: "assets/images/icons/i_globe.png", id: "menuMap", positionAsPct: 20, visible: true };
var toolMenu = new Menu(params);
toolMenu.addMenuItem({ label: "小部件测试", icon: "assets/images/icons/i_highway.png", visible: true, onMenuItemClick: testMenuItemClick });
menuFrame.addChild(toolMenu);
toolMenu.startup();
} function testMenuItemClick(evt) {
topic.publish("showWidget", drawWidget);
} });
</script>
</head>
<body class="tundra">
<div id="mapDiv">
<div data-dojo-type="webgis2book/widgets/MenuFrame" id='menuFrame' style="left: 100px;"></div>
<div data-dojo-type="webgis2book/widgets/WidgetContainer" id='widgetContainer'></div>
</div>
</body>
</html>