Revision 2669 branches/CqCMSDvp/libraries/libCq CMS for java.old/src/org/cresques/io/raster/RasterStats.java

View differences:

RasterStats.java
1 1
/*
2 2
 * Cresques Mapping Suite. Graphic Library for constructing mapping applications.
3
 * 
4
 * Copyright (C) 2004-5. 
5 3
 *
4
 * Copyright (C) 2004-5.
5
 *
6 6
 * This program is free software; you can redistribute it and/or
7 7
 * modify it under the terms of the GNU General Public License
8 8
 * as published by the Free Software Foundation; either version 2
......
18 18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
19 19
 *
20 20
 * For more information, contact:
21
 * 
21
 *
22 22
 * cresques@gmail.com
23 23
 */
24 24
package org.cresques.io.raster;
25 25

  
26 26
import java.util.ArrayList;
27 27

  
28

  
28 29
/**
29 30
 * Clase para estadisticas
30 31
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
31 32
 */
32 33
public class RasterStats {
33
	
34
	/**
35
	 * Clase que contiene los valores calculados para una imagen.
36
	 * Esto se usa cuando se solicita varias veces para una misma imagen solo 
37
	 * tenga que calcular los valores una vez.
38
	 * @author Nacho Brodin (brodin_ign@gva.es)
39
	 */
40
	public class History{
41
		public String file = null;
42
		public int[] min = null;
43
		public int[] max = null;
44
		public int[] secMin = null;
45
		public int[] secMax = null;
46
		
47
		public History(String file, int[] min, int[] max, int[] secMin, int[] secMax){
48
			this.file = file;
49
			this.min = (int[])min.clone();
50
			this.max = (int[])max.clone();
51
			this.secMin = (int[])secMin.clone();
52
			this.secMax = (int[])secMax.clone();
53
		}
54
	}
55
	
56
	/**
57
	 * Constructor
58
	 */
59
	public RasterStats() {
60
		super();
61
	}
62
	
63
	/**
64
	 * M?nimo valor de pixel por banda
65
	 */
66
	public int [] 	minBandValue = {Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE};
67
	/**
68
	 * M?ximo valor de pixel por banda
69
	 */
70
	public int [] 	maxBandValue = {Integer.MIN_VALUE,Integer.MIN_VALUE,Integer.MIN_VALUE};
71
	/**
72
	 * Segundo valor m?s peque?o de pixel por banda
73
	 */
74
	public int [] 	secondMinBandValue = {Integer.MAX_VALUE,Integer.MAX_VALUE,Integer.MAX_VALUE};
75
	/**
76
	 * Segundo valor m?s grande de pixel por banda
77
	 */
78
	public int [] 	secondMaxBandValue = {Integer.MIN_VALUE,Integer.MIN_VALUE,Integer.MIN_VALUE};
79
	
80
	/**
81
	 * Historial de valores para una imagen. Esto se usa cuando se solicita varias
82
	 * veces para una misma imagen solo tenga que calcular los valores una vez
83
	 */
84
	public ArrayList history = new ArrayList();
85
	
86
	/**
87
	 * Porcentaje de recorte de colas
88
	 */
89
	public double	tailPercent = 0D; 
90
		
91
	public void pinta() {
92
		for (int i=0; i<3; i++)
93
			System.out.println("  Band ["+i+"]: "+minBandValue[i]+"..."+maxBandValue[i]);
94
			
95
		System.out.println("Porcentaje de recorte: "+ tailPercent);
34
    /**
35
     * M?nimo valor de pixel por banda
36
     */
37
    public int[] minBandValue = {
38
                                    Integer.MAX_VALUE, Integer.MAX_VALUE,
39
                                    Integer.MAX_VALUE
40
                                };
96 41

  
97
	}
42
    /**
43
     * M?ximo valor de pixel por banda
44
     */
45
    public int[] maxBandValue = {
46
                                    Integer.MIN_VALUE, Integer.MIN_VALUE,
47
                                    Integer.MIN_VALUE
48
                                };
98 49

  
50
    /**
51
     * Segundo valor m?s peque?o de pixel por banda
52
     */
53
    public int[] secondMinBandValue = {
54
                                          Integer.MAX_VALUE, Integer.MAX_VALUE,
55
                                          Integer.MAX_VALUE
56
                                      };
57

  
58
    /**
59
     * Segundo valor m?s grande de pixel por banda
60
     */
61
    public int[] secondMaxBandValue = {
62
                                          Integer.MIN_VALUE, Integer.MIN_VALUE,
63
                                          Integer.MIN_VALUE
64
                                      };
65

  
66
    /**
67
     * Historial de valores para una imagen. Esto se usa cuando se solicita varias
68
     * veces para una misma imagen solo tenga que calcular los valores una vez
69
     */
70
    public ArrayList history = new ArrayList();
71

  
72
    /**
73
     * Porcentaje de recorte de colas
74
     */
75
    public double tailPercent = 0D;
76

  
77
    /**
78
     * Constructor
79
     */
80
    public RasterStats() {
81
        super();
82
    }
83

  
84
    public void pinta() {
85
        for (int i = 0; i < 3; i++)
86
            System.out.println("  Band [" + i + "]: " + minBandValue[i] +
87
                               "..." + maxBandValue[i]);
88

  
89
        System.out.println("Porcentaje de recorte: " + tailPercent);
90
    }
91

  
92
    /**
93
     * Clase que contiene los valores calculados para una imagen.
94
     * Esto se usa cuando se solicita varias veces para una misma imagen solo
95
     * tenga que calcular los valores una vez.
96
     * @author Nacho Brodin (brodin_ign@gva.es)
97
     */
98
    public class History {
99
        public String file = null;
100
        public int[] min = null;
101
        public int[] max = null;
102
        public int[] secMin = null;
103
        public int[] secMax = null;
104

  
105
        public History(String file, int[] min, int[] max, int[] secMin,
106
                       int[] secMax) {
107
            this.file = file;
108
            this.min = (int[]) min.clone();
109
            this.max = (int[]) max.clone();
110
            this.secMin = (int[]) secMin.clone();
111
            this.secMax = (int[]) secMax.clone();
112
        }
113
    }
99 114
}

Also available in: Unified diff