@Override public RoadLeg createFromParcel(Parcel source) { return new RoadLeg(source); } @Override public RoadLeg[] newArray(int size) {
/** default constructor when normal loading failed: * the road shape only contains the waypoints; All distances and times are at 0; * there is no node; mStatus set to TECHNICAL_ISSUE. */ public Road(ArrayList<GeoPoint> waypoints){ init(); int n = waypoints.size(); for (int i=0; i<n; i++){ GeoPoint p = waypoints.get(i); mRouteHigh.add(p); } for (int i=0; i<n-1; i++){ RoadLeg leg = new RoadLeg(/*i, i+1, mLinks*/); mLegs.add(leg); } mBoundingBox = BoundingBox.fromGeoPoints(mRouteHigh); mStatus = STATUS_TECHNICAL_ISSUE; }
public void startElement(String uri, String localName, String name, Attributes attributes) throws SAXException { if (localName.equals("route")) { mCurrentRoad = new Road(); mRoads.add(mCurrentRoad); } else if (localName.equals("polyline")) { isPolyline = true; } else if (localName.equals("overview_polyline")) { isOverviewPolyline = true; } else if (localName.equals("leg")) { mLeg = new RoadLeg(); isLeg = true; } else if (localName.equals("step")) { mNode = new RoadNode(); isStep = true; } else if (localName.equals("duration")) { isDuration = true; } else if (localName.equals("distance")) { isDistance = true; } else if (localName.equals("bounds")) { isBB = true; } mStringBuilder.setLength(0); }
RoadLeg leg = new RoadLeg(); road.mLegs.add(leg); leg.mLength = jLeg.getDouble("distance");