You are viewing a plain text version of this content. The canonical link for it is here.
Posted to batik-dev@xmlgraphics.apache.org by tk...@apache.org on 2001/03/12 10:58:07 UTC
cvs commit: xml-batik/sources/org/apache/batik/bridge BridgeContext.java SVGSVGElementBridge.java
tkormann 01/03/12 01:58:06
Modified: resources/org/apache/batik/apps/svgbrowser/resources
GUI.properties
sources/org/apache/batik/bridge BridgeContext.java
SVGSVGElementBridge.java
Log:
add a method to the BridgeContext to return the actual size of the SVG document
Revision Changes Path
1.2 +2 -2 xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/GUI.properties
Index: GUI.properties
===================================================================
RCS file: /home/cvs/xml-batik/resources/org/apache/batik/apps/svgbrowser/resources/GUI.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- GUI.properties 2001/03/08 01:21:04 1.1
+++ GUI.properties 2001/03/12 09:58:02 1.2
@@ -9,7 +9,7 @@
# The viewer's GUI resources.
#
# Author: stephane@hillion.org
-# $Id: GUI.properties,v 1.1 2001/03/08 01:21:04 hillion Exp $
+# $Id: GUI.properties,v 1.2 2001/03/12 09:58:02 tkormann Exp $
#
#
@@ -73,7 +73,7 @@
Processing.mnemonic = P
ResetTransform.type = ITEM
-ResetTransform.text = Reset Transform
+ResetTransform.text = Initial View
ResetTransform.icon = resources/blank.gif
ResetTransform.mnemonic = T
ResetTransform.action = ResetTransformAction
1.16 +30 -2 xml-batik/sources/org/apache/batik/bridge/BridgeContext.java
Index: BridgeContext.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/BridgeContext.java,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- BridgeContext.java 2001/03/08 12:39:18 1.15
+++ BridgeContext.java 2001/03/12 09:58:04 1.16
@@ -8,6 +8,7 @@
package org.apache.batik.bridge;
+import java.awt.geom.Dimension2D;
import java.io.IOException;
import java.net.MalformedURLException;
import java.util.Collections;
@@ -17,6 +18,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+
import org.apache.batik.css.HiddenChildElementSupport;
import org.apache.batik.gvt.GraphicsNode;
import org.apache.batik.gvt.GraphicsNodeRenderContext;
@@ -39,7 +41,7 @@
* a SVG DOM tree such as the current viewport or the user agent.
*
* @author <a href="mailto:Thierry.Kormann@sophia.inria.fr">Thierry Kormann</a>
- * @version $Id: BridgeContext.java,v 1.15 2001/03/08 12:39:18 tkormann Exp $
+ * @version $Id: BridgeContext.java,v 1.16 2001/03/12 09:58:04 tkormann Exp $
*/
public class BridgeContext implements ErrorConstants {
@@ -116,6 +118,11 @@
protected DocumentLoader documentLoader;
/**
+ * The size of the document.
+ */
+ protected Dimension2D documentSize;
+
+ /**
* Constructs a new empty bridge context.
*/
protected BridgeContext() {}
@@ -287,12 +294,33 @@
/////////////////////////////////////////////////////////////////////////
/**
+ * Returns the actual size of the document or null if the document
+ * has not ben built yet.
+ */
+ public Dimension2D getDocumentSize() {
+ return documentSize;
+ }
+
+ /**
+ * Sets the size of the document to the specified dimension.
+ *
+ * @param d the actual size of the SVG document
+ */
+ protected void setDocumentSize(Dimension2D d) {
+ this.documentSize = d;
+ }
+
+ /**
* Returns the viewport of the specified element.
* @param e the element interested in its viewport
*/
public Viewport getViewport(Element e) {
if (viewportStack != null) { // building time
- return (Viewport)viewportStack.get(0);
+ if (viewportStack.size() > 0) {
+ return (Viewport)viewportStack.get(0);
+ } else {
+ return (Viewport)viewportMap.get(userAgent);
+ }
} else {
// search the first parent which has defined a viewport
e = HiddenChildElementSupport.getParentElement(e);
1.10 +3 -1 xml-batik/sources/org/apache/batik/bridge/SVGSVGElementBridge.java
Index: SVGSVGElementBridge.java
===================================================================
RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/SVGSVGElementBridge.java,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -r1.9 -r1.10
--- SVGSVGElementBridge.java 2001/03/08 12:39:29 1.9
+++ SVGSVGElementBridge.java 2001/03/12 09:58:05 1.10
@@ -8,6 +8,7 @@
package org.apache.batik.bridge;
+import java.awt.Dimension;
import java.awt.Shape;
import java.awt.geom.AffineTransform;
import java.awt.geom.NoninvertibleTransformException;
@@ -30,7 +31,7 @@
* Bridge class for the <svg> element.
*
* @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
- * @version $Id: SVGSVGElementBridge.java,v 1.9 2001/03/08 12:39:29 tkormann Exp $
+ * @version $Id: SVGSVGElementBridge.java,v 1.10 2001/03/12 09:58:05 tkormann Exp $
*/
public class SVGSVGElementBridge implements GraphicsNodeBridge,
SVGConstants,
@@ -128,6 +129,7 @@
}
}
} else {
+ ctx.setDocumentSize(new Dimension((int)w, (int)h));
clip = new Rectangle2D.Float(x, y, w, h);
}
---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org