How to use the @igo2/common.getEntityRevision function in @igo2/common

To help you get started, we’ve selected a few @igo2/common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github infra-geo-ouverte / igo2-lib / packages / geo / src / lib / feature / feature-form / feature-form.component.ts View on Github external
private formDataToFeature(data: { [key: string]: any }): Feature {
    const properties = {};
    const meta = {};
    if (this.feature === undefined) {
      (meta as any).id = uuid();
    } else {
      Object.assign(properties, this.feature.properties);
      Object.assign(meta, this.feature.meta, {
        revision: getEntityRevision(this.feature) + 1
      });
    }

    const propertyPrefix = 'properties.';
    Object.entries(data).forEach((entry: [string, any]) => {
      const [key, value] = entry;
      if (key.startsWith(propertyPrefix)) {
        const property = key.substr(propertyPrefix.length);
        properties[property] = value;
      }
    });

    let geometry = data.geometry;
    if (geometry === undefined && this.feature !== undefined) {
      geometry = this.feature.geometry;
    }
github infra-geo-ouverte / igo2-lib / projects / geo / src / lib / feature / feature-form / feature-form.component.ts View on Github external
private formDataToFeature(data: { [key: string]: any }): Feature {
    const properties = {};
    const meta = {};
    if (this.feature === undefined) {
      meta['id'] = uuid();
    } else {
      Object.assign(properties, this.feature.properties);
      Object.assign(meta, this.feature.meta, {
        revision: getEntityRevision(this.feature) + 1
      });
    }

    const propertyPrefix = 'properties.';
    Object.entries(data).forEach((entry: [string, any]) => {
      const [key, value] = entry;
      if (key.startsWith(propertyPrefix)) {
        const property = key.substr(propertyPrefix.length);
        properties[property] = value;
      }
    });

    let geometry = data.geometry;
    if (geometry === undefined && this.feature !== undefined) {
      geometry = this.feature.geometry;
    }
github infra-geo-ouverte / igo2-lib / projects / geo / src / lib / feature / shared / feature.utils.ts View on Github external
olFeature.setId(getEntityId(feature));

  if (feature.projection !== undefined) {
    olFeature.set('projection', feature.projection);
  }

  if (feature.extent !== undefined) {
    olFeature.set('extent', feature.extent);
  }

  const mapTitle = getEntityProperty(feature, 'meta.mapTitle');
  if (mapTitle !== undefined) {
    olFeature.set('mapTitle', mapTitle);
  }

  olFeature.set('entityRevision', getEntityRevision(feature));

  return olFeature;
}
github infra-geo-ouverte / igo2-lib / packages / geo / src / lib / feature / shared / feature.utils.ts View on Github external
}

  if (feature.extent !== undefined) {
    olFeature.set('_extent', feature.extent, true);
  }

  if (feature.projection !== undefined) {
    olFeature.set('_projection', feature.projection, true);
  }

  const mapTitle = getEntityProperty(feature, 'meta.mapTitle');
  if (mapTitle !== undefined) {
    olFeature.set('_mapTitle', mapTitle, true);
  }

  olFeature.set('_entityRevision', getEntityRevision(feature), true);

  const icon = getEntityIcon(feature);
  if (icon !== undefined) {
    olFeature.set('_icon', icon, true);
  }

  if (feature.meta && feature.meta.style) {
    olFeature.set('_style', feature.meta.style, true);
  }

  return olFeature;
}