OpenMap Development p2
OpenMap Development p2
OpenMap Development p2
TM
Agenda Controlling the Map Projection Different Projections Managing OMGraphics Symbols Drawing OMGraphics OMGrid/OMRaster Issues Clipping, Holes in OMGraphics PropertyConsumer and GUIs Geo (spatial indexing) OpenMap 5.0 changes, including time controls
Projection object in MapBean controls map view Change Projection, layers notied MapBean API methods
setProjection(Projection proj); setCenter(lat, lon); setScale(float scale);
MapBean Projection API Each call to MapBean Projection API causes Projection events to be sent to layers For multiple changes, modify Projection object instead and set it on MapBean
Instead of:
mapBean.setCenter(lat, lon); mapBean.setScale(scale);
Do:
Proj p = (Proj) mapBean.getProjection(); p.setCenter(lat, lon); p.setScale(scale); mapBean.setProjection(p);
MapBean as Listener
MapBean provides Projection, a readonly interface Projections need to be cast to Proj in order to modify parameters Call setProjection(Projection) on MapBean after modications. Layers hold copy and wont pick up changes.
Mercator Equal Arc (CADRG, LLXY) Orthographic Equal Distance (LambertConformal, UTM) Gnomonic
Great Circle
Shortest geocentric line between two points Longitude lines
Rhumb
Line of constant bearing between two points Latitude (and Longitude) lines
Straight
Pixel lines, no geographic signicance
Mercator
Longitude and latitude lines perpendicular and straight Distortion - moving away from equator increases pixel distances between latitude lines Lines of constant direction (bearing) are straight
Equal Arc (CADRG, LLXY) Pixels and geocentric coordinates change at the same rate Good for images from generic sources
Orthographic
Great circle lines through center are straight Always directed at the center point of map
Equal Distance (UTM, Conic) Pixels and ground distance change at same rate Zones based on Longitude, accuracy errors occur when away from Median longitude
Gnomonic
Managing OMGraphics
Data View, responding to Projection Layer is responsible for deciding how OMGraphics are managed and organized If more organization is needed, OMGraphicLists to organize OMGraphics into groups
Change Layers, completely different data source Change rendering contents of OMGraphicList for single Layer Choice usually depends on:
data source for different scales - different source, different layers Complexity of application to present to users
Switching Layers
ScaleFilterLayer
A parent layer that switches between child layers, depending on the map scale Need to have one less transition scale than layer count
BufferedLayer
A layer that maintains a set of layers within a personal MapBean Renders layers as image
ScaleFilterLayer
Congure in API
setLayersAndScales(Layer[], float[]);
Congure in Properties
scaledRoads.class=com.bbn.openmap.layer.ScaleFilterLayer scaledRoads.prettyName=Northeast Roads scaledRoads.layers=neroads neroadsDetailed scaledRoads.transitionScales=150000 neroads.class=com.bbn.openmap.layer.shape.ShapeLayer neroadsDetailed.class=com.bbn.openmap.layer.shape.ShapeLayer
BufferedLayer
Congure in API
addLayer(Layer); removeLayer(Layer); clearLayers();
Congure in Properties
bufLayer.class=com.bbn.openmap.layer.BufferedLayer bufLayer.prettyName=My Layer Group bufLayer.layers=layer1 layer2 layer3 bufLayer.visibleLayers=layer1 layer3 bufLayer.hasActiveLayers=false
OMGraphicHandlerLayer
Filter in the prepare() method
Initially organize data to quickly evaluate OMGraphics as sets Remember to consider data set size
Brute force might be just as good as clever organization Run, evaluate, rene
Organizing OMGraphics
Symbols
Using Symbols
Different sources
Images from les Mil-Std-2525B package Icon package
OMScalingIcon
Centers image over location Can change image size for
Mil-Std-2525b Symbols
Use SymbolReferenceLibrary com.bbn.openmap.tools.symbology.milStd2525 package DISA symbol set, not all possibilities included Symbols identied by 15 character key code SymbolChooser lets you gure out whats available and get the code
SymbolReferenceLibrary
Congure in Properties:
srl.class=com.bbn.openmap.tools.symbology.milStd2525.SymbolReferenceLibrary srl.imageMakerClass=com.bbn.openmap.tools.symbology.milStd2525.PNGSymbolImageMak er srl.path=data/symbols/milStd2525
OMIconFactory
Creates resizable vector icons Dened with IconPart/IconPartList Rendered with DrawingAttributes
Drawing OMGraphics
OMDrawingTool
EditToolLoader tells OMDrawingTool which EditableOMGraphic should be used for OMGraphic EditToolLoaders available for circles, range rings, rectangles, polys, rasters, points, lines, splines, text, distance
EditorLayer
OMGraphicHandlerLayer with Tool Interface Provides controls on ToolPanel Provide editing controls for single layer Requires EditorTool component that determines what editor does
DrawingEditorTool
EditorLayer Examples
Edit OMGraphic
omDrawingTool.edit(omGraphic, drawingToolRequestor);
Create OMGraphic
omDrawingTool.create(class, drawingAttributes, DrawingToolRequestor, ifGUIAllowed);
DrawingToolRequestor
Component the DrawingTool noties when its done Usually the layer
drawingComplete(OMGraphic, OMAction);
Spatial Filtering
Filtering based on Shape object, can be retrieved from projected OMGraphic and passed to FilterSupport
OMGraphicList filtered = fSupport.filter(Shape,insideOrOutside);
OMGrid/OMRaster Issues
Projection Mismatch
OMGrid appearance is set of OMGraphics created by OMGridGenerators SimpleColorGenerator creates Equal Arc projected image, wont match Mercator New ImageWarp/OMWarpingImage classes will take pixels and create warped image
Crossing the Dateline is handled, if the entire image is rendered on map. Really a small-world problem - occurs when image needs to be rendered on both sides of map, i.e. if the image wraps around the map area.
Small-world Solutions OMScalingRaster needs to be extended/ updated to paint image twice, once for each side of map Can take code from OMRect to make the projection calls to determine locations
ArrayList rects = proj.forwardRect(new LatLonPoint(lat1, lon1), // NW new LatLonPoint(lat2, lon2), // SE lineType, nseg, !isClear(fillPaint)); int size = rects.size();
Setting clip area on java.awt.Graphics limits the render area, species the area that gets painted java.awt.geom.Area created from Shape, other areas can be subtracted. JTS Topology Suite
PropertyConsumer
Interface for component that can be congured by Properties Provides methods for setting and getting properties Also provides methods for gathering information about what properties are available to be set (editors)
void setProperties(String, Properties); void setProperties(Properties); void setPropertyPrefix(String); String getPropertyPrefix(); Properties getProperties(Properties); Properties getPropertyInfo(Properties);
Dening Properties As dened in the class, properties should be unscoped, as if property prex is undened
public final static ShowLabelsProperty = showLabels; // not . showLabels
Property Output
getProperties method returns Properties lled with scoped key values as Strings
properties.putProperty(prefix + ShowLabelsProperty, Boolean.toString(showLabels));
Should always call super.getProperties() if superclass is PropertyConsumer Should always return a Properties object
Property Metadata getPropertyInfo provides Properties that describe PropertyConsumer Each property requires 3 properties added
Non-scoped property name Property name + ScopedEditorProperty Property name + LabelEditorProperty
propInfo.put(ShowLabelsProperty, Description); propInfo.put(ShowLabelsProperty + ScopedEditorProperty, com.bbn.openmap.util.PropertyEditor.YesNoProperty); propInfo.put(ShowLabelsProperty + LabelEditorProperty, GUI Label);
PropertyEditors
ScopedEditorProperty allows you to dene a component that provides a GUI for a property PropertyEditors in package com.bbn.openmap.util.propertyEditor Inspector class creates GUI from getPropertyInfo properties
Package that represents locations, paths and areas as vectors A coordinate is represented by Geo
x, y, z tuple instead of lat, lon
GeoExtent
ExtentIndex
Spatial index that organizes Extents for quick searches ExtentIndexImpl organizes by longitude strips
Extent Index
extents
Intersection Class that manages queries on an ExtentIndex Also answers direct spatial intersection queries about Extents For ExtentIndex queries, uses MatchFilter and MatchCollector
MatchFilter species distance between objects to be considered a hit MatchCollector is where you get the answers, via iterator
Consider
Intersection Functions
Region intersects region? Path intersect region? Point in region? Intersection point between GC arcs? Polys intersect? Point on segment? GC arc within distance of point?
OpenMap 5.0
Changes will be required to move from OM4.6.5 to OM5.0 Projection API changed Increased precision OMGeo, OMShape
New:
Point2D forward(Point2D); Point2D inverse(Point2D);
Projection Hierarchy
Proj/Projection still the top class Cartesian projection (x, y) GeoProj, new class
Generics allow LatLonPoint returns All old projections are GeoProj objects
ProjectionFactory
ProjectionFactory no longer singleton Created like any other Component, should be added to MapHandler Available via MapBean
Precision Upgrade
Projection library calculations all based on doubles OMGraphics based on doubles, signatures changed Old oats only accurate to 7ft, doubles accurate to centimeters.
OMGeo OMGraphic class that internally uses Geo and Extents to represent shapes OMGeo abstract, instantiate inner classes
OMGeo.Pt OMGeo.Line OMGeo.Polyline OMGeo.Region
OMShape
New OMGraphic that takes java.awt.Shape objects as source geometry Intended for use with Cartesian projection, will work with GeoProj projections if coordinate range ts
OMEvent Handling
OMEvents represent something that happens at a time and place Time Conrols display events in
List form Timeline form On the map for a given time
OMEvent
Provides text description of event Timestamp Optional location Can contain attributes
OMEventHandler
Creates OMEvents from data source Added to MapHandler Can provide ltering
Timeline