GeoInfo.fromValues constructor

GeoInfo.fromValues(
  1. int width,
  2. int height,
  3. double xScale,
  4. double yScale,
  5. double xMin,
  6. double yMax,
  7. String? prjWkt,
)

Implementation

GeoInfo.fromValues(int width, int height, double xScale, double yScale,
    double xMin, double yMax, String? prjWkt) {
  _rows = height;
  _cols = width;
  _prjWkt = prjWkt;

  //  |  xScale      0  dx | => m00, m01, m02
  //  |  0      yScale  dy | => m10, m11, m12
  //  |  0           0   1 |
  var m00 = xScale;
  var m01 = 0.0;
  var m02 = xMin;
  var m10 = 0.0;
  var m11 = yScale;
  var m12 = yMax;
  _pixelToWorldTransform =
      AffineTransformation.fromMatrixValues(m00, m01, m02, m10, m11, m12);
  _worldToPixelTransform = _pixelToWorldTransform!.getInverse();

  _xResolution = m00;
  _yResolution = m11.abs();

  var llCoord = _pixelToWorldTransform!
      .transform(Coordinate(0, 0), Coordinate.empty2D());
  var urCoord = _pixelToWorldTransform!.transform(
      Coordinate(_cols!.toDouble(), _rows!.toDouble()), Coordinate.empty2D());

  _worldEnvelope = Envelope.fromCoordinates(llCoord, urCoord);
}