Skip to content

Conversation

@mhaulo
Copy link

@mhaulo mhaulo commented Sep 28, 2019

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant