Statistics
| Revision:

root / trunk / extensions / extGeoreferencing / src / org / gvsig / georeferencing / ui / launcher / GeorefLauncherDialog.java @ 18530

History | View | Annotate | Download (4.54 KB)

1
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2007 IVER T.I. and Generalitat Valenciana.
4
 *
5
 * This program is free software; you can redistribute it and/or
6
 * modify it under the terms of the GNU General Public License
7
 * as published by the Free Software Foundation; either version 2
8
 * of the License, or (at your option) any later version.
9
 *
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 * GNU General Public License for more details.
14
 *
15
 * You should have received a copy of the GNU General Public License
16
 * along with this program; if not, write to the Free Software
17
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
18
 */
19
package org.gvsig.georeferencing.ui.launcher;
20

    
21
import java.awt.BorderLayout;
22

    
23
import javax.swing.JPanel;
24

    
25
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
26
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
27

    
28
import com.iver.andami.ui.mdiManager.IWindow;
29
import com.iver.andami.ui.mdiManager.IWindowListener;
30
import com.iver.andami.ui.mdiManager.WindowInfo;
31

    
32
/**
33
 * Dialogo con el cuadro de par?metros iniciales de la funcionalidad de georreferenciaci?n.
34
 * 
35
 * 10/01/2008
36
 * @author Nacho Brodin nachobrodin@gmail.com
37
 */
38
public class GeorefLauncherDialog extends JPanel implements IWindow, IWindowListener {
39
        private static final long            serialVersionUID = 7362459094802955247L;
40
        private GeorefLauncherPanel          geoLauncherPanel = null;
41
        
42
        private String[]                     viewNameList = null;
43
        private int                          polynomialDegree;
44

    
45
        /**
46
         * Tama?o de la ventana
47
         */
48
        private int                          widthWindow      = 380;
49
        private int                          heightWindow     = 320;
50
                
51
        /**
52
         * Constructor
53
         * @param viewList Lista de nombres de las vistas disponibles
54
         * @param degreeList grado m?ximo para la georreferenciaci?n polinomial
55
         */
56
        public GeorefLauncherDialog(String[] viewList, int polynomialDegree, ButtonsPanelListener listener) {
57
                this.viewNameList = viewList;
58
                this.polynomialDegree = polynomialDegree;
59
                
60
                BorderLayout bl = new BorderLayout();
61
                this.setLayout(bl);
62
                
63
                this.add(getGeorefLauncherPanel(listener), BorderLayout.CENTER);
64
        }
65
                
66
        /**
67
         * Obtiene el panel general del lanzador  de la georreferenciaci?n
68
         * @return GeorefLauncherPanel
69
         */
70
        public GeorefLauncherPanel getGeorefLauncherPanel(ButtonsPanelListener listener){
71
                if (geoLauncherPanel == null) 
72
                        geoLauncherPanel = new GeorefLauncherPanel(viewNameList, polynomialDegree, listener);
73
                
74
                return geoLauncherPanel;
75
        }
76
        
77
        /*
78
         * (non-Javadoc)
79
         * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
80
         */
81
        public WindowInfo getWindowInfo() {
82
                WindowInfo m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
83
                m_viewinfo.setHeight(heightWindow);
84
                m_viewinfo.setWidth(widthWindow);
85
                return m_viewinfo;
86
        }
87
        
88
        /*
89
         * (non-Javadoc)
90
         * @see com.iver.andami.ui.mdiManager.IWindowListener#windowActivated()
91
         */
92
        public void windowActivated() {
93
        }
94

    
95
        /*
96
         * (non-Javadoc)
97
         * @see com.iver.andami.ui.mdiManager.IWindowListener#windowClosed()
98
         */
99
        public void windowClosed() {
100
        }
101
        
102
        //-------Consulta de propiedades seleccionadas---------
103
        
104
        /**
105
         * Obtiene la capa que ha sido abierta por el usuario 
106
         * @return Obtiene la capa que ha sido abierta por el usuario o null si no 
107
         * hay abierta ninguna.
108
         */
109
        public FLyrRasterSE getLayer() {
110
                return geoLauncherPanel.getFileSelectionPanel().getLayer();
111
        }
112
        
113
        /**
114
         * Obtiene la vista seleccionada
115
         * @return
116
         */
117
        public String getSelectedView() {
118
                return geoLauncherPanel.getTypeSelectionPanel().getSelectedView();
119
        }
120
        
121
        /**
122
         * Obtiene el tipo de georreferenciaci?n seleccionada
123
         * @return entero con el tipo de georreferenciaci?n. Es una constante contenida en la 
124
         * clase georreferencing.
125
         */
126
        public int getType() {
127
                return geoLauncherPanel.getTypeSelectionPanel().getType();
128
        }
129
        
130
        /**
131
         * Obtiene el tipo de algoritmo seleccionado
132
         * @return Cte definida en Georeferencing
133
         */
134
        public int getAlgorithm() {
135
                return geoLauncherPanel.getAlgorithmSelectionPanel().getAlgorithm();
136
        }
137
        
138
        /**
139
         * Obtiene el grado del algoritmo
140
         * @return 
141
         */
142
        public int getDegree() {
143
                String degree = ((String)geoLauncherPanel.getAlgorithmSelectionPanel().getDegreeList().getSelectedItem());
144
                String[] l = degree.split(" ");
145
                degree = l[l.length - 1];
146
                try {
147
                        return Integer.valueOf(degree).intValue();
148
                }catch (NumberFormatException e) {
149
                        return -1;
150
                }
151
        }
152

    
153
}
154