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/04/12 15:28:10 UTC

cvs commit: xml-batik/sources/org/apache/batik/bridge ViewBox.java

tkormann    01/04/12 06:28:09

  Modified:    sources/org/apache/batik/bridge ViewBox.java
  Added:       samples/tests linkingViewBox.svg
  Log:
  first test for linking.
  
  The current impl. should support complex SVG URI fragment (including transform, viewBox, id, referencing <view>...). Anyway, I have some tests to do.
  
  Revision  Changes    Path
  1.1                  xml-batik/samples/tests/linkingViewBox.svg
  
  Index: linkingViewBox.svg
  ===================================================================
  <?xml version="1.0" standalone="no"?>
  <!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 20000802//EN"
  "http://www.w3.org/TR/2000/CR-SVG-20000802/DTD/svg-20000802.dtd">
  
  <!-- ========================================================================= -->
  <!-- Copyright (C) The Apache Software Foundation. All rights reserved.        -->
  <!--                                                                           -->
  <!-- This software is published under the terms of the Apache Software License -->
  <!-- version 1.1, a copy of which has been included with this distribution in  -->
  <!-- the LICENSE file.                                                         -->
  <!-- ========================================================================= -->
  
  <!-- ========================================================================= -->
  <!-- Linking and viewBox test.                                                 -->
  <!--                                                                           -->
  <!-- @author Thierry.Kormann@sophia.inria.fr                                   -->
  <!-- @version $Id: linkingViewBox.svg,v 1.1 2001/04/12 13:28:08 tkormann Exp $ -->
  <!-- ========================================================================= -->
  
  <?xml-stylesheet type="text/css" href="test.css" ?>
  
  <svg id="body" width="450" height="500" viewBox="0 0 450 500">
  <title>Linking and viewBox test</title>
      <!-- ============================================================= -->
      <!-- Test content                                                  -->
      <!-- ============================================================= -->
  
      <g id="testContent">
  
    <text x="225" y="50" class="title">
  Linking and viewBox test
    </text>
  
  <a xlink:href="#svgView(viewBox(125,125,100,100))">
    <text x="120" y="90" class="title" style="fill:blue;text-decoration:underline">
  Click here to start...
    </text>
  </a>
  
  <g transform="translate(125 125)" 
     style="stroke:black;stroke-width:4;font-size:12;text-decoration:underline;text-anchor:middle">
  
  <rect x="0"   y="0"   width="100" height="100" style="fill:crimson" />
  <a xlink:href="#svgView(viewBox(235,125,100,100))"> <!-- go to orange -->
  <text x="50" y="50" style="fill:blue;stroke:none;">Go to 'orange'</text>
  </a>
  
  
  <rect x="110" y="0"   width="100" height="100" style="fill:orange" />
  <a xlink:href="#svgView(viewBox(125,235,100,100))"> <!-- go to gold -->
  <text x="160" y="50" style="fill:blue;stroke:none;">Go to 'gold'</text>
  </a>
  
  
  <rect x="0"   y="110" width="100" height="100" style="fill:gold" />
  <a xlink:href="#svgView(viewBox(235,235,100,100))"> <!-- go to grey -->
  <text x="50" y="160" style="fill:blue;stroke:none;">Go to 'grey'</text>
  </a>
  
  
  <rect x="110" y="110" width="100" height="100" style="fill:#eee" />
  <a xlink:href="#svgView(viewBox(125,125,100,100))"> <!-- go to crimson -->
  <text x="160" y="160" style="fill:blue;stroke:none;">Back to 'crimson'</text>
  </a>
  
  </g>
  
      </g>
  
      <!-- ============================================================= -->
      <!-- Batik sample mark                                             -->
      <!-- ============================================================= -->
      <use xlink:href="../batikLogo.svg#Batik_Tag_Box" />
      
  </svg>
  
  
  
  1.4       +5 -1      xml-batik/sources/org/apache/batik/bridge/ViewBox.java
  
  Index: ViewBox.java
  ===================================================================
  RCS file: /home/cvs/xml-batik/sources/org/apache/batik/bridge/ViewBox.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ViewBox.java	2001/04/10 15:49:49	1.3
  +++ ViewBox.java	2001/04/12 13:28:09	1.4
  @@ -29,7 +29,7 @@
    * This class provides convenient methods to handle viewport.
    *
    * @author <a href="mailto:tkormann@apache.org">Thierry Kormann</a>
  - * @version $Id: ViewBox.java,v 1.3 2001/04/10 15:49:49 tkormann Exp $
  + * @version $Id: ViewBox.java,v 1.4 2001/04/12 13:28:09 tkormann Exp $
    */
   public abstract class ViewBox implements SVGConstants, ErrorConstants {
   
  @@ -68,6 +68,10 @@
           if (vh.hasId) {
               Document document = e.getOwnerDocument();
               attrDefElement = document.getElementById(vh.id);
  +        }
  +        if (attrDefElement == null) {
  +            throw new BridgeException(e, ERR_URI_MALFORMED,
  +                                      new Object[] {ref});
           }
           // if the referenced element is not a view, the attribute values to use
           // are those defined on the enclosed svg element
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: batik-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: batik-dev-help@xml.apache.org