Open
Conversation
This commit adds no new features, but prepares the codebase for upcoming changes by refactoring and restructuring it. Summary of changes: 1. Methods in Conversion are now class methods Conversion class feels more like a collections of utility methods instead of a logical entity. Therefore having them as class methods fels more appropriate approach. Also, it feels convenient not having to initialize and object (Conversion.new.lng_to_x), but just call methods directly (Conversion.lng.to_x). 2. Separate BoundingBox and Renderer from Map To keep the Map class tidy and preventing it from growing too much while adding new features, I create two new classes and moved some of the functionality from Map to them. BoundingBox is an abstaction for... well.. a bounding box. It represents a rectagular area. So far the only use case has been the map view itself, but in the future, it will have other use cases as well. Renderer takes care of transforming the values represented by Map to an image on the disk.
At the core of this, there is a simple framework for drawing different shapes. The design of it is pretty much the same as in some of the classes in Rails/ActiveStorage. Currently only LineStrings are supported, but adding support for other geometry types is fairly easy. GpxFile is a helper class for the CLI. It reads a gpx file given as an argument, and translates it into GeoJSON format. It's only included in the CLI by default, because when using the Ruby API, it's more likely that the data is already in GeoJSON format. Also the version number is now bumped up to 0.1, because this commit creates new features.
Mostly cosmetic changes, such as removing unnecessary comments and obsolete things from Rakefile and gemspec file. This commit also bring Gemfile.lock and contributor list up to date.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request is a combination of three commits. Two of them are fairly big changes.
The motivation behind these changes was to create features for drawing GeoJSON shapes on top of a base map. This added some complexity, and to keep the codebase tidy, I decided to make some structural changes first. For implementatio details, please see individual commit messages.
In general, this seems to be working quite nicely. But I'd be surprised if I hadn't made any mistakes, so it would be great to have someone else test this thorougly as well.