Represents a vector data object with a shape. It may include application specific properties.

Type Parameters

  • TShape extends Shape | null = Shape | null

    Represents the type of feature's shape. Default type is inferred from the 'shape' passed to the constructor.

  • TProperties extends FeatureProperties = FeatureProperties

    Represents the type of feature's properties. Default type is inferred from the 'properties' passed to the constructor. If the 'properties' is not provided the type is defaulted to FeatureProperties.

      // Creates a type-guarded Feature with the Point shape and specific properties
    const leuvenCity = new Feature(point, {name: 'Leuven'});
    // TypeScript infers the shape and properties type from the constructor inputs
    const {x, y} = leuvenCity.shape;
    console.log(`city: ${leuvenCity.properties.name}`);

    // Let TypeScript know the types explicitly
    interface CityProps {name: string, population: number}
    const anotherCity = new Feature<Point, CityProps>(point, {name: 'Brussels', population: 2_100_000});
    anotherCity.properties.population += 20_000;

Hierarchy

Constructors

Accessors

Methods

Constructors

  • Creates a new feature with the given geometry and properties. Represents a vector data object with a shape. It may include application specific properties.

    Type Parameters

    Parameters

    • shape: TShape

      the feature's shape.

    • Optional properties: TProperties

      an object hash containing the Feature's properties.

    • Optional id: FeatureId

      the identifier of the Feature. This id may be omitted when instantiating a new feature: for example, before adding a Feature to a MemoryStore. However, note that features which are part of the result of a model query must have an id.

    Returns Feature<TShape, TProperties>

Accessors

  • get id(): FeatureId
  • The unique identifier of the Feature. This unique id must uniquely identify the Feature within the context of a model, ie.within the context of a luciad.model.feature.FeatureModel.

    Returns FeatureId

  • set id(value): void
  • Parameters

    Returns void

  • get properties(): TProperties
  • The properties of the data object. This is optional and may be left undefined. Usually, this object is a key/value pair object.

    Returns TProperties

  • set properties(value): void
  • Parameters

    • value: TProperties

    Returns void

  • get shape(): TShape
  • The shape of the feature

    Returns TShape

  • set shape(shape): void
  • Parameters

    • shape: TShape

    Returns void

Methods

  • Makes a deep clone of this feature.

    Returns Feature<TShape, TProperties>

    a copy of this feature