forked from cemaden-educacao/WPD-MobileApp
analuizaff
4 years ago
2 changed files with 65 additions and 33 deletions
@ -1,15 +1,67 @@ |
|||||
import React from "react"; |
|
||||
|
import React, { useContext } from "react"; |
||||
|
import { View } from "react-native"; |
||||
import { Polygon } from "react-native-maps"; |
import { Polygon } from "react-native-maps"; |
||||
|
import { CurrentLocationContext } from "../context/CurrentLocationContext"; |
||||
|
|
||||
export default function MapPolygons({ coordinates }) { |
|
||||
|
export default function MapPolygons() { |
||||
|
const context = useContext(CurrentLocationContext); |
||||
|
const location = context.currentCoordinates; |
||||
|
|
||||
|
|
||||
|
//Coordenadas dos poligonos das áreas de inundação (substituir por valores da API)
|
||||
|
const coordinates1 = [ |
||||
|
{ |
||||
|
latitude: location["latitude"] - 0.001, |
||||
|
longitude: location["longitude"] + 0.00002 |
||||
|
}, |
||||
|
{ |
||||
|
latitude: (location.latitude) - 0.0002, |
||||
|
longitude: (location.longitude) + 0.0001 |
||||
|
}, |
||||
|
{ |
||||
|
latitude: (location.latitude) + 0.001, |
||||
|
longitude: (location.longitude) - 0.00002 |
||||
|
}, |
||||
|
{ |
||||
|
latitude: (location.latitude) + 0.0002, |
||||
|
longitude: (location.longitude) - 0.001 |
||||
|
} |
||||
|
]; |
||||
|
const coordinates2 = [ |
||||
|
{ |
||||
|
latitude: location["latitude"] + 0.0010, |
||||
|
longitude: location["longitude"] - 0.0007 |
||||
|
}, |
||||
|
{ |
||||
|
latitude: (location.latitude) + 0.0006, |
||||
|
longitude: (location.longitude) - 0.0006 |
||||
|
}, |
||||
|
{ |
||||
|
latitude: (location.latitude) + 0.17, |
||||
|
longitude: (location.longitude) - 0.00225 |
||||
|
}, |
||||
|
{ |
||||
|
latitude: (location.latitude) + 0.001, |
||||
|
longitude: (location.longitude) - 0.00212 |
||||
|
} |
||||
|
] |
||||
return ( |
return ( |
||||
<Polygon |
|
||||
coordinates={coordinates} |
|
||||
// hole={hole}
|
|
||||
strokeColor="rgba(25, 118, 210,0.2)" |
|
||||
fillColor="rgba(25, 118, 210,0.5)" |
|
||||
strokeWidth={5} |
|
||||
/> |
|
||||
|
<View> |
||||
|
<Polygon |
||||
|
coordinates={coordinates1} |
||||
|
// hole={hole}
|
||||
|
strokeColor="rgba(25, 118, 210,0.2)" |
||||
|
fillColor="rgba(25, 118, 210,0.5)" |
||||
|
strokeWidth={5} |
||||
|
/> |
||||
|
<Polygon |
||||
|
coordinates={coordinates2} |
||||
|
// hole={hole}
|
||||
|
strokeColor="rgba(25, 118, 210,0.2)" |
||||
|
fillColor="rgba(25, 118, 210,0.5)" |
||||
|
strokeWidth={5} |
||||
|
/> |
||||
|
</View> |
||||
); |
); |
||||
} |
} |
||||
|
|
||||
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue