Repository navigation
Expand file tree
/
Copy pathExampleMapList.js
More file actions
75 lines (69 loc) · 2.04 KB
/
Copy pathExampleMapList.js
File metadata and controls
75 lines (69 loc) · 2.04 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
import * as React from 'react';
import { View, StyleSheet, Dimensions, Text, TouchableHighlight, PixelRatio, FlatList } from 'react-native';
import NavigationService from '../NavigationService';
import Thumbnails from '../component/Thumbnails';
const defalutImageSrc = require('../../image/mapImage0.png');
const width = Dimensions.get('window').width;
const vectorMap = '矢量地图',map3D = '三维场景',ObliquePhoto = '倾斜摄影';
const testData = [{ key: vectorMap }, { key: ObliquePhoto }, { key: 'GL地图瓦片' }, { key: '影像叠加矢量地图' }, { key: map3D }, { key: 'CAD' }];
export default class ExampleMapList extends React.Component {
_itemClick = (key) => {
switch(key){
case vectorMap:
NavigationService.navigate('LocalMapView', { path: '/SampleData/Changchun/Changchun.smwu' });
break;
case map3D:
NavigationService.navigate('Map3D', { path: '/SampleData/凯德Mall/凯德Mall.sxwu' });
break;
case ObliquePhoto:
NavigationService.navigate('Map3D', { path: '/SampleData/MaSai/MaSai.sxwu' });
break;
default:
break;
}
}
_renderItem = ({ item }) => {
let key = item.key;
let src =defalutImageSrc;
switch (key){
case vectorMap:
src = require('../../image/VectorMap.png');
break;
case map3D:
src = require('../../image/map3D.png');
break;
case ObliquePhoto:
src = require('../../image/ObliquePhoto.png');
break;
}
return (
<Thumbnails title={key} src={src} btnClick={()=>this._itemClick(key)} />
);
}
render() {
return (
<View style={styles.container}>
<FlatList
data={testData}
renderItem={this._renderItem}
horizontal={false}
numColumns={2}
/>
</View>
);
}
}
const styles = StyleSheet.create({
item: {
display: 'flex',
justifyContent: 'center',
height: 40,
width: width,
paddingLeft: 15,
},
container: {
flex: 1,
backgroundColor: 'white',
alignSelf: 'center',
},
});