Changeset 6002 in josm for trunk/src/com/kitfox/svg/FeSpotLight.java
- Timestamp:
- 2013-06-11T01:01:28+02:00 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/com/kitfox/svg/FeSpotLight.java
r4256 r6002 1 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 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 24 33 * 25 34 * Created on March 18, 2004, 6:52 AM 26 35 */ 27 28 36 package com.kitfox.svg; 29 37 30 38 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 39 40 /** … … 41 42 * @author <a href="mailto:mark@kitfox.com">Mark McKay</a> 42 43 */ 43 public class FeSpotLight extends FeLight 44 public class FeSpotLight extends FeLight 44 45 { 46 47 public static final String TAG_NAME = "fespotlight"; 45 48 float x = 0f; 46 49 float y = 0f; … … 51 54 float specularComponent = 0f; 52 55 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 60 69 protected void build() throws SVGException 61 70 { 62 71 super.build(); 63 72 64 73 StyleAttribute sty = new StyleAttribute(); 65 74 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 86 150 public boolean updateTime(double curTime) throws SVGException 87 151 { … … 91 155 StyleAttribute sty = new StyleAttribute(); 92 156 boolean stateChange = false; 93 157 94 158 if (getPres(sty.setName("x"))) 95 159 { … … 101 165 } 102 166 } 103 167 104 168 if (getPres(sty.setName("y"))) 105 169 { … … 111 175 } 112 176 } 113 177 114 178 if (getPres(sty.setName("z"))) 115 179 { … … 121 185 } 122 186 } 123 187 124 188 if (getPres(sty.setName("pointsAtX"))) 125 189 { … … 131 195 } 132 196 } 133 197 134 198 if (getPres(sty.setName("pointsAtY"))) 135 199 { … … 141 205 } 142 206 } 143 207 144 208 if (getPres(sty.setName("pointsAtZ"))) 145 209 { … … 151 215 } 152 216 } 153 217 154 218 if (getPres(sty.setName("specularComponent"))) 155 219 { … … 161 225 } 162 226 } 163 227 164 228 if (getPres(sty.setName("limitingConeAngle"))) 165 229 { … … 171 235 } 172 236 } 173 237 174 238 return stateChange; 175 239 } 176 240 } 177
Note:
See TracChangeset
for help on using the changeset viewer.