📄 openmap-arch.sgml
字号:
</#if><p>The ToolPanel is a Component that looks for components implementingthe <htmlurl url="api/com/bbn/openmap/gui/Tool.html" name="Tool">interface. It provides a quick interface to make tools and controlsvisible and accessable.<p>Some of the components available are pictured above, and explainedbelow:<p><itemize><item><sect2>OMToolSet<label id="sec-toolpanel"><p>The <htmlurl url="./api/com/bbn/openmap/gui/OMToolSet.html"name="OMToolSet"> is a composite GUI JavaBean, set up to control theview and mouse modes of the MapBean. Any one of its parts may behidden from view by adjusting its properties:<itemize><item>Directional control. Made from the <htmlurlurl="./api/com/bbn/openmap/gui/NavigatePanel.html"name="NavigatePanel"> Bean. This lets you pan the screen in thedirection of the button that is pressed.<item>Zoom buttons. Made from the <htmlurlurl="./api/com/bbn/openmap/gui/ZoomPanel.html" name="ZoomPanel">.This panel has two buttons - the plus (+) button zooms in (increasesscale by 2X), and the minus (-) button zooms out (decreases scale by2X).<item>Scale field window. This shows the current scale setting (1:scale),and also lets you enter a desired scale directly.</itemize><item>LayersPanel launch button. The LayersPanel is explained <ref id="sec-layerspanel" name="here">.<item>Drawing Tool Launcher. The <htmlurlurl="api/com/bbn/openmap/tools/drawing/package-summary.html"name="Drawing Tool"> lets the users draw different graphics on themap, and direct those graphics to layers or components that can usethem. It uses the MapHandler to find these components.<item>OverviewMapHandler. The <htmlurlurl="api/com/bbn/openmap/gui/OverviewMapHandler.html"name="OverviewMapHandler"> is a self-contained MapBean that provides areference view of a source MapBean, and also provides control over theMapBean.<item>MouseMode Selector. The <htmlurlurl="api/com/bbn/openmap/gui/MouseModePanel.html"name="MouseModePanel"> provides a way to control the <htmlurlurl="api/com/bbn/openmap/MouseDelegator.html" name="MouseDelegator">,choosing the active <htmlurlurl="api/com/bbn/openmap/event/MapMouseMode.html"name="MapMouseMode">.<item><htmlurl url="api/com/bbn/openmap/gui/ProjectionStackTool.html"name="Projection Stack buttons">. The <htmlurlurl="api/com/bbn/openmap/proj/ProjectionStack.html"name="ProjectionStack"> remembers past map projections and lets theuser go back to preious projections. It also lets the user go forwardagain.</itemize><sect2>InformationDelegator<label id="sec-infodelegator"><p><#if output=html><IMG SRC="images/whopanel.png"></#if>The <htmlurl url="./api/com/bbn/openmap/InformationDelegator.html"name="InformationDelegator"> is a JavaBean used for status updates andmessages. The <bf><ref id="sec-navmousemode"name="NavMouseMode"></bf> uses the InformationDelegator to display thelatitude, longitude, and XY pixel location of the cursor on theMapBean window. Layers can use the InformationDelegator to displayone-liners, pop-up messages, and web pages. The colored lights at theright of the widget reflect whether particular layers are working(red) or are finished (green). The lights are buttons that launch thepalette for the layer it represents.<sect2>LayersPanel<label id="sec-layerspanel"><p><#if output=html><IMG SRC="images/layers-window.png"></#if><P>The <htmlurl url="./api/com/bbn/openmap/gui/LayersPanel.html"name="LayersPanel"> is used to manage the display and order of thelayers in the MapBean. This panel also lets you bring up and dismissthe GUI controls for a layer, called layer palettes. Some of thebuttons act on a `selected' layer. Click on the layer name to selectit.<itemize><item><#if output=html><IMG SRC="images/top.png"></#if>Move the selected layer to the top of the map.<item><#if output=html><IMG SRC="images/up.png"></#if>The selected layer exchanges position with the one above it.<item><#if output=html><IMG SRC="images/down.png"></#if>The selected layer exchanges position with the one below it.<item><#if output=html><IMG SRC="images/bottom.png"></#if>Move the selected layer to the bottom of the map.<item><#if output=html><IMG SRC="images/DeleteLayer.png"></#if>Delete the selected layer from the application.<item><#if output=html><IMG SRC="images/AddLayer.png"></#if>Add a layer to the application.<item><#if output=html><IMG SRC="images/layerNotSelected.png"></#if>Click this to add the layer to the map.<item><#if output=html><IMG SRC="images/layerSelected.png"></#if>Click this to remove the layer from the map.<item><#if output=html><IMG SRC="images/palette_off.png"></#if>The GUI palette for the layer is not active. Click this to displayit.<item><#if output=html><IMG SRC="images/palette_on.png"></#if>The GUI palette for the layer is active.</itemize><!-- Layers and PlugIn Section --><sect>Layers and PlugIns<label id="sec-layers"><p><htmlurl url="./api/com/bbn/openmap/Layer.html" name="Layers"> arecomponents that get added to the MapBean in a hierarchical stackingorder. The map is drawn by painting the graphics of each layerstarting with the bottommost one and proceeding up the hierarchy.Successive layers render their graphics on top of the graphics oflower ones.<p><htmlurl url="./api/com/bbn/openmap/plugin/package-summary.html"name="PlugIns"> are components that are used by the PlugInLayer tofetch data and prepare graphics for the map.<p>Layers and PlugIns are responsible for aquiring, constructing, and rendering theirown graphical data. The <bf><ref id="sec-omgraphics"name="OMGraphics"></bf> package provides a simple way to constructvector and raster graphics out of geo-spatial and XY data.<p>They can also be interactive, by registering for mouse events andconstructing their very own GUI widget controls.<p>When a layer is added to the MapBean, it automatically becomes a<htmlurl url="api/com/bbn/openmap/event/ProjectionListener.html"name="ProjectionListener"> of the MapBean. This means that the layerreceives notification when the <bf><ref id="sec-projection"name="Projection"></bf> (or view) of the map changes.<p>To reiterate, the standard capabilities of a Layer are:<itemize><item>Create, manage, and render graphical objects. <item>Receive and respond to mouse events over the map.<item>Create GUI controls for additional configuration.</itemize><sect1>ShapeLayer<label id="sec-shapelayer"><p>This is a generic layer for displaying data in <htmlurlurl="http://www.esri.com/" name="ESRI"> shapefile format. See the<htmlurl url="api/com/bbn/openmap/layer/shape/ShapeLayer.html"name="ShapeLayer"> class.<sect1>ShapePlugIn<label id="sec-shapeplugin"><p>A different component for handling Shape data is in the <htmlurl url="api/com/bbn/openmap/plugin/esri/package-summary.html"name="esri plugin"> package.<sect1>VPFLayer<label id="sec-vpflayer"><p>This is a generic layer for displaying <htmlurlurl="http://www.nima.mil/" name="NIMA"> VPF data. See the <htmlurlurl="api/com/bbn/openmap/layer/vpf/VPFLayer.html" name="VPFLayer">class.<sect1>EarthquakeLayer<label id="sec-earthquakelayer"><p>The <htmlurl url="api/com/bbn/openmap/layer/EarthquakeLayer.html"name="EarthquakeLayer"> displays data of recent earthquake activity.It gets its data by querying live data feeds at the <htmlurlurl="http://www.usgs.gov/" name="USGS">.<sect1>Raster Layers<label id="sec-raster-layers"><p><itemize><item><htmlurl url="./api/com/bbn/openmap/layer/rpf/RpfLayer.html"name="Raster Product Format (RPF) Layer">, which displays <htmlurlurl="http://www.nima.mil/" name="NIMA's"> CADRG and CIB data.<item><htmlurl url="./api/com/bbn/openmap/layer/dted/DTEDLayer.html"name="DTED Layer">, which displays NIMA's Digital Terrain ElevationData.</itemize><sect1>Writing your own Layer or PlugIn<label id="sec-write-your-own-layer"><p>To write your own layer, you need to extend the <htmlurlurl="api/com/bbn/openmap/Layer.html" name="Layer"> class. The minimumrequirement is that you override the <tt/projectionChanged()/ and<tt/paint()/ methods. This former method is invoked when your layeris part of the MapBean and the view changes (e.g., when someonerecenters the map). It is up to you to fetch and prepare yourgraphics (or maybe do something else), and then <tt/repaint()/yourself. The easiest way to write your own layer is to derive itfrom another one already cooked up. For some simple examples see the<htmlurl url="api/com/bbn/openmap/layer/GraticuleLayer.html"name="GraticuleLayer"> and <htmlurlurl="api/com/bbn/openmap/layer/test/TestLayer.html" name="TestLayer">classes.<P>Many layers get their data from the local disk or cdrom of the machinethat they run on, but there are others that query remote sites on theInternet. The <bf><ref id="sec-earthquakelayer" name="EarthquakeLayer"></bf> is a good example of live layer.<p>To write your own PlugIn, you can extend the <htmlurlurl="api/com/bbn/openmap/plugin/AbstractPlugIn.html"name="AbstractPlugIn"> class, which implements the <htmlurlurl="api/com/bbn/openmap/plugin/AbstractPlugIn.html"name="PlugIn"> interface. You only have to implement <tt/thegetRectangle()/ method, which returns an <htmlurlurl="api/com/bbn/openmap/omGraphics/OMGraphicList.html"name="OMGraphicList"> to the PlugInLayer. PlugIns can also receiveMouseEvents and create a GUI palette, just like layers. The advantageto creating a PlugIn is that you don't have to deal with the <refid="sec-swingworker" name="Swing Worker"> which should be used bylayers to kick off another thread to do their work, in order not toslow the application down. The PlugInLayer does this for the PlugIn.<sect2>OMGraphics<label id="sec-omgraphics"><p><htmlurl url="./api/com/bbn/openmap/omGraphics/package-tree.html"name="OMGraphics"> help you to turn your vector or raster data intointeractive graphics that can be rendered on the map canvas.Each OMGraphic provides a simple interface to manage projecting,rendering, and gesturing.<p>In general, there are three steps needed to get your data to appear onthe screen. The OMGraphic needs to be created. Then call<tt/generate()/ on the OMGraphic with the current <bf><refid="sec-projection" name="Projection"></bf> to prepare for rendering.Then call <tt/render()/ on the OMGraphic with the java.awt.Graphicscontext. This final step is usually performed when the <tt/paint()/method is invoked on your layer. To trigger the AWT painting, call<tt/repaint()/, instead of <tt/paint()/ directly. Note that even ifthe graphic is already in XY, it still needs to be `generated' beforeit is `rendered', or it will not show up on the map.<P><itemize><item>Vector graphics <itemize> <item><htmlurl url="./api/com/bbn/openmap/omGraphics/OMCircle.html" name="Circle"> <item><htmlurl url="./api/com/bbn/openmap/omGraphics/OMLine.html" name="Line"> <item><htmlurl url="./api/com/bbn/openmap/omGraphics/OMPoly.html" name="Polygon and Polyline"> <item><htmlurl url="./api/com/bbn/openmap/omGraphics/OMRect.html" name="Rectangle"> </itemize><item>Raster Graphics <itemize> <item><htmlurl url="./api/com/bbn/openmap/omGraphics/OMBitmap.html" name="Bitmap"> <item><htmlurl url="./api/com/bbn/openmap/omGraphics/OMRaster.html" name="Raster (image)"> </itemize><item>Other <itemize> <item><htmlurl url="./api/com/bbn/openmap/omGraphics/OMGraphic.html" name="Parent Graphic"> <item><htmlurl url="./api/com/bbn/openmap/omGraphics/OMText.html" name="Text"> <item><htmlurl url="./api/com/bbn/openmap/omGraphics/OMGraphicList.html" name="Graphic List"> </itemize></itemize><p>The <htmlurl url="./api/com/bbn/openmap/omGraphics/OMGraphicList.html"name="OMGraphicList"> is a unique OMGraphic: it can be used to managea vector of OMGraphics. It can also contain other OMGraphicLists, soyou can create nested groupings of graphics.<p>And of course you can extend any of the OMGraphic classes to createyour own specific graphic or extended functionality.<sect2>Layer GUI Palettes<P>Palettes are layer-specific GUI components that provide another meansto configure and interact with the layer. The Layer interfaceprovides a <tt/getGUI()/ method which can be used by the layer toreturn its GUI. The OpenMap Viewer application presents a layer'spalette in an InternalFrame. This is accessible from the <refid="sec-layerspanel" name="LayersPanel"> component.<sect2>Multi-threading and the SwingWorker<label id="sec-multithreading"><p>When developing your own layer you should be aware of how it couldpotentially affect the overall performance of OpenMap. Specifically,a layer should not block too long on <tt/paint()/,<tt/projectionChanged()/, or other interface methods. If, forinstance, your layer needs to do a lot of computation each time<tt/projectionChanged()/ is invoked, then you should consider spawninga thread to do the work. This way you won't block the propagation of<tt/projectionChanged()/ to other layers and components. Since alllayers are Swing components, they can call <tt/repaint()/ anytime whenthey've got something new to show. So once your thread finishes doingwork, and you've got new data, you can initiate a <tt/repaint()/.<P><label id="sec-swingworker">The <htmlurl url="./api/com/bbn/openmap/util/SwingWorker.html"name="SwingWorker"> is a class which supports spawning and managingworker threads; Sun has a <htmlurlurl="http://java.sun.com/docs/books/tutorial/ui/swingMisc/threads.html#SwingWorker"name="tutorial"> on the SwingWorker. Several of our main Layers usethis service, including the <bf><ref id="sec-shapelayer"name="ShapeLayer"></bf>.<!-- --><sect>Projection<label id="sec-projection"><p>The <htmlurl url="api/com/bbn/openmap/proj/Projection.html"name="Projection"> interface allows you read-only access to thecurrent MapBean projection. The MapBean updates all the Layers andother <htmlurlurl="./api/com/bbn/openmap/event/ProjectionListener.html"name="ProjectionListeners"> when the view changes.<p>A Projection object is defined with:<itemize><item>Latitude and longitude of the center point of the MapBean canvas<item>Scale,<item>Height and width of the MapBean canvas<item>Projection type (Mercator, Orthographic, etc)</itemize></article>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -