• Keep in touch:
  • Linked In
  • Twitter
  • RSS

What is the highest layer number?

Finding the highest layer number is analogous to finding the highest unique identifier before adding new definitions to an existing movie. The layer number determines the order in which objects are displayed. Objects with a higher layer number are displayed in front of ones on a lower layer. The most obvious practical example would be to add a watermark to an existing movie.

Finding the highest layer is simply a matter of finding the instructions that add an object to the display list (Place[2|3]) and recording the highest layer number found.

int layer = 0;
Place place;
Place2 place2;
Place3 place3;

for (MovieTag object : list) {
    if (object instanceof Place) {
        place = (Place)object;
        if (place.getLayer() > layer) {
            layer = place.getLayer();
        }
    } else if (object instanceof Place2) {
        place2 = (Place2)object;
        if (place2.getLayer() > layer) {
            layer = place2.getLayer();
        }
    } else if (object instanceof Place3) {
        place3 = (Place3)object;
        if (place3.getLayer() > layer) {
            layer = place3.getLayer();
        }
    }
}