svn-gvsig-desktop / branches / v10 / extensions / extPublish / src / org / gvsig / publish / infoProject / ProjectInfo.java @ 14376
History | View | Annotate | Download (3.41 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 |
* This class implements IProjectInfo in order to give information about the gvSIG project
|
43 |
*
|
44 |
* @author Jos? Vicente Hig?n (josevicente.higon@iver.es)
|
45 |
*/
|
46 |
package org.gvsig.publish.infoProject; |
47 |
|
48 |
import java.util.ArrayList; |
49 |
import java.util.Iterator; |
50 |
|
51 |
|
52 |
import com.iver.cit.gvsig.project.Project; |
53 |
import com.iver.cit.gvsig.project.documents.view.ProjectView; |
54 |
import com.iver.cit.gvsig.project.documents.view.ProjectViewFactory; |
55 |
|
56 |
/**
|
57 |
* This class represents a gvSIG project information.
|
58 |
*
|
59 |
* @author Jos? Vicente Hig?n (josevicente.higon@iver.es)
|
60 |
*
|
61 |
*/
|
62 |
public class ProjectInfo implements IProjectInfo { |
63 |
private Project gvProject = null; |
64 |
/**
|
65 |
* Constructor
|
66 |
*
|
67 |
* @param prj gvSIG Project
|
68 |
*
|
69 |
*/
|
70 |
public ProjectInfo(Project gvProj){
|
71 |
this.gvProject = gvProj;
|
72 |
} |
73 |
|
74 |
/**
|
75 |
* @see IProjectInf.getName()
|
76 |
*/
|
77 |
public String getName() { |
78 |
return this.gvProject.getName(); |
79 |
} |
80 |
/**
|
81 |
* @see IProjectInf.getOwner()
|
82 |
*/
|
83 |
public String getOwner() { |
84 |
return this.gvProject.getOwner(); |
85 |
} |
86 |
/*
|
87 |
* @see IProjectInf.getActiveViewInfo()
|
88 |
*
|
89 |
public IViewInfo getActiveViewInfo() {
|
90 |
//get the ProjectView
|
91 |
ProjectView prjView = (ProjectView) activeView.getModel();
|
92 |
IViewInfo viewInfo = new ViewInfo(prjView);;
|
93 |
return viewInfo;
|
94 |
}*/
|
95 |
/**
|
96 |
* @return IViewInfo[] array with information about the views of the project
|
97 |
* TODO: I'm creating a new View info each time. I must improve that !!
|
98 |
*/
|
99 |
public IViewInfo[] getViewsInfo() { |
100 |
ArrayList aux = gvProject.getDocumentsByType(ProjectViewFactory.registerName);
|
101 |
|
102 |
IViewInfo[] arrayViewInfo = new IViewInfo[aux.size()]; |
103 |
|
104 |
int i = 0; |
105 |
for (Iterator it = aux.iterator(); it.hasNext(); i++){ |
106 |
ProjectView v = (ProjectView) it.next(); |
107 |
arrayViewInfo[i] = new ViewInfo(v);
|
108 |
} |
109 |
return arrayViewInfo;
|
110 |
} |
111 |
/**
|
112 |
* @see IProjectInfo#toString()
|
113 |
*/
|
114 |
public String toString(){ |
115 |
return getName();
|
116 |
} |
117 |
/**
|
118 |
* I am supposing the layer name is unique !!!
|
119 |
*
|
120 |
* @return ILayerInfo with name layerName. Null if doesn't exist
|
121 |
*/
|
122 |
public ILayerInfo getLayerInfoByName(String layerName) { |
123 |
IViewInfo[] iview = getViewsInfo();
|
124 |
for (int i = 0; i < iview.length; i++ ){ |
125 |
ILayerInfo ilayer = iview[i].getLayerInfoByName(layerName); |
126 |
if (ilayer != null){ |
127 |
return ilayer;
|
128 |
} |
129 |
} |
130 |
return null; |
131 |
} |
132 |
|
133 |
} |