The shape object in OMLine is create fine. I can see my coordinates in
the object and it is being drawn the on map. The problem is in the
BasicGeometry.distanceToEdge method at line :
if (shape.contains(x,y))
The is always returns false therefore skipping all calculations and
returning POSITIVE_INFINITY.
Below is a sample code to demonstrate the problem.
GeneralPath path = new GeneralPath();
path.moveTo(10,20);
path.lineTo(20,20);
System.out.println("The path conatins point " + path.contains(15,20));
System.out.println("Path intersects " +path.intersects(15,20,1,1));
double d = java.awt.geom.Line2D.ptSegDist(10,20,20,20,15,20);
System.out.println("distance "+d);
Output:
The path conatins point false
Path intersects false
distance 0.0
For my purposes the if (shape.contains(x,y)) line should be removed.
-Chinh
Don Dietrick wrote:
> Hi Chinh,
>
> I'd check to see if the shape object is getting created for your
> OMLine. This usually occurs when the OMLine is generated. If the
> OMLine needs to be generated, the OMGraphic.distance() method will
> return infinity.
>
> - Don
>
> On Monday, January 27, 2003, at 05:53 PM, Chinh Tang wrote:
>
>> Hi all,
>> I think I've found a bug in 4.5.4. The description below works for
>> previous versions.
>> My code uses a list of OMLine contained in the OMGraphicList.
>> I tried to use OMGraphicList.findClosest(int x, int y, float limit)
>> on these OMLine and got a null back. The problem is
>> OMGraphic.distance(int x, int y) always return INFINITY for OMLine. I
>> think this method should be overridden.
>>
>> Can anyone confirm this bug?
>>
>> -Chinh
>>
>> --
>> [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"]
>>
>>
>
>
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
> Don Dietrick, BBN Technologies, dietrick@bbn.com
> 10 Moulton Street, Cambridge, MA 02138
> 617-873-3031 [fax]-2794
> =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
>
>
-- [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 Wed Jan 29 10:12:41 2003
This archive was generated by hypermail 2.1.8 : Thu May 12 2005 - 07:18:34 EDT