@Override public Coord getCoord() { return this.wrapped.getCoord(); }
@Override public Coord getCoord() { return this.delegate.getCoord() ; }
@Override public Coord getCoord() { return act.getCoord(); }
public Trip( final Activity departure, final Activity arrival, final double departureTime, final Id<Person> agentId) { this.departure = departure; this.arrival = arrival; this.departureTime = departureTime; this.length = CoordUtils.calcEuclideanDistance( departure.getCoord() , arrival.getCoord() ); this.agentId = agentId; } }
private double calcMatchCost( final Trip driverTrip, final Trip passengerTrip) { final double timeDiff = Math.abs( driverTrip.departureTime - passengerTrip.departureTime ); final double detourDist = CoordUtils.calcEuclideanDistance( driverTrip.departure.getCoord() , passengerTrip.departure.getCoord() ) + CoordUtils.calcEuclideanDistance( driverTrip.arrival.getCoord() , passengerTrip.arrival.getCoord() ) + passengerTrip.length - driverTrip.length; return scale * (timeDiff + betaDetour * detourDist); }
@Override public Coord getCoord() { return this.delegate.getCoord(); } @Override
private GridNode getNodeFromAct(Activity act) { String gridNodeId = GridNode.getGridNodeIdForCoord(act.getCoord(), this.gridSize); if (this.gridNodeId2GridNode.get(gridNodeId.toString()) == null) { this.gridNodeId2GridNode.put(gridNodeId.toString(), new GridNode(gridNodeId)); } return this.gridNodeId2GridNode.get(gridNodeId.toString()); }
public BasicFacility( final Activity act) { this.coord = act.getCoord(); this.id = act.getFacilityId(); this.link = act.getLinkId(); }
private double calcBeelineDistance(final Activity fromAct, final Activity toAct) { double item; if ( fromAct.getCoord()!=null && toAct.getCoord()!=null ) { item = CoordUtils.calcEuclideanDistance(fromAct.getCoord(), toAct.getCoord()) ; } else { if ( noCoordCnt < 1 ) { noCoordCnt ++ ; log.warn("either fromAct or to Act has no Coord; using link coordinates as substitutes.\n" + Gbl.ONLYONCE ) ; } Link fromLink = scenario.getNetwork().getLinks().get( fromAct.getLinkId() ) ; Link toLink = scenario.getNetwork().getLinks().get( toAct.getLinkId() ) ; item = CoordUtils.calcEuclideanDistance( fromLink.getCoord(), toLink.getCoord() ) ; } return item; }
private Coord getCoord(Activity activity) { if (activity == null) { return null; } Coord fromCoord; if (activity.getCoord() != null) { fromCoord = activity.getCoord(); } else { if (!this.scenario.getNetwork().getLinks().isEmpty()) { fromCoord = this.scenario.getNetwork().getLinks().get(activity.getLinkId()).getCoord(); } else { fromCoord = null; } } return fromCoord; }
private Coord getCoord(Activity activity) { // yy I think that my intuition would be to put the following into prepareForSim. kai, dec'16 if (activity == null) { return null; } Coord fromCoord; if (activity.getCoord() != null) { fromCoord = activity.getCoord(); } else { if (!this.scenario.getNetwork().getLinks().isEmpty()) { fromCoord = this.scenario.getNetwork().getLinks().get(activity.getLinkId()).getCoord(); } else { fromCoord = null; } } return fromCoord; }
private Facility toFacility(final Activity act) { if ((act.getLinkId() == null || act.getCoord() == null) && facilities != null && !facilities.getFacilities().isEmpty()) { // use facilities only if the activity does not provides the required fields. return facilities.getFacilities().get( act.getFacilityId() ); } return new ActivityWrapperFacility( act ); }
private boolean judgeByBeeline(final Activity fromAct, final Activity toAct) { if (this.aoiCenter == null) { // we cannot use the bee-line decision if we don't know the alternative aoi-center return false; } Coord fromCoord = fromAct.getCoord(); Coord toCoord = toAct.getCoord(); if (fromCoord == null) { fromCoord = this.network.getLinks().get(fromAct.getLinkId()).getCoord(); } if (toCoord == null) { toCoord = this.network.getLinks().get(toAct.getLinkId()).getCoord(); } return (CoordUtils.distancePointLinesegment(fromCoord, toCoord, this.aoiCenter) <= this.aoiRadius); }
private Coord getCoord( Activity act) { Coord coord = act.getCoord(); if (coord == null) { Link link = simulationView.getNetwork().getLinks().get(act.getLinkId()); coord = link.getCoord(); } return OTFServerQuadTree.getOTFTransformation().transform(coord); }
private void assertPlanCorrectlyTransformed( final Plan originalPlan, final Plan reprojectedPlan) { final List<Activity> originalActivities = TripStructureUtils.getActivities( originalPlan , EmptyStageActivityTypes.INSTANCE ); final List<Activity> reprojectedActivities = TripStructureUtils.getActivities( reprojectedPlan , EmptyStageActivityTypes.INSTANCE ); Assert.assertEquals( "unexpected number of activities in reprojected plan", originalActivities.size(), reprojectedActivities.size() ); final Iterator<Activity> originalIterator = originalActivities.iterator(); final Iterator<Activity> reprojectedIterator = reprojectedActivities.iterator(); while ( originalIterator.hasNext() ) { final Activity o = originalIterator.next(); final Activity r = reprojectedIterator.next(); assertIsCorrectlyTransformed( o.getCoord() , r.getCoord() ); } }
public AbstractFeatureType createActFeature(Activity act, StyleType style) { PlacemarkType p = this.kmlObjectFactory.createPlacemarkType(); p.setName("Activity on link: " + act.getLinkId().toString()); Coord coord = this.coordTransform.transform(act.getCoord()); PointType point = this.kmlObjectFactory.createPointType(); point.getCoordinates().add(Double.toString(coord.getX()) + "," + Double.toString(coord.getY()) + ",0.0"); p.setAbstractGeometryGroup(this.kmlObjectFactory.createPoint(point)); p.setStyleUrl(style.getId()); return p; }
public ActivitySerializable(Activity act) { coord = new CoordSerializable(act.getCoord()); endTime = act.getEndTime(); facIdString = act.getFacilityId() == null ? null : act.getFacilityId().toString(); linkIdString = act.getLinkId() == null ? null : act.getLinkId().toString(); maximumDuration = act.getMaximumDuration(); startTime = act.getStartTime(); type = act.getType(); }
public static void copyFromTo(Activity act, Activity newAct) { Coord coord = act.getCoord() == null ? null : new Coord(act.getCoord().getX(), act.getCoord().getY()); // (we don't want to copy the coord ref, but rather the contents!) newAct.setCoord(coord); newAct.setType( act.getType() ); newAct.setLinkId(act.getLinkId()); newAct.setStartTime(act.getStartTime()); newAct.setEndTime(act.getEndTime()); newAct.setMaximumDuration(act.getMaximumDuration()); newAct.setFacilityId(act.getFacilityId()); AttributesUtils.copyAttributesFromTo( act , newAct ); }
private void assertPlan(Plan plan, String homeFacilityId, String workFacilityId, boolean linkCoordMustBeNull) { Activity home1 = (Activity) plan.getPlanElements().get(0); Activity work = (Activity) plan.getPlanElements().get(2); Activity home2 = (Activity) plan.getPlanElements().get(4); Assert.assertEquals(homeFacilityId, home1.getFacilityId().toString()); Assert.assertEquals(workFacilityId, work.getFacilityId().toString()); Assert.assertEquals(homeFacilityId, home2.getFacilityId().toString()); if (linkCoordMustBeNull) { Assert.assertNull(home1.getLinkId()); Assert.assertNull(home1.getCoord()); Assert.assertNull(work.getLinkId()); Assert.assertNull(work.getCoord()); Assert.assertNull(home2.getLinkId()); Assert.assertNull(home2.getCoord()); } }
@Test public void testWrapper() { for (Activity activity : activities) { Facility wrapper = new ActivityWrapperFacility( activity ); Assert.assertEquals( "wrapped activity returns incorrect coordinate!", activity.getCoord(), wrapper.getCoord()); Assert.assertEquals( "wrapped activity returns incorrect link id!", activity.getLinkId(), wrapper.getLinkId()); } } }