Revision 14890

View differences:

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&oacute;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">&copy; Copyright
15
      Generalitat Valenciana, IVER T.I. 2007.</font></td>
16
  </tr>
17
</table>
18
  <h3>Extensi&oacute;n de ejemplo:</h3>
19
   <p> - Opciones men&uacute;</p>
20
   <p> - Informaci&oacute;n ToolBar</p>
21
   <p> - Modificar preferencias</p>
22
   <p> - Opci&oacute;n en el men&uacute; contextual</p>
23
   <p> - Posibilidad de visualizar las extensiones elegidas</p>
24
   <p> - Personalizaci&oacute;n del Splash</p>
25
   <p> - InfoTool personalizado para nuestra capa</p>
26
   <p> - Ventana de About</p>
27
   <p> - Crear extensi&oacute;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/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
 *
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.toc;
44

  
45
import com.iver.andami.PluginServices;
46

  
47
import com.iver.cit.gvsig.fmap.layers.FLayer;
48
import com.iver.cit.gvsig.project.documents.view.gui.View;
49
import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction;
50
import com.iver.cit.gvsig.project.documents.view.toc.ITocItem;
51

  
52
import org.gvsig.examples.example1.gui.InputCoordinatesPanel;
53

  
54

  
55
/**
56
 * Properties toc menu entry center view to point.
57
 *
58
 * @author Vicente Caballero Navarro
59
 */
60
public class PropertiesTocMenuEntry extends AbstractTocContextMenuAction {
61
    /* (non-Javadoc)
62
     * @see com.iver.cit.gvsig.project.documents.IContextMenuAction#getGroup()
63
     */
64
    public String getGroup() {
65
        return "examplegroup";
66
    }
67

  
68
    /* (non-Javadoc)
69
     * @see com.iver.cit.gvsig.project.documents.IContextMenuAction#getGroupOrder()
70
     */
71
    public int getGroupOrder() {
72
        return 1;
73
    }
74

  
75
    /* (non-Javadoc)
76
     * @see com.iver.cit.gvsig.project.documents.IContextMenuAction#getOrder()
77
     */
78
    public int getOrder() {
79
        return 1;
80
    }
81

  
82
    /* (non-Javadoc)
83
     * @see com.iver.cit.gvsig.project.documents.IContextMenuAction#getText()
84
     */
85
    public String getText() {
86
        return PluginServices.getText(this, "Centrar_la_Vista_sobre_un_punto");
87
    }
88

  
89
    /* (non-Javadoc)
90
     * @see com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction#isEnabled(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
91
     */
92
    public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
93
        return true;
94
    }
95

  
96
    /* (non-Javadoc)
97
     * @see com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction#isVisible(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
98
     */
99
    public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
100
        return (isTocItemBranch(item));
101
    }
102

  
103
    /* (non-Javadoc)
104
     * @see com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction#execute(com.iver.cit.gvsig.project.documents.view.toc.ITocItem, com.iver.cit.gvsig.fmap.layers.FLayer[])
105
     */
106
    public void execute(ITocItem item, FLayer[] selectedItems) {
107
        View vista = (View) PluginServices.getMDIManager().getActiveWindow();
108
        InputCoordinatesPanel dataSelectionPanel = new InputCoordinatesPanel(vista);
109
        PluginServices.getMDIManager().addWindow(dataSelectionPanel);
110
    }
111
}
0 112

  
tags/tmp_build/examples/exaExampleCenterViewToPoint/src/org/gvsig/examples/example1/ExampleExtension.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
/* gvSIG. Sistema de Informaci?n Geogr?fica de la Generalitat Valenciana
44
 *
45
 * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
46
 *
47
 * This program is free software; you can redistribute it and/or
48
 * modify it under the terms of the GNU General Public License
49
 * as published by the Free Software Foundation; either version 2
50
 * of the License, or (at your option) any later version.
51
 *
52
 * This program is distributed in the hope that it will be useful,
53
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
54
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
55
 * GNU General Public License for more details.
56
 *
57
 * You should have received a copy of the GNU General Public License
58
 * along with this program; if not, write to the Free Software
59
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,USA.
60
 *
61
 * For more information, contact:
62
 *
63
 *  Generalitat Valenciana
64
 *   Conselleria d'Infraestructures i Transport
65
 *   Av. Blasco Ib??ez, 50
66
 *   46010 VALENCIA
67
 *   SPAIN
68
 *
69
 *      +34 963862235
70
 *   gvsig@gva.es
71
 *      www.gvsig.gva.es
72
 *
73
 *    or
74
 *
75
 *   IVER T.I. S.A
76
 *   Salamanca 50
77
 *   46005 Valencia
78
 *   Spain
79
 *
80
 *   +34 963163400
81
 *   dac@iver.es
82
 */
83
package org.gvsig.examples.example1;
84

  
85
import com.iver.andami.PluginServices;
86
import com.iver.andami.plugins.Extension;
87
import com.iver.andami.plugins.ExtensionDecorator;
88
import com.iver.andami.preferences.IPreference;
89
import com.iver.andami.preferences.IPreferenceExtension;
90

  
91
import com.iver.cit.gvsig.About;
92
import com.iver.cit.gvsig.gui.panels.FPanelAbout;
93

  
94
import com.iver.utiles.extensionPoints.ExtensionPoints;
95
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
96

  
97
import org.gvsig.examples.example1.preferences.CenterViewToPointPage;
98
import org.gvsig.examples.example1.toc.PropertiesTocMenuEntry;
99

  
100
import java.util.ArrayList;
101

  
102

  
103
/**
104
 * Example of extension with a dialog of preferences, option in a context menu,
105
 * Exclusive extensions and about page.
106
 *
107
 * @author Vicente Caballero Navarro
108
 */
109
public class ExampleExtension extends Extension implements IPreferenceExtension {
110
    private CenterViewToPointPage centerViewPage = new CenterViewToPointPage();
111

  
112
    /* (non-Javadoc)
113
     * @see com.iver.andami.plugins.IExtension#initialize()
114
     */
115
    public void initialize() {
116
    }
117

  
118
    /* (non-Javadoc)
119
     * @see com.iver.andami.plugins.IExtension#postInitialize()
120
     */
121
    public void postInitialize() {
122
        super.postInitialize();
123

  
124
        ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance();
125
        extensionPoints.add("View_TocActions", "CenterViewToPoint",
126
            new PropertiesTocMenuEntry());
127

  
128
        About about = (About) PluginServices.getExtension(About.class);
129
        FPanelAbout panelAbout = about.getAboutPanel();
130
        java.net.URL aboutURL = this.getClass().getResource("/about.htm");
131
        panelAbout.addAboutUrl(PluginServices.getText(this, "example_extension"),
132
            aboutURL);
133

  
134
        exclusiveExtensions();
135
    }
136

  
137
    /**
138
     *
139
     */
140
    private void exclusiveExtensions() {
141
        ArrayList goodExtensions = new ArrayList();
142
        String[] ss = new String[] {
143
                "com.iver.core.Consola", "com.iver.core.StatusBar",
144
                "com.iver.cit.gvsig.ViewControls", "com.iver.cit.gvsig.AddLayer",
145
                "com.iver.cit.gvsig.ProjectExtension",
146
                "com.iver.cit.gvsig.About", "com.iver.cit.gvsig.LayoutControls",
147
                "com.iver.cit.gvsig.ViewPropertiesExtension",
148
                "com.iver.cit.gvsig.ZoomPrev",
149
                "com.iver.cit.gvsig.ViewProjectWindow",
150
                "com.iver.cit.gvsig.Print", "com.iver.cit.gvsig.PrintProperties",
151
                "com.iver.cit.gvsig.LayoutEditableControls",
152
                "com.iver.cit.gvsig.LayoutUndoExtension",
153
                "com.iver.cit.gvsig.LayoutRedoExtension",
154
                "com.iver.cit.gvsig.LayoutInsertToolsExtension",
155
                "com.iver.cit.gvsig.LayoutGraphicControls",
156
                "com.iver.cit.gvsig.LayoutEditVertexExtension",
157
                "com.iver.cit.gvsig.ViewSelectionControls",
158
                "org.gvsig.examples.example1.extension.CenterViewToPointExtension",
159
                "org.gvsig.examples.example1.extension.InfoToolExampleExtension",
160
                "org.gvsig.examples.example1.extension.OpenCSVToPointsExtension",
161
                "org.gvsig.examples.example1.ExampleExtension"
162
            };
163

  
164
        for (int i = 0; i < ss.length; i++) {
165
            goodExtensions.add(ss[i]);
166
        }
167

  
168
        ExtensionDecorator[] exts = PluginServices.getDecoratedExtensions();
169

  
170
        for (int i = 0; i < exts.length; i++) {
171
            if (!goodExtensions.contains(exts[i].getExtension().getClass()
172
                                                    .getName())) {
173
                exts[i].setVisibility(ExtensionDecorator.ALWAYS_INVISIBLE);
174
                System.out.println(exts[i].getExtension().getClass().getName());
175
            } else {
176
                exts[i].setVisibility(ExtensionDecorator.INACTIVE);
177
                System.err.println(exts[i].getExtension().getClass().getName());
178
            }
179
        }
180
    }
181

  
182
    /* (non-Javadoc)
183
     * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
184
     */
185
    public void execute(String arg0) {
186
    }
187

  
188
    /* (non-Javadoc)
189
     * @see com.iver.andami.plugins.IExtension#isEnabled()
190
     */
191
    public boolean isEnabled() {
192
        return false;
193
    }
194

  
195
    /* (non-Javadoc)
196
     * @see com.iver.andami.plugins.IExtension#isVisible()
197
     */
198
    public boolean isVisible() {
199
        return false;
200
    }
201

  
202
    /* (non-Javadoc)
203
     * @see com.iver.andami.preferences.IPreferenceExtension#getPreferencesPage()
204
     */
205
    public IPreference getPreferencesPage() {
206
        return centerViewPage;
207
    }
208
}
0 209

  
tags/tmp_build/examples/exaExampleCenterViewToPoint/src/org/gvsig/examples/example1/extension/OpenCSVToPointsExtension.java
1
package org.gvsig.examples.example1.extension;
2

  
3
import com.hardcode.driverManager.DriverLoadException;
4
import com.hardcode.driverManager.DriverManager;
5
import com.hardcode.gdbms.engine.data.DataSource;
6
import com.hardcode.gdbms.engine.data.DataSourceFactory;
7
import com.hardcode.gdbms.engine.data.NoSuchTableException;
8
import com.hardcode.gdbms.engine.data.driver.DriverException;
9
import com.iver.andami.PluginServices;
10
import com.iver.andami.plugins.Extension;
11
import com.iver.cit.gvsig.ProjectExtension;
12
import com.iver.cit.gvsig.fmap.MapContext;
13
import com.iver.cit.gvsig.fmap.layers.FLayerGenericVectorial;
14
import com.iver.cit.gvsig.fmap.layers.LayerFactory;
15
import com.iver.cit.gvsig.project.Project;
16
import com.iver.cit.gvsig.project.ProjectFactory;
17
import com.iver.cit.gvsig.project.documents.view.ProjectView;
18
import com.iver.cit.gvsig.project.documents.view.gui.View;
19
import com.iver.gvsig.addeventtheme.AddEventThemeDriver;
20
import com.iver.utiles.extensionPoints.ExtensionPoint;
21
import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
22

  
23
public class OpenCSVToPointsExtension extends Extension{
24

  
25
	public void initialize() {
26
		// TODO Auto-generated method stub
27

  
28
	}
29

  
30
	public void postInitialize() {
31
		try {
32
			addCSVPointLayer();
33
		} catch (DriverLoadException e) {
34
			// TODO Auto-generated catch block
35
			e.printStackTrace();
36
		} catch (NoSuchTableException e) {
37
			// TODO Auto-generated catch block
38
			e.printStackTrace();
39
		} catch (DriverException e) {
40
			// TODO Auto-generated catch block
41
			e.printStackTrace();
42
		} catch (InstantiationException e) {
43
			// TODO Auto-generated catch block
44
			e.printStackTrace();
45
		} catch (IllegalAccessException e) {
46
			// TODO Auto-generated catch block
47
			e.printStackTrace();
48
		}
49

  
50
	}
51

  
52
	public void execute(String actionCommand) {
53
		// TODO Auto-generated method stub
54

  
55
	}
56

  
57
	public boolean isEnabled() {
58
		// TODO Auto-generated method stub
59
		return false;
60
	}
61

  
62
	public boolean isVisible() {
63
		// TODO Auto-generated method stub
64
		return false;
65
	}
66

  
67

  
68

  
69
	private void addCSVPointLayer() throws DriverLoadException, NoSuchTableException, DriverException, InstantiationException, IllegalAccessException{
70
//		  Funcion encargada de crear y cargar en la vista la capa
71
//		  de trabajo a partir del fichero csv
72

  
73
		ProjectView pv=ProjectFactory.createView("Ejemplo CSV to Points");
74
		View view=(View)pv.createWindow();
75
		ProjectExtension pe=(ProjectExtension)PluginServices.getExtension(ProjectExtension.class);
76
		Project project=pe.getProject();
77
		project.addDocument(pv);
78
		PluginServices.getMDIManager().addWindow(view);
79

  
80
//		   csv
81
		  DataSourceFactory dataSourceFactory=LayerFactory.getDataSourceFactory();
82
		  String fileName="C:/prueba.csv";
83
		  dataSourceFactory.addFileDataSource("csv string", "prueba",fileName);
84
		  DataSource ds = dataSourceFactory.createRandomDataSource("prueba");
85
		  ds.start();
86

  
87
//		   Crearemos el driver que gestiona la capa de eventos y lo enlazaremos con
88
//		   la fuente de datos que acabamos de crear indicandole que columnas de esta
89
//		   representan los puntos de la geomretria
90
		  int xFieldIndex = ds.getFieldIndexByName("X");
91
		  int yFieldIndex = ds.getFieldIndexByName("Y");
92
//		  DriverManager dm=new DriverManager();
93
		  AddEventThemeDriver driver=new AddEventThemeDriver();//(AddEventThemeDriver)dm.getDriver("csv string");
94
		  driver.setData(ds, xFieldIndex, yFieldIndex);
95

  
96
		  MapContext mapContext=view.getMapControl().getMapContext();
97

  
98
//		   Crearemos ahora la nueva capa basada en este driver
99
		  FLayerGenericVectorial layer = (FLayerGenericVectorial)(((ExtensionPoint)ExtensionPointsSingleton.getInstance().get("Layers")).create("com.iver.cit.gvsig.fmap.layers.FLayerGenericVectorial"));
100
		  layer.setName("prueba");
101
		  layer.setDriver(driver);
102
		  layer.setProjection(mapContext.getProjection());
103
	      mapContext.getLayers().addLayer(layer);
104

  
105

  
106

  
107
//          capa = LayerFactory.createLayer("ademuz", driver, mapContext.getProjection());
108
//	      capa.addLayerListener(new AddEventThemListener());
109
//	      mapContext.getLayers().addLayer(layer);
110
//		   Una vez creada la capa se le a?ade una propiedad para reconocerla
111
//		   como nuestra capa de trabajo
112
		  layer.setProperty("CapaDePruebaCSV","propiedad para distinguir la capa de prueba");
113

  
114
//		   Indicamos al mapContext que se debe repintar
115
		  mapContext.invalidate();
116
		  mapContext.redraw();
117
	}
118
}
0 119

  
tags/tmp_build/examples/exaExampleCenterViewToPoint/src/org/gvsig/examples/example1/extension/InfoToolExampleExtension.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.extension;
43

  
44
import org.gvsig.examples.example1.tool.InfoToolListener;
45

  
46
import com.iver.andami.PluginServices;
47
import com.iver.andami.ui.mdiManager.IWindow;
48
import com.iver.cit.gvsig.fmap.MapContext;
49
import com.iver.cit.gvsig.fmap.MapControl;
50
import com.iver.cit.gvsig.fmap.layers.FLayer;
51
import com.iver.cit.gvsig.fmap.layers.FLayerGenericVectorial;
52
import com.iver.cit.gvsig.fmap.tools.Behavior.Behavior;
53
import com.iver.cit.gvsig.fmap.tools.Behavior.MouseMovementBehavior;
54
import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior;
55
import com.iver.cit.gvsig.project.documents.view.gui.View;
56
import com.iver.cit.gvsig.project.documents.view.toolListeners.StatusBarListener;
57

  
58

  
59
/**
60
 * Class that extends of the tool InfoToolExtension and
61
 * override the methods that interests us to change its behavior.
62
 *
63
 * @author Vicente Caballero Navarro
64
 */
65
public class InfoToolExampleExtension
66
    extends com.iver.cit.gvsig.InfoToolExtension {
67

  
68
	/* (non-Javadoc)
69
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
70
	 */
71
	public void execute(String s) {
72
        IWindow window = PluginServices.getMDIManager().getActiveWindow();
73

  
74
        if (window instanceof View) {
75
            MapControl mapCtrl = ((View) window).getMapControl();
76

  
77
            if (s.compareTo("INFO") == 0) {
78
                if (mapCtrl.getMapTool("centerviewtopoint") == null) {
79
                    StatusBarListener sbl = new StatusBarListener(mapCtrl);
80
                    InfoToolListener itl = new InfoToolListener(mapCtrl);
81
                    mapCtrl.addMapTool("centerviewtopoint",
82
                        new Behavior[] {
83
                            new PointBehavior(itl),
84
                            new MouseMovementBehavior(sbl)
85
                        });
86
                }
87
            }
88

  
89
//            FLayer[] layers=mapCtrl.getMapContext().getLayers().getActives();
90
//            if (layers[0] instanceof FLayerGenericVectorial){
91
//        		if (layers[0].getProperty("CapaDePruebaCSV")!=null)
92
        			if (s.compareTo("INFO") == 0) {
93
        				mapCtrl.setTool("centerviewtopoint");
94
        			}
95
//            } else {
96
//                super.execute(s);
97
//            }
98
        }
99
    }
100

  
101
    /* (non-Javadoc)
102
     * @see com.iver.andami.plugins.IExtension#initialize()
103
     */
104
    public void initialize() {
105
        super.initialize();
106
    }
107

  
108
    /* (non-Javadoc)
109
     * @see com.iver.andami.plugins.IExtension#isEnabled()
110
     */
111
    public boolean isEnabled() {
112
        return super.isEnabled();
113
    }
114

  
115
    /* (non-Javadoc)
116
     * @see com.iver.andami.plugins.IExtension#isVisible()
117
     */
118
    public boolean isVisible() {
119
        IWindow window = PluginServices.getMDIManager().getActiveWindow();
120

  
121
        if (window instanceof View) {
122
            MapContext mapContext = ((View) window).getMapControl()
123
                                     .getMapContext();
124
            FLayer[] layers=mapContext.getLayers().getActives();
125
            for (int i=0;i<layers.length;i++){
126
            	if (layers[i] instanceof FLayerGenericVectorial){
127
            		if (layers[i].getProperty("CapaDePruebaCSV")!=null)
128
            			return true;
129
            	}
130
            }
131
        }
132

  
133
        return super.isVisible();
134
    }
135
}
0 136

  
tags/tmp_build/examples/exaExampleCenterViewToPoint/src/org/gvsig/examples/example1/extension/CenterViewToPointExtension.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.extension;
43

  
44
import java.awt.Color;
45
import java.util.prefs.Preferences;
46

  
47
import org.gvsig.examples.example1.gui.InputCoordinatesPanel;
48

  
49
import com.iver.andami.PluginServices;
50
import com.iver.andami.plugins.Extension;
51
import com.iver.cit.gvsig.fmap.MapContext;
52
import com.iver.cit.gvsig.fmap.layers.FLayers;
53
import com.iver.cit.gvsig.project.documents.view.IProjectView;
54
import com.iver.cit.gvsig.project.documents.view.gui.View;
55
import com.iver.utiles.StringUtilities;
56

  
57
/**
58
 * The CenterViewToPointExtension class allows to center the View over a
59
 * concrete point given by its coordinates.
60
 *
61
 * @author Vicente Caballero Navarro
62
 */
63
public class CenterViewToPointExtension extends Extension{
64

  
65
	private View vista;
66
	public static Color COLOR=Color.red;
67
	private static Preferences prefs = Preferences.userRoot().node( "centerviewtopoint" );
68

  
69
    /* (non-Javadoc)
70
     * @see com.iver.andami.plugins.Extension#inicializar()
71
     */
72
    public void initialize() {
73
    	String colorString=prefs.get("colorcenterviewtopoint",StringUtilities.color2String(CenterViewToPointExtension.COLOR));
74
		Color color=StringUtilities.string2Color(colorString);
75
		CenterViewToPointExtension.COLOR=color;
76

  
77
    }
78

  
79
    /* (non-Javadoc)
80
     * @see com.iver.andami.plugins.Extension#execute(java.lang.String)
81
     */
82
    public void execute(String actionCommand) {
83
		if ("CENTERVIEWTOPOINT".equals(actionCommand)){
84
			vista = (View)PluginServices.getMDIManager().getActiveWindow();
85
			InputCoordinatesPanel dataSelectionPanel = new InputCoordinatesPanel(vista);
86
			PluginServices.getMDIManager().addWindow(dataSelectionPanel);
87
		}
88
    }
89

  
90
    public View getView(){
91
    	return vista;
92
    }
93
    /* (non-Javadoc)
94
     * @see com.iver.andami.plugins.Extension#isEnabled()
95
     */
96
    public boolean isEnabled() {
97
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
98
		 .getActiveWindow();
99
		if (f == null) {
100
		    return false;
101
		}
102
		if (f.getClass() == View.class) {
103
		    View vista = (View) f;
104
		    IProjectView model = vista.getModel();
105
		    MapContext mapa = model.getMapContext();
106
		    FLayers layers = mapa.getLayers();
107
		    for (int i=0;i < layers.getLayersCount();i++) {
108
               if (layers.getLayer(i).isAvailable()) return true;
109
		    }
110
		}
111
		return false;
112

  
113
    }
114

  
115
    /* (non-Javadoc)
116
     * @see com.iver.andami.plugins.Extension#isVisible()
117
     */
118
    public boolean isVisible() {
119
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
120
		 .getActiveWindow();
121
		if (f == null) {
122
		    return false;
123
		}
124
		if (f.getClass() == View.class) {
125
		    View vista = (View) f;
126
		    IProjectView model = vista.getModel();
127
		    MapContext mapa = model.getMapContext();
128
            if (mapa.getLayers().getLayersCount() > 0) {
129
                return true;
130
            }
131
            return false;
132
        }
133
		return false;
134
	}
135

  
136
}
0 137

  
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();
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff