CS6345_FinalProject

CS 6345 - Spatial Data Structures Final Project - Doubly Connected Edge List  Daniel Latimer My project is to construct a doubly connected edge list (DCEL) from an input file containing topological data. I decided to accept GML 1.0 as input as it is a well known open standard, and construct and display the DCEL using microsoft windows' GDI+ graphics engine. I added a KDTree to index verticies so we can perform orthogonal range searches.

For information as to what the DCEL and KDTree can do please read my project report:

Some Screenshots:
Debug View with a GML file showing the major roads of north america.

Face colouring semi-complete

Two examples with the previous Roads GML file as well as a North American Hydrography GML file: The overview:

And zoomed/panned to see something a little closer to home (Canada: The maritimes)

Problems
Dangling Edges on Faces The DCEL wasn't handling faces that included edges that ran into the face well (Edges E2 and E3 in the example below). Since the DCEL tells which direction the edge is in by which side the face is on the algorithm died when we had an edge with the same face on both sides. I wrote a recursive depth first search to find the next "non dangling" edge, and continue iterating over the datastructure, I included a list of edges already visited and a list of edges already on the face as to not investigate any of those. Using a Hash table for the edges already visited made lookup a little quicker. After trying it out on some large datasets I discovered that it could hit a stack overflow, so I reimplemented it as an interative algorithm. Fairly simple switch. All that was needed was to include a queue for edges to investigate, throw the whole algorithm in a while(queue.empty == false) loop and instead of recursing, we would push edges onto the queue. This fixed my dangling edge problem.



Ideas for optimization
I now have my DCEL implemented and working. However it gets slow for large datasets (edges > 3,000,000). Here are a few Ideas I had to improve performance.

Multi-Edge edges Change the definition of a vertex to be only the verticies of degree 3 or greater. This would mean we would have long lists of edge pieces Ex. Edge1(vertexA - edgeAB - vertexB - edgeBC - vertexC) where vertexA and vertexC have more edges incident on them, and vertexB only has edgeAB and edgeBC incident on it.

Generalize Edges The longest part to draw in the DCEL are the edges. Areas take aproximitely 1/10th the time or less. One reason for this is we are trying to draw the full accuracy of the edges when zoomed out. This isn't needed for everyday use of most GIS applications. I propose to use a secondary data structure that will generalize the lines, reduce computation time during a print, and reduce edges printed, such as a zoom trie. When we zoom in we can reduce the generalization automatically. I'm not sure a zoom trie is the best data structure to use though, as it is meant for areas and not lines. We should be able to construct some data structure using what we learned from the zoom trie though that would allow us to access a generalized line with less difficulty then accessing the full line. Something that immediately comes to mind would be a binary tree of vertexes. We could perform a breadth first search to level X to ungeneralize. There is probably a data structure that has already been invented to do this kind of generalization of lines, research into that area would be the first step.

Example:



Source Code
You can find the source code for it on my subversion repository: https://subversion.assembla.com/svn/danlatimer/trunk/cs6345_spatial_data_structures/final_project

It should build without modification using a stock install of Visual Studio 2008.

Note: This application relies on Windows's GDI+ to output graphics to the screen. All code that outputs graphics is contained in the PrintManager class, so it would be possible to create a derived PrintManager for other graphics engines, implimenting the important functions (drawLine, drawPolygon, printTextToScreen, and leaving the rest as stub functions). However at the moment the application will only work in Windows.