Пример #1
0
 private void excludeLoop(int i1, int i2, int i3) {
   _ee.setLocation(i1, i2, i3);
   PointOfInterest tpoi;
   float d;
   int bx1 = i1 - _r1 > 0 ? i1 - _r1 : 0;
   int bx2 = i2 - _r1 > 0 ? i2 - _r1 : 0;
   int bx3 = i3 - _r1 > 0 ? i3 - _r1 : 0;
   int ex1 = i1 + _r1 < _n1 ? i1 + _r1 : _n1 - 1;
   int ex2 = i2 + _r1 < _n2 ? i2 + _r1 : _n2 - 1;
   int ex3 = i3 + _r1 < _n3 ? i3 + _r1 : _n3 - 1;
   for (int ii3 = bx3; ii3 <= ex3; ++ii3) {
     for (int ii2 = bx2; ii2 <= ex2; ++ii2) {
       for (int ii1 = bx1; ii1 <= ex1; ++ii1) {
         tpoi = _poiArray[ii3][ii2][ii1];
         if (tpoi.isLocked()) continue;
         d = _ee.getDistance(ii1, ii2, ii3);
         if (d <= 1.f) {
           tpoi.setVal(0.f);
           tpoi.setLock(true);
           tpoi.setLive(false);
         }
       }
     }
   }
 }
Пример #2
0
  public PointOfInterest get(String name) {
    for (PointOfInterest poi : this.container) {
      if (poi.getName() == name) {
        return poi;
      }
    }

    return null;
  }
 @Override
 public void onItemSelected(AdapterView<?> parent, View view, int pos, long id) {
   matchingPois.clear();
   for (PointOfInterest poi : allPois) {
     if (poi.isOfCategorie(categories.get(pos))) {
       matchingPois.add(poi);
     }
   }
   poiAdapter.notifyDataSetChanged();
 }
 @Override
 public void afterTextChanged(Editable recherche) {
   matchingPois.clear();
   for (PointOfInterest poi : allPois) {
     if (poi.matches(recherche.toString())) {
       matchingPois.add(poi);
     }
   }
   poiAdapter.notifyDataSetChanged();
 }
Пример #5
0
 public void creatureFulfilled(SeaLifePrototype creatureType) {
   PointOfInterest poi;
   for (Iterator<PointOfInterest> i = goals.iterator(); i.hasNext(); ) {
     poi = i.next();
     if (poi.getCreature() == null) continue;
     if (poi.getCreature().getName().equals(creatureType.getName())) {
       i.remove();
     }
   }
 }
Пример #6
0
 public void tick(Point2D whereIAm) {
   PointOfInterest poi;
   for (Iterator<PointOfInterest> i = goals.iterator(); i.hasNext(); ) {
     poi = i.next();
     poi.age();
     if (poi.getAge() > AGE_THRESHOLD
         || StaticDiver.getDistanceFromCreature(poi.getLocation(), whereIAm)
             < DISTANCE_THRESHOLD) {
       i.remove();
     }
   }
 }
Пример #7
0
 /** Excludes points around the index i1,i2 using a serial loop. */
 private void excludeLoop(int i1, int i2) {
   _ete.setLocation(i1, i2);
   PointOfInterest tpoi;
   float d;
   int _r = (int) (_maxr + 0.5f);
   int bx1 = i1 - _r > 0 ? i1 - _r : 0;
   int bx2 = i2 - _r > 0 ? i2 - _r : 0;
   int ex1 = i1 + _r < _n1 ? i1 + _r : _n1 - 1;
   int ex2 = i2 + _r < _n2 ? i2 + _r : _n2 - 1;
   for (int ii2 = bx2; ii2 <= ex2; ++ii2) {
     for (int ii1 = bx1; ii1 <= ex1; ++ii1) {
       tpoi = _poiArray[ii2][ii1];
       if (tpoi.isLocked()) continue;
       d = _ete.getDistance(ii1, ii2);
       if (d <= _maxr) {
         tpoi.setVal(0.f);
         tpoi.setLock(true);
         tpoi.setLive(false);
       }
     }
   }
 }
Пример #8
0
  public PointOfInterest get(double latitude, double longitude, int accuracy) {
    PointOfInterest p = null;

    for (PointOfInterest poi : this.container) {
      if (poi.getId() > 0
          && poi.isMonitored()
          && poi.contains(latitude, longitude, accuracy)
          && (p == null || p.getRadius() > poi.getRadius())) {
        p = poi;
      }
    }

    return p;
  }