src/format/FeatureHash.js
function setStyleProperties_(text, feature) {

  const properties = getStyleProperties_(text, feature);
  const geometry = feature.getGeometry();

  // Deal with legacy properties
  if (geometry instanceof olGeomPoint) {
    if (properties.isLabel ||
        properties[ngeoFormatFeatureProperties.IS_TEXT]) {
      delete properties.strokeColor;
      delete properties.fillColor;
    } else {
      delete properties.fontColor;
      delete properties.fontSize;
    }
  } else {
    delete properties.fontColor;

    if (geometry instanceof olGeomLineString) {
      delete properties.fillColor;
      delete properties.fillOpacity;
    }
  }

  // Convert font size from px to pt
  if (properties.fontSize) {
    const fontSizeStr = /** @type {string} */(properties.fontSize);
    /** @type {number} */
    let fontSize = parseFloat(fontSizeStr);
    if (fontSizeStr.indexOf('px') !== -1) {
      fontSize = Math.round(fontSize / 1.333333);
    }
    properties.fontSize = fontSize;
  }

  // Convert legacy properties
  const clone = {};
  for (const key in properties) {
    const value = properties[key];
    if (LegacyProperties_[key]) {
      clone[LegacyProperties_[key]] = value;
    } else {
      clone[key] = value;
    }
  }

  feature.setProperties(clone);
}
function setStyleProperties_(text, feature) {

  const properties = getStyleProperties_(text, feature);
  const geometry = feature.getGeometry();

  // Deal with legacy properties
  if (geometry instanceof olGeomPoint) {
    if (properties.isLabel ||
        properties[ngeoFormatFeatureProperties.IS_TEXT]) {
      delete properties.strokeColor;
      delete properties.fillColor;
    } else {
      delete properties.fontColor;
      delete properties.fontSize;
    }
  } else {
    delete properties.fontColor;

    if (geometry instanceof olGeomLineString) {
      delete properties.fillColor;
      delete properties.fillOpacity;
    }
  }

  // Convert font size from px to pt
  if (properties.fontSize) {
    const fontSizeStr = /** @type {string} */(properties.fontSize);
    /** @type {number} */
    let fontSize = parseFloat(fontSizeStr);
    if (fontSizeStr.indexOf('px') !== -1) {
      fontSize = Math.round(fontSize / 1.333333);
    }
    properties.fontSize = fontSize;
  }

  // Convert legacy properties
  const clone = {};
  for (const key in properties) {
    const value = properties[key];
    if (LegacyProperties_[key]) {
      clone[LegacyProperties_[key]] = value;
    } else {
      clone[key] = value;
    }
  }

  feature.setProperties(clone);
}
function setStyleProperties_ ( text , feature ) { const properties = getStyleProperties_ ( text , feature ) ; const geometry = feature . getGeometry ( ) ; // Deal with legacy properties if ( geometry instanceof olGeomPoint ) { if ( properties . isLabel || properties [ ngeoFormatFeatureProperties . IS_TEXT ] ) { delete properties . strokeColor ; delete properties . fillColor ; } else { delete properties . fontColor ; delete properties . fontSize ; } } else { delete properties . fontColor ; if ( geometry instanceof olGeomLineString ) { delete properties . fillColor ; delete properties . fillOpacity ; } } // Convert font size from px to pt if ( properties . fontSize ) { const fontSizeStr = /** @type {string} */ ( properties . fontSize ) ; /** @type {number} */ let fontSize = parseFloat ( fontSizeStr ) ; if ( fontSizeStr . indexOf ( 'px' ) !== - 1 ) { fontSize = Math . round ( fontSize / 1.333333 ) ; } properties . fontSize = fontSize ; } // Convert legacy properties const clone = { } ; for ( const key in properties ) { const value = properties [ key ] ; if ( LegacyProperties_ [ key ] ) { clone [ LegacyProperties_ [ key ] ] = value ; } else { clone [ key ] = value ; } } feature . setProperties ( clone ) ; }
Read a logical sequence of characters and apply the decoded result as
style properties for the feature. Legacy keys are converted to the new ones
for compatibility.
@param {string} text Text.
@param {import("ol/Feature.js").default} feature Feature.
@private
@hidden
Read a logical sequence of characters and apply the decoded result as style properties for the feature . Legacy keys are converted to the new ones for compatibility .