Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Populating and unpopulating bounds in geometries and feature objects #197

Closed
navispatial opened this issue Aug 27, 2023 · 1 comment
Closed
Labels
enhancement New feature or request 🌐 geobase Related to the code package "geobase" refactoring

Comments

@navispatial
Copy link
Member

Implicit and explicit bounds was implemented in #141.

This issue suggest some changes to the interface defined in Bounded, especially for the bounded method.

The old API has been (since 0.5.x):

  /// Returns a bounded object with a bounding box populated in [bounds] (and
  /// in any subitem bounding boxes too). Other properties are left intact.
  ///
  /// The returned subtype must be the same as the type of this.
  ///
  /// The [recalculate] parameter:
  /// * false: `bounds` for a returned object is calculated if [bounds] is null
  /// * true: `bounds` for a returned object is always recalculated
  ///
  /// When a calculated bounding box equals to the current bounds of this (or
  /// bounds cannot be calculated), it's allowed for implementations to return
  /// `this`.
  ///
  /// The `bounds` in returned bounded object may still be null, if bounds
  /// cannot be calculated (for example in the case of an empty geometry).
  Bounded bounded({bool recalculate = false});

However there are some inconsistencies on implementations.

The new API would be:

  /// Returns a bounded object of the same subtype as this with certain
  /// properties populated.
  ///
  /// If nothing is populated then `this` is returned.
  ///
  /// If [onBounds] is true (as by default):
  /// * The `bounds` in a returned bounded object is ensured to be populated
  ///   (expect when cannot be calculated, for example in the case of an empty
  ///   geometry).
  /// * If [traverse] is true, then also bounding boxes of any child bounded
  ///   objects are populated.
  Bounded populated({
    bool traverse = false,
    bool onBounds = true,
  });

  /// Returns a bounded object of the same subtype as this with certain
  /// properties unpopulated (or cleared).
  ///
  /// If nothing is unpopulated then `this` is returned.
  ///
  /// If [onBounds] is true (as by default):
  /// * The `bounds` in a returned bounded object is ensured to be unpopulated.
  /// * If [traverse] is true, then also bounding boxes of any child bounded
  ///   objects are unpopulated.
  Bounded unpopulated({
    bool traverse = false,
    bool onBounds = true,
  });

The new API shall be released in version 0.6.x. This old API shall be deprecated, to be removed by version 1.0.0.

@navispatial
Copy link
Member Author

Implemented in geobase 0.6.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request 🌐 geobase Related to the code package "geobase" refactoring
Projects
None yet
Development

No branches or pull requests

1 participant