From 6776ed9f1a81e517139d85eb6d2e28911fd0fc35 Mon Sep 17 00:00:00 2001 From: kitfox Date: Tue, 19 Mar 2013 05:20:37 +0000 Subject: Adding support for style sheets. git-svn-id: https://svn.java.net/svn/svgsalamander~svn/trunk/svg-core@153 7dc7fa77-23fb-e6ad-8e2e-c86bd48ed22b --- src/main/java/com/kitfox/svg/FeSpotLight.java | 138 ++++++++++++++++++-------- 1 file changed, 96 insertions(+), 42 deletions(-) (limited to 'src/main/java/com/kitfox/svg/FeSpotLight.java') diff --git a/src/main/java/com/kitfox/svg/FeSpotLight.java b/src/main/java/com/kitfox/svg/FeSpotLight.java index 186ebe2..81fd088 100644 --- a/src/main/java/com/kitfox/svg/FeSpotLight.java +++ b/src/main/java/com/kitfox/svg/FeSpotLight.java @@ -33,24 +33,18 @@ * * Created on March 18, 2004, 6:52 AM */ - package com.kitfox.svg; import com.kitfox.svg.xml.StyleAttribute; -import java.awt.*; -import java.awt.geom.*; -import java.net.*; -import java.util.*; - -import com.kitfox.svg.xml.*; -import org.xml.sax.*; /** * @author Mark McKay * @author Mark McKay */ -public class FeSpotLight extends FeLight +public class FeSpotLight extends FeLight { + + public static final String TAG_NAME = "fespotlight"; float x = 0f; float y = 0f; float z = 0f; @@ -59,39 +53,100 @@ public class FeSpotLight extends FeLight float pointsAtZ = 0f; float specularComponent = 0f; float limitingConeAngle = 0f; - - /** Creates a new instance of FillElement */ - public FeSpotLight() { + /** + * Creates a new instance of FillElement + */ + public FeSpotLight() + { + } + + public String getTagName() + { + return TAG_NAME; } - protected void build() throws SVGException { super.build(); - + StyleAttribute sty = new StyleAttribute(); String strn; - - if (getPres(sty.setName("x"))) x = sty.getFloatValueWithUnits(); - if (getPres(sty.setName("y"))) y = sty.getFloatValueWithUnits(); - if (getPres(sty.setName("z"))) z = sty.getFloatValueWithUnits(); - if (getPres(sty.setName("pointsAtX"))) pointsAtX = sty.getFloatValueWithUnits(); - if (getPres(sty.setName("pointsAtY"))) pointsAtY = sty.getFloatValueWithUnits(); - if (getPres(sty.setName("pointsAtZ"))) pointsAtZ = sty.getFloatValueWithUnits(); - if (getPres(sty.setName("specularComponent"))) specularComponent = sty.getFloatValueWithUnits(); - if (getPres(sty.setName("limitingConeAngle"))) limitingConeAngle = sty.getFloatValueWithUnits(); + + if (getPres(sty.setName("x"))) + { + x = sty.getFloatValueWithUnits(); + } + if (getPres(sty.setName("y"))) + { + y = sty.getFloatValueWithUnits(); + } + if (getPres(sty.setName("z"))) + { + z = sty.getFloatValueWithUnits(); + } + if (getPres(sty.setName("pointsAtX"))) + { + pointsAtX = sty.getFloatValueWithUnits(); + } + if (getPres(sty.setName("pointsAtY"))) + { + pointsAtY = sty.getFloatValueWithUnits(); + } + if (getPres(sty.setName("pointsAtZ"))) + { + pointsAtZ = sty.getFloatValueWithUnits(); + } + if (getPres(sty.setName("specularComponent"))) + { + specularComponent = sty.getFloatValueWithUnits(); + } + if (getPres(sty.setName("limitingConeAngle"))) + { + limitingConeAngle = sty.getFloatValueWithUnits(); + } + } + + public float getX() + { + return x; + } + + public float getY() + { + return y; + } + + public float getZ() + { + return z; + } + + public float getPointsAtX() + { + return pointsAtX; + } + + public float getPointsAtY() + { + return pointsAtY; + } + + public float getPointsAtZ() + { + return pointsAtZ; + } + + public float getSpecularComponent() + { + return specularComponent; + } + + public float getLimitingConeAngle() + { + return limitingConeAngle; } - public float getX() { return x; } - public float getY() { return y; } - public float getZ() { return z; } - public float getPointsAtX() { return pointsAtX; } - public float getPointsAtY() { return pointsAtY; } - public float getPointsAtZ() { return pointsAtZ; } - public float getSpecularComponent() { return specularComponent; } - public float getLimitingConeAngle() { return limitingConeAngle; } - public boolean updateTime(double curTime) throws SVGException { // if (trackManager.getNumTracks() == 0) return false; @@ -99,7 +154,7 @@ public class FeSpotLight extends FeLight //Get current values for parameters StyleAttribute sty = new StyleAttribute(); boolean stateChange = false; - + if (getPres(sty.setName("x"))) { float newVal = sty.getFloatValueWithUnits(); @@ -109,7 +164,7 @@ public class FeSpotLight extends FeLight stateChange = true; } } - + if (getPres(sty.setName("y"))) { float newVal = sty.getFloatValueWithUnits(); @@ -119,7 +174,7 @@ public class FeSpotLight extends FeLight stateChange = true; } } - + if (getPres(sty.setName("z"))) { float newVal = sty.getFloatValueWithUnits(); @@ -129,7 +184,7 @@ public class FeSpotLight extends FeLight stateChange = true; } } - + if (getPres(sty.setName("pointsAtX"))) { float newVal = sty.getFloatValueWithUnits(); @@ -139,7 +194,7 @@ public class FeSpotLight extends FeLight stateChange = true; } } - + if (getPres(sty.setName("pointsAtY"))) { float newVal = sty.getFloatValueWithUnits(); @@ -149,7 +204,7 @@ public class FeSpotLight extends FeLight stateChange = true; } } - + if (getPres(sty.setName("pointsAtZ"))) { float newVal = sty.getFloatValueWithUnits(); @@ -159,7 +214,7 @@ public class FeSpotLight extends FeLight stateChange = true; } } - + if (getPres(sty.setName("specularComponent"))) { float newVal = sty.getFloatValueWithUnits(); @@ -169,7 +224,7 @@ public class FeSpotLight extends FeLight stateChange = true; } } - + if (getPres(sty.setName("limitingConeAngle"))) { float newVal = sty.getFloatValueWithUnits(); @@ -179,8 +234,7 @@ public class FeSpotLight extends FeLight stateChange = true; } } - + return stateChange; } } - -- cgit v1.2.3-55-g7522