Revision 16768
tags/tmp_build/examples/exaExampleCenterViewToPoint/.classpath | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<classpath> |
|
3 |
<classpathentry kind="src" path="src"/> |
|
4 |
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jSDK1.4.12"/> |
|
5 |
<classpathentry sourcepath="C:/workspaceVersion1/_fwAndami/src" kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/andami.jar"/> |
|
6 |
<classpathentry sourcepath="C:/workspaceVersion1/appgvSIG/src" kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.cit.gvsig.jar"/> |
|
7 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/iver-utiles.jar"/> |
|
8 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/castor-0.9.5.3-xml.jar"/> |
|
9 |
<classpathentry sourcepath="C:/workspaceVersion1/libFMap/src" kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/fmap.jar"/> |
|
10 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/beans.jar"/> |
|
11 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/javaws.jar"/> |
|
12 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/commons-codec-1.3.jar"/> |
|
13 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/crimson.jar"/> |
|
14 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/gvsig-i18n.jar"/> |
|
15 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/jcalendar.jar"/> |
|
16 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/JUF-1.0.jar"/> |
|
17 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/JWizardComponent.jar"/> |
|
18 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/kxml2.jar"/> |
|
19 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/log4j-1.2.8.jar"/> |
|
20 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/looks-2.0.2.jar"/> |
|
21 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/tempFileManager.jar"/> |
|
22 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/xerces_2_5_0.jar"/> |
|
23 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/xml-apis.jar"/> |
|
24 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/lib/xmlrpc-2.0.1.jar"/> |
|
25 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/cms.jar"/> |
|
26 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/driver-manager-1.1.jar"/> |
|
27 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/gdbms-0.8-SNAPSHOT.jar"/> |
|
28 |
<classpathentry kind="lib" path="C:/Archivos de programa/gvSIG_1.0.2/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.gvsig.addeventtheme.jar"/> |
|
29 |
<classpathentry kind="output" path="bin"/> |
|
30 |
</classpath> |
|
0 | 31 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/theme/andami-theme.xml | ||
---|---|---|
1 |
<AndamiProperties> |
|
2 |
<ApplicationImages> |
|
3 |
<SplashImages> |
|
4 |
<Splash path="gvSIG/extensiones/com.iver.gvsig.centerviewpoint/theme/logo_es.png" timer="1000"/> |
|
5 |
<Splash path="gvSIG/extensiones/com.iver.gvsig.centerviewpoint/theme/logo_personalizado.png" timer="100000"/> |
|
6 |
</SplashImages> |
|
7 |
<BackgroundImage path="gvSIG/extensiones/com.iver.gvsig.centerviewpoint/theme/logo_fondo_personalizado.png"/> |
|
8 |
<WallpaperType value="CENTERED"/> |
|
9 |
<Icon path="gvSIG/extensiones/com.iver.gvsig.centerviewpoint/theme/logoGVA.gif"/> |
|
10 |
</ApplicationImages> |
|
11 |
<ApplicationName value="gvSIG 1.0.2. Example center View to point"/> |
|
12 |
</AndamiProperties> |
|
0 | 13 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/.project | ||
---|---|---|
1 |
<?xml version="1.0" encoding="UTF-8"?> |
|
2 |
<projectDescription> |
|
3 |
<name>exaExampleCenterViewToPoint</name> |
|
4 |
<comment></comment> |
|
5 |
<projects> |
|
6 |
</projects> |
|
7 |
<buildSpec> |
|
8 |
<buildCommand> |
|
9 |
<name>org.eclipse.jdt.core.javabuilder</name> |
|
10 |
<arguments> |
|
11 |
</arguments> |
|
12 |
</buildCommand> |
|
13 |
<buildCommand> |
|
14 |
<name>de.loskutov.FileSync.FSBuilder</name> |
|
15 |
<arguments> |
|
16 |
</arguments> |
|
17 |
</buildCommand> |
|
18 |
</buildSpec> |
|
19 |
<natures> |
|
20 |
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature> |
|
21 |
<nature>org.eclipse.jdt.core.javanature</nature> |
|
22 |
<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature> |
|
23 |
</natures> |
|
24 |
</projectDescription> |
|
0 | 25 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/about.htm | ||
---|---|---|
1 |
<html> |
|
2 |
<head> |
|
3 |
<title>Extesión de ejemplo.</title> |
|
4 |
<meta content=""> |
|
5 |
<style></style> |
|
6 |
</head> |
|
7 |
<body> |
|
8 |
<table width="60%" border="0"> |
|
9 |
<tr> |
|
10 |
<td width="64%"><img src="images/logo_horiz_bicolor_gva.png" width="329" height="50"></td> |
|
11 |
<td width="36%"><div align="right"><img src="images/logoIver.png" width="87" height="50"></div></td> |
|
12 |
</tr> |
|
13 |
<tr> |
|
14 |
<td colspan="2"><font face="Arial, Helvetica, sans-serif">© Copyright |
|
15 |
Generalitat Valenciana, IVER T.I. 2007.</font></td> |
|
16 |
</tr> |
|
17 |
</table> |
|
18 |
<h3>Extensión de ejemplo:</h3> |
|
19 |
<p> - Opciones menú</p> |
|
20 |
<p> - Información ToolBar</p> |
|
21 |
<p> - Modificar preferencias</p> |
|
22 |
<p> - Opción en el menú contextual</p> |
|
23 |
<p> - Posibilidad de visualizar las extensiones elegidas</p> |
|
24 |
<p> - Personalización del Splash</p> |
|
25 |
<p> - InfoTool personalizado para nuestra capa</p> |
|
26 |
<p> - Ventana de About</p> |
|
27 |
<p> - Crear extensión sin los fuentes de gvSIG</p> |
|
28 |
|
|
29 |
<p><br><br><b> Build Number: #build.number#</b></p> |
|
30 |
</body> |
|
31 |
</html> |
|
0 | 32 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_en.properties | ||
---|---|---|
1 |
#Translations for language [en] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto=Center view to point |
|
4 |
color_point=Color point |
|
5 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=Select the layers you want to get information from |
|
6 |
example_extension=Example extension |
|
7 |
formato_de_numero_incorrecto=Incorrect number format |
|
8 |
no_hay_ninguna_capa_seleccionada=No layer has been selected |
|
9 |
this_is_a_window_example=This is a window example |
|
10 |
Vista=View |
|
0 | 11 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_gl.properties | ||
---|---|---|
1 |
#Translations for language [gl] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto=Centrar a vista sobre un punto |
|
4 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=Debe seleccionar as capas das que desexe obter informaci\u00f3n |
|
5 |
formato_de_numero_incorrecto=Formato de n\u00famero incorrecto. |
|
6 |
no_hay_ninguna_capa_seleccionada=Non hai ningunha capa seleccionada |
|
7 |
Vista=Vista |
|
0 | 8 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/config.xml | ||
---|---|---|
1 |
<?xml version="1.0" encoding="ISO-8859-1"?> |
|
2 |
<plugin-config> |
|
3 |
<depends plugin-name="com.iver.cit.gvsig" /> |
|
4 |
<libraries library-dir="lib"/> |
|
5 |
<resourceBundle name="text"/> |
|
6 |
<extensions> |
|
7 |
<extension class-name="org.gvsig.examples.example1.ExampleExtension" |
|
8 |
description="Extensi?n de ejemplo." |
|
9 |
active="true" |
|
10 |
priority="1"> |
|
11 |
</extension> |
|
12 |
<extension class-name="org.gvsig.examples.example1.extension.CenterViewToPointExtension" |
|
13 |
description="Extensi?n que permite hacer zooms en funci?n de un par de coordenadas introducidas por el usuario." |
|
14 |
active="true" |
|
15 |
priority="2"> |
|
16 |
<menu text="Vista/Centrar_la_Vista_sobre_un_punto" tooltip="Centrar_la_Vista_sobre_un_punto" |
|
17 |
action-command="CENTERVIEWTOPOINT" |
|
18 |
icon="images/centerviewtopoint.png" /> |
|
19 |
<tool-bar name="com.iver.cit.gvsig.Herramientas"> |
|
20 |
<action-tool icon="images/centerviewtopoint.png" |
|
21 |
action-command="CENTERVIEWTOPOINT" tooltip="Centrar_la_Vista_sobre_un_punto" |
|
22 |
enable-text="deber?a de estar activada" last="true"/> |
|
23 |
</tool-bar> |
|
24 |
</extension> |
|
25 |
<extension class-name="org.gvsig.examples.example1.extension.InfoToolExampleExtension" |
|
26 |
description="Extensi?n encargada de gestionar la herramienta de info y centrar el extent al punto." |
|
27 |
active="true" |
|
28 |
priority="29"> |
|
29 |
<menu text="Vista/consulta/informacion" action-command="INFO" icon="images/Identify.png"/> |
|
30 |
<tool-bar name="View_Tools_Query" position="5"> |
|
31 |
<selectable-tool icon="images/Identify.png" action-command="INFO" tooltip="informacion" position="1"/> |
|
32 |
</tool-bar> |
|
33 |
</extension> |
|
34 |
<extension class-name="org.gvsig.examples.example1.extension.OpenCSVToPointsExtension" |
|
35 |
description="Extensi?n encargada de abrir una vista con una cpa de puntos de una fichero CSV." |
|
36 |
active="true" |
|
37 |
priority="30"> |
|
38 |
</extension> |
|
39 |
</extensions> |
|
40 |
</plugin-config> |
|
0 | 41 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_cs.properties | ||
---|---|---|
1 |
#Translations for language [cs] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto=Centruj pohled na st\u0159ed |
|
4 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=Ozna\u010dte vrstvy, ze kter\u00fdch chcete z\u00edskat informace |
|
5 |
formato_de_numero_incorrecto=Neplatn\u00e9 \u010d\u00edslo form\u00e1tu |
|
6 |
no_hay_ninguna_capa_seleccionada=Nebyla vybr\u00e1na \u017e\u00e1dn\u00e1 vrstva |
|
7 |
Vista=Pohled |
|
0 | 8 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_fr.properties | ||
---|---|---|
1 |
#Translations for language [fr] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto=Centrer la vue sur un point |
|
4 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=Vous devez s\u00e9lectionner les couches pour lesquelles vous souhaitez obtenir des informations. |
|
5 |
formato_de_numero_incorrecto=Format incorrect |
|
6 |
no_hay_ninguna_capa_seleccionada= |
|
7 |
Vista=Vue |
|
0 | 8 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_eu.properties | ||
---|---|---|
1 |
#Translations for language [eu] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto=Zentratu bista puntu batekiko |
|
4 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=Geruzak hautatu behar dituzu horien gaineko informazioa jasotzeko. |
|
5 |
formato_de_numero_incorrecto=Zenbakiaren formatua okerra da |
|
6 |
no_hay_ninguna_capa_seleccionada= |
|
7 |
Vista=Bista |
|
0 | 8 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_nl.properties | ||
---|---|---|
1 |
#Translations for language [nl] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto= |
|
4 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion= |
|
5 |
formato_de_numero_incorrecto= |
|
6 |
no_hay_ninguna_capa_seleccionada= |
|
7 |
Vista=Kaartbeeld |
|
0 | 8 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_pl.properties | ||
---|---|---|
1 |
#Translations for language [po] |
|
2 |
#Mon Mar 12 10:04:20 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto=Wycentruj w punkcie |
|
4 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=Wybierz warstwy, z kt\u00f3rych chcesz pobra\u0107 informacje |
|
5 |
formato_de_numero_incorrecto=Niew\u0142a\u015bciwy format liczbowy |
|
6 |
no_hay_ninguna_capa_seleccionada=Nie wybrano warstwy |
|
7 |
Vista=Widok |
|
0 | 8 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_it.properties | ||
---|---|---|
1 |
#Translations for language [it] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto=Centra la visuale su un punto |
|
4 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=Selezionare i layers di cui si desiderano informazioni. |
|
5 |
formato_de_numero_incorrecto=Formato del numero errato. |
|
6 |
no_hay_ninguna_capa_seleccionada=Nessun layer selezionato |
|
7 |
Vista=Vista |
|
0 | 8 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text.properties | ||
---|---|---|
1 |
#Translations for language [es] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto=Centrar la vista sobre un punto |
|
4 |
color_point=Color del punto |
|
5 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=Debe seleccionar las capas de las que quiera obtener informaci\u00f3n. |
|
6 |
example_extension=Extensi?n ejemplo |
|
7 |
formato_de_numero_incorrecto=Formato de n\u00famero incorrecto. |
|
8 |
no_hay_ninguna_capa_seleccionada=No hay ninguna capa seleccionada |
|
9 |
this_is_a_window_example=Esto es una ventana de ejemplo |
|
10 |
Vista=Vista |
|
0 | 11 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_ro.properties | ||
---|---|---|
1 |
#Translations for language [ro] |
|
2 |
#Thu Mar 01 10:01:15 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto=Centrar atentia a un punct |
|
4 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=Trebuie selectionate crpetele de la care dorim obtine informati |
|
5 |
formato_de_numero_incorrecto= |
|
6 |
no_hay_ninguna_capa_seleccionada=nu ai ninguna capeta selectionata |
|
7 |
Vista=Vedere |
|
0 | 8 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_zh.properties | ||
---|---|---|
1 |
#Translations for language [zh] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto=\u5411\u4e00\u70b9\u96c6\u4e2d |
|
4 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=\u60a8\u5fc5\u987b\u9009\u5b9a\u60a8\u8981\u8bfb\u53d6\u4fe1\u606f\u7684\u56fe\u5c42 |
|
5 |
formato_de_numero_incorrecto=\u6570\u5b57\u683c\u5f0f\u65e0\u6548 |
|
6 |
no_hay_ninguna_capa_seleccionada=\u672a\u9009\u5b9a\u56fe\u5c42 |
|
7 |
Vista=\u89c6\u56fe |
|
0 | 8 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_ca.properties | ||
---|---|---|
1 |
#Translations for language [ca] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto=Centrar la Vista sobre un punt |
|
4 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion=Ha de seleccionar les capes de les quals vol obtindre informaci\u00f3 |
|
5 |
formato_de_numero_incorrecto=Format de n\u00famero incorrecte |
|
6 |
no_hay_ninguna_capa_seleccionada=No hi ha cap capa seleccionada |
|
7 |
Vista=Vista |
|
0 | 8 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_pt.properties | ||
---|---|---|
1 |
#Translations for language [pt] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto= |
|
4 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion= |
|
5 |
formato_de_numero_incorrecto= |
|
6 |
no_hay_ninguna_capa_seleccionada= |
|
7 |
Vista=Vista |
|
0 | 8 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/config/text_de.properties | ||
---|---|---|
1 |
#Translations for language [de] |
|
2 |
#Mon Feb 26 16:06:24 CET 2007 |
|
3 |
Centrar_la_Vista_sobre_un_punto= |
|
4 |
debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion= |
|
5 |
formato_de_numero_incorrecto= |
|
6 |
no_hay_ninguna_capa_seleccionada= |
|
7 |
Vista=Ansicht |
|
0 | 8 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/build.number | ||
---|---|---|
1 |
#Build Number for ANT. Do not edit! |
|
2 |
#Thu Apr 19 17:16:38 CEST 2007 |
|
3 |
build.number=910 |
|
0 | 4 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/src/org/gvsig/examples/example1/tool/InfoToolListener.java | ||
---|---|---|
1 |
|
|
2 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
3 |
* |
|
4 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* Generalitat Valenciana |
|
23 |
* Conselleria d'Infraestructures i Transport |
|
24 |
* Av. Blasco Ib??ez, 50 |
|
25 |
* 46010 VALENCIA |
|
26 |
* SPAIN |
|
27 |
* |
|
28 |
* +34 963862235 |
|
29 |
* gvsig@gva.es |
|
30 |
* www.gvsig.gva.es |
|
31 |
* |
|
32 |
* or |
|
33 |
* |
|
34 |
* IVER T.I. S.A |
|
35 |
* Salamanca 50 |
|
36 |
* 46005 Valencia |
|
37 |
* Spain |
|
38 |
* |
|
39 |
* +34 963163400 |
|
40 |
* dac@iver.es |
|
41 |
*/ |
|
42 |
|
|
43 |
package org.gvsig.examples.example1.tool; |
|
44 |
|
|
45 |
import com.iver.andami.PluginServices; |
|
46 |
|
|
47 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
48 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
49 |
import com.iver.cit.gvsig.fmap.layers.FLayerGenericVectorial; |
|
50 |
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent; |
|
51 |
import com.iver.cit.gvsig.project.documents.view.toolListeners.InfoListener; |
|
52 |
|
|
53 |
|
|
54 |
/** |
|
55 |
* Class that extends of the tool InfoToolListenerImpl and |
|
56 |
* override the methods that interests us to change its behavior. |
|
57 |
* |
|
58 |
* @author Vicente Caballero Navarro |
|
59 |
*/ |
|
60 |
public class InfoToolListener extends InfoToolListenerImpl { |
|
61 |
|
|
62 |
public InfoToolListener(MapControl mapCtrl) { |
|
63 |
super(mapCtrl); |
|
64 |
|
|
65 |
} |
|
66 |
|
|
67 |
/* (non-Javadoc) |
|
68 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.Events.PointEvent) |
|
69 |
*/ |
|
70 |
public void point(PointEvent event) { |
|
71 |
super.point(event); |
|
72 |
PluginServices.getMainFrame().enableControls(); |
|
73 |
} |
|
74 |
} |
|
0 | 75 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/src/org/gvsig/examples/example1/tool/InfoToolListenerImpl.java | ||
---|---|---|
1 |
|
|
2 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
3 |
* |
|
4 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
|
22 |
* Generalitat Valenciana |
|
23 |
* Conselleria d'Infraestructures i Transport |
|
24 |
* Av. Blasco Ib??ez, 50 |
|
25 |
* 46010 VALENCIA |
|
26 |
* SPAIN |
|
27 |
* |
|
28 |
* +34 963862235 |
|
29 |
* gvsig@gva.es |
|
30 |
* www.gvsig.gva.es |
|
31 |
* |
|
32 |
* or |
|
33 |
* |
|
34 |
* IVER T.I. S.A |
|
35 |
* Salamanca 50 |
|
36 |
* 46005 Valencia |
|
37 |
* Spain |
|
38 |
* |
|
39 |
* +34 963163400 |
|
40 |
* dac@iver.es |
|
41 |
*/ |
|
42 |
|
|
43 |
package org.gvsig.examples.example1.tool; |
|
44 |
|
|
45 |
import com.iver.andami.PluginServices; |
|
46 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
47 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
48 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
|
49 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
|
50 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
|
51 |
import com.iver.cit.gvsig.fmap.layers.FLayer; |
|
52 |
import com.iver.cit.gvsig.fmap.layers.FLayerGenericVectorial; |
|
53 |
import com.iver.cit.gvsig.fmap.layers.GraphicLayer; |
|
54 |
import com.iver.cit.gvsig.fmap.rendering.FGraphic; |
|
55 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
|
56 |
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent; |
|
57 |
import com.iver.cit.gvsig.fmap.tools.Listeners.PointListener; |
|
58 |
import com.iver.cit.gvsig.project.documents.view.toolListeners.InfoListener; |
|
59 |
|
|
60 |
import org.gvsig.examples.example1.extension.CenterViewToPointExtension; |
|
61 |
import org.gvsig.examples.example1.tool.gui.InfoWindowExample; |
|
62 |
|
|
63 |
import java.awt.Cursor; |
|
64 |
import java.awt.Image; |
|
65 |
import java.awt.Point; |
|
66 |
import java.awt.Toolkit; |
|
67 |
import java.awt.geom.Point2D; |
|
68 |
import java.awt.geom.Rectangle2D; |
|
69 |
|
|
70 |
import javax.swing.ImageIcon; |
|
71 |
|
|
72 |
|
|
73 |
/** |
|
74 |
* Implementation of the interface PointListener as tool |
|
75 |
* of information and center the extent to that point. |
|
76 |
* |
|
77 |
* @author Vicente Caballero Navarro |
|
78 |
*/ |
|
79 |
public class InfoToolListenerImpl implements PointListener { |
|
80 |
private final Image icentertopoint = new ImageIcon(MapControl.class.getResource( |
|
81 |
"images/InfoCursor.gif")).getImage(); |
|
82 |
private Cursor cur = Toolkit.getDefaultToolkit().createCustomCursor(icentertopoint, |
|
83 |
new Point(16, 16), ""); |
|
84 |
private MapControl mapControl; |
|
85 |
private InfoListener infoListener; |
|
86 |
/** |
|
87 |
* Create a new InfoToolListenerImpl. |
|
88 |
* |
|
89 |
* @param mapControl MapControl. |
|
90 |
*/ |
|
91 |
public InfoToolListenerImpl(MapControl mapControl) { |
|
92 |
this.mapControl = mapControl; |
|
93 |
infoListener=new InfoListener(mapControl); |
|
94 |
} |
|
95 |
|
|
96 |
/* (non-Javadoc) |
|
97 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.Events.PointEvent) |
|
98 |
*/ |
|
99 |
public void point(PointEvent event) { |
|
100 |
FLayer[] layers=mapControl.getMapContext().getLayers().getActives(); |
|
101 |
if (layers[0] instanceof FLayerGenericVectorial){ |
|
102 |
if (layers[0].getProperty("CapaDePruebaCSV")!=null){ |
|
103 |
Point2D centerPoint = mapControl.getViewPort().toMapPoint(event.getPoint()); |
|
104 |
zoomToCoordinates(centerPoint); |
|
105 |
drawPoint(centerPoint); |
|
106 |
InfoWindowExample iwe=new InfoWindowExample(); |
|
107 |
PluginServices.getMDIManager().addWindow(iwe); |
|
108 |
} |
|
109 |
} else { |
|
110 |
try { |
|
111 |
infoListener.point(event); |
|
112 |
} catch (BehaviorException e) { |
|
113 |
e.printStackTrace(); |
|
114 |
} |
|
115 |
} |
|
116 |
|
|
117 |
} |
|
118 |
|
|
119 |
private void drawPoint(Point2D center) { |
|
120 |
GraphicLayer lyr = mapControl.getMapContext().getGraphicsLayer(); |
|
121 |
lyr.clearAllGraphics(); |
|
122 |
|
|
123 |
FSymbol theSymbol = new FSymbol(FConstant.SYMBOL_TYPE_POINT, |
|
124 |
CenterViewToPointExtension.COLOR); |
|
125 |
int idSymbol = lyr.addSymbol(theSymbol); |
|
126 |
IGeometry geom = ShapeFactory.createPoint2D(center.getX(), center.getY()); |
|
127 |
FGraphic theGraphic = new FGraphic(geom, idSymbol); |
|
128 |
lyr.addGraphic(theGraphic); |
|
129 |
mapControl.drawGraphics(); |
|
130 |
mapControl.drawMap(false); |
|
131 |
} |
|
132 |
|
|
133 |
private void zoomToCoordinates(Point2D center) { |
|
134 |
Rectangle2D oldExtent = mapControl.getViewPort().getAdjustedExtent(); |
|
135 |
double oldCenterX = oldExtent.getCenterX(); |
|
136 |
double oldCenterY = oldExtent.getCenterY(); |
|
137 |
double movX = center.getX() - oldCenterX; |
|
138 |
double movY = center.getY() - oldCenterY; |
|
139 |
double upperLeftCornerX = oldExtent.getMinX() + movX; |
|
140 |
double upperLeftCornerY = oldExtent.getMinY() + movY; |
|
141 |
double width = oldExtent.getWidth(); |
|
142 |
double height = oldExtent.getHeight(); |
|
143 |
Rectangle2D extent = new Rectangle2D.Double(upperLeftCornerX, |
|
144 |
upperLeftCornerY, width, height); |
|
145 |
mapControl.getViewPort().setExtent(extent); |
|
146 |
mapControl.getMapContext().clearAllCachingImageDrawnLayers(); |
|
147 |
} |
|
148 |
|
|
149 |
/* (non-Javadoc) |
|
150 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#getCursor() |
|
151 |
*/ |
|
152 |
public Cursor getCursor() { |
|
153 |
return cur; |
|
154 |
} |
|
155 |
|
|
156 |
/* (non-Javadoc) |
|
157 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.ToolListener#cancelDrawing() |
|
158 |
*/ |
|
159 |
public boolean cancelDrawing() { |
|
160 |
return true; |
|
161 |
} |
|
162 |
|
|
163 |
/* (non-Javadoc) |
|
164 |
* @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#pointDoubleClick(com.iver.cit.gvsig.fmap.tools.Events.PointEvent) |
|
165 |
*/ |
|
166 |
public void pointDoubleClick(PointEvent event) { |
|
167 |
} |
|
168 |
} |
|
0 | 169 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/src/org/gvsig/examples/example1/tool/gui/InfoWindowExample.java | ||
---|---|---|
1 |
package org.gvsig.examples.example1.tool.gui; |
|
2 |
|
|
3 |
import java.awt.event.ActionListener; |
|
4 |
|
|
5 |
import javax.swing.JPanel; |
|
6 |
|
|
7 |
import com.iver.andami.PluginServices; |
|
8 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
9 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
10 |
import javax.swing.JLabel; |
|
11 |
|
|
12 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
|
13 |
|
|
14 |
public class InfoWindowExample extends JPanel implements IWindow{ |
|
15 |
|
|
16 |
private JLabel jLabel = null; |
|
17 |
private AcceptCancelPanel accept; |
|
18 |
|
|
19 |
/** |
|
20 |
* This method initializes |
|
21 |
* |
|
22 |
*/ |
|
23 |
public InfoWindowExample() { |
|
24 |
super(); |
|
25 |
initialize(); |
|
26 |
} |
|
27 |
|
|
28 |
/** |
|
29 |
* This method initializes this |
|
30 |
* |
|
31 |
*/ |
|
32 |
private void initialize() { |
|
33 |
jLabel = new JLabel(); |
|
34 |
jLabel.setText(PluginServices.getText(this,"this_is_a_window_example")); |
|
35 |
this.setSize(new java.awt.Dimension(380,78)); |
|
36 |
|
|
37 |
this.add(jLabel, null); |
|
38 |
this.add(getAcceptCancelPanel(), null); |
|
39 |
} |
|
40 |
|
|
41 |
public WindowInfo getWindowInfo() { |
|
42 |
WindowInfo wi=new WindowInfo(WindowInfo.MODALDIALOG); |
|
43 |
return wi; |
|
44 |
} |
|
45 |
private AcceptCancelPanel getAcceptCancelPanel() { |
|
46 |
if (accept == null) { |
|
47 |
ActionListener okAction, cancelAction; |
|
48 |
okAction = new java.awt.event.ActionListener() { |
|
49 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
50 |
PluginServices.getMDIManager().closeWindow( |
|
51 |
InfoWindowExample.this); |
|
52 |
} |
|
53 |
}; |
|
54 |
cancelAction = new java.awt.event.ActionListener() { |
|
55 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
56 |
PluginServices.getMDIManager().closeWindow( |
|
57 |
InfoWindowExample.this); |
|
58 |
} |
|
59 |
}; |
|
60 |
accept = new AcceptCancelPanel(okAction, cancelAction); |
|
61 |
accept.setPreferredSize(new java.awt.Dimension(300, 300)); |
|
62 |
// accept.setBounds(new java.awt.Rectangle(243,387,160,28)); |
|
63 |
accept.setEnabled(true); |
|
64 |
accept.setVisible(true); |
|
65 |
} |
|
66 |
return accept; |
|
67 |
} |
|
68 |
|
|
69 |
} // @jve:decl-index=0:visual-constraint="10,10" |
|
0 | 70 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/src/org/gvsig/examples/example1/preferences/CenterViewToPointPage.java | ||
---|---|---|
1 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
2 |
* |
|
3 |
* Copyright (C) 2005 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 |
|
|
42 |
package org.gvsig.examples.example1.preferences; |
|
43 |
|
|
44 |
import com.iver.andami.PluginServices; |
|
45 |
import com.iver.andami.preferences.AbstractPreferencePage; |
|
46 |
import com.iver.andami.preferences.StoreException; |
|
47 |
|
|
48 |
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel; |
|
49 |
|
|
50 |
import com.iver.utiles.StringUtilities; |
|
51 |
|
|
52 |
import org.gvsig.examples.example1.extension.CenterViewToPointExtension; |
|
53 |
|
|
54 |
import java.awt.Color; |
|
55 |
|
|
56 |
import java.util.prefs.Preferences; |
|
57 |
|
|
58 |
import javax.swing.ImageIcon; |
|
59 |
import javax.swing.JPanel; |
|
60 |
|
|
61 |
|
|
62 |
/** |
|
63 |
* References page of center view to point options. |
|
64 |
* |
|
65 |
* @author Vicente Caballero Navarro |
|
66 |
*/ |
|
67 |
public class CenterViewToPointPage extends AbstractPreferencePage { |
|
68 |
private static Preferences prefs = Preferences.userRoot().node("centerviewtopoint"); |
|
69 |
private ColorChooserPanel colorPoint; |
|
70 |
private ImageIcon icon; |
|
71 |
|
|
72 |
public CenterViewToPointPage() { |
|
73 |
super(); |
|
74 |
icon = new ImageIcon(this.getClass().getClassLoader().getResource("images/CenterView.png")); |
|
75 |
addComponent(PluginServices.getText(this, "color_point") + ":", |
|
76 |
colorPoint = new ColorChooserPanel()); |
|
77 |
} |
|
78 |
|
|
79 |
/* (non-Javadoc) |
|
80 |
* @see com.iver.andami.preferences.IPreference#initializeValues() |
|
81 |
*/ |
|
82 |
public void initializeValues() { |
|
83 |
String colorString = prefs.get("colorcenterviewtopoint", |
|
84 |
StringUtilities.color2String(CenterViewToPointExtension.COLOR)); |
|
85 |
Color color = StringUtilities.string2Color(colorString); |
|
86 |
CenterViewToPointExtension.COLOR = color; |
|
87 |
colorPoint.setColor(color); |
|
88 |
colorPoint.setAlpha(255); |
|
89 |
} |
|
90 |
|
|
91 |
/* (non-Javadoc) |
|
92 |
* @see com.iver.andami.preferences.IPreference#getID() |
|
93 |
*/ |
|
94 |
public String getID() { |
|
95 |
return this.getClass().getName(); |
|
96 |
} |
|
97 |
|
|
98 |
/* (non-Javadoc) |
|
99 |
* @see com.iver.andami.preferences.IPreference#getTitle() |
|
100 |
*/ |
|
101 |
public String getTitle() { |
|
102 |
return PluginServices.getText(this, "Centrar_la_Vista_sobre_un_punto"); |
|
103 |
} |
|
104 |
|
|
105 |
/* (non-Javadoc) |
|
106 |
* @see com.iver.andami.preferences.IPreference#getPanel() |
|
107 |
*/ |
|
108 |
public JPanel getPanel() { |
|
109 |
return this; |
|
110 |
} |
|
111 |
|
|
112 |
/* (non-Javadoc) |
|
113 |
* @see com.iver.andami.preferences.AbstractPreferencePage#storeValues() |
|
114 |
*/ |
|
115 |
public void storeValues() throws StoreException { |
|
116 |
String colorString; |
|
117 |
colorString = StringUtilities.color2String(colorPoint.getColor()); |
|
118 |
prefs.put("colorcenterviewtopoint", colorString); |
|
119 |
CenterViewToPointExtension.COLOR = colorPoint.getColor(); |
|
120 |
} |
|
121 |
|
|
122 |
/* (non-Javadoc) |
|
123 |
* @see com.iver.andami.preferences.IPreference#initializeDefaults() |
|
124 |
*/ |
|
125 |
public void initializeDefaults() { |
|
126 |
colorPoint.setColor(CenterViewToPointExtension.COLOR); |
|
127 |
} |
|
128 |
|
|
129 |
/* (non-Javadoc) |
|
130 |
* @see com.iver.andami.preferences.IPreference#getIcon() |
|
131 |
*/ |
|
132 |
public ImageIcon getIcon() { |
|
133 |
return icon; |
|
134 |
} |
|
135 |
|
|
136 |
/* (non-Javadoc) |
|
137 |
* @see com.iver.andami.preferences.IPreference#isValueChanged() |
|
138 |
*/ |
|
139 |
public boolean isValueChanged() { |
|
140 |
return super.hasChanged(); |
|
141 |
} |
|
142 |
|
|
143 |
/* (non-Javadoc) |
|
144 |
* @see com.iver.andami.preferences.AbstractPreferencePage#setChangesApplied() |
|
145 |
*/ |
|
146 |
public void setChangesApplied() { |
|
147 |
setChanged(false); |
|
148 |
} |
|
149 |
} |
|
0 | 150 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/src/org/gvsig/examples/example1/gui/InputCoordinatesPanel.java | ||
---|---|---|
1 |
/* |
|
2 |
* Created on 08-nov-2005 |
|
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 org.gvsig.examples.example1.gui; |
|
45 |
|
|
46 |
import java.awt.Color; |
|
47 |
import java.awt.Component; |
|
48 |
import java.awt.event.ActionEvent; |
|
49 |
import java.awt.event.ActionListener; |
|
50 |
import java.awt.event.MouseEvent; |
|
51 |
import java.awt.geom.Point2D; |
|
52 |
import java.awt.geom.Rectangle2D; |
|
53 |
|
|
54 |
import javax.swing.JDialog; |
|
55 |
import javax.swing.JLabel; |
|
56 |
import javax.swing.JOptionPane; |
|
57 |
import javax.swing.JPanel; |
|
58 |
import javax.swing.JTextField; |
|
59 |
|
|
60 |
import org.cresques.cts.IProjection; |
|
61 |
import org.gvsig.examples.example1.extension.CenterViewToPointExtension; |
|
62 |
import org.gvsig.gui.beans.AcceptCancelPanel; |
|
63 |
|
|
64 |
import com.iver.andami.PluginServices; |
|
65 |
import com.iver.andami.ui.mdiManager.IWindow; |
|
66 |
import com.iver.andami.ui.mdiManager.WindowInfo; |
|
67 |
import com.iver.cit.gvsig.fmap.MapContext; |
|
68 |
import com.iver.cit.gvsig.fmap.MapControl; |
|
69 |
import com.iver.cit.gvsig.fmap.core.IGeometry; |
|
70 |
import com.iver.cit.gvsig.fmap.core.ShapeFactory; |
|
71 |
import com.iver.cit.gvsig.fmap.core.v02.FConstant; |
|
72 |
import com.iver.cit.gvsig.fmap.core.v02.FSymbol; |
|
73 |
import com.iver.cit.gvsig.fmap.layers.GraphicLayer; |
|
74 |
import com.iver.cit.gvsig.fmap.rendering.FGraphic; |
|
75 |
import com.iver.cit.gvsig.fmap.tools.BehaviorException; |
|
76 |
import com.iver.cit.gvsig.fmap.tools.Events.PointEvent; |
|
77 |
import com.iver.cit.gvsig.gui.panels.ColorChooserPanel; |
|
78 |
import com.iver.cit.gvsig.project.documents.view.gui.View; |
|
79 |
import com.iver.cit.gvsig.project.documents.view.toolListeners.InfoListener; |
|
80 |
import javax.swing.JButton; |
|
81 |
|
|
82 |
|
|
83 |
/** |
|
84 |
* The InputCoordinatesPanel class creates a JPanel where the |
|
85 |
* user can input the coordinates of the point of reference |
|
86 |
* for center the View. |
|
87 |
* |
|
88 |
* @author jmorell |
|
89 |
*/ |
|
90 |
public class InputCoordinatesPanel extends JPanel implements IWindow { |
|
91 |
private static final long serialVersionUID = 1L; |
|
92 |
private JLabel labelX = null; |
|
93 |
private JTextField textX = null; |
|
94 |
private JLabel labelY = null; |
|
95 |
private JTextField textY = null; |
|
96 |
private MapControl mapControl; |
|
97 |
private WindowInfo viewInfo = null; |
|
98 |
private String firstCoordinate; |
|
99 |
private String secondCoordinate; |
|
100 |
private Point2D center; |
|
101 |
private GraphicLayer lyr; |
|
102 |
private ColorChooserPanel colorPanel; |
|
103 |
private AcceptCancelPanel okCancelPanel = null; |
|
104 |
private JButton bRemovePoint = null; |
|
105 |
private View view=null; |
|
106 |
/** |
|
107 |
* This is the default constructor |
|
108 |
*/ |
|
109 |
public InputCoordinatesPanel(View view) { |
|
110 |
super(); |
|
111 |
this.view=view; |
|
112 |
this.mapControl = view.getMapControl(); |
|
113 |
lyr=mapControl.getMapContext().getGraphicsLayer(); |
|
114 |
initializeCoordinates(); |
|
115 |
initialize(); |
|
116 |
} |
|
117 |
|
|
118 |
private void initializeCoordinates() { |
|
119 |
IProjection proj = mapControl.getProjection(); |
|
120 |
String projName = proj.getAbrev(); |
|
121 |
if (projName.equals("EPSG:23030") || projName.equals("EPSG:27492") || projName.equals("EPSG:42101") || projName.equals("EPSG:42304")) { |
|
122 |
firstCoordinate = "X"; |
|
123 |
secondCoordinate = "Y"; |
|
124 |
} else if (projName.equals("EPSG:4230") || projName.equals("EPSG:4326")) { |
|
125 |
firstCoordinate = "Lon"; |
|
126 |
secondCoordinate = "Lat"; |
|
127 |
} else { |
|
128 |
System.out.println("Proyecci?n: " + projName); |
|
129 |
System.out.println("Proyecci?n no soportada."); |
|
130 |
} |
|
131 |
} |
|
132 |
|
|
133 |
private void zoomToCoordinates() throws Exception { |
|
134 |
try{ |
|
135 |
Rectangle2D oldExtent = mapControl.getViewPort().getAdjustedExtent(); |
|
136 |
double oldCenterX = oldExtent.getCenterX(); |
|
137 |
double oldCenterY = oldExtent.getCenterY(); |
|
138 |
double centerX = (new Double((String)textX.getText())).doubleValue(); |
|
139 |
double centerY = (new Double((String)textY.getText())).doubleValue(); |
|
140 |
center=new Point2D.Double(centerX,centerY); |
|
141 |
double movX = centerX-oldCenterX; |
|
142 |
double movY = centerY-oldCenterY; |
|
143 |
double upperLeftCornerX = oldExtent.getMinX()+movX; |
|
144 |
double upperLeftCornerY = oldExtent.getMinY()+movY; |
|
145 |
double width = oldExtent.getWidth(); |
|
146 |
double height = oldExtent.getHeight(); |
|
147 |
Rectangle2D extent = new Rectangle2D.Double(upperLeftCornerX, upperLeftCornerY, width, height); |
|
148 |
mapControl.getViewPort().setExtent(extent); |
|
149 |
}catch (NumberFormatException e) { |
|
150 |
throw new Exception(); |
|
151 |
} |
|
152 |
|
|
153 |
} |
|
154 |
|
|
155 |
/** |
|
156 |
* This method initializes this |
|
157 |
* |
|
158 |
* @return void |
|
159 |
*/ |
|
160 |
private void initialize() { |
|
161 |
labelY = new JLabel(); |
|
162 |
labelY.setBounds(10, 35, 28, 20); |
|
163 |
labelY.setText(secondCoordinate + ":"); |
|
164 |
labelX = new JLabel(); |
|
165 |
labelX.setBounds(10, 10, 28, 20); |
|
166 |
labelX.setText(firstCoordinate + ":"); |
|
167 |
this.setLayout(null); |
|
168 |
this.setSize(307, 111); |
|
169 |
this.add(labelX, null); |
|
170 |
this.add(getTextX(), null); |
|
171 |
this.add(labelY, null); |
|
172 |
this.add(getTextY(), null); |
|
173 |
this.add(getColorPanel()); |
|
174 |
this.add(getOkCancelPanel(), null); |
|
175 |
this.add(getBRemovePoint(), null); |
|
176 |
} |
|
177 |
|
|
178 |
/** |
|
179 |
* This method initializes textX |
|
180 |
* |
|
181 |
* @return javax.swing.JTextField |
|
182 |
*/ |
|
183 |
private JTextField getTextX() { |
|
184 |
if (textX == null) { |
|
185 |
textX = new JTextField(); |
|
186 |
textX.setBounds(40, 10, 260, 20); |
|
187 |
textX.addActionListener(new java.awt.event.ActionListener() { |
|
188 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
189 |
textX.transferFocus(); |
|
190 |
} |
|
191 |
}); |
|
192 |
} |
|
193 |
return textX; |
|
194 |
} |
|
195 |
|
|
196 |
/** |
|
197 |
* This method initializes textY |
|
198 |
* |
|
199 |
* @return javax.swing.JTextField |
|
200 |
*/ |
|
201 |
private JTextField getTextY() { |
|
202 |
if (textY == null) { |
|
203 |
textY = new JTextField(); |
|
204 |
textY.setBounds(40, 35, 260, 20); |
|
205 |
textY.addActionListener(new java.awt.event.ActionListener() { |
|
206 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
207 |
textY.transferFocus(); |
|
208 |
} |
|
209 |
}); |
|
210 |
} |
|
211 |
return textY; |
|
212 |
} |
|
213 |
|
|
214 |
/* (non-Javadoc) |
|
215 |
* @see com.iver.andami.ui.mdiManager.View#getViewInfo() |
|
216 |
*/ |
|
217 |
public WindowInfo getWindowInfo() { |
|
218 |
if (viewInfo == null) { |
|
219 |
viewInfo=new WindowInfo(WindowInfo.MODALDIALOG); |
|
220 |
viewInfo.setTitle(PluginServices.getText(this,"Centrar_la_Vista_sobre_un_punto")); |
|
221 |
viewInfo.setWidth(this.getWidth()+8); |
|
222 |
viewInfo.setHeight(this.getHeight()); |
|
223 |
} |
|
224 |
return viewInfo; |
|
225 |
} |
|
226 |
private void openInfo(){ |
|
227 |
InfoListener infoListener=new InfoListener(mapControl); |
|
228 |
MouseEvent e=new MouseEvent((Component)view,MouseEvent.BUTTON1,MouseEvent.ACTION_EVENT_MASK,MouseEvent.MOUSE_CLICKED,500,400,1,true); |
|
229 |
Point2D centerPixels=mapControl.getViewPort().fromMapPoint(center.getX(),center.getY()); |
|
230 |
PointEvent pe=new PointEvent(centerPixels,e); |
|
231 |
try { |
|
232 |
infoListener.point(pe); |
|
233 |
} catch (BehaviorException e1) { |
|
234 |
e1.printStackTrace(); |
|
235 |
} |
|
236 |
if (mapControl.getMapContext().getLayers().getActives().length==0){ |
|
237 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),PluginServices.getText(this,"no_hay_ninguna_capa_seleccionada")+" \n"+ |
|
238 |
PluginServices.getText(this,"debe_seleccionar_las_capas_de_las_que_quiera_obtener_informacion")); |
|
239 |
} |
|
240 |
} |
|
241 |
private void drawPoint(Color color){ |
|
242 |
CenterViewToPointExtension.COLOR=color; |
|
243 |
lyr.clearAllGraphics(); |
|
244 |
FSymbol theSymbol = new FSymbol(FConstant.SYMBOL_TYPE_POINT,color); |
|
245 |
int idSymbol = lyr.addSymbol(theSymbol); |
|
246 |
IGeometry geom = ShapeFactory.createPoint2D(center.getX(),center.getY()); |
|
247 |
FGraphic theGraphic = new FGraphic(geom, idSymbol); |
|
248 |
lyr.addGraphic(theGraphic); |
|
249 |
mapControl.drawGraphics(); |
|
250 |
mapControl.drawMap(false); |
|
251 |
|
|
252 |
} |
|
253 |
|
|
254 |
|
|
255 |
/** |
|
256 |
* This method initializes jPanel |
|
257 |
* |
|
258 |
* @return javax.swing.JPanel |
|
259 |
*/ |
|
260 |
private JPanel getColorPanel() { |
|
261 |
if (colorPanel==null){ |
|
262 |
colorPanel=new ColorChooserPanel(); |
|
263 |
colorPanel.setAlpha(250); |
|
264 |
colorPanel.setColor(CenterViewToPointExtension.COLOR); |
|
265 |
colorPanel.setBounds(new java.awt.Rectangle(40,59,123,24)); |
|
266 |
} |
|
267 |
return colorPanel; |
|
268 |
} |
|
269 |
|
|
270 |
/** |
|
271 |
* This method initializes okCancelPanel |
|
272 |
* |
|
273 |
* @return javax.swing.JPanel |
|
274 |
*/ |
|
275 |
private AcceptCancelPanel getOkCancelPanel() { |
|
276 |
if (okCancelPanel == null) { |
|
277 |
ActionListener okAction, cancelAction; |
|
278 |
okAction = new java.awt.event.ActionListener() { |
|
279 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
280 |
try{ |
|
281 |
zoomToCoordinates(); |
|
282 |
}catch (Exception e1) { |
|
283 |
JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),PluginServices.getText(this,"formato_de_numero_incorrecto")); |
|
284 |
return; |
|
285 |
} |
|
286 |
// y sale. |
|
287 |
if (PluginServices.getMainFrame() == null) |
|
288 |
((JDialog) (getParent().getParent().getParent().getParent())).dispose(); |
|
289 |
else |
|
290 |
PluginServices.getMDIManager().closeWindow(InputCoordinatesPanel.this); |
|
291 |
|
|
292 |
openInfo(); |
|
293 |
drawPoint(((ColorChooserPanel)getColorPanel()).getColor()); |
|
294 |
} |
|
295 |
}; |
|
296 |
cancelAction = new ActionListener() { |
|
297 |
public void actionPerformed(ActionEvent e) { |
|
298 |
closeThis(); |
|
299 |
} |
|
300 |
}; |
|
301 |
okCancelPanel = new AcceptCancelPanel(okAction, cancelAction); |
|
302 |
okCancelPanel.setBounds(new java.awt.Rectangle(40, 88, 260, 30)); |
|
303 |
} |
|
304 |
return okCancelPanel; |
|
305 |
} |
|
306 |
|
|
307 |
private void closeThis() { |
|
308 |
PluginServices.getMDIManager().closeWindow(this); |
|
309 |
|
|
310 |
} |
|
311 |
|
|
312 |
/** |
|
313 |
* This method initializes bRemovePoint |
|
314 |
* |
|
315 |
* @return javax.swing.JButton |
|
316 |
*/ |
|
317 |
private JButton getBRemovePoint() { |
|
318 |
if (bRemovePoint == null) { |
|
319 |
bRemovePoint = new JButton(); |
|
320 |
bRemovePoint.setBounds(new java.awt.Rectangle(181,59,101,25)); |
|
321 |
bRemovePoint.setText(PluginServices.getText(this,"remove")); |
|
322 |
bRemovePoint.addActionListener(new java.awt.event.ActionListener() { |
|
323 |
public void actionPerformed(java.awt.event.ActionEvent e) { |
|
324 |
lyr.clearAllGraphics(); |
|
325 |
mapControl.drawMap(false); |
|
326 |
} |
|
327 |
}); |
|
328 |
} |
|
329 |
return bRemovePoint; |
|
330 |
} |
|
331 |
|
|
332 |
|
|
333 |
} // @jve:decl-index=0:visual-constraint="103,18" |
|
0 | 334 |
tags/tmp_build/examples/exaExampleCenterViewToPoint/src/org/gvsig/examples/example1/toc/PropertiesTocMenuEntry.java | ||
---|---|---|
1 |
|
|
2 |
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana |
|
3 |
* |
|
4 |
* Copyright (C) 2005 IVER T.I. and Generalitat Valenciana. |
|
5 |
* |
|
6 |
* This program is free software; you can redistribute it and/or |
|
7 |
* modify it under the terms of the GNU General Public License |
|
8 |
* as published by the Free Software Foundation; either version 2 |
|
9 |
* of the License, or (at your option) any later version. |
|
10 |
* |
|
11 |
* This program is distributed in the hope that it will be useful, |
|
12 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
13 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
14 |
* GNU General Public License for more details. |
|
15 |
* |
|
16 |
* You should have received a copy of the GNU General Public License |
|
17 |
* along with this program; if not, write to the Free Software |
|
18 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,USA. |
|
19 |
* |
|
20 |
* For more information, contact: |
|
21 |
* |
Also available in: Unified diff