Skip to content

Bug ​​in default values ? #228

Description

@PABLOCORRO

The default values ​​of some variables in LegacyMapImageRenderer.cs have not been considered in the code, this causes overflow errors:

image

For example, the following code in the ONPAINT event (MapBox.cs), produces constant run-time errors because it receives _image as new Bitmap(1, 1):
image

This can be demonstrated by adding the following (in Bold) to the code above:
{
var image = _miRenderer.ImageValue;
if (image != null && image.PixelFormat != PixelFormat.Undefined)
{
if (image.Width > 1 && image.Height > 1) {
var imageEnvelope = _miRenderer.ImageEnvelope ?? new Envelope();
if (_map.Envelope.Equals(imageEnvelope))
pe.Graphics.DrawImageUnscaled(image, 0, 0);
else {
var ul = _map.WorldToImage(imageEnvelope.TopLeft());
var lr = map.WorldToImage(imageEnvelope.BottomRight());
pe.Graphics.DrawImage(image, RectangleF.FromLTRB(ul.X, ul.Y, lr.X, lr.Y));
}
}
else
{
Debug.WriteLine("bug");
}

}

I hope it will be useful to you, thank you!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions