Statistics
| Revision:

svn-gvsig-desktop / tags / v1_1_Build_1009 / extensions / extGeoProcessing / src / com / iver / cit / gvsig / geoprocess / impl / spatialjoin / gui / GeoProcessingSpatialJoinPanel2.java @ 12649

History | View | Annotate | Download (3.81 KB)

1 6749 azabala
/*
2
 * Created on 09-ago-2006
3
 *
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
/* CVS MESSAGES:
45
*
46
* $Id$
47
* $Log$
48 12571 azabala
* Revision 1.1.2.3  2007-07-12 16:54:35  azabala
49
* bug solved when try to do a one to many spatial join with layers without numeric fields
50
*
51
* Revision 1.1.2.2  2006/11/15 00:08:17  jjdelcerro
52 8765 jjdelcerro
* *** empty log message ***
53 7374 azabala
*
54 8765 jjdelcerro
* Revision 1.2  2006/09/19 19:24:09  azabala
55
* fixed bug (sumarization function dialog showed always the same fields, first selected layer fields in combo box)
56
*
57 7374 azabala
* Revision 1.1  2006/08/11 16:30:38  azabala
58 6749 azabala
* *** empty log message ***
59
*
60
*
61
*/
62
package com.iver.cit.gvsig.geoprocess.impl.spatialjoin.gui;
63
64
import java.awt.Insets;
65 12571 azabala
import java.awt.event.ItemEvent;
66 6749 azabala
import java.util.Map;
67
68
import javax.swing.JCheckBox;
69
70
import com.iver.andami.PluginServices;
71
import com.iver.cit.gvsig.fmap.layers.FLayers;
72
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
73 12571 azabala
import com.iver.cit.gvsig.geoprocess.core.fmap.XTypes;
74 6749 azabala
import com.iver.cit.gvsig.geoprocess.core.gui.GeoProcessingOverlayPanel2;
75
import com.iver.cit.gvsig.geoprocess.core.gui.SpatialJoinNumericFieldSelection;
76
77
public class GeoProcessingSpatialJoinPanel2 extends
78
                GeoProcessingOverlayPanel2 implements SpatialJoinPanelIF{
79
80
81
        private JCheckBox nearestCheckbox;
82
83
        private SpatialJoinNumericFieldSelection fieldDialog;
84
85
        private Map sumarizeFunctions;
86
87
88
        public GeoProcessingSpatialJoinPanel2(FLayers layers) {
89
                super(layers, PluginServices.
90
                                                        getText(null,
91
                                                        "Enlace_espacial._Introduccion_de_datos") +
92
                                                        ":");
93
        }
94
        protected void addSpecificDesign() {
95
                super.addSpecificDesign();
96
                Insets insets = new Insets(5, 5, 5, 5);
97
                nearestCheckbox = new JCheckBox();
98
                nearestCheckbox.setText(PluginServices.
99
                                getText(this, "Obtener_mas_proximo"));
100
                addComponent(nearestCheckbox, insets);
101
        }
102
103
104
        public boolean isNearestSelected() {
105
                return nearestCheckbox.isSelected();
106
        }
107
108
        public FLyrVect getFirstLayer(){
109
                return this.getInputLayer();
110
        }
111
112
        public boolean openSumarizeFunction() {
113 7374 azabala
                //if(fieldDialog == null){
114 6749 azabala
                        fieldDialog = new SpatialJoinNumericFieldSelection(getSecondLayer());
115
                        fieldDialog.pack();
116 7374 azabala
                //}
117 6749 azabala
                fieldDialog.setSize(560,300);
118
                fieldDialog.setVisible(true);
119
                sumarizeFunctions = fieldDialog.getSumarizationFunctions();
120
                return fieldDialog.isOk();
121
        }
122 12571 azabala
123
        /**
124
         * Subclasses those want to overwrite logic of this component
125
         * must overwrites this method
126
         * @param e
127
         */
128
        protected void processLayer2ComboBoxStateChange(ItemEvent e) {
129
                if(XTypes.getNumericFieldsNames(getSecondLayer()).length == 0){
130
                        nearestCheckbox.setSelected(true);
131
                        nearestCheckbox.setEnabled(false);
132
                }else{
133
                        nearestCheckbox.setEnabled(true);
134
                }
135
        }
136 6749 azabala
137
138
139
        public Map getSumarizeFunctions() {
140
                return sumarizeFunctions;
141
        }
142 12571 azabala
143 6749 azabala
}