@phila/layerboard 2.1.0 → 3.0.0-beta.0

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.
package/example/main.js DELETED
@@ -1,82 +0,0 @@
1
- /*
2
- _ _ _
3
- | | | | | |
4
- | | __ _ _ _ ___ _ __| |__ ___ __ _ _ __ __| |
5
- | |/ _` | | | |/ _ \ '__| '_ \ / _ \ / _` | '__/ _` |
6
- | | (_| | |_| | __/ | | |_) | (_) | (_| | | | (_| |
7
- |_|\__,_|\__, |\___|_| |_.__/ \___/ \__,_|_| \__,_|
8
- __/ |
9
- |___/
10
- */
11
-
12
- import accounting from 'accounting';
13
- import axios from 'axios';
14
- import moment from 'moment';
15
- import layerboard from '../dist/layerboard';
16
-
17
- // import 'leaflet/dist/leaflet.css';
18
- // import 'leaflet-easybutton/src/easy-button.css';
19
- // import 'leaflet-measure/dist/leaflet-measure.css';
20
-
21
- // turn off console logging in production
22
- // TODO come up with better way of doing this with webpack + env vars
23
- const { hostname='' } = location;
24
- if (hostname !== 'localhost' && !hostname.match(/(\d+\.){3}\d+/)) {
25
- console.log = console.info = console.debug = console.error = function () {};
26
- }
27
-
28
- function openHelp() {
29
- var firstHash = window.location.hash;
30
- // console.log('setHash is running, firstHash:', firstHash);
31
- var firstHashArr = firstHash.split('/').slice(2);
32
- console.log('firstHashArr:', firstHashArr);
33
- var finalHash = '#/help';
34
- for (var i=0; i < firstHashArr.length; i++) {
35
- finalHash = finalHash + '/' + firstHashArr[i];
36
- }
37
- window.location.hash = finalHash;
38
- }
39
-
40
- console.log('openHelp:', openHelp);
41
-
42
- var BASE_CONFIG_URL = 'https://rawgit.com/ajrothwell/openmaps-base-config/f7a091508316694767f24fd68ab07af38ddad163/config.js';
43
- var GATEKEEPER_KEY = 'ec8681f792812d7e3ff15e9094bfd4ad';
44
- var WEBMAP_ID = '4c3ed877199c402895b7fa45ce6409b6';
45
-
46
- layerboard({
47
- bundled: true,
48
- router: {
49
- enabled: true
50
- },
51
- geolocation: {
52
- enabled: true
53
- },
54
- addressAutocomplete: {
55
- enabled: true
56
- },
57
- map: {
58
- // possibly should move to base config
59
- defaultBasemap: 'pwd',
60
- defaultIdentifyFeature: 'address-marker',
61
- imagery: {
62
- enabled: true
63
- },
64
- historicBasemaps: {
65
- enabled: true
66
- },
67
- center: [-75.16347348690034, 39.952562122622254],
68
- clickToIdentifyFeatures: true,
69
- containerClass: 'map-container-type3',
70
- },
71
- cyclomedia: {
72
- enabled: true,
73
- measurementAllowed: false,
74
- popoutAble: true,
75
- },
76
- pictometry: {
77
- enabled: false,
78
- },
79
- gatekeeperKey: GATEKEEPER_KEY,
80
- baseConfig: BASE_CONFIG_URL,
81
- webmapId: WEBMAP_ID,
82
- });
@@ -1,108 +0,0 @@
1
- /* header.site-header > .row:last-of-type {
2
- background: #2176d2;
3
- } */
4
- body {
5
- overflow-y: hidden;
6
- }
7
-
8
- .bold-a {
9
- font-weight: bold;
10
- color: white;
11
- }
12
-
13
- .grid-y {
14
- overflow-y: hidden;
15
- }
16
-
17
- .greeting > h2 {
18
- margin-bottom: 30px;
19
- }
20
-
21
- .greeting > .callout {
22
- border-color: #58c04d;
23
- background: #fff;
24
- /*margin: 0 0 1rem 0;*/
25
- padding: 1rem;
26
- }
27
-
28
- .greeting > .callout > ul {
29
- margin: 0 0 0 1.42857rem;
30
- padding: 0 0 0 1.42857rem;
31
- }
32
-
33
- #application .site-header, #application .app-footer {
34
- background: #2176d2;
35
- }
36
-
37
- #application .site-header .page-title-container h1 {
38
- font-size: 2.14286rem;
39
- }
40
-
41
- /*this fixes an issue with the topic panel scrolling over the footer padding*/
42
- #application .app-footer {
43
- position: relative;
44
- }
45
-
46
- /*small*/
47
- @media screen and (max-width: 750px) {
48
- .logo {
49
- float: left;
50
- }
51
-
52
- #application .site-header .logo img {
53
- max-width: 100px;
54
- height: auto;
55
- }
56
-
57
- #application .site-header .page-title-container h1 {
58
- font-size: 1.75rem;
59
- }
60
-
61
- .page-title
62
-
63
- .page-title-container {
64
- float: right;
65
- }
66
- }
67
-
68
- #demo-badge {
69
- /*text-transform: capitalize;*/
70
- font-size: 14px;
71
- vertical-align: top;
72
- /*color: #eee;*/
73
- margin-left: 4px;
74
- line-height: 35px;
75
- padding: 4px;
76
- border-radius: 8px;
77
- background: #f3c613;
78
- }
79
-
80
- .tour-tip{
81
- border-left: 3px solid color(dark-ben-franklin);
82
- padding-left: 10px;
83
- display: flex;
84
- align-items: center;
85
- margin-bottom: 15px;
86
- &:hover{
87
- cursor: pointer;
88
- cursor: hand;
89
- background: color(ghost-gray);
90
- }
91
- }
92
-
93
- .tour-tip__action{
94
- color: color(dark-ben-franklin);
95
- @include rem(font-size, 1.75);
96
- margin:0;
97
- padding:0;
98
- }
99
-
100
- .tour-tip__result{
101
- // padding-left: 30px;
102
- }
103
-
104
- .tour-tip__icon {
105
- margin-right: 10px;
106
- @include rem(font-size, 3)
107
- color: color(electric-blue);
108
- }
package/example/util.js DELETED
@@ -1,11 +0,0 @@
1
- function openHelp() {
2
- var firstHash = window.location.hash;
3
- // console.log('setHash is running, firstHash:', firstHash);
4
- var firstHashArr = firstHash.split('/').slice(2);
5
- console.log('firstHashArr:', firstHashArr);
6
- var finalHash = '#/help';
7
- for (var i=0; i < firstHashArr.length; i++) {
8
- finalHash = finalHash + '/' + firstHashArr[i];
9
- }
10
- window.location.hash = finalHash;
11
- }
package/src/App.vue DELETED
@@ -1,48 +0,0 @@
1
- <template>
2
- <div>
3
- <layerboard />
4
- <lb-footer />
5
- </div>
6
- </template>
7
-
8
- <script>
9
-
10
- import Layerboard from './components/Layerboard.vue';
11
- import LbFooter from './components/LbFooter.vue';
12
-
13
- export default {
14
- name: 'App',
15
- components: {
16
- Layerboard,
17
- LbFooter,
18
- },
19
- mounted() {
20
- window.addEventListener('resize', this.handleWindowResize);
21
- this.handleWindowResize();
22
- },
23
- methods: {
24
- handleWindowResize() {
25
- const windowHeight = window.innerHeight;
26
- const rootElement = document.getElementById('mb-root');
27
- const rootStyle = window.getComputedStyle(rootElement);
28
- // const rootHeight = rootStyle.getPropertyValue('height');
29
- // const rootHeightNum = parseInt(rootHeight.replace('px', ''));
30
- // const rootHeightNum = 100;
31
- const rootWidth = rootStyle.getPropertyValue('width');
32
- const rootHeight = rootStyle.getPropertyValue('height');
33
- const rootWidthNum = parseInt(rootWidth.replace('px', ''));
34
- const rootHeightNum = parseInt(rootHeight.replace('px', ''));
35
-
36
- const dim = {
37
- width: rootWidthNum,
38
- height: rootHeightNum,
39
- };
40
-
41
- // console.log('App handleWindowResize is running, dim:', dim);
42
- // this.$store.commit('setWindowWidth', rootWidthNum);
43
- this.$store.commit('setWindowDimensions', dim);
44
- },
45
- },
46
-
47
- };
48
- </script>
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -1,361 +0,0 @@
1
- <template>
2
- <div
3
- id="mb-root"
4
- class="cell medium-auto grid-x"
5
- >
6
- <button
7
- class="small-24 button datasets-button"
8
- @click="toggleTopics"
9
- >
10
- {{ buttonMessage }}
11
- </button>
12
-
13
- <topic-panel v-show="shouldShowTopics" />
14
-
15
- <map-panel v-show="shouldShowMap">
16
- <cyclomedia-widget
17
- v-if="shouldLoadCyclomediaWidget"
18
- v-show="cyclomediaActive"
19
- slot="cycloWidget"
20
- screen-percent="3"
21
- :orientation="this.$config.cyclomedia.orientation"
22
- />
23
- <pictometry-widget
24
- v-if="shouldLoadPictometryWidget"
25
- v-show="pictometryActive"
26
- slot="pictWidget"
27
- >
28
- <pictometry-png-marker
29
- v-if="pictometryShowAddressMarker"
30
- :latlng="[geocodeData.geometry.coordinates[1], geocodeData.geometry.coordinates[0]]"
31
- :icon="'markers.png'"
32
- :height="60"
33
- :width="40"
34
- :offset-x="0"
35
- :offset-y="0"
36
- />
37
- <pictometry-layer v-if="pictometryActive" />
38
- <pictometry-png-marker
39
- v-if="cyclomediaActive && pictometryActive"
40
- :latlng="cycloLatlng"
41
- :icon="'camera2.png'"
42
- :height="20"
43
- :width="30"
44
- :offset-x="-2"
45
- :offset-y="-2"
46
- />
47
- <pictometry-view-cone
48
- v-if="cyclomediaActive && pictometryActive"
49
- :latlng="cycloLatlng"
50
- :rotation-angle="cycloRotationAngle"
51
- :h-fov="cycloHFov"
52
- />
53
- </pictometry-widget>
54
- </map-panel>
55
-
56
- <!-- <footer-test></footer-test> -->
57
- <popover
58
- v-if="popoverOpen"
59
- :options="popoverOptions"
60
- :slots="{'text': popoverText}"
61
- />
62
- </div>
63
- </template>
64
-
65
- <script>
66
- import axios from 'axios';
67
- import TopicPanel from './TopicPanel.vue';
68
- import MapPanel from './MapPanel.vue';
69
- // import FooterTest from './FooterTest.vue';
70
- // console.log('FooterTest:', FooterTest)
71
-
72
- export default {
73
- name: 'Layerboard',
74
- components: {
75
- TopicPanel,
76
- MapPanel,
77
- // FooterTest,
78
- CyclomediaWidget: () => import(/* webpackChunkName: "mbmb_pvm_CyclomediaWidget" */'@phila/vue-mapping/src/cyclomedia/Widget.vue'),
79
- PictometryWidget: () => import(/* webpackChunkName: "mbmb_pvm_PictometryWidget" */'@phila/vue-mapping/src/pictometry/Widget.vue'),
80
- PictometryLayer: () => import(/* webpackChunkName: "mbmb_pvm_PictometryLayer" */'@phila/vue-mapping/src/pictometry/Layer.vue'),
81
- PictometryPngMarker: () => import(/* webpackChunkName: "mbmb_pvm_PictometryPngMarker" */'@phila/vue-mapping/src/pictometry/PngMarker.vue'),
82
- PictometryViewCone: () => import(/* webpackChunkName: "mbmb_pvm_PictometryViewCone" */'@phila/vue-mapping/src/pictometry/ViewCone.vue'),
83
- Popover: () => import(/* webpackChunkName: "mbmb_pvc_Popover" */'@phila/vue-comps/src/components/Popover.vue'),
84
- // Footer: () => import(/* webpackChunkName: "Footer" */'./Footer.vue'),
85
- },
86
- computed: {
87
- popoverOpen() {
88
- return this.$store.state.popover.open;
89
- },
90
- popoverText() {
91
- return this.$store.state.popover.text;
92
- },
93
- popoverOptions() {
94
- return this.$store.state.popover.options;
95
- },
96
- isMobileOrTablet() {
97
- return this.$store.state.isMobileOrTablet;
98
- },
99
- shouldLoadCyclomediaWidget() {
100
- return this.$config.cyclomedia.enabled && !this.isMobileOrTablet;
101
- },
102
- shouldLoadPictometryWidget() {
103
- return this.$config.pictometry.enabled && !this.isMobileOrTablet;
104
- },
105
- fullScreenMapEnabled() {
106
- return this.$store.state.fullScreenMapEnabled;
107
- },
108
- cyclomediaActive() {
109
- return this.$store.state.cyclomedia.active;
110
- },
111
- cycloLatlng() {
112
- if (this.$store.state.cyclomedia.orientation.xyz !== null) {
113
- const xyz = this.$store.state.cyclomedia.orientation.xyz;
114
- return [ xyz[1], xyz[0] ];
115
- }
116
- const center = this.$config.map.center;
117
- return center;
118
-
119
- },
120
- cycloRotationAngle() {
121
- return this.$store.state.cyclomedia.orientation.yaw * (180/3.14159265359);
122
- },
123
- cycloHFov() {
124
- return this.$store.state.cyclomedia.orientation.hFov;
125
- },
126
- pictometryActive() {
127
- return this.$store.state.pictometry.active;
128
- },
129
- pictometryZoom() {
130
- return this.$store.state.pictometry.zoom;
131
- },
132
- pictometryShowAddressMarker() {
133
- if (!this.pictometryActive || !this.geocodeData) {
134
- return false;
135
- } else if (this.pictometryZoom < 20 && this.cyclomediaActive) {
136
- return false;
137
- }
138
- return true;
139
-
140
- },
141
- geocodeData() {
142
- return this.$store.state.geocode.data;
143
- },
144
- windowDim() {
145
- return this.$store.state.windowDimensions;
146
- },
147
- windowHeight() {
148
- return this.$store.state.windowSize.height;
149
- },
150
- didToggleTopicsOn() {
151
- return this.$store.state.didToggleTopicsOn;
152
- },
153
- buttonMessage() {
154
- if (this.didToggleTopicsOn) {
155
- return 'See Map';
156
- }
157
- return 'See Datasets';
158
-
159
- },
160
- shouldShowTopics() {
161
- return this.$store.state.shouldShowTopics;
162
- },
163
- shouldShowMap() {
164
- return this.$store.state.shouldShowMap;
165
- },
166
- },
167
- watch: {
168
- pictometryShowAddressMarker(nextValue) {
169
- // console.log('watch pictometryShowAddressMarker', nextValue);
170
- },
171
- windowDim(nextDim) {
172
- this.calculateShouldShowTopics();
173
- this.calculateShouldShowMap();
174
- },
175
- // windowWidth(nextWidth) {
176
- // this.calculateShouldShowTopics();
177
- // this.calculateShouldShowMap();
178
- // },
179
- fullScreenMapEnabled(nextValue) {
180
- this.calculateShouldShowTopics();
181
- this.calculateShouldShowMap();
182
- },
183
- didToggleTopicsOn(nextValue) {
184
- this.calculateShouldShowTopics();
185
- this.calculateShouldShowMap();
186
- },
187
- shouldShowTopics(nextValue) {
188
- this.handleWindowResize();
189
- },
190
- shouldShowMap(nextValue) {
191
- this.handleWindowResize();
192
- },
193
- },
194
- mounted() {
195
- // console.log('cyclo', this.$config.cyclomedia.enabled, CyclomediaWidget);
196
- let defaultLayers = [];
197
-
198
- if (this.$config.initialPopover && window.location.hash == '') {
199
- this.$store.commit('setPopoverOpen', true);
200
- this.$store.commit('setPopoverOptions', this.$config.initialPopover.options);
201
- if (this.$config.initialPopover.slots) {
202
- this.$store.commit('setPopoverText', this.$config.initialPopover.slots.text);
203
- }
204
- }
205
-
206
- if (this.$config.topics != undefined) {
207
- for (let topic of this.$config.topics) {
208
- for (let component of topic.components) {
209
- if (component.type === 'checkbox-set' || component.type === 'radio-button-set') {
210
- defaultLayers = defaultLayers.concat(component.options.defaultTopicLayers);
211
- }
212
- }
213
- }
214
- }
215
-
216
- // console.log('Layerboard.vue mounted, this.$config.topics:', this.$config.topics, 'defaultLayers:', defaultLayers, 'this.$store.state.map.webMapLayersAndRest:', this.$store.state.map.webMapLayersAndRest);
217
-
218
- this.$store.commit('setDefaultLayers', defaultLayers);
219
- this.$store.commit('setWebMapActiveLayers', defaultLayers);
220
-
221
- if (this.$config.defaultPanel) {
222
- if (this.$config.defaultPanel === 'topics') {
223
- this.$store.commit('setDidToggleTopicsOn', true);
224
- }
225
- }
226
-
227
- if (this.$config.dataSources) {
228
- this.$controller.dataManager.fetchData();
229
- }
230
-
231
- window.addEventListener('resize', this.handleWindowResize);
232
- this.handleWindowResize();
233
-
234
- const store = this.$store;
235
- const knackUrl = "https://api.knackhq.com/v1/objects/object_4/records/export?type=json";
236
- const params = {
237
- // dataType: 'json'
238
- };
239
- const headers = {
240
- 'X-Knack-Application-Id': '550c60d00711ffe12e9efc64',
241
- 'X-Knack-REST-API-Key': '7bce4520-28dc-11e5-9f0a-4d758115b820',
242
- };
243
- axios.get(knackUrl, { params, headers }).then(response => {
244
- const dataOut = response.data;
245
- const records = dataOut.records;
246
- const recordsFiltered = records.filter(record => record.field_12 === "API" || record.field_12 === "GeoService");
247
-
248
- let bennyEndpoints = {};
249
-
250
- for (let record of recordsFiltered) {
251
- const url = record.field_25.split('"')[1];
252
- let url2;
253
- if (url) {
254
- url2 = url.split('query')[0].replace('https://', '').replace('http://', '').replace(/\/$/, "").toLowerCase();
255
- } else {
256
- url2 = null;
257
- }
258
- if (record.field_13_raw.length > 0) {
259
- bennyEndpoints[url2] = record.field_13_raw[0].id;
260
- } else {
261
- bennyEndpoints[url2] = '';
262
- }
263
- }
264
- store.commit('setBennyEndpoints', bennyEndpoints);
265
- }, response => {
266
- console.log('AXIOS ERROR Layerboard.vue');
267
- });
268
- },
269
- methods: {
270
- // for mobile only
271
- toggleTopics() {
272
- const prevVal = this.$store.state.didToggleTopicsOn;
273
- this.$store.commit('setDidToggleTopicsOn', !prevVal);
274
- },
275
- calculateShouldShowTopics() {
276
- // const windowWidth = this.windowWidth;
277
- const windowWidth = this.windowDim.width;
278
- const smallScreen = windowWidth < 750;
279
- const didToggleTopicsOn = this.$store.state.didToggleTopicsOn;
280
- const fullScreenMapEnabled = this.$store.state.fullScreenMapEnabled;
281
- // console.log('calculateShouldShowTopics, smallScreen:', smallScreen, 'didToggleTopicsOn', didToggleTopicsOn, 'fullScreenMapEnabled', fullScreenMapEnabled);
282
- const shouldShowTopics = !smallScreen && !fullScreenMapEnabled || smallScreen && didToggleTopicsOn;
283
- this.$store.commit('setShouldShowTopics', shouldShowTopics);
284
- },
285
- calculateShouldShowMap() {
286
- // const windowWidth = this.windowWidth;
287
- const windowWidth = this.windowDim.width;
288
- const notMobile = windowWidth > 750;
289
- const didToggleTopicsOn = this.$store.state.didToggleTopicsOn;
290
- const shouldShowMap = notMobile || !didToggleTopicsOn;
291
- this.$store.commit('setShouldShowMap', shouldShowMap);
292
- },
293
- handleWindowResize() {
294
- const windowHeight = window.innerHeight;
295
- const rootElement = document.getElementById('mb-root');
296
- const rootStyle = window.getComputedStyle(rootElement);
297
- // const rootHeight = rootStyle.getPropertyValue('height');
298
- // const rootHeightNum = parseInt(rootHeight.replace('px', ''));
299
- // const rootHeightNum = 100;
300
- const rootWidth = rootStyle.getPropertyValue('width');
301
- const rootHeight = rootStyle.getPropertyValue('height');
302
- const rootWidthNum = parseInt(rootWidth.replace('px', ''));
303
- const rootHeightNum = parseInt(rootHeight.replace('px', ''));
304
-
305
- const dim = {
306
- width: rootWidthNum,
307
- height: rootHeightNum,
308
- };
309
-
310
- // console.log('Layerboard handleWindowResize is running, dim:', dim);
311
- // this.$store.commit('setWindowWidth', rootWidthNum);
312
- this.$store.commit('setWindowDimensions', dim);
313
- },
314
- },
315
- };
316
- </script>
317
-
318
- <style>
319
- /*don't highlight any form elements*/
320
- input:focus,
321
- select:focus,
322
- textarea:focus,
323
- button:focus {
324
- outline: none;
325
- }
326
-
327
- /* standards applies padding to buttons, which causes some weirdness with
328
- buttons on the map panel. override here. */
329
- button {
330
- padding: inherit;
331
- }
332
-
333
- .mb-root {
334
- position: absolute;
335
- bottom: 0;
336
- top: 78px;
337
- left: 0;
338
- right: 0;
339
- overflow: auto;
340
- }
341
-
342
- .datasets-button {
343
- display: none;
344
- height: 36px;
345
- margin: 0;
346
- }
347
-
348
- .mb-panel {
349
- /* height: 100%; */
350
- }
351
-
352
- /*small devices only*/
353
- /* @media screen and (max-width: 39.9375em) { */
354
- @media screen and (max-width: 750px) {
355
- .datasets-button {
356
- display: block;
357
- height: 36px;
358
- }
359
- }
360
-
361
- </style>