Statistics
| Revision:

root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / Project.java @ 6888

History | View | Annotate | Download (37.8 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.project;
42

    
43
import java.awt.Color;
44
import java.beans.PropertyChangeEvent;
45
import java.beans.PropertyChangeListener;
46
import java.beans.PropertyChangeSupport;
47
import java.io.Serializable;
48
import java.lang.reflect.Field;
49
import java.lang.reflect.Modifier;
50
import java.text.DateFormat;
51
import java.util.ArrayList;
52
import java.util.Date;
53
import java.util.Hashtable;
54
import java.util.Iterator;
55

    
56
import org.cresques.cts.IProjection;
57
import org.cresques.cts.ProjectionPool;
58

    
59
import com.hardcode.driverManager.DriverLoadException;
60
import com.hardcode.gdbms.engine.data.DataSource;
61
import com.hardcode.gdbms.engine.data.NoSuchTableException;
62
import com.hardcode.gdbms.engine.data.SourceInfo;
63
import com.hardcode.gdbms.engine.data.db.DBSourceInfo;
64
import com.hardcode.gdbms.engine.data.db.DBTableSourceInfo;
65
import com.hardcode.gdbms.engine.data.file.FileSourceInfo;
66
import com.hardcode.gdbms.engine.data.object.ObjectSourceInfo;
67
import com.iver.andami.PluginServices;
68
import com.iver.andami.ui.mdiManager.IWindow;
69
import com.iver.andami.ui.mdiManager.WindowInfo;
70
import com.iver.cit.gvsig.ProjectExtension;
71
import com.iver.cit.gvsig.fmap.DriverException;
72
import com.iver.cit.gvsig.fmap.MapContext;
73
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
74
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
75
import com.iver.cit.gvsig.fmap.layers.CancelationException;
76
import com.iver.cit.gvsig.fmap.layers.FLayer;
77
import com.iver.cit.gvsig.fmap.layers.FLayers;
78
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
79
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
80
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
81
import com.iver.cit.gvsig.fmap.layers.XMLException;
82
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
83
import com.iver.cit.gvsig.fmap.operations.selection.LinkSelectionListener;
84
import com.iver.cit.gvsig.gui.project.OpenException;
85
import com.iver.cit.gvsig.gui.project.ProjectWindow;
86
import com.iver.cit.gvsig.gui.project.SaveException;
87
import com.iver.utiles.PostProcessSupport;
88
import com.iver.utiles.StringUtilities;
89
import com.iver.utiles.Utils;
90
import com.iver.utiles.XMLEntity;
91

    
92

    
93
/**
94
 * Clase que representa un proyecto de openSIG
95
 *
96
 * @author Fernando Gonz?lez Cort?s
97
 */
98
public class Project implements Serializable, PropertyChangeListener {
99
        public static String VERSION = "1.0";
100
        static private IProjection defaultProjection = ProjectionPool.get(
101
                        "EPSG:23030");
102
        private PropertyChangeSupport change;
103
        boolean modified = false;
104
        private String name;
105
        //private String path;
106
        private String creationDate;
107
        private String modificationDate;
108
        private String owner;
109
        private String comments;
110
        private Color selectionColor = new Color(255, 255, 0);
111
        private ArrayList views = new ArrayList();
112
        private ArrayList tables = new ArrayList();
113
        private ArrayList maps = new ArrayList();
114
        private ArrayList extents = new ArrayList();
115
        private int signatureAtStartup;
116
        // used to restore the position of the Project Manager window when loading a project from file
117
        private static WindowInfo seedProjectWindow = null;
118

    
119

    
120
        /**
121
         * Creates a new Project object.
122
         */
123
        public Project() {
124
                change = new PropertyChangeSupport(this);
125

    
126
                //        change.addPropertyChangeListener(this);
127
                creationDate = DateFormat.getDateInstance().format(new Date());
128
                modificationDate = creationDate;
129
//                signatureAtStartup = computeSignature();
130

    
131
                /*                LayerFactory.setDriversPath(PluginServices.getPluginServices(this)
132
                   .getPluginDirectory()
133
                   .getAbsolutePath() +
134
                   File.separator + "drivers");
135
                 */
136
        }
137

    
138
        /**
139
         * Obtiene la fecha de creaci?n del proyecto
140
         *
141
         * @return
142
         */
143
        public String getCreationDate() {
144
                return creationDate;
145
        }
146

    
147
        /**
148
         * Obtiene el nombre del proyecto
149
         *
150
         * @return
151
         */
152
        public String getName() {
153
                return name;
154
        }
155

    
156
//        /**
157
//         * Obtiene la ruta completa del fichero donde se guardo por ?ltima vez el
158
//         * proyecto
159
//         *
160
//         * @return
161
//         */
162
//        public String getPath() {
163
//                return path;
164
//        }
165

    
166
        /**
167
         * Asigna la fecha de creaci?n del proyecto. Este m?todo tiene sentido s?lo
168
         * por que al recuperar la fecha del XML hay que asignarla al objeto
169
         * proyecto de alguna manera. La fecha se asigna en el constructor y no se
170
         * deber?a de modificar nunca
171
         *
172
         * @param string
173
         */
174
        public void setCreationDate(String string) {
175
                creationDate = string;
176
                modified = true;
177
                change.firePropertyChange("", null, null);
178
        }
179

    
180
        /**
181
         * A?ade un mapa al proyecto
182
         *
183
         * @param m
184
         */
185
        public void addMap(ProjectMap m) {
186
                maps.add(m);
187
                m.addPropertyChangeListener(this);
188
                modified = true;
189
                change.firePropertyChange("", null, null);
190
                m.setProject(this, maps.size() - 1);
191
        }
192

    
193
        /**
194
         * Elimina un mapa del proyecto
195
         *
196
         * @param i indice del mapa
197
         */
198
        public void delMap(int i) {
199
                maps.remove(i);
200
                modified = true;
201
                change.firePropertyChange("", null, null);
202
        }
203

    
204
        /**
205
         * Establece el nombre del proyecto
206
         *
207
         * @param string
208
         */
209
        public void setName(String string) {
210
                name = string;
211
                modified = true;
212
                change.firePropertyChange("", null, null);
213
        }
214

    
215
//        /**
216
//         * establece la ruta completa de donde se encuentra guardado el proyecto
217
//         *
218
//         * @param string
219
//         */
220
//        public void setPath(String string) {
221
//                path = string;
222
//                modified = true;
223
//                change.firePropertyChange("", null, null);
224
//        }
225

    
226
        /**
227
         * DOCUMENT ME!
228
         *
229
         * @param co DOCUMENT ME!
230
         *
231
         * @return DOCUMENT ME!
232
         */
233
        public ProjectTable getTable(AlphanumericData co) {
234
                /**
235
                 * Como las tablas se pueden a?adir cuando se pincha en "ver tabla" de
236
                 * una capa, se puede intentar a?adir dos veces la misma tabla
237
                 */
238
                for (int i = 0; i < tables.size(); i++) {
239
                        if (((ProjectTable) tables.get(i)).getAssociatedTable() == co) {
240
                                return (ProjectTable) tables.get(i);
241
                        }
242
                }
243

    
244
                return null;
245
        }
246

    
247
        public ProjectTable getTable(String name) {
248
                /**
249
                 * Como las tablas se pueden a?adir cuando se pincha en "ver tabla" de
250
                 * una capa, se puede intentar a?adir dos veces la misma tabla
251
                 */
252
                for (int i = 0; i < tables.size(); i++) {
253
                        if (((ProjectTable) tables.get(i)).getName().equals(name)) {
254
                                return (ProjectTable) tables.get(i);
255
                        }
256
                }
257

    
258
                return null;
259
        }
260

    
261
        /**
262
         * A?ade una tabla al proyecto
263
         *
264
         * @param t
265
         */
266
        public void addTable(ProjectTable t) {
267
                tables.add(t);
268
                t.addPropertyChangeListener(this);
269
                modified = true;
270
                change.firePropertyChange("", null, null);
271
                t.setProject(this, tables.size() - 1);
272
        }
273

    
274
        /**
275
         * Elimina una tabla del proyecto
276
         *
277
         * @param i indice de la tabla
278
         */
279
        public void delTable(int i) {
280
                tables.remove(i);
281
                modified = true;
282
                change.firePropertyChange("", null, null);
283
        }
284

    
285
        /**
286
         * A?ade una vista al proyecto
287
         *
288
         * @param v
289
         */
290
        public void addView(ProjectView v) {
291
                views.add(v);
292
                v.addPropertyChangeListener(this);
293
                modified = true;
294
                change.firePropertyChange("", null, null);
295
                v.setProject(this, views.size() - 1);
296
        }
297

    
298
        /**
299
         * Elimina una tabla del proyecto
300
         *
301
         * @param i indice del proyecto
302
         */
303
        public void delView(int k) {
304
                ProjectView pv=(ProjectView)views.get(k);
305
                FLayers layers=pv.getMapContext().getLayers();
306

    
307
                for (int i = layers.getLayersCount()-1; i>=0; i--){
308
                try {
309
                        if (layers.getLayer(i) instanceof AlphanumericData){
310
                    Project project = ((ProjectExtension)PluginServices.getExtension(ProjectExtension.class)).getProject();
311
                    ProjectTable pt = project.getTable((AlphanumericData) layers.getLayer(i));
312

    
313
                    ArrayList tables = project.getTables();
314
                    for (int j = 0; j < tables.size(); j++) {
315
                        if (tables.get(j) == pt){
316
                            project.delTable(j);
317
                            break;
318
                        }
319
                    }
320

    
321
                    PluginServices.getMDIManager().closeSingletonWindow(pt);
322
                }
323
                layers.getLayer(i).getParentLayer().removeLayer(layers.getLayer(i));
324
                        } catch (CancelationException e1) {
325
                            e1.printStackTrace();
326
                    }
327
            }
328
                views.remove(k);
329
                modified = true;
330
                change.firePropertyChange("", null, null);
331
        }
332

    
333
        /**
334
         * Devuelve true si el proyecto (o alguna tabla, vista o mapa que contiene)
335
         * fue modificado
336
         *
337
         * @return
338
         */
339
        public boolean isModified() {
340
                if (this.getMaps().size()==0 && this.getViews().size()==0 && this.getTables().size() == 0){
341
                        return false;
342
                }
343
                return true;
344
                ///return modified;    TODO El atributo modified solo detecta cuando se elimina o a?ade una vista,
345
                ///mapa o tabla pero no cuando se modifican.
346
        }
347

    
348
        /**
349
         * Obtiene los comentarios
350
         *
351
         * @return
352
         */
353
        public String getComments() {
354
                return comments;
355
        }
356

    
357
        /**
358
         * Obtiene la fecha de la ?ltima modificaci?n
359
         *
360
         * @return
361
         */
362
        public String getModificationDate() {
363
                return modificationDate;
364
        }
365

    
366
        /**
367
         * Obtiene el propietario del proyecto
368
         *
369
         * @return
370
         */
371
        public String getOwner() {
372
                return owner;
373
        }
374

    
375
        /**
376
         * Establece una cadena como comentarios al proyecto
377
         *
378
         * @param string
379
         */
380
        public void setComments(String string) {
381
                comments = string;
382
                modified = true;
383
                change.firePropertyChange("", null, null);
384
        }
385

    
386
        /**
387
         * Establece la fecha de la ?ltima modificaci?n
388
         *
389
         * @param string
390
         */
391
        public void setModificationDate(String string) {
392
                modificationDate = string;
393
                modified = true;
394
                change.firePropertyChange("", null, null);
395
        }
396

    
397
        /**
398
         * Establece el propietario del proyecto
399
         *
400
         * @param string
401
         */
402
        public void setOwner(String string) {
403
                owner = string;
404
                modified = true;
405
                change.firePropertyChange("", null, null);
406
        }
407

    
408
        /**
409
         * Establece el flag de modificado del proyecto
410
         *
411
         * @param b
412
         */
413
        public void setModified(boolean b) {
414
                modified = b;
415
        }
416

    
417
        /**
418
         * Obtiene el color de selecci?n que se usar? en el proyecto
419
         *
420
         * @return
421
         */
422
        public Color getSelectionColor() {
423
                return selectionColor;
424
        }
425

    
426
        /**
427
         * Establece el color de selecci?n
428
         *
429
         * @param color
430
         */
431
        public void setSelectionColor(Color color) {
432
                selectionColor = color;
433
                FSymbol.setSelectionColor(color);
434
                modified = true;
435
                change.firePropertyChange("selectionColor", null, color);
436
        }
437

    
438
        /**
439
         * Obtiene el color como un entero para su serializaci?n a XML
440
         *
441
         * @return
442
         */
443
        public String getColor() {
444
                return StringUtilities.color2String(selectionColor);
445
        }
446

    
447
        /**
448
         * M?todo invocado al recuperar de XML para establecer el color de
449
         * seleccion del proyecto
450
         *
451
         * @param color Entero que representa un color
452
         */
453
        public void setColor(String color) {
454
                modified = true;
455
                selectionColor = StringUtilities.string2Color(color);
456
        }
457

    
458
        /* (non-Javadoc)
459
         * @see java.beans.PropertyChangeListener#propertyChange(java.beans.PropertyChangeEvent)
460
         */
461
        public void propertyChange(PropertyChangeEvent evt) {
462
                this.modified = true;
463
                change.firePropertyChange(evt);
464
        }
465

    
466
        /**
467
         * DOCUMENT ME!
468
         *
469
         * @param arg1
470
         */
471
        public void addExtent(ProjectExtent arg1) {
472
                extents.add(arg1);
473
                modified = true;
474
                change.firePropertyChange("addExtent", null, null);
475
        }
476

    
477
        /**
478
         * DOCUMENT ME!
479
         *
480
         * @param arg0
481
         *
482
         * @return
483
         */
484
        public Object removeExtent(int arg0) {
485
                modified = true;
486
                change.firePropertyChange("delExtent", null, null);
487

    
488
                return extents.remove(arg0);
489
        }
490

    
491
        /**
492
         * DOCUMENT ME!
493
         *
494
         * @return DOCUMENT ME!
495
         */
496
        public ProjectExtent[] getExtents() {
497
                return (ProjectExtent[]) extents.toArray(new ProjectExtent[0]);
498
        }
499

    
500
        /**
501
         * DOCUMENT ME!
502
         *
503
         * @param arg0
504
         */
505
        public synchronized void addPropertyChangeListener(
506
                PropertyChangeListener arg0) {
507
                change.addPropertyChangeListener(arg0);
508
        }
509

    
510
        /**
511
         * DOCUMENT ME!
512
         *
513
         * @return
514
         */
515
        public ArrayList getMaps() {
516
                return maps;
517
        }
518

    
519
        /**
520
         * DOCUMENT ME!
521
         *
522
         * @return
523
         */
524
        public ArrayList getTables() {
525
                return tables;
526
        }
527

    
528
        /**
529
         * DOCUMENT ME!
530
         *
531
         * @return
532
         */
533
        public ArrayList getViews() {
534
                return views;
535
        }
536

    
537
        /**
538
         * DOCUMENT ME!
539
         *
540
         * @return DOCUMENT ME!
541
         *
542
         * @throws DriverException
543
         * @throws XMLException
544
         */
545
        public XMLEntity getXMLEntity() throws DriverException, XMLException {
546
                XMLEntity xml = new XMLEntity();
547
                xml.putProperty("className", this.getClass().getName());
548
                xml.putProperty("VERSION", VERSION);
549
                xml.putProperty("comments", comments);
550
                xml.putProperty("creationDate", creationDate);
551

    
552
                int numExtents = extents.size();
553

    
554
                /*double[] xs = new double[size];
555
                   double[] ys = new double[size];
556
                   double[] ws = new double[size];
557
                   double[] hs = new double[size];
558
                 */
559
                xml.putProperty("numExtents", numExtents);
560

    
561
                for (int i = 0; i < numExtents; i++) {
562
                        /*        Rectangle2D rect = (Rectangle2D) extents.get(i);
563
                           xs[i] = rect.getX();
564
                           ys[i] = rect.getY();
565
                           ws[i] = rect.getWidth();
566
                           hs[i] = rect.getHeight();
567
                         */
568
                        xml.addChild(((ProjectExtent) extents.get(i)).getXMLEntity());
569
                }
570

    
571
        // NUEVO: ESTO ESTA EN PRUEBAS. SIRVE PARA
572
        // BORRAR LAS REFERENCIAS A DATASOURCES QUE HEMOS
573
        // BORRADO. Hay que probar a borrarlos cuando se
574
        // borra una tabla y cuando se borra una capa.
575
        cleanBadReferences();
576
                SourceInfo[] infos = LayerFactory.getDataSourceFactory().getDriverInfos();
577
                xml.putProperty("data-source-count", infos.length);
578

    
579
                for (int i = 0; i < infos.length; i++) {
580
                        SourceInfo di = infos[i];
581
                        XMLEntity child = this.getSourceInfoXMLEntity(di);
582
                        xml.addChild(child);
583
                }
584

    
585
                /*
586
                   xml.putProperty("extentsX", xs);
587
                   xml.putProperty("extentsY", ys);
588
                   xml.putProperty("extentsW", ws);
589
                   xml.putProperty("extentsH", hs);
590
                 */
591

    
592
                int numViews=0;
593
                for (int i = 0; i < views.size(); i++) {
594
                        try {
595
                                XMLEntity xmlchild=((ProjectView) views.get(i)).getXMLEntity();
596
                                xml.addChild(xmlchild);
597
                                numViews++;
598
                        } catch (SaveException e) {
599
                                e.showError();
600
                        }
601
                }
602
                xml.putProperty("numViews", numViews);
603

    
604
                int numMaps=0;
605
                for (int i = 0; i < maps.size(); i++) {
606
                        try {
607
                                XMLEntity xmlchild=((ProjectMap) maps.get(i)).getXMLEntity();
608
                                xml.addChild(xmlchild);
609
                                numMaps++;
610
                        } catch (SaveException e) {
611
                                e.showError();
612
                        }
613
                }
614
                xml.putProperty("numMaps", numMaps);
615
                xml.putProperty("modificationDate", modificationDate);
616
                xml.putProperty("modified", modified);
617
                xml.putProperty("name", name);
618
                xml.putProperty("owner", owner);
619
                //xml.putProperty("path", path);
620
                xml.putProperty("selectionColor",
621
                        StringUtilities.color2String(selectionColor));
622

    
623
                int numTables=0;
624
                for (int i = 0; i < tables.size(); i++) {
625
                        try {
626
                                XMLEntity xmlchild=((ProjectTable) tables.get(i)).getXMLEntity();
627
                                xml.addChild(xmlchild);
628
                                numTables++;
629
                        } catch (SaveException e) {
630

    
631
                                e.showError();
632
                        }
633
                }
634
                xml.putProperty("numTables", numTables);
635
                xml.putProperty("projection", defaultProjection.getAbrev());
636

    
637
                // save the properties of the Project Manager window
638
                IWindow []andamiViews = PluginServices.getMDIManager().getAllWindows();
639
                for (int i=0; i<andamiViews.length; i++) {
640
                        if (andamiViews[i] instanceof ProjectWindow) {
641
                                ProjectWindow pw = (ProjectWindow) andamiViews[i];
642
                                try {
643
                                        XMLEntity xmlchild = null;
644
                                        xmlchild = getWindowInfoXMLEntity(pw);
645
                                        if (xmlchild!=null) {
646
                                                xml.addChild(xmlchild);
647
                                        }
648
                                }
649
                                catch (SaveException e){
650
                                        e.showError();
651
                                }
652
                        }
653
                }
654

    
655
                return xml;
656
        }
657
        /**
658
         * DOCUMENT ME!
659
         *
660
         * @param xml DOCUMENT ME!
661
         *
662
         * @return DOCUMENT ME!
663
         * @throws XMLException
664
         * @throws DriverException
665
         * @throws DriverIOException
666
         * @throws OpenException
667
         */
668
        public static Project createFromXML03(XMLEntity xml)
669
                throws OpenException {
670
                Project p = new Project();
671
                try{
672
                p.comments = xml.getStringProperty("comments");
673
                p.creationDate = xml.getStringProperty("creationDate");
674
/*
675
                double[] xs = xml.getDoubleArrayProperty("extentsX");
676
                double[] ys = xml.getDoubleArrayProperty("extentsY");
677
                double[] ws = xml.getDoubleArrayProperty("extentsW");
678
                double[] hs = xml.getDoubleArrayProperty("extentsH");
679
*/
680
                int numExtents=xml.getIntProperty("numExtents");
681
                for (int i = 0; i < numExtents; i++) {
682
                        ProjectExtent pe=ProjectExtent.createFromXML03(xml.getChild(i));
683
                        p.extents.add(pe);
684
                }
685

    
686
                int numViews = xml.getIntProperty("numViews");
687

    
688
                for (int i = numExtents; i < numViews+numExtents; i++) {
689
                        p.views.add(ProjectView.createFromXML03(xml.getChild(i), p));
690
                }
691

    
692
                int numMaps = xml.getIntProperty("numMaps");
693

    
694
                for (int i = numViews+numExtents; i < (numMaps + numViews+numExtents); i++) {
695
                        p.maps.add(ProjectMap.createFromXML03(xml.getChild(i), p));
696
                }
697

    
698
                p.modificationDate = xml.getStringProperty("modificationDate");
699
                p.modified = xml.getBooleanProperty("modified");
700
                p.name = xml.getStringProperty("name");
701
                p.owner = xml.getStringProperty("owner");
702
//                p.path = xml.getStringProperty("path");
703
                p.selectionColor = StringUtilities.string2Color(xml.getStringProperty(
704
                                        "selectionColor"));
705

    
706
                int numTables = xml.getIntProperty("numTables");
707

    
708
                for (int i = numExtents+numMaps + numViews; i < (numExtents+numTables + numMaps + numViews);
709
                                i++) {
710
                        p.tables.add(ProjectTable.createFromXML03(xml.getChild(i), p));
711
                }
712
                String strProj = xml.getStringProperty("projection");
713
                if (strProj != null)
714
                        Project.setProjection(ProjectionPool.get(strProj));
715
                }catch (Exception e) {
716
                        throw new OpenException(e,p.getClass().getName());
717
                }
718
                return p;
719
        }
720

    
721
        /**
722
         * DOCUMENT ME!
723
         *
724
         * @param xml DOCUMENT ME!
725
         *
726
         * @return DOCUMENT ME!
727
         *
728
         * @throws XMLException
729
         * @throws DriverException
730
         * @throws DriverIOException
731
         * @throws OpenException
732
         * @throws VersionException
733
         */
734
        public static Project createFromXML(XMLEntity xml)
735
                throws OpenException {
736

    
737
                int childNumber = 0;
738
                Project p = new Project();
739
                try{
740
                p.comments = xml.getStringProperty("comments");
741
                p.creationDate = xml.getStringProperty("creationDate");
742

    
743
                /*
744
                   double[] xs = xml.getDoubleArrayProperty("extentsX");
745
                   double[] ys = xml.getDoubleArrayProperty("extentsY");
746
                   double[] ws = xml.getDoubleArrayProperty("extentsW");
747
                   double[] hs = xml.getDoubleArrayProperty("extentsH");
748
                 */
749
                int numExtents = xml.getIntProperty("numExtents");
750

    
751
                for (int i = 0; i < numExtents; i++) {
752
                        ProjectExtent pe = ProjectExtent.createFromXML(xml.getChild(i));
753
                        p.extents.add(pe);
754
                }
755

    
756
                childNumber = numExtents;
757

    
758
                int numDataSources = xml.getIntProperty("data-source-count");
759

    
760
                for (int i = childNumber; i < (childNumber + numDataSources); i++) {
761
                        XMLEntity child = xml.getChild(i);
762

    
763
                        if (child.getStringProperty("type").equals("otherDriverFile")) {
764
                                LayerFactory.getDataSourceFactory().addFileDataSource(child.getStringProperty(
765
                                                "driverName"), child.getStringProperty("gdbmsname"),
766
                                        child.getStringProperty("file"));
767
                        } else if (child.getStringProperty("type").equals("sameDriverFile")) {
768
                                /*                                String layerName = child.getStringProperty("layerName");
769
                                   ProjectView vista = project.getViewByName(child.getStringProperty(
770
                                   "viewName"));
771
                                   FLayer layer = vista.getMapContext().getLayers().getLayer(layerName);
772

773
                                   modelo = ((AlphanumericData) layer).getRecordset();
774
                                   associatedTable = (AlphanumericData) layer;
775
                                 */
776
                        } else if (child.getStringProperty("type").equals("db")) {
777
                                LayerFactory.getDataSourceFactory().addDBDataSourceByTable(child.getStringProperty(
778
                                                "gdbmsname"), child.getStringProperty("host"),
779
                                        child.getIntProperty("port"),
780
                                        child.getStringProperty("user"),
781
                                        child.getStringProperty("password"),
782
                                        child.getStringProperty("dbName"),
783
                                        child.getStringProperty("tableName"),
784
                                        child.getStringProperty("driverInfo"));
785
                        }
786
                }
787

    
788
                childNumber += numDataSources;
789

    
790
                int numViews = xml.getIntProperty("numViews");
791

    
792
                for (int i = childNumber; i < (numViews + childNumber); i++) {
793
                        try{
794
                                ProjectView pv = (ProjectView) ProjectView.createFromXML(xml.getChild(i), p);
795
                                p.addView(pv);
796
                                if (pv.getSeedViewInfo()!=null) { // open the view, if it was open, and restore its dimensions
797
                                        com.iver.cit.gvsig.gui.View vista = new com.iver.cit.gvsig.gui.View();
798
                                        vista.setModel(pv);
799
                                        PluginServices.getMDIManager().addWindow(vista);
800
                                        PluginServices.getMDIManager().changeWindowInfo(vista, pv.getSeedViewInfo());
801
                                }
802
                        }catch(OpenException e){
803
                                e.showError();
804
                        }
805
                }
806

    
807
                childNumber += numViews;
808

    
809
                int numMaps = xml.getIntProperty("numMaps");
810

    
811
                for (int i = childNumber; i < (numMaps + childNumber); i++) {
812
                        try{
813
                                // p.maps.add(ProjectMap.createFromXML(xml.getChild(i), p));
814
                                ProjectMap map = (ProjectMap) ProjectMap.createFromXML(xml.getChild(i), p);
815
                                p.maps.add(map);
816
                                if (map.getSeedViewInfo()!=null) { // open the view, if it was open, and restore its dimensions
817
                                        map.getModel().setProjectMap(map);
818
                                        PluginServices.getMDIManager().addWindow(map.getModel());
819
                                        PluginServices.getMDIManager().changeWindowInfo(map.getModel(), map.getSeedViewInfo());
820
                                }
821
                        }catch(OpenException e){
822
                                e.showError();
823
                        }
824
                }
825

    
826
                childNumber += numMaps;
827
                p.modificationDate = xml.getStringProperty("modificationDate");
828
                p.modified = xml.getBooleanProperty("modified");
829
                p.name = xml.getStringProperty("name");
830
                p.owner = xml.getStringProperty("owner");
831
//                p.path = xml.getStringProperty("path");
832
                p.selectionColor = StringUtilities.string2Color(xml.getStringProperty(
833
                                        "selectionColor"));
834

    
835
                int numTables = xml.getIntProperty("numTables");
836

    
837
                for (int i = childNumber; i < (childNumber + numTables); i++) {
838
                        try{
839
                                ProjectTable ptable = (ProjectTable) ProjectTable.createFromXML(xml.getChild(i), p);
840
                                p.tables.add(ptable);
841
                                if (ptable.getSeedViewInfo()!=null && ptable.getAndamiView()!=null) { // open the view, if it was open, and restore its dimensions
842
                                        PluginServices.getMDIManager().addWindow(ptable.getAndamiView());
843
                                        PluginServices.getMDIManager().changeWindowInfo(ptable.getAndamiView(), ptable.getSeedViewInfo());
844
                                }
845
                        }catch(OpenException e){
846
                                e.showError();
847
                        }
848
                }
849

    
850

    
851
                /* The project window defines its own size!!
852
                childNumber += numTables;
853
                if (childNumber < xml.getNumChild()) { // restore the position of the project manager window
854
                        XMLEntity child = xml.getChild(childNumber);
855
                        if (child.contains("className")
856
                                        && child.getStringProperty("className").equals("com.iver.cit.gvsig.project.Project")
857
                                        && child.contains("name")
858
                                        && child.getStringProperty("name").equals("ViewInfoProperties")) {
859
                                seedProjectWindow = Project.createViewInfoFromXMLEntity(xml.getChild(childNumber));
860
                        }
861
                }
862
                 */
863

    
864
                p.setLinkTable();
865

    
866
                String strProj = xml.getStringProperty("projection");
867

    
868
                if (strProj != null) {
869
                        Project.setProjection(ProjectionPool.get(strProj));
870
                }
871
        PostProcessSupport.executeCalls();
872
                }catch (Exception e) {
873
                        throw new OpenException(e,p.getClass().getName());
874
                }
875
//                p.setSignature( p.hashCode());
876
                return p;
877

    
878
        }
879

    
880
//        private void setSignature(int signature) {
881
//                this.signatureAtStartup = computeSignature();
882
//        }
883

    
884
        /**
885
         * Reestablece los link que ten?a cada tabla con las dem?s.
886
         */
887
        public void setLinkTable() {
888
                ArrayList tables = getTables();
889

    
890
                for (int i = 0; i < tables.size(); i++) {
891
                        for (int j = 0; j < tables.size(); j++) {
892
                                /*System.out.println("name = " +
893
                                        ((ProjectTable) tables.get(j)).getModelo().getName());
894
                                System.out.println("linktable = " +
895
                                        ((ProjectTable) tables.get(i)).getLinkTable());
896
*/
897
                                try {
898
                                if ((((ProjectTable) tables.get(i)).getLinkTable() != null) &&
899
                                                ((ProjectTable) tables.get(i)).getLinkTable().equals(((ProjectTable) tables
900
                                                                                                                                                                  .get(
901
                                                                j)).getModelo().getRecordset().getName())) {
902
                                        LinkSelectionListener lsl;
903

    
904
                                                lsl = new LinkSelectionListener((SelectableDataSource)((ProjectTable) tables.get(
905
                                                                        i)).getModelo().getRecordset(),
906
                                                                        (SelectableDataSource)((ProjectTable) tables.get(j)).getModelo().getRecordset(),
907
                                                                ((ProjectTable) tables.get(i)).getField1(),
908
                                                                ((ProjectTable) tables.get(i)).getField2());
909

    
910
                                                ((SelectableDataSource)((ProjectTable) tables.get(i)).getModelo().getRecordset())
911
                                         .addSelectionListener(lsl);
912

    
913
                                }
914
                                } catch (DriverLoadException e) {
915
                                        // TODO Auto-generated catch block
916
                                        e.printStackTrace();
917
                                }
918
                        }
919
                }
920
        }
921

    
922
        /**
923
         * Obtiene la vista que contiene a la capa que se pasa como par?metro
924
         *
925
         * @param layer Capa cuya vista se quiere obtener
926
         *
927
         * @return
928
         *
929
         * @throws RuntimeException Si la capa que se pasa como par?metro no se
930
         *                    encuentra en ninguna vista
931
         */
932
        public String getView(FLayer layer) {
933
                for (int v = 0; v < views.size(); v++) {
934
                        ProjectView pView = (ProjectView) views.get(v);
935
                        FLayers layers = pView.getMapContext().getLayers();
936
                        if (isView(layers,layer))return pView.getName();
937
                }
938

    
939
                throw new RuntimeException("The layer is not in a view");
940
        }
941

    
942
        public boolean isView(FLayers layers, FLayer layer) {
943
                for (int i = 0; i < layers.getLayersCount(); i++) {
944
                        if (layers.getLayer(i) instanceof FLayers){
945
                                return isView((FLayers)layers.getLayer(i),layer);
946
                        }else{
947
                                if (layers.getLayer(i) == layer) {
948
                                        return true;
949
                                }
950
                        }
951
                }
952
                return false;
953
        }
954

    
955
        /**
956
         * Devuelve la vista cuyo nombre coincide (sensible a mayusculas) con el
957
         * que se pasa como par?metro. Devuelve null si no hay ninguna vista con
958
         * ese nombre
959
         *
960
         * @param viewName Nombre de la vista que se quiere obtener
961
         *
962
         * @return DOCUMENT ME!
963
         */
964
        public ProjectView getViewByName(String viewName) {
965
                Object o = getProjectElementByName(viewName, views);
966

    
967
                if (o == null) {
968
                        return null;
969
                }
970

    
971
                return (ProjectView) o;
972
        }
973

    
974
        /**
975
         * DOCUMENT ME!
976
         *
977
         * @return DOCUMENT ME!
978
         */
979
        public static IProjection getProjection() {
980
                return defaultProjection;
981
        }
982

    
983
        /**
984
         * DOCUMENT ME!
985
         *
986
         * @param defaultProjection DOCUMENT ME!
987
         */
988
        public static void setProjection(IProjection defaultProjection) {
989
                Project.defaultProjection = defaultProjection;
990
        }
991

    
992
        /**
993
         * DOCUMENT ME!
994
         *
995
         * @param name DOCUMENT ME!
996
         * @param l DOCUMENT ME!
997
         *
998
         * @return DOCUMENT ME!
999
         */
1000
        private Object getProjectElementByName(String name, ArrayList l) {
1001
                for (Iterator iter = l.iterator(); iter.hasNext();) {
1002
                        ProjectElement elem = (ProjectElement) iter.next();
1003

    
1004
                        if (elem.getName().equals(name)) {
1005
                                return elem;
1006
                        }
1007
                }
1008

    
1009
                return null;
1010
        }
1011

    
1012
        /**
1013
         * DOCUMENT ME!
1014
         *
1015
         * @param name
1016
         *
1017
         * @return
1018
         */
1019
        public ProjectTable getTableByName(String name) {
1020
                Object o = getProjectElementByName(name, tables);
1021

    
1022
                if (o == null) {
1023
                        return null;
1024
                }
1025

    
1026
                return (ProjectTable) o;
1027
        }
1028

    
1029
        /**
1030
         * DOCUMENT ME!
1031
         *
1032
         * @param name
1033
         *
1034
         * @return
1035
         */
1036
        public ProjectMap getLayoutByName(String name) {
1037
                Object o = getProjectElementByName(name, maps);
1038

    
1039
                if (o == null) {
1040
                        return null;
1041
                }
1042

    
1043
                return (ProjectMap) o;
1044
        }
1045

    
1046
    public SelectableDataSource getDataSourceByLayer(FLayer layer) throws DriverException {
1047
        ArrayList tables = getTables();
1048
        SelectableDataSource dataSource = null;
1049
        try {
1050
        for (int i = 0; i < tables.size(); i++) {
1051
            ProjectTable pt = (ProjectTable) tables.get(i);
1052
            if (pt.getOriginal() == ((AlphanumericData) layer).getRecordset()){
1053
                dataSource = (SelectableDataSource)pt.getModelo().getRecordset();
1054
                break;
1055
            }else if (pt.getModelo() == ((AlphanumericData) layer).getRecordset()){
1056

    
1057
                                        dataSource = (SelectableDataSource)pt.getModelo().getRecordset();
1058

    
1059
                break;
1060
            }
1061
        }
1062
        } catch (DriverLoadException e) {
1063
                        // TODO Auto-generated catch block
1064
                        e.printStackTrace();
1065
                }
1066

    
1067
        if (dataSource == null){
1068
            //No se ha creado la tabla asociada al tema
1069
            dataSource = ((AlphanumericData) layer).getRecordset();
1070
        }
1071

    
1072
        return dataSource;
1073

    
1074
    }
1075

    
1076
    /**
1077
     * Recorremos las capas y las tablas del proyecto, y creamos una lista
1078
     * con todos los datasources de GDBMS que estamos usando.
1079
     * Luego recorremos los que est?n registrados, y borramos
1080
     * aquellos que no est?n siendo usados, es decir, aquellos
1081
     * que no est?n en nuestra lista (un Hash con clave el nombre
1082
     * del GDBMS)
1083
     *
1084
     */
1085
    private void cleanBadReferences()
1086
    {
1087
        Hashtable usedDataSources = new Hashtable();
1088
        // Primero las tablas
1089
        int i, j;
1090
        try {
1091
        for (i=0; i<tables.size(); i++)
1092
        {
1093
            ProjectTable t = (ProjectTable) tables.get(i);
1094
            SelectableDataSource ds;
1095

    
1096
                                ds = (SelectableDataSource)t.getModelo().getRecordset();
1097

    
1098
            if (t.getOriginal() != null)
1099
                usedDataSources.put(t.getOriginal().getRecordset().getName(), t.getOriginal());
1100
            usedDataSources.put(ds.getName(), ds);
1101
        }
1102
        } catch (DriverLoadException e) {
1103
                        // TODO Auto-generated catch block
1104
                        e.printStackTrace();
1105
                }
1106
        // Ahora las vistas
1107
        try {
1108
            for (i=0; i<views.size(); i++)
1109
            {
1110
                ProjectView pv = (ProjectView) views.get(i);
1111

    
1112
                FLayers lyrs = pv.getMapContext().getLayers();
1113

    
1114
                for (j=0; j<lyrs.getLayersCount(); j++)
1115
                {
1116
                    FLayer lyr = lyrs.getLayer(j);
1117
                    if (lyr instanceof FLyrVect)
1118
                    {
1119
                        FLyrVect lyrVect = (FLyrVect) lyr;
1120
                        if (lyrVect.isAvailable())
1121
                                usedDataSources.put(lyrVect.getRecordset().getName(), lyrVect.getSource().getRecordset());
1122
                    }
1123
                }
1124
                MapContext aux = pv.getMapOverViewContext();
1125
                if (aux != null)
1126
                {
1127
                    FLayers lyrsOverview = aux.getLayers();
1128
                    for (j=0; j<lyrsOverview.getLayersCount(); j++)
1129
                    {
1130
                        FLayer lyr = lyrsOverview.getLayer(j);
1131
                        if (lyr instanceof FLyrVect)
1132
                        {
1133
                            FLyrVect lyrVect = (FLyrVect) lyr;
1134
                            usedDataSources.put(lyrVect.getSource().getRecordset().getName(), lyrVect.getSource().getRecordset());
1135
                        }
1136
                    }
1137
                }
1138

    
1139
            } // for i
1140
        } catch (DriverLoadException e) {
1141
                        // TODO Auto-generated catch block
1142
                        e.printStackTrace();
1143
                } catch (DriverException e) {
1144
                        // TODO Auto-generated catch block
1145
                        e.printStackTrace();
1146
                }
1147
        // Recorremos los dataSources y los borramos si no
1148
        // los estamos usando.
1149
        SourceInfo[] infos = LayerFactory.getDataSourceFactory().getDriverInfos();
1150
        try {
1151
            for (i=0; i < infos.length; i++)
1152
            {
1153
                if (!usedDataSources.containsKey(infos[i].name))
1154
                {
1155
                    DataSource ds;
1156
                    ds = LayerFactory.getDataSourceFactory().createRandomDataSource(infos[i].name);
1157
                    ds.remove();
1158
                }
1159
            }
1160
        } catch (DriverLoadException e) {
1161
            // TODO Auto-generated catch block
1162
            e.printStackTrace();
1163
        } catch (NoSuchTableException e) {
1164
            // TODO Auto-generated catch block
1165
            e.printStackTrace();
1166
        } catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
1167
            // TODO Auto-generated catch block
1168
            e.printStackTrace();
1169
        }
1170
    }
1171

    
1172
    /**
1173
         * DOCUMENT ME!
1174
         *
1175
         * @return DOCUMENT ME!
1176
     * @throws SaveException
1177
         * @throws XMLException
1178
         * @throws SaveException
1179
         */
1180
        public XMLEntity getWindowInfoXMLEntity(IWindow window) throws SaveException {
1181
                if (window!=null && PluginServices.getMDIManager().getWindowInfo(window)!=null) {
1182
                        WindowInfo vi = PluginServices.getMDIManager().getWindowInfo(window);
1183
                        XMLEntity xml = new XMLEntity();
1184
                        //xml.putProperty("nameClass", this.getClass().getName());
1185
                        try{
1186
                                xml.setName("ViewInfoProperties");
1187
                                xml.putProperty("className", this.getClass().getName());
1188
                                xml.putProperty("X", vi.getX());
1189
                                xml.putProperty("Y", vi.getY());
1190
                                xml.putProperty("Width", vi.getWidth());
1191
                                xml.putProperty("Height", vi.getHeight());
1192
                                xml.putProperty("isVisible", vi.isVisible());
1193
                                xml.putProperty("isResizable", vi.isResizable());
1194
                                xml.putProperty("isMaximizable", vi.isMaximizable());
1195
                                xml.putProperty("isModal", vi.isModal());
1196
                                xml.putProperty("isModeless", vi.isModeless());
1197
                                xml.putProperty("isClosed", vi.isClosed());
1198
                                if (vi.isMaximized()==true) {
1199
                                        xml.putProperty("isMaximized", vi.isMaximized());
1200
                                        xml.putProperty("normalX", vi.getNormalX());
1201
                                        xml.putProperty("normalY", vi.getNormalY());
1202
                                        xml.putProperty("normalWidth", vi.getNormalWidth());
1203
                                        xml.putProperty("normalHeight", vi.getNormalHeight());
1204
                                }
1205
                        }catch (Exception e) {
1206
                                throw new SaveException(e,this.getClass().getName());
1207
                        }
1208
                        return xml;
1209
                }
1210
                else
1211
                        return null;
1212
        }
1213

    
1214
        public static WindowInfo createWindowInfoFromXMLEntity(XMLEntity xml)
1215
        {
1216
                WindowInfo result = new WindowInfo();
1217
                result.setX(xml.getIntProperty("X"));
1218
                result.setY(xml.getIntProperty("Y"));
1219
                result.setHeight(xml.getIntProperty("Height"));
1220
                result.setWidth(xml.getIntProperty("Width"));
1221
                result.setClosed(xml.getBooleanProperty("isClosed"));
1222
                if (xml.contains("isMaximized")) {
1223
                        boolean maximized = xml.getBooleanProperty("isMaximized");
1224
                        result.setMaximized(maximized);
1225
                        if (maximized==true) {
1226
                                result.setNormalBounds(xml.getIntProperty("normalX"), xml.getIntProperty("normalY"), xml.getIntProperty("normalWidth"), xml.getIntProperty("normalHeight"));
1227
                        }
1228
                        else {
1229
                                result.setNormalBounds(result.getBounds());
1230
                        }
1231
                }
1232

    
1233
                return result;
1234
        }
1235

    
1236
        public static WindowInfo getSeedProjectWindow() {
1237
                return seedProjectWindow;
1238
        }
1239

    
1240
        public XMLEntity getSourceInfoXMLEntity(SourceInfo di) {
1241
                XMLEntity child = new XMLEntity();
1242

    
1243

    
1244
                if (di instanceof ObjectSourceInfo) {
1245
                        ObjectSourceInfo driver = (ObjectSourceInfo) di;
1246
                        child.putProperty("type", "sameDriverFile");
1247
                        child.putProperty("gdbmsname", driver.name);
1248
                } else if (di instanceof FileSourceInfo) {
1249
                        FileSourceInfo vfdi = (FileSourceInfo) di;
1250
                        child.putProperty("type", "otherDriverFile");
1251
                        child.putProperty("gdbmsname", vfdi.name);
1252
                        child.putProperty("file", vfdi.file);
1253
                        child.putProperty("driverName", vfdi.driverName);
1254
                } else if (di instanceof DBSourceInfo) {
1255
                        DBTableSourceInfo dbdi = (DBTableSourceInfo) di;
1256
                        child.putProperty("type", "db");
1257
                        child.putProperty("gdbmsname", dbdi.name);
1258
                        child.putProperty("dbms", dbdi.dbms);
1259
                        child.putProperty("host", dbdi.host);
1260
                        child.putProperty("port", dbdi.port);
1261
                        child.putProperty("user", dbdi.user);
1262
                        child.putProperty("password", dbdi.password);
1263
                        child.putProperty("dbName", dbdi.dbName);
1264
                        child.putProperty("tableName", dbdi.tableName);
1265
                        child.putProperty("driverInfo", dbdi.driverName);
1266
                }
1267

    
1268
                return child;
1269
        }
1270

    
1271
//        public boolean hasChanged() {
1272
//                return signatureAtStartup != computeSignature();
1273
//        }
1274

    
1275
//        public int computeSignature() {
1276
//
1277
////                /* TODO method also present in ProjectMap, ProjectTable,
1278
////                 *  ProjectView and ProjectExtent
1279
////                 */
1280
//                int result = 17;
1281
////
1282
////                Class clazz = getClass();
1283
////                Field[] fields = clazz.getDeclaredFields();
1284
////                for (int i = 0; i < fields.length; i++) {
1285
////                        try {
1286
////                                // don't compute following fields
1287
////                                if (fields[i].getName().equals("modificationDate")
1288
////                                                || fields[i].getName().equals("creationDate")
1289
////                                                || fields[i].getName().equals("signatureAtStartup")
1290
////                                                || fields[i].getName().equals("change")
1291
////                                                || Modifier.isStatic(fields[i].getModifiers()))
1292
////                                        continue;
1293
////
1294
////
1295
////                                String type = fields[i].getType().getName();
1296
////                                if (type.equals("boolean")) {
1297
////                                        result += 37 + ((fields[i].getBoolean(this)) ? 1 : 0);
1298
////                                } else if (type.equals("java.lang.String")) {
1299
////                                        Object v = fields[i].get(this);
1300
////                                        if (v == null) {
1301
////                                                result += 37;
1302
////                                                continue;
1303
////                                        }
1304
////                                        char[] chars = ((String) v).toCharArray();
1305
////                                        for (int j = 0; j < chars.length; j++) {
1306
////                                                result += 37 + (int) chars[i];
1307
////                                        }
1308
////                                } else if (type.equals("byte")) {
1309
////                                        result += 37 + (int) fields[i].getByte(this);
1310
////                                } else if (type.equals("char")) {
1311
////                                        result += 37 + (int) fields[i].getChar(this);
1312
////                                } else if (type.equals("short")) {
1313
////                                        result += 37 + (int) fields[i].getShort(this);
1314
////                                } else if (type.equals("int")) {
1315
////                                        result += 37 + fields[i].getInt(this);
1316
////                                } else if (type.equals("long")) {
1317
////                                        long f = fields[i].getLong(this) ;
1318
////                                        result += 37 + (f ^ (f >>> 32));
1319
////                                } else if (type.equals("float")) {
1320
////                                        result += 37 + Float.floatToIntBits(fields[i].getFloat(this));
1321
////                                } else if (type.equals("double")) {
1322
////                                        long f = Double.doubleToLongBits(fields[i].getDouble(this));
1323
////                                        result += 37 + (f ^ (f >>> 32));
1324
////                                } else {
1325
//////                                        Object obj = fields[i].get(this);
1326
//////                                        result += 37 + ((obj != null)? obj.hashCode() : 0);
1327
////                                }
1328
////                        } catch (Exception e) { e.printStackTrace(); }
1329
////
1330
////                }
1331
////
1332
////                for (int i = 0; i < views.size(); i++) {
1333
////                        ProjectView e = (ProjectView) views.get(i);
1334
////                        result += 37 + e.computeSignature();
1335
////                }
1336
////
1337
////                for (int i = 0; i < tables.size(); i++) {
1338
////                        ProjectTable e = (ProjectTable) tables.get(i);
1339
////                        result += 37 + e.computeSignature();
1340
////                }
1341
////
1342
////                for (int i = 0; i < maps.size(); i++) {
1343
////                        ProjectMap e = (ProjectMap) maps.get(i);
1344
////                        result += 37 + e.computeSignature();
1345
////                }
1346
////
1347
////                for (int i = 0; i < extents.size(); i++) {
1348
////                        ProjectExtent e = (ProjectExtent) extents.get(i);
1349
////                        result += 37 + e.computeSignature();
1350
////                }
1351
//
1352
//
1353
//                return result;
1354
//        }
1355

    
1356
}