Skip to content

Story: Edit point coordinates and declared spatial context in place #40

Closed

Description

@Alexandre-T

Edit point coordinates and declared spatial context in place

As a developer using spatial-types,
I want to modify point ordinates, family and declared reference on the same instance,
so that incremental edits do not require replacing the point after every change.

Context

Parent Epic: #38.

Build on the shared contracts and the completed #36; geometric validity is not a construction or mutation requirement.

Depends on #39 for shared public contracts and explicit immutable naming.

Acceptance Criteria

  • Mutable Point is available for XY, XYZ, XYM and XYZM under the corresponding dimension namespace.

  • The final constructor parameter selects SpatialModelEnum and defaults to SpatialModelEnum::GEOMETRY.

  • setX(), setY(), setZ() and setM() are exposed through MutablePointInterface. For an axis present in the declared layout, the setter updates that ordinate on the same instance.

  • Calling setZ() or setM() for an axis absent from the declared layout throws LongitudeOne\SpatialTypes\Exception\BadMethodCallException, including when the argument is null; the point remains unchanged.

  • Every successful setter returns the same instance with return type static, allowing chained ordinate and declared-context updates.

  • Coordinate setters accept the same input types and parsing behavior as the corresponding constructor ordinate: numbers and null, and strings wherever that constructor accepts them. X/Y string input uses the existing geo-parser path; do not broaden Z/M input beyond the corresponding constructor contract.

  • Rejected technical or parsing input leaves the receiver unchanged.

  • Each supported ordinate can independently be null, including X = 0 and Y = null, and getters preserve the exact supplied values.

  • Changing family or declared SRID/spatial reference preserves all ordinates.

  • Spatial type and coordinate dimension remain fixed; an unavailable axis cannot be introduced by a setter.

  • EMPTY and partially supplied states retain the distinctions established by Story: Allow partially null point ordinates #36.

  • Mutable Point implements MutablePointInterface and MutableSpatialInterface through the approved interface hierarchy and exposes no with… methods.

  • No dimension setter is exposed; null values never remove axes from the declared layout.

  • Mutable spatial classes reside directly in their dimension namespace, alongside Geometry and Geography; spatial mode is instance state, not fixed by a family namespace.

  • Declared-SRID/reference and spatial-mode setters update the same instance without recalculating coordinates; the final constructor family parameter defaults to SpatialModelEnum::GEOMETRY.

Constraints

  • Apply Story: Preserve immutable types under explicit names and shared contracts #39: concrete immutable classes are final, immutable aggregates reject mutable components without conversion, common interfaces are read-only, and with… methods belong exclusively to immutable variants. Do not add deprecated aliases for renamed classes.
  • Coordinate layout and spatial type remain fixed. Geometric validity is delegated to explicit spatial-validator use; do not introduce automatic validation, repair, reprojection or dimension conversion. Changes to declared family or reference preserve coordinates. Preserve the representable states established by Story: Allow partially null point ordinates #36.
  • Follow the naming and namespace layout defined by Epic: Support mutable and immutable spatial objects #38. Preserve the distinction between technical representation and normative geometric validity under ISO/IEC 13249-3 and applicable OGC specifications.

Definition of Done

The project's common Definition of Done applies.

  • composer test-local passes.
  • composer quality passes.
  • Tests cover all coordinate layouts, both families, null transitions, setter return identity and chaining, constructor-equivalent input/parsing, rejected input without mutation, unavailable-axis exceptions (including null), and reference-only changes.
  • Story-specific public API documentation is updated.

Metadata

Metadata

Assignees

No one assigned

    Labels

    impact:apiAffects the public API

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions