forked from banzor/WijMap
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbasic.html
228 lines (198 loc) · 9.63 KB
/
basic.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
<!doctype html>
<html lang="en">
<head>
<title>Wijmo + ESRI Map</title>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
<meta name="description" content="%description%" />
<meta name="keywords" content="" />
<meta name="author" content="ComponentOne" />
<link type="text/css" href="css/aristo/jquery-ui-1.8.4.custom.css" rel="stylesheet" />
<link href="css/jquery.wijmo-open.0.8.0.css" rel="stylesheet" type="text/css" />
<link href="css/jquery.wijmo-complete.0.8.0.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.5.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.bgiframe-2.1.1.js"></script>
<script type="text/javascript" src="js/jquery.glob.min.js"></script>
<script type="text/javascript" src="js/jquery.mousewheel.min.js"></script>
<script type="text/javascript" src="js/raphael.js"></script>
<script type="text/javascript" src="js/raphael-popup.js"></script>
<script src="js/jquery.wijmo-open.0.8.0.min.js" type="text/javascript"></script>
<script src="js/jquery.wijmo-complete.0.8.0.min.js" type="text/javascript"></script>
<!-- ArcGIS API for JavaScript -->
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=2.1compact"></script>
<script type="text/javascript">
/*************
* Dojo stuff
*************/
dojo.require("esri.map");
dojo.addOnLoad(init);
var map, tiledMapServiceLayer;
var streetMap, imageryPrime, shadedRelief, ngsTopoUS, boundariesWorld;
function init() {
var zoomSymbol = new esri.symbol.SimpleFillSymbol(esri.symbol.SimpleFillSymbol.STYLE_SOLID, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([20, 156, 255]), 1), new dojo.Color([141, 185, 219, 0.3]));
esriConfig.defaults.map.zoomSymbol = zoomSymbol.toJson();
var initialExtent = new esri.geometry.Extent({ "xmin": -8918366, "ymin": 4920346, "xmax": -8891613, "ymax": 4939455, "spatialReference": { "wkid": 102100} });
map = new esri.Map("map", { extent: initialExtent, slider: false });
// register for some map events
dojo.connect(map, "onLoad", function () {
console.log("Map onLoad event");
/*****************
* Hook up jQuery
*****************/
$(document).ready(jQueryReady);
});
dojo.connect(map, "onLayerAdd", function () {
console.log("Map onLayerAdd event");
});
dojo.connect(map, "onExtentChange", showExtent);
imageryPrime = new esri.layers.ArcGISTiledMapServiceLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Imagery/MapServer", { id: "imageryPrime" });
map.addLayer(imageryPrime);
shadedRelief = initLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Shaded_Relief/MapServer", "shadedRelief");
ngsTopoUS = initLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Topo_Map/MapServer", "ngsTopoUS");
boundariesWorld = initLayer("http://server.arcgisonline.com/ArcGIS/rest/services/Reference/World_Boundaries_and_Places/MapServer", "boundariesWorld");
streetMap = initLayer("http://server.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer", "streetMap");
}
function initLayer(url, id) {
var layer = new esri.layers.ArcGISTiledMapServiceLayer(url, { id: id, visible: false });
map.addLayer(layer);
return layer;
}
function changeMap(layers) {
hideImageTiledLayers(layers);
for (var i = 0; i < layers.length; i++) {
layers[i].show();
}
}
function hideImageTiledLayers(layers) {
for (var j = 0, jl = map.layerIds.length; j < jl; j++) {
var layer = map.getLayer(map.layerIds[j]);
if (dojo.indexOf(layers, layer) == -1) {
layer.hide();
}
}
}
function showExtent(extent) {
var s = "";
s = "XMin: " + extent.xmin.toFixed(2) + " "
+ "YMin: " + extent.ymin.toFixed(2) + " "
+ "XMax: " + extent.xmax.toFixed(2) + " "
+ "YMax: " + extent.ymax.toFixed(2);
dojo.byId("info").innerHTML = s;
}
/***************
* jQuery stuff
***************/
function jQueryReady() {
console.log("jQuery ready event");
// Create jQuery Slider
createSlider();
// Create and configure a jQuery Dialog for use as an info window
$("#dialog").wijdialog({
title: "Location",
autoOpen: false,
captionButtons: {
refresh: { visible: false },
toggle: { visible: false },
minimize: { visible: false },
maximize: { visible: false }
}
});
$("#flyoutmenu").wijmenu();
$("#tooltip").wijtooltip({
content: "You aren't here!"
});
var markerSymbol = new esri.symbol.SimpleMarkerSymbol(esri.symbol.SimpleMarkerSymbol.STYLE_X, 12, new esri.symbol.SimpleLineSymbol(esri.symbol.SimpleLineSymbol.STYLE_SOLID, new dojo.Color([255, 0, 0, 0.75]), 4));
var graphic;
dojo.connect(map, "onClick", function (evt) {
console.log("Map onClick event");
// Add a graphic at the clicked location
if (graphic) {
graphic.setGeometry(evt.mapPoint);
}
else {
graphic = new esri.Graphic(evt.mapPoint, markerSymbol);
map.graphics.add(graphic);
}
var content = "Latitude = ${y} <br/> Longitude = ${x}";
$("#dialog").wijdialog("option", "position", [evt.pageX + 10, evt.pageY + 10]);
$("#dialog").attr("innerHTML", esri.substitute(esri.geometry.webMercatorToGeographic(evt.mapPoint), content));
$("#dialog").wijdialog("open");
//$("#tooltip").wijtooltip("option", "position", { my: "top left", at: "top left", offset: (evt.pageX.toString() + ", " + evt.pageY.toString()) });
//$("#tooltip").wijtooltip("show");
});
dojo.connect(map, "onMouseDragStart", function (evt) {
$("#dialog").wijdialog("close");
});
dojo.connect(map, "onZoomStart", function (evt) {
$("#dialog").wijdialog("close");
});
}
function createSlider() {
$("#jqSlider").wijslider({
min: 0,
max: 17,
value: map.getLevel(),
orientation: "vertical",
change: function (event, ui) {
map.setLevel(ui.value);
}
});
dojo.connect(map, "onZoomEnd", function (evt) {
$("#jqSlider").wijslider("value", map.getLevel());
});
}
</script>
<style type="text/css">
/*demo page css*/
body
{
font-size: 12px;
}
</style>
</head>
<body class="demo-single">
<div class="container">
<div class="header">
<h2>
Wijmo + ESRI Map</h2>
</div>
<div class="main demo">
<!-- Begin demo markup --><a id="tooltip" href="" title="Woot!"></a>
<div id="map" class="ui-widget ui-widget-content ui-corner-all" style="position: relative; width: 700px; height: 500px;">
<div id="toolbar" style="position: absolute; left: 5px; top: 5px; z-index: 100;">
<ul id="flyoutmenu">
<li><a href="#"><span class="ui-icon ui-icon-image ui-wijmenu-icon-left"></span><span>Views</span></a>
<ul>
<li><a href="#" onclick="changeMap([imageryPrime]);">Imagery</a></li>
<li><a href="#" onclick="changeMap([imageryPrime,boundariesWorld]);">Imagery/Places</a></li>
<li><a href="#" onclick="changeMap([ngsTopoUS]);">Topographic Map</a></li>
<li><a href="#" onclick="changeMap([shadedRelief]);">Relief</a></li>
<li><a href="#" onclick="changeMap([streetMap]);">Street Map</a></li></ul>
</li>
</ul>
</div>
<div style="position: absolute; right: 20px; top: 20px; z-index: 100;">
<div id="jqSlider" style="height: 200px">
</div>
</div>
</div>
<br />
<div id="info" class="ui-widget-header ui-corner-all" style="width: 690px; text-align: center; padding: 5px; color: black;">
</div>
<p>
Click on the map to get location details.</p>
<!-- Div that will be used to render jQuery Dialog -->
<div id="dialog">
</div>
<!-- End demo markup -->
<div class="demo-options">
<!-- Begin options markup -->
<!-- End options markup -->
</div>
</div>
<div class="footer demo-description">
</div>
</div>
</body>
</html>