protected List<HeightInfo> availableSpace(ModelInfo info) {
   List<HeightInfo> list = new LinkedList<>();
   BufferedImage mask = info.getMask();
   if (mask == null) {
     info.parseMask();
     if (mask == null) {
       return list;
     }
   }
   int width = mask.getWidth();
   int height = mask.getHeight();
   double xr = Mediator.getMapWidth() / width;
   double zr = Mediator.getMapHeight() / height;
   for (int i = 0; i < width; i++) {
     for (int j = 0; j < height; j++) {
       double y = PreviewPanel.getColor(mask, i, j);
       if (y >= 128) {
         double x = (width / 2 - i) * xr;
         double z = (height / 2 - j) * zr;
         list.add(new HeightInfo(x, y, z));
       }
     }
   }
   return list;
 }
  public List<GeneratedObject> generate(GenerationInfo info) {
    long time = System.currentTimeMillis();
    int collisionsValue = info.getArgs().get(Consts.COLLISIONS).intValue();
    collisions = collisionsValue == 1 ? true : false;
    Dimension mapDimensions = Mediator.getMapDimensions();
    if (mapDimensions == null) {
      WindowUtil.displayError(PropertiesKeys.NO_HEIGHTMAP);
      return new ArrayList<>();
    }
    if (collisions) {
      collisionTree =
          TreeNode.createTree(
              Mediator.getMapWidth(),
              Mediator.getMapHeight(),
              (short) (Math.log(mapDimensions.getWidth()) / Math.log(2)));
    }
    xRatio = Mediator.getMapWidth() / mapDimensions.width;
    zRatio = Mediator.getMapHeight() / mapDimensions.height;
    yRatio = Mediator.getMapMaxYSetting() / Mediator.getMapMaxY();
    HeightInfo.setThreshold((xRatio + zRatio) / 2.0);

    List<GeneratedObject> result = generationMethod(info);
    Mediator.updateModels(result);
    time = System.currentTimeMillis() - time;
    System.out.println("Time used: " + time + " ms.");
    time /= 1000F;
    collisionTree = null;
    int size = result.size();
    if (collisionDetected) {
      collisionDetected = false;
      WindowUtil.displayError(PropertiesKeys.COLLISION, size, time);
    } else {
      if (size > 0) {
        WindowUtil.displayInfo(PropertiesKeys.RESULT, size, time);
      } else {
        WindowUtil.displayError(PropertiesKeys.NO_RESULT);
      }
    }
    return result;
  }