Revision 174

View differences:

org.gvsig.lrs/tags/org.gvsig.lrs-1.0.21/org.gvsig.lrs.app/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.lrs</artifactId>
6
    <version>1.0.21</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.lrs.app</artifactId>
10
  <packaging>pom</packaging>
11
  <name>org.gvsig.lrs.app</name>
12

  
13
  <modules>
14
    <module>org.gvsig.lrs.app.mainplugin</module>
15
  </modules>
16

  
17
</project>
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.21/org.gvsig.lrs.app/org.gvsig.lrs.app.mainplugin/pom.xml
1
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2
  <modelVersion>4.0.0</modelVersion>
3
  <parent>
4
    <groupId>org.gvsig</groupId>
5
    <artifactId>org.gvsig.lrs.app</artifactId>
6
    <version>1.0.21</version>
7
  </parent>
8
  <groupId>org.gvsig</groupId>
9
  <artifactId>org.gvsig.lrs.app.mainplugin</artifactId>
10
  <version>1.0.21</version>
11
  <name>org.gvsig.lrs.app.mainplugin</name>
12

  
13
    <properties>
14
    <!-- Package info property values -->
15
    <gvsig.package.info.state>testing</gvsig.package.info.state>
16
    <gvsig.package.info.dependencies>required: org.gvsig.app.mainplugin -ge 2.3.0-A</gvsig.package.info.dependencies>
17
    <gvsig.package.info.official>true</gvsig.package.info.official>
18
    <gvsig.package.info.name>Linear reference system</gvsig.package.info.name>
19
    <gvsig.package.info.description>Provides tools to manage linear reference system.</gvsig.package.info.description>
20
    <gvsig.package.info.categories>Vector</gvsig.package.info.categories>
21
    <gvsig.package.info.javaVM>j1_6</gvsig.package.info.javaVM>
22
    <gvsig.package.info.poolURL>https://devel.gvsig.org/download/projects/gvsig-lrs/pool</gvsig.package.info.poolURL>
23
  </properties>
24

  
25
  <dependencies>
26
    <dependency>
27
      <groupId>org.gvsig</groupId>
28
      <artifactId>org.gvsig.andami</artifactId>
29
    </dependency>
30
    <dependency>
31
      <groupId>org.gvsig</groupId>
32
      <artifactId>org.gvsig.lrs.swing.api</artifactId>
33
    </dependency>
34
    <dependency>
35
      <groupId>org.gvsig</groupId>
36
      <artifactId>org.gvsig.lrs.lib.api</artifactId>
37
    </dependency>
38
    <dependency>
39
      <groupId>org.gvsig</groupId>
40
      <artifactId>org.gvsig.lrs.lib.impl</artifactId>
41
    </dependency>
42
    <dependency>
43
      <groupId>org.gvsig</groupId>
44
      <artifactId>org.gvsig.lrs.swing.impl</artifactId>
45
    </dependency>
46
    <dependency>
47
      <groupId>org.gvsig</groupId>
48
      <artifactId>org.gvsig.app.mainplugin</artifactId>
49
    </dependency>
50
    <dependency>
51
      <groupId>org.gvsig</groupId>
52
      <artifactId>org.gvsig.app.document.table.app.mainplugin</artifactId>
53
    </dependency>
54
  </dependencies>
55
</project>
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.21/org.gvsig.lrs.app/org.gvsig.lrs.app.mainplugin/buildNumber.properties
1
#Mon Jan 28 22:10:09 CET 2019
2
buildNumber=23
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.21/org.gvsig.lrs.app/org.gvsig.lrs.app.mainplugin/src/main/resources-plugin/plugin-persistence.def
1
<?xml version="1.0"?>
2
<!--
3
Definitions of plugin persistence org.gvsig.lrs.app.mainplugin
4
 -->
5
<definitions>
6
  <version>1.0.0</version>
7
  <classes>
8
    <class name="org.gvsig.lrs.app.mainplugin">
9
      <extends>
10
      	<class name="JLrsCalculateMLastUsedValues"/>
11
      </extends>
12
      <description>Persistence of the LRS plugin</description>
13
      <fields>
14
      </fields>
15
    </class>
16
  </classes>
17
</definitions>  
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.21/org.gvsig.lrs.app/org.gvsig.lrs.app.mainplugin/src/main/resources-plugin/i18n/text.properties
1
#text.properties
2

  
3
error_creating_panel=Error creando el panel
4

  
5
# CREATE ROUTE
6
length=Longitud
7
one_field=Un campo
8
two_fields=Dos campos
9
up_left=Arriba izquierda
10
down_left=Abajo izquierda
11
up_right=Arriba derecha
12
down_right=Abajo derecha
13
create_routes=Crear rutas
14
source=Origen
15
m-coordinate-selector=Selecciona geometrias para calcular su coordenada M
16
calculate-m-routes=Calcular coordenada M
17
id_route_field=Campo de identificadores de rutas
18
pk_selected=Campos con los valores de la coordenada M en los extremos
19
pk_inicial=Valor inicial
20
pk_final=Valor final
21
output_file=Archivo de salida
22
measure_source=Origen de mediciones
23
from_measure_field=Campo desde o longitud
24
to_measure_field=Campo hasta
25
coordinates_priority=Prioridad de coordenadas
26
measure_factor=Factor de medici\u00f3n
27
measure_offset=Compensaci\u00f3n de medici\u00f3n
28
ignore_spatial_gaps=Ignorar huecos espaciales
29
_Browser=Navegador
30
_Accept=Aceptar
31
_Cancel=Cancelar
32
_Close=Cerrar
33
linear_reference_system=Ref. lineal
34
progress=Progreso
35
error_getting_parameters=Error obteniendo los par\u00e1metros del algoritmo
36
need_to_select_a_route_identifier_field=Es necesario seleccionar un campo de identificadores de rutas
37
paratemeters=Parametros
38
_LrsNeededParameterException=Falta alguno de los par\u00e1metros necesarios.
39
need_to_fill_the_target_path=Es necesario rellenar la ruta al archivo de salida
40
need_to_select_a_length_measure_field=Es necesario seleccionar un campo para las medidas
41
need_to_select_a_from_measure_field=Es necesario seleccionar un campo para las medidas o desde el que comenzarlas
42
need_to_select_a_to_measure_field=Es necesario seleccionar un campo hasta el que terminar las medidas
43
file_already_exists_do_you_want_overwrite_it=El archivo ya existe \u00bfDesea sobrescribirlo?
44
grouping_features=Agrupando elementos
45
at_least_one_layer_needed=Es necesaria al menos una capa
46
impossible_to_find_needed_layer=No se ha podido encontrar la capa necesaria
47
error_creating_outputStore=Error creando el almac\u00E9n de salida
48
load_layer_question=\u00bfLe gustar\u00eda cargar la capa generada?
49
load_layer_question_title=\u00bfCargar Capa?
50

  
51
#CALIBRATE ROUTE
52
calibrate_point_layer=Capa de puntos de calibraci\u00f3n
53
id_calibration_point_route_field=Identificador de ruta en la capa de puntos
54
measures_field=Campo de medidas
55
measure_calc_method=M\u00E9todo de c\u00e1lculo de mediciones
56
search_radius=Radio de b\u00FAsqueda
57
interpolate_between_calibration_points=Interpolar entre puntos de calibraci\u00f3n
58
units=Unidades
59
extrapolate_before_calibration_points=Extrapolar antes de puntos de calibraci\u00f3n
60
extrapolate_after_calibration_points=Extrapolar despu\u00E9s de puntos de calibraci\u00f3n
61
include_all=Incluir todos los elementos en la capa de salida
62
distance=Distancia
63
measures=Medidas
64
calibrate_routes=Calibrar rutas
65
two_or_more_layers_are_needed=Son necesarias dos o mas capas
66
impossible_to_find_needed_layers=No fue posible encontrar las capas necesarias
67
error_getting_selected_item_from_cmbInputLayer=Error obteniendo el valor seleccionado del origen
68
error_getting_selected_item_from_cmbIdRouteField=Error obteniendo el valor seleccionado del identificador de rutas
69
need_to_select_a_source_layer=Es necesario seleccionar un campo para el origen
70
error_getting_selected_item_from_cmbCalibratePointLayer=Error obteniendo la capa de puntos de calibraci\u00f3n
71
need_to_select_a_calibrate_point_layer=Es necesario seleccionar un campo para la capa de puntos de calibraci\u00f3n
72
error_getting_selected_item_from_cmbCalibrationPointIdRouteField=Error obteniendo el valor seleccionado del identificador de rutas de la capa de calibraci\u00f3n
73
need_to_select_a_route_identifier_calibration_point_field=Es necesario seleccionar un campo para el identificador de rutas de la capa de calibraci\u00f3n
74
error_getting_selected_item_from_cmbFromMeasureField=Error obteniendo el valor seleccionado del campo desde
75
need_to_select_a_from_Measure_field=Es necesario seleccionar un valor desde
76
calibrating_features=Calibrando elementos
77
kilometer=kil\u00f3metro
78
meter=metro
79
centimeter=cent\u00edmetro
80
millimeter=mil\u00edmetro
81
mile=milla
82
yards=yardas
83
feet=pies
84
inch=pulgada
85

  
86
#EDIT ROUTE
87
a_layer_is_needed=Es necesaria una capa
88
an_editing_layer_is_needed=Es necesaria una capa editable
89
impossible_to_find_needed_layer=No fue posible encontrar una capa necesaria
90
edit_route_calibration=Editar calibraci\u00f3n de ruta
91
error_getting_table_info=Error obteniendo la tabla de informaci\u00f3n
92

  
93
minimum=M\u00ednimo
94
maximum=M\u00e1ximo
95
_Invert=Invertir
96
_Apply=Aplicar
97
a_selectedIdRoute_is_needed=Es necesario un identificador de ruta seleccionado
98
route_not_contained=El identificador de ruta no esta contenido en la capa en edici\u00f3n
99

  
100
warnings_in_edit_route=Se han encontrado las siguientes advertencias en la tabla de edici\u00f3n:
101
accept_warnings_question=\u00BFEsta seguro de que desea continuar guardando estos datos?
102
warnings_dialog=Di\u00e1logo de Advertencias Encontradas
103
more_warnings_found=...y {0} advertencias mas encontradas
104
warn_Not_data_found_in_table=La tabla de edici\u00f3n no tiene datos
105
warn_Not_enough_data_found_in_table=La tabla de edici\u00f3n no tiene datos suficientes
106
warn_Negative_value_at_row=Un dato negativo ha sido encontrado en la fila {0}
107
warn_Out_of_sequence_value_at_row=El valor en la fila {0} esta fuera de secuencia
108
warn_Repeated_value_at_row=Valores repetidos en las filas {0} y {1}
109

  
110

  
111
#GENERATE DYNAMIC SEGMENTATION
112
generate_dynamic_segmentation=Generar segmentaci\u00f3n din\u00e1mica
113
table=Tabla de Valores
114
table_id_route_field=Identificador de ruta en la tabla de valores
115
landmark_field=Hito
116
final_landmark_field=Hito final
117
value_field=Valor
118
a_table_is_needed=Es necesaria una tabla
119
error_getting_selected_item_from_cmbTable=Error obteniendo el valor seleccionando de la tabla
120
need_to_select_a_table=Es necesario seleccionar un campo para el valor de la tabla
121
error_getting_selected_item_from_cmbTableIdRouteField=Error obteniendo el valor seleccionando el identificador de ruta de la tabla
122
error_getting_selected_item_from_cmbLandmarkField=Error obteniendo el valor seleccionando del hito
123
need_to_select_a_landmark_field=Es necesario seleccionar un campo para el valor del hito
124
error_getting_selected_item_from_cmbFinalLandmarkField=Error obteniendo el valor seleccionando del hito final
125
error_getting_selected_item_from_cmbValueField=Error obteniendo el valor seleccionando del campo de valor
126
need_to_select_a_value_field=Es necesario seleccionar un campo para el valor
127

  
128
#SHOW MEASURES
129
at_least_a_line_needed=Al menos una l\u00ednea es necesaria
130
show_measures=Mostrar medidas
131
wiper_measures=Limpiar medidas
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.21/org.gvsig.lrs.app/org.gvsig.lrs.app.mainplugin/src/main/resources-plugin/i18n/text_en.properties
1
#text_en.properties
2

  
3
error_creating_panel=Error creating panel
4

  
5
# CREATE ROUTE
6
length=Length
7
one_field=One field
8
two_fields=Two fields
9
up_left=Up left
10
down_left=Down left
11
up_right=Up right
12
down_right=Down right
13
create_routes=Create Routes
14
source=Source
15
id_route_field=Route identifier field
16
m-coordinate-selector=Select the geometries to calculate the M coodinate
17
calculate-m-routes=Calculate M coordinate
18
pk_selected=Fields to get the M coordinate values
19
pk_inicial=Initial value
20
pk_final=End value
21
output_file=Output file
22
measure_source=Measure source
23
from_measure_field=From-measure or length field
24
to_measure_field=To-measure field
25
coordinates_priority=Coordinate priority
26
measure_factor=Measure factor
27
measure_offset=Measure offset
28
ignore_spatial_gaps=Ignore spatial gaps
29
_Browser=Browser
30
_Accept=Ok
31
_Cancel=Cancel
32
_Close=Close
33
linear_reference_system=Linear ref.
34
progress=Progress
35
error_getting_parameters=Error getting algorithm parameters
36
need_to_select_a route_identifier_field=You need to select a route identifier field
37
paratemeters=Parameters
38
_LrsNeededParameterException=One or more of required parameters are empty
39
need_to_fill_the_target_path=You need to fill the target file path
40
need_to_select_a_length_measure_field=You need to select a length measure field
41
need_to_select_a_from_measure_field=You need to select a from measure field
42
need_to_select_a_to_measure_field=You need to select a to measure field
43
file_already_exists_do_you_want_overwrite_it=File already exists. Do you want overwrite it?
44
grouping_features=Grouping features
45
at_least_one_layer_needed=At least one layer is needed
46
impossible_to_find_needed_layer=Impossible to find needed layer
47
error_creating_outputStore=Error creating output store
48
load_layer_question=Would you like to load the generated layer?
49
load_layer_question_title=Load Layer?
50

  
51
#CALIBRATE ROUTE
52
calibrate_point_layer=Calibration points layer
53
id_calibration_point_route_field=Route identifier in calibration points layer
54
measures_field=Measures field
55
measure_calc_method=Measure calculations method
56
search_radius=Search radius
57
interpolate_between_calibration_points=Interpolate between calibration points
58
units=Units
59
extrapolate_before_calibration_points=Extrapolate before calibration points
60
extrapolate_after_calibration_points=Extrapolate after calibration points
61
include_all=Include all elements in output layer
62
distance=Distance
63
measures=Measures
64
calibrate_routes=Calibrate routes
65
two_or_more_layers_are_needed=Two or more layers are needed
66
impossible_to_find_needed_layers=Impossible to find needed layers
67
error_getting_selected_item_from_cmbInputLayer=Error getting selected item from source layer
68
error_getting_selected_item_from_cmbIdRouteField=Error getting selected item from route identifier field
69
need_to_select_a_source_layer=You need to select a source layer
70
error_getting_selected_item_from_cmbCalibratePointLayer=Error getting selected item from calibration points layer
71
need_to_select_a_calibrate_point_layer=You need to select a calibration points layer
72
error_getting_selected_item_from_cmbCalibrationPointIdRouteField=Error getting selected item from route identifier in calibration points layer
73
need_to_select_a_route_identifier_calibration_point_field=You need to select a route identifier field from calibration points layer
74
error_getting_selected_item_from_cmbFromMeasureField=Error getting selected item from From-measure field
75
need_to_select_a_from_Measure_field=You need to select a From-measure field
76
calibrating_features=Calibrating features
77
kilometer=kilometer
78
meter=meter
79
centimeter=centimeter
80
millimeter=millimeter
81
mile=mile
82
yards=yards
83
feet=feet
84
inch=inch
85

  
86
#EDIT ROUTE
87
a_layer_is_needed=A layer is needed
88
an_editing_layer_is_needed=An editing layer is needed
89
impossible_to_find_needed_layer=Impossible to find a correct layer
90
edit_route_calibration=Edit route calibration
91

  
92
minimum=Minimum
93
maximum=Maximum
94
_Invert=Invert
95
_Apply=Apply
96
a_selectedIdRoute_is_needed=A selected route identifier is needed
97
route_not_contained=Selected id route is not contained in editing layer
98
error_getting_table_info=Error getting table info
99

  
100
warnings_in_edit_route=Have been found the following warnings in the data table:
101
accept_warnings_question=Are you sure you want to continue saving this data?
102
warnings_dialog=Warnings Found Dialog
103
more_warnings_found=...and {0} more warnings found
104
warn_Not_data_found_in_table=The editing table has not data
105
warn_Not_enough_data_found_in_table=The editing table has not enough data
106
warn_Negative_value_at_row=A negative value has been found at row {0}
107
warn_Out_of_sequence_value_at_row=Value at row {0} is out of sequence
108
warn_Repeated_value_at_row=Repeated values in rows {0} and {1}
109

  
110

  
111
#GENERATE DYNAMIC SEGMENTATION
112
generate_dynamic_segmentation=Generate dynamic segmentation
113
table=Value table
114
table_id_route_field=Route identifier in value table
115
landmark_field=Landmark
116
final_landmark_field=Final Landmark
117
value_field=Value
118
a_table_is_needed=A table is needed
119
error_getting_selected_item_from_cmbTable=Error getting selected item from table
120
need_to_select_a_table=You need to select a table
121
error_getting_selected_item_from_cmbTableIdRouteField=Error getting selected item from route identifier in value table
122
error_getting_selected_item_from_cmbLandmarkField=Error getting selected item from landmark field
123
need_to_select_a_landmark_field=You need to select a landmark field
124
error_getting_selected_item_from_cmbFinalLandmarkField=Error getting selected item from final landmark field
125
error_getting_selected_item_from_cmbValueField=Error getting selected item from value field
126
need_to_select_a_value_field=You need to select a value field
127

  
128
#SHOW MEASURES
129
at_least_a_line_needed=At least a line is needed
130
show_measures=Show Measures
131
wiper_measures=Clean measures
132

  
0 133

  
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.21/org.gvsig.lrs.app/org.gvsig.lrs.app.mainplugin/src/main/resources-plugin/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 gvSIG
3
  Association. This program is free software; you can redistribute it and/or modify
4
  it under the terms of the GNU General Public License as published by the Free Software
5
  Foundation; either version 3 of the License, or (at your option) any later version.
6
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
7
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
8
  PURPOSE. See the GNU General Public License for more details. You should have received
9
  a copy of the GNU General Public License along with this program; if not, write to
10
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
11
  USA. For any additional information, do not hesitate to contact us at info AT gvsig.com,
12
  or visit our website www.gvsig.com. -->
13
<plugin-config>
14
  <depends plugin-name="org.gvsig.app.mainplugin" />
15
  <depends plugin-name="org.gvsig.app.document.table.app.mainplugin" />
16
  <depends plugin-name="org.gvsig.shp.app.mainplugin" />
17
  <resourceBundle name="text" />
18
  <libraries library-dir="lib" />
19
  <extensions>
20
    <extension class-name="org.gvsig.lrs.app.createroute.CreateRouteExtension"
21
      description="" active="true" priority="1">
22

  
23
      <action name="create-routes" label="create_routes" tooltip="create_routes"
24
        position="900700100" action-command="create-routes" icon="pk_red"
25
        accelerator="" />
26

  
27
      <menu text="tools/linear_reference_system/create_routes" name="create-routes" />
28

  
29
      <tool-bar name="linear_reference_system" position="900700100">
30
        <action-tool name="create-routes" />
31
      </tool-bar>
32

  
33
    </extension>
34
    <extension class-name="org.gvsig.lrs.app.calibrateroute.CalibrateRouteExtension"
35
      description="" active="true" priority="1">
36

  
37
      <action name="calibrate-routes" label="calibrate_routes" tooltip="calibrate_routes"
38
        position="900700200" action-command="calibrate-routes" icon="pk_blue"
39
        accelerator="" />
40

  
41
      <menu text="tools/linear_reference_system/calibrate_routes" name="calibrate-routes" />
42

  
43
      <tool-bar name="linear_reference_system" position="900700200">
44
        <action-tool name="calibrate-routes" />
45
      </tool-bar>
46
      
47
      
48
    </extension>
49
    <extension class-name="org.gvsig.lrs.app.calibrateroute.MeasureCalculatorRouteExtension"
50
      description="" active="true" priority="2">
51
      
52
      <action name="calculate-m-routes" label="calculate-m-routes" tooltip="calculate-m-routes"
53
        position="900700300" action-command="calculate-m-routes" icon="pk_m"
54
        accelerator="" />
55

  
56
      <menu text="tools/linear_reference_system/calculate-m-routes" name="calculate-m-routes" />
57

  
58
      <tool-bar name="linear_reference_system" position="900700300">
59
        <action-tool name="calculate-m-routes" />
60
      </tool-bar>
61

  
62
    </extension>
63

  
64
    <extension class-name="org.gvsig.lrs.app.editroutecalibration.EditRouteCalibrationExtension"
65
      description="" active="true" priority="1">
66
      <action name="edit-route-calibration" label="edit_route_calibration" tooltip="edit_route_calibration"
67
        position="900700400" action-command="edit-route-calibration" icon="pk_cian"
68
        accelerator="" />
69
      <menu text="tools/linear_reference_system/edit_route_calibration" name="edit-route-calibration" />
70
      <tool-bar name="linear_reference_system" position="900700400">
71
        <action-tool name="edit-route-calibration" />
72
      </tool-bar>
73
    </extension>
74

  
75
    <extension class-name="org.gvsig.lrs.app.generatedynamicsegmentation.GenerateDynamicSegmentationExtension"
76
      description="" active="true" priority="1">
77
      <action name="generate-dynamic-segmentation" label="generate_dynamic_segmentation" tooltip="generate_dynamic_segmentation"
78
        position="900700500" action-command="generate-dynamic-segmentation" icon="pk_yellow"
79
        accelerator="" />
80
      <menu text="tools/linear_reference_system/generate_dynamic_segmentation" name="generate-dynamic-segmentation" />
81
      <tool-bar name="linear_reference_system" position="900700500">
82
        <action-tool name="generate-dynamic-segmentation" />
83
      </tool-bar>
84
    </extension>
85

  
86
    <extension class-name="org.gvsig.lrs.app.showmeasures.ShowMeasuresExtension"
87
      description="" active="true" priority="1">
88
      <action name="show-measures" label="show_measures" tooltip="show_measures"
89
        position="900700600" action-command="show-measures" icon="pk_green"
90
        accelerator="" />
91
      <menu text="tools/linear_reference_system/show_measures" name="show-measures" />
92
      <tool-bar name="linear_reference_system" position="900700600">
93
        <action-tool name="show-measures" />
94
      </tool-bar>
95
    </extension>
96

  
97
    <extension class-name="org.gvsig.lrs.app.showmeasures.WiperMeasuresExtension"
98
      description="" active="true" priority="1">
99
      <action name="wiper-measures" label="wiper_measures" tooltip="wiper_measures"
100
        position="900700700" action-command="wiper-measures" icon="wiper"
101
        accelerator="" />
102
      <menu text="tools/linear_reference_system/wiper_measures" name="wiper-measures" />
103
      <tool-bar name="linear_reference_system" position="900700700">
104
        <action-tool name="wiper-measures" />
105
      </tool-bar>
106
    </extension>
107

  
108
  </extensions>
109
</plugin-config>
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.21/org.gvsig.lrs.app/org.gvsig.lrs.app.mainplugin/src/main/assembly/gvsig-plugin-package.xml
1
<!-- gvSIG. Desktop Geographic Information System. Copyright (C) 2007-2013 gvSIG
2
  Association. This program is free software; you can redistribute it and/or modify
3
  it under the terms of the GNU General Public License as published by the Free Software
4
  Foundation; either version 3 of the License, or (at your option) any later version.
5
  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
6
  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
7
  PURPOSE. See the GNU General Public License for more details. You should have received
8
  a copy of the GNU General Public License along with this program; if not, write to
9
  the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
10
  USA. For any additional information, do not hesitate to contact us at info AT gvsig.com,
11
  or visit our website www.gvsig.com. -->
12
<assembly>
13
  <id>gvsig-plugin-package</id>
14
  <formats>
15
    <format>zip</format>
16
  </formats>
17
  <baseDirectory>${project.artifactId}</baseDirectory>
18
  <includeBaseDirectory>true</includeBaseDirectory>
19
  <files>
20
    <file>
21
      <source>target/${project.artifactId}-${project.version}.jar</source>
22
      <outputDirectory>lib</outputDirectory>
23
    </file>
24
    <file>
25
      <source>target/package.info</source>
26
    </file>
27
  </files>
28

  
29
  <fileSets>
30
    <fileSet>
31
      <directory>src/main/resources-plugin</directory>
32
      <outputDirectory>.</outputDirectory>
33
    </fileSet>
34
  </fileSets>
35

  
36

  
37
  <dependencySets>
38
    <dependencySet>
39
      <useProjectArtifact>false</useProjectArtifact>
40
      <useTransitiveDependencies>false</useTransitiveDependencies>
41
      <outputDirectory>lib</outputDirectory>
42
      <includes>
43
        <include>org.gvsig:org.gvsig.lrs.lib.api</include>
44
        <include>org.gvsig:org.gvsig.lrs.lib.impl</include>
45
        <include>org.gvsig:org.gvsig.lrs.swing.api</include>
46
        <include>org.gvsig:org.gvsig.lrs.swing.impl</include>
47
      </includes>
48
    </dependencySet>
49
  </dependencySets>
50

  
51
</assembly>
52

  
0 53

  
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.21/org.gvsig.lrs.app/org.gvsig.lrs.app.mainplugin/src/main/java/org/gvsig/lrs/app/createroute/CreateRouteExtension.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
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., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.app.createroute;
24

  
25
import java.awt.event.ActionEvent;
26
import java.awt.event.ActionListener;
27

  
28
import javax.swing.JOptionPane;
29

  
30
import org.apache.commons.lang3.StringUtils;
31
import org.bouncycastle.util.Store;
32
import org.cresques.cts.IProjection;
33
import org.gvsig.andami.IconThemeHelper;
34
import org.gvsig.andami.plugins.Extension;
35
import org.gvsig.app.ApplicationLocator;
36
import org.gvsig.app.ApplicationManager;
37
import org.gvsig.app.project.documents.view.ViewDocument;
38
import org.gvsig.app.project.documents.view.gui.IView;
39
import org.gvsig.fmap.dal.DALLocator;
40
import org.gvsig.fmap.dal.DataManager;
41
import org.gvsig.fmap.dal.DataStore;
42
import org.gvsig.fmap.dal.DataStoreParameters;
43
import org.gvsig.fmap.dal.exception.InitializeException;
44
import org.gvsig.fmap.dal.exception.ProviderNotRegisteredException;
45
import org.gvsig.fmap.dal.exception.ReadException;
46
import org.gvsig.fmap.dal.exception.ValidateDataParametersException;
47
import org.gvsig.fmap.dal.feature.FeatureStore;
48
import org.gvsig.fmap.dal.store.shp.SHPNewStoreParameters;
49
import org.gvsig.fmap.geom.Geometry;
50
import org.gvsig.fmap.geom.type.GeometryType;
51
import org.gvsig.fmap.mapcontext.MapContextLocator;
52
import org.gvsig.fmap.mapcontext.MapContextManager;
53
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
54
import org.gvsig.fmap.mapcontext.layers.FLayer;
55
import org.gvsig.fmap.mapcontext.layers.FLayers;
56
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
57
import org.gvsig.lrs.lib.api.LrsAlgorithm;
58
import org.gvsig.lrs.lib.api.LrsAlgorithmsLocator;
59
import org.gvsig.lrs.lib.api.LrsAlgorithmsManager;
60
import org.gvsig.lrs.lib.api.LrsCreateRouteAlgorithmParams;
61
import org.gvsig.lrs.lib.api.exceptions.LrsGettingParametersException;
62
import org.gvsig.lrs.lib.api.exceptions.LrsNeededParameterException;
63
import org.gvsig.lrs.swing.api.JLrsAlgorithmParams;
64
import org.gvsig.lrs.swing.api.JLrsProgressDialog;
65
import org.gvsig.lrs.swing.api.LrsAlgorithmsSwingLocator;
66
import org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager;
67
import org.gvsig.lrs.swing.impl.JLrsCreateRouteParamsController;
68
import org.gvsig.lrs.swing.impl.JLrsUtils;
69
import org.gvsig.tools.ToolsLocator;
70
import org.gvsig.tools.i18n.I18nManager;
71
import org.gvsig.tools.swing.api.ToolsSwingLocator;
72
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
73
import org.gvsig.tools.task.SimpleTaskStatus;
74
import org.slf4j.Logger;
75
import org.slf4j.LoggerFactory;
76

  
77

  
78
/**
79
 * @author fdiaz
80
 *
81
 */
82
public class CreateRouteExtension extends Extension {
83

  
84
    private static final Logger logger = LoggerFactory.getLogger(CreateRouteExtension.class);
85

  
86
    /* (non-Javadoc)
87
     * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
88
     */
89
    public void execute(String actionCommand) {
90
        if (StringUtils.equalsIgnoreCase(actionCommand, "create-routes")) {
91
            IView view = getActiveView();
92
            FLayers layers = view.getMapControl().getMapContext().getLayers();
93

  
94
            final WindowManager winManager = ToolsSwingLocator.getWindowManager();
95

  
96
            final LrsAlgorithmsSwingManager manager = LrsAlgorithmsSwingLocator.getLrsAlgorithmsSwingManager();
97

  
98
            final I18nManager i18nManager = ToolsLocator.getI18nManager();
99

  
100
            JLrsCreateRouteParamsController panel;
101
            try {
102
                panel = (JLrsCreateRouteParamsController)manager.createJLrsCreateRouteAlgorithmParameters(layers, null);
103
            } catch (LrsNeededParameterException e2) {
104
                logger.error("Error creating panel", e2);
105
                JOptionPane.showMessageDialog(
106
                    null,
107
                    new StringBuilder().append(i18nManager.getTranslation("error_creating_panel"))
108
                        .append(":").append(e2.getLocalizedMessage()),
109
                    i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE);
110
                return;
111
            }
112
            panel.setVisibleAceptCancel(true);
113
            panel.addActionListener(new ActionListener() {
114

  
115
                public void actionPerformed(ActionEvent e) {
116
                    JLrsAlgorithmParams panel = (JLrsAlgorithmParams) e.getSource();
117
                    if (panel.isCanceled()) {
118
                        return;
119
                    }
120
                    LrsCreateRouteAlgorithmParams params = null;
121
                    try {
122
                        params = (LrsCreateRouteAlgorithmParams)panel.getParams();
123
                    } catch (LrsGettingParametersException e1) {
124
                        logger.error("Error getting parameters", e1);
125
                        JOptionPane.showMessageDialog(
126
                            null,
127
                            new StringBuilder().append(i18nManager.getTranslation("error_getting_parameters"))
128
                                .append(":").append(e1.getLocalizedMessage()),
129
                            i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE);
130
                        return;
131
                    } catch (LrsNeededParameterException e1) {
132
                        logger.warn("Error getting parameters", e1);
133
                        JOptionPane.showMessageDialog(
134
                            null,
135
                            i18nManager.getTranslation(e1.getMessage()),
136
                            i18nManager.getTranslation("warning"), JOptionPane.WARNING_MESSAGE);
137
                        return;
138
                    }
139
                    LrsAlgorithmsManager algorithmsManager = LrsAlgorithmsLocator.getLrsAlgorithmsManager();
140
                    final LrsAlgorithm algorithm = algorithmsManager.createLrsAlgorithm(params);
141
                    final SHPNewStoreParameters shpParams=(SHPNewStoreParameters)params.getNewFeatureStoreParameters();
142

  
143
                    final SimpleTaskStatus taskStatus =
144
                        ToolsLocator.getTaskStatusManager().createDefaultSimpleTaskStatus(i18nManager.getTranslation("progress"));
145

  
146
                    final JLrsProgressDialog progressDialog = manager.createJLrsProgressDialog(taskStatus);
147

  
148
                    winManager.showWindow(progressDialog.asJComponent(), i18nManager.getTranslation("create_routes"),
149
                        WindowManager.MODE.WINDOW);
150

  
151
                    Thread task = new Thread(new Runnable() {
152

  
153
                        public void run() {
154
                            try {
155
                                algorithm.execute(taskStatus);
156
                                int resultLoadLayer =JOptionPane.showConfirmDialog(
157
                                    null,
158
                                    i18nManager.getTranslation("load_layer_question"),
159
                                    i18nManager.getTranslation("load_layer_question_title"), JOptionPane.YES_NO_OPTION);
160
                                if (resultLoadLayer==JOptionPane.YES_OPTION){
161
                                    loadLayer(shpParams);
162
                                }
163
                            } catch (Exception e) {
164
                                logger.error("Error creating routes", e);
165
                                String message = e.getMessage();
166
                                if (e.getCause() != null) {
167
                                    message = e.getCause().getMessage();
168
                                }
169
                                JOptionPane.showMessageDialog(
170
                                    progressDialog.asJComponent(),
171
                                    message,
172
                                    i18nManager.getTranslation("create_routes"),
173
                                    JOptionPane.ERROR_MESSAGE
174
                                );
175
                            }
176
                        }
177
                    });
178
                    task.start();
179
                }
180
            });
181
            winManager.showWindow(panel.asJComponent(), i18nManager.getTranslation("create_routes"),
182
                WindowManager.MODE.WINDOW);
183
        }
184
    }
185

  
186
    /* (non-Javadoc)
187
     * @see org.gvsig.andami.plugins.IExtension#initialize()
188
     */
189
    public void initialize() {
190
        registerIcons();
191
    }
192

  
193
    /* (non-Javadoc)
194
     * @see org.gvsig.andami.plugins.IExtension#isEnabled()
195
     */
196
    public boolean isEnabled() {
197
        IView view = getActiveView();
198
        if (view!=null){
199
            FLayers layers = view.getMapControl().getMapContext().getLayers();
200
            return JLrsUtils.validateOneCurveLyrOneNonGeomField(layers);
201
        }else return false;
202

  
203
    }
204

  
205
    /* (non-Javadoc)
206
     * @see org.gvsig.andami.plugins.IExtension#isVisible()
207
     */
208
    public boolean isVisible() {
209
        ApplicationManager application = ApplicationLocator.getManager();
210

  
211
        return application.getActiveComponent(ViewDocument.class) != null;
212
    }
213

  
214
    private void registerIcons() {
215
        IconThemeHelper.registerIcon("lrs", "pk_red", this);
216
        IconThemeHelper.registerIcon("lrs", "pk_m", this);
217
    }
218

  
219

  
220
    private IView getActiveView() {
221
        ApplicationManager application = ApplicationLocator.getManager();
222
        IView view = (IView) application.getActiveComponent(ViewDocument.class);
223
        return view;
224
    }
225

  
226
    private void loadLayer(SHPNewStoreParameters shpParams){
227
        if (shpParams!=null ){
228
            String name=shpParams.getFile().getName();
229
            if (name.contains(".shp")){
230
                name=name.substring(0,name.lastIndexOf(".shp"));
231
            }
232
            MapContextManager mapContextManager =MapContextLocator.getMapContextManager();
233

  
234
            FLyrVect newLayer=null;
235
            try {
236
                newLayer = (FLyrVect) mapContextManager.createLayer(name,shpParams);
237
            } catch (LoadLayerException e) {
238
                logger.warn("Couldn't load layer",e);
239
            }
240
            getActiveView().getMapControl().getMapContext().getLayers().addLayer(newLayer);
241
        }
242
    }
243

  
244
}
0 245

  
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.21/org.gvsig.lrs.app/org.gvsig.lrs.app.mainplugin/src/main/java/org/gvsig/lrs/app/calibrateroute/CalibrateRouteExtension.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
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., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.app.calibrateroute;
24

  
25
import java.awt.event.ActionEvent;
26
import java.awt.event.ActionListener;
27

  
28
import javax.swing.JOptionPane;
29

  
30
import org.apache.commons.lang3.StringUtils;
31
import org.gvsig.andami.IconThemeHelper;
32
import org.gvsig.andami.PluginServices;
33
import org.gvsig.andami.PluginsLocator;
34
import org.gvsig.andami.PluginsManager;
35
import org.gvsig.andami.plugins.Extension;
36
import org.gvsig.app.ApplicationLocator;
37
import org.gvsig.app.ApplicationManager;
38
import org.gvsig.app.project.documents.view.ViewDocument;
39
import org.gvsig.app.project.documents.view.gui.IView;
40
import org.gvsig.fmap.dal.exception.DataException;
41
import org.gvsig.fmap.dal.feature.EditableFeature;
42
import org.gvsig.fmap.dal.feature.Feature;
43
import org.gvsig.fmap.dal.feature.FeatureSelection;
44
import org.gvsig.fmap.dal.feature.FeatureStore;
45
import org.gvsig.fmap.dal.store.shp.SHPNewStoreParameters;
46
import org.gvsig.fmap.geom.Geometry;
47
import org.gvsig.fmap.mapcontext.MapContextLocator;
48
import org.gvsig.fmap.mapcontext.MapContextManager;
49
import org.gvsig.fmap.mapcontext.exceptions.LoadLayerException;
50
import org.gvsig.fmap.mapcontext.layers.FLayers;
51
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
52
import org.gvsig.lrs.lib.api.LrsAlgorithm;
53
import org.gvsig.lrs.lib.api.LrsAlgorithmsLocator;
54
import org.gvsig.lrs.lib.api.LrsAlgorithmsManager;
55
import org.gvsig.lrs.lib.api.LrsCalibrateRouteAlgorithmParams;
56
import org.gvsig.lrs.lib.api.MeasuresCalculator;
57
import org.gvsig.lrs.lib.api.exceptions.LrsGettingParametersException;
58
import org.gvsig.lrs.lib.api.exceptions.LrsNeededParameterException;
59
import org.gvsig.lrs.swing.api.JLrsAlgorithmParams;
60
import org.gvsig.lrs.swing.api.JLrsLastUsedValues;
61
import org.gvsig.lrs.swing.api.JLrsProgressDialog;
62
import org.gvsig.lrs.swing.api.LrsAlgorithmsSwingLocator;
63
import org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager;
64
import org.gvsig.lrs.swing.impl.JLrsCalibrateRouteParamsController;
65
import org.gvsig.lrs.swing.impl.JLrsUtils;
66
import org.gvsig.tools.ToolsLocator;
67
import org.gvsig.tools.dispose.DisposableIterator;
68
import org.gvsig.tools.dynobject.DynObject;
69
import org.gvsig.tools.i18n.I18nManager;
70
import org.gvsig.tools.swing.api.ToolsSwingLocator;
71
import org.gvsig.tools.swing.api.windowmanager.Dialog;
72
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
73
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2;
74
import org.gvsig.tools.task.SimpleTaskStatus;
75
import org.slf4j.Logger;
76
import org.slf4j.LoggerFactory;
77

  
78

  
79
/**
80
 * @author fdiaz
81
 *
82
 */
83
public class CalibrateRouteExtension extends Extension {
84

  
85
	private static final Logger logger = LoggerFactory.getLogger(CalibrateRouteExtension.class);
86

  
87
	/* (non-Javadoc)
88
	 * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
89
	 */
90
	public void execute(String actionCommand) {
91
		if (StringUtils.equalsIgnoreCase(actionCommand, "calibrate-routes")) {
92
			IView view = getActiveView();
93
			FLayers layers = view.getMapControl().getMapContext().getLayers();
94

  
95
			final WindowManager winManager = ToolsSwingLocator.getWindowManager();
96

  
97
			final LrsAlgorithmsSwingManager manager = LrsAlgorithmsSwingLocator.getLrsAlgorithmsSwingManager();
98

  
99
			final I18nManager i18nManager = ToolsLocator.getI18nManager();
100

  
101
			JLrsCalibrateRouteParamsController panel;
102
			try {
103
				panel = (JLrsCalibrateRouteParamsController)manager.createJLrsCalibrateRouteAlgorithmParameters(layers, null);
104
			} catch (LrsNeededParameterException e2) {
105
				logger.error("Error creating panel", e2);
106
				JOptionPane.showMessageDialog(
107
						null,
108
						new StringBuilder().append(i18nManager.getTranslation("error_creating_panel"))
109
						.append(":").append(e2.getLocalizedMessage()),
110
						i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE);
111
				return;
112
			}
113
			panel.setVisibleAceptCancel(true);
114
			panel.addActionListener(new ActionListener() {
115

  
116
				public void actionPerformed(ActionEvent e) {
117
					JLrsAlgorithmParams panel = (JLrsAlgorithmParams) e.getSource();
118
					if (panel.isCanceled()) {
119
						return;
120
					}
121
					LrsCalibrateRouteAlgorithmParams params = null;
122
					try {
123
						params = (LrsCalibrateRouteAlgorithmParams)panel.getParams();
124
					} catch (LrsGettingParametersException e1) {
125
						logger.error("Error getting parameters", e1);
126
						JOptionPane.showMessageDialog(
127
								null,
128
								new StringBuilder().append(i18nManager.getTranslation("error_getting_parameters"))
129
								.append(":").append(e1.getLocalizedMessage()),
130
								i18nManager.getTranslation("error"), JOptionPane.ERROR_MESSAGE);
131
						return;
132
					} catch (LrsNeededParameterException e1) {
133
						logger.warn("Error getting parameters", e1);
134
						JOptionPane.showMessageDialog(
135
								null,
136
								i18nManager.getTranslation(e1.getMessage()),
137
								i18nManager.getTranslation("warning"), JOptionPane.WARNING_MESSAGE);
138
						return;
139
					}
140
					LrsAlgorithmsManager algorithmsManager = LrsAlgorithmsLocator.getLrsAlgorithmsManager();
141
					final LrsAlgorithm algorithm = algorithmsManager.createLrsAlgorithm(params);
142
					final SHPNewStoreParameters shpParams=(SHPNewStoreParameters)params.getNewFeatureStoreParameters();
143

  
144
					final SimpleTaskStatus taskStatus =
145
							ToolsLocator.getTaskStatusManager().createDefaultSimpleTaskStatus(i18nManager.getTranslation("progress"));
146

  
147
					final JLrsProgressDialog progressDialog = manager.createJLrsProgressDialog(taskStatus);
148

  
149
					winManager.showWindow(progressDialog.asJComponent(), i18nManager.getTranslation("calibrate_routes"),
150
							WindowManager.MODE.WINDOW);
151

  
152
					Thread task = new Thread(new Runnable() {
153

  
154
						public void run() {
155
							try {
156
								algorithm.execute(taskStatus);
157
								int resultLoadLayer =JOptionPane.showConfirmDialog(
158
										null,
159
										i18nManager.getTranslation("load_layer_question"),
160
										i18nManager.getTranslation("load_layer_question_title"), JOptionPane.YES_NO_OPTION);
161
								if (resultLoadLayer==JOptionPane.YES_OPTION){
162
									loadLayer(shpParams);
163
								}
164
							} catch (Exception e) {
165
								logger.error("Error calibrating route", e);
166
								String message = e.getMessage();
167
								if (e.getCause() != null) {
168
									message = e.getCause().getMessage();
169
								}
170
								JOptionPane.showMessageDialog(
171
										progressDialog.asJComponent(),
172
										message,
173
										i18nManager.getTranslation("calibrate_routes"),
174
										JOptionPane.ERROR_MESSAGE
175
										);
176
							}
177
						}
178
					});
179
					task.start();
180

  
181
				}
182
			});
183
			winManager.showWindow(panel.asJComponent(), i18nManager.getTranslation("calibrate_routes"),
184
					WindowManager.MODE.WINDOW);
185
		}
186

  
187
	}
188

  
189
	/* (non-Javadoc)
190
	 * @see org.gvsig.andami.plugins.IExtension#initialize()
191
	 */
192
	public void initialize() {
193
		registerIcons();
194
	}
195

  
196
	/* (non-Javadoc)
197
	 * @see org.gvsig.andami.plugins.IExtension#isEnabled()
198
	 */
199
	public boolean isEnabled() {
200
        IView view = getActiveView();
201
        //FLyrVect activeLayer = getActiveLayer(view);
202
        if (view!=null){
203
            ViewDocument viewDocument = view.getViewDocument();
204
            FLayers layers = viewDocument.getMapContext().getLayers();
205
            return JLrsUtils.validatedMCurveAndPointLayer(layers);
206
        }
207

  
208
        return false;
209

  
210
	}
211

  
212
	/* (non-Javadoc)
213
	 * @see org.gvsig.andami.plugins.IExtension#isVisible()
214
	 */
215
	public boolean isVisible() {
216
		ApplicationManager application = ApplicationLocator.getManager();
217

  
218
		return application.getActiveComponent(ViewDocument.class) != null;
219
	}
220

  
221
	private void registerIcons() {
222
		IconThemeHelper.registerIcon("lrs", "pk_blue", this);
223
	}
224

  
225

  
226
	private IView getActiveView() {
227
		ApplicationManager application = ApplicationLocator.getManager();
228
		IView view = (IView) application.getActiveComponent(ViewDocument.class);
229
		return view;
230
	}
231

  
232
	private void loadLayer(SHPNewStoreParameters shpParams){
233
		if (shpParams!=null ){
234
			String name=shpParams.getFile().getName();
235
			if (name.contains(".shp")){
236
				name=name.substring(0,name.lastIndexOf(".shp"));
237
			}
238
			MapContextManager mapContextManager =MapContextLocator.getMapContextManager();
239

  
240
			FLyrVect newLayer=null;
241
			try {
242
				newLayer = (FLyrVect) mapContextManager.createLayer(name,shpParams);
243
			} catch (LoadLayerException e) {
244
				logger.warn("Couldn't load layer",e);
245
			}
246
			getActiveView().getMapControl().getMapContext().getLayers().addLayer(newLayer);
247
		}
248
	}
249

  
250
}
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.21/org.gvsig.lrs.app/org.gvsig.lrs.app.mainplugin/src/main/java/org/gvsig/lrs/app/calibrateroute/MeasureCalculatorRouteExtension.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
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., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.app.calibrateroute;
24

  
25
import java.awt.event.ActionEvent;
26
import java.awt.event.ActionListener;
27

  
28
import org.apache.commons.lang3.StringUtils;
29
import org.gvsig.andami.IconThemeHelper;
30
import org.gvsig.andami.PluginServices;
31
import org.gvsig.andami.PluginsLocator;
32
import org.gvsig.andami.PluginsManager;
33
import org.gvsig.andami.plugins.Extension;
34
import org.gvsig.app.ApplicationLocator;
35
import org.gvsig.app.ApplicationManager;
36
import org.gvsig.app.project.documents.view.ViewDocument;
37
import org.gvsig.app.project.documents.view.gui.IView;
38
import org.gvsig.fmap.dal.exception.DataException;
39
import org.gvsig.fmap.dal.feature.EditableFeature;
40
import org.gvsig.fmap.dal.feature.Feature;
41
import org.gvsig.fmap.dal.feature.FeatureSelection;
42
import org.gvsig.fmap.dal.feature.FeatureStore;
43
import org.gvsig.fmap.geom.Geometry;
44
import org.gvsig.fmap.mapcontext.layers.FLayer;
45
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
46
import org.gvsig.lrs.lib.api.LrsAlgorithmsLocator;
47
import org.gvsig.lrs.lib.api.LrsAlgorithmsManager;
48
import org.gvsig.lrs.lib.api.MeasuresCalculator;
49
import org.gvsig.lrs.lib.api.exceptions.LrsNeededParameterException;
50
import org.gvsig.lrs.swing.api.JLrsAlgorithmParams;
51
import org.gvsig.lrs.swing.api.JLrsLastUsedValues;
52
import org.gvsig.lrs.swing.api.LrsAlgorithmsSwingLocator;
53
import org.gvsig.lrs.swing.api.LrsAlgorithmsSwingManager;
54
import org.gvsig.tools.ToolsLocator;
55
import org.gvsig.tools.dispose.DisposableIterator;
56
import org.gvsig.tools.dynobject.DynObject;
57
import org.gvsig.tools.i18n.I18nManager;
58
import org.gvsig.tools.swing.api.ToolsSwingLocator;
59
import org.gvsig.tools.swing.api.windowmanager.Dialog;
60
import org.gvsig.tools.swing.api.windowmanager.WindowManager;
61
import org.gvsig.tools.swing.api.windowmanager.WindowManager_v2;
62
import org.slf4j.Logger;
63
import org.slf4j.LoggerFactory;
64

  
65

  
66
/**
67
 * @author jbadia
68
 *
69
 */
70
public class MeasureCalculatorRouteExtension extends Extension {
71

  
72
	private static final Logger logger = LoggerFactory.getLogger(MeasureCalculatorRouteExtension.class);
73

  
74
	/* (non-Javadoc)
75
	 * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
76
	 */
77
	public void execute(String actionCommand) {
78

  
79
		if (StringUtils.equalsIgnoreCase(actionCommand, "calculate-m-routes")) {
80
			IView view = getActiveView();
81
			FLyrVect layer = view.getMapControl().getMapContext().getLayers().getFirstActiveVectorLayer();
82

  
83

  
84
			LrsAlgorithmsSwingManager manager = LrsAlgorithmsSwingLocator.getLrsAlgorithmsSwingManager();
85
			I18nManager i18nManager = ToolsLocator.getI18nManager();
86

  
87
			PluginsManager pluginsManager = PluginsLocator.getManager();
88
			PluginServices plugin = pluginsManager.getPlugin(this);
89
			DynObject pluginProperties = plugin.getPluginProperties();
90

  
91

  
92

  
93
			JLrsAlgorithmParams panel;
94
			try {
95
				JLrsLastUsedValues params = manager.getJLrsLastUsedValues(pluginProperties);
96
				panel = manager.createJLrsCalculateMRoutePanel(layer, params);
97
				WindowManager_v2 winManager = (WindowManager_v2) ToolsSwingLocator.getWindowManager();
98

  
99
				final Dialog dialog = winManager.createDialog(panel.asJComponent(), 
100
						i18nManager.getTranslation("m-coordinate-selector"), "", WindowManager_v2.BUTTONS_OK_CANCEL);      
101
				dialog.addActionListener(new ActionListener() {
102
					public void actionPerformed(ActionEvent e) {
103
						if( dialog.getAction()==WindowManager_v2.BUTTON_OK) {
104
							LrsAlgorithmsManager lrsAlgMng = LrsAlgorithmsLocator.getLrsAlgorithmsManager();
105
							LrsAlgorithmsSwingManager lrsAlgSwingMng = LrsAlgorithmsSwingLocator.getLrsAlgorithmsSwingManager();
106

  
107
							JLrsLastUsedValues prms = lrsAlgSwingMng.getJLrsLastUsedValues();
108
							if(prms != null && !StringUtils.isBlank(prms.getPkInicial()) && !StringUtils.isBlank(prms.getPkFinal())){
109

  
110
								FLyrVect lyrVect = (FLyrVect) getActiveView().getMapControl().getMapContext().getLayers().getFirstActiveVectorLayer();
111
								FeatureStore featStore = lyrVect.getFeatureStore();
112
								try {
113
									featStore.edit(FeatureStore.MODE_FULLEDIT);
114

  
115
									FeatureSelection selection = featStore.getFeatureSelection();
116
									DisposableIterator it = selection.fastIterator();
117
									while(it.hasNext()){
118
										Feature feat = (Feature) it.next();
119
										EditableFeature editfeat = feat.getEditable();
120

  
121
										MeasuresCalculator mcalc = lrsAlgMng.createMeasuresCalculator(editfeat.getDefaultGeometry(), false);
122
										mcalc.setFirstMeasure(editfeat.getDouble(prms.getPkInicial()));
123
										mcalc.setLastMeasure(editfeat.getDouble(prms.getPkFinal()));
124
										mcalc.calculate();
125
										Geometry mgeom = mcalc.getResult();
126

  
127
										editfeat.setDefaultGeometry(mgeom);
128
										editfeat.validate(EditableFeature.FINISH_EDITING);
129
										featStore.update(editfeat);
130
									}
131

  
132
									featStore.finishEditing();
133
								} catch (DataException e1) {
134
									logger.debug("Error creating the M coordinate: ", e1);
135
								}
136
							}else{
137

  
138
							}
139

  
140
						}
141
					}
142
				});
143
				dialog.show(WindowManager.MODE.WINDOW);
144
			} catch (LrsNeededParameterException e1) {
145
				// TODO Auto-generated catch block
146
				e1.printStackTrace();
147
			}
148

  
149
		}
150
	}
151

  
152
	/* (non-Javadoc)
153
	 * @see org.gvsig.andami.plugins.IExtension#initialize()
154
	 */
155
	public void initialize() {
156
		registerIcons();
157
	}
158

  
159
	/* (non-Javadoc)
160
	 * @see org.gvsig.andami.plugins.IExtension#isEnabled()
161
	 */
162
	public boolean isEnabled() {
163
        IView view = getActiveView();
164
        if (view!=null){
165
            ViewDocument viewDocument = view.getViewDocument();
166
            FLayer[] layers = viewDocument.getMapContext().getLayers().getActives();
167
            return layers.length > 0;
168
        }
169

  
170
        return false;
171

  
172
	}
173

  
174
	/* (non-Javadoc)
175
	 * @see org.gvsig.andami.plugins.IExtension#isVisible()
176
	 */
177
	public boolean isVisible() {
178
		ApplicationManager application = ApplicationLocator.getManager();
179
		return application.getActiveComponent(ViewDocument.class) != null;
180
	}
181

  
182
	private void registerIcons() {
183
		IconThemeHelper.registerIcon("lrs", "pk_blue", this);
184
	}
185

  
186

  
187
	private IView getActiveView() {
188
		ApplicationManager application = ApplicationLocator.getManager();
189
		IView view = (IView) application.getActiveComponent(ViewDocument.class);
190
		return view;
191
	}
192

  
193

  
194
}
0 195

  
org.gvsig.lrs/tags/org.gvsig.lrs-1.0.21/org.gvsig.lrs.app/org.gvsig.lrs.app.mainplugin/src/main/java/org/gvsig/lrs/app/showmeasures/WiperMeasuresExtension.java
1
/* gvSIG. Desktop Geographic Information System.
2
 *
3
 * Copyright ? 2007-2015 gvSIG Association
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., 51 Franklin Street, Fifth Floor, Boston,
18
 * MA  02110-1301, USA.
19
 *
20
 * For any additional information, do not hesitate to contact us
21
 * at info AT gvsig.com, or visit our website www.gvsig.com.
22
 */
23
package org.gvsig.lrs.app.showmeasures;
24

  
25
import org.apache.commons.lang3.StringUtils;
26
import org.slf4j.Logger;
27
import org.slf4j.LoggerFactory;
28

  
29
import org.gvsig.andami.IconThemeHelper;
30
import org.gvsig.andami.plugins.Extension;
31
import org.gvsig.app.ApplicationLocator;
32
import org.gvsig.app.ApplicationManager;
33
import org.gvsig.app.project.documents.view.ViewDocument;
34
import org.gvsig.app.project.documents.view.gui.IView;
35
import org.gvsig.fmap.mapcontext.MapContext;
36
import org.gvsig.fmap.mapcontext.layers.FLayer;
37
import org.gvsig.fmap.mapcontext.layers.vectorial.FLyrVect;
38
import org.gvsig.fmap.mapcontext.layers.vectorial.GraphicLayer;
39
import org.gvsig.lrs.swing.impl.JLrsShowMeasuresParamsController;
40

  
41
/**
42
 * @author dmartinez
43
 *
44
 */
45
public class WiperMeasuresExtension extends Extension {
46

  
47
    private static final Logger logger = LoggerFactory.getLogger(WiperMeasuresExtension.class);
48

  
49
    private JLrsShowMeasuresParamsController panel;
50

  
51

  
52
    /*
53
     * (non-Javadoc)
54
     *
55
     * @see org.gvsig.andami.plugins.IExtension#execute(java.lang.String)
56
     */
57
    public void execute(String actionCommand) {
58
        if (StringUtils.equalsIgnoreCase(actionCommand, "wiper-measures")) {
59
            IView view = getActiveView();
60
            final MapContext mapContext = view.getMapControl().getMapContext();
61
            final GraphicLayer graphics = mapContext.getGraphicsLayer();
62

  
63
            graphics.removeGraphics(ShowMeasuresExtension.SHOW_MEASURES_GRAPHICS_ID);
64
            mapContext.invalidate();
65

  
66
        }
67
    }
68

  
69
    /*
70
     * (non-Javadoc)
71
     *
72
     * @see org.gvsig.andami.plugins.IExtension#initialize()
73
     */
74
    public void initialize() {
75
        registerIcons();
76
    }
77

  
78
    /*
79
     * (non-Javadoc)
80
     *
81
     * @see org.gvsig.andami.plugins.IExtension#isEnabled()
82
     */
83
    public boolean isEnabled() {
84
        IView view = getActiveView();
85
        FLyrVect activeLayer = getActiveLayer(view);
86
        if (panel == null && activeLayer != null) {
87
            return true;
88
        }
89
        return false;
90
    }
91

  
92
    /*
93
     * (non-Javadoc)
94
     *
95
     * @see org.gvsig.andami.plugins.IExtension#isVisible()
96
     */
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff