예제 #1
0
    @Override
    public void renderTo(Target<?> target) {

      double directionAngle = parseDirection(node.getTags(), PI);
      VectorXZ faceVector = VectorXZ.fromAngle(directionAngle);

      Material machineMaterial = null;
      Material poleMaterial = STEEL;
      Type type = null;

      if (node.getTags().contains("vending", "bicycle_tube")
          && node.getTags().containsAny("operator", asList("Continental", "continental"))) {
        machineMaterial = new ImmutableMaterial(Lighting.FLAT, Color.ORANGE);
      } else if (node.getTags().contains("vending", "bicycle_tube")) {
        machineMaterial = new ImmutableMaterial(Lighting.FLAT, Color.BLUE);
      } else if (node.getTags().contains("vending", "cigarettes")) {
        machineMaterial = new ImmutableMaterial(Lighting.FLAT, new Color(0.8f, 0.73f, 0.5f));
      } else if (node.getTags().contains("vending", "condoms")) {
        machineMaterial = new ImmutableMaterial(Lighting.FLAT, new Color(0.39f, 0.15f, 0.11f));
      }

      // get Type of vending machine
      if (isInWall(node)) {
        type = Type.WALL;
      } else {
        type = Type.PILLAR;
      }

      // default dimensions will differ depending on the post box type
      float height = 0f;

      switch (type) {
        case WALL:
          break;
        case PILLAR:
          height = parseHeight(node.getTags(), 1.8f);

          target.drawBox(
              poleMaterial,
              getBase().add(new VectorXYZ(0, 0, -0.05).rotateY(faceVector.angle())),
              faceVector,
              height - 0.3,
              0.1,
              0.1);
          target.drawBox(
              machineMaterial,
              getBase().addY(height - 1).add(new VectorXYZ(0, 0, 0.1).rotateY(directionAngle)),
              faceVector,
              1,
              1,
              0.2);

          break;
        default:
          assert false : "unknown or unsupported Vending machine Type";
      }
    }
예제 #2
0
    @Override
    public void renderTo(Target<?> target) {

      float distanceX = 3f;
      float distanceZ = 1.6f;

      int n = -1;
      int m = 0;

      if (node.getTags().containsAny(asList("recycling:glass_bottles", "recycling:glass"), "yes")) {
        n++;
      }
      if (node.getTags().contains("recycling:paper", "yes")) {
        n++;
      }
      if (node.getTags().contains("recycling:clothes", "yes")) {
        n++;
      }

      if (node.getTags().contains("recycling:paper", "yes")) {
        drawContainer(
            target,
            "paper",
            getBase()
                .add(
                    new VectorXYZ((distanceX * (-n / 2 + m)), 0f, (distanceZ / 2))
                        .rotateY(faceVector.angle())));
        drawContainer(
            target,
            "paper",
            getBase()
                .add(
                    new VectorXYZ((distanceX * (-n / 2 + m)), 0f, -(distanceZ / 2))
                        .rotateY(faceVector.angle())));
        m++;
      }
      if (node.getTags().containsAny(asList("recycling:glass_bottles", "recycling:glass"), "yes")) {
        drawContainer(
            target,
            "white_glass",
            getBase()
                .add(
                    new VectorXYZ((distanceX * (-n / 2 + m)), 0f, (distanceZ / 2))
                        .rotateY(faceVector.angle())));
        drawContainer(
            target,
            "coloured_glass",
            getBase()
                .add(
                    new VectorXYZ((distanceX * (-n / 2 + m)), 0f, -(distanceZ / 2))
                        .rotateY(faceVector.angle())));
        m++;
      }
      if (node.getTags().contains("recycling:clothes", "yes")) {
        drawContainer(
            target,
            "clothes",
            getBase()
                .add(new VectorXYZ((distanceX * (-n / 2 + m)), 0f, 0).rotateY(faceVector.angle())));
      }
    }