Oops! I was missing the omcorba_vb.jar file from my classpath. Also, it
seems like openmap was looking for some .shp files in $OPENMAP_HOME/data
when they actually resided in $OPENMAP_HOME/share/data. Ok, so now the
problem is that I am getting a null pointer on the following line:
com.bbn.openmap.layer.specialist.MakeProjection mp = new
com.bbn.openmap.layer.specialist.MakeProjection(cp);
The line I used to create the object cp was:
com.bbn.openmap.CSpecialist.CProjection cp = new
com.bbn.openmap.CSpecialist.CProjection();
And it seems maybe I should be using the other constructor for
CProjection? CProjection(short kind, LLPoint center, short height, short
width, int scale) ... My only question there is what the heck is "kind"?
> -----Original Message-----
> From: Benjamin.May@bookspan.com [mailto:Benjamin.May@bookspan.com]
> Sent: Monday, August 11, 2003 5:20 PM
> To: openmap-users@bbn.com
> Subject: RE: [OpenMap Users] Newbie questions
>
>
>
> Hrm, well I tried running my java code on my own PC and this
> problem went away. But now it's complaining about missing
> classes. There is a
>
> com/bbn/openmap/CSpecialist/
>
> Package in the docs which is missing from my distribution!
> Whats up with that!? Here's my whole class, in case you're interested:
>
>
> import java.util.*;
> import java.io.*;
> import com.bbn.openmap.image.*;
>
> public class Test{
>
> Properties P;
>
> public Properties getMapProperties(){
> if (P == null){
> try{
> FileInputStream s = new
> FileInputStream("openmap.properties");
> P = new Properties();
> P.load(s);
> }catch(Exception e){
> e.printStackTrace();
> System.exit(0);
> }
> }
>
> return P;
> }
>
> public static void main(String argv[]) throws Exception{
> Test t = new Test();
> byte [] outfile = t.getMapAsJPEG();
> FileOutputStream out = new FileOutputStream("test.jpg");
> out.write(outfile);
> out.close();
> }
>
> public com.bbn.openmap.proj.Projection getMapProjection(){
> com.bbn.openmap.CSpecialist.CProjection cp = new
> com.bbn.openmap.CSpecialist.CProjection();
> com.bbn.openmap.layer.specialist.MakeProjection mp =
> new com.bbn.openmap.layer.specialist.MakeProjection(cp);
> com.bbn.openmap.proj.Projection proj = mp.getProj();
> return proj;
>
> }
>
> public byte [] getMapAsJPEG()
> throws Exception
> {
>
> Properties props = getMapProperties();
>
> ImageServer imageServer = new ImageServer("mapDemo", props);
>
> com.bbn.openmap.image.SunJPEGFormatter formatter = new
> com.bbn.openmap.image.SunJPEGFormatter();
> formatter.setImageQuality(1.0f);
> imageServer.setFormatter(formatter);
> byte [] imageBytes =
> imageServer.createImage(getMapProjection());
> return imageBytes;
> }
>
> }
>
> > -----Original Message-----
> > From: Adam Russell [mailto:adam.russell@channing.harvard.edu]
> > Sent: Monday, August 11, 2003 4:45 PM
> > To: Benjamin.May@bookspan.com; openmap-users@bbn.com
> > Subject: Re: [OpenMap Users] Newbie questions
> >
> >
> > Ha!! That is a fun one.
> > This provides some explanation and a possible workaround
> > http://www.caucho.com/support/resin-interest/0009/0367.html
> > Basically, java.awt needs to have X around in order to
> work. It does
> > this by checking the value of the DISPLAY variable to try and
> > connect to
> > a working X server.
> > There is a couple of workarounds and I think that sun may
> > have a fix in
> > the most recent java releases.
> > I just went with the Xvfb solution(see the above link) and since it
> > works very well stopped investigating this further.
> > A google search with keyords like java.awt and Headless will
> > give you a
> > lot more info too.
> >
> >
> > Benjamin.May@bookspan.com wrote:
> >
> > >
> > > Hrm, well so far so good. I am able to do some basic stuff.
> > For now, I
> > > am just using a default setting Projection. I can worry
> > about getting
> > > the position attributes once I am able to just write a file
> > out at all
> > > ;) When I try to instantiate the ImageServer as in Keith's
> > example, I
> > > get the following exception:
> > >
> > > Exception in thread "main" java.lang.InternalError: Can't
> connect to
> > > X11 window server using ':0.0' as the value of the
> DISPLAY variable.
> > > at
> sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
> > > at
> > >
> > sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment
> > .java:54)
> > > at java.lang.Class.forName0(Native Method)
> > > at java.lang.Class.forName(Class.java:115)
> > > at
> > >
> > java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(Graph
> > icsEnvironment.java:53)
> > > at java.awt.Font.initializeFont(Font.java:259)
> > > at java.awt.Font.<init>(Font.java:293)
> > > at java.awt.Font.decode(Font.java:773)
> > > at com.bbn.openmap.layer.LabelLayer.<init>(Unknown Source)
> > > at com.bbn.openmap.layer.DateLayer.<init>(Unknown Source)
> > > at java.lang.Class.newInstance0(Native Method)
> > > at java.lang.Class.newInstance(Class.java:232)
> > > at
> > com.bbn.openmap.util.ComponentFactory.create(Unknown Source)
> > > at
> > com.bbn.openmap.image.ImageServer.getLayers(Unknown Source)
> > > at
> > com.bbn.openmap.image.ImageServer.setProperties(Unknown Source)
> > > at
> com.bbn.openmap.image.ImageServer.<init>(Unknown Source)
> > > at
> com.bbn.openmap.image.ImageServer.<init>(Unknown Source)
> > > at Test.getMapAsJPEG(Test.java:47)
> > > at Test.main(Test.java:27)
> > > Now, I am trying to save an image without using swing at
> > all, so I am
> > > confused why the image manager is trying to act as an XWin
> > client. Is
> > > the imagemanager inherently swing-related? If so I should probably
> > > chose another way to do this. Thanks again guys!
> > >
> > > -----Original Message-----
> > > *From:* Benjamin.May@bookspan.com
> > [mailto:Benjamin.May@bookspan.com]
> > > *Sent:* Monday,
> > August 11, 2003 2:52 PM
> > > *To:* kalphonso@diamonddata.com
> > > *Cc:* openmap-users@bbn.com
> > > *Subject:* RE: [OpenMap Users] Newbie questions
> > >
> > >
> > > This is a good start... What class is that in? You have some
> > > methods (getMapProperties() for instance) which you
> dont provide
> > > here. Are the openmap methods? Where are you passing it the
> > > co-ordinates so it knows what map to draw? Thanks!
> > >
> > > Here is the block of code I use to generate a map
> > jpeg from a
> > > set of properties and a map projection.
> > >
> > >
> > > public byte [] getMapAsJPEG(HttpSession session)
> > > {
> > > Properties props = getMapProperties();
> > >
> > > ImageServer imageServer = new
> > ImageServer("mapDemo", props);
> > > com.bbn.openmap.image.SunJPEGFormatter
> formatter = new
> > > com.bbn.openmap.image.SunJPEGFormatter();
> > > formatter.setImageQuality(1.0f);
> > > imageServer.setFormatter(formatter);
> > > byte [] imageBytes =
> > > imageServer.createImage(getMapProjection());
> > > return imageBytes;
> > > }
> > >
> >
> >
> --
> [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 Tue Aug 12 09:16:13 2003
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:36 EDT