-
Notifications
You must be signed in to change notification settings - Fork 5
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
Simple geometry data structures on geobase #133
Labels
Comments
navispatial
added
enhancement
New feature or request
🌐 geobase
Related to the code package "geobase"
labels
Jul 6, 2022
navispatial
added a commit
that referenced
this issue
Aug 4, 2022
First implementation in [c512dff]. For example /// A point geometry with a position.
class Point extends Geometry {
final PositionCoords _position;
/// A point geometry with [position].
const Point(PositionCoords position) : _position = position;
/// A point geometry from a [position].
///
/// Use an optional [type] to explicitely specify the type of coordinates. If
/// not provided and an iterable has 3 items, then xyz coordinates are
/// assumed.
///
/// Supported coordinate value combinations for `Iterable<double>` are:
/// (x, y), (x, y, z), (x, y, m) and (x, y, z, m).
///
/// An example to build a point geometry with 2D coordinates:
/// ```dart
/// // using a coordinate value list (x, y)
/// Point.build([10, 20]);
/// ```
///
/// An example to build a point geometry with 3D coordinates:
/// ```dart
/// // using a coordinate value list (x, y, z)
/// Point.build([10, 20, 30]);
/// ```
///
/// An example to build a point geometry with 2D coordinates with measurement:
/// ```dart
/// // using a coordinate value list (x, y, m), need to specify type
/// Point.build([10, 20, 40], type: Coords.xym);
/// ```
///
/// An example to build a point geometry with 3D coordinates with measurement:
/// ```dart
/// // using a coordinate value list (x, y, z, m)
/// Point.build([10, 20, 30, 40]);
/// ```
factory Point.build(
Iterable<double> position, {
Coords? type,
}) {
if (position is PositionCoords) {
return Point(position);
} else {
return Point(
PositionCoords.view(
position is List<double>
? position
: position.toList(growable: false),
type: type ?? Coords.fromDimension(position.length),
),
);
}
}
@override
Geom get type => Geom.point;
/// The position in this point geometry.
PositionCoords get position => _position;
} |
This was referenced Aug 4, 2022
navispatial
added a commit
that referenced
this issue
Aug 6, 2022
Implemented in geobase 0.3.0-dev.2. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
geocore package has geometry classes (Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPoint, GeometryCollection). However internal data structures for these might be quite deep. When building these data structures when decoding data read from file formats, lot of object instantiation is needed.
geobase has
Position
(sub classesProjected
andGeographic
) andBox
(sub classesProjBox
andGeoBox
). However not yet classes for other simple geometry data structures.Simple geometries can be written to a data format encoder or built from a data format decoder using content interfaces, for example a line string
Actual line string data is deliver on
Iterable<Object> coordinates
that could be an iterable ofPosition
objects orIterable<num>
objects (containing x, y and optionally z and m coordinate values).The idea would be to implement a data structure class for line strings that takes and saves directly this data without object conversions and instantiations.
Other simple geometry classes in the same way.
The text was updated successfully, but these errors were encountered: