Skip to content

Epic: Support mutable and immutable spatial objects #38

Closed
9 of 9 issues completed
Closed

Description

@Alexandre-T

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

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    impact:apiAffects the public APIimpact:architectureRequires or affects an architecture decisionimpact:breakingIntroduces a backward-incompatible change

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions