root / branches / v10 / extensions / extPublish / src / com / iver / cit / gvsig / publish / infoProject / ViewInfo.java @ 13570
History | View | Annotate | Download (5.02 KB)
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
---|---|
2 |
*
|
3 |
* Copyright (C) 2004-2006 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 Iba?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 |
/**
|
42 |
* @author Jos? Vicente Hig?n (josevicente.higon@iver.es)
|
43 |
*/
|
44 |
package com.iver.cit.gvsig.publish.infoProject; |
45 |
|
46 |
import java.util.ArrayList; |
47 |
|
48 |
import com.iver.andami.PluginServices; |
49 |
import com.iver.cit.gvsig.fmap.DriverException; |
50 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
51 |
import com.iver.cit.gvsig.fmap.layers.FLayers; |
52 |
import com.iver.cit.gvsig.fmap.layers.LayersIterator; |
53 |
import com.iver.cit.gvsig.project.documents.view.IProjectView; |
54 |
import com.iver.cit.gvsig.project.documents.view.ProjectView; |
55 |
|
56 |
|
57 |
/**
|
58 |
* This class represents the information about a gvSIG view
|
59 |
*
|
60 |
* TODO: Now we are writing the exceptions in the logfile, we must create
|
61 |
* our own exception in order to show to the user (gui).
|
62 |
*
|
63 |
* @author Jos? Vicente Hig?n (josevicente.higon@iver.es)
|
64 |
*
|
65 |
*/
|
66 |
public class ViewInfo implements IViewInfo { |
67 |
private ProjectView view = null; |
68 |
private ILayerInfo[] layers = null; |
69 |
/**
|
70 |
* Constructor
|
71 |
*/
|
72 |
public ViewInfo(ProjectView view){
|
73 |
this.view = view;
|
74 |
LayersIterator it = new LayersIterator(view.getMapContext().getLayers());
|
75 |
//move one position
|
76 |
it.nextLayer(); |
77 |
ArrayList list = new ArrayList(); |
78 |
while (it.hasNext()){
|
79 |
list.add(it.nextLayer()); |
80 |
} |
81 |
if (list.size()> 0){ |
82 |
this.layers = new LayerInfo[list.size()]; |
83 |
for ( int i = 0; i < list.size(); i++){ |
84 |
this.layers[i] = new LayerInfo((FLayer)list.get(i)); |
85 |
} |
86 |
} |
87 |
/*
|
88 |
FLayers lyrs = this.view.getMapContext().getLayers();
|
89 |
this.layers = new LayerInfo[lyrs.getLayersCount()];
|
90 |
for (int i=0; i < lyrs.getLayersCount(); i++){
|
91 |
FLayer lyr = lyrs.getLayer(i);
|
92 |
LayerInfo lyrinf = new DefaultLayerInfo(lyr);
|
93 |
this.layers[i] = lyrinf;
|
94 |
}*/
|
95 |
} |
96 |
/**
|
97 |
* @see ViewInf.getComment()
|
98 |
*/
|
99 |
public String getComment() { |
100 |
|
101 |
return this.view.getComment(); |
102 |
} |
103 |
/**
|
104 |
* @see ViewInf.getCreationDate()
|
105 |
*/
|
106 |
public String getCreationDate() { |
107 |
|
108 |
return this.view.getCreationDate(); |
109 |
} |
110 |
/**
|
111 |
* @see ViewInf.getMaxX()
|
112 |
*/
|
113 |
public double getMaxX() { |
114 |
double aux=0; |
115 |
try {
|
116 |
aux = this.view.getMapContext().getFullExtent().getMaxX();
|
117 |
} catch (DriverException e) {
|
118 |
PluginServices.getLogger().error("Can't get View MaX", e);
|
119 |
} |
120 |
return aux;
|
121 |
/*String aux = null;
|
122 |
try {
|
123 |
aux = Double.toString(this.view.getMapContext().getFullExtent().getMaxX());
|
124 |
} catch (DriverException e) {
|
125 |
PluginServices.getLogger().error("Can't get View MaX", e);
|
126 |
}
|
127 |
return aux;
|
128 |
*/
|
129 |
} |
130 |
/**
|
131 |
* @see ViewInf.getMaxY()
|
132 |
*/
|
133 |
public double getMaxY() { |
134 |
double aux=0; |
135 |
try {
|
136 |
aux = this.view.getMapContext().getFullExtent().getMaxY();
|
137 |
} catch (DriverException e) {
|
138 |
PluginServices.getLogger().error("Can't get View MaxY", e);
|
139 |
} |
140 |
return aux;
|
141 |
} |
142 |
/**
|
143 |
* @see ViewInf.getMinX()
|
144 |
*/
|
145 |
public double getMinX() { |
146 |
double aux=0; |
147 |
try {
|
148 |
aux = this.view.getMapContext().getFullExtent().getMinX();
|
149 |
} catch (DriverException e) {
|
150 |
PluginServices.getLogger().error("Can't get View MinX", e);
|
151 |
} |
152 |
return aux;
|
153 |
} |
154 |
/**
|
155 |
* @see ViewInf.getMinY()
|
156 |
*/
|
157 |
public double getMinY() { |
158 |
double aux=0; |
159 |
try {
|
160 |
aux = this.view.getMapContext().getFullExtent().getMinY();
|
161 |
} catch (DriverException e) {
|
162 |
PluginServices.getLogger().error("Can't get View MinY", e);
|
163 |
} |
164 |
return aux;
|
165 |
} |
166 |
/**
|
167 |
* @see ViewInf.getName()
|
168 |
*/
|
169 |
public String getName() { |
170 |
|
171 |
return this.view.getName(); |
172 |
} |
173 |
/**
|
174 |
* @see ViewInf.getOwner()
|
175 |
*/
|
176 |
public String getOwner() { |
177 |
|
178 |
return this.view.getOwner(); |
179 |
} |
180 |
/**
|
181 |
* @see ViewInf.getSRS()
|
182 |
*/
|
183 |
public String getSRS() { |
184 |
|
185 |
return this.view.getMapContext().getProjection().getAbrev(); |
186 |
} |
187 |
/**
|
188 |
* @see ViewInfo.IgetLayers()
|
189 |
*/
|
190 |
public ILayerInfo[] getLayers() { |
191 |
/*FLayers layers = this.view.getMapContext().getLayers();
|
192 |
LayerInfo[] res = new LayerInfo[layers.getLayersCount()];
|
193 |
for (int i=0; i < layers.getLayersCount(); i++){
|
194 |
FLayer lyr = layers.getLayer(i);
|
195 |
LayerInfo lyrinf = new DefaultLayerInfo(lyr);
|
196 |
res[i] = lyrinf;
|
197 |
}
|
198 |
return res;*/
|
199 |
return this.layers; |
200 |
} |
201 |
|
202 |
} |