public float getHeight() { if (root == null) return 0; return root.getDeviceHeight(); }
/** * Returns the viewing rectangle of this diagram in device coordinates. * @param rect * @return */ public Rectangle2D getViewRect(Rectangle2D rect) { if (root != null) return root.getDeviceRect(rect); return rect; }
public float getWidth() { if (root == null) return 0; return root.getDeviceWidth(); }
if (getPres(sty.setName("x"))) x = sty.getNumberWithUnits(); if (getPres(sty.setName("y"))) y = sty.getNumberWithUnits(); if (getPres(sty.setName("width"))) width = sty.getNumberWithUnits(); if (getPres(sty.setName("height"))) height = sty.getNumberWithUnits(); if (getPres(sty.setName("viewBox"))) if (getPres(sty.setName("preserveAspectRatio"))) if (contains(preserve, "none")) { parAlignX = PA_X_NONE; parAlignY = PA_Y_NONE; } else if (contains(preserve, "xMinYMin")) { parAlignX = PA_X_MIN; parAlignY = PA_Y_MIN; } else if (contains(preserve, "xMidYMin")) { parAlignX = PA_X_MID; parAlignY = PA_Y_MIN; } else if (contains(preserve, "xMaxYMin")) { parAlignX = PA_X_MAX; parAlignY = PA_Y_MIN; } else if (contains(preserve, "xMinYMid")) { parAlignX = PA_X_MIN; parAlignY = PA_Y_MID; } else if (contains(preserve, "xMidYMid")) { parAlignX = PA_X_MID; parAlignY = PA_Y_MID; } else if (contains(preserve, "xMaxYMid")) { parAlignX = PA_X_MAX; parAlignY = PA_Y_MID; } else if (contains(preserve, "xMinYMax")) { parAlignX = PA_X_MIN; parAlignY = PA_Y_MAX; } else if (contains(preserve, "xMidYMax")) { parAlignX = PA_X_MID; parAlignY = PA_Y_MAX; } else if (contains(preserve, "xMaxYMax")) { parAlignX = PA_X_MAX; parAlignY = PA_Y_MAX; } if (contains(preserve, "meet")) parSpecifier = PS_MEET; else if (contains(preserve, "slice")) parSpecifier = PS_SLICE; prepareViewport();
/** * Loads an SVG document from a URI. * @param svgURI - URI to load document from */ public void setSvgURI(URI svgURI) { URI old = this.svgURI; this.svgURI = svgURI; SVGDiagram diagram = svgUniverse.getDiagram(svgURI); if (diagram != null) { Dimension size = getPreferredSize(); if (size == null) { size = new Dimension((int)diagram.getRoot().getDeviceWidth(), (int)diagram.getRoot().getDeviceHeight()); } diagram.setDeviceViewport(new Rectangle(0, 0, size.width, size.height)); } changes.firePropertyChange("svgURI", old, svgURI); }
public List pick(Point2D point, boolean boundingBox, List retVec) throws SVGException { if (retVec == null) { retVec = new ArrayList(); } root.pick(point, boundingBox, retVec); return retVec; }
public void render(Graphics2D g) throws SVGException { prepareViewport(); AffineTransform cachedXform = g.getTransform(); g.transform(viewXform); super.render(g); g.setTransform(cachedXform); }
/** * Draws this diagram to the passed graphics context */ public void render(Graphics2D g) throws SVGException { root.render(g); }
/** * Sets the dimensions of the device being rendered into. This is used by * SVGRoot when its x, y, width or height parameters are specified as * percentages. */ public void setDeviceViewport(Rectangle deviceViewport) { this.deviceViewport.setBounds(deviceViewport); if (root != null) { try { root.build(); } catch (SVGException ex) { Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, "Could not build document", ex); } } } }
try defaultBounds = getBoundingBox();
if (getPres(sty.setName("x"))) if (getPres(sty.setName("y"))) if (getPres(sty.setName("width"))) if (getPres(sty.setName("height"))) if (getPres(sty.setName("viewBox"))) if (getPres(sty.setName("preserveAspectRatio"))) if (contains(preserve, "none")) { parAlignX = PA_X_NONE; parAlignY = PA_Y_NONE; } else if (contains(preserve, "xMinYMin")) { parAlignX = PA_X_MIN; parAlignY = PA_Y_MIN; } else if (contains(preserve, "xMidYMin")) { parAlignX = PA_X_MID; parAlignY = PA_Y_MIN; } else if (contains(preserve, "xMaxYMin")) { parAlignX = PA_X_MAX; parAlignY = PA_Y_MIN; } else if (contains(preserve, "xMinYMid")) { parAlignX = PA_X_MIN; parAlignY = PA_Y_MID; } else if (contains(preserve, "xMidYMid")) { parAlignX = PA_X_MID; parAlignY = PA_Y_MID; } else if (contains(preserve, "xMaxYMid")) { parAlignX = PA_X_MAX; parAlignY = PA_Y_MID; } else if (contains(preserve, "xMinYMax")) { parAlignX = PA_X_MIN; parAlignY = PA_Y_MAX; } else if (contains(preserve, "xMidYMax")) { parAlignX = PA_X_MID; parAlignY = PA_Y_MAX; } else if (contains(preserve, "xMaxYMax")) { parAlignX = PA_X_MAX; parAlignY = PA_Y_MAX; } if (contains(preserve, "meet")) else if (contains(preserve, "slice")) prepareViewport();
/** * Loads an SVG document from a URI. * @param svgURI - URI to load document from */ public void setSvgURI(URI svgURI) { URI old = this.svgURI; this.svgURI = svgURI; SVGDiagram diagram = svgUniverse.getDiagram(svgURI); if (diagram != null) { Dimension size = getPreferredSize(); if (size == null) { size = new Dimension((int)diagram.getRoot().getDeviceWidth(), (int)diagram.getRoot().getDeviceHeight()); } diagram.setDeviceViewport(new Rectangle(0, 0, size.width, size.height)); } changes.firePropertyChange("svgURI", old, svgURI); }
public List pick(Point2D point, boolean boundingBox, List retVec) throws SVGException { if (retVec == null) { retVec = new ArrayList(); } root.pick(point, boundingBox, retVec); return retVec; }
public void render(Graphics2D g) throws SVGException { prepareViewport(); AffineTransform cachedXform = g.getTransform(); g.transform(viewXform); super.render(g); g.setTransform(cachedXform); }
/** * Draws this diagram to the passed graphics context */ public void render(Graphics2D g) throws SVGException { root.render(g); }
/** * Sets the dimensions of the device being rendered into. This is used by * SVGRoot when its x, y, width or height parameters are specified as * percentages. * @param deviceViewport */ public void setDeviceViewport(Rectangle deviceViewport) { this.deviceViewport.setBounds(deviceViewport); if (root != null) { try { root.build(); } catch (SVGException ex) { Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, "Could not build document", ex); } } } }
try defaultBounds = getBoundingBox(); } catch (SVGException ex)
if (getPres(sty.setName("x"))) if (getPres(sty.setName("y"))) if (getPres(sty.setName("width"))) if (getPres(sty.setName("height"))) if (getPres(sty.setName("viewBox"))) if (getPres(sty.setName("preserveAspectRatio"))) if (contains(preserve, "none")) { parAlignX = PA_X_NONE; parAlignY = PA_Y_NONE; } else if (contains(preserve, "xMinYMin")) { parAlignX = PA_X_MIN; parAlignY = PA_Y_MIN; } else if (contains(preserve, "xMidYMin")) { parAlignX = PA_X_MID; parAlignY = PA_Y_MIN; } else if (contains(preserve, "xMaxYMin")) { parAlignX = PA_X_MAX; parAlignY = PA_Y_MIN; } else if (contains(preserve, "xMinYMid")) { parAlignX = PA_X_MIN; parAlignY = PA_Y_MID; } else if (contains(preserve, "xMidYMid")) { parAlignX = PA_X_MID; parAlignY = PA_Y_MID; } else if (contains(preserve, "xMaxYMid")) { parAlignX = PA_X_MAX; parAlignY = PA_Y_MID; } else if (contains(preserve, "xMinYMax")) { parAlignX = PA_X_MIN; parAlignY = PA_Y_MAX; } else if (contains(preserve, "xMidYMax")) { parAlignX = PA_X_MID; parAlignY = PA_Y_MAX; } else if (contains(preserve, "xMaxYMax")) { parAlignX = PA_X_MAX; parAlignY = PA_Y_MAX; } if (contains(preserve, "meet")) else if (contains(preserve, "slice")) prepareViewport();