This package provides classes and utilities for rendering map borders with optional axes in LuciadRIA applications. It allows you to compose a view consisting of a main map and up to four border maps that can display axes and other custom drawings aligned with the map’s coordinate system.
Overview
The central class is BorderedMap, which creates a standard LuciadRIA map (RIAMap) together with optional border maps.
Each border is implemented as a separate map and can render axes, grid lines, labels, and any custom content.
|
Usage
Use the BorderedMap class to mount the main map and any enabled border maps into a container element.
Enable a border map by specifying its size, and optionally attach an axis using axisConfiguration.
If a border map has size > 0 but no axisConfiguration, it won’t render an axis by default, but you can still use it for custom drawings.
import { BorderedMap } from "@luciad/ria-toolbox-map-borders/BorderedMap.js";
import { getUnitOfMeasure } from "@luciad/ria/uom/UnitOfMeasureRegistry.js";
import { createCartesianReference } from "@luciad/ria/reference/ReferenceProvider.js";
const mapOptions = {
reference: createCartesianReference({
xUnitOfMeasure: getUnitOfMeasure("NauticalMile"),
yUnitOfMeasure: getUnitOfMeasure("FlightLevel")
})
};
const borderedMap = new BorderedMap(domNode, mapOptions, {
left: { size: 100, axisConfiguration: { /* AxisConfiguration for left border */ } },
bottom: { size: 60, axisConfiguration: { /* AxisConfiguration for bottom border */ } },
top: { size: 40 },
right: { size: 60 }
});
Axis configuration
Each border map can have an optional axis controlled by an AxisConfiguration.
It defines line styles, tick spacing, label formatting, and grid line options.
Key properties include:
-
axisLineStyle: defines the style of the axis line.
-
gridLine: whether to extend ticks as grid lines over the map.
-
labelFormatter: formats tick labels.
-
labelStyle, labelRotation: control label appearance.
-
tickLength, subTickLength: set tick length.
-
spacing: control the distance between major ticks.
-
subTicks: define the number or function for sub-ticks.
Axes are rendered through an internally created AxisLayer that uses an AxisPainter, automatically attached to the corresponding border map.
| The axis is drawn only on the part of the border map that directly touches the main map. |
Border layers
To render custom drawings on a border, use BorderedMap.projectLayerToBorder().
It creates a new FeatureLayer on the specified border map based on a existing layer on the main map.
The new layer re-uses the source layer’s model and shapeProvider, and internally attaches a BorderShapeProvider that projects shapes onto the border axis.
const borderMap = borderedMap.getBorderMap("bottom");
const borderLayer = borderedMap.projectLayerToBorder(
trajectoryLayer,
"bottom",
new TrajectoryBorderPainter("bottom")
);
if (borderMap && borderLayer) {
borderMap.layerTree.addChild(borderLayer);
}
Alternatively, use createBorderMapLayer(model, borderType, layerOptions) to create a border layer directly from a FeatureModel.
Border shape provider
The BorderShapeProvider is automatically attached to layers created with projectLayerToBorder or createBorderMapLayer.
It projects feature shapes from the main map into the border map’s axis reference.
Depending on the shape type:
-
PolylineandPolygon: all vertices are projected onto the axis and returned as aPolyline. -
Point: projected onto the axis. -
ShapeList: all child shapes are transformed recursively. -
Pattern-based shapes, such as
ArcandCircle: simplified into a two-pointPolylinebased on their bounding-box diagonal.
You can vertically offset projected shapes (in pixels) to position them above or below the axis.
To ensure drawings remain within the visible part of the axis, use isBorderPointInAxisRange(point).
Border controllers
By default, border maps handle mouse and touch input for navigation:
-
Panning along the border axis
-
Zooming by changing the scale factor along the axis
Rotation isn’t supported.
Border maps also support feature selection. You can attach additional custom controllers to implement your own interaction logic.
|
By default, areas shared by adjacent borders, such as the bottom-left corner, don’t consume input events.
You can adjust this behavior by using |