private bool AddImage(MapImage mapImage) { if (mapImage.ImageBoundary == null) { return(false); } Boundary imageBoundary = mapImage.ImageBoundary; if (canvasBoundary.MinX > imageBoundary.MinX) { canvasBoundary.MinX = imageBoundary.MinX; } if (canvasBoundary.MinY > imageBoundary.MinY) { canvasBoundary.MinY = imageBoundary.MinY; } if (canvasBoundary.MaxX < imageBoundary.MaxX) { canvasBoundary.MaxX = imageBoundary.MaxX; } if (canvasBoundary.MaxY < imageBoundary.MaxY) { canvasBoundary.MaxY = imageBoundary.MaxY; } double viewPixelPerDegreeX = mapImages[0].ViewWidth / (mapImages[0].ImageBoundary.MaxX - mapImages[0].ImageBoundary.MinX); double viewPixelPerDegreeY = mapImages[0].ViewHeight / (mapImages[0].ImageBoundary.MaxY - mapImages[0].ImageBoundary.MinY); mapImage.ViewWidth = (imageBoundary.MaxX - imageBoundary.MinX) * viewPixelPerDegreeX; mapImage.ViewHeight = (imageBoundary.MaxY - imageBoundary.MinY) * viewPixelPerDegreeY; mapImages.Add(mapImage); imageBoundary.CalculateMargin(canvasBoundary, viewPixelPerDegreeX, viewPixelPerDegreeY); //Canvas.SetLeft(border, imageBoundary.Left); //Canvas.SetTop(border, imageBoundary.Top); //Canvas.SetZIndex(border, 0); Console.WriteLine($"mapImage : {mapImage.ImageBoundary.Left}, {mapImage.ImageBoundary.Top}"); FitCanvas(); return(true); }