LuciadCPillar C# 2024.0.01
Luciad.Models.Features.Feature Class Reference

A Feature is a (partial) copy of a domain object. More...

Inheritance diagram for Luciad.Models.Features.Feature:

Classes

class  Builder
 Allows the incremental creation of a Feature object. More...
 

Public Member Functions

Luciad.Models.Features.Feature.Builder AsBuilder ()
 Returns this Feature as a Feature.Builder. More...
 
void Dispose ()
 
override bool Equals (object other)
 
Luciad.Geometries.Geometry FindGeometry ()
 Tries to find a geometry for this feature. More...
 
override int GetHashCode ()
 
GetValue< T > (Luciad.Datamodels.DataPropertyPath propertyPath)
 Accesses the value for the given property. More...
 
bool HasId ()
 Returns if this Feature has an id. More...
 

Static Public Member Functions

static Luciad.Models.Features.Feature.Builder NewBuilder ()
 Returns a new Feature Builder. More...
 

Properties

Luciad.Datamodels.DataType DataType [get]
 The data type describing the feature properties. More...
 
ulong Id [get]
 The id of this feature. More...
 

Detailed Description

A Feature is a (partial) copy of a domain object.

It allows the rest of the API to easily access the domain object's properties, including any geometry. If you do a query on the model, and retrieve a Feature from it, the caller of the query receives ownership of the Feature. I.e. the caller can decide what to do with it, and when to dispose it.

This means that the Map and Layer API's are allowed to keep references to a Feature and have unrestricted lock-less access to its properties. The caller of the IFeatureModel.Query method is responsible for managing the lifetime of a Feature.

To make Feature instances easy to use in a multi-threaded environment, they are

  • immutable
  • thread safe for reading

See article for more details on this class.

Member Function Documentation

◆ AsBuilder()

Luciad.Models.Features.Feature.Builder Luciad.Models.Features.Feature.AsBuilder ( )
inline

Returns this Feature as a Feature.Builder.

This makes it possible to copy a Feature, and modify values. Note that when using this builder, it is not possible to change the datatype. Only the values and the id of the Feature. Otherwise a System.InvalidOperationException will be thrown.

Returns
this Feature as a Feature.Builder.
Since
2020.1

◆ Dispose()

void Luciad.Models.Features.Feature.Dispose ( )
inline

◆ Equals()

override bool Luciad.Models.Features.Feature.Equals ( object  other)
inline

◆ FindGeometry()

Luciad.Geometries.Geometry Luciad.Models.Features.Feature.FindGeometry ( )
inline

Tries to find a geometry for this feature.

If this feature's data type is annotated with GeometryDataAnnotation, the value of the corresponding property is returned. Otherwise, the result will be null.

Returns
the annotated geometry, if any, else null.
See also
GeometryDataAnnotation.PropertyPath

◆ GetHashCode()

override int Luciad.Models.Features.Feature.GetHashCode ( )
inline

◆ GetValue< T >()

T Luciad.Models.Features.Feature.GetValue< T > ( Luciad.Datamodels.DataPropertyPath  propertyPath)
inline

Accesses the value for the given property.

Example

var optBool = feature.GetValue<bool?>(boolPropertyPath);
var optInt = feature.GetValue<int?>(intPropertyPath);
var optLong = feature.GetValue<long?>(longPropertyPath);
var optFloat = feature.GetValue<float?>(floatPropertyPath);
var optDouble = feature.GetValue<double?>(doublePropertyPath);
var optString = feature.GetValue<string>(stringPropertyPath);
var optGeometry = feature.GetValue<Geometry>(geometryPropertyPath);
var unsetValue = feature.GetValue<string>(unsetPropertyPath); // Unset property -> null
Parameters
propertyPaththe property for which to return a value
Template Parameters
Tthe supported types are bool, int, long, float, double, string, Geometry or a subtype of Geometry.
Returns
the value for the given property. If the property does exist in the DataType, but is not set for this particular feature, null is returned.
Exceptions
System.ArgumentExceptionwhen the property is not of a known type, if it doesn't exist in the DataType, or when the type of the value doesn't correspond with the provided type parameter (for example when the property value is a Point geometry, but it is requested using ArcBand as type parameter).

◆ HasId()

bool Luciad.Models.Features.Feature.HasId ( )
inline

Returns if this Feature has an id.

If this method returns false, it is not allowed to call Feature.Id.

Returns
if this Feature has an id.
See also
Feature.Builder.Id

◆ NewBuilder()

static Luciad.Models.Features.Feature.Builder Luciad.Models.Features.Feature.NewBuilder ( )
inlinestatic

Returns a new Feature Builder.

Returns
a new Feature Builder.

Property Documentation

◆ DataType

Luciad.Datamodels.DataType Luciad.Models.Features.Feature.DataType
get

The data type describing the feature properties.

[get]

Returns the data type describing the feature properties.

◆ Id

ulong Luciad.Models.Features.Feature.Id
get

The id of this feature.

[get]

Returns the id of this feature. A feature id should be unique across a model.

When no id is set, this method will throw an exception.

Exceptions
System.InvalidOperationExceptionwhen the feature has no id.