Beispiel #1
0
 public Surface find(String fullId) {
   if (fullId.equals(getFullId())) return this;
   for (Surface child : children) {
     Surface result = child.find(fullId);
     if (result != null) return result;
   }
   return null;
 }
Beispiel #2
0
 public String getFullId() {
   StringBuffer sbuf = new StringBuffer(getId());
   Surface curr = getParent();
   while (curr != null) {
     sbuf.insert(0, curr.getId() + ".");
     curr = curr.getParent();
   }
   return sbuf.toString();
 }
Beispiel #3
0
 public Rectangle2D getBoundingBox() {
   if (worldGeometry != null) return (Rectangle2D) worldGeometry.clone();
   Rectangle2D bbox = null;
   for (Surface child : children) {
     if (bbox == null) bbox = child.getBoundingBox();
     else bbox = bbox.createUnion(child.getBoundingBox());
   }
   return bbox;
 }
Beispiel #4
0
 public void removeChild(Surface child) {
   if (children.remove(child)) {
     child.setParent(null);
   }
 }
Beispiel #5
0
 public void addChild(Surface child) {
   children.add(child);
   child.setParent(this);
 }