Editing Mode for Polygons – GSoC Project Progress

Hello everyone!

There are a couple of weeks from the last time I’ve talked about my progress with my Google Summer of Code project. Thus, the plugin I’m working on has undergone major changes, but most of them are code-related and were intended to increase the internal quality, which will hopefully lead to an increase in the productivity on the plugin. I’ll present these changes briefly, but I won’t insist too much on them since I don’t want this post to become too technical (at least not for now). Also, I’ve added two important new features to the plugin which make it much more interactive. I’ll talk about them more into detail in the next paragraphs.

But first I find important to remind you (and possibly make aware the people who did not read my previous posts) about the intent of my project – what is all about and who can use it. The application to which I contribute is Marble, a virtual globe and a world atlas, which hides under this short introduction many useful and even fun features as well as a dedicated team which works on it. What I’m specifically working on is a plugin, named Annotate Plugin, which allows people to add placemarks and ground overlays onto the map, as well as draw polygons on the Earth’s surface (or even Pluto’s if you have a map for it 🙂 ). Why would you need this? Well, maybe you lead a presentation about human migration and you know that visual effects have a great impact on participants, so you decide to mark particular regions from which many people migrate to other countries. You can even use different colors to give people an insight into their number. Or maybe you are a student and since you love technology, you can make the assessment at that boring subject a little bit more interesting for both you and your teacher.

Hoping that what I’m spending my time on this summer is a little bit clearer, I will proceed with presenting my progress during the last weeks. As I mentioned in the beginning of this post, a great percentage of my work involved re-writing from scratch an important part of the plugin because of its bad design which caused its extending to become very time-consuming. The idea for the code refactoring was that the whole Editing Mode should be organized on states. That is, Add Polygon, Add Polygon Hole, Add Placemark, etc are all independent states which means they could not exist at the same time (or if they could, they should not, since it would cause redundancy). This idea, alongside other improvements, took me almost one week and a half to implement, but now it is fully functional and the code looks much better.

Excepting the code refactoring, I also added two new features which make the editing of a polygon much more interactive and let the users draw any shape. The first one I implemented is Merging Nodes. The flow is as it follows: enter the Merging Nodes state and then start clicking the nodes you want to merge, in pairs of two. Be aware that it is not possible to merge two nodes from two different polygons, or two nodes from two different inner boundaries of the same polygon, or a node from a polygon’s outer boundary with a node from one of its inner boundaries.


The second feature I implemented is Adding Nodes, which introduces something totally new to the Editing Mode: the possibility of adding new nodes to an already drawn polygon. The flow here is: enter the Adding Nodes state and then you will see when hovering the middle of each polygon’s line that a virtual node will appear and will disappear when moving the cursor from above it. To make it become a real node simply click it and immediately after that you will be adjusting the new node. After clicking it one more time, it will stick to that position and the process can be repeated.


Since both features are hard to be illustrated in screenshots, I made a screencast which shows it best. You can find it here (it looks much better in full screen mode).

Ok, so this is it. I hope you enjoyed it and made you curious enough to give it a try :).

Later Edit: The patch including these two features has not been merged to master yet (I only submitted a review request this morning) so if you are eager to test it already, you can find the patch here.

See you,
Călin Cruceru

2 thoughts on “Editing Mode for Polygons – GSoC Project Progress

  1. richard says:

    Nice screencast! – but a little to fast.
    We see those menus and features for the first time, so it’s ok to rest a moment on the menus, so we can actually read them. 🙂

    Speaking as a user, I think showing the “states” to the user is to technical. From what I get in the screencast, this is like, what you have in every presentation software (e.g. Impress, Calligra Stage, etc.) when you add a rectangle or whatever. It is quite clear to every user that you can only add a polygon OR a node … at a time. So the checkboxes in the menu are superfluously and also confusing.

    Furthermore I think you should make these (Add Polygon Hole, Merge Nodes, Add Node) available in the context menu, since going to the menubar can become quite tedious after a while.

    But nice progress and I really like the easy drawing of polygons!

    • Hi richard! Thank you for your feedback. You’re being useful through it as usually :).

      Regarding the speed of the screencast – I’m sorry about that, it was the first recording I did and then the program which I used didn’t work anymore (there were broken pixels everywhere) and I was a little bit in a hurry and I really wanted to publish the post.

      I like that you are paying attention to details – so yes, I am planning to implement a more user friendly interface, so you won’t need to click every time on that View menu. My mentors and me decided that it is better to first add functionality and then work on the user interface.

      Also, yes, you are right, that menu will be made exclusive, but I had some problems with it and I decided to do this in the next patch.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s