Graphics Reference
In-Depth Information
Figure
.
.
Classes for original data
We explain the difference between this realization and the traditional inheritance
realization. If we use an inheritance mechanism, all methods of a superclass are au-
tomatically available from subclasses. Instead, this realization requires explicit dele-
gation statements, which are additional work. However, explicit declarations for del-
egation are useful to make the responsibilities of classes that execute methods clear
and to realize the rigid sotware structure.
Classes for Data about Basic Graphics
17.3.4
PlotModel
isaninterfacetosetorgetinformation foraparticulargraphic.Aseach
graphicrequiresdatatobevisualized,itdeclaresmethodsforhandlinga
DataModel
object:
setDataModel
and
getDataModel
.Inordertodrawagraphic,detailed
drawing procedures are required; they are then declared in a
Plotter
interface
separately.
PlotModel
has methods for handling them:
createPlotter
and
getPlotter
.
PlotModel
has several methods for interactive operations, such as
getPlot-
ModelHandler
,
setSelector
,and
getSelector
.
PlotModel
also has
a method for drawing strings at any location of a graphics:
drawString
.As
PlotModel
does not maintain the size information of graphics, we specify the lo-
cation of strings by the ratio of grphicssize in the
drawString
method.
BasicPlotModel
is an abstract class that implements
PlotModel
and gives
simple implementations of many of the methods. Italso defines several fieldstostore
important objects such as
plotter
for
Plotter
,
selector
for
Selector
,
and
title
for the title of the graphics.
To draw a two-dimensional scatterplot,
ScatterPlotModel
is defined by ex-
tending
BasicPlotModel
. It has specific information for drawing a scatterplot
such as
connect
for indicating whether points are connected or not as a boolean