*/
protected GraphicUpdate readGraphic(int graphicAction, LinkProperties graphicProperties, Projection proj,
OMGridGenerator generator)
throws IOException {
OMGraphic graphic = null;
String header = link.readDelimiter(false);
// Sanity check
if (header == Link.END_TOTAL || header == Link.END_SECTION) {
return null;
}
int graphicType = link.dis.readByte();
switch (graphicType) {
case LinkGraphicList.GRAPHICTYPE_LINE:
graphic = LinkLine.read(link.dis, graphicProperties);
break;
case LinkGraphicList.GRAPHICTYPE_POLY:
graphic = LinkPoly.read(link.dis, graphicProperties);
break;
case LinkGraphicList.GRAPHICTYPE_RECTANGLE:
graphic = LinkRectangle.read(link.dis, graphicProperties);
break;
case LinkGraphicList.GRAPHICTYPE_POINT:
graphic = LinkPoint.read(link.dis, graphicProperties);
break;
case LinkGraphicList.GRAPHICTYPE_CIRCLE:
graphic = LinkCircle.read(link.dis, graphicProperties);
break;
case LinkGraphicList.GRAPHICTYPE_ELLIPSE:
graphic = LinkEllipse.read(link.dis, graphicProperties);
break;
case LinkGraphicList.GRAPHICTYPE_RASTER:
graphic = LinkRaster.read(link.dis, graphicProperties);
break;
case LinkGraphicList.GRAPHICTYPE_BITMAP:
graphic = LinkBitmap.read(link.dis, graphicProperties);
break;
case LinkGraphicList.GRAPHICTYPE_TEXT:
graphic = LinkText.read(link.dis, graphicProperties);
break;
case LinkGraphicList.GRAPHICTYPE_GRID:
graphic = LinkGrid.read(link.dis, graphicProperties);
break;
case LinkGraphicList.GRAPHICTYPE_ARC:
graphic = LinkArc.read(link.dis, graphicProperties);
break;
default:
System.err.println("LinkActionList: received unknown graphic type.");
}
if (graphic != null && proj != null) {
if (graphic instanceof OMGrid) {
((OMGrid) graphic).setGenerator(generator);
}
graphic.generate(proj);
}
return (new GraphicUpdate(graphicAction, graphic));
}