Skip to content

Commit

Permalink
add reset_limits kwarg, disambiguate some function calls (#294)
Browse files Browse the repository at this point in the history
* add a reset_limits kwarg to GeoAxis, to control insertion behaviour

* minor fixes for crs

* Bump patch version
  • Loading branch information
asinghvi17 authored Nov 27, 2024
1 parent eeacf36 commit 4307d29
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
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)

2 comments on commit 4307d29

@asinghvi17
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/120294

Tip: Release Notes

Did you know you can add release notes too? Just add markdown formatted text underneath the comment after the text
"Release notes:" and it will be added to the registry PR, and if TagBot is installed it will also be added to the
release that TagBot creates. i.e.

@JuliaRegistrator register

Release notes:

## Breaking changes

- blah

To add them here just re-invoke and the PR will be updated.

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.7.9 -m "<description of version>" 4307d29036d770d34c4a69bb52b7851e77a92677
git push origin v0.7.9

Please sign in to comment.