*/
protected UGraphic[] getSpecGraphics(Projection p) {
CProjection cproj;
LLPoint ll1, ll2;
StringHolder dynamicArgsHolder;
Server spec = getSpecialist();
if (Debug.debugging("cspec")) {
System.out.println(getName()
+ "|BufferedCSpecLayer.getSpecGraphics()");
}
// If we have graphics, return them
if (graphics != null) {
System.out.println("Returning cached graphics");
return graphics;
}
cproj = new CProjection((short) (p.getProjectionType()), new LLPoint(p.getCenter()
.getLatitude(), p.getCenter().getLongitude()), (short) p.getHeight(), (short) p.getWidth(), (int) p.getScale());
// lat-lon "box", (depends on the projection)
LatLonPoint ul = p.getUpperLeft();
LatLonPoint lr = p.getLowerRight();
// ll1 = new LLPoint(ul.getLatitude(), ul.getLongitude());
// ll2 = new LLPoint(lr.getLatitude(), lr.getLongitude());
// Adjust lat/lon for total global area
ll1 = new LLPoint(90.0f, -180.0f);
ll2 = new LLPoint(-90.0f, 180.0f);
// check for cancellation
if (isCancelled()) {
dirtybits |= PREMATURE_FINISH;
if (Debug.debugging("cspec"))
System.out.println(getName()
+ "|BufferedCSpecLayer.getSpecGraphics(): aborted.");
return null;
}
// check for null specialist
if (spec == null) {
System.err.println(getName()
+ "|BufferedCSpecLayer.getSpecGraphics(): null specialist!");
return null;
}
try {
// Keep the gestures up-to-date
mapGesture.setProjection(p);
// Static Args can't go out null....
String staticArguments = getStaticArgs();
if (staticArguments == null) {
staticArguments = "";
setStaticArgs(staticArguments);
}
// neither can dynamic args
dynamicArgsHolder = new StringHolder(getArgs());
if (dynamicArgsHolder.value == null) {
dynamicArgsHolder.value = "";
}
// call getRectangle();
if (Debug.debugging("cspec")) {
System.out.println(getName()
+ "|BufferedCSpecLayer.getSpecGraphics():"
+ " calling getRectangle with projection: " + p
+ " ul=" + ul + " lr=" + lr + " staticArgs=\""
+ staticArguments + "\"" + " dynamicArgs=\""
+ dynamicArgsHolder.value + "\"" + " clientID="
+ clientID);
}
long start = System.currentTimeMillis();
graphics = spec.getRectangle(cproj,
ll1,
ll2,
staticArguments,
dynamicArgsHolder,
selectDist,