Ignore:
Timestamp:
2013-06-11T01:01:28+02:00 (12 years ago)
Author:
Don-vip
Message:

fix #8742 - update svgsalamander to release 0.1.18+patch (fix bug SVGSALAMANDER-26) -> allow to open more SVG files

File:
1 edited

Legend:

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

    r4256 r6002  
    11/*
    2  * FillElement.java
    3  *
    4  *
    5  *  The Salamander Project - 2D and 3D graphics libraries in Java
    6  *  Copyright (C) 2004 Mark McKay
    7  *
    8  *  This library is free software; you can redistribute it and/or
    9  *  modify it under the terms of the GNU Lesser General Public
    10  *  License as published by the Free Software Foundation; either
    11  *  version 2.1 of the License, or (at your option) any later version.
    12  *
    13  *  This library is distributed in the hope that it will be useful,
    14  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
    15  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    16  *  Lesser General Public License for more details.
    17  *
    18  *  You should have received a copy of the GNU Lesser General Public
    19  *  License along with this library; if not, write to the Free Software
    20  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
    21  *
    22  *  Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
    23  *  projects can be found at http://www.kitfox.com
     2 * SVG Salamander
     3 * Copyright (c) 2004, Mark McKay
     4 * All rights reserved.
     5 *
     6 * Redistribution and use in source and binary forms, with or
     7 * without modification, are permitted provided that the following
     8 * conditions are met:
     9 *
     10 *   - Redistributions of source code must retain the above
     11 *     copyright notice, this list of conditions and the following
     12 *     disclaimer.
     13 *   - Redistributions in binary form must reproduce the above
     14 *     copyright notice, this list of conditions and the following
     15 *     disclaimer in the documentation and/or other materials
     16 *     provided with the distribution.
     17 *
     18 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
     19 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
     20 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
     21 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
     22 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
     23 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
     24 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
     25 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     26 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
     27 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
     29 * OF THE POSSIBILITY OF SUCH DAMAGE.
     30 *
     31 * Mark McKay can be contacted at mark@kitfox.com.  Salamander and other
     32 * projects can be found at http://www.kitfox.com
    2433 *
    2534 * Created on March 18, 2004, 6:52 AM
    2635 */
    27 
    2836package com.kitfox.svg;
    2937
    3038import com.kitfox.svg.xml.StyleAttribute;
    31 import java.awt.*;
    32 import java.awt.geom.*;
    33 import java.net.*;
    34 import java.util.*;
    35 
    36 import com.kitfox.svg.xml.*;
    37 import org.xml.sax.*;
    3839
    3940/**
     
    4142 * @author <a href="mailto:mark@kitfox.com">Mark McKay</a>
    4243 */
    43 public class FeSpotLight extends FeLight 
     44public class FeSpotLight extends FeLight
    4445{
     46
     47    public static final String TAG_NAME = "fespotlight";
    4548    float x = 0f;
    4649    float y = 0f;
     
    5154    float specularComponent = 0f;
    5255    float limitingConeAngle = 0f;
    53    
    54 
    55     /** Creates a new instance of FillElement */
    56     public FeSpotLight() {
    57     }
    58 
    59    
     56
     57    /**
     58     * Creates a new instance of FillElement
     59     */
     60    public FeSpotLight()
     61    {
     62    }
     63
     64    public String getTagName()
     65    {
     66        return TAG_NAME;
     67    }
     68
    6069    protected void build() throws SVGException
    6170    {
    6271        super.build();
    63        
     72
    6473        StyleAttribute sty = new StyleAttribute();
    6574        String strn;
    66        
    67         if (getPres(sty.setName("x"))) x = sty.getFloatValueWithUnits();
    68         if (getPres(sty.setName("y"))) y = sty.getFloatValueWithUnits();
    69         if (getPres(sty.setName("z"))) z = sty.getFloatValueWithUnits();
    70         if (getPres(sty.setName("pointsAtX"))) pointsAtX = sty.getFloatValueWithUnits();
    71         if (getPres(sty.setName("pointsAtY"))) pointsAtY = sty.getFloatValueWithUnits();
    72         if (getPres(sty.setName("pointsAtZ"))) pointsAtZ = sty.getFloatValueWithUnits();
    73         if (getPres(sty.setName("specularComponent"))) specularComponent = sty.getFloatValueWithUnits();
    74         if (getPres(sty.setName("limitingConeAngle"))) limitingConeAngle = sty.getFloatValueWithUnits();
    75     }
    76 
    77     public float getX() { return x; }
    78     public float getY() { return y; }
    79     public float getZ() { return z; }
    80     public float getPointsAtX() { return pointsAtX; }
    81     public float getPointsAtY() { return pointsAtY; }
    82     public float getPointsAtZ() { return pointsAtZ; }
    83     public float getSpecularComponent() { return specularComponent; }
    84     public float getLimitingConeAngle() { return limitingConeAngle; }
    85    
     75
     76        if (getPres(sty.setName("x")))
     77        {
     78            x = sty.getFloatValueWithUnits();
     79        }
     80        if (getPres(sty.setName("y")))
     81        {
     82            y = sty.getFloatValueWithUnits();
     83        }
     84        if (getPres(sty.setName("z")))
     85        {
     86            z = sty.getFloatValueWithUnits();
     87        }
     88        if (getPres(sty.setName("pointsAtX")))
     89        {
     90            pointsAtX = sty.getFloatValueWithUnits();
     91        }
     92        if (getPres(sty.setName("pointsAtY")))
     93        {
     94            pointsAtY = sty.getFloatValueWithUnits();
     95        }
     96        if (getPres(sty.setName("pointsAtZ")))
     97        {
     98            pointsAtZ = sty.getFloatValueWithUnits();
     99        }
     100        if (getPres(sty.setName("specularComponent")))
     101        {
     102            specularComponent = sty.getFloatValueWithUnits();
     103        }
     104        if (getPres(sty.setName("limitingConeAngle")))
     105        {
     106            limitingConeAngle = sty.getFloatValueWithUnits();
     107        }
     108    }
     109
     110    public float getX()
     111    {
     112        return x;
     113    }
     114
     115    public float getY()
     116    {
     117        return y;
     118    }
     119
     120    public float getZ()
     121    {
     122        return z;
     123    }
     124
     125    public float getPointsAtX()
     126    {
     127        return pointsAtX;
     128    }
     129
     130    public float getPointsAtY()
     131    {
     132        return pointsAtY;
     133    }
     134
     135    public float getPointsAtZ()
     136    {
     137        return pointsAtZ;
     138    }
     139
     140    public float getSpecularComponent()
     141    {
     142        return specularComponent;
     143    }
     144
     145    public float getLimitingConeAngle()
     146    {
     147        return limitingConeAngle;
     148    }
     149
    86150    public boolean updateTime(double curTime) throws SVGException
    87151    {
     
    91155        StyleAttribute sty = new StyleAttribute();
    92156        boolean stateChange = false;
    93        
     157
    94158        if (getPres(sty.setName("x")))
    95159        {
     
    101165            }
    102166        }
    103        
     167
    104168        if (getPres(sty.setName("y")))
    105169        {
     
    111175            }
    112176        }
    113        
     177
    114178        if (getPres(sty.setName("z")))
    115179        {
     
    121185            }
    122186        }
    123        
     187
    124188        if (getPres(sty.setName("pointsAtX")))
    125189        {
     
    131195            }
    132196        }
    133        
     197
    134198        if (getPres(sty.setName("pointsAtY")))
    135199        {
     
    141205            }
    142206        }
    143        
     207
    144208        if (getPres(sty.setName("pointsAtZ")))
    145209        {
     
    151215            }
    152216        }
    153        
     217
    154218        if (getPres(sty.setName("specularComponent")))
    155219        {
     
    161225            }
    162226        }
    163        
     227
    164228        if (getPres(sty.setName("limitingConeAngle")))
    165229        {
     
    171235            }
    172236        }
    173        
     237
    174238        return stateChange;
    175239    }
    176240}
    177 
Note: See TracChangeset for help on using the changeset viewer.