Showing
26 changed files
with
9 additions
and
933 deletions
1 | 1 | ||
2 | var SERVER_lOCAL = "f3eb38c42803.ngrok.io" | 2 | var SERVER_lOCAL = "f3eb38c42803.ngrok.io" |
3 | -var SERVER_= "311cd4338cad.ngrok.io" | 3 | +var SERVER_= "53d03390d6cb.ngrok.io" |
4 | var SERVER = SERVER_ | 4 | var SERVER = SERVER_ |
5 | export { SERVER } | 5 | export { SERVER } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -13,14 +13,15 @@ class MainPage extends Component { | ... | @@ -13,14 +13,15 @@ class MainPage extends Component { |
13 | 13 | ||
14 | super(props) | 14 | super(props) |
15 | 15 | ||
16 | - //AsyncStorage.getItem('isFirst',(err,result) => { | 16 | + AsyncStorage.getItem('isFirst',(err,result) => { |
17 | - // | 17 | + |
18 | - // JSON.parse(result)? this.props.navigation.navigate('App'): | 18 | + JSON.parse(result)? this.props.navigation.navigate('App'): |
19 | - // | 19 | + |
20 | - // this.props.navigation.navigate('Guidance') | 20 | + this.props.navigation.navigate('Guidance') |
21 | - // | 21 | + |
22 | - //}) | 22 | + }) |
23 | this.props.navigation.navigate('Guidance') | 23 | this.props.navigation.navigate('Guidance') |
24 | + | ||
24 | } | 25 | } |
25 | _onRefresh = () => { | 26 | _onRefresh = () => { |
26 | this.setState({refreshing: true}); | 27 | this.setState({refreshing: true}); | ... | ... |
소스코드/.gitignore
deleted
100644 → 0
소스코드/PME/.expo-shared/assets.json
deleted
100644 → 0
소스코드/PME/.gitignore
deleted
100644 → 0
소스코드/PME/App.js
deleted
100644 → 0
1 | -import { Component } from 'react'; | ||
2 | -import { StyleSheet, Text, View, AppRegistry } from 'react-native'; | ||
3 | -import { createAppContainer } from 'react-navigation'; | ||
4 | -import {createStackNavigator } from 'react-navigation-stack' | ||
5 | -import MainScreen from './components/Navigation/Navigation'; | ||
6 | -import React from 'react' | ||
7 | - | ||
8 | -const AppStackNavigator = createStackNavigator({ | ||
9 | - Main:{ | ||
10 | - screen: MainScreen, | ||
11 | - navigationOptions: { | ||
12 | - headerShown:false | ||
13 | - } | ||
14 | - } | ||
15 | -}); | ||
16 | - | ||
17 | -export default createAppContainer(AppStackNavigator); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
소스코드/PME/app.json
deleted
100644 → 0
1 | -{ | ||
2 | - "expo": { | ||
3 | - "name": "HelloWorld", | ||
4 | - "slug": "PME", | ||
5 | - "platforms": [ | ||
6 | - "ios", | ||
7 | - "android", | ||
8 | - "web" | ||
9 | - ], | ||
10 | - "version": "1.0.0", | ||
11 | - "orientation": "portrait", | ||
12 | - "icon": "./assets/icon.png", | ||
13 | - "splash": { | ||
14 | - "image": "./assets/splash.png", | ||
15 | - "resizeMode": "contain", | ||
16 | - "backgroundColor": "#ffffff" | ||
17 | - }, | ||
18 | - "updates": { | ||
19 | - "fallbackToCacheTimeout": 0 | ||
20 | - }, | ||
21 | - "assetBundlePatterns": [ | ||
22 | - "**/*" | ||
23 | - ], | ||
24 | - "ios": { | ||
25 | - "supportsTablet": true | ||
26 | - }, | ||
27 | - "android" : { | ||
28 | - "package" : "com.A.BLE", | ||
29 | - "config": { | ||
30 | - "googleMaps": {"apiKey":"AIzaSyCe_1-Mml2OyihnmS2oiPUj73X-Aj1j_2k"} | ||
31 | - } | ||
32 | - } | ||
33 | - } | ||
34 | -} |
소스코드/PME/assets/icon.png
deleted
100644 → 0
642 Bytes
소스코드/PME/assets/marker.png
deleted
100644 → 0
3.44 KB
소스코드/PME/assets/security.png
deleted
100644 → 0
6.19 KB
소스코드/PME/assets/splash.png
deleted
100644 → 0
9.09 KB
소스코드/PME/babel.config.js
deleted
100644 → 0
1 | -import React, { memo, useState, useEffect, useMemo, createRef } from "react"; | ||
2 | -import { Dimensions, LayoutAnimation, Platform } from "react-native"; | ||
3 | -import MapView, { Marker, Polyline } from "react-native-maps"; | ||
4 | -import SuperCluster from "supercluster"; | ||
5 | -import ClusterMarker from "./ClusteredMarker"; | ||
6 | -import { | ||
7 | - isMarker, | ||
8 | - markerToGeoJSONFeature, | ||
9 | - calculateBBox, | ||
10 | - returnMapZoom, | ||
11 | - generateSpiral | ||
12 | -} from "./helpers"; | ||
13 | - | ||
14 | -const ClusteredMapView = ({ | ||
15 | - radius, | ||
16 | - maxZoom, | ||
17 | - minZoom, | ||
18 | - extent, | ||
19 | - nodeSize, | ||
20 | - children, | ||
21 | - onClusterPress, | ||
22 | - onRegionChangeComplete, | ||
23 | - preserveClusterPressBehavior, | ||
24 | - clusteringEnabled, | ||
25 | - clusterColor, | ||
26 | - clusterTextColor, | ||
27 | - spiderLineColor, | ||
28 | - layoutAnimationConf, | ||
29 | - animationEnabled, | ||
30 | - renderCluster, | ||
31 | - ...restProps | ||
32 | -}) => { | ||
33 | - const [markers, updateMarkers] = useState([]); | ||
34 | - const [spiderMarkers, updateSpiderMarker] = useState([]); | ||
35 | - const [otherChildren, updateChildren] = useState([]); | ||
36 | - const [superCluster, setSuperCluster] = useState(null); | ||
37 | - const [currentRegion, updateRegion] = useState( | ||
38 | - restProps.region || restProps.initialRegion | ||
39 | - ); | ||
40 | - | ||
41 | - const [isSpiderfier, updateSpiderfier] = useState(false); | ||
42 | - const [spiderfierMarker, updateSpiderfierMarker] = useState(null); | ||
43 | - const [clusterChildren, updateClusterChildren] = useState(null); | ||
44 | - const mapRef = createRef(); | ||
45 | - | ||
46 | - const propsChildren = useMemo(() => React.Children.toArray(children), [ | ||
47 | - children | ||
48 | - ]); | ||
49 | - | ||
50 | - useEffect(() => { | ||
51 | - const rawData = []; | ||
52 | - const otherChildren = []; | ||
53 | - | ||
54 | - if (!clusteringEnabled) { | ||
55 | - updateChildren(propsChildren); | ||
56 | - return; | ||
57 | - } | ||
58 | - | ||
59 | - React.Children.forEach(children, (child, i) => { | ||
60 | - if (isMarker(child)) { | ||
61 | - rawData.push(markerToGeoJSONFeature(child, i)); | ||
62 | - } else { | ||
63 | - otherChildren.push(child); | ||
64 | - } | ||
65 | - }); | ||
66 | - | ||
67 | - const superCluster = new SuperCluster({ | ||
68 | - radius, | ||
69 | - maxZoom, | ||
70 | - minZoom, | ||
71 | - extent, | ||
72 | - nodeSize | ||
73 | - }); | ||
74 | - | ||
75 | - superCluster.load(rawData); | ||
76 | - | ||
77 | - const bBox = calculateBBox(currentRegion); | ||
78 | - const zoom = returnMapZoom(currentRegion, bBox, minZoom); | ||
79 | - const markers = superCluster.getClusters(bBox, zoom); | ||
80 | - | ||
81 | - updateMarkers(markers); | ||
82 | - updateChildren(otherChildren); | ||
83 | - setSuperCluster(superCluster); | ||
84 | - }, [children, restProps.region, restProps.initialRegion]); | ||
85 | - | ||
86 | - useEffect(() => { | ||
87 | - if (isSpiderfier && markers.length > 0) { | ||
88 | - let positions = generateSpiral( | ||
89 | - markers[0].properties.point_count, | ||
90 | - markers[0].geometry.coordinates, | ||
91 | - clusterChildren | ||
92 | - ); | ||
93 | - updateSpiderMarker(positions); | ||
94 | - updateSpiderfierMarker({ | ||
95 | - latitude: markers[0].geometry.coordinates[1], | ||
96 | - longitude: markers[0].geometry.coordinates[0] | ||
97 | - }); | ||
98 | - } else { | ||
99 | - updateSpiderMarker([]); | ||
100 | - } | ||
101 | - }, [isSpiderfier]); | ||
102 | - | ||
103 | - const _onRegionChangeComplete = region => { | ||
104 | - if (superCluster) { | ||
105 | - const bBox = calculateBBox(region); | ||
106 | - const zoom = returnMapZoom(region, bBox, minZoom); | ||
107 | - const markers = superCluster.getClusters(bBox, zoom); | ||
108 | - | ||
109 | - if (animationEnabled && Platform.OS === "ios") { | ||
110 | - LayoutAnimation.configureNext(layoutAnimationConf); | ||
111 | - } | ||
112 | - | ||
113 | - if (zoom >= 17 && markers.length === 1 && clusterChildren) { | ||
114 | - updateSpiderfier(true); | ||
115 | - } else { | ||
116 | - updateSpiderfier(false); | ||
117 | - } | ||
118 | - | ||
119 | - updateMarkers(markers); | ||
120 | - onRegionChangeComplete(region, markers); | ||
121 | - updateRegion(region); | ||
122 | - } | ||
123 | - }; | ||
124 | - | ||
125 | - const _onClusterPress = cluster => () => { | ||
126 | - const children = superCluster.getLeaves(cluster.id); | ||
127 | - updateClusterChildren(children); | ||
128 | - | ||
129 | - if (preserveClusterPressBehavior) { | ||
130 | - onClusterPress(cluster, children); | ||
131 | - return; | ||
132 | - } | ||
133 | - | ||
134 | - const coordinates = children.map(({ geometry }) => ({ | ||
135 | - latitude: geometry.coordinates[1], | ||
136 | - longitude: geometry.coordinates[0] | ||
137 | - })); | ||
138 | - | ||
139 | - mapRef.current.fitToCoordinates(coordinates, { | ||
140 | - edgePadding: restProps.edgePadding | ||
141 | - }); | ||
142 | - | ||
143 | - onClusterPress(cluster, children); | ||
144 | - }; | ||
145 | - | ||
146 | - return ( | ||
147 | - <MapView | ||
148 | - {...restProps} | ||
149 | - ref={map => { | ||
150 | - restProps.mapRef(map); | ||
151 | - mapRef.current = map; | ||
152 | - }} | ||
153 | - onRegionChangeComplete={_onRegionChangeComplete} | ||
154 | - > | ||
155 | - {markers.map(marker => | ||
156 | - marker.properties.point_count === 0 ? ( | ||
157 | - propsChildren[marker.properties.index] | ||
158 | - ) : !isSpiderfier ? ( | ||
159 | - renderCluster ? ( | ||
160 | - renderCluster({ | ||
161 | - onPress: _onClusterPress(marker), | ||
162 | - clusterColor, | ||
163 | - clusterTextColor, | ||
164 | - ...marker | ||
165 | - }) | ||
166 | - ) : ( | ||
167 | - <ClusterMarker | ||
168 | - key={`cluster-${marker.id}`} | ||
169 | - {...marker} | ||
170 | - onPress={_onClusterPress(marker)} | ||
171 | - clusterColor={clusterColor} | ||
172 | - clusterTextColor={clusterTextColor} | ||
173 | - /> | ||
174 | - ) | ||
175 | - ) : null | ||
176 | - )} | ||
177 | - {otherChildren} | ||
178 | - {spiderMarkers.map(marker => ( | ||
179 | - <Marker | ||
180 | - key={marker.latitude} | ||
181 | - coordinate={marker} | ||
182 | - image={marker.image} | ||
183 | - onPress={marker.onPress} | ||
184 | - ></Marker> | ||
185 | - ))} | ||
186 | - {spiderMarkers.map((marker, index) => { | ||
187 | - { | ||
188 | - return ( | ||
189 | - spiderfierMarker && ( | ||
190 | - <Polyline | ||
191 | - key={index} | ||
192 | - coordinates={[spiderfierMarker, marker, spiderfierMarker]} | ||
193 | - strokeColor={spiderLineColor} | ||
194 | - strokeWidth={1} | ||
195 | - /> | ||
196 | - ) | ||
197 | - ); | ||
198 | - } | ||
199 | - })} | ||
200 | - </MapView> | ||
201 | - ); | ||
202 | -}; | ||
203 | - | ||
204 | -ClusteredMapView.defaultProps = { | ||
205 | - clusteringEnabled: true, | ||
206 | - animationEnabled: true, | ||
207 | - preserveClusterPressBehavior: false, | ||
208 | - layoutAnimationConf: LayoutAnimation.Presets.spring, | ||
209 | - // SuperCluster parameters | ||
210 | - radius: Dimensions.get("window").width * 0.06, | ||
211 | - maxZoom: 20, | ||
212 | - minZoom: 1, | ||
213 | - extent: 512, | ||
214 | - nodeSize: 64, | ||
215 | - // Map parameters | ||
216 | - edgePadding: { top: 50, left: 50, right: 50, bottom: 50 }, | ||
217 | - // Cluster styles | ||
218 | - clusterColor: "#00B386", | ||
219 | - clusterTextColor: "#FFFFFF", | ||
220 | - spiderLineColor: "#FF0000", | ||
221 | - // Callbacks | ||
222 | - onRegionChangeComplete: () => {}, | ||
223 | - onClusterPress: () => {}, | ||
224 | - mapRef: () => {} | ||
225 | -}; | ||
226 | - | ||
227 | -export default memo(ClusteredMapView); |
1 | -import React, { memo } from "react"; | ||
2 | -import { Text, View, StyleSheet, TouchableOpacity } from "react-native"; | ||
3 | -import { Marker } from "react-native-maps"; | ||
4 | -import { returnMarkerStyle } from "./helpers"; | ||
5 | - | ||
6 | -const ClusteredMarker = ({ | ||
7 | - geometry, | ||
8 | - properties, | ||
9 | - onPress, | ||
10 | - clusterColor, | ||
11 | - clusterTextColor | ||
12 | -}) => { | ||
13 | - const points = properties.point_count; | ||
14 | - const { width, height, fontSize, size } = returnMarkerStyle(points); | ||
15 | - | ||
16 | - return ( | ||
17 | - <Marker | ||
18 | - coordinate={{ | ||
19 | - longitude: geometry.coordinates[0], | ||
20 | - latitude: geometry.coordinates[1] | ||
21 | - }} | ||
22 | - style={{ zIndex: points + 1 }} | ||
23 | - onPress={onPress} | ||
24 | - > | ||
25 | - <TouchableOpacity | ||
26 | - activeOpacity={0.5} | ||
27 | - style={[styles.container, { width, height }]} | ||
28 | - > | ||
29 | - <View | ||
30 | - style={[ | ||
31 | - styles.wrapper, | ||
32 | - { | ||
33 | - backgroundColor: clusterColor, | ||
34 | - width, | ||
35 | - height, | ||
36 | - borderRadius: width / 2 | ||
37 | - } | ||
38 | - ]} | ||
39 | - /> | ||
40 | - <View | ||
41 | - style={[ | ||
42 | - styles.cluster, | ||
43 | - { | ||
44 | - backgroundColor: clusterColor, | ||
45 | - width: size, | ||
46 | - height: size, | ||
47 | - borderRadius: size / 2 | ||
48 | - } | ||
49 | - ]} | ||
50 | - > | ||
51 | - <Text style={[styles.text, { color: clusterTextColor, fontSize }]}> | ||
52 | - {points} | ||
53 | - </Text> | ||
54 | - </View> | ||
55 | - </TouchableOpacity> | ||
56 | - </Marker> | ||
57 | - ); | ||
58 | -}; | ||
59 | - | ||
60 | -const styles = StyleSheet.create({ | ||
61 | - container: { | ||
62 | - display: "flex", | ||
63 | - justifyContent: "center", | ||
64 | - alignItems: "center" | ||
65 | - }, | ||
66 | - wrapper: { | ||
67 | - position: "absolute", | ||
68 | - opacity: 0.5, | ||
69 | - zIndex: 0 | ||
70 | - }, | ||
71 | - cluster: { | ||
72 | - display: "flex", | ||
73 | - justifyContent: "center", | ||
74 | - alignItems: "center", | ||
75 | - zIndex: 1 | ||
76 | - }, | ||
77 | - text: { | ||
78 | - fontWeight: "bold" | ||
79 | - } | ||
80 | -}); | ||
81 | - | ||
82 | -export default memo(ClusteredMarker); |
소스코드/PME/components/MainTab.js
deleted
100644 → 0
1 | -import { Component } from 'react'; | ||
2 | -import { StyleSheet, Text, View, Image, TouchableOpacity, Alert } from 'react-native'; | ||
3 | -import { Icon } from 'native-base'; // 추가된 코드 | ||
4 | -import React from 'react' | ||
5 | -import {Marker} from 'react-native-maps' | ||
6 | -import Constants from 'expo-constants'; | ||
7 | -import * as Location from 'expo-location'; | ||
8 | -import MapView from "../ClusteredMapView"; | ||
9 | - | ||
10 | - | ||
11 | -export default class MainScreen extends Component { | ||
12 | - | ||
13 | - // navigationOptions 코드 추가 | ||
14 | - static navigationOptions = { | ||
15 | - headerLeft: <Icon name='ios-camera' style={{ paddingLeft:10 }}/>, | ||
16 | - title: 'PME Service', | ||
17 | - headerRight: <Icon name='ios-send' style={{ paddingRight:10 }}/>, | ||
18 | - } | ||
19 | - constructor(props) { | ||
20 | - super(props) | ||
21 | - this.state= { | ||
22 | - location:null, | ||
23 | - errorMsg:null | ||
24 | - } | ||
25 | - } | ||
26 | - componentDidMount() { | ||
27 | - (async () => { | ||
28 | - let { status } = await Location.requestPermissionsAsync(); | ||
29 | - if (status !== 'granted') { | ||
30 | - this.setState({ | ||
31 | - errorMsg:'Permission to access location was denied' | ||
32 | - }) | ||
33 | - } | ||
34 | - | ||
35 | - let location = await Location.getCurrentPositionAsync({}); | ||
36 | - console.log(location) | ||
37 | - this.setState({ | ||
38 | - location | ||
39 | - },() => { | ||
40 | - console.log(this.state.location.coords.latitude) | ||
41 | - }) | ||
42 | - })(); | ||
43 | - } | ||
44 | - render() { | ||
45 | - return ( | ||
46 | - //this.state.location? | ||
47 | - <View style={{width:"100%",height:"100%"}}> | ||
48 | - | ||
49 | - <TouchableOpacity onPress={() => Alert.alert('OK',"주변에 의심자가 있습니까?",[{text:"OK",onPress:() =>alert("확인")},{text:'cancel'}])} style={{position:"absolute",bottom:10,right:10, width:50,height:50,backgroundColor:"red",borderRadius:100}}> | ||
50 | - <View style={{flex:1,justifyContent: 'center',alignItems: 'center'}}> | ||
51 | - <Image style={{width:22,height:22}} source={require('../assets/security.png')}/> | ||
52 | - </View> | ||
53 | - </TouchableOpacity> | ||
54 | - </View> | ||
55 | - //:<Text>Loading..</Text> | ||
56 | - | ||
57 | - ); | ||
58 | - } | ||
59 | -} | ||
60 | - | ||
61 | -const styles = StyleSheet.create({ | ||
62 | - container: { | ||
63 | - flex: 1, | ||
64 | - alignItems: 'center', | ||
65 | - justifyContent: 'center', | ||
66 | - }, | ||
67 | -}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -import React, { Component } from 'react'; | ||
2 | -import { StyleSheet, Text, View, Image, | ||
3 | - TouchableOpacity, ScrollView, Dimensions, | ||
4 | - SafeAreaView, } from 'react-native'; | ||
5 | - | ||
6 | -import { createAppContainer} from 'react-navigation'; | ||
7 | -import {createStackNavigator } from 'react-navigation-stack'; | ||
8 | -import ReportTab from '../TabNavigator/reportTab' | ||
9 | -import MainTab from '../TabNavigator/MainTab' | ||
10 | -import { Icon } from 'native-base'; // 추가된 코드 | ||
11 | - | ||
12 | - const Stack = createStackNavigator( | ||
13 | - { | ||
14 | - MainTab: { | ||
15 | - screen: props => <MainTab {...props}/>, | ||
16 | - navigationOptions: { | ||
17 | - headerLeft: <Icon name='ios-camera' style={{ paddingLeft:10 }}/>, | ||
18 | - title: 'PME Service', | ||
19 | - headerRight: <Icon name='ios-send' style={{ paddingRight:10 }}/>, | ||
20 | - headerTitleStyle: {flex: 1, textAlign: 'center'}, | ||
21 | - headerStyle: { | ||
22 | - shadowOpacity: 0, | ||
23 | - shadowOffset: { | ||
24 | - y: 0, | ||
25 | - x:0, | ||
26 | - height:0 | ||
27 | - }, | ||
28 | - shadowRadius: 0, elevation:0 | ||
29 | - } | ||
30 | - }, | ||
31 | - } | ||
32 | - ,reportTab: { | ||
33 | - screen: props=> <ReportTab {...props}/>, | ||
34 | - navigationOptions: { | ||
35 | - headerShown:false | ||
36 | - } | ||
37 | - }, | ||
38 | - },{ | ||
39 | - | ||
40 | - | ||
41 | - | ||
42 | - } | ||
43 | - ); | ||
44 | - | ||
45 | - export default createAppContainer(Stack); | ||
46 | - | ||
47 | - /* | ||
48 | - | ||
49 | - <Text | ||
50 | - onPress={() => { | ||
51 | - props.navigation.navigate('BlueScreen'); | ||
52 | - props.navigation.closeDrawer(); | ||
53 | - }} | ||
54 | - > | ||
55 | - BlueScreen | ||
56 | - </Text> | ||
57 | - <Text | ||
58 | - onPress={() => { | ||
59 | - props.navigation.navigate('DefaultScreen'); | ||
60 | - props.navigation.closeDrawer(); | ||
61 | - }} | ||
62 | - > | ||
63 | - DefaultScreen | ||
64 | - </Text> | ||
65 | - */ | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -import { Component } from 'react'; | ||
2 | -import { StyleSheet, Text, View, Image, TouchableOpacity, Alert, Platform } from 'react-native'; | ||
3 | -import { Icon } from 'native-base'; // 추가된 코드 | ||
4 | -import React from 'react' | ||
5 | -import {Marker} from 'react-native-maps' | ||
6 | -import Constants from 'expo-constants'; | ||
7 | -import * as Location from 'expo-location'; | ||
8 | -import MapView from "../ClusteredMapView"; | ||
9 | - | ||
10 | -import Share from 'react-native-share'; | ||
11 | -const url = 'https://awesome.contents.com/'; | ||
12 | -const title = 'Awesome Contents'; | ||
13 | -const message = 'Please check this out.'; | ||
14 | -const icon = 'data:<data_type>/<file_extension>;base64,<base64_data>'; | ||
15 | -const options = Platform.select({ | ||
16 | - ios: { | ||
17 | - activityItemSources: [ | ||
18 | - { // For sharing url with custom title. | ||
19 | - placeholderItem: { type: 'url', content: url }, | ||
20 | - item: { | ||
21 | - default: { type: 'url', content: url }, | ||
22 | - }, | ||
23 | - subject: { | ||
24 | - default: title, | ||
25 | - }, | ||
26 | - linkMetadata: { originalUrl: url, url, title }, | ||
27 | - }, | ||
28 | - { // For sharing text. | ||
29 | - placeholderItem: { type: 'text', content: message }, | ||
30 | - item: { | ||
31 | - default: { type: 'text', content: message }, | ||
32 | - message: null, // Specify no text to share via Messages app. | ||
33 | - }, | ||
34 | - linkMetadata: { // For showing app icon on share preview. | ||
35 | - title: message | ||
36 | - }, | ||
37 | - }, | ||
38 | - { // For using custom icon instead of default text icon at share preview when sharing with message. | ||
39 | - placeholderItem: { | ||
40 | - type: 'url', | ||
41 | - content: icon | ||
42 | - }, | ||
43 | - item: { | ||
44 | - default: { | ||
45 | - type: 'text', | ||
46 | - content: `${message} ${url}` | ||
47 | - }, | ||
48 | - }, | ||
49 | - linkMetadata: { | ||
50 | - title: message, | ||
51 | - icon: icon | ||
52 | - } | ||
53 | - }, | ||
54 | - ], | ||
55 | - }, | ||
56 | - default: { | ||
57 | - title, | ||
58 | - subject: title, | ||
59 | - message: `${message} ${url}`, | ||
60 | - }, | ||
61 | -}); | ||
62 | - | ||
63 | -export default class MainScreen extends Component { | ||
64 | - | ||
65 | - // navigationOptions 코드 추가 | ||
66 | - static navigationOptions = { | ||
67 | - headerLeft: <Icon name='ios-camera' style={{ paddingLeft:10 }}/>, | ||
68 | - title: 'PME Service', | ||
69 | - headerRight: <Icon name='ios-send' style={{ paddingRight:10 }}/>, | ||
70 | - } | ||
71 | - constructor(props) { | ||
72 | - super(props) | ||
73 | - this.state= { | ||
74 | - location:null, | ||
75 | - errorMsg:null | ||
76 | - } | ||
77 | - } | ||
78 | - componentDidMount() { | ||
79 | - (async () => { | ||
80 | - let { status } = await Location.requestPermissionsAsync(); | ||
81 | - if (status !== 'granted') { | ||
82 | - this.setState({ | ||
83 | - errorMsg:'Permission to access location was denied' | ||
84 | - }) | ||
85 | - } | ||
86 | - | ||
87 | - let location = await Location.getCurrentPositionAsync({}); | ||
88 | - console.log(location) | ||
89 | - this.setState({ | ||
90 | - location | ||
91 | - },() => { | ||
92 | - console.log(this.state.location.coords.latitude) | ||
93 | - }) | ||
94 | - })(); | ||
95 | - } | ||
96 | - render() { | ||
97 | - return ( | ||
98 | - this.state.location? | ||
99 | - <View style={{width:"100%",height:"100%"}}> | ||
100 | - | ||
101 | - <MapView | ||
102 | - style={{ flex: 1 }} | ||
103 | - initialRegion={ { latitude: this.state.location.coords.latitude, longitude: this.state.location.coords.longitude | ||
104 | - ,latitudeDelta: 0.0922, longitudeDelta: 0.0421}} | ||
105 | - zoomEnabled={true} | ||
106 | - pitchEnabled={true} | ||
107 | - showsUserLocation={true} | ||
108 | - followsUserLocation={true} | ||
109 | - showsCompass={true} | ||
110 | - showsBuildings={true} | ||
111 | - showsTraffic={true} | ||
112 | - showsIndoors={true} | ||
113 | - extent={512}> | ||
114 | - <Marker coordinate={{ latitude: this.state.location.coords.latitude+0.1, longitude: this.state.location.coords.longitude }} > | ||
115 | - <Image style={{width:54,height:54}} source={require('../../assets/marker.png')}/> | ||
116 | - </Marker> | ||
117 | - <Marker coordinate={{ latitude: this.state.location.coords.latitude+0.5, longitude: this.state.location.coords.longitude }}> | ||
118 | - <Image style={{width:54,height:54}} source={require('../../assets/marker.png')}/> | ||
119 | - </Marker> | ||
120 | - <Marker icon="../../assets/marker.png" coordinate={{ latitude: this.state.location.coords.latitude+0.0001, longitude: this.state.location.coords.longitude }}> | ||
121 | - <Image style={{width:54,height:54}} source={require('../../assets/marker.png')}/> | ||
122 | - </Marker> | ||
123 | - <Marker icon="../../assets/marker.png" coordinate={{ latitude: this.state.location.coords.latitude+0.0003, longitude: this.state.location.coords.longitude }}> | ||
124 | - <Image style={{width:54,height:54}} source={require('../../assets/marker.png')}/> | ||
125 | - </Marker> | ||
126 | - <Marker icon="../../assets/marker.png" coordinate={{ latitude: this.state.location.coords.latitude+0.03, longitude: this.state.location.coords.longitude }}> | ||
127 | - <Image style={{width:54,height:54}} source={require('../../assets/marker.png')}/> | ||
128 | - </Marker> | ||
129 | - <Marker icon="../../assets/marker.png" coordinate={{ latitude: this.state.location.coords.latitude+0.05, longitude: this.state.location.coords.longitude }}> | ||
130 | - <Image style={{width:54,height:54}} source={require('../../assets/marker.png')}/> | ||
131 | - </Marker> | ||
132 | - <Marker icon="../../assets/marker.png" coordinate={{ latitude: this.state.location.coords.latitude+0.01, longitude: this.state.location.coords.longitude }}> | ||
133 | - <Image style={{width:54,height:54}} source={require('../../assets/marker.png')}/> | ||
134 | - </Marker> | ||
135 | - <Marker icon="../../assets/marker.png" coordinate={{ latitude: this.state.location.coords.latitude+0.2, longitude: this.state.location.coords.longitude }}> | ||
136 | - <Image style={{width:54,height:54}} source={require('../../assets/marker.png')}/> | ||
137 | - </Marker> | ||
138 | - <Marker icon="../../assets/marker.png" coordinate={{ latitude: this.state.location.coords.latitude+0.3, longitude: this.state.location.coords.longitude }}> | ||
139 | - <Image style={{width:54,height:54}} source={require('../../assets/marker.png')}/> | ||
140 | - </Marker> | ||
141 | - <Marker icon="../../assets/marker.png" coordinate={{ latitude: this.state.location.coords.latitude+0.7, longitude: this.state.location.coords.longitude }}> | ||
142 | - <Image style={{width:54,height:54}} source={require('../../assets/marker.png')}/> | ||
143 | - </Marker> | ||
144 | - | ||
145 | - </MapView> | ||
146 | - <TouchableOpacity onPress={() => Alert.alert('OK',"주변에 의심자가 있습니까?",[{text:"OK",onPress:() =>Share.open(options)},{text:'cancel'}])} style={{position:"absolute",bottom:10,right:10, width:50,height:50,backgroundColor:"red",borderRadius:100}}> | ||
147 | - <View style={{flex:1,justifyContent: 'center',alignItems: 'center'}}> | ||
148 | - <Image style={{width:22,height:22}} source={require('../../assets/security.png')}/> | ||
149 | - </View> | ||
150 | - </TouchableOpacity> | ||
151 | - </View> | ||
152 | - :<Text>Loading..</Text> | ||
153 | - | ||
154 | - ); | ||
155 | - } | ||
156 | -} | ||
157 | - | ||
158 | -const styles = StyleSheet.create({ | ||
159 | - container: { | ||
160 | - flex: 1, | ||
161 | - alignItems: 'center', | ||
162 | - justifyContent: 'center', | ||
163 | - }, | ||
164 | -}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
1 | -import React, { Component } from 'react'; | ||
2 | -import { View, Text, StyleSheet, Button } from 'react-native'; | ||
3 | -import * as DocumentPicker from 'expo-document-picker'; | ||
4 | -import Icon from 'native-base' | ||
5 | -export default class AddTab extends Component { | ||
6 | - static navigationOptions = { | ||
7 | - headerLeft: <Icon name='ios-camera' style={{ paddingLeft:10 }}/>, | ||
8 | - title: 'PME Service', | ||
9 | - headerRight: <Icon name='ios-send' style={{ paddingRight:10 }}/>, | ||
10 | - } | ||
11 | - state = { | ||
12 | - image: null, | ||
13 | - }; | ||
14 | - _pickDocument = async () => { | ||
15 | - let result = await DocumentPicker.getDocumentAsync({}); | ||
16 | - alert(result.uri); | ||
17 | - console.log(result); | ||
18 | - } | ||
19 | - | ||
20 | - _pickImage = async () => { | ||
21 | - let result = await ImagePicker.launchImageLibraryAsync({ | ||
22 | - allowsEditing: true, | ||
23 | - aspect: [4, 3], | ||
24 | - }); | ||
25 | - | ||
26 | - alert(result.uri); | ||
27 | - console.log(result) | ||
28 | - | ||
29 | - if (!result.cancelled) { | ||
30 | - this.setState({ image: result.uri }); | ||
31 | - } | ||
32 | - }; | ||
33 | - | ||
34 | - render() { | ||
35 | - let { image } = this.state; | ||
36 | - return ( | ||
37 | - <View style={style.container}> | ||
38 | - <Button | ||
39 | - title="녹음파일을 등록해주세요." | ||
40 | - onPress={this._pickDocument} | ||
41 | - /> | ||
42 | - <Button | ||
43 | - title="접수하기" | ||
44 | - onPress={() => {alert("접수되었습니다.")}} | ||
45 | - /> | ||
46 | - </View> | ||
47 | - ); | ||
48 | - } | ||
49 | -} | ||
50 | - | ||
51 | -const style = StyleSheet.create({ | ||
52 | - container: { | ||
53 | - flex: 1, | ||
54 | - alignItems: 'center', | ||
55 | - justifyContent: 'center', | ||
56 | - } | ||
57 | -}); | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
소스코드/PME/components/helpers.js
deleted
100644 → 0
1 | -import GeoViewport from "@mapbox/geo-viewport"; | ||
2 | -import { Dimensions } from "react-native"; | ||
3 | - | ||
4 | -const { width, height } = Dimensions.get("window"); | ||
5 | - | ||
6 | -export const isMarker = child => | ||
7 | - child && | ||
8 | - child.props && | ||
9 | - child.props.coordinate && | ||
10 | - child.props.cluster !== false; | ||
11 | - | ||
12 | -export const calculateBBox = region => { | ||
13 | - let lngD; | ||
14 | - if (region.longitudeDelta < 0) lngD = region.longitudeDelta + 360; | ||
15 | - else lngD = region.longitudeDelta; | ||
16 | - | ||
17 | - return [ | ||
18 | - region.longitude - lngD, // westLng - min lng | ||
19 | - region.latitude - region.latitudeDelta, // southLat - min lat | ||
20 | - region.longitude + lngD, // eastLng - max lng | ||
21 | - region.latitude + region.latitudeDelta // northLat - max lat | ||
22 | - ]; | ||
23 | -}; | ||
24 | - | ||
25 | -export const returnMapZoom = (region, bBox, minZoom) => { | ||
26 | - const viewport = | ||
27 | - region.longitudeDelta >= 40 | ||
28 | - ? { zoom: minZoom } | ||
29 | - : GeoViewport.viewport(bBox, [width, height]); | ||
30 | - | ||
31 | - return viewport.zoom; | ||
32 | -}; | ||
33 | - | ||
34 | -export const markerToGeoJSONFeature = (marker, index) => { | ||
35 | - return { | ||
36 | - type: "Feature", | ||
37 | - geometry: { | ||
38 | - coordinates: [ | ||
39 | - marker.props.coordinate.longitude, | ||
40 | - marker.props.coordinate.latitude | ||
41 | - ], | ||
42 | - type: "Point" | ||
43 | - }, | ||
44 | - properties: { | ||
45 | - point_count: 0, | ||
46 | - index, | ||
47 | - ..._removeChildrenFromProps(marker.props) | ||
48 | - } | ||
49 | - }; | ||
50 | -}; | ||
51 | - | ||
52 | -export const generateSpiral = (count, centerLocation, clusterChildren) => { | ||
53 | - let res = []; | ||
54 | - res.length = count; | ||
55 | - let angle = 0; | ||
56 | - | ||
57 | - for (let i = 0; i < count; i++) { | ||
58 | - angle = 0.25 * (i * 0.5); | ||
59 | - let latitude = centerLocation[1] + 0.0002 * angle * Math.cos(angle); | ||
60 | - let longitude = centerLocation[0] + 0.0002 * angle * Math.sin(angle); | ||
61 | - res[i] = { | ||
62 | - longitude, | ||
63 | - latitude, | ||
64 | - image: clusterChildren[i] && clusterChildren[i].properties.image, | ||
65 | - onPress: clusterChildren[i] && clusterChildren[i].properties.onPress | ||
66 | - }; | ||
67 | - } | ||
68 | - | ||
69 | - return res; | ||
70 | -}; | ||
71 | - | ||
72 | -export const returnMarkerStyle = points => { | ||
73 | - if (points >= 50) { | ||
74 | - return { | ||
75 | - width: 84, | ||
76 | - height: 84, | ||
77 | - size: 64, | ||
78 | - fontSize: 20 | ||
79 | - }; | ||
80 | - } | ||
81 | - | ||
82 | - if (points >= 25) { | ||
83 | - return { | ||
84 | - width: 78, | ||
85 | - height: 78, | ||
86 | - size: 58, | ||
87 | - fontSize: 19 | ||
88 | - }; | ||
89 | - } | ||
90 | - | ||
91 | - if (points >= 15) { | ||
92 | - return { | ||
93 | - width: 72, | ||
94 | - height: 72, | ||
95 | - size: 54, | ||
96 | - fontSize: 18 | ||
97 | - }; | ||
98 | - } | ||
99 | - | ||
100 | - if (points >= 10) { | ||
101 | - return { | ||
102 | - width: 66, | ||
103 | - height: 66, | ||
104 | - size: 50, | ||
105 | - fontSize: 17 | ||
106 | - }; | ||
107 | - } | ||
108 | - | ||
109 | - if (points >= 8) { | ||
110 | - return { | ||
111 | - width: 60, | ||
112 | - height: 60, | ||
113 | - size: 46, | ||
114 | - fontSize: 17 | ||
115 | - }; | ||
116 | - } | ||
117 | - | ||
118 | - if (points >= 4) { | ||
119 | - return { | ||
120 | - width: 84, | ||
121 | - height: 84, | ||
122 | - size: 64, | ||
123 | - fontSize: 16 | ||
124 | - }; | ||
125 | - } | ||
126 | - | ||
127 | - return { | ||
128 | - width: 84, | ||
129 | - height: 84, | ||
130 | - size: 64, | ||
131 | - fontSize: 15 | ||
132 | - }; | ||
133 | -}; | ||
134 | - | ||
135 | -const _removeChildrenFromProps = props => { | ||
136 | - const newProps = {}; | ||
137 | - Object.keys(props).forEach(key => { | ||
138 | - if (key !== "children") { | ||
139 | - newProps[key] = props[key]; | ||
140 | - } | ||
141 | - }); | ||
142 | - return newProps; | ||
143 | -}; |
소스코드/PME/package-lock.json
deleted
100644 → 0
This diff could not be displayed because it is too large.
소스코드/PME/package.json
deleted
100644 → 0
1 | -{ | ||
2 | - "main": "node_modules/expo/AppEntry.js", | ||
3 | - "scripts": { | ||
4 | - "start": "expo start", | ||
5 | - "android": "expo start --android", | ||
6 | - "ios": "expo start --ios", | ||
7 | - "web": "expo start --web", | ||
8 | - "eject": "expo eject" | ||
9 | - }, | ||
10 | - "dependencies": { | ||
11 | - "@expo/vector-icons": "^10.1.0", | ||
12 | - "@react-native-community/masked-view": "^0.1.10", | ||
13 | - "expo": "~37.0.3", | ||
14 | - "expo-constants": "^9.0.0", | ||
15 | - "expo-document-picker": "^8.1.0", | ||
16 | - "expo-location": "^8.1.0", | ||
17 | - "native-base": "^2.13.12", | ||
18 | - "react": "~16.9.0", | ||
19 | - "react-dom": "~16.9.0", | ||
20 | - "react-native": "https://github.com/expo/react-native/archive/sdk-37.0.1.tar.gz", | ||
21 | - "react-native-gesture-handler": "^1.6.1", | ||
22 | - "react-native-map-clustering": "^3.1.2", | ||
23 | - "react-native-maps": "^0.27.1", | ||
24 | - "react-native-safe-area-context": "^0.7.3", | ||
25 | - "react-native-screens": "^2.7.0", | ||
26 | - "react-native-share": "^3.3.2", | ||
27 | - "react-native-web": "~0.11.7", | ||
28 | - "react-navigation": "^4.3.9", | ||
29 | - "react-navigation-stack": "^2.5.0" | ||
30 | - }, | ||
31 | - "devDependencies": { | ||
32 | - "@babel/core": "^7.8.6", | ||
33 | - "babel-preset-expo": "~8.1.0" | ||
34 | - }, | ||
35 | - "private": true | ||
36 | -} |
소스코드/PME/yarn.lock
deleted
100644 → 0
This diff could not be displayed because it is too large.
소스코드/package.json
deleted
100644 → 0
소스코드/yarn.lock
deleted
100644 → 0
This diff is collapsed. Click to expand it.
No preview for this file type
주제보고서/최종보고서.hwp
0 → 100644
No preview for this file type
-
Please register or login to post a comment