OpenStreetMap logo OpenStreetMap

It has been almost one week since coding officially started with Google Summer of Code. As mentioned in my previous post, I have been selected to work as a Student Developer for OpenStreetMap through Google Summer of Code.

I have been working on my project and the experience so far has been great. In this post, I’ll be explaining what I’ve done and you can find the code in the development branch of this repo.

The Action Class

First, I had to create an Action class. The methods of this class will be called when an action occurs. For my plugin, I wanted the user to be able to select an area in the MapView and this area had to be processed. For this functionality, I had to extend the MapMode class (Makes the Action a MapMode and implement the SelectionEnded Interface (this provides the area selection functionality) and override the necessary functions.

Once this was done, I had to add the action class to the MapMode menus in JOSM. I did this by overriding the mapFrameInitialized method of the Plugin class.

Utilities

Next, I created classes that can provide utilities for the working of the plugin. The following classes were created: * DataUtils * NetworkUtils * MapUtils These classes provide functions that can prepare data to send to the server, communicate with the server, add points from the DataSet on the MapView.

Tests

Once all this was done, I started writing unit tests to make sure that the classes are doing what I expect them to do. For this, I used Junit and JOSM’s test utilities. For some tests that involved the methods that communicate with the server, I created a new endpoint in the server for the tests to communicate with. Right now, all the tests are passing.

What I’ve learned

Students rarely get a chance to build applications using just docs of dependencies. This project was my first time building something using docs alone and it is taught to be how to use docs efficiently and how to write good documentation. The main aim of writing this article was to show my progress and also help someone who might have an idea for a new plugin for JOSM get started. I think I’ve done that in this article.

Up Next

Now that the JOSM end of the plugin is almost done, I’m going to start working on the server side starting with data collection. I will describe how I collect data on next week’s post.

Location: Ward 149, Zone 11 Valasaravakkam, Ambattur, Thiruvallur, Tamil Nadu, 600087, India
Email icon Bluesky Icon Facebook Icon LinkedIn Icon Mastodon Icon Telegram Icon X Icon

Discussion

Log in to leave a comment