Class S57ToS101Translator
Translates a parsed S-57 S57Document (from the
EncDotNet.S57 NuGet package) into the S-101 in-memory document model
so that the existing S-101 portrayal pipeline can drive rendering of S-57
ENC data.
public sealed class S57ToS101Translator
- Inheritance
-
S57ToS101Translator
- Inherited Members
Remarks
The translation is intentionally lossy and breadth-first:
- S-57 object/attribute numeric codes are remapped to S-101 Feature Catalogue acronyms via S57S101Mapping. Unmapped feature classes are skipped.
- S-57 isolated / connected nodes become S-101 Point records.
- S-57 edges become S-101 Curve Segment records with begin / end point associations and intermediate coordinates.
- S-57 area features have their FSPT edge ring wrapped into a single composite curve and referenced from a synthesised S-101 Surface record.
- S-57 multi-point soundings (
SOUNDG) are translated into a single S-101Soundingfeature backed by a multi-point spatial record (RCNM = 115); the depth values live on the points within that record and are read by theSOUNDG03portrayal rule aspoint.ScaledZ. - Listed-value remap (S-57 enum codes to S-101 enum codes) is not yet performed; string attribute values pass through unchanged.
Complex attributes are emitted in pre-order: the complex's row (empty
value) followed by its sub-attribute rows. Every row's
ParentIndex (ISO 8211 PAIX, S-100
Part 10a) names the 1-based position of its parent complex row in the
same list, or 0 for a row bound directly to the feature, so the
nesting the Feature Catalogue prescribes is explicit in the output.
Feature identifiers: every S-101 feature carries the producing agency,
FIDN and FIDS of the S-57 object it comes from. When one S-57
object yields several S-101 features (a BRIDGE becomes a
Bridge and a SpanFixed / SpanOpening), the primary
feature (the Bridge) keeps the S-57 identifier and the derived one
keeps the agency and FIDN but takes the next FIDS (the S-57
feature identification subdivision, wrapping from 65535 to 0) that no
feature in the translated dataset uses, so feature object identifiers stay
unique. Features of distinct S-57 objects that share a FOID in the source
cell keep it, so validation still reports the source duplicate.
Constructors
S57ToS101Translator()
Creates a translator using Default.
public S57ToS101Translator()
S57ToS101Translator(S57S101Mapping)
Creates a translator using the supplied code mapping.
public S57ToS101Translator(S57S101Mapping mapping)
Parameters
mappingS57S101Mapping
S57ToS101Translator(S57S101Mapping, S101AllowedEnumValues?)
Creates a translator using the supplied code mapping and the given
allowable-value lookup. Pass null for allowedEnumValues
to disable enumerate-value enforcement (useful in tests).
public S57ToS101Translator(S57S101Mapping mapping, S101AllowedEnumValues? allowedEnumValues)
Parameters
mappingS57S101MappingallowedEnumValuesS101AllowedEnumValues
S57ToS101Translator(S57S101Mapping, S101AllowedEnumValues?, S101FeatureAttributeBindings)
Creates a translator using the supplied code mapping, allowable-value
lookup, and feature/attribute binding lookup. Pass null for
allowedEnumValues to disable enumerate-value
enforcement (useful in tests). featureBindings gates
which feature classes may carry each assembled S-101 complex attribute.
public S57ToS101Translator(S57S101Mapping mapping, S101AllowedEnumValues? allowedEnumValues, S101FeatureAttributeBindings featureBindings)
Parameters
mappingS57S101MappingallowedEnumValuesS101AllowedEnumValuesfeatureBindingsS101FeatureAttributeBindings
S57ToS101Translator(S57S101Mapping, S101AllowedEnumValues?, S101FeatureAttributeBindings, S57TranslationTarget)
Creates a translator into target using the supplied
code mapping, allowable-value lookup, and feature/attribute binding lookup.
The lookups should be built from target's Feature
Catalogue; ForTarget(S57TranslationTarget) wires the bundled ones.
public S57ToS101Translator(S57S101Mapping mapping, S101AllowedEnumValues? allowedEnumValues, S101FeatureAttributeBindings featureBindings, S57TranslationTarget target)
Parameters
mappingS57S101MappingallowedEnumValuesS101AllowedEnumValuesfeatureBindingsS101FeatureAttributeBindingstargetS57TranslationTarget
Properties
Target
The S-100 product this translator targets.
public S57TranslationTarget Target { get; }
Property Value
Methods
ForTarget(S57TranslationTarget)
Creates a translator into target using the bundled
mapping and Feature Catalogue lookups for
Spec (see ForSpec(string)).
public static S57ToS101Translator ForTarget(S57TranslationTarget target)
Parameters
targetS57TranslationTargetThe S-100 product to translate into.
Returns
- S57ToS101Translator
A translator targeting
target.
ForTarget(S57TranslationTarget, S57S101Mapping)
Creates a translator into target whose enumerate-value
and complex-attribute checks use the bundled Feature Catalogue of
Spec.
public static S57ToS101Translator ForTarget(S57TranslationTarget target, S57S101Mapping mapping)
Parameters
targetS57TranslationTargetThe S-100 product to translate into.
mappingS57S101MappingThe S-57 code mapping into
target's feature catalogue.
Returns
- S57ToS101Translator
A translator targeting
target.
Translate(S57Dataset)
Translates an S57Dataset into an S101Document.
public S101Document Translate(S57Dataset dataset)
Parameters
datasetS57Dataset
Returns
Translate(S57Dataset, S57TranslationDiagnostics?)
Translates an S57Dataset into an S101Document,
recording what was dropped into diagnostics.
public S101Document Translate(S57Dataset dataset, S57TranslationDiagnostics? diagnostics)
Parameters
datasetS57DatasetdiagnosticsS57TranslationDiagnostics
Returns
Translate(S57Document)
Translates an S57Document into an S101Document.
public S101Document Translate(S57Document s57)
Parameters
s57S57Document
Returns
Translate(S57Document, S57TranslationDiagnostics?)
Translates an S57Document into an S101Document, optionally recording per-drop diagnostics.
public S101Document Translate(S57Document s57, S57TranslationDiagnostics? diagnostics)
Parameters
s57S57DocumentThe parsed S-57 document to translate.
diagnosticsS57TranslationDiagnosticsOptional collector that accumulates the object classes, attributes, and enumerate values dropped during translation. Pass
null(the default) to disable collection with zero overhead.