Statistics
| Revision:

root / trunk / extensions / extRasterTools-SE / src / org / gvsig / rastertools / vectorizacion / ui / VectorizationDialog.java @ 21635

History | View | Annotate | Download (3.78 KB)

1 21579 nbrodin
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
2
 *
3
 * Copyright (C) 2004 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.rastertools.vectorizacion.ui;
20
21
import java.awt.BorderLayout;
22
import java.awt.Dimension;
23
24
import javax.swing.JPanel;
25
26
import org.gvsig.fmap.raster.layers.FLyrRasterSE;
27
import org.gvsig.gui.beans.buttonspanel.ButtonsPanel;
28
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent;
29
import org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener;
30
import org.gvsig.raster.beans.previewbase.IPreviewRenderProcess;
31
32
import com.iver.andami.PluginServices;
33
import com.iver.andami.ui.mdiManager.IWindow;
34
import com.iver.andami.ui.mdiManager.WindowInfo;
35
36
/**
37
 * Dialogo para el preprocesado del raster antes de la aplicaci?n de la vectorizaci?n.
38
 *
39
 * 12/06/2008
40
 * @author Nacho Brodin nachobrodin@gmail.com
41
 */
42
public class VectorizationDialog extends JPanel implements IWindow, ButtonsPanelListener {
43
        private static final long            serialVersionUID = -5374834293534046986L;
44
        private String                       name             = null;
45
        private FLyrRasterSE                 lyr              = null;
46
        private IPreviewRenderProcess        renderProcess    = null;
47
        private PreprocessVectorizationPanel prepPanel        = null;
48
49
        /**
50
         * Constructor
51
         * @param width Ancho
52
         * @param height Alto
53
         */
54
        public VectorizationDialog(int width, int height, FLyrRasterSE lyr, IPreviewRenderProcess renderProcess) {
55
                this.name = lyr.getName();
56
                this.lyr = lyr;
57
                this.renderProcess = renderProcess;
58
                this.setPreferredSize(new Dimension(width, height));
59
                this.setSize(width, height);
60
                this.setLayout(new BorderLayout(5, 5));
61
                this.add(getPreprocessVectorizationPanel(), java.awt.BorderLayout.CENTER);
62
        }
63
64
        /**
65
         * Obtiene el panel con el histograma
66
         * @return HistogramPanel
67
         */
68
        public PreprocessVectorizationPanel getPreprocessVectorizationPanel() {
69
                if (prepPanel == null) {
70
                        prepPanel = new PreprocessVectorizationPanel(lyr, renderProcess);
71
                }
72
                return prepPanel;
73
        }
74
75
        /*
76
         * (non-Javadoc)
77
         * @see com.iver.andami.ui.mdiManager.IWindow#getWindowInfo()
78
         */
79
        public WindowInfo getWindowInfo() {
80 21635 nbrodin
                WindowInfo m_viewinfo = new WindowInfo(WindowInfo.MODELESSDIALOG | WindowInfo.RESIZABLE | WindowInfo.MAXIMIZABLE);
81 21579 nbrodin
                if (name != null)
82
                        m_viewinfo.setAdditionalInfo(name);
83
                m_viewinfo.setTitle(PluginServices.getText(this, "recorte"));
84
                m_viewinfo.setHeight(this.getHeight());
85
                m_viewinfo.setWidth(this.getWidth());
86
                return m_viewinfo;
87
        }
88
89
        /**
90
         * Acciones a ejecutar cuando se cancela
91
         */
92
        public void close() {
93
                try {
94
                        PluginServices.getMDIManager().closeWindow(this);
95
                } catch (ArrayIndexOutOfBoundsException e) {
96
                        // Si la ventana no se puede eliminar no hacemos nada
97
                }
98
        }
99
100
        /*
101
         * (non-Javadoc)
102
         * @see org.gvsig.gui.beans.buttonspanel.ButtonsPanelListener#actionButtonPressed(org.gvsig.gui.beans.buttonspanel.ButtonsPanelEvent)
103
         */
104
        public void actionButtonPressed(ButtonsPanelEvent e) {
105
                if (e.getButton() == ButtonsPanel.BUTTON_CLOSE) {
106
                        close();
107
                }
108
        }
109
}