Revision 2183 trunk/applications/appgvSIG/src/com/iver/cit/gvsig/project/Project.java
Project.java | ||
---|---|---|
57 | 57 |
import com.iver.cit.gvsig.fmap.layers.SelectableDataSource; |
58 | 58 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
59 | 59 |
import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData; |
60 |
import com.iver.cit.gvsig.fmap.operations.selection.LinkSelectionListener; |
|
60 | 61 |
|
61 | 62 |
import com.iver.utiles.StringUtilities; |
62 | 63 |
import com.iver.utiles.XMLEntity; |
... | ... | |
87 | 88 |
* @author Fernando Gonz?lez Cort?s |
88 | 89 |
*/ |
89 | 90 |
public class Project implements Serializable, PropertyChangeListener { |
90 |
public static String VERSION = "0.3"; |
|
91 |
public static String VERSION = "0.3-GISPLANET";
|
|
91 | 92 |
static private IProjection defaultProjection = ProjectionPool.get( |
92 | 93 |
"EPSG:23030"); |
93 | 94 |
private PropertyChangeSupport change; |
... | ... | |
113 | 114 |
// change.addPropertyChangeListener(this); |
114 | 115 |
creationDate = DateFormat.getDateInstance().format(new Date()); |
115 | 116 |
modificationDate = creationDate; |
116 |
/* LayerFactory.setDriversPath(PluginServices.getPluginServices(this) |
|
117 |
.getPluginDirectory() |
|
118 |
.getAbsolutePath() + |
|
119 |
File.separator + "drivers"); |
|
120 |
*/} |
|
121 | 117 |
|
118 |
/* LayerFactory.setDriversPath(PluginServices.getPluginServices(this) |
|
119 |
.getPluginDirectory() |
|
120 |
.getAbsolutePath() + |
|
121 |
File.separator + "drivers"); |
|
122 |
*/ |
|
123 |
} |
|
124 |
|
|
122 | 125 |
/** |
123 | 126 |
* Obtiene la fecha de creaci?n del proyecto |
124 | 127 |
* |
... | ... | |
171 | 174 |
m.addPropertyChangeListener(this); |
172 | 175 |
modified = true; |
173 | 176 |
change.firePropertyChange("", null, null); |
174 |
m.setProject(this, maps.size()-1);
|
|
177 |
m.setProject(this, maps.size() - 1);
|
|
175 | 178 |
} |
176 | 179 |
|
177 | 180 |
/** |
... | ... | |
238 | 241 |
t.addPropertyChangeListener(this); |
239 | 242 |
modified = true; |
240 | 243 |
change.firePropertyChange("", null, null); |
241 |
t.setProject(this, tables.size()-1);
|
|
244 |
t.setProject(this, tables.size() - 1);
|
|
242 | 245 |
} |
243 |
|
|
246 |
|
|
244 | 247 |
/** |
245 | 248 |
* Elimina una tabla del proyecto |
246 | 249 |
* |
... | ... | |
538 | 541 |
child.putProperty("password", dbdi.password); |
539 | 542 |
child.putProperty("dbName", dbdi.dbName); |
540 | 543 |
child.putProperty("tableName", dbdi.tableName); |
541 |
child.putProperty("driverInfo", dbdi.driverInfo);
|
|
544 |
child.putProperty("driverInfo", dbdi.driverName);
|
|
542 | 545 |
} |
543 | 546 |
|
544 | 547 |
xml.addChild(child); |
... | ... | |
579 | 582 |
|
580 | 583 |
return xml; |
581 | 584 |
} |
585 |
/** |
|
586 |
* DOCUMENT ME! |
|
587 |
* |
|
588 |
* @param xml DOCUMENT ME! |
|
589 |
* |
|
590 |
* @return DOCUMENT ME! |
|
591 |
* @throws XMLException |
|
592 |
* @throws DriverException |
|
593 |
* @throws DriverIOException |
|
594 |
*/ |
|
595 |
public static Project createFromXML03(XMLEntity xml) |
|
596 |
throws XMLException, DriverException, DriverIOException { |
|
597 |
Project p = new Project(); |
|
598 |
p.comments = xml.getStringProperty("comments"); |
|
599 |
p.creationDate = xml.getStringProperty("creationDate"); |
|
600 |
/* |
|
601 |
double[] xs = xml.getDoubleArrayProperty("extentsX"); |
|
602 |
double[] ys = xml.getDoubleArrayProperty("extentsY"); |
|
603 |
double[] ws = xml.getDoubleArrayProperty("extentsW"); |
|
604 |
double[] hs = xml.getDoubleArrayProperty("extentsH"); |
|
605 |
*/ |
|
606 |
int numExtents=xml.getIntProperty("numExtents"); |
|
607 |
for (int i = 0; i < numExtents; i++) { |
|
608 |
ProjectExtent pe=ProjectExtent.createFromXML03(xml.getChild(i)); |
|
609 |
p.extents.add(pe); |
|
610 |
} |
|
582 | 611 |
|
612 |
int numViews = xml.getIntProperty("numViews"); |
|
613 |
|
|
614 |
for (int i = numExtents; i < numViews+numExtents; i++) { |
|
615 |
p.views.add(ProjectView.createFromXML03(xml.getChild(i), p)); |
|
616 |
} |
|
617 |
|
|
618 |
int numMaps = xml.getIntProperty("numMaps"); |
|
619 |
|
|
620 |
for (int i = numViews+numExtents; i < (numMaps + numViews+numExtents); i++) { |
|
621 |
p.maps.add(ProjectMap.createFromXML03(xml.getChild(i), p)); |
|
622 |
} |
|
623 |
|
|
624 |
p.modificationDate = xml.getStringProperty("modificationDate"); |
|
625 |
p.modified = xml.getBooleanProperty("modified"); |
|
626 |
p.name = xml.getStringProperty("name"); |
|
627 |
p.owner = xml.getStringProperty("owner"); |
|
628 |
p.path = xml.getStringProperty("path"); |
|
629 |
p.selectionColor = StringUtilities.string2Color(xml.getStringProperty( |
|
630 |
"selectionColor")); |
|
631 |
|
|
632 |
int numTables = xml.getIntProperty("numTables"); |
|
633 |
|
|
634 |
for (int i = numExtents+numMaps + numViews; i < (numExtents+numTables + numMaps + numViews); |
|
635 |
i++) { |
|
636 |
p.tables.add(ProjectTable.createFromXML03(xml.getChild(i), p)); |
|
637 |
} |
|
638 |
String strProj = xml.getStringProperty("projection"); |
|
639 |
if (strProj != null) |
|
640 |
Project.setProjection(ProjectionPool.get(strProj)); |
|
641 |
|
|
642 |
return p; |
|
643 |
} |
|
644 |
|
|
583 | 645 |
/** |
584 | 646 |
* DOCUMENT ME! |
585 | 647 |
* |
... | ... | |
675 | 737 |
p.tables.add(ProjectTable.createFromXML(xml.getChild(i), p)); |
676 | 738 |
} |
677 | 739 |
|
740 |
p.setLinkTable(); |
|
741 |
|
|
678 | 742 |
String strProj = xml.getStringProperty("projection"); |
679 | 743 |
|
680 | 744 |
if (strProj != null) { |
... | ... | |
685 | 749 |
} |
686 | 750 |
|
687 | 751 |
/** |
752 |
* Reestablece los link que ten?a cada tabla con las dem?s. |
|
753 |
*/ |
|
754 |
public void setLinkTable() { |
|
755 |
ArrayList tables = getTables(); |
|
756 |
|
|
757 |
for (int i = 0; i < tables.size(); i++) { |
|
758 |
for (int j = 0; j < tables.size(); j++) { |
|
759 |
/*System.out.println("name = " + |
|
760 |
((ProjectTable) tables.get(j)).getModelo().getName()); |
|
761 |
System.out.println("linktable = " + |
|
762 |
((ProjectTable) tables.get(i)).getLinkTable()); |
|
763 |
*/ |
|
764 |
if ((((ProjectTable) tables.get(i)).getLinkTable() != null) && |
|
765 |
((ProjectTable) tables.get(i)).getLinkTable().equals(((ProjectTable) tables |
|
766 |
.get( |
|
767 |
j)).getModelo().getName())) { |
|
768 |
LinkSelectionListener lsl = new LinkSelectionListener(((ProjectTable) tables.get( |
|
769 |
i)).getModelo(), |
|
770 |
((ProjectTable) tables.get(j)).getModelo(), |
|
771 |
((ProjectTable) tables.get(i)).getField1(), |
|
772 |
((ProjectTable) tables.get(i)).getField2()); |
|
773 |
((ProjectTable) tables.get(i)).getModelo() |
|
774 |
.addSelectionListener(lsl); |
|
775 |
} |
|
776 |
} |
|
777 |
} |
|
778 |
} |
|
779 |
|
|
780 |
/** |
|
688 | 781 |
* Obtiene la vista que contiene a la capa que se pasa como par?metro |
689 | 782 |
* |
690 | 783 |
* @param layer Capa cuya vista se quiere obtener |
Also available in: Unified diff