svn-gvsig-desktop / trunk / extensions / ext3Dgui / src / org / gvsig / gvsig3dgui / layout / fframe / ListView3DModel.java @ 25358
History | View | Annotate | Download (4.28 KB)
1 |
/*
|
---|---|
2 |
* Created on 02-jun-2004
|
3 |
*
|
4 |
*/
|
5 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
|
6 |
*
|
7 |
* Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
|
8 |
*
|
9 |
* This program is free software; you can redistribute it and/or
|
10 |
* modify it under the terms of the GNU General Public License
|
11 |
* as published by the Free Software Foundation; either version 2
|
12 |
* of the License, or (at your option) any later version.
|
13 |
*
|
14 |
* This program is distributed in the hope that it will be useful,
|
15 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
17 |
* GNU General Public License for more details.
|
18 |
*
|
19 |
* You should have received a copy of the GNU General Public License
|
20 |
* along with this program; if not, write to the Free Software
|
21 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA.
|
22 |
*
|
23 |
* For more information, contact:
|
24 |
*
|
25 |
* Generalitat Valenciana
|
26 |
* Conselleria d'Infraestructures i Transport
|
27 |
* Av. Blasco Ib??ez, 50
|
28 |
* 46010 VALENCIA
|
29 |
* SPAIN
|
30 |
*
|
31 |
* +34 963862235
|
32 |
* gvsig@gva.es
|
33 |
* www.gvsig.gva.es
|
34 |
*
|
35 |
* or
|
36 |
*
|
37 |
* IVER T.I. S.A
|
38 |
* Salamanca 50
|
39 |
* 46005 Valencia
|
40 |
* Spain
|
41 |
*
|
42 |
* +34 963163400
|
43 |
* dac@iver.es
|
44 |
*/
|
45 |
package org.gvsig.gvsig3dgui.layout.fframe; |
46 |
|
47 |
import java.util.ArrayList; |
48 |
|
49 |
import javax.swing.AbstractListModel; |
50 |
import javax.swing.JOptionPane; |
51 |
|
52 |
import org.gvsig.gvsig3dgui.ProjectView3D; |
53 |
|
54 |
import com.iver.andami.PluginServices; |
55 |
import com.iver.cit.gvsig.ProjectExtension; |
56 |
import com.iver.cit.gvsig.project.documents.layout.fframes.IFFrame; |
57 |
import com.iver.cit.gvsig.project.documents.layout.gui.Layout; |
58 |
import com.iver.cit.gvsig.project.documents.view.ProjectViewBase; |
59 |
|
60 |
|
61 |
/**
|
62 |
* Modelo de la Lista de vistas a seleccionar.
|
63 |
*
|
64 |
* @author Vicente Caballero Navarro
|
65 |
*/
|
66 |
public class ListView3DModel extends AbstractListModel { |
67 |
private ArrayList views = new ArrayList(); |
68 |
|
69 |
/**
|
70 |
* A?ade las vistas que tiene el proyecto a la lista.
|
71 |
*/
|
72 |
// public void addViews() {
|
73 |
// ProjectExtension projectextension = (ProjectExtension) PluginServices.getExtension(com.iver.cit.gvsig.ProjectExtension.class);
|
74 |
// views = projectextension.getProject().getDocumentsByType(ProjectViewFactory.registerName);
|
75 |
// }
|
76 |
|
77 |
|
78 |
public void addViews() { |
79 |
ProjectExtension projectextension = (ProjectExtension) PluginServices |
80 |
.getExtension(com.iver.cit.gvsig.ProjectExtension.class); |
81 |
// views =
|
82 |
// projectextension.getProject().getDocumentsByType(ProjectViewFactory.registerName);
|
83 |
ArrayList todos = projectextension.getProject().getDocuments();
|
84 |
views.clear(); |
85 |
String vistas = "Las siguientes vistas que se muestran a continuacion no pueden " |
86 |
+ "introducirse en el mapa si no estan abiertas\n";
|
87 |
boolean exits = false; |
88 |
for (int i = 0; i < todos.size(); i++) { |
89 |
if (todos.get(i) instanceof ProjectView3D) { |
90 |
ProjectView3D projectView3D = (ProjectView3D) todos.get(i); |
91 |
if (projectView3D.getCanvas3d() != null) |
92 |
views.add(projectView3D); |
93 |
else {
|
94 |
exits = true;
|
95 |
vistas += " " + projectView3D.getName() + "\n"; |
96 |
} |
97 |
} |
98 |
} |
99 |
if (exits) {
|
100 |
JOptionPane.showMessageDialog(null, vistas); |
101 |
} |
102 |
} |
103 |
|
104 |
/**
|
105 |
* Add all fframeviews into a list.
|
106 |
*
|
107 |
* @param l
|
108 |
* Layout.
|
109 |
*/
|
110 |
public void addViews(Layout l) { |
111 |
int num = 0; |
112 |
l.getLayoutContext().updateFFrames(); |
113 |
IFFrame[] fframes=l.getLayoutContext().getFFrames();
|
114 |
for (int i = 0; i < fframes.length; i++) { |
115 |
IFFrame f = fframes[i]; |
116 |
|
117 |
if (f instanceof FFrameView3D) { |
118 |
//((FFrameView)f).getView().setName("FFrameView "+num+((FFrameView)f).getName());
|
119 |
views.add(f); |
120 |
((FFrameView3D) f).setNum(num); |
121 |
num++; |
122 |
} |
123 |
} |
124 |
|
125 |
//ProjectExtension projectextension =(ProjectExtension)App.instance.getPc().getExtension(com.iver.cit.gvsig.ProjectExtension.class);
|
126 |
//views=projectextension.getProject().getViews();
|
127 |
} |
128 |
|
129 |
/**
|
130 |
* Devuelve el ArrayList con las FFrameView.
|
131 |
*
|
132 |
* @return DOCUMENT ME!
|
133 |
*/
|
134 |
//public ArrayList getViews() {
|
135 |
// return views;
|
136 |
//}
|
137 |
|
138 |
/**
|
139 |
* @see javax.swing.ListModel#getSize()
|
140 |
*/
|
141 |
public int getSize() { |
142 |
return views.size();
|
143 |
} |
144 |
|
145 |
/**
|
146 |
* @see javax.swing.ListModel#getElementAt(int)
|
147 |
*/
|
148 |
public Object getElementAt(int index) { |
149 |
return views.get(index);
|
150 |
} |
151 |
} |