Styling: {
    APPLY_CONVERT_GEOM_GPX: boolean;
    DEFAULT_CIRCLE: {
        fill: { color: number[]; opacity: number };
        radius: number;
        stroke: { color: number[]; opacity: number; width: number };
    };
    DEFAULT_FILL: { color: number[]; opacity: number };
    DEFAULT_ICON: { anchor: number[]; scale: number; src: string };
    DEFAULT_STROKE: { color: number[]; opacity: number; width: number };
    DEFAULT_TEXT: {
        fill: { color: number[]; opacity: number };
        font: string;
        stroke: { color: number[]; opactity: number; width: number };
        textAlign: string;
    };
    definePropertiesFromStyle: (feature: any) => void;
    definePropertiesFromStyleByType: (feature: any) => void;
    defineStyleFromProperties: (feature: any) => any;
    defineStyleFunctionByDefault: (defaultStyle: any) => Function;
    defineTagFromStyle: (style: any, format: string) => string;
    getListTags: () => any[];
} = ...

Type declaration

  • APPLY_CONVERT_GEOM_GPX: boolean

    Options to convert geometry

  • DEFAULT_CIRCLE: {
        fill: { color: number[]; opacity: number };
        radius: number;
        stroke: { color: number[]; opacity: number; width: number };
    }

    Default circle style options

  • DEFAULT_FILL: { color: number[]; opacity: number }

    Default fill style options

  • DEFAULT_ICON: { anchor: number[]; scale: number; src: string }

    Default icon style options

  • DEFAULT_STROKE: { color: number[]; opacity: number; width: number }

    Default stroke style options

  • DEFAULT_TEXT: {
        fill: { color: number[]; opacity: number };
        font: string;
        stroke: { color: number[]; opactity: number; width: number };
        textAlign: string;
    }

    Default text style options

  • definePropertiesFromStyle: (feature: any) => void

    Transform a native style to feature properties

    definePropertiesFromStyle

    A l'écriture du format.

    feature style --> feature properties --> tag styling

    Le style natif est récupéré pour chaque feature :

    // Ex.
    var style = feature.getStyle();

    Ensuite, le style natif est transformé en properties pour chaque feature :

    // Ex.
    var stroke = style.getStroke();
    var oColorStroke = Color.rgbaToHex(stroke.getColor());
    feature.set("stroke", oColorStroke.hex); // #000000
    feature.set("stroke-opacity", oColorStroke.opacity); // 0.8

    Et, chaque properties des features sont ecrites dans le format du fichier (opération native sous OpenLayers) :

    Ex. avec le format GeoJSON :

    "properties": {
    "stroke": "#000000",
    "stroke-opacity": 0.8
    }
  • definePropertiesFromStyleByType: (feature: any) => void

    Transform a native style to feature properties by type of geometry

    not yet implemented !

  • defineStyleFromProperties: (feature: any) => any

    Transform feature properties to a native style

    defineStyleFromProperties

    A la lecture du format :

    tag styling ---> feature properties ---> feature style

    Les balises de 'styling' du fichier sont ajoutées dans les properties de chaque features (opération native sous OpenLayers):

    Ex. avec le format GeoJSON :

    "properties": {
    "stroke": "#000000", -> feature.get("stroke");
    "stroke-width": 13, -> feature.get("stroke-width");
    "stroke-opacity": 0.8, -> feature.get("stroke-opacity");
    "fill": "#a03737", -> feature.get("fill");
    "fill-opacity": 0.5 -> feature.get("fill-opacity");
    }

    Ensuite, les properties des features sont transformées dans le style natif :

    // Ex.
    feature.setStyle(new Style({
    fill : new FillStyle({
    color : Color.hexToRgba(feature.get("fill"), feature.get("fill-opacity") || 1)
    }),
    stroke : new StrokeStyle({
    color : Color.hexToRgba(feature.get("stroke"), feature.get("stroke-opacity"))
    width : feature.get("stroke-width")
    })
    }));
  • defineStyleFunctionByDefault: (defaultStyle: any) => Function

    Define a default style function to apply to a feature

    defineStyleFunctionByDefault

    ...

  • defineTagFromStyle: (style: any, format: string) => string

    Transform a native style to tags 'styling' into the format

    defineTagFromStyle

    A partir d'un style natif, on le transforme en balise de 'styling' dans le format demandé, que l'on peut ensuite inserer dans le fichier.

    style ---> tag styling

  • getListTags: () => any[]

    All styling tags

    getListTags

    "type", // type de geometrie
    "fill",
    "fill-opacity",
    "stroke",
    "stroke-opacity",
    "stroke-width",
    "circle-fill",
    "circle-fill-opacity",
    "circle-stroke",
    "circle-stroke-opacity",
    "circle-stroke-width",
    "circle-radius",
    "marker-symbol",
    "marker-color",
    "marker-size"