GeoTransform constructor

GeoTransform({
  1. void point(
    1. GeoStream,
    2. num,
    3. num, [
    4. num?,
    ])?,
  2. void sphere(
    1. GeoStream
    )?,
  3. void lineStart(
    1. GeoStream
    )?,
  4. void lineEnd(
    1. GeoStream
    )?,
  5. void polygonStart(
    1. GeoStream
    )?,
  6. void polygonEnd(
    1. GeoStream
    )?,
})

Defines an arbitrary transform using the methods defined on the specified methods object.

Any undefined methods will use pass-through methods that propagate inputs to the output stream. For example, to reflect the y-dimension (see also GeoIdentity.reflectX):

var reflectY = GeoTransform(point: (stream, x, y, [z]) {
  stream.point([x, -y]);
});

Or to define an affine matrix transformation:

matrix(a, b, c, d, tx, ty) => GeoTransform(point: (stream, x, y, [z]) {
      stream.point([a * x + b * y + tx, c * x + d * y + ty]);
    });

Implementation

GeoTransform(
    {void Function(GeoStream, num, num, [num?])? point,
    void Function(GeoStream)? sphere,
    void Function(GeoStream)? lineStart,
    void Function(GeoStream)? lineEnd,
    void Function(GeoStream)? polygonStart,
    void Function(GeoStream)? polygonEnd})
    : _point = point,
      _sphere = sphere,
      _lineStart = lineStart,
      _lineEnd = lineEnd,
      _polygonStart = polygonStart,
      _polygonEnd = polygonEnd;