There is a default implementation of renderDataForProjection in Layer, but
doesn't do enough for the imageServer. I was using a layer modeled after
com.bbn.openmap.examples.simple.RouteLayer and added an implementation of
renderDataForProjection which included "omgraphics.project(proj);". Then it
worked for me.
-----Original Message-----
From: Keith Alphonso [mailto:kalphonso@diamonddata.com]
Sent: Thursday, February 20, 2003 10:19 AM
To: '"Gubler, Rüdiger" '; 'Don Dietrick (E-Mail) '; 'Openmap-Users
(E-Mail) '
Subject: RE: [OpenMap Users] ImageServer
I had a similar problem and it turned out that I was not implementing the
renderDataForProjection. This is necessary for image generation.
-----Original Message-----
From: "Gubler, Rüdiger"
To: Don Dietrick (E-Mail); Openmap-Users (E-Mail)
Sent: 2/20/03 1:58 AM
Subject: [OpenMap Users] ImageServer
Hello,
I use the following code to get an image:
ImageFormatter imageFormatter = null;
Projection proj = null;
Vector layerVec = null;
Layer[] layers = null;
byte[] data = null;
layerVec = new Vector();
layerVec.add(new WayLayer("Ways"));
layerVec.add(new AreaLayer("Urban",
GisUrbanArea.class));
layers = (Layer[]) layerVec.toArray(new
Layer[layerVec.size()]);
imageFormatter = new SunJPEGFormatter();
((SunJPEGFormatter) imageFormatter).setImageQuality(1f);
proj = ProjectionFactory.makeProjection(projType,
latitide, longitude, scale, width, hight);
ImageServer imageServer = new ImageServer(layers,
imageFormatter);
imageServer.setDoAntiAliasing(true);
data = imageServer.createImage(proj, -1, -1);
try
{
OutputStream fos = new
FileOutputStream("C:/GisImageTest/Test.jpg");
fos.write(data);
fos.close();
}
catch (FileNotFoundException fnfex)
{
Logger.defaultLogger.log(Level.ERROR,
fnfex.getMessage(), fnfex);
}
catch (IOException ioex)
{
Logger.defaultLogger.log(Level.ERROR,
ioex.getMessage(), ioex);
}
The problem is that only the background is painted and the Layers (which
worked great in a MapBean) do nothing. I have added some
logmessages into the computeGraphics() method of the layers.
What is going wrong?
Yours Rüdiger
-- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"] -- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"] -- [To unsubscribe to this list send an email to "majdart@bbn.com" with the following text in the BODY of the message "unsubscribe openmap-users"]Received on Thu Feb 20 12:26:36 2003
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:34 EDT