-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwicker_park.js
More file actions
266 lines (201 loc) · 6.76 KB
/
wicker_park.js
File metadata and controls
266 lines (201 loc) · 6.76 KB
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
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
window.onload = init;
function init() {
// Map for entire city - when ready, use clone() function to create inset map
//var overview = new OpenLayers.Map('inset', {
// maxExtent: new OpenLayers.Bounds(1173524.7058, 1898031.7821, 1178333.0059, 1902906.1645)
// });
// maxResolution: auto,
// maxExtent: new OpenLayers.Bounds(1091130.7724, 1813891.8902, 1205198.8501, 1951669.0201),
// projection: new OpenLayers.Projection('EPSG:3435'),
// units: 'ft',
map = new OpenLayers.Map('map', {
maxResolution: "auto",
projection: new OpenLayers.Projection('EPSG:3435'),
units: 'ft',
numZoomLevels: 6,
maxExtent: new OpenLayers.Bounds(-530651.654365917, 1084738.22396089, -525073.023945515, 1087586.75830336)
});
// Protocols - Retrieving GeoJSON files for vector layers
// -----------------------------------------------------
var buildings_protocol = new OpenLayers.Protocol.HTTP({
url: 'wicker_park_buildings.json',
format: new OpenLayers.Format.GeoJSON({})
});
var roofs_protocol = new OpenLayers.Protocol.HTTP({
url: 'wicker_park_roofs_new.json',
format: new OpenLayers.Format.GeoJSON({})
});
var walls_protocol = new OpenLayers.Protocol.HTTP({
url: 'wicker_park_walls_new.json',
format: new OpenLayers.Format.GeoJSON({})
});
var streets_protocol = new OpenLayers.Protocol.HTTP({
url: 'wicker_park_streets.json',
format: new OpenLayers.Format.GeoJSON({})
});
var curbs_protocol = new OpenLayers.Protocol.HTTP({
url: 'wicker_park_curbs.json',
format: new OpenLayers.Format.GeoJSON({})
});
// --------------------------------------------------
// Layers
// --------------------------------------------------
var canvas = ['SVG', 'Canvas', 'VML'];
buildings_layer = new OpenLayers.Layer.Vector('Buildings', {
protocol: buildings_protocol,
strategies: [new OpenLayers.Strategy.Fixed()],
renderers: canvas,
isBaseLayer: true
});
roofs_layer = new OpenLayers.Layer.Vector('Roofs', {
protocol: roofs_protocol,
strategies: [new OpenLayers.Strategy.Fixed()],
});
walls_layer = new OpenLayers.Layer.Vector('Walls', {
protocol: walls_protocol,
strategies: [new OpenLayers.Strategy.Fixed()],
});
streets_layer = new OpenLayers.Layer.Vector('Streets', {
protocol: streets_protocol,
strategies: [new OpenLayers.Strategy.BBOX()],
renderers: canvas,
isBaseLayer: false
});
curbs_layer = new OpenLayers.Layer.Vector('Curbs', {
protocol: curbs_protocol,
renderers: canvas,
strategies: [new OpenLayers.Strategy.BBOX()]
});
// --------------------------------------------------
// Styles
// --------------------------------------------------
var buildings_style = new OpenLayers.Style({
'fillColor': '#679e8b',
'fillOpacity': .33,
'strokeColor': '#000000',
'strokeWidth': 2,
});
var buildings_style_map = new OpenLayers.StyleMap({
'default': buildings_style
});
buildings_layer.styleMap = buildings_style_map;
var roofs_style = new OpenLayers.Style({
'fillColor': '#679e8b',
'fillOpacity': .33,
'strokeColor': '#000000',
'strokeWidth': 2,
});
var roofs_style_map = new OpenLayers.StyleMap({
'default': roofs_style
});
roofs_layer.styleMap = roofs_style_map;
var walls_style = new OpenLayers.Style({
'fillColor': '#679e8b',
'fillOpacity': .33,
'strokeColor': '#000000',
'strokeWidth': 2,
});
var walls_style_map = new OpenLayers.StyleMap({
'default': walls_style
});
walls_layer.styleMap = walls_style_map;
var streets_style = new OpenLayers.Style({
'strokeColor': '#616161',
'strokeWidth': 3,
});
var streets_style_map = new OpenLayers.StyleMap({
'default': streets_style
});
streets_layer.styleMap = streets_style_map;
var curbs_style = new OpenLayers.Style({
'strokeColor': '#616161',
'strokeWidth': 0.5
});
var curbs_style_map = new OpenLayers.StyleMap({
'default': curbs_style
});
curbs_layer.styleMap = curbs_style_map;
//-----------------------------------------------------
// Making Isometric
// --------------------------------------------------
//
// TODO: All the things
// DONE: boom
// ---------------------------------------------------------
// Controls, Markers, and Mapmaking
// ---------------------------------------------------------
//map.addLayer(buildings_layer);
map.addLayers([streets_layer, curbs_layer, buildings_layer, walls_layer, roofs_layer ]);
// Overview Map
// Top Panel - search, hood jump, log in
// pretty certain by now this will NOT be made in OpenLayers
// Layer Switcher - in this case layers will be things like hotspots
// events, my friends, apts/homes, jobs, etc.
/* var layerSwitcher = new OpenLayers.Control.LayerSwitcher({
roundedCorner: true,
roundedCornerColor: 'green'
});
map.addControl(layerSwitcher);
*/
var highlightCtrl = new OpenLayers.Control.SelectFeature(
buildings_layer, {
hover: true,
highlightOnly: true,
renderIntent: "temporary",
});
var bldg_select = new OpenLayers.Control.SelectFeature(
buildings_layer, {
toggle: true,
clickout: true
});
map.addControl(highlightCtrl);
highlightCtrl.activate();
map.addControl(bldg_select);
bldg_select.activate();
// TODO: Get this working so that hovering over building only pops up name and address, clicking fills feature logs with bulk of data
// On second thought, seems to take too long
// Maybe just highlight only to give users visual clue of buildng they are about to select, then once they click it, display bulk data
//
//
function displayPopup() {
$.getJSON('wicker_park_pretty.json', function(data) {
var address = {
'bldg_gid': data[i][0],
'address': data[i]['bldgData']['address']
};
});
}
function bldg_selected(event) {
var feature = event.feature;
var bldg_gid = String(feature.attributes.bldg_gid);
$.getJSON('wicker_park_pretty.json', function(data) {
// for ( var i = 0; i < data.length; i++) {
//alert(data[bldg_gid]['bldgData']['address'])
// if (feature.attributes.bldg_gid == data[bldg_gid]) {
var popup = new OpenLayers.Popup.FramedCloud("popup",
feature.geometry.getBounds().getCenterLonLat(),
new OpenLayers.Size(200,100),
"<h1>"+ data[bldg_gid]['bldgData']['address'] + "</h1>",
null,
true
);
feature.popup = popup;
map.addPopup(popup);}
//pup.innerHTML += data.features[i].properties.address ; }
);
}
function bldg_unselected(event) {
map.removePopup(event.feature.popup);
event.feature.popup.destroy();
event.feature.popup = null;
}
// buildings_layer.events.register('featureselected', this, bldg_selected);
// buildings_layer.events.register('featureunselected', this, bldg_unselected);
//
//
buildings_layer.events.on({
'featureselected': bldg_selected,
'featureunselected': bldg_unselected
});
map.zoomTo(3);
}