fix(dae): marker and icon
This commit is contained in:
parent
43aae4e133
commit
113d20efe1
8 changed files with 30 additions and 54 deletions
BIN
src/assets/img/icon-dae.png
Normal file
BIN
src/assets/img/icon-dae.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
BIN
src/assets/img/marker-dae.png
Normal file
BIN
src/assets/img/marker-dae.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.6 KiB |
|
|
@ -10,6 +10,7 @@ import markerRedDisabled from "~/assets/img/marker-red-disabled.png";
|
||||||
import markerYellowDisabled from "~/assets/img/marker-yellow-disabled.png";
|
import markerYellowDisabled from "~/assets/img/marker-yellow-disabled.png";
|
||||||
import markerGreenDisabled from "~/assets/img/marker-green-disabled.png";
|
import markerGreenDisabled from "~/assets/img/marker-green-disabled.png";
|
||||||
import markerOrigin from "~/assets/img/marker-origin.png";
|
import markerOrigin from "~/assets/img/marker-origin.png";
|
||||||
|
import markerDae from "~/assets/img/marker-dae.png";
|
||||||
|
|
||||||
const images = {
|
const images = {
|
||||||
red: markerRed,
|
red: markerRed,
|
||||||
|
|
@ -20,6 +21,7 @@ const images = {
|
||||||
yellowDisabled: markerYellowDisabled,
|
yellowDisabled: markerYellowDisabled,
|
||||||
greenDisabled: markerGreenDisabled,
|
greenDisabled: markerGreenDisabled,
|
||||||
origin: markerOrigin,
|
origin: markerOrigin,
|
||||||
|
dae: markerDae,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function FeatureImages() {
|
export default function FeatureImages() {
|
||||||
|
|
|
||||||
|
|
@ -17,11 +17,10 @@ const iconStyle = {
|
||||||
iconSize: 0.5,
|
iconSize: 0.5,
|
||||||
};
|
};
|
||||||
|
|
||||||
const defibCircleStyle = {
|
const defibStyle = {
|
||||||
circleRadius: 8,
|
iconImage: "dae",
|
||||||
circleColor: ["get", "defibColor"],
|
iconSize: 0.5,
|
||||||
circleStrokeColor: "#FFFFFF",
|
iconAllowOverlap: true,
|
||||||
circleStrokeWidth: 2,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const useStyles = createStyles(({ theme: { colors } }) => ({
|
const useStyles = createStyles(({ theme: { colors } }) => ({
|
||||||
|
|
@ -66,12 +65,12 @@ export default function ShapePoints({ shape, children, ...shapeSourceProps }) {
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{/* Defibrillators (DAE) – separate layer (non-clustered) */}
|
{/* Defibrillators (DAE) – separate layer (non-clustered) */}
|
||||||
<Maplibre.CircleLayer
|
<Maplibre.SymbolLayer
|
||||||
filter={["==", ["get", "isDefib"], true]}
|
filter={["==", ["get", "isDefib"], true]}
|
||||||
key="points-defib"
|
key="points-defib"
|
||||||
id="points-defib"
|
id="points-defib"
|
||||||
aboveLayerID="points-origin"
|
aboveLayerID="points-origin"
|
||||||
style={defibCircleStyle}
|
style={defibStyle}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{children}
|
{children}
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,8 @@ import {
|
||||||
} from "@expo/vector-icons";
|
} from "@expo/vector-icons";
|
||||||
import { useNavigation, CommonActions } from "@react-navigation/native";
|
import { useNavigation, CommonActions } from "@react-navigation/native";
|
||||||
|
|
||||||
|
import FontAwesome6 from "@expo/vector-icons/FontAwesome6";
|
||||||
|
|
||||||
import DrawerContent from "~/navigation/DrawerNav/DrawerContent";
|
import DrawerContent from "~/navigation/DrawerNav/DrawerContent";
|
||||||
import { useDrawerState } from "~/navigation/Context";
|
import { useDrawerState } from "~/navigation/Context";
|
||||||
import getDefaultDrawerWidth from "~/navigation/DrawerNav/getDefaultDrawerWidth";
|
import getDefaultDrawerWidth from "~/navigation/DrawerNav/getDefaultDrawerWidth";
|
||||||
|
|
@ -375,11 +377,16 @@ export default React.memo(function DrawerNav() {
|
||||||
options={{
|
options={{
|
||||||
drawerLabel: "Défibrillateurs",
|
drawerLabel: "Défibrillateurs",
|
||||||
drawerIcon: ({ focused }) => (
|
drawerIcon: ({ focused }) => (
|
||||||
<MaterialCommunityIcons
|
<FontAwesome6
|
||||||
name="heart-pulse"
|
name="heart-circle-bolt"
|
||||||
{...iconProps}
|
{...iconProps}
|
||||||
{...(focused ? iconFocusedProps : {})}
|
{...(focused ? iconFocusedProps : {})}
|
||||||
/>
|
/>
|
||||||
|
// <MaterialCommunityIcons
|
||||||
|
// name="heart-flash"
|
||||||
|
// {...iconProps}
|
||||||
|
// {...(focused ? iconFocusedProps : {})}
|
||||||
|
// />
|
||||||
),
|
),
|
||||||
unmountOnBlur: true,
|
unmountOnBlur: true,
|
||||||
}}
|
}}
|
||||||
|
|
|
||||||
|
|
@ -130,7 +130,6 @@ export default function useFeatures({
|
||||||
id,
|
id,
|
||||||
properties: {
|
properties: {
|
||||||
id,
|
id,
|
||||||
defibColor: "#4CAF50",
|
|
||||||
defib,
|
defib,
|
||||||
isDefib: true,
|
isDefib: true,
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ import IconTouchTarget from "~/components/IconTouchTarget";
|
||||||
import { useTheme } from "~/theme";
|
import { useTheme } from "~/theme";
|
||||||
import { useDefibsState, useNetworkState } from "~/stores";
|
import { useDefibsState, useNetworkState } from "~/stores";
|
||||||
import useLocation from "~/hooks/useLocation";
|
import useLocation from "~/hooks/useLocation";
|
||||||
import { getDefibAvailability } from "~/utils/dae/getDefibAvailability";
|
|
||||||
import {
|
import {
|
||||||
osmProfileUrl,
|
osmProfileUrl,
|
||||||
profileDefaultModes,
|
profileDefaultModes,
|
||||||
|
|
@ -33,6 +32,7 @@ import {
|
||||||
setA11yFocusAfterInteractions,
|
setA11yFocusAfterInteractions,
|
||||||
} from "~/lib/a11y";
|
} from "~/lib/a11y";
|
||||||
|
|
||||||
|
import markerDae from "~/assets/img/marker-dae.png";
|
||||||
import RoutingSteps from "~/scenes/AlertCurMap/RoutingSteps";
|
import RoutingSteps from "~/scenes/AlertCurMap/RoutingSteps";
|
||||||
import MapHeadRouting from "~/scenes/AlertCurMap/MapHeadRouting";
|
import MapHeadRouting from "~/scenes/AlertCurMap/MapHeadRouting";
|
||||||
|
|
||||||
|
|
@ -42,11 +42,6 @@ import {
|
||||||
STATE_CALCULATING_LOADING,
|
STATE_CALCULATING_LOADING,
|
||||||
} from "~/scenes/AlertCurMap/constants";
|
} from "~/scenes/AlertCurMap/constants";
|
||||||
|
|
||||||
const STATUS_COLORS = {
|
|
||||||
open: "#4CAF50",
|
|
||||||
closed: "#F44336",
|
|
||||||
unknown: "#9E9E9E",
|
|
||||||
};
|
|
||||||
|
|
||||||
export default React.memo(function DAEItemCarte() {
|
export default React.memo(function DAEItemCarte() {
|
||||||
const { colors } = useTheme();
|
const { colors } = useTheme();
|
||||||
|
|
@ -206,10 +201,6 @@ export default React.memo(function DAEItemCarte() {
|
||||||
// Defib marker GeoJSON
|
// Defib marker GeoJSON
|
||||||
const defibGeoJSON = useMemo(() => {
|
const defibGeoJSON = useMemo(() => {
|
||||||
if (!hasDefibCoords) return null;
|
if (!hasDefibCoords) return null;
|
||||||
const { status } = getDefibAvailability(
|
|
||||||
defib.horaires_std,
|
|
||||||
defib.disponible_24h,
|
|
||||||
);
|
|
||||||
return {
|
return {
|
||||||
type: "FeatureCollection",
|
type: "FeatureCollection",
|
||||||
features: [
|
features: [
|
||||||
|
|
@ -222,7 +213,6 @@ export default React.memo(function DAEItemCarte() {
|
||||||
properties: {
|
properties: {
|
||||||
id: defib.id,
|
id: defib.id,
|
||||||
nom: defib.nom || "Défibrillateur",
|
nom: defib.nom || "Défibrillateur",
|
||||||
color: STATUS_COLORS[status],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|
@ -370,22 +360,17 @@ export default React.memo(function DAEItemCarte() {
|
||||||
</Maplibre.ShapeSource>
|
</Maplibre.ShapeSource>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
<Maplibre.Images images={{ dae: markerDae }} />
|
||||||
|
|
||||||
{/* Defib marker */}
|
{/* Defib marker */}
|
||||||
{defibGeoJSON && (
|
{defibGeoJSON && (
|
||||||
<Maplibre.ShapeSource id="defibItemSource" shape={defibGeoJSON}>
|
<Maplibre.ShapeSource id="defibItemSource" shape={defibGeoJSON}>
|
||||||
<Maplibre.CircleLayer
|
|
||||||
id="defibItemCircle"
|
|
||||||
style={{
|
|
||||||
circleRadius: 10,
|
|
||||||
circleColor: ["get", "color"],
|
|
||||||
circleStrokeColor: "#FFFFFF",
|
|
||||||
circleStrokeWidth: 2.5,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Maplibre.SymbolLayer
|
<Maplibre.SymbolLayer
|
||||||
id="defibItemLabel"
|
id="defibItemSymbol"
|
||||||
aboveLayerID="defibItemCircle"
|
|
||||||
style={{
|
style={{
|
||||||
|
iconImage: "dae",
|
||||||
|
iconSize: 0.5,
|
||||||
|
iconAllowOverlap: true,
|
||||||
textField: ["get", "nom"],
|
textField: ["get", "nom"],
|
||||||
textSize: 12,
|
textSize: 12,
|
||||||
textOffset: [0, 1.8],
|
textOffset: [0, 1.8],
|
||||||
|
|
|
||||||
|
|
@ -20,21 +20,15 @@ import Text from "~/components/Text";
|
||||||
import Loader from "~/components/Loader";
|
import Loader from "~/components/Loader";
|
||||||
import { useTheme } from "~/theme";
|
import { useTheme } from "~/theme";
|
||||||
import { defibsActions } from "~/stores";
|
import { defibsActions } from "~/stores";
|
||||||
import { getDefibAvailability } from "~/utils/dae/getDefibAvailability";
|
|
||||||
|
import markerDae from "~/assets/img/marker-dae.png";
|
||||||
|
|
||||||
import useNearbyDefibs from "./useNearbyDefibs";
|
import useNearbyDefibs from "./useNearbyDefibs";
|
||||||
|
|
||||||
const STATUS_COLORS = {
|
|
||||||
open: "#4CAF50",
|
|
||||||
closed: "#F44336",
|
|
||||||
unknown: "#9E9E9E",
|
|
||||||
};
|
|
||||||
|
|
||||||
function defibsToGeoJSON(defibs) {
|
function defibsToGeoJSON(defibs) {
|
||||||
return {
|
return {
|
||||||
type: "FeatureCollection",
|
type: "FeatureCollection",
|
||||||
features: defibs.map((d) => {
|
features: defibs.map((d) => {
|
||||||
const { status } = getDefibAvailability(d.horaires_std, d.disponible_24h);
|
|
||||||
return {
|
return {
|
||||||
type: "Feature",
|
type: "Feature",
|
||||||
id: d.id,
|
id: d.id,
|
||||||
|
|
@ -45,8 +39,6 @@ function defibsToGeoJSON(defibs) {
|
||||||
properties: {
|
properties: {
|
||||||
id: d.id,
|
id: d.id,
|
||||||
nom: d.nom || "Défibrillateur",
|
nom: d.nom || "Défibrillateur",
|
||||||
status,
|
|
||||||
color: STATUS_COLORS[status],
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
|
@ -176,27 +168,19 @@ export default React.memo(function DAEListCarte() {
|
||||||
detached={false}
|
detached={false}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
|
<Maplibre.Images images={{ dae: markerDae }} />
|
||||||
|
|
||||||
{geoJSON.features.length > 0 && (
|
{geoJSON.features.length > 0 && (
|
||||||
<Maplibre.ShapeSource
|
<Maplibre.ShapeSource
|
||||||
id="defibSource"
|
id="defibSource"
|
||||||
shape={geoJSON}
|
shape={geoJSON}
|
||||||
onPress={onMarkerPress}
|
onPress={onMarkerPress}
|
||||||
>
|
>
|
||||||
<Maplibre.CircleLayer
|
|
||||||
id="defibCircleLayer"
|
|
||||||
style={{
|
|
||||||
circleRadius: 8,
|
|
||||||
circleColor: ["get", "color"],
|
|
||||||
circleStrokeColor: "#FFFFFF",
|
|
||||||
circleStrokeWidth: 2,
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
<Maplibre.SymbolLayer
|
<Maplibre.SymbolLayer
|
||||||
id="defibSymbolLayer"
|
id="defibSymbolLayer"
|
||||||
aboveLayerID="defibCircleLayer"
|
|
||||||
style={{
|
style={{
|
||||||
iconImage: "heart-pulse",
|
iconImage: "dae",
|
||||||
iconSize: 0.6,
|
iconSize: 0.5,
|
||||||
iconAllowOverlap: true,
|
iconAllowOverlap: true,
|
||||||
textField: ["get", "nom"],
|
textField: ["get", "nom"],
|
||||||
textSize: 11,
|
textSize: 11,
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue