|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.xj.anylogic.engine.presentation.ImageCache
public class ImageCache
A cache for images deiplayed in AnyLogic presentation graphics. A cached image is identified by either its presentable object (active object or experiment) or its URL. An image is cached as BufferedImage with either its original width and height or width and height requested by the user. Note that if the same image is drawn twice with different width and height, or its dimensions change all the time, that may seriously slow down the presentation as the image will be reloaded and the new BufferedImage will be created on each frame.
| Constructor Summary | |
|---|---|
ImageCache()
|
|
| Method Summary | |
|---|---|
void |
clear()
Clears the cache. |
java.awt.image.BufferedImage |
getCachedImage(Presentable p,
java.lang.String filename,
int width,
int height)
Deprecated. use getCachedImage(Presentable, String, String, int, int) |
java.awt.image.BufferedImage |
getCachedImage(Presentable p,
java.lang.String packagePrefix,
java.lang.String fileName,
int width,
int height)
Returns an already cached buffered image identified by its owner presentable object, filename and dimensions. |
java.awt.image.BufferedImage |
getCachedImage(java.net.URL url,
int width,
int height)
Returns an already cached buffered image identified by its url and dimensions. |
java.awt.image.BufferedImage |
getCAD(Presentable p,
java.lang.String packagePrefix,
java.lang.String fileName,
int id,
int width,
int height,
java.awt.Color backgroundColor,
java.lang.String[] layerNames,
boolean[] layersVisibility,
java.awt.Color[] customLayerColors,
boolean invertDefaultColors,
boolean forceRedraw)
Deprecated. this method will be removed in the future releases, please use getCAD(Presentable, String, String, int, int, int, Color, String[], boolean[], Color[], int, boolean) |
java.awt.image.BufferedImage |
getCAD(Presentable p,
java.lang.String packagePrefix,
java.lang.String fileName,
int id,
int width,
int height,
java.awt.Color backgroundColor,
java.lang.String[] layerNames,
boolean[] layersVisibility,
java.awt.Color[] customLayerColors,
int drawingAttributes,
boolean forceRedraw)
This method is not intended to be called by user Fetches a cached buffered CAD image identified by its owner presentable object or creates, adds to cache and returns a new one. |
java.awt.image.BufferedImage |
getImage(Presentable p,
java.lang.String packagePrefix,
java.lang.String fileName,
int width,
int height)
Fetches a cached buffered image identified by its owner presentable object or creates, adds to cache and returns a new one. |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ImageCache()
| Method Detail |
|---|
public java.awt.image.BufferedImage getImage(Presentable p,
java.lang.String packagePrefix,
java.lang.String fileName,
int width,
int height)
p - the presentable objectpackagePrefix - the package name of original active object where
this image is defined, formatted using '/' characters; with '/'
character at the beginning and at the endfileName - the file name of the image, relative to the class of pwidth - the requested width of the image, or -1 for original sizeheight - the requested height of the image, or -1 for original size
@Deprecated
public java.awt.image.BufferedImage getCAD(Presentable p,
java.lang.String packagePrefix,
java.lang.String fileName,
int id,
int width,
int height,
java.awt.Color backgroundColor,
java.lang.String[] layerNames,
boolean[] layersVisibility,
java.awt.Color[] customLayerColors,
boolean invertDefaultColors,
boolean forceRedraw)
getCAD(Presentable, String, String, int, int, int, Color, String[], boolean[], Color[], int, boolean)
public java.awt.image.BufferedImage getCAD(Presentable p,
java.lang.String packagePrefix,
java.lang.String fileName,
int id,
int width,
int height,
java.awt.Color backgroundColor,
java.lang.String[] layerNames,
boolean[] layersVisibility,
java.awt.Color[] customLayerColors,
int drawingAttributes,
boolean forceRedraw)
p - the presentable objectpackagePrefix - the package name of original active object where
this image is defined, formatted using '/' characters; with '/'
character at the beginning and at the endfileName - the file name of the image, relative to the class of pid - some id of the model element, used to distinguish between
different CAD image elements referring to the same cad filewidth - the requested width of the image, or -1 for original sizeheight - the requested height of the image, or -1 for original sizebackgroundColor - the background color for CAD drawinglayerNames - the array of names of CAD layers to be drawnlayersVisibility - the array of the same length as
layerNames. Contains true values
for layers which should be drawn.customLayerColors - the array of the same length as
layerNames. Allows user to specify custom color for
all the shapes in a particular layer(s). Default layer colors are
used for layers having null item in this array.drawingAttributes - the drawing attributes, this value should be
zero or an "OR" combination of CAD_* constants,
e.g. CAD_NEGATIVE | CAD_ANTIALIASINGforceRedraw - if true, CAD will be rerendered even
if its cached image seems up-to-date
public void clear()
public java.awt.image.BufferedImage getCachedImage(Presentable p,
java.lang.String packagePrefix,
java.lang.String fileName,
int width,
int height)
p - the presentable objectpackagePrefix - the package name of original active object where
this image is defined, formatted using '/' characters; with '/'
character at the beginning and at the endfileName - the file name of the image, relative to the class of pwidth - the width of the imageheight - the height of the image
@Deprecated
public java.awt.image.BufferedImage getCachedImage(Presentable p,
java.lang.String filename,
int width,
int height)
getCachedImage(Presentable, String, String, int, int)
p - the presentable objectfilename - the file name of the image, relative to the class of pwidth - the width of the imageheight - the height of the image
public java.awt.image.BufferedImage getCachedImage(java.net.URL url,
int width,
int height)
url - the URL of the imagewidth - the width of the imageheight - the height of the image
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||