com.partnersoft.maps.render
Class SelectionDrawingSurface

java.lang.Object
  extended by com.partnersoft.maps.render.AbstractDrawingSurface
      extended by com.partnersoft.maps.render.SelectionDrawingSurface
All Implemented Interfaces:
DrawingSurface

public class SelectionDrawingSurface
extends AbstractDrawingSurface

This is the drawing surface used to determine selection hits (e.g from mouse clicks).

This surface should be created fresh for every selection operation, and its frame should be set such that it forms the bounding box for the selection region desired.

A little history: initial implementations used two different methods for Java2D and OpenGL. The specifics were stored in Java2DDrawingSurface and OpenGLDrawingSurface, respectively, and selection was essentially treated as a special case of regular drawing for those classes (which is the case in OpenGL selection anyway). Unfortunately there were performance and useability problems; having two different selection models made the modes behave differently, and speeding up OpenGL selection would have required more active culling. Also, the selection code was mixed in with drawing code, making implementations more complex than necessary.

Russell rewrote this while optimizing performance of OpenGL, especially selection, in version 4.2. Paul refactored further during 4.3 development, removing all selection code from the other classes.

Copyright 2006-2008 Partner Software, Inc.

Version:
$Id: SelectionDrawingSurface.java 2328 2010-01-06 15:38:22Z paul $
Author:
Russell Cagle, Paul Reavis

Field Summary
 
Fields inherited from class com.partnersoft.maps.render.AbstractDrawingSurface
backgroundColor, currentImageStyle, currentMapSet, currentPointStyle, currentPolygonStyle, currentPolylineStyle, currentTextStyle, foregroundColor, invisiblePolylineStyle, printing, renderImageStyle, renderMode, renderPointStyle, renderPolygonStyle, renderPolylineStyle, renderQuality, renderTextStyle, showInvisibleGraphics
 
Fields inherited from interface com.partnersoft.maps.render.DrawingSurface
QUALITY_GOOD, QUALITY_OK, QUALITY_POOR, RENDER_EPHEMERA, RENDER_INDICATION, RENDER_RASTER, RENDER_RETICLE, RENDER_SELECTION, RENDER_VECTOR
 
Constructor Summary
SelectionDrawingSurface(MapViewFrame frame)
           
 
Method Summary
 void clear()
           
 void drawImage(int dataID, double x, double y, int offsetX, int offsetY, int rotation, ImageSource image, double scale, int pixelsWide, int pixelsHigh)
           
 void drawPoint(int dataID, double x, double y, int offsetX, int offsetY, int rotation)
           
 void drawPolygon(int dataID, DoubleBuffer coords)
           
 void drawPolygon(int dataID, DynamicDoubleArray coords)
           
 void drawPolyline(int dataID, DoubleBuffer coords)
           
 void drawRasterImage(RasterImage image)
           
 void drawText(int dataID, double x, double y, int offsetX, int offsetY, int rotation, int alignment, java.lang.String text)
           
 void drawWheelMenu(WheelMenu menu)
           
 void drawWheelMenuCenter(WheelMenu menu)
           
 void endTile()
           
 int[][] getSelections()
           
 boolean isDirty()
           
 void popName()
           
 void pushName(int i)
           
 void setTextStyle(int style)
           
 void startDrawing()
           
 void startTile(RoverBytes bytes)
          Sets up the transformations for the coordinates that are coming in.
 void stopDrawing()
           
 
Methods inherited from class com.partnersoft.maps.render.AbstractDrawingSurface
copyBackBuffer, displayListFor, displayListFor, drawDisplayList, drawLiteralPoints, drawPolyline, drawPolyline, endDisplayList, isBackBufferSupported, isDisplayListSupported, isDrawingToBackBuffer, popState, pushState, removeDisplayList, setBackgroundColor, setDrawingToBackBuffer, setForegroundColor, setFrame, setImageStyle, setImageStyle, setImageStyle, setMapSet, setPointStyle, setPointStyle, setPointStyle, setPolygonStyle, setPolygonStyle, setPolygonStyle, setPolylineStyle, setPolylineStyle, setPolylineStyle, setPrinting, setRenderMode, setRenderQuality, setRenderScaleRegion, setShowInvisibleGraphics, setTextStyle, setTextStyle, startDisplayList, startDisplayList
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SelectionDrawingSurface

public SelectionDrawingSurface(MapViewFrame frame)
Method Detail

drawPolygon

public void drawPolygon(int dataID,
                        DoubleBuffer coords)
Specified by:
drawPolygon in interface DrawingSurface
Overrides:
drawPolygon in class AbstractDrawingSurface

startDrawing

public void startDrawing()
Specified by:
startDrawing in interface DrawingSurface
Specified by:
startDrawing in class AbstractDrawingSurface

stopDrawing

public void stopDrawing()
Specified by:
stopDrawing in interface DrawingSurface
Specified by:
stopDrawing in class AbstractDrawingSurface

isDirty

public boolean isDirty()

startTile

public void startTile(RoverBytes bytes)
Description copied from interface: DrawingSurface
Sets up the transformations for the coordinates that are coming in.

Parameters:
bytes - everything we need to set up our transformation.

endTile

public void endTile()

clear

public void clear()

setTextStyle

public void setTextStyle(int style)
Specified by:
setTextStyle in interface DrawingSurface
Overrides:
setTextStyle in class AbstractDrawingSurface

drawImage

public void drawImage(int dataID,
                      double x,
                      double y,
                      int offsetX,
                      int offsetY,
                      int rotation,
                      ImageSource image,
                      double scale,
                      int pixelsWide,
                      int pixelsHigh)

drawPolyline

public void drawPolyline(int dataID,
                         DoubleBuffer coords)
Specified by:
drawPolyline in interface DrawingSurface
Specified by:
drawPolyline in class AbstractDrawingSurface

drawPoint

public void drawPoint(int dataID,
                      double x,
                      double y,
                      int offsetX,
                      int offsetY,
                      int rotation)
Specified by:
drawPoint in interface DrawingSurface
Specified by:
drawPoint in class AbstractDrawingSurface

drawText

public void drawText(int dataID,
                     double x,
                     double y,
                     int offsetX,
                     int offsetY,
                     int rotation,
                     int alignment,
                     java.lang.String text)
Specified by:
drawText in interface DrawingSurface
Specified by:
drawText in class AbstractDrawingSurface

drawRasterImage

public void drawRasterImage(RasterImage image)

pushName

public void pushName(int i)

popName

public void popName()

getSelections

public int[][] getSelections()

drawWheelMenuCenter

public void drawWheelMenuCenter(WheelMenu menu)

drawWheelMenu

public void drawWheelMenu(WheelMenu menu)

drawPolygon

public void drawPolygon(int dataID,
                        DynamicDoubleArray coords)
Specified by:
drawPolygon in interface DrawingSurface
Specified by:
drawPolygon in class AbstractDrawingSurface