Skip to content

Story: Edit polygons and triangles in place #43

Closed

Description

@Alexandre-T

Edit polygons and triangles in place

As a developer using spatial-types,
I want to modify polygon rings and their points,
so that surface boundaries can be assembled and revised incrementally.

Context

Parent Epic: #38.

Polygon and Triangle remain distinct fixed spatial types. Their mutable APIs preserve representable data without enforcing geometric validity.

Depends on #39 for shared public contracts and explicit immutable naming, and on #41 for mutable line-string rings (which depends on #40).

Acceptance Criteria

  • Mutable Polygon and Triangle are available in every currently supported layout with Geometry as the default constructor family.
  • Consumers can add, insert, remove and replace rings, replace points within rings and replace all coordinate content.
  • Supplied ring order and ordinates, including null values, are preserved.
  • Editing does not automatically close rings or enforce triangle point counts, ring orientation, simplicity or other geometric validity rules.
  • Supplied spatial components must be mutable: polygon/triangle rings and their points. Immutable spatial components are rejected without implicit conversion. Coordinate-array input creates mutable descendants.
  • Construction, insertion and replacement retain supplied component instances by reference without cloning; getters expose the same instances. Mutating a shared component is observable in every aggregate referencing it.
  • Declared-SRID, spatial-reference and spatial-mode setters each accept a second boolean propagation parameter defaulting to true. With true, the change applies recursively to the receiver and all descendants; with false, only the receiver changes. No ordinates are recalculated.
  • Every successful mutation returns the receiver with return type static for chaining.
  • Indices start at zero at each nesting level. Insertion at the addressed sequence's count appends; access, replacement and removal require existing elements. Point addressing uses ring then point for polygons/triangles, and patch then ring then point for polyhedral surfaces.
  • Failed addressing or technical input validation leaves the receiver and all referenced descendants unchanged.
  • Family and declared-reference changes do not recalculate coordinates; instance type and dimension remain fixed.
  • Invalid addressing or technical input failures do not partially modify the receiver.
  • Mutable Polygon and Triangle expose no with… methods; immutable counterparts retain copy-producing with… methods and reject mutable components.
  • Mutable types implement the applicable MutableInterface and MutableSpatialInterface contracts, expose no with… methods and have no dimension setter.
  • 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 open and incomplete rings, non-geometrically-valid triangles, null ordinates, indexed failures and component isolation.
  • Tests verify reference identity, immutable-component rejection, chained return identity, propagation enabled/disabled for each context setter, and failure atomicity across nested components.
  • 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