public class GralCanvasStorage extends java.lang.Object implements GralCanvas_ifc
GralCanvasStorage.Figure
. A figure has a position (GralPos
)
and only one or some GralCanvasStorage.FigureData
.
For more as one FigureData per Figure the container GralCanvasStorage.FigureDataSet
is used.
GralCanvasStorage.FigureData
and GralCanvasStorage.FigureDataSet
can be created independent of a GralCanvasStorage.Figure
and used in more as one figure on different positions, with similar presentation: /**Dataset of the border of the data words in memory:Above it is an example to define the appearance of a figure as FigureDataSet on construction inside a class. To use it in two figures, the application should call in an initialization phase before establishing the graphic:+--+--+ | | | +--+--+It is used for all Mem presentation (Master and Slave). / final GralCanvasStorage.FigureDataSet figData_Words = new GralCanvasStorage.FigureDataSet(); { GralColor color = GralColor.getColor("bk"); this.figData_Words.addPolyline(color).point(0, 0).point(0,2); // | for(int ix = 0; ix <20; ++ix) { this.figData_Words.addPolyline(color) .point(ix,2) .point(ix+1,2) // --+ 20 times gives rectangles for each word. .point(ix+1,0) // | .point(ix,0); // --+ } }
void init() throws ParseException { // this.pos.setPosition("10-2,10+1++"); this.canvas.addFigure("dataWordsMaster", this.pos, this.figData_Words, false); this.pos.setPosition("10-2,40+1++"); this.canvas.addFigure("dataWordsSlave1", this.pos, this.figData_Words, false);Dynamic figures
addFigure(String, GralPos, FigureDataSet, boolean)
above).
If you invoke GralWidget.redrawOnlyDynamics(int, int)
or GralWidget.redraw(int, int, boolean)
with true as last argument then only these figures are drawn, the background of the canvas will not be deleted.
This prevents flickering effects on the screen because the delay after clean and redraw all.
The coordinates of the area of a figure are calculated. Before drawing the figure the canvas content is stored in the heap,
using a proper container such as org.eclipse.swt.graphics.Image
.
Before redraw the figure this canvas content is restored.
This process should be well organized, meaningful if more as one figures overlap.
But this is done in the implementation level of the library SwtWdgCanvas
for the SWT implementation.
GralCanvasStorage.Figure.show(boolean)
. Now a special case is possible:
If a figure is shown for only one step, its restoration of the background is done firstly.
Then an overlap problem is solved.
Modifier and Type | Class and Description |
---|---|
static class |
GralCanvasStorage.Arcus |
static class |
GralCanvasStorage.Figure
Data class to store some representation data of a figure.
|
static class |
GralCanvasStorage.FigureData
This is the common abstract class for all data which describes one part of a figure.
|
static class |
GralCanvasStorage.FigureDataSet |
static class |
GralCanvasStorage.FigureText |
static class |
GralCanvasStorage.Fillin |
static class |
GralCanvasStorage.KindFigureData |
static class |
GralCanvasStorage.PaintOrderImage |
static class |
GralCanvasStorage.PolyLine |
static class |
GralCanvasStorage.PolyLineFloatArray |
static class |
GralCanvasStorage.SimpleLine |
Modifier and Type | Field and Description |
---|---|
java.util.Map<java.lang.String,GralCanvasStorage.Figure> |
idxFigure
Only used to prevent and check name clashes between figures.
|
java.util.concurrent.ConcurrentLinkedQueue<GralCanvasStorage.Figure> |
paintOrders
List of all orders to paint in
#drawBackground(GC, int, int, int, int) . |
static java.lang.String |
version
Version, history and license.
|
(package private) java.util.List<GralCanvasStorage.Figure> |
XXXdynamicOrder
If dynamic figures are available, this list contains the draw order.
|
Constructor and Description |
---|
GralCanvasStorage() |
Modifier and Type | Method and Description |
---|---|
GralCanvasStorage.Figure |
addFigure(java.lang.String name,
GralPos pos,
boolean isDynamic)
Adds a simple figure with only one FigureData for example one line.
|
GralCanvasStorage.Figure |
addFigure(java.lang.String name,
GralPos pos,
GralCanvasStorage.FigureData data,
boolean isDynamic)
Adds a simple figure with only one FigureData for example one line.
|
GralCanvasStorage.Figure |
addFigure(java.lang.String name,
GralPos pos,
GralCanvasStorage.FigureDataSet data,
boolean isDynamic)
Adds a complex figure with a FigureDataSet
|
void |
drawFillin(GralPos pos,
GralColor color) |
void |
drawImage(GralImageBase image,
int x,
int y,
int dx,
int dy,
GralRectangle imagePixelSize) |
void |
drawLine(GralColor color,
GralCanvasArea.UserUnits userUnits,
float[][] points,
int iy)
Accepts a order to draw a line.
|
void |
drawLine(GralColor color,
int x1,
int y1,
int x2,
int y2)
Accepts a order to draw a line.
|
void |
drawLine(GralPos pos,
GralColor color,
java.util.List<GralPoint> points)
Accepts a order to draw a line.
|
void |
drawText(java.lang.String text) |
void |
setTextStyle(GralColor color,
GralFont font,
int origin) |
public static final java.lang.String version
GralCanvasStorage.Figure
can contain more as one GralCanvasStorage.FigureData
,
which allows one Object with several lines or areas with a common position.
GralCanvasStorage.PolyLineFloatArray
drawLine(GralPos, GralColor, List)
, improved GralCanvasStorage.Figure
-derivates.
public final java.util.concurrent.ConcurrentLinkedQueue<GralCanvasStorage.Figure> paintOrders
#drawBackground(GC, int, int, int, int)
.public final java.util.Map<java.lang.String,GralCanvasStorage.Figure> idxFigure
java.util.List<GralCanvasStorage.Figure> XXXdynamicOrder
public GralCanvasStorage.Figure addFigure(java.lang.String name, GralPos pos, boolean isDynamic)
pos
- color
- data
- isDynamic
- public GralCanvasStorage.Figure addFigure(java.lang.String name, GralPos pos, GralCanvasStorage.FigureData data, boolean isDynamic)
pos
- color
- data
- isDynamic
- public GralCanvasStorage.Figure addFigure(java.lang.String name, GralPos pos, GralCanvasStorage.FigureDataSet data, boolean isDynamic)
pos
- color
- data
- isDynamic
- public void drawLine(GralColor color, int x1, int y1, int x2, int y2)
drawLine
in interface GralCanvas_ifc
color
- x1
- TODO yet it is pixel coordinates, use GralGrid coordinates.y1
- x2
- y2
- public void drawLine(GralPos pos, GralColor color, java.util.List<GralPoint> points)
color
- public void drawLine(GralColor color, GralCanvasArea.UserUnits userUnits, float[][] points, int iy)
color
- public void drawImage(GralImageBase image, int x, int y, int dx, int dy, GralRectangle imagePixelSize)
drawImage
in interface GralCanvas_ifc
public void drawText(java.lang.String text)
drawText
in interface GralCanvas_ifc
public void setTextStyle(GralColor color, GralFont font, int origin)
setTextStyle
in interface GralCanvas_ifc