Browse Source

Fixing pins in map feed

master
GabrielTrettel 3 years ago
parent
commit
318cbee549
  1. BIN
      src/app/assets/floodZonesAssets/PinIntransitável.png
  2. BIN
      src/app/assets/floodZonesAssets/PinTransitável.png
  3. BIN
      src/app/assets/floodZonesAssets/drive-download-20210419T204927Z-001.zip
  4. BIN
      src/app/assets/pluviometer/PinPluviometroArt.png
  5. BIN
      src/app/assets/pluviometer/PinPluviometroOficial.png
  6. BIN
      src/app/assets/rain/PinChuvaForte.png
  7. BIN
      src/app/assets/rain/PinChuvaFraca.png
  8. BIN
      src/app/assets/rain/PinChuvaModerada.png
  9. BIN
      src/app/assets/rain/PinChuvaMuitoForte.png
  10. BIN
      src/app/assets/rain/PinNublado.png
  11. BIN
      src/app/assets/rain/PinSolNuvens.png
  12. BIN
      src/app/assets/rain/PinSolpng.png
  13. BIN
      src/app/assets/river/PinRioBaixo.png
  14. BIN
      src/app/assets/river/PinRioBaixoOf.png
  15. BIN
      src/app/assets/river/PinRioCheio.png
  16. BIN
      src/app/assets/river/PinRioCheioOf.png
  17. BIN
      src/app/assets/river/PinRioExtravasado.png
  18. BIN
      src/app/assets/river/PinRioExtravasadoOf.png
  19. BIN
      src/app/assets/river/PinRioNormal.png
  20. BIN
      src/app/assets/river/PinRioNormalOf.png
  21. 9
      src/app/components/MapMarker.js
  22. 6
      src/app/components/MapModal.js
  23. 14
      src/app/config/assets.js
  24. 40
      src/app/hooks/selectFromDB.js

BIN
src/app/assets/floodZonesAssets/PinIntransitável.png

After

Width: 1667  |  Height: 2501  |  Size: 89 KiB

BIN
src/app/assets/floodZonesAssets/PinTransitável.png

After

Width: 1667  |  Height: 2501  |  Size: 86 KiB

BIN
src/app/assets/floodZonesAssets/drive-download-20210419T204927Z-001.zip

BIN
src/app/assets/pluviometer/PinPluviometroArt.png

After

Width: 1667  |  Height: 2501  |  Size: 68 KiB

BIN
src/app/assets/pluviometer/PinPluviometroOficial.png

After

Width: 1667  |  Height: 2501  |  Size: 76 KiB

BIN
src/app/assets/rain/PinChuvaForte.png

After

Width: 1667  |  Height: 2501  |  Size: 82 KiB

BIN
src/app/assets/rain/PinChuvaFraca.png

After

Width: 1667  |  Height: 2501  |  Size: 81 KiB

BIN
src/app/assets/rain/PinChuvaModerada.png

After

Width: 1667  |  Height: 2501  |  Size: 82 KiB

BIN
src/app/assets/rain/PinChuvaMuitoForte.png

After

Width: 1667  |  Height: 2501  |  Size: 81 KiB

BIN
src/app/assets/rain/PinNublado.png

After

Width: 1667  |  Height: 2501  |  Size: 84 KiB

BIN
src/app/assets/rain/PinSolNuvens.png

After

Width: 1667  |  Height: 2501  |  Size: 89 KiB

BIN
src/app/assets/rain/PinSolpng.png

After

Width: 1667  |  Height: 2501  |  Size: 88 KiB

BIN
src/app/assets/river/PinRioBaixo.png

After

Width: 1667  |  Height: 2501  |  Size: 66 KiB

BIN
src/app/assets/river/PinRioBaixoOf.png

After

Width: 1667  |  Height: 2501  |  Size: 74 KiB

BIN
src/app/assets/river/PinRioCheio.png

After

Width: 1667  |  Height: 2501  |  Size: 66 KiB

BIN
src/app/assets/river/PinRioCheioOf.png

After

Width: 1667  |  Height: 2501  |  Size: 74 KiB

BIN
src/app/assets/river/PinRioExtravasado.png

After

Width: 1667  |  Height: 2501  |  Size: 66 KiB

BIN
src/app/assets/river/PinRioExtravasadoOf.png

After

Width: 1667  |  Height: 2501  |  Size: 74 KiB

BIN
src/app/assets/river/PinRioNormal.png

After

Width: 1667  |  Height: 2501  |  Size: 66 KiB

BIN
src/app/assets/river/PinRioNormalOf.png

After

Width: 1667  |  Height: 2501  |  Size: 75 KiB

9
src/app/components/MapMarker.js

@ -4,7 +4,10 @@ import MapView from "react-native-maps";
import colors from "../config/colors"; import colors from "../config/colors";
import { dimensions } from "../config/dimensions"; import { dimensions } from "../config/dimensions";
import MapModal from "./MapModal"; import MapModal from "./MapModal";
const markerSize = 30;
const imageScale = 0.025;
const markerSizeWidth = Math.floor(1667 * imageScale);
const markerSizeHeigth = Math.floor(2501 * imageScale);
export default function MapMarker(props) { export default function MapMarker(props) {
const [isModalVisible, setIsModalVisible] = useState(false); const [isModalVisible, setIsModalVisible] = useState(false);
@ -67,7 +70,7 @@ const styles = StyleSheet.create({
}, },
markerPoint: { markerPoint: {
alignSelf: "center", alignSelf: "center",
height: markerSize,
width: markerSize,
height: markerSizeHeigth,
width: markerSizeWidth,
}, },
}); });

6
src/app/components/MapModal.js

@ -187,11 +187,7 @@ function componentBody(props) {
return ( return (
<View style={styles.bodyRow}> <View style={styles.bodyRow}>
<Image
style={styles.bodyIcon}
resizeMode="stretch"
source={props.image}
/>
<Image style={styles.bodyIcon} resizeMode="stretch" source={props.logo} />
<View style={styles.bodyInfo}> <View style={styles.bodyInfo}>
<Text style={styles.bodyTitle}>{props.title}</Text> <Text style={styles.bodyTitle}>{props.title}</Text>

14
src/app/config/assets.js

@ -35,51 +35,63 @@ export default {
floodZones: { floodZones: {
FloodZonesIcon: FloodZones, FloodZonesIcon: FloodZones,
passable: require("../assets/floodZonesAssets/passable_icon.png"), passable: require("../assets/floodZonesAssets/passable_icon.png"),
passable_pin: require("../assets/floodZonesAssets/PinTransitável.png"),
passable_toggle: require("../assets/floodZonesAssets/Transitavel_c.png"), passable_toggle: require("../assets/floodZonesAssets/Transitavel_c.png"),
passable_2: require("../assets/floodZonesAssets/passable_2.png"), passable_2: require("../assets/floodZonesAssets/passable_2.png"),
notPassable: require("../assets/floodZonesAssets/not_passable_icon.png"), notPassable: require("../assets/floodZonesAssets/not_passable_icon.png"),
notPassable_pin: require("../assets/floodZonesAssets/PinIntransitável.png"),
notPassable2: require("../assets/floodZonesAssets/notpassable_2_toggle.png"), notPassable2: require("../assets/floodZonesAssets/notpassable_2_toggle.png"),
notPassable_toggle: require("../assets/floodZonesAssets/Intransitavel_c.png"), notPassable_toggle: require("../assets/floodZonesAssets/Intransitavel_c.png"),
}, },
riverLevel: { riverLevel: {
RiverIcon: RiverIcon, RiverIcon: RiverIcon,
low_pin: require("../assets/river/PinRioBaixo.png"),
low: require("../assets/river/rio_baixo.png"), low: require("../assets/river/rio_baixo.png"),
Low: RiverLow, Low: RiverLow,
LowToggle: RiverLowToggle, LowToggle: RiverLowToggle,
normal_pin: require("../assets/river/PinRioNormal.png"),
normal: require("../assets/river/rio_normal.png"), normal: require("../assets/river/rio_normal.png"),
Normal: RiverNormal, Normal: RiverNormal,
NormalToggle: RiverNormalToggle, NormalToggle: RiverNormalToggle,
high_pin: require("../assets/river/PinRioCheio.png"),
high: require("../assets/river/rio_alto.png"), high: require("../assets/river/rio_alto.png"),
High: RiverHigh, High: RiverHigh,
HighToggle: RiverHighToggle, HighToggle: RiverHighToggle,
flooding_pin: require("../assets/river/PinRioExtravasado.png"),
flooding: require("../assets/river/rio_transbordando.png"), flooding: require("../assets/river/rio_transbordando.png"),
Flooding: RiverFlood, Flooding: RiverFlood,
FloodingToggle: RiverFloodToggle, FloodingToggle: RiverFloodToggle,
}, },
rainLevel: { rainLevel: {
RainIcon: RainIcon, RainIcon: RainIcon,
rain_0_5_pin: require("../assets/rain/PinNublado.png"),
rain_0_5: require("../assets/rain/sem_chuva.png"), rain_0_5: require("../assets/rain/sem_chuva.png"),
Rain_0_5: RainNot, Rain_0_5: RainNot,
Rain_0_5_Toggle: RainNotToggle, Rain_0_5_Toggle: RainNotToggle,
rain_1_5: require("../assets/rain/chuva_fraca.png"), rain_1_5: require("../assets/rain/chuva_fraca.png"),
rain_1_5_pin: require("../assets/rain/PinChuvaFraca.png"),
Rain_1_5: RainLow, Rain_1_5: RainLow,
Rain_1_5_Toggle: RainLowToggle, Rain_1_5_Toggle: RainLowToggle,
rain_2_5: require("../assets/rain/chuva_logo.png"), rain_2_5: require("../assets/rain/chuva_logo.png"),
rain_2_5_pin: require("../assets/rain/PinChuvaModerada.png"),
Rain_2_5: RainMedium, Rain_2_5: RainMedium,
Rain_2_5_Toggle: RainMediumToggle, Rain_2_5_Toggle: RainMediumToggle,
rain_3_5: require("../assets/rain/chuva_forte.png"), rain_3_5: require("../assets/rain/chuva_forte.png"),
rain_3_5_pin: require("../assets/rain/PinChuvaForte.png"),
Rain_3_5: RainHigh, Rain_3_5: RainHigh,
Rain_3_5_Toggle: RainHighToggle, Rain_3_5_Toggle: RainHighToggle,
rain_4_5: require("../assets/rain/chuva_muito_forte.png"), rain_4_5: require("../assets/rain/chuva_muito_forte.png"),
rain_4_5_pin: require("../assets/rain/PinChuvaMuitoForte.png"),
Rain_4_5: RainVeryHigh, Rain_4_5: RainVeryHigh,
Rain_4_5_Toggle: RainVeryHighToggle, Rain_4_5_Toggle: RainVeryHighToggle,
@ -94,7 +106,9 @@ export default {
Weather_5_clean, Weather_5_clean,
], ],
pluviometer: require("../assets/pluviometer/diario_pluviometrico.png"), pluviometer: require("../assets/pluviometer/diario_pluviometrico.png"),
pluviometer_pin: require("../assets/pluviometer/PinPluviometroArt.png"),
officialPluviometer: require("../assets/pluviometer/pluviometroOficial.png"), officialPluviometer: require("../assets/pluviometer/pluviometroOficial.png"),
officialPluviometer_pin: require("../assets/pluviometer/PinPluviometroOficial.png"),
PluviometerIcon: Pluviometer, PluviometerIcon: Pluviometer,
AppLogoTitle: AppLogoTitle, AppLogoTitle: AppLogoTitle,
}; };

40
src/app/hooks/selectFromDB.js

@ -23,6 +23,30 @@ const custom_assets = {
}), }),
}; };
const custom_assets_pin = {
pluviometer: assets.pluviometer_pin,
officialPluviometer: assets.officialPluviometer_pin,
floodZones: {
passable: assets.floodZones.passable_pin,
not_passable: assets.floodZones.notPassable_pin,
},
riverLevel: ["low_pin", "normal_pin", "high_pin]", "flooding_pin"].map(
(key) => {
return assets.riverLevel[key];
}
),
rainLevel: [
"rain_0_5_pin",
"rain_1_5_pin",
"rain_2_5_pin",
"rain_3_5_pin",
"rain_4_5_pin",
"rain_5_5_pin",
].map((key) => {
return assets.rainLevel[key];
}),
};
// NOTE: For debug pourposes, every icon will be placed some `offset` from // NOTE: For debug pourposes, every icon will be placed some `offset` from
// another. In final release, offset must be assigned to 0.0 // another. In final release, offset must be assigned to 0.0
var offset = 0.0001; var offset = 0.0001;
@ -61,6 +85,10 @@ function parseFloodZones(row) {
longitude: row["Longitude"] + displacement, longitude: row["Longitude"] + displacement,
}, },
image: image:
row["Passable"] == 1
? custom_assets_pin.floodZones.passable
: custom_assets_pin.floodZones.not_passable,
logo:
row["Passable"] == 1 row["Passable"] == 1
? custom_assets.floodZones.passable ? custom_assets.floodZones.passable
: custom_assets.floodZones.notPassable, : custom_assets.floodZones.notPassable,
@ -88,7 +116,8 @@ function parseRiverLevel(row) {
latitude: row["Latitude"], latitude: row["Latitude"],
longitude: row["Longitude"] + displacement, longitude: row["Longitude"] + displacement,
}, },
image: custom_assets.riverLevel[riverIdx],
image: custom_assets_pin.riverLevel[riverIdx],
logo: custom_assets.riverLevel[riverIdx],
description: row["Description"], description: row["Description"],
date: row["Date"] + " | " + row["Time"], date: row["Date"] + " | " + row["Time"],
pictures: row["Images"], pictures: row["Images"],
@ -121,7 +150,8 @@ function parseRainLevel(row) {
latitude: row["Latitude"], latitude: row["Latitude"],
longitude: row["Longitude"] + displacement, longitude: row["Longitude"] + displacement,
}, },
image: custom_assets.rainLevel[rainIdx],
image: custom_assets_pin.rainLevel[rainIdx],
logo: custom_assets.rainLevel[rainIdx],
description: description, description: description,
date: row["Date"] + " | " + row["Time"], date: row["Date"] + " | " + row["Time"],
pictures: row["Images"], pictures: row["Images"],
@ -209,7 +239,8 @@ function buildRandonData(location, addr) {
return points.map((points) => { return points.map((points) => {
return { return {
image: custom_assets.officialPluviometer,
image: custom_assets_pin.officialPluviometer,
logo: custom_assets.officialPluviometer_pin,
ID: ++ID, ID: ++ID,
name: "officialPluviometer", name: "officialPluviometer",
title: "Pluviometro Oficial " + i++, title: "Pluviometro Oficial " + i++,
@ -286,7 +317,8 @@ function useMarkers(isFocused) {
}); });
const result = { const result = {
image: custom_assets.pluviometer,
image: custom_assets_pin.pluviometer,
logo: custom_assets.pluviometer,
ID: ++ID, ID: ++ID,
name: "pluviometer", name: "pluviometer",
title: "Pluviometro 1", title: "Pluviometro 1",

Loading…
Cancel
Save