Statistics
| Revision:

root / trunk / extensions / extGeoreferencing / src / com / iver / cit / gvsig / StackZoom.java @ 3011

History | View | Annotate | Download (2.84 KB)

1
/*
2
 * Created on 20-sep-2005
3
 *
4
 * To change the template for this generated file go to
5
 * Window>Preferences>Java>Code Generation>Code and Comments
6
 */
7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
11
 * This program is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU General Public License
13
 * as published by the Free Software Foundation; either version 2
14
 * of the License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
24
 *
25
 * For more information, contact:
26
 *
27
 *  Generalitat Valenciana
28
 *   Conselleria d'Infraestructures i Transport
29
 *   Av. Blasco Ib??ez, 50
30
 *   46010 VALENCIA
31
 *   SPAIN
32
 *
33
 *      +34 963862235
34
 *   gvsig@gva.es
35
 *      www.gvsig.gva.es
36
 *
37
 *    or
38
 *
39
 *   IVER T.I. S.A
40
 *   Salamanca 50
41
 *   46005 Valencia
42
 *   Spain
43
 *
44
 *   +34 963163400
45
 *   dac@iver.es
46
 */
47
package com.iver.cit.gvsig;
48

    
49
import java.util.ArrayList;
50

    
51
import org.cresques.px.Extent;
52

    
53
/**
54
 * Clase para almacenar los extents que se van seleccionando al manipular
55
 * una imagen para su georreferenciaci?n. Esto permite recuperar extents anteriores.
56
 * 
57
 * @author Nacho Brodin (brodin_ign@gva.es)
58
 */
59
public class StackZoom{
60
                
61
        private ArrayList extentList = new ArrayList();
62
        private Extent initExtent = null;
63
                
64
        private int selectElem = -1;
65
        
66
        public StackZoom(){}
67
        
68
        /**
69
         * A?ade un extent a la lista
70
         * @param ext
71
         */
72
        public void setZoom(Extent ext){
73
                extentList.add(ext);
74
                selectElem ++;
75
        }
76
                
77
        /**
78
         * Recupera el ?ltimo extent aplicado
79
         * @return
80
         */
81
        public Extent getLastZoom(){
82
                if(extentList.size() == 0)
83
                        return null;
84
                
85
                if((selectElem - 1)== -1){
86
                        selectElem = -1;
87
                        extentList.clear();
88
                        return null;
89
                }
90
                                
91
                selectElem --;
92
                                
93
                Extent ex = (Extent)extentList.get(selectElem);
94
                return ex;
95
        }
96
        
97
        /**
98
         * Recupera el siguiente zoom. Se usa cuando se ha recuperado el ?ltimo
99
         * zoom y se quiere volver al siguiente.
100
         * @return
101
         */
102
        public Extent getNextZoom(){
103
                if(selectElem == (extentList.size() - 1) || extentList.size() == 0)
104
                        return null;
105
                selectElem ++;
106
                Extent ex = (Extent)extentList.get(selectElem);
107
                return ex;
108
        }
109
        
110
        /**
111
         * @return Returns the initExtent.
112
         */
113
        public Extent getInitExtent() {
114
                return initExtent;
115
        }
116
        
117
        /**
118
         * @param initExtent The initExtent to set.
119
         */
120
        public void setInitExtent(Extent initExtent) {
121
                this.initExtent = initExtent;
122
        }
123

    
124
}