Revision 5247 trunk/extensions/extRasterTools/src/org/gvsig/rasterTools/brightnessContrast/ui/EnhancedBrightnessContrastPanel.java

View differences:

EnhancedBrightnessContrastPanel.java
4 4
import java.awt.GridBagLayout;
5 5
import java.awt.event.ActionEvent;
6 6
import java.awt.event.ActionListener;
7
import java.awt.event.MouseEvent;
8
import java.awt.event.MouseListener;
7 9

  
8
import javax.swing.JButton;
9 10
import javax.swing.JCheckBox;
10 11
import javax.swing.JLabel;
11 12
import javax.swing.JPanel;
......
29 30
 *
30 31
 */
31 32
public class EnhancedBrightnessContrastPanel extends JPanel implements ActionListener,
33
																	MouseListener,
32 34
																	IRasterPropertiesRegistrable,
33 35
																	IRasterOperationsRegistrablePanels{
34 36

  
......
41 43
	private JPanel jPanel1 = null;
42 44
	private JCheckBox cBrightC = null;
43 45
	private JLabel lBrightC = null;
44
	private JButton jButton = null;
45 46
	private JPanel pEnCheck = null;
46 47
	private JPanel pEnSlider = null;
47 48
	private JCheckBox cEnhanced = null;
......
51 52
	private CheckSliderText cstEnhanced = null;
52 53
	private JLabel jLabel = null;
53 54
	private BrightnessContrastStackManager bcManager = null;
55
	private JCheckBox jCheckBox1 = null;
56
	private JLabel jLabel1 = null;
54 57

  
55 58
	/**
56 59
	 * This is the default constructor
......
220 223
	 */
221 224
	private JPanel getJPanel1() {
222 225
		if (jPanel1 == null) {
226
			GridBagConstraints gridBagConstraints19 = new GridBagConstraints();
227
			gridBagConstraints19.gridx = 1;
228
			gridBagConstraints19.gridy = 0;
229
			jLabel1 = new JLabel();
230
			jLabel1.setText("Previsualizaci?n");
231
			jLabel1.setPreferredSize(new java.awt.Dimension(150,15));
232
			jLabel1.setSize(new java.awt.Dimension(160,15));
223 233
			GridBagConstraints gridBagConstraints10 = new GridBagConstraints();
224
			gridBagConstraints10.insets = new java.awt.Insets(0,0,0,140);
234
			gridBagConstraints10.gridx = 0;
235
			gridBagConstraints10.insets = new java.awt.Insets(0,0,0,0);
225 236
			gridBagConstraints10.gridy = 0;
226
			gridBagConstraints10.anchor = java.awt.GridBagConstraints.CENTER;
227
			gridBagConstraints10.gridx = 0;
228 237
			jPanel1 = new JPanel();
229 238
			jPanel1.setLayout(new GridBagLayout());
230
			jPanel1.setPreferredSize(new java.awt.Dimension(180,30));
231
			jPanel1.add(getJButton(), gridBagConstraints10);
239
			jPanel1.setPreferredSize(new java.awt.Dimension(180,25));
240
			jPanel1.add(getJCheckBox1(), gridBagConstraints10);
241
			jPanel1.add(jLabel1, gridBagConstraints19);
232 242
		}
233 243
		return jPanel1;
234 244
	}
......
246 256
	}
247 257

  
248 258
	/**
249
	 * This method initializes jButton	
250
	 * 	
251
	 * @return javax.swing.JButton	
252
	 */
253
	private JButton getJButton() {
254
		if (jButton == null) {
255
			jButton = new JButton();
256
			jButton.setPreferredSize(new java.awt.Dimension(22,22));
257
		}
258
		return jButton;
259
	}
260

  
261
	/**
262 259
	 * This method initializes jPanel	
263 260
	 * 	
264 261
	 * @return javax.swing.JPanel	
......
316 313
	 * 	
317 314
	 * @return javax.swing.JCheckBox	
318 315
	 */
319
	private JCheckBox getCEnhanced() {
316
	public JCheckBox getCEnhanced() {
320 317
		if (cEnhanced == null) {
321 318
			cEnhanced = new JCheckBox();
322 319
		}
......
354 351
	 * 	
355 352
	 * @return javax.swing.JCheckBox	
356 353
	 */
357
	private JCheckBox getJCheckBox() {
354
	public JCheckBox getJCheckBox() {
358 355
		if (jCheckBox == null) {
359 356
			jCheckBox = new JCheckBox();
360 357
		}
361 358
		return jCheckBox;
362 359
	}
363 360
	
364
	private CheckSliderText getCheckSliderText(){
361
	public CheckSliderText getCheckSliderText(){
365 362
		String rcName = "Recortar Colas ( % )"; 
366 363
		if (cstEnhanced == null){
367 364
			cstEnhanced = new CheckSliderText();
368 365
			cstEnhanced.setName(rcName);
369 366
			cstEnhanced.setSliderValue(0);
370 367
			cstEnhanced.setSliderRange(0,50);
368
			cstEnhanced.setTextValue("0.0");
371 369
			
372 370
		}
373 371
		return cstEnhanced;
......
376 374
	public void setBCControlEnabled(boolean active){
377 375
		this.lstBrightness.setControlEnabled(active);
378 376
		this.lstContrast.setControlEnabled(active);
379
		this.jButton.setEnabled(active);
377
		this.getJCheckBox1().setEnabled(active);
378
		this.jLabel1.setEnabled(active);
380 379
		this.lBrightC.setEnabled(active);
381 380
	}
382 381
	
......
414 413
		// Si est? activo el panel de brillo y contraste tomamos los valores y cargamos un filtro de 
415 414
		// brillo y contraste
416 415
		if(ebcPanel.getCBrightC().isSelected()){
417
			int incrBrillo = ebcPanel.lstBrightness.getTextValue();
418
			int incrContraste = ebcPanel.lstContrast.getTextValue();
416
			int incrBrillo = Integer.valueOf(ebcPanel.lstBrightness.getTextValue()).intValue();
417
			int incrContraste = Integer.valueOf(ebcPanel.lstContrast.getTextValue()).intValue();
419 418
			bcManager.addHistogramFilter();
420 419
			bcManager.addBrightnessFilter(incrBrillo);
421 420
			bcManager.addContrastFilter(incrContraste);
......
424 423
			stackManager.removeFilter(bcManager.brightness);
425 424
			stackManager.removeFilter(bcManager.contrast);
426 425
		}
426
		//Filtro de realce lineal seleccionado
427
		if(ebcPanel.getCEnhanced().isSelected()){
428
			if((ebcPanel.getJCheckBox().isSelected()) && (!ebcPanel.getCheckSliderText().isSelected()))
429
				stackManager.addEnhancedFilter(true, fLayer.getSource().getFiles()[0].getName());
430
			else
431
				stackManager.addEnhancedFilter(false, fLayer.getSource().getFiles()[0].getName());
432
				
433
			//Recorte de colas seleccionado
434
			if(ebcPanel.getCheckSliderText().isSelected()){
435
				stackManager.removeFilter(stackManager.getTypeFilter("computeminmax"));
436
				double recorte = Double.parseDouble(ebcPanel.getCheckSliderText().getTextValue())/100;
437
				if(ebcPanel.getJCheckBox().isSelected())
438
					stackManager.addTailFilter(recorte, 0D, true);
439
				else
440
					stackManager.addTailFilter(recorte, 0D, false);
441
			}else{
442
				stackManager.removeFilter(stackManager.getTypeFilter("tail"));
443
				stackManager.addComputeMinMaxFilter();
444
			}
445
			
446
		}
447
//		Sin filtro lineal seleccionado
448
		if(!ebcPanel.getCEnhanced().isSelected()){
449
			stackManager.removeFilter(stackManager.getTypeFilter("computeminmax"));
450
			stackManager.removeFilter(stackManager.getTypeFilter("tail"));
451
			stackManager.removeFilter(stackManager.getTypeFilter("enhanced"));
452
		}
453
		fLayer.getFMap().invalidate();
454
		
427 455
	}
428 456

  
429 457
	public void addTabPanel(FLyrRasterAdjustPropertiesTocMenuEntry menu) {
......
455 483
		
456 484
	}
457 485

  
486
	/**
487
	 * This method initializes jCheckBox1	
488
	 * 	
489
	 * @return javax.swing.JCheckBox	
490
	 */
491
	private JCheckBox getJCheckBox1() {
492
		if (jCheckBox1 == null) {
493
			jCheckBox1 = new JCheckBox();
494
		}
495
		return jCheckBox1;
496
	}
497

  
498
	//********************************************************************
499
	//***********************EVENTOS DE RAT?N*****************************
500
	public void mouseClicked(MouseEvent e) {
501
		// TODO Auto-generated method stub
502
		
503
	}
504

  
505
	public void mouseEntered(MouseEvent e) {
506
		// TODO Auto-generated method stub
507
		
508
	}
509

  
510
	public void mouseExited(MouseEvent e) {
511
		// TODO Auto-generated method stub
512
		
513
	}
514

  
515
	public void mousePressed(MouseEvent e) {
516
		// TODO Auto-generated method stub
517
		
518
	}
519

  
520
	public void mouseReleased(MouseEvent e) {
521
		// TODO Auto-generated method stub
522
		
523
	}
524

  
458 525
}

Also available in: Unified diff