Browse Source

layerlist

master
Irul24 1 year ago
parent
commit
0e0e82baa5
  1. 82
      src/component/mapCollectScreen.tsx

82
src/component/mapCollectScreen.tsx

@ -27,8 +27,9 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{
const [modalInputLocation, setmodalInputLocation] = useState(false); const [modalInputLocation, setmodalInputLocation] = useState(false);
const [modalBasemap, setmodalBasemap] = useState(false); const [modalBasemap, setmodalBasemap] = useState(false);
const [modalLayerList, setmodalLayerList] = useState(false); const [modalLayerList, setmodalLayerList] = useState(false);
const [isSelectedLayer1, setSelectionLayer1] = useState(false); const [isSelectedLayerPDAM, setSelectionLayerPDAM] = useState(false);
const [layerList,setLayerList] = useState('') const [isSelectedLayerPermit, setSelectionLayerPermit] = useState(false);
const [layerList,setLayerList] = useState(['pdams','permits','pjus'])
const getLocation = () => { const getLocation = () => {
Geolocation.getCurrentPosition( Geolocation.getCurrentPosition(
@ -51,7 +52,7 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{
await RNFetchBlob.config({ await RNFetchBlob.config({
trusty : true trusty : true
}) })
.fetch('GET', `https://c557-117-102-73-102.ngrok-free.app/catalog`,{ .fetch('GET', `https://de36-117-102-73-102.ngrok-free.app/catalog`,{
"Accept": 'application/json', "Accept": 'application/json',
"Content-Type": "application/json", "Content-Type": "application/json",
} }
@ -149,11 +150,16 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{
mapStyle={styleURL} mapStyle={styleURL}
zoomEnabled={true} zoomEnabled={true}
compassEnabled={false} compassEnabled={false}
> >
{/* Layer Visibility */}
{
isSelectedLayerPDAM ?
<VectorSource <VectorSource
id="pdams" id="pdams"
url="https://c557-117-102-73-102.ngrok-free.app/pdams" url="https://de36-117-102-73-102.ngrok-free.app/pdams"
tileUrlTemplates={["https://c557-117-102-73-102.ngrok-free.app/pdams/{z}/{x}/{y}"]} tileUrlTemplates={["https://de36-117-102-73-102.ngrok-free.app/pdams/{z}/{x}/{y}"]}
onPress={(e)=>{ onPress={(e)=>{
console.log(e.features[0].properties?.nama); console.log(e.features[0].properties?.nama);
Alert.alert(e.features[0].properties?.nama) Alert.alert(e.features[0].properties?.nama)
@ -164,43 +170,42 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{
sourceID="pdams" sourceID="pdams"
sourceLayerID="pdams" sourceLayerID="pdams"
id="pdams" id="pdams"
style={{lineColor:'red',lineWidth:3}} style={{lineColor:'blue',lineWidth:3}}
/> />
{/* {isSelectedLayer1 ?
:
null
} */}
</VectorSource> </VectorSource>
:null
}
{
isSelectedLayerPermit ?
<VectorSource <VectorSource
id="permits" id="permits"
url="https://c557-117-102-73-102.ngrok-free.app/permits" url="https://de36-117-102-73-102.ngrok-free.app/permits"
tileUrlTemplates={["https://c557-117-102-73-102.ngrok-free.app/permits/{z}/{x}/{y}"]} tileUrlTemplates={["https://de36-117-102-73-102.ngrok-free.app/permits/{z}/{x}/{y}"]}
onPress={(e)=>{ onPress={(e)=>{
console.log(e.features[0].properties?.company_name); console.log(e.features[0].properties!.company_name);
// Alert.alert(e.features[0].properties?.nama) Alert.alert(e.features[0].properties!.company_name)
}} }}
> >
<LineLayer <FillLayer
sourceID="permits"
sourceLayerID="permits" sourceLayerID="permits"
id="permits" id="some-fill-feature"
style={{lineColor:'red',lineWidth:3}}
/>
{/* <FillLayer
id="permits"
style={{ style={{
fillColor: ['interpolate', ['linear'], ['zoom'], 0, '#eeddbb', 2, '#0daa00', 3, '#bbbbee'], fillColor: ['interpolate', ['linear'], ['zoom'], 0, 'blue', 2, 'black', 3, 'grey'],
fillOpacity:0.5 fillOpacity:0.5
}} }}
/> */} />
{/* {isSelectedLayer1 ? <LineLayer
sourceLayerID="permits"
: id="linelayer1"
null style={{lineColor:'red',lineWidth:3}}
} */} />
</VectorSource> </VectorSource>
:null
}
{!delayRender ? {!delayRender ?
<> <>
<PointAnnotation <PointAnnotation
@ -392,16 +397,25 @@ function MapCollectScreen({route,navigation}:MapCollectProps):React.JSX.Element{
/> />
</Pressable> </Pressable>
</View> </View>
<View style={{flexDirection:'column',marginTop:'10%',padding:20}}> <View style={{flexDirection:'column', marginTop:'10%',paddingStart:'10%',paddingEnd:'10%'}}>
<View style={{flexDirection:"row",alignItems:'center',justifyContent:'space-around'}}> <View style={{flexDirection:"row",alignItems:'center',justifyContent:'flex-start',borderBottomColor:'#A6A6A6',borderBottomWidth:2,padding:5}}>
<Text style={{color:'black',fontWeight:'400',fontSize:16}}>Administrasi Kecamatan Jakut</Text> <CheckBox
disabled={false}
value={isSelectedLayerPDAM}
onValueChange={(newValue) => setSelectionLayerPDAM(newValue)}
/>
<Text style={{color:'black',fontWeight:'400',fontSize:16}}>Pipa PDAM</Text>
</View>
<View style={{flexDirection:"row",alignItems:'center',justifyContent:'flex-start',borderBottomColor:'#A6A6A6',borderBottomWidth:2,padding:5}}>
<CheckBox <CheckBox
disabled={false} disabled={false}
value={isSelectedLayer1} value={isSelectedLayerPermit}
onValueChange={(newValue) => setSelectionLayer1(newValue)} onValueChange={(newValue) => setSelectionLayerPermit(newValue)}
/> />
<Text style={{color:'black',fontWeight:'400',fontSize:16}}>Land Permit</Text>
</View> </View>
</View> </View>
</View> </View>
</Modal> </Modal>

Loading…
Cancel
Save