source: josm/trunk/patches/10trim_svgsalamander.patch@ 15283

Last change on this file since 15283 was 8083, checked in by bastiK, 10 years ago

update svgsalamander to r200

File size: 10.1 KB
  • kitfox/svg/SVGElement.java

    Only in kitfox/svg: animation
    Only in kitfox/svg/app/ant: SVGToImageAntTask.java
    Only in kitfox/svg/app/beans: ProportionalLayoutPanel.form
    Only in kitfox/svg/app/beans: ProportionalLayoutPanel.java
    Only in kitfox/svg/app/beans: SVGPanel.form
    Only in kitfox/svg/app/beans: SVGPanel.java
    Only in kitfox/svg/app/data: HandlerFactory.java
    Only in kitfox/svg/app: MainFrame.form
    Only in kitfox/svg/app: MainFrame.java
    Only in kitfox/svg/app: PlayerDialog.form
    Only in kitfox/svg/app: PlayerDialog.java
    Only in kitfox/svg/app: PlayerThread.java
    Only in kitfox/svg/app: PlayerThreadListener.java
    Only in kitfox/svg/app: SVGPlayer.form
    Only in kitfox/svg/app: SVGPlayer.java
    Only in kitfox/svg/app: SVGViewer.form
    Only in kitfox/svg/app: SVGViewer.java
    Only in kitfox/svg/app: VersionDialog.form
    Only in kitfox/svg/app: VersionDialog.java
    Only in kitfox/svg: SVGDisplayPanel.form
    Only in kitfox/svg: SVGDisplayPanel.java
    diff -ur kitfox/svg/SVGElement.java src/com/kitfox/svg/SVGElement.java
    old new  
    3535 */
    3636package com.kitfox.svg;
    3737
    38 import com.kitfox.svg.animation.AnimationElement;
    39 import com.kitfox.svg.animation.TrackBase;
    40 import com.kitfox.svg.animation.TrackManager;
    4138import com.kitfox.svg.pathcmd.Arc;
    4239import com.kitfox.svg.pathcmd.BuildHistory;
    4340import com.kitfox.svg.pathcmd.Cubic;
     
    122119     * The diagram this element belongs to
    123120     */
    124121    protected SVGDiagram diagram;
    125     /**
    126      * Link to the universe we reside in
    127      */
    128     protected final TrackManager trackManager = new TrackManager();
    129122    boolean dirty = true;
    130123
    131124    /**
     
    305298        }
    306299    }
    307300
    308     public void removeAttribute(String name, int attribType)
    309     {
    310         switch (attribType)
    311         {
    312             case AnimationElement.AT_CSS:
    313                 inlineStyles.remove(name);
    314                 return;
    315             case AnimationElement.AT_XML:
    316                 presAttribs.remove(name);
    317                 return;
    318         }
    319     }
    320 
    321     public void addAttribute(String name, int attribType, String value) throws SVGElementException
    322     {
    323         if (hasAttribute(name, attribType))
    324         {
    325             throw new SVGElementException(this, "Attribute " + name + "(" + AnimationElement.animationElementToString(attribType) + ") already exists");
    326         }
    327 
    328         //Alter layout for id attribute
    329         if ("id".equals(name))
    330         {
    331             if (diagram != null)
    332             {
    333                 diagram.removeElement(id);
    334                 diagram.setElement(value, this);
    335             }
    336             this.id = value;
    337         }
    338 
    339         switch (attribType)
    340         {
    341             case AnimationElement.AT_CSS:
    342                 inlineStyles.put(name, new StyleAttribute(name, value));
    343                 return;
    344             case AnimationElement.AT_XML:
    345                 presAttribs.put(name, new StyleAttribute(name, value));
    346                 return;
    347         }
    348 
    349         throw new SVGElementException(this, "Invalid attribute type " + attribType);
    350     }
    351 
    352     public boolean hasAttribute(String name, int attribType) throws SVGElementException
    353     {
    354         switch (attribType)
    355         {
    356             case AnimationElement.AT_CSS:
    357                 return inlineStyles.containsKey(name);
    358             case AnimationElement.AT_XML:
    359                 return presAttribs.containsKey(name);
    360             case AnimationElement.AT_AUTO:
    361                 return inlineStyles.containsKey(name) || presAttribs.containsKey(name);
    362         }
    363 
    364         throw new SVGElementException(this, "Invalid attribute type " + attribType);
    365     }
    366 
    367301    /**
    368302     * @return a set of Strings that corespond to CSS attributes on this element
    369303     */
     
    389323        children.add(child);
    390324        child.parent = this;
    391325        child.setDiagram(diagram);
    392 
    393         //Add info to track if we've scanned animation element
    394         if (child instanceof AnimationElement)
    395         {
    396             trackManager.addTrackElement((AnimationElement) child);
    397         }
    398326    }
    399327
    400328    protected void setDiagram(SVGDiagram diagram)
     
    529457        return getStyle(attrib, true);
    530458    }
    531459
    532     public void setAttribute(String name, int attribType, String value) throws SVGElementException
    533     {
    534         StyleAttribute styAttr;
    535 
    536 
    537         switch (attribType)
    538         {
    539             case AnimationElement.AT_CSS:
    540             {
    541                 styAttr = (StyleAttribute) inlineStyles.get(name);
    542                 break;
    543             }
    544             case AnimationElement.AT_XML:
    545             {
    546                 styAttr = (StyleAttribute) presAttribs.get(name);
    547                 break;
    548             }
    549             case AnimationElement.AT_AUTO:
    550             {
    551                 styAttr = (StyleAttribute) inlineStyles.get(name);
    552 
    553                 if (styAttr == null)
    554                 {
    555                     styAttr = (StyleAttribute) presAttribs.get(name);
    556                 }
    557                 break;
    558             }
    559             default:
    560                 throw new SVGElementException(this, "Invalid attribute type " + attribType);
    561         }
    562 
    563         if (styAttr == null)
    564         {
    565             throw new SVGElementException(this, "Could not find attribute " + name + "(" + AnimationElement.animationElementToString(attribType) + ").  Make sure to create attribute before setting it.");
    566         }
    567 
    568         //Alter layout for relevant attributes
    569         if ("id".equals(styAttr.getName()))
    570         {
    571             if (diagram != null)
    572             {
    573                 diagram.removeElement(this.id);
    574                 diagram.setElement(value, this);
    575             }
    576             this.id = value;
    577         }
    578 
    579         styAttr.setStringValue(value);
    580     }
    581 
    582     public boolean getStyle(StyleAttribute attrib, boolean recursive) throws SVGException
    583     {
    584         return getStyle(attrib, recursive, true);
    585     }
    586    
    587460    /**
    588461     * Copies the current style into the passed style attribute. Checks for
    589462     * inline styles first, then internal and extranal style sheets, and finally
     
    595468     * style attribute, checks attributes of parents back to root until one
    596469     * found.
    597470     */
    598     public boolean getStyle(StyleAttribute attrib, boolean recursive, boolean evalAnimation)
    599             throws SVGException
     471    public boolean getStyle(StyleAttribute attrib, boolean recursive) throws SVGException
    600472    {
    601473        String styName = attrib.getName();
    602474
     
    605477
    606478        attrib.setStringValue(styAttr == null ? "" : styAttr.getStringValue());
    607479
    608         //Evalutate coresponding track, if one exists
    609         if (evalAnimation)
    610         {
    611             TrackBase track = trackManager.getTrack(styName, AnimationElement.AT_CSS);
    612             if (track != null)
    613             {
    614                 track.getValue(attrib, diagram.getUniverse().getCurTime());
    615                 return true;
    616             }
    617         }
    618 
    619480        //Return if we've found a non animated style
    620481        if (styAttr != null)
    621482        {
     
    628489
    629490        attrib.setStringValue(presAttr == null ? "" : presAttr.getStringValue());
    630491
    631         //Evalutate coresponding track, if one exists
    632         if (evalAnimation)
    633         {
    634             TrackBase track = trackManager.getTrack(styName, AnimationElement.AT_XML);
    635             if (track != null)
    636             {
    637                 track.getValue(attrib, diagram.getUniverse().getCurTime());
    638                 return true;
    639             }
    640         }
    641 
    642492        //Return if we've found a presentation attribute instead
    643493        if (presAttr != null)
    644494        {
     
    700550        //Copy presentation value directly
    701551        attrib.setStringValue(presAttr == null ? "" : presAttr.getStringValue());
    702552
    703         //Evalutate coresponding track, if one exists
    704         TrackBase track = trackManager.getTrack(presName, AnimationElement.AT_XML);
    705         if (track != null)
    706         {
    707             track.getValue(attrib, diagram.getUniverse().getCurTime());
    708             return true;
    709         }
    710 
    711553        //Return if we found presentation attribute
    712554        if (presAttr != null)
    713555        {
  • kitfox/svg/SVGLoaderHelper.java

    diff -ur kitfox/svg/SVGLoaderHelper.java src/com/kitfox/svg/SVGLoaderHelper.java
    old new  
    3737package com.kitfox.svg;
    3838
    3939import java.net.*;
    40 import java.io.*;
    41 
    42 import com.kitfox.svg.animation.parser.*;
    4340
    4441/**
    4542 * @author Mark McKay
     
    5855    public final SVGDiagram diagram;
    5956
    6057    public final URI xmlBase;
    61 
    62     /**
    63      * Animate nodes use this to parse their time strings
    64      */
    65     public final AnimTimeParser animTimeParser = new AnimTimeParser(new StringReader(""));
    6658   
    6759    /** Creates a new instance of SVGLoaderHelper */
    6860    public SVGLoaderHelper(URI xmlBase, SVGUniverse universe, SVGDiagram diagram)
  • kitfox/svg/SVGLoader.java

    diff -ur kitfox/svg/SVGLoader.java src/com/kitfox/svg/SVGLoader.java
    old new  
    4242import org.xml.sax.*;
    4343import org.xml.sax.helpers.DefaultHandler;
    4444
    45 import com.kitfox.svg.animation.*;
    4645import java.util.logging.Level;
    4746import java.util.logging.Logger;
    4847
     
    8887
    8988        //Compile a list of important builder classes
    9089        nodeClasses.put("a", A.class);
    91         nodeClasses.put("animate", Animate.class);
    92         nodeClasses.put("animatecolor", AnimateColor.class);
    93         nodeClasses.put("animatemotion", AnimateMotion.class);
    94         nodeClasses.put("animatetransform", AnimateTransform.class);
    9590        nodeClasses.put("circle", Circle.class);
    9691        nodeClasses.put("clippath", ClipPath.class);
    9792        nodeClasses.put("defs", Defs.class);
     
    115110        nodeClasses.put("polyline", Polyline.class);
    116111        nodeClasses.put("radialgradient", RadialGradient.class);
    117112        nodeClasses.put("rect", Rect.class);
    118         nodeClasses.put("set", SetSmil.class);
    119113        nodeClasses.put("shape", ShapeElement.class);
    120114        nodeClasses.put("stop", Stop.class);
    121115        nodeClasses.put("style", Style.class);
Note: See TracBrowser for help on using the repository browser.