Proposed Architecture Draft Only
Please provide feedback in forum post:
Proposed Control Architecture
The aim is to produce a control that is both useful and reusable for GIS Silverlight projects.
The specific goals are:
- Seperate the actual map implimentation from the control so it can used with any map control
- Maximium design flexibility
- Easy to maintain, version, test, deploy
- Full featured with no restrictions
Abstract Control and implimentation per base map
- Every control will have a project for the abstract control that defines what events, method and properties the map must expose in order to support this control as well as the generic implimentation (Purple).
- Then for every map control (Green) a project is created that impliments this class (Orange).
- A common Interface IMapControl<T> will expect the specific Map object as "MapInstance" and have a helper property "MapName" to allow this to be set in XAML. The control will have to impliment IDisposeable
- A common project (Blue) will contain generic classes for constants, entities and enums. For example a "Location" class for Latitiude/Longitude. We will leverage a OGC compliant framework to produce many of the common elements.
- A common helper project for each base control (Green) will contain common functionality like type convertors or common methods.
Parts and states model
This model is well documented by Microsoft and allows design tools like Blend to render the controls and provide the designer with tools to completely redesign the control. Essentially a "generic.xaml" template is created but only the essentials parts
and VSM states are essential, everything else can be redesigned as the designer see's fit.
Information links here:
- All strings for parts and states are defined as constants
- We use a consistant nameing pattern for parts
- We use a consistant nameing patter for states
- We use a "GoToState" method for all state changes.
Coordinate Panel Control
- CoordinatePanel.cs - Logic for the control and Abstract methods, events and properties to be implimented.
- generic.xaml - Generic template for the control
"CoordinatePanel.cs" is setup as per the Parts and States model, using OnApplyTemplate() to get its parts. All map related method, properties and events are handled by creating them abstract.
- CoordinatePanel.cs - Implimentation of the Abstract Class.
The Bing Maps instance will be set as property "MapInstance". Here we wire up the required events, properties and methods and convert the map specific entities into the generic ones. The BingMaps helper project removes any duplicate code needed for
every control and every conversion
Your application - page.xaml.cs
- Simple put the Specific map control on the page eg BingMaps CoordinatePanel
- set the MapName property of the control in XAML to the name of the Map control
<Grid x:Name="LayoutRoot" Background="White">
<m:Map x:Name="map" />
<c:CoordinatePanel x:Name="coord" MapName="map" />