340 likes | 459 Views
FOSS4G Conference October, 2009. MapWindow 6.0: An Extensible Architecture for Cartographic Symbology. Ted Dunsford. Ted Dunsford Graduate Research Assistant Idaho State University with Dr. Dan Ames, in collaboration with U.S. Environmental Protection Agency,
E N D
FOSS4G Conference October, 2009 MapWindow 6.0: An Extensible Architecture for Cartographic Symbology • Ted Dunsford
Ted Dunsford Graduate Research Assistant Idaho State University with Dr. Dan Ames, in collaboration with U.S. Environmental Protection Agency, AQUA TERRA Consultants, and CUAHSI
Overview • MapWindow 6.0 & Component Architecture • Extensibility & Interfaces • Extensible Symbology Architecture
MapWindow 4 ActiveX Control The Map Window 4 project is a windows project that started with the idea of an ActiveX control. • Very easy to use. • Drag and drop files to open them. • Built in zooming an panning. • Works with a large number of languages.
MapWindow 4 Application • Strictly 2D • Requires ActiveX • Supports one plug-in interface that controls the entire application. • Fast C++ drawing but limited symbology • Slow data manipulation
The Curent Project: • MapWindow 4.x • Our Legacy Open Source project wrapping an ActiveX control • MapWindow 5.x • Our Dot Net Web Mapping Tools • Community Code • No ActiveX control dependencies • Modular • Extendable • Versatile
Components Component Based Architecture Lets you…
Drag and Drop a New GIS! • Tool Strip • Pre-Loaded Buttons • Status Strip • Handles Progress Messages
Wire Controls Together • Properties Right on the Controls allow them to link together.
Interfaces Original Object Interface Color Width Height
Extensibility Interface Unknown Object Color ??? Width Height
MapWindow Defines Interfaces MapWindow Interface Plug-in Color Width Height Plug-ins provide new code that satisfies standardized interfaces.
Interfaces Define the Plug-in MapWindow Application MapWindow Interfaces www.ioffer.com MapWindow searches for classes that implement specific interfaces by using System.Reflection
Managers Wrangle Plugins • Plugins do the work: • Loading data • Performing a process • Handle events • Managers decide which provider gets used. deutsch.istockphoto.com
Feature Symbology Feature Layer Symbolizer (default) Symbology Feature Scheme Categories Feature Category Collection [0] Feature Category 0 Symbolizer [1] Feature Category 1 Symbolizer FeatureSet
Point Symbolizers GetColor() Point Category Point Symbolizer Symbols Filter Expression [1] Character Symbol List<ISymbol> [0] Your Symbol
Simple Point Symbols • Simple Symbols: • Color • Shape • Symbols • Size • Offset • Angle • Outline Symbols • Outline Color • Outline Width • Use Outline
Character Point Symbols • Character Symbols: • Character • FontFamilyName • Color • Style • Symbols • Size • Offset • Angle * True Type fonts are scalable vectors, and many are symbolic.
Picture Point Symbols • Picture Symbols: • Image • ImageFilename • Opacity • Symbols • Size • Offset • Angle • Outline Symbols • Outline Color • Outline Width • Use Outline
Point Categories • Symbolizer • Selection Symbolizer • Filter Expression
Filter Expressions PointCategory smallSize = newPointCategory(Color.Blue, PointShapes.Rectangle, 4); smallSize.FilterExpression = "[Area] < .01"; smallSize.LegendText = "Small Cities"; PointCategory largeSize = newPointCategory(Color.Yellow, PointShapes.Star, 16); largeSize.FilterExpression = "[Area] >= .01"; largeSize.LegendText = "Large Cities";
Make Your Own ISymbol • Step 1: Implement ISymbol • public class Symbol :ISymbol • Step 2: Draw • public void Draw(Graphics g, doublescale) • { • Rectanglebounds = new Rectangle(-5, -5, 10, 10); • g.DrawEllipse(Pens.Black, bounds); • }
UI for Custom Symbols • Property Grid • Built in to .Net • Customizable Editors • Adapts to Any Object • Reflection • Use System.Reflection • More Design Control • Much more effort
Save and Load Custom Symbols using MapWindow.Serialization; Add Reference Add an Attribute Tag [Serialize("PointShapes")] publicPointShapes PointShape { get { return _pointShape; } set { _pointShape = value; } }
XML File Saves Object Definition • Object Types Cached At The Top • Types are re-used <item key="16" value="MapWindow.Drawing.SimpleSymbol, MapWindow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=ca60e6823c3a6ee5" /> <item type="16"> <member name="XmlColor" type="17" value="#227A9A" /> <member name="Opacity" type="18" value="1" /> <member name="PointShapes" type="19" value="Star" />
Upcomming Goals • File-based Vector Formats • OGR Feature Providers • Large scale raster & image handling
Thanks to the U.S. Environmental Protection Agency AQUA TERRA Consultants CUAHSI HIS And Dr. Daniel P. Ames Thanks!