gps.tracks
Class PolylineEncoder

java.lang.Object
  extended by gps.tracks.PolylineEncoder

public final class PolylineEncoder
extends java.lang.Object


Constructor Summary
PolylineEncoder()
           
PolylineEncoder(int pNumLevels, int pZoomFactor, double pVerySmall, boolean forceEndpoints)
           
 
Method Summary
 BT747Hashtable createEncodings(Track track, int level, int step)
           
static double distance(Trackpoint p0, Trackpoint p1, Trackpoint p2)
          distance(p0, p1, p2) computes the distance between the point p0 and the segment [p1,p2].
 BT747Hashtable dpEncode(Track track)
          Douglas-Peucker algorithm, adapted for encoding
 BT747Hashtable getBounds()
           
static java.lang.String replace(java.lang.String s, java.lang.String one, java.lang.String another)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PolylineEncoder

public PolylineEncoder(int pNumLevels,
                       int pZoomFactor,
                       double pVerySmall,
                       boolean forceEndpoints)

PolylineEncoder

public PolylineEncoder()
Method Detail

dpEncode

public final BT747Hashtable dpEncode(Track track)
Douglas-Peucker algorithm, adapted for encoding

Returns:
[EncodedPoints;EncodedLevels]

replace

public static final java.lang.String replace(java.lang.String s,
                                             java.lang.String one,
                                             java.lang.String another)

distance

public static final double distance(Trackpoint p0,
                                    Trackpoint p1,
                                    Trackpoint p2)
distance(p0, p1, p2) computes the distance between the point p0 and the segment [p1,p2]. This could probably be replaced with something that is a bit more numerically stable.

Parameters:
p0 - Point.
p1 - First point of segment.
p2 - Second point of segment.
Returns:
Distance between point p0 and the segment [p1,p2].

createEncodings

public final BT747Hashtable createEncodings(Track track,
                                            int level,
                                            int step)

getBounds

public final BT747Hashtable getBounds()