Articles/Projects

Here are some of the projects I have developed and released to the community, as well as some articles I have written:

SharpKml

Description

SharpKML is an implementation of the Open Geospatial Consortium (OGC) KML 2.2 standard developed in C#, able to read/write both KML files and KMZ files. KML is the most commonly associated with Google Earth and the files created with this library are compatible with the application.

What I Learned

The project was fun to implement as there is a published standard to measure performance against. Also, writing library code for other people to use increased my awareness for the need of good documentation, both in the code and on the website. As well as the documentation, the library is unit tested (using NUint) to ensure any future changes to the code will not result in existing code dependent on the library failing. Documentation and unit testing both help to ensure the code is maintainable by multiple people.

WPF Map Control using openstreetmap.org Data

Description

This article describes how to incorporate image data obtained from the open source openstreetmap.org website. The article also includes a custom control that can be incorporated into other applications, as well as providing a sample application on how to integrate the control.

What I Learned

The project increased my knowledge of Window Presentation Framework, especially on how to separate data from the user interface (using the MVVM pattern). The benefit of separating the data and UI is to allow easy modification to one without changing the other.

Using Direct2D with WPF

Description

In this article I increased the graphical performance of WPF by utilising Direct2D. The article was created after I created a CAD like control (for a separate project) and found the performance of WPF to be the bottleneck.

What I Learned

When creating the article there was very little information on how to use Direct2D with WPF or even if it was possible. As of writing, a Google search for “Direct2D WPF” yields only 323,000 results, with my article being the second. The only other solutions required mixing managed with unmanaged code, however, by using the Windows API Code Pack all code could be written in managed code only (though during development I did need to modify some C++/CLI code to get to a point where I could port it across to C#).

Parsing Latitude and Longitude Information

Description

This is a short article that extracts longitude and latitude information from user input. Whilst sounding simple, user input can be in a variety of formats and cultures that can be tricky to extract the numbers (the main difference being some cultures use ‘.’ for the decimal separator, others user ‘,’). The code presented also allows (de)serialization of the latitude/longitude information according to ISO 6709.

What I Learned

The article, which is still being updated as users find different formats they want parsed, uses the existing .NET framework to parse the numbers, which has extensive cultural support. However, extracting the numbers to pass to the framework proved to be tricky, relying on complex regular expressions in order to be as flexible as possible. Although there isn’t much code, there was a lot of research and knowledge learned about cultural settings and the article was enjoyable to write.

ListBox drag selection

Description

This article was created to address a missing feature of the WPF implementation of the ListBox control; the native ListBox control in Microsoft Windows allows selection of multiple items by dragging a rectangle around them, however, this functionality is not available when using WPF.

What I Learned

The article is relatively short and code is simple (around 500 lines of code) but the result is an increase in the usability of the ListBox when trying to select multiple items, which is a common usage scenario. When searching for a solution I was not the only one wanting this feature, hence the creation of the article to help others who might be frustrated by the lack of functionality of the ListBox.

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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s