org.geotools.swt
Class SwtMapFrame

Object
  extended by Window
      extended by ApplicationWindow
          extended by SwtMapFrame
All Implemented Interfaces:
IRunnableContext, IShellProvider

public class SwtMapFrame
extends ApplicationWindow

An SWT frame containing a map display pane and a toolbar, status bar and map layer table.

Author:
Michael Bedward, Andrea Antonello (www.hydrologis.com)

Nested Class Summary
static class SwtMapFrame.Tool
          Constants for available toolbar buttons used with the enableTool(org.geotools.swt.SwtMapFrame.Tool...) method.
 
Nested classes/interfaces inherited from class Window
Window.IExceptionHandler
 
Field Summary
 
Fields inherited from class ApplicationWindow
seperator1
 
Fields inherited from class Window
CANCEL, OK
 
Constructor Summary
SwtMapFrame(boolean showMenu, boolean showToolBar, boolean showStatusBar, boolean showLayerTable)
          Default constructor.
SwtMapFrame(boolean showMenu, boolean showToolBar, boolean showStatusBar, boolean showLayerTable, MapContent content)
          Constructs a new JMapFrame object with specified context and a default renderer (an instance of StreamingRenderer).
SwtMapFrame(boolean showMenu, boolean showToolBar, boolean showStatusBar, boolean showLayerTable, MapContent content, GTRenderer renderer)
          Constructs a new JMapFrame object with specified context and renderer
 
Method Summary
protected  Control createContents(Composite parent)
           
protected  MenuManager createMenuManager()
           
protected  ToolBarManager createToolBarManager(int style)
           
 void enableTool(SwtMapFrame.Tool... tool)
          This method is an alternative to #enableToolBar(boolean).
 MapContent getMapContent()
          Get the map context associated with this frame.
 SwtMapPane getMapPane()
          Provides access to the instance of JMapPane being used by this frame.
 GTRenderer getRenderer()
          Get the renderer being used by this frame.
 void setMapContent(MapContent content)
          Set the MapContent object used by this frame.
 void setRenderer(GTRenderer renderer)
          Set the renderer to be used by this frame.
static void showMap(MapContent content)
          Creates a new JMapFrame object with a toolbar, map pane and status bar; sets the supplied MapContent; and displays the frame on the AWT event dispatching thread.
 
Methods inherited from class ApplicationWindow
addCoolBar, addMenuBar, addStatusLine, addToolBar, canHandleShellCloseEvent, close, configureShell, coolBarChildrenExist, createCoolBarControl, createCoolBarManager, createCoolBarManager2, createStatusLine, createStatusLineManager, createToolBarControl, createToolBarManager2, createTrimWidgets, getCoolBarControl, getCoolBarManager, getCoolBarManager2, getFont, getLayout, getMenuBarManager, getSeperator1, getStatusLineManager, getSymbolicFontName, getToolBarControl, getToolBarManager, getToolBarManager2, run, setStatus, showTopSeperator, toolBarChildrenExist
 
Methods inherited from class Window
constrainShellSize, create, createShell, getConstrainedShellBounds, getContents, getDefaultImage, getDefaultImages, getDefaultOrientation, getInitialLocation, getInitialSize, getParentShell, getReturnCode, getShell, getShellListener, getShellStyle, getWindowManager, handleFontChange, handleShellCloseEvent, initializeBounds, open, setBlockOnOpen, setDefaultImage, setDefaultImages, setDefaultModalParent, setDefaultOrientation, setExceptionHandler, setParentShell, setReturnCode, setShellStyle, setWindowManager
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SwtMapFrame

public SwtMapFrame(boolean showMenu,
                   boolean showToolBar,
                   boolean showStatusBar,
                   boolean showLayerTable)
Default constructor. Creates a JMapFrame with no context or renderer set


SwtMapFrame

public SwtMapFrame(boolean showMenu,
                   boolean showToolBar,
                   boolean showStatusBar,
                   boolean showLayerTable,
                   MapContent content)
Constructs a new JMapFrame object with specified context and a default renderer (an instance of StreamingRenderer).

Parameters:
showLayerTable -
showStatusBar -
content - the map context with layers to be displayed

SwtMapFrame

public SwtMapFrame(boolean showMenu,
                   boolean showToolBar,
                   boolean showStatusBar,
                   boolean showLayerTable,
                   MapContent content,
                   GTRenderer renderer)
Constructs a new JMapFrame object with specified context and renderer

Parameters:
showLayerTable -
showStatusBar -
context - the map context with layers to be displayed
renderer - the renderer to be used
Method Detail

showMap

public static void showMap(MapContent content)
Creates a new JMapFrame object with a toolbar, map pane and status bar; sets the supplied MapContent; and displays the frame on the AWT event dispatching thread. The context's title is used as the frame's title.

Parameters:
content - the map context containing the layers to display

enableTool

public void enableTool(SwtMapFrame.Tool... tool)
This method is an alternative to #enableToolBar(boolean). It requests that a tool bar be created with specific tools, identified by SwtMapFrame.Tool constants.
 myMapFrame.enableTool(Tool.PAN, Tool.ZOOM);
 

Parameters:
tool - one or more SwtMapFrame.Tool constants

createContents

protected Control createContents(Composite parent)
Overrides:
createContents in class Window

createToolBarManager

protected ToolBarManager createToolBarManager(int style)
Overrides:
createToolBarManager in class ApplicationWindow

createMenuManager

protected MenuManager createMenuManager()
Overrides:
createMenuManager in class ApplicationWindow

getMapContent

public MapContent getMapContent()
Get the map context associated with this frame. Returns null if no map context has been set explicitly with the constructor or setMapContent(org.geotools.map.MapContent).

Returns:
the current MapContent object

setMapContent

public void setMapContent(MapContent content)
Set the MapContent object used by this frame.

Parameters:
content - a MapContent instance
Throws:
IllegalArgumentException - if context is null

getRenderer

public GTRenderer getRenderer()
Get the renderer being used by this frame. Returns null if no renderer was set via the constructor or setRenderer(org.geotools.renderer.GTRenderer).

Returns:
the current GTRenderer object

setRenderer

public void setRenderer(GTRenderer renderer)
Set the renderer to be used by this frame.

Parameters:
renderer - a GTRenderer instance
Throws:
IllegalArgumentException - if renderer is null

getMapPane

public SwtMapPane getMapPane()
Provides access to the instance of JMapPane being used by this frame.

Returns:
the JMapPane object


Copyright © 1996-2014 Geotools. All Rights Reserved.