Your application needs aviation objects, such as airspaces or routes, and you don’t want read them in from a data source, an AIXM, ARINC 424, or DAFIF dataset, for example. Instead, you want to create the aviation objects from code.

Choosing a domain model

To create the aviation objects, you need a domain model that you can instantiate and configure with properties.

The tutorial Support a custom vector format explains how you can create a domain model from scratch.

For aviation data, you can also rely on domain models in the API:

  • The AIXM 5.1 domain model, available in the com.luciad.format.aixm51.model package. The decoder for the AIXM 5.1 format uses this domain model.

  • The AIS domain model, available in the com.luciad.ais.model package. The decoders for the ARINC 424, AIXM 3.3/4.x and DAFIF(T) formats use this domain model.

In comparison, the AIXM 5.1 domain model is the most elaborate one, offering a lot of flexibility. The AIS domain model focuses on ease-of-use. In this article, we rely on the AIS domain model to create airspace objects.

Creating aviation data through the AIS domain model

The AIS domain model comes with a factory class TLcdAISDataObjectFactory. We start from that factory class to create aviation objects. We show you how to use it by creating two types of aviation objects:

  • An airspace defined by a boundary

  • An airspace defined by a corridor

The factory methods in TLcdAISDataObjectFactory require a TLcdDataType that defines the desired properties, such as the airspace name and type. For this, we can use a set of out-of-the-box data types that model the properties according to the data formats ARINC 424, AIXM 3.3/4.x, or DAFIF(T). In this article, we rely on the AIXM 3.3/4.x data types.

Creating an airspace defined by a boundary

To start creating an airspace defined by a boundary, we invoke the method createAirspace in TLcdAISDataObjectFactory:

Program: Creating a boundary airspace domain object
TLcdAISDataObjectFactory aisDataObjectFactory = new TLcdAISDataObjectFactory();
ILcdEditableAirspace airspace = aisDataObjectFactory.createAirspace(TLcdAIXMDataTypes.Airspace);

Next, we define the geometry of the airspace. An ILcdEditableAirspace represents an airspace defined by a boundary, which you can construct with TLcdAirspaceSegment instances. Together, those airspace segments form the closed boundary of the airspace.

Program: Defining the geometry of a boundary airspace
TLcdAirspaceSegment segment = new TLcdAirspaceSegment(RHUMB_LINE);
segment.setSegmentNumber(1);
segment.setLocation(new TLcdLonLatHeightPoint(8.0, 44.0, 1000.0));
airspace.addSegment(segment);

segment = new TLcdAirspaceSegment(RHUMB_LINE);
segment.setSegmentNumber(2);
segment.setLocation(new TLcdLonLatHeightPoint(8.5, 44.5, 1000.0));
airspace.addSegment(segment);

segment = new TLcdAirspaceSegment(RHUMB_LINE);
segment.setSegmentNumber(3);
segment.setLocation(new TLcdLonLatHeightPoint(8, 45, 1000.0));
airspace.addSegment(segment);

Finally, we populate the properties of the airspace, such as its type, and its lower and upper limit:

Program: Defining the properties of a boundary airspace
airspace.setValue(TLcdAIXMAirspaceDataProperties.TYPE, TLcdAirspaceType.OTHER);
airspace.setValue(TLcdAIXMAirspaceDataProperties.LOWER_LIMIT, 500);
airspace.setValue(TLcdAIXMAirspaceDataProperties.LOWER_LIMIT_UNIT, TLcdAltitudeUnit.FEET);
airspace.setValue(TLcdAIXMAirspaceDataProperties.UPPER_LIMIT, 5000);
airspace.setValue(TLcdAIXMAirspaceDataProperties.UPPER_LIMIT_UNIT, TLcdAltitudeUnit.FEET);

To use this domain object on a map, you first add it to a model:

Program:Adding the boundary airspace to a model
TLcd2DBoundsIndexedModel model = new TLcd2DBoundsIndexedModel();
model.setModelReference(new TLcdGeodeticReference());
model.setModelDescriptor(new TLcdAIXMAirspaceModelDescriptor("customAirspace"));
model.addElement(airspace, ILcdModel.NO_EVENT);

You can visualize the resulting model directly on a GXY or Lightspeed map. See Visualize AIXM data on a GXY map and Visualize AIXM data on a Lightspeed map for more information.

Creating an airspace defined by a corridor

You create an airspace defined by a corridor in much the same way, but now you must use the domain object ILcdEditableAirspaceCorridor instead. To start creating the airspace, you call the method createAirspaceCorridor in TLcdAISDataObjectFactory. You use TLcdAIXMDataTypes.AirspaceCorridor as the data type. Again, you construct the geometry from airspace segments, but this time the segments represent the axis of the corridor. You define the width of the corridor through the width property on ILcdEditableAirspaceCorridor.