View Javadoc
1 /***************************************************************************** 2 * Virtual Mockup for Machine Vision 3 * Copyright (C) 2001-2003 Fabio R. de Miranda, João E. Kogler Jr., 4 * Carlos S. Santos. 5 * Virtual Mockup for Machine Vision Project funded by SENAC-SP 6 * 7 * Permission is granted to redistribute and/or modify this 8 * software under the terms of the GNU Lesser General Public 9 * License as published by the Free Software Foundation; either 10 * version 2.1 of the License, or (at your option) any later version. 11 * 12 * This software is distributed in the hope that it will be useful, 13 * but WITHOUT ANY WARRANTY; without even the implied warranty of 14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 * Lesser General Public License (http://www.gnu.org/copyleft/lesser.html) 16 * for more details. 17 * 18 *****************************************************************************/ 19 20 package camera3d; 21 22 23 import org.jdom.*; 24 25 /*** 26 * @author Fábio Roberto de Miranda e Carlos da Silva dos Santos 27 * @version 1.0 28 */ 29 class VcAmbientLightXMLHandler extends VcLightXMLHandler { 30 31 VcAmbientLightXMLHandler() { 32 super(); 33 this.type = "AmbientLight"; 34 } 35 36 /*** 37 * Creates describing XML element for a given ambient light. 38 * @param obj must be a VcAmbientLight. 39 * @return element describing light or null if input VcObject is not a VcAmbientLight. 40 */ 41 Element createElement(VcObject obj){ 42 if(!(obj instanceof VcAmbientLight)) return null; 43 element = super.createElement(obj); 44 return element; 45 } 46 47 /*** 48 * Creates VcAmbientLight from XML element describing it. 49 * @param el XML element describing a VcAmbientLight. 50 * @return VcAmbientLight described by el. 51 */ 52 VcObject createObject (Element el){ 53 if(!type.equals(el.getName())) return null; 54 VcAmbientLight light = new VcAmbientLight(); 55 initializeObject(el,light); 56 return light; 57 } 58 59 /*** 60 * Adds an ambient light to scene graph. 61 * @param vcObject must be a VcAmbientLight. 62 * @param base receives the ambiente light. 63 */ 64 void addObject(VcObject vcObject, J3DBase base){ 65 if(!(vcObject instanceof VcAmbientLight))return; 66 VcObject obj = base.getByLabel(vcObject.getLabel()); 67 if(obj!=null){ 68 if(obj instanceof VcAmbientLight) base.removeVcObject(obj); 69 else obj.setLabel("_"+obj.getLabel()); 70 } 71 base.addLight((VcLight)vcObject); 72 } 73 74 }

This page was automatically generated by Maven