|
|
|
@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from 'react'; |
|
|
|
import {View,Text, StyleSheet, ScrollView, TouchableOpacity, Image, Animated, TextInput, Button, Alert} from 'react-native'; |
|
|
|
import {View,Text, StyleSheet, ScrollView, TouchableOpacity, Image, Animated, TextInput, Button, Alert} from 'react-native'; |
|
|
|
import {useNavigation,NavigationContainer,useIsFocused} from '@react-navigation/native'; |
|
|
|
import {useNavigation,NavigationContainer,useIsFocused} from '@react-navigation/native'; |
|
|
|
import MapLibreGL from '@maplibre/maplibre-react-native'; |
|
|
|
import MapLibreGL from '@maplibre/maplibre-react-native'; |
|
|
|
|
|
|
|
import { MapView,ShapeSource,Camera,UserLocation,PointAnnotation,FillLayer,LineLayer,VectorSource } from "@maplibre/maplibre-react-native"; |
|
|
|
import { SelectList } from 'react-native-dropdown-select-list'; |
|
|
|
import { SelectList } from 'react-native-dropdown-select-list'; |
|
|
|
import { RadioButton } from 'react-native-paper'; |
|
|
|
import { RadioButton } from 'react-native-paper'; |
|
|
|
import DatePicker from 'react-native-date-picker'; |
|
|
|
import DatePicker from 'react-native-date-picker'; |
|
|
|
@ -420,15 +421,14 @@ export default function EditPolygonScreen({route,navigation}:EditPolygonScreenPr |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<View style={{flexDirection:'column'}}> |
|
|
|
<View style={{flexDirection:'column'}}> |
|
|
|
<MapLibreGL.MapView |
|
|
|
<MapView |
|
|
|
style={{width:'80%',height:160,alignSelf:'center'}} |
|
|
|
style={{width:'80%',height:160,alignSelf:'center'}} |
|
|
|
styleURL={styleURL} |
|
|
|
mapStyle={styleURL} |
|
|
|
zoomEnabled={false} |
|
|
|
zoomEnabled={false} |
|
|
|
scrollEnabled={false} |
|
|
|
scrollEnabled={false} |
|
|
|
> |
|
|
|
> |
|
|
|
<MapLibreGL.Camera
|
|
|
|
<Camera
|
|
|
|
centerCoordinate={centerCoords.length === 0 ? coordinates[0] : centerCoords} |
|
|
|
centerCoordinate={centerCoords.length === 0 ? coordinates[0] : centerCoords} |
|
|
|
allowUpdates={true} |
|
|
|
|
|
|
|
zoomLevel={17} |
|
|
|
zoomLevel={17} |
|
|
|
minZoomLevel={5} |
|
|
|
minZoomLevel={5} |
|
|
|
maxZoomLevel={20} |
|
|
|
maxZoomLevel={20} |
|
|
|
@ -437,7 +437,7 @@ export default function EditPolygonScreen({route,navigation}:EditPolygonScreenPr |
|
|
|
{ |
|
|
|
{ |
|
|
|
!loadGeom ? |
|
|
|
!loadGeom ? |
|
|
|
<> |
|
|
|
<> |
|
|
|
<MapLibreGL.ShapeSource |
|
|
|
<ShapeSource |
|
|
|
id="polygon2" |
|
|
|
id="polygon2" |
|
|
|
shape={{ |
|
|
|
shape={{ |
|
|
|
"type": "FeatureCollection", |
|
|
|
"type": "FeatureCollection", |
|
|
|
@ -455,18 +455,18 @@ export default function EditPolygonScreen({route,navigation}:EditPolygonScreenPr |
|
|
|
] |
|
|
|
] |
|
|
|
}} |
|
|
|
}} |
|
|
|
> |
|
|
|
> |
|
|
|
<MapLibreGL.LineLayer
|
|
|
|
<LineLayer
|
|
|
|
id="linelayer2" |
|
|
|
id="linelayer2" |
|
|
|
style={{lineColor:'red',lineWidth:3}} |
|
|
|
style={{lineColor:'red',lineWidth:3}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
<MapLibreGL.FillLayer
|
|
|
|
<FillLayer
|
|
|
|
id="some-fill-feature2" |
|
|
|
id="some-fill-feature2" |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
fillColor: ['interpolate', ['linear'], ['zoom'], 0, '#eeddbb', 2, '#0daa00', 3, '#bbbbee'], |
|
|
|
fillColor: ['interpolate', ['linear'], ['zoom'], 0, '#eeddbb', 2, '#0daa00', 3, '#bbbbee'], |
|
|
|
fillOpacity:0.5 |
|
|
|
fillOpacity:0.5 |
|
|
|
}} |
|
|
|
}} |
|
|
|
/> |
|
|
|
/> |
|
|
|
</MapLibreGL.ShapeSource> |
|
|
|
</ShapeSource> |
|
|
|
</> |
|
|
|
</> |
|
|
|
: |
|
|
|
: |
|
|
|
null |
|
|
|
null |
|
|
|
@ -474,7 +474,7 @@ export default function EditPolygonScreen({route,navigation}:EditPolygonScreenPr |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
coordinates.map((item:any,index:number)=>( |
|
|
|
coordinates.map((item:any,index:number)=>( |
|
|
|
<MapLibreGL.PointAnnotation |
|
|
|
<PointAnnotation |
|
|
|
key={index} |
|
|
|
key={index} |
|
|
|
id={String(index)} |
|
|
|
id={String(index)} |
|
|
|
coordinate={item} |
|
|
|
coordinate={item} |
|
|
|
@ -483,10 +483,10 @@ export default function EditPolygonScreen({route,navigation}:EditPolygonScreenPr |
|
|
|
<View style={{ height: 75, width: 75 }}> |
|
|
|
<View style={{ height: 75, width: 75 }}> |
|
|
|
<View style={{width:15,height:15,backgroundColor:'red',borderColor:'black',borderRadius:50}} /> |
|
|
|
<View style={{width:15,height:15,backgroundColor:'red',borderColor:'black',borderRadius:50}} /> |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
</MapLibreGL.PointAnnotation> |
|
|
|
</PointAnnotation> |
|
|
|
)) |
|
|
|
)) |
|
|
|
} |
|
|
|
} |
|
|
|
</MapLibreGL.MapView> |
|
|
|
</MapView> |
|
|
|
{!secondPress ? |
|
|
|
{!secondPress ? |
|
|
|
<TouchableOpacity style={{alignSelf:'center',paddingTop:10}} onPress={()=>{navigation.navigate('Map View Polygon', { screen: 'Map View Polygon',data: { |
|
|
|
<TouchableOpacity style={{alignSelf:'center',paddingTop:10}} onPress={()=>{navigation.navigate('Map View Polygon', { screen: 'Map View Polygon',data: { |
|
|
|
id:data.id, |
|
|
|
id:data.id, |
|
|
|
|