Revision 2801

View differences:

branches/gvSIG04/applications/appgvSIG/distFiles/llig-me.txt
1
llig-me.txt
2

  
3
**************************
4

  
5
gvSIG v 0.4
6

  
7
Requisits de la instal?laci?:
8

  
9
    - M?quina Virtual Java 1.4.2 o superior instal?lada (http://java.sun.com).
10

  
11
Requisits de l'aplicaci?:
12

  
13
    - Sistema
14

  
15
        ? M?nims: Pentium III / 256 MB RAM.
16

  
17
        ? Recomanables: Pentium IV / 512 MB RAM.
18

  
19
        ? Sistemes operatius: plataformes Windows i Linux.
20
        Provat en Win98/XP, Linux Suse 8.2/9.0/9.2 i Linux Debian(Lliurex).
21

  
22

  
23
    - Programari instal?lat (disponible en http://www.gvsig.gva.es o en http://java.sun.com)
24

  
25
        ? M?quina Virtual Java 1.4.2 (06 o superior).
26

  
27
        ? JAI (Java Advanced Imaging).
28

  
29
        ? JAI Image I/O.
30

  
31

  
32
Nota: les libreries JAI i JAI Image I/O han d'estar instal?lades sobre la M?quina Virtual Java que gvSIG utilitze en l'execuci?. Si s'instal?la una nova JVM en el sistema i s'usa per a executar gvSIG ser? indispensable instal?lar les llibreries sobre esta.
33

  
34

  
35
M?s informaci? ? suport:
36

  
37
    Web oficial del projecte:
38

  
39
        http://www.gvsig.gva.es
40

  
41
    Llistes de distribuci?:
42

  
43
        http://runas.cap.gva.es/mailman/listinfo/gvsig_usuarios (suport per a usuaris).
44

  
45
        http://runas.cap.gva.es/mailman/listinfo/gvsig_desarrolladores (suport per a desenvolupadors).
46

  
47
        http://runas.cap.gva.es/mailman/listinfo/gvsig_english (suport per a usuaris o desenvolupadors de parla no-hispana).
48

  
0 49

  
branches/gvSIG04/applications/appgvSIG/distFiles/LEEME.txt
1
gvSIG v 0.2.0 beta.
2

  
3
Prerequisitos:
4
  - Java instalado (JRE 1.4.2 o superior) (http://java.sun.com)
5
  - JAI + JAI image I/O (http://java.sun.com)
6
  - librer?as din?micas para los ECW: vienen con cualquier
7
    producto de ERMAPPER y son gratuitas (Actualmente solo hay disponibles para
8
    MS windows)(http://www.ermapper.com)
9
  
10
Instalaci?n:
11

  
12
	Descomprimir el archivo zip completo en el directorio deseado
13
	
14
Ejecuci?n
15
	En windows: gvSIG.bat
16
	En linux:  gvSIG.sh
17

  
18
M?s informaci?n:
19
	gvsig@gva.es
0 20

  
branches/gvSIG04/applications/appgvSIG/build.number
1
#Build Number for ANT. Do not edit!
2
#Mon Sep 05 13:36:50 CEST 2005
3
build.number=737
0 4

  
branches/gvSIG04/applications/appgvSIG/VCN
1
REALIZADOS:
2

  
3
- Al a?adir un nuevo fframe se debe de quedar ese como seleccionado 
4
y todos los dem?s hay que dejarlos como no seleccionados.
5

  
6
- Implementar el FFrameLegend con todos los nombres de capas 
7
como textLayout y los s?mbolos.
8

  
9
-Meterle un m?todo que cambie cada uno de los nombres y s?mbolos 
10
del fframe en un fframe por separado.
11
(Simplificar)A partir de un FFrameLegend crear FFrameText y FFrameSymbol.
12

  
13
-Introducir dentro FGraphicsUtilities la parte del m?todo paintcomponent 
14
de FPreviewSymbol que sea com?n dibujar sobre el mapa de forma est?tica.
15
Se dibuja por la posici?n del shape y no del rect?ngulo.
16

  
17
-Crear una clase FLayoutUtilities, con los m?todos est?ticos fromSheet y toSheet.
18

  
19
-Crear grupos de fframes unidos, Agrupar y para Desagrupar, 
20
de forma que cuando se agrupan se crea un FframeGroup que contenga dentro 
21
todos los fframes seleccionados previamente, y cuando se desagrupa 
22
se elimina el fframegroup y se vuelve a crear un fframe 
23
de cada uno de los fframe que contenia dentro el fframegroup.
24

  
25
-Alinear como lo hace arcView o como lo hace el visual editor en funci?n 
26
de los fframes seleccionados o en funci?n del Layout.
27

  
28
-Colocar detr?s y delante fframes seleccionados respecto de los dem?s.
29

  
30
-El FConstanstLayout debe de desaparecer y a?adir las 
31
constantes que contiene en las clases que las necesiten.
32

  
33
- Crear las barras de escala y modificar la escala en vez de en metros en cent?metros.
34

  
35
-Cuando se muestra una escala que no es fija, y se modifica la escala de la vista, 
36
la escala que lo representa no varia.
37

  
38
- Se pueda abrir el di?logo de propiedades de cada uno de los fframes a?adidos al Layout, 
39
con la informaci?n que necesita.
40

  
41
- Cuando se alinea un solo elemento no se hace como deber?a. 
42

  
43
-L?nea gr?fica.
44

  
45
-FullExtent.
46

  
47
- El di?logo de FPanelDefault no tiene la posibilidad p?blica de modificar 
48
que no contenga relleno.
49
-Los puntos se deben de poder cambiar su tama?o al cambiar su tama?o arrastrando con 
50
el rat?n en el Layout y no solo desde el di?logo de propiedades de este.
51

  
52
- El Fshape se crea cada vez que se dibuja y por lo tanto no hay que guardarlo.
53

  
54
- FSymbol tiene que guardarse en XML utilizando la XMLEntity.La forma separar el modelo del Layout.
55

  
56
-Al cambiar de tama?o un fframe por encima de su posicion x e y, se distorsiona.
57

  
58
-Al modificar la escala de una vista en el Layout la escala gr?fica debe de cambiar su tama?o 
59
de acuerdo al cambio en la escala de la vista.
60

  
61
-Haciendo un doble click se acceda al dialogo de propiedades de cada uno de los fframes.
62

  
63
-FFrameText: Falta poder posicionar las l?neas a la izquierda, centro o derecha.
64

  
65
-Hacer el entramado que sea transparente totalmente en vez de blanco y que se pueda controlar su transparencia en las l?neas que lo componen.
66

  
67
- La propiedad de poder a?adir una vista, una imagen o una leyenda en forma de borrador o presentaci?n.
68

  
69
- Popupmenu en el Layout que se abre pulsando el bot?n derecho del rat?n.
70

  
71
- En FFrameViewDialog si no se selecciona ninguna vista y se acepta salta una excepci?n.
72

  
73
- Al cambiar el zoom y posicionar alg?n elemento detr?s o delante respecto de los dem?s 
74
cambia el zoom y se coloca siempre en mismo lugar.
75

  
76
- Teniendo seleccionada la herramienta de selecci?n y desplazar un fframe cambia su tama?o, ahora lo sigue cambiando pero solo cuando
77
 se desplaza de su posici?n, el desplazamiento y cambio de tama?o de un rect?ngulo 
78
con el grid seleccionado no funciona del todo bien, cambia 
79
el tama?o de forma anormal, pero no siempre.
80

  
81
- Separar el drawLayout para imprimir del drawLayout para visualizar en pantalla.
82

  
83
-En FBorderDialog, falta a?adir propiedades al rect?ngulo que se a?ade, 
84
por ejemplo elegir el color, grosor, textura,de momento es un rect?ngulo simple.
85

  
86

  
87
- FFramePicture se debe cambiar, ya que crea un bufferedimage tan grande como el zoom que se hace y salta la excepci?n de out of memory.
88

  
89
PENDIENTES:
90

  
91
- Rematar el a?adir una vista al Layout, 
92
y su actualizaci?n.
93

  
94
- El Di?logo FLegendManagerWindow, 
95
para que pueda funcionar igual que en arcView 
96
debe ser ?nico implementando SingletonView y que se pueda cambiar su modelo 
97
por el de otra vista que lo requiera. 
98
Ahora mismo lo he dejado como modal y que implementa View.
99

  
100
-Al a?adir una misma vista dos veces al Layout sigue cambiando su extent, cada repaint.
101
Tambi?n al tocar la vista y refrescar en el Layout, que debe ser por lo mismo ya que la 
102
escala que calcula es diferente cada vez y eso cambia el extent.
103
Supongo que es la forma de calcular el extent respecto de la anchura y altura del 
104
fframe que lo contiene y al ser dos se reajusta sin parar. Para corregir esto hay que:
105
El extent del Fmap debe de quedarse fuera de este, 
106
de esta forma no se necesitara clonar fmap cuando el extent 
107
de la vista a a?adir al Layout no tiene que ser la misma.
108

  
109
-A?adir el insertar un rect?ngulo a cada uno de los fframes seleccionados
110
dentro de fframeGraphics contener FShapes con el rect?ngulo dentro en este caso y 
111
pensando en poder a?adir tambi?n de otras formas los rect?ngulos y l?neas que queramos.
112
fshape + symbol==graphics.
113

  
114
- No corren prisa: deshacer, escala real, 
115
zoom a lo seleccionado.
116

  
117
-Revisar los di?logos de los fframes para ver posibles fallos.
118

  
119
- Hay que tener en cuenta que di?logos abrir cuando hay varios fframes seleccionados 
120
cuando se quiere abrir el di?logo de propiedades. En FLayoutGraphics,openFFrameDialog(), 
121
hay que abrir el di?logo de propiedades cuando hayan m?s de uno seleccionado, 
122
incluido cuando son de tipos diferentes.
123

  
124
- Cuando se deslinka el extent de una vista a?adidar al Layout del extent original, se clona el FMap. 
125

  
126
-FFrameView: Falta recortar a la vista y lo de los eventos de cuando se tiene que actualizar el Layout respecto de los cambios de la vista.
127
	Enlace vivo: Se debe guardar el extent actual de la vista y quedarse con ese extent.
128
	
129
-FFramePicture: Falta lo de los eventos.
130
-FFrameScaleBar: Visualizar solo las vistas que esten a?adidas al Layout y no todas.
131
-FFrameLegend: Eventos .Y visualizar en la lista de selecci?n, si se quiere, las vistas a?adidas solamente y no todas.
132

  
133

  
134
-Preparar p?gina: FConfigLayoutDialog muestra una apariencia que no es la del Look and feel elegida. 
135
Puede que sea porque es un MODALDIALOG.
136

  
137
- Cuando se posiciona delante o detr?s una barra de escala, se cambia el tipo de fuente. 
138
Pero el tama?o es el mismo, el color del graphics tambi?n y el tipo de fuente.
139
- El area imprimible hay que conseguir que sea la misma para 
140
los attributes, PageFormat y para guardarla en un atributo 
141
de la clase Attributes. Imprimir de acuerdo a los m?rgenes establecidos, no funciona bien todav?a. Es un tema delicado.
142

  
143
- m_name de FFrame solo lo utilizan tres fframes de momento.
144

  
145
- Mirar el por que una vista tarda tanto en dibujar un trocillo peque?o en el Layout.
146

  
147
- La leyenda que se introduzca con tama?o adecuado, mirar arcView.
148

  
149
DUDAS:
150

  
151
- El simplificar un fframe, como por ejemplo la leyenda esta ya hecho pero el arcView 
152
tambi?n simplifica una vista por cada uno de sus shapes.(Esto no).
153
--------------------------------------------------------------------------------------
154
______________________________
155
VERSION 0.3:
156
______________________________
157

  
158
- Los botones del Layout que se apliquen sobre la vista a?adida se deben de poner a enables 
159
cuando se tenga seleccionada una vista. V
160

  
161
- Cuando se abre las propiedades de una vista a?adida en el Layout en el di?logo no se queda 
162
esta seleccionada en la lista, pero si se rellena el di?ologo con los datos necesarios. V
163

  
164
- Al imprimir un layout que est? en vertical tras haber guardado el proyecto y recuperado se 
165
visualiza en vertical pero la impresi?n es en horizontal. V
166

  
167
- A?adir al di?logo de FFrameText la posibilidad de poner color a los textos a?adidos. V
168

  
169

  
170

  
171
________________________________
172
CAD
173
________________________________
174

  
175

  
0 176

  
branches/gvSIG04/applications/appgvSIG/src/log4j.properties
1
log4j.rootLogger=info, stdout
2

  
3
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
4
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
5

  
6
# Pattern to output the caller's file name and line number.
7
log4j.appender.stdout.layout.ConversionPattern=%5p [%t] (%F:%L) - %m%n
8

  
9
log4j.appender.R=org.apache.log4j.RollingFileAppender
10
log4j.appender.R.File=application.log
11

  
12
log4j.appender.R.MaxFileSize=100KB
13
# Keep one backup file
14
log4j.appender.R.MaxBackupIndex=1
15

  
16
log4j.appender.R.layout=org.apache.log4j.PatternLayout
17
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
18

  
0 19

  
branches/gvSIG04/applications/appgvSIG/src/com/iver/cit/gvsig/ProjectExtension.java
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;
42

  
43
import java.awt.Component;
44
import java.io.File;
45
import java.io.FileNotFoundException;
46
import java.io.FileReader;
47
import java.io.FileWriter;
48
import java.text.DateFormat;
49
import java.util.Date;
50

  
51
import javax.swing.JFileChooser;
52
import javax.swing.JOptionPane;
53

  
54
import org.exolab.castor.xml.MarshalException;
55
import org.exolab.castor.xml.Marshaller;
56
import org.exolab.castor.xml.ValidationException;
57

  
58
import com.iver.andami.Launcher;
59
import com.iver.andami.PluginServices;
60
import com.iver.andami.messages.Messages;
61
import com.iver.andami.messages.NotificationManager;
62
import com.iver.andami.plugins.Extension;
63
import com.iver.cit.gvsig.fmap.DriverException;
64
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
65
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
66
import com.iver.cit.gvsig.fmap.layers.XMLException;
67
import com.iver.cit.gvsig.gui.project.ProjectWindow;
68
import com.iver.cit.gvsig.project.Project;
69
import com.iver.cit.gvsig.project.ProjectFactory;
70
import com.iver.cit.gvsig.project.ProjectMap;
71
import com.iver.cit.gvsig.project.ProjectView;
72
import com.iver.utiles.GenericFileFilter;
73
import com.iver.utiles.NotExistInXMLEntity;
74
import com.iver.utiles.XMLEntity;
75
import com.iver.utiles.xmlEntity.generate.XmlTag;
76

  
77

  
78
/**
79
 * Extension que proporciona controles para crear proyectos nuevos, abrirlos y
80
 * guardarlos. Adem?s los tipos de tabla que soporta el proyecto son a?adidos
81
 * en esta clase.
82
 *
83
 * @author Fernando Gonz?lez Cort?s
84
 */
85
public class ProjectExtension implements Extension {
86
	private ProjectWindow projectFrame;
87
	private Project p;
88
	/**
89
	 * @see com.iver.mdiApp.plugins.Extension#inicializar()
90
	 */
91
	public void inicializar() {
92
	    try {
93
            Class.forName("javax.media.jai.EnumeratedParameter");
94
        } catch (ClassNotFoundException e) {
95
            NotificationManager.addError("La m?quina virtual con la que se ejecuta gvSIG no tiene JAI instalado", e);
96
        }
97
	    
98
		p = ProjectFactory.createProject();
99
		p.setName(PluginServices.getText(this, "untitled"));
100
		p.setModified(false);
101
		projectFrame = new ProjectWindow(this);
102
		projectFrame.setProject(p);
103
		showProjectWindow();
104
		PluginServices.getMainFrame().setTitle(PluginServices.getText(this, "sin_titulo"));
105

  
106
		LayerFactory.setDriversPath(PluginServices.getPluginServices(this)
107
												  .getPluginDirectory()
108
												  .getAbsolutePath() +
109
			File.separator + "drivers");
110
	}
111

  
112
	/**
113
	 * Muestra la ventana con el gestor de proyectos.
114
	 */
115
	public void showProjectWindow() {
116
		PluginServices.getMDIManager().addView(projectFrame);
117
	}
118

  
119
	/**
120
	 * Guarda el proyecto actual en disco.
121
	 */
122
	private void guardar() {
123
		if (p.getPath() == null) {
124
			guardarDialogo();
125
		} else {
126
			escribirProyecto(new File(p.getPath()), p);
127
			projectFrame.refreshControls();
128
		}
129
	}
130
	private void guardarDialogo(){
131
		JFileChooser jfc = new JFileChooser();
132
		jfc.addChoosableFileFilter(new GenericFileFilter("gvp",
133
				PluginServices.getText(this, "tipo_fichero_proyecto")));
134

  
135
		if (jfc.showSaveDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) {
136
			File file=jfc.getSelectedFile();
137
			if (!(file.getPath().endsWith(".gvp") || file.getPath().endsWith(".GVP"))){
138
				file=new File(file.getPath()+".gvp");
139
			}
140
			escribirProyecto(file, p);
141
			projectFrame.refreshControls();
142
		}
143
	}
144
	/**
145
	 * Guarda si el proyecto ha sido modificado.
146
	 *
147
	 * @return True si se ha guardado correctamente.
148
	 */
149
	private boolean modificado() {
150
		///if (p.isModified()) {
151
		if (true) {
152
			//TODO de momento se queda como modificado siempre, para poder controlar perfectamente cuando un proyecto ha sido modificado 
153
			//hay que recoger los eventos de cambio de leyenda, cambio de extent, a?adir una capa, etc que se encuentran en FMap.
154
			int res = JOptionPane.showConfirmDialog((Component) PluginServices.getMainFrame(),
155
					PluginServices.getText(this, "guardar_cambios"),
156
					"gvSIG",
157
					JOptionPane.YES_NO_CANCEL_OPTION,
158
					JOptionPane.INFORMATION_MESSAGE);
159

  
160
			if (res == JOptionPane.YES_OPTION) {
161
				guardar();
162
			} else if (res == JOptionPane.CANCEL_OPTION) {
163
				return false;
164
			}
165
		}
166

  
167
		return true;
168
	}
169

  
170
	/**
171
	 * @see com.iver.mdiApp.plugins.Extension#updateUI(java.lang.String)
172
	 */
173
	public void execute(String actionCommand) {
174
		if (actionCommand.equals("NUEVO")) {
175
			//Si est? modificado se pregunta si se quiere guardar el anterior
176
			if (!modificado()) {
177
				return;
178
			}
179
			ProjectView.numViews=0;
180
            ProjectMap.numMaps = 0;
181
			PluginServices.getMDIManager().closeAllViews();
182
			p = ProjectFactory.createProject();
183
			p.setName(PluginServices.getText(this, "untitled"));
184
			p.setModified(false);
185
			projectFrame.setProject(p);
186
			showProjectWindow();
187
			PluginServices.getMainFrame().setTitle(PluginServices.getText(this, "sin_titulo"));
188
		} else if (actionCommand.equals("ABRIR")) {
189
			//Si est? modificado se pregunta si se quiere guardar el anterior
190
			if (!modificado()) {
191
				ProjectView.numViews=0;
192
                ProjectMap.numMaps = 0;
193
				return;
194
			}
195
			
196
			JFileChooser jfc = new JFileChooser();
197
			jfc.addChoosableFileFilter(new GenericFileFilter("gvp",
198
					PluginServices.getText(this, "tipo_fichero_proyecto")));
199

  
200
			if (jfc.showOpenDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) {
201
				ProjectView.numViews=0;
202
                ProjectMap.numMaps = 0;
203
				PluginServices.getMDIManager().closeAllViews();
204

  
205
				Project o = leerProyecto(jfc.getSelectedFile());
206

  
207
				if (o != null) {
208
					p = o;
209
				}
210

  
211
				projectFrame.setProject(p);
212
				PluginServices.getMainFrame().setTitle(p.getName());
213
				projectFrame.refreshControls();
214
				showProjectWindow();
215
			}
216
		} else if (actionCommand.equals("GUARDAR")) {
217
			guardar();
218
		} else if (actionCommand.equals("GUARDAR_COMO")) {
219
			guardarDialogo();
220
		} else if (actionCommand.equals("SALIR")){
221
			int option = JOptionPane.showConfirmDialog(null,
222
					Messages.getString("MDIFrame.quiere_salir"),
223
					Messages.getString("MDIFrame.salir"),
224
					JOptionPane.YES_NO_OPTION);
225

  
226
			if (option == JOptionPane.YES_OPTION) {
227
				Launcher.closeApplication();
228
			}
229
		}
230
	}
231

  
232
	/**
233
	 * Escribe el proyecto en XML.
234
	 *
235
	 * @param file Fichero.
236
	 * @param p Proyecto.
237
	 */
238
	public void escribirProyecto(File file, Project p) {
239
		// write it out as XML
240
		try {
241
			FileWriter writer = new FileWriter(file.getAbsolutePath());
242
			Marshaller m = new Marshaller(writer);
243
			m.setEncoding("ISO-8859-1");
244
			p.setName(file.getName());
245
			p.setPath(file.toString());
246
			p.setModificationDate(DateFormat.getDateInstance().format(new Date()));
247
			p.setModified(false);
248
			m.marshal(p.getXMLEntity().getXmlTag());
249
			PluginServices.getMainFrame().setTitle(file.getName());
250
		} catch (Exception e) {
251
			NotificationManager.addError("Error guardando el proyecto", e);
252
		}
253

  
254
	}
255

  
256
	/**
257
	 * Lee del XML el proyecto.
258
	 *
259
	 * @param file Fichero.
260
	 *
261
	 * @return Proyecto.
262
	 */
263
	public Project leerProyecto(File file) {
264
		Project proj = null;
265

  
266
		try {
267
			File xmlFile = new File(file.getAbsolutePath());
268
			FileReader reader;
269
			reader = new FileReader(xmlFile);
270
			XmlTag tag = (XmlTag) XmlTag.unmarshal(reader);
271

  
272
			try {
273
				proj = Project.createFromXML(new XMLEntity(tag));
274
				return proj;
275
			} catch (XMLException e) {
276
                NotificationManager.addInfo("Al leer el proyecto", e);
277
			} catch (DriverException e) {
278
                NotificationManager.addInfo("Al leer el proyecto", e);
279
			} catch (DriverIOException e) {
280
                NotificationManager.addInfo("Al leer el proyecto", e);
281
			} catch (NotExistInXMLEntity e){
282
                NotificationManager.addInfo("Al leer el proyecto", e);
283
			} 
284
			try {
285
                proj = Project.createFromXML03(new XMLEntity(tag));
286
    			return proj;
287
            } catch (XMLException e1) {
288
				NotificationManager.addError("Al leer el proyecto", e1);
289
            } catch (DriverException e1) {
290
				NotificationManager.addError("Al leer el proyecto", e1);
291
            } catch (DriverIOException e1) {
292
				NotificationManager.addError("Al leer el proyecto", e1);
293
            }
294
			
295
		} catch (FileNotFoundException e) {
296
			JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),PluginServices.getText(this, "fichero_incorrecto"));
297
			//NotificationManager.addError("Al leer el proyecto", e);
298
		} catch (MarshalException e) {
299
			JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),PluginServices.getText(this, "formato_incorrecto"));
300
			//NotificationManager.addError("Al leer el proyecto", e);
301
		} catch (ValidationException e) {
302
			JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),PluginServices.getText(this, "formato_incorrecto"));
303
			//NotificationManager.addError("Al leer el proyecto", e);
304
		} 
305
		
306
		return null;
307
	}
308

  
309
	/**
310
	 * Devuelve el proyecto.
311
	 *
312
	 * @return Proyecto.
313
	 */
314
	public Project getProject() {
315
		return p;
316
	}
317

  
318
	/**
319
	 * @see com.iver.andami.plugins.Extension#isEnabled()
320
	 */
321
	public boolean isEnabled() {
322
		return true;
323
	}
324

  
325
	/**
326
	 * @see com.iver.andami.plugins.Extension#isVisible()
327
	 */
328
	public boolean isVisible() {
329
		return true;
330
	}
331
}
0 332

  
branches/gvSIG04/applications/appgvSIG/src/com/iver/cit/gvsig/gui/MapOverview.java
1
/*
2
 * Created on 21-jun-2004
3
 *
4
 * TODO To change the template for this generated file go to
5
 * Window - Preferences - Java - Code Generation - Code and Comments
6
 */
7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
11
 * This program is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU General Public License
13
 * as published by the Free Software Foundation; either version 2
14
 * of the License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
24
 *
25
 * For more information, contact:
26
 *
27
 *  Generalitat Valenciana
28
 *   Conselleria d'Infraestructures i Transport
29
 *   Av. Blasco Ib??ez, 50
30
 *   46010 VALENCIA
31
 *   SPAIN
32
 *
33
 *      +34 963862235
34
 *   gvsig@gva.es
35
 *      www.gvsig.gva.es
36
 *
37
 *    or
38
 *
39
 *   IVER T.I. S.A
40
 *   Salamanca 50
41
 *   46005 Valencia
42
 *   Spain
43
 *
44
 *   +34 963163400
45
 *   dac@iver.es
46
 */
47
package com.iver.cit.gvsig.gui;
48

  
49
import com.iver.cit.gvsig.fmap.ColorEvent;
50
import com.iver.cit.gvsig.fmap.DriverException;
51
import com.iver.cit.gvsig.fmap.ExtentEvent;
52
import com.iver.cit.gvsig.fmap.FMap;
53
import com.iver.cit.gvsig.fmap.MapControl;
54
import com.iver.cit.gvsig.fmap.ViewPort;
55
import com.iver.cit.gvsig.fmap.ViewPortListener;
56
import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior;
57
import com.iver.cit.gvsig.gui.toolListeners.MapOverviewListener;
58
import com.iver.cit.gvsig.gui.toolListeners.StatusBarListener;
59

  
60
import java.awt.Color;
61
import java.awt.Cursor;
62
import java.awt.Graphics;
63
import java.awt.Graphics2D;
64
import java.awt.geom.AffineTransform;
65
import java.awt.geom.Line2D;
66
import java.awt.geom.Point2D;
67
import java.awt.geom.Rectangle2D;
68

  
69

  
70
/**
71
 * DOCUMENT ME!
72
 *
73
 * @author FJP TODO To change the template for this generated type comment go
74
 * 		   to Window - Preferences - Java - Code Generation - Code and
75
 * 		   Comments
76
 */
77
public class MapOverview extends MapControl implements ViewPortListener {
78
	private MapControl m_MapAssoc;
79
	boolean first = true;
80

  
81
	/**
82
	 * Crea un nuevo MapOverview.
83
	 *
84
	 * @param mapAssoc DOCUMENT ME!
85
	 */
86
	public MapOverview(MapControl mapAssoc) {
87
		super();
88

  
89
		// super.vp.setBackColor(new Color(230,230,230));
90
		m_MapAssoc = mapAssoc;
91

  
92
		// setModel((FMap) m_MapAssoc.getMapContext().clone()); // Lo inicializamos con
93
		// los mismos temas que tenga el grande.
94
		MapOverviewListener movl = new MapOverviewListener(this);
95
		addMapTool("zoomtopoint", new PointBehavior(movl));
96
		setCursor(movl.getCursor());
97

  
98
		setTool("zoomtopoint");
99
	}
100

  
101
	/**
102
	 * DOCUMENT ME!
103
	 *
104
	 * @return DOCUMENT ME!
105
	 */
106
	public FMap getAssociatedMapContext() {
107
		return m_MapAssoc.getMapContext();
108
	}
109

  
110
	/* (non-Javadoc)
111
	 * @see com.iver.cit.opensig.gui.IMapExtentListener#extentChanged(java.awt.geom.Rectangle2D)
112
	 */
113
	public void extentChanged(ExtentEvent evExtent) {
114
		// Nos llega el nuevo extent del FMap asociado, as? que dibujamos nuestro 
115
		// rect?ngulo para mostrar la zona de dibujo del otro mapa.
116
		repaint();
117
	}
118

  
119
	/**
120
	 * Recalcula el extent a aplicar de las capas que estan a?adidas.
121
	 */
122
	public void refreshExtent() {
123
		try {
124
		if (this.getMapContext().getFullExtent()!=null){
125
				this.getMapContext().getViewPort().setExtent(this.getMapContext().getFullExtent());
126
		}else{
127
			delModel();
128
		}
129
		} catch (DriverException e1) {
130
			e1.printStackTrace();
131
		}
132
	}
133

  
134
	/* (non-Javadoc)
135
	 * @see javax.swing.JComponent#paintComponent(java.awt.Graphics)
136
	 */
137
	protected void paintComponent(Graphics g) {
138
		super.paintComponent(g);
139
			if ((m_MapAssoc.getMapContext().getViewPort().getExtent() != null) &&
140
					(getMapContext().getViewPort().getExtent() != null)) {
141
				if (first) {
142
					first = false;
143
					repaint();
144

  
145
					return;
146
				} else {
147
					first = true;
148
				}
149

  
150
				ViewPort vp = getMapContext().getViewPort();
151
				ViewPort vpOrig = m_MapAssoc.getMapContext().getViewPort();
152
				Graphics2D g2 = (Graphics2D) g;
153
				g2.setColor(Color.black);
154
				g2.setXORMode(Color.white);
155

  
156
				// Dibujamos el extent del mapa asociado.
157
				g2.setTransform(vp.getAffineTransform());
158

  
159
				g2.fill(vpOrig.getAdjustedExtent());
160
				// dibujamos las l?neas vertical y horizontal
161
				Point2D pRightUp = vp.toMapPoint(getWidth(), 0);
162
				Line2D.Double linVert = new Line2D.Double(vpOrig.getExtent()
163
																.getCenterX(),
164
						vp.getExtent().getMinY(), vpOrig.getExtent().getCenterX(),
165
						pRightUp.getY());
166
				Line2D.Double linHoriz = new Line2D.Double(vp.getExtent().getMinX(),
167
						vpOrig.getExtent().getCenterY(), pRightUp.getX(),
168
						vpOrig.getExtent().getCenterY());
169

  
170
				g2.draw(linVert);
171
				g2.draw(linHoriz);
172

  
173
				g2.setTransform(new AffineTransform());
174

  
175
				// System.out.println("Dibujo el extent " + m_MapAssoc.getExtent().toString());
176
			}
177
		
178
	}
179

  
180
	/**
181
	 * DOCUMENT ME!
182
	 *
183
	 * @param model DOCUMENT ME!
184
	 */
185
	public void setModel(FMap model) {
186
		this.setMapContext(model);
187
		m_MapAssoc.getMapContext().getViewPort().addViewPortListener(this);
188
		getMapContext().getViewPort().addViewPortListener(this);
189
	}
190
	private void delModel(){
191
		this.getMapContext().getViewPort().setExtent(null);
192
		m_MapAssoc.getMapContext().getViewPort().removeViewPortListener(this);
193
		getMapContext().getViewPort().removeViewPortListener(this);
194
	}
195

  
196
	/**
197
	 * @see com.iver.cit.gvsig.fmap.ViewPortListener#backColorChanged(com.iver.cit.gvsig.fmap.ColorEvent)
198
	 */
199
	public void backColorChanged(ColorEvent e) {
200
	}
201
}
0 202

  
branches/gvSIG04/applications/appgvSIG/src/com/iver/cit/gvsig/gui/toc/TOCRenderer.java
1
/*
2
 * Created on 23-feb-2004
3
 *
4
 * To change the template for this generated file go to
5
 * Window>Preferences>Java>Code Generation>Code and Comments
6
 */
7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
11
 * This program is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU General Public License
13
 * as published by the Free Software Foundation; either version 2
14
 * of the License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
24
 *
25
 * For more information, contact:
26
 *
27
 *  Generalitat Valenciana
28
 *   Conselleria d'Infraestructures i Transport
29
 *   Av. Blasco Ib??ez, 50
30
 *   46010 VALENCIA
31
 *   SPAIN
32
 *
33
 *      +34 963862235
34
 *   gvsig@gva.es
35
 *      www.gvsig.gva.es
36
 *
37
 *    or
38
 *
39
 *   IVER T.I. S.A
40
 *   Salamanca 50
41
 *   46005 Valencia
42
 *   Spain
43
 *
44
 *   +34 963163400
45
 *   dac@iver.es
46
 */
47
package com.iver.cit.gvsig.gui.toc;
48

  
49
import java.awt.Color;
50
import java.awt.Component;
51
import java.awt.Dimension;
52
import java.awt.Font;
53
import java.awt.GridBagConstraints;
54
import java.awt.GridBagLayout;
55
import java.awt.Rectangle;
56

  
57
import javax.swing.BorderFactory;
58
import javax.swing.JCheckBox;
59
import javax.swing.JLabel;
60
import javax.swing.JPanel;
61
import javax.swing.JTree;
62
import javax.swing.SpringLayout;
63
import javax.swing.UIManager;
64
import javax.swing.border.Border;
65
import javax.swing.tree.DefaultMutableTreeNode;
66
import javax.swing.tree.TreeCellRenderer;
67

  
68
import com.iver.cit.gvsig.fmap.layers.FLayer;
69

  
70

  
71

  
72
/**
73
 * Renderer que actua sobre el TOC.
74
 *
75
 * @author vcn
76
 */
77
public class TOCRenderer extends JPanel implements TreeCellRenderer {
78
    public Border bordeSeleccionado = BorderFactory.createEtchedBorder();
79

  
80
    /*public Border bordeSeleccionado = BorderFactory.createBevelBorder(BevelBorder.RAISED,
81
            SystemColor.black, SystemColor.lightGray, SystemColor.gray,
82
            SystemColor.lightGray);
83
    */
84
    private Border bordeNormal = BorderFactory.createEmptyBorder();
85
    
86
	private JCheckBox check;
87
	private JLabel label;
88

  
89
	private static final Font BIGGER_FONT = 
90
									  new Font("SansSerif", Font.BOLD, 12);
91

  
92
	GridBagLayout gridbag = new GridBagLayout();
93
	GridBagConstraints c = new GridBagConstraints();
94
    /**
95
     * Creates a new TOCRenderer object.
96
     */
97
    public TOCRenderer() {
98
        this.setBackground(Color.lightGray);
99
        // this.setLayout(new BorderLayout());
100
        
101
		check = new JCheckBox();
102
		label = new JLabel();
103
		
104

  
105

  
106
		/* this.setLayout(gridbag);
107

  
108
		c.fill = GridBagConstraints.NONE;
109
		c.weightx = 1.0;
110
		c.anchor = GridBagConstraints.WEST;
111
		// c.weightx = check.getWidth();
112
		gridbag.setConstraints(check,c);
113
		this.add(check);
114
		c.anchor = GridBagConstraints.WEST;
115
		gridbag.setConstraints(colorPanel,c);
116
		// c.weightx = colorPanel.getWidth();
117
		this.add(colorPanel);
118
		c.gridwidth = GridBagConstraints.REMAINDER; //end row
119
		c.fill = GridBagConstraints.HORIZONTAL;		
120
		gridbag.setConstraints(label,c);
121
		this.add(label); */ 
122

  
123

  
124

  
125
		/* this.setLayout(new FlowLayout(FlowLayout.LEFT));
126
		this.add(check);
127
		this.add(colorPanel);
128
		this.add(label); */
129
		
130
		/* this.setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
131
		this.add(check);
132
		this.add(colorPanel);
133
		this.add(label); */  
134

  
135
		SpringLayout theLayout = new SpringLayout();		 
136
		this.setLayout(theLayout);
137

  
138
		//int rows = 1;
139
		//int cols = 2;
140
				
141
		/* this.setLayout(new BorderLayout());
142
		
143
		this.add(check, BorderLayout.WEST);
144
		this.add(label, BorderLayout.CENTER);
145
		*/ 
146
		/*
147
		GridBagLayout gridbag = new GridBagLayout();
148
        GridBagConstraints c = new GridBagConstraints();
149
        
150
        this.setLayout(gridbag);
151
        this.add(check);
152
        c.gridwidth = GridBagConstraints.REMAINDER;
153
        c.fill = GridBagConstraints.HORIZONTAL;
154
        this.add(label, c);
155
        */
156
		
157
//		Adjust constraints for the text field so it's at
158
//		(<label's right edge> + 5, 5).
159
		this.add(check);
160
		this.add(label);  
161

  
162
		theLayout.putConstraint(SpringLayout.WEST, label,
163
						   5,
164
						   SpringLayout.EAST, check); 
165

  
166
		this.setBorder(bordeSeleccionado);
167

  
168
        check.setBackground(UIManager.getColor("Button.background"));
169
        label.setForeground(UIManager.getColor("Tree.textForeground"));
170
        
171
        
172
    }
173

  
174
    /**
175
     * M?todo llamado una vez por cada nodo, y todas las veces que se redibuja
176
     * en pantalla el TOC.
177
     *
178
     * @param tree
179
     * @param value
180
     * @param isSelected
181
     * @param expanded
182
     * @param leaf
183
     * @param row
184
     * @param hasFocus
185
     *
186
     * @return
187
     */
188
    public Component getTreeCellRendererComponent(JTree tree, Object value,
189
        boolean isSelected, boolean expanded, boolean leaf, int row,
190
        boolean hasFocus) {
191
                
192
        DefaultMutableTreeNode n = (DefaultMutableTreeNode) value;
193
		String stringValue = "";
194
		this.setBackground(UIManager.getColor("Button.background"));
195
		this.label.setFont(tree.getFont());
196
		// System.out.println("ancho tree=" + tree.getWidth());
197

  
198
		if (n.getUserObject() instanceof ITocItem)
199
		{
200
			
201
	       	ITocItem item = (ITocItem) n.getUserObject();	       	
202
			stringValue = item.getLabel();
203
			
204
	        Dimension sizeNode = item.getSize(); // Se fija en el resize del TOC
205
	        
206
			this.setPreferredSize(sizeNode);
207
			
208
			if (item instanceof TocItemBranch)
209
			{
210
				TocItemBranch branch = (TocItemBranch) item;
211
				FLayer lyr = branch.getLayer();
212
				check.setVisible(true);
213
				check.setSelected(lyr.isVisible());
214
				check.setEnabled(true);
215
			    if (!lyr.isWithinScale(lyr.getFMap().getScaleView()))
216
			        check.setEnabled(false);
217
				
218
				if (lyr.isActive())
219
				{				
220
					this.setBorder(bordeSeleccionado);
221
					this.label.setFont(BIGGER_FONT);
222
				}
223
				else
224
				{				
225
					this.setBorder(bordeNormal);
226
				}				
227
	        }
228
			else
229
			{
230
				check.setVisible(false);
231
				this.setBorder(bordeNormal);			
232
				
233
			}
234
	        label.setText(stringValue);
235
	        if (item.getIcon() != null)
236
	        {
237
	        	label.setIcon(item.getIcon());
238
	        	// System.out.println("Pongo etiqueta " + stringValue + " con icono " + item.getIcon().toString());
239
	        }
240
	        this.setPreferredSize(sizeNode);
241
		}		
242
		// this.setPreferredSize(new Dimension(tree.getWidth()-60,24)); // sizeNode);
243

  
244
        if (leaf) {
245
            // label.setIcon(UIManager.getIcon("Tree.leafIcon"));
246
            
247
        } else if (expanded) {
248
            //label.setIcon(UIManager.getIcon("Tree.openIcon"));
249
        } else {
250
            //label.setIcon(UIManager.getIcon("Tree.closedIcon"));
251
        }
252

  
253
        return this;
254
    }
255

  
256
	public Rectangle getCheckBoxBounds() {
257
		return check.getBounds();
258
	}
259

  
260
}
0 261

  
branches/gvSIG04/applications/appgvSIG/src/com/iver/cit/gvsig/gui/toc/TocItemLeaf.java
1
/*
2
 * Created on 03-dic-2004
3
 *
4
 * TODO To change the template for this generated file go to
5
 * Window - Preferences - Java - Code Generation - Code and Comments
6
 */
7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
11
 * This program is free software; you can redistribute it and/or
12
 * modify it under the terms of the GNU General Public License
13
 * as published by the Free Software Foundation; either version 2
14
 * of the License, or (at your option) any later version.
15
 *
16
 * This program is distributed in the hope that it will be useful,
17
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
19
 * GNU General Public License for more details.
20
 *
21
 * You should have received a copy of the GNU General Public License
22
 * along with this program; if not, write to the Free Software
23
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
24
 *
25
 * For more information, contact:
26
 *
27
 *  Generalitat Valenciana
28
 *   Conselleria d'Infraestructures i Transport
29
 *   Av. Blasco Ib??ez, 50
30
 *   46010 VALENCIA
31
 *   SPAIN
32
 *
33
 *      +34 963862235
34
 *   gvsig@gva.es
35
 *      www.gvsig.gva.es
36
 *
37
 *    or
38
 *
39
 *   IVER T.I. S.A
40
 *   Salamanca 50
41
 *   46005 Valencia
42
 *   Spain
43
 *
44
 *   +34 963163400
45
 *   dac@iver.es
46
 */
47
package com.iver.cit.gvsig.gui.toc;
48

  
49
import java.awt.Dimension;
50
import java.awt.Graphics2D;
51
import java.awt.Rectangle;
52
import java.awt.datatransfer.DataFlavor;
53
import java.awt.datatransfer.UnsupportedFlavorException;
54
import java.awt.geom.AffineTransform;
55
import java.awt.image.BufferedImage;
56
import java.io.IOException;
57

  
58
import javax.swing.Icon;
59
import javax.swing.ImageIcon;
60

  
61
import com.iver.cit.gvsig.fmap.core.FShape;
62
import com.iver.cit.gvsig.fmap.core.v02.FGraphicUtilities;
63
import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
64
import com.iver.cit.gvsig.fmap.rendering.styling.FStyle2D;
65
import com.iver.cit.gvsig.fmap.rendering.styling.SymbolPreviewDrawer;
66

  
67
/**
68
 * @author FJP
69
 *
70
 * TODO To change the template for this generated type comment go to
71
 * Window - Preferences - Java - Code Generation - Code and Comments
72
 */
73
public class TocItemLeaf implements ITocItem {
74

  
75
	private FSymbol symbol;
76
	private String description;
77
	private int layerType;
78
	private static int w_1symbol = 20;
79
	private static int h_1symbol = 15;
80
	
81
	private Dimension sz;
82
	
83
	private static SymbolPreviewDrawer pSD = new SymbolPreviewDrawer();
84
	
85
    final public static DataFlavor INFO_FLAVOR =
86
	    new DataFlavor(TocItemLeaf.class, "ItemLeaf");
87

  
88
	static DataFlavor flavors[] = {INFO_FLAVOR };
89
	
90
	
91
	public TocItemLeaf(FSymbol symbol, String description, int layerType)
92
	{
93
		this.symbol = symbol;
94
		this.description = description;
95
		this.layerType = layerType;
96
	}
97
	/* (non-Javadoc)
98
	 * @see com.iver.cit.gvsig.gui.toc.ITocItem#getLabel()
99
	 */
100
	public String getLabel() {
101
		return description;
102
	}
103

  
104
	/* (non-Javadoc)
105
	 * @see com.iver.cit.gvsig.gui.toc.ITocItem#getIcon()
106
	 */
107
	public Icon getIcon() {
108
		// System.out.println("Dentro de getIcon: layerType=" + layerType);
109
		BufferedImage img = null;
110
		
111
		switch (layerType)
112
		{
113
			case FShape.POINT:
114
			case FShape.LINE:
115
			case FShape.POLYGON:
116
			case FShape.MULTIPOINT:
117
				img = new BufferedImage(w_1symbol, h_1symbol, BufferedImage.TYPE_INT_ARGB);
118
				Graphics2D g2 = img.createGraphics();
119
				Rectangle r = new Rectangle(w_1symbol, h_1symbol);				
120
				FGraphicUtilities.DrawSymbol(g2, AffineTransform.getScaleInstance(0.8,0.8), r, symbol);
121
				break;									
122
			case FShape.MULTI:
123
				img = new BufferedImage(3*w_1symbol, h_1symbol, BufferedImage.TYPE_INT_ARGB);
124
				g2 = img.createGraphics();
125
				r = new Rectangle(3*w_1symbol, h_1symbol);
126
				
127
				FGraphicUtilities.DrawSymbol(g2, AffineTransform.getScaleInstance(0.8,0.8), r, symbol);
128
				break;					
129
			
130
		}
131
		if (img==null)return null;//TODO tipo de shape no soportado.
132
		return new ImageIcon(img);
133
	}
134
	
135
	/* (non-Javadoc)
136
	 * @see java.awt.datatransfer.Transferable#getTransferDataFlavors()
137
	 */
138
	public DataFlavor[] getTransferDataFlavors() {
139
		return flavors;
140
	}
141

  
142
	/* (non-Javadoc)
143
	 * @see java.awt.datatransfer.Transferable#isDataFlavorSupported(java.awt.datatransfer.DataFlavor)
144
	 */
145
	public boolean isDataFlavorSupported(DataFlavor dF) {
146
		return dF.equals(INFO_FLAVOR);
147
	}
148

  
149
	/* (non-Javadoc)
150
	 * @see java.awt.datatransfer.Transferable#getTransferData(java.awt.datatransfer.DataFlavor)
151
	 */
152
	public Object getTransferData(DataFlavor dF) throws UnsupportedFlavorException, IOException {
153
	    if (dF.equals(INFO_FLAVOR)) {
154
	        return this;
155
	      }
156
	      else throw new UnsupportedFlavorException(dF);
157
	}
158
	/* (non-Javadoc)
159
	 * @see com.iver.cit.gvsig.gui.toc.ITocItem#getSize()
160
	 */
161
	public Dimension getSize() {
162
		return sz;
163
	}
164
	/* (non-Javadoc)
165
	 * @see com.iver.cit.gvsig.gui.toc.ITocItem#setSize(java.awt.Dimension)
166
	 */
167
	public void setSize(Dimension sz) {
168
		this.sz = sz;
169
		
170
	}
171
	
172

  
173
	/**
174
	 * @return Returns the symbol.
175
	 */
176
	public FSymbol getSymbol() {
177
		return symbol;
178
	}
179
}
0 180

  
branches/gvSIG04/applications/appgvSIG/src/com/iver/cit/gvsig/gui/toc/TocMenuEntry.java
1
/*
2
 * Created on 20-dic-2004
3
 * 
4
 * gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
5
 *
6
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
7
 *
8
 * This program is free software; you can redistribute it and/or
9
 * modify it under the terms of the GNU General Public License
10
 * as published by the Free Software Foundation; either version 2
11
 * of the License, or (at your option) any later version.
12
 *
13
 * This program is distributed in the hope that it will be useful,
14
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16
 * GNU General Public License for more details.
17
 *
18
 * You should have received a copy of the GNU General Public License
19
 * along with this program; if not, write to the Free Software
20
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
21
 *
22
 * For more information, contact:
23
 *
24
 *  Generalitat Valenciana
25
 *   Conselleria d'Infraestructures i Transport
26
 *   Av. Blasco Ib??ez, 50
27
 *   46010 VALENCIA
28
 *   SPAIN
29
 *
30
 *      +34 963862235
31
 *   gvsig@gva.es
32
 *      www.gvsig.gva.es
33
 *
34
 *    or
35
 *
36
 *   IVER T.I. S.A
37
 *   Salamanca 50
38
 *   46005 Valencia
39
 *   Spain
40
 *
41
 *   +34 963163400
42
 *   dac@iver.es
43
 */
44
package com.iver.cit.gvsig.gui.toc;
45

  
46
import java.awt.event.ActionEvent;
47
import java.awt.event.ActionListener;
48

  
49
import com.iver.cit.gvsig.fmap.FMap;
50
import com.iver.cit.gvsig.fmap.layers.FLayer;
51

  
52
/**
53
 * @author Luis W. Sevilla (sevilla_lui@gva.es)
54
 */
55
public abstract class TocMenuEntry implements ActionListener {
56
	private FPopupMenu menu;
57
	//private Class [] layerTypes = null;
58
	public TocMenuEntry() {
59
	}
60
	
61
	/**
62
	 * Se utiliza para inicializar el menu. Dentro comprobar?
63
	 * encima de qu? tipo de tocItem hemos pinchado, y se
64
	 * mostrar? la opci?n de menu o no en funci?n de si
65
	 * es un branch o un leaf, o incluso de alg?n otro
66
	 * par?metro interno. 
67
	 * @param menu
68
	 */
69
	public void initialize(FPopupMenu m) {
70
		menu = m;
71
	}
72
	
73
	/**
74
	 * C?digo que se ejecuta cuando selecciona una opci?n
75
	 * de menu. Recibe el tocItem sobre el que has pinchado.
76
	 * @param tocItem
77
	 */
78
	public abstract void actionPerformed(ActionEvent e);
79
	
80
	public FPopupMenu getMenu() { return menu; }
81
	
82
	public FMap getMapContext() {
83
		return menu.mapContext;
84
	}
85
	public Object getNodeUserObject() {
86
		return menu.nodo.getUserObject();
87
	}
88
	
89
	public FLayer getNodeLayer() {
90
		if (isTocItemBranch())
91
			return ((TocItemBranch) getNodeUserObject()).getLayer();
92
		return null;
93
	}
94
	public boolean isTocItemLeaf() {
95
		return getNodeUserObject() instanceof TocItemLeaf;
96
	}
97
	
98
	public boolean isTocItemBranch() {
99
		return getNodeUserObject() instanceof TocItemBranch;
100
	}
101
}
0 102

  
branches/gvSIG04/applications/appgvSIG/src/com/iver/cit/gvsig/gui/toc/ITocItem.java
1
/*
2
 * Created on 03-dic-2004
3
 *
4
 * TODO To change the template for this generated file go to
5
 * Window - Preferences - Java - Code Generation - Code and Comments
6
 */
7
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
8
 *
9
 * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
10
 *
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff