Repository navigation
Epic: Support mutable and immutable spatial objects #38
Description
Epic: Support mutable and immutable spatial objects
Context
spatial-types currently exposes immutable spatial objects. Some consumers need to edit coordinates and aggregate membership progressively while retaining object identity.
The completed #36 provides partially null point ordinates. This Epic preserves that representation freedom in both object variants.
Objective
Allow consumers to choose a mutable or immutable representation for every currently supported spatial type and coordinate dimension, with explicit contracts for coordinates, family, spatial reference and aggregate components.
Scope
- First rename existing concrete spatial classes with the Immutable suffix and make them final, preserving immutable behavior and their dimension/family namespaces. Remove former names without aliases or deprecation; the library has never been in production.
- Introduce mutable classes without a suffix directly under their dimension namespace, alongside Geometry and Geography.
- Share read-only interfaces and suitable abstract bases without mutable classes extending concrete immutable classes. Separate ImmutableInterface copy contracts from MutableInterface mutation contracts.
- Support in-place editing of available ordinates, declared family, declared spatial reference and aggregate membership. The final mutable-constructor parameter is SpatialModelEnum, defaulting to SpatialModelEnum::GEOMETRY.
- Provide type-specific editing operations, including circular-string origin, arc append and arc replacement.
- Reserve with… methods exclusively for immutable variants and set…/add…/remove… methods for mutable variants. Immutable aggregates reject mutable spatial components without implicit conversion.
- Adapt factories and document ownership, propagation and consumer-facing contracts.
Each instance retains its spatial type and coordinate dimension, with no dimension setter. MutableSpatialInterface exposes setters for declared SRID/reference and spatial mode (Geometry/Geography). Family and declared-reference changes never recalculate coordinates. Dimension conversion and coordinate transformation belong to spatial-transformer.
Geometric validity remains an explicit spatial-validator concern. Incomplete coordinates, including Point(0, null), remain representable. No mutation or copy path may reintroduce geometric validation.
Stories
- Story: Preserve immutable types under explicit names and shared contracts #39 Preserve immutable types under explicit names and shared contracts
- Story: Edit point coordinates and declared spatial context in place #40 Edit point coordinates and declared spatial context in place
- Story: Edit line strings and circular strings in place #41 Edit line strings and circular strings in place
- Story: Edit compound curves in place #42 Edit compound curves in place
- Story: Edit polygons and triangles in place #43 Edit polygons and triangles in place
- Story: Edit polyhedral surfaces in place #44 Edit polyhedral surfaces in place
- Story: Edit multi-objects and spatial collections in place #45 Edit multi-objects and spatial collections in place
- Story: Create spatial types through public factories with a shared mutability mode #46 Create both spatial representations through factories and document their use
This list may evolve during refinement.
Completion Criteria
- All Stories required to achieve the objective are complete.
- Both representations are available for the supported types and dimensions within the defined scope.
- No unresolved work required by the scope remains.
Activity
spatial-types1.0.0 #27spatial-types1.0.0 #26