web-mapping 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,20 @@
1
+ Copyright 2013 Ishmael Smyrnow
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,13 @@
1
+ .leaflet-control-layers-group-name {
2
+ font-weight: bold;
3
+ margin-bottom: .2em;
4
+ display: block;
5
+ }
6
+
7
+ .leaflet-control-layers-group {
8
+ margin-bottom: .5em;
9
+ }
10
+
11
+ .leaflet-control-layers-group label {
12
+ padding-left: .5em;
13
+ }
@@ -0,0 +1,291 @@
1
+ /* global L */
2
+
3
+ // A layer control which provides for layer groupings.
4
+ // Author: Ishmael Smyrnow
5
+ L.Control.GroupedLayers = L.Control.extend({
6
+
7
+ options: {
8
+ collapsed: true,
9
+ position: 'topright',
10
+ autoZIndex: true
11
+ },
12
+
13
+ initialize: function (baseLayers, groupedOverlays, options) {
14
+ var i, j;
15
+ L.Util.setOptions(this, options);
16
+
17
+ this._layers = {};
18
+ this._lastZIndex = 0;
19
+ this._handlingClick = false;
20
+ this._groupList = [];
21
+ this._domGroups = [];
22
+
23
+ for (i in baseLayers) {
24
+ this._addLayer(baseLayers[i], i);
25
+ }
26
+
27
+ for (i in groupedOverlays) {
28
+ for (var j in groupedOverlays[i]) {
29
+ this._addLayer(groupedOverlays[i][j], j, i, true);
30
+ }
31
+ }
32
+ },
33
+
34
+ onAdd: function (map) {
35
+ this._initLayout();
36
+ this._update();
37
+
38
+ map
39
+ .on('layeradd', this._onLayerChange, this)
40
+ .on('layerremove', this._onLayerChange, this);
41
+
42
+ return this._container;
43
+ },
44
+
45
+ onRemove: function (map) {
46
+ map
47
+ .off('layeradd', this._onLayerChange)
48
+ .off('layerremove', this._onLayerChange);
49
+ },
50
+
51
+ addBaseLayer: function (layer, name) {
52
+ this._addLayer(layer, name);
53
+ this._update();
54
+ return this;
55
+ },
56
+
57
+ addOverlay: function (layer, name, group) {
58
+ this._addLayer(layer, name, group, true);
59
+ this._update();
60
+ return this;
61
+ },
62
+
63
+ removeLayer: function (layer) {
64
+ var id = L.Util.stamp(layer);
65
+ delete this._layers[id];
66
+ this._update();
67
+ return this;
68
+ },
69
+
70
+ _initLayout: function () {
71
+ var className = 'leaflet-control-layers',
72
+ container = this._container = L.DomUtil.create('div', className);
73
+
74
+ //Makes this work on IE10 Touch devices by stopping it from firing a mouseout event when the touch is released
75
+ container.setAttribute('aria-haspopup', true);
76
+
77
+ if (!L.Browser.touch) {
78
+ L.DomEvent.disableClickPropagation(container);
79
+ L.DomEvent.on(container, 'wheel', L.DomEvent.stopPropagation);
80
+ } else {
81
+ L.DomEvent.on(container, 'click', L.DomEvent.stopPropagation);
82
+ }
83
+
84
+ var form = this._form = L.DomUtil.create('form', className + '-list');
85
+
86
+ if (this.options.collapsed) {
87
+ if (!L.Browser.android) {
88
+ L.DomEvent
89
+ .on(container, 'mouseover', this._expand, this)
90
+ .on(container, 'mouseout', this._collapse, this);
91
+ }
92
+ var link = this._layersLink = L.DomUtil.create('a', className + '-toggle', container);
93
+ link.href = '#';
94
+ link.title = 'Layers';
95
+
96
+ if (L.Browser.touch) {
97
+ L.DomEvent
98
+ .on(link, 'click', L.DomEvent.stop)
99
+ .on(link, 'click', this._expand, this);
100
+ }
101
+ else {
102
+ L.DomEvent.on(link, 'focus', this._expand, this);
103
+ }
104
+
105
+ this._map.on('click', this._collapse, this);
106
+ // TODO keyboard accessibility
107
+ } else {
108
+ this._expand();
109
+ }
110
+
111
+ this._baseLayersList = L.DomUtil.create('div', className + '-base', form);
112
+ this._separator = L.DomUtil.create('div', className + '-separator', form);
113
+ this._overlaysList = L.DomUtil.create('div', className + '-overlays', form);
114
+
115
+ container.appendChild(form);
116
+ },
117
+
118
+ _addLayer: function (layer, name, group, overlay) {
119
+ var id = L.Util.stamp(layer);
120
+
121
+ this._layers[id] = {
122
+ layer: layer,
123
+ name: name,
124
+ overlay: overlay
125
+ };
126
+
127
+ if (group) {
128
+ var groupId = this._groupList.indexOf(group);
129
+
130
+ if (groupId === -1) {
131
+ groupId = this._groupList.push(group) - 1;
132
+ }
133
+
134
+ this._layers[id].group = {
135
+ name: group,
136
+ id: groupId
137
+ };
138
+ }
139
+
140
+ if (this.options.autoZIndex && layer.setZIndex) {
141
+ this._lastZIndex++;
142
+ layer.setZIndex(this._lastZIndex);
143
+ }
144
+ },
145
+
146
+ _update: function () {
147
+ if (!this._container) {
148
+ return;
149
+ }
150
+
151
+ this._baseLayersList.innerHTML = '';
152
+ this._overlaysList.innerHTML = '';
153
+ this._domGroups.length = 0;
154
+
155
+ var baseLayersPresent = false,
156
+ overlaysPresent = false,
157
+ i, obj;
158
+
159
+ for (i in this._layers) {
160
+ obj = this._layers[i];
161
+ this._addItem(obj);
162
+ overlaysPresent = overlaysPresent || obj.overlay;
163
+ baseLayersPresent = baseLayersPresent || !obj.overlay;
164
+ }
165
+
166
+ this._separator.style.display = overlaysPresent && baseLayersPresent ? '' : 'none';
167
+ },
168
+
169
+ _onLayerChange: function (e) {
170
+ var obj = this._layers[L.Util.stamp(e.layer)];
171
+
172
+ if (!obj) { return; }
173
+
174
+ if (!this._handlingClick) {
175
+ this._update();
176
+ }
177
+
178
+ var type = obj.overlay ?
179
+ (e.type === 'layeradd' ? 'overlayadd' : 'overlayremove') :
180
+ (e.type === 'layeradd' ? 'baselayerchange' : null);
181
+
182
+ if (type) {
183
+ this._map.fire(type, obj);
184
+ }
185
+ },
186
+
187
+ // IE7 bugs out if you create a radio dynamically, so you have to do it this hacky way (see http://bit.ly/PqYLBe)
188
+ _createRadioElement: function (name, checked) {
189
+
190
+ var radioHtml = '<input type="radio" class="leaflet-control-layers-selector" name="' + name + '"';
191
+ if (checked) {
192
+ radioHtml += ' checked="checked"';
193
+ }
194
+ radioHtml += '/>';
195
+
196
+ var radioFragment = document.createElement('div');
197
+ radioFragment.innerHTML = radioHtml;
198
+
199
+ return radioFragment.firstChild;
200
+ },
201
+
202
+ _addItem: function (obj) {
203
+ var label = document.createElement('label'),
204
+ input,
205
+ checked = this._map.hasLayer(obj.layer),
206
+ container;
207
+
208
+ if (obj.overlay) {
209
+ input = document.createElement('input');
210
+ input.type = 'checkbox';
211
+ input.className = 'leaflet-control-layers-selector';
212
+ input.defaultChecked = checked;
213
+ } else {
214
+ input = this._createRadioElement('leaflet-base-layers', checked);
215
+ }
216
+
217
+ input.layerId = L.Util.stamp(obj.layer);
218
+
219
+ L.DomEvent.on(input, 'click', this._onInputClick, this);
220
+
221
+ var name = document.createElement('span');
222
+ name.innerHTML = ' ' + obj.name;
223
+
224
+ label.appendChild(input);
225
+ label.appendChild(name);
226
+
227
+ if (obj.overlay) {
228
+ container = this._overlaysList;
229
+
230
+ var groupContainer = this._domGroups[obj.group.id];
231
+
232
+ // Create the group container if it doesn't exist
233
+ if (!groupContainer) {
234
+ groupContainer = document.createElement('div');
235
+ groupContainer.className = 'leaflet-control-layers-group';
236
+ groupContainer.id = 'leaflet-control-layers-group-' + obj.group.id;
237
+
238
+ var groupLabel = document.createElement('span');
239
+ groupLabel.className = 'leaflet-control-layers-group-name';
240
+ groupLabel.innerHTML = obj.group.name;
241
+
242
+ groupContainer.appendChild(groupLabel);
243
+ container.appendChild(groupContainer);
244
+
245
+ this._domGroups[obj.group.id] = groupContainer;
246
+ }
247
+
248
+ container = groupContainer;
249
+ } else {
250
+ container = this._baseLayersList;
251
+ }
252
+
253
+ container.appendChild(label);
254
+
255
+ return label;
256
+ },
257
+
258
+ _onInputClick: function () {
259
+ var i, input, obj,
260
+ inputs = this._form.getElementsByTagName('input'),
261
+ inputsLen = inputs.length;
262
+
263
+ this._handlingClick = true;
264
+
265
+ for (i = 0; i < inputsLen; i++) {
266
+ input = inputs[i];
267
+ obj = this._layers[input.layerId];
268
+
269
+ if (input.checked && !this._map.hasLayer(obj.layer)) {
270
+ this._map.addLayer(obj.layer);
271
+
272
+ } else if (!input.checked && this._map.hasLayer(obj.layer)) {
273
+ this._map.removeLayer(obj.layer);
274
+ }
275
+ }
276
+
277
+ this._handlingClick = false;
278
+ },
279
+
280
+ _expand: function () {
281
+ L.DomUtil.addClass(this._container, 'leaflet-control-layers-expanded');
282
+ },
283
+
284
+ _collapse: function () {
285
+ this._container.className = this._container.className.replace(' leaflet-control-layers-expanded', '');
286
+ }
287
+ });
288
+
289
+ L.control.groupedLayers = function (baseLayers, groupedOverlays, options) {
290
+ return new L.Control.GroupedLayers(baseLayers, groupedOverlays, options);
291
+ };
data/assets/main.css ADDED
@@ -0,0 +1,178 @@
1
+ html, body, #container {
2
+ height: 100%;
3
+ width: 100%;
4
+ overflow: hidden;
5
+ }
6
+ body {
7
+ padding-top: 50px;
8
+ }
9
+ input[type="radio"], input[type="checkbox"] {
10
+ margin: 0;
11
+ }
12
+ #sidebar {
13
+ display: block;
14
+ width: 250px;
15
+ height: 100%;
16
+ max-width: 100%;
17
+ float: left;
18
+ }
19
+ #map {
20
+ width: auto;
21
+ height: 100%;
22
+ box-shadow: 0 0 10px rgba(0,0,0,0.5);
23
+ }
24
+ #loading {
25
+ position: absolute;
26
+ width: 220px;
27
+ height: 19px;
28
+ top: 50%;
29
+ left: 50%;
30
+ margin: -10px 0 0 -110px;
31
+ z-index: 20001;
32
+ }
33
+ #features {
34
+ margin: 0px;
35
+ border: none;
36
+ border-radius: 0px;
37
+ -webkit-box-shadow: none;
38
+ box-shadow: none;
39
+ }
40
+ #sidebar-hide-btn {
41
+ margin-top: -2px;
42
+ }
43
+ #aboutTabsContent {
44
+ padding-top: 10px;
45
+ }
46
+ .progress-bar-full {
47
+ width: 100%;
48
+ }
49
+ .white {
50
+ color: #FFFFFF;
51
+ }
52
+ .panel-heading{
53
+ width: 250px;
54
+ }
55
+ .panel-body{
56
+ width: 250px;
57
+ }
58
+ .feature-row {
59
+ cursor: pointer;
60
+ width: 250px;
61
+ }
62
+ .sidebar-wrapper {
63
+ width: 100%;
64
+ height: 100%;
65
+ position: relative;
66
+ }
67
+ .sidebar-table {
68
+ position: absolute;
69
+ width: 100%;
70
+ top: 103px;
71
+ bottom: 0px;
72
+ overflow: auto;
73
+ }
74
+ .leaflet-control-layers {
75
+ overflow: auto;
76
+ }
77
+ .leaflet-control-layers label {
78
+ font-weight: normal;
79
+ margin-bottom: 0px;
80
+ }
81
+ .leaflet-control-layers-list input[type="radio"], input[type="checkbox"] {
82
+ margin: 2px;
83
+ }
84
+ .table {
85
+ margin-bottom: 0px;
86
+ }
87
+ .navbar .navbar-brand {
88
+ font-weight: bold;
89
+ font-size: 25px;
90
+ color: #FFFFFF;
91
+ }
92
+ .navbar-collapse.in {
93
+ overflow-y: hidden;
94
+ }
95
+ .navbar-header .navbar-icon-container {
96
+ margin-right: 15px;
97
+ }
98
+ .navbar-header .navbar-icon {
99
+ line-height: 50px;
100
+ height: 50px;
101
+ }
102
+ .navbar-header a.navbar-icon {
103
+ margin-left: 25px;
104
+ }
105
+ .typeahead {
106
+ background-color: #FFFFFF;
107
+ }
108
+ .tt-dropdown-menu {
109
+ background-color: #FFFFFF;
110
+ border: 1px solid rgba(0, 0, 0, 0.2);
111
+ border-radius: 4px 4px 4px 4px;
112
+ box-shadow: 0 5px 10px rgba(0, 0, 0, 0.2);
113
+ margin-top: 4px;
114
+ padding: 4px 0;
115
+ width: 100%;
116
+ max-height: 300px;
117
+ overflow: auto;
118
+ }
119
+ .tt-suggestion {
120
+ font-size: 14px;
121
+ line-height: 20px;
122
+ padding: 3px 10px;
123
+ }
124
+ .tt-suggestion.tt-cursor {
125
+ background-color: #0097CF;
126
+ color: #FFFFFF;
127
+ cursor: pointer;
128
+ }
129
+ .tt-suggestion p {
130
+ margin: 0;
131
+ }
132
+ .tt-suggestion + .tt-suggestion {
133
+ border-top: 1px solid #ccc;
134
+ }
135
+ .typeahead-header {
136
+ margin: 0 5px 5px 5px;
137
+ padding: 3px 0;
138
+ border-bottom: 2px solid #333;
139
+ }
140
+ .has-feedback .form-control-feedback {
141
+ position: absolute;
142
+ top: 0;
143
+ right: 0;
144
+ display: block;
145
+ width: 34px;
146
+ height: 34px;
147
+ line-height: 34px;
148
+ text-align: center;
149
+ }
150
+ @media (max-width: 992px) {
151
+ .navbar .navbar-brand {
152
+ font-size: 18px;
153
+ }
154
+ }
155
+ @media (max-width: 767px){
156
+ #sidebar {
157
+ display: none;
158
+ }
159
+ .url-break {
160
+ word-break: break-all;
161
+ word-break: break-word;
162
+ -webkit-hyphens: auto;
163
+ hyphens: auto;
164
+ }
165
+ .dropdown-menu a i{
166
+ color: #FFFFFF;
167
+ }
168
+ }
169
+
170
+ /* Print Handling */
171
+ @media print {
172
+ .navbar {
173
+ display: none !important;
174
+ }
175
+ .leaflet-control-container {
176
+ display: none !important;
177
+ }
178
+ }