本文整理了Java中org.matsim.api.core.v01.population.Activity.getLinkId()
方法的一些代码示例,展示了Activity.getLinkId()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Activity.getLinkId()
方法的具体详情如下:
包路径:org.matsim.api.core.v01.population.Activity
类名称:Activity
方法名:getLinkId
暂无
代码示例来源:origin: matsim-org/matsim
@Override
public Id<Link> getLinkId() {
return this.delegate.getLinkId() ;
}
代码示例来源:origin: matsim-org/matsim
@Override
public Id<Link> getLinkId() {
return this.wrapped.getLinkId();
}
代码示例来源:origin: matsim-org/matsim
@Override
public Id<Link> getLinkId() {
return act.getLinkId();
}
代码示例来源:origin: matsim-org/matsim
@Override
public Id<Link> getLinkId() {
return this.delegate.getLinkId();
}
@Override
代码示例来源: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 void startRoute() {
this.currroute = this.plans.getFactory().getRouteFactories().createRoute(NetworkRoute.class, this.prevAct.getLinkId(), this.prevAct.getLinkId());
this.currleg.setRoute(this.currroute);
}
代码示例来源:origin: matsim-org/matsim
private Id<? extends BasicLocation> getLocationId(Activity activity) {
return activity.getFacilityId()!=null ?
activity.getFacilityId() :
activity.getLinkId();
}
代码示例来源:origin: matsim-org/matsim
private void startRoute(final Attributes atts) {
this.currroute = this.plans.getFactory().getRouteFactories().createRoute(NetworkRoute.class, this.prevAct.getLinkId(), this.prevAct.getLinkId());
this.currleg.setRoute(this.currroute);
if (atts.getValue("dist") != null) {
this.currroute.setDistance(Double.parseDouble(atts.getValue("dist")));
}
if (atts.getValue("trav_time") != null) {
this.currroute.setTravelTime(Time.parseTime(atts.getValue("trav_time")));
}
}
代码示例来源:origin: matsim-org/matsim
private boolean atSameLocation(Activity firstLegUsingMode,
Activity lastLegUsingMode) {
return firstLegUsingMode.getFacilityId()!=null ?
firstLegUsingMode.getFacilityId().equals(
lastLegUsingMode.getFacilityId() ) :
firstLegUsingMode.getLinkId().equals(
lastLegUsingMode.getLinkId() );
}
代码示例来源: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
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 Id<Link> decideOnLinkIdForActivity( Activity act, Scenario sc ) {
if ( act.getFacilityId() !=null ) {
final ActivityFacility facility = sc.getActivityFacilities().getFacilities().get( act.getFacilityId() );;
if ( facility==null ) {
throw new RuntimeException("facility ID given but not in facilities container") ;
}
Gbl.assertNotNull( facility.getLinkId() );
return facility.getLinkId();
}
Gbl.assertNotNull( act.getLinkId() );
return act.getLinkId() ;
}
public static Coord decideOnCoordForActivity( Activity act, Scenario sc ) {
代码示例来源:origin: matsim-org/matsim
public void moveToFirstLinkInNextLeg() {
Plan plan = getOwnerPerson().getSelectedPlan();
List<? extends PlanElement> actsLegs = plan.getPlanElements();
setCurrentLinkId(((Activity) actsLegs.get(getLegIndex() + 1)).getLinkId());
}
代码示例来源:origin: matsim-org/matsim
public static Activity createActivity(Activity act) {
Activity newAct = getFactory().createActivityFromLinkId(act.getType(), act.getLinkId()) ;
copyFromTo(act, newAct);
// (this ends up setting type and linkId again)
return newAct ;
}
代码示例来源: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
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 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
public void addTrip(NetworkRoute networkRoute, String transportMode) {
Activity lastActivity;
if (!plan.getPlanElements().isEmpty()) {
lastActivity = (Activity) plan.getPlanElements().get(plan.getPlanElements().size()-1);
assert lastActivity.getLinkId().equals(networkRoute.getStartLinkId());
} else {
lastActivity = PopulationUtils.createActivityFromLinkId(activityType, networkRoute.getStartLinkId());
plan.addActivity(lastActivity);
}
Leg leg = PopulationUtils.createLeg(transportMode);
leg.setRoute(networkRoute);
plan.addLeg(leg);
Activity activity = PopulationUtils.createActivityFromLinkId(activityType, networkRoute.getEndLinkId());
plan.addActivity(activity);
}
代码示例来源: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
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 );
}
内容来源于网络,如有侵权,请联系作者删除!