本文整理了Java中org.matsim.api.core.v01.population.Activity.getCoord()
方法的一些代码示例,展示了Activity.getCoord()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getCoord()
方法的具体详情如下:
包路径:org.matsim.api.core.v01.population.Activity
类名称:Activity
方法名:getCoord
暂无
代码示例来源:origin: matsim-org/matsim
@Override
public Coord getCoord() {
return this.wrapped.getCoord();
}
代码示例来源:origin: matsim-org/matsim
@Override
public Coord getCoord() {
return this.delegate.getCoord() ;
}
代码示例来源:origin: matsim-org/matsim
@Override
public Coord getCoord() {
return act.getCoord();
}
代码示例来源:origin: matsim-org/matsim
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;
}
}
代码示例来源:origin: matsim-org/matsim
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);
}
代码示例来源:origin: matsim-org/matsim
@Override
public Coord getCoord() {
return this.delegate.getCoord();
}
@Override
代码示例来源:origin: matsim-org/matsim
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());
}
代码示例来源:origin: matsim-org/matsim
public BasicFacility(
final Activity act) {
this.coord = act.getCoord();
this.id = act.getFacilityId();
this.link = act.getLinkId();
}
代码示例来源:origin: matsim-org/matsim
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;
}
代码示例来源:origin: matsim-org/matsim
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;
}
代码示例来源:origin: matsim-org/matsim
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;
}
代码示例来源:origin: matsim-org/matsim
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 );
}
代码示例来源:origin: matsim-org/matsim
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);
}
代码示例来源:origin: matsim-org/matsim
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);
}
代码示例来源:origin: matsim-org/matsim
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() );
}
}
代码示例来源:origin: matsim-org/matsim
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;
}
代码示例来源:origin: matsim-org/matsim
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();
}
代码示例来源:origin: matsim-org/matsim
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 );
}
代码示例来源:origin: matsim-org/matsim
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());
}
}
代码示例来源:origin: matsim-org/matsim
@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());
}
}
}
内容来源于网络,如有侵权,请联系作者删除!