LuciadCPillar C# 2026.1.02
Loading...
Searching...
No Matches
Luciad.Datamodels.DataType.Builder Class Referencesealed

Builder that allows DataType instances to be created. More...

Inheritance diagram for Luciad.Datamodels.DataType.Builder:

Public Member Functions

 Builder (Luciad.Datamodels.DataType.Builder other)
 Copy constructor.
Luciad.Datamodels.DataType.Builder AddAnnotation (Luciad.Datamodels.DataAnnotation annotation)
 The annotation to add to the data type under construction.
Luciad.Datamodels.DataType.Builder AddAnnotation (Luciad.Datamodels.IDataAnnotationFactory annotationFactory)
 Adds an annotation factory that is invoked when build is called.
Luciad.Datamodels.DataType.Builder AddBooleanProperty (string name)
 Adds a scalar property with the given name and DataType.getBooleanType() as its value type.
Luciad.Datamodels.DataType.Builder AddDoubleProperty (string name)
 Adds a scalar property with the given name and DataType.getDoubleType() as its value type.
Luciad.Datamodels.DataType.Builder AddFloatProperty (string name)
 Adds a scalar property with the given name and DataType.getFloatType() as its value type.
Luciad.Datamodels.DataType.Builder AddGeometryProperty (string name, bool mainGeometry)
 Adds a property with the given name and DataType.getGeometryType() as its value type, marking it as this type's main geometry when mainGeometry is true.
Luciad.Datamodels.DataType.Builder AddIntProperty (string name)
 Adds a scalar property with the given name and DataType.getIntType() as its value type.
Luciad.Datamodels.DataType.Builder AddLongProperty (string name)
 Adds a scalar property with the given name and DataType.getLongType() as its value type.
Luciad.Datamodels.DataType.Builder AddProperty (Luciad.Datamodels.DataProperty property)
 The property to add to the data type under construction.
Luciad.Datamodels.DataType.Builder AddStringProperty (string name)
 Adds a scalar property with the given name and DataType.getStringType() as its value type.
Luciad.Datamodels.DataType Build ()
 Build the data type, including the properties and annotations that were added to this builder.
void Dispose ()
Luciad.Datamodels.DataType.Builder Name (string name)
 The name of the new data type.

Detailed Description

Builder that allows DataType instances to be created.

Typical usage would be create a DataType.Builder using DataType.NewBuilder, specifying the data type's name. Then add the necessary DataProperty(s) and finally build() the data type. The following snippet shows how this is done for a simple example data type:

return DataType.NewBuilder()
.Name("TestDataType")
.AddProperty(someProperty)
.AddProperty(geometryProperty)
.AddAnnotation(new GeometryDataAnnotationFactory(geometryProperty))
.Build();

Constructor & Destructor Documentation

◆ Builder()

Luciad.Datamodels.DataType.Builder.Builder ( Luciad.Datamodels.DataType.Builder other)
inline

Copy constructor.

Parameters
otherthe builder to copy.

Member Function Documentation

◆ AddAnnotation() [1/2]

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddAnnotation ( Luciad.Datamodels.DataAnnotation annotation)
inline

The annotation to add to the data type under construction.

Parameters
annotationthe annotation to add to the data type under construction.
Returns
this builder.
Exceptions
System.ArgumentNullExceptionwhen a null value is passed.

◆ AddAnnotation() [2/2]

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddAnnotation ( Luciad.Datamodels.IDataAnnotationFactory annotationFactory)
inline

Adds an annotation factory that is invoked when build is called.

The factory is provided with the type that is being built. This can be useful when the created annotation needs access to the type, for instance when the annotation requires a DataPropertyPath.

An example usage is:

public sealed class GeometryDataAnnotationFactory : IDataAnnotationFactory
{
public GeometryDataAnnotationFactory(DataProperty property)
{
Property = property;
}
public DataAnnotation CreateAnnotation(DataType dataType)
{
return new GeometryDataAnnotation(DataPropertyPath.NewBuilder().OriginType(dataType).Property(Property).Build());
}
private readonly DataProperty Property;
}
var geometryProperty = DataProperty.NewBuilder().Name("geometry").ValueType(DataType.GeometryType).Build();
var dataType = DataType.NewBuilder()
.Name("MyType")
.AddProperty(geometryProperty)
.AddAnnotation(new GeometryDataAnnotationFactory(geometryProperty))
.Build();
Parameters
annotationFactorythe factory object.
Returns
this builder.
Exceptions
System.ArgumentNullExceptionwhen a null value is passed.

◆ AddBooleanProperty()

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddBooleanProperty ( string name)
inline

Adds a scalar property with the given name and DataType.getBooleanType() as its value type.

Use addProperty() for anything more specific.

Parameters
namethe name of the property.
Returns
this builder.
Since
2026.1

◆ AddDoubleProperty()

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddDoubleProperty ( string name)
inline

Adds a scalar property with the given name and DataType.getDoubleType() as its value type.

Use addProperty() for anything more specific.

Parameters
namethe name of the property.
Returns
this builder.
Since
2026.1

◆ AddFloatProperty()

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddFloatProperty ( string name)
inline

Adds a scalar property with the given name and DataType.getFloatType() as its value type.

Use addProperty() for anything more specific.

Parameters
namethe name of the property.
Returns
this builder.
Since
2026.1

◆ AddGeometryProperty()

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddGeometryProperty ( string name,
bool mainGeometry )
inline

Adds a property with the given name and DataType.getGeometryType() as its value type, marking it as this type's main geometry when mainGeometry is true.

If the data type has a single geometry, always pass true. A type needs a main geometry for Feature.findGeometry() and for the default painters to know which property holds the shape to draw. Only a type with several geometry properties needs false, for the ones that are not its main geometry.

For the main geometry, a GeometryDataAnnotation for the property is wired internally, so there is no need to create that annotation through an IDataAnnotationFactory.

A data type has at most one main geometry. Calling this again with true throws an exception, and build() additionally rejects a type of which the second GeometryDataAnnotation came from addAnnotation() rather than from here.

The annotated case is shorthand for adding the property and then attaching its GeometryDataAnnotation through an IDataAnnotationFactory, shown below:

var geometryProperty = DataProperty.NewBuilder().Name("geometry").ValueType(DataType.GeometryType).Build();
var dataType = DataType.NewBuilder()
.Name("MyType")
.AddProperty(geometryProperty)
.AddAnnotation(new GeometryDataAnnotationFactory(geometryProperty))
.Build();
Parameters
namethe name of the geometry property.
mainGeometrywhether the property is this type's main geometry, annotated with a GeometryDataAnnotation. Pass true unless the data type has more than one geometry property.
Returns
this builder.
Exceptions
System.InvalidOperationExceptionif this data type already has a main geometry and mainGeometry is true.
Since
2026.1

◆ AddIntProperty()

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddIntProperty ( string name)
inline

Adds a scalar property with the given name and DataType.getIntType() as its value type.

Use addProperty() for anything more specific.

Parameters
namethe name of the property.
Returns
this builder.
Since
2026.1

◆ AddLongProperty()

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddLongProperty ( string name)
inline

Adds a scalar property with the given name and DataType.getLongType() as its value type.

Use addProperty() for anything more specific.

Parameters
namethe name of the property.
Returns
this builder.
Since
2026.1

◆ AddProperty()

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddProperty ( Luciad.Datamodels.DataProperty property)
inline

The property to add to the data type under construction.

Parameters
propertythe property to add to the data type under construction.
Returns
this builder.

◆ AddStringProperty()

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.AddStringProperty ( string name)
inline

Adds a scalar property with the given name and DataType.getStringType() as its value type.

Use addProperty() for anything more specific.

Parameters
namethe name of the property.
Returns
this builder.
Since
2026.1

◆ Build()

Luciad.Datamodels.DataType Luciad.Datamodels.DataType.Builder.Build ( )
inline

Build the data type, including the properties and annotations that were added to this builder.

After calling this function, this builder should no longer be used.

Returns
the data type.
Exceptions
System.InvalidOperationExceptionIf not all mandatory parameters are set, or if the data type ends up with more than one GeometryDataAnnotation. A data type has at most one main geometry.

◆ Dispose()

void Luciad.Datamodels.DataType.Builder.Dispose ( )
inline

◆ Name()

Luciad.Datamodels.DataType.Builder Luciad.Datamodels.DataType.Builder.Name ( string name)
inline

The name of the new data type.

Calling this function is mandatory.

Parameters
namename of the new data type.
Returns
this builder.