Revision 31719

View differences:

tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/.cvsignore
1
bin
0 2

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/build.xml
1
<project name="Generar extension en Andami" default="generate-without-source" basedir=".">
2
    <description>
3
        Instala el plugin de Centrar la Vista sobre un punto en Andami.
4
    </description>
5
  <!-- set global properties for this build -->
6
  <property name="src" location="src"/>
7
  <property name="bin" location="bin"/>
8
  <property name="doc"  location="doc"/>
9
  <property name="dist"  location="dist"/>
10
  <property name="without_src"  location="without_src"/>
11
  <property name="plugin" value="com.iver.gvsig.extMeasureGeometry"/>
12
	 <property name="mainplugin" value="com.iver.cit.gvsig"/>
13
	<property name="extensionDir" location="../_fwAndami/gvSIG/extensiones"/>
14
  <property name="drivers-dir" location="${extensionDir}/${mainplugin}/drivers" />
15

  
16
	<property name="build" location="bin"/>
17
  <target name="init">
18
    <!-- Create the time stamp -->
19
    <tstamp/>
20
  </target>
21

  
22
  <target name="generate-without-source" description="generate the distribution without the source file" >
23
    <!-- Create the distribution directory -->
24
    <mkdir dir="${without_src}"/>
25

  
26
    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
27
    <jar jarfile="${without_src}/${plugin}.jar" basedir="${bin}"/>
28
    <copy file="config/config.xml" todir="${without_src}"/>
29
    <copy todir="${without_src}">
30
    	<fileset dir="." includes="text*.properties"/>
31
    </copy>
32
    <copy todir="${without_src}/images">
33
    	<fileset dir="images/" includes="*"/>
34
    </copy>
35
    <move todir="${extensionDir}/${plugin}/">
36
    	<fileset dir="${without_src}" includes="**/**"/>
37
    </move>
38
  </target>
39

  
40
</project>
41

  
0 42

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/text.properties
1
#text.properties
0 2

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/text_en.properties
1
#text_en.properties
0 2

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/.project
1
<?xml version="1.0" encoding="UTF-8"?>
2
<projectDescription>
3
	<name>extMeasureGeometry</name>
4
	<comment></comment>
5
	<projects>
6
	</projects>
7
	<buildSpec>
8
		<buildCommand>
9
			<name>org.eclipse.jdt.core.javabuilder</name>
10
			<arguments>
11
			</arguments>
12
		</buildCommand>
13
		<buildCommand>
14
			<name>de.loskutov.FileSync.FSBuilder</name>
15
			<arguments>
16
			</arguments>
17
		</buildCommand>
18
	</buildSpec>
19
	<natures>
20
		<nature>org.eclipse.jdt.core.javanature</nature>
21
	</natures>
22
</projectDescription>
0 23

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/config/config.xml
1
<?xml version="1.0" encoding="ISO-8859-1"?>
2
<plugin-config>
3
	<libraries library-dir="."/>
4
	<depends plugin-name="com.iver.cit.gvsig"/>
5
		<resourceBundle name="text"/>
6
	<extensions>
7
		<extension class-name="com.iver.gvsig.AreaExtension"
8
			description="Extension that measures the area of all the polygonos they selected."
9
			active="true">
10
			<menu text="Vista/area" tooltip="area"
11
				action-command="AREA"
12
				icon="images/area.png" />
13
			<tool-bar name="area">
14
				<action-tool icon="images/area.png"
15
					action-command="AREA" tooltip="area"
16
					enable-text="deber?a de estar activada" last="true"/>
17
			</tool-bar>
18
		</extension>
19
		<extension class-name="com.iver.gvsig.PerimeterExtension"
20
			description="Extension that measures the perimeter of all the lines they selected."
21
			active="true">
22
			<menu text="Vista/perimeter" tooltip="perimeter"
23
				action-command="PERIMETER"
24
				icon="images/perimeter.png" />
25
			<tool-bar name="perimeter">
26
				<action-tool icon="images/perimeter.png"
27
					action-command="PERIMETER" tooltip="perimeter"
28
					enable-text="deber?a de estar activada" last="true"/>
29
			</tool-bar>
30
		</extension>
31
		<extension class-name="com.iver.gvsig.AddXYPointThemeExtension"
32
			description="Extension that add the coordinates x and y."
33
			active="true">
34
			<menu text="Vista/add_x_y" tooltip="add_x_y"
35
				action-command="ADDXYPOINT"
36
				icon="images/xypoint.png" />
37
			<tool-bar name="add_x_y">
38
				<action-tool icon="images/xypoint.png"
39
					action-command="ADDXYPOINT" tooltip="add_x_y"
40
					enable-text="deber?a de estar activada" last="true"/>
41
			</tool-bar>
42
		</extension>
43
	</extensions>
44
</plugin-config>
0 45

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/build.xml
1
<project name="instalador-gvSIG" default="init" basedir=".">
2
	<!--
3
	<property name="dir_inst" location="C:\Archivos de programa"/>
4
	<property name="base_dir" location="./"/>		
5
	<property name="dir_libs" location="C:\Archivos de programa\IzPack\lib"/>
6
	<property name="vers" location="0.6"/>
7
	<property name="izpack_dir" location="C:\Archivos de programa\IzPack"/>
8
	-->
9
	
10
	<property name="dir_inst" location="/usr/local"/>
11
	<property name="base_dir" location="./"/>		
12
	<property name="izpack_dir" location="../../install/IzPack"/>
13
	<property name="dir_libs" location="${izpack_dir}/lib"/>
14
	
15
	<taskdef name="izpack" classpath="${dir_libs}/compiler.jar" classname="com.izforge.izpack.ant.IzPackTask"/>
16
	
17
	<target name="init">
18
		<izpack input="install.xml" 
19
				output="${JARNAME}" 
20
				installerType="standard" 
21
				basedir="${base_dir}" 
22
				izPackDir="${izpack_dir}/"/>
23
	</target>
24
	
25
	<target name="clean">
26
		<delete>
27
			<fileset dir=".">
28
			    <include name="**.zip"/>
29
			</fileset>
30
		</delete>
31
		<delete dir="bin" />
32
		<delete dir="extensions" />
33
	</target>
34
	
35
</project>
0 36

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/installer_files/install.bat
1
java -jar APPNAME-FULLVERSION.jar
0 2

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/installer_files/install.sh
1
#!/bin/sh
2
[ -x /usr/bin/dirname ] && cd `/usr/bin/dirname $0`
3
java -jar APPNAME-FULLVERSION.jar
0 4

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/variables.sh
1
#!/bin/sh
2

  
3
export APPNAME=measure_geometry
4
#export FULLVERSION='0.1_alpha'
5
export FULLVERSION='0.1'
6
export TARGET_DIR=/tmp/"$APPNAME"/versiones
7

  
8
## estas extensiones se muestran en los packs, y se puede elegir instalarlos o no
9
## (el fichero install.xml también debe estar actualizado para reflejar esto)
10
EXTENSIONS=(
11
com.iver.gvsig.extMeasureGeometry
12
)
13

  
0 14

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/install.xml
1
<installation version="1.0">
2
	<info>
3
		<!--<appname>gvSIG_1.0_alpha</appname>-->
4
		<appname>gvSIG_1.0_alpha</appname>
5
		<appversion>1.0_alpha</appversion>
6
		<authors>
7
			<author name="Generalitat Valenciana. Conselleria d'Infraestructures i Transport" email="" />
8
			<author name="Iver Tecnologías de la Información S.A." email="" />
9
		</authors>
10
		<url>http://www.gvsig.gva.es/</url>
11
		<javaversion>1.4</javaversion>
12
	</info>
13

  
14
	<guiprefs height="600" resizable="yes" width="800">
15
		<laf name="liquid">
16
			<os family="unix" />
17
		</laf>
18
		<laf name="liquid">
19
			<os family="windows" />
20
		</laf>
21
	</guiprefs>
22

  
23
	<locale>
24
		<langpack iso3="spa"/>
25
		<langpack iso3="val"/>
26
		<langpack iso3="eng"/>
27
		<langpack iso3="cat"/>
28
		<langpack iso3="chn"/>
29
		<langpack iso3="cze"/>
30
		<langpack iso3="dan"/>
31
		<langpack iso3="deu"/>
32
		<langpack iso3="fin"/>
33
		<langpack iso3="fra"/>
34
		<langpack iso3="glg"/>
35
		<langpack iso3="hun"/>
36
		<langpack iso3="ita"/>
37
		<langpack iso3="jpn"/>
38
		<langpack iso3="mys"/>
39
		<langpack iso3="ned"/>
40
		<langpack iso3="nor"/>
41
		<langpack iso3="pol"/>
42
		<langpack iso3="por"/>
43
		<langpack iso3="rom"/>
44
		<langpack iso3="rus"/>
45
		<langpack iso3="scg"/>
46
		<langpack iso3="svk"/>
47
		<langpack iso3="swe"/>
48
		<langpack iso3="ukr"/>
49
	</locale>
50

  
51
	<resources>
52
		<res src="resources/gpl.txt" id="LicencePanel.licence"/>
53
		<res src="resources/LEEME.html" id="HTMLInfoPanel.info"/>
54
		<res src="resources/images/Logo_gvsig_gva.jpg" id="Installer.image"/>
55
		<res src="resources/userInputSpec.xml" id="userInputSpec.xml"/>
56
                <parsable os="linux" targetfile="resources/userInputSpec.xml"/>
57
                <res src="resources/userInputLang.xml_val" id="userInputLang.xml_val" />
58
                <res src="resources/userInputLang.xml_spa" id="userInputLang.xml_spa" />
59
	</resources>
60

  
61
	<panels>
62
		<panel classname="HTMLInfoPanel"/>
63
		<panel classname="LicencePanel"/>
64
		<panel classname="PacksPanel"/>
65
		<panel classname="UserInputPanel"/>
66
		<panel classname="InstallPanel"/>
67
		<panel classname="SimpleFinishPanel"/>
68
	</panels>
69

  
70
	<packs>
71

  
72
		<pack name="Extensión de Área y Perímetro" required="yes">
73
			<description>Extensión de Área y Perímetro</description>
74
			<file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/" src="extensiones/com.iver.gvsig.extMeasureGeometry" override="true"/>
75
		</pack>
76

  
77
	</packs>
78

  
79
</installation>
0 80

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/distribucion.sh
1
#!/bin/bash
2

  
3
# Si se produce un error, salimos inmediatamente
4
set -e
5

  
6
# Obtenemos el locale
7
LOC=`echo $LANG | sed 's/_.*//'`
8

  
9
if [ $# -ne "1" ]; then
10
  if [ $LOC = "es" ] ; then
11
    echo "Uso: distribucion.sh numero_de_build"
12
  else
13
    echo "Usage: distribucion.sh build_number"
14
  fi
15
  exit
16
fi
17

  
18
DIR_BASE=`pwd`
19

  
20
source variables.sh
21
# Get a version with format 1_0_alpha
22
UNDERSCORE_VERSION=`echo $FULLVERSION | sed 'y/./_/'`
23
# Get a version with format 10_alpha
24
BRIEFVERSION=`echo $FULLVERSION | sed 'y/./_/'`
25
# The name of the dir which will be ZIPed, containing the resulting installer
26
INSTALLER_DIR="$APPNAME"-$FULLVERSION\_installer
27
JARNAME="$APPNAME"-"$UNDERSCORE_VERSION".jar
28
# The extension targets on the this version of gvSIG:
29
GVSIG_VERSION=1.0_alpha
30

  
31
BUILDNUMBER="$1"
32

  
33
ZIPNAME="$APPNAME"-"$UNDERSCORE_VERSION"\-"$BUILDNUMBER".zip
34
#WINDOWSZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-windows-i586.zip
35
#LINUXZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-linux-i586.zip
36

  
37
#Directorios
38
#OUTPUT_DIR=/mnt/sercartlin/grupo-sig-ca/Testing/Versiones/v"$FULLVERSION"\_"$BUILDNUMBER"
39
OUTPUT_DIR="$TARGET_DIR"/v"$FULLVERSION"\_"$BUILDNUMBER"
40
PATH_SOURCE_EXT=../../_fwAndami/gvSIG/extensiones
41
PATH_SOURCE_MANDAT_EXT=../../../../_fwAndami/gvSIG/extensiones
42

  
43
echo -e "\n*****************"
44
echo "      BASE       "
45
echo "*****************"
46
#echo -n "$DIR_BASE" "-- "
47
rm bin -rf
48
mkdir -p bin/gvSIG/extensiones
49
#cp "$APPNAME"_installer/LEEME "$APPNAME"_installer/LLIG-ME "$APPNAME"_installer/README bin
50
#cp resources/gpl.txt bin
51

  
52

  
53
echo -e "\n*****************"
54
[ $LOC = "es" ] && echo "   EXTENSIONES   "
55
[ $LOC != "es" ] && echo "   EXTENSIONS   "
56
echo "*****************"
57

  
58
rm -rf extensiones
59
mkdir extensiones
60

  
61

  
62
i=0
63
while [ ! -z ${EXTENSIONS[$i]} ]
64
do
65
  [ $LOC = "es" ] && echo "Copiando "${EXTENSIONS[$i]}
66
  [ $LOC != "es" ] && echo "Copying "${EXTENSIONS[$i]}
67
  echo cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} extensiones -rf
68
  cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} extensiones -rf
69
  i=`expr $i + 1`
70
done
71

  
72
echo -e "\n********************"
73
echo " BUILDING INSTALLER "
74
echo "********************"
75
# Generar el instalador (jar) para windows
76
cd "$DIR_BASE"
77
echo ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME"
78
ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME"
79

  
80
echo -e "\n******************"
81
[ $LOC = "es" ] && echo " GENERAR DISTRIB "
82
[ $LOC != "es" ] && echo " GENERATE DISTRIB "
83
echo "******************"
84
# Generar el tar.gz para Linux y el ZIP para Windows
85

  
86
# V=`echo $MAJOR.$MINOR$POINT$REL`
87
# V1=`echo $MAJOR$SEP$MINOR$SEP$REL`
88

  
89
mkdir -p "$OUTPUT_DIR"
90

  
91
cd "$DIR_BASE"
92
rm -Rf "$INSTALLER_DIR"
93
cp -a installer_files "$INSTALLER_DIR"
94
rm -R "$INSTALLER_DIR"/CVS 2> /dev/null && true
95
# Set the correct version number in the scripts and files
96
if [ -f  "$INSTALLER_DIR"/install.sh ] ; then
97
  sed "s/FULLVERSION/$UNDERSCORE_VERSION/ ; s/APPNAME/$APPNAME/" "$INSTALLER_DIR"/install.sh > "$INSTALLER_DIR"/install.sh.bak
98
  mv "$INSTALLER_DIR"/install.sh.bak "$INSTALLER_DIR"/install.sh ;
99
  chmod +x "$INSTALLER_DIR"/install.sh
100
fi
101
if [ -f  "$INSTALLER_DIR"/install.bat ] ; then
102
  sed "s/FULLVERSION/$UNDERSCORE_VERSION/ ; s/APPNAME/$APPNAME/" "$INSTALLER_DIR"/install.bat > "$INSTALLER_DIR"/install.bat.bak
103
  mv "$INSTALLER_DIR"/install.bat.bak "$INSTALLER_DIR"/install.bat;
104
fi
105
mv "$JARNAME" "$INSTALLER_DIR"
106
zip -9r "$ZIPNAME" "$INSTALLER_DIR"
107
rm -Rf "$INSTALLER_DIR"
108

  
109
[ $LOC = "es" ] && echo " Copiando" "$ZIPNAME" "a" "$OUTPUT_DIR"
110
[ $LOC != "es" ] && echo " Copying" $ZIPNAME "to" "$OUTPUT_DIR"
111
cp "$ZIPNAME" "$OUTPUT_DIR"
112
 
0 113

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/resources/userInputLang.xml_val
1
<langpack>
2
  <str id="text.label" txt="Ruta a gvSIG:"/>
3
</langpack>
0 4

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/resources/userInputLang.xml_spa
1
<langpack>
2
  <str id="text.label" txt="Ruta a gvSIG:"/>
3
</langpack>
0 4

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/resources/userInputLang.xml_cat
1
<langpack>
2
  <str id="text.label" txt="Ruta a gvSIG:"/>
3
</langpack>
0 4

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/resources/userInputLang.xml_fra
1
<langpack>
2
  <str id="text.label" txt="Path to gvSIG:"/>
3
</langpack>
0 4

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/resources/userInputLang.xml_eng
1
<langpack>
2
  <str id="text.label" txt="Path to gvSIG:"/>
3
</langpack>
0 4

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/resources/userInputSpec.xml
1
<userInput>
2
	<panel order="0">
3
		<field 	type="search" 
4
				variable="INSTALL_PATH"
5
				size="45">
6
  			<description align="left" />
7
  			<spec 	txt="Path to gvSIG:" 
8
		  			id="text.label"
9
  					checkfilename="bin/andami.jar"
10
        			type="directory" 
11
        			result="directory">
12
  			<choice value="/usr/local/gvSIG_1.0" os="unix" />
13
  			<choice value="/opt/gvSIG_1.0" os="unix" />
14
  			<choice value="$USER_HOME/gvSIG_1.0" os="unix" />
15
  			<choice value="C:\Archivos de Programa\gvSIG_1.0" os="windows" />
16
  			<choice value="C:\Program Files\gvSIG_1.0" os="windows" />
17
  			</spec>
18
		</field>
19
	</panel>
20
</userInput>
21

  
0 22

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/resources/LEEME.html
1
<html>
2
<head>
3
<style type="text/css">
4
html, body, h1, h2, h3, h4, div, p, ul, li, input {
5
   font-family: Arial, Helvetica, sans-serif;
6
}
7

  
8
h1 {
9
   font-size: large;
10
}
11

  
12
h2 {
13
   font-size: large;
14
}
15

  
16
h3 {
17
   font-size: medium;
18
}
19
</style>
20
</head>
21
<body>
22
<h1>gvSIG, el SIG en software libre de la Generalitat Valenciana
23
(http://www.gvsig.gva.es).</h1>
24

  
25
<h2>Autores:</h2>
26
<ul>
27
<li>Generalitat Valenciana
28
 (Conselleria d'Infraestructures i Transport).</li>
29
<li>Iver Tecnolog&iacute;as de la Informaci&oacute;n S.A.</li>
30
</ul>
31

  
32
<p>Software con licencia GNU/GPL
33
(http://www.fsf.org/licensing/licenses/gpl.html)</p>
34

  
35
<p>Contacto:
36
	gvsig@gva.es<p>
37

  
38
<h2>Requisitos de la aplicaci&oacute;n:</h2>
39
<h3>Sistema</h3>
40
<ul>
41
<li>M&iacute;nimos: Pentium III / 256 MB RAM.</li>
42
<li>Recomendables: Pentium IV / 512 MB RAM.</li>
43
<li>Sistemas operativos: plataformas Windows y Linux.
44
 Probado en Win98/XP, Linux Suse 8.2/9.0/9.2 y Linux Debian (Lliurex).</li>
45
</ul>
46

  
47
<h3>Software instalado</h3> (disponible en http://www.gvsig.gva.es o en http://java.sun.com)
48
<ul>
49
<li>M&aacute;quina Virtual Java 1.4.2 (06 o superior).</li>
50
<li>JAI (Java Advanced Imaging).</li>
51
<li>JAI Image I/O.</li>
52
</ul>
53

  
54
<p style="text-align:justify">Nota: Las librer&iacute;as JAI y JAI Image I/O deben estar instaladas sobre la M&aacute;quina Virtual Java que gvSIG utilice en su ejecuci&oacute;n. Si se instala una nueva JVM en el sistema y se usa para ejecutar gvSIG ser&aacute; indispensable instalar las librer&iacute;as sobre &eacute;sta (gvSIG se ejecuta con la JVM que tenga por defecto el sistema operativo; para saber cu&aacute;l es, ejecutar <span style="monospace">"java&nbsp;-version"</span> en un interfaz de comandos o consola).</p>
55

  
56
<h2>M&aacute;s informaci&oacute;n y soporte en:</h2>
57
<h3> Web oficial del proyecto:</h3>
58
	http://www.gvsig.gva.es
59

  
60
<h3>Listas de distribuci&oacute;n:</h3>
61
<span style="monospace"> http://runas.cap.gva.es/mailman/listinfo/gvsig_usuarios</span> (soporte para usuarios).
62
<span style="monospace"> http://runas.cap.gva.es/mailman/listinfo/gvsig_desarrolladores</span> (soporte para desarrolladores).
63
<span style="monospace"> http://runas.cap.gva.es/mailman/listinfo/gvsig_internacional</span> (soporte para desarrolladores o usuarios de habla no hispana).
64

  
65
</body>
66
</html>
0 67

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/resources/userInputLang.xml_deu
1
<langpack>
2
  <str id="text.label" txt="Path to gvSIG:"/>
3
</langpack>
0 4

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/resources/userInputLang.xml_ita
1
<langpack>
2
  <str id="text.label" txt="Path to gvSIG:"/>
3
</langpack>
0 4

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/resources/userInputLang.xml_por
1
<langpack>
2
  <str id="text.label" txt="Path to gvSIG:"/>
3
</langpack>
0 4

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/resources/gpl.txt
1
	GNU GENERAL PUBLIC LICENSE
2
	Version 2, June 1991
3

  
4
	 Copyright (C) 1989, 1991 Free Software Foundation, Inc. 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed.
5

  
6
		Preamble
7

  
8
	The licenses for most software are designed to take away your freedom to share and change it.  By contrast, the GNU General Public License is intended to guarantee your freedom to share and change free software--to make sure the software is free for all its users.  This General Public License applies to most of the Free Software Foundation's software and to any other program whose authors commit to using it.  (Some other Free Software Foundation software is covered by the GNU Library General Public License instead.)  You can apply it to your programs, too.
9

  
10
	When we speak of free software, we are referring to freedom, not price.  Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for this service if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs; and that you know you can do these things.
11

  
12
	To protect your rights, we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights. These restrictions translate to certain responsibilities for you if you distribute copies of the software, or if you modify it.
13

  
14
	For example, if you distribute copies of such a program, whether gratis or for a fee, you must give the recipients all the rights that you have.  You must make sure that they, too, receive or can get the source code.  And you must show them these terms so they know their
15
rights.
16

  
17
	We protect your rights with two steps: (1) copyright the software, and (2) offer you this license which gives you legal permission to copy, distribute and/or modify the software.
18

  
19
	Also, for each author's protection and ours, we want to make certain that everyone understands that there is no warranty for this free software.  If the software is modified by someone else and passed on, we want its recipients to know that what they have is not the original, so that any problems introduced by others will not reflect on the original authors' reputations.
20

  
21
	Finally, any free program is threatened constantly by software	patents.  We wish to avoid the danger that redistributors of a free program will individually obtain patent licenses, in effect making the program proprietary.  To prevent this, we have made it clear that any patent must be licensed for everyone's free use or not licensed at all.
22

  
23
	The precise terms and conditions for copying, distribution and modification follow.
24

  
25
				GNU GENERAL PUBLIC LICENSE
26
	TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
27

  
28
	0. This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License.  The "Program", below, refers to any such program or work, and a "work based on the Program" means either the Program or any derivative work under copyright law: that is to say, a work containing the Program or a portion of it, either verbatim or with modifications and/or translated into another language.  (Hereinafter, translation is included without limitation in the term "modification".)  Each licensee is addressed as "you".
29

  
30
	Activities other than copying, distribution and modification are not covered by this License; they are outside its scope.  The act of running the Program is not restricted, and the output from the Program is covered only if its contents constitute a work based on the Program (independent of having been made by running the Program). Whether that is true depends on what the Program does.
31

  
32
1.	You may copy and distribute verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice and disclaimer of warranty; keep intact all the notices that refer to this License and to the absence of any warranty; and give any other recipients of the Program a copy of this License along with the Program.
33

  
34
You may charge a fee for the physical act of transferring a copy, and you may at your option offer warranty protection in exchange for a fee.
35

  
36
2.	You may modify your copy or copies of the Program or any portion of it, thus forming a work based on the Program, and copy and distribute such modifications or work under the terms of Section 1 above, provided that you also meet all of these conditions:
37

  
38
a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
39

  
40
b) You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License.
41

  
42
c)	If the modified program normally reads commands interactively when run, you must cause it, when started running for such interactive use in the most ordinary way, to print or display an announcement including an appropriate copyright notice and a notice that there is no warranty (or else, saying that you provide a warranty) and that users may redistribute the program under these conditions, and telling the user how to view a copy of this License.  (Exception: if the Program itself is interactive but does not normally print such an announcement, your work based on the Program is not required to print an announcement.)
43

  
44
These requirements apply to the modified work as a whole.  If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works.  But when you distribute the same sections as part of a whole which is a work based on the Program, the distribution of the whole must be on the terms of this License, whose permissions for other licensees extend to the entire whole, and thus to each and every part regardless of who wrote it.
45

  
46
Thus, it is not the intent of this section to claim rights or contest your rights to work written entirely by you; rather, the intent is to exercise the right to control the distribution of derivative or collective works based on the Program.
47

  
48
In addition, mere aggregation of another work not based on the Program with the Program (or with a work based on the Program) on a volume of a storage or distribution medium does not bring the other work under the scope of this License.
49

  
50
3.	You may copy and distribute the Program (or a work based on it, under Section 2) in object code or executable form under the terms of Sections 1 and 2 above provided that you also do one of the following:
51

  
52
a) Accompany it with the complete corresponding machine-readable source code, which must be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
53

  
54
b) Accompany it with a written offer, valid for at least three years, to give any third party, for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code, to be distributed under the terms of Sections 1 and 2 above on a medium customarily used for software interchange; or,
55

  
56
c)	Accompany it with the information you received as to the offer to distribute corresponding source code.  (This alternative is allowed only for noncommercial distribution and only if you received the program in object code or executable form with such an offer, in accord with Subsection b above.)
57

  
58
The source code for a work means the preferred form of the work for making modifications to it.  For an executable work, complete source code means all the source code for all modules it contains, plus any associated interface definition files, plus the scripts used to control compilation and installation of the executable.  However, as a special exception, the source code distributed need not include anything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs, unless that component itself accompanies the executable.
59

  
60
If distribution of executable or object code is made by offering access to copy from a designated place, then offering equivalent access to copy the source code from the same place counts as distribution of the source code, even though third parties are not compelled to copy the source along with the object code.
61

  
62
4.	You may not copy, modify, sublicense, or distribute the Program except as expressly provided under this License.  Any attempt otherwise to copy, modify, sublicense or distribute the Program is void, and will automatically terminate your rights under this License.
63
However, parties who have received copies, or rights, from you under this License will not have their licenses terminated so long as such parties remain in full compliance.
64

  
65
5.	You are not required to accept this License, since you have not signed it.  However, nothing else grants you permission to modify or distribute the Program or its derivative works.  These actions are prohibited by law if you do not accept this License.  Therefore, by modifying or distributing the Program (or any work based on the Program), you indicate your acceptance of this License to do so, and all its terms and conditions for copying, distributing or modifying the Program or works based on it.
66

  
67
6.	Each time you redistribute the Program (or any work based on the Program), the recipient automatically receives a license from the original licensor to copy, distribute or modify the Program subject to these terms and conditions.  You may not impose any further restrictions on the recipients' exercise of the rights granted herein.
68
You are not responsible for enforcing compliance by third parties to this License.
69

  
70
7.	If, as a consequence of a court judgment or allegation of patent infringement or for any other reason (not limited to patent issues), conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License.  If you cannot distribute so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may not distribute the Program at all.  For example, if a patent license would not permit royalty-free redistribution of the Program by all those who receive copies directly or indirectly through you, then the only way you could satisfy both it and this License would be to refrain entirely from distribution of the Program.
71

  
72
If any portion of this section is held invalid or unenforceable under any particular circumstance, the balance of the section is intended to apply and the section as a whole is intended to apply in other circumstances.
73

  
74
It is not the purpose of this section to induce you to infringe any patents or other property right claims or to contest validity of any such claims; this section has the sole purpose of protecting the integrity of the free software distribution system, which is implemented by public license practices.  Many people have made generous contributions to the wide range of software distributed through that system in reliance on consistent application of that system; it is up to the author/donor to decide if he or she is willing to distribute software through any other system and a licensee cannot impose that choice.
75

  
76
This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
77

  
78
8.	If the distribution and/or use of the Program is restricted in certain countries either by patents or by copyrighted interfaces, the original copyright holder who places the Program under this License may add an explicit geographical distribution limitation excluding those countries, so that distribution is permitted only in or among countries not thus excluded.  In such case, this License incorporates the limitation as if written in the body of this License.
79

  
80
9.	The Free Software Foundation may publish revised and/or new versions of the General Public License from time to time.  Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns.
81

  
82
Each version is given a distinguishing version number.  If the Program specifies a version number of this License which applies to it and "any later version", you have the option of following the terms and conditions either of that version or of any later version published by the Free Software Foundation.  If the Program does not specify a version number of this License, you may choose any version ever published by the Free Software Foundation.
83

  
84
10.	If you wish to incorporate parts of the Program into other free programs whose distribution conditions are different, write to the author to ask for permission.  For software which is copyrighted by the Free Software Foundation, write to the Free Software Foundation; we sometimes make exceptions for this.  Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally.
85

  
86
NO WARRANTY
87

  
88
11.	BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
89

  
90
12.	IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
91

  
92
END OF TERMS AND CONDITIONS
93

  
94
How to Apply These Terms to Your New Programs
95

  
96
If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms.
97

  
98
To do so, attach the following notices to the program.  It is safest to attach them to the start of each source file to most effectively convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found.
99

  
100
<one line to give the program's name and a brief idea of what it does.> Copyright (C) <year>  <name of author>
101

  
102
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
103

  
104
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
105

  
106
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
107

  
108

  
109
Also add information on how to contact you by electronic and paper mail.
110

  
111
If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
112

  
113
Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
114
This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
115

  
116
The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License.  Of course, the commands you use may be called something other than `show w' and `show c'; they could even be mouse-clicks or menu items--whatever suits your program.
117

  
118
You should also get your employer (if you work as a programmer) or your school, if any, to sign a "copyright disclaimer" for the program, if necessary.  Here is a sample; alter the names:
119

  
120
Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
121

  
122
<signature of Ty Coon>, 1 April 1989
123
Ty Coon, President of Vice
124

  
125
This General Public License does not permit incorporating your program into proprietary programs.  If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library.  If this is what you want to do, use the GNU Library General Public License instead of this License.
0 126

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/resources/userInputLang.xml_cze
1
<langpack>
2
  <str id="text.label" txt="Path to gvSIG:"/>
3
</langpack>
0 4

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/HOWTO-BUILD.txt
1
 C?MO GENERAR EL INSTALADOR:
2
 ===========================
3
- gvSIG debe estar correctamente construido en ../_fwAndami/bin (en el caso de una extensi?n aislada, basta con que est? construida la extensi?n)
4
- El proyecto 'install' debe estar presente en la ra?z del workspace (contiene el Izpack, entre otras cosas)
5
- En el fichero variables.sh hay algunas variables que nos pueden interesar, que permiten personalizar el nombre del plugin, la versi?n, el directorio destino, las extensiones incluidas, etc. La variable  APPNAME normalmente valdr? "gvSIG", pero puede tiener nombre si estamos empaquetando una extensi?n (por ejemplo,  "nomenclatorIGN").
6
- Definir los packs adecuados en el fichero XML de configuraci?n (install.xml), y revisar el fichero en general.
7
- En el fichero resources/userInputSpec.xml modificar los directorios candidatos, si se ha producido un cambio de la versi?n de gvSIG sobre la que queremos instalar
8
- Lanzar el script distribucion.sh, pas?ndole como par?metro el n?mero de build deseado
0 9

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/install/extensionsList
1
#Para añadir una nueva extension al instalador incrementar EXT_N y agregar el nombre al vector EXTENSIONS
2
# Esto lo necesitamos porque no queremos coger todas las extensiones que haya, solo las que elijamos
3
EXT_N=1
4
EXTENSIONS=(
5
com.iver.gvsig.extMeasureGeometry
6
)
0 7

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/src/com/iver/gvsig/AreaExtension.java
1
package com.iver.gvsig;
2

  
3
import java.io.File;
4
import java.io.IOException;
5

  
6
import com.hardcode.gdbms.engine.values.Value;
7
import com.hardcode.gdbms.engine.values.ValueFactory;
8
import com.iver.andami.PluginServices;
9
import com.iver.andami.plugins.Extension;
10
import com.iver.cit.gvsig.fmap.DriverException;
11
import com.iver.cit.gvsig.fmap.MapContext;
12
import com.iver.cit.gvsig.fmap.ViewPort;
13
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
14
import com.iver.cit.gvsig.fmap.core.FShape;
15
import com.iver.cit.gvsig.fmap.core.IFeature;
16
import com.iver.cit.gvsig.fmap.core.IGeometry;
17
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
18
import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
19
import com.iver.cit.gvsig.fmap.drivers.SHPLayerDefinition;
20
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
21
import com.iver.cit.gvsig.fmap.drivers.shp.IndexedShpDriver;
22
import com.iver.cit.gvsig.fmap.edition.DefaultRowEdited;
23
import com.iver.cit.gvsig.fmap.edition.EditionException;
24
import com.iver.cit.gvsig.fmap.edition.IRowEdited;
25
import com.iver.cit.gvsig.fmap.edition.writers.shp.ShpWriter;
26
import com.iver.cit.gvsig.fmap.layers.FLayer;
27
import com.iver.cit.gvsig.fmap.layers.FLayers;
28
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
29
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
30
import com.iver.cit.gvsig.fmap.layers.VectorialFileAdapter;
31
import com.iver.cit.gvsig.project.documents.view.IProjectView;
32
import com.iver.cit.gvsig.project.documents.view.gui.View;
33
import com.iver.gvsig.measure.Operations;
34

  
35
/**
36
 * Extension responsible for calculating the area and the perimeter of the geometries selected,
37
 * only when these they be of type polygon.
38
 * When there is not an active layer, or some of the geometries selected be not of type polygon
39
 * this tool will remain in not visible way.
40
 *
41
 * @author Vicente Caballero Navarro
42
 */
43
public class AreaExtension extends Extension {
44
	private MapContext map;
45
	private FLyrVect lv;
46
	/**
47
	 * @see com.iver.andami.plugins.IExtension#initialize()
48
	 */
49
	public void initialize() {
50
	}
51

  
52
	/**
53
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
54
	 */
55
	public void execute(String actionCommand) {
56
		ViewPort vp=map.getViewPort();
57
		Operations operations=new Operations();
58
		ShpWriter writer=((IndexedShpDriver)lv.getSource().getDriver()).getShpWriter();
59
		SHPLayerDefinition lyrDef;
60
		try {
61

  
62
			ReadableVectorial adapter = lv.getSource();
63
			int numRows=adapter.getShapeCount();
64
			IGeometry[] geometries=new IGeometry[numRows];
65
			Object[] values=new Object[numRows];
66
			for (int i=0;i<numRows;i++){
67
				IFeature feat=adapter.getFeature(i);
68
				geometries[i]=feat.getGeometry().cloneGeometry();
69
				values[i]=feat.getAttributes();
70
				System.err.println(feat.getAttribute(0).toString());
71
			}
72

  
73

  
74

  
75
			lyrDef = Operations.createLayerDefinition(lv);
76
			FieldDescription[] fD=lyrDef.getFieldsDesc();
77
			FieldDescription[] newFDA = operations.getAreaFields(fD);
78
			FieldDescription[] newFD = operations.getPerimeterFields(newFDA);
79

  
80

  
81
			lyrDef.setFieldsDesc(newFD);
82

  
83
			File newFile = ((VectorialFileDriver)adapter.getDriver()).getFile();
84
			writer.setFile(newFile);
85
			writer.initialize(lyrDef);
86
			writer.preProcess();
87

  
88
			for (int i=0;i<numRows;i++){
89
				IGeometry geom=geometries[i];
90
				Value[] vals=(Value[])values[i];
91
				Value[] newValues=new Value[vals.length+2];
92
				for (int j=0;j<vals.length;j++){
93
					newValues[j]=vals[j];
94
				}
95

  
96
				double area=operations.getArea(geom);
97
				newValues[newValues.length-2]=ValueFactory.createValue(area);
98
				double perimeter=operations.getPerimeter(geom,vp);
99
				newValues[newValues.length-1]=ValueFactory.createValue(perimeter);
100
				DefaultFeature df=new DefaultFeature(geom,newValues);
101
				IRowEdited edRow = new DefaultRowEdited(df, IRowEdited.STATUS_ADDED, i);
102
				writer.process(edRow);
103
			}
104
			writer.postProcess();
105
			adapter.getDriver().reload();
106

  
107
			VectorialFileAdapter newAdapter = new VectorialFileAdapter(newFile);
108
			newAdapter.setDriver(adapter.getDriver());
109

  
110

  
111
			lv.setSource(newAdapter);
112
			lv.setRecordset(newAdapter.getRecordset());
113
//			SelectableDataSource rs = lv.getRecordset();
114
//			FieldDescription[] fields = rs.getFieldsDescription();
115
//			for (int ik=0; ik < fields.length; ik++)
116
//				System.out.println(fields[ik].getFieldName());
117
		} catch (EditionException e) {
118
			e.printStackTrace();
119
		} catch (DriverException e1) {
120
			e1.printStackTrace();
121
		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e1) {
122
			e1.printStackTrace();
123
		} catch (DriverIOException e) {
124
			e.printStackTrace();
125
		} catch (IOException e) {
126
			e.printStackTrace();
127
		}
128
	}
129

  
130

  
131
	/**
132
	 * @see com.iver.andami.plugins.IExtension#isEnabled()
133
	 */
134
	public boolean isEnabled() {
135
		return true;
136
	}
137

  
138
	/**
139
	 * @see com.iver.andami.plugins.IExtension#isVisible()
140
	 */
141
	public boolean isVisible() {
142
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
143
				.getActiveWindow();
144

  
145
		if (f == null) {
146
			return false;
147
		}
148
		if (f instanceof View) {
149
			View vista = (View) f;
150
			IProjectView model = vista.getModel();
151
			map = model.getMapContext();
152
			FLayers layers = map.getLayers();
153
			FLayer[] layersActives=layers.getActives();
154
			if (layersActives.length == 1) {
155
				if (layersActives[0] instanceof FLyrVect) {
156
					lv = (FLyrVect) layersActives[0];
157
					try {
158
						int type=lv.getShapeType();
159
						if (FShape.CIRCLE == type
160
								|| FShape.ELLIPSE == type
161
								|| FShape.POLYGON == type) {
162
							return true;
163
						}
164
					} catch (DriverException e) {
165
						return false;
166
					}
167
				}
168
			}
169
		}
170
		return false;
171
	}
172
}
0 173

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/src/com/iver/gvsig/PerimeterExtension.java
1
package com.iver.gvsig;
2

  
3
import java.io.File;
4
import java.io.IOException;
5

  
6
import com.hardcode.gdbms.engine.values.Value;
7
import com.hardcode.gdbms.engine.values.ValueFactory;
8
import com.iver.andami.PluginServices;
9
import com.iver.andami.plugins.Extension;
10
import com.iver.cit.gvsig.fmap.DriverException;
11
import com.iver.cit.gvsig.fmap.MapContext;
12
import com.iver.cit.gvsig.fmap.ViewPort;
13
import com.iver.cit.gvsig.fmap.core.DefaultFeature;
14
import com.iver.cit.gvsig.fmap.core.FShape;
15
import com.iver.cit.gvsig.fmap.core.IFeature;
16
import com.iver.cit.gvsig.fmap.core.IGeometry;
17
import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
18
import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
19
import com.iver.cit.gvsig.fmap.drivers.SHPLayerDefinition;
20
import com.iver.cit.gvsig.fmap.drivers.VectorialFileDriver;
21
import com.iver.cit.gvsig.fmap.drivers.shp.IndexedShpDriver;
22
import com.iver.cit.gvsig.fmap.edition.DefaultRowEdited;
23
import com.iver.cit.gvsig.fmap.edition.EditionException;
24
import com.iver.cit.gvsig.fmap.edition.IRowEdited;
25
import com.iver.cit.gvsig.fmap.edition.writers.shp.ShpWriter;
26
import com.iver.cit.gvsig.fmap.layers.FLayer;
27
import com.iver.cit.gvsig.fmap.layers.FLayers;
28
import com.iver.cit.gvsig.fmap.layers.FLyrVect;
29
import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
30
import com.iver.cit.gvsig.fmap.layers.VectorialFileAdapter;
31
import com.iver.cit.gvsig.project.documents.view.IProjectView;
32
import com.iver.cit.gvsig.project.documents.view.gui.View;
33
import com.iver.gvsig.measure.Operations;
34

  
35
/**
36
 * Extension responsible for calculating the perimeter of the geometries selected,
37
 * only when these they be of type line.
38
 * When there is not an active layer, or some of the geometries selected be not of type line
39
 * this tool will remain in not visible way.
40
 *
41
 * @author Vicente Caballero Navarro
42
 */
43
public class PerimeterExtension extends Extension {
44
	private MapContext map;
45
	private FLyrVect lv;
46
	/**
47
	 * @see com.iver.andami.plugins.IExtension#initialize()
48
	 */
49
	public void initialize() {
50
	}
51

  
52
	/**
53
	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
54
	 */
55
	public void execute(String actionCommand) {
56
		ViewPort vp=map.getViewPort();
57
		Operations operations=new Operations();
58

  
59
		ShpWriter writer=((IndexedShpDriver)lv.getSource().getDriver()).getShpWriter();
60
		SHPLayerDefinition lyrDef;
61
		try {
62
			ReadableVectorial adapter = lv.getSource();
63
			int numRows=adapter.getShapeCount();
64
			IGeometry[] geometries=new IGeometry[numRows];
65
			Object[] values=new Object[numRows];
66
			for (int i=0;i<numRows;i++){
67
				IFeature feat=adapter.getFeature(i);
68
				geometries[i]=feat.getGeometry().cloneGeometry();
69
				values[i]=feat.getAttributes();
70
			}
71

  
72
			lyrDef = Operations.createLayerDefinition(lv);
73
			FieldDescription[] fD=lyrDef.getFieldsDesc();
74
			FieldDescription[] newFD = operations.getPerimeterFields(fD);
75
			lyrDef.setFieldsDesc(newFD);
76

  
77

  
78
			File newFile = ((VectorialFileDriver)adapter.getDriver()).getFile();
79
			writer.setFile(newFile);
80
			writer.initialize(lyrDef);
81
			writer.preProcess();
82

  
83
			for (int i=0;i<numRows;i++){
84
				IGeometry geom=geometries[i];
85
				Value[] vals=(Value[])values[i];
86
				Value[] newValues=new Value[vals.length+1];
87
				for (int j=0;j<vals.length;j++){
88
					newValues[j]=vals[j];
89
				}
90

  
91
				double perimeter=operations.getPerimeter(geom,vp);
92
				newValues[newValues.length-1]=ValueFactory.createValue(perimeter);
93
				DefaultFeature df=new DefaultFeature(geom,newValues);
94
				IRowEdited edRow = new DefaultRowEdited(df, IRowEdited.STATUS_ADDED, i);
95
				writer.process(edRow);
96
			}
97
			writer.postProcess();
98
			adapter.getDriver().reload();
99

  
100
			VectorialFileAdapter newAdapter = new VectorialFileAdapter(newFile);
101
			newAdapter.setDriver(adapter.getDriver());
102

  
103

  
104
			lv.setSource(newAdapter);
105
			lv.setRecordset(newAdapter.getRecordset());
106

  
107

  
108
		} catch (EditionException e) {
109
			e.printStackTrace();
110
		} catch (DriverException e1) {
111
			e1.printStackTrace();
112
		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e1) {
113
			e1.printStackTrace();
114
		} catch (DriverIOException e) {
115
			e.printStackTrace();
116
		} catch (IOException e) {
117
			e.printStackTrace();
118
		}
119
	}
120

  
121

  
122
	/**
123
	 * @see com.iver.andami.plugins.IExtension#isEnabled()
124
	 */
125
	public boolean isEnabled() {
126
		return true;
127
	}
128

  
129
	/**
130
	 * @see com.iver.andami.plugins.IExtension#isVisible()
131
	 */
132
	public boolean isVisible() {
133
		com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
134
				.getActiveWindow();
135

  
136
		if (f == null) {
137
			return false;
138
		}
139
		if (f instanceof View) {
140
			View vista = (View) f;
141
			IProjectView model = vista.getModel();
142
			map = model.getMapContext();
143
			FLayers layers = map.getLayers();
144
			FLayer[] layersActives = layers.getActives();
145
			if (layersActives.length == 1) {
146
				if (layersActives[0] instanceof FLyrVect) {
147
					lv = (FLyrVect) layersActives[0];
148
					try {
149
						int type = lv.getShapeType();
150
						if (FShape.ARC == type || FShape.LINE == type) {
151
							return true;
152
						}
153
					} catch (DriverException e) {
154
						return false;
155
					}
156
				}
157
			}
158

  
159
		}
160
		return false;
161
	}
162
}
0 163

  
tags/gvsig_redes-1_0_0-1235/extensions/extMeasureGeometry/src/com/iver/gvsig/measure/Operations.java
1
package com.iver.gvsig.measure;
2

  
3
import java.awt.Shape;
4
import java.sql.Types;
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff