MapWindow 6.0: An Extensible MapWindow 6.0: An Extensible Architecture for Cartographic Architecture for Cartographic
SymbologySymbology
04/21/231 of 34
Ted Ted Dunsford Dunsford
FOSS4G ConferenceFOSS4G ConferenceOctober, 2009October, 2009
04/21/23 2 of 34
Ted DunsfordGraduate Research Assistant Idaho State University
with Dr. Dan Ames,
in collaboration withU.S. Environmental Protection Agency, AQUA TERRA Consultants, and CUAHSI
Overview
04/21/23 3 of 34
• MapWindow 6.0 & Component Architecture
• Extensibility & Interfaces
• Extensible Symbology Architecture
MapWindow 4 ActiveX Control
04/21/23 4 of 34
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
04/21/23 5 of 34
• 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
6 of 34
• Community Code• No ActiveX control
dependencies• Modular• Extendable• Versatile
Components
Component
Based
Architecture
Lets you…
7 of 34
Drag and Drop a New GIS!
04/21/23 8 of 34
•Tool Strip•Pre-Loaded Buttons
•Status Strip•Handles Progress Messages
Drag and Drop a Map
04/21/23 9 of 34
Drag’n Drop a Legend
04/21/23 10 of 34
Wire Controls Together
04/21/23 11 of 34
• Properties Right on the Controls allow them to link together.
Even Plug-in Management!
04/21/23 12 of 34
Interfaces
13 of 34
ColorColor
WidthWidth
HeightHeight
Original Object
04/21/23 14 of 34
ColorColor
WidthWidth
HeightHeight
Unknown Object
???
Extensibility
04/21/23 15 of 34
MapWindow Defines Interfaces
ColorColor
WidthWidth
HeightHeight
MapWindow
Plug-in Plug-in
Plug-ins provide new code that satisfies standardized interfaces.
04/21/23 16 of 34
Interfaces Define the Plug-in
MapWindow Interfaces
MapWindow Application
MapWindow searches for classes that implement specific interfaces by using System.Reflection
www.ioffer.com
Managers Wrangle Plugins
• Plugins do the work:– Loading data– Performing a process– Handle events
• Managers decide which provider gets used.
17 of 34
deutsch.istockphoto.com
Feature Symbology
04/21/23 18 of 34
Feature LayerFeature Layer
FeatureSetFeatureSet
Feature SchemeFeature Scheme
Symbology
Feature Category Collection
Feature Category Collection
Categories
Symbolizer (default)
Feature Category 0Feature Category 0
Feature Category 1Feature Category 1
[0]
[1]
SymbolizerSymbolizer
SymbolizerSymbolizer
Point Symbolizers
04/21/23 19 of 34
Point Category Point Category Point SymbolizerPoint Symbolizer
Filter Expression
Filter Expression List<ISymbol>List<ISymbol>
Symbols
Character SymbolCharacter Symbol[1]
[0] Your SymbolYour Symbol
GetColor()
Symbolizers Stack Symbols
04/21/23 20 of 34
Built In Point Symbols
04/21/23 21 of 34
Simple Point Symbols
04/21/23 22 of 34
• Simple Symbols:• Color• Shape
• Symbols• Size• Offset• Angle
• Outline Symbols• Outline Color• Outline Width• Use Outline
Character Point Symbols
04/21/23 23 of 34
• Character Symbols:• Character• FontFamilyName• Color• Style
• Symbols• Size• Offset• Angle
* True Type fonts are scalable vectors, and many are symbolic.
Picture Point Symbols
04/21/23 24 of 34
• Picture Symbols:• Image• ImageFilename• Opacity
• Symbols• Size• Offset• Angle
• Outline Symbols• Outline Color• Outline Width• Use Outline
Multiple Layers in Action
04/21/23 25 of 34
Point Categories
04/21/23 26 of 34
• Symbolizer• Selection Symbolizer
• Filter Expression
Filter Expressions
04/21/23 27 of 34
PointCategory smallSize = new PointCategory(Color.Blue, PointShapes.Rectangle, 4);smallSize.FilterExpression = "[Area] < .01";smallSize.LegendText = "Small Cities";
PointCategory largeSize = new PointCategory(Color.Yellow, PointShapes.Star, 16);largeSize.FilterExpression = "[Area] >= .01";largeSize.LegendText = "Large Cities";
Multiple Categories
04/21/23 28 of 34
Make Your Own ISymbol
04/21/23 29 of 34
• Step 1: Implement ISymbol
public class Symbol : ISymbol
• Step 2: Draw
public void Draw(Graphics g, double scale){ Rectangle bounds = new Rectangle(-5, -5, 10, 10); g.DrawEllipse(Pens.Black, bounds);}
UI for Custom Symbols
04/21/23 30 of 34
• 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
04/21/23 31 of 34
using MapWindow.Serialization;
[Serialize("PointShapes")]public PointShapes PointShape{ get { return _pointShape; } set { _pointShape = value; } }
1. Add Reference
2. Add an Attribute Tag
XML File Saves Object Definition
04/21/23 32 of 34
<item key="16" value="MapWindow.Drawing.SimpleSymbol, MapWindow, Version=6.0.0.0, Culture=neutral, PublicKeyToken=ca60e6823c3a6ee5" />
• Object Types Cached At The Top
• Types are re-used<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
33 of 34
Thanks!
34 of 34
Thanks to the
U.S. Environmental Protection Agency
AQUA TERRA Consultants
CUAHSI HIS
And
Dr. Daniel P. Ames