Vector Viewer
<!-- GENERATED by build/scripts/gen-viewer-pages.py from viewers/poka-vector-viewer/plugin.json, viewers/poka-vector-viewer/src/main.rs, core/proto/preview.proto and FILE_FORMATS.csv. Do not edit by hand: change the source, then run the script. -->poka-vector-viewer · version 1.0.0 · poka-vector-viewer.wasm
What it does
From the crate's //! header:
Poka viewer: render a Drawing2DAst (protobuf) on stdin as HTML with
inline SVG on stdout. The host wraps the HTML in an HtmlPreview response.
Pairs with any parser extension that emits Drawing2DAst — currently
poka-gpx (planned pairings: poka-kml, poka-geojson, future SVG passthrough).
Owns the SVG chrome (dark backdrop, padding, fit-to-view, footer meta) so
map-shaped extensions stop re-implementing it per format.
Not the same role as the host's Three.js CAD viewer — that one handles
DwgDrawing with layers / ACI / 3D camera. This viewer is the cheap
flat-geometry path. See arch.md § "Module Composition" and the
Drawing2DAst block in preview.proto.
Limits
| Memory cap | 32 MB |
| Time cap | 5000 ms |
A module that exceeds either is killed and reported.
What it takes
Stdin is one of these messages, exactly the bytes the parser wrote (core/proto/preview.proto, "Parser → Viewer composition ABI"):
Drawing2DAst
Pure 2D vector geometry: shared by map-shaped formats (gpx, kml, geojson) and any future extension whose primary preview is a flat drawing. Not the same as DwgDrawing — that targets the host's Three.js CAD viewer (layers, ACI palette, 3D Polyline3D, real-unit pan/zoom). Drawing2DAst targets poka-vector-viewer, which renders inline SVG. Pick Drawing2DAst when the drawing is flat geometry; pick DwgDrawing when the drawing is CAD entities that benefit from the CAD viewer chrome. Viewer: poka-vector-viewer.
| Field | Type | Comment |
|---|---|---|
filename |
string |
Name of the previewed file |
file_size |
uint64 |
Size of the previewed file, in bytes |
source_format |
string |
Free-form header line, e.g. "GPX · 1 track · 247 points" |
entities |
repeated Vector2DEntity |
The drawing primitives |
min_x |
double |
Optional precomputed axis-aligned bounds. If all four are zero, the viewer recomputes from entities. Same coordinate space as the entity coordinates (lon/lat for GPS, drawing units for CAD); the viewer fits to view. |
min_y |
double |
Bounds: see min_x |
max_x |
double |
Bounds: see min_x |
max_y |
double |
Bounds: see min_x |
y_up |
bool |
True for engineering coords (y grows upward); false for screen/raster (y grows downward, the SVG default). Map data is y-up. |
paint_in_order |
bool |
True when the entities are a picture painted back to front, as in a metafile or a diagram: the viewer then draws them in the order given, on white paper, since the file's own colours were chosen for it. False keeps the layered order (polygons, lines, circles, points, labels) that maps and tracks want. |
units |
optional string |
Physical units the coordinates are in, as a human string, when the source records them (DXF $INSUNITS, a Gerber MO command, an IFC unit assignment). The viewer shows measurements as "drawing units" when this is empty. Additive: parsers that don't set it are unchanged. |
facts |
FileFacts |
Per-format facts for the file-information panel (#182); additive. |
Used by
<!-- USED-BY:BEGIN -->21 format(s) in FILE_FORMATS.csv name this viewer.
| Format | Parser | Extensions |
|---|---|---|
| CGM | poka-cgm |
.cgm |
| DWFX | poka-dwfx |
.dwfx |
| DXB | poka-dxb |
.dxb |
| EMF | poka-emf |
.emf |
| GBR | poka-gerber |
.gbr |
| GCODE | poka-gcode |
.gcode |
| GEOJSON | poka-geojson |
.geojson |
| GPKG | poka-gpkg |
.gpkg |
| GPX | poka-gpx |
.gpx |
| KICAD_PCB | poka-kicad-pcb |
.kicad_pcb |
| KML | poka-kml |
.kml |
| KMZ | poka-kmz |
.kmz |
| LANDXML | poka-landxml |
.landxml |
| LIN | poka-lin |
.lin |
| SHP | poka-shp |
.shp |
| TCX | poka-tcx |
.tcx |
| THMX | poka-thmx |
.thmx |
| VSD | poka-vsd |
.vsd |
| VSDX | poka-vsdx |
.vsdx |
| WMF | poka-wmf |
.wmf |
| WPG | poka-wpg |
.wpg |
This list is read from FILE_FORMATS.csv of a local poka-parsers checkout. It is current only as of the last run of the generator with that checkout.