/** * Begins a graphic block whose visibility is controlled by the <CODE>layer</CODE>. * Blocks can be nested. Each block must be terminated by an {@link #endLayer()}.<p> * Note that nested layers with {@link PdfLayer#addChild(PdfLayer)} only require a single * call to this method and a single call to {@link #endLayer()}; all the nesting control * is built in. * @param layer the layer */ public void beginLayer(final PdfOCG layer) { if (layer instanceof PdfLayer && ((PdfLayer)layer).getTitle() != null) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("a.title.is.not.a.layer")); if (layerDepth == null) layerDepth = new ArrayList<Integer>(); if (layer instanceof PdfLayerMembership) { layerDepth.add(Integer.valueOf(1)); beginLayer2(layer); return; } int n = 0; PdfLayer la = (PdfLayer)layer; while (la != null) { if (la.getTitle() == null) { beginLayer2(la); ++n; } la = la.getParent(); } layerDepth.add(Integer.valueOf(n)); }
/** * Begins a graphic block whose visibility is controlled by the <CODE>layer</CODE>. * Blocks can be nested. Each block must be terminated by an {@link #endLayer()}.<p> * Note that nested layers with {@link PdfLayer#addChild(PdfLayer)} only require a single * call to this method and a single call to {@link #endLayer()}; all the nesting control * is built in. * @param layer the layer */ public void beginLayer(final PdfOCG layer) { if (layer instanceof PdfLayer && ((PdfLayer)layer).getTitle() != null) throw new IllegalArgumentException(MessageLocalization.getComposedMessage("a.title.is.not.a.layer")); if (layerDepth == null) layerDepth = new ArrayList<Integer>(); if (layer instanceof PdfLayerMembership) { layerDepth.add(Integer.valueOf(1)); beginLayer2(layer); return; } int n = 0; PdfLayer la = (PdfLayer)layer; while (la != null) { if (la.getTitle() == null) { beginLayer2(la); ++n; } la = la.getParent(); } layerDepth.add(Integer.valueOf(n)); }