From 4307d29036d770d34c4a69bb52b7851e77a92677 Mon Sep 17 00:00:00 2001 From: Anshul Singhvi Date: Wed, 27 Nov 2024 15:36:07 -0500 Subject: [PATCH] add reset_limits kwarg, disambiguate some function calls (#294) * add a reset_limits kwarg to GeoAxis, to control insertion behaviour * minor fixes for crs * Bump patch version --- Project.toml | 2 +- src/geoaxis.jl | 15 ++++++++++++--- src/projection.jl | 4 ++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Project.toml b/Project.toml index 0a0d413d..77081df6 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "GeoMakie" uuid = "db073c08-6b98-4ee5-b6a4-5efafb3259c6" authors = ["Makie.jl Contributors"] -version = "0.7.8" +version = "0.7.9" [deps] Colors = "5ae59095-9a9b-59fe-a467-6f913c188581" diff --git a/src/geoaxis.jl b/src/geoaxis.jl index 28692c45..2d0c5036 100644 --- a/src/geoaxis.jl +++ b/src/geoaxis.jl @@ -823,15 +823,24 @@ end # This is where we override the stuff to make it our stuff. function Makie.plot!(axis::GeoAxis, plot::Makie.AbstractPlot) + # deal with setting the transform_func correctly source = pop!(plot.kw, :source, axis.source) transformfunc = lift(create_transform, axis.dest, source) - trans = Transformation(transformfunc; get(plot.kw, :transformation, Attributes())...) + + trans = Makie.Transformation(transformfunc; get(plot.kw, :transformation, Attributes())...) plot.kw[:transformation] = trans + + # remove the reset_limits kwarg if there is one, this determines whether to automatically reset limits + # on plot insertion + reset_limits = to_value(pop!(plot.kw, :reset_limits, true)) + + # actually plot Makie.plot!(axis.scene, plot) + # some area-like plots basically always look better if they cover the whole plot area. # adjust the limit margins in those cases automatically. - Makie.needs_tight_limits(plot) && Makie.tightlimits!(axis) - if Makie.is_open_or_any_parent(axis.scene) + Makie.needs_tight_limits(plot) && reset_limits && Makie.tightlimits!(axis) + if Makie.is_open_or_any_parent(axis.scene) && reset_limits Makie.reset_limits!(axis) end return plot diff --git a/src/projection.jl b/src/projection.jl index f0b43f1d..a1f0c7e6 100644 --- a/src/projection.jl +++ b/src/projection.jl @@ -153,5 +153,5 @@ Return a PROJ-compatible string from a GeoFormatTypes CRS object. """ function gft2str end gft2str(crs::GeoFormatTypes.EPSG{1}) = String("EPSG:$(GeoFormatTypes.val(crs))") -gft2str(crs::GeoFormatTypes.CoordinateReferenceSystemFormat) = string(GeoFormatTypes.val(crs)) -gft2str(crs::GeoFormatTypes.WellKnownText{GeoFormatTypes.CRS}) = string(GeoFormatTypes.val(crs)) +gft2str(crs::GeoFormatTypes.CoordinateReferenceSystemFormat) = Base.convert(String, crs) +gft2str(crs::GeoFormatTypes.WellKnownText{GeoFormatTypes.CRS}) = Base.convert(String, crs)