Skip to content

DatelineHelper

Namespace: ThinkGeo.Core

Splits and rejoins geometry at the dateline: the east and west edges of a wrapping extent, in the extent's own unit - decimal degrees, Spherical Mercator meters, or a custom world.

public static class DatelineHelper

Inheritance object → DatelineHelper

Remarks:

Geometry drawn under WrappingMode.WrapDateline must lie inside the layer's LayerBase.WrappingExtent. A shape that crosses the dateline is stored as a multi-part shape cut exactly on the seam, the representation GeoJSON specifies (RFC 7946, section 3.1.9). DatelineHelper.Split(LineBaseShape, RectangleShape) produces it once, when the data is loaded; the map never folds geometry while drawing.

A line feature split this way carries the DatelineHelper.SplitColumnName column and its parts are in traversal order. Labeling reads the column to place one label at the center of the whole line, and DatelineHelper.Merge(Feature, RectangleShape) restores the continuous line so an application can read the true endpoints, length and center.

Fields

SplitColumnName

The column that marks a line feature whose parts are one line split at the dateline, in traversal order. Its value is "1". DatelineHelper.Split(LineBaseShape, RectangleShape) sets it; an application loading data a file already split (GeoJSON does) can set it itself.

public static string SplitColumnName;

Methods

Split(LineBaseShape, RectangleShape)

Splits a line at the dateline of a wrapping extent into a MultilineShape whose parts each lie inside the extent, in traversal order. Every crossing segment is cut exactly on the edge with its Y (and Z, when present) interpolated in the line's own unit. A line already inside the extent comes back as a single-part multiline.

public static MultilineShape Split(LineBaseShape lineShape, RectangleShape wrappingExtent)

Parameters

lineShape LineBaseShape
The line, in the unit of the wrapping extent.

wrappingExtent RectangleShape
The world extent whose east and west edges are the dateline.

Returns

MultilineShape
A multiline whose parts each lie within the extent's X range.

Split(AreaBaseShape, RectangleShape)

Splits a polygon or multipolygon at the dateline of a wrapping extent into a MultipolygonShape whose parts each lie inside the extent. A shape already inside the extent comes back unchanged as a single-polygon multipolygon. Polygons that enclose a pole are not handled, and per-vertex Z values are not preserved when a polygon is actually cut.

public static MultipolygonShape Split(AreaBaseShape areaShape, RectangleShape wrappingExtent)

Parameters

areaShape AreaBaseShape
The polygon or multipolygon, in the unit of the wrapping extent.

wrappingExtent RectangleShape
The world extent whose east and west edges are the dateline.

Returns

MultipolygonShape
A multipolygon whose parts each lie within the extent's X range.

Split(Feature, RectangleShape)

Splits a feature's geometry at the dateline of a wrapping extent so that it lies inside the extent. A line is split into parts in traversal order and, when it actually crosses, the returned feature carries the DatelineHelper.SplitColumnName column; a polygon is split; a point past an edge is moved inside from the other side. The feature's id, tag and column values are preserved. A feature already inside the extent is returned as it is.

public static Feature Split(Feature feature, RectangleShape wrappingExtent)

Parameters

feature Feature
The feature, in the unit of the wrapping extent.

wrappingExtent RectangleShape
The world extent whose east and west edges are the dateline.

Returns

Feature
A feature whose geometry lies within the extent's X range.

IsSplit(Feature)

Whether a feature carries the DatelineHelper.SplitColumnName column: its geometry is one line split at the dateline, parts in traversal order.

public static bool IsSplit(Feature feature)

Parameters

feature Feature
The feature to inspect.

Returns

bool
True when the feature is marked as a line split at the dateline.

Merge(Feature, RectangleShape)

The inverse of DatelineHelper.Split(LineBaseShape, RectangleShape) for a line: rejoins the parts of a feature's multiline into one line with continuous coordinates running past the edge of the wrapping extent, so its true endpoints, length and center are those of the line the data meant. A feature marked with DatelineHelper.SplitColumnName is joined in part order; an unmarked multiline is joined where one part ends on the dateline and another starts on it at the same Y, exactly one world apart. The result drops the mark. A feature that joins nothing is returned as it is. Draw the result only after splitting it again.

public static Feature Merge(Feature feature, RectangleShape wrappingExtent)

Parameters

feature Feature
The feature, in the unit of the wrapping extent.

wrappingExtent RectangleShape
The world extent whose east and west edges are the dateline.

Returns

Feature
A feature whose geometry is the continuous line, or the input when nothing joins.

A(MultilineShape, Double&)

internal static MultilineShape A(MultilineShape , Double& )

Parameters

`` MultilineShape

`` Double&

Returns

MultilineShape

A(MultilineShape, RectangleShape)

internal static MultilineShape A(MultilineShape , RectangleShape )

Parameters

`` MultilineShape

`` RectangleShape

Returns

MultilineShape

A(Feature, BaseShape)

internal static void A(Feature , BaseShape )

Parameters

`` Feature

`` BaseShape

Returns

void