if (isCancelled()) {
Debug.message("dted", getName() + "|DTEDLayer.prepare(): aborted.");
return null;
}
Projection projection = getProjection();
if (projection == null) {
Debug.error("DTED Layer needs to be added to the MapBean before it can draw images!");
return new OMGraphicList();
}
if (cache == null) {
Debug.output("DTEDLayer: Creating cache! (This is a one-time operation!)");
cache = new DTEDCacheManager(paths, paths2, numColors, opaqueness);
cache.setCacheSize(cacheSize);
DTEDFrameSubframeInfo dfsi = new DTEDFrameSubframeInfo(viewType, bandHeight, dtedLevel, slopeAdjust);
cache.setSubframeInfo(dfsi);
}
// Check to make sure the projection is EqualArc
if (!(projection instanceof EqualArc)) {
if (viewType != DTEDFrameSubframe.NOSHADING) {
fireRequestInfoLine(" DTED requires an Equal Arc projection (CADRG/LLXY) to view images.");
Debug.error("DTEDLayer: DTED requires an Equal Arc projection (CADRG/LLXY) to view images.");
}
return new OMGraphicList();
}
Debug.message("basic", getName() + "|DTEDLayer.prepare(): doing it");
// Setting the OMGraphicsList for this layer. Remember, the
// OMGraphicList is made up of OMGraphics, which are generated
// (projected) when the graphics are added to the list. So,
// after this call, the list is ready for painting.
// call getRectangle();
if (Debug.debugging("dted")) {
Debug.output(getName() + "|DTEDLayer.prepare(): "
+ "calling getRectangle " + " with projection: "
+ projection + " ul = " + projection.getUpperLeft()
+ " lr = " + projection.getLowerRight());
}
OMGraphicList omGraphicList;
if (projection.getScale() < maxScale) {
omGraphicList = cache.getRectangle((EqualArc) projection);
} else {
fireRequestInfoLine(" The scale is too small for DTED viewing.");
Debug.error("DTEDLayer: scale (1:" + projection.getScale()
+ ") is smaller than minimum (1:" + maxScale + ") allowed.");
omGraphicList = new OMGraphicList();
}
/////////////////////
// safe quit