User Tools

Site Tools


doc:topologylayer:1300

High-Level API Integration

Documentation | ⌂ Topology Layers | « Previous | Next »

  • TGIS_TopoTool provides access to High-Level topology functionality.
  • Topology workflows available in Editor can be embedded into applications.
  • Most topology operations are executed through RunTool().
  • High-Level APIs simplify topology application development.

Throughout this guide we have focused primarily on topology workflows available through TatukGIS Editor.

One of the key design goals of the TatukGIS topology framework is that the same functionality is also available to developers through TatukGIS Developer Kernel.

This allows custom GIS applications to provide topology capabilities without implementing topology management, validation, hierarchy maintenance, or editing workflows from scratch.

Developer Focus

This chapter introduces the High-Level API based on the TGIS_TopoTool class. Low-Level topology classes such as TGIS_TopoStoreAbstract class, and topology primitive management APIs are outside the scope of this introductory guide.

Native Topology Support

Topology stored using the SQLite topology format is supported natively by TatukGIS Developer Kernel.

A topology layer can be added to a map and used very much like a standard vector layer.

The layer can:

  • Be displayed in a Viewer.
  • Participate in selections.
  • Support geometry editing.
  • Participate in topology workflows.
  • Serve as a parent layer for Feature hierarchies.

From the application point of view, topology layers behave similarly to ordinary vector layers.

IMPORTANT: SQLite topology support is available natively in TatukGIS Developer Kernel. Support for PostGIS Topology and Oracle Topology requires Enterprise functionality.

The High-Level API Philosophy

The topology framework was intentionally designed to hide the complexity of topology management behind a small set of high-level operations.

Rather than requiring an application developer to manually:

  • Create topology schemas
  • Manage Nodes
  • Manage Edges
  • Create Faces
  • Maintain hierarchies
  • Validate topology

TatukGIS provides a ready-made topology controller in TGIS_TopoTool class. This class exposes the same workflows available in TatukGIS Editor.

Topology Tool Architecture

The application launches a tool, and the framework handles the complete workflow automatically.

Creating the Topology Tool Instance

Topology functionality becomes available after creating an instance of TGIS_TopoTool class.

Typically, this is performed during form initialization.

procedure TfrmTopology.FormCreate(Sender: TObject);
begin
  fTopoTool := TGIS_TopoTool.Create(
                 Self,
                 gisViewer,
                 gisLegend,
                 gisAttributes
               );
end;

The constructor accepts instances of:

  • TGIS_ViewerWnd,
  • TGIS_Legend,
  • TGIS_ControlAttributes (optional).

Once created, the object is ready to execute topology operations.

Launching Topology Tools

Most topology functionality is exposed through:

RunTool(...)

The method accepts one value from the TGIS_TopoTools enumeration.

procedure RunTool(
  const _tool : TGIS_TopoTools
);

Creating a New Topology

The Create Topology Wizard can be launched through:

procedure TfrmTopology.menuTopoCreateTopologyClick(
  Sender: TObject
);
begin
  fTopoTool.RunTool(
    TGIS_TopoTools.CreateTopology
  );
end;

This operation corresponds directly to:

Topology → Create Topology...

in TatukGIS Editor.

Creating Feature Layers

Feature Layer creation is exposed through:

procedure TfrmTopology.menuTopoCreateFeatureLayerClick(
  Sender: TObject
);
begin
  fTopoTool.RunTool(
    TGIS_TopoTools.CreateFeatureLayer
  );
end;

Executing this method launches the same Feature Layer Wizard used throughout this tutorial.

Creating Features

Features can be created using:

procedure TfrmTopology.menuTopoCreateFeatureClick(
  Sender: TObject
);
begin
  fTopoTool.RunTool(
    TGIS_TopoTools.CreateTopoFeature
  );
end;

This operation launches the Create Feature Wizard and guides the user through selecting source objects and destination layers.

Deleting Features

Feature deletion is performed through:

procedure TfrmTopology.menuTopoDeleteFeatureClick(
  Sender: TObject
);
begin
  fTopoTool.RunTool(
    TGIS_TopoTools.DeleteTopoFeature
  );
end;

Hierarchy updates are handled automatically by the topology framework.

Modifying Existing Features

Feature composition can be modified using:

procedure TfrmTopology.menuTopoAddElementsToFeatureClick(
  Sender: TObject
);
begin
  fTopoTool.RunTool(
   TGIS_TopoTools.AddElementsToTopoFeature
  );
end;

and:

procedure TfrmTopology.menuTopoDeleteFeatureElementClick(
  Sender: TObject
);
begin
  fTopoTool.RunTool(
    TGIS_TopoTools.DeleteTopoFeatureElement
  );
end;

These operations correspond to the Add Elements and Delete Feature Element workflows described earlier in this guide.

Topology Validation and Repair

Topology import errors can be repaired automatically or manually.

Automatic Repair

procedure TfrmTopology.menuTopoAutoFixImportErrorsClick(
  Sender: TObject
);
begin
  fTopoTool.RunTool(
    TGIS_TopoTools.AutoFixTopoImportErrors
  );
end;

Merge Feature Into Neighbor

procedure TfrmTopology.menuTopoMergeFeatureIntoNeighborClick(
  Sender: TObject
);
begin
  fTopoTool.RunTool(
    TGIS_TopoTools.ManualFixTopoImportErrors
);
end;

The corresponding repair wizards are displayed automatically.

Settings and Rollback

Additional topology operations are also available.

Settings

procedure TfrmTopology.menuTopoSettingsClick(
  Sender: TObject
);
begin
  fTopoTool.OpenSettingsForm;
end;
<code pascal>

Rollback

procedure TfrmTopology.menuTopoRollbackClick(
  Sender: TObject
);
begin
  fTopoTool.Rollback;
end;

Rollback restores the topology to the most recently committed state.

Minimal Topology Application

One of the strengths of the High-Level API is its simplicity.

After:

  • Creating a TGIS_TopoTool instance
  • Connecting menu items to RunTool()

the application immediately gains support for:

  • Topology creation
  • Feature Layer creation
  • Feature hierarchy management
  • Topology editing
  • Validation
  • Error repair

TIP: For many applications, the code presented in this chapter is sufficient to build a complete topology-enabled GIS application. The complexity of topology management remains hidden behind the TGIS_TopoTool class interface.


The next chapter shows editing API used ina TopologyLayer sample application.

« Previous | Next »

2026/09/24 17:12

Page Tools