Revision 1145

View differences:

org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/resources-plugin/text_it.properties
1
#text_it.properties
2
_problems_loading_portableview_file_data=Problemi nel caricamento della mappa tematica id\:%(id) ver\:%(version) bn\:%(buildNumber)
3
_portable_view_not_found_installed=Mappa tematica installata non trovata\: id\:%(id) ver\:%(version) bn\:%(buildNumber)
4
comments=Commenti
5
install_portable_view=Installa mappa tematica
6
name_is_required=Il nome \u00E8 obbligatorio
7
open_portable_view=Apri mappa tematica
8
source_view=Vista di origine
9
portable_view_properties=Propriet\u00E0 della mappa tematica
10
portable_views_availables=Mappe tematiche disponibili
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/resources-plugin/text.properties
1
#text.properties
2
_problems_loading_portableview_file_data=Se han encontrado problema al generar el Mapa tem\u00E1tico\: id\:%(id) ver\:%(version) bn\:%(buildNumber)
3
_portable_view_not_found_installed=No se encontr\u00F3 el Mapa tem\u00E1tico instalado\: id\:%(id) ver\:%(version) bn\:%(buildNumber)
4
comments=Comentarios
5
install_portable_view=Instalar mapas tem\u00E1ticos
6
name_is_required=El nombre es obligatorio
7
open_portable_view=Abrir mapas tem\u00E1ticos
8
source_view=Vista origen
9
portable_view_properties=Propiedades de la vista portable
10
portable_views_availables=Vistas portables disponibles
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/resources-plugin/text_en.properties
1
#text_en.properties
2
_problems_loading_portableview_file_data=Problems loading Portable View\: id\:%(id) ver\:%(version) bn\:%(buildNumber)
3
_portable_view_not_found_installed=Installed Portable View not found\: id\:%(id) ver\:%(version) bn\:%(buildNumber)
4
comments=Comments
5
install_portable_view=Install Portable View
6
name_is_required=Name is required
7
open_portable_view=Open Portable Views
8
source_view=Source View
9
portable_view_properties=Portable View properties
10
portable_views_availables=Portable views available
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<depends plugin-name="org.gvsig.app" />
4
	<resourceBundle name="text" />
5
	<label-set class-name="org.gvsig.educa.portableview.app.viewer.ui.PortableViewDocumentViewer">
6
		<label id="units" size="75"/>
7
		<label id="x" size="120"/>
8
		<label id="y" size="120"/>
9
		<label id="4" size="110"/>
10
		<label id="5" size="110"/>
11
		<label id="distancearea" size="30"/>
12
		<label id="projection" size="110"/>
13
	</label-set>
14
	<libraries library-dir="lib" />
15
	<extensions>
16
		<extension
17
			class-name="org.gvsig.educa.portableview.app.viewer.PortableViewExtension"
18
			description=""
19
			active="true"
20
			priority="1">
21
		</extension>
22

  
23
		<extension
24
			class-name="org.gvsig.educa.portableview.app.viewer.PortableViewBasicMapControlExtension"
25
			description="" active="true" priority="1">
26
			<combo-scale name="view-change-scale-portableview"
27
				label="1:"
28
				elements="1000;2000;5000;10000;25000;50000;100000;200000;500000;1000000;2000000;5000000"
29
				value="10000"
30
				action-command="view-change-scale" />
31

  
32
			<action
33
		        name="view-change-scale-portableview"
34
		        label="_Change_scale"
35
		        action-command="view-change-scale" />
36
            <action
37
		        name="view-navigation-pan-portableview"
38
		        label="_Move_the_map"
39
		        position="650100100"
40
		        action-command="view-navigation-pan"
41
		        icon="view-navigation-pan"
42
		        tooltip="_Move_the_map"
43
		        accelerator="" />
44
		  	<action
45
		        name="view-navigation-zoom-in-center-portableview"
46
		        label="_Zoom_in_center"
47
		        position="650100200"
48
		        action-command="view-navigation-zoom-in-center"
49
		        tooltip="_Zoom_in_center"
50
		        icon="view-navigation-zoom-in-center"
51
		        accelerator="" />
52
		    <action
53
		        name="view-navigation-zoom-out-center-portableview"
54
		        label="_Zoom_out_center"
55
		        position="650100300"
56
		        action-command="view-navigation-zoom-out-center"
57
		        tooltip="_Zoom_out_center"
58
		        icon="view-navigation-zoom-out-center"
59
		        accelerator="" />
60
		    <action
61
		        name="view-navigation-zoom-in-topoint-portableview"
62
		        label="_Zoom_in_to_point"
63
		        position="650100400"
64
		        action-command="view-navigation-zoom-in-topoint"
65
		        icon="view-navigation-zoom-in-topoint"
66
		        tooltip="_Zoom_in_to_point"
67
		        accelerator="" />
68
            <action
69
		        name="view-navigation-zoom-out-topoint-portableview"
70
		        label="_Zoom_out_to_point"
71
		        position="650100500"
72
		        action-command="view-navigation-zoom-out-topoint"
73
		        icon="view-navigation-zoom-out-topoint"
74
		        tooltip="_Zoom_out_to_point"
75
		        accelerator="" />
76
		    <action
77
		        name="view-navigation-zoom-back-portableview"
78
		        label="_zoom_back"
79
		        tooltip="_zoom_back"
80
		        action-command="view-navigation-zoom-back"
81
		        icon="view-navigation-zoom-back"
82
		        position="650100700"
83
		        accelerator=""/>
84
            <action
85
		        name="view-navigation-zoom-all-portableview"
86
		        label="_Zoom_all"
87
		        position="650100800"
88
		        action-command="view-navigation-zoom-all"
89
		        icon="view-navigation-zoom-all"
90
		        tooltip="_Zoom_all"
91
		        accelerator="" />
92

  
93
		    <menu
94
		        name="view-navigation-pan-portableview"
95
		        text="View/Navigation/Pan" />
96
		    <menu
97
		        name="view-navigation-zoom-in-center-portableview"
98
		        text="View/Navigation/Zoom_in_to_center"/>
99
		    <menu
100
		        name="view-navigation-zoom-out-center-portableview"
101
		        text="View/Navigation/Zoom_out_to_center"/>
102
			<menu
103
		        name="view-navigation-zoom-in-topoint-portableview"
104
		        text="View/Navigation/Zoom_in" />
105
		    <menu
106
		        name="view-navigation-zoom-out-topoint-portableview"
107
		        text="View/Navigation/Zoom_out" />
108
		    <menu
109
		        name="view-navigation-zoom-all-portableview"
110
		        text="View/Navigation/Zoom_all" />
111
			<menu
112
		        name="view-navigation-zoom-back-portableview"
113
		        text="View/Navigation/Zoom_back" />
114

  
115
      		<tool-bar name="view_navigation" position="3">
116
		        <selectable-tool name="view-navigation-zoom-in-topoint-portableview" is-default="true" />
117
		        <selectable-tool name="view-navigation-zoom-out-topoint-portableview" />
118
		        <action-tool name="view-navigation-zoom-all-portableview"  />
119
		        <action-tool name="view-navigation-zoom-in-center-portableview"  />
120
		        <action-tool name="view-navigation-zoom-out-center-portableview"  />
121
        		<action-tool name="view-navigation-zoom-back-portableview"/>
122
		    </tool-bar>
123

  
124
		    <tool-bar name="view_navigation" position="4">
125
		        <selectable-tool name="view-navigation-pan-portableview"/>
126
		    </tool-bar>
127
		</extension>
128
		<extension class-name="org.gvsig.educa.portableview.app.viewer.PortableViewMeasureToolsExtension"
129
			description="Extensi?n encargada de gestionar las operaciones de medir sobre los ThemtaticMap."
130
			active="true" priority="30">
131

  
132
			<action
133
		        name="view-query-distance-portableview"
134
		        label="_Query_distance"
135
		        position="650700200"
136
		        action-command="view-query-distance"
137
		        icon="view-query-distance"
138
		        tooltip="_Query_distance"
139
		        accelerator="" />
140
		    <action
141
		        name="view-query-area-portableview"
142
		        label="_Query_area"
143
		        position="650700100"
144
		        action-command="view-query-area"
145
		        icon="view-query-area"
146
		        tooltip="_Query_area"
147
		        accelerator="" />
148

  
149
			<menu
150
		        name="view-query-distance-portableview"
151
		        text="View/Query/Distance" />
152
	        <menu
153
		        name="view-query-area-portableview"
154
		        text="View/Query/Area" />
155

  
156
		    <tool-bar name="view_tools_query" position="5">
157
		        <selectable-tool name="view-query-distance-portableview" />
158
		        <selectable-tool name="view-query-area-portableview" />
159
		    </tool-bar>
160
		</extension>
161

  
162
		<extension class-name="org.gvsig.educa.portableview.app.viewer.PortableViewInfoByPointToolsExtension"
163
			description="Extensi?n encargada de gestionar la herramienta de info en los mapas tematicos."
164
			active="true"
165
			priority="29">
166

  
167
			<action
168
		        name="layer-info-by-point-portableview"
169
		        label="_point_information"
170
		        tooltip="_Show_point_information"
171
		        action-command="layer-info-by-point"
172
		        icon="layer-info-by-point"
173
		        position="600200000"
174
		        accelerator="" />
175
		    <menu
176
		        name="layer-info-by-point-portableview"
177
		        text="View/Query/Information" />
178
		    <tool-bar name="view_tools_query" position="5">
179
		        <selectable-tool name="layer-info-by-point-portableview" />
180
		    </tool-bar>
181
		</extension>
182
	</extensions>
183
</plugin-config>
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/resources-plugin/text_pt_BR.properties
1
#text_pt_br.properties
2
_problems_loading_portableview_file_data=Problemas ao carregar dados de arquivo do mapa tem\u00E1tico
3
_portable_view_not_found_installed=Mapa tem\u00E1tico instalado n\u00E3o encontrado
4
comments=Coment\u00E1rios
5
install_portable_view=Instalar mapa tem\u00E1tico
6
name_is_required=Nome \u00E9 obrigat\u00F3rio
7
open_portable_view=Abrir mapa tem\u00E1tico
8
source_view=Vista de origem
9
portable_view_properties=Propriedades do mapa tem\u00E1tico
10
portable_views_availables=Mapas tem\u00E1ticos dispon\u00EDveis
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/resources-plugin/text_ru.properties
1
#text_ru.properties
2
_problems_loading_portableview_file_data=\u041E\u0448\u0438\u0431\u043A\u0430 \u0437\u0430\u0433\u0440\u0443\u0437\u043A\u0438 \u0422\u0435\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0439 \u043A\u0430\u0440\u0442\u044B\:  id\:%(id) ver\:%(version) bn\:%(buildNumber)
3
_portable_view_not_found_installed=\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u043B\u0435\u043D\u043D\u0430\u044F \u0422\u0435\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0430\u044F \u043A\u0430\u0440\u0442\u0430 \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D\u0430\: id\:%(id) ver\:%(version) bn\:%(buildNumber)
4
comments=\u041A\u043E\u043C\u043C\u0435\u043D\u0442\u0430\u0440\u0438\u0438
5
install_portable_view=\u0423\u0441\u0442\u0430\u043D\u043E\u0432\u0438\u0442\u044C \u0422\u0435\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0443\u044E \u043A\u0430\u0440\u0442\u0443
6
name_is_required=\u041D\u0435\u043E\u0431\u0445\u043E\u0434\u0438\u043C\u043E \u0432\u0432\u0435\u0441\u0442\u0438 \u0438\u043C\u044F
7
open_portable_view=\u041E\u0442\u043A\u0440\u044B\u0442\u044C \u0422\u0435\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0443\u044E \u043A\u0430\u0440\u0442\u0443
8
source_view=\u0418\u0441\u0445\u043E\u0434\u043D\u044B\u0439 \u0412\u0438\u0434
9
portable_view_properties=\u0421\u0432\u043E\u0439\u0441\u0442\u0432\u0430 \u0422\u0435\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0439 \u043A\u0430\u0440\u0442\u044B
10
portable_views_availables=\u0422\u0435\u043C\u0430\u0442\u0438\u0447\u0435\u0441\u043A\u0438\u0435 \u043A\u0430\u0440\u0442\u044B \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/resources-plugin/text_de.properties
1
#text_de.properties
2
_problems_loading_portableview_file_data=Problem beim Laden der Thematischen Karte\: id\:%(id) ver\:%(version) bn\:%(buildNumber)
3
_portable_view_not_found_installed=Installierte Thematische Karte nicht gefunden\: id\:%(id) ver\:%(version) bn\:%(buildNumber)
4
comments=Kommentare
5
install_portable_view=Thematische Karte installieren
6
name_is_required=Ein Name ist erforderlich
7
open_portable_view=Thematische Karte \u00F6ffnen
8
source_view=Quelldaten-Ansicht
9
portable_view_properties=Eigenschaften der Thematischen Karte
10
portable_views_availables=Verf\u00FCgbare Thematische Karten
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/resources-plugin/about/universidad.edu.uy.html
1
<html>
2
<body>
3

  
4
	<img src="universidad.edu.uy.jpg">
5
	<br>
6
	<br>
7
	<img src="LOGO-FING-rgb.jpg">
8

  
9
	<br>
10
	<p>
11
		<a href="http://www.universidad.edu.uy">http://www.universidad.edu.uy</a>
12
	</p>
13
	<p>La Universidad de la Rep&uacute;blica (UdelaR) es la principal
14
		instituci&oacute;n de educaci&oacute;n superior y de investigaci&oacute;n del Uruguay. En
15
		colaboraci&oacute;n con una amplia gama de actores institucionales y
16
		sociales, realiza tambi&eacute;n m&uacute;ltiples actividades orientadas al uso
17
		socialmente valioso del conocimiento y a la difusi&oacute;n de la cultura. Es
18
		una instituci&oacute;n p&uacute;blica, aut&oacute;noma y cogobernada por sus docentes,
19
		estudiantes y egresados.</p>
20
	<p>La Universidad Mayor de la Rep&uacute;blica surge a la vida p&uacute;blica el
21
		18 de julio de 1849, sin embargo, el proceso de su fundaci&oacute;n comienza
22
		diecis&eacute;is a&ntilde;os antes, el 11 de junio de 1833, cuando la ley propuesta
23
		es aprobada.</p>
24
</body>
25
</html>
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/resources-plugin/about/disid.html
1
<html>
2
<body>
3

  
4
<img src="disid-logo.jpeg"><br>
5

  
6
<h2>DiSiD Technologies</h2>
7
<br>
8
<p>
9
<a href="http://www.disid.com/">http://www.disid.com/</a>
10
</p>
11
<p>Empresa de ingenier&iacute;a inform&aacute;tica especializada en tecnolog&iacute;a Java.</p>
12
<p>Nuestro objetivo es proveer soluciones software enfocadas a resolver problemas y necesidades con
13
el objetivo de ofrecer s&oacute;lo lo que los clientes necesitan, evitando gestiones innecesarias.</p>
14
<br>
15
<p>Especializados en:
16
<ul>
17
<li>Sistemas de informaci&oacute;n geogr&aacute;fica (gvSIG)</li>
18
<li>Reconocimiento y trazabilidad de personas y Activos con representaci&oacute;n gr&aacute;fica</li>
19
<li>e-business y Tiendas virtuales</li>
20
<li>Portales corporativos y Marketing on-line</li>
21
<li>Consultor&iacute;a tecnol&oacute;gica, desarrollo, soporte y formaci&oacute;n Java</li>
22
</ul>
23
<br>
24
<img src="gvsig-logo1-association.jpg">
25
<p><em>Miembro de la <a href="http://www.gvsig.com/">Asociaci&oacute;n gvSIG</a></em>
26
</body>
27
</html>
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/resources-plugin/about/MTOP.html
1
<html>
2
<body>
3

  
4
	<img src="MTOP.png">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
5
	<img src="MTOP-TOPOGRAFIA.png">
6

  
7
	<h2>Ministerio de Transporte y Obras P&uacute;blicas (Uruguay)</h2>
8
	<h3>Direcci&oacute;n Nacional de Topograf&iacute;a</h3>
9
	<br>
10
	<p>
11
		<a
12
			href="http://www.mtop.gub.uy/gxpsites/hgxpp001?1,6,18,O,S,0,MNU;E;2;6;7;1;21;3;MNU;,">http://www.mtop.gub.uy</a>
13
	</p>
14

  
15
	<h4>
16
		Misi&oacute;n
17
		</h2>
18
		<p>Posibilitar y conseguir el espacio necesario para el
19
			emplazamiento geom&eacute;trico y legal, para que hagan posible la
20
			realizaci&oacute;n de emprendimientos de inter&eacute;s nacional,
21
			armonizando el inter&eacute;s individual con el colectivo,
22
			minimizando los impactos negativos ambientales y sociales, debiendo
23
			adem&aacute;s conservar, custodiar y administrar datos de
24
			geograf&iacute;a b&aacute;sica territorial del Pa&iacute;s,
25
			promoviendo la uniformizaci&oacute;n de una cartograf&iacute;a
26
			b&aacute;sica para el Estado.</p>
27

  
28
		<h4>
29
			Visi&oacute;n
30
			</h2>
31
			<p>Obtener a tiempo, geom&eacute;trica y legalmente, el espacio
32
				para el inicio y concreci&oacute;n planificada de las obras y
33
				actividades de inter&eacute;s p&uacute;blico previstas, en
34
				cumplimiento de sus cometidos. Concretar un sistema de
35
				informaci&oacute;n georreferenciable general b&aacute;sico para el
36
				Pa&iacute;s, que permita el intercambio de la informaci&oacute;n
37
				existente, tanto p&uacute;blica como privada, en lo relativo con su
38
				georreferenciamiento, buscando la creaci&oacute;n de la
39
				Infraestructura Nacional de datos Espaciales (INDE) compatible con
40
				una Infraestructura Regional de Datos (MERCOSUR) y con la
41
				Infraestructura de Datos Espaciales para las Am&eacute;ricas (IDEPA)
42
				en desarrollo.</p>
43
</body>
44
</html>
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/assembly/gvsig-plugin-package.xml
1
<assembly>
2
  <id>gvsig-plugin-package</id>
3
  <formats>
4
    <format>zip</format>
5
  </formats>
6
  <baseDirectory>${project.artifactId}</baseDirectory>
7
  <includeBaseDirectory>true</includeBaseDirectory>
8
  <files>
9
    <file>
10
      <source>target/${project.artifactId}-${project.version}.jar</source>
11
      <outputDirectory>lib</outputDirectory>
12
    </file>
13
    <file>
14
      <source>target/package.info</source>
15
    </file>
16
  </files>
17

  
18
  <fileSets>
19
    <fileSet>
20
      <directory>src/main/resources-plugin</directory>
21
      <outputDirectory>.</outputDirectory>
22
    </fileSet>
23
  </fileSets>
24

  
25
  <dependencySets>
26
    <dependencySet>
27
      <useProjectArtifact>false</useProjectArtifact>
28
      <useTransitiveDependencies>false</useTransitiveDependencies>
29
      <outputDirectory>lib</outputDirectory>
30
      <includes>
31
		<include>org.gvsig:org.gvsig.educa.portableview.lib.api</include>
32
		<include>org.gvsig:org.gvsig.educa.portableview.lib.impl</include>
33
		<include>org.gvsig:org.gvsig.educa.portableview.lib.prov.installer</include>
34
		<include>org.gvsig:org.gvsig.educa.portableview.swing.api</include>
35
		<include>org.gvsig:org.gvsig.educa.portableview.swing.impl</include>
36
      </includes>
37
    </dependencySet>
38
  </dependencySets>
39

  
40
</assembly>
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/java/org/gvsig/educa/portableview/app/viewer/PortableViewMeasureToolsExtension.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.educa.portableview.app.viewer;
23

  
24
import org.gvsig.andami.PluginServices;
25
import org.gvsig.andami.plugins.Extension;
26
import org.gvsig.andami.ui.mdiManager.IWindow;
27
import org.gvsig.app.project.documents.view.toolListeners.AreaListener;
28
import org.gvsig.app.project.documents.view.toolListeners.MeasureListener;
29
import org.gvsig.educa.portableview.app.viewer.ui.PortableViewDocumentViewer;
30
import org.gvsig.educa.portableview.swing.PortableViewSwingLocator;
31
import org.gvsig.educa.portableview.swing.viewer.MapControlToolRegistrant;
32
import org.gvsig.fmap.mapcontext.layers.FLayers;
33
import org.gvsig.fmap.mapcontrol.MapControl;
34
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolygonBehavior;
35
import org.gvsig.fmap.mapcontrol.tools.Behavior.PolylineBehavior;
36

  
37
/**
38
 * PortableView Measure tool extension
39
 *
40
 * @author gvSIG Team
41
 * @version $Id$
42
 *
43
 */
44
public class PortableViewMeasureToolsExtension extends Extension implements
45
    MapControlToolRegistrant {
46

  
47
    private static final String VIEW_QUERY_AREA = "view-query-area";
48
	private static final String VIEW_QUERY_DISTANCE = "view-query-distance";
49

  
50
	public void initialize() {
51
        // Nothing to do
52

  
53
    }
54

  
55
    @Override
56
    public void postInitialize() {
57

  
58
        // Register tools
59
        PortableViewSwingLocator.getSwingManager().addMapControlRegistrant(this);
60
    }
61

  
62
    public boolean isEnabled() {
63
        IWindow window = PluginServices.getMDIManager().getActiveWindow();
64

  
65
        if (window instanceof PortableViewDocumentViewer) {
66
            PortableViewDocumentViewer viewer =
67
                (PortableViewDocumentViewer) window;
68

  
69
            FLayers layers =
70
                viewer.getPortableView().getMapContext().getLayers();
71

  
72
            for (int i = 0; i < layers.getLayersCount(); i++) {
73
                if (layers.getLayer(i).isAvailable()) {
74
                    return true;
75
                }
76
            }
77
        }
78
        return false;
79
    }
80

  
81
    public boolean isVisible() {
82
        IWindow window = PluginServices.getMDIManager().getActiveWindow();
83
        return window instanceof PortableViewDocumentViewer;
84
    }
85

  
86
    public void registerTools(MapControl mapControl) {
87
        // Medir
88

  
89
        MeasureListener mli = new MeasureListener(mapControl);
90
        mapControl.addBehavior("medicion", new PolylineBehavior(mli));
91

  
92
        // Area
93
        AreaListener ali = new AreaListener(mapControl);
94
        mapControl.addBehavior("area", new PolygonBehavior(ali));
95

  
96
    }
97

  
98
    public void execute(String actionCommand) {
99
        IWindow window = PluginServices.getMDIManager().getActiveWindow();
100
        if (!(window instanceof PortableViewDocumentViewer)) {
101
            return;
102
        }
103
        PortableViewDocumentViewer tmDocViewer =
104
            (PortableViewDocumentViewer) window;
105
        MapControl mapCtrl = tmDocViewer.getViewer().getMapControl();
106
        if (actionCommand.equals(VIEW_QUERY_DISTANCE)) {
107
            mapCtrl.setTool("medicion");
108
        }
109
        if (actionCommand.equals(VIEW_QUERY_AREA)) {
110
            mapCtrl.setTool("area");
111
        }
112
    }
113
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/java/org/gvsig/educa/portableview/app/viewer/PortableViewDocumentManager.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.educa.portableview.app.viewer;
23

  
24
import java.util.Arrays;
25
import java.util.Iterator;
26
import java.util.List;
27

  
28
import javax.swing.ImageIcon;
29

  
30
import org.gvsig.andami.PluginServices;
31
import org.gvsig.andami.ui.mdiManager.IWindow;
32
import org.gvsig.app.project.Project;
33
import org.gvsig.app.project.ProjectManager;
34
import org.gvsig.app.project.documents.AbstractDocument;
35
import org.gvsig.app.project.documents.AbstractDocumentManager;
36
import org.gvsig.app.project.documents.Document;
37
import org.gvsig.app.project.documents.gui.IDocumentWindow;
38
import org.gvsig.app.project.documents.gui.WindowLayout;
39
import org.gvsig.app.project.documents.view.ViewDocument;
40
import org.gvsig.educa.portableview.PortableViewManager;
41
import org.gvsig.educa.portableview.app.viewer.ui.PortableViewDocumentProperties;
42
import org.gvsig.educa.portableview.app.viewer.ui.PortableViewDocumentViewer;
43
import org.gvsig.educa.portableview.app.viewer.ui.PortableViewSelector;
44
import org.gvsig.educa.portableview.map.PortableView;
45
import org.gvsig.educa.portableview.swing.PortableViewSwingLocator;
46
import org.gvsig.educa.portableview.swing.PortableViewSwingManager;
47
import org.gvsig.tools.ToolsLocator;
48
import org.gvsig.tools.dynobject.DynObjectManager;
49
import org.gvsig.tools.dynobject.DynStruct;
50
import org.gvsig.tools.persistence.PersistenceManager;
51
import org.gvsig.tools.swing.api.windowmanager.WindowManager.MODE;
52

  
53
/**
54
 * @author gvSIG Team
55
 * @version $Id$
56
 *
57
 */
58
public class PortableViewDocumentManager extends AbstractDocumentManager {
59

  
60
    public static final String PERSISTENCE_PORTABLEVIEW_DOCUMENT_DEFINITION_NAME =
61
        "PortableViewDocument";
62

  
63
    public static String TYPENAME = "project.document.portableView";
64

  
65
    private DynStruct persistenceDefinition = null;
66

  
67
    private final PortableViewSwingManager tmSwingManager;
68

  
69
    private final PortableViewManager tmManager;
70

  
71
    /**
72
     * Registers in the points of extension the Factory with alias.
73
     *
74
     */
75
    public static void register() {
76

  
77
        PortableViewDocumentManager factory = new PortableViewDocumentManager();
78

  
79
        ProjectManager.getInstance().registerDocumentFactory(factory);
80

  
81
        registerIcons();
82

  
83
        PersistenceManager manager = ToolsLocator.getPersistenceManager();
84
        manager.registerFactory(factory);
85

  
86
        if (factory.persistenceDefinition == null) {
87
            DynObjectManager dynman = ToolsLocator.getDynObjectManager();
88
            factory.persistenceDefinition =
89
                dynman.createDynClass(PersistenceManager.PERSISTENCE_NAMESPACE,
90
                    PERSISTENCE_PORTABLEVIEW_DOCUMENT_DEFINITION_NAME,
91
                    "Portable view document Persistence definition");
92

  
93
            factory.persistenceDefinition.addDynFieldString("id").setMandatory(
94
                true);
95
            factory.persistenceDefinition.addDynFieldInt("version")
96
                .setMandatory(true);
97
            factory.persistenceDefinition.addDynFieldInt("buildNumber")
98
                .setMandatory(true);
99
            factory.persistenceDefinition.addDynFieldString("name")
100
                .setMandatory(true);
101
            factory.persistenceDefinition.addDynFieldString("comment")
102
                .setMandatory(false);
103
            factory.persistenceDefinition.addDynFieldObject("sourceView")
104
                .setMandatory(false).setClassOfValue(ViewDocument.class);
105

  
106
        }
107

  
108
    }
109

  
110
    /**
111
     *
112
     */
113
    private static void registerIcons() {
114
        PluginServices.getIconTheme().registerDefault(
115
            "document-portableview-icon",
116
            PortableViewDocumentManager.class.getClassLoader().getResource(
117
                "images/document-portableview-icon.png"));
118
        PluginServices.getIconTheme().registerDefault(
119
            "document-portableview-icon-sel",
120
            PortableViewDocumentManager.class.getClassLoader().getResource(
121
                "images/document-portableview-icon-sel.png"));
122
    }
123

  
124
    /**
125
     *
126
     */
127
    public PortableViewDocumentManager() {
128
        tmSwingManager = PortableViewSwingLocator.getSwingManager();
129
        tmManager = tmSwingManager.getManager();
130
    }
131

  
132
    @Override
133
    public ImageIcon getIcon() {
134
        if (!PluginServices.getIconTheme().exists("document-portableview-icon")) {
135
            registerIcons();
136
        }
137
        return PluginServices.getIconTheme().get("document-portableview-icon");
138
    }
139

  
140
    @Override
141
    public ImageIcon getIconSelected() {
142
        if (!PluginServices.getIconTheme().exists(
143
            "document-portableview-icon-sel")) {
144
            registerIcons();
145
        }
146
        return PluginServices.getIconTheme().get(
147
            "document-portableview-icon-sel");
148
    }
149

  
150
    @Override
151
    public String getTitle() {
152
        return tmSwingManager.getTranslation("Portable_View");
153
    }
154

  
155
    public String getTypeName() {
156
        return TYPENAME;
157
    }
158

  
159
    public AbstractDocument createDocument() {
160
        return new PortableViewDocument(this);
161
    }
162

  
163
    public PortableViewDocument createDocument(PortableView portableView) {
164
        return new PortableViewDocument(this, portableView);
165
    }
166

  
167
    @Override
168
    public AbstractDocument createDocumentByUser() {
169
        Iterator<? extends Document> iterator = createDocumentsByUser();
170
        if (iterator == null || !iterator.hasNext()) {
171
            return null;
172
        }
173
        return (AbstractDocument) iterator.next();
174
    }
175

  
176
    @Override
177
    public Iterator<? extends Document> createDocumentsByUser() {
178
        PortableViewSelector selector =
179
            new PortableViewSelector(this, tmManager.getInstalledMaps());
180
        tmSwingManager.getWindowManager().showWindow(selector,
181
            tmSwingManager.getTranslation("open_portable_view"), MODE.DIALOG);
182

  
183
        if (selector.getDocuments() == null
184
            || selector.getDocuments().isEmpty()) {
185
            return Arrays.asList(new Document[] {}).iterator();
186
        }
187
        return selector.getDocuments().iterator();
188
    }
189

  
190
    public IWindow getMainWindow(Document doc, WindowLayout layout) {
191
        IDocumentWindow portableViewPanel;
192
        portableViewPanel =
193
            (IDocumentWindow) PluginServices.getMDIManager()
194
                .getSingletonWindow(getMainWindowClass(), doc);
195
        if (portableViewPanel != null) {
196
            // The window document is already created, return it.
197
            return portableViewPanel;
198
        }
199

  
200
        portableViewPanel = this.createDocumentWindow(doc);
201
        if (layout != null && portableViewPanel != null) {
202
            portableViewPanel.setWindowLayout(layout);
203
        }
204
        return portableViewPanel;
205
    }
206

  
207
    public IWindow getPropertiesWindow(Document doc) {
208
        PortableViewDocumentProperties propertiesPanel =
209
            (PortableViewDocumentProperties) PluginServices.getMDIManager()
210
                .getSingletonWindow(PortableViewDocumentProperties.class, doc);
211
        if (propertiesPanel != null) {
212
            // The table window document is already created, return it.
213
            return propertiesPanel;
214
        }
215

  
216
        propertiesPanel =
217
            new PortableViewDocumentProperties((PortableViewDocument) doc);
218
        return propertiesPanel;
219
    }
220

  
221
    public Class<? extends IDocumentWindow> getMainWindowClass() {
222
        return PortableViewDocumentViewer.class;
223
    }
224

  
225
    public boolean manages(Object object) {
226
        return object instanceof PortableViewDocument;
227
    }
228

  
229
    public DynStruct getDefinition(String className) {
230
        // TODO review it
231
        if (this.persistenceDefinition.getName().equalsIgnoreCase(className)) {
232
            return this.persistenceDefinition;
233
        }
234
        if (this.persistenceDefinition.getFullName()
235
            .equalsIgnoreCase(className)) {
236
            return this.persistenceDefinition;
237
        }
238
        if (this.getDocumentClass().getName().equals(className)) {
239
            return this.persistenceDefinition;
240
        }
241
        return null;
242
    }
243

  
244
    @SuppressWarnings("rawtypes")
245
    @Override
246
    protected Class getDocumentClass() {
247
        return PortableViewDocument.class;
248
    }
249

  
250
    /**
251
     * Gets the first document which map is the specified
252
     *
253
     * @param curMap
254
     * @return
255
     */
256
    public PortableViewDocument getDocumentForMap(PortableView map) {
257
        if (map == null) {
258
            return null;
259
        }
260
        List<Document> docs = getProject().getDocuments(TYPENAME);
261
        for (Document document : docs) {
262
            if (((PortableViewDocument) document).isMap(map)) {
263
                return (PortableViewDocument) document;
264
            }
265
        }
266
        return null;
267
    }
268

  
269
    /**
270
     * Gets current project
271
     *
272
     * @return
273
     */
274
    private Project getProject() {
275
        return ProjectManager.getInstance().getCurrentProject();
276
    }
277
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/java/org/gvsig/educa/portableview/app/viewer/ui/PortableViewDocumentProperties.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.educa.portableview.app.viewer.ui;
23

  
24
import java.awt.FlowLayout;
25
import java.awt.GridBagConstraints;
26
import java.awt.GridBagLayout;
27
import java.awt.GridLayout;
28
import java.awt.Insets;
29
import java.awt.event.ActionEvent;
30

  
31
import javax.swing.AbstractAction;
32
import javax.swing.BorderFactory;
33
import javax.swing.JButton;
34
import javax.swing.JPanel;
35
import javax.swing.JScrollPane;
36
import javax.swing.JTextArea;
37
import javax.swing.JTextField;
38

  
39
import org.apache.commons.lang3.StringUtils;
40
import org.gvsig.andami.PluginServices;
41
import org.gvsig.andami.ui.mdiManager.SingletonWindow;
42
import org.gvsig.andami.ui.mdiManager.WindowInfo;
43
import org.gvsig.educa.portableview.app.viewer.PortableViewDocument;
44
import org.gvsig.educa.portableview.swing.PortableViewSwingLocator;
45
import org.gvsig.educa.portableview.swing.PortableViewSwingManager;
46
import org.gvsig.educa.portableview.swing.PortableViewWindowManager.MESSAGE_DIALOG_TYPE;
47
import org.gvsig.educa.portableview.swing.viewer.PortableViewInforamtionViewer;
48
import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
49
import org.gvsig.tools.swing.api.ToolsSwingLocator;
50
import org.gvsig.tools.swing.api.usability.UsabilitySwingManager;
51

  
52
/**
53
 * @author gvSIG Team
54
 * @version $Id$
55
 *
56
 */
57
public class PortableViewDocumentProperties extends JPanel implements
58
    SingletonWindow {
59

  
60
    /**
61
     *
62
     */
63
    private static final long serialVersionUID = 8865766314251281948L;
64

  
65
    private static final int DEFAULT_HEIGHT = 450;
66

  
67
    private static final int DEFAULT_WIDTH = 700;
68

  
69
    private final PortableViewDocument model;
70
    private final PortableViewSwingManager tmSwingManager;
71
    private final UsabilitySwingManager usabManager;
72
    private WindowInfo windowInfo;
73

  
74
    private JTextField name;
75

  
76
    private PortableViewInforamtionViewer info;
77

  
78
    private JTextArea comments;
79

  
80
    private JButton acceptButton;
81

  
82
    private JButton cancelButton;
83

  
84
    private JTextField sourceViewName;
85

  
86
    /**
87
     * @param doc
88
     */
89
    public PortableViewDocumentProperties(PortableViewDocument doc) {
90
        super();
91
        model = doc;
92
        tmSwingManager = PortableViewSwingLocator.getSwingManager();
93
        usabManager = ToolsSwingLocator.getUsabilitySwingManager();
94
        initializeUI();
95
    }
96

  
97
    /**
98
     *
99
     */
100
    private void initializeUI() {
101
        setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
102
        setLayout(new GridBagLayout());
103

  
104
        GridBagConstraints gbcBase = createBaseGridBagContraints();
105

  
106
        // add name
107
        JPanel namePanel = createNamePanel();
108
        add(namePanel, gbcBase.clone());
109

  
110
        // add ThMap info
111
        JPanel infoPanel = createInfoPanel();
112
        GridBagConstraints gbc = (GridBagConstraints) gbcBase.clone();
113
        gbc.fill = GridBagConstraints.BOTH;
114
        gbc.weighty = 1;
115
        add(infoPanel, gbc);
116

  
117
        // add comments
118
        JPanel commentPanel = createCommentsPanel();
119
        add(commentPanel, gbcBase.clone());
120

  
121
        // add command panel
122
        JPanel commandsPanel = createCommandPanel();
123
        add(commandsPanel, gbcBase.clone());
124

  
125
    }
126

  
127
    /**
128
     * @return
129
     */
130
    private GridBagConstraints createBaseGridBagContraints() {
131
        GridBagConstraints gbcBase = new GridBagConstraints();
132

  
133
        gbcBase.gridx = GridBagConstraints.RELATIVE;
134
        gbcBase.gridy = GridBagConstraints.RELATIVE;
135
        gbcBase.gridheight = 1;
136
        gbcBase.gridwidth = GridBagConstraints.REMAINDER;
137
        gbcBase.insets = new Insets(5, 5, 5, 5);
138
        gbcBase.fill = GridBagConstraints.HORIZONTAL;
139
        gbcBase.weightx = 1;
140
        gbcBase.weighty = 0;
141
        return gbcBase;
142
    }
143

  
144
    /**
145
     * @return
146
     */
147
    private JPanel createCommandPanel() {
148
        JPanel commandsPanel =
149
            new JPanel(new FlowLayout(FlowLayout.TRAILING, 10, 10));
150
        acceptButton =
151
            usabManager.createJButton(new AbstractAction(tmSwingManager
152
                .getTranslation("accept")) {
153

  
154
                /**
155
                     *
156
                     */
157
                private static final long serialVersionUID =
158
                    -1782481065769162438L;
159

  
160
                public void actionPerformed(ActionEvent e) {
161
                    accept();
162

  
163
                }
164

  
165
            });
166
        commandsPanel.add(acceptButton);
167
        cancelButton =
168
            usabManager.createJButton(new AbstractAction(tmSwingManager
169
                .getTranslation("cancel")) {
170

  
171
                /**
172
                     *
173
                     */
174
                private static final long serialVersionUID =
175
                    2955490218831066658L;
176

  
177
                public void actionPerformed(ActionEvent e) {
178
                    close();
179

  
180
                }
181

  
182
            });
183
        commandsPanel.add(cancelButton);
184
        return commandsPanel;
185
    }
186

  
187
    /**
188
     * @return
189
     */
190
    private JPanel createNamePanel() {
191
        GridBagLayoutPanel namePanel = new GridBagLayoutPanel();
192
        name = new JTextField(model.getName());
193
        namePanel.addComponent(tmSwingManager.getTranslation("name"), name);
194
        sourceViewName = new JTextField();
195
        sourceViewName.setEditable(false);
196
        if (model.getSourceView() != null) {
197
            sourceViewName.setText(model.getSourceView().getName());
198
            namePanel.addComponent(
199
                tmSwingManager.getTranslation("source_view"), sourceViewName);
200
        }
201
        return namePanel;
202
    }
203

  
204
    /**
205
     * @return
206
     */
207
    private JPanel createInfoPanel() {
208
        JPanel infoPanel = new JPanel(new GridLayout());
209
        info = tmSwingManager.newInformationViewer();
210
        info.loadMapInformation(model.getPortableView());
211
        infoPanel.add(new JScrollPane(info.getSwingComponent()));
212
        infoPanel.setBorder(BorderFactory.createTitledBorder(tmSwingManager
213
            .getTranslation("portable_view_information")));
214
        return infoPanel;
215
    }
216

  
217
    /**
218
     * @return
219
     */
220
    private JPanel createCommentsPanel() {
221
        GridBagLayoutPanel commentPanel = new GridBagLayoutPanel();
222
        comments = new JTextArea(model.getComment());
223
        JScrollPane commentsScroll = new JScrollPane(comments);
224
        commentPanel.addComponent(tmSwingManager.getTranslation("comments"),
225
            commentsScroll);
226
        return commentPanel;
227
    }
228

  
229
    private void accept() {
230
        if (StringUtils.isBlank(name.getText())) {
231
            tmSwingManager.getWindowManager().showMessageDialog(this,
232
                tmSwingManager.getTranslation("portable_view_properties"),
233
                tmSwingManager.getTranslation("name_is_required"),
234
                MESSAGE_DIALOG_TYPE.ERROR);
235
            return;
236
        }
237
        model.setName(name.getText());
238
        model.setComment(comments.getText());
239
        close();
240
    }
241

  
242
    public void close() {
243
        PluginServices.getMDIManager().closeWindow(this);
244
    }
245

  
246
    public WindowInfo getWindowInfo() {
247
        if (windowInfo == null) {
248
            windowInfo =
249
                new WindowInfo(WindowInfo.MAXIMIZABLE | WindowInfo.RESIZABLE);
250

  
251
            windowInfo.setTitle(tmSwingManager
252
                .getTranslation("portable_view_properties"));
253

  
254
            windowInfo.setWidth(DEFAULT_WIDTH);
255
            windowInfo.setHeight(DEFAULT_HEIGHT);
256
        }
257
        return windowInfo;
258
    }
259

  
260
    public Object getWindowProfile() {
261
        return WindowInfo.PROPERTIES_PROFILE;
262
    }
263

  
264
    public Object getWindowModel() {
265
        return model;
266
    }
267

  
268
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/java/org/gvsig/educa/portableview/app/viewer/ui/TocImageProvider.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.educa.portableview.app.viewer.ui;
23

  
24
import javax.swing.ImageIcon;
25

  
26
import org.gvsig.andami.PluginServices;
27
import org.gvsig.educa.portableview.swing.viewer.PortableViewTocImageProvider;
28
import org.gvsig.fmap.mapcontext.layers.FLayer;
29
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
30
import org.gvsig.fmap.mapcontext.rendering.symbols.ISymbol;
31

  
32
/**
33
 * Image provider for Portable View TOC items
34
 *
35
 * @author gvSIG Team
36
 * @version $Id$
37
 *
38
 */
39
public class TocImageProvider implements PortableViewTocImageProvider {
40

  
41
    public ImageIcon getImageIconForLayer(FLayer layer) {
42
        return PluginServices.getIconTheme().get(layer.getTocImageIcon());
43
    }
44

  
45
    public ImageIcon getSymbolPreview(ISymbol symbol, FLayer sourceLayer) {
46
        // Use default
47
        return null;
48
    }
49

  
50
    public ImageIcon getUnavailableIconForLayer(){
51
    	return PluginServices.getIconTheme().get("layer-unavialable");
52
    }
53

  
54
}
org.gvsig.educa.portableview/tags/org.gvsig.educa.portableview-1.0.170/org.gvsig.educa.portableview.app/org.gvsig.educa.portableview.app.viewer/src/main/java/org/gvsig/educa/portableview/app/viewer/ui/PortableViewDocumentViewer.java
1
/* gvSIG. Geographic Information System of the Valencian Government
2
 *
3
 * Copyright (C) 2007-2008 Infrastructures and Transports Department
4
 * of the Valencian Government (CIT)
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., 51 Franklin Street, Fifth Floor, Boston,
19
 * MA  02110-1301, USA.
20
 *
21
 */
22
package org.gvsig.educa.portableview.app.viewer.ui;
23

  
24
import java.awt.GridLayout;
25
import java.beans.PropertyChangeEvent;
26
import java.beans.PropertyChangeListener;
27
import java.io.IOException;
28

  
29
import javax.help.UnsupportedOperationException;
30
import javax.swing.BorderFactory;
31
import javax.swing.JPanel;
32

  
33
import org.cresques.cts.IProjection;
34
import org.gvsig.andami.PluginServices;
35
import org.gvsig.andami.ui.mdiFrame.NewStatusBar;
36
import org.gvsig.andami.ui.mdiManager.IWindowTransform;
37
import org.gvsig.andami.ui.mdiManager.WindowInfo;
38
import org.gvsig.app.project.documents.Document;
39
import org.gvsig.app.project.documents.gui.IDocumentWindow;
40
import org.gvsig.app.project.documents.gui.WindowLayout;
41
import org.gvsig.educa.portableview.app.viewer.PortableViewBasicMapControlExtension;
42
import org.gvsig.educa.portableview.app.viewer.PortableViewDocument;
43
import org.gvsig.educa.portableview.map.CantLoadContextException;
44
import org.gvsig.educa.portableview.map.InvalidPortableViewFormatException;
45
import org.gvsig.educa.portableview.map.PortableView;
46
import org.gvsig.educa.portableview.map.PortableViewInformation;
47
import org.gvsig.educa.portableview.swing.PortableViewSwingLocator;
48
import org.gvsig.educa.portableview.swing.PortableViewSwingManager;
49
import org.gvsig.educa.portableview.swing.viewer.PortableViewViewer;
50
import org.gvsig.fmap.mapcontext.MapContext;
51
import org.gvsig.fmap.mapcontext.events.ColorEvent;
52
import org.gvsig.fmap.mapcontext.events.ExtentEvent;
53
import org.gvsig.fmap.mapcontext.events.ProjectionEvent;
54
import org.gvsig.fmap.mapcontext.events.listeners.ViewPortListener;
55
import org.gvsig.fmap.mapcontrol.MapControl;
56

  
57
/**
58
 * Document Window to show PortableViews
59
 *
60
 * @author gvSIG Team
61
 * @version $Id$
62
 *
63
 */
64
public class PortableViewDocumentViewer extends JPanel implements
65
    IDocumentWindow, IWindowTransform, PropertyChangeListener {
66

  
67
    /**
68
     *
69
     */
70
    private static final long serialVersionUID = 6987853732480183690L;
71

  
72
    private static final int DEFAULT_HEIGHT = 450;
73

  
74
    private static final int DEFAULT_WIDTH = 700;
75

  
76
    private WindowInfo windowInfo;
77
    private final PortableViewDocument model;
78
    private boolean isPalette = false;
79

  
80
    private final PortableViewSwingManager tmSwingManager;
81

  
82
    private PortableViewViewer viewer;
83

  
84
    private String title;
85

  
86
    private ViewPortListener viewPortListener;
87

  
88
    /**
89
     * Default contructor
90
     *
91
     * @throws IOException
92
     * @throws CantLoadContextException
93
     * @throws InvalidPortableViewFormatException
94
     *
95
     */
96
    public PortableViewDocumentViewer(Document document)
97
        throws InvalidPortableViewFormatException, CantLoadContextException,
98
        IOException {
99
        super();
100
        model = (PortableViewDocument) document;
101
        tmSwingManager = PortableViewSwingLocator.getSwingManager();
102
        setBorder(BorderFactory.createEmptyBorder(3, 3, 3, 3));
103
        setLayout(new GridLayout(1, 1));
104

  
105
        model.addPropertyChangeListener(this);
106

  
107
        updateViewer();
108
        updateTitle();
109
    }
110

  
111
    /**
112
     * Gets the title for this window
113
     *
114
     * @return
115
     */
116
    public String getTitle() {
117
        return title;
118
    }
119

  
120
    /**
121
     * Update the panel title
122
     *
123
     */
124
    protected void updateTitle() {
125
        title =
126
            tmSwingManager.getTranslation("Portable_View").concat(": ")
127
                .concat(this.model.getName());
128
        if (windowInfo != null) {
129
            windowInfo.setTitle(title);
130
        }
131
    }
132

  
133
    /**
134
     * Update the view contained in the panel
135
     *
136
     * @throws InvalidPortableViewFormatException
137
     * @throws CantLoadContextException
138
     * @throws IOException
139
     */
140
    protected void updateViewer() throws InvalidPortableViewFormatException,
141
        CantLoadContextException, IOException {
142
        String toolId = null;
143

  
144
        // Remove previous viewer
145
        if (viewer != null) {
146
            // backup current tool
147
            toolId = viewer.getMapControl().getCurrentTool();
148
            remove(viewer.getSwingComponent());
149
            if (viewPortListener != null) {
150
                viewer.getMapControl().getViewPort()
151
                    .removeViewPortListener(viewPortListener);
152
            }
153
            viewer.dispose();
154
            viewer = null;
155
        }
156

  
157
        // create new viewer
158
        viewer = tmSwingManager.getViewer(model.getPortableView());
159
        add(viewer.getSwingComponent());
160
        final MapControl mapControl = viewer.getMapControl();
161

  
162
        // restore tool (if any)
163
        if (toolId != null) {
164
            mapControl.setTool(toolId);
165
        } else {
166
            mapControl.setTool(PortableViewBasicMapControlExtension.TOOL_PAN_ID);
167
        }
168
        if (mapControl.getViewPort() != null) {
169
            viewPortListener = new ViewPortListener() {
170

  
171
                public void extentChanged(ExtentEvent e) {
172
                    if (PluginServices.getMainFrame() != null) {
173
                        NewStatusBar statusBar =
174
                            PluginServices.getMainFrame().getStatusBar();
175
                        statusBar
176
                            .setControlValue("scale", String.valueOf(mapControl
177
                                .getMapContext().getScaleView()));
178
                        statusBar.setMessage("projection", mapControl
179
                            .getViewPort().getProjection().getAbrev());
180
                    }
181
                }
182

  
183
                public void backColorChanged(ColorEvent e) {
184
                    // Do nothing
185
                }
186

  
187
                public void projectionChanged(ProjectionEvent e) {
188
                    // Do nothing
189
                }
190
            };
191
            mapControl.getViewPort().addViewPortListener(viewPortListener);
192
        }
193
    }
194

  
195
    /**
196
     * @return the viewer
197
     */
198
    public PortableViewViewer getViewer() {
199
        return viewer;
200
    }
201

  
202
    /**
203
     * @return the viewer
204
     */
205
    public PortableView getPortableView() {
206
        return viewer.getPortableView();
207
    }
208

  
209
    /**
210
     * @return the viewer
211
     */
212
    public PortableViewInformation getPortableViewInformation() {
213
        return viewer.getPortableView().getInformation();
214
    }
215

  
216
    // IWindow interface
217

  
218
    public WindowInfo getWindowInfo() {
219
        if (windowInfo == null) {
220
            windowInfo =
221
                new WindowInfo(WindowInfo.ICONIFIABLE | WindowInfo.MAXIMIZABLE
222
                    | WindowInfo.RESIZABLE);
223

  
224
            windowInfo.setTitle(getTitle());
225

  
226
            windowInfo.setWidth(DEFAULT_WIDTH);
227
            windowInfo.setHeight(DEFAULT_HEIGHT);
228
        }
229
        return windowInfo;
230
    }
231

  
232
    // SingletonWindow interface
233

  
234
    public Object getWindowModel() {
235
        return this.model;
236
    }
237

  
238
    public void toPalette() {
239
        isPalette = true;
240
        windowInfo.toPalette(true);
241
        windowInfo.setClosed(false);
242
        PluginServices.getMDIManager().changeWindowInfo(this, getWindowInfo());
243
    }
244

  
245
    public void restore() {
246
        isPalette = false;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff