API reference / @zaes/tactical-graphics/openlayers / PreparedFeatures
Interface: PreparedFeatures
Defined in: components/openlayers/prepareFeatures.ts:33
One call from renderTacticalGraphic output to features you can put on a map
The pieces have existed for a while and had to be assembled in the right order: project the GeoJSON, ask stylesFor which style functions draw this graphic, publish the shape's extent to the label feature with publishGraphicExtent, and skip the label feature entirely for the 104 graphics that keep every glyph on the graphic itself. Miss the second and a symbol's designation is drawn twice; miss the third and every fitted symbol — the CBRN triangle, the airfield's runways, the sector-1 modifier glyphs — silently comes out at a fixed size in metres rather than scaled to the area it landed in.
Silently is the problem. Nothing throws, nothing warns, and the map looks plausible until somebody notices a symbol that does not grow with its shape. A host should not have to know a checklist to avoid that, so this is the checklist.
Nothing here is new capability — it is the same three calls in the order they have to happen — and the parts stay exported for a host that wants to do it by hand.
const rendered = renderTacticalGraphic(feature);
const {graphic, labels} = prepareFeatures(rendered);
source.addFeature(graphic);
if (labels) source.addFeature(labels);Properties
graphic
graphic: Feature;Defined in: components/openlayers/prepareFeatures.ts:35
The drawn symbol, styled. Always present.
labels?
optional labels?: Feature<Geometry, {
[x: string]: any;
}>;Defined in: components/openlayers/prepareFeatures.ts:41
The label anchors, styled and carrying the graphic's extent — or undefined for a graphic that keeps every glyph on the graphic feature, which is 104 of the 291. Adding a label feature for one of those draws its designation a second time.