1 | /*
|
---|
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
|
---|
24 | *
|
---|
25 | * Created on March 18, 2004, 6:52 AM
|
---|
26 | */
|
---|
27 |
|
---|
28 | package com.kitfox.svg;
|
---|
29 |
|
---|
30 | import 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.*;
|
---|
38 |
|
---|
39 | /**
|
---|
40 | * @author Mark McKay
|
---|
41 | * @author <a href="mailto:mark@kitfox.com">Mark McKay</a>
|
---|
42 | */
|
---|
43 | public class FePointLight extends FeLight
|
---|
44 | {
|
---|
45 | float x = 0f;
|
---|
46 | float y = 0f;
|
---|
47 | float z = 0f;
|
---|
48 |
|
---|
49 |
|
---|
50 | /** Creates a new instance of FillElement */
|
---|
51 | public FePointLight() {
|
---|
52 | }
|
---|
53 |
|
---|
54 |
|
---|
55 | protected void build() throws SVGException
|
---|
56 | {
|
---|
57 | super.build();
|
---|
58 |
|
---|
59 | StyleAttribute sty = new StyleAttribute();
|
---|
60 | String strn;
|
---|
61 |
|
---|
62 | if (getPres(sty.setName("x"))) x = sty.getFloatValueWithUnits();
|
---|
63 |
|
---|
64 | if (getPres(sty.setName("y"))) y = sty.getFloatValueWithUnits();
|
---|
65 |
|
---|
66 | if (getPres(sty.setName("z"))) z = sty.getFloatValueWithUnits();
|
---|
67 | }
|
---|
68 |
|
---|
69 | public float getX() { return x; }
|
---|
70 | public float getY() { return y; }
|
---|
71 | public float getZ() { return z; }
|
---|
72 |
|
---|
73 | public boolean updateTime(double curTime) throws SVGException
|
---|
74 | {
|
---|
75 | // if (trackManager.getNumTracks() == 0) return false;
|
---|
76 |
|
---|
77 | //Get current values for parameters
|
---|
78 | StyleAttribute sty = new StyleAttribute();
|
---|
79 | boolean stateChange = false;
|
---|
80 |
|
---|
81 | if (getPres(sty.setName("x")))
|
---|
82 | {
|
---|
83 | float newVal = sty.getFloatValueWithUnits();
|
---|
84 | if (newVal != x)
|
---|
85 | {
|
---|
86 | x = newVal;
|
---|
87 | stateChange = true;
|
---|
88 | }
|
---|
89 | }
|
---|
90 |
|
---|
91 | if (getPres(sty.setName("y")))
|
---|
92 | {
|
---|
93 | float newVal = sty.getFloatValueWithUnits();
|
---|
94 | if (newVal != y)
|
---|
95 | {
|
---|
96 | y = newVal;
|
---|
97 | stateChange = true;
|
---|
98 | }
|
---|
99 | }
|
---|
100 |
|
---|
101 | if (getPres(sty.setName("z")))
|
---|
102 | {
|
---|
103 | float newVal = sty.getFloatValueWithUnits();
|
---|
104 | if (newVal != z)
|
---|
105 | {
|
---|
106 | z = newVal;
|
---|
107 | stateChange = true;
|
---|
108 | }
|
---|
109 | }
|
---|
110 |
|
---|
111 | return stateChange;
|
---|
112 | }
|
---|
113 | }
|
---|
114 |
|
---|