NodeDigiTab

Namespace: Digi21.DigiNG.DigiTab
Assembly: Digi21.DigiNG

Code in a DigiTab code table.

public sealed class NodeDigiTab : IDisposable

Implements: IDisposable. The NuGet package's reference assembly declares public sealed class NodeDigiTab, without IDisposable: code compiled with the package cannot use using with a NodeDigiTab or call Dispose, and native code is released when the garbage collector finalizes the object.

A NodeDigiTab is obtained in two ways:

  • Through Codes or the this[string] indexer of a DigiTab. The object is not a copy: assigning a property changes the code in the code table, in memory. If the code table is not modifiable, the assignment throws InvalidOperationException.
  • Through the constructor, to add it later to a table using AddCode. After AddCode, that object is read-only.

Assignments to a read-only object's properties throw InvalidOperationException.

Constructors

Constructor Description
NodeDigiTab(string name) Creates a line code with the specified name.

Properties

Property Description
string Name Code name. Read-only.
string Description Code description.
GeometryType Type Geometry type: point, line or virtual.
int Priority Code priority.
string Color Color in the drawing window.
string ColorPhotogrammetric Color in the photogrammetric window.
IEnumerable<string> Tags Code tags.
IEnumerable<string> Alias Code aliases.
string Table Database table linked to the code.
Dictionary<string, string> Values Code values. Read-only.

Methods

Method Description
void Dispose() Releases native code. After Dispose, the object cannot be used. Not present in the NuGet package's reference assembly.

Example

This program adds the point code PUNTO_CONTROL to a code table and saves it to another file:

using Digi21.DigiNG.DigiTab;

if (args.Length != 2)
{
    Console.WriteLine("Uso: AnadeCodigo <entrada.tab.xml> <salida.tab.xml>");
    return 1;
}

using var tabla = DigiTab.Load(args[0]);

if (tabla.HasCode("PUNTO_CONTROL"))
{
    Console.WriteLine("La tabla ya tiene el código PUNTO_CONTROL.");
    return 1;
}

var código = new NodeDigiTab("PUNTO_CONTROL")
{
    Description = "Punto de control",
    Color = "#FF0000FF",
    ColorPhotogrammetric = "#FFFF00FF",
    Priority = 10,
    Tags = ["control", "topografía"],
    // Enum.Parse obtains the number from the installed assembly; read the GeometryType page.
    Type = Enum.Parse<GeometryType>("Point"),
};

// After AddCode, the properties of 'código' are read-only.
tabla.AddCode(código);
tabla.Write(args[1]);

Console.WriteLine($"{tabla.Codes.Count()} códigos escritos en {args[1]}.");
return 0;