root / trunk / applications / appgvSIG / src / com / iver / cit / gvsig / project / ProjectMap.java @ 2183
History | View | Annotate | Download (3.33 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 com.hardcode.gdbms.engine.data.driver.DriverException; |
44 |
|
45 |
import com.iver.cit.gvsig.fmap.layers.XMLException; |
46 |
import com.iver.cit.gvsig.gui.layout.Layout; |
47 |
|
48 |
import com.iver.utiles.XMLEntity; |
49 |
|
50 |
import java.text.DateFormat; |
51 |
|
52 |
import java.util.Date; |
53 |
|
54 |
|
55 |
/**
|
56 |
* DOCUMENT ME!
|
57 |
*
|
58 |
* @author Fernando Gonz?lez Cort?s
|
59 |
*/
|
60 |
public class ProjectMap extends ProjectElement { |
61 |
private static int numMaps = 0; |
62 |
private Layout model;
|
63 |
|
64 |
/**
|
65 |
* DOCUMENT ME!
|
66 |
*
|
67 |
* @param baseName DOCUMENT ME!
|
68 |
*
|
69 |
* @return DOCUMENT ME!
|
70 |
*/
|
71 |
public static ProjectMap createMap(String baseName) { |
72 |
ProjectMap m = new ProjectMap();
|
73 |
m.setName(baseName + " - " + numMaps);
|
74 |
m.setCreationDate(DateFormat.getInstance().format(new Date())); |
75 |
numMaps++; |
76 |
|
77 |
return m;
|
78 |
} |
79 |
|
80 |
/**
|
81 |
* @see com.iver.cit.gvsig.project.ProjectMap#getModel()
|
82 |
*/
|
83 |
public Layout getModel() {
|
84 |
return model;
|
85 |
} |
86 |
|
87 |
/**
|
88 |
* @see com.iver.cit.gvsig.project.ProjectMap#setMapContext(com.iver.cit.gvsig.project.castor.XMLEntity)
|
89 |
*/
|
90 |
public void setModel(Layout f) { |
91 |
model = f; |
92 |
f.setName(getName()); |
93 |
} |
94 |
|
95 |
/**
|
96 |
* @see com.iver.cit.gvsig.project.ProjectElement#setName(java.lang.String)
|
97 |
*/
|
98 |
public void setName(String string) { |
99 |
super.setName(string);
|
100 |
|
101 |
Layout m = getModel(); |
102 |
|
103 |
if (m != null) { |
104 |
m.setName(string); |
105 |
} |
106 |
} |
107 |
|
108 |
/**
|
109 |
* DOCUMENT ME!
|
110 |
*
|
111 |
* @return DOCUMENT ME!
|
112 |
* @throws XMLException
|
113 |
*
|
114 |
* @throws DriverException
|
115 |
*/
|
116 |
public XMLEntity getXMLEntity() throws XMLException { |
117 |
XMLEntity xml = super.getXMLEntity();
|
118 |
//xml.putProperty("nameClass", this.getClass().getName());
|
119 |
xml.putProperty("numMaps", numMaps);
|
120 |
xml.addChild(model.getXMLEntity()); |
121 |
|
122 |
return xml;
|
123 |
} |
124 |
|
125 |
/**
|
126 |
* @see com.iver.cit.gvsig.project.ProjectElement#setXMLEntity(com.iver.utiles.XMLEntity)
|
127 |
*/
|
128 |
public void setXMLEntity(XMLEntity xml, Project p) { |
129 |
numMaps = xml.getIntProperty("numMaps");
|
130 |
model = Layout.createLayout(xml.getChild(0), p);
|
131 |
} |
132 |
|
133 |
/**
|
134 |
* @see com.iver.cit.gvsig.project.ProjectElement#setXMLEntity(com.iver.utiles.XMLEntity)
|
135 |
*/
|
136 |
public void setXMLEntity03(XMLEntity xml, Project p) { |
137 |
numMaps = xml.getIntProperty("numMaps");
|
138 |
model = Layout.createLayout03(xml.getChild(0), p);
|
139 |
} |
140 |
} |