forked from dmuthami/ilex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
baseMapwidget.html
101 lines (87 loc) · 4.02 KB
/
baseMapwidget.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
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=7,IE=9" />
<!--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>Basemap with Thumbnail Picker</title>
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.0/js/dojo/dijit/themes/claro/claro.css">
<link rel="stylesheet" type="text/css" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.0/js/dojo/dojox/image/resources/image.css">
<style>
html, body { height: 100%; width: 100%; margin: 0; padding: 0; }
#map{padding:0;}
#thumbPickerDiv{
border:solid 1px #79663b;
-moz-border-radius: 6px;
-webkit-border-radius: 6px;
}
</style>
<script type="text/javascript">var djConfig = {parseOnLoad: true};</script>
<script type="text/javascript" src="http://serverapi.arcgisonline.com/jsapi/arcgis/?v=3.0"></script>
<script type="text/javascript">
dojo.require("esri.map");
dojo.require("dijit.form.Button");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("esri.dijit.BasemapGallery");
dojo.require("dojox.image.ThumbnailPicker");
dojo.require("dojo.data.ItemFileReadStore");
dojo.require("esri.layers.osm");
var map,basemapGallery;
function init() {
var initExtent = new esri.geometry.Extent({"xmin":-17307789,"ymin":-5390950,"xmax":3884224,"ymax":-9783,"spatialReference":{"wkid":102100}});
map = new esri.Map("map",{extent:initExtent});
createBasemapGallery();
dojo.connect(map, 'onLoad', function(theMap) {
//resize the map when the browser resizes
dojo.connect(dijit.byId('map'), 'resize', map,map.resize);
});
}
function createBasemapGallery(){
basemapGallery = new esri.dijit.BasemapGallery({
showArcGISBasemaps: true,
map: map
});
dojo.connect(basemapGallery,"onLoad",function(){
//first get a list of the basemaps to set to a dojo store
var items= dojo.map(basemapGallery.basemaps,function(basemap){
return {thumbnailUrl:basemap.thumbnailUrl, id:basemap.id, title:basemap.title};
});
var data = {
identifier:"id",
items:items
};
var itemRequest = {
query: {},
start:0,
count: 4
};
var itemNameMap = {
imageThumbAttr: "thumbnailUrl",
titleAttr : "title"
};
var store = new dojo.data.ItemFileReadStore({data:data});
//Populate the dojo thumbnail picker with the basemaps
var thumbPicker = dijit.byId('thumbPickerDiv');
thumbPicker.setDataStore(store,itemRequest,itemNameMap);
dojo.subscribe(thumbPicker.getClickTopicName(),function(info){
//when you click a thumbnail in the gallery - switch the basemap to the selected item.
basemapGallery.select(info.data.id);
});
});
}
dojo.addOnLoad(init);
</script>
</head>
<body class="claro">
<div dojotype="dijit.layout.BorderContainer" design="headline" gutters="false" style="width:100%;height:100%;margin:0;">
<div id="map" dojotype="dijit.layout.ContentPane" region="center" style="border:1px solid #000;">
<div style="position:absolute; right:75px; top:100px; z-Index:99;">
<div id="thumbPickerDiv" dojoType="dojox.image.ThumbnailPicker" size="400" isClickable="true" isHorizontal="false" ></div>
</div>
</div>
</div>
</body>
</html>