Top Banner
OpenMap Toolkit OpenMap Toolkit Introduction Introduction
51

OpenMap Toolkit

Feb 03, 2016

Download

Documents

elkan

OpenMap Toolkit. Introduction. What is OpenMap?. Geospatial visualization toolkit Includes: an application framework software components that display information gathered from different map data sources Displays data from: local files remote servers Based on Sun's Java Beans. Usages. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: OpenMap Toolkit

OpenMap ToolkitOpenMap Toolkit

IntroductionIntroduction

Page 2: OpenMap Toolkit

What is OpenMapWhat is OpenMap??

►Geospatial visualization toolkitGeospatial visualization toolkit► Includes:Includes:

an application frameworkan application framework software components that display software components that display

information gathered from different map information gathered from different map data sourcesdata sources

►Displays data from:Displays data from: local files local files remote serversremote servers

►Based on Sun's Java BeansBased on Sun's Java Beans

Page 3: OpenMap Toolkit

UsagesUsages

►OpenMap provides components that OpenMap provides components that can be used as:can be used as: A standalone applicationA standalone application An appletAn applet A part of another applicationA part of another application An image serverAn image server

Page 4: OpenMap Toolkit

Usages – A standalone Usages – A standalone applicationapplication

►Provided component:Provided component: comcom..bbnbbn..openmapopenmap..appapp..OpenMapOpenMap

►Creates the basic framework for Creates the basic framework for configuring and running a mapping configuring and running a mapping applicationapplication

►A container for components added to an A container for components added to an applicationapplication

►Forms the backbone of applications with Forms the backbone of applications with differing interfaces and functionalitiesdiffering interfaces and functionalities

Page 5: OpenMap Toolkit

Usages – A standalone Usages – A standalone applicationapplication

►The application is configured by The application is configured by openmap.properties file that specifies:openmap.properties file that specifies: which components are created and addedwhich components are created and added initialization properties of the componentsinitialization properties of the components locations of data files or serverslocations of data files or servers

►Power of JavaBeansPower of JavaBeans New applications can be configured New applications can be configured

without recompilation, simply by without recompilation, simply by modifying the properties file with a text modifying the properties file with a text editoreditor

Page 6: OpenMap Toolkit

Usages – an appletUsages – an applet

►Provided component:Provided component: com.bbn.openmap.app.OpenMapAppletcom.bbn.openmap.app.OpenMapApplet

►Creates the application framework Creates the application framework within an applet framework within an within an applet framework within an applet framework applet framework

►The added components are restricted The added components are restricted by the sandbox from communicating by the sandbox from communicating with any other computer other than the with any other computer other than the one that the applet was served from. one that the applet was served from.

Page 7: OpenMap Toolkit

Data SourcesData Sources

SourceSourceApplicApplic..

AppletApplet

ComputationComputationXXXX

Data files on Data files on HDHD

XX--

Data files from Data files from URLURL

XXURL from the same URL from the same server as appletserver as applet

Data files in Data files in jarjar

XXXX

DB (JDBC)DB (JDBC)XXDB server should run on DB server should run on the same machines as the same machines as appletapplet

ServerServerXXServer should runs on Server should runs on applet serverapplet server

Page 8: OpenMap Toolkit

Usages – a part of another Usages – a part of another applicationapplication

►OpenMap user interface components OpenMap user interface components and Layers and Layers are based on Java Swing componentsare based on Java Swing components can be used in other applications as can be used in other applications as

regular swing components outside of the regular swing components outside of the OpenMap application framework. OpenMap application framework.

►Other componentsOther components can be also used can be also used by simply including them to the by simply including them to the projectproject

Page 9: OpenMap Toolkit

Usages – an image serverUsages – an image server

►Provided component:Provided component: comcom..bbnbbn..openmapopenmap..imageimage..ImageServerImageServer

►Uses an openmap.properties file to Uses an openmap.properties file to configure layers to use for an image, configure layers to use for an image, and then creates an image from those and then creates an image from those layers.layers.

►Can be run as a stand-alone Can be run as a stand-alone application to create images.application to create images.

Page 10: OpenMap Toolkit

Usages – an image serverUsages – an image server

►The robust usage of an image server is The robust usage of an image server is coupling with coupling with servlet environmentservlet environment

►Provided component:Provided component: com.bbn.openmap.image.MapRequestHandlecom.bbn.openmap.image.MapRequestHandle

rr►Extends the ImageServerExtends the ImageServer

also parses a properties file to configure its also parses a properties file to configure its layerslayers

capable of parsing request strings to create capable of parsing request strings to create images dynamically, adjusting the projection images dynamically, adjusting the projection and layer content of the images as requestedand layer content of the images as requested

Page 11: OpenMap Toolkit

OpenMap ToolkitOpenMap Toolkit

Drawing Graphic ObjectsDrawing Graphic Objects

Page 12: OpenMap Toolkit

ProjectionsProjections

►By geospatial definition:By geospatial definition: a projection is the translation between a a projection is the translation between a

spherical model of the earth to a flat, two-spherical model of the earth to a flat, two-dimensional surface.dimensional surface.

► In OpenMap:In OpenMap: projections are components that handle projections are components that handle

the translations between latitude and the translations between latitude and longitude coordinates and screen locations.longitude coordinates and screen locations.

Projections only handle translation from Projections only handle translation from decimal degree latitude/longitude data to decimal degree latitude/longitude data to map view x/y coordinates.map view x/y coordinates.

Page 13: OpenMap Toolkit

ProjectionsProjections

► A datum is a definition of how coordinates A datum is a definition of how coordinates on the sphere are defined. on the sphere are defined.

►OpenMap projections assume that latitude OpenMap projections assume that latitude and longitude coordinates are defined in and longitude coordinates are defined in terms of the WGS 84 datum. terms of the WGS 84 datum.

►OpenMap currently does not have a OpenMap currently does not have a mechanism for translating coordinates mechanism for translating coordinates from other datum into WGS 84, but there from other datum into WGS 84, but there are packages available on the internet for are packages available on the internet for performing this functionperforming this function..

Page 14: OpenMap Toolkit

ProjectionsProjections► Projection allows to work with map shapes that should Projection allows to work with map shapes that should

be drawn on the map. be drawn on the map. ► Vector features - shapes defined as pairs of coordinate Vector features - shapes defined as pairs of coordinate

pointspoints► Projections are capable of determining how vector Projections are capable of determining how vector

features (defined by lat/long) are rendered on features (defined by lat/long) are rendered on themselves. The geometry of these shapes depend on themselves. The geometry of these shapes depend on the line type specified for a shape:the line type specified for a shape: Great Circle lines - The line between two coordinates is the Great Circle lines - The line between two coordinates is the

shortest distance between these points on the surface of the shortest distance between these points on the surface of the Earth.Earth.

Rhumb Lines - The line between two coordinates has constant Rhumb Lines - The line between two coordinates has constant bearing. As you move along a line from one point to another, bearing. As you move along a line from one point to another, you are always moving in the same direction.you are always moving in the same direction.

Straight - The lines between coordinates drawn in pixel space.Straight - The lines between coordinates drawn in pixel space.► Shapes created from vector feature geometries created Shapes created from vector feature geometries created

from different data sources will line up with each other from different data sources will line up with each other if all the coordinates are defined in the same datum.if all the coordinates are defined in the same datum.

Page 15: OpenMap Toolkit

EventsEvents

►OpenMap components communicate with OpenMap components communicate with each other using the Java event model.each other using the Java event model.

► Information is passed from one component Information is passed from one component to another using event objects. to another using event objects.

► A component registers itself as an event A component registers itself as an event listener to the other component that listener to the other component that generates events.generates events.

►Whenever the source component generates Whenever the source component generates a new event, it sends that event to all of its a new event, it sends that event to all of its listeners. This model is used throughout listeners. This model is used throughout OpenMap communications.OpenMap communications.

► For more information on different events seeFor more information on different events see comcom..bbnbbn..openmapopenmap..eventevent

Page 16: OpenMap Toolkit

OMGraphicsOMGraphics

►OMGraphics is as set of classes:OMGraphics is as set of classes: Used to represent data objects on the map. Used to represent data objects on the map. Managed by Layers as objectsManaged by Layers as objects Know how to work with Projections to figure Know how to work with Projections to figure

out where they should draw themselves in out where they should draw themselves in a map window. a map window.

Can be dynamically repositioned, change Can be dynamically repositioned, change their appearance under various conditions, their appearance under various conditions, and are able to respond to simple spatial and are able to respond to simple spatial queries about map pixel locations and their queries about map pixel locations and their distance away from points.distance away from points.

Page 17: OpenMap Toolkit

OMGraphicsOMGraphics

►Supported shapes:Supported shapes: OMArc and OMCircleOMArc and OMCircle OMGridOMGrid OMLine and OMArrowHeadOMLine and OMArrowHead OMPointOMPoint OMPolyOMPoly OMRasterObject OMRasterObject OMRect OMRect OMTextOMText

Page 18: OpenMap Toolkit

OMGraphicsOMGraphicsDrawing PathsDrawing Paths

►OMPoly object OMPoly object represents a path between several pointsrepresents a path between several points can be closed (polygon) or open (polyline)can be closed (polygon) or open (polyline)

►OMDistance objectOMDistance object is an OMPoly rendered in lat/lon spaceis an OMPoly rendered in lat/lon space has labels on it displaying both the ground has labels on it displaying both the ground

distance between points and the cumulative distance between points and the cumulative distance over the entire lengthdistance over the entire length

►OMSpline objectOMSpline object adds curves between the points on the polygonadds curves between the points on the polygon

►OMDecoratedSpline objectOMDecoratedSpline object allows the curved polygon edge to be decorated allows the curved polygon edge to be decorated

with a symbolic edge or textwith a symbolic edge or text

Page 19: OpenMap Toolkit

OMGraphicsOMGraphicsDrawing ImagesDrawing Images

► The OMRasterObject The OMRasterObject is a superclass for OMGraphics that uses an image to represent is a superclass for OMGraphics that uses an image to represent

itselfitself is located according to their upper left corner is located according to their upper left corner can be rotatedcan be rotated

► OMBitmap OMBitmap two-color image created from data that species whether the pixels two-color image created from data that species whether the pixels

in the image are on or offin the image are on or off can be used in conjunction with the XBMFile, which can read X can be used in conjunction with the XBMFile, which can read X

bitmap text files to create these imagesbitmap text files to create these images► OMRasterOMRaster

is the main class for displaying imagesis the main class for displaying images can be created from pixel data containing ARGB color information, can be created from pixel data containing ARGB color information,

pixel information to be derived from a color lookup table, or from pixel information to be derived from a color lookup table, or from a java.awt.Image object created from an image file. a java.awt.Image object created from an image file.

Can handle any image that the Java can read (JPG, GIF, PNG, TIFF)Can handle any image that the Java can read (JPG, GIF, PNG, TIFF)

Page 20: OpenMap Toolkit

OMGraphicsOMGraphicsDrawing ImagesDrawing Images

►OMScalingIconOMScalingIcon a subclass of OMScalingRastera subclass of OMScalingRaster used to represent an object on the mapused to represent an object on the map centers its image over object’s locationcenters its image over object’s location scales the icon appropriately for the given scales the icon appropriately for the given

projection scaleprojection scale can be given a scale value that it uses to can be given a scale value that it uses to

decide when to represent itself at full size, decide when to represent itself at full size, as well as a minimum and maximum scale as well as a minimum and maximum scale where it will stop scaling itself, in order to where it will stop scaling itself, in order to prevent itself from becoming too small or prevent itself from becoming too small or too largetoo large..

Page 21: OpenMap Toolkit

OMGraphicsOMGraphicsDrawing AttributesDrawing Attributes

►DrawingAttributes objectDrawingAttributes object knows how to manage different types of knows how to manage different types of

drawing attributesdrawing attributes used by a layer to read properties for used by a layer to read properties for

attribute settingsattribute settings can be used to push attributes to and pull can be used to push attributes to and pull

attributes from OMGraphicsattributes from OMGraphics

Page 22: OpenMap Toolkit

OMGraphicsOMGraphicsDrawing AttributesDrawing Attributes

► Line Paint - java.awt.Paint used for the edge of Line Paint - java.awt.Paint used for the edge of the OMGraphic can be individually controlledthe OMGraphic can be individually controlled

► Select Paint - a secondary Paint for the edge Select Paint - a secondary Paint for the edge when the OMGraphic is selected when the OMGraphic is selected (select()/deselect() methods toggle the line (select()/deselect() methods toggle the line paint and select paint when rendering the paint and select paint when rendering the OMGraphic’s edge. OMGraphic’s edge.

► Fill Paint - A Paint for the interior of the area of Fill Paint - A Paint for the interior of the area of the OMGraphic.the OMGraphic. The com.bbn.openmap.omGraphics.OMColor.clear The com.bbn.openmap.omGraphics.OMColor.clear

object is the default fillobject is the default fill

Page 23: OpenMap Toolkit

OMGraphicsOMGraphicsDrawing AttributesDrawing Attributes

► Texture Paint - A textured mask pattern for Texture Paint - A textured mask pattern for the OMGraphic. the OMGraphic. If not null, then it will be rendered on top of the fill If not null, then it will be rendered on top of the fill

paint. If the fill paint is clear, the texture mask will paint. If the fill paint is clear, the texture mask will not be used. not be used.

to render the texture mask as is, set the fill paint to render the texture mask as is, set the fill paint of the graphic instead. This is really to be used to of the graphic instead. This is really to be used to have a texture added to the graphic, with the fill have a texture added to the graphic, with the fill paint still influencing appearance.paint still influencing appearance.

► Matting and the Matting Paint - a setting Matting and the Matting Paint - a setting (Paint) for adding additional color around the (Paint) for adding additional color around the edge, to enhance the line Paint against a edge, to enhance the line Paint against a busy background.busy background.

► Stroke - Controls how the edge is drawn, Stroke - Controls how the edge is drawn, specifying line width, dash pattern, end and specifying line width, dash pattern, end and corner accents, or customizable patterns.corner accents, or customizable patterns.

Page 24: OpenMap Toolkit

OMGraphicsOMGraphicsManaging OMGraphicsManaging OMGraphics

►OMGraphicListOMGraphicList wrapper class that contains a java.util.List, wrapper class that contains a java.util.List, used to contain and manage OMGraphicsused to contain and manage OMGraphics Capable to:Capable to:

►control the order which its OMGraphics are control the order which its OMGraphics are renderedrendered

►find OMGraphics closest to a pixel locationfind OMGraphics closest to a pixel location►find the OMGraphic that contains a pixel locationfind the OMGraphic that contains a pixel location►move OMGraphics to different places in the list.move OMGraphics to different places in the list.

is also OMGraphics, which allow them to be is also OMGraphics, which allow them to be nestednested

Page 25: OpenMap Toolkit

OMGraphicsOMGraphicsManaging OMGraphicsManaging OMGraphics

►OMGraphicListOMGraphicList has the capability to set their behavior regarding has the capability to set their behavior regarding

how accessible their contained OMGraphics arehow accessible their contained OMGraphics are►vague - behaves as if all of its parts contribute to one vague - behaves as if all of its parts contribute to one

OMGraphic, and will return itself for any distance queriesOMGraphic, and will return itself for any distance queries► transparent - pass all queries onto its contained transparent - pass all queries onto its contained

OMGraphics. OMGraphics.

Calling OMGraphic methods on the list Calling OMGraphic methods on the list (setLinePaint(), setFillPaint(), etc.) will cause all of (setLinePaint(), setFillPaint(), etc.) will cause all of the OMGraphics on the list to be configured with the OMGraphics on the list to be configured with that value.that value.

To generate the OMGraphics on a list with the To generate the OMGraphics on a list with the current projection, or to render them, generate() current projection, or to render them, generate() and render() can be called on the OMGraphicList.and render() can be called on the OMGraphicList.

Page 26: OpenMap Toolkit

OMGraphicsOMGraphicsDetecting user’s actionsDetecting user’s actions

►OMGraphics have several query OMGraphics have several query methods that layers can use to methods that layers can use to determine of what the user is doing determine of what the user is doing with the mouse over the map.with the mouse over the map.

►The OMGraphic must be generated in The OMGraphic must be generated in order for these methods to have any order for these methods to have any meaningmeaning

Page 27: OpenMap Toolkit

OMGraphicsOMGraphicsDetecting user’s actionsDetecting user’s actions

►public float public float distancedistance((int x, int y)int x, int y) – a – a distance of OMGraphic from the distance of OMGraphic from the coordinate (x,y)coordinate (x,y)

►public float public float distanceToEdge(int x, int y)distanceToEdge(int x, int y) - -a distance to the edge of the OMGraphica distance to the edge of the OMGraphic even if the coordinate is inside the area of even if the coordinate is inside the area of

theOMGraphic.theOMGraphic.

►public boolean public boolean contains(int x, int y)contains(int x, int y) - true - true if the coordinate is inside the OMGraphic.if the coordinate is inside the OMGraphic.

Page 28: OpenMap Toolkit

OMGraphicsOMGraphicsDetecting user’s actionsDetecting user’s actions

► OMGraphic list add some functionalityOMGraphic list add some functionality► public OMGraphic public OMGraphic findClosest(int x, int y)findClosest(int x, int y)► public OMGraphic public OMGraphic findClosest(int x, int y, int findClosest(int x, int y, int

limit)limit) Ask the OMGraphicList for the OMGraphic closest Ask the OMGraphicList for the OMGraphic closest

to the coordinate. In the second method, the to the coordinate. In the second method, the query only returns an OMGraphic if the distance is query only returns an OMGraphic if the distance is within the provided pixel distance limit. Both within the provided pixel distance limit. Both methods return null of an OMGraphic isn’t foundmethods return null of an OMGraphic isn’t found..

► public int public int findIndexOfClosest(int x, int y)findIndexOfClosest(int x, int y);;► public int public int findIndexOfClosest(int x, int y, int findIndexOfClosest(int x, int y, int

limit)limit);; Ask for the index on the list of the OMGraphic Ask for the index on the list of the OMGraphic

closest to the coordinate. In the second method, closest to the coordinate. In the second method, the query only returns an index if the distance is the query only returns an index if the distance is within the provided pixel distance limitwithin the provided pixel distance limit..

Page 29: OpenMap Toolkit

OMGraphicsOMGraphicsDetecting user’s actionsDetecting user’s actions

► public OMGraphic public OMGraphic selectClosest(int x, int y)selectClosest(int x, int y);;► public OMGraphic public OMGraphic selectClosest(int x, int y, int selectClosest(int x, int y, int

limit)limit);; Ask the OMGraphicList for the OMGraphic closest to the Ask the OMGraphicList for the OMGraphic closest to the

coordinate, except also call the select() method on the coordinate, except also call the select() method on the OMGraphic.OMGraphic.

This method is convenient because it also calls This method is convenient because it also calls deselect() on all of the other OMGraphics that are not deselect() on all of the other OMGraphics that are not returnedreturned..

In the second method, the query only returns an In the second method, the query only returns an OMGraphic if the distance is within the provided pixel OMGraphic if the distance is within the provided pixel distance limit.distance limit.

Both methods return null of an OMGraphic isn’t foundBoth methods return null of an OMGraphic isn’t found..► public OMGraphic public OMGraphic getOMGraphicThanContains(int getOMGraphicThanContains(int

x, int y)x, int y);; Ask for the OMGraphic that contains the coordinateAsk for the OMGraphic that contains the coordinate

Page 30: OpenMap Toolkit

OMGraphicsOMGraphicsGenerate and render ParadigmGenerate and render Paradigm

►Once an OMGraphic is created, it Once an OMGraphic is created, it MUST be MUST be projected:projected: its position on the map needs to be calculated its position on the map needs to be calculated the Projection object that arrives in the ProjectionEvent the Projection object that arrives in the ProjectionEvent

is used on the OMGraphic.generate(Projection) method. is used on the OMGraphic.generate(Projection) method.

► The OMGraphics will need to be generated whenThe OMGraphics will need to be generated when the projection changesthe projection changes the position of the OMGraphic has changed, or certain the position of the OMGraphic has changed, or certain

attributes of the OMGraphic are changedattributes of the OMGraphic are changed The OMGraphics are smart enough to know when a The OMGraphics are smart enough to know when a

attribute change requires a generationattribute change requires a generation

► If you try to render an OMGraphic that has not If you try to render an OMGraphic that has not been generated, it will not appear on the mapbeen generated, it will not appear on the map. .

Page 31: OpenMap Toolkit

OpenMap ToolkitOpenMap Toolkit

Data FormatsData Formats

Page 32: OpenMap Toolkit

Data Formats – Location DataData Formats – Location Data

►Displaying of location data or objects located Displaying of location data or objects located at a specific place is easily handled by: at a specific place is easily handled by: com.bbn.openmap.layer.location.LocationLayercom.bbn.openmap.layer.location.LocationLayer

► The LocationLayer manages composite The LocationLayer manages composite OMGraphics calledOMGraphics called com.bbn.openmap.layer.location.Locationcom.bbn.openmap.layer.location.Location

► Location objects contain a marker OMGraphic Location objects contain a marker OMGraphic that represents the actual object, and a that represents the actual object, and a OMText to display the name of that object.OMText to display the name of that object.

Page 33: OpenMap Toolkit

Data Formats – Location DataData Formats – Location Data

►Load of Locations is abstracted to the Load of Locations is abstracted to the LocationHandler interface, which is LocationHandler interface, which is responsible for creating Locations from responsible for creating Locations from a particular data source.a particular data source.

►OpenMap comes with two default OpenMap comes with two default implementationsimplementations CSVLocationHandler – loads data from CSVLocationHandler – loads data from

coma-separated filescoma-separated files DBLocationHandler – loads location data DBLocationHandler – loads location data

from databasefrom database

Page 34: OpenMap Toolkit

Data Formats – Location DataData Formats – Location Data

►The DBLocationHandler The DBLocationHandler can be configured to issue SQL commands can be configured to issue SQL commands

to a JDBC server to retrieve location to a JDBC server to retrieve location information from a relational database.information from a relational database.

expects that any query to the database expects that any query to the database returns a set of results in a particular returns a set of results in a particular order, and has a queryString property it order, and has a queryString property it will use for the SQL request that will make will use for the SQL request that will make that happen. that happen.

Page 35: OpenMap Toolkit

Data Formats – Shape DataData Formats – Shape Data

►There are several options available for There are several options available for displaying data files in the ESRI Shape file displaying data files in the ESRI Shape file format. format.

►Shape files Shape files contain vector geometries (points, polygons contain vector geometries (points, polygons

& lines)& lines) are usually distributed in a set of three files: are usually distributed in a set of three files:

►the geometry file (.shp) the geometry file (.shp) ►the index file (.shx)the index file (.shx)►the database attribute file (.dbf)the database attribute file (.dbf)

Page 36: OpenMap Toolkit

Data Formats – Shape DataData Formats – Shape Data

► The .shp file contains all the geometry for The .shp file contains all the geometry for objects that are going to be placed on the map.objects that are going to be placed on the map.

► The Shape file specification doesn’t specify or The Shape file specification doesn’t specify or limit the coordinate system used for the limit the coordinate system used for the geometries in the filegeometries in the file

► To be used by OpenMap the shape files should To be used by OpenMap the shape files should have their geometries defined in decimal have their geometries defined in decimal degree latitude/longitude data.degree latitude/longitude data.

► There’re several solutions for using shape files:There’re several solutions for using shape files: When we are interested in the contents of the .dbfWhen we are interested in the contents of the .dbf When we handle the attributes uniformlyWhen we handle the attributes uniformly

Page 37: OpenMap Toolkit

Data Formats – Shape DataData Formats – Shape DataUniform attributesUniform attributes

►ShapeLayerShapeLayer Suits for displaying large Shape files that are Suits for displaying large Shape files that are

available on the local machine, when you simply available on the local machine, when you simply want to display the data. want to display the data.

Renders all of the OMGraphics in the same wayRenders all of the OMGraphics in the same way. . Creates a spatial index file that enables it to use Creates a spatial index file that enables it to use

the current map projection to display only the the current map projection to display only the geometries on the map. Whenever the geometries on the map. Whenever the projection changes, this layer recalculates what projection changes, this layer recalculates what geometries are needed, and re-reads those geometries are needed, and re-reads those geometries from the data file. geometries from the data file.

More I/O intensity vs. less memory consumption.More I/O intensity vs. less memory consumption.

Page 38: OpenMap Toolkit

Data Formats – Shape DataData Formats – Shape DataUniform attributesUniform attributes

►BufferedShapeLayer BufferedShapeLayer Extends the ShapeLayerExtends the ShapeLayer Simply reads the entire contents of the Simply reads the entire contents of the

Shape file at once and holds on to the Shape file at once and holds on to the OMGraphics created for the geometries. OMGraphics created for the geometries. These OMGraphics are simply regenerated These OMGraphics are simply regenerated when the projection changes. when the projection changes.

Less I/O intensity vs. more memory Less I/O intensity vs. more memory consumption.consumption.

Page 39: OpenMap Toolkit

Data Formats – Shape DataData Formats – Shape DataAttributes DBAttributes DB

► AreaShapeLayerAreaShapeLayer Renders a geometry in a shape file differently Renders a geometry in a shape file differently

depending on the contents of the dbf file. depending on the contents of the dbf file. The properties for the file can be set to render different The properties for the file can be set to render different

types of geometries in a specific way, where a particular types of geometries in a specific way, where a particular attribute field in the database file is used as a key to attribute field in the database file is used as a key to determine how each geometry should be rendered. determine how each geometry should be rendered.

Can respond to mouse events to provide more Can respond to mouse events to provide more information about individual geometries on the map, information about individual geometries on the map, displaying name information of objects through the displaying name information of objects through the InformationDelegator.InformationDelegator.

Holds all of the attribute information in memory while Holds all of the attribute information in memory while managing the OMGraphics for the geometries in the managing the OMGraphics for the geometries in the standard ShapeLayer manner.standard ShapeLayer manner.

Page 40: OpenMap Toolkit

Data Formats – Shape DataData Formats – Shape DataAttributes DBAttributes DB

► EsriPlugIn EsriPlugIn Uses classes in the dataAccess.shape package to Uses classes in the dataAccess.shape package to

read and write shape files. read and write shape files. Reads the .shp and .dbf files, and can display the Reads the .shp and .dbf files, and can display the

dbf file contents in a table available via the dbf file contents in a table available via the layer’s palette. Clicking on the dbf table entry layer’s palette. Clicking on the dbf table entry causes the map object to highlight, and clicking causes the map object to highlight, and clicking on a map object highlights the table entry. on a map object highlights the table entry.

Individual geometries can be set to rendered Individual geometries can be set to rendered differently at runtime, although those new differently at runtime, although those new rendering settings can’t be saved between rendering settings can’t be saved between application sessions. application sessions.

More memory consumption vs. less intensive I/O More memory consumption vs. less intensive I/O and the ability to query the dbf file contentsand the ability to query the dbf file contents..

Page 41: OpenMap Toolkit

OpenMap ToolkitOpenMap Toolkit

Map Container ArchitectureMap Container Architecture

Page 42: OpenMap Toolkit

Map Container ArchitectureMap Container Architecture

►MapBean is a main container of the maps. contains a com.bbn.openmap.proj.Projection

object that defines the geographic positioning of the map represented by the MapBean

Projection is defined by a combination of the projection type, the latitude/longitude of the center of the window, a scale factor for the projection, and the pixel height and width of the window.

Whenever a Projection object changes on a MapBean, it sends out an event ProjectionEvent to its listeners

Page 43: OpenMap Toolkit

Map Container ArchitectureMap Container Architecture

►MapBean contains Layers the rendering of Layers onto the map is controlled

by the Java component rendering mechanism. This mechanism controls how layered components are painted on top of each other. In addition to making sure that each component gets painted into the window in the proper order, the Component class also includes a method that allows it to tell the rendering mechanism that it would like to be painted. It is this feature that allows Layers to work independently from each other, and lets the MapBean avoid knowing what is happening on the Layers.

Page 44: OpenMap Toolkit

Map Container ArchitectureMap Container Architecture

►Layers are ProjectionListeners - when added to

the MapBean they receive a ProjectionEvent whenever the map is panned, zoomed, or resized.

Layer’s main responsibility is to be ready to render its contribution to the map whenever its paint() method is called, and if the projection dictates what it draws, it must only render to the map in its paint() method when it is ready.

Page 45: OpenMap Toolkit

Map Container ArchitectureMap Container Architecture

►The MapHandler is a heart of OpenMap application is Java BeanContext, which can be thought of as

a big bucket that can have objects added to or removed from it.

sends events to listeners when its object membership changes (MembershipListeners can use the events to set up or sever connections with the objects being added or removed).

keeps track of SoloMapComponents - objects that are supposed to be an only instance of a component type in the BeanContext at a time.

Page 46: OpenMap Toolkit

Map Container ArchitectureMap Container Architecture

►MapHandler can be thought of as a map, complete with the

MapBean, Layers, and other management components that are contained within it

can be used by those components that need to get a handle to other objects and services

can be used to add or remove components to the application, at runtime, and all the other objects added to the MapHandler get notified of the addition/removal automatically

Page 47: OpenMap Toolkit

Map Container ArchitectureMap Container Architecture

►LayerHandler manages layers – both those visible on

the map, and those available for the map. uses the Layer.isVisible() attribute to

decide which layers are active on the map Has methods to change the visibility of

layers, add layers, remove layers, and change their order

sends out events notifying listeners when the list of available layers has changed.

Page 48: OpenMap Toolkit

Map Container ArchitectureMap Container ArchitectureInteraction with UserInteraction with User

► MouseEvents event objects that are generated when mouse actions are

made over a Java component visible in a window describe what kind of action took place

►Move►Click► Release►Drag► etc

The OpenMap architecture supports the management of the distribution of these events, directing them to components in the application

Layers and other tool components can use these events to interpret and respond to user gestures over the map, displaying more information about map features, modifying the location of the features, or configuring tools for analysis queries

Page 49: OpenMap Toolkit

Map Container ArchitectureMap Container ArchitectureInteraction with UserInteraction with User

►MapMouseModes describe how MouseEvents and

MouseMotionEvents are interpreted and consumed

►Layers can use MapMouseListeners to subscribe to receive events from particular MapMouseModes, it is possible to add some control over the

conditions for which layers respond to MouseEvents at any given time

Page 50: OpenMap Toolkit

Map Container ArchitectureMap Container ArchitectureInteraction with UserInteraction with User

►MouseDelegator manages a list of MouseModes knows which one is 'active' at any given time listens for events from the MapBean, which

tell it which layers have been added to the map. When it gets that list of layers, the MouseDelegator asks each layer for their MapMouseListener, and adds those MapMouseListeners to theMapMouseModes

Page 51: OpenMap Toolkit

Map Container ArchitectureMap Container ArchitectureInteraction with UserInteraction with User

► MouseEvent gets fired the active MapMouseMode, which starts providing the MouseEvent to its MapMouseListeners.

► Each listener is given the chance to consume the event.

► A MapMouseListener is free to act on an event and not consume it, so that it can continue to be passed on to other listeners.

► The MapMouseListeners from the layers on top of the map are given a change to consume the MouseEvent before those on the bottom part of the map.

► MapMouseListener provides a String array of all the MouseMode ID strings it is

interested in receiving events from has its own methods that the MouseEvents and

MouseMotionEvents arrive in. can use these events to find out if events have occurred over

any map features, and respond if necessary.