svn-gvsig-desktop / branches / v10 / extensions / extPublish / src / org / gvsig / publish / infoproject / ViewInfo.java @ 22616
History | View | Annotate | Download (4.04 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 org.gvsig.publish.infoproject; |
45 |
|
46 |
import java.awt.geom.Rectangle2D; |
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.project.documents.view.ProjectView; |
53 |
|
54 |
|
55 |
/**
|
56 |
* This class represents the information about a gvSIG view
|
57 |
*
|
58 |
*
|
59 |
* @author Jos? Vicente Hig?n (josevicente.higon@iver.es)
|
60 |
*
|
61 |
*/
|
62 |
public class ViewInfo implements IViewInfo { |
63 |
private ProjectView view = null; |
64 |
private LayerInfo[] layers = null; |
65 |
private ProjectInfo project = null; |
66 |
|
67 |
/**
|
68 |
* Constructor
|
69 |
*
|
70 |
*/
|
71 |
public ViewInfo(ProjectView view, ProjectInfo projectInfo){
|
72 |
this.project = projectInfo;
|
73 |
this.view = view;
|
74 |
FLayers lyrs = this.view.getMapContext().getLayers();
|
75 |
this.layers = new LayerInfo[lyrs.getLayersCount()]; |
76 |
int j = lyrs.getLayersCount() -1 ; |
77 |
for (int i=0; i < lyrs.getLayersCount(); i++){ |
78 |
FLayer lyr = lyrs.getLayer(i); |
79 |
LayerInfo lyrinf = new LayerInfo(lyr,view, this, null); |
80 |
this.layers[j] = lyrinf;
|
81 |
j--; |
82 |
} |
83 |
|
84 |
} |
85 |
/**
|
86 |
*
|
87 |
* @see org.gvsig.publish.infoproject.IViewInfo#getComment()
|
88 |
*/
|
89 |
public String getComment() { |
90 |
|
91 |
return this.view.getComment(); |
92 |
} |
93 |
/**
|
94 |
*
|
95 |
* @see org.gvsig.publish.infoproject.IViewInfo#getCreationDate()
|
96 |
*/
|
97 |
public String getCreationDate() { |
98 |
|
99 |
return this.view.getCreationDate(); |
100 |
} |
101 |
/**
|
102 |
* @see ViewInf.getName()
|
103 |
*/
|
104 |
public String getName() { |
105 |
|
106 |
return this.view.getName(); |
107 |
} |
108 |
/**
|
109 |
* @see ViewInf.getOwner()
|
110 |
*/
|
111 |
public String getOwner() { |
112 |
|
113 |
return this.view.getOwner(); |
114 |
} |
115 |
/**
|
116 |
* @see ViewInf.getSRS()
|
117 |
*/
|
118 |
public String getEPSG() { |
119 |
|
120 |
return this.view.getMapContext().getProjection().getAbrev(); |
121 |
} |
122 |
/**
|
123 |
* @see ViewInfo.IgetLayers()
|
124 |
*/
|
125 |
public ILayerInfo[] getLayers() { |
126 |
return ProcessFilterProjectInfo.processor().process(getProjectInfo().getFilterProjectInfo(), this.layers); |
127 |
} |
128 |
/**
|
129 |
*
|
130 |
* @see java.lang.Object#toString()
|
131 |
*/
|
132 |
public String toString(){ |
133 |
return getName();
|
134 |
} |
135 |
/**
|
136 |
*
|
137 |
* @see org.gvsig.publish.infoProject.IViewInfo#getLayerInfoByName(java.lang.String)
|
138 |
*/
|
139 |
public ILayerInfo findLayer(String layerName) { |
140 |
ILayerInfo[] ilayers = getLayers();
|
141 |
for (int i = 0; i < ilayers.length; i++){ |
142 |
ILayerInfo target = ilayers[i].findLayer(layerName); |
143 |
if (target != null){ |
144 |
return target;
|
145 |
} |
146 |
} |
147 |
return null; |
148 |
} |
149 |
/**
|
150 |
*
|
151 |
* @see org.gvsig.publish.infoproject.IViewInfo#getBBox()
|
152 |
*/
|
153 |
public Rectangle2D getBBox() { |
154 |
Rectangle2D aux = null; |
155 |
try {
|
156 |
aux = this.view.getMapContext().getFullExtent();
|
157 |
} catch (DriverException e) {
|
158 |
PluginServices.getLogger().error("ERROR ViewInfo: Can't get Full extent", e);
|
159 |
} |
160 |
return aux;
|
161 |
} |
162 |
/**
|
163 |
*
|
164 |
* @see org.gvsig.publish.infoproject.IViewInfo#getProjectInfo()
|
165 |
*/
|
166 |
public IProjectInfo getProjectInfo() {
|
167 |
return project;
|
168 |
} |
169 |
|
170 |
} |