Beispiel #1
1
 private void initHolesBitmaps(List<Hole> holes) throws ParseException, LoadException {
   for (Hole hole : holes) {
     hole.setBitmap(
         (Bitmap)
             ContentProcessor.init()
                 .useCache(BitmapMemoryCache.getInstance())
                 .fromRes(resources)
                 .bitmap()
                 .load(String.valueOf(Hole.getModelIds()[0])));
     hole.setRocksBitmap(
         (Bitmap)
             ContentProcessor.init()
                 .useCache(BitmapMemoryCache.getInstance())
                 .fromRes(resources)
                 .bitmap()
                 .load(String.valueOf(Hole.getRocksModelIds()[0])));
     for (Rock rock : hole.getRocks()) {
       rock.setBitmap(
           (Bitmap)
               ContentProcessor.init()
                   .useCache(BitmapMemoryCache.getInstance())
                   .fromRes(resources)
                   .bitmap()
                   .load(String.valueOf(Rock.getRandomModelResId())));
     }
   }
 }
 public void setOpenHoles(Fingering fingering) {
   List<Boolean> openHoles = fingering.getOpenHole();
   Iterator<Boolean> openHoleIterator = openHoles.iterator();
   for (Hole iHole : hole) {
     boolean isOpen = openHoleIterator.next();
     iHole.setOpenHole(isOpen);
   }
 }
  @Override
  public void updateComponents() {
    // TODO Write recursive validation method and call it here.
    // Then take out the error checking in all the other methods.
    components = new ArrayList<ComponentInterface>();

    if (borePoint != null && !borePoint.isEmpty()) {
      SortedPositionList<BorePoint> borePointList = makePositionList(borePoint);
      // Add the mouthpiece reference position to the map.
      // I don't believe the optimization routines should care that this
      // offset
      // is not subtracted, since the calculations are performed on the
      // components, which are offset agnostic.
      // borePointMap.put(mouthpieceOrigin.getBorePosition(),

      processMouthpiece(borePointList);
      components.add(mouthpiece);

      processTermination(borePointList);

      SortedPositionList<Hole> holeList = makePositionList(hole);

      // TODO Deal with the Mouthpiece and the start of the bore:

      // Process the holes, making sections as needed to include the hole
      // on the right
      if (holeList.size() > 0) {
        for (Hole currentHole : holeList) {
          double rightPosition = currentHole.getBorePosition();
          makeSections(borePointList, rightPosition);
          processPosition(borePointList, currentHole);

          components.add(currentHole);
        }
      }

      // Process the rest of the sections. There must be at least one
      double lastPosition = borePointList.getLast().getBorePosition() + 1.;
      makeSections(borePointList, lastPosition);
    }
  }
  protected void convertDimensions(double multiplier) {
    if (mouthpiece != null) {
      mouthpiece.convertDimensions(multiplier);
    }

    if (borePoint != null) {
      for (BorePoint aPoint : borePoint) {
        aPoint.convertDimensions(multiplier);
      }
    }

    if (hole != null) {
      for (Hole aHole : hole) {
        aHole.convertDimensions(multiplier);
      }
    }

    if (termination != null) {
      termination.convertDimensions(multiplier);
    }
  }