1 17 18 19 20 package org.apache.fop.area; 21 22 import java.awt.geom.Rectangle2D ; 23 import java.io.IOException ; 24 import java.util.HashMap ; 25 26 32 public class RegionViewport extends Area implements Cloneable { 33 private RegionReference regionReference; 35 private Rectangle2D viewArea; 36 private boolean clip = false; 37 38 43 public RegionViewport(Rectangle2D viewArea) { 44 this.viewArea = viewArea; 45 addTrait(Trait.IS_VIEWPORT_AREA, Boolean.TRUE); 46 } 47 48 53 public void setRegionReference(RegionReference reg) { 54 regionReference = reg; 55 } 56 57 62 public RegionReference getRegionReference() { 63 return regionReference; 64 } 65 66 71 public void setClip(boolean c) { 72 clip = c; 73 } 74 75 76 public boolean isClip() { 77 return this.clip; 78 } 79 80 85 public Rectangle2D getViewArea() { 86 return viewArea; 87 } 88 89 private void writeObject(java.io.ObjectOutputStream out) 90 throws IOException { 91 out.writeFloat((float) viewArea.getX()); 92 out.writeFloat((float) viewArea.getY()); 93 out.writeFloat((float) viewArea.getWidth()); 94 out.writeFloat((float) viewArea.getHeight()); 95 out.writeBoolean(clip); 96 out.writeObject(props); 97 out.writeObject(regionReference); 98 } 99 100 private void readObject(java.io.ObjectInputStream in) 101 throws IOException , ClassNotFoundException { 102 viewArea = new Rectangle2D.Float (in.readFloat(), in.readFloat(), 103 in.readFloat(), in.readFloat()); 104 clip = in.readBoolean(); 105 props = (HashMap )in.readObject(); 106 setRegionReference((RegionReference) in.readObject()); 107 } 108 109 115 public Object clone() { 116 RegionViewport rv = new RegionViewport((Rectangle2D )viewArea.clone()); 117 rv.regionReference = (RegionReference)regionReference.clone(); 118 if (props != null) { 119 rv.props = new HashMap (props); 120 } 121 if (foreignAttributes != null) { 122 rv.foreignAttributes = new HashMap (foreignAttributes); 123 } 124 return rv; 125 } 126 } 127 128 | Popular Tags |