Repository navigation
Story: Edit line strings and circular strings in place #41
Description
Edit line strings and circular strings in place
As a developer using spatial-types,
I want to edit line-string points and circular-string arcs,
so that linear and circular paths can be built and revised incrementally.
Context
Parent Epic: #38.
This covers LineString and CircularString in every currently supported layout. Circular-string arc helpers complement general point editing rather than enforcing geometric validity.
Depends on #39 for shared public contracts and explicit immutable naming, and on #40 for mutable point components.
Acceptance Criteria
-
Mutable LineString and CircularString support adding, inserting, removing and replacing ordered points and replacing their complete coordinate content.
-
Accessors preserve point order and supplied ordinates, including null values.
-
setOrigin(point) adds the first point when the circular string is empty; otherwise it replaces only the first point.
-
appendArc(passingPoint, destinationPoint) appends the two supplied points when an origin followed by zero or more complete pairs already exists. With no origin or an incomplete pair, it fails without mutation.
-
replaceArc(index, passingPoint, destinationPoint) preserves the origin at point 2 * index and replaces points 2 * index + 1 and 2 * index + 2. Replacing the destination also changes the following arc's origin, because that endpoint is shared.
-
Point and arc indices start at zero. Insertion at the point count appends; indexed access, replacement and removal require an existing element. Invalid addressing fails without mutation.
-
replaceArc requires all three positions of the addressed arc to exist. General point editing remains available for incomplete sequences; arc helpers do not validate the geometry of the supplied points.
-
Editing does not automatically close a path, repair arcs or enforce minimum counts, continuity or geometric coordinate completeness.
-
The SRID, spatial-reference and spatial-mode setters each accept a second boolean propagation parameter, defaulting to true. When true, they update the line and every contained point; when false, only the line is updated. Ordinates remain unchanged.
-
All successful mutation methods return the receiver with return type static, allowing chained operations.
-
Supplied point objects are retained by reference without cloning on construction, insertion or replacement; getters expose those same instances. Editing a shared mutable point is observable in every line holding it, including propagated context changes.
-
Failed editing operations leave the line and its referenced points unchanged.
-
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-localpasses. -
composer qualitypasses. - Tests cover chained mutation and return identity, zero-based indexing, indexed failures, reference identity on input/output, shared points, both propagation settings for all three context setters, shared arc endpoints, empty/incomplete sequences and null ordinates; public examples explain arc indexing.
- Story-specific public API documentation is updated.
Activity