Statistics
| Revision:

root / branches / v2_0_0_prep / applications / appgvSIG / src / com / iver / cit / gvsig / gui / selectionByTheme / MySelectionByThemeListener.java @ 24759

History | View | Annotate | Download (5.12 KB)

1
/* 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
 * For more information, contact:
20
 *
21
 *  Generalitat Valenciana
22
 *   Conselleria d'Infraestructures i Transport
23
 *   Av. Blasco Ib??ez, 50
24
 *   46010 VALENCIA
25
 *   SPAIN
26
 *
27
 *      +34 963862235
28
 *   gvsig@gva.es
29
 *      www.gvsig.gva.es
30
 *
31
 *    or
32
 *
33
 *   IVER T.I. S.A
34
 *   Salamanca 50
35
 *   46005 Valencia
36
 *   Spain
37
 *
38
 *   +34 963163400
39
 *   dac@iver.es
40
 */
41
package com.iver.cit.gvsig.gui.selectionByTheme;
42

    
43
import org.gvsig.fmap.mapcontext.layers.FLayer;
44
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
45

    
46
/**
47
 * DOCUMENT ME!
48
 *
49
 * @author Fernando Gonz?lez Cort?s
50
 */
51
//TODO comentado para que compile
52
public class MySelectionByThemeListener implements SelectionByThemeListener {
53
        /**
54
         * @see com.iver.cit.gvsig.gui.selectionByTheme.SelectionByThemeListener#newSet(int,
55
         *      int, int)
56
         */
57
        public void newSet(FLayer[] toSelect, FLayer selectionLayer, int action) {
58
                long t1 = System.currentTimeMillis();
59
                if (selectionLayer instanceof FLyrVect) {
60
//                        try {
61
//                                FeatureStore fs = ((FLyrVect) selectionLayer).getFeatureStore();
62
//                                for (int i = 0; i < toSelect.length; i++) {
63
//                                        if (toSelect[i] instanceof FLyrVect) {
64
//                                                FeatureStore capa = ((FLyrVect) toSelect[i]).getFeatureStore();
65
//                                                QueryByThemeVisitor visitor = new QueryByThemeVisitor(
66
//                                                                toSelect[i], selectionLayer, action);
67
//                                                capa.clearSelection();
68
//
69
//                                                ((VectorialData) selectionLayer).process(visitor,
70
//                                                                fs.getSelection());
71
//                                                capa.setSelection(visitor.getBitset());
72
//                                        }
73
//                                }
74
//                        } catch (ProcessVisitorException e) {
75
//                                NotificationManager.addError("Error leyendo las capas", e);
76
//                        } catch (ReadDriverException e) {
77
//                                NotificationManager.addError("Error leyendo las capas", e);
78
//                        } catch (VisitorException e) {
79
//                                NotificationManager.addError("Error leyendo las capas", e);
80
//                        }
81

    
82
                }
83
                long t2 = System.currentTimeMillis();
84
                System.out
85
                                .println("Tiempo de consulta: " + (t2 - t1) + " milisegundos");
86
                // doSelection(toSelect, selectionLayer, action, false);
87
        }
88

    
89
        /**
90
         * @see com.iver.cit.gvsig.gui.selectionByTheme.SelectionByThemeListener#addToSet(int,
91
         *      int, int)
92
         */
93
        public void addToSet(FLayer[] toSelect, FLayer selectionLayer, int action) {
94
                if (selectionLayer instanceof FLyrVect) {
95
//                        try {
96
//                                FeatureStore fs = ((FLyrVect) selectionLayer).getFeatureStore();
97
//                                for (int i = 0; i < toSelect.length; i++) {
98
//                                        if (toSelect[i] instanceof FLyrVect) {
99
//                                                FeatureStore capa = ((FLyrVect) toSelect[i]).getFeatureStore();
100
//                                                QueryByThemeVisitor visitor = new QueryByThemeVisitor(
101
//                                                                toSelect[i], selectionLayer, action);
102
//                                                FBitSet selection = capa.getSelection();
103
//                                                ((VectorialData) selectionLayer).process(visitor,
104
//                                                                selected.getSelection());
105
//                                                selection.or(visitor.getBitset());
106
//                                                capa.setSelection(selection);
107
//                                        }
108
//                                }
109
//                        } catch (ReadDriverException e) {
110
//                                NotificationManager.addError("Error leyendo las capas", e);
111
//                        } catch (ProcessVisitorException e) {
112
//                                NotificationManager.addError("Error leyendo las capas", e);
113
//                        } catch (VisitorException e) {
114
//                                NotificationManager.addError("Error leyendo las capas", e);
115
//                        }
116
                }
117
        }
118

    
119
        /**
120
         * @see com.iver.cit.gvsig.gui.selectionByTheme.SelectionByThemeListener#fromSet(int,
121
         *      int, int)
122
         */
123
        public void fromSet(FLayer[] toSelect, FLayer selectionLayer, int action) {
124
                if (selectionLayer instanceof FLyrVect) {
125
//                        try {
126
//                                FeatureStore selected = ((FLyrVect) selectionLayer).getFeatureStore();
127
//                                for (int i = 0; i < toSelect.length; i++) {
128
//                                        if (toSelect[i] instanceof FLyrVect) {
129
//                                                Selectable capa = ((FLyrVect) toSelect[i]).getFeatureStore();
130
//
131
//                                                QueryByThemeVisitor visitor = new QueryByThemeVisitor(
132
//                                                                toSelect[i], selectionLayer, action);
133
//                                                FBitSet selection = capa.getSelection();
134
//                                                ((VectorialData) selectionLayer).process(visitor,
135
//                                                                selected.getSelection());
136
//                                                selection.and(visitor.getBitset());
137
//                                                capa.setSelection(selection);
138
//                                        }
139
//                                }
140
//                        } catch (ReadDriverException e) {
141
//                                NotificationManager.addError("Error leyendo las capas", e);
142
//                        } catch (ProcessVisitorException e) {
143
//                                NotificationManager.addError("Error leyendo las capas", e);
144
//                        } catch (VisitorException e) {
145
//                                NotificationManager.addError("Error leyendo las capas", e);
146
//                        }
147

    
148
                }
149
        }
150
}