RE: [OpenMap Users] finding extents of map?

From: Ben Podoll <benjamin.podoll_at_und.edu>
Date: Sun, 8 Aug 2004 08:45:54 -0500

Let's say I have a mapBean that shows a map of the Midwest. The entire
screen resolution I am using is 1600x1200 but my GUI is only about 800x600
let's say...

Now the GUI is placed in the center of the screen and is just sitting there.

Now, I have a external class that where I want to open a SpatialIndex object
and execute the locateRecords(int minx, int miny, int maxx, int maxy)
command on a shapefile. How do I figure out the parameters need above if I
only have access to a basicMapPanel?


> -----Original Message-----
> From: Rob Ratcliff [mailto:rrr6399_at_futuretek.com]
> Sent: Sunday, August 08, 2004 4:31 AM
> To: Ben Podoll
> Subject: RE: [OpenMap Users] finding extents of map?
>
> Ben,
>
> Since the mapbean is a panel, couldn't you get the width and height
> directly from that? Then assume that upper left is (0,0) and
> lower right is (w,h)?
>
> It looks like there is some problem with the .forward() method. Are you
> calling this method after the map has been rendered to the
> screen? (i.e. not during the construction of the map or before the
> basicMapPanel has been added to a parent that is visible?) (If
> your width and height is 0 you'll know that it is at the wrong time and
> you'll have to put your calculations in an invokeLater()).
>
> Rob
>
>
> inal Message-----
> > From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-
> users_at_bbn.com]On
> > Behalf Of Ben Podoll
> > Sent: Saturday, August 07, 2004 10:25 PM
> > To: openmap-users_at_bbn.com
> > Subject: [OpenMap Users] finding extents of map?
> >
> >
> > I am having trouble finding the extents of my display (am I doing it
> > wrong?):
> >
> > Projection proj = basicMapPanel.getMapBean().getProjection();
> > LatLonPoint upperLeft = proj.getUpperLeft();
> > LatLonPoint lowerRight = proj.getLowerRight();
> > println("center: " + proj.getCenter().toString());
> > println("upper left: " + upperLeft.toString());
> > println("lower right: " + lowerRight.toString());
> > println("width: " + String.valueOf(proj.getWidth()));
> > println("height: " + String.valueOf(proj.getHeight()));
> > println("scale: " + String.valueOf(proj.getScale()));
> > println("upper left (x,y): " + proj.forward(upperLeft));
> > println("lower right (x,y): " + proj.forward(lowerRight));
> >
> > Here is my output:
> >
> > center: LatLonPoint[lat=43.724747,lon=-94.012375]
> > upper left: LatLonPoint[lat=56.325226,lon=-120.36881]
> > lower right: LatLonPoint[lat=27.789461,lon=-67.65593]
> > width: 1600
> > height: 1200
> > scale: 1.2E7
> > upper left (x,y): java.awt.Point[x=0,y=0]
> > lower right (x,y): java.awt.Point[x=1600,y=1200]
> >
> > My display GUI is very small and it states that the lower right
> corner is
> > 1600,1200? But that is the resolution of my entire screen, and the
> GUI is
> > way smaller.
> >
> > The whole reason for this is that I want to determine what shapes (in
> a
> > shapefile) are valid for my current view. Per a previous response to
> another
> > email I sent to the openmap userlist I am using a SpatialIndex like
> so:
> >
> > SpatialIndex si = new
> > SpatialIndex(ssx.toExternalForm(),shp.toExternalForm());
> > si.dumpIndex(true);
> > ESRIRecord[] shapes = si.locateRecords(?, ?, ?, ?);
> > System.out.println(shapes.length);
> >
> > But I don't know what to put for the locateRecords() parameter... Can
> > someone give me a pointer? I assume it is x,y values which I don't
> know how
> > to give.
> >
> >
> > --
> > [To unsubscribe to this list send an email to "majdart_at_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_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Sun Aug 08 2004 - 09:47:32 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:05 EDT