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
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>TEMPLATE example</title>
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">
<meta name="description" content="An example of TEMPLATE">
<meta name="author" content="Ryan Westphal">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<link rel="stylesheet" type="text/css" href="css/style.css" />
<style type="text/css">
#mapTab
{
min-height: 99%;
}
#map
{
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
}
</style>
</head>
<body>
<div id="app" data-role="page">
<div data-role="header">
<h1><span data-text="DisplayName">Amherst</span></h1>
</div>
<div data-role="content">
<div class="have-mapTabs">
<p>Which map would you like?</p>
<ul data-role="listview" data-inset="true">
<li><a href="#mapTab" data-map-tab="{"MapTabID":"ParcelMap","DisplayName":"Parcel Map"}">Parcel Map</a></li>
<li><a href="#mapTab" data-map-tab="{"MapTabID":"ZoningMap","DisplayName":"Zoning Map"}">Zoning Map</a></li>
</ul>
</div>
</div>
</div>
<div id="mapTab" data-role="page" data-fullscreen="true">
<div data-role="header" data-position="fixed">
<h1><span data-text="DisplayName">Parcel App</span></h1>
<a href="#app" data-role="button" data-icon="arrow-d" data-iconpos="notext" data-transition="slidedown" class="mapTab-switch ui-btn-right">Select Tab</a>
</div>
<div data-role="content">
<div id="map">
</div>
</div>
<div data-role="footer" data-position="fixed">
<p> </p>
</div>
</div>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="http://code.jquerygeo.com/jquery.geo-1.0a4.min.js"></script>
<script>
(function() {
var mapTab = window.sessionStorage.getItem("mapTab") || null,
map = null,
bbox = window.sessionStorage.getItem("bbox") || null;
if (mapTab) {
mapTab = JSON.parse(mapTab);
}
$("#app").delegate("a", "click", function() {
mapTab = $(this).data("mapTab");
window.sessionStorage.setItem("mapTab", JSON.stringify(mapTab));
});
$("#mapTab").bind("pageinit", function() {
$.mobile.fixedToolbars.setTouchToggleEnabled(false);
});
$("#mapTab").bind("pagebeforeshow", function() {
$("#mapTab [data-text='DisplayName']").text(mapTab.DisplayName);
$("title").text(mapTab.DisplayName);
});
$( document ).bind( "pagechange", function(e, mobile) {
if ( $(mobile.toPage).is("#mapTab") ) {
$.geo.proj = null;
// create a map
if ( map == null ) {
map = $("#map").geomap({
tilingScheme: null,
bboxMax: [ 372440,2935595,396368,2985633 ],
bbox: bbox ? JSON.parse(bbox) : [ 372440,2935595,396368,2985633 ],
services: [{
id: "gpv",
type: "shingled",
src: function(view) {
var mapState = {
Application: "ParcelApp",
MapTab: mapTab.MapTabID,
Extent: {
bbox: view.bbox
}
};
return "http://alpha.appgeo.com/GPV/Services/MapImage.ashx?m=GetMapImage&state=" + JSON.stringify(mapState) + "&width=" + view.width + "&height=" + view.height;
}
}],
bboxchange: function(e, geo) {
bbox = "[" + geo.bbox.toString() + "]";
window.sessionStorage.setItem("bbox", bbox);
}
});
} else {
map.geomap( "resize" );
}
}
});
/*
$("#mapTab").bind("pagebeforehide", function() {
if (map) {
map.geomap("destroy");
map = null;
}
});
*/
})();
</script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
</body>
</html>
|