public CoordinateMapper(Map map)
{
if (map == null)
throw new Exception(MiscText.GpxMustBeOcadMap);
using (map.Read()) {
mapScale = map.MapScale;
realWorldCoords = map.RealWorldCoords;
if (!realWorldCoords.RealWorldOn && realWorldCoords.RealWorldAngle == 0 && realWorldCoords.RealWorldOffsetX == 0 && realWorldCoords.RealWorldOffsetY == 0) {
hasRealWorldCoords = false;
mapProjectionType = MapProjectionType.None;
}
else {
hasRealWorldCoords = true;
mapProjectionType = realWorldCoords.ProjectionType;
if (mapProjectionType == MapProjectionType.Known) {
SetupProjection(realWorldCoords.Proj4String);
}
}
}
}