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.

nodes1_v1
nodes2_v1

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.

nodes3_v1
nodes4_v1

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

Advertisements

Randa Meetings 2014 – KDE

Hi everyone.

Did you know that for the 5th year, KDE is planning a Developer Sprint which is going to be held in Randa, Switzerland from the 9th to 15th of August this year?

Let me tell you a few words about it if you don’t know what is all about. These sprints are mostly the only times when KDE developers gather under the same roof to work on specific parts of our beloved open-source organization. These sprints are a great opportunity to plan and design new features as well as to hack on them. If you are interested, you can find more about previous sprints here.

A picture from 2010 Randa Meetings

A picture from 2010 Randa Meetings

But things cannot be as accessible as we might want. As you have probably guessed already, KDE needs money in order to make possible these meetings, since it is a non-profit organization which gained its popularity (and raises it day by day) owing to its great contributors and its great users. These contributors donate their time to help improve the software you love, so if you are a dedicated KDE user or if you are simply enthusiastic about free and open-source software you can support the Randa Meetings by making a donation here. Thank you! 🙂

Remember that wonderful ‘bird out of cage’ feeling FOSS gives you.

Călin Cruceru