Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add reset_limits kwarg, disambiguate some function calls #294

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
15 changes: 12 additions & 3 deletions src/geoaxis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions src/projection.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Loading