当前位置: 首页>>代码示例>>Java>>正文


Java Human类代码示例

本文整理汇总了Java中rescuecore2.standard.entities.Human的典型用法代码示例。如果您正苦于以下问题:Java Human类的具体用法?Java Human怎么用?Java Human使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Human类属于rescuecore2.standard.entities包,在下文中一共展示了Human类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: computeAnimation

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
/**
 * Compute the animation frames.
 *
 * @param frameCount The number of animation frames to compute.
 */
public void computeAnimation(int frameCount) {
    synchronized (this) {
        frames.clear();
        // Compute animation
        double step = 1.0 / (frameCount - 1.0);
        for (EntityID next : humanIDs) {
            Queue<Pair<Integer, Integer>> result = new LinkedList<Pair<Integer, Integer>>();
            Human human = (Human) world.getEntity(next);
            if (human == null) {
                continue;
            }
            AgentPath path = AgentPath.computePath(human, world);
            if (path == null) {
                continue;
            }
            for (int i = 0; i < frameCount; ++i) {
                Pair<Integer, Integer> nextPoint = path.getPointOnPath(i * step);
                result.add(nextPoint);
            }
            result.add(human.getLocation(world));
            frames.put(next, result);
        }
        animationDone = false;
    }
}
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:31,代码来源:MrlBaseAnimatedHumanLayer.java

示例2: calc

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
@Override
public HumanDetector calc() {
	Human transportHuman = this.agentInfo.someoneOnBoard();
	if (transportHuman != null) {
		logger.debug("someoneOnBoard:" + transportHuman);
		this.result = transportHuman.getID();
		return this;
	}
	if (this.result != null) {
		Human target = (Human) this.worldInfo.getEntity(this.result);
		if (!isValidHuman(target)) {
			logger.debug("Invalid Human:" + target + " ==>reset target");
			this.result = null;
		}
	}
	if (this.result == null) {
		this.result = calcTarget();
	}
	return this;
}
 
开发者ID:RCRS-ADF,项目名称:sample,代码行数:21,代码来源:TestHumanDetector.java

示例3: calcTarget

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
private EntityID calcTarget() {
	List<Human> rescueTargets = filterRescueTargets(this.worldInfo.getEntitiesOfType(CIVILIAN));
	List<Human> rescueTargetsInCluster = filterInCluster(rescueTargets);
	List<Human> targets = rescueTargetsInCluster;
	if (targets.isEmpty())
		targets = rescueTargets;

	
	logger.debug("Targets:"+targets);
	if (!targets.isEmpty()) {
		targets.sort(new DistanceSorter(this.worldInfo, this.agentInfo.me()));
		Human selected = targets.get(0);
		logger.debug("Selected:"+selected);
		return selected.getID();
	}
	
	return null;
}
 
开发者ID:RCRS-ADF,项目名称:sample,代码行数:19,代码来源:TestHumanDetector.java

示例4: filterInCluster

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
private List<Human> filterInCluster(Collection<? extends StandardEntity> entities) {
	int clusterIndex = clustering.getClusterIndex(this.agentInfo.getID());
	List<Human> filter = new ArrayList<>();
	HashSet<StandardEntity> inCluster = new HashSet<>(clustering.getClusterEntities(clusterIndex));
	for (StandardEntity next : entities) {
		if (!(next instanceof Human))
			continue;
		Human h = (Human) next;
		if (!h.isPositionDefined())
			continue;
		StandardEntity position = this.worldInfo.getPosition(h);
		if (position == null)
			continue;
		if (!inCluster.contains(position))
			continue;
		filter.add(h);
	}
	return filter;

}
 
开发者ID:RCRS-ADF,项目名称:sample,代码行数:21,代码来源:TestHumanDetector.java

示例5: isValidHuman

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
private boolean isValidHuman(StandardEntity entity) {
	if (entity == null)
		return false;
	if (!(entity instanceof Human))
		return false;

	Human target = (Human) entity;
	if (!target.isHPDefined() || target.getHP() == 0)
		return false;
	if (!target.isPositionDefined())
		return false;
	if (!target.isDamageDefined() || target.getDamage() == 0)
		return false;
	if (!target.isBuriednessDefined())
		return false;

	StandardEntity position = worldInfo.getPosition(target);
	if (position == null)
		return false;

	StandardEntityURN positionURN = position.getStandardURN();
	if (positionURN == REFUGE || positionURN == AMBULANCE_TEAM)
		return false;

	return true;
}
 
开发者ID:RCRS-ADF,项目名称:sample,代码行数:27,代码来源:TestHumanDetector.java

示例6: MrlBaseHumanLayer

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
public MrlBaseHumanLayer() {
    super(Human.class);
    ViewLayer annotation = this.getClass().getAnnotation(ViewLayer.class);
    if (annotation != null) {
        drawOverAllData = annotation.drawAllData();
    }
}
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:8,代码来源:MrlBaseHumanLayer.java

示例7: render

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
@Override
public Shape render(Human h, Graphics2D g, ScreenTransform t) {
    Pair<Integer, Integer> location = getLocation(h);
    if (location == null) {
        return null;
    }
    if (h.isPositionDefined() && (world.getEntity(h.getPosition()) instanceof AmbulanceTeam)) {
        return null;
    }

    int x = t.xToScreen(location.first());
    int y = t.yToScreen(location.second());
    Shape shape;
    shape = new Ellipse2D.Double(x - SIZE / 2, y - SIZE / 2, SIZE, SIZE);
    if (h == StaticViewProperties.selectedObject) {
        g.setColor(Color.MAGENTA);
        defaultCircle(h, g, t);
    } else {
        g.setColor(adjustColour(getColour(h), h.getHP()));
    }
    paintShape(h, shape, g);
    if (drawOverAllData
            && (StaticViewProperties.selectedObject == null || !agentEntitiesMap.containsKey(StaticViewProperties.selectedObject.getID()))) {
        if (overallEntities.contains(h.getID().getValue())) {
            paintData(h, shape, g,t);
        }
    } else if (StaticViewProperties.selectedObject != null
            && agentEntitiesMap.containsKey(StaticViewProperties.selectedObject.getID())
            && agentEntitiesMap.get(StaticViewProperties.selectedObject.getID()).contains(h.getID().getValue())) {
        paintData(h, shape, g,t);
    }
    return shape;
}
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:34,代码来源:MrlBaseHumanLayer.java

示例8: getColour

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
protected Color getColour(Human h) {
    switch (h.getStandardURN()) {
        case CIVILIAN:
            return CIVILIAN_COLOUR;
        case FIRE_BRIGADE:
            return FIRE_BRIGADE_COLOUR;
        case AMBULANCE_TEAM:
            return AMBULANCE_TEAM_COLOUR;
        case POLICE_FORCE:
            return POLICE_FORCE_COLOUR;
        default:
            throw new IllegalArgumentException("Don't know how to draw humans of type " + h.getStandardURN());
    }
}
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:15,代码来源:MrlBaseHumanLayer.java

示例9: compare

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
public int compare(Human h1, Human h2) {
    if (h1 instanceof Civilian && !(h2 instanceof Civilian)) {
        return -1;
    }
    if (h2 instanceof Civilian && !(h1 instanceof Civilian)) {
        return 1;
    }
    return h1.getID().getValue() - h2.getID().getValue();
}
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:10,代码来源:MrlBaseHumanLayer.java

示例10: getLocation

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
@Override
protected Pair<Integer, Integer> getLocation(Human h) {
    synchronized (this) {
        Queue<Pair<Integer, Integer>> agentFrames = frames.get(h.getID());
        if (agentFrames != null && !agentFrames.isEmpty()) {
            return agentFrames.peek();
        }
    }
    return h.getLocation(world);
}
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:11,代码来源:MrlBaseAnimatedHumanLayer.java

示例11: viewObject

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
@Override
protected void viewObject(Object o) {
    super.viewObject(o);
    if (o instanceof Human) {
        humanIDs.add(((Human) o).getID());
    }
}
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:8,代码来源:MrlBaseAnimatedHumanLayer.java

示例12: paintData

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
@Override
    protected void paintData(Human h, Shape shape, Graphics2D g, ScreenTransform t) {
        g.setColor(Color.MAGENTA.darker());
        Circle2D circle2D = new Circle2D(t.xToScreen(h.getX()), t.yToScreen(h.getY()), 18d, true);
        circle2D.draw(g);
//        g.fill(shape);
    }
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:8,代码来源:MrlSampleHumansLayer.java

示例13: filterRescueTargets

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
private List<Human> filterRescueTargets(Collection<? extends StandardEntity> list) {
	List<Human> rescueTargets = new ArrayList<>();
	for (StandardEntity next : list) {
		if (!(next instanceof Human))
			continue;
		Human h = (Human) next;
		if (!isValidHuman(h))
			continue;
		if (h.getBuriedness() == 0)
			continue;
		rescueTargets.add(h);
	}
	return rescueTargets;
}
 
开发者ID:RCRS-ADF,项目名称:sample,代码行数:15,代码来源:TestHumanDetector.java

示例14: MessageHuman

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
public MessageHuman(int messageID, Human human)
{
	super(messageID);
	humanID = human.getID();
	humanHP = human.getHP();
	humanBuriedness = human.getBuriedness();
	humanDamage = human.getDamage();
	humanPosition = human.getPosition();
}
 
开发者ID:AIT-Rescue,项目名称:AIT-Rescue,代码行数:10,代码来源:MessageHuman.java

示例15: defaultCircle

import rescuecore2.standard.entities.Human; //导入依赖的package包/类
protected void defaultCircle(Human h, Graphics2D g, ScreenTransform t) {
    Circle2D circle2D = new Circle2D(t.xToScreen(h.getX()), t.yToScreen(h.getY()), 18d, true);
    circle2D.draw(g);
}
 
开发者ID:MRL-RS,项目名称:visual-debugger,代码行数:5,代码来源:MrlBaseAnimatedHumanLayer.java


注:本文中的rescuecore2.standard.entities.Human类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。