S-PLUS Connect/Java v1.0

com.insightful.gdevice
Class SCanvasAWT

java.lang.Object
  extended bycom.insightful.gdevice.SCanvasAWT
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SCanvas

public class SCanvasAWT
extends Object
implements Serializable

An SCanvasAWT object saves and draws S-PLUS graphics commands. It implements only pre-Swing functionality.

See Also:
Serialized Form

Field Summary
protected  Color m_bgColor
           
protected  int m_bgColorA
           
protected  int m_bgColorB
           
protected  int m_bgColorG
           
protected  int m_bgColorR
           
protected  int m_clearCount
          The number of clears performed on this canvas.
protected  boolean m_hasEmbeddedFileData
           
protected  String m_tag
          Tag string for canvas page, or XML with tag and other elements
protected  String m_title
          Title of canvas page.
static int SPLUS_DISPLAY_HEIGHT
          S-PLUS graphsheet height.
static int SPLUS_DISPLAY_WIDTH
          S-PLUS graphsheet width.
 
Constructor Summary
SCanvasAWT()
          Constructs an SCanvasAWT object.
 
Method Summary
 void add(com.insightful.gdevice.SGraphCommand cmd)
          Adds an SGraphCommand to this SCanvas.
 void add(Vector vec)
          Adds a set of SGraphCommand objects to this SCanvas.
 void clear()
          Clears this SCanvas.
 void clearBackgroundRGBA()
           
 void clearEmbeddedFileData()
           
static SCanvasAWT createErrorCanvas(String errorString)
           
static SCanvasAWT createFromXML(XMLElement elt, IDHash idHash)
           
 SCanvas createSCanvas()
          Create an SCanvas with the same properties as this SCanvasAWT.
 SCanvasAWT createSCanvasAWT()
           
 Color getAltBackgroundColor()
           
 ColorScheme getAltColorScheme()
           
 Color getBackgroundColor()
          Returns the current background color.
 Dimension getBestFitSize(Dimension maxSize)
           
 int getClearCount()
          Gets the number of clears done on this canvas.
 boolean getClipIdentify()
           
 ColorScheme getColorScheme()
          Returns the color scheme for this SCanvas.
 boolean getDebug()
           
 URL getDocumentBase()
           
 int getHeight()
          Returns the height of the S-PLUS graphsheet being viewed.
 SCanvasHit getHit(int x, int y)
           
 SCanvasHit getHit(Point pt)
           
 Color getImageColor(int index)
          Returns the specified image color from the current color scheme.
 IndexColorModel getImageIndexColorModel()
           
 IndexColorModel getImageIndexColorModel(byte[] r, byte[] g, byte[] b, byte[] a)
           
 boolean getInApplet()
           
 String[] getIntersectingTags(Rectangle rect)
          Returns tags for all active regions the intersect the given rectangle.
 Color getLineColor(com.insightful.gdevice.SGraphCommand cmd)
          Return color for drawing lines, given color int.
static Dimension getMaxFitSize(Dimension userSize, Dimension maxSize)
           
 int getNumberCommands()
          Gets the number of graphics commands in the canvas.
 Color getPaletteColor(com.insightful.gdevice.SGraphCommand cmd)
          Returns the specified palette color from the current color scheme.
 Color getPolygonColor(com.insightful.gdevice.SGraphCommand cmd)
          Return color for drawing polygons, given color int.
 String getPropertyAction()
           
protected  ColorScheme getRendererColorScheme()
           
 String[] getSelectedTagArray()
          returns an array of the selected region tags.
 com.insightful.gdevice.SGraphCommand getSmallestPlotRegionCommand(int x, int y)
          Given mouse coords x,y in the canvas, returns the SGraphCommand with the smallest unique plot region whose plot region contains this point.
 String getTag()
          Returns the tag string, which uniquely identifies the page.
 Color getTextColor(int index)
          old version, used to select color for annotations.
 Color getTextColor(com.insightful.gdevice.SGraphCommand cmd)
          Return color for drawing text, given color int.
 String getTitle()
          Returns the canvas page title.
 Dimension getUserSize()
          Returns the user size.
 SCanvasPoint getValueFromPoint(int x, int y)
          Given mouse coords x,y in the canvas, returns the x,y values of this point in the coordinate system of the SGraphCommand with the smallest plot region that contains this point.
 SCanvasPoint getValueFromPoint(Point pt)
          Given mouse coords x,y in the canvas, returns the x,y values of this point in the coordinate system of the SGraphCommand with the smallest plot region that contains this point.
 SCanvasPoint getValueFromPoint(com.insightful.gdevice.SGraphCommand cmd, int x, int y)
          Given an SGraphCommand and mouse coords x,y in the canvas, returns the x,y values of this point in the coordinate system of that cmd.
 SCanvasPoint getValueFromPoint(com.insightful.gdevice.SGraphCommand cmd, Point pt)
          Given an SGraphCommand and mouse coords x,y in the canvas, returns the x,y values of this point in the coordinate system of that cmd.
 int getWidth()
          Returns the width of the S-PLUS graphsheet being viewed.
 void graphSizeChanged()
          Notifies all graph commands in the canvas that the graph size has changed, and that they might need to recompute cached graphics.
 boolean hasEmbeddedFileData()
           
 boolean isEmpty()
          Returns true if this SCanvas contains no graphics.
 void loadEmbeddedCanvas(SCanvasAWT canvas)
           
 void paint(Graphics g)
          Paints this SCanvas.
 void paint(Graphics g, int canvasCommandsDrawn)
          Paints the commands in this SCanvas, assuming that the first canvasCommandsDrawn graphics commands from the display list have already been drawn.
 void paintSelections(Graphics g, com.insightful.gdevice.TagSet tagset)
          Paints highlights for the active regions in this SCanvasAWT that are selected.
 void print(Graphics g)
          Prints this SCanvas.
 void printString(Graphics g, String txt, int x, int y)
          print string, using pixelation so it works in applet printing.
 void releaseMemory()
           
 void setAltBackgroundColor(Color col)
           
 void setAltColorScheme(ColorScheme cs)
           
 void setBackgroundRGBA(int r, int g, int b, int a)
           
 void setCanvasTagSet(com.insightful.gdevice.TagSet tagSet)
          set TagSet.
 void setClipIdentify(boolean val)
          set/get flag for whether to clip java.identify regions to plot region.
 void setColorScheme(ColorScheme cs)
          Sets the color scheme for this SCanvas.
 void setDebug(boolean val)
          set/get flag for whether to print debugging info.
 void setDocumentBase(URL val)
          set/get documentBase to be used when resolving URLs in embedded images
 void setFromXML(XMLElement elt, IDHash idHash)
           
 void setInApplet(boolean val)
          set/get flag for whether to print applet info.
 void setPropertyAction(String action)
           
 void setSelectedTagArray(String[] tags)
           
 void setSize(int width, int height)
          Sets the width and height of the virtual graphsheet.
 void setTag(String tag)
          Sets the tag string, which uniquely identifies the page.
 void setTitle(String title)
          Sets the canvas page title.
 void setUserSize(Dimension dim)
          Sets the user size.
 boolean usingPDFColorScheme()
           
 void writeXML(PrintWriter out, String colorschemeTag, Vector uniqueRectCmds)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SPLUS_DISPLAY_WIDTH

public static final int SPLUS_DISPLAY_WIDTH
S-PLUS graphsheet width. This is the value as known by the Splus graphics driver; it has little connection to the scaled width displayed in java. This value may be used to determine the aspect ratio that S-PLUS believes it is displaying the graphics.

See Also:
Constant Field Values

SPLUS_DISPLAY_HEIGHT

public static final int SPLUS_DISPLAY_HEIGHT
S-PLUS graphsheet height. This is the value as known by the Splus graphics driver; it has little connection to the scaled width displayed in java. This value may be used to determine the aspect ratio that S-PLUS believes it is displaying the graphics.

See Also:
Constant Field Values

m_title

protected String m_title
Title of canvas page. A value of "#" means to generate a title containing the page number.


m_tag

protected String m_tag
Tag string for canvas page, or XML with tag and other elements


m_clearCount

protected int m_clearCount
The number of clears performed on this canvas.


m_hasEmbeddedFileData

protected transient boolean m_hasEmbeddedFileData

m_bgColorR

protected int m_bgColorR

m_bgColorG

protected int m_bgColorG

m_bgColorB

protected int m_bgColorB

m_bgColorA

protected int m_bgColorA

m_bgColor

protected Color m_bgColor
Constructor Detail

SCanvasAWT

public SCanvasAWT()
Constructs an SCanvasAWT object. (Does nothing.)

Method Detail

getTitle

public String getTitle()
Returns the canvas page title.


setTitle

public void setTitle(String title)
Sets the canvas page title.


getTag

public String getTag()
Returns the tag string, which uniquely identifies the page.


setTag

public void setTag(String tag)
Sets the tag string, which uniquely identifies the page.


isEmpty

public boolean isEmpty()
Returns true if this SCanvas contains no graphics.


setSize

public void setSize(int width,
                    int height)
Sets the width and height of the virtual graphsheet.


graphSizeChanged

public void graphSizeChanged()
Notifies all graph commands in the canvas that the graph size has changed, and that they might need to recompute cached graphics.


getWidth

public int getWidth()
Returns the width of the S-PLUS graphsheet being viewed.


getHeight

public int getHeight()
Returns the height of the S-PLUS graphsheet being viewed.


add

public void add(com.insightful.gdevice.SGraphCommand cmd)
Adds an SGraphCommand to this SCanvas.


add

public void add(Vector vec)
Adds a set of SGraphCommand objects to this SCanvas.

Parameters:
vec - Vector of SGraphCommand objects to add.

getClearCount

public int getClearCount()
Gets the number of clears done on this canvas. This number is used to detect when the canvas needs a complete redisplay after a clear in place.


getNumberCommands

public int getNumberCommands()
Gets the number of graphics commands in the canvas. This number is used to do incremental updating.


clear

public void clear()
Clears this SCanvas.


paint

public void paint(Graphics g)
Paints this SCanvas.

Parameters:
g - the graphics context.

paint

public void paint(Graphics g,
                  int canvasCommandsDrawn)
Paints the commands in this SCanvas, assuming that the first canvasCommandsDrawn graphics commands from the display list have already been drawn. If canvasCommandsDrawn is 0, this method also draws the background.

Parameters:
g - the graphics context.
canvasCommandsDrawn - the number of commands from the display list that have already been painted.

paintSelections

public void paintSelections(Graphics g,
                            com.insightful.gdevice.TagSet tagset)
Paints highlights for the active regions in this SCanvasAWT that are selected.

Parameters:
g - the graphics context.
tagset - list of tags of selected regions.

print

public void print(Graphics g)
Prints this SCanvas.


getColorScheme

public ColorScheme getColorScheme()
Returns the color scheme for this SCanvas.


setColorScheme

public void setColorScheme(ColorScheme cs)
Sets the color scheme for this SCanvas.


getBackgroundColor

public Color getBackgroundColor()
Returns the current background color.


getPaletteColor

public Color getPaletteColor(com.insightful.gdevice.SGraphCommand cmd)
Returns the specified palette color from the current color scheme. The index should be in the same range as for the ColorScheme class's getPaletteColor method.

See Also:
ColorScheme.getPaletteColor(int)

getLineColor

public Color getLineColor(com.insightful.gdevice.SGraphCommand cmd)
Return color for drawing lines, given color int.


getTextColor

public Color getTextColor(com.insightful.gdevice.SGraphCommand cmd)
Return color for drawing text, given color int.


getPolygonColor

public Color getPolygonColor(com.insightful.gdevice.SGraphCommand cmd)
Return color for drawing polygons, given color int.


getTextColor

public Color getTextColor(int index)
old version, used to select color for annotations.


getImageColor

public Color getImageColor(int index)
Returns the specified image color from the current color scheme. The index should be in the same range as for the ColorScheme class's getImageColor method.

See Also:
ColorScheme.getImageColor(int)

getImageIndexColorModel

public IndexColorModel getImageIndexColorModel()

getImageIndexColorModel

public IndexColorModel getImageIndexColorModel(byte[] r,
                                               byte[] g,
                                               byte[] b,
                                               byte[] a)

usingPDFColorScheme

public boolean usingPDFColorScheme()

getAltColorScheme

public ColorScheme getAltColorScheme()

setAltColorScheme

public void setAltColorScheme(ColorScheme cs)

getRendererColorScheme

protected ColorScheme getRendererColorScheme()

getAltBackgroundColor

public Color getAltBackgroundColor()

setAltBackgroundColor

public void setAltBackgroundColor(Color col)

getSmallestPlotRegionCommand

public com.insightful.gdevice.SGraphCommand getSmallestPlotRegionCommand(int x,
                                                                         int y)
Given mouse coords x,y in the canvas, returns the SGraphCommand with the smallest unique plot region whose plot region contains this point.


getValueFromPoint

public SCanvasPoint getValueFromPoint(Point pt)
Given mouse coords x,y in the canvas, returns the x,y values of this point in the coordinate system of the SGraphCommand with the smallest plot region that contains this point.


getValueFromPoint

public SCanvasPoint getValueFromPoint(int x,
                                      int y)
Given mouse coords x,y in the canvas, returns the x,y values of this point in the coordinate system of the SGraphCommand with the smallest plot region that contains this point.


getValueFromPoint

public SCanvasPoint getValueFromPoint(com.insightful.gdevice.SGraphCommand cmd,
                                      Point pt)
Given an SGraphCommand and mouse coords x,y in the canvas, returns the x,y values of this point in the coordinate system of that cmd.


getValueFromPoint

public SCanvasPoint getValueFromPoint(com.insightful.gdevice.SGraphCommand cmd,
                                      int x,
                                      int y)
Given an SGraphCommand and mouse coords x,y in the canvas, returns the x,y values of this point in the coordinate system of that cmd.


createSCanvasAWT

public SCanvasAWT createSCanvasAWT()

printString

public void printString(Graphics g,
                        String txt,
                        int x,
                        int y)
print string, using pixelation so it works in applet printing.


getHit

public SCanvasHit getHit(Point pt)

getHit

public SCanvasHit getHit(int x,
                         int y)

getIntersectingTags

public String[] getIntersectingTags(Rectangle rect)
Returns tags for all active regions the intersect the given rectangle.


writeXML

public void writeXML(PrintWriter out,
                     String colorschemeTag,
                     Vector uniqueRectCmds)

createFromXML

public static SCanvasAWT createFromXML(XMLElement elt,
                                       IDHash idHash)

setFromXML

public void setFromXML(XMLElement elt,
                       IDHash idHash)

createErrorCanvas

public static SCanvasAWT createErrorCanvas(String errorString)

setUserSize

public void setUserSize(Dimension dim)
Sets the user size.


getUserSize

public Dimension getUserSize()
Returns the user size.


getBestFitSize

public Dimension getBestFitSize(Dimension maxSize)

getMaxFitSize

public static Dimension getMaxFitSize(Dimension userSize,
                                      Dimension maxSize)

setCanvasTagSet

public void setCanvasTagSet(com.insightful.gdevice.TagSet tagSet)
set TagSet. Called by SCanvasPaneController when canvas is added.


getSelectedTagArray

public String[] getSelectedTagArray()
returns an array of the selected region tags. (this has nothing to do with the page tags)


setSelectedTagArray

public void setSelectedTagArray(String[] tags)

createSCanvas

public SCanvas createSCanvas()
Create an SCanvas with the same properties as this SCanvasAWT. [This was removed so we could make a clean spjgraph.jar. it is being added again so that we can make Splus6.2 work with IMiner3.0.]


setDocumentBase

public void setDocumentBase(URL val)
set/get documentBase to be used when resolving URLs in embedded images


getDocumentBase

public URL getDocumentBase()

setClipIdentify

public void setClipIdentify(boolean val)
set/get flag for whether to clip java.identify regions to plot region.


getClipIdentify

public boolean getClipIdentify()

setDebug

public void setDebug(boolean val)
set/get flag for whether to print debugging info.


getDebug

public boolean getDebug()

setInApplet

public void setInApplet(boolean val)
set/get flag for whether to print applet info.


getInApplet

public boolean getInApplet()

releaseMemory

public void releaseMemory()

hasEmbeddedFileData

public boolean hasEmbeddedFileData()

clearEmbeddedFileData

public void clearEmbeddedFileData()

loadEmbeddedCanvas

public void loadEmbeddedCanvas(SCanvasAWT canvas)

getPropertyAction

public String getPropertyAction()

setPropertyAction

public void setPropertyAction(String action)

setBackgroundRGBA

public void setBackgroundRGBA(int r,
                              int g,
                              int b,
                              int a)

clearBackgroundRGBA

public void clearBackgroundRGBA()

S-PLUS Connect/Java v1.0

Copyright © 2000, 2002 Insightful Corporation
Warning: Classes not documented in the S-PLUS Programmer's Guide may change in future releases.