refactored waypoint-matching into map-access-layer
This commit is contained in:
parent
02b8202001
commit
9e64eb39c4
6 changed files with 148 additions and 129 deletions
|
|
@ -0,0 +1,58 @@
|
|||
/**
|
||||
* Information on matched way point
|
||||
*
|
||||
* @author ab
|
||||
*/
|
||||
package btools.mapaccess;
|
||||
|
||||
import java.io.DataInput;
|
||||
import java.io.DataOutput;
|
||||
import java.io.IOException;
|
||||
|
||||
import btools.mapaccess.OsmNode;
|
||||
|
||||
public final class MatchedWaypoint
|
||||
{
|
||||
public OsmNode node1;
|
||||
public OsmNode node2;
|
||||
public OsmNode crosspoint;
|
||||
public OsmNode waypoint;
|
||||
public String name; // waypoint name used in error messages
|
||||
public double radius; // distance in meter between waypoint and crosspoint
|
||||
|
||||
public boolean hasUpdate;
|
||||
|
||||
public void writeToStream( DataOutput dos ) throws IOException
|
||||
{
|
||||
dos.writeInt( node1.ilat );
|
||||
dos.writeInt( node1.ilon );
|
||||
dos.writeInt( node2.ilat );
|
||||
dos.writeInt( node2.ilon );
|
||||
dos.writeInt( crosspoint.ilat );
|
||||
dos.writeInt( crosspoint.ilon );
|
||||
dos.writeInt( waypoint.ilat );
|
||||
dos.writeInt( waypoint.ilon );
|
||||
dos.writeDouble( radius );
|
||||
}
|
||||
|
||||
public static MatchedWaypoint readFromStream( DataInput dis ) throws IOException
|
||||
{
|
||||
MatchedWaypoint mwp = new MatchedWaypoint();
|
||||
mwp.node1 = new OsmNode();
|
||||
mwp.node2 = new OsmNode();
|
||||
mwp.crosspoint = new OsmNode();
|
||||
mwp.waypoint = new OsmNode();
|
||||
|
||||
mwp.node1.ilat = dis.readInt();
|
||||
mwp.node1.ilon = dis.readInt();
|
||||
mwp.node2.ilat = dis.readInt();
|
||||
mwp.node2.ilon = dis.readInt();
|
||||
mwp.crosspoint.ilat = dis.readInt();
|
||||
mwp.crosspoint.ilon = dis.readInt();
|
||||
mwp.waypoint.ilat = dis.readInt();
|
||||
mwp.waypoint.ilon = dis.readInt();
|
||||
mwp.radius = dis.readDouble();
|
||||
return mwp;
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue