1 47 48 package com.lowagie.text.pdf; 49 50 import java.util.Collection ; 51 import java.util.HashSet ; 52 53 62 public class PdfLayerMembership extends PdfDictionary implements PdfOCG { 63 64 67 public static final PdfName ALLON = new PdfName("AllOn"); 68 71 public static final PdfName ANYON = new PdfName("AnyOn"); 72 75 public static final PdfName ANYOFF = new PdfName("AnyOff"); 76 79 public static final PdfName ALLOFF = new PdfName("AllOff"); 80 81 PdfIndirectReference ref; 82 PdfArray members = new PdfArray(); 83 HashSet layers = new HashSet (); 84 85 89 public PdfLayerMembership(PdfWriter writer) { 90 super(PdfName.OCMD); 91 put(PdfName.OCGS, members); 92 ref = writer.getPdfIndirectReference(); 93 } 94 95 99 public PdfIndirectReference getRef() { 100 return ref; 101 } 102 103 107 public void addMember(PdfLayer layer) { 108 if (!layers.contains(layer)) { 109 members.add(layer.getRef()); 110 layers.add(layer); 111 } 112 } 113 114 118 public Collection getLayers() { 119 return layers; 120 } 121 122 128 public void setVisibilityPolicy(PdfName type) { 129 put(PdfName.P, type); 130 } 131 132 136 public PdfObject getPdfObject() { 137 return this; 138 } 139 } 140 | Popular Tags |