Skip to content

Div icon #250

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

Merged
merged 3 commits into from
Dec 1, 2015
Merged

Div icon #250

merged 3 commits into from
Dec 1, 2015

Conversation

ocefpaf
Copy link
Member

@ocefpaf ocefpaf commented Nov 15, 2015

@BibMartin this is my first attempt to dive in the new code. So I have a few questions:

  • The original DivIcon class was inheriting from MacroElement. I changed it to Icon, although I don't think it matters in this case.
  • You carefully tried to preserve the method div_markers, but I am starting to think that should go away. It is not really what the original leaflet divIcon is all about.
  • If we agree that div_markers should ho we can safely remove the static_div_icon.js and the tests for that method.
  • I believe there more <templates>.js that we can remove.

Note that in this PR I already removed the template. To see the failure keeping that go to:

https://travis-ci.org/ocefpaf/folium/jobs/91228684

🇫🇷 I am praying for the victims of this horrible attack. I Hope everybody close to you are alright. 🇫🇷

@ocefpaf
Copy link
Member Author

ocefpaf commented Nov 15, 2015

This PR is the first one of a long term plan to get us closer to matplotlib via mplexporter and mplleaflet.

See: http://nbviewer.ipython.org/gist/ocefpaf/ab173ae7a7ee40430cdf

@BibMartin
Copy link
Contributor

🇫🇷 I am praying for the victims of this horrible attack. I Hope everybody close to you are alright. 🇫🇷

Thank you for your prayers ; everyone I know is fine, but I have a deep thought for past and future victims.

@BibMartin
Copy link
Contributor

This PR is the first one of a long term plan to get us closer to matplotlib via mplexporter and mplleaflet.

That's good idea ; I guess we can end-up with a MatplotlibFigure object that does mplleaflet's job.
I wonder whether we shall do this in calling mplleaflet, or get inspiration from it and do it in folium's style.

@themiurgo
Copy link
Contributor

Great PR @ocefpaf . I love the notebook with arrow DivIcons, you just gave me a great idea to visualise GPS trajectories. 👍

@BibMartin There's nothing else to add to what has been already said in these days. Let's all hope in a better future. 🇫🇷

@ocefpaf
Copy link
Member Author

ocefpaf commented Nov 16, 2015

you just gave me a great idea to visualise GPS trajectories.

Glad that was helpful! My real intent is to show ocean currents though 😉 (Soon in a notebook example.)

@ocefpaf
Copy link
Member Author

ocefpaf commented Nov 16, 2015

That's good idea ; I guess we can end-up with a MatplotlibFigure object that does mplleaflet's job.
I wonder whether we shall do this in calling mplleaflet, or get inspiration from it and do it in folium's style.

I like the idea of a MatplotlibFigure. I think that the best course of action is to factor out the fig2json.
The fig2json is pretty simple and the only dependency is mplexporter and of course matplolitb.

PS: I removed the div_markers method and tests. I added some tests for the new DivIcon.
Looking at this again I really don't think we should inherent from icon. Most of we inherent is not applicable to the DivIcon (rotation, color, etc). What do you think? Should I just inherit from MacroElement?

@ocefpaf ocefpaf added the enhancement Feature request or idea about how to make folium better label Nov 27, 2015
@ocefpaf ocefpaf added this to the v0.2.0 milestone Nov 27, 2015
@ocefpaf ocefpaf force-pushed the divIcon branch 2 times, most recently from 35fd682 to 6037324 Compare November 27, 2015 11:02
@ocefpaf
Copy link
Member Author

ocefpaf commented Nov 27, 2015

  • The original DivIcon class was inheriting from MacroElement. I changed it to Icon, although I don't think it matters in this case.

@BibMartin I changed it back to MacroElement because, even though divIcon is an Icon, it does not make sense to expose the Icon methods here.

Let me know how bad this is and if we can salvage some ideas for a better PR 😬

});
{{this._parent.get_name()}}.setIcon({{this.get_name()}});
{% endmacro %}
""")
""") # noqa

Copy link
Contributor

Choose a reason for hiding this comment

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

What does # noqa mean ?

Copy link
Member Author

Choose a reason for hiding this comment

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

No questions asked. It serves to tell humans and automatic tools to not mess with that line.

@BibMartin
Copy link
Contributor

@ocefpaf
It looks fine to me. I just don't understand why you've dropped out the class structure in test_features.py and unstacked everything in different functions. But I guess this is not the active part of the PR.

Let me know how bad this is and if we can salvage some ideas for a better PR 😬

It's good to me. Just maybe I should write proper code so that you don't need to pep8 and docstring it.

@ocefpaf
Copy link
Member Author

ocefpaf commented Nov 27, 2015

I just don't understand why you've dropped out the class structure in test_features.py and unstacked everything in different functions.

Something about pytest was not working properly. I can't remember what. However, I believe that pytest is designed to work better that way.

I will wait for #261 and #262. (Then I will go back to this one, rebase, polish, and ping you again 😄)

@ocefpaf
Copy link
Member Author

ocefpaf commented Nov 30, 2015

Rebased and good for another round if review.

BibMartin added a commit that referenced this pull request Dec 1, 2015
@BibMartin BibMartin merged commit 97d36c7 into python-visualization:master Dec 1, 2015
@BibMartin
Copy link
Contributor

Merged : thanks @ocefpaf

@ocefpaf ocefpaf deleted the divIcon branch December 1, 2015 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Feature request or idea about how to make folium better
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants