Revision 15494 import/ext3D/branches/ext3D_v1.1/ext3Dgui/src/com/iver/ai2/gvsig3dgui/layer/TransparencyPanel.java
TransparencyPanel.java | ||
---|---|---|
129 | 129 |
} |
130 | 130 |
|
131 | 131 |
private void UpdateOrder() { |
132 |
|
|
133 | 132 |
// cogemos la capa q esta seleccionada |
134 | 133 |
|
135 | 134 |
MapContext mapa = view3D.getMapContext(); |
... | ... | |
141 | 140 |
if (selectedExtent.length == 1 && selectedExtent[0].isAvailable()) { |
142 | 141 |
|
143 | 142 |
lyr3DAux = (FLayer) selectedExtent[0]; |
144 |
if (!(lyr3DAux.getName().equals(lyr3D.getName()))){ |
|
145 |
lyr3D = lyr3DAux; |
|
146 |
layer3DProps = Layer3DProps.getLayer3DProps(lyr3D); |
|
147 |
|
|
148 |
order = layer3DProps.getPlanetOrder(); |
|
149 |
// opacity = layer3DProps.getOpacity(); |
|
150 |
opacity = ((FLyrDefault)lyr3D).getTransparency() / 255; |
|
151 |
// sliderTrans.setValue((int) opacity * 255); |
|
152 |
|
|
153 |
} |
|
143 |
// if (!(lyr3DAux.getName().equals(lyr3D.getName()))) { |
|
144 |
// // sliderTrans.setValue((int) opacity * 255); |
|
145 |
// |
|
146 |
// } |
|
147 |
lyr3D = lyr3DAux; |
|
148 |
layer3DProps = Layer3DProps.getLayer3DProps(lyr3D); |
|
149 |
|
|
150 |
order = layer3DProps.getPlanetOrder(); |
|
151 |
// opacity = layer3DProps.getOpacity(); |
|
152 |
opacity = (((FLyrDefault) lyr3D).getTransparency()) |
|
153 |
/ (float) 255; |
|
154 | 154 |
} |
155 | 155 |
|
156 | 156 |
} |
... | ... | |
159 | 159 |
* This method initializes this |
160 | 160 |
*/ |
161 | 161 |
private void initialize() { |
162 |
|
|
162 |
|
|
163 | 163 |
GridBagConstraints gridBagConstraints1 = new GridBagConstraints(); |
164 | 164 |
gridBagConstraints1.fill = GridBagConstraints.VERTICAL; |
165 | 165 |
gridBagConstraints1.gridy = 2; |
... | ... | |
171 | 171 |
gridBagConstraints.gridwidth = 2; |
172 | 172 |
gridBagConstraints.insets = new Insets(15, 0, 0, 0); |
173 | 173 |
gridBagConstraints.gridy = 3; |
174 |
|
|
175 |
this.add(getSliderTrans(),gridBagConstraints1); |
|
176 |
this.add(getOkCancelPanel(),gridBagConstraints); |
|
177 |
// jContentPane = new JPanel(); |
|
178 |
// jContentPane.setLayout(new GridBagLayout()); |
|
179 |
// jContentPane.add(getJButton(), gridBagConstraints); |
|
180 |
// jContentPane.add(getJSlider(), gridBagConstraints1); |
|
181 | 174 |
|
182 |
|
|
183 |
|
|
175 |
this.add(getSliderTrans(), gridBagConstraints1); |
|
176 |
this.add(getOkCancelPanel(), gridBagConstraints); |
|
177 |
// jContentPane = new JPanel(); |
|
178 |
// jContentPane.setLayout(new GridBagLayout()); |
|
179 |
// jContentPane.add(getJButton(), gridBagConstraints); |
|
180 |
// jContentPane.add(getJSlider(), gridBagConstraints1); |
|
181 |
|
|
184 | 182 |
// Inicialize component |
185 | 183 |
setName(PluginServices.getText(this, "Transparency")); |
186 | 184 |
// Introducing the margin |
187 |
// setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
|
|
185 |
// setBorder(BorderFactory.createEmptyBorder(6, 6, 6, 6));
|
|
188 | 186 |
// Dimension of the panel |
189 | 187 |
// setSize(new Dimension(width, height)); |
190 | 188 |
this.setPreferredSize(new Dimension(width, height)); |
... | ... | |
192 | 190 |
|
193 | 191 |
// ADDING COMPONENTS |
194 | 192 |
|
195 |
// this.addComponent(getSliderTrans(), new Insets(2, 5, 2, 5));
|
|
196 |
// |
|
197 |
// // Accept buton
|
|
198 |
// this.addComponent(getOkCancelPanel(), new Insets(2, 5, 2, 5));
|
|
193 |
// this.addComponent(getSliderTrans(), new Insets(2, 5, 2, 5));
|
|
194 |
//
|
|
195 |
// // Accept buton
|
|
196 |
// this.addComponent(getOkCancelPanel(), new Insets(2, 5, 2, 5));
|
|
199 | 197 |
|
200 | 198 |
// Launching slider update |
201 | 199 |
// Create the object with the run() method |
... | ... | |
231 | 229 |
} |
232 | 230 |
|
233 | 231 |
public void stateChanged(ChangeEvent e) { |
234 |
// this.UpdateOrder();
|
|
232 |
// this.UpdateOrder();
|
|
235 | 233 |
JSlider source = (JSlider) e.getSource(); |
236 | 234 |
int trans = (int) source.getValue(); |
237 | 235 |
// System.out.println("valor de la transparencia capturada " + trans); |
... | ... | |
240 | 238 |
// Alpha value |
241 | 239 |
opacity = (float) trans / 255f; |
242 | 240 |
// Setting opaciti in layer properties |
243 |
//layer3DProps.setOpacity(opacity); |
|
244 |
// Setting opacity in layer
|
|
245 |
((FLyrDefault)lyr3D).setTransparency(trans); |
|
241 |
// layer3DProps.setOpacity(opacity);
|
|
242 |
// Setting opacity in layer |
|
243 |
((FLyrDefault) lyr3D).setTransparency(trans);
|
|
246 | 244 |
// Notify the opacity to planet |
247 | 245 |
view3D.getPlanet().setTextureOpacityLayer(order, opacity); |
248 | 246 |
// Repainting canvas |
... | ... | |
265 | 263 |
view3D.getPlanet().setTextureOpacityLayer(order, a); |
266 | 264 |
// Repainting canvas |
267 | 265 |
view3D.getCanvas3d().repaint(); |
268 |
// Stop thread
|
|
269 |
runnable.end();
|
|
266 |
// Stop thread |
|
267 |
runnable.end(); |
|
270 | 268 |
PluginServices.getMDIManager().closeWindow( |
271 | 269 |
TransparencyPanel.this); |
272 | 270 |
} |
... | ... | |
310 | 308 |
public void run() { |
311 | 309 |
while (true) { |
312 | 310 |
try { |
313 |
Thread.sleep(500);
|
|
311 |
Thread.sleep(250);
|
|
314 | 312 |
synchronized (this) { |
315 | 313 |
if (finish) { |
316 | 314 |
break; |
... | ... | |
322 | 320 |
} |
323 | 321 |
// aki codigo de comprobacion |
324 | 322 |
UpdateOrder(); |
325 |
sliderTrans.setValue((int)(opacity * 255)); |
|
323 |
sliderTrans.setValue((int) (opacity * 255));
|
|
326 | 324 |
sliderTrans.repaint(); |
327 | 325 |
} |
328 | 326 |
} |
Also available in: Unified diff