package routingtile;
import java.io.IOException;
import java.io.RandomAccessFile;
import java.util.ArrayList;
import java.util.HashMap;
public class TestMain {
private static RoutingTileHeader header = new RoutingTileHeader();
private static SimpleIntersectionList simpleIntersection = new SimpleIntersectionList();
private static LinkList link = new LinkList();
private static RoutingIdRangeList routingIdRange = new RoutingIdRangeList();
protected static final int BITS_PER_BYTE = 0x8;
private static Readblom rb;
private final static StringBuilder strB = HexFinder.readData();
//创建一个指针
private static int pointer;
public static void main(String[] agrs)throws Exception{
//header赋值
routingTileHeader();
//调用simpleIntersection方法
simpleIntersection();
//调用link方法
link();
//调用routingIdRange方法
routingIdRange();
//调用linkId通过routingIdRange关联link方法
linkIdAttr();
}
//linkId通过routingIdRange关联link方法
/**
* linkIdAttr()
*/
public static void linkIdAttr() {
ArrayList<SimpleIntersection> simpleIntersections = simpleIntersection.getSimpleIntersection();
ArrayList<Link> links = link.getLink1();
ArrayList<NumRoutingListElements> featureRanges = routingIdRange.getFeatureRange();
int linkId = 0;
int startFeatureId,endFeatureId,dPosition = 0;
//取第46条
System.out.println("simpleIntersection[46]:");
System.out.println("dx:" + simpleIntersections.get(46).getPosition().getDx());
System.out.println("dy:" + simpleIntersections.get(46).getPosition().getDy());
System.out.println("numLinks:" + simpleIntersections.get(46).getNumLinks());
for (int r = 0;r < simpleIntersections.get(46).getConnectedLinks().size();r++ ){
System.out.println("connectedLinks[" + r + "]:");
System.out.println("isExternalLinkReference:" + simpleIntersections.get(46).getConnectedLinks().get(r).getIsExternalLinkReference());
if (simpleIntersections.get(46).getConnectedLinks().get(r).getIsExternalLinkReference()) {
linkId = simpleIntersections.get(46).getConnectedLinks().get(r).getLinkReferenceChoice().getExternalLinkReference().getTileExternalLinkReference().getLinkId();
System.out.println("extTileIdx:" + simpleIntersections.get(46).getConnectedLinks().get(r).getLinkReferenceChoice().getExternalLinkReference().getExtTileIdx());
System.out.println("positiveLinkDirection:" + simpleIntersections.get(46).getConnectedLinks().get(r).getLinkReferenceChoice().getExternalLinkReference().getTileExternalLinkReference().getPositiveLinkDirection());
System.out.println("LinkId:" + linkId + "\r\n");
}else {
linkId = simpleIntersections.get(46).getConnectedLinks().get(r).getLinkReferenceChoice().getInternalLinkReference().getLinkId();
System.out.println("positiveLinkDirection:" + simpleIntersections.get(46).getConnectedLinks().get(r).getLinkReferenceChoice().getInternalLinkReference().getPositiveLinkDirection());
System.out.println("LinkId:" + linkId+ "\r\n");
}
/* for (int n = 0; n < simpleIntersections.size(); n++) {
System.out.println("simpleIntersection[" + n + "]:");
System.out.println("dx:" + simpleIntersections.get(n).getPosition().getDx());
System.out.println("dy:" + simpleIntersections.get(n).getPosition().getDy());
System.out.println("numLinks:" + simpleIntersections.get(n).getNumLinks());
for (int r = 0;r < simpleIntersections.get(n).getConnectedLinks().size();r++ ){
System.out.println("connectedLinks[" + r + "]:");
System.out.println("isExternalLinkReference:" + simpleIntersections.get(n).getConnectedLinks().get(r).getIsExternalLinkReference());
if (simpleIntersections.get(n).getConnectedLinks().get(r).getIsExternalLinkReference()) {
linkId = simpleIntersections.get(n).getConnectedLinks().get(r).getLinkReferenceChoice().getExternalLinkReference().getTileExternalLinkReference().getLinkId();
System.out.println("extTileIdx:" + simpleIntersections.get(n).getConnectedLinks().get(r).getLinkReferenceChoice().getExternalLinkReference().getExtTileIdx());
System.out.println("positiveLinkDirection:" + simpleIntersections.get(n).getConnectedLinks().get(r).getLinkReferenceChoice().getExternalLinkReference().getTileExternalLinkReference().getPositiveLinkDirection());
System.out.println("LinkId:" + linkId + "\r\n");
}else {
linkId = simpleIntersections.get(n).getConnectedLinks().get(r).getLinkReferenceChoice().getInternalLinkReference().getLinkId();
System.out.println("positiveLinkDirection:" + simpleIntersections.get(n).getConnectedLinks().get(r).getLinkReferenceChoice().getInternalLinkReference().getPositiveLinkDirection());
System.out.println("LinkId:" + linkId+ "\r\n");
}*/
int xPosition = 0;
for (int t = 0; t < featureRanges.size(); t++) {
startFeatureId = featureRanges.get(t).getStartFeatureId();
endFeatureId = featureRanges.get(t).getEndFeatureId();
if (endFeatureId < linkId) {
dPosition = endFeatureId - startFeatureId + 1;
xPosition = dPosition + xPosition;
}else if ((startFeatureId <= linkId) || (linkId <= endFeatureId)) {
dPosition = linkId - startFeatureId + 1;
xPosition = dPosition + xPosition;
break;
}
}
xPosition = xPosition - 1;
if (xPosition < links.size()) {
//System.out.println("linkId:"+linkId+"对应的位置:"+(xPosition-1));
System.out.println("link:["+(xPosition)+"]");
System.out.println("length:" + links.get(xPosition).getLength().getLength1());
if (links.get(xPosition).getAttrSource().getAttrsource1()) {
System.out.println("attrSource: EXPLICIT (1)");
System.out.println("priorityRoadClass:" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getPriorityRoadClass().getPriorityRoadClass1());
switch (links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1()) {
case 0:
System.out.println("linkType: " + "NO_SPECIAL (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 1:
System.out.println("linkType: " + "RAMP (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 2:
System.out.println("linkType: " + "ROUNDABOUT (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 3:
System.out.println("linkType: " + "PARALLEL (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 4:
System.out.println("linkType: " + "SERVICE_ROAD (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 5:
System.out.println("linkType: " + "MAIN_ROAD (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 6:
System.out.println("linkType: " + "SQUARE (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 8:
System.out.println("linkType: " + "PEDESTRIAN_ZONE (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 9:
System.out.println("linkType: " + "PEDESTRIAN (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 10:
System.out.println("linkType: " + "ROUNDABOUT_INTERIOR (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 11:
System.out.println("linkType: " + "SLIP_ROAD (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 12:
System.out.println("linkType: " + "SPECIAL_TRAFFIC_FIGURE (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 13:
System.out.println("linkType: " + "BOUNDARY (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
default:
break;
}
switch (links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getTravelDirection().getTravelDirection()) {
case 0:
System.out.println("travelDirection: " + "IN_NO_DIRECTION (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getTravelDirection().getTravelDirection() + ")");
break;
case 1:
System.out.println("travelDirection: " + "IN_POSITIVE_DIRECTION (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getTravelDirection().getTravelDirection() + ")");
break;
case 2:
System.out.println("travelDirection: " + "IN_NEGATIVE_DIRECTION (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getTravelDirection().getTravelDirection() + ")");
break;
case 3:
System.out.println("travelDirection: " + "IN_BOTH_DIRECTIONS (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getTravelDirection().getTravelDirection() + ")");
break;
default:
break;
}
System.out.println("ferry:" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getFerry());
System.out.println("tunnel:" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getTunnel());
System.out.println("bridge:" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getBridge());
switch (links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getToll().getToll()) {
case 0:
System.out.println("toll: " + "IN_NO_DIRECTION (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getToll().getToll() + ")");
break;
case 1:
System.out.println("toll: " + "IN_POSITIVE_DIRECTION (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getToll().getToll() + ")");
break;
case 2:
System.out.println("toll: " + "IN_NEGATIVE_DIRECTION (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getToll().getToll() + ")");
break;
case 3:
System.out.println("toll: " + "IN_BOTH_DIRECTIONS (" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getToll().getToll() + ")");
break;
default:
break;
}
System.out.println("controlledAccess:" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getControlledAccess());
System.out.println("serviceArea:" + links.get(xPosition).getAttrInfo().getFixedAttributes().getSharedAttr().getServiceArea());
System.out.println("functionalRoadClass:" + links.get(xPosition).getAttrInfo().getFixedAttributes().getRoutingAttr().getFunctionalRoadClass().getFunctionalRoadClass());
System.out.println("urban:" + links.get(xPosition).getAttrInfo().getFixedAttributes().getRoutingAttr().getUrban());
System.out.println("complexIntersection:" + links.get(xPosition).getAttrInfo().getFixedAttributes().getRoutingAttr().getComplexIntersection());
System.out.println("pluralJunction:" + links.get(xPosition).getAttrInfo().getFixedAttributes().getRoutingAttr().getPluralJunction());
System.out.println("motorway:" + links.get(xPosition).getAttrInfo().getFixedAttributes().getRoutingAttr().getMotorway());
}else{
System.out.println("attrSource: INDEXED (0)");
System.out.println("fixedRoadAttributeSetListIndex:" + links.get(xPosition).getAttrInfo().getFixedRoadAttributeSetListIndex().getFixedRoadAttributeSetListIndex());
}
System.out.println("averageSpeed:" + links.get(xPosition).getAverageSpeed().getAverageSpeed());
System.out.println("startAngle:" + links.get(xPosition).getStartAngle().getStartAngle());
System.out.println("endAngle:" + links.get(xPosition).getEndAngle().getEndAngle() + "\r\n");
}else {
System.out.println("");
}
}
}
/**
* routingIdRange方法,返回RoutingIdRangeList
* @throws IOException
*/
public static RoutingIdRangeList routingIdRange() throws IOException{
//创建一个mp用于接收返回值
HashMap<String, Integer> mp;
//初始化LinkIdRangeListOffset指针位置
HexFinder.initialize(header.getLinkIdRangeListOffset());
//numFeatureRanges
RoutingIdRangeList rIRL = new RoutingIdRangeList();
NumRoutingListElements nRLE = new NumRoutingListElements();
mp = HexFinder.dicedall(16,pointer, strB);
pointer = mp.get("pointer");
int numFeatureRanges = mp.get("value");
rIRL.setNumFeatureRanges(numFeatureRanges);
// System.out.println("\r\n" + "numFeatureRanges:" + rIRL.getNumFeatureRanges());
ArrayList<NumRoutingListElements> featureranges = new ArrayList<NumRoutingListElements>();
for (int p = 0; p < rIRL.getNumFeatureRanges(); p++) {
NumRoutingListElements NRLE = new NumRoutingListElements();
mp = HexFinder.dicedall(16,pointer, strB);
pointer = mp.get("pointer");
int startFeatureId = mp.get("value");
NRLE.setStartFeatureId(startFeatureId);
mp = HexFinder.dicedall(16,pointer, strB);
pointer = mp.get("pointer");
int endFeatureId = mp.get("value");
NRLE.setEndFeatureId(endFeatureId);
featureranges.add(NRLE);
}
routingIdRange.setFeatureRange(featureranges);
//输出所有值
/* System.out.println("RoutingIdRangeList:");
for (int q = 0;q < featureranges.size();q++) {
System.out.println("\n"+"featureRange[" + q + "]:");
System.out.println("startFeatureId:" + featureranges.get(q).getStartFeatureId());
System.out.println("EndFeatureId:" + featureranges.get(q).getEndFeatureId());
}*/
return routingIdRange;
}
/**
* link方法,返回LinkList
* @throws IOException
*/
public static LinkList link() throws IOException{
//创建一个mp用于接收返回值
HashMap<String, Integer> mp;
//初始化LinksOffset指针位置
HexFinder.initialize(header.getLinksOffset());
//numLinks
LinkList linkList = new LinkList();
mp = HexFinder.dicedall(16,pointer, strB);
pointer = mp.get("pointer");
int numnumLinks = mp.get("value");
linkList.setNumnumLinks(numnumLinks);
// System.out.println("\n" + "numLinks:" + linkList.getNumnumLinks());
ArrayList<Link> links = new ArrayList<Link>();
for (int i = 0; i < linkList.getNumnumLinks(); i++) {
//linkList.getNumnumLinks()
Link lk = new Link();
FeatureLength FL = new FeatureLength();
StringBuilder stB = new StringBuilder();
for (int j = 0; j < 32/BITS_PER_BYTE; j++) {
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
int first = mp.get("value");
for (int m = 0; m < BITS_PER_BYTE - 1; m++) {
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
int seven = mp.get("value");
if (first == 1) {
stB = stB.append(seven);
}else {
stB = stB.append(seven);
}
}
if (first != 1) {
break;
}
}
Long length = Long .valueOf(stB.toString(),2);
FL.setLength1(length);
lk.setLength(FL);
AttributeSource aBS = new AttributeSource(); //选择 0 1
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
int attrSource = mp.get("value");
RoutingAttributeInfo rABI = new RoutingAttributeInfo(); //选择
//attrsource == 0 INDEXED = 0 输出INDEXED(0)
if (attrSource == 0) {
aBS.setAttrsource1(false);
FixedRoadAttributeSetListIndex fRASLI = new FixedRoadAttributeSetListIndex();
mp = HexFinder.dicedall(8,pointer, strB);
pointer = mp.get("pointer");
int fixedroadattributesetlistindex = mp.get("value");
rABI.setFixedRoadAttributeSetListIndex(fRASLI);
fRASLI.setFixedRoadAttributeSetListIndex(fixedroadattributesetlistindex);
lk.setAttrSource(aBS);
lk.setAttrInfo(rABI);
}else {
aBS.setAttrsource1(true);
lk.setAttrSource(aBS);
lk.setAttrInfo(rABI);
FixedRoadAttributeSet fRABS = new FixedRoadAttributeSet();
SharedRoadAttributes sRA = new SharedRoadAttributes();
RoutingRoadAttributes rRA = new RoutingRoadAttributes();
PriorityRoadClass pRC = new PriorityRoadClass();
LinkType lT = new LinkType();
Direction d = new Direction();
FunctionalRoadClass fRC = new FunctionalRoadClass();
//SharedRoadAttributes
mp = HexFinder.dicedall(4,pointer, strB);
pointer = mp.get("pointer");
int priorityroadclass = mp.get("value");
rABI.setFixedAttributes(fRABS);
sRA.setPriorityRoadClass(pRC);
pRC.setPriorityRoadClass1(priorityroadclass);
mp = HexFinder.dicedall(4,pointer, strB); //13个选择
pointer = mp.get("pointer");
int linkType = mp.get("value");
rABI.setFixedAttributes(fRABS);
fRABS.setSharedAttr(sRA);
sRA.setLinkType(lT);
lT.setLinkType1(linkType); //13个选择输出
mp = HexFinder.dicedall(2,pointer, strB); //4个选择
pointer = mp.get("pointer");
int travelDirection = mp.get("value");
rABI.setFixedAttributes(fRABS);
fRABS.setSharedAttr(sRA);
sRA.setTravelDirection(d);
d.setTravelDirection(travelDirection);
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
boolean ferry;
if(mp.get("value") == 1){
ferry = true;
}else{
ferry = false;
}
rABI.setFixedAttributes(fRABS);
fRABS.setSharedAttr(sRA);
sRA.setFerry(ferry);
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
boolean tunnel;
if(mp.get("value") == 1){
tunnel = true;
}else{
tunnel = false;
}
rABI.setFixedAttributes(fRABS);
fRABS.setSharedAttr(sRA);
sRA.setTunnel(tunnel);
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
boolean bridge;
if(mp.get("value") == 1){
bridge = true;
}else{
bridge = false;
}
rABI.setFixedAttributes(fRABS);
fRABS.setSharedAttr(sRA);
sRA.setBridge(bridge);
mp = HexFinder.dicedall(2,pointer, strB); //4个选择
pointer = mp.get("pointer");
int toll = mp.get("value");
rABI.setFixedAttributes(fRABS);
fRABS.setSharedAttr(sRA);
sRA.setToll(d);
d.setToll(toll);
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
boolean controlledAccess;
if(mp.get("value") == 1){
controlledAccess = true;
}else{
controlledAccess = false;
}
rABI.setFixedAttributes(fRABS);
fRABS.setSharedAttr(sRA);
sRA.setControlledAccess(controlledAccess);
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
boolean serviceArea;
if(mp.get("value") == 1){
serviceArea = true;
}else{
serviceArea = false;
}
rABI.setFixedAttributes(fRABS);
fRABS.setSharedAttr(sRA);
sRA.setServiceArea(serviceArea);
//RoutingRoadAttributes
mp = HexFinder.dicedall(3,pointer, strB);
pointer = mp.get("pointer");
int functionalRoadClass = mp.get("value");
rABI.setFixedAttributes(fRABS);
fRABS.setRoutingAttr(rRA);
rRA.setFunctionalRoadClass(fRC);
fRC.setFunctionalRoadClass(functionalRoadClass);
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
boolean urban;
if(mp.get("value") == 1){
urban = true;
}else{
urban = false;
}
rABI.setFixedAttributes(fRABS);
fRABS.setRoutingAttr(rRA);
rRA.setUrban(urban);
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
boolean complexIntersection;
if(mp.get("value") == 1){
complexIntersection = true;
}else{
complexIntersection = false;
}
rABI.setFixedAttributes(fRABS);
fRABS.setRoutingAttr(rRA);
rRA.setComplexIntersection(complexIntersection);
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
boolean pluralJunction;
if(mp.get("value") == 1){
pluralJunction = true;
}else{
pluralJunction = false;
}
rABI.setFixedAttributes(fRABS);
fRABS.setRoutingAttr(rRA);
rRA.setPluralJunction(pluralJunction);
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
boolean motorway;
if(mp.get("value") == 1){
motorway = true;
}else{
motorway = false;
}
rABI.setFixedAttributes(fRABS);
fRABS.setRoutingAttr(rRA);
rRA.setMotorway(motorway);
}
AverageSpeed aS = new AverageSpeed();
LinkSector lS = new LinkSector();
mp = HexFinder.dicedall(8,pointer, strB);
pointer = mp.get("pointer");
int averageSpeed = mp.get("value");
lk.setAverageSpeed(aS);
aS.setAverageSpeed(averageSpeed);
mp = HexFinder.dicedall(6,pointer, strB);
pointer = mp.get("pointer");
int startangle = mp.get("value");
lk.setStartAngle(lS);
lS.setStartAngle(startangle);
mp = HexFinder.dicedall(6,pointer, strB);
pointer = mp.get("pointer");
int endangle = mp.get("value");
lk.setEndAngle(lS);
lS.setEndAngle(endangle);
links.add(lk);
}
link.setLink1(links);
//输出所有值
/* System.out.println("LinkList:");
for (int k = 0; k < links.size();k++) {
System.out.println("\n"+"link[" + k + "]:");
System.out.println("length:" + links.get(k).getLength().getLength1());
if (links.get(k).getAttrSource().getAttrsource1()) {
System.out.println("attrSource: EXPLICIT (1)");
System.out.println("priorityRoadClass:" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getPriorityRoadClass().getPriorityRoadClass1());
switch (links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1()) {
case 0:
System.out.println("linkType: " + "NO_SPECIAL (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 1:
System.out.println("linkType: " + "RAMP (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 2:
System.out.println("linkType: " + "ROUNDABOUT (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 3:
System.out.println("linkType: " + "PARALLEL (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 4:
System.out.println("linkType: " + "SERVICE_ROAD (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 5:
System.out.println("linkType: " + "MAIN_ROAD (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 6:
System.out.println("linkType: " + "SQUARE (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 8:
System.out.println("linkType: " + "PEDESTRIAN_ZONE (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 9:
System.out.println("linkType: " + "PEDESTRIAN (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 10:
System.out.println("linkType: " + "ROUNDABOUT_INTERIOR (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 11:
System.out.println("linkType: " + "SLIP_ROAD (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 12:
System.out.println("linkType: " + "SPECIAL_TRAFFIC_FIGURE (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
case 13:
System.out.println("linkType: " + "BOUNDARY (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getLinkType().getLinkType1() + ")");
break;
default:
break;
}
switch (links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getTravelDirection().getTravelDirection()) {
case 0:
System.out.println("travelDirection: " + "IN_NO_DIRECTION (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getTravelDirection().getTravelDirection() + ")");
break;
case 1:
System.out.println("travelDirection: " + "IN_POSITIVE_DIRECTION (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getTravelDirection().getTravelDirection() + ")");
break;
case 2:
System.out.println("travelDirection: " + "IN_NEGATIVE_DIRECTION (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getTravelDirection().getTravelDirection() + ")");
break;
case 3:
System.out.println("travelDirection: " + "IN_BOTH_DIRECTIONS (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getTravelDirection().getTravelDirection() + ")");
break;
default:
break;
}
System.out.println("ferry:" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getFerry());
System.out.println("tunnel:" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getTunnel());
System.out.println("bridge:" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getBridge());
switch (links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getToll().getToll()) {
case 0:
System.out.println("toll: " + "IN_NO_DIRECTION (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getToll().getToll() + ")");
break;
case 1:
System.out.println("toll: " + "IN_POSITIVE_DIRECTION (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getToll().getToll() + ")");
break;
case 2:
System.out.println("toll: " + "IN_NEGATIVE_DIRECTION (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getToll().getToll() + ")");
break;
case 3:
System.out.println("toll: " + "IN_BOTH_DIRECTIONS (" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getToll().getToll() + ")");
break;
default:
break;
}
System.out.println("controlledAccess:" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getControlledAccess());
System.out.println("serviceArea:" + links.get(k).getAttrInfo().getFixedAttributes().getSharedAttr().getServiceArea());
System.out.println("functionalRoadClass:" + links.get(k).getAttrInfo().getFixedAttributes().getRoutingAttr().getFunctionalRoadClass().getFunctionalRoadClass());
System.out.println("urban:" + links.get(k).getAttrInfo().getFixedAttributes().getRoutingAttr().getUrban());
System.out.println("complexIntersection:" + links.get(k).getAttrInfo().getFixedAttributes().getRoutingAttr().getComplexIntersection());
System.out.println("pluralJunction:" + links.get(k).getAttrInfo().getFixedAttributes().getRoutingAttr().getPluralJunction());
System.out.println("motorway:" + links.get(k).getAttrInfo().getFixedAttributes().getRoutingAttr().getMotorway());
}else{
System.out.println("attrSource: INDEXED (0)");
System.out.println("fixedRoadAttributeSetListIndex:" + links.get(k).getAttrInfo().getFixedRoadAttributeSetListIndex().getFixedRoadAttributeSetListIndex());
}
System.out.println("averageSpeed:" + links.get(k).getAverageSpeed().getAverageSpeed());
System.out.println("startAngle:" + links.get(k).getStartAngle().getStartAngle());
System.out.println("endAngle:" + links.get(k).getEndAngle().getEndAngle() + "\r\n");
}*/
return link;
}
/**
* simpleIntersection方法,返回SimpleIntersectionList
* @throws IOException
*/
public static SimpleIntersectionList simpleIntersection() throws IOException{
//创建一个mp用于接收返回值
HashMap<String, Integer> mp;
//初始化SimpleIntersectionOffset指针位置
HexFinder.initialize(header.getSimpleIntersectionOffset());
//numIntersections
SimpleIntersectionList numIntersectionList = new SimpleIntersectionList();
mp = HexFinder.dicedall(16,pointer, strB);
pointer = mp.get("pointer");
int numIntersection = mp.get("value");
numIntersectionList.setNumIntersections(numIntersection);
// System.out.println("numIntersections:" + numIntersectionList.getNumIntersections());
ArrayList<SimpleIntersection> simpleIntersections =new ArrayList<SimpleIntersection>();
for(int h = 0; h<simpleIntersection.getNumIntersections(); h++)
{
// 放到CoordXYOffset对象中
CoordXYOffset coordXYOffset = new CoordXYOffset();
SimpleIntersection sIntersection = new SimpleIntersection();
mp = HexFinder.dicedall(14,pointer, strB);
pointer = mp.get("pointer");
int dx = mp.get("value");
if (14 < 64 && (dx & (1L << (14-1))) != 0) {
dx |= (-1L << 14);
}
mp = HexFinder.dicedall(14,pointer, strB);
pointer = mp.get("pointer");
int dy = mp.get("value");
if (14 < 64 && (dy & (1L << (14-1))) != 0) {
dy |= (-1L << 14);
}
coordXYOffset.setDx(dx);
coordXYOffset.setDy(dy);
mp = HexFinder.dicedall(8,pointer, strB);
pointer = mp.get("pointer");
int numLinks = mp.get("value");
sIntersection.setNumLinks(numLinks);
sIntersection.setPosition(coordXYOffset);
ArrayList<IntOrExtDirectedLinkReference> connectedLinks = new ArrayList<IntOrExtDirectedLinkReference>();
for(int g = 0; g<sIntersection.getNumLinks(); g++)
{
DirectedLinkReference dLR= new DirectedLinkReference();
ExternalDirectedLinkReference eDLR = new ExternalDirectedLinkReference();
IntOrExtDirectedLinkReference iEDLR = new IntOrExtDirectedLinkReference();
LinkReferenceChoice choice = new LinkReferenceChoice();
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
int isExternalLinkReference = mp.get("value");
//IsExternalLinkReference等于false时
if(isExternalLinkReference==0){
iEDLR.setIsExternalLinkReference(false);
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
boolean positiveLinkDirection;
if(mp.get("value") == 1){
positiveLinkDirection = true;
}else{
positiveLinkDirection = false;
}
dLR.setPositiveLinkDirection(positiveLinkDirection);
mp = HexFinder.dicedall(15,pointer, strB);
pointer = mp.get("pointer");
int linkId = mp.get("value");
dLR.setLinkId(linkId);
choice.setInternalLinkReference(dLR);
choice.setExternalLinkReference(eDLR);
iEDLR.setLinkReferenceChoice(choice);
connectedLinks.add(iEDLR);
}else{ //true
iEDLR.setIsExternalLinkReference(true);
mp = HexFinder.dicedall(8,pointer, strB);
pointer = mp.get("pointer");
int extTileIdx = mp.get("value");
mp = HexFinder.dicedall(1,pointer, strB);
pointer = mp.get("pointer");
boolean positiveLinkDirection;
if(mp.get("value") == 1){
positiveLinkDirection = true;
}else{
positiveLinkDirection = false;
}
dLR.setPositiveLinkDirection(positiveLinkDirection);
mp = HexFinder.dicedall(15,pointer, strB);
pointer = mp.get("pointer");
int linkId = mp.get("value");
dLR.setLinkId(linkId);
eDLR.setTileExternalLinkReference(dLR);
eDLR.setExtTileIdx(extTileIdx);
eDLR.setTileExternalLinkReference(dLR);
choice.setInternalLinkReference(dLR);
choice.setExternalLinkReference(eDLR);
iEDLR.setLinkReferenceChoice(choice);
connectedLinks.add(iEDLR);
}
}
sIntersection.setConnectedLinks(connectedLinks);
simpleIntersections.add(sIntersection);
}
simpleIntersection.setSimpleIntersection(simpleIntersections);
//输出所有值
/* System.out.println("SimpleIntersectionList:");
for (int y = 0; y < simpleIntersections.size(); y++) {
System.out.println("\n"+"simpleIntersection[" + y + "]:");
System.out.println("dx:" + simpleIntersections.get(y).getPosition().getDx());
System.out.println("dy:" + simpleIntersections.get(y).getPosition().getDy());
System.out.println("numLinks:" + simpleIntersections.get(y).getNumLinks());
for (int z = 0;z < simpleIntersections.get(y).getConnectedLinks().size();z++ ) {
System.out.println("connectedLinks[" + z + "]:");
System.out.println("isExternalLinkReference:" + simpleIntersections.get(y).getConnectedLinks().get(z).getIsExternalLinkReference());
if (simpleIntersections.get(y).getConnectedLinks().get(z).getIsExternalLinkReference()) {
System.out.println("extTileIdx:" + simpleIntersections.get(y).getConnectedLinks().get(z).getLinkReferenceChoice().getExternalLinkReference().getExtTileIdx());
System.out.println("positiveLinkDirection:" + simpleIntersections.get(y).getConnectedLinks().get(z).getLinkReferenceChoice().getExternalLinkReference().getTileExternalLinkReference().getPositiveLinkDirection());
System.out.println("LinkId:" + simpleIntersections.get(y).getConnectedLinks().get(z).getLinkReferenceChoice().getExternalLinkReference().getTileExternalLinkReference().getLinkId());
}else {
System.out.println("positiveLinkDirection:" + simpleIntersections.get(y).getConnectedLinks().get(z).getLinkReferenceChoice().getInternalLinkReference().getPositiveLinkDirection());
System.out.println("LinkId:" + simpleIntersections.get(y).getConnectedLinks().get(z).getLinkReferenceChoice().getInternalLinkReference().getLinkId());
}
}
}*/
//取第几条
/* SimpleIntersection intersection = simpleIntersection.getSimpleIntersection().get(15);
System.out.println("dx:" + intersection.getPosition().getDx());
System.out.println("dy:" + intersection.getPosition().getDy());
System.out.println("NumLinks:" + intersection.getNumLinks());
ArrayList<IntOrExtDirectedLinkReference> connectedLinks = intersection.getConnectedLinks();
for (int x = 0; x < connectedLinks.size(); x++) {
if (connectedLinks.get(x).getIsExternalLinkReference()) {
System.out.println("IsExternalLinkReference:" + connectedLinks.get(x).getIsExternalLinkReference());
System.out.println("extTileIdx:" + connectedLinks.get(x).getLinkReferenceChoice().getExternalLinkReference().getExtTileIdx());
System.out.println("positiveLinkDirection:" + connectedLinks.get(x).getLinkReferenceChoice().getExternalLinkReference().getTileExternalLinkReference().getPositiveLinkDirection());
System.out.println("LinkId:" + connectedLinks.get(x).getLinkReferenceChoice().getExternalLinkReference().getTileExternalLinkReference().getLinkId());
}else {
System.out.println("IsExternalLinkReference:" + connectedLinks.get(x).getIsExternalLinkReference());
System.out.println("positiveLinkDirection:" + connectedLinks.get(x).getLinkReferenceChoice().getInternalLinkReference().getPositiveLinkDirection());
System.out.println("LinkId:" + connectedLinks.get(x).getLinkReferenceChoice().getInternalLinkReference().getLinkId());
}
}
*/
return simpleIntersection;
}
/**
* routingTileHeader方法,给header赋值
* @throws IOException
*/
public static void routingTileHeader() throws IOException{
RandomAccessFile in=new RandomAccessFile("second.dat","r");
rb = new Readblom(2);
in.read(rb.buffer, 0, 2);
RoutingContentMask routingcontentmask = new RoutingContentMask();
routingcontentmask.setHasFixedRoadAttributeSetList(rb.readBool());
routingcontentmask.setHasSimpleIntersectionList(rb.readBool());
routingcontentmask.setHasLinkList(rb.readBool());
routingcontentmask.setHasRouteUpLinkList(rb.readBool());
routingcontentmask.setHasRouteDownLinkList(rb.readBool());
routingcontentmask.setHasLinkToTileList(rb.readBool());
routingcontentmask.setHasLinkIdRangeList(rb.readBool());
routingcontentmask.setHasSimpleIntersectionIdRangeList(rb.readBool());
routingcontentmask.setHasAttributeMaps(rb.readBool());
routingcontentmask.setHasExternalTileIdList(rb.readBool());
header.setContentMask(routingcontentmask);
if(header.getContentMask().getHasFixedRoadAttributeSetList() == true)
{
header.setFixedRoadAttributeSetListOffset(in.readInt());
}
if(header.getContentMask().getHasSimpleIntersectionList() == true)
{
header.setSimpleIntersectionOffset(in.readInt());
}
if(header.getContentMask().getHasLinkList()== true)
{
header.setLinksOffset(in.readInt());
}
if(header.getContentMask().getHasRouteUpLinkList()== true)
{
header.setRouteUpLinksOffset(in.readInt());
}
if(header.getContentMask().getHasRouteDownLinkList()== true)
{
header.setRouteDownLinksOffset(in.readInt());
}
if(header.getContentMask().getHasLinkToTileList()== true)
{
header.setLink2TileListOffset(in.readInt());
}
if(header.getContentMask().getHasLinkIdRangeList()== true)
{
header.setLinkIdRangeListOffset(in.readInt());
}
if(header.getContentMask().getHasSimpleIntersectionIdRangeList()== true)
{
header.setSimplIntIdRangeListOffset(in.readInt());
}
if(header.getContentMask().getHasAttributeMaps()== true)
{
header.setAttributeMapsOffset(in.readInt());
}
if(header.getContentMask().getHasExternalTileIdList()== true)
{
header.setExternalTileIdListOffset(in.readInt());
}
/* System.out.println(
+header.getFixedRoadAttributeSetListOffset() + "\r\n"
+header.getSimpleIntersectionOffset() + "\r\n"
+header.getLinksOffset() + "\r\n"
+header.getRouteUpLinksOffset() + "\r\n"
+header.getRouteDownLinksOffset() + "\r\n"
+header.getLink2TileListOffset() + "\r\n"
+header.getSimplIntIdRangeListOffset() + "\r\n"
+header.getLinkIdRangeListOffset() + "\r\n"
+header.getAttributeMapsOffset() + "\r\n"
+header.getExternalTileIdListOffset() + "\r\n");*/
in.seek(header.getSimpleIntersectionOffset());
simpleIntersection.setNumIntersections(in.readShort());
}
}
class Readblom{
protected int bytePosition;
protected int bitOffset;
protected static final byte BYTE_MOD_MASK = 0x7;
protected static final int BITS_PER_BYTE = 0x8;
protected static final int BITS_PER_LONG = 0x40;
public byte[] buffer;
Readblom(int b)
{
buffer = new byte[b];
}
public long getBitPosition()
{
return BITS_PER_BYTE * bytePosition + bitOffset;
}
//设置bit位置
public void setBitPosition(final long bitPosition) throws IOException
{
bitOffset = (int)(bitPosition % 8);
bytePosition = (int)(bitPosition / BITS_PER_BYTE);
}
private byte nextByte() throws IOException
{
if (bytePosition >= buffer.length)
throw new IOException("ByteArrayBitStreamReader: Unable to read byte on offset position " +
(bytePosition + 1) + ". It's beyond end of the stream with length " + buffer.length + ".");
return buffer[bytePosition++];
}
/**
* Returns the next unsigned byte without resetting the bit offset.
*
* @return Read next byte.
*
* @throws IOException If the reading failed.
*/
private int nextUnsignedByte() throws IOException
{
return nextByte() & 0xff;
}
public boolean readBool() throws IOException
{
return readBits(1) == 1;
}
//有符号位
public long readSignedBits(final int numBits) throws IOException
{
long result = readBits(numBits);
/*
* Perform a sign extension if needed.
* 1L << 64 in Java is not 0L, but 1L, so treat numBits == 64 as a special case
* (numBits == 64 does not need sign extension anyway)
*/
if (numBits < 64 && (result & (1L << (numBits - 1))) != 0)
{
result |= (-1L << numBits);
}
return result;
}
public long readBits(final int numBits) throws IOException
{
int bitsToRead = bitOffset + numBits;
final int nextBitOffset = bitsToRead & BYTE_MOD_MASK;
long accum = 0L;
while (bitsToRead > 0)
{
accum = (accum << BITS_PER_BYTE) | nextUnsignedByte();
bitsToRead -= BITS_PER_BYTE;
}
bitOffset = nextBitOffset;
if (nextBitOffset != 0)
{
bytePosition--;
}
/*
* Shift away unwanted bits on the right and mask out unwanted bits on
* the left.
*/
return (accum >>> -bitsToRead) & (-1L >>> (BITS_PER_LONG - numBits));
}
}
class RoutingContentMask{
private boolean hasFixedRoadAttributeSetList;
private boolean hasSimpleIntersectionList;
private boolean hasLinkList;
private boolean hasRouteUpLinkList;
private boolean hasRouteDownLinkList;
private boolean hasLinkToTileList;
private boolean hasLinkIdRangeList;
private boolean hasSimpleIntersectionIdRangeList;
private boolean hasAttributeMaps;
private boolean hasExternalTileIdList;
public RoutingContentMask() {}
public void setHasFixedRoadAttributeSetList(boolean hasFixedRoadAttributeSetList) {
this.hasFixedRoadAttributeSetList = hasFixedRoadAttributeSetList;
}
public boolean getHasFixedRoadAttributeSetList() {
return hasFixedRoadAttributeSetList;
}
public void setHasSimpleIntersectionList(boolean hasSimpleIntersectionList) {
this.hasSimpleIntersectionList = hasSimpleIntersectionList;
}
public boolean getHasSimpleIntersectionList() {
return hasSimpleIntersectionList;
}
public void setHasLinkList(boolean hasLinkList) {
this.hasLinkList = hasLinkList;
}
public boolean getHasLinkList() {
return hasLinkList;
}
public void setHasRouteUpLinkList(boolean hasRouteUpLinkList) {
this.hasRouteUpLinkList = hasRouteUpLinkList;
}
public boolean getHasRouteUpLinkList() {
return hasRouteUpLinkList;
}
public void setHasRouteDownLinkList(boolean hasRouteDownLinkList) {
this.hasRouteDownLinkList = hasRouteDownLinkList;
}
public boolean getHasRouteDownLinkList() {
return hasRouteDownLinkList;
}
public void setHasLinkToTileList(boolean hasLinkToTileList) {
this.hasLinkToTileList = hasLinkToTileList;
}
public boolean getHasLinkToTileList() {
return hasLinkToTileList;
}
public void setHasLinkIdRangeList(boolean hasLinkIdRangeList) {
this.hasLinkIdRangeList = hasLinkIdRangeList;
}
public boolean getHasLinkIdRangeList() {
return hasLinkIdRangeList;
}
public void setHasSimpleIntersectionIdRangeList(boolean hasSimpleIntersectionIdRangeList) {
this.hasSimpleIntersectionIdRangeList = hasSimpleIntersectionIdRangeList;
}
public boolean getHasSimpleIntersectionIdRangeList() {
return hasSimpleIntersectionIdRangeList;
}
public void setHasAttributeMaps(boolean hasAttributeMaps) {
this.hasAttributeMaps = hasAttributeMaps;
}
public boolean getHasAttributeMaps() {
return hasAttributeMaps;
}
public void setHasExternalTileIdList(boolean hasExternalTileIdList) {
this.hasExternalTileIdList = hasExternalTileIdList;
}
public boolean getHasExternalTileIdList() {
return hasExternalTileIdList;
}
}
class RoutingTileHeader {
RoutingContentMask contentMask;
int fixedRoadAttributeSetListOffset;
int simpleIntersectionOffset;
int linksOffset;
int routeUpLinksOffset;
int routeDownLinksOffset;
int link2TileListOffset;
int linkIdRangeListOffset;
int simplIntIdRangeListOffset;
int attributeMapsOffset;
int externalTileIdListOffset;
public RoutingTileHeader() {}
public RoutingContentMask getContentMask() {
return contentMask;
}
public void setContentMask(RoutingContentMask contentMask) {
this.contentMask = contentMask;
}
public int getFixedRoadAttributeSetListOffset() {
return fixedRoadAttributeSetListOffset;
}
public void setFixedRoadAttributeSetListOffset(int fixedRoadAttributeSetListOffset) {
this.fixedRoadAttributeSetListOffset = fixedRoadAttributeSetListOffset;
}
public int getSimpleIntersectionOffset() {
return simpleIntersectionOffset;
}
public void setSimpleIntersectionOffset(int simpleIntersectionOffset) {
this.simpleIntersectionOffset = simpleIntersectionOffset;
}
public int getLinksOffset() {
return linksOffset;
}
public void setLinksOffset(int linksOffset) {
this.linksOffset = linksOffset;
}
public int getRouteUpLinksOffset() {
return routeUpLinksOffset;
}
public void setRouteUpLinksOffset(int routeUpLinksOffset) {
this.routeUpLinksOffset = routeUpLinksOffset;
}
public int getRouteDownLinksOffset() {
return routeDownLinksOffset;
}
public void setRouteDownLinksOffset(int routeDownLinksOffset) {
this.routeDownLinksOffset = routeDownLinksOffset;
}
public int getLink2TileListOffset() {
return link2TileListOffset;
}
public void setLink2TileListOffset(int link2TileListOffset) {
this.link2TileListOffset = link2TileListOffset;
}
public int getLinkIdRangeListOffset() {
return linkIdRangeListOffset;
}
public void setLinkIdRangeListOffset(int linkIdRangeListOffset) {
this.linkIdRangeListOffset = linkIdRangeListOffset;
}
public int getSimplIntIdRangeListOffset() {
return simplIntIdRangeListOffset;
}
public void setSimplIntIdRangeListOffset(int simplIntIdRangeListOffset) {
this.simplIntIdRangeListOffset = simplIntIdRangeListOffset;
}
public int getAttributeMapsOffset() {
return attributeMapsOffset;
}
public void setAttributeMapsOffset(int attributeMapsOffset) {
this.attributeMapsOffset = attributeMapsOffset;
}
public int getExternalTileIdListOffset() {
return externalTileIdListOffset;
}
public void setExternalTileIdListOffset(int externalTileIdListOffset) {
this.externalTileIdListOffset = externalTileIdListOffset;
}
}
class SimpleIntersectionList {
private int numIntersections;
private ArrayList<SimpleIntersection> simpleIntersection;//simpleIntersection[numIntersections]
public SimpleIntersectionList() {}
public int getNumIntersections() {
return numIntersections;
}
public void setNumIntersections(int numIntersections) {
this.numIntersections = numIntersections;
}
public ArrayList<SimpleIntersection> getSimpleIntersection() {
return simpleIntersection;
}
public void setSimpleIntersection(ArrayList<SimpleIntersection> simpleIntersection) {
this.simpleIntersection = simpleIntersection; //simpleIntersection.addAll(simpleIntersection);
}
}
class SimpleIntersection{
private CoordXYOffset position;
private int numLinks;
private ExternalDirectedLinkReference externalLinkReference;
private ArrayList<IntOrExtDirectedLinkReference> connectedLinks;//connectedLinks[numLinks]
public SimpleIntersection() {}
public CoordXYOffset getPosition() {
return position;
}
public void setPosition(CoordXYOffset position) {
this.position = position;
}
public int getNumLinks() {
return numLinks;
}
public void setNumLinks(int numLinks) {
this.numLinks = numLinks;
}
public ArrayList<IntOrExtDirectedLinkReference> getConnectedLinks() {
return connectedLinks;
}
public void setConnectedLinks(ArrayList<IntOrExtDirectedLinkReference> connectedLinks) {
this.connectedLinks = connectedLinks; //connectedLinks.addAll(connectedLinks);
}
public ExternalDirectedLinkReference getExternalLinkReference() {
return externalLinkReference;
}
public void setExternalLinkReference(
ExternalDirectedLinkReference externalLinkReference) {
this.externalLinkReference = externalLinkReference;
}
}
class CoordXYOffset{
private int numBits;
private int dx;
private int dy;
public CoordXYOffset() {}
public int getNumBits() {
return numBits;
}
public void setNumBits(int numBits) {
this.numBits = numBits;
}
public int getDx() {
return dx;
}
public void setDx(int dx) {
this.dx = dx;
}
public int getDy() {
return dy;
}
public void setDy(int dy) {
this.dy = dy;
}
}
class IntOrExtDirectedLinkReference{
private boolean isExternalLinkReference;
private LinkReferenceChoice linkReferenceChoice;
public IntOrExtDirectedLinkReference() {}
public boolean getIsExternalLinkReference() {
return isExternalLinkReference;
}
public void setIsExternalLinkReference(boolean isExternalLinkReference) {
this.isExternalLinkReference = isExternalLinkReference;
}
public LinkReferenceChoice getLinkReferenceChoice() {
return linkReferenceChoice;
}
public void setLinkReferenceChoice(LinkReferenceChoice linkReferenceChoice) {
this.linkReferenceChoice = linkReferenceChoice;
}
}
class LinkReferenceChoice{
private DirectedLinkReference internalLinkReference;
private ExternalDirectedLinkReference externalLinkReference;
public LinkReferenceChoice() {}
public DirectedLinkReference getInternalLinkReference() {
return internalLinkReference;
}
public void setInternalLinkReference(DirectedLinkReference internalLinkReference) {
this.internalLinkReference = internalLinkReference;
}
public ExternalDirectedLinkReference getExternalLinkReference() {
return externalLinkReference;
}
public void setExternalLinkReference(ExternalDirectedLinkReference externalLinkReference) {
this.externalLinkReference = externalLinkReference;
}
}
class DirectedLinkReference{
private boolean positiveLinkDirection;
private int linkId;
public DirectedLinkReference() {}
public boolean getPositiveLinkDirection() {
return positiveLinkDirection;
}
public void setPositiveLinkDirection(boolean positiveLinkDirection) {
this.positiveLinkDirection = positiveLinkDirection;
}
public int getLinkId() {
return linkId;
}
public void setLinkId(int linkId2) {
this.linkId = linkId2;
}
}
class LinkId{
private byte linkId;
public LinkId() {}
public byte getLinkId() {
return linkId;
}
public void setLinkId(byte linkId) {
this.linkId = linkId;
}
}
class ExternalDirectedLinkReference{
private int extTileIdx;
private DirectedLinkReference tileExternalLinkReference;
public ExternalDirectedLinkReference() {}
public int getExtTileIdx() {
return extTileIdx;
}
public void setExtTileIdx(int extTileIdx2) {
this.extTileIdx = extTileIdx2;
}
public DirectedLinkReference getTileExternalLinkReference() {
return tileExternalLinkReference;
}
public void setTileExternalLinkReference(DirectedLinkReference tileExternalLinkReference) {
this.tileExternalLinkReference = tileExternalLinkReference;
}
}
class SizeOfExternalTileIdList{
private int SizeOfExternalTileIdList;
public SizeOfExternalTileIdList() {}
public int getSizeOfExternalTileIdList() {
return SizeOfExternalTileIdList;
}
public void setSizeOfExternalTileIdList(int SizeOfExternalTileIdList) {
this.SizeOfExternalTileIdList = SizeOfExternalTileIdList;
}
}
class LinkList{
private int numnumLinks; //uint16 16位
private ArrayList<Link> link1; //有问题 //集合
public LinkList() {}
public int getNumnumLinks() {
return numnumLinks;
}
public void setNumnumLinks(int numnumLinks) {
this.numnumLinks = numnumLinks;
}
public ArrayList<Link> getLink1() {
return link1;
}
public void setLink1(ArrayList<Link> link1) {
this.link1 = link1;
}
}
class Link{
private FeatureLength length;
private AttributeSource attrSource;
private RoutingAttributeInfo attrInfo;
private AverageSpeed averageSpeed;
private LinkSector startAngle;
private LinkSector endAngle;
public Link() {}
public FeatureLength getLength() {
return length;
}
public void setLength(FeatureLength length) {
this.length = length;
}
public AttributeSource getAttrSource() {
return attrSource;
}
public void setAttrSource(AttributeSource attrSource) {
this.attrSource = attrSource;
}
public RoutingAttributeInfo getAttrInfo() {
return attrInfo;
}
public void setAttrInfo(RoutingAttributeInfo attrInfo) {
this.attrInfo = attrInfo;
}
public AverageSpeed getAverageSpeed() {
return averageSpeed;
}
public void setAverageSpeed(AverageSpeed averageSpeed) {
this.averageSpeed = averageSpeed;
}
public LinkSector getStartAngle() {
return startAngle;
}
public void setStartAngle(LinkSector startAngle) {
this.startAngle = startAngle;
}
public LinkSector getEndAngle() {
return endAngle;
}
public void setEndAngle(LinkSector endAngle) {
this.endAngle = endAngle;
}
}
class FeatureLength{
private long length; //varuint32 24位可变
public FeatureLength() {}
public long getLength1() {
return length;
}
public void setLength1(long length) {
this.length = length;
}
}
class AttributeSource{
// private int INDEXED; //1bit INDEXED = 0
// private int EXPLICIT; //1bit EXPLICIT = 1
private boolean attrsource;
public AttributeSource() {}
public boolean getAttrsource1() {
return attrsource;
}
public void setAttrsource1(boolean attrsource) {
this.attrsource = attrsource;
}
// public int getINDEXED() {
// return INDEXED;
// }
// public void setINDEXED(int INDEXED) {
// this.INDEXED = INDEXED;
// }
// public int getEXPLICIT() {
// return EXPLICIT;
// }
// public void setEXPLICIT(int EXPLICIT) {
// this.EXPLICIT = EXPLICIT;
// }
}
class RoutingAttributeInfo{
private FixedRoadAttributeSetListIndex fixedRoadAttributeSetListIndex;
private FixedRoadAttributeSet fixedAttributes;
public RoutingAttributeInfo() {}
public FixedRoadAttributeSetListIndex getFixedRoadAttributeSetListIndex() {
return fixedRoadAttributeSetListIndex;
}
public void setFixedRoadAttributeSetListIndex(FixedRoadAttributeSetListIndex fixedRoadAttributeSetListIndex) {
this.fixedRoadAttributeSetListIndex = fixedRoadAttributeSetListIndex;
}
public FixedRoadAttributeSet getFixedAttributes() {
return fixedAttributes;
}
public void setFixedAttributes(FixedRoadAttributeSet fixedAttributes) {
this.fixedAttributes = fixedAttributes;
}
}
class FixedRoadAttributeSetListIndex{ //1bit INDEXED = 0时
private int fixedRoadAttributeSetListIndex; //varuint16 8位
public FixedRoadAttributeSetListIndex() {}
public int getFixedRoadAttributeSetListIndex() {
return fixedRoadAttributeSetListIndex;
}
public void setFixedRoadAttributeSetListIndex(int fixedRoadAttributeSetListIndex) {
this.fixedRoadAttributeSetListIndex = fixedRoadAttributeSetListIndex;
}
}
class FixedRoadAttributeSet{ //1bit EXPLICIT = 1时
private SharedRoadAttributes sharedAttr;
private RoutingRoadAttributes routingAttr;
public FixedRoadAttributeSet() {}
public SharedRoadAttributes getSharedAttr() {
return sharedAttr;
}
public void setSharedAttr(SharedRoadAttributes sharedAttr) {
this.sharedAttr = sharedAttr;
}
public RoutingRoadAttributes getRoutingAttr() {
return routingAttr;
}
public void setRoutingAttr(RoutingRoadAttributes routingAttr) {
this.routingAttr = routingAttr;
}
}
class SharedRoadAttributes{
private PriorityRoadClass priorityRoadClass;
private LinkType linkType;
private Direction travelDirection;
private boolean ferry; //所有布尔:1bit
private boolean tunnel;
private boolean bridge;
private Direction toll;
private boolean controlledAccess;
private boolean serviceArea;
public SharedRoadAttributes() {}
public PriorityRoadClass getPriorityRoadClass() {
return priorityRoadClass;
}
public void setPriorityRoadClass(PriorityRoadClass priorityRoadClass) {
this.priorityRoadClass = priorityRoadClass;
}
public LinkType getLinkType() {
return linkType;
}
public void setLinkType(LinkType linkType) {
this.linkType = linkType;
}
public Direction getTravelDirection() {
return travelDirection;
}
public void setTravelDirection(Direction travelDirection) {
this.travelDirection = travelDirection;
}
public boolean getFerry() {
return ferry;
}
public void setFerry(boolean ferry) {
this.ferry = ferry;
}
public boolean getTunnel() {
return tunnel;
}
public void setTunnel(boolean tunnel) {
this.tunnel = tunnel;
}
public boolean getBridge() {
return bridge;
}
public void setBridge(boolean bridge) {
this.bridge = bridge;
}
public Direction getToll() {
return toll;
}
public void setToll(Direction toll) {
this.toll = toll;
}
public boolean getControlledAccess() {
return controlledAccess;
}
public void setControlledAccess(boolean controlledAccess) {
this.controlledAccess = controlledAccess;
}
public boolean getServiceArea() {
return serviceArea;
}
public void setServiceArea(boolean serviceArea) {
this.serviceArea = serviceArea;
}
}
class PriorityRoadClass{
private int priorityRoadClass; //4bit
public PriorityRoadClass() {}
public int getPriorityRoadClass1() {
return priorityRoadClass;
}
public void setPriorityRoadClass1(int priorityroadclass) {
this.priorityRoadClass = priorityroadclass;
}
}
class LinkType{
private int linkType; //特殊:14中情况,0~D 4bit
public LinkType() {}
public int getLinkType1() {
return linkType;
}
public void setLinkType1(int linkType) {
this.linkType = linkType;
}
}
class Direction{ //特殊:四种情况:0~3 ,下面的两个不是都顺序输出的,两个东西
private int travelDirection; //2bit
private int toll; //2bit
public Direction() {}
public int getTravelDirection() {
return travelDirection;
}
public void setTravelDirection(int travelDirection) {
this.travelDirection = travelDirection;
}
public int getToll() {
return toll;
}
public void setToll(int toll) {
this.toll = toll;
}
}
class RoutingRoadAttributes {
private FunctionalRoadClass functionalRoadClass;
private boolean urban;
private boolean complexIntersection;
private boolean pluralJunction;
private boolean motorway;
public RoutingRoadAttributes() {}
public FunctionalRoadClass getFunctionalRoadClass() {
return functionalRoadClass;
}
public void setFunctionalRoadClass(FunctionalRoadClass functionalRoadClass) {
this.functionalRoadClass = functionalRoadClass;
}
public boolean getUrban() {
return urban;
}
public void setUrban(boolean urban) {
this.urban = urban;
}
public boolean getComplexIntersection() {
return complexIntersection;
}
public void setComplexIntersection(boolean complexIntersection) {
this.complexIntersection = complexIntersection;
}
public boolean getPluralJunction() {
return pluralJunction;
}
public void setPluralJunction(boolean pluralJunction) {
this.pluralJunction = pluralJunction;
}
public boolean getMotorway() {
return motorway;
}
public void setMotorway(boolean motorway) {
this.motorway = motorway;
}
}
class FunctionalRoadClass {
private int functionalRoadClass; //3bit
public FunctionalRoadClass() {}
public int getFunctionalRoadClass() {
return functionalRoadClass;
}
public void setFunctionalRoadClass(int functionalRoadClass) {
this.functionalRoadClass = functionalRoadClass;
}
}
class AverageSpeed{
private int averageSpeed; //uint8 8位
public AverageSpeed() {}
public int getAverageSpeed() {
return averageSpeed;
}
public void setAverageSpeed(int averageSpeed) {
this.averageSpeed = averageSpeed;
}
}
class LinkSector{ //下面的两个不是都顺序输出的,两个东西
private int startAngle; //6bit
private int endAngle; //6bit
public LinkSector() {}
public int getStartAngle() {
return startAngle;
}
public void setStartAngle(int startAngle) {
this.startAngle = startAngle;
}
public int getEndAngle() {
return endAngle;
}
public void setEndAngle(int endAngle) {
this.endAngle = endAngle;
}
}
class RoutingIdRangeList{
private int numFeatureRanges;
private ArrayList<NumRoutingListElements> featureRange;
public RoutingIdRangeList() {}
public int getNumFeatureRanges() {
return numFeatureRanges;
}
public void setNumFeatureRanges(int numFeatureRanges) {
this.numFeatureRanges = numFeatureRanges;
}
public ArrayList<NumRoutingListElements> getFeatureRange() {
return featureRange;
}
public void setFeatureRange(ArrayList<NumRoutingListElements> featureRange) {
this.featureRange = featureRange;
}
}
class NumRoutingListElements{
private int startFeatureId;
private int endFeatureId;
public int getStartFeatureId() {
return startFeatureId;
}
public void setStartFeatureId(int startFeatureId) {
this.startFeatureId = startFeatureId;
}
public int getEndFeatureId() {
return endFeatureId;
}
public void setEndFeatureId(int endFeatureId) {
this.endFeatureId = endFeatureId;
}
}
最最最最新版
最新推荐文章于 2024-01-18 11:33:48 发布