Changeset 11525 in josm


Ignore:
Timestamp:
2017-02-02T00:08:08+01:00 (8 weeks ago)
Author:
Don-vip
Message:

see #14319 - update to latest version of svgSalamander (2017-01-07, patched)

Location:
trunk/src/com/kitfox/svg
Files:
61 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/com/kitfox/svg/A.java

    r8084 r11525  
    5656    }
    5757
     58    @Override
    5859    public String getTagName()
    5960    {
     
    6162    }
    6263   
     64    @Override
    6365    protected void build() throws SVGException
    6466    {
     
    8486     * update
    8587     */
     88    @Override
    8689    public boolean updateTime(double curTime) throws SVGException
    8790    {
  • trunk/src/com/kitfox/svg/Circle.java

    r8084 r11525  
    6262    }
    6363
     64    @Override
    6465    public String getTagName()
    6566    {
     
    6768    }
    6869
     70    @Override
    6971    protected void build() throws SVGException
    7072    {
     
    9193    }
    9294
     95    @Override
    9396    public void render(Graphics2D g) throws SVGException
    9497    {
     
    98101    }
    99102
     103    @Override
    100104    public Shape getShape()
    101105    {
     
    103107    }
    104108
     109    @Override
    105110    public Rectangle2D getBoundingBox() throws SVGException
    106111    {
     
    115120     * update
    116121     */
     122    @Override
    117123    public boolean updateTime(double curTime) throws SVGException
    118124    {
  • trunk/src/com/kitfox/svg/ClipPath.java

    r8084 r11525  
    3939import java.awt.Shape;
    4040import java.awt.geom.Area;
    41 import java.util.Iterator;
    4241
    4342/**
     
    6059    }
    6160
     61    @Override
    6262    public String getTagName()
    6363    {
     
    6969     * each child tag that has been processed
    7070     */
     71    @Override
    7172    public void loaderAddChild(SVGLoaderHelper helper, SVGElement child) throws SVGElementException
    7273    {
     
    7475    }
    7576
     77    @Override
    7678    protected void build() throws SVGException
    7779    {
     
    103105
    104106        Area clipArea = null;
    105         for (Iterator it = children.iterator(); it.hasNext();)
    106         {
    107             ShapeElement se = (ShapeElement) it.next();
     107        for (SVGElement svgElement : children) {
     108            ShapeElement se = (ShapeElement) svgElement;
    108109
    109110            if (clipArea == null)
     
    136137     * @throws com.kitfox.svg.SVGException
    137138     */
     139    @Override
    138140    public boolean updateTime(double curTime) throws SVGException
    139141    {
  • trunk/src/com/kitfox/svg/Defs.java

    r8084 r11525  
    3636package com.kitfox.svg;
    3737
    38 import java.util.Iterator;
    39 
    4038/**
    4139 * @author Mark McKay
     
    5452    }
    5553
     54    @Override
    5655    public String getTagName()
    5756    {
     
    6362     * each child tag that has been processed
    6463     */
     64    @Override
    6565    public void loaderAddChild(SVGLoaderHelper helper, SVGElement child) throws SVGElementException
    6666    {
     
    7070    }
    7171
     72    @Override
    7273    public boolean updateTime(double curTime) throws SVGException
    7374    {
    7475        boolean stateChange = false;
    75         for (Iterator it = children.iterator(); it.hasNext();)
    76         {
    77             SVGElement ele = (SVGElement) it.next();
     76        for (SVGElement ele : children) {
    7877            stateChange = stateChange || ele.updateTime(curTime);
    7978        }
  • trunk/src/com/kitfox/svg/Desc.java

    r8084 r11525  
    5555    }
    5656
     57    @Override
    5758    public String getTagName()
    5859    {
     
    6364     * Called during load process to add text scanned within a tag
    6465     */
     66    @Override
    6567    public void loaderAddText(SVGLoaderHelper helper, String text)
    6668    {
     
    7375    }
    7476
     77    @Override
    7578    public boolean updateTime(double curTime)
    7679    {
  • trunk/src/com/kitfox/svg/Ellipse.java

    r8084 r11525  
    6363    }
    6464
     65    @Override
    6566    public String getTagName()
    6667    {
     
    6869    }
    6970
     71    @Override
    7072    protected void build() throws SVGException
    7173    {
     
    9799    }
    98100
     101    @Override
    99102    public void render(Graphics2D g) throws SVGException
    100103    {
     
    104107    }
    105108
     109    @Override
    106110    public Shape getShape()
    107111    {
     
    109113    }
    110114
     115    @Override
    111116    public Rectangle2D getBoundingBox() throws SVGException
    112117    {
     
    121126     * update
    122127     */
     128    @Override
    123129    public boolean updateTime(double curTime) throws SVGException
    124130    {
  • trunk/src/com/kitfox/svg/Filter.java

    r10865 r11525  
    44 * All rights reserved.
    55 *
    6  * Redistribution and use in source and binary forms, with or 
     6 * Redistribution and use in source and binary forms, with or
    77 * without modification, are permitted provided that the following
    88 * conditions are met:
    99 *
    10  *   - Redistributions of source code must retain the above 
     10 *   - Redistributions of source code must retain the above
    1111 *     copyright notice, this list of conditions and the following
    1212 *     disclaimer.
    1313 *   - Redistributions in binary form must reproduce the above
    1414 *     copyright notice, this list of conditions and the following
    15  *     disclaimer in the documentation and/or other materials 
     15 *     disclaimer in the documentation and/or other materials
    1616 *     provided with the distribution.
    1717 *
     
    2727 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2828 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    29  * OF THE POSSIBILITY OF SUCH DAMAGE. 
    30  * 
     29 * OF THE POSSIBILITY OF SUCH DAMAGE.
     30 *
    3131 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    3232 * projects can be found at http://www.kitfox.com
     
    3636package com.kitfox.svg;
    3737
    38 import com.kitfox.svg.xml.StyleAttribute;
    3938import java.awt.geom.Point2D;
    4039import java.net.URI;
    4140import java.net.URL;
    4241import java.util.ArrayList;
     42
     43import com.kitfox.svg.xml.StyleAttribute;
    4344
    4445/**
     
    6263    Point2D filterRes = new Point2D.Double();
    6364    URL href = null;
    64     final ArrayList filterEffects = new ArrayList();
     65    final ArrayList<SVGElement> filterEffects = new ArrayList<>();
    6566
    6667    /**
     
    7172    }
    7273
     74    @Override
    7375    public String getTagName()
    7476    {
     
    7678    }
    7779
     80    @Override
    7881    protected void build() throws SVGException
    7982    {
     
    161164    }
    162165
     166    @Override
    163167    public boolean updateTime(double curTime) throws SVGException
    164168    {
  • trunk/src/com/kitfox/svg/Font.java

    r8084 r11525  
    5959    FontFace fontFace = null;
    6060    MissingGlyph missingGlyph = null;
    61     final HashMap glyphs = new HashMap();
     61    final HashMap<String, SVGElement> glyphs = new HashMap<>();
    6262
    6363    /**
     
    6868    }
    6969
     70    @Override
    7071    public String getTagName()
    7172    {
     
    7778     * each child tag that has been processed
    7879     */
     80    @Override
    7981    public void loaderAddChild(SVGLoaderHelper helper, SVGElement child) throws SVGElementException
    8082    {
     
    9395    }
    9496
     97    @Override
    9598    public void loaderEndElement(SVGLoaderHelper helper) throws SVGParseException
    9699    {
     
    102105    }
    103106
     107    @Override
    104108    protected void build() throws SVGException
    105109    {
     
    211215     * update
    212216     */
     217    @Override
    213218    public boolean updateTime(double curTime) throws SVGException
    214219    {
  • trunk/src/com/kitfox/svg/FontFace.java

    r8084 r11525  
    7272    }
    7373
     74    @Override
    7475    public String getTagName()
    7576    {
     
    7778    }
    7879
     80    @Override
    7981    protected void build() throws SVGException
    8082    {
     
    229231     * update
    230232     */
     233    @Override
    231234    public boolean updateTime(double curTime)
    232235    {
  • trunk/src/com/kitfox/svg/Glyph.java

    r8084 r11525  
    6363    }
    6464
     65    @Override
    6566    public String getTagName()
    6667    {
     
    6869    }
    6970
     71    @Override
    7072    protected void build() throws SVGException
    7173    {
     
    9294     * update
    9395     */
     96    @Override
    9497    public boolean updateTime(double curTime) throws SVGException
    9598    {
  • trunk/src/com/kitfox/svg/Gradient.java

    r8084 r11525  
    4141import java.net.URI;
    4242import java.util.ArrayList;
    43 import java.util.Iterator;
    4443import java.util.logging.Level;
    4544import java.util.logging.Logger;
     
    6261    //Either this gradient contains a list of stops, or it will take it's
    6362    // stops from the referenced gradient
    64     ArrayList stops = new ArrayList();
     63    ArrayList<Stop> stops = new ArrayList<>();
    6564    URI stopRef = null;
    6665    protected AffineTransform gradientTransform = null;
     
    7776    }
    7877
     78    @Override
    7979    public String getTagName()
    8080    {
     
    8686     * each child tag that has been processed
    8787     */
     88    @Override
    8889    public void loaderAddChild(SVGLoaderHelper helper, SVGElement child) throws SVGElementException
    8990    {
     
    9798    }
    9899
     100    @Override
    99101    protected void build() throws SVGException
    100102    {
     
    173175        stopFractions = new float[stops.size()];
    174176        int idx = 0;
    175         for (Iterator it = stops.iterator(); it.hasNext();)
    176         {
    177             Stop stop = (Stop) it.next();
     177        for (Stop stop : stops) {
    178178            float val = stop.offset;
    179179            if (idx != 0 && val < stopFractions[idx - 1])
     
    202202        stopColors = new Color[stops.size()];
    203203        int idx = 0;
    204         for (Iterator it = stops.iterator(); it.hasNext();)
    205         {
    206             Stop stop = (Stop) it.next();
     204        for (Stop stop : stops) {
    207205            int stopColorVal = stop.color.getRGB();
    208206            Color stopColor = new Color((stopColorVal >> 16) & 0xff, (stopColorVal >> 8) & 0xff, stopColorVal & 0xff, clamp((int) (stop.opacity * 255), 0, 255));
     
    255253     * update
    256254     */
     255    @Override
    257256    public boolean updateTime(double curTime) throws SVGException
    258257    {
     
    262261        //Get current values for parameters
    263262        StyleAttribute sty = new StyleAttribute();
    264         boolean shapeChange = false;
    265263        String strn;
    266264
     
    335333
    336334        //Check stops, if any
    337         for (Iterator it = stops.iterator(); it.hasNext();)
    338         {
    339             Stop stop = (Stop) it.next();
     335        for (Stop stop : stops) {
    340336            if (stop.updateTime(curTime))
    341337            {
  • trunk/src/com/kitfox/svg/Group.java

    r8084 r11525  
    6666    }
    6767
     68    @Override
    6869    public String getTagName()
    6970    {
     
    7576     * each child tag that has been processed
    7677     */
     78    @Override
    7779    public void loaderAddChild(SVGLoaderHelper helper, SVGElement child) throws SVGElementException
    7880    {
     
    98100    }
    99101
    100     void pick(Point2D point, boolean boundingBox, List retVec) throws SVGException
     102    @Override
     103    void pick(Point2D point, boolean boundingBox, List<List<SVGElement>> retVec) throws SVGException
    101104    {
    102105        Point2D xPoint = new Point2D.Double(point.getX(), point.getY());
     
    113116
    114117
    115         for (Iterator it = children.iterator(); it.hasNext();)
    116         {
    117             SVGElement ele = (SVGElement) it.next();
     118        for (SVGElement ele : children) {
    118119            if (ele instanceof RenderableElement)
    119120            {
     
    125126    }
    126127
    127     void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, List retVec) throws SVGException
     128    @Override
     129    void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, List<List<SVGElement>> retVec) throws SVGException
    128130    {
    129131        if (xform != null)
     
    134136
    135137
    136         for (Iterator it = children.iterator(); it.hasNext();)
    137         {
    138             SVGElement ele = (SVGElement) it.next();
     138        for (SVGElement ele : children) {
    139139            if (ele instanceof RenderableElement)
    140140            {
     
    146146    }
    147147
     148    @Override
    148149    public void render(Graphics2D g) throws SVGException
    149150    {
     
    169170        beginLayer(g);
    170171
    171         Iterator it = children.iterator();
     172        Iterator<SVGElement> it = children.iterator();
    172173
    173174//        try
     
    185186        while (it.hasNext())
    186187        {
    187             SVGElement ele = (SVGElement) it.next();
     188            SVGElement ele = it.next();
    188189            if (ele instanceof RenderableElement)
    189190            {
     
    212213     * Retrieves the cached bounding box of this group
    213214     */
     215    @Override
    214216    public Shape getShape()
    215217    {
     
    225227        Area retShape = new Area();
    226228
    227         for (Iterator it = children.iterator(); it.hasNext();)
    228         {
    229             SVGElement ele = (SVGElement) it.next();
    230 
     229        for (SVGElement ele : children) {
    231230            if (ele instanceof ShapeElement)
    232231            {
     
    246245     * Retrieves the cached bounding box of this group
    247246     */
     247    @Override
    248248    public Rectangle2D getBoundingBox() throws SVGException
    249249    {
     
    262262    public void calcBoundingBox() throws SVGException
    263263    {
    264 //        Rectangle2D retRect = new Rectangle2D.Float();
    265264        Rectangle2D retRect = null;
    266265
    267         for (Iterator it = children.iterator(); it.hasNext();)
    268         {
    269             SVGElement ele = (SVGElement) it.next();
    270 
     266        for (SVGElement ele : children) {
    271267            if (ele instanceof RenderableElement)
    272268            {
     
    304300    }
    305301
     302    @Override
    306303    public boolean updateTime(double curTime) throws SVGException
    307304    {
    308305        boolean changeState = super.updateTime(curTime);
    309         Iterator it = children.iterator();
     306        Iterator<SVGElement> it = children.iterator();
    310307
    311308        //Distribute message to all members of this group
    312309        while (it.hasNext())
    313310        {
    314             SVGElement ele = (SVGElement) it.next();
     311            SVGElement ele = it.next();
    315312            boolean updateVal = ele.updateTime(curTime);
    316313
  • trunk/src/com/kitfox/svg/Hkern.java

    r8084 r11525  
    5050    int k;
    5151
     52    @Override
    5253    public String getTagName()
    5354    {
     
    5556    }
    5657
     58    @Override
    5759    protected void build() throws SVGException
    5860    {
     
    7981    }
    8082
     83    @Override
    8184    public boolean updateTime(double curTime) throws SVGException
    8285    {
  • trunk/src/com/kitfox/svg/ImageSVG.java

    r8084 r11525  
    7777    }
    7878
     79    @Override
    7980    public String getTagName()
    8081    {
     
    8283    }
    8384
     85    @Override
    8486    protected void build() throws SVGException
    8587    {
     
    185187    }
    186188
    187     void pick(Point2D point, boolean boundingBox, List retVec) throws SVGException
     189    @Override
     190    void pick(Point2D point, boolean boundingBox, List<List<SVGElement>> retVec) throws SVGException
    188191    {
    189192        if (getBoundingBox().contains(point))
     
    193196    }
    194197
    195     void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, List retVec) throws SVGException
     198    @Override
     199    void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, List<List<SVGElement>> retVec) throws SVGException
    196200    {
    197201        if (ltw.createTransformedShape(getBoundingBox()).intersects(pickArea))
     
    201205    }
    202206
     207    @Override
    203208    public void render(Graphics2D g) throws SVGException
    204209    {
     
    262267    }
    263268
     269    @Override
    264270    public Rectangle2D getBoundingBox()
    265271    {
     
    274280     * update
    275281     */
     282    @Override
    276283    public boolean updateTime(double curTime) throws SVGException
    277284    {
  • trunk/src/com/kitfox/svg/Line.java

    r8084 r11525  
    6363    }
    6464
     65    @Override
    6566    public String getTagName()
    6667    {
     
    6869    }
    6970
     71    @Override
    7072    protected void build() throws SVGException
    7173    {
     
    9799    }
    98100
     101    @Override
    99102    public void render(Graphics2D g) throws SVGException
    100103    {
     
    104107    }
    105108
     109    @Override
    106110    public Shape getShape()
    107111    {
     
    109113    }
    110114
     115    @Override
    111116    public Rectangle2D getBoundingBox() throws SVGException
    112117    {
     
    121126     * update
    122127     */
     128    @Override
    123129    public boolean updateTime(double curTime) throws SVGException
    124130    {
  • trunk/src/com/kitfox/svg/LinearGradient.java

    r10787 r11525  
    6565    }
    6666
     67    @Override
    6768    public String getTagName()
    6869    {
     
    7071    }
    7172
     73    @Override
    7274    protected void build() throws SVGException
    7375    {
     
    9799    }
    98100
     101    @Override
    99102    public Paint getPaint(Rectangle2D bounds, AffineTransform xform)
    100103    {
     
    168171     * update
    169172     */
     173    @Override
    170174    public boolean updateTime(double curTime) throws SVGException
    171175    {
  • trunk/src/com/kitfox/svg/Marker.java

    r8084 r11525  
    6161    boolean markerUnitsStrokeWidth = true; //if set to false 'userSpaceOnUse' is assumed
    6262
     63    @Override
    6364    public String getTagName()
    6465    {
     
    6667    }
    6768
     69    @Override
    6870    protected void build() throws SVGException
    6971    {
     
    131133    }
    132134
     135    @Override
    133136    protected boolean outsideClip(Graphics2D g) throws SVGException
    134137    {
     
    144147    }
    145148
     149    @Override
    146150    public void render(Graphics2D g) throws SVGException
    147151    {
     
    173177    }
    174178
     179    @Override
    175180    public Shape getShape()
    176181    {
     
    179184    }
    180185
     186    @Override
    181187    public Rectangle2D getBoundingBox() throws SVGException
    182188    {
     
    192198     * update
    193199     */
     200    @Override
    194201    public boolean updateTime(double curTime) throws SVGException
    195202    {
     
    229236    {
    230237
    231         private ArrayList markerList = new ArrayList();
     238        private ArrayList<MarkerPos> markerList = new ArrayList<MarkerPos>();
    232239        boolean started = false;
    233240
     
    362369         * @return the markerList
    363370         */
    364         public ArrayList getMarkerList()
     371        public ArrayList<MarkerPos> getMarkerList()
    365372        {
    366373            return markerList;
  • trunk/src/com/kitfox/svg/Metadata.java

    r8084 r11525  
    5353    }
    5454
     55    @Override
    5556    public String getTagName()
    5657    {
     
    5859    }
    5960
     61    @Override
    6062    public boolean updateTime(double curTime)
    6163    {
  • trunk/src/com/kitfox/svg/MissingGlyph.java

    r8084 r11525  
    7373    }
    7474
     75    @Override
    7576    public String getTagName()
    7677    {
     
    8283     * each child tag that has been processed
    8384     */
     85    @Override
    8486    public void loaderAddChild(SVGLoaderHelper helper, SVGElement child) throws SVGElementException
    8587    {
     
    8789    }
    8890
     91    @Override
    8992    protected void build() throws SVGException
    9093    {
     
    153156    }
    154157
     158    @Override
    155159    public void render(Graphics2D g) throws SVGException
    156160    {
     
    162166        }
    163167
    164         Iterator it = children.iterator();
     168        Iterator<SVGElement> it = children.iterator();
    165169        while (it.hasNext())
    166170        {
    167             SVGElement ele = (SVGElement) it.next();
     171            SVGElement ele = it.next();
    168172            if (ele instanceof RenderableElement)
    169173            {
     
    212216    }
    213217
     218    @Override
    214219    public Shape getShape()
    215220    {
     
    221226    }
    222227
     228    @Override
    223229    public Rectangle2D getBoundingBox() throws SVGException
    224230    {
     
    237243     * update
    238244     */
     245    @Override
    239246    public boolean updateTime(double curTime) throws SVGException
    240247    {
  • trunk/src/com/kitfox/svg/Path.java

    r10787 r11525  
    6363    }
    6464
     65    @Override
    6566    public String getTagName()
    6667    {
     
    6869    }
    6970
     71    @Override
    7072    protected void build() throws SVGException
    7173    {
     
    8688    }
    8789
     90    @Override
    8891    public void render(Graphics2D g) throws SVGException
    8992    {
     
    9396    }
    9497
     98    @Override
    9599    public Shape getShape()
    96100    {
     
    98102    }
    99103
     104    @Override
    100105    public Rectangle2D getBoundingBox() throws SVGException
    101106    {
     
    110115     * update
    111116     */
     117    @Override
    112118    public boolean updateTime(double curTime) throws SVGException
    113119    {
  • trunk/src/com/kitfox/svg/PatternSVG.java

    r8084 r11525  
    4747import java.awt.image.BufferedImage;
    4848import java.net.URI;
    49 import java.util.Iterator;
    5049import java.util.logging.Level;
    5150import java.util.logging.Logger;
     
    7776    }
    7877
     78    @Override
    7979    public String getTagName()
    8080    {
     
    8686     * each child tag that has been processed
    8787     */
     88    @Override
    8889    public void loaderAddChild(SVGLoaderHelper helper, SVGElement child) throws SVGElementException
    8990    {
     
    9192    }
    9293
     94    @Override
    9395    protected void build() throws SVGException
    9496    {
     
    227229        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    228230
    229         for (Iterator it = children.iterator(); it.hasNext();)
    230         {
    231             SVGElement ele = (SVGElement) it.next();
     231        for (SVGElement ele : children) {
    232232            if (ele instanceof RenderableElement)
    233233            {
     
    264264    }
    265265
     266    @Override
    266267    public Paint getPaint(Rectangle2D bounds, AffineTransform xform)
    267268    {
     
    276277     * update
    277278     */
     279    @Override
    278280    public boolean updateTime(double curTime) throws SVGException
    279281    {
  • trunk/src/com/kitfox/svg/Polygon.java

    r8084 r11525  
    6262    }
    6363
     64    @Override
    6465    public String getTagName()
    6566    {
     
    6768    }
    6869
     70    @Override
    6971    protected void build() throws SVGException
    7072    {
     
    9799    }
    98100
     101    @Override
    99102    public void render(Graphics2D g) throws SVGException
    100103    {
     
    104107    }
    105108
     109    @Override
    106110    public Shape getShape()
    107111    {
     
    109113    }
    110114
     115    @Override
    111116    public Rectangle2D getBoundingBox() throws SVGException
    112117    {
     
    121126     * update
    122127     */
     128    @Override
    123129    public boolean updateTime(double curTime) throws SVGException
    124130    {
  • trunk/src/com/kitfox/svg/Polyline.java

    r8084 r11525  
    6262    }
    6363
     64    @Override
    6465    public String getTagName()
    6566    {
     
    6768    }
    6869
     70    @Override
    6971    public void build() throws SVGException
    7072    {
     
    9698    }
    9799
     100    @Override
    98101    public void render(Graphics2D g) throws SVGException
    99102    {
     
    103106    }
    104107
     108    @Override
    105109    public Shape getShape()
    106110    {
     
    108112    }
    109113
     114    @Override
    110115    public Rectangle2D getBoundingBox() throws SVGException
    111116    {
     
    120125     * update
    121126     */
     127    @Override
    122128    public boolean updateTime(double curTime) throws SVGException
    123129    {
  • trunk/src/com/kitfox/svg/RadialGradient.java

    r10787 r11525  
    44 * All rights reserved.
    55 *
    6  * Redistribution and use in source and binary forms, with or
     6 * Redistribution and use in source and binary forms, with or 
    77 * without modification, are permitted provided that the following
    88 * conditions are met:
    99 *
    10  *   - Redistributions of source code must retain the above
     10 *   - Redistributions of source code must retain the above 
    1111 *     copyright notice, this list of conditions and the following
    1212 *     disclaimer.
    1313 *   - Redistributions in binary form must reproduce the above
    1414 *     copyright notice, this list of conditions and the following
    15  *     disclaimer in the documentation and/or other materials
     15 *     disclaimer in the documentation and/or other materials 
    1616 *     provided with the distribution.
    1717 *
     
    2727 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2828 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    29  * OF THE POSSIBILITY OF SUCH DAMAGE.
    30  *
     29 * OF THE POSSIBILITY OF SUCH DAMAGE. 
     30 * 
    3131 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    3232 * projects can be found at http://www.kitfox.com
     
    3636package com.kitfox.svg;
    3737
     38import com.kitfox.svg.xml.StyleAttribute;
    3839import java.awt.MultipleGradientPaint;
    3940import java.awt.Paint;
     
    4243import java.awt.geom.Point2D;
    4344import java.awt.geom.Rectangle2D;
    44 import java.util.Arrays;
    45 
    46 import com.kitfox.svg.xml.StyleAttribute;
    4745
    4846/**
  • trunk/src/com/kitfox/svg/Rect.java

    r8084 r11525  
    6969    }
    7070
     71    @Override
    7172    public String getTagName()
    7273    {
     
    132133     }
    133134     */
     135    @Override
    134136    protected void build() throws SVGException
    135137    {
     
    200202    }
    201203
     204    @Override
    202205    public void render(Graphics2D g) throws SVGException
    203206    {
     
    207210    }
    208211
     212    @Override
    209213    public Shape getShape()
    210214    {
     
    212216    }
    213217
     218    @Override
    214219    public Rectangle2D getBoundingBox() throws SVGException
    215220    {
     
    224229     * update
    225230     */
     231    @Override
    226232    public boolean updateTime(double curTime) throws SVGException
    227233    {
  • trunk/src/com/kitfox/svg/RenderableElement.java

    r8084 r11525  
    7373    }
    7474
     75    @Override
    7576    protected void build() throws SVGException
    7677    {
     
    9697    abstract public void render(Graphics2D g) throws SVGException;
    9798
    98     abstract void pick(Point2D point, boolean boundingBox, List retVec) throws SVGException;
     99    abstract void pick(Point2D point, boolean boundingBox, List<List<SVGElement>> retVec) throws SVGException;
    99100
    100     abstract void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, List retVec) throws SVGException;
     101    abstract void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, List<List<SVGElement>> retVec) throws SVGException;
    101102
    102103    abstract public Rectangle2D getBoundingBox() throws SVGException;
  • trunk/src/com/kitfox/svg/SVGDiagram.java

    r8084 r11525  
    6262   
    6363    //Indexes elements within this SVG diagram
    64     final HashMap idMap = new HashMap();
     64    final HashMap<String, SVGElement> idMap = new HashMap<>();
    6565
    6666    SVGRoot root;
     
    116116     * @return the passed in list
    117117     */
    118     public List pick(Point2D point, List retVec) throws SVGException
     118    public List<List<SVGElement>> pick(Point2D point, List<List<SVGElement>> retVec) throws SVGException
    119119    {
    120120        return pick(point, false, retVec);
    121121    }
    122122   
    123     public List pick(Point2D point, boolean boundingBox, List retVec) throws SVGException
     123    public List<List<SVGElement>> pick(Point2D point, boolean boundingBox, List<List<SVGElement>> retVec) throws SVGException
    124124    {
    125125        if (retVec == null)
    126126        {
    127             retVec = new ArrayList();
     127            retVec = new ArrayList<>();
    128128        }
    129129       
     
    133133    }
    134134
    135     public List pick(Rectangle2D pickArea, List retVec) throws SVGException
     135    public List<List<SVGElement>> pick(Rectangle2D pickArea, List<List<SVGElement>> retVec) throws SVGException
    136136    {
    137137        return pick(pickArea, false, retVec);
    138138    }
    139139   
    140     public List pick(Rectangle2D pickArea, boolean boundingBox, List retVec) throws SVGException
     140    public List<List<SVGElement>> pick(Rectangle2D pickArea, boolean boundingBox, List<List<SVGElement>> retVec) throws SVGException
    141141    {
    142142        if (retVec == null)
    143143        {
    144             retVec = new ArrayList();
     144            retVec = new ArrayList<>();
    145145        }
    146146       
  • trunk/src/com/kitfox/svg/SVGElement.java

    r8084 r11525  
    44 * All rights reserved.
    55 *
    6  * Redistribution and use in source and binary forms, with or 
     6 * Redistribution and use in source and binary forms, with or
    77 * without modification, are permitted provided that the following
    88 * conditions are met:
    99 *
    10  *   - Redistributions of source code must retain the above 
     10 *   - Redistributions of source code must retain the above
    1111 *     copyright notice, this list of conditions and the following
    1212 *     disclaimer.
    1313 *   - Redistributions in binary form must reproduce the above
    1414 *     copyright notice, this list of conditions and the following
    15  *     disclaimer in the documentation and/or other materials 
     15 *     disclaimer in the documentation and/or other materials
    1616 *     provided with the distribution.
    1717 *
     
    2727 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2828 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    29  * OF THE POSSIBILITY OF SUCH DAMAGE. 
    30  * 
     29 * OF THE POSSIBILITY OF SUCH DAMAGE.
     30 *
    3131 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    3232 * projects can be found at http://www.kitfox.com
     
    3535 */
    3636package com.kitfox.svg;
     37
     38import java.awt.geom.AffineTransform;
     39import java.awt.geom.GeneralPath;
     40import java.io.Serializable;
     41import java.net.URI;
     42import java.util.ArrayList;
     43import java.util.Collections;
     44import java.util.HashMap;
     45import java.util.HashSet;
     46import java.util.Iterator;
     47import java.util.LinkedList;
     48import java.util.List;
     49import java.util.Set;
     50import java.util.regex.Matcher;
     51import java.util.regex.Pattern;
     52
     53import org.xml.sax.Attributes;
     54import org.xml.sax.SAXException;
    3755
    3856import com.kitfox.svg.pathcmd.Arc;
     
    5169import com.kitfox.svg.xml.StyleSheet;
    5270import com.kitfox.svg.xml.XMLParseUtil;
    53 import java.awt.geom.AffineTransform;
    54 import java.awt.geom.GeneralPath;
    55 import java.io.Serializable;
    56 import java.net.URI;
    57 import java.util.ArrayList;
    58 import java.util.Collections;
    59 import java.util.HashMap;
    60 import java.util.HashSet;
    61 import java.util.Iterator;
    62 import java.util.LinkedList;
    63 import java.util.List;
    64 import java.util.Set;
    65 import java.util.regex.Matcher;
    66 import java.util.regex.Pattern;
    67 import org.xml.sax.Attributes;
    68 import org.xml.sax.SAXException;
    69 
    7071
    7172/**
     
    7980    public static final String SVG_NS = "http://www.w3.org/2000/svg";
    8081    protected SVGElement parent = null;
    81     protected final ArrayList children = new ArrayList();
     82    protected final ArrayList<SVGElement> children = new ArrayList<>();
    8283    protected String id = null;
    8384    /**
     
    8889     * Styles defined for this elemnt via the <b>style</b> attribute.
    8990     */
    90     protected final HashMap inlineStyles = new HashMap();
     91    protected final HashMap<String, StyleAttribute> inlineStyles = new HashMap<>();
    9192    /**
    9293     * Presentation attributes set for this element. Ie, any attribute other
    9394     * than the <b>style</b> attribute.
    9495     */
    95     protected final HashMap presAttribs = new HashMap();
     96    protected final HashMap<String, StyleAttribute> presAttribs = new HashMap<>();
    9697    /**
    9798     * A list of presentation attributes to not include in the presentation
    9899     * attribute set.
    99100     */
    100     protected static final Set ignorePresAttrib;
     101    protected static final Set<String> ignorePresAttrib;
    101102
    102103    static
    103104    {
    104         HashSet set = new HashSet();
     105        HashSet<String> set = new HashSet<>();
    105106//        set.add("id");
    106107//        set.add("class");
     
    157158     * @return an ordered list of nodes from the root of the tree to this node
    158159     */
    159     public List getPath(List retVec)
     160    public List<SVGElement> getPath(List<SVGElement> retVec)
    160161    {
    161162        if (retVec == null)
    162163        {
    163             retVec = new ArrayList();
     164            retVec = new ArrayList<>();
    164165        }
    165166
     
    179180     * @return The list containing the children of this group
    180181     */
    181     public List getChildren(List retVec)
     182    public List<SVGElement> getChildren(List<SVGElement> retVec)
    182183    {
    183184        if (retVec == null)
    184185        {
    185             retVec = new ArrayList();
     186            retVec = new ArrayList<>();
    186187        }
    187188
     
    197198    public SVGElement getChild(String id)
    198199    {
    199         for (Iterator it = children.iterator(); it.hasNext();)
    200         {
    201             SVGElement ele = (SVGElement) it.next();
     200        for (SVGElement ele : children) {
    202201            String eleId = ele.getId();
    203202            if (eleId != null && eleId.equals(id))
     
    234233        }
    235234
    236         Object temp = children.get(i);
     235        SVGElement temp = children.get(i);
    237236        children.set(i, children.get(j));
    238237        children.set(j, temp);
     
    269268        if (style != null)
    270269        {
    271             HashMap map = XMLParseUtil.parseStyle(style, inlineStyles);
     270            HashMap<?, ?> map = XMLParseUtil.parseStyle(style, inlineStyles);
    272271        }
    273272
     
    302301     * @return a set of Strings that corespond to CSS attributes on this element
    303302     */
    304     public Set getInlineAttributes()
     303    public Set<String> getInlineAttributes()
    305304    {
    306305        return inlineStyles.keySet();
     
    310309     * @return a set of Strings that corespond to XML attributes on this element
    311310     */
    312     public Set getPresentationAttributes()
     311    public Set<String> getPresentationAttributes()
    313312    {
    314313        return presAttribs.keySet();
     
    330329        this.diagram = diagram;
    331330        diagram.setElement(id, this);
    332         for (Iterator it = children.iterator(); it.hasNext();)
    333         {
    334             SVGElement ele = (SVGElement) it.next();
     331        for (SVGElement ele : children) {
    335332            ele.setDiagram(diagram);
    336333        }
     
    400397        for (int i = 0; i < children.size(); ++i)
    401398        {
    402             SVGElement ele = (SVGElement) children.get(i);
     399            SVGElement ele = children.get(i);
    403400            ele.build();
    404401        }
     
    418415        return id;
    419416    }
    420     LinkedList contexts = new LinkedList();
     417    LinkedList<SVGElement> contexts = new LinkedList<>();
    421418
    422419    /**
     
    431428    protected SVGElement popParentContext()
    432429    {
    433         return (SVGElement) contexts.removeLast();
     430        return contexts.removeLast();
    434431    }
    435432
     
    474471
    475472        //Check for local inline styles
    476         StyleAttribute styAttr = (StyleAttribute)inlineStyles.get(styName);
     473        StyleAttribute styAttr = inlineStyles.get(styName);
    477474
    478475        attrib.setStringValue(styAttr == null ? "" : styAttr.getStringValue());
     
    486483
    487484        //Check for presentation attribute
    488         StyleAttribute presAttr = (StyleAttribute)presAttribs.get(styName);
     485        StyleAttribute presAttr = presAttribs.get(styName);
    489486
    490487        attrib.setStringValue(presAttr == null ? "" : presAttr.getStringValue());
     
    533530    {
    534531        //Check for local inline styles
    535         return (StyleAttribute) inlineStyles.get(styName);
     532        return inlineStyles.get(styName);
    536533    }
    537534
     
    546543
    547544        //Make sure we have a coresponding presentation attribute
    548         StyleAttribute presAttr = (StyleAttribute) presAttribs.get(presName);
     545        StyleAttribute presAttr = presAttribs.get(presName);
    549546
    550547        //Copy presentation value directly
     
    568565    {
    569566        //Check for local inline styles
    570         return (StyleAttribute) presAttribs.get(styName);
     567        return presAttribs.get(styName);
    571568    }
    572569
     
    601598        String function = matchWord.group().toLowerCase();
    602599
    603         LinkedList termList = new LinkedList();
     600        LinkedList<String> termList = new LinkedList<>();
    604601        while (matchWord.find())
    605602        {
     
    609606
    610607        double[] terms = new double[termList.size()];
    611         Iterator it = termList.iterator();
     608        Iterator<String> it = termList.iterator();
    612609        int count = 0;
    613610        while (it.hasNext())
    614611        {
    615             terms[count++] = XMLParseUtil.parseDouble((String) it.next());
     612            terms[count++] = XMLParseUtil.parseDouble(it.next());
    616613        }
    617614
     
    661658    }
    662659
    663     static protected float nextFloat(LinkedList l)
    664     {
    665         String s = (String) l.removeFirst();
     660    static protected float nextFloat(LinkedList<String> l)
     661    {
     662        String s = l.removeFirst();
    666663        return Float.parseFloat(s);
    667664    }
     
    672669
    673670        //Tokenize
    674         LinkedList tokens = new LinkedList();
     671        LinkedList<String> tokens = new LinkedList<>();
    675672        while (matchPathCmd.find())
    676673        {
     
    680677
    681678        boolean defaultRelative = false;
    682         LinkedList cmdList = new LinkedList();
     679        LinkedList<PathCommand> cmdList = new LinkedList<>();
    683680        char curCmd = 'Z';
    684681        while (tokens.size() != 0)
    685682        {
    686             String curToken = (String) tokens.removeFirst();
     683            String curToken = tokens.removeFirst();
    687684            char initChar = curToken.charAt(0);
    688685            if ((initChar >= 'A' && initChar <= 'Z') || (initChar >= 'a' && initChar <= 'z'))
     
    825822    public SVGElement getChild(int i)
    826823    {
    827         return (SVGElement) children.get(i);
     824        return children.get(i);
    828825    }
    829826
  • trunk/src/com/kitfox/svg/SVGLoader.java

    r8084 r11525  
    44 * All rights reserved.
    55 *
    6  * Redistribution and use in source and binary forms, with or 
     6 * Redistribution and use in source and binary forms, with or
    77 * without modification, are permitted provided that the following
    88 * conditions are met:
    99 *
    10  *   - Redistributions of source code must retain the above 
     10 *   - Redistributions of source code must retain the above
    1111 *     copyright notice, this list of conditions and the following
    1212 *     disclaimer.
    1313 *   - Redistributions in binary form must reproduce the above
    1414 *     copyright notice, this list of conditions and the following
    15  *     disclaimer in the documentation and/or other materials 
     15 *     disclaimer in the documentation and/or other materials
    1616 *     provided with the distribution.
    1717 *
     
    2727 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2828 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    29  * OF THE POSSIBILITY OF SUCH DAMAGE. 
    30  * 
     29 * OF THE POSSIBILITY OF SUCH DAMAGE.
     30 *
    3131 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    3232 * projects can be found at http://www.kitfox.com
     
    3838
    3939
    40 import java.util.*;
    41 import java.net.*;
    42 import org.xml.sax.*;
    43 import org.xml.sax.helpers.DefaultHandler;
    44 
     40import java.net.URI;
     41import java.util.HashMap;
     42import java.util.HashSet;
     43import java.util.LinkedList;
    4544import java.util.logging.Level;
    4645import java.util.logging.Logger;
     46
     47import org.xml.sax.Attributes;
     48import org.xml.sax.SAXException;
     49import org.xml.sax.helpers.DefaultHandler;
    4750
    4851/**
     
    5255public class SVGLoader extends DefaultHandler
    5356{
    54     final HashMap nodeClasses = new HashMap();
     57    final HashMap<String, Class<?>> nodeClasses = new HashMap<>();
    5558    //final HashMap attribClasses = new HashMap();
    56     final LinkedList buildStack = new LinkedList();
    57 
    58     final HashSet ignoreClasses = new HashSet();
     59    final LinkedList<SVGElement> buildStack = new LinkedList<>();
     60
     61    final HashSet<String> ignoreClasses = new HashSet<>();
    5962
    6063    final SVGLoaderHelper helper;
     
    7376
    7477    final boolean verbose;
    75    
     78
    7679    /** Creates a new instance of SVGLoader */
    7780    public SVGLoader(URI xmlBase, SVGUniverse universe)
     
    7982        this(xmlBase, universe, false);
    8083    }
    81    
     84
    8285    public SVGLoader(URI xmlBase, SVGUniverse universe, boolean verbose)
    8386    {
    8487        this.verbose = verbose;
    85        
     88
    8689        diagram = new SVGDiagram(xmlBase, universe);
    8790
     
    138141        return sb.toString();
    139142    }
    140    
     143
     144    @Override
    141145    public void startDocument() throws SAXException
    142146    {
     
    146150    }
    147151
     152    @Override
    148153    public void endDocument() throws SAXException
    149154    {
     
    151156    }
    152157
     158    @Override
    153159    public void startElement(String namespaceURI, String sName, String qName, Attributes attrs) throws SAXException
    154160    {
     
    158164        }
    159165        indent++;
    160        
     166
    161167        if (skipNonSVGTagDepth != 0 || (!namespaceURI.equals("") && !namespaceURI.equals(SVGElement.SVG_NS)))
    162168        {
     
    164170            return;
    165171        }
    166        
     172
    167173        sName = sName.toLowerCase();
    168174
     
    187193
    188194        try {
    189             Class cls = (Class)obj;
     195            Class<?> cls = (Class<?>)obj;
    190196            SVGElement svgEle = (SVGElement)cls.newInstance();
    191197
    192198            SVGElement parent = null;
    193             if (buildStack.size() != 0) parent = (SVGElement)buildStack.getLast();
     199            if (buildStack.size() != 0) parent = buildStack.getLast();
    194200            svgEle.loaderStartElement(helper, attrs, parent);
    195201
     
    198204        catch (Exception e)
    199205        {
    200             Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, 
     206            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
    201207                "Could not load", e);
    202208            throw new SAXException(e);
     
    205211    }
    206212
     213    @Override
    207214    public void endElement(String namespaceURI, String sName, String qName)
    208215        throws SAXException
     
    213220            System.err.println(printIndent(indent, " ") + "Ending parse of tag " + sName+ ": " + namespaceURI);
    214221        }
    215        
     222
    216223        if (skipNonSVGTagDepth != 0)
    217224        {
     
    219226            return;
    220227        }
    221        
     228
    222229        sName = sName.toLowerCase();
    223230
     
    230237
    231238        try {
    232             SVGElement svgEle = (SVGElement)buildStack.removeLast();
     239            SVGElement svgEle = buildStack.removeLast();
    233240
    234241            svgEle.loaderEndElement(helper);
     
    237244            if (buildStack.size() != 0)
    238245            {
    239                 parent = (SVGElement)buildStack.getLast();
     246                parent = buildStack.getLast();
    240247            }
    241248            //else loadRoot = (SVGElement)svgEle;
     
    253260        catch (Exception e)
    254261        {
    255             Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, 
     262            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
    256263                "Could not parse", e);
    257264            throw new SAXException(e);
     
    259266    }
    260267
     268    @Override
    261269    public void characters(char buf[], int offset, int len)
    262270        throws SAXException
     
    269277        if (buildStack.size() != 0)
    270278        {
    271             SVGElement parent = (SVGElement)buildStack.getLast();
     279            SVGElement parent = buildStack.getLast();
    272280            String s = new String(buf, offset, len);
    273281            parent.loaderAddText(helper, s);
     
    275283    }
    276284
     285    @Override
    277286    public void processingInstruction(String target, String data)
    278287        throws SAXException
     
    280289        //Check for external style sheet
    281290    }
    282    
     291
    283292//    public SVGElement getLoadRoot() { return loadRoot; }
    284293    public SVGDiagram getLoadedDiagram() { return diagram; }
  • trunk/src/com/kitfox/svg/SVGLoaderHelper.java

    r8084 r11525  
    44 * All rights reserved.
    55 *
    6  * Redistribution and use in source and binary forms, with or 
     6 * Redistribution and use in source and binary forms, with or
    77 * without modification, are permitted provided that the following
    88 * conditions are met:
    99 *
    10  *   - Redistributions of source code must retain the above 
     10 *   - Redistributions of source code must retain the above
    1111 *     copyright notice, this list of conditions and the following
    1212 *     disclaimer.
    1313 *   - Redistributions in binary form must reproduce the above
    1414 *     copyright notice, this list of conditions and the following
    15  *     disclaimer in the documentation and/or other materials 
     15 *     disclaimer in the documentation and/or other materials
    1616 *     provided with the distribution.
    1717 *
     
    2727 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2828 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    29  * OF THE POSSIBILITY OF SUCH DAMAGE. 
    30  * 
     29 * OF THE POSSIBILITY OF SUCH DAMAGE.
     30 *
    3131 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    3232 * projects can be found at http://www.kitfox.com
     
    3737package com.kitfox.svg;
    3838
    39 import java.net.*;
     39import java.net.URI;
    4040
    4141/**
     
    5656
    5757    public final URI xmlBase;
    58    
     58
    5959    /** Creates a new instance of SVGLoaderHelper */
    6060    public SVGLoaderHelper(URI xmlBase, SVGUniverse universe, SVGDiagram diagram)
  • trunk/src/com/kitfox/svg/SVGRoot.java

    r10787 r11525  
    9393    }
    9494
     95    @Override
    9596    public String getTagName()
    9697    {
     
    9899    }
    99100   
     101    @Override
    100102    public void build() throws SVGException
    101103    {
     
    163165    }
    164166
     167    @Override
    165168    public SVGRoot getRoot()
    166169    {
     
    262265    {
    263266        prepareViewport();
    264 
     267       
    265268        Rectangle targetViewport = g.getClipBounds();
    266 
     269//
     270//        if (targetViewport == null)
     271//        {
     272//            Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
     273//            targetViewport = new Rectangle(0, 0, size.width, size.height);
     274//        }
     275//        clipRect.setRect(targetViewport);
     276
     277       
    267278        Rectangle deviceViewport = diagram.getDeviceViewport();
    268279        if (width != null && height != null)
     
    294305        else
    295306        {
     307//            Dimension size = Toolkit.getDefaultToolkit().getScreenSize();
     308//            targetViewport = new Rectangle(0, 0, size.width, size.height);
    296309            targetViewport = new Rectangle(deviceViewport);
    297310        }
     
    319332    }
    320333
    321     public void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, List retVec) throws SVGException
     334    @Override
     335    public void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, List<List<SVGElement>> retVec) throws SVGException
    322336    {
    323337        if (viewXform != null)
     
    330344    }
    331345   
    332     public void pick(Point2D point, boolean boundingBox, List retVec) throws SVGException
     346    @Override
     347    public void pick(Point2D point, boolean boundingBox, List<List<SVGElement>> retVec) throws SVGException
    333348    {
    334349        Point2D xPoint = new Point2D.Double(point.getX(), point.getY());
     
    347362    }
    348363
     364    @Override
    349365    public Shape getShape()
    350366    {
     
    353369    }
    354370
     371    @Override
    355372    public Rectangle2D getBoundingBox() throws SVGException
    356373    {
     
    381398     * update
    382399     */
     400    @Override
    383401    public boolean updateTime(double curTime) throws SVGException
    384402    {
  • trunk/src/com/kitfox/svg/SVGUniverse.java

    r10865 r11525  
    44 * All rights reserved.
    55 *
    6  * Redistribution and use in source and binary forms, with or 
     6 * Redistribution and use in source and binary forms, with or
    77 * without modification, are permitted provided that the following
    88 * conditions are met:
    99 *
    10  *   - Redistributions of source code must retain the above 
     10 *   - Redistributions of source code must retain the above
    1111 *     copyright notice, this list of conditions and the following
    1212 *     disclaimer.
    1313 *   - Redistributions in binary form must reproduce the above
    1414 *     copyright notice, this list of conditions and the following
    15  *     disclaimer in the documentation and/or other materials 
     15 *     disclaimer in the documentation and/or other materials
    1616 *     provided with the distribution.
    1717 *
     
    2727 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2828 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    29  * OF THE POSSIBILITY OF SUCH DAMAGE. 
    30  * 
     29 * OF THE POSSIBILITY OF SUCH DAMAGE.
     30 *
    3131 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    3232 * projects can be found at http://www.kitfox.com
     
    3636package com.kitfox.svg;
    3737
    38 import com.kitfox.svg.app.beans.SVGIcon;
    3938import java.awt.Graphics2D;
    4039import java.awt.image.BufferedImage;
     
    5857import java.util.Base64;
    5958import java.util.HashMap;
    60 import java.util.Iterator;
    6159import java.util.logging.Level;
    6260import java.util.logging.Logger;
    6361import java.util.zip.GZIPInputStream;
     62
    6463import javax.imageio.ImageIO;
    6564import javax.xml.parsers.ParserConfigurationException;
    6665import javax.xml.parsers.SAXParserFactory;
     66
    6767import org.xml.sax.EntityResolver;
    6868import org.xml.sax.InputSource;
     
    7070import org.xml.sax.SAXParseException;
    7171import org.xml.sax.XMLReader;
     72
     73import com.kitfox.svg.app.beans.SVGIcon;
    7274
    7375/**
     
    8991     * initiated from streams will have the scheme <i>svgSalamander</i>.
    9092     */
    91     final HashMap loadedDocs = new HashMap();
    92     final HashMap loadedFonts = new HashMap();
    93     final HashMap loadedImages = new HashMap();
     93    final HashMap<URI, SVGDiagram> loadedDocs = new HashMap<>();
     94    final HashMap<String, Font> loadedFonts = new HashMap<>();
     95    final HashMap<URL, SoftReference<BufferedImage>> loadedImages = new HashMap<>();
    9496    public static final String INPUTSTREAM_SCHEME = "svgSalamander";
    9597    /**
     
    141143    public Font getDefaultFont()
    142144    {
    143         for (Iterator it = loadedFonts.values().iterator(); it.hasNext();)
    144         {
    145             return (Font) it.next();
     145        for (Font font : loadedFonts.values()) {
     146            return font;
    146147        }
    147148        return null;
     
    150151    public Font getFont(String fontName)
    151152    {
    152         return (Font) loadedFonts.get(fontName);
     153        return loadedFonts.get(fontName);
    153154    }
    154155
     
    183184                    }
    184185
    185                     SoftReference ref = new SoftReference(img);
     186                    SoftReference<BufferedImage> ref = new SoftReference<>(img);
    186187                    loadedImages.put(url, ref);
    187188
     
    218219        }
    219220
    220         SoftReference ref;
     221        SoftReference<BufferedImage> ref;
    221222        try
    222223        {
     
    231232                icon.paintIcon(null, g, 0, 0);
    232233                g.dispose();
    233                 ref = new SoftReference(img);
     234                ref = new SoftReference<>(img);
    234235            } else
    235236            {
    236237                BufferedImage img = ImageIO.read(imageURL);
    237                 ref = new SoftReference(img);
     238                ref = new SoftReference<>(img);
    238239            }
    239240            loadedImages.put(imageURL, ref);
     
    247248    BufferedImage getImage(URL imageURL)
    248249    {
    249         SoftReference ref = (SoftReference) loadedImages.get(imageURL);
     250        SoftReference<BufferedImage> ref = loadedImages.get(imageURL);
    250251        if (ref == null)
    251252        {
     
    253254        }
    254255
    255         BufferedImage img = (BufferedImage) ref.get();
     256        BufferedImage img = ref.get();
    256257        //If image was cleared from memory, reload it
    257258        if (img == null)
     
    265266                    "Could not load image", e);
    266267            }
    267             ref = new SoftReference(img);
     268            ref = new SoftReference<>(img);
    268269            loadedImages.put(imageURL, ref);
    269270        }
     
    308309            URI xmlBase = new URI(path.getScheme(), path.getSchemeSpecificPart(), null);
    309310
    310             SVGDiagram dia = (SVGDiagram) loadedDocs.get(xmlBase);
     311            SVGDiagram dia = loadedDocs.get(xmlBase);
    311312            if (dia == null && loadIfAbsent)
    312313            {
     
    316317
    317318                loadSVG(url, false);
    318                 dia = (SVGDiagram) loadedDocs.get(xmlBase);
     319                dia = loadedDocs.get(xmlBase);
    319320                if (dia == null)
    320321                {
     
    349350        }
    350351
    351         SVGDiagram dia = (SVGDiagram) loadedDocs.get(xmlBase);
     352        SVGDiagram dia = loadedDocs.get(xmlBase);
    352353        if (dia != null || !loadIfAbsent)
    353354        {
     
    372373
    373374            loadSVG(url, false);
    374             dia = (SVGDiagram) loadedDocs.get(xmlBase);
     375            dia = loadedDocs.get(xmlBase);
    375376            return dia;
    376377        } catch (Exception e)
     
    604605    /**
    605606     * Get list of uris of all loaded documents and subdocuments.
    606      * @return 
    607      */
    608     public ArrayList getLoadedDocumentURIs()
    609     {
    610         return new ArrayList(loadedDocs.keySet());
    611     }
    612    
     607     * @return
     608     */
     609    public ArrayList<URI> getLoadedDocumentURIs()
     610    {
     611        return new ArrayList<>(loadedDocs.keySet());
     612    }
     613
    613614    /**
    614615     * Remove loaded document from cache.
    615      * @param uri 
     616     * @param uri
    616617     */
    617618    public void removeDocument(URI uri)
     
    619620        loadedDocs.remove(uri);
    620621    }
    621    
     622
    622623    public boolean isVerbose()
    623624    {
  • trunk/src/com/kitfox/svg/ShapeElement.java

    r10787 r11525  
    8787
    8888    @Override
    89     void pick(Point2D point, boolean boundingBox, List retVec) throws SVGException
     89    void pick(Point2D point, boolean boundingBox, List<List<SVGElement>> retVec) throws SVGException
    9090    {
    9191//        StyleAttribute styleAttrib = new StyleAttribute();
     
    9898
    9999    @Override
    100     void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, List retVec) throws SVGException
    101     {
    102         StyleAttribute styleAttrib = new StyleAttribute();
     100    void pick(Rectangle2D pickArea, AffineTransform ltw, boolean boundingBox, List<List<SVGElement>> retVec) throws SVGException
     101    {
     102//        StyleAttribute styleAttrib = new StyleAttribute();
    103103//        if (getStyle(styleAttrib.setName("fill")) && getShape().contains(point))
    104104        if (ltw.createTransformedShape((boundingBox ? getBoundingBox() : getShape())).intersects(pickArea))
     
    397397            layout.layout(shape);
    398398           
    399             ArrayList list = layout.getMarkerList();
     399            ArrayList<MarkerPos> list = layout.getMarkerList();
    400400            for (int i = 0; i < list.size(); ++i)
    401401            {
    402                 MarkerPos pos = (MarkerPos)list.get(i);
     402                MarkerPos pos = list.get(i);
    403403
    404404                switch (pos.type)
  • trunk/src/com/kitfox/svg/Stop.java

    r8084 r11525  
    5858    }
    5959
     60    @Override
    6061    public String getTagName()
    6162    {
     
    6364    }
    6465
     66    @Override
    6567    protected void build() throws SVGException
    6668    {
     
    105107     * update
    106108     */
     109    @Override
    107110    public boolean updateTime(double curTime) throws SVGException
    108111    {
  • trunk/src/com/kitfox/svg/Style.java

    r8084 r11525  
    6262    }
    6363
     64    @Override
    6465    public String getTagName()
    6566    {
     
    7071     * Called during load process to add text scanned within a tag
    7172     */
     73    @Override
    7274    public void loaderAddText(SVGLoaderHelper helper, String text)
    7375    {
     
    7880    }
    7981
     82    @Override
    8083    protected void build() throws SVGException
    8184    {
     
    9093    }
    9194
     95    @Override
    9296    public boolean updateTime(double curTime) throws SVGException
    9397    {
  • trunk/src/com/kitfox/svg/Symbol.java

    r8084 r11525  
    6161    }
    6262
     63    @Override
    6364    public String getTagName()
    6465    {
     
    6667    }
    6768
     69    @Override
    6870    protected void build() throws SVGException
    6971    {
     
    9496    }
    9597
     98    @Override
    9699    protected boolean outsideClip(Graphics2D g) throws SVGException
    97100    {
     
    108111    }
    109112
     113    @Override
    110114    public void render(Graphics2D g) throws SVGException
    111115    {
     
    118122    }
    119123
     124    @Override
    120125    public Shape getShape()
    121126    {
     
    124129    }
    125130
     131    @Override
    126132    public Rectangle2D getBoundingBox() throws SVGException
    127133    {
     
    137143     * update
    138144     */
     145    @Override
    139146    public boolean updateTime(double curTime) throws SVGException
    140147    {
  • trunk/src/com/kitfox/svg/Text.java

    r10787 r11525  
    4444import java.awt.geom.Point2D;
    4545import java.awt.geom.Rectangle2D;
    46 import java.util.Iterator;
     46import java.io.Serializable;
    4747import java.util.LinkedList;
     48import java.util.List;
    4849import java.util.regex.Matcher;
    4950import java.util.regex.Pattern;
     
    6364    float fontSize;
    6465    //List of strings and tspans containing the content of this node
    65     LinkedList content = new LinkedList();
     66    LinkedList<Serializable> content = new LinkedList<>();
    6667    Shape textShape;
    6768    public static final int TXAN_START = 0;
     
    9899    }
    99100
     101    @Override
    100102    public String getTagName()
    101103    {
     
    122124    }
    123125
    124     public java.util.List getContent()
     126    public List<Serializable> getContent()
    125127    {
    126128        return content;
     
    131133     * each child tag that has been processed
    132134     */
     135    @Override
    133136    public void loaderAddChild(SVGLoaderHelper helper, SVGElement child) throws SVGElementException
    134137    {
     
    141144     * Called during load process to add text scanned within a tag
    142145     */
     146    @Override
    143147    public void loaderAddText(SVGLoaderHelper helper, String text)
    144148    {
     
    150154    }
    151155
     156    @Override
    152157    public void build() throws SVGException
    153158    {
     
    273278            }
    274279        }
    275 
     280       
    276281        if (font == null)
    277282        {
     
    286291        AffineTransform xform = new AffineTransform();
    287292
    288         for (Iterator it = content.iterator(); it.hasNext();)
    289         {
    290             Object obj = it.next();
    291 
     293        for (Serializable obj : content) {
    292294            if (obj instanceof String)
    293295            {
     
    451453//    }
    452454
     455    @Override
    453456    public void render(Graphics2D g) throws SVGException
    454457    {
     
    458461    }
    459462
     463    @Override
    460464    public Shape getShape()
    461465    {
     
    463467    }
    464468
     469    @Override
    465470    public Rectangle2D getBoundingBox() throws SVGException
    466471    {
     
    475480     * update
    476481     */
     482    @Override
    477483    public boolean updateTime(double curTime) throws SVGException
    478484    {
  • trunk/src/com/kitfox/svg/Title.java

    r8084 r11525  
    5555    }
    5656
     57    @Override
    5758    public String getTagName()
    5859    {
     
    6364     * Called during load process to add text scanned within a tag
    6465     */
     66    @Override
    6567    public void loaderAddText(SVGLoaderHelper helper, String text)
    6668    {
     
    8082     * update
    8183     */
     84    @Override
    8285    public boolean updateTime(double curTime) throws SVGException
    8386    {
  • trunk/src/com/kitfox/svg/TransformableElement.java

    r8084 r11525  
    8787     */
    8888
     89    @Override
    8990    protected void build() throws SVGException
    9091    {
     
    124125     * update
    125126     */
     127    @Override
    126128    public boolean updateTime(double curTime) throws SVGException
    127129    {
  • trunk/src/com/kitfox/svg/Tspan.java

    r10787 r11525  
    4141import java.awt.Shape;
    4242import java.awt.font.FontRenderContext;
    43 import java.awt.font.GlyphMetrics;
    44 import java.awt.font.GlyphVector;
    4543import java.awt.geom.AffineTransform;
    4644import java.awt.geom.GeneralPath;
     
    7371    }
    7472
     73    @Override
    7574    public String getTagName()
    7675    {
     
    125124     * Called during load process to add text scanned within a tag
    126125     */
     126    @Override
    127127    public void loaderAddText(SVGLoaderHelper helper, String text)
    128128    {
     
    130130    }
    131131
     132    @Override
    132133    protected void build() throws SVGException
    133134    {
     
    340341//    }
    341342
     343    @Override
    342344    public void render(Graphics2D g) throws SVGException
    343345    {
     
    433435        float cursorY = 0;
    434436   
    435         int posPtr = 1;
    436437        FontRenderContext frc = g.getFontRenderContext();
    437438
     
    442443    }
    443444
     445    @Override
    444446    public Shape getShape()
    445447    {
     
    448450    }
    449451
     452    @Override
    450453    public Rectangle2D getBoundingBox()
    451454    {
     
    461464     * update
    462465     */
     466    @Override
    463467    public boolean updateTime(double curTime) throws SVGException
    464468    {
  • trunk/src/com/kitfox/svg/Use.java

    r8084 r11525  
    6666    }
    6767
     68    @Override
    6869    public String getTagName()
    6970    {
     
    7172    }
    7273
     74    @Override
    7375    protected void build() throws SVGException
    7476    {
     
    109111    }
    110112
     113    @Override
    111114    public void render(Graphics2D g) throws SVGException
    112115    {
     
    134137    }
    135138
     139    @Override
    136140    public Shape getShape()
    137141    {
     
    148152    }
    149153
     154    @Override
    150155    public Rectangle2D getBoundingBox() throws SVGException
    151156    {
     
    174179     * update
    175180     */
     181    @Override
    176182    public boolean updateTime(double curTime) throws SVGException
    177183    {
  • trunk/src/com/kitfox/svg/app/beans/SVGIcon.java

    r10787 r11525  
    44 * All rights reserved.
    55 *
    6  * Redistribution and use in source and binary forms, with or 
     6 * Redistribution and use in source and binary forms, with or
    77 * without modification, are permitted provided that the following
    88 * conditions are met:
    99 *
    10  *   - Redistributions of source code must retain the above 
     10 *   - Redistributions of source code must retain the above
    1111 *     copyright notice, this list of conditions and the following
    1212 *     disclaimer.
    1313 *   - Redistributions in binary form must reproduce the above
    1414 *     copyright notice, this list of conditions and the following
    15  *     disclaimer in the documentation and/or other materials 
     15 *     disclaimer in the documentation and/or other materials
    1616 *     provided with the distribution.
    1717 *
     
    2727 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2828 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    29  * OF THE POSSIBILITY OF SUCH DAMAGE. 
    30  * 
     29 * OF THE POSSIBILITY OF SUCH DAMAGE.
     30 *
    3131 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    3232 * projects can be found at http://www.kitfox.com
     
    3737package com.kitfox.svg.app.beans;
    3838
    39 import com.kitfox.svg.SVGCache;
    40 import com.kitfox.svg.SVGDiagram;
    41 import com.kitfox.svg.SVGException;
    42 import com.kitfox.svg.SVGUniverse;
    4339import java.awt.Component;
    4440import java.awt.Dimension;
     
    5450import java.beans.PropertyChangeSupport;
    5551import java.net.URI;
     52
    5653import javax.swing.ImageIcon;
    5754
     55import com.kitfox.svg.SVGCache;
     56import com.kitfox.svg.SVGDiagram;
     57import com.kitfox.svg.SVGException;
     58import com.kitfox.svg.SVGUniverse;
    5859
    5960/**
     
    6667
    6768    public static final String PROP_AUTOSIZE = "PROP_AUTOSIZE";
    68    
     69
    6970    private final PropertyChangeSupport changes = new PropertyChangeSupport(this);
    70    
     71
    7172    SVGUniverse svgUniverse = SVGCache.getSVGUniverse();
    7273    public static final int INTERP_NEAREST_NEIGHBOR = 0;
    7374    public static final int INTERP_BILINEAR = 1;
    7475    public static final int INTERP_BICUBIC = 2;
    75    
     76
    7677    private boolean antiAlias;
    7778    private int interpolation = INTERP_NEAREST_NEIGHBOR;
    7879    private boolean clipToViewbox;
    79    
     80
    8081    URI svgURI;
    81    
     82
    8283//    private boolean scaleToFit;
    8384    AffineTransform scaleXform = new AffineTransform();
     
    8990    public static final int AUTOSIZE_STRETCH = 4;
    9091    private int autosize = AUTOSIZE_NONE;
    91    
     92
    9293    Dimension preferredSize;
    93    
     94
    9495    /** Creates a new instance of SVGIcon */
    9596    public SVGIcon()
    9697    {
    9798    }
    98    
     99
    99100    public void addPropertyChangeListener(PropertyChangeListener p)
    100101    {
    101102        changes.addPropertyChangeListener(p);
    102103    }
    103    
     104
    104105    public void removePropertyChangeListener(PropertyChangeListener p)
    105106    {
    106107        changes.removePropertyChangeListener(p);
    107108    }
    108    
     109
     110    @Override
    109111    public Image getImage()
    110112    {
     
    117119     * @return height of this icon
    118120     */
    119     public int getIconHeight()
     121    public int getIconHeightIgnoreAutosize()
    120122    {
    121123        if (preferredSize != null &&
    122                 (autosize == AUTOSIZE_VERT || autosize == AUTOSIZE_STRETCH 
     124                (autosize == AUTOSIZE_VERT || autosize == AUTOSIZE_STRETCH
    123125                || autosize == AUTOSIZE_BESTFIT))
    124126        {
    125127            return preferredSize.height;
    126128        }
    127        
     129
    128130        SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
    129131        if (diagram == null)
     
    133135        return (int)diagram.getHeight();
    134136    }
    135    
     137
    136138    /**
    137139     * @return width of this icon
    138140     */
    139     public int getIconWidth()
     141    public int getIconWidthIgnoreAutosize()
    140142    {
    141143        if (preferredSize != null &&
    142                 (autosize == AUTOSIZE_HORIZ || autosize == AUTOSIZE_STRETCH 
     144                (autosize == AUTOSIZE_HORIZ || autosize == AUTOSIZE_STRETCH
    143145                || autosize == AUTOSIZE_BESTFIT))
    144146        {
    145147            return preferredSize.width;
    146148        }
    147        
     149
    148150        SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
    149151        if (diagram == null)
     
    153155        return (int)diagram.getWidth();
    154156    }
    155    
     157
     158    private boolean isAutoSizeBestFitUseFixedHeight(final int iconWidthIgnoreAutosize, final int iconHeightIgnoreAutosize,
     159            final SVGDiagram diagram)
     160    {
     161        return iconHeightIgnoreAutosize/diagram.getHeight() < iconWidthIgnoreAutosize/diagram.getWidth();
     162    }
     163
     164    @Override
     165    public int getIconWidth()
     166    {
     167        final int iconWidthIgnoreAutosize = getIconWidthIgnoreAutosize();
     168        final int iconHeightIgnoreAutosize = getIconHeightIgnoreAutosize();
     169        final SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
     170        if (preferredSize != null && (autosize == AUTOSIZE_VERT ||
     171                                     (autosize == AUTOSIZE_BESTFIT && isAutoSizeBestFitUseFixedHeight(iconWidthIgnoreAutosize, iconHeightIgnoreAutosize, diagram))))
     172        {
     173            final double aspectRatio = diagram.getHeight()/diagram.getWidth();
     174            return (int)(iconHeightIgnoreAutosize / aspectRatio);
     175        }
     176        else
     177        {
     178            return iconWidthIgnoreAutosize;
     179        }
     180    }
     181
     182    @Override
     183    public int getIconHeight()
     184    {
     185        final int iconWidthIgnoreAutosize = getIconWidthIgnoreAutosize();
     186        final int iconHeightIgnoreAutosize = getIconHeightIgnoreAutosize();
     187        final SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
     188        if (preferredSize != null && (autosize == AUTOSIZE_HORIZ ||
     189                                      (autosize == AUTOSIZE_BESTFIT && !isAutoSizeBestFitUseFixedHeight(iconWidthIgnoreAutosize, iconHeightIgnoreAutosize, diagram))))
     190        {
     191            final double aspectRatio = diagram.getHeight()/diagram.getWidth();
     192            return (int)(iconWidthIgnoreAutosize * aspectRatio);
     193        }
     194        else
     195        {
     196            return iconHeightIgnoreAutosize;
     197        }
     198    }
     199
    156200    /**
    157201     * Draws the icon to the specified component.
     
    161205     * @param y - Y coordinate to draw icon
    162206     */
     207    @Override
    163208    public void paintIcon(Component comp, Graphics gg, int x, int y)
    164209    {
    165         //Copy graphics object so that 
     210        //Copy graphics object so that
    166211        Graphics2D g = (Graphics2D)gg.create();
    167212        paintIcon(comp, g, x, y);
    168213        g.dispose();
    169214    }
    170    
     215
    171216    private void paintIcon(Component comp, Graphics2D g, int x, int y)
    172217    {
    173218        Object oldAliasHint = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
    174219        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, antiAlias ? RenderingHints.VALUE_ANTIALIAS_ON : RenderingHints.VALUE_ANTIALIAS_OFF);
    175        
     220
    176221        Object oldInterpolationHint = g.getRenderingHint(RenderingHints.KEY_INTERPOLATION);
    177222        switch (interpolation)
     
    187232                break;
    188233        }
    189        
    190        
     234
     235
    191236        SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
    192237        if (diagram == null)
     
    194239            return;
    195240        }
    196        
     241
    197242        g.translate(x, y);
    198243        diagram.setIgnoringClipHeuristic(!clipToViewbox);
     
    201246            g.setClip(new Rectangle2D.Float(0, 0, diagram.getWidth(), diagram.getHeight()));
    202247        }
    203        
    204        
     248
     249
    205250        if (autosize == AUTOSIZE_NONE)
    206251        {
     
    217262            return;
    218263        }
    219        
    220         final int width = getIconWidth();
    221         final int height = getIconHeight();
     264
     265        final int width = getIconWidthIgnoreAutosize();
     266        final int height = getIconHeightIgnoreAutosize();
    222267//        int width = getWidth();
    223268//        int height = getHeight();
    224        
     269
    225270        if (width == 0 || height == 0)
    226271        {
    227272            return;
    228273        }
    229        
     274
    230275//        if (width == 0 || height == 0)
    231276//        {
     
    236281//            return;
    237282//        }
    238        
     283
    239284//        g.setClip(0, 0, width, height);
    240        
    241        
     285
     286
    242287//        final Rectangle2D.Double rect = new Rectangle2D.Double();
    243288//        diagram.getViewRect(rect);
    244 //       
     289//
    245290//        scaleXform.setToScale(width / rect.width, height / rect.height);
    246291        double diaWidth = diagram.getWidth();
    247292        double diaHeight = diagram.getHeight();
    248        
     293
    249294        double scaleW = 1;
    250295        double scaleH = 1;
    251296        if (autosize == AUTOSIZE_BESTFIT)
    252297        {
    253             scaleW = scaleH = (height / diaHeight < width / diaWidth) 
     298            scaleW = scaleH = (height / diaHeight < width / diaWidth)
    254299                    ? height / diaHeight : width / diaWidth;
    255300        }
     
    268313        }
    269314        scaleXform.setToScale(scaleW, scaleH);
    270        
     315
    271316        AffineTransform oldXform = g.getTransform();
    272317        g.transform(scaleXform);
    273        
     318
    274319        try
    275320        {
     
    280325            throw new RuntimeException(e);
    281326        }
    282        
     327
    283328        g.setTransform(oldXform);
    284        
    285        
     329
     330
    286331        g.translate(-x, -y);
    287        
     332
    288333        g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, oldAliasHint);
    289334        if (oldInterpolationHint != null)
     
    292337        }
    293338    }
    294    
     339
    295340    /**
    296341     * @return the universe this icon draws it's SVGDiagrams from
     
    300345        return svgUniverse;
    301346    }
    302    
     347
    303348    public void setSvgUniverse(SVGUniverse svgUniverse)
    304349    {
     
    307352        changes.firePropertyChange("svgUniverse", old, svgUniverse);
    308353    }
    309    
     354
    310355    /**
    311356     * @return the uni of the document being displayed by this icon
     
    315360        return svgURI;
    316361    }
    317    
     362
    318363    /**
    319364     * Loads an SVG document from a URI.
     
    324369        URI old = this.svgURI;
    325370        this.svgURI = svgURI;
    326        
     371
    327372        SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
    328373        if (diagram != null)
     
    335380            diagram.setDeviceViewport(new Rectangle(0, 0, size.width, size.height));
    336381        }
    337        
     382
    338383        changes.firePropertyChange("svgURI", old, svgURI);
    339384    }
    340    
     385
    341386    /**
    342387     * Loads an SVG document from the classpath.  This function is equivilant to
     
    347392    {
    348393        URI old = this.svgURI;
    349        
     394
    350395        try
    351396        {
    352397            svgURI = new URI(getClass().getResource(resourcePath).toString());
    353398            changes.firePropertyChange("svgURI", old, svgURI);
    354            
     399
    355400            SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
    356401            if (diagram != null)
     
    358403                diagram.setDeviceViewport(new Rectangle(0, 0, preferredSize.width, preferredSize.height));
    359404            }
    360            
     405
    361406        }
    362407        catch (Exception e)
     
    365410        }
    366411    }
    367    
    368     /**
    369      * If this SVG document has a viewbox, if scaleToFit is set, will scale the viewbox to match the
    370      * preferred size of this icon
    371      * @deprecated
    372      * @return
    373      */
    374     public boolean isScaleToFit()
    375     {
    376         return autosize == AUTOSIZE_STRETCH;
    377     }
    378    
    379     /**
    380      * @deprecated
    381      * @return
    382      */
    383     public void setScaleToFit(boolean scaleToFit)
    384     {
    385         setAutosize(AUTOSIZE_STRETCH);
    386 //        boolean old = this.scaleToFit;
    387 //        this.scaleToFit = scaleToFit;
    388 //        firePropertyChange("scaleToFit", old, scaleToFit);
    389     }
    390    
     412
    391413    public Dimension getPreferredSize()
    392414    {
     
    400422            }
    401423        }
    402        
     424
    403425        return new Dimension(preferredSize);
    404426    }
    405    
     427
    406428    public void setPreferredSize(Dimension preferredSize)
    407429    {
    408430        Dimension old = this.preferredSize;
    409431        this.preferredSize = preferredSize;
    410        
     432
    411433        SVGDiagram diagram = svgUniverse.getDiagram(svgURI);
    412434        if (diagram != null)
     
    414436            diagram.setDeviceViewport(new Rectangle(0, 0, preferredSize.width, preferredSize.height));
    415437        }
    416        
     438
    417439        changes.firePropertyChange("preferredSize", old, preferredSize);
    418440    }
    419    
    420    
     441
    421442    /**
    422443     * @return true if antiAliasing is turned on.
    423      * @deprecated
    424      */
    425     public boolean getUseAntiAlias()
    426     {
    427         return getAntiAlias();
    428     }
    429    
    430     /**
    431      * @param antiAlias true to use antiAliasing.
    432      * @deprecated
    433      */
    434     public void setUseAntiAlias(boolean antiAlias)
    435     {
    436         setAntiAlias(antiAlias);
    437     }
    438    
    439     /**
    440      * @return true if antiAliasing is turned on.
    441444     */
    442445    public boolean getAntiAlias()
     
    444447        return antiAlias;
    445448    }
    446    
     449
    447450    /**
    448451     * @param antiAlias true to use antiAliasing.
     
    454457        changes.firePropertyChange("antiAlias", old, antiAlias);
    455458    }
    456    
     459
    457460    /**
    458461     * @return interpolation used in rescaling images
     
    462465        return interpolation;
    463466    }
    464    
     467
    465468    /**
    466469     * @param interpolation Interpolation value used in rescaling images.
     
    476479        changes.firePropertyChange("interpolation", old, interpolation);
    477480    }
    478    
     481
    479482    /**
    480483     * clipToViewbox will set a clip box equivilant to the SVG's viewbox before
     
    485488        return clipToViewbox;
    486489    }
    487    
     490
    488491    public void setClipToViewbox(boolean clipToViewbox)
    489492    {
     
    508511        changes.firePropertyChange(PROP_AUTOSIZE, oldAutosize, autosize);
    509512    }
    510        
     513
    511514}
  • trunk/src/com/kitfox/svg/app/data/Handler.java

    r10746 r11525  
    44 * All rights reserved.
    55 *
    6  * Redistribution and use in source and binary forms, with or 
     6 * Redistribution and use in source and binary forms, with or
    77 * without modification, are permitted provided that the following
    88 * conditions are met:
    99 *
    10  *   - Redistributions of source code must retain the above 
     10 *   - Redistributions of source code must retain the above
    1111 *     copyright notice, this list of conditions and the following
    1212 *     disclaimer.
    1313 *   - Redistributions in binary form must reproduce the above
    1414 *     copyright notice, this list of conditions and the following
    15  *     disclaimer in the documentation and/or other materials 
     15 *     disclaimer in the documentation and/or other materials
    1616 *     provided with the distribution.
    1717 *
     
    2727 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2828 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    29  * OF THE POSSIBILITY OF SUCH DAMAGE. 
    30  * 
     29 * OF THE POSSIBILITY OF SUCH DAMAGE.
     30 *
    3131 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    3232 * projects can be found at http://www.kitfox.com
     
    3535package com.kitfox.svg.app.data;
    3636
    37 import com.kitfox.svg.SVGConst;
    3837import java.io.ByteArrayInputStream;
    3938import java.io.IOException;
     
    4544import java.util.logging.Level;
    4645import java.util.logging.Logger;
     46
     47import com.kitfox.svg.SVGConst;
    4748
    4849/**
     
    7879            }
    7980        }
    80        
     81
     82        @Override
    8183        public void connect() throws IOException
    8284        {
    8385        }
    8486
     87        @Override
    8588        public String getHeaderField(String name)
    8689        {
     
    9396        }
    9497
     98        @Override
    9599        public InputStream getInputStream() throws IOException
    96100        {
     
    104108    }
    105109
     110    @Override
    106111    protected URLConnection openConnection(URL u) throws IOException
    107112    {
  • trunk/src/com/kitfox/svg/pathcmd/Arc.java

    r8084 r11525  
    7777
    7878//    public void appendPath(ExtendedGeneralPath path, BuildHistory hist)
     79    @Override
    7980    public void appendPath(GeneralPath path, BuildHistory hist)
    8081    {
     
    9192    }
    9293
     94    @Override
    9395    public int getNumKnotsAdded()
    9496    {
     
    257259    }
    258260
     261    @Override
    259262    public String toString()
    260263    {
  • trunk/src/com/kitfox/svg/pathcmd/Cubic.java

    r8084 r11525  
    5757    }
    5858
     59    @Override
    5960    public String toString()
    6061    {
     
    7576
    7677//    public void appendPath(ExtendedGeneralPath path, BuildHistory hist)
     78    @Override
    7779    public void appendPath(GeneralPath path, BuildHistory hist)
    7880    {
     
    8890    }
    8991
     92    @Override
    9093    public int getNumKnotsAdded()
    9194    {
  • trunk/src/com/kitfox/svg/pathcmd/CubicSmooth.java

    r8084 r11525  
    6464
    6565//    public void appendPath(ExtendedGeneralPath path, BuildHistory hist)
     66    @Override
    6667    public void appendPath(GeneralPath path, BuildHistory hist)
    6768    {
     
    8283    }
    8384   
     85    @Override
    8486    public int getNumKnotsAdded()
    8587    {
     
    8789    }
    8890
     91    @Override
    8992    public String toString()
    9093    {
  • trunk/src/com/kitfox/svg/pathcmd/Horizontal.java

    r8084 r11525  
    5252    }
    5353
     54    @Override
    5455    public String toString()
    5556    {
     
    6465
    6566//    public void appendPath(ExtendedGeneralPath path, BuildHistory hist)
     67    @Override
    6668    public void appendPath(GeneralPath path, BuildHistory hist)
    6769    {
     
    7476    }
    7577   
     78    @Override
    7679    public int getNumKnotsAdded()
    7780    {
  • trunk/src/com/kitfox/svg/pathcmd/LineTo.java

    r8084 r11525  
    6161
    6262//    public void appendPath(ExtendedGeneralPath path, BuildHistory hist)
     63    @Override
    6364    public void appendPath(GeneralPath path, BuildHistory hist)
    6465    {
     
    7172    }
    7273   
     74    @Override
    7375    public int getNumKnotsAdded()
    7476    {
     
    7678    }
    7779
     80    @Override
    7881    public String toString()
    7982    {
  • trunk/src/com/kitfox/svg/pathcmd/MoveTo.java

    r8084 r11525  
    6060
    6161//    public void appendPath(ExtendedGeneralPath path, BuildHistory hist)
     62    @Override
    6263    public void appendPath(GeneralPath path, BuildHistory hist)
    6364    {
     
    7172    }
    7273
     74    @Override
    7375    public int getNumKnotsAdded()
    7476    {
     
    7678    }
    7779
     80    @Override
    7881    public String toString()
    7982    {
  • trunk/src/com/kitfox/svg/pathcmd/Quadratic.java

    r8084 r11525  
    5555    }
    5656
     57    @Override
    5758    public String toString()
    5859    {
     
    7071
    7172//    public void appendPath(ExtendedGeneralPath path, BuildHistory hist)
     73    @Override
    7274    public void appendPath(GeneralPath path, BuildHistory hist)
    7375    {
     
    8082    }
    8183
     84    @Override
    8285    public int getNumKnotsAdded()
    8386    {
  • trunk/src/com/kitfox/svg/pathcmd/QuadraticSmooth.java

    r8084 r11525  
    5353    }
    5454
     55    @Override
    5556    public String toString()
    5657    {
     
    6566
    6667//    public void appendPath(ExtendedGeneralPath path, BuildHistory hist)
     68    @Override
    6769    public void appendPath(GeneralPath path, BuildHistory hist)
    6870    {
     
    8385    }
    8486
     87    @Override
    8588    public int getNumKnotsAdded()
    8689    {
  • trunk/src/com/kitfox/svg/pathcmd/Terminal.java

    r8084 r11525  
    5252    }
    5353
     54    @Override
    5455    public String toString()
    5556    {
     
    5960
    6061//    public void appendPath(ExtendedGeneralPath path, BuildHistory hist)
     62    @Override
    6163    public void appendPath(GeneralPath path, BuildHistory hist)
    6264    {
     
    6668    }
    6769   
     70    @Override
    6871    public int getNumKnotsAdded()
    6972    {
  • trunk/src/com/kitfox/svg/pathcmd/Vertical.java

    r8084 r11525  
    5252    }
    5353
     54    @Override
    5455    public String toString()
    5556    {
     
    6364
    6465//    public void appendPath(ExtendedGeneralPath path, BuildHistory hist)
     66    @Override
    6567    public void appendPath(GeneralPath path, BuildHistory hist)
    6668    {
     
    7375    }
    7476
     77    @Override
    7578    public int getNumKnotsAdded()
    7679    {
  • trunk/src/com/kitfox/svg/util/FontSystem.java

    r10787 r11525  
    5656    FontMetrics fm;
    5757
    58     HashMap glyphCache = new HashMap();
     58    HashMap<String, Glyph> glyphCache = new HashMap<String, Glyph>();
    5959   
    6060    public FontSystem(String fontFamily, int fontStyle, int fontWeight, int fontSize)
     
    9494    }
    9595
     96    @Override
    9697    public MissingGlyph getGlyph(String unicode)
    9798    {
  • trunk/src/com/kitfox/svg/xml/ColorTable.java

    r8084 r11525  
    4949{
    5050
    51     static final Map colorTable;
     51    static final Map<String, Color> colorTable;
    5252    static {
    53         HashMap table = new HashMap();
     53        HashMap<String, Color> table = new HashMap<>();
    5454
    5555        //We really should be interpreting the currentColor keyword as
  • trunk/src/com/kitfox/svg/xml/NumberWithUnits.java

    r8084 r11525  
    123123    }
    124124
     125    @Override
    125126    public String toString()
    126127    {
     
    128129    }
    129130
     131    @Override
    130132    public boolean equals(Object obj)
    131133    {
     
    146148    }
    147149
     150    @Override
    148151    public int hashCode()
    149152    {
  • trunk/src/com/kitfox/svg/xml/ReadableXMLElement.java

    r8084 r11525  
    3939import org.w3c.dom.*;
    4040import java.net.*;
    41 import java.util.*;
    42 import java.lang.reflect.*;
    4341
    4442/**
  • trunk/src/com/kitfox/svg/xml/StyleSheet.java

    r8084 r11525  
    1616public class StyleSheet
    1717{
    18     HashMap ruleMap = new HashMap();
     18    HashMap<StyleSheetRule, String> ruleMap = new HashMap<>();
    1919
    2020    public static StyleSheet parseSheet(String src)
  • trunk/src/com/kitfox/svg/xml/StyleSheetRule.java

    r8084 r11525  
    2222    }
    2323
     24    @Override
    2425    public int hashCode()
    2526    {
     
    3132    }
    3233
     34    @Override
    3335    public boolean equals(Object obj)
    3436    {
  • trunk/src/com/kitfox/svg/xml/WritableXMLElement.java

    r8084 r11525  
    3737package com.kitfox.svg.xml;
    3838
    39 import org.w3c.dom.*;
    40 import java.net.*;
    41 import java.util.*;
    42 import java.lang.reflect.*;
    43 
    4439/**
    4540 * @author Mark McKay
  • trunk/src/com/kitfox/svg/xml/XMLParseUtil.java

    r10866 r11525  
    44 * All rights reserved.
    55 *
    6  * Redistribution and use in source and binary forms, with or 
     6 * Redistribution and use in source and binary forms, with or
    77 * without modification, are permitted provided that the following
    88 * conditions are met:
    99 *
    10  *   - Redistributions of source code must retain the above 
     10 *   - Redistributions of source code must retain the above
    1111 *     copyright notice, this list of conditions and the following
    1212 *     disclaimer.
    1313 *   - Redistributions in binary form must reproduce the above
    1414 *     copyright notice, this list of conditions and the following
    15  *     disclaimer in the documentation and/or other materials 
     15 *     disclaimer in the documentation and/or other materials
    1616 *     provided with the distribution.
    1717 *
     
    2727 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    2828 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    29  * OF THE POSSIBILITY OF SUCH DAMAGE. 
    30  * 
     29 * OF THE POSSIBILITY OF SUCH DAMAGE.
     30 *
    3131 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    3232 * projects can be found at http://www.kitfox.com
     
    3737package com.kitfox.svg.xml;
    3838
    39 import com.kitfox.svg.SVGConst;
    40 import java.awt.*;
    41 import java.util.*;
    42 import java.util.regex.*;
     39import java.awt.Toolkit;
     40import java.util.HashMap;
     41import java.util.Iterator;
     42import java.util.LinkedList;
    4343import java.util.logging.Level;
    4444import java.util.logging.Logger;
     45import java.util.regex.Matcher;
     46import java.util.regex.Pattern;
     47
     48import com.kitfox.svg.SVGConst;
    4549
    4650/**
     
    6367        matchWs.reset(list);
    6468
    65         LinkedList matchList = new LinkedList();
     69        LinkedList<String> matchList = new LinkedList<>();
    6670        while (matchWs.find())
    6771        {
     
    7074
    7175        String[] retArr = new String[matchList.size()];
    72         return (String[])matchList.toArray(retArr);
     76        return matchList.toArray(retArr);
    7377    }
    7478
    7579    public static double parseDouble(String val)
    7680    {
    77         /*
    78         if (val == null) return 0.0;
    79 
    80         double retVal = 0.0;
    81         try
    82         { retVal = Double.parseDouble(val); }
    83         catch (Exception e)
    84         {}
    85         return retVal;
    86          */
    8781        return findDouble(val);
    8882    }
     
    10397        catch (StringIndexOutOfBoundsException e)
    10498        {
    105             Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING, 
     99            Logger.getLogger(SVGConst.SVG_LOGGER).log(Level.WARNING,
    106100                "XMLParseUtil: regex parse problem: '" + val + "'", e);
    107101        }
     
    112106        double retVal = 0;
    113107        try
    114         { 
    115             retVal = Double.parseDouble(val); 
    116            
     108        {
     109            retVal = Double.parseDouble(val);
     110
    117111            float pixPerInch;
    118112            try {
    119                 pixPerInch = (float)Toolkit.getDefaultToolkit().getScreenResolution();
     113                pixPerInch = Toolkit.getDefaultToolkit().getScreenResolution();
    120114            }
    121115            catch (NoClassDefFoundError err)
     
    126120            final float inchesPerCm = .3936f;
    127121            final String units = fpMatch.group(6);
    128            
     122
    129123            if ("%".equals(units)) retVal /= 100;
    130124            else if ("in".equals(units))
     
    166160        fpMatch.reset(list);
    167161
    168         LinkedList doubList = new LinkedList();
     162        LinkedList<Double> doubList = new LinkedList<>();
    169163        while (fpMatch.find())
    170164        {
     
    174168
    175169        double[] retArr = new double[doubList.size()];
    176         Iterator it = doubList.iterator();
     170        Iterator<Double> it = doubList.iterator();
    177171        int idx = 0;
    178172        while (it.hasNext())
    179173        {
    180             retArr[idx++] = ((Double)it.next()).doubleValue();
     174            retArr[idx++] = it.next().doubleValue();
    181175        }
    182176
     
    216210        fpMatch.reset(list);
    217211
    218         LinkedList floatList = new LinkedList();
     212        LinkedList<Float> floatList = new LinkedList<>();
    219213        while (fpMatch.find())
    220214        {
     
    224218
    225219        float[] retArr = new float[floatList.size()];
    226         Iterator it = floatList.iterator();
     220        Iterator<Float> it = floatList.iterator();
    227221        int idx = 0;
    228222        while (it.hasNext())
    229223        {
    230             retArr[idx++] = ((Float)it.next()).floatValue();
     224            retArr[idx++] = it.next().floatValue();
    231225        }
    232226
     
    261255        intMatch.reset(list);
    262256
    263         LinkedList intList = new LinkedList();
     257        LinkedList<Integer> intList = new LinkedList<>();
    264258        while (intMatch.find())
    265259        {
     
    269263
    270264        int[] retArr = new int[intList.size()];
    271         Iterator it = intList.iterator();
     265        Iterator<Integer> it = intList.iterator();
    272266        int idx = 0;
    273267        while (it.hasNext())
    274268        {
    275             retArr[idx++] = ((Integer)it.next()).intValue();
     269            retArr[idx++] = it.next().intValue();
    276270        }
    277271
     
    307301     * @param map - A map to which these styles will be added
    308302     */
    309     public static HashMap parseStyle(String styleString, HashMap map) {
     303    public static HashMap<String, StyleAttribute> parseStyle(String styleString, HashMap<String, StyleAttribute> map) {
    310304        final Pattern patSemi = Pattern.compile(";");
    311305
Note: See TracChangeset for help on using the changeset viewer.