Ejemplo n.º 1
0
 private void findOrphanRoads() {
   for (StandardEntity road : world.getRoads()) {
     if (roadHelper.getPathId(road.getID()) == null) {
       orphanRoads.add((Road) road);
     }
   }
 }
Ejemplo n.º 2
0
  private Path getNearestPath(Road road, List<Path> paths) {
    int range = 10000;
    int minDistance = Integer.MAX_VALUE;
    EntityID nearestPath = null;

    while (nearestPath == null) {
      Collection<StandardEntity> entities = world.getObjectsInRange(road, range);

      for (StandardEntity entity : entities) {
        if (entity instanceof Road) {
          EntityID pathId = roadHelper.getPathId(entity.getID());

          if (pathId != null) {
            int distance = Util.distance((Area) entity, road);
            if (distance < minDistance) {
              nearestPath = pathId;
              minDistance = distance;
            }
          }
        }
      }
      range += 10000;
    }

    for (Path path : paths) {
      if (path.getId().equals(nearestPath)) {
        return path;
      }
    }
    return null;
  }
Ejemplo n.º 3
0
 /** entitiesComboBoxを再生成する */
 private void resetEntitiesComboBox(Collection<StandardEntity> c) {
   entitiesComboBox.removeAllItems();
   if (c == null) {
     c = viewer.world.getEntitiesOfType(Viewer.INDEX_CLASS);
   }
   strToID = new HashMap<String, EntityID>(c.size());
   idToIndex = new HashMap<EntityID, Integer>(c.size());
   List<StandardEntity> entitiesList = new ArrayList<StandardEntity>(c);
   Collections.sort(entitiesList, new EntityTools.IDComparator());
   entitiesComboBox.addItem("Null");
   int i = 1;
   for (StandardEntity se : entitiesList) {
     String name = se.getClass().getSimpleName() + " (" + se.getID().getValue() + ")";
     strToID.put(name, se.getID());
     idToIndex.put(se.getID(), i);
     entitiesComboBox.addItem(name);
     i++;
   }
 }
Ejemplo n.º 4
0
 public void init() {
   for (StandardEntity entity : world.getPlatoonAgents()) {
     humanInfoMap.put(entity.getID(), new HumanInfo(false, false));
   }
 }