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.gui;
21 /*
22 * Title: Câmera Virtual - LIVES
23 * Description: Câmera Virtual para Controle via LabVIEW
24 * Copyright: Copyright (c) 2001
25 * Company: Centro de Educação em Informática - SENAC - SP
26 */
27 import javax.swing.*;
28 import java.awt.*;
29 import camera3d.*;
30 //import javax.media.j3d.*;
31
32 /***
33 * Pane for editing point light specific parameters.
34 *
35 * @author Fábio Roberto de Miranda
36 * @version 1.0
37 */
38 class VcPointLightEditionPane extends JPanel implements DoubleValueChangeListener {
39
40 private VcPointLight pointLight;
41 private GUIControl guiControl;
42
43 private JLabel jLabel1 = new JLabel();
44 private DoubleDigitalControl constantControl = new DoubleDigitalControl();
45 private DoubleDigitalControl linearControl = new DoubleDigitalControl();
46 private DoubleDigitalControl quadraticControl = new DoubleDigitalControl();
47 private JLabel jLabel2 = new JLabel();
48 private JLabel constantLabel = new JLabel();
49 private JLabel linearLabel = new JLabel();
50 private JLabel quadraticLabel = new JLabel();
51
52 /***
53 * Creates pane.
54 */
55 public VcPointLightEditionPane() {
56 try {
57 jbInit();
58 }
59 catch(Exception e) {
60 e.printStackTrace();
61 }
62 }
63
64 void setGUIControl(GUIControl guiControl){
65 this.guiControl = guiControl;
66 }
67
68 public void valueChanged(DoubleChangeEvent chg){
69 guiControl.changePointLightAttenuation( pointLight,
70 constantControl.getValue(),
71 linearControl.getValue(),
72 quadraticControl.getValue());
73
74 }
75
76
77 private void jbInit() throws Exception {
78 jLabel1.setText("Point Light");
79 jLabel1.setBounds(new Rectangle(6, 9, 91, 20));
80 this.setBorder(BorderFactory.createEtchedBorder());
81 this.setMinimumSize(new Dimension(150, 200));
82 this.setPreferredSize(new Dimension(150, 200));
83 this.setLayout(null);
84 constantControl.setBounds(new Rectangle(108, 70, 72, 35));
85 linearControl.setBounds(new Rectangle(107, 115, 72, 35));
86 quadraticControl.setBounds(new Rectangle(106, 162, 72, 35));
87 jLabel2.setText("Attenuation");
88 jLabel2.setBounds(new Rectangle(8, 45, 82, 17));
89 constantLabel.setText("constant");
90 constantLabel.setBounds(new Rectangle(13, 80, 61, 17));
91 linearLabel.setText("linear");
92 linearLabel.setBounds(new Rectangle(16, 123, 41, 17));
93 quadraticLabel.setText("quadratic");
94 quadraticLabel.setBounds(new Rectangle(16, 173, 66, 17));
95 this.add(jLabel1, null);
96 this.add(jLabel2, null);
97 this.add(constantControl, null);
98 this.add(linearControl, null);
99 this.add(constantLabel, null);
100 this.add(linearLabel, null);
101 this.add(quadraticLabel, null);
102 this.add(quadraticControl, null);
103 constantControl.addValueChangeListener(this);
104 linearControl.addValueChangeListener(this);
105 quadraticControl.addValueChangeListener(this);
106 }
107
108 void setVcPointLight(VcPointLight pointLight){
109 this.pointLight = pointLight;
110 updateData();
111 }
112
113 void updateData(){
114 if (pointLight==null){
115 debugln("PointLight is null");
116 }
117 constantControl.setValue(pointLight.getConstantAttenuation());
118 linearControl.setValue(pointLight.getLinearAttenuation());
119 quadraticControl.setValue(pointLight.getQuadraticAttenuation());
120 }
121
122 void debugln(String s){
123 if (GUIControl.debugflag){
124 System.out.println(s);
125 }
126 }
127 }
This page was automatically generated by Maven