當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。