-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathBasicRaster.vue
56 lines (50 loc) · 1.73 KB
/
BasicRaster.vue
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
<template>
<Page ref="page">
<ActionBar :title="title" backgroundColor="#3F51B5">
<NavigationButton text="Go Back" android.systemIcon="ic_menu_back" @tap="$navigateBack" />
</ActionBar>
<GridLayout orientation="vertical" rows="*,50">
<!-- <BottomSheet :steps="[0, 100]"> -->
<CartoMap ref="mapView" row="0" zoom="15" width="100%" height="100%" @mapReady="onMapReady" focusPos="45.19199, 5.7190" />
<!-- <GridLayout ref="bottomSheet" :height="100" /> -->
<!-- </BottomSheet> -->
</GridLayout>
</Page>
</template>
<script lang="ts">
import { HTTPTileDataSource } from '@nativescript-community/ui-carto/datasources/http';
import { RasterTileLayer } from '@nativescript-community/ui-carto/layers/raster';
import { CartoMap, MapEventData } from '@nativescript-community/ui-carto/ui';
import Vue from 'nativescript-vue';
import { Component } from 'vue-property-decorator';
@Component({})
export default class BasicRaster extends Vue {
title: string;
destroyed() {
setTimeout(function () {
__collect();
}, 2000);
}
onMapReady(e: MapEventData) {
const mapView = e.object as CartoMap;
mapView.setFocusPos({ longitude: 6, latitude: 45 }, 0);
const dataSource = new HTTPTileDataSource({
minZoom: 0,
maxZoom: 22,
subdomains: 'abc',
url: 'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'
});
const rasterLayer = new RasterTileLayer({
dataSource,
zoomLevelBias: 1
});
mapView.addLayer(rasterLayer);
}
}
</script>
<style scoped>
ActionBar {
background-color: #3f51b5;
color: #ffffff;
}
</style>