Skip to main content

Crate cjseq

Crate cjseq 

Source
Expand description

cjseq2 is a typed fork of cjseq, for reading, writing, and converting between CityJSON and CityJSONSeq.

The library crate is still named cjseq (see Cargo.toml’s [lib] section), so existing code that does use cjseq::CityJSON keeps working unchanged. The package itself is published as cjseq2 pending an eventual merge upstream.

Internally the crate is organised into one module per concern:

  • geometry — Geometry, GeometryType, GeometryTemplates
  • semantics — Semantics, SemanticsSurface, SemanticsValues
  • appearance — Appearance, MaterialReference, MaterialValues, TextureReference, TextureValues
  • city_object — CityObject
  • metadata — Metadata, PointOfContact, Address, ReferenceSystem, Transform, GeographicalExtent
  • error — CjseqError, Result
  • cityjson — CityJSON, CityJSONFeature, SortingStrategy, and the sequencing/collect/filter logic

Every type is re-exported at the crate root, so the module boundaries above are an internal organisational detail, not part of the public import paths. The one exception is the Result<T> alias, which stays at error::Result so that a glob use cjseq::* cannot shadow std::result::Result.

Re-exports§

pub use error::CjseqError;

Modules§

error

Structs§

Address
The address member of a PointOfContact (§ 5.3 pointOfContact).
Appearance
The document-level appearance library.
CityJSON
CityJSONFeature
CityObject
GeometryCommon
The members every geometry may carry that are neither its type, its lod, nor its boundaries. The appearance values are depth-typed, keyed by theme.
GeometryTemplates
MaterialObject
One entry of the document-level appearance.materials palette, referred to by index from a MaterialReference.
MaterialReference
One theme’s material assignment for a geometry: either a value colouring the whole object, or a depth-typed values array with one index per surface.
Metadata
The metadata member of a crate::CityJSON object (§ 5 Metadata).
PointOfContact
The pointOfContact member of Metadata (§ 5.3).
ReferenceSystem
A reference system following the OGC Name Type Specification.
Semantics
The semantics member of a geometry.
SemanticsSurface
One semantic surface: its type, its place in the parent/children hierarchy, and any further attributes the file chooses to carry.
TextureObject
One entry of the document-level appearance.textures palette, referred to by the first entry of each ring in a TextureValues.
TextureReference
One theme’s texture assignment for a geometry.
Transform

Enums§

BorderColor
A texture’s borderColor, whose schema is the one place a CityJSON colour is not fixed at three numbers:
CityJSONFeatureType
The type member of a CityJSONFeature object. The spec fixes its value to the single string "CityJSONFeature" (§ 7.2 Text sequences and streaming with CityJSONFeature); as with CityJSONType, there is no Extension variant.
CityJSONType
The type member of a CityJSON object. The spec fixes its value to the single string "CityJSON" (§ 1 CityJSON Object); unlike City Object and semantic-surface types, CityJSON does not define an Extension document type, so there is no Extension variant here – a document declaring any other type value fails to deserialize.
CityObjectType
The type member of a City Object (§ 2 The different City Objects).
Geometry
A CityJSON geometry object.
GeometryType
The tag of a Geometry, for callers that need the kind without matching on the whole enum.
KnownCityObjectType
The known 1st- and 2nd-level City Object types (§ 2 The different City Objects). Every variant is a unit variant and every identifier is already spelled exactly as the spec requires (eg TINRelief, WaterBody, CityFurniture), so serde’s default (non-untagged) derive collapses each one to its bare name string with no #[serde(rename)] needed.
KnownSemanticSurfaceType
The known surface types the spec assigns to Building-, WaterBody-, and Transportation-family City Objects (§ 3.3 Semantics of geometric primitives). Every variant is a unit variant already spelled exactly as the spec requires, so serde’s default (non-untagged) derive collapses each one to its bare name string with no #[serde(rename)] needed.
MaterialValues
The values array of a MaterialReference: one index into the document’s materials palette per surface, so it is nested exactly two levels less deeply than that geometry’s boundaries (CityJSON 2.0, section 6.1).
SemanticSurfaceType
The type member of a Semantic Object (§ 3.3 Semantics of geometric primitives).
SemanticsValues
The values array of a Semantics object: one index into surfaces per surface of the geometry, so it is nested exactly one level less deeply than that geometry’s boundaries.
SortingStrategy
TextureFormat
A texture image’s file format: "type": {"enum": ["PNG", "JPG"]}.
TextureType
What a texture depicts: "textureType": {"enum": ["unknown", "specific", "typical"]}. Lower case, and a closed set.
TextureValues
The values array of a TextureReference: nested exactly as deeply as the geometry’s boundaries (CityJSON 2.0, section 6.2), with each ring becoming [texture_index, uv_index, ...] — one more entry than the ring has vertices. An untextured ring is [null].
WrapMode
How a texture repeats outside [0, 1]: "wrapMode": {"enum": ["none", "wrap", "mirror", "clamp", "border"]}.

Functions§

cjseq_to_cj
Collects a base CityJSON metadata and a vector of CityJSONFeatures into a complete CityJSON object

Type Aliases§

Color
A material or border colour: three numbers, per appearance.schema.json’s "minItems": 3, "maxItems": 3 on diffuseColor, emissiveColor and specularColor.
GeographicalExtent
MaterialShell
One shell’s worth of material indices, one per surface. None — a whole shell with no material — is null in JSON, which geomprimitives.schema.json permits at every level of material.values ("type": ["array", "null"]).
MaterialSolid
One solid’s worth of material indices, one per surface, per shell.
Ring
A closed sequence of vertex indices bounding a face.
SemanticsShell
One shell’s worth of semantic-surface indices, one per surface. None — a whole shell with no semantics — is null in JSON, which geomprimitives.schema.json permits at every level of semantics.values ("type": ["array", "null"]), exactly as it does for material.values.
SemanticsSolid
One solid’s worth of semantic-surface indices, per surface, per shell.
Shell
A closed collection of surfaces bounding a volume.
Surface
A face: the exterior ring first, then any interior rings.
TexturedRing
One ring’s texture entry: the texture index first, then one UV-vertex index per vertex of the ring — so one entry more than the ring has vertices. [null] means the ring is not textured.
TexturedShell
One volume’s bounding faces, mirroring crate::Shell.
TexturedSurface
One face’s rings, exterior first, mirroring crate::Surface.