Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

font: display kps #5402

Merged
merged 9 commits into from
Oct 25, 2023
123 changes: 66 additions & 57 deletions front/src/common/Map/Consts/colors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ const colors: Record<string, Theme> = {
electricbox: {
text: '#b42222',
},
kp: {
circle: '#162873',
text: '#4d4f53',
halo: '#ffffff',
},
kvb: {
color: '#ffc700',
},
Expand All @@ -36,30 +41,20 @@ const colors: Record<string, Theme> = {
text: '#555555',
halo: '#eee',
},
psl: {
pointtext: '#5b5b5b',
pointhalo: '#ffffff',
detailtext: '#555555',
detailhalo: '#ffffff',
text: '#4d4f53',
halo: '#ffffff',
},
mapmarker: {
text: '#0088ce',
circle: '#0088ce',
},
neutral_sections: {
lower_pantograph: '#ff0000',
switch_off: '#000000',
},
op: {
circle: '#82be00',
text: '#202258',
minitext: '#333',
halo: '#eee',
},
sign: {
text: '#333333',
halo: '#ffffff',
},
pk: {
circle: '#162873',
text: '#142c90',
},
platform: {
fill: '#e05206',
},
Expand All @@ -79,9 +74,13 @@ const colors: Record<string, Theme> = {
color750V: '#86cf00',
colorOther: '#000000',
},
neutral_sections: {
lower_pantograph: '#ff0000',
switch_off: '#000000',
psl: {
pointtext: '#5b5b5b',
pointhalo: '#ffffff',
detailtext: '#555555',
detailhalo: '#ffffff',
text: '#4d4f53',
halo: '#ffffff',
},
radio: {
text: '#5596c8',
Expand All @@ -101,6 +100,10 @@ const colors: Record<string, Theme> = {
text: '#e05206',
halo: '#ffffff',
},
sign: {
text: '#333333',
halo: '#ffffff',
},
signal: {
text: '#333333',
halo: '#ffffff',
Expand Down Expand Up @@ -172,6 +175,11 @@ const colors: Record<string, Theme> = {
electricbox: {
text: '#b42222',
},
kp: {
circle: '#8338ec',
text: '#8338ec',
halo: '#8338ec',
},
kvb: {
color: '#ffc700',
},
Expand All @@ -185,30 +193,20 @@ const colors: Record<string, Theme> = {
text: '#4895ef',
halo: '#0b011d',
},
psl: {
pointtext: '#eeeeee',
pointhalo: '#3a86ff',
detailtext: '#3a86ff',
detailhalo: '#0b011d',
text: '#3a86ff',
halo: '#000000',
},
mapmarker: {
text: '#ffaa39',
circle: '#ffaa39',
},
neutral_sections: {
lower_pantograph: '#ff0000',
switch_off: '#000000',
},
op: {
circle: '#82be00',
text: '#4895ef',
minitext: '#4895ef',
halo: '#0b011d',
},
sign: {
text: '#eeeeee',
halo: '#333333',
},
pk: {
circle: '#8338ec',
text: '#8338ec',
},
platform: {
fill: '#f1c453',
},
Expand All @@ -228,9 +226,13 @@ const colors: Record<string, Theme> = {
color750V: '#86cf00',
colorOther: '#FFFFFF',
},
neutral_sections: {
lower_pantograph: '#ff0000',
switch_off: '#000000',
psl: {
pointtext: '#eeeeee',
pointhalo: '#3a86ff',
detailtext: '#3a86ff',
detailhalo: '#0b011d',
text: '#3a86ff',
halo: '#000000',
},
radio: {
text: '#5596c8',
Expand All @@ -250,6 +252,10 @@ const colors: Record<string, Theme> = {
text: '#e05206',
halo: '#ffffff',
},
sign: {
text: '#eeeeee',
halo: '#333333',
},
signal: {
text: '#eeeeee',
halo: '#000000',
Expand Down Expand Up @@ -313,6 +319,11 @@ const colors: Record<string, Theme> = {
electricbox: {
text: bpLight,
},
kp: {
circle: bpLight,
text: bpLight,
halo: bpLight,
},
kvb: {
color: bpLight,
},
Expand All @@ -326,29 +337,19 @@ const colors: Record<string, Theme> = {
text: bpLight,
halo: bpBg,
},
psl: {
pointtext: bpLight,
pointhalo: bpBg,
detailtext: bpLight,
detailhalo: bpBg,
text: bpLight,
halo: bpBg,
},
mapmarker: {
text: bpMedium,
circle: bpLight,
},
op: {
text: bpLight,
halo: bpBg,
},
sign: {
text: bpLight,
halo: bpBg,
neutral_sections: {
lower_pantograph: '#ff0000',
switch_off: '#000000',
},
pk: {
op: {
circle: bpLight,
text: bpLight,
minitext: bpLight,
halo: bpBg,
},
platform: {
fill: bpMedium,
Expand All @@ -369,9 +370,13 @@ const colors: Record<string, Theme> = {
color750V: bpLight,
colorOther: bpLight,
},
neutral_sections: {
lower_pantograph: '#ff0000',
switch_off: '#000000',
psl: {
pointtext: bpLight,
pointhalo: bpBg,
detailtext: bpLight,
detailhalo: bpBg,
text: bpLight,
halo: bpBg,
},
radio: {
text: bpMedium,
Expand All @@ -391,6 +396,10 @@ const colors: Record<string, Theme> = {
text: bpLight,
halo: bpBg,
},
sign: {
text: bpLight,
halo: bpBg,
},
signal: {
text: bpLight,
halo: bpBg,
Expand Down
16 changes: 6 additions & 10 deletions front/src/common/Map/Layers/BufferStops.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,20 @@ export function getBufferStopsLayerProps(params: { sourceTable?: string }): Omit
type: 'symbol',
minzoom: 12,
layout: {
'text-field': ['slice', ['get', 'id'], 11],
'text-field': '{extensions_sncf_kp}',
'text-font': ['Roboto Condensed'],
'text-size': 10,
'text-offset': [0, 1.2],
'text-offset': [1, 0.2],
'icon-image': 'HEURTOIR',
'icon-size': 0.2,
'text-anchor': 'center',
'text-anchor': 'left',
'icon-rotation-alignment': 'viewport',
'icon-allow-overlap': false,
'icon-ignore-placement': false,
'text-allow-overlap': false,
visibility: 'visible',
},
paint: {
'text-color': '#555',
'text-halo-width': 2,
'text-halo-color': 'rgba(255,255,255,0.75)',
'text-halo-blur': 1,
'text-color': '#333',
},
};

Expand All @@ -48,13 +44,13 @@ const BufferStops: FC<BufferStopsProps> = ({ layerOrder }) => {

return layersSettings.bufferstops ? (
<Source
id="osrd_bufferstoplayer_geo"
id="osrd_bufferstop_geo"
type="vector"
url={`${MAP_URL}/layer/buffer_stops/mvt/geo/?infra=${infraID}`}
>
<OrderedLayer
{...getBufferStopsLayerProps({ sourceTable: 'buffer_stops' })}
id="chartis/osrd_bufferstoplayer/geo"
id="chartis/osrd_bufferstop/geo"
layerOrder={layerOrder}
/>
</Source>
Expand Down
4 changes: 2 additions & 2 deletions front/src/common/Map/Layers/Detectors.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ export function getDetectorsNameLayerProps(params: {
const res: OmitLayer<SymbolLayer> = {
type: 'symbol',
layout: {
'text-field': ['slice', ['get', 'id'], 9],
'text-field': '{extensions_sncf_kp}',
'text-font': ['Roboto Condensed'],
'text-size': 10,
'text-anchor': 'left',
'text-allow-overlap': false,
'text-ignore-placement': false,
'text-offset': [0.75, 0.1],
'text-offset': [0.5, 0.2],
visibility: 'visible',
},
paint: {
Expand Down
22 changes: 22 additions & 0 deletions front/src/common/Map/Layers/GeoJSONs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ import {
import { getPSLSignsLayerProps, getPSLSignsMastLayerProps } from './extensions/SNCF/SNCF_PSL_SIGNS';
import { LayerContext } from './types';
import { getCatenariesProps, getCatenariesTextParams } from './Catenaries';
import configKPLabelLayer from './configKPLabelLayer';
import OrderedLayer from './OrderedLayer';

const SIGNAL_TYPE_KEY = 'extensions_sncf_installation_type';
Expand Down Expand Up @@ -146,6 +147,18 @@ function getSignalLayers(context: LayerContext, prefix: string): LayerProps[] {
return [
{ ...getSignalMatLayerProps(context), id: `${prefix}geo/signal-mat` },
{ ...getPointLayerProps(context), id: `${prefix}geo/signal-point` },
{
...configKPLabelLayer({
bottomOffset: 6.5,
colors: context.colors,
fieldName: 'extensions_sncf_kp',
minzoom: 12,
isSignalisation: true,
sourceLayer: context.sourceTable || '',
}),
id: `${prefix}geo/signal-kp`,
filter: ['in', 'extensions_sncf_installation_type', ...context.symbolsList],
} as LayerProps,
].concat(
context.symbolsList.map((symbol) => {
const props = getSignalLayerProps(context, symbol);
Expand Down Expand Up @@ -212,6 +225,15 @@ function getPSLSignsLayers(context: LayerContext, prefix: string): LayerProps[]
id: `${prefix}geo/psl-signs-mast`,
minzoom: POINT_ENTITIES_MIN_ZOOM,
},
{
...configKPLabelLayer({
colors: context.colors,
minzoom: 9.5,
isSignalisation: true,
sourceLayer: 'psl_signs',
}),
id: `${prefix}geo/psl-signs-kp`,
},
];
}

Expand Down
Loading