@phila/layerboard 2.2.0 → 3.0.0-beta.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.
@@ -1,315 +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
-
70
- export default {
71
- name: 'Layerboard',
72
- components: {
73
- TopicPanel,
74
- MapPanel,
75
- CyclomediaWidget: () => import(/* webpackChunkName: "mbmb_pvm_CyclomediaWidget" */'@phila/vue-mapping/src/cyclomedia/Widget.vue'),
76
- PictometryWidget: () => import(/* webpackChunkName: "mbmb_pvm_PictometryWidget" */'@phila/vue-mapping/src/pictometry/Widget.vue'),
77
- PictometryLayer: () => import(/* webpackChunkName: "mbmb_pvm_PictometryLayer" */'@phila/vue-mapping/src/pictometry/Layer.vue'),
78
- PictometryPngMarker: () => import(/* webpackChunkName: "mbmb_pvm_PictometryPngMarker" */'@phila/vue-mapping/src/pictometry/PngMarker.vue'),
79
- PictometryViewCone: () => import(/* webpackChunkName: "mbmb_pvm_PictometryViewCone" */'@phila/vue-mapping/src/pictometry/ViewCone.vue'),
80
- Popover: () => import(/* webpackChunkName: "mbmb_pvc_Popover" */'@phila/vue-comps/src/components/Popover.vue'),
81
- },
82
- computed: {
83
- popoverOpen() {
84
- return this.$store.state.popover.open;
85
- },
86
- popoverText() {
87
- return this.$store.state.popover.text;
88
- },
89
- popoverOptions() {
90
- return this.$store.state.popover.options;
91
- },
92
- isMobileOrTablet() {
93
- return this.$store.state.isMobileOrTablet;
94
- },
95
- shouldLoadCyclomediaWidget() {
96
- return this.$config.cyclomedia.enabled && !this.isMobileOrTablet;
97
- },
98
- shouldLoadPictometryWidget() {
99
- return this.$config.pictometry.enabled && !this.isMobileOrTablet;
100
- },
101
- fullScreenMapEnabled() {
102
- return this.$store.state.fullScreenMapEnabled;
103
- },
104
- cyclomediaActive() {
105
- return this.$store.state.cyclomedia.active;
106
- },
107
- cycloLatlng() {
108
- if (this.$store.state.cyclomedia.orientation.xyz !== null) {
109
- const xyz = this.$store.state.cyclomedia.orientation.xyz;
110
- return [ xyz[1], xyz[0] ];
111
- }
112
- const center = this.$config.map.center;
113
- return center;
114
- },
115
- cycloRotationAngle() {
116
- return this.$store.state.cyclomedia.orientation.yaw * (180 / 3.14159265359);
117
- },
118
- cycloHFov() {
119
- return this.$store.state.cyclomedia.orientation.hFov;
120
- },
121
- pictometryActive() {
122
- return this.$store.state.pictometry.active;
123
- },
124
- pictometryZoom() {
125
- return this.$store.state.pictometry.zoom;
126
- },
127
- pictometryShowAddressMarker() {
128
- if (!this.pictometryActive || !this.geocodeData) {
129
- return false;
130
- } else if (this.pictometryZoom < 20 && this.cyclomediaActive) {
131
- return false;
132
- }
133
- return true;
134
- },
135
- geocodeData() {
136
- return this.$store.state.geocode.data;
137
- },
138
- windowDim() {
139
- return this.$store.state.windowDimensions;
140
- },
141
- windowHeight() {
142
- return this.$store.state.windowSize.height;
143
- },
144
- didToggleTopicsOn() {
145
- return this.$store.state.didToggleTopicsOn;
146
- },
147
- buttonMessage() {
148
- if (this.didToggleTopicsOn) {
149
- return 'See Map';
150
- }
151
- return 'See Datasets';
152
- },
153
- shouldShowTopics() {
154
- return this.$store.state.shouldShowTopics;
155
- },
156
- shouldShowMap() {
157
- return this.$store.state.shouldShowMap;
158
- },
159
- },
160
- watch: {
161
- pictometryShowAddressMarker(nextValue) {
162
- },
163
- windowDim(nextDim) {
164
- this.calculateShouldShowTopics();
165
- this.calculateShouldShowMap();
166
- },
167
- fullScreenMapEnabled(nextValue) {
168
- this.calculateShouldShowTopics();
169
- this.calculateShouldShowMap();
170
- },
171
- didToggleTopicsOn(nextValue) {
172
- this.calculateShouldShowTopics();
173
- this.calculateShouldShowMap();
174
- },
175
- shouldShowTopics(nextValue) {
176
- this.handleWindowResize();
177
- },
178
- shouldShowMap(nextValue) {
179
- this.handleWindowResize();
180
- },
181
- },
182
- mounted() {
183
- let defaultLayers = [];
184
-
185
- if (this.$config.initialPopover && window.location.hash == '') {
186
- this.$store.commit('setPopoverOpen', true);
187
- this.$store.commit('setPopoverOptions', this.$config.initialPopover.options);
188
- if (this.$config.initialPopover.slots) {
189
- this.$store.commit('setPopoverText', this.$config.initialPopover.slots.text);
190
- }
191
- }
192
-
193
- if (this.$config.topics != undefined) {
194
- for (let topic of this.$config.topics) {
195
- for (let component of topic.components) {
196
- if (component.type === 'checkbox-set' || component.type === 'radio-button-set') {
197
- defaultLayers = defaultLayers.concat(component.options.defaultTopicLayers);
198
- }
199
- }
200
- }
201
- }
202
-
203
- this.$store.commit('setDefaultLayers', defaultLayers);
204
- this.$store.commit('setWebMapActiveLayers', defaultLayers);
205
-
206
- if (this.$config.defaultPanel) {
207
- if (this.$config.defaultPanel === 'topics') {
208
- this.$store.commit('setDidToggleTopicsOn', true);
209
- }
210
- }
211
-
212
- if (this.$config.dataSources) {
213
- this.$controller.dataManager.fetchData();
214
- }
215
-
216
- window.addEventListener('resize', this.handleWindowResize);
217
- this.handleWindowResize();
218
-
219
- const store = this.$store;
220
- const cartoUrlQuery = `https://phl.carto.com:443/api/v2/sql?q= \
221
- select url_text, COALESCE(representation, '') as representation \
222
- from phl.knack_metadata_reps_endpoints_join \
223
- WHERE ( format = 'API' OR format = 'GeoService' ) \
224
- AND url_text IS NOT null`;
225
-
226
- axios.get(cartoUrlQuery).then(response => {
227
- const data = response.data.rows;
228
- let bennyEndpoints = {};
229
- data.map((datum) => {
230
- const shortUrl = datum.url_text.split('query')[0].replace('https://', '').replace('http://', '').replace(/\/$/, "").toLowerCase();
231
- bennyEndpoints[shortUrl] = datum.representation;
232
- });
233
- store.commit('setBennyEndpoints', bennyEndpoints);
234
- }, () => {
235
- console.log('AXIOS ERROR Layerboard.vue');
236
- });
237
- },
238
- methods: {
239
- // for mobile only
240
- toggleTopics() {
241
- const prevVal = this.$store.state.didToggleTopicsOn;
242
- this.$store.commit('setDidToggleTopicsOn', !prevVal);
243
- },
244
- calculateShouldShowTopics() {
245
- const windowWidth = this.windowDim.width;
246
- const smallScreen = windowWidth < 750;
247
- const didToggleTopicsOn = this.$store.state.didToggleTopicsOn;
248
- const fullScreenMapEnabled = this.$store.state.fullScreenMapEnabled;
249
- const shouldShowTopics = !smallScreen && !fullScreenMapEnabled || smallScreen && didToggleTopicsOn;
250
- this.$store.commit('setShouldShowTopics', shouldShowTopics);
251
- },
252
- calculateShouldShowMap() {
253
- const windowWidth = this.windowDim.width;
254
- const notMobile = windowWidth > 750;
255
- const didToggleTopicsOn = this.$store.state.didToggleTopicsOn;
256
- const shouldShowMap = notMobile || !didToggleTopicsOn;
257
- this.$store.commit('setShouldShowMap', shouldShowMap);
258
- },
259
- handleWindowResize() {
260
- const windowHeight = window.innerHeight;
261
- const rootElement = document.getElementById('mb-root');
262
- const rootStyle = window.getComputedStyle(rootElement);
263
- const rootWidth = rootStyle.getPropertyValue('width');
264
- const rootHeight = rootStyle.getPropertyValue('height');
265
- const rootWidthNum = parseInt(rootWidth.replace('px', ''));
266
- const rootHeightNum = parseInt(rootHeight.replace('px', ''));
267
- const dim = {
268
- width: rootWidthNum,
269
- height: rootHeightNum,
270
- };
271
- this.$store.commit('setWindowDimensions', dim);
272
- },
273
- },
274
- };
275
- </script>
276
-
277
- <style>
278
- /*don't highlight any form elements*/
279
- input:focus,
280
- select:focus,
281
- textarea:focus,
282
- button:focus {
283
- outline: none;
284
- }
285
-
286
- /* standards applies padding to buttons, which causes some weirdness with
287
- buttons on the map panel. override here. */
288
- button {
289
- padding: inherit;
290
- }
291
-
292
- .mb-root {
293
- position: absolute;
294
- bottom: 0;
295
- top: 78px;
296
- left: 0;
297
- right: 0;
298
- overflow: auto;
299
- }
300
-
301
- .datasets-button {
302
- display: none;
303
- height: 36px;
304
- margin: 0;
305
- }
306
-
307
- /*small devices only*/
308
- /* @media screen and (max-width: 39.9375em) { */
309
- @media screen and (max-width: 750px) {
310
- .datasets-button {
311
- display: block;
312
- height: 36px;
313
- }
314
- }
315
- </style>
@@ -1,112 +0,0 @@
1
- <template>
2
- <div>
3
- <div class="app-footer">
4
- <div class="row expanded">
5
- <div class="columns">
6
- <nav>
7
- <ul class="inline-list">
8
- <!-- <li v-for="link in this.$config.footerContent"> -->
9
- <topic-component-group
10
- :topic-components="footerComponents"
11
- :is-list="true"
12
- />
13
- <!-- <popover-link :options="this.popoverLinkOptions"
14
- :slots="this.popoverLinkSlots"
15
- :customStyle="this.customStyle"
16
- /> -->
17
- <!-- </li> -->
18
- <!-- <li>
19
- <a target="_blank" :href="this.feedbackUrl">Feedback</a>
20
- </li> -->
21
- </ul>
22
- </nav>
23
- </div>
24
- </div>
25
- </div>
26
- </div>
27
- </template>
28
-
29
-
30
- <script>
31
-
32
- import TopicComponentGroup from '@phila/vue-comps/src/components/TopicComponentGroup.vue';
33
-
34
- export default {
35
- name: 'LbFooter',
36
- components: {
37
- TopicComponentGroup,
38
- // PopoverLink: () => import(/* webpackChunkName: "lblb_pvc_PopoverLink" */'@phila/vue-comps/src/components/PopoverLink.vue'),
39
- },
40
- computed: {
41
- footerContent() {
42
- return this.$config.footerContent;
43
- },
44
- footerComponents() {
45
- if (this.$config.footerContent.components) {
46
- return this.$config.footerContent.components;
47
- }
48
- return null;
49
- // if no components, use a single 'checkbox-set'
50
- // return [{ type: 'checkbox-set' }];
51
-
52
- },
53
- feedbackUrl() {
54
- if (this.$config.footer) {
55
- if (this.$config.footer.feedbackUrl) {
56
- return this.$config.footer.feedbackUrl;
57
- }
58
- return null;
59
-
60
- }
61
- return null;
62
-
63
- },
64
- customStyle() {
65
- if (this.$config.footer) {
66
- if (this.$config.footer.helpPopover) {
67
- if (this.$config.footer.helpPopover.linkStyle) {
68
- return this.$config.footer.helpPopover.linkStyle;
69
- }
70
- return { 'color': 'white', 'border-bottom': '0px' };
71
-
72
- }
73
- return { 'color': 'white', 'border-bottom': '0px' };
74
-
75
- }
76
- return { 'color': 'white', 'border-bottom': '0px' };
77
-
78
- },
79
- popoverHeight() {
80
- if (this.$config.footer) {
81
- if (this.$config.footer.helpPopover) {
82
- if (this.$config.footer.helpPopover.height) {
83
- return this.$config.footer.helpPopover.height;
84
- }
85
- return '80%';
86
-
87
- }
88
- return '80%';
89
-
90
- }
91
- return '80%';
92
-
93
- },
94
- popoverLinkOptions() {
95
- return {
96
- height: this.popoverHeight,
97
- components: [
98
- {
99
- type: 'helpInstructions',
100
- },
101
- ],
102
- };
103
- },
104
- popoverLinkSlots() {
105
- return {
106
- shouldShowValue: false,
107
- value: 'Help',
108
- };
109
- },
110
- },
111
- };
112
- </script>