Classification: UNCLASSIFIED
This is the tonic I needed:
Point xyTargetPos = proj.forward(ll);
Thanks, Carsten!
-----Original Message-----
From: owner-openmap-users_at_bbn.com [mailto:owner-openmap-users_at_bbn.com]On
Behalf Of "Carsten Ø. Madsen"
Sent: Tuesday, December 20, 2005 1:14 AM
To: 'openmap-users_at_bbn.com'
Subject: Re: [OpenMap Users] OMPoly and getShape woes
Hi
You have to convert the lat,lon to x,y via the forward method as contains
operates in x,y space. Something like the following:
LatLonPoint currentPos = new LatLonPoint(points[0], points[1], true);
Mercator proj = new Mercator(currentPos, 65000f, 1024, 768);
Point xyTargetPos = proj.forward(ll);
// prep for spatial analysis
OMPoly polyCopy = new OMPoly();
polyCopy.setLineType(OMGraphicConstants.LINETYPE_GREATCIRCLE);
polyCopy.setLocation(poly.getLatLonArray(), OMGraphic.RADIANS);
polyCopy.setDoShapes(true);
polyCopy.generate(proj);
if (polyCopy.getShape().contains(xyTargetPos)) {...
regards
/carsten
Lepkowski, Thomas M., CTR, OSD-PA&E wrote:
Hello all,
I have two things:
1) a valid and displayed OMGraphic with LatLonPoint (of course).
2) a valid and displayed OMPoly ( in the form of ESRIPolygon ).
The OMGraphic point is inside the OMPoly. It's like a town inside a state.
The state is represented by the OMPoly and the town is a simple OMGraphic.
I want to show programmatically that the town is inside the state.
My following code is not printing "true":
<CODE>
// some code bringing me here
// OMPoly is on map
EsriPolygon ep = (EsriPolygon) omg;
ep.setDoShapes( true );
ep.generate( projection );
GeneralPath gp = ep.getShape();
// latLonPoint is inside the polygon
// THIS PRINTS "false" EXPECT IT TO PRINT "true"
System.out.println( "Inside polygon: " + gp.contains(
latLonPoint.getLongitude(), latLonPoint.getLatitude() );
</CODE>
I expect gp.contains( ) wants another representation of x,y but I don't know
what.
Any help is greatly appreciated.
-Tom
--
[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 Tue Dec 20 2005 - 10:02:24 EST