Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/build.number
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/build.number	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/build.number	(revision 12191)
@@ -0,0 +1,3 @@
+#Build Number for ANT. Do not edit!
+#Mon Jun 18 10:17:22 CEST 2007
+build.number=4

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/build.number
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/.cvsignore
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/.cvsignore	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/.cvsignore	(revision 12191)
@@ -0,0 +1,3 @@
+bin
+extensiones
+nomenclatorIGN-*.zip

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/.cvsignore
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/build.xml
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/build.xml	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/build.xml	(revision 12191)
@@ -0,0 +1,35 @@
+<project name="instalador-gvSIG" default="init" basedir=".">
+	<!--
+	<property name="dir_inst" location="C:\Archivos de programa"/>
+	<property name="base_dir" location="./"/>		
+	<property name="dir_libs" location="C:\Archivos de programa\IzPack\lib"/>
+	<property name="vers" location="0.6"/>
+	<property name="izpack_dir" location="C:\Archivos de programa\IzPack"/>
+	-->
+	
+	<property name="dir_inst" location="/usr/local"/>
+	<property name="base_dir" location="./"/>		
+	<property name="izpack_dir" location="../../install/IzPack"/>
+	<property name="dir_libs" location="${izpack_dir}/lib"/>
+	
+	<taskdef name="izpack" classpath="${dir_libs}/compiler.jar" classname="com.izforge.izpack.ant.IzPackTask"/>
+	
+	<target name="init">
+		<izpack input="install.xml" 
+				output="${JARNAME}" 
+				installerType="standard" 
+				basedir="${base_dir}" 
+				izPackDir="${izpack_dir}/"/>
+	</target>
+	
+	<target name="clean">
+		<delete>
+			<fileset dir=".">
+			    <include name="**.zip"/>
+			</fileset>
+		</delete>
+		<delete dir="bin" />
+		<delete dir="extensions" />
+	</target>
+	
+</project>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/build.xml
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/install.xml
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/install.xml	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/install.xml	(revision 12191)
@@ -0,0 +1,79 @@
+<installation version="1.0">
+	<info>
+		<appname>gvSIG_1.0 piloto redes</appname>
+		<appversion>1.0</appversion>
+		<authors>
+			<author name="Generalitat Valenciana. Conselleria d'Infraestructures i Transport" email="" />
+			<author name="Iver Tecnologías de la Información S.A." email="" />
+		</authors>
+		<url>http://www.gvsig.gva.es/</url>
+		<javaversion>1.4</javaversion>
+	</info>
+
+	<guiprefs height="600" resizable="yes" width="800">
+		<laf name="liquid">
+			<os family="unix" />
+		</laf>
+	</guiprefs>
+
+	<locale>
+		<!-- only keep the languages which are also available in gvSIG -->
+		<langpack iso3="spa"/>
+		<langpack iso3="val"/>
+		<langpack iso3="eng"/>
+	<!--	<langpack iso3="cat"/>
+		<langpack iso3="chn"/> -->
+		<langpack iso3="cze"/>
+	<!--	<langpack iso3="dan"/> -->
+		<langpack iso3="deu"/>
+	<!--	<langpack iso3="fin"/>-->
+		<langpack iso3="fra"/>
+		<langpack iso3="glg"/>
+	<!--	<langpack iso3="hun"/> -->
+		<langpack iso3="ita"/>
+	<!--	<langpack iso3="jpn"/>
+		<langpack iso3="mys"/>
+		<langpack iso3="ned"/>
+		<langpack iso3="nor"/>
+		<langpack iso3="pol"/> -->
+		<langpack iso3="por"/>
+	<!--	<langpack iso3="rom"/>
+		<langpack iso3="rus"/>
+		<langpack iso3="scg"/>
+		<langpack iso3="svk"/>
+		<langpack iso3="swe"/>
+		<langpack iso3="ukr"/> -->
+	</locale>
+
+	<resources>
+		<res src="resources/gpl.txt" id="LicencePanel.licence"/>
+		<res src="resources/LEEME.html" id="HTMLInfoPanel.info"/>
+		<res src="resources/images/Logo_gvsig_gva.jpg" id="Installer.image"/>
+				<res src="resources/userInputSpec.xml" id="userInputSpec.xml"/>
+                <parsable os="linux" targetfile="resources/userInputSpec.xml"/>
+                <res src="resources/userInputLang.xml_val" id="userInputLang.xml_val" />
+                <res src="resources/userInputLang.xml_spa" id="userInputLang.xml_spa" />
+	</resources>
+
+	<panels>
+		<panel classname="HTMLInfoPanel"/>
+		<panel classname="LicencePanel"/>
+		<panel classname="PacksPanel"/>
+		<panel classname="UserInputPanel"/>
+		<panel classname="InstallPanel"/>
+		<panel classname="SimpleFinishPanel"/>
+	</panels>
+
+	<packs>
+
+    <pack name="Extension Piloto redes" required="yes">
+      <description>Extension piloto de redes</description>
+      <file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/" src="extensiones/com.iver.cit.gvsig.graph" override="true"/>
+      <file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/" src="../../../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.cit.gvsig.graph-fmap-gvsig.jar" override="true"/>
+      <file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/" src="../../../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.cit.gvsig.jar" override="true"/>
+    </pack>
+    
+	</packs>
+
+
+</installation>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/install.xml
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_fra
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_fra	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_fra	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_fra
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_eng
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_eng	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_eng	(revision 12191)
@@ -0,0 +1,12 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+    <str id="UserInputPanel.search.autodetect.failed.message"    txt="Autodetection failed."/>
+    <str id="UserInputPanel.search.autodetect.failed.caption"    txt="Autodetection failed."/>
+    <str id="UserInputPanel.search.autodetect.tooltip"           txt="Check for the file or directory in the paths given above."/>
+    <str id="UserInputPanel.search.location"           txt="Enter location of {0}."/>
+    <str id="UserInputPanel.search.location.checkedfile" txt="The existence of {0} is checked."/>
+    <str id="UserInputPanel.search.browse"           txt="Browse..."/>
+    <str id="UserInputPanel.search.wrongselection.message"   txt="The file or directory you choose either does not exist or is not appropiate. You must have gvSIG installed in the selected directory."/>
+    <str id="UserInputPanel.search.wrongselection.caption"   txt="Invalid selection."/>
+  
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_eng
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputSpec.xml
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputSpec.xml	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputSpec.xml	(revision 12191)
@@ -0,0 +1,21 @@
+<userInput>
+	<panel order="0">
+		<field 	type="search" 
+				variable="INSTALL_PATH"
+				size="45">
+  			<description align="left" />
+  			<spec 	txt="Path to gvSIG:" 
+		  			id="text.label"
+  					checkfilename="bin/andami.jar"
+        			type="directory" 
+        			result="directory">
+  			<choice value="/usr/local/gvSIG_1.0" os="unix" />
+  			<choice value="/opt/gvSIG_1.0" os="unix" />
+  			<choice value="$USER_HOME/gvSIG_1.0" os="unix" />
+  			<choice value="C:\Archivos de Programa\gvSIG_1.0" os="windows" />
+  			<choice value="C:\Program Files\gvSIG_1.0" os="windows" />
+  			</spec>
+		</field>
+	</panel>
+</userInput>
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputSpec.xml
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/LEEME.html
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/LEEME.html	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/LEEME.html	(revision 12191)
@@ -0,0 +1,66 @@
+<html>
+<head>
+<style type="text/css">
+html, body, h1, h2, h3, h4, div, p, ul, li, input {
+   font-family: Arial, Helvetica, sans-serif;
+}
+
+h1 {
+   font-size: large;
+}
+
+h2 {
+   font-size: large;
+}
+
+h3 {
+   font-size: medium;
+}
+</style>
+</head>
+<body>
+<h1>gvSIG, el SIG en software libre de la Generalitat Valenciana
+(http://www.gvsig.gva.es).</h1>
+
+<h2>Autores:</h2>
+<ul>
+<li>Generalitat Valenciana
+ (Conselleria d'Infraestructures i Transport).</li>
+<li>Iver Tecnolog&iacute;as de la Informaci&oacute;n S.A.</li>
+</ul>
+
+<p>Software con licencia GNU/GPL
+(http://www.fsf.org/licensing/licenses/gpl.html)</p>
+
+<p>Contacto:
+	gvsig@gva.es<p>
+
+<h2>Requisitos de la aplicaci&oacute;n:</h2>
+<h3>Sistema</h3>
+<ul>
+<li>M&iacute;nimos: Pentium III / 256 MB RAM.</li>
+<li>Recomendables: Pentium IV / 512 MB RAM.</li>
+<li>Sistemas operativos: plataformas Windows y Linux.
+ Probado en Win98/XP, Linux Suse 8.2/9.0/9.2 y Linux Debian (Lliurex).</li>
+</ul>
+
+<h3>Software instalado</h3> (disponible en http://www.gvsig.gva.es o en http://java.sun.com)
+<ul>
+<li>M&aacute;quina Virtual Java 1.4.2 (06 o superior).</li>
+<li>JAI (Java Advanced Imaging).</li>
+<li>JAI Image I/O.</li>
+</ul>
+
+<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>
+
+<h2>M&aacute;s informaci&oacute;n y soporte en:</h2>
+<h3> Web oficial del proyecto:</h3>
+	http://www.gvsig.gva.es
+
+<h3>Listas de distribuci&oacute;n:</h3>
+<span style="monospace"> http://runas.cap.gva.es/mailman/listinfo/gvsig_usuarios</span> (soporte para usuarios).
+<span style="monospace"> http://runas.cap.gva.es/mailman/listinfo/gvsig_desarrolladores</span> (soporte para desarrolladores).
+<span style="monospace"> http://runas.cap.gva.es/mailman/listinfo/gvsig_internacional</span> (soporte para desarrolladores o usuarios de habla no hispana).
+
+</body>
+</html>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/LEEME.html
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_deu
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_deu	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_deu	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_deu
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_ita
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_ita	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_ita	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_ita
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/launcher.ini
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/launcher.ini	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/launcher.ini	(revision 12191)
@@ -0,0 +1,36 @@
+
+## Ruta al achivo Jar a lanzar
+jar = %JARNAME%
+
+
+
+## Parametros a incluir al lanzar el Jar
+jarParams = 
+
+
+
+## Lanzar el Jar en ansincrono o no:
+##     * si(se lanza el java y finaliza el lanzador):S SI YES Y 1
+##     * no(el lanzado se espera a que termine la ejecucion del java):{distinto de los anterirores}
+launchJarAsync = NO
+
+## Version de JRE requerida
+jre_version = 1.4.2
+## Si existen varias JRE de la requerida, cual es la preferida (si esta)
+jre_version_prefered = 1.4.2_10
+
+
+## Descarga remota
+## 	* los valores valido de downloadEnabled son:
+##		- habilitado: S SI YES Y 1
+##		- deshabilitado: {distinto de los anteriores}
+downloadEnabled = 1
+
+
+## Path del instalable del jre (si no existe y estan
+##	habilitadas las descargas, lo dejara aqui)
+jre = j2re-1_4_2_10-linux.tar.gz
+downloadJre = http://www.gvsig.org/j2re-1_4_2_10-linux.tar.gz
+installJreCmd =./install_jre.sh
+installedJreJavaFile = $HOME/gvSIG/jre/1.4.2_10/bin/java
+installedJreRootDirectory =$HOME/gvSIG/jre

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/launcher.ini
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_por
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_por	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_por	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_por
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/gpl.txt
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/gpl.txt	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/gpl.txt	(revision 12191)
@@ -0,0 +1,125 @@
+	GNU GENERAL PUBLIC LICENSE
+	Version 2, June 1991
+
+	 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.
+
+		Preamble
+
+	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.
+
+	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.
+
+	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.
+
+	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
+rights.
+
+	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.
+
+	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.
+
+	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.
+
+	The precise terms and conditions for copying, distribution and modification follow.
+
+				GNU GENERAL PUBLIC LICENSE
+	TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+	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".
+
+	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.
+
+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.
+
+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.
+
+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:
+
+a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
+
+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.
+
+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.)
+
+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.
+
+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.
+
+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.
+
+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:
+
+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,
+
+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,
+
+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.)
+
+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.
+
+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.
+
+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.
+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.
+
+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.
+
+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.
+You are not responsible for enforcing compliance by third parties to this License.
+
+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.
+
+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.
+
+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.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+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.
+
+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.
+
+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.
+
+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.
+
+NO WARRANTY
+
+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.
+
+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.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+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.
+
+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.
+
+<one line to give the program's name and a brief idea of what it does.> Copyright (C) <year>  <name of author>
+
+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.
+
+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.
+
+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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
+
+Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
+
+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.
+
+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:
+
+Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+<signature of Ty Coon>, 1 April 1989
+Ty Coon, President of Vice
+
+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.
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/gpl.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_cze
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_cze	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_cze	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_cze
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_val
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_val	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_val	(revision 12191)
@@ -0,0 +1,11 @@
+<langpack>
+  <str id="text.label" txt="Ruta a gvSIG:"/>
+    <str id="UserInputPanel.error.caption"        txt="Problema d'entrada"/>
+
+	<str id="UserInputPanel.search.browse"           txt="Buscar..."/>
+	<str id="UserInputPanel.search.autodetect"    txt="Autodetectar"/>
+	<str id="UserInputPanel.search.autodetect.failed.message"    txt="Autodetecci�n ha fallado."/>
+    <str id="UserInputPanel.search.autodetect.failed.caption"    txt="Autodetecci�n ha fallado."/>
+ 	<str id="UserInputPanel.search.wrongselection.message"   txt="�s necessari tindre gvSIG instal�lat en el directori que se seleccione."/>
+  
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_val
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_spa
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_spa	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_spa	(revision 12191)
@@ -0,0 +1,12 @@
+<langpack>
+  <str id="text.label" txt="Ruta a gvSIG:"/>
+    <str id="UserInputPanel.search.autodetect.failed.message"    txt="Autodetecci�n ha fallado."/>
+    <str id="UserInputPanel.search.autodetect.failed.caption"    txt="Autodetecci�n ha fallado."/>
+    <str id="UserInputPanel.search.autodetect.tooltip"           txt="Compruebe el fichero o directorio en las rutas mostradas arriba."/>
+    <str id="UserInputPanel.search.location"           txt="Introduzca la ruta de {0}."/>
+    <str id="UserInputPanel.search.location.checkedfile" txt="Se comprueba la existencia de {0}."/>
+    <str id="UserInputPanel.search.browse"           txt="Buscar..."/>
+    <str id="UserInputPanel.search.wrongselection.message"   txt="El fichero o directorio elegido no existe o no es apropiado. Es necesario tener gvSIG en el directorio que se seleccione"/>
+    <str id="UserInputPanel.search.wrongselection.caption"   txt="Selecci�n inv�lida."/>
+  
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_spa
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/h_gvSIG-install.sh
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/h_gvSIG-install.sh	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/h_gvSIG-install.sh	(revision 12191)
@@ -0,0 +1,54 @@
+echo Unpacking...
+set -e
+tail +$lcount $0 | tar -xz  --no-same-owner 
+echo Launching instalation program....
+cd ./_tmp_install
+set +e
+#export LD_LIBRARY_PATH="$PWD:$PWD/lib:$LD_LIBRARY_PATH"
+./launcher-Linux >launcher_out 2>&1
+res=$?
+runOK=true
+if [ $res -eq 1 -o $res -eq 0 ] 
+then
+	runOK=true
+else
+	runOK=false
+	export LD_LIBRARY_PATH="$PWD:$PWD/lib:$LD_LIBRARY_PATH"
+	./launcher-Linux > launcher_out2  2>&1
+	res=$?
+	if [  $res = 1 -o  $res = 0 ]
+	then
+		runOK=true
+	fi
+	
+fi
+
+if [ $runOK = false ]
+then
+	cat launcher_out	
+	echo
+	cat launcher_out2
+	echo
+	if grep -q 'libstdc++.so.6:' launcher_out ; then
+		echo You need the libstdc++6 library correctly instaled in your system to use 
+		echo the installation program.
+		echo
+		echo "In a debian-based distribution (if you have root privileges)"
+		echo you can run the command:
+		echo '    apt-get install libstdc++6'
+
+	fi
+	if grep -q 'libc.so.6:' launcher_out ; then
+		echo You need the libc6 library correctly instaled in your system to use 
+		echo the installation program.
+		echo
+		echo "In a debian-based distribution (if you have root privileges)"
+		echo you can run the command:
+		echo '    apt-get install libc6'
+	fi
+	echo
+fi
+
+cd ..
+rm -r ./_tmp_install 2>&1 >/dev/null
+exit 0 

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/h_gvSIG-install.sh
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/uninstall1.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/uninstall1.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/ico-gvSIG16x16.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/ico-gvSIG16x16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/Logo-gvSIG.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/Logo-gvSIG.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/help16x16.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/help16x16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/uninstall.ico
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/uninstall.ico
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/.xvpics/uninstall.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/.xvpics/uninstall.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/.xvpics/uninstall1.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/.xvpics/uninstall1.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/.xvpics/Logo-gvSIG.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/.xvpics/Logo-gvSIG.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/.xvpics/help16x16.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/.xvpics/help16x16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/.xvpics/uninstall16x16.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/.xvpics/uninstall16x16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/ico-gvSIG.GIF
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/ico-gvSIG.GIF
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/uninstall.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/uninstall.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/help.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/help.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/ico-gvSIG.ico
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/ico-gvSIG.ico
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/help.ico
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/help.ico
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/uninstall16x16.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/uninstall16x16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/ico-gvSIG.JPG
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/ico-gvSIG.JPG
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/papelera.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/papelera.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/ico-gvSIG.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/ico-gvSIG.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/Logo_gvsig_gva.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/Logo_gvsig_gva.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/help.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/images/help.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_cat
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_cat	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_cat	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Ruta a gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/resources/userInputLang.xml_cat
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/.cvsignore
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/.cvsignore	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/.cvsignore	(revision 12191)
@@ -0,0 +1,2 @@
+./libs
+linux
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/.cvsignore
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/build.xml
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/build.xml	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/build.xml	(revision 12191)
@@ -0,0 +1,27 @@
+<project name="instalador-gvSIG" default="init" basedir=".">
+	
+	<property name="base_dir" location="./"/>		
+	<property name="izpack_dir" location="${INSTALL_GVSIG_PATH}/IzPack"/>
+	<property name="dir_libs" location="${izpack_dir}/lib"/>
+	
+	<taskdef name="izpack" classpath="${dir_libs}/compiler.jar" classname="com.izforge.izpack.ant.IzPackTask"/>
+	
+	<target name="init">
+		<izpack input="install.xml" 
+				output="${JARNAME}" 
+				installerType="standard" 
+				basedir="${base_dir}" 
+				izPackDir="${izpack_dir}/"/>
+	</target>
+	
+	<target name="clean">
+		<delete>
+			<fileset dir=".">
+			    <include name="**.zip"/>
+			</fileset>
+		</delete>
+		<delete dir="bin" />
+		<delete dir="extensions" />
+	</target>
+	
+</project>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux/build.xml
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/linux
___________________________________________________________________
Added: svn:ignore
   + ./libs
linux


Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/variables.sh
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/variables.sh	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/variables.sh	(revision 12191)
@@ -0,0 +1,18 @@
+#!/bin/sh
+
+export APPNAME=gvSIG_pilot_redes
+export FULLVERSION='1.0'
+export TARGET_DIR=/tmp/versiones/
+
+
+## estas extensiones se muestran en los packs, y se puede elegir instalarlos o no
+## (el fichero install.xml también debe estar actualizado para reflejar esto)
+EXTENSIONS=(
+com.iver.cit.gvsig.graph
+)
+
+## estas extensiones se instalan pero no se muestran en los packs
+MANDATORY_EXTENSIONS=(
+com.iver.cit.gvsig.graph
+)
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/variables.sh
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/distribucion.sh
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/distribucion.sh	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/distribucion.sh	(revision 12191)
@@ -0,0 +1,259 @@
+#!/bin/bash
+
+# Si se produce un error, salimos inmediatamente
+set -e
+
+DIR_BASE=`pwd`
+
+source variables.sh
+# Get a version with format 1_0_alpha
+UNDERSCORE_VERSION=`echo $FULLVERSION | sed 'y/./_/'`
+# Get a version with format 10_alpha
+BRIEFVERSION=`echo $FULLVERSION | sed 's/\.//'`
+# The name of the dir which will be ZIPed, containing the resulting installer
+INSTALLER_DIR="$APPNAME"-$FULLVERSION\_installer
+JARNAME="$APPNAME"-"$FULLVERSION".jar
+# The extension targets on the this version of gvSIG:
+GVSIG_VERSION=1.0
+
+GVSIG_BUILDNUMBER=`sed -n 's/build.number=//p' ../../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/build.number`
+
+GVSIG_FULLVERSION=gvSIG-$GVSIG_VERSION-$GVSIG_BUILDNUMBER
+
+cd ../../_fwAndami
+ANDAMI_PATH=`pwd`
+
+cd ../install
+INSTALL_GVSIG_PATH=`pwd`
+INSTALL_GVSIG_LINUX_PATH="$INSTALL_GVSIG_PATH"/instalador-gvSIG-lin
+INSTALL_GVSIG_WINDOWS_PATH="$INSTALL_GVSIG_PATH"/instalador-gvSIG-win
+
+cd "$DIR_BASE"
+
+DIR_LIN=linux
+DIR_WIN=windows
+WINDOWSZIP="$APPNAME"-"$BRIEFVERSION"\_"$GVSIG_FULLVERSION"-windows-i586.7z
+LINUXZIP="$APPNAME"-"$BRIEFVERSION"\_"$GVSIG_FULLVERSION"-linux-i586.tgz
+
+LINUXBIN="$APPNAME"-"$BRIEFVERSION"\_"$GVSIG_FULLVERSION"-linux-i586.bin
+LINUXBINWITHJRE="$APPNAME"-"$BRIEFVERSION"\_"$GVSIG_FULLVERSION"-linux-i586-withjre.bin
+
+WINDOWSEXE="$APPNAME"-"$BRIEFVERSION"\_"$GVSIG_FULLVERSION"-windows-i586.exe
+WINDOWSEXEWITHJRE="$APPNAME"-"$BRIEFVERSION"\_"$GVSIG_FULLVERSION"-windows-i586-withjre.exe
+
+#Directorios
+OUTPUT_DIR="$TARGET_DIR"/v"$FULLVERSION"\_"$GVSIG_FULLVERSION"
+PATH_SOURCE_EXT="$ANDAMI_PATH"/gvSIG/extensiones
+PATH_SOURCE_MANDAT_EXT="$ANDAMI_PATH"/gvSIG/extensiones
+
+
+echo "*****************"
+echo "      BASE       "
+echo "*****************"
+# Para Linux
+echo -n "$DIR_BASE"/"$DIR_LIN" "-- "
+cd "$DIR_BASE"/"$DIR_LIN"
+rm bin -rf
+if [ ! -d libs ] ; then
+   ln -s "$INSTALL_GVSIG_LINUX_PATH"/libs
+fi
+mkdir -p bin/gvSIG/extensiones
+cp resources/gpl.txt bin
+# No enlazamos directamente el directorio lib para no incluir el directorio CVS
+mkdir -p bin/lib
+cd "$DIR_BASE"/"$DIR_LIN"/bin/lib
+for i in "$ANDAMI_PATH"/lib/*.jar ; do
+  ln -s "$i" .
+done
+for i in "$ANDAMI_PATH"/lib/*.zip ; do
+  ln -s "$i" .
+done
+cd "$DIR_BASE"/"$DIR_LIN"
+ln -s "$ANDAMI_PATH"/andami.jar bin/
+ln -s "$ANDAMI_PATH"/castor.properties bin/
+#cp resources/andami-config.xml bin
+echo OK.
+
+
+# Para Windows
+echo -n "$DIR_BASE"/"$DIR_WIN" "-- "
+cd "$DIR_BASE"/"$DIR_WIN"
+rm bin -rf
+if [ ! -d libs ] ; then
+   ln -s "$INSTALL_GVSIG_WINDOWS_PATH"/libs
+fi
+mkdir -p bin/gvSIG/extensiones
+cp resources/gpl.txt bin
+# No enlazamos directamente el directorio lib para no incluir el directorio CVS
+mkdir -p bin/lib
+cd "$DIR_BASE"/"$DIR_WIN"/bin/lib
+for i in "$ANDAMI_PATH"/lib/*.jar ; do
+  ln -s "$i" .
+done
+for i in "$ANDAMI_PATH"/lib/*.zip ; do
+  ln -s "$i" .
+done
+cd "$DIR_BASE"/"$DIR_WIN"
+ln -s "$ANDAMI_PATH"/andami.jar bin
+ln -s "$ANDAMI_PATH"/castor.properties bin/
+#cp resources/andami-config.xml bin
+
+#Copiamos el lanzador y sus tracuciones al tmpResources
+rm -Rf tmpResources
+mkdir tmpResources
+cp -R $INSTALL_GVSIG_PATH/launcher/izpack-launcher-1.3/dist/* ./tmpResources
+mv ./tmpResources/launcher-Win32.exe ./tmpResources/gvSIG.exe
+#Quitamos el ini, manifest y los CVS
+rm ./tmpResources/*.ini ./tmpResources/*.manifest
+find ./tmpResources -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true
+echo OK.
+
+# Estas extensiones se copian directamente al directorio destino, ya que no vamos a dar
+# opcion a no instalarlas, son obligatorias
+cd "$DIR_BASE"
+i=0
+while [ ! -z ${MANDATORY_EXTENSIONS[$i]} ]
+do
+  echo ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_LIN"/bin/gvSIG/extensiones
+  ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_LIN"/bin/gvSIG/extensiones
+  echo ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_WIN"/bin/gvSIG/extensiones
+  ln -s "$PATH_SOURCE_MANDAT_EXT"/${MANDATORY_EXTENSIONS[$i]} "$DIR_WIN"/bin/gvSIG/extensiones
+  i=`expr $i + 1`
+done
+
+
+echo "*****************"
+echo "   EXTENSIONES   "
+echo "*****************"
+
+rm -rf $DIR_LIN/extensiones
+mkdir $DIR_LIN/extensiones
+rm -rf $DIR_WIN/extensiones
+mkdir $DIR_WIN/extensiones
+
+i=0
+while [ ! -z ${EXTENSIONS[$i]} ]
+do
+  echo "Copiando "${EXTENSIONS[$i]}
+  echo cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_LIN"/extensiones -rf
+  cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_LIN"/extensiones -rf
+  echo cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_WIN"/extensiones -rf
+  cp "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} "$DIR_WIN"/extensiones -rf
+  i=`expr $i + 1`
+done
+
+
+echo "*****************"
+echo "    INST-WIN     "
+echo "*****************"
+# Generar el instalador (jar) para windows
+cd "$DIR_BASE"/"$DIR_WIN"
+rm "$JARNAME" -f
+ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME" -DINSTALL_GVSIG_PATH="$INSTALL_GVSIG_PATH"
+
+echo "*****************"
+echo "    INST-LIN     "
+echo "*****************"
+# Generar el instalador (jar) para Linux
+cd "$DIR_BASE"/"$DIR_LIN"
+rm "$JARNAME" -f
+ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME" -DINSTALL_GVSIG_PATH="$INSTALL_GVSIG_PATH"
+
+
+echo "******************"
+echo " GENERAR DISTRIB "
+echo "******************"
+# Generar el .bin para Linux y el .EXE para Windows
+
+mkdir -p "$OUTPUT_DIR"
+echo "- Linux"
+## Nueva instalacion para linux
+cd "$DIR_BASE"/"$DIR_LIN"
+rm -Rf "$INSTALLER_DIR"
+mkdir -p "$INSTALLER_DIR"/_tmp_install
+cp "$JARNAME" "$INSTALLER_DIR"/_tmp_install
+cd "$INSTALLER_DIR"
+cp -R "$INSTALL_GVSIG_PATH"/launcher/izpack-launcher-1.3_linux/dist/* ./_tmp_install
+find . -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true
+
+rm ./_tmp_install/launcher.ini
+cp "$DIR_BASE"/"$DIR_LIN"/resources/launcher.ini ./_tmp_install/launcher.ini
+sed "s/%JARNAME%/$JARNAME/" ./_tmp_install/launcher.ini > ./_tmp_install/launcher.ini.bak
+mv ./_tmp_install/launcher.ini.bak ./_tmp_install/launcher.ini
+
+tar -cvzf ./tmp.tgz ./_tmp_install
+cp "$INSTALL_GVSIG_LINUX_PATH"/jre/*.gz ./_tmp_install
+tar -cvzf ./tmp_wjre.tgz ./_tmp_install
+echo '#!/bin/sh' > xx.tmp
+lcount=`cat xx.tmp "$DIR_BASE"/"$DIR_LIN"/resources/h_gvSIG-install.sh | wc -l`
+lcount=$(($lcount+2)) # sumamos dos: uno por la linea siguiente y otro para el inicio
+echo "lcount=$lcount" >> xx.tmp
+cat xx.tmp "$DIR_BASE"/"$DIR_LIN"/resources/h_gvSIG-install.sh ./tmp.tgz  > "$LINUXBIN"
+cat xx.tmp "$DIR_BASE"/"$DIR_LIN"/resources/h_gvSIG-install.sh ./tmp_wjre.tgz  > "$LINUXBINWITHJRE"
+rm xx.tmp
+chmod a+x "$LINUXBIN" "$LINUXBINWITHJRE"
+mv "$LINUXBINWITHJRE" "$LINUXBIN" "$OUTPUT_DIR"
+cd "$DIR_BASE"/"$DIR_LIN"
+rm -Rf "$INSTALLER_DIR"
+## Fin Nueva instalacion para linux
+rm "$JARNAME"
+
+
+
+
+## Para Windows
+echo "- Windows"
+#set -x
+cd "$DIR_BASE"/"$DIR_WIN"
+rm -Rf "$INSTALLER_DIR"
+mkdir "$INSTALLER_DIR"
+#cp -a installer_files "$INSTALLER_DIR"
+
+cp -aR "$INSTALL_GVSIG_PATH"/launcher/izpack-launcher-1.3/dist/* "$INSTALLER_DIR"
+rm -f "$INSTALLER_DIR"/install.bat
+
+find "$INSTALLER_DIR" -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true
+
+## hacemos las sustituciones de la variable
+rm "$INSTALLER_DIR"/launcher-Win32.ini
+cp resources/launcher-Win32.ini "$INSTALLER_DIR"/launcher-Win32.ini
+sed "s/%JARNAME%/$JARNAME/" "$INSTALLER_DIR"/launcher-Win32.ini > "$INSTALLER_DIR"/launcher-Win32.ini.bak
+mv "$INSTALLER_DIR"/launcher-Win32.ini.bak "$INSTALLER_DIR"/launcher-Win32.ini;
+
+
+mv "$JARNAME" "$INSTALLER_DIR"
+cd "$INSTALLER_DIR"
+
+if [ -f  "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" ] ; then
+	rm -f "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP"
+fi
+"$INSTALL_GVSIG_PATH"/launcher/7z/7za a -t7z -r "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP" * -mx0
+cd -
+sed "s/%TITLE%/$APPNAME-$BRIEFVERSION\_$BUILDNUMBER/" "$INSTALL_GVSIG_PATH"/launcher/7z/dist_config.txt > dist_config.txt
+cat "$INSTALL_GVSIG_PATH"/launcher/7z/7zS.sfx  dist_config.txt "$WINDOWSZIP" > "$WINDOWSEXE"
+
+### paquete con los instalables de JRE, Jai y Jai i/o
+"$INSTALL_GVSIG_PATH"/launcher/7z/7za a -t7z "$DIR_BASE"/"$DIR_WIN"/"$WINDOWSZIP"  "$INSTALL_GVSIG_WINDOWS_PATH"/jre_installers/*.exe -mx0
+cat "$INSTALL_GVSIG_PATH"/launcher/7z/7zS.sfx  dist_config.txt "$WINDOWSZIP" > "$WINDOWSEXEWITHJRE"
+
+###
+
+
+rm dist_config.txt
+rm "$WINDOWSZIP"
+
+rm -Rf "$INSTALLER_DIR"
+
+mv "$WINDOWSEXE" "$OUTPUT_DIR"
+mv "$WINDOWSEXEWITHJRE" "$OUTPUT_DIR"
+
+# Limpiamos tmpResources
+cd "$DIR_BASE"/"$DIR_WIN"
+rm -r ./tmpResources
+cd -
+
+cd "$DIR_BASE"
+
+#limpiamos
+rm -r "$DIR_BASE"/"$DIR_WIN"/bin "$DIR_BASE"/"$DIR_WIN"/extensiones "$DIR_BASE"/"$DIR_WIN"/libs "$DIR_BASE"/"$DIR_WIN"/"$JARNAME" 2> /dev/null || true
+rm -r "$DIR_BASE"/"$DIR_LIN"/bin "$DIR_BASE"/"$DIR_LIN"/extensiones "$DIR_BASE"/"$DIR_LIN"/libs "$DIR_BASE"/"$DIR_WIN"/"$JARNAME" 2> /dev/null || true

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/distribucion.sh
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/com.iver.cit.gvsig.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/com.iver.cit.gvsig.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/install.xml
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/install.xml	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/install.xml	(revision 12191)
@@ -0,0 +1,81 @@
+<installation version="1.0">
+	<info>
+		<appname>gvSIG_1.0 piloto redes</appname>
+		<appversion>1.0</appversion>
+		<authors>
+			<author name="Generalitat Valenciana. Conselleria d'Infraestructures i Transport" email="" />
+			<author name="Iver Tecnologías de la Información S.A." email="" />
+		</authors>
+		<url>http://www.gvsig.gva.es/</url>
+		<javaversion>1.4</javaversion>
+	</info>
+
+	<guiprefs height="600" resizable="yes" width="800">
+		<laf name="liquid">
+			<os family="windows" />
+		</laf>
+	</guiprefs>
+
+	<locale>
+		<!-- only keep the languages which are also available in gvSIG -->
+		<langpack iso3="spa"/>
+		<langpack iso3="val"/>
+		<langpack iso3="eng"/>
+	<!--	<langpack iso3="cat"/>
+		<langpack iso3="chn"/> -->
+		<langpack iso3="cze"/>
+	<!--	<langpack iso3="dan"/> -->
+		<langpack iso3="deu"/>
+	<!--	<langpack iso3="fin"/>-->
+		<langpack iso3="fra"/>
+		<langpack iso3="glg"/>
+	<!--	<langpack iso3="hun"/> -->
+		<langpack iso3="ita"/>
+	<!--	<langpack iso3="jpn"/>
+		<langpack iso3="mys"/>
+		<langpack iso3="ned"/>
+		<langpack iso3="nor"/>
+		<langpack iso3="pol"/> -->
+		<langpack iso3="por"/>
+	<!--	<langpack iso3="rom"/>
+		<langpack iso3="rus"/>
+		<langpack iso3="scg"/>
+		<langpack iso3="svk"/>
+		<langpack iso3="swe"/>
+		<langpack iso3="ukr"/> -->
+	</locale>
+
+	<native os="windows" type="izpack" name="ShellLink.dll"/>
+
+	<resources>
+		<res src="resources/gpl.txt" id="LicencePanel.licence"/>
+		<res src="resources/LEEME.html" id="HTMLInfoPanel.info"/>
+		<res src="resources/images/Logo_gvsig_gva.jpg" id="Installer.image"/>
+				<res src="resources/userInputSpec.xml" id="userInputSpec.xml"/>
+                <parsable os="windows" targetfile="resources/userInputSpec.xml"/>
+                <res src="resources/userInputLang.xml_val" id="userInputLang.xml_val" />
+                <res src="resources/userInputLang.xml_spa" id="userInputLang.xml_spa" />
+>
+	</resources>
+
+	<panels>
+		<panel classname="HTMLInfoPanel"/>
+		<panel classname="LicencePanel"/>
+		<panel classname="PacksPanel"/>
+		<panel classname="UserInputPanel"/>
+		<panel classname="InstallPanel"/>
+		<panel classname="SimpleFinishPanel"/>
+	</panels>
+
+	<packs>
+
+    <pack name="Extension Piloto redes" required="yes">
+      <description>Extension piloto de redes</description>
+      <file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/" src="extensiones/com.iver.cit.gvsig.graph" override="true"/>
+      <file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/" src="../../../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.cit.gvsig.graph-fmap-gvsig.jar" override="true"/>
+      <file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/" src="../../../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.cit.gvsig.jar" override="true"/>
+    </pack>
+    
+	</packs>
+
+</installation>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/install.xml
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_deu
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_deu	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_deu	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_deu
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_ita
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_ita	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_ita	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_ita
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/launcher-Win32.ini
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/launcher-Win32.ini	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/launcher-Win32.ini	(revision 12191)
@@ -0,0 +1,123 @@
+[default]
+; Nombre de la aplicacion
+appname = gvSIG Piloto redes
+
+; Ruta al achivo Jar a lanzar
+jar = %JARNAME%
+
+
+; Comando a ejecutar:
+;    Admite remplazo de variable:
+;	* #JAVA# ejecutable de java
+;	* #JAVA_HOME# path del Java_home
+;	* #JAR# el valor de la variable 'jar' de este fichero
+;	* #ARGS# cadena con todos los argumentos con los que se ha llamado al lanzador
+;	* #ARG1#, #ARG2#, ... #ARG9#: parametro recivido en 'n' lugar
+;	* #ARG0#: Nombre del ejecutable del lanzador
+;    Tambien admite los valores de la seccion 'Variables' encerrados entre
+;    el caracter almuadilla '#'
+; 	 * Nota: los nombres de las variables son case sensitive
+command = #JAVA# -jar #JAR#
+
+
+
+
+; Lanzar el Jar en ansincrono o no:
+;     * si(se lanza el javaw.exe y finaliza el lanzador):S SI YES Y 1
+;     * si(el lanzado se espera a que termine la ejecucion del javaw.exe):{distinto de los anterirores}
+launchJarAsync = 0
+
+; Modo: dice si se va a usar en modo lanzador de la instalacion o de la aplicacion
+; (De momento solo afecta al titulo)
+;     * Instalacion: INSTALL
+;     * Applicacion: APPLICATION
+launchMode = INSTALL
+
+; Realizar la comprobaciones o no:
+;     * si(por defecto):S SI YES Y 1
+;     * no(debera estar especificado el parametro'jre_home'):{distinto de los anterirores}
+doChecks = YES
+
+; Ruta el Java_home a usar en caso de 'doChecks-->No'
+jre_home =
+;ejemplo: jre_home = C:/Archivos de programa/Java/j2re1.4.2_11
+
+
+; Habilita la pregunta al usuario de si hay que hacer las comprobaciones de JRE etc...
+;     - por defecto se hace la pregunta
+;     - Si la respuesta del usario es 'no' se solicita la usuario que indique el ejectuable de la JRE
+;     * si(se pregunta al usario):S SI YES Y 1
+;     * no(no se pregunta y se realizan las comprobaciones):{distinto de los anterirores}
+askForCheckingProcess = SI
+
+
+
+; Version de JRE requerida
+jre_version = 1.4.2
+jre_version_prefered = 1.4.2_06
+
+
+
+; Descarga remota
+; 	* los valores valido de downloadEnabled son:
+;		- habilitado: S SI YES Y 1
+;		- deshabilitado: {distinto de los anteriores}
+downloadEnabled = 1
+
+
+
+; Path del instalable del jre (si no existe y estan
+;	habilitadas las descargas, lo dejara aqui)
+jre = j2re-1_4_2_06-windows-i586-p.exe
+downloadJre = http://www.gvsig.gva.es/fileadmin/conselleria/images/Documentacion/descargas/software/windows/j2re-1_4_2_06-windows-i586-p.exe
+
+
+
+; Path del instalable del jai (si no existe y estan
+;	habilitadas las descargas, lo dejara aqui)
+jai = jai-1_1_2_01-lib-windows-i586-jre.exe
+;downloadJai = http://www.gvsig.org/jai-1_1_2_01-lib-windows-i586-jre.exe
+downloadJai = http://www.gvsig.gva.es/fileadmin/conselleria/images/Documentacion/descargas/software/windows/jai-1_1_2_01-lib-windows-i586-jre.exe
+
+
+
+; Path del instalable del jai io (si no existe y estan
+;	habilitadas las descargas, lo dejara aqui)
+jai_io = jai_imageio-1_0_01-lib-windows-i586-jre.exe
+downloadJai_io = http://www.gvsig.gva.es/fileadmin/conselleria/images/Documentacion/descargas/software/windows/jai_imageio-1_0_01-lib-windows-i586-jre.exe
+
+
+
+; Esta seccion indica una lista de fichero a
+; copiar antes de lanzar el comando.
+; Los ficheros se copiaran si no existen en el
+; destino.
+; Destino puede ser un directorio, pero debe finalizar
+; con '/'
+; Pueden usarse variables declaradas en la
+; seccion 'variables' colocadas entre '#'
+;  * Nota: los nombres de las variables son case sensitive
+; Requiere los valores:
+;	* source1: primer fichero origen
+;	* target1: primer destino
+;	* source2: segundo fichero origen
+;	* target2: segundo destino
+;	...
+;	* source{n}: 'n' fichero origen
+;	* target{n}: 'n' destino
+[CopyRequiredFiles]
+source1=
+target1=
+
+source2=
+target2=
+
+source3=
+target3=
+
+
+; En esta seccion se pueden definir valores 
+; que se pueden utilizar en el parametro 'command'
+; o en la copia de los ficheros
+;  * Nota: los nombres son case sensitive
+[Variables]

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/launcher-Win32.ini
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_por
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_por	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_por	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_por
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/gpl.txt
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/gpl.txt	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/gpl.txt	(revision 12191)
@@ -0,0 +1,125 @@
+	GNU GENERAL PUBLIC LICENSE
+	Version 2, June 1991
+
+	 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.
+
+		Preamble
+
+	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.
+
+	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.
+
+	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.
+
+	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
+rights.
+
+	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.
+
+	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.
+
+	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.
+
+	The precise terms and conditions for copying, distribution and modification follow.
+
+				GNU GENERAL PUBLIC LICENSE
+	TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+	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".
+
+	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.
+
+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.
+
+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.
+
+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:
+
+a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
+
+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.
+
+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.)
+
+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.
+
+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.
+
+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.
+
+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:
+
+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,
+
+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,
+
+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.)
+
+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.
+
+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.
+
+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.
+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.
+
+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.
+
+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.
+You are not responsible for enforcing compliance by third parties to this License.
+
+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.
+
+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.
+
+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.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+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.
+
+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.
+
+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.
+
+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.
+
+NO WARRANTY
+
+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.
+
+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.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+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.
+
+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.
+
+<one line to give the program's name and a brief idea of what it does.> Copyright (C) <year>  <name of author>
+
+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.
+
+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.
+
+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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
+
+Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
+
+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.
+
+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:
+
+Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+<signature of Ty Coon>, 1 April 1989
+Ty Coon, President of Vice
+
+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.
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/gpl.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_cze
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_cze	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_cze	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_cze
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_val
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_val	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_val	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Ruta a gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_val
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_spa
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_spa	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_spa	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Ruta a gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_spa
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/ico-gvSIG.ico
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/ico-gvSIG.ico
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/help.ico
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/help.ico
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/uninstall16x16.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/uninstall16x16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/ico-gvSIG.JPG
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/ico-gvSIG.JPG
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/papelera.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/papelera.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/ico-gvSIG.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/ico-gvSIG.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/Logo_gvsig_gva.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/Logo_gvsig_gva.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/help.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/help.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/uninstall1.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/uninstall1.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/ico-gvSIG16x16.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/ico-gvSIG16x16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/Logo-gvSIG.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/Logo-gvSIG.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/help16x16.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/help16x16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/uninstall.ico
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/uninstall.ico
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/ico-gvSIG.GIF
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/ico-gvSIG.GIF
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/help.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/help.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/uninstall.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/images/uninstall.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_cat
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_cat	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_cat	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Ruta a gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_cat
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_fra
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_fra	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_fra	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_fra
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_eng
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_eng	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_eng	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputLang.xml_eng
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputSpec.xml
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputSpec.xml	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputSpec.xml	(revision 12191)
@@ -0,0 +1,21 @@
+<userInput>
+	<panel order="0">
+		<field 	type="search" 
+				variable="INSTALL_PATH"
+				size="45">
+  			<description align="left" />
+  			<spec 	txt="Path to gvSIG:" 
+		  			id="text.label"
+  					checkfilename="bin/andami.jar"
+        			type="directory" 
+        			result="directory">
+  			<choice value="/usr/local/gvSIG_1.0" os="unix" />
+  			<choice value="/opt/gvSIG_1.0" os="unix" />
+  			<choice value="$USER_HOME/gvSIG_1.0" os="unix" />
+  			<choice value="C:\Archivos de Programa\gvSIG_1.0" os="windows" />
+  			<choice value="C:\Program Files\gvSIG_1.0" os="windows" />
+  			</spec>
+		</field>
+	</panel>
+</userInput>
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/userInputSpec.xml
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/LEEME.html
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/LEEME.html	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/LEEME.html	(revision 12191)
@@ -0,0 +1,66 @@
+<html>
+<head>
+<style type="text/css">
+html, body, h1, h2, h3, h4, div, p, ul, li, input {
+   font-family: Arial, Helvetica, sans-serif;
+}
+
+h1 {
+   font-size: large;
+}
+
+h2 {
+   font-size: large;
+}
+
+h3 {
+   font-size: medium;
+}
+</style>
+</head>
+<body>
+<h1>gvSIG, el SIG en software libre de la Generalitat Valenciana
+(http://www.gvsig.gva.es).</h1>
+
+<h2>Autores:</h2>
+<ul>
+<li>Generalitat Valenciana
+ (Conselleria d'Infraestructures i Transport).</li>
+<li>Iver Tecnolog&iacute;as de la Informaci&oacute;n S.A.</li>
+</ul>
+
+<p>Software con licencia GNU/GPL
+(http://www.fsf.org/licensing/licenses/gpl.html)</p>
+
+<p>Contacto:
+	gvsig@gva.es<p>
+
+<h2>Requisitos de la aplicaci&oacute;n:</h2>
+<h3>Sistema</h3>
+<ul>
+<li>M&iacute;nimos: Pentium III / 256 MB RAM.</li>
+<li>Recomendables: Pentium IV / 512 MB RAM.</li>
+<li>Sistemas operativos: plataformas Windows y Linux.
+ Probado en Win98/XP, Linux Suse 8.2/9.0/9.2 y Linux Debian (Lliurex).</li>
+</ul>
+
+<h3>Software instalado</h3> (disponible en http://www.gvsig.gva.es o en http://java.sun.com)
+<ul>
+<li>M&aacute;quina Virtual Java 1.4.2 (06 o superior).</li>
+<li>JAI (Java Advanced Imaging).</li>
+<li>JAI Image I/O.</li>
+</ul>
+
+<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>
+
+<h2>M&aacute;s informaci&oacute;n y soporte en:</h2>
+<h3> Web oficial del proyecto:</h3>
+	http://www.gvsig.gva.es
+
+<h3>Listas de distribuci&oacute;n:</h3>
+<span style="monospace"> http://runas.cap.gva.es/mailman/listinfo/gvsig_usuarios</span> (soporte para usuarios).
+<span style="monospace"> http://runas.cap.gva.es/mailman/listinfo/gvsig_desarrolladores</span> (soporte para desarrolladores).
+<span style="monospace"> http://runas.cap.gva.es/mailman/listinfo/gvsig_internacional</span> (soporte para desarrolladores o usuarios de habla no hispana).
+
+</body>
+</html>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/resources/LEEME.html
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/.cvsignore
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/.cvsignore	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/.cvsignore	(revision 12191)
@@ -0,0 +1,2 @@
+./libs
+w32
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/.cvsignore
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/build.xml
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/build.xml	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/build.xml	(revision 12191)
@@ -0,0 +1,27 @@
+<project name="instalador-gvSIG" default="init" basedir=".">
+	<property name="dir_inst" location="/usr/local"/>
+	<property name="base_dir" location="./"/>		
+	<property name="izpack_dir" location="${INSTALL_GVSIG_PATH}/IzPack"/>
+	<property name="dir_libs" location="${izpack_dir}/lib"/>
+	
+	<taskdef name="izpack" classpath="${dir_libs}/compiler.jar" classname="com.izforge.izpack.ant.IzPackTask"/>
+	
+	<target name="init">
+		<izpack input="install.xml" 
+				output="${JARNAME}" 
+				installerType="standard" 
+				basedir="${base_dir}" 
+				izPackDir="${izpack_dir}/"/>
+	</target>
+	
+	<target name="clean">
+		<delete>
+			<fileset dir=".">
+			    <include name="**.zip"/>
+			</fileset>
+		</delete>
+		<delete dir="bin" />
+		<delete dir="extensions" />
+	</target>
+	
+</project>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows/build.xml
___________________________________________________________________
Added: svn:eol-style
   + native


Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/windows
___________________________________________________________________
Added: svn:ignore
   + ./libs
w32


Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/HOWTO-BUILD.txt
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/HOWTO-BUILD.txt	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/HOWTO-BUILD.txt	(revision 12191)
@@ -0,0 +1,8 @@
+ C�MO GENERAR EL INSTALADOR:
+ ===========================
+- gvSIG debe estar correctamente construido en ../_fwAndami/bin 
+- Debe de estar el proyecto /var/lib/cvs_gvSIG/gvSIG-project/install en el workspace.
+- 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, etc. La variable  APPNAME normalmente valdr� "gvSIG", pero puede tiener nombre si estamos empaquetando una extensi�n (por ejemplo,  "nomenclatorIGN").
+- Definir los packs adecuados en el fichero XML de configuraci�n (install.xml), y revisar el fichero en general.
+- Definir las extensiones a incluir en el directorio variables.sh.
+- Lanzar el script distribucion.sh.

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/old/HOWTO-BUILD.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/variables.sh
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/variables.sh	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/variables.sh	(revision 12191)
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+export APPNAME=gvSIG_pilot_redes
+export FULLVERSION='1.0'
+export TARGET_DIR=/tmp/"$APPNAME"/versiones
+#export TARGET_DIR=/mnt/sercartlin/grupo-sig-ca/Testing/Versiones/
+export MAIN_INSTALL_PLUGIN=com.iver.cit.gvsig.graph #Nombre del plugin que proporciona el 'build.nuber' para la distribucion
+
+## estas extensiones se muestran en los packs, y se puede elegir instalarlos o no
+## (el fichero install.xml tambien debe estar actualizado para reflejar esto)
+EXTENSIONS=(
+"$MAIN_INSTALL_PLUGIN"
+)

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/variables.sh
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/install.xml
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/install.xml	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/install.xml	(revision 12191)
@@ -0,0 +1,80 @@
+<installation version="1.0">
+	<info>
+		<appname>gvSIG_pitolo_redes_1.0</appname>
+		<appversion>1.0</appversion>
+		<authors>
+			<author name="Generalitat Valenciana. Conselleria d'Infraestructures i Transport" email="" />
+			<author name="Iver Tecnologías de la Información S.A." email="" />
+		</authors>
+		<url>http://www.gvsig.gva.es/</url>
+		<javaversion>1.4</javaversion>
+	</info>
+
+	<guiprefs height="600" resizable="yes" width="800">
+		<laf name="liquid">
+			<os family="unix" />
+		</laf>
+		<laf name="liquid">
+			<os family="windows" />
+		</laf>
+	</guiprefs>
+
+	<locale>
+		<langpack iso3="spa"/>
+		<langpack iso3="val"/>
+		<langpack iso3="eng"/>
+		<langpack iso3="cat"/>
+		<langpack iso3="chn"/>
+		<langpack iso3="cze"/>
+		<langpack iso3="dan"/>
+		<langpack iso3="deu"/>
+		<langpack iso3="fin"/>
+		<langpack iso3="fra"/>
+		<langpack iso3="glg"/>
+		<langpack iso3="hun"/>
+		<langpack iso3="ita"/>
+		<langpack iso3="jpn"/>
+		<langpack iso3="mys"/>
+		<langpack iso3="ned"/>
+		<langpack iso3="nor"/>
+		<langpack iso3="pol"/>
+		<langpack iso3="por"/>
+		<langpack iso3="rom"/>
+		<langpack iso3="rus"/>
+		<langpack iso3="scg"/>
+		<langpack iso3="svk"/>
+		<langpack iso3="swe"/>
+		<langpack iso3="ukr"/>
+	</locale>
+
+	<resources>
+		<res src="resources/gpl.txt" id="LicencePanel.licence"/>
+		<res src="resources/LEEME.html" id="HTMLInfoPanel.info"/>
+		<res src="resources/images/Logo_gvsig_gva.jpg" id="Installer.image"/>
+		<res src="resources/userInputSpec.xml" id="userInputSpec.xml"/>
+                <parsable os="linux" targetfile="resources/userInputSpec.xml"/>
+                <res src="resources/userInputLang.xml_val" id="userInputLang.xml_val" />
+                <res src="resources/userInputLang.xml_spa" id="userInputLang.xml_spa" />
+	</resources>
+
+	<panels>
+		<panel classname="HTMLInfoPanel"/>
+		<panel classname="LicencePanel"/>
+		<panel classname="PacksPanel"/>
+		<panel classname="UserInputPanel"/>
+		<panel classname="InstallPanel"/>
+		<panel classname="SimpleFinishPanel"/>
+	</panels>
+
+	<packs>
+
+    <pack name="Piloto redes" required="yes">
+      <description>Aplicacion ganadora del Concurso de redes</description>
+      <file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/" src="extensiones/com.iver.cit.gvsig.graph" override="true"/>
+      <file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/" src="../../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.cit.gvsig.graph-fmap-gvsig.jar" override="true"/>
+      <file targetdir="$INSTALL_PATH/bin/gvSIG/extensiones/com.iver.cit.gvsig/lib/" src="../../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/lib/com.iver.cit.gvsig.graph-gvsig.jar" override="true"/>
+    </pack>
+
+</packs>
+
+</installation>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/install.xml
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/distribucion.sh
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/distribucion.sh	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/distribucion.sh	(revision 12191)
@@ -0,0 +1,235 @@
+#!/bin/bash
+
+# Si se produce un error, salimos inmediatamente
+set -e
+
+
+# Obtenemos el locale
+LOC=`echo $LANG | sed 's/_.*//'`
+
+# Comprobar que estamos en el directorio adecuado
+if [ "$LOC" = "es" ] ; then
+  ERROR_BASEDIR="Este script debe invocarse desde el directorio  \'install\' del proyecto"
+else
+  ERROR_BASEDIR="This script must be run from the \'install\' directory of the project"
+fi
+if [ ! -d ../../install/instalador-gvSIG-lin ] || [ ! -d ../../install/instalador-gvSIG-win ] || [ ! -d ../../_fwAndami ] ; then
+        echo $ERROR_BASEDIR
+        exit 1 ;
+fi
+
+DIR_BASE=`pwd`
+GVSIG_INSTALLDIR=`readlink -f ../../install`
+ANDAMI_DIR=`readlink -f ../../_fwAndami`
+
+source variables.sh
+# Get a version with format 1_0_alpha
+UNDERSCORE_VERSION=`echo $FULLVERSION | sed 'y/./_/'`
+# Get a version with format 10_alpha
+BRIEFVERSION=`echo $FULLVERSION | sed 's/\.//'`
+# The name of the dir which will be ZIPed, containing the resulting installer
+INSTALLER_DIR="$APPNAME"-$FULLVERSION\_installer
+JARNAME="$APPNAME"-"$FULLVERSION".jar
+# The extension targets on the this version of gvSIG:
+GVSIG_VERSION=1.0
+
+BUILDNUMBER=`sed -n 's/build.number=//p' "$ANDAMI_DIR"/gvSIG/extensiones/"$MAIN_INSTALL_PLUGIN"/build.number`
+
+#ZIPNAME="$APPNAME"-"$UNDERSCORE_VERSION"\_"$BUILDNUMBER".zip
+DIR_LIN=.
+DIR_WIN=.
+
+DIR_LIN_GVSIG="$GVSIG_INSTALLDIR"/instalador-gvSIG-lin
+DIR_WIN_GVSIG="$GVSIG_INSTALLDIR"/instalador-gvSIG-win
+
+
+WINDOWSZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-windows-i586.7z
+LINUXZIP="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-linux-i586.tgz
+
+LINUXBIN="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-linux-i586.bin
+
+WINDOWSEXE="$APPNAME"-"$BRIEFVERSION"\_"$BUILDNUMBER"-windows-i586.exe
+
+#Directorios
+#OUTPUT_DIR=/mnt/sercartlin/grupo-sig-ca/Testing/Versiones/v"$FULLVERSION"\_"$BUILDNUMBER"
+OUTPUT_DIR="$TARGET_DIR"/v"$FULLVERSION"\_"$BUILDNUMBER"
+PATH_SOURCE_EXT="$ANDAMI_DIR"/gvSIG/extensiones
+
+
+echo "*****************"
+echo "      BASE       "
+echo "*****************"
+
+cd "$DIR_BASE"/
+rm bin -rf
+mkdir -p bin/gvSIG/extensiones
+#cp "$DIR_WIN_GVSIG"/installer_files/LEEME "$DIR_WIN_GVSIG"installer_files/LLIG-ME "$DIR_WIN_GVSIG"installer_files/README bin
+cp resources/gpl.txt bin
+# No enlazamos directamente el directorio lib para no incluir el directorio CVS
+mkdir -p bin/lib
+cd "$DIR_BASE"/bin/lib
+for i in "$ANDAMI_DIR"/lib/*.jar ; do
+  ln -s "$i" .
+done
+for i in "$ANDAMI_DIR"/lib/*.zip ; do
+  ln -s "$i" .
+done
+cd "$DIR_BASE"/
+ln -s "$ANDAMI_DIR"/andami.jar bin/
+ln -s "$ANDAMI_DIR"/castor.properties bin/
+#cp resources/andami-config.xml bin
+echo OK.
+
+
+# Para Windows
+#Copiamos el lanzador y sus tracuciones al tmpResources
+rm -Rf tmpResources
+mkdir tmpResources
+cp -R "$GVSIG_INSTALLDIR"/launcher/izpack-launcher-1.3/dist/* ./tmpResources
+mv ./tmpResources/launcher-Win32.exe ./tmpResources/gvSIG.exe
+#Quitamos el ini, manifest y los CVS
+rm ./tmpResources/*.ini ./tmpResources/*.manifest
+find ./tmpResources -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true
+echo OK.
+
+# Estas extensiones se copian directamente al directorio destino, ya que no vamos a dar
+# opcion a no instalarlas, son obligatorias
+cd "$DIR_BASE"
+i=0
+while [ ! -z ${MANDATORY_EXTENSIONS[$i]} ]
+do
+  echo ln -s "$PATH_SOURCE_EXT"/${MANDATORY_EXTENSIONS[$i]} bin/gvSIG/extensiones
+  ln -s "$PATH_SOURCE_EXT"/${MANDATORY_EXTENSIONS[$i]} bin/gvSIG/extensiones
+  i=`expr $i + 1`
+done
+
+echo "*****************"
+[ $LOC = "es" ] && echo "   EXTENSIONES   "
+[ $LOC != "es" ] && echo "   EXTENSIONS   "
+echo "*****************"
+
+rm -rf extensiones
+mkdir extensiones
+
+i=0
+while [ ! -z ${EXTENSIONS[$i]} ]
+do
+  [ $LOC = "es" ] && echo "Enlazando "${EXTENSIONS[$i]}
+  [ $LOC != "es" ] && echo "Linking "${EXTENSIONS[$i]}
+  echo ln -s "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} extensiones
+  ln -s "$PATH_SOURCE_EXT"/${EXTENSIONS[$i]} extensiones
+  i=`expr $i + 1`
+done
+
+echo "*****************"
+echo "    INST     "
+echo "*****************"
+# Generar el instalador (jar)
+cd "$DIR_BASE"/
+rm "$JARNAME" -f
+ant -DJARNAME="$JARNAME" -DGVSIG_VERSION="$GVSIG_VERSION" -DAPPNAME="$APPNAME"
+
+
+echo "******************"
+[ $LOC = "es" ] && echo " GENERAR DISTRIB "
+[ $LOC != "es" ] && echo " GENERATE DISTRIB "
+echo "******************"
+# Generar el tar.gz para Linux y el EXE para Windows
+
+mkdir -p "$OUTPUT_DIR"
+echo "- Linux"
+## Nueva instalacion para linux
+rm -Rf "$INSTALLER_DIR"
+mkdir -p "$INSTALLER_DIR"/tmp_gvSIGInstall
+cp "$JARNAME" "$INSTALLER_DIR"/tmp_gvSIGInstall
+cd "$INSTALLER_DIR"
+chmod u+x "$GVSIG_INSTALLDIR"/launcher/izpack-launcher-1.3_linux/dist/launcher-Linux
+cp -R "$GVSIG_INSTALLDIR"/launcher/izpack-launcher-1.3_linux/dist/* ./tmp_gvSIGInstall
+chmod a+x ./tmp_gvSIGInstall/launcher-Linux
+find . -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true
+
+sed "s/%JARNAME%/$JARNAME/" ./tmp_gvSIGInstall/launcher.ini > ./tmp_gvSIGInstall/launcher.ini.bak
+mv ./tmp_gvSIGInstall/launcher.ini.bak ./tmp_gvSIGInstall/launcher.ini;
+
+tar -cvzf ./tmp.tgz ./tmp_gvSIGInstall
+echo '#!/bin/sh' > xx.tmp
+lcount=`cat xx.tmp "$GVSIG_INSTALLDIR"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh | wc -l`
+lcount=$(($lcount+2)) # sumamos dos: uno por la linea siguiente y otro para el inicio
+echo "lcount=$lcount" >> xx.tmp
+cat xx.tmp "$GVSIG_INSTALLDIR"/launcher/izpack-launcher-1.3_linux/h_gvSIG-install.sh ./tmp.tgz  > "$LINUXBIN"
+rm xx.tmp
+chmod a+x "$LINUXBIN"
+mv "$LINUXBIN" "$OUTPUT_DIR"
+cd "$DIR_BASE"/
+rm -Rf "$INSTALLER_DIR"
+## Fin Nueva instalacion para linux
+
+## Para Windows
+echo "- Windows"
+#set -x
+cd "$DIR_BASE"
+rm -Rf "$INSTALLER_DIR"
+
+mkdir "$INSTALLER_DIR"
+cp -aR "$GVSIG_INSTALLDIR"/launcher/izpack-launcher-1.3/dist/* "$INSTALLER_DIR"
+rm -f "$INSTALLER_DIR"/install.bat
+
+find "$INSTALLER_DIR" -name CVS -type d -exec rm -rf {} 2> /dev/null ';' || true
+
+## hacemos las sustituciones de la variable
+sed "s/%JARNAME%/$JARNAME/" "$INSTALLER_DIR"/launcher-Win32.ini > "$INSTALLER_DIR"/launcher-Win32.ini.bak
+mv "$INSTALLER_DIR"/launcher-Win32.ini.bak "$INSTALLER_DIR"/launcher-Win32.ini;
+
+
+mv "$JARNAME" "$INSTALLER_DIR"
+cd "$INSTALLER_DIR"
+
+if [ -f  "$DIR_BASE"/"$WINDOWSZIP" ] ; then
+	rm -f "$DIR_BASE"/"$WINDOWSZIP"
+fi
+chmod u+x "$GVSIG_INSTALLDIR"/launcher/7z/7za
+"$GVSIG_INSTALLDIR"/launcher/7z/7za a -r "$DIR_BASE"/"$WINDOWSZIP" *
+cd -
+sed "s/%TITLE%/$APPNAME-$BRIEFVERSION\_$BUILDNUMBER/" "$GVSIG_INSTALLDIR"/launcher/7z/dist_config.txt > dist_config.txt
+cat "$GVSIG_INSTALLDIR"/launcher/7z/7zS.sfx  dist_config.txt "$WINDOWSZIP" > "$WINDOWSEXE"
+
+###
+
+
+rm dist_config.txt
+rm "$WINDOWSZIP"
+
+rm -Rf "$INSTALLER_DIR"
+
+mv "$WINDOWSEXE" "$OUTPUT_DIR"
+
+# Limpiamos tmpResources
+cd "$DIR_BASE"/
+rm -r ./tmpResources
+cd -
+
+## Limpiamos
+
+rm -rf extensiones
+rm -rf bin
+
+echo "******************"
+[ $LOC = "es" ] && echo " GENERAR FUENTES "
+[ $LOC != "es" ] && echo " GENERATE SOURCES "
+echo "******************"
+
+cd ..
+ant generate-source-package
+mv dist-src/gv*-src.zip "$OUTPUT_DIR"
+cd -
+
+
+echo "*****************"
+echo "    FIN     "
+echo "*****************"
+
+echo ""
+echo "Generados los ficheros:"
+echo "$OUTPUT_DIR"
+ls -lh "$OUTPUT_DIR"
+cd "$DIR_BASE"

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/distribucion.sh
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_spa
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_spa	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_spa	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Ruta a gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_spa
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/Leeme-predes.txt
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/Leeme-predes.txt	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/Leeme-predes.txt	(revision 12191)
@@ -0,0 +1,44 @@
+Piloto Redes versi�n 1.0 (Build Number #build.number#):
+
+Antes de comenzar compruebe los siguientes puntos:
+
+1.- Descargue los fuentes de la v1.0.2 de gvSIG. Siga los pasos all� indicados en el archivo 'Leeme.txt' para obtener un entorno de desarrollo funcional.
+
+*** Compilaci�n
+
+1.- Descomprima este paquete dentro del directorio de fuentes que acaba de preparar ( gvSIG-1_0_2-src).
+
+2.- (S�lo si usa eclipse) Importe los proyectos que acaba de descomprimir:
+  *1: Men� File/Import.
+  *2: Seleccione 'Existing Projects into workspace' y 'Next'
+  *3: Con la opci�n 'Select root directory' pulse 'Browse...'
+  *4: Sit�ese en el directorio del workspace (normalmente el dialogo ya se encuentra en �l) y pulse 'Aceptar'.
+  *5: Pulse 'Deselect All'
+  *6: Marque los siguientes proyectos de la lista: extGraph_predes.
+  *7: Pulse 'Finish'.
+
+3.- Ejecute el 'build.xml' del proyecto 'extGraph_predes' (usando ant o eclipse).
+
+*** Ejecuci�n
+
+Una vez compilado el proyecto, aparecer�n los men�s y opciones para la generaci�n de topolog�as de las redes y del proceso 'Camino M�nimo'.
+
+Tambi�n se activar� en el panel de propiedades de las capas vectoriales el nuevo tipo de simbolog�a 'Densidad de puntos'.
+
+*** Compilaci�n despu�s de modificar los fuentes
+
+Despu�s de modificar las fuentes de los proyectos del piloto, debe ejecutar los 'build.xml' de los proyectos en el orden siguiente (usando ant o eclipse):
+
+  *1 libFMap
+  *2 appgvSIG
+  *3 extGraph_predes
+
+Ante cualquier problema:
+
+Apuntese a la lista de desarrolladores de gvSIG y pregunte all� (http://www.gvsig.gva.es).
+
+Gracias por desarrollar sobre gvSIG.
+
+Un saludo.
+
+Equipo gvSIG.

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/Leeme-predes.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/uninstall1.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/uninstall1.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/ico-gvSIG16x16.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/ico-gvSIG16x16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/Logo-gvSIG.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/Logo-gvSIG.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/help16x16.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/help16x16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/uninstall.ico
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/uninstall.ico
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/ico-gvSIG.GIF
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/ico-gvSIG.GIF
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/help.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/help.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/uninstall.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/uninstall.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/ico-gvSIG.ico
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/ico-gvSIG.ico
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/help.ico
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/help.ico
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/uninstall16x16.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/uninstall16x16.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/ico-gvSIG.JPG
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/ico-gvSIG.JPG
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/papelera.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/papelera.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/ico-gvSIG.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/ico-gvSIG.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/Logo_gvsig_gva.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/Logo_gvsig_gva.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/help.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/images/help.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_cat
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_cat	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_cat	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Ruta a gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_cat
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_fra
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_fra	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_fra	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_fra
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_eng
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_eng	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_eng	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_eng
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputSpec.xml
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputSpec.xml	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputSpec.xml	(revision 12191)
@@ -0,0 +1,31 @@
+<userInput>
+	<panel order="0">
+		<field 	type="search" 
+				variable="INSTALL_PATH"
+				size="45">
+  			<description align="left" />
+  			<spec 	txt="Path to gvSIG:" 
+		  			id="text.label"
+  					checkfilename="bin/andami.jar"
+        			type="directory" 
+        			result="directory">
+  			<choice value="/usr/local/gvSIG_1.0" os="unix" />
+  			<choice value="/usr/local/gvSIG_1.0.1" os="unix" />
+  			<choice value="/usr/local/gvSIG_1.0.2" os="unix" />
+  			<choice value="/opt/gvSIG_1.0" os="unix" />
+  			<choice value="/opt/gvSIG_1.0.1" os="unix" />
+  			<choice value="/opt/gvSIG_1.0.2" os="unix" />
+  			<choice value="$USER_HOME/gvSIG_1.0" os="unix" />
+  			<choice value="$USER_HOME/gvSIG_1.0.1" os="unix" />
+  			<choice value="$USER_HOME/gvSIG_1.0.2" os="unix" />
+  			<choice value="C:\Archivos de Programa\gvSIG_1.0" os="windows" />
+  			<choice value="C:\Archivos de Programa\gvSIG_1.0.1" os="windows" />
+  			<choice value="C:\Archivos de Programa\gvSIG_1.0.2" os="windows" />
+  			<choice value="C:\Program Files\gvSIG_1.0" os="windows" />
+  			<choice value="C:\Program Files\gvSIG_1.0.1" os="windows" />
+  			<choice value="C:\Program Files\gvSIG_1.0.2" os="windows" />
+  			</spec>
+		</field>
+	</panel>
+</userInput>
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputSpec.xml
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/LEEME.html
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/LEEME.html	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/LEEME.html	(revision 12191)
@@ -0,0 +1,66 @@
+<html>
+<head>
+<style type="text/css">
+html, body, h1, h2, h3, h4, div, p, ul, li, input {
+   font-family: Arial, Helvetica, sans-serif;
+}
+
+h1 {
+   font-size: large;
+}
+
+h2 {
+   font-size: large;
+}
+
+h3 {
+   font-size: medium;
+}
+</style>
+</head>
+<body>
+<h1>gvSIG, el SIG en software libre de la Generalitat Valenciana
+(http://www.gvsig.gva.es).</h1>
+
+<h2>Autores:</h2>
+<ul>
+<li>Generalitat Valenciana
+ (Conselleria d'Infraestructures i Transport).</li>
+<li>Iver Tecnolog&iacute;as de la Informaci&oacute;n S.A.</li>
+</ul>
+
+<p>Software con licencia GNU/GPL
+(http://www.fsf.org/licensing/licenses/gpl.html)</p>
+
+<p>Contacto:
+	gvsig@gva.es<p>
+
+<h2>Requisitos de la aplicaci&oacute;n:</h2>
+<h3>Sistema</h3>
+<ul>
+<li>M&iacute;nimos: Pentium III / 256 MB RAM.</li>
+<li>Recomendables: Pentium IV / 512 MB RAM.</li>
+<li>Sistemas operativos: plataformas Windows y Linux.
+ Probado en Win98/XP, Linux Suse 8.2/9.0/9.2 y Linux Debian (Lliurex).</li>
+</ul>
+
+<h3>Software instalado</h3> (disponible en http://www.gvsig.gva.es o en http://java.sun.com)
+<ul>
+<li>M&aacute;quina Virtual Java 1.4.2 (06 o superior).</li>
+<li>JAI (Java Advanced Imaging).</li>
+<li>JAI Image I/O.</li>
+</ul>
+
+<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>
+
+<h2>M&aacute;s informaci&oacute;n y soporte en:</h2>
+<h3> Web oficial del proyecto:</h3>
+	http://www.gvsig.gva.es
+
+<h3>Listas de distribuci&oacute;n:</h3>
+<span style="monospace"> http://runas.cap.gva.es/mailman/listinfo/gvsig_usuarios</span> (soporte para usuarios).
+<span style="monospace"> http://runas.cap.gva.es/mailman/listinfo/gvsig_desarrolladores</span> (soporte para desarrolladores).
+<span style="monospace"> http://runas.cap.gva.es/mailman/listinfo/gvsig_internacional</span> (soporte para desarrolladores o usuarios de habla no hispana).
+
+</body>
+</html>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/LEEME.html
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/Readme-predes.txt
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/Readme-predes.txt	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/Readme-predes.txt	(revision 12191)
@@ -0,0 +1,42 @@
+Network Extension Pilot version 1.0 (Build number #build.number#):
+
+Before starting, check the following points:
+
+1.- Download the sources for gvSIG v1.0.2. Follow the procedure described in the �Readme.txt� file to setup a working development environment.
+
+*** Compilation
+
+1.- Uncompress the pilot package into the source folder just created (gvSIG-1_0_2-src). Note: some files in the  'binaries' folder must be overwritten.
+
+2.- (Only if using Eclipse) Import the projects:
+  *1: Pick the the File/Import menu command.
+  *2: Choose 'Existing Projects into workspace' and hit 'Next'
+  *3: With the option 'Select root directory' press 'Browse...'
+  *4: Locate the workspace folder (normally, this should be the default) and hit 'Accept'.
+  *5: Click on 'Deselect All'
+  *6: Mark the following project from the list: extGraph_predes.
+  *7: Click on 'Finish'.
+
+3.- Run the 'build.xml' in the project 'extGraph_predes' (using  Ant or Eclipse).
+
+*** Execution
+
+After the projects have been compiled, new menu options will appear to generate network topologies and run Shortest Path calculationss.
+
+Also, in the property panel for vectorial layers, a new Dot Density symbology type will appear.
+
+*** Building after changes
+
+After modifying the pilot sources, the 'build.xml' within the projects must be run in the following order, using Ant or Eclipse:
+
+  *1 libFMap
+  *2 appgvSIG
+  *3 extGraph_predes
+
+For further assistance, please subscribe to the gvSIG developer list and send your questions there (see in http://www.gvsig.gva.es).
+
+Thanks for developing on gvSIG.
+
+Regards,
+
+The gvSIG Team
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/Readme-predes.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_deu
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_deu	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_deu	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_deu
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_ita
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_ita	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_ita	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_ita
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_por
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_por	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_por	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_por
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/gpl.txt
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/gpl.txt	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/gpl.txt	(revision 12191)
@@ -0,0 +1,125 @@
+	GNU GENERAL PUBLIC LICENSE
+	Version 2, June 1991
+
+	 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.
+
+		Preamble
+
+	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.
+
+	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.
+
+	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.
+
+	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
+rights.
+
+	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.
+
+	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.
+
+	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.
+
+	The precise terms and conditions for copying, distribution and modification follow.
+
+				GNU GENERAL PUBLIC LICENSE
+	TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+	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".
+
+	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.
+
+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.
+
+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.
+
+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:
+
+a) You must cause the modified files to carry prominent notices stating that you changed the files and the date of any change.
+
+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.
+
+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.)
+
+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.
+
+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.
+
+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.
+
+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:
+
+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,
+
+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,
+
+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.)
+
+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.
+
+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.
+
+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.
+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.
+
+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.
+
+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.
+You are not responsible for enforcing compliance by third parties to this License.
+
+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.
+
+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.
+
+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.
+
+This section is intended to make thoroughly clear what is believed to be a consequence of the rest of this License.
+
+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.
+
+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.
+
+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.
+
+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.
+
+NO WARRANTY
+
+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.
+
+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.
+
+END OF TERMS AND CONDITIONS
+
+How to Apply These Terms to Your New Programs
+
+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.
+
+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.
+
+<one line to give the program's name and a brief idea of what it does.> Copyright (C) <year>  <name of author>
+
+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.
+
+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.
+
+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
+
+
+Also add information on how to contact you by electronic and paper mail.
+
+If the program is interactive, make it output a short notice like this when it starts in an interactive mode:
+
+Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
+This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details.
+
+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.
+
+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:
+
+Yoyodyne, Inc., hereby disclaims all copyright interest in the program `Gnomovision' (which makes passes at compilers) written by James Hacker.
+
+<signature of Ty Coon>, 1 April 1989
+Ty Coon, President of Vice
+
+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.
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/gpl.txt
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_cze
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_cze	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_cze	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Path to gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_cze
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_val
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_val	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_val	(revision 12191)
@@ -0,0 +1,3 @@
+<langpack>
+  <str id="text.label" txt="Ruta a gvSIG:"/>
+</langpack>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/resources/userInputLang.xml_val
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/HOWTO-BUILD.txt
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/HOWTO-BUILD.txt	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/HOWTO-BUILD.txt	(revision 12191)
@@ -0,0 +1,11 @@
+ C�MO GENERAR EL INSTALADOR:
+ ===========================
+- Solo ejecutable desde Linux
+- gvSIG debe estar correctamente construido en ../_fwAndami/bin
+- El plugin principal debe dejar un fichero 'build.number' dentro de su directorio de andami, que indicara el numero del build para la distribuci�n.
+- Lanzar el target 'distribucion' del build.xml del plugin principal (solo para plugins).
+- El proyecto 'install' debe estar presente en la ra�z del workspace (contiene el Izpack, entre otras cosas)
+- 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").
+- Definir los packs adecuados en el fichero XML de configuraci�n (install.xml), y revisar el fichero en general.
+- 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
+- Lanzar el script distribucion.sh desde el directorio donde se encuentra (ejemplo: "cd workspace/extXXX/install ; ./distribucion.sh ").

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install/HOWTO-BUILD.txt
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native


Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/install
___________________________________________________________________
Added: svn:ignore
   + bin
extensiones
nomenclatorIGN-*.zip


Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/lib/colt.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/lib/colt.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/lib/commons-collections-testframework-3.2.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/lib/commons-collections-testframework-3.2.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/lib/concurrent.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/lib/concurrent.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/lib/commons-collections-3.2.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/lib/commons-collections-3.2.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/lib/jung-1.7.4.jar
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/lib/jung-1.7.4.jar
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/plantilla.htm
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/plantilla.htm	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/plantilla.htm	(revision 12191)
@@ -0,0 +1,96 @@
+<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
+<html>
+<head>
+<title>Documento sin t&iacute;tulo</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<style type='text/css'>
+<!--   .normal { 	font-family: Arial, Helvetica, sans-serif;	font-size: 10px; font-style: normal; color: #333333;} h1 {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 14px;
+}
+a {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 10px;
+	font-style: italic;
+	font-weight: bold;
+}
+.distancia {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 10px;
+	color: #666666;
+}
+.resumen {
+	font-family: Arial, Helvetica, sans-serif;
+	font-size: 12px;
+	color: #333333;
+}
+.left {
+	color: #990000;
+	font-weight: bold;
+}
+.right {
+	color: #0033FF;
+	font-weight: bold;
+}
+--> 
+</style>
+</head>
+
+<body>
+<h1>Informe de Ruta:SOMONTES AL PALACIO DE LA REAL QUINTA-MONTE CARMELO</h1>
+<br>
+<span class="resumen"> Salida desde: <b>SOMONTES AL PALACIO DE LA REAL QUINTA</b><br>
+Llegada a:<b> MONTE CARMELO</b><br>
+Longitud total del trayecto: <b>9,020.31</b></span> 
+<hr width ="70%">
+<table>
+  <tr>
+    <td width="40"><img src="images/drapeau_depart.gif" width="18" height="26"></td>
+    <td class='normal'>1. Salir de:<b> SOMONTES AL PALACIO DE LA REAL QUINTA</b></td></tr><tr>
+    <td width="40" class='normal'>&nbsp;
+    <td><a href="images/0">Ver sobre el mapa</a></tr></table><hr width ="70%">
+<table>
+  <tr>
+    <td width="40"><img src="images/turn-left.png" width="32" height="32"></td>
+    <td class='normal'>2 Contin�e por <b>SOMONTES AL PALACIO DE LA REAL QUINTA</b> 
+      durante 447.44 y gire a la <span class="left"><b>izquierda</b></span> por 
+      <b>M-30 (CTRA DEL PARDO)</b></td>
+  </tr><tr>
+    <td width="40">&nbsp;</td>
+    <td class="distancia">Distancia acumulada: 447.44 metros</td>
+  </tr><tr>
+    <td width="40">&nbsp;
+    <td><a href="images/0">Ver sobre el mapa</a></tr></table><hr width ="70%">
+<table>
+  <tr>
+    <td width="40"><img src="images/turn-left.png" width="32" height="32"></td>
+    <td class='normal'>3 Contin�e por <b>M-30 (CTRA DEL PARDO)</b> durante  2,320.58 y  gire a la <b>izquierda</b> por <b>LA ALBERCA</b></td></tr><tr>
+    <td width="40">&nbsp;</td>
+    <td class="distancia">Distancia acumulada: 2,768.02</td>
+  </tr><tr>
+    <td width="40">&nbsp;
+    <td><a href="images/1,2,3">Ver sobre el mapa</a></tr></table><hr width ="70%">
+<table>
+  <tr>
+    <td width="40"><img src="images/turn-right.png" width="32" height="32"></td>
+    <td class='normal'>4 Contin�e por <b>LA ALBERCA</b> durante 355.99 y gire 
+      a la <span class="right"><b>derecha</b></span> por <b>SOMONTES</b></td>
+  </tr><tr>
+    <td width="40">&nbsp;</td>
+    <td class="distancia">Distancia acumulada: 3,124.01</td>
+  </tr><tr>
+    <td width="40">&nbsp;
+    <td><a href="images/4,5,6">Ver sobre el mapa</a></tr></table>
+<hr width ="70%">
+<table>
+  <tr>
+    <td width="40"><img src="images/drapeau_arrivee.gif" width="18" height="26"></td>
+    <td class="resumen">16. Llegada: MONTE CARMELO</td>
+  </tr><tr>
+    <td width="40">&nbsp;</td>
+    <td class="distancia">Longitud: 9,020.31</td>
+  </tr><tr>
+    <td width="40">&nbsp;
+    <td><a href="images/24">Ver sobre el mapa</a></tr></table>
+ </body>
+</html>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/plantilla.htm
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/algorithms/SnapSimplePointInAreaLocator.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/algorithms/SnapSimplePointInAreaLocator.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/algorithms/SnapSimplePointInAreaLocator.java	(revision 12191)
@@ -0,0 +1,111 @@
+/*
+ * Created on 06-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-10-17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/09 19:10:56  azabala
+* First version in CVS
+*
+*
+*/
+package com.vividsolutions.jts.algorithms;
+
+import java.util.Iterator;
+
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryCollection;
+import com.vividsolutions.jts.geom.GeometryCollectionIterator;
+import com.vividsolutions.jts.geom.LinearRing;
+import com.vividsolutions.jts.geom.Location;
+import com.vividsolutions.jts.geom.Polygon;
+
+public class SnapSimplePointInAreaLocator extends
+		com.vividsolutions.jts.algorithm.SimplePointInAreaLocator {
+	 public static int locate(Coordinate p, Geometry geom, double snapTolerance)
+	  {
+	    if (geom.isEmpty()) return Location.EXTERIOR;
+
+	    if (containsPoint(p, geom, snapTolerance))
+	      return Location.INTERIOR;
+	    return Location.EXTERIOR;
+	  }
+
+	  private static boolean containsPoint(Coordinate p, Geometry geom, double snapTolerance)
+	  {
+	    if (geom instanceof Polygon) {
+	      return containsPointInPolygon(p, (Polygon) geom);
+	    }
+	    else if (geom instanceof GeometryCollection) {
+	      Iterator geomi = new GeometryCollectionIterator((GeometryCollection) geom);
+	      while (geomi.hasNext()) {
+	        Geometry g2 = (Geometry) geomi.next();
+	        if (g2 != geom)
+	          if (containsPoint(p, g2, snapTolerance))
+	            return true;
+	      }
+	    }
+	    return false;
+	  }
+
+	  public static boolean containsPointInPolygon(Coordinate p, Polygon poly, double snapTolerance)
+	  {
+	    if (poly.isEmpty()) return false;
+	    LinearRing shell = (LinearRing) poly.getExteriorRing();
+	    if (! SnapCGAlgorithms.isPointInRing(p, shell.getCoordinates(), snapTolerance)) return false;
+	    // now test if the point lies in or on the holes
+	    for (int i = 0; i < poly.getNumInteriorRing(); i++) {
+	      LinearRing hole = (LinearRing) poly.getInteriorRingN(i);
+	      if (SnapCGAlgorithms.isPointInRing(p, hole.getCoordinates(), snapTolerance)) return false;
+	    }
+	    return true;
+	  }
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/algorithms/SnapSimplePointInAreaLocator.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/algorithms/SnapPointLocator.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/algorithms/SnapPointLocator.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/algorithms/SnapPointLocator.java	(revision 12191)
@@ -0,0 +1,210 @@
+/*
+ * Created on 06-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-10-17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/09 19:10:56  azabala
+* First version in CVS
+*
+*
+*/
+package com.vividsolutions.jts.algorithms;
+
+import java.util.Iterator;
+
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryCollection;
+import com.vividsolutions.jts.geom.GeometryCollectionIterator;
+import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.LinearRing;
+import com.vividsolutions.jts.geom.Location;
+import com.vividsolutions.jts.geom.MultiLineString;
+import com.vividsolutions.jts.geom.MultiPolygon;
+import com.vividsolutions.jts.geom.Polygon;
+import com.vividsolutions.jts.geomgraph.SnappingGeometryGraph;
+
+public class SnapPointLocator extends com.vividsolutions.jts.algorithm.PointLocator {
+	 private boolean isIn;         // true if the point lies in or on any Geometry element
+	  private int numBoundaries;    // the number of sub-elements whose boundaries the point lies in
+
+	  public SnapPointLocator() {
+	  }
+
+	  /**
+	   * Convenience method to test a point for intersection with
+	   * a Geometry
+	   * @param p the coordinate to test
+	   * @param geom the Geometry to test
+	   * @return <code>true</code> if the point is in the interior or boundary of the Geometry
+	   */
+	  public boolean intersects(Coordinate p, Geometry geom, double snapTolerance)
+	  {
+	    return locate(p, geom, snapTolerance) != Location.EXTERIOR;
+	  }
+
+	  /**
+	   * Computes the topological relationship ({@link Location}) of a single point
+	   * to a Geometry.
+	   * It handles both single-element
+	   * and multi-element Geometries.
+	   * The algorithm for multi-part Geometries
+	   * takes into account the SFS Boundary Determination Rule.
+	   *
+	   * @return the {@link Location} of the point relative to the input Geometry
+	   */
+	  public int locate(Coordinate p, Geometry geom, double snapTolerance)
+	  {
+	    if (geom.isEmpty()) return Location.EXTERIOR;
+
+	    if (geom instanceof LinearRing) {
+	      return locate(p, (LinearRing) geom, snapTolerance);
+	    }
+	    if (geom instanceof LineString) {
+	      return locate(p, (LineString) geom, snapTolerance);
+	    }
+	    else if (geom instanceof Polygon) {
+	      return locate(p, (Polygon) geom, snapTolerance);
+	    }
+
+	    isIn = false;
+	    numBoundaries = 0;
+	    computeLocation(p, geom, snapTolerance);
+	    if (SnappingGeometryGraph.isInBoundary(numBoundaries)) 
+	    	return Location.BOUNDARY;
+	    if (numBoundaries > 0 || isIn) 
+	    	return Location.INTERIOR;
+	    return Location.EXTERIOR;
+	  }
+
+	  private void computeLocation(Coordinate p, Geometry geom, double snapTolerance)
+	  {
+	    if (geom instanceof LinearRing) {
+	      updateLocationInfo(locate(p, (LinearRing) geom, snapTolerance));
+	    }
+	    if (geom instanceof LineString) {
+	      updateLocationInfo(locate(p, (LineString) geom, snapTolerance));
+	    }
+	    else if (geom instanceof Polygon) {
+	      updateLocationInfo(locate(p, (Polygon) geom, snapTolerance));
+	    }
+	    else if (geom instanceof MultiLineString) {
+	      MultiLineString ml = (MultiLineString) geom;
+	      for (int i = 0; i < ml.getNumGeometries(); i++) {
+	        LineString l = (LineString) ml.getGeometryN(i);
+	        updateLocationInfo(locate(p, l, snapTolerance));
+	      }
+	    }
+	    else if (geom instanceof MultiPolygon) {
+	      MultiPolygon mpoly = (MultiPolygon) geom;
+	      for (int i = 0; i < mpoly.getNumGeometries(); i++) {
+	        Polygon poly = (Polygon) mpoly.getGeometryN(i);
+	        updateLocationInfo(locate(p, poly, snapTolerance));
+	      }
+	    }
+	    else if (geom instanceof GeometryCollection) {
+	      Iterator geomi = new GeometryCollectionIterator((GeometryCollection) geom);
+	      while (geomi.hasNext()) {
+	        Geometry g2 = (Geometry) geomi.next();
+	        if (g2 != geom)
+	          computeLocation(p, g2, snapTolerance);
+	      }
+	    }
+	  }
+
+	  private void updateLocationInfo(int loc)
+	  {
+	    if (loc == Location.INTERIOR) isIn = true;
+	    if (loc == Location.BOUNDARY) numBoundaries++;
+	  }
+
+	  private int locate(Coordinate p, LineString l, double snapTolerance)
+	  {
+	    Coordinate[] pt = l.getCoordinates();
+	    if (! l.isClosed()) {
+	      if (p.distance(pt[0]) <= snapTolerance
+	          || p.distance(pt[pt.length - 1]) <= snapTolerance ) {
+	        return Location.BOUNDARY;
+	      }
+	    }
+	    if (SnapCGAlgorithms.isOnLine(p, pt, snapTolerance))
+	      return Location.INTERIOR;
+	    return Location.EXTERIOR;
+	  }
+
+	  private int locate(Coordinate p, LinearRing ring, double snapTolerance)
+	  {
+	    // can this test be folded into isPointInRing ?
+	    if (SnapCGAlgorithms.isOnLine(p, ring.getCoordinates())) {
+	      return Location.BOUNDARY;
+	    }
+	    if (SnapCGAlgorithms.isPointInRing(p, ring.getCoordinates(), snapTolerance))
+	      return Location.INTERIOR;
+	    return Location.EXTERIOR;
+	  }
+
+	  private int locate(Coordinate p, Polygon poly, double snapTolerance)
+	  {
+	    if (poly.isEmpty()) return Location.EXTERIOR;
+	    LinearRing shell = (LinearRing) poly.getExteriorRing();
+
+	    int shellLoc = locate(p, shell, snapTolerance);
+	    if (shellLoc == Location.EXTERIOR) return Location.EXTERIOR;
+	    if (shellLoc == Location.BOUNDARY) return Location.BOUNDARY;
+	    // now test if the point lies in or on the holes
+	    for (int i = 0; i < poly.getNumInteriorRing(); i++) {
+	      LinearRing hole = (LinearRing) poly.getInteriorRingN(i);
+	      int holeLoc = locate(p, hole, snapTolerance);
+	      if (holeLoc == Location.INTERIOR) return Location.EXTERIOR;
+	      if (holeLoc == Location.BOUNDARY) return Location.BOUNDARY;
+	    }
+	    return Location.INTERIOR;
+	  }
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/algorithms/SnapPointLocator.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/algorithms/SnapCGAlgorithms.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/algorithms/SnapCGAlgorithms.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/algorithms/SnapCGAlgorithms.java	(revision 12191)
@@ -0,0 +1,174 @@
+/*
+ * Created on 06-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.2  2006-10-19 16:06:48  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/09 19:10:56  azabala
+* First version in CVS
+*
+*
+*/
+package com.vividsolutions.jts.algorithms;
+
+import com.vividsolutions.jts.algorithm.CGAlgorithms;
+import com.vividsolutions.jts.algorithm.RobustDeterminant;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.operation.overlay.SnapLineIntersector;
+
+public class SnapCGAlgorithms extends CGAlgorithms {
+	/**
+	   * Test whether a point lies on the line segments defined by a
+	   * list of coordinates.
+	   *
+	   * @return true true if
+	   * the point is a vertex of the line or lies in the interior of a line
+	   * segment in the linestring
+	   */
+	  public static boolean isOnLine(Coordinate p, Coordinate[] pt, double snapTol) {
+	    SnapLineIntersector lineIntersector = new SnapLineIntersector(snapTol);
+	    for (int i = 1; i < pt.length; i++) {
+	      Coordinate p0 = pt[i - 1];
+	      Coordinate p1 = pt[i];
+	      lineIntersector.computeIntersection(p, p0, p1);
+	      if (lineIntersector.hasIntersection()) {
+	        return true;
+	      }
+	    }
+	    return false;
+	  }
+	  public static boolean isPointInRing(Coordinate p, Coordinate[] ring, double snapTolerance) {
+		    /*
+		     *  For each segment l = (i-1, i), see if it crosses ray from test point in positive x direction.
+		     */
+		    int crossings = 0;  // number of segment/ray crossings
+		    
+		    SnapLineIntersector lineIntersector = new SnapLineIntersector(snapTolerance);
+		    
+		    for (int i = 1; i < ring.length; i++) {
+		      int i1 = i - 1;
+		      Coordinate p1 = ring[i];
+		      Coordinate p2 = ring[i1];
+		      
+		      lineIntersector.computeIntersection(p, p1, p2);
+		      if (lineIntersector.hasIntersection()) {
+		        crossings ++;
+		      }
+
+//		      if (((p1.y > (p.y - snapTolerance)) && (p2.y <= (p.y + snapTolerance))) ||
+//		          ((p2.y > (p.y - snapTolerance)) && (p1.y <= (p.y) + snapTolerance))) {//si no se cumple, no pueden intersectar
+//		        
+//		    	double x1 = p1.x - p.x;
+//		        double y1 = p1.y - p.y;
+//		        double x2 = p2.x - p.x;
+//		        double y2 = p2.y - p.y;
+//		        /*
+//		        *  segment straddles x axis, so compute intersection with x-axis.
+//		         */
+//		        double xInt = RobustDeterminant.signOfDet2x2(x1, y1, x2, y2) / (y2 - y1);
+//		        //xsave = xInt;
+//		        /*
+//		        *  crosses ray if strictly positive intersection.
+//		         */
+//		        if (xInt > 0.0) {
+//		          crossings++;
+//		        }
+//		      }
+		    }
+		    /*
+		     *  p is inside if number of crossings is odd.
+		     */
+		    if ((crossings % 2) == 1) {
+		      return true;
+		    }
+		    else {
+		      return false;
+		    }
+		  }
+	  
+	  /**
+	   * Computes the orientation of a point q to the directed line segment p1-p2.
+	   * The orientation of a point relative to a directed line segment indicates
+	   * which way you turn to get to q after travelling from p1 to p2.
+	   *
+	   * @return 1 if q is counter-clockwise from p1-p2
+	   * @return -1 if q is clockwise from p1-p2
+	   * @return 0 if q is collinear with p1-p2
+	   */
+	  public static int computeOrientation(Coordinate p1, Coordinate p2, Coordinate q) {
+	    return orientationIndex(p1, p2, q);
+	  }
+	  /**
+	   * Returns the index of the direction of the point <code>q</code>
+	   * relative to a
+	   * vector specified by <code>p1-p2</code>.
+	   *
+	   * @param p1 the origin point of the vector
+	   * @param p2 the final point of the vector
+	   * @param q the point to compute the direction to
+	   *
+	   * @return 1 if q is counter-clockwise (left) from p1-p2
+	   * @return -1 if q is clockwise (right) from p1-p2
+	   * @return 0 if q is collinear with p1-p2
+	   */
+	  public static int orientationIndex(Coordinate p1, Coordinate p2, Coordinate q) {
+	    // travelling along p1->p2, turn counter clockwise to get to q return 1,
+	    // travelling along p1->p2, turn clockwise to get to q return -1,
+	    // p1, p2 and q are colinear return 0.
+	    double dx1 = p2.x - p1.x;
+	    double dy1 = p2.y - p1.y;
+	    double dx2 = q.x - p2.x;
+	    double dy2 = q.y - p2.y;
+	    return RobustDeterminant.signOfDet2x2(dx1, dy1, dx2, dy2);
+	  }
+	  
+	  
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/algorithms/SnapCGAlgorithms.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/index/SnapMonotoneChainEdge.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/index/SnapMonotoneChainEdge.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/index/SnapMonotoneChainEdge.java	(revision 12191)
@@ -0,0 +1,174 @@
+/*
+ * Created on 02-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-10-17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/05 19:20:57  azabala
+* first version in cvs
+*
+* Revision 1.1  2006/10/02 19:06:26  azabala
+* First version in CVS
+*
+*
+*/
+package com.vividsolutions.jts.geomgraph.index;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geomgraph.SnappingEdge;
+import com.vividsolutions.jts.geomgraph.index.MonotoneChainEdge;
+import com.vividsolutions.jts.geomgraph.index.SegmentIntersector;
+
+public class SnapMonotoneChainEdge extends MonotoneChainEdge {
+	
+	  SnappingEdge e;
+	  int[] startIndex;
+	  double snapTolerance;
+	  
+
+	  public SnapMonotoneChainEdge(SnappingEdge e, double snapTolerance) {
+		super(e);	    
+		this.e = e;
+	    startIndex = super.getStartIndexes();
+	    this.snapTolerance = snapTolerance;
+	  }
+	  
+	  public SnappingEdge getEdge(){
+		  return e;
+	  }
+
+	  public void computeIntersects(MonotoneChainEdge mce,
+			                        SegmentIntersector si)
+	  {
+	   if (! (mce instanceof SnapMonotoneChainEdge))
+		   throw new IllegalArgumentException("Requiere MCE de snap");
+	    for (int i = 0; i < startIndex.length - 1; i++) {
+	      for (int j = 0; j < mce.getStartIndexes().length - 1; j++) {
+	        computeIntersectsForChain(i, mce, j, si );
+	      }//for
+	    }//for
+	  }
+	  
+	  
+	  public void computeIntersectsForChain(int chainIndex0, 
+			  							MonotoneChainEdge mce,
+			  								int chainIndex1,
+			  								SegmentIntersector si){
+		  if (! (mce instanceof SnapMonotoneChainEdge))
+			   throw new IllegalArgumentException("Requiere MCE de snap");
+	    computeIntersectsForChain(startIndex[chainIndex0], 
+	    		             startIndex[chainIndex0 + 1],
+	                           mce,
+	                           mce.getStartIndexes()[chainIndex1],
+                             mce.getStartIndexes()[chainIndex1 + 1],
+	                            si );
+	  }
+	  
+	  
+
+	  private void computeIntersectsForChain(int start0, int end0, 
+			  MonotoneChainEdge mce, int start1,
+			  int end1, SegmentIntersector ei){
+		  
+		  if (! (mce instanceof SnapMonotoneChainEdge))
+			   throw new IllegalArgumentException("Requiere MCE de snap");
+		
+		SnapMonotoneChainEdge snapMce = (SnapMonotoneChainEdge) mce;
+	    Coordinate p00 = super.getCoordinates()[start0];
+	    Coordinate p01 = super.getCoordinates()[end0];
+	    
+	    Coordinate p10 = mce.getCoordinates()[start1];
+	    Coordinate p11 = mce.getCoordinates()[end1];
+	    
+
+	    // terminating condition for the recursion
+	    if (end0 - start0 == 1 && end1 - start1 == 1) {
+	      ei.addIntersections(e, start0, snapMce.getEdge(), start1);
+	      return;
+	    }
+	    
+	    // nothing to do if the envelopes of these chains don't overlap
+	    Envelope env1 = new Envelope(p00, p01);
+		double newMinX = env1.getMinX() - snapTolerance;
+		double newMaxX = env1.getMaxX() + snapTolerance;
+		double newMinY = env1.getMinY() - snapTolerance;
+		double newMaxY = env1.getMaxY() + snapTolerance;
+		env1 = new Envelope(newMinX, newMaxX, newMinY, newMaxY);
+	 
+		Envelope env2 = new Envelope(p10, p11);
+		newMinX = env1.getMinX() - snapTolerance;
+		newMaxX = env1.getMaxX() + snapTolerance;
+		newMinY = env1.getMinY() - snapTolerance;
+		newMaxY = env1.getMaxY() + snapTolerance;
+		env2 = new Envelope(newMinX, newMaxX, newMinY, newMaxY);
+	    
+	    if (! env1.intersects(env2))
+	    	return;
+
+	    
+	    // the chains overlap, 
+	    //so split each in half and iterate  (binary search)
+	    int mid0 = (start0 + end0) / 2;
+	    int mid1 = (start1 + end1) / 2;
+
+	    if (start0 < mid0) {
+	      if (start1 < mid1) 
+	    	  computeIntersectsForChain(start0, mid0, mce, start1,  mid1, ei);
+	      if (mid1 < end1)   
+	    	  computeIntersectsForChain(start0, mid0, mce, mid1,    end1, ei);
+	    }
+	    
+	    if (mid0 < end0) {
+	      if (start1 < mid1) 
+	    	  computeIntersectsForChain(mid0, end0, mce, start1,  mid1, ei);
+	      if (mid1 < end1)   
+	    	  computeIntersectsForChain(mid0,   end0, mce, mid1,    end1, ei);
+	    }
+	  }
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/index/SnapMonotoneChainEdge.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/index/SnapSimpleMCSweepLineIntersector.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/index/SnapSimpleMCSweepLineIntersector.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/index/SnapSimpleMCSweepLineIntersector.java	(revision 12191)
@@ -0,0 +1,184 @@
+/*
+ * Created on 02-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-10-05 19:20:57  azabala
+* first version in cvs
+*
+* Revision 1.1  2006/10/02 19:06:26  azabala
+* First version in CVS
+*
+*
+*/
+package com.vividsolutions.jts.geomgraph.index;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import com.vividsolutions.jts.geomgraph.Edge;
+import com.vividsolutions.jts.geomgraph.index.MonotoneChain;
+import com.vividsolutions.jts.geomgraph.index.MonotoneChainEdge;
+import com.vividsolutions.jts.geomgraph.index.SegmentIntersector;
+import com.vividsolutions.jts.geomgraph.index.SimpleMCSweepLineIntersector;
+import com.vividsolutions.jts.geomgraph.index.SweepLineEvent;
+
+public class SnapSimpleMCSweepLineIntersector extends
+		SimpleMCSweepLineIntersector {
+	
+	 List events = new ArrayList();
+	  // statistics information
+	  int nOverlaps;
+
+	
+	  public SnapSimpleMCSweepLineIntersector() {
+	  }
+
+	  
+	  public void computeIntersections(List edges, 
+			  SegmentIntersector si, 
+			  boolean testAllSegments)
+	  {
+	    if (testAllSegments)
+	      add(edges, null);
+	    else
+	      add(edges);
+	    computeIntersections(si);
+	  }
+
+	  public void computeIntersections(List edges0, List edges1, SegmentIntersector si)
+	  {
+	    add(edges0, edges0);
+	    add(edges1, edges1);
+	    computeIntersections(si);
+	  }
+
+	  private void add(List edges)
+	  {
+	    for (Iterator i = edges.iterator(); i.hasNext(); ) {
+	      Edge edge = (Edge) i.next();
+	      // edge is its own group
+	      add(edge, edge);
+	    }
+	  }
+	  private void add(List edges, Object edgeSet)
+	  {
+	    for (Iterator i = edges.iterator(); i.hasNext(); ) {
+	      Edge edge = (Edge) i.next();
+	      add(edge, edgeSet);
+	    }
+	  }
+
+	  private void add(Edge edge, Object edgeSet)
+	  {
+	    MonotoneChainEdge mce = edge.getMonotoneChainEdge();
+	    int[] startIndex = mce.getStartIndexes();
+	    for (int i = 0; i < startIndex.length - 1; i++) {
+	      MonotoneChain mc = new MonotoneChain(mce, i);
+	      SweepLineEvent insertEvent = new SweepLineEvent(edgeSet, 
+	    		  mce.getMinX(i), 
+	    		  null, mc);
+	      events.add(insertEvent);
+	      events.add(new SweepLineEvent(edgeSet, mce.getMaxX(i), insertEvent, mc));
+	    }
+	  }
+
+	  /**
+	   * Because Delete Events have a link to their corresponding Insert event,
+	   * it is possible to compute exactly the range of events which must be
+	   * compared to a given Insert event object.
+	   */
+	  private void prepareEvents()
+	  {
+	    Collections.sort(events);
+	    for (int i = 0; i < events.size(); i++ )
+	    {
+	      SweepLineEvent ev = (SweepLineEvent) events.get(i);
+	      if (ev.isDelete()) {
+	        ev.getInsertEvent().setDeleteEventIndex(i);
+	      }
+	    }
+	  }
+
+	  private void computeIntersections(SegmentIntersector si)
+	  {
+	    nOverlaps = 0;
+	    prepareEvents();
+
+	    for (int i = 0; i < events.size(); i++ )
+	    {
+	      SweepLineEvent ev = (SweepLineEvent) events.get(i);
+	      if (ev.isInsert()) {
+	        processOverlaps(i, ev.getDeleteEventIndex(), ev, si);
+	      }
+	    }
+	  }
+
+	  private void processOverlaps(int start, int end, SweepLineEvent ev0, SegmentIntersector si)
+	  {
+	    MonotoneChain mc0 = (MonotoneChain) ev0.getObject();
+	    /**
+	     * Since we might need to test for self-intersections,
+	     * include current insert event object in list of event objects to test.
+	     * Last index can be skipped, because it must be a Delete event.
+	     */
+	    for (int i = start; i < end; i++ ) {
+	      SweepLineEvent ev1 = (SweepLineEvent) events.get(i);
+	      if (ev1.isInsert()) {
+	        MonotoneChain mc1 = (MonotoneChain) ev1.getObject();
+	        // don't compare edges in same group
+	        // null group indicates that edges should be compared
+	        if (ev0.edgeSet == null || (ev0.edgeSet != ev1.edgeSet)) {
+	          mc0.computeIntersections(mc1, si);
+	          nOverlaps++;
+	        }
+	      }
+	    }
+	  }
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/index/SnapSimpleMCSweepLineIntersector.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapEdgeIntersectionList.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapEdgeIntersectionList.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapEdgeIntersectionList.java	(revision 12191)
@@ -0,0 +1,289 @@
+/*
+ * Created on 02-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-10-17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/09 19:10:56  azabala
+* First version in CVS
+*
+* Revision 1.1  2006/10/05 19:20:57  azabala
+* first version in cvs
+*
+* Revision 1.1  2006/10/02 19:06:39  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.vividsolutions.jts.geomgraph;
+
+import java.util.Iterator;
+import java.util.List;
+import java.util.TreeMap;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geomgraph.DirectedEdgeStar;
+import com.vividsolutions.jts.geomgraph.Edge;
+import com.vividsolutions.jts.geomgraph.EdgeEndStar;
+import com.vividsolutions.jts.geomgraph.EdgeIntersection;
+import com.vividsolutions.jts.geomgraph.EdgeIntersectionList;
+import com.vividsolutions.jts.geomgraph.Label;
+import com.vividsolutions.jts.geomgraph.Node;
+import com.vividsolutions.jts.geomgraph.NodeFactory;
+
+public class SnapEdgeIntersectionList extends EdgeIntersectionList {
+		
+	   class SnapEdgeIntersectNode extends Node implements Comparable{
+		    EdgeIntersection edgeIntersection;
+			public SnapEdgeIntersectNode(Coordinate arg0, 
+									EdgeEndStar arg1,
+									EdgeIntersection edgeIntersection) {
+				super(arg0, arg1);
+				this.edgeIntersection = edgeIntersection;
+			}
+			
+			//Esto me vale para Nodos a secas, pero para el caso de intersecciones no....
+			//porque tienen mas informacion (segmento asociado, etc.)
+			//Por ejemplo, primer y ultimo punto de un poligono cerrado no deben ser el 
+			//mismo nodo, sino nodos distintos
+			
+			public boolean equals(Object obj){
+				SnapEdgeIntersectNode other = (SnapEdgeIntersectNode) obj;
+				return (other.coord.distance(this.coord) 
+									<= snapTolerance) &&
+					   (other.edgeIntersection.segmentIndex == this.edgeIntersection.segmentIndex) &&
+					   ( Math.abs(other.edgeIntersection.dist - this.edgeIntersection.dist) <= snapTolerance);
+			}
+			public int hashCode() {
+			  return 1;   //esto no es eficiente 
+			}
+			
+			//Esto es necesario porque a la hora de recorrer
+			//las intersecciones de un Edge me interesa
+			//que est�n ordenadas en el sentido de los vertices (0,1,2..etc)
+			public int compareTo(Object arg0) {
+				SnapEdgeIntersectNode other = (SnapEdgeIntersectNode)arg0;
+				return this.edgeIntersection.compareTo(other.edgeIntersection);
+			}
+		}//EdgeIntersectionNode
+		
+	    SnappingNodeMap nodeMap = null;
+	
+	 // a Map <EdgeIntersection, EdgeIntersection>
+	//TODO Ver si sustituimos por SnappingNodeMap
+//	  private TreeMap nodeMap = new TreeMap();
+	  SnappingEdge edge;  // the parent edge
+	  
+	  /*
+	   * El codigo de verificacion de snap est� por todas partes.
+	   * Llevar a una clase auxiliar si procede
+	   * */
+	  private double snapTolerance;
+
+	  public SnapEdgeIntersectionList(SnappingEdge edge)
+	  {
+		  super(edge);
+	      this.edge = edge;
+	      this.snapTolerance = edge.getSnapTolerance();
+	      nodeMap = new SnappingNodeMap(new NodeFactory(), snapTolerance){
+	    	  public Node addNode(Node n)
+	    	  {
+	    		SnapEdgeIntersectNode newNode = (SnapEdgeIntersectNode)n;
+	    	    SnapEdgeIntersectNode eNode = (SnapEdgeIntersectNode) 
+	    	    	super.nodeMap.get(newNode);
+	    	    if(eNode != null){
+	    	    	eNode.mergeLabel(newNode);
+	    	    	return eNode;
+	    	    }else
+	    	    	super.nodeMap.put(newNode, newNode);
+	    	    return newNode;
+	    	  }  
+	    	  //TODO Esto hay que refinarlo. 
+	    	  /*
+	    	   * Por un lado quiero la rapidez del HashMap, y la posibilidad
+	    	   * de resolver conflictos a partir de equals...
+	    	   * 
+	    	   * Pero cuando me pidan las intersecciones ordenadas, es 
+	    	   * necesario hacerlo seg�n el sentido de los vertices
+	    	   * (de mas cercana a mas lejana al vertice 0)
+	    	   * 
+	    	   * */
+	    	  
+	    	  public Iterator iterator()
+	    	  {
+	    		 long t0 = System.currentTimeMillis();
+	    		 TreeMap ordered = new TreeMap(nodeMap);
+	    		 long t1 = System.currentTimeMillis();
+//	    		 System.out.println((t1-t0)+" en crear el Map");
+	    		  return ordered.values().iterator();
+	    	  }
+	     
+	      };
+	  }
+
+	  /**
+	   * Adds an intersection into the list, if it isn't already there.
+	   * The input segmentIndex and dist are expected to be normalized.
+	   * @return the EdgeIntersection found or added
+	   */
+	  public EdgeIntersection add(Coordinate intPt,
+			  	int segmentIndex, double dist)
+	  {
+		  EdgeIntersection eiNew = new EdgeIntersection(intPt, 
+									    		segmentIndex, 
+									    		dist);
+		  
+		  SnapEdgeIntersectNode newNode = new SnapEdgeIntersectNode(intPt,
+				 new  DirectedEdgeStar(), eiNew);
+		  SnapEdgeIntersectNode solution = 
+			  (SnapEdgeIntersectNode) nodeMap.addNode(newNode);
+	      return solution.edgeIntersection;
+	  }
+
+	  /**
+	   * Returns an iterator of {@link EdgeIntersection}s
+	   *
+	   * @return an Iterator of EdgeIntersections
+	   */
+	  public Iterator iterator() { 
+//		  return nodeMap.values().iterator();
+		  return nodeMap.iterator();
+	  }
+
+	  /**
+	   * Tests if the given point is an edge intersection
+	   *
+	   * @param pt the point to test
+	   * @return true if the point is an intersection
+	   */
+	  public boolean isIntersection(Coordinate pt)
+	  {
+		  //TODO No seria mejor acudir al NodeMap???
+	    for (Iterator it = iterator(); it.hasNext(); ) {
+	      EdgeIntersection ei = ((SnapEdgeIntersectNode)it.next()).edgeIntersection;
+	      if (ei.coord.distance(pt) <= snapTolerance)
+	       return true;
+	    }
+	    return false;
+	  }
+	  
+	  /**
+	   * Creates new edges for all the edges that the intersections in this
+	   * list split the parent edge into.
+	   * Adds the edges to the input list (this is so a single list
+	   * can be used to accumulate all split edges for a Geometry).
+	   *
+	   * @param edgeList a list of EdgeIntersections
+	   */
+	  public void addSplitEdges(List edgeList)
+	  {
+	    // ensure that the list has entries for the first and last point of the edge
+	    addEndpoints();
+
+	    Iterator it = iterator();
+	    // there should always be at least two entries in the list
+	    //es decir, todo Edge tendr� al menos 2 EdgeIntersection...sus nodos
+	    EdgeIntersection eiPrev = ((SnapEdgeIntersectNode) it.next()).edgeIntersection;
+	    
+	    
+//	    UNA DE LAS CLAVES EST� AQUI
+//	    SI TENEMOS COORDENADA-EDGEINTERSECTION-COORDENADA Y EDGEINTERSECTION
+//	    ES UN SNAP DE COORDENADA FINAL, APARECERAN COSAS SPUREAS.
+	    
+	    
+	    
+	    while (it.hasNext()) {
+	      EdgeIntersection ei = ((SnapEdgeIntersectNode)it.next()).edgeIntersection;
+	      Edge newEdge = this.createSplitEdge(eiPrev, ei);
+	      edgeList.add(newEdge);
+
+	      eiPrev = ei;
+	    }
+	  }
+	  
+	  public void addEndpoints()
+	  {
+	    int maxSegIndex = edge.getCoordinates().length - 1;
+	    add(edge.getCoordinates()[0], 0, 0.0);
+	    add(edge.getCoordinates()[maxSegIndex], maxSegIndex, 0.0);
+	  }
+
+	  /**
+	   * Create a new "split edge" with the section of points between
+	   * (and including) the two intersections.
+	   * The label for the new edge is the same as the label for the parent edge.
+	   */
+	  Edge createSplitEdge(EdgeIntersection ei0, EdgeIntersection ei1)
+	  {
+//	Debug.print("\ncreateSplitEdge"); Debug.print(ei0); Debug.print(ei1);
+	    int npts = ei1.segmentIndex - ei0.segmentIndex + 2;
+
+	    Coordinate lastSegStartPt = this.edge.getCoordinate(ei1.segmentIndex);
+	    // if the last intersection point is not equal to the its segment start pt,
+	    // add it to the points list as well.
+	    
+	    
+	    // (This check is needed because the distance metric is not totally reliable!)
+	    // The check for point equality is 2D only - Z values are ignored
+	   // boolean useIntPt1 = ei1.dist > 0.0 || ! ei1.coord.equals2D(lastSegStartPt);
+	    boolean useIntPt1 = ei1.dist > snapTolerance || ! 
+	    	(ei1.coord.distance(lastSegStartPt) <= snapTolerance);//Con esto se dejaria de usar el segundo punto...pero y el primero??? en el 1er segmento hay que considerarlo
+	    if (! useIntPt1) {
+	      npts--;
+	    }
+	    Coordinate[] pts = new Coordinate[npts];
+	    int ipt = 0;
+	    pts[ipt++] = new Coordinate(ei0.coord);
+	    for (int i = ei0.segmentIndex + 1; i <= ei1.segmentIndex; i++) {
+	      pts[ipt++] = this.edge.getCoordinate(i);
+	    }
+	    if (useIntPt1) pts[ipt] = ei1.coord;
+	    return new SnappingEdge(pts, new Label(this.edge.getLabel()), snapTolerance);
+	  }
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapEdgeIntersectionList.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapDirectedEdge.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapDirectedEdge.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapDirectedEdge.java	(revision 12191)
@@ -0,0 +1,138 @@
+/*
+ * Created on 02-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-10-17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/09 19:10:56  azabala
+* First version in CVS
+*
+* Revision 1.1  2006/10/05 19:20:57  azabala
+* first version in cvs
+*
+* Revision 1.1  2006/10/02 19:06:39  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.vividsolutions.jts.geomgraph;
+
+import com.vividsolutions.jts.algorithms.SnapCGAlgorithms;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geomgraph.DirectedEdge;
+import com.vividsolutions.jts.geomgraph.Edge;
+import com.vividsolutions.jts.geomgraph.Quadrant;
+import com.vividsolutions.jts.util.Assert;
+
+public class SnapDirectedEdge extends DirectedEdge {
+
+	private Coordinate p0;
+	private Coordinate p1;
+	private double dx, dy;
+	int quadrant;
+	
+	public SnapDirectedEdge(Edge arg0, boolean arg1) {
+		super(arg0, arg1);
+	}
+	 
+	public Coordinate getCoordinate() { return p0; }
+	  public Coordinate getDirectedCoordinate() { return p1; }
+	  public int getQuadrant() { return quadrant; }
+	  public double getDx() { return dx; }
+	  public double getDy() { return dy; }
+
+ protected void init(Coordinate p0, Coordinate p1)
+  {
+    this.p0 = p0;
+    this.p1 = p1;
+    dx = p1.x - p0.x;
+    dy = p1.y - p0.y;
+    if(dx == 0 && dy == 0)
+    	System.out.println(p0.toString()+";"+p1.toString());
+    quadrant = Quadrant.quadrant(dx, dy);
+   
+    Assert.isTrue(! (dx == 0 && dy == 0), "EdgeEnd with identical endpoints found");
+  }
+ 
+ public String toString(){
+	 return this.p0.toString() + "," + p1.toString();
+ }
+ 
+ public int compareTo(Object obj)
+ {
+     SnapDirectedEdge de = (SnapDirectedEdge) obj;
+     return compareDirection(de);
+ }
+
+ /**
+  * Returns 1 if this DirectedEdge has a greater angle with the
+  * positive x-axis than b", 0 if the DirectedEdges are collinear, and -1 otherwise.
+  * <p>
+  * Using the obvious algorithm of simply computing the angle is not robust,
+  * since the angle calculation is susceptible to roundoff. A robust algorithm
+  * is:
+  * <ul>
+  * <li>first compare the quadrants. If the quadrants are different, it it
+  * trivial to determine which vector is "greater".
+  * <li>if the vectors lie in the same quadrant, the robust
+  * {@link RobustCGAlgorithms#computeOrientation(Coordinate, Coordinate, Coordinate)}
+  * function can be used to decide the relative orientation of the vectors.
+  * </ul>
+  */
+ public int compareDirection(SnapDirectedEdge e)
+ {
+   // if the rays are in different quadrants, determining the ordering is trivial
+   if (quadrant > e.quadrant) return 1;
+   if (quadrant < e.quadrant) return -1;
+   // vectors are in the same quadrant - check relative orientation of direction vectors
+   // this is > e if it is CCW of e
+   return SnapCGAlgorithms.computeOrientation(e.p0, e.p1, p1);
+ }
+ 
+   
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapDirectedEdge.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapEdgeIntersection.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapEdgeIntersection.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapEdgeIntersection.java	(revision 12191)
@@ -0,0 +1,99 @@
+/*
+ * Created on 02-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-10-17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/05 19:20:57  azabala
+* first version in cvs
+*
+* Revision 1.1  2006/10/02 19:06:39  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.vividsolutions.jts.geomgraph;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geomgraph.EdgeIntersection;
+
+public class SnapEdgeIntersection extends EdgeIntersection {
+	
+	
+	  public SnapEdgeIntersection(Coordinate coord, int segmentIndex, double dist) {
+		  super(coord, segmentIndex, dist);
+	  }
+
+	  public int compareTo(Object obj)
+	  {
+	    SnapEdgeIntersection other = (SnapEdgeIntersection) obj;
+	    return compare(other.segmentIndex, other.dist);
+	  }
+	  /**
+	   * @return -1 this EdgeIntersection is located before the argument location
+	   * @return 0 this EdgeIntersection is at the argument location
+	   * @return 1 this EdgeIntersection is located after the argument location
+	   */
+	  public int compare(int segmentIndex, double dist)
+	  {
+		  //TODO VER SI METER DISTANCIA DE SNAP
+	    if (this.segmentIndex < segmentIndex) return -1;
+	    if (this.segmentIndex > segmentIndex) return 1;
+	    if (this.dist < dist) return -1;
+	    if (this.dist > dist) return 1;
+	    return 0;
+	  }
+
+	  public boolean isEndPoint(int maxSegmentIndex)
+	  {
+		  //TODO VER SI METER DISTANCIA DE SNAP
+	    if (segmentIndex == 0 && dist == 0.0) return true;
+	    if (segmentIndex == maxSegmentIndex) return true;
+	    return false;
+	  }
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapEdgeIntersection.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingGeometryGraph.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingGeometryGraph.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingGeometryGraph.java	(revision 12191)
@@ -0,0 +1,490 @@
+/*
+ * Created on 12-sep-2006 by azabala
+ *
+ */
+package com.vividsolutions.jts.geomgraph;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import com.vividsolutions.jts.algorithm.CGAlgorithms;
+import com.vividsolutions.jts.algorithm.LineIntersector;
+import com.vividsolutions.jts.geom.*;
+import com.vividsolutions.jts.geomgraph.index.SegmentIntersector;
+import com.vividsolutions.jts.geomgraph.index.SimpleMCSweepLineIntersector;
+import com.vividsolutions.jts.geomgraph.index.SnapSimpleMCSweepLineIntersector;
+import com.vividsolutions.jts.util.Assert;
+
+/**
+ */
+public class SnappingGeometryGraph extends GeometryGraph {
+
+	// Properties of PlanarGraph that we want to overwrite to
+	// use snapping
+	public static final CGAlgorithms cga = new CGAlgorithms();
+
+	protected SnappingNodeMap nodes;
+
+
+	// overwrite to catch them when returned by Snapping map
+	protected Collection boundaryNodes;
+
+	protected int argIndex;
+
+	private boolean useBoundaryDeterminationRule = false;
+
+	private boolean hasTooFewPoints = false;
+
+	private Coordinate invalidPoint;
+
+	private Map lineEdgeMap = new HashMap(); 
+	
+	private Geometry parentGeometry;
+	
+	double snapTolerance;
+
+	public SnappingGeometryGraph(NodeFactory nodeFact, double tolerance,
+			int argIndex, Geometry parentGeometry) {
+		//le pasamos al constructor padre GeometryCollection vacia para que
+		//no replique la construccion del grafo
+		super(argIndex, new GeometryCollection(new Geometry[0], parentGeometry.getFactory()));
+		nodes = new SnappingNodeMap(nodeFact, tolerance);
+		this.argIndex = argIndex;
+		this.parentGeometry = parentGeometry;
+		this.snapTolerance = tolerance;
+		add(parentGeometry);
+	}
+	
+	
+	public Geometry getGeometry(){
+		return this.parentGeometry;
+	}
+	
+	
+	public void dumpNodes(){
+		this.nodes.dump();
+	}
+
+	public SnappingGeometryGraph(double tolerance, int argIndex, Geometry parent) {
+		super(argIndex, new GeometryCollection(new Geometry[0], parent.getFactory()));
+		nodes = new SnappingNodeMap(new NodeFactory(), tolerance);
+		this.argIndex = argIndex;
+		this.snapTolerance = tolerance;
+		this.parentGeometry = parent;
+		add(parent);
+	}
+
+	public Collection getBoundaryNodes() {
+		if (boundaryNodes == null)
+			boundaryNodes = nodes.getBoundaryNodes(argIndex);
+		return boundaryNodes;
+	}
+
+	public Coordinate[] getBoundaryPoints() {
+		Collection coll = getBoundaryNodes();
+		Coordinate[] pts = new Coordinate[coll.size()];
+		int i = 0;
+		for (Iterator it = coll.iterator(); it.hasNext();) {
+			Node node = (Node) it.next();
+			pts[i++] = (Coordinate) node.getCoordinate().clone();
+		}
+		return pts;
+	}
+
+	public Iterator getNodeIterator() {
+		return nodes.iterator();
+	}
+
+	public Collection getNodes() {
+		return nodes.values();
+	}
+
+	public Node addNode(Node node) {
+		return nodes.addNode(node);
+	}
+
+	public Node addNode(Coordinate coord) {
+		return nodes.addNode(coord);
+	}
+
+	/**
+	 * @return the node if found; null otherwise
+	 */
+	public Node find(Coordinate coord) {
+		return nodes.find(coord);
+	}
+	
+	public boolean isBoundaryNode(int geomIndex, Coordinate coord) {
+		Node node = nodes.find(coord);
+		if (node == null)
+			return false;
+		Label label = node.getLabel();
+		if (label != null && label.getLocation(geomIndex) == Location.BOUNDARY)
+			return true;
+		return false;
+	}
+
+	
+
+	public void add(EdgeEnd e) {
+		nodes.add(e);
+		edgeEndList.add(e);
+	}
+	
+	
+
+	/**
+	 * Link the DirectedEdges at the nodes of the graph. This allows clients to
+	 * link only a subset of nodes in the graph, for efficiency (because they
+	 * know that only a subset is of interest).
+	 */
+	public void linkResultDirectedEdges() {
+		for (Iterator nodeit = nodes.iterator(); nodeit.hasNext();) {
+			Node node = (Node) nodeit.next();
+			((DirectedEdgeStar) node.getEdges()).linkResultDirectedEdges();
+		}
+	}
+
+	/**
+	 * Link the DirectedEdges at the nodes of the graph. This allows clients to
+	 * link only a subset of nodes in the graph, for efficiency (because they
+	 * know that only a subset is of interest).
+	 */
+	public void linkAllDirectedEdges() {
+		for (Iterator nodeit = nodes.iterator(); nodeit.hasNext();) {
+			Node node = (Node) nodeit.next();
+			((DirectedEdgeStar) node.getEdges()).linkAllDirectedEdges();
+		}
+	}
+
+	/**
+	 * Returns the EdgeEnd which has edge e as its base edge (MD 18 Feb 2002 -
+	 * this should return a pair of edges)
+	 * 
+	 * @return the edge, if found <code>null</code> if the edge was not found
+	 */
+	public EdgeEnd findEdgeEnd(Edge e) {
+		for (Iterator i = getEdgeEnds().iterator(); i.hasNext();) {
+			EdgeEnd ee = (EdgeEnd) i.next();
+			if (ee.getEdge() == e)
+				return ee;
+		}
+		return null;
+	}
+
+	/**
+	 * Returns the edge whose first two coordinates are p0 and p1
+	 * 
+	 * @return the edge, if found <code>null</code> if the edge was not found
+	 */
+	public Edge findEdge(Coordinate p0, Coordinate p1) {
+		for (int i = 0; i < edges.size(); i++) {
+			Edge e = (Edge) edges.get(i);
+			Coordinate[] eCoord = e.getCoordinates();
+			if (p0.equals(eCoord[0]) && p1.equals(eCoord[1]))
+				return e;
+		}
+		return null;
+	}
+
+	/**
+	 * Returns the edge which starts at p0 and whose first segment is parallel
+	 * to p1
+	 * 
+	 * @return the edge, if found <code>null</code> if the edge was not found
+	 */
+	public Edge findEdgeInSameDirection(Coordinate p0, Coordinate p1) {
+		for (int i = 0; i < edges.size(); i++) {
+			Edge e = (Edge) edges.get(i);
+
+			Coordinate[] eCoord = e.getCoordinates();
+			if (matchInSameDirection(p0, p1, eCoord[0], eCoord[1]))
+				return e;
+
+			if (matchInSameDirection(p0, p1, eCoord[eCoord.length - 1],
+					eCoord[eCoord.length - 2]))
+				return e;
+		}
+		return null;
+	}
+
+	/**
+	 * The coordinate pairs match if they define line segments lying in the same
+	 * direction. E.g. the segments are parallel and in the same quadrant (as
+	 * opposed to parallel and opposite!).
+	 */
+	private boolean matchInSameDirection(Coordinate p0, Coordinate p1,
+			Coordinate ep0, Coordinate ep1) {
+		if (!p0.equals(ep0))
+			return false;
+
+		if (CGAlgorithms.computeOrientation(p0, p1, ep1) == CGAlgorithms.COLLINEAR
+				&& Quadrant.quadrant(p0, p1) == Quadrant.quadrant(ep0, ep1))
+			return true;
+		return false;
+	}
+
+	
+	private void add(Geometry g)
+	  {
+	    if (g.isEmpty()) return;
+
+	    // check if this Geometry should obey the Boundary Determination Rule
+	    // all collections except MultiPolygons obey the rule
+	    if (g instanceof GeometryCollection
+	        && ! (g instanceof MultiPolygon))
+	            useBoundaryDeterminationRule = true;
+
+	    if (g instanceof Polygon)                 addPolygon((Polygon) g);
+	                        // LineString also handles LinearRings
+	    else if (g instanceof LineString)         addLineString((LineString) g);
+	    else if (g instanceof Point)              addPoint((Point) g);
+	    else if (g instanceof MultiPoint)         addCollection((MultiPoint) g);
+	    else if (g instanceof MultiLineString)    addCollection((MultiLineString) g);
+	    else if (g instanceof MultiPolygon)       addCollection((MultiPolygon) g);
+	    else if (g instanceof GeometryCollection) addCollection((GeometryCollection) g);
+	    else  throw new UnsupportedOperationException(g.getClass().getName());
+	  }
+
+	  private void addCollection(GeometryCollection gc)
+	  {
+	    for (int i = 0; i < gc.getNumGeometries(); i++) {
+	      Geometry g = gc.getGeometryN(i);
+	      add(g);
+	    }
+	  }
+	  /**
+	   * Add a Point to the graph.
+	   */
+	  private void addPoint(Point p)
+	  {
+	    Coordinate coord = p.getCoordinate();
+	    insertPoint(argIndex, coord, Location.INTERIOR);
+	  }
+	  /**
+	   * The left and right topological location arguments assume that the ring is oriented CW.
+	   * If the ring is in the opposite orientation,
+	   * the left and right locations must be interchanged.
+	   */
+	  private void addPolygonRing(LinearRing lr, int cwLeft, int cwRight)
+	  {
+	    Coordinate[] coord = CoordinateArrays.removeRepeatedPoints(lr.getCoordinates());
+
+	    if (coord.length < 4) {
+	      hasTooFewPoints = true;
+	      invalidPoint = coord[0];
+	      return;
+	    }
+
+	    int left  = cwLeft;
+	    int right = cwRight;
+	    if (cga.isCCW(coord)) {
+	      left = cwRight;
+	      right = cwLeft;
+	    }
+	    SnappingEdge e = new SnappingEdge(coord,
+	                        new Label(argIndex, Location.BOUNDARY, left, right), this.snapTolerance);
+	    lineEdgeMap.put(lr, e);
+
+	    insertEdge(e);
+	    // insert the endpoint as a node, to mark that it is on the boundary
+	    insertPoint(argIndex, coord[0], Location.BOUNDARY);
+	  }
+
+	  private void addPolygon(Polygon p)
+	  {
+	    addPolygonRing(
+	            (LinearRing) p.getExteriorRing(),
+	            Location.EXTERIOR,
+	            Location.INTERIOR);
+
+	    for (int i = 0; i < p.getNumInteriorRing(); i++) {
+	      // Holes are topologically labelled opposite to the shell, since
+	      // the interior of the polygon lies on their opposite side
+	      // (on the left, if the hole is oriented CW)
+	      addPolygonRing(
+	            (LinearRing) p.getInteriorRingN(i),
+	            Location.INTERIOR,
+	            Location.EXTERIOR);
+	    }
+	  }
+
+	  private void addLineString(LineString line)
+	  {
+	    Coordinate[] coord = CoordinateArrays.removeRepeatedPoints(line.getCoordinates());
+
+	    if (coord.length < 2) {
+	      hasTooFewPoints = true;
+	      invalidPoint = coord[0];
+	      return;
+	    }
+
+	    // add the edge for the LineString
+	    // line edges do not have locations for their left and right sides
+	    SnappingEdge e = new SnappingEdge(coord, new Label(argIndex, Location.INTERIOR) , this.snapTolerance);
+	    lineEdgeMap.put(line, e);
+	    insertEdge(e);
+	    /**
+	     * Add the boundary points of the LineString, if any.
+	     * Even if the LineString is closed, add both points as if they were endpoints.
+	     * This allows for the case that the node already exists and is a boundary point.
+	     */
+	    Assert.isTrue(coord.length >= 2, "found LineString with single point");
+	    insertBoundaryPoint(argIndex, coord[0]);
+	    insertBoundaryPoint(argIndex, coord[coord.length - 1]);
+
+	  }
+
+	  /**
+	   * Add an Edge computed externally.  The label on the Edge is assumed
+	   * to be correct.
+	   */
+	  public void addEdge(Edge e)
+	  {
+	    insertEdge(e);
+	    Coordinate[] coord = e.getCoordinates();
+	    // insert the endpoint as a node, to mark that it is on the boundary
+	    insertPoint(argIndex, coord[0], Location.BOUNDARY);
+	    insertPoint(argIndex, coord[coord.length - 1], Location.BOUNDARY);
+	  }
+
+	  /**
+	   * Add a point computed externally.  The point is assumed to be a
+	   * Point Geometry part, which has a location of INTERIOR.
+	   */
+	  public void addPoint(Coordinate pt)
+	  {
+	    insertPoint(argIndex, pt, Location.INTERIOR);
+	  }
+	  
+	  
+	  /**
+	   * Compute self-nodes, taking advantage of the Geometry type to
+	   * minimize the number of intersection tests.  (E.g. rings are
+	   * not tested for self-intersection, since they are assumed to be valid).
+	   * @param li the LineIntersector to use
+	   * @param computeRingSelfNodes if <false>, intersection checks are optimized to not test rings for self-intersection
+	   * @return the SegmentIntersector used, containing information about the intersections found
+	   */
+	  public SegmentIntersector computeSelfNodes(LineIntersector li, boolean computeRingSelfNodes)
+	  {
+	    SegmentIntersector si = new SegmentIntersector(li, true, false);
+	    SnapSimpleMCSweepLineIntersector esi = new SnapSimpleMCSweepLineIntersector();
+	    // optimized test for Polygons and Rings
+	    if (! computeRingSelfNodes
+	        && (parentGeometry instanceof LinearRing
+	        || parentGeometry instanceof Polygon
+	        || parentGeometry instanceof MultiPolygon)) {
+	      esi.computeIntersections(edges, si, false);
+	    }
+	    else {
+	      esi.computeIntersections(edges, si, true);
+	    }
+	    addSelfIntersectionNodes(argIndex);
+	    return si;
+	  }
+
+
+	  
+	  public SegmentIntersector computeEdgeIntersections(
+	    GeometryGraph g,
+	    LineIntersector li,
+	    boolean includeProper)
+	  {
+	    SegmentIntersector siSnap = new SegmentIntersector(li, includeProper, true);
+	    siSnap.setBoundaryNodes(this.getBoundaryNodes(), g.getBoundaryNodes());
+
+	    SnapSimpleMCSweepLineIntersector esiSnap = new SnapSimpleMCSweepLineIntersector();
+	    esiSnap.computeIntersections(edges, g.edges, siSnap);
+	    return siSnap;
+		  
+//		  return super.computeEdgeIntersections(g, li, includeProper);
+	  }
+
+	 
+	 
+
+	  private void addSelfIntersectionNodes(int argIndex)
+	  {
+	    for (Iterator i = edges.iterator(); i.hasNext(); ) {
+	      Edge e = (Edge) i.next();
+	      int eLoc = e.getLabel().getLocation(argIndex);
+	      for (Iterator eiIt = e.eiList.iterator(); eiIt.hasNext(); ) {
+	        EdgeIntersection ei = (EdgeIntersection) eiIt.next();
+	        addSelfIntersectionNode(argIndex, ei.coord, eLoc);
+	      }
+	    }
+	  }
+	  /**
+	   * Add a node for a self-intersection.
+	   * If the node is a potential boundary node (e.g. came from an edge which
+	   * is a boundary) then insert it as a potential boundary node.
+	   * Otherwise, just add it as a regular node.
+	   */
+	  private void addSelfIntersectionNode(int argIndex, Coordinate coord, int loc)
+	  {
+	    // if this node is already a boundary node, don't change it
+	    if (isBoundaryNode(argIndex, coord)) return;
+	    if (loc == Location.BOUNDARY && useBoundaryDeterminationRule)
+	        insertBoundaryPoint(argIndex, coord);
+	    else
+	      insertPoint(argIndex, coord, loc);
+	  }
+
+	  private void insertPoint(int argIndex, Coordinate coord, int onLocation)
+	  {
+	    Node n = nodes.addNode(coord);
+	    Label lbl = n.getLabel();
+	    if (lbl == null) {
+	      n.label = new Label(argIndex, onLocation);
+	    }
+	    else
+	      lbl.setLocation(argIndex, onLocation);
+	  }
+	  
+	  /**
+	   * Adds points using the mod-2 rule of SFS.  This is used to add the boundary
+	   * points of dim-1 geometries (Curves/MultiCurves).  According to the SFS,
+	   * an endpoint of a Curve is on the boundary
+	   * iff if it is in the boundaries of an odd number of Geometries
+	   */
+	  private void insertBoundaryPoint(int argIndex, Coordinate coord)
+	  {
+	    Node n = nodes.addNode(coord);
+	    Label lbl = n.getLabel();
+	    // the new point to insert is on a boundary
+	    int boundaryCount = 1;
+	    // determine the current location for the point (if any)
+	    int loc = Location.NONE;
+	    if (lbl != null) loc = lbl.getLocation(argIndex, Position.ON);
+	    if (loc == Location.BOUNDARY) boundaryCount++;
+
+	    // determine the boundary status of the point according to the Boundary Determination Rule
+	    int newLoc = determineBoundary(boundaryCount);
+	    lbl.setLocation(argIndex, newLoc);
+	  }
+	  
+	  
+	  public void computeSplitEdges(List edgelist)
+	  {
+	    for (Iterator i = edges.iterator(); i.hasNext(); ) {
+	      SnappingEdge e = (SnappingEdge) i.next();
+	      e.getEdgeIntersectionList().addSplitEdges(edgelist);
+	    }
+	  }
+	  
+	  /**
+	   * Borra las intersecciones registradas en los nodos
+	   * (util de cara a reutilizar un GeometryGraph en multiples intersecciones)
+	   * */
+	  public void clearIntersections(){
+		  for (Iterator i = edges.iterator(); i.hasNext(); ) {
+		      SnappingEdge e = (SnappingEdge) i.next();
+		      e.clearIntersections();
+		    }
+	  }
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingGeometryGraph.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingPlanarGraph.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingPlanarGraph.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingPlanarGraph.java	(revision 12191)
@@ -0,0 +1,257 @@
+/*
+ * Created on 11-sep-2006 by azabala
+ *
+ */
+package com.vividsolutions.jts.geomgraph;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import com.vividsolutions.jts.algorithm.CGAlgorithms;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Location;
+import com.vividsolutions.jts.geomgraph.DirectedEdgeStar;
+import com.vividsolutions.jts.geomgraph.Edge;
+import com.vividsolutions.jts.geomgraph.EdgeEnd;
+import com.vividsolutions.jts.geomgraph.EdgeEndStar;
+import com.vividsolutions.jts.geomgraph.Label;
+import com.vividsolutions.jts.geomgraph.Node;
+import com.vividsolutions.jts.geomgraph.NodeFactory;
+import com.vividsolutions.jts.geomgraph.PlanarGraph;
+import com.vividsolutions.jts.geomgraph.Quadrant;
+
+/**
+ * @author alzabord
+ * 
+ * TODO To change the template for this generated type comment go to Window -
+ * Preferences - Java - Code Style - Code Templates
+ */
+public class SnappingPlanarGraph extends PlanarGraph {
+
+	public static final CGAlgorithms cga = new CGAlgorithms();
+
+	protected List edges = new ArrayList();
+
+	protected SnappingNodeMap nodes;
+
+	protected List edgeEndList = new ArrayList();
+
+	
+	/**
+	 * For nodes in the Collection, link the DirectedEdges at the node that are
+	 * in the result. This allows clients to link only a subset of nodes in the
+	 * graph, for efficiency (because they know that only a subset is of
+	 * interest).
+	 */
+	public static void linkResultDirectedEdges(Collection nodes) {
+		for (Iterator nodeit = nodes.iterator(); nodeit.hasNext();) {
+			Node node = (Node) nodeit.next();
+			DirectedEdgeStar edgeStar =  (DirectedEdgeStar) node.getEdges();
+			edgeStar.linkResultDirectedEdges();
+		}
+	}
+
+	public SnappingPlanarGraph(NodeFactory nodeFact, double tolerance) {
+		nodes = new SnappingNodeMap(nodeFact, tolerance);
+	}
+	
+
+	public SnappingPlanarGraph(double tolerance) {
+		nodes = new SnappingNodeMap(new NodeFactory(), tolerance);
+	}
+	
+
+	public Iterator getEdgeIterator() {
+		return edges.iterator();
+	}
+
+	public Collection getEdgeEnds() {
+		return edgeEndList;
+	}
+	
+
+	public boolean isBoundaryNode(int geomIndex, Coordinate coord) {
+		Node node = nodes.find(coord);
+		if (node == null)
+			return false;
+		Label label = node.getLabel();
+		if (label != null && label.getLocation(geomIndex) == Location.BOUNDARY)
+			return true;
+		return false;
+	}
+
+	protected void insertEdge(Edge e) {
+		edges.add(e);
+	}
+	
+
+	
+	public void add(EdgeEnd e) {
+		nodes.add(e);
+		edgeEndList.add(e);
+	}
+	
+	
+
+	public Iterator getNodeIterator() {
+		return nodes.iterator();
+	}
+
+	public Collection getNodes() {
+		return nodes.values();
+	}
+
+	public Node addNode(Node node) {
+		return nodes.addNode(node);
+	}
+
+	public Node addNode(Coordinate coord) {
+		return nodes.addNode(coord);
+	}
+
+	/**
+	 * @return the node if found; null otherwise
+	 */
+	public Node find(Coordinate coord) {
+		return nodes.find(coord);
+	}
+
+	
+	/**
+	 * Add a set of edges to the graph. 
+	 * For each edge two DirectedEdges will be
+	 * created. DirectedEdges are NOT linked by this method.
+	 */
+	public void addEdges(List edgesToAdd) {
+		// create all the nodes for the edges
+		for (Iterator it = edgesToAdd.iterator(); it.hasNext();) {
+			Edge e = (Edge) it.next();
+			edges.add(e);
+			SnapDirectedEdge de1 = new SnapDirectedEdge(e, true);
+			SnapDirectedEdge de2 = new SnapDirectedEdge(e, false);
+			de1.setSym(de2);
+			de2.setSym(de1);
+//IMPORTAR VER QUE PASA AQU�: Para cada nuevo Edge, construye un EdgeEnd que puede dar a lugar a un nodo y que origina un Edge
+			add(de1);
+			add(de2);
+		}
+	}
+
+	/**
+	 * Link the DirectedEdges at the nodes of the graph. This allows clients to
+	 * link only a subset of nodes in the graph, for efficiency (because they
+	 * know that only a subset is of interest).
+	 */
+	public void linkResultDirectedEdges() {
+		for (Iterator nodeit = nodes.iterator(); nodeit.hasNext();) {
+			Node node = (Node) nodeit.next();
+			((DirectedEdgeStar) node.getEdges()).linkResultDirectedEdges();
+		}
+	}
+
+	/**
+	 * Link the DirectedEdges at the nodes of the graph. This allows clients to
+	 * link only a subset of nodes in the graph, for efficiency (because they
+	 * know that only a subset is of interest).
+	 */
+	public void linkAllDirectedEdges() {
+		for (Iterator nodeit = nodes.iterator(); nodeit.hasNext();) {
+			Node node = (Node) nodeit.next();
+			((DirectedEdgeStar) node.getEdges()).linkAllDirectedEdges();
+		}
+	}
+
+	/**
+	 * Returns the EdgeEnd which has edge e as its base edge (MD 18 Feb 2002 -
+	 * this should return a pair of edges)
+	 * 
+	 * @return the edge, if found <code>null</code> if the edge was not found
+	 */
+	public EdgeEnd findEdgeEnd(Edge e) {
+		for (Iterator i = getEdgeEnds().iterator(); i.hasNext();) {
+			EdgeEnd ee = (EdgeEnd) i.next();
+			if (ee.getEdge() == e)
+				return ee;
+		}
+		return null;
+	}
+
+	/**
+	 * Returns the edge whose first two coordinates are p0 and p1
+	 * 
+	 * @return the edge, if found <code>null</code> if the edge was not found
+	 */
+	public Edge findEdge(Coordinate p0, Coordinate p1) {
+		for (int i = 0; i < edges.size(); i++) {
+			Edge e = (Edge) edges.get(i);
+			Coordinate[] eCoord = e.getCoordinates();
+			if (p0.equals(eCoord[0]) && p1.equals(eCoord[1]))
+				return e;
+		}
+		return null;
+	}
+
+	/**
+	 * Returns the edge which starts at p0 and whose first segment is parallel
+	 * to p1
+	 * 
+	 * @return the edge, if found <code>null</code> if the edge was not found
+	 */
+	public Edge findEdgeInSameDirection(Coordinate p0, Coordinate p1) {
+		for (int i = 0; i < edges.size(); i++) {
+			Edge e = (Edge) edges.get(i);
+
+			Coordinate[] eCoord = e.getCoordinates();
+			if (matchInSameDirection(p0, p1, eCoord[0], eCoord[1]))
+				return e;
+
+			if (matchInSameDirection(p0, p1, eCoord[eCoord.length - 1],
+					eCoord[eCoord.length - 2]))
+				return e;
+		}
+		return null;
+	}
+
+	/**
+	 * The coordinate pairs match if they define line segments lying in the same
+	 * direction. E.g. the segments are parallel and in the same quadrant (as
+	 * opposed to parallel and opposite!).
+	 */
+	private boolean matchInSameDirection(Coordinate p0, Coordinate p1,
+			Coordinate ep0, Coordinate ep1) {
+		if (!p0.equals(ep0))
+			return false;
+
+		if (CGAlgorithms.computeOrientation(p0, p1, ep1) == CGAlgorithms.COLLINEAR
+				&& Quadrant.quadrant(p0, p1) == Quadrant.quadrant(ep0, ep1))
+			return true;
+		return false;
+	}
+	
+	public void dump(){
+		System.out.println("EDGES");
+		Iterator it = this.getEdgeIterator();
+		while(it.hasNext()){
+			Edge e = (Edge) it.next();
+			e.print(System.out);
+			System.out.println("");
+		}
+		System.out.println("NODES");
+		it = this.getNodeIterator();
+		while(it.hasNext()){
+			Node node = (Node) it.next();
+			System.out.println(node.getCoordinate());
+			System.out.println(node.getLabel());
+			List edges = node.getEdges().getEdges();
+			for(int z = 0; z < edges.size(); z++){
+				EdgeEnd ee = (EdgeEnd) edges.get(z);
+				Label eeL = ee.getLabel();
+				System.out.println(ee.toString() + "," + eeL.toString());
+			}
+		}
+//		nodes.dump();
+	}
+
+}
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingPlanarGraph.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapEdgeList.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapEdgeList.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapEdgeList.java	(revision 12191)
@@ -0,0 +1,176 @@
+/*
+ * Created on 04-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-10-17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/05 19:20:57  azabala
+* first version in cvs
+*
+*
+*/
+package com.vividsolutions.jts.geomgraph;
+
+import java.awt.geom.Rectangle2D;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import com.iver.cit.gvsig.fmap.spatialindex.RTreeJsi;
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geomgraph.Edge;
+import com.vividsolutions.jts.geomgraph.EdgeList;
+import com.vividsolutions.jts.index.SpatialIndex;
+import com.vividsolutions.jts.index.quadtree.Quadtree;
+/**
+ * Overwrites jts' EdgeList to allow spatial queries
+ * consideering snap.
+ * 
+ * (for example, (0 0, 5 0) and (0.01 0.01, 5.01 0.02)
+ * arent equivalent in findEqualEdge, even thought with a
+ * snap distance of 0.1
+ * 
+ * 
+ * 
+ * */
+public class SnapEdgeList extends EdgeList {
+	private List edges = new ArrayList();
+	 
+//	  private SpatialIndex index = new Quadtree();
+	
+	//El quadtree no funciona bien para indexar dimensiones
+	//lineales o lineas.
+	
+	  private RTreeJsi spatialIndex = new RTreeJsi();
+	  private double snapTolerance;
+	  
+	  
+	  
+	  public SnapEdgeList(double snapTolerance) {
+		  this.snapTolerance = snapTolerance;
+	  }
+
+	  /**
+	   * Insert an edge unless it is already in the list
+	   */
+	  public void add(Edge e)
+	  {
+//        int position = edges.size();		  
+	    edges.add(e);
+	    //TODO me peta el indice espacial
+//	    Envelope oldEnvelope = e.getEnvelope();
+//		Rectangle2D newEnvelope = getEnvelopeForSnap(oldEnvelope);
+//		spatialIndex.insert(newEnvelope, position);
+	  }
+
+	  private Rectangle2D getEnvelopeForSnap(Envelope oldEnvelope){
+			double xmin = oldEnvelope.getMinX() - snapTolerance;
+		  	double ymin = oldEnvelope.getMinY() - snapTolerance;
+		  	double width = oldEnvelope.getWidth() + snapTolerance;
+		  	double height = oldEnvelope.getHeight() + snapTolerance;
+		  	
+		  	return new Rectangle2D.Double(xmin, ymin, width, height);
+	  }
+
+
+//	 <FIX> fast lookup for edges
+	  /**
+	   * If there is an edge equal to e already in the list, return it.
+	   * Otherwise return null.
+	   * @return  equal edge, if there is one already in the list
+	   *          null otherwise
+	   */
+	  public Edge findEqualEdge(Edge e)
+	  {
+		  //TODO NO ENCUENTRO UN INDICE ESPACIAL EN CONDICIONES
+//	    Collection testEdges = spatialIndex.
+//	     query(getEnvelopeForSnap(e.getEnvelope()));
+		  //PETA CON QUADTREE Y CON RTREE DE JSI
+
+		Collection testEdges = edges;  
+		  
+	    for (Iterator i = testEdges.iterator(); i.hasNext(); ) {
+	    	//TODO me peta el indice espacial
+//	      int index = ((Integer)i.next()).intValue();
+	      Edge testEdge = (Edge) i.next();	
+	    	
+//	      Edge testEdge = (Edge) edges.get(index);
+	      if (testEdge.equals(e) ) return testEdge;
+	    }
+	    return null;
+	  }
+	  
+	  public void addAll(Collection edgeColl)
+	  {
+	    for (Iterator i = edgeColl.iterator(); i.hasNext(); ) {
+	      add((Edge) i.next());
+	    }
+	  }
+	  
+	  public Iterator iterator() { return edges.iterator(); }
+
+	  public Edge get(int i) { return (Edge) edges.get(i); }
+
+	  /**
+	   * If the edge e is already in the list, return its index.
+	   * @return  index, if e is already in the list
+	   *          -1 otherwise
+	   */
+	  public int findEdgeIndex(Edge e)
+	  {
+	    for (int i = 0; i < edges.size(); i++) {
+	      if ( ((Edge) edges.get(i)).equals(e) ) return i;
+	    }
+	    return -1;
+	  }
+
+	  
+	  public List getEdges() { return edges; }
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnapEdgeList.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingNodeMap.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingNodeMap.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingNodeMap.java	(revision 12191)
@@ -0,0 +1,515 @@
+/*
+ * Created on 11-sep-2006 by azabala
+ *
+ */
+package com.vividsolutions.jts.geomgraph;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+
+import com.vividsolutions.jts.algorithms.SnapSimplePointInAreaLocator;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geom.Location;
+import com.vividsolutions.jts.geom.TopologyException;
+import com.vividsolutions.jts.geomgraph.DirectedEdge;
+import com.vividsolutions.jts.geomgraph.DirectedEdgeStar;
+import com.vividsolutions.jts.geomgraph.Edge;
+import com.vividsolutions.jts.geomgraph.EdgeEnd;
+import com.vividsolutions.jts.geomgraph.EdgeEndStar;
+import com.vividsolutions.jts.geomgraph.GeometryGraph;
+import com.vividsolutions.jts.geomgraph.Label;
+import com.vividsolutions.jts.geomgraph.Node;
+import com.vividsolutions.jts.geomgraph.NodeFactory;
+import com.vividsolutions.jts.geomgraph.NodeMap;
+import com.vividsolutions.jts.geomgraph.Position;
+import com.vividsolutions.jts.util.Assert;
+
+/**
+ * Repository of nodes of a PlanarGraph that applies a snap tolerance.
+ * 
+ * If we ask for a node, and it founds a node in the tolerance distance it
+ * returns the found node.
+ * 
+ * 
+ * 
+ * @author alzabord
+ */
+public class SnappingNodeMap extends NodeMap {
+
+	
+
+	// Esto  va a ir muy lento
+	// buscar otros mecanismos (indice espacial, o hashmap)
+	protected HashMap nodeMap;
+
+	private class SnapDirectedEdgeStar extends DirectedEdgeStar {
+
+		/**
+		 * The location of the point for this star in Geometry i Areas
+		 */
+		private int[] ptInAreaLocation = { Location.NONE, Location.NONE };
+
+		private Label label;
+
+		List resultAreaEdgeList = null;
+
+		List getResultAreaEdges() {
+			if (resultAreaEdgeList != null)
+				return resultAreaEdgeList;
+			resultAreaEdgeList = new ArrayList();
+			for (Iterator it = iterator(); it.hasNext();) {
+				DirectedEdge de = (DirectedEdge) it.next();
+				if (de.isInResult() || de.getSym().isInResult())
+					resultAreaEdgeList.add(de);
+			}
+			return resultAreaEdgeList;
+		}
+
+		private final int SCANNING_FOR_INCOMING = 1;
+
+		private final int LINKING_TO_OUTGOING = 2;
+
+		private SnapDirectedEdgeStar() {
+			super();
+
+			edgeList = new ArrayList();
+
+		}
+
+		/**
+		 * Traverse the star of DirectedEdges, linking the included edges
+		 * together. To link two dirEdges, the <next> pointer for an incoming
+		 * dirEdge is set to the next outgoing edge.
+		 * <p>
+		 * DirEdges are only linked if:
+		 * <ul>
+		 * <li>they belong to an area (i.e. they have sides)
+		 * <li>they are marked as being in the result
+		 * </ul>
+		 * <p>
+		 * Edges are linked in CCW order (the order they are stored). This means
+		 * that rings have their face on the Right (in other words, the
+		 * topological location of the face is given by the RHS label of the
+		 * DirectedEdge)
+		 * <p>
+		 * PRECONDITION: No pair of dirEdges are both marked as being in the
+		 * result
+		 */
+		public void linkResultDirectedEdges() {
+			// make sure edges are copied to resultAreaEdges list
+			List resultEdges = getResultAreaEdges();
+			// find first area edge (if any) to start linking at
+			DirectedEdge firstOut = null;
+			DirectedEdge incoming = null;
+			int state = SCANNING_FOR_INCOMING;
+			// link edges in CCW order
+			for (int i = 0; i < resultAreaEdgeList.size(); i++) {
+				DirectedEdge nextOut = (DirectedEdge) resultEdges.get(i);
+				DirectedEdge nextIn = nextOut.getSym();
+
+				// skip de's that we're not interested in
+				if (!nextOut.getLabel().isArea())
+					continue;
+
+				// record first outgoing edge, in order to link the last
+				// incoming edge
+				if (firstOut == null && nextOut.isInResult())
+					firstOut = nextOut;
+				// assert: sym.isInResult() == false, since pairs of dirEdges
+				// should have been removed already
+
+				switch (state) {
+				case SCANNING_FOR_INCOMING:
+					if (!nextIn.isInResult())
+						continue;
+					incoming = nextIn;
+					state = LINKING_TO_OUTGOING;
+					break;
+				case LINKING_TO_OUTGOING:
+					if (!nextOut.isInResult())
+						continue;
+					incoming.setNext(nextOut);
+					state = SCANNING_FOR_INCOMING;
+					break;
+				}
+			}// for
+			if (state == LINKING_TO_OUTGOING) {
+				// Debug.print(firstOut == null, this);
+				if (firstOut == null)
+					throw new TopologyException("no outgoing dirEdge found",
+							getCoordinate());
+				// Assert.isTrue(firstOut != null, "no outgoing dirEdge found
+				// (at " + getCoordinate() );
+				Assert.isTrue(firstOut.isInResult(),
+						"unable to link last incoming dirEdge");
+				incoming.setNext(firstOut);
+			}
+		}
+
+		/**
+		 * Insert an EdgeEnd into the map, and clear the edgeList cache, since
+		 * the list of edges has now changed
+		 */
+		protected void insertEdgeEnd(EdgeEnd e, Object obj) {
+			edgeMap.put(e, obj);
+			if (edgeList == null)
+				edgeList = new ArrayList();
+			edgeList.add(e);
+
+			// Necesitamos que la "estrella" de Ejes asociada a un Nodo conserve
+			// siempre un orden antihorario. Por eso, cada vez que se a�ada un
+			// nuevo
+			// eje solo se inserta en el Map (que mantiene el orden)
+			// y la cache se pone a null
+
+			// edgeList = null;
+		}
+
+		public Iterator iterator() {
+			return getEdges().iterator();
+		}
+
+		public List getEdges() {
+			Collections.sort(edgeList, new Comparator() {
+				public int compare(Object arg0, Object arg1) {
+					EdgeEnd e0 = (EdgeEnd) arg0;
+					EdgeEnd e1 = (EdgeEnd) arg1;
+					return e0.compareTo(e1);
+				}
+			});
+			// if (edgeList == null) {
+			// edgeList = new ArrayList(edgeMap.values());
+			// }
+			return edgeList;
+		}
+
+		public Label getLabel() {
+			return label;
+		}
+
+		void computeEdgeEndLabels() {
+			// Compute edge label for each EdgeEnd
+			for (Iterator it = iterator(); it.hasNext();) {
+				EdgeEnd ee = (EdgeEnd) it.next();
+				ee.computeLabel();
+			}
+		}
+
+		void propagateSideLabels(int geomIndex) {
+			// Since edges are stored in CCW order around the node,
+			// As we move around the ring we move from the right to the left
+			// side of the edge
+			int startLoc = Location.NONE;
+			// initialize loc to location of last L side (if any)
+			// System.out.println("finding start location");
+			for (Iterator it = iterator(); it.hasNext();) {
+				EdgeEnd e = (EdgeEnd) it.next();
+				Label label = e.getLabel();
+				if (label.isArea(geomIndex)
+						&& label.getLocation(geomIndex, Position.LEFT) != Location.NONE)
+					startLoc = label.getLocation(geomIndex, Position.LEFT);
+			}
+			// no labelled sides found, so no labels to propagate
+			if (startLoc == Location.NONE)
+				return;
+
+			int currLoc = startLoc;
+			for (Iterator it = iterator(); it.hasNext();) {
+				EdgeEnd e = (EdgeEnd) it.next();
+				Label label = e.getLabel();
+				// set null ON values to be in current location
+				if (label.getLocation(geomIndex, Position.ON) == Location.NONE)
+					label.setLocation(geomIndex, Position.ON, currLoc);
+				// set side labels (if any)
+				// if (label.isArea()) { //ORIGINAL
+				if (label.isArea(geomIndex)) {
+					int leftLoc = label.getLocation(geomIndex, Position.LEFT);
+					int rightLoc = label.getLocation(geomIndex, Position.RIGHT);
+					// if there is a right location, that is the next location
+					// to propagate
+					if (rightLoc != Location.NONE) {
+						// Debug.print(rightLoc != currLoc, this);
+						if (rightLoc != currLoc)
+							throw new TopologyException(
+									"side location conflict", e.getCoordinate());
+						if (leftLoc == Location.NONE) {
+							Assert
+									.shouldNeverReachHere("found single null side (at "
+											+ e.getCoordinate() + ")");
+						}
+						currLoc = leftLoc;
+					} else {
+						/**
+						 * RHS is null - LHS must be null too. This must be an
+						 * edge from the other geometry, which has no location
+						 * labelling for this geometry. This edge must lie
+						 * wholly inside or outside the other geometry (which is
+						 * determined by the current location). Assign both
+						 * sides to be the current location.
+						 */
+						Assert.isTrue(label.getLocation(geomIndex,
+								Position.LEFT) == Location.NONE,
+								"found single null side");
+						label.setLocation(geomIndex, Position.RIGHT, currLoc);
+						label.setLocation(geomIndex, Position.LEFT, currLoc);
+					}
+				}
+			}
+		}
+
+		int getLocation(int geomIndex, Coordinate p, GeometryGraph[] geom) {
+			// compute location only on demand
+			if (ptInAreaLocation[geomIndex] == Location.NONE) {
+				ptInAreaLocation[geomIndex] = SnapSimplePointInAreaLocator
+						.locate(p, geom[geomIndex].getGeometry(), snapTolerance);
+			}
+			return ptInAreaLocation[geomIndex];
+		}
+
+		public void mergeSymLabels() {
+			for (Iterator it = iterator(); it.hasNext();) {
+				DirectedEdge de = (DirectedEdge) it.next();
+				Label label = de.getLabel();
+				Label symLabel = de.getSym().getLabel();
+				label.merge(symLabel);
+			}
+		}
+
+		/**
+		 * Update incomplete dirEdge labels from the labelling for the node
+		 */
+		public void updateLabelling(Label nodeLabel) {
+			for (Iterator it = iterator(); it.hasNext();) {
+				DirectedEdge de = (DirectedEdge) it.next();
+				Label label = de.getLabel();
+				label.setAllLocationsIfNull(0, nodeLabel.getLocation(0));
+				label.setAllLocationsIfNull(1, nodeLabel.getLocation(1));
+			}
+		}
+
+		public void computeLabelling(GeometryGraph[] geom) {
+			computeEdgeEndLabels();
+			propagateSideLabels(0);
+			propagateSideLabels(1);
+			boolean[] hasDimensionalCollapseEdge = { false, false };
+			for (Iterator it = iterator(); it.hasNext();) {
+				EdgeEnd e = (EdgeEnd) it.next();
+				Label label = e.getLabel();
+				for (int geomi = 0; geomi < 2; geomi++) {
+					if (label.isLine(geomi)
+							&& label.getLocation(geomi) == Location.BOUNDARY)
+						hasDimensionalCollapseEdge[geomi] = true;
+				}
+			}
+			for (Iterator it = iterator(); it.hasNext();) {
+				EdgeEnd e = (EdgeEnd) it.next();
+				Label label = e.getLabel();
+				for (int geomi = 0; geomi < 2; geomi++) {
+					if (label.isAnyNull(geomi)) {
+						int loc = Location.NONE;
+						if (hasDimensionalCollapseEdge[geomi]) {
+							loc = Location.EXTERIOR;
+						} else {
+							Coordinate p = e.getCoordinate();
+							loc = getLocation(geomi, p, geom);
+						}
+						label.setAllLocationsIfNull(geomi, loc);
+					}// if
+				}// for
+			}// for
+
+			// determine the overall labelling for this DirectedEdgeStar
+			// (i.e. for the node it is based at)
+			label = new Label(Location.NONE);
+			for (Iterator it = iterator(); it.hasNext();) {
+				EdgeEnd ee = (EdgeEnd) it.next();
+				Edge e = ee.getEdge();
+				Label eLabel = e.getLabel();
+				for (int i = 0; i < 2; i++) {
+					int eLoc = eLabel.getLocation(i);
+					if (eLoc == Location.INTERIOR || eLoc == Location.BOUNDARY)
+						label.setLocation(i, Location.INTERIOR);
+				}
+			}
+		}
+	}
+
+	class SnapNode extends Node {
+
+		public SnapNode(Coordinate arg0, EdgeEndStar arg1) {
+			super(arg0, arg1);
+		}
+
+		public boolean equals(Object obj) {
+			SnapNode other = (SnapNode) obj;
+			return other.coord.distance(this.coord) <= snapTolerance;
+		}
+
+		public int hashCode() {
+			return 1; // esto no es eficiente
+		}
+	}
+
+	private double snapTolerance;
+
+	public SnappingNodeMap(NodeFactory nodeFactory, double snapTolerance) {
+		super(nodeFactory);
+		this.snapTolerance = snapTolerance;
+		// spatialIndex = new Quadtree();
+		nodeMap = new HashMap();
+	}
+
+	class MinDistCoordComparator implements Comparator {
+		Coordinate coord;
+
+		MinDistCoordComparator(Coordinate coord) {
+			this.coord = coord;
+		}
+
+		public int compare(Object arg0, Object arg1) {
+			Coordinate c1 = ((Node) arg0).getCoordinate();
+			Coordinate c2 = ((Node) arg1).getCoordinate();
+
+			double d1 = c1.distance(coord);
+			double d2 = c2.distance(coord);
+
+			if (d1 < d2)
+				return 1;
+			if (d1 > d2)
+				return -1;
+			else
+				return 0;
+		}
+	}
+
+	private Envelope getQueryRect(Coordinate coord) {
+		double xmin = coord.x - snapTolerance;
+		double ymin = coord.y - snapTolerance;
+		double xmax = coord.x + snapTolerance;
+		double ymax = coord.y + snapTolerance;
+		Envelope queryRect = new Envelope(xmin, xmax, ymin, ymax);
+		return queryRect;
+	}
+
+	public Node addNode(final Coordinate coord) {
+		SnapNode candidate = null;
+		DirectedEdgeStar edgeStar = new SnapDirectedEdgeStar();
+		candidate = new SnapNode(coord, edgeStar);
+
+		/*
+		 * PRUEBA PARA VER POR QU� DA ERRORES CON POLIGONOS
+		 * 
+		 * 
+		 * 
+		 */
+
+		Node stored = (Node) nodeMap.get(candidate);
+		if (stored != null)
+			return stored;
+		else {
+			nodeMap.put(candidate, candidate);
+			return candidate;
+		}
+		// Envelope queryRect = getQueryRect(coord);
+		// List nodes = spatialIndex.query(queryRect);
+		// Spatial Index est� devolviendo candidatos fuera del rectangulo
+		// ser� problema del quadtree
+		// if(nodes.size() != 0){
+		// Collections.sort(nodes, new MinDistCoordComparator(coord));
+		// Node candidate = (Node) nodes.get(0);
+		// if(candidate.getCoordinate().distance(coord) < snapTolerance )
+		// return candidate;
+		// }else{
+		// System.out.println("El nodo "+coord.x+","+coord.y+" no tiene entradas
+		// analogas en el quadtree");
+		// List all = this.spatialIndex.queryAll();
+		// System.out.println("en el quadtree "+all.size());
+		// for(int i = 0; i < all.size(); i++){
+		// Node node = (Node) all.get(i);
+		// Coordinate coord2 = node.getCoordinate();
+		// System.out.println(coord2.x + "," + coord2.y);
+		// }
+		// }
+		// Node solution = nodeFactory.createNode(coord);
+		// spatialIndex.insert(queryRect, solution);
+		// return solution;
+	}
+
+	// FIXME: REVISAR SI HABR�A QUE HACER UN MERGE LABEL ARRIBA O AQU�
+	public Node addNode(Node n) {
+
+		Node node = addNode(n.getCoordinate());
+		node.mergeLabel(n);
+		return node;
+	}
+
+	/**
+	 * Adds a node for the start point of this EdgeEnd (if one does not already
+	 * exist in this map). Adds the EdgeEnd to the (possibly new) node.
+	 */
+	public void add(EdgeEnd e) {
+		Coordinate p = e.getCoordinate();
+		Node n = addNode(p);
+		n.add(e);// Si el nodo ya existe, se le a�ade una arista
+	}
+
+	/**
+	 * @return the node if found; null otherwise
+	 */
+	public Node find(Coordinate coord) {
+		// Envelope queryRect = getQueryRect(coord);
+		// List nodes = spatialIndex.query(getQueryRect(coord));
+		// Collections.sort(nodes, new MinDistCoordComparator(coord));
+		// Node candidate = (Node) nodes.get(0);
+		return (Node) nodeMap.get(new SnapNode(coord, null));
+		// return candidate;
+	}
+
+	public Iterator iterator() {
+		return nodeMap.values().iterator();
+		// return spatialIndex.queryAll().iterator();
+	}
+
+	public Collection values() {
+		return nodeMap.values();
+		// return spatialIndex.queryAll();
+	}
+
+	public Collection getBoundaryNodes(int geomIndex) {
+		Collection bdyNodes = new ArrayList();
+		for (Iterator i = iterator(); i.hasNext();) {
+			Node node = (Node) i.next();
+			if (node.getLabel().getLocation(geomIndex) == Location.BOUNDARY)
+				bdyNodes.add(node);
+		}
+		return bdyNodes;
+	}
+
+	public void dump() {
+		System.out.println(this.toString());
+		Iterator it = iterator();
+		while (it.hasNext()) {
+			Node node = (Node) it.next();
+			Coordinate coord = node.getCoordinate();
+			System.out.println("x= " + coord.x + ", y= " + coord.y);
+		}
+	}
+
+	public static void main(String[] args) {
+		SnappingNodeMap nodeMap = new SnappingNodeMap(new NodeFactory(), 0.01);
+		nodeMap.addNode(new Coordinate(0.001, 0.001));
+		nodeMap.addNode(new Coordinate(0.002, 0.002));
+		Iterator it = nodeMap.iterator();
+		while (it.hasNext()) {
+			Node node = (Node) it.next();
+			Coordinate coord = node.getCoordinate();
+			System.out.println("x= " + coord.x + ", y= " + coord.y);
+		}
+	}
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingNodeMap.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingEdge.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingEdge.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingEdge.java	(revision 12191)
@@ -0,0 +1,251 @@
+/*
+ * Created on 02-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.2  2006-10-19 16:06:48  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/05 19:20:57  azabala
+* first version in cvs
+*
+* Revision 1.1  2006/10/02 19:06:39  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.vividsolutions.jts.geomgraph;
+
+import com.vividsolutions.jts.algorithm.LineIntersector;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geomgraph.Edge;
+import com.vividsolutions.jts.geomgraph.EdgeIntersectionList;
+import com.vividsolutions.jts.geomgraph.Label;
+import com.vividsolutions.jts.geomgraph.index.MonotoneChainEdge;
+import com.vividsolutions.jts.geomgraph.index.SnapMonotoneChainEdge;
+
+public class SnappingEdge extends Edge {
+
+	  SnapEdgeIntersectionList eiList;
+	  private double snapTolerance;
+	  private SnapMonotoneChainEdge mce;
+	  
+	  /**
+	   * TODO->Esto es una cagada????
+	   * El problema es que no estoy aplicando SNAP
+	   * en el compute de intersecciones colineales
+	   * 
+	   * 
+	   * 
+	   * Nos permite snapear las coordenadas del Edge, para
+	   * que antes de a�adir un SnapEdgeIntersection se verifique
+	   * si coincide con un vertice (y  snapearlo al vertice
+	   * para evitar que salgan cosas raras)
+	   * */
+	  private SnappingNodeMap nodes; 
+	 
+	  public SnappingEdge(Coordinate[] pts, Label label, double tolerance)
+	  {
+		super(pts, label);
+		this.snapTolerance = tolerance;
+		eiList = new SnapEdgeIntersectionList(this);
+		
+	  }
+	  
+	  public double getSnapTolerance(){
+		  return snapTolerance;
+	  }
+	  
+	  public SnappingEdge(Coordinate[] pts, double snapTolerance)
+	  {
+	    this(pts, null, snapTolerance);
+	  }
+
+	 
+	  public EdgeIntersectionList getEdgeIntersectionList() { 
+		  return eiList; 
+	  }
+
+	  
+	  public MonotoneChainEdge getMonotoneChainEdge()
+	  {
+	    if (mce == null) 
+	    	mce = new SnapMonotoneChainEdge(this, snapTolerance);
+	    return  mce;
+	  }
+	  
+	  public boolean isPointwiseEqual(Edge e)
+	  {
+		Coordinate[] thisCoordinates = this.getCoordinates();
+	    Coordinate[] otherCoordinates = e.getCoordinates();
+	    if (thisCoordinates.length != otherCoordinates.length) 
+	    	return false;
+
+	    for (int i = 0; i < thisCoordinates.length; i++) {
+	      if (! (thisCoordinates[i].distance(otherCoordinates[i]) <= snapTolerance)) {
+	         return false;
+	      }
+	    }
+	    return true;
+	  }
+	  
+	  public boolean equals(Object o)
+	  {
+	    if (! (o instanceof Edge)) return false;
+	    Edge e = (Edge) o;
+        Coordinate[] thisCoordinates = this.getCoordinates();
+        Coordinate[] otherCoordinates = e.getCoordinates();
+	    if (thisCoordinates.length != otherCoordinates.length) 
+	    	return false;
+
+	    boolean isEqualForward = true;
+	    boolean isEqualReverse = true;
+	    int iRev = thisCoordinates.length;
+	    for (int i = 0; i < thisCoordinates.length; i++) {
+	      if (! (thisCoordinates[i].distance(otherCoordinates[i])
+	    		  <= snapTolerance)) {
+	         isEqualForward = false;
+	      }
+	      if (!(thisCoordinates[i].distance(otherCoordinates[--iRev]) <= snapTolerance)) {
+	         isEqualReverse = false;
+	      }
+	      if (! isEqualForward && ! isEqualReverse) return false;
+	    }
+	    return true;
+	  }
+	 
+	  
+	  /**
+	   * Adds EdgeIntersections for one or both
+	   * intersections found for a segment of an edge to the edge intersection list.
+	   */
+	  public void addIntersections(LineIntersector li, 
+			  int segmentIndex,
+			  int geomIndex){
+		  
+		  //se supone que si es colineal, aqu� se a�aden los
+		  // dos puntos
+		  
+		    for (int i = 0; i < li.getIntersectionNum(); i++) {
+		      addIntersection(li, segmentIndex, geomIndex, i);
+		    }
+	  }
+	  
+	  /**
+	   * Add an EdgeIntersection for intersection intIndex.
+	   * An intersection that falls exactly on a vertex of the edge is normalized
+	   * to use the higher of the two possible segmentIndexes
+	   */
+	  public void addIntersection(LineIntersector li, 
+			  int segmentIndex, 
+			  int geomIndex, 
+			  int intIndex)
+	  {
+	      Coordinate intPt = new Coordinate(li.getIntersection(intIndex));
+	      
+	      
+//	      AQUI ESTA OTRA DE LAS CLAVES
+//	      intPt es una coordenada, que puede estar muy cerca de alguna coordenada
+//	      del EDGE. �Como gestionar esto?
+//	      CREO QUE LO MEJOR ES SNAPEAR
+	    
+	      int normalizedSegmentIndex = segmentIndex;
+	      double dist = li.getEdgeDistance(geomIndex, intIndex);
+	      // normalize the intersection point location
+	      int nextSegIndex = normalizedSegmentIndex + 1;
+	      if (nextSegIndex < super.getNumPoints()) {
+	        Coordinate nextPt = super.getCoordinate(nextSegIndex);
+	        
+	        //TODO VER ESTO DEL 0.0
+//	        AQUI PASA ALGO RARO TAMBIEN
+//	        PARA EL TEST N� 1, TUVE QUE A�ADIR EL ELSE
+//	        PERO PARA EL SIGUIENTE TESTE CREO QUE ME EST� PERDIENDO
+//	        LOS PUNTOS INTERMEDIOS
+	        
+	        
+	        //if (intPt.distance(nextPt) == 0.0) {
+	        if (intPt.distance(nextPt) <= snapTolerance) {
+	            normalizedSegmentIndex = nextSegIndex;
+	            dist = 0.0;
+	            intPt = nextPt;
+	            
+	        }else{
+	        	Coordinate previousPoint = this.getCoordinate(normalizedSegmentIndex);
+	        	if(intPt.distance(previousPoint) <= snapTolerance){
+	        		dist = 0.0;
+	        		intPt = previousPoint;
+	        	}
+	        }
+	        
+	        /*
+	        TODO
+	        Esto lo a�ado porque cuando la interseccion es un snapping, me conserva
+	        todos los puntos y me salen dos puntos seguidos iguales (probar)
+	        y luego la clase Quadrant me tira excepciones
+	        */
+//	        else if (intPt.distance(nextPt) <= snapTolerance) {
+//	            normalizedSegmentIndex = segmentIndex;
+//	            dist = 0.0;
+//				//TODO PRUEBA 
+//				intPt = nextPt;	            
+//	        }
+	      }
+	      
+	      eiList.add(intPt, normalizedSegmentIndex, dist);
+	  }	 
+	  
+	  /**
+	   * Util para volver a calcular intersecciones de este Edge
+	   * con los Edges de un geometrygraph distinto al original
+	   * 
+	   * */
+	  public void clearIntersections(){
+		  eiList = new SnapEdgeIntersectionList(this);
+	  }
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/geomgraph/SnappingEdge.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/NonRobustSnapLineIntersector.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/NonRobustSnapLineIntersector.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/NonRobustSnapLineIntersector.java	(revision 12191)
@@ -0,0 +1,93 @@
+/*
+ * Created on 28-sep-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-10-19 16:06:48  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/05 19:20:57  azabala
+* first version in cvs
+*
+* Revision 1.1  2006/10/02 19:06:56  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.vividsolutions.jts.operation.overlay;
+
+
+import com.vividsolutions.jts.algorithm.NonRobustLineIntersector;
+
+public class NonRobustSnapLineIntersector extends NonRobustLineIntersector {
+
+	/**
+	   * @return true if both numbers are positive or if both numbers are negative.
+	   * Returns false if both numbers are zero.
+	   */
+	  public static boolean isSameSignAndNonZero(double a, double b) {
+	    if (a == 0 || b == 0) {
+	      return false;
+	    }
+	    return (a < 0 && b < 0) || (a > 0 && b > 0);
+	  }
+
+
+	  public NonRobustSnapLineIntersector() {
+	  }
+
+	  
+	  
+
+
+
+	
+
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/NonRobustSnapLineIntersector.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnapLineIntersector.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnapLineIntersector.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnapLineIntersector.java	(revision 12191)
@@ -0,0 +1,436 @@
+/*
+ * Created on 27-sep-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.1  2006-10-19 16:06:48  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.1  2006/10/17 18:25:53  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.1  2006/10/05 19:20:57  azabala
+ * first version in cvs
+ *
+ * Revision 1.1  2006/10/02 19:06:56  azabala
+ * *** empty log message ***
+ *
+ *
+ */
+package com.vividsolutions.jts.operation.overlay;
+
+import com.vividsolutions.jts.algorithm.CGAlgorithms;
+import com.vividsolutions.jts.algorithm.RobustLineIntersector;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geom.LineSegment;
+
+public class SnapLineIntersector extends RobustLineIntersector {
+
+	double snapTolerance;
+
+	public SnapLineIntersector(double snapTolerance) {
+		super();
+		this.snapTolerance = snapTolerance;
+	}
+
+	public void computeIntersection(Coordinate p, Coordinate p1, Coordinate p2) {
+		isProper = false;
+		Envelope snapEnvelope = new Envelope(p.x - snapTolerance,
+				p.x + snapTolerance,
+				p.y - snapTolerance,
+				p.y + snapTolerance);
+		Envelope segmentEnvelope = new Envelope(p1, p2);
+		if(segmentEnvelope.intersects(snapEnvelope))
+		{
+			LineSegment segment = new LineSegment(p1, p2);
+			/*
+			 * TODO SERIA MUY INTERESANTE QUE, ADEMAS DE VER SI EL PUNTO MAS
+			 * PROXIMO DEL SEGMENTO AL PUNTO DADO ENTRA EN SNAP, VER TAMBI�N EL
+			 * REGISTRO DE NODOS (NODEMAP)????
+			 * 
+			 */
+			Coordinate intersectionCandidate = segment.closestPoint(p);
+			if (intersectionCandidate.distance(p) <= snapTolerance) {
+				isProper = true;
+				//verify if it is an extreme point
+				if (intersectionCandidate.distance(p1) <= snapTolerance) {
+					isProper = false;
+					result = DO_INTERSECT;
+					intPt[0] = p1;//we snaps to the point
+				}
+				
+				if (intersectionCandidate.distance(p2) <= snapTolerance){
+					isProper = false;
+					result = DO_INTERSECT;
+					intPt[0] = p2;//we snaps to the point
+				}
+				
+				result = DO_INTERSECT;
+				intPt[0] = intersectionCandidate;
+				return;
+			}//distance < snap tolerance
+		}//segmentEnvelope 
+		result = DONT_INTERSECT;
+	}
+	
+	
+	
+	
+	public int computeIntersect(Coordinate p1, Coordinate p2,
+								Coordinate q1, Coordinate q2) {
+		isProper = false;
+		Envelope env1 = new Envelope(p1, p2);
+		double newMinX = env1.getMinX() - snapTolerance;
+		double newMaxX = env1.getMaxX() + snapTolerance;
+		double newMinY = env1.getMinY() - snapTolerance;
+		double newMaxY = env1.getMaxY() + snapTolerance;
+		env1 = new Envelope(newMinX, newMaxX, newMinY, newMaxY);
+		
+		Envelope env2 = new Envelope(q1, q2);
+		newMinX = env2.getMinX() - snapTolerance;
+		newMaxX = env2.getMaxX() + snapTolerance;
+		newMinY = env2.getMinY() - snapTolerance;
+		newMaxY = env2.getMaxY() + snapTolerance;
+		env2 = new Envelope(newMinX, newMaxX, newMinY, newMaxY);
+		
+		if(! env1.intersects(env2))
+			return DONT_INTERSECT;
+		
+		/*
+		 * Algoritmo para calcular interseccion de dos segmentos aplicando snapping
+		 * */
+	
+		//1-vemos si intersectan sin necesidad de snap
+		int test = super.computeIntersect(p1, p2, q1, q2);
+		if(test != DONT_INTERSECT)
+			return test;
+		
+	
+		//2-Vemos si son paralelos, y la distancia que los separa es inferior
+		//a la de snap (si fuesen coincidentes ya habr�a sido detectado
+		
+	   //condiciones de paralelismo en funci�n del producto escalar
+		//ver http://www.faqs.org/faqs/graphics/algorithms-faq/
+		//distancia de punto a recta y de recta a recta
+	    double r_bot = (p2.x-p1.x)*(q2.y-q1.y) - (p2.y-p1.y)*(q2.x-q1.x);
+	    
+	    /*
+	     * Ahora mismo no recuerdo el significado matem�tico de r_bot
+	     * (es  (Dx1 * Dy2) - (Dy1 * Dx2) siendo (Dx1,Dy1) (Dx2, Dy2)
+	     * los vectores que se est� tratando de ver si son paralelos...
+	     * 
+	     * Como no tengo claro qu� es, la condici�n de snap va a ser
+	     * la distancia de snap
+	     * */
+	    
+	   // boolean parallels = (r_bot==0);
+	    
+	    boolean parallels = (Math.abs(r_bot) <= snapTolerance);
+	    
+	    
+	    if  ( parallels ) {      
+	    	//Son paralelos
+	    	double distance1 = CGAlgorithms.distancePointLine(p1, q1, q2);
+	    	double distance2 = CGAlgorithms.distancePointLine(p2, q1, q2);
+	    	double distance = Math.min(distance1, distance2);
+	    	if(distance <= snapTolerance)
+	    		return computeCollinearIntersection(p1, p2, q1, q2);
+	    	else 
+	    		return DONT_INTERSECT;
+	    }
+	    
+	    //Ultimo intento. Probamos a intersectar cada uno de los vertices de la
+	    //linea de entrada
+	    computeIntersection(p1, q1, q2);
+	    if(this.hasIntersection()){
+	    	return result;
+	    }
+	    computeIntersection(p2, q1, q2);
+	    if(this.hasIntersection())
+	    {
+	    	return result;
+	    }
+		return DONT_INTERSECT;
+	}
+	
+	/**
+	 * Returns t param for point P of vector AB in the parametric line equation
+	 * P = t*AB
+	 * 
+	 * @param p
+	 * @param A
+	 * @param B
+	 */
+	private double getParametrizedLineFactor(Coordinate p, Coordinate A, Coordinate B){
+		 double r = ( (p.x - A.x) * (B.x - A.x) + (p.y - A.y) * (B.y - A.y) )
+         /
+       ( (B.x - A.x) * (B.x - A.x) + (B.y - A.y) * (B.y - A.y) );
+		 return r;
+	}
+
+	
+	/*
+	 * Computes collinear intersections, but instead of considering envelope 
+	 * intersections, it applies parametrized line equations (ideal to snap)
+	 * */
+	private int computeCollinearIntersection(Coordinate p1, Coordinate p2,
+			Coordinate q1, Coordinate q2) {
+
+		/*
+		 * TODO
+		 * Estamos teniendo un problema: La clase SegmentIntersector hace el
+		 * siguiente uso de computeCollinearIntersection:
+		 * 
+		 * li.computeIntersection(p00, p01, p10, p11);
+           if (li.hasIntersection()) {
+      			numIntersections++;
+           if (! isTrivialIntersection(e0, segIndex0, e1, segIndex1)) {
+           		hasIntersection = true;
+           		if (includeProper || ! li.isProper() ) {
+           			e0.addIntersections(li, segIndex0, 0);
+           			e1.addIntersections(li, segIndex1, 1);
+                }
+               if (li.isProper()) {
+                            properIntersectionPoint = 
+                            (Coordinate) li.getIntersection(0).clone();
+                           hasProper = true;
+                           if (! isBoundaryPoint(li, bdyNodes))
+                                hasProperInterior = true;
+               }
+               
+               Y esto aparece comentado:
+               	//if (li.isCollinear())
+               	 //hasCollinear = true;
+               
+               En estas circunstancias no se est� recuperando
+               el segundo punto de la intersecci�n colineal, ni se 
+               verifica que es una intersecci�n colineal
+     
+		 * */
+		
+		
+		/*
+		 * TODO Otro problema: a la hora de calcular la intersecci�n entre dos
+		 * segmentos colineales, definir bien CUAL VA A SNAPEAR SOBRE CUAL.
+		 * 
+		 * Es decir, en grafoA.computeIntersect(grafoB), las coordenadas del GeometryGraph
+		 * B se mover�n a las l�neas del GeometryGraph B
+		 * 
+		 * ESTO NO ES TAN IMPORTANTE COMO SNAPEAR EdgeIntersection y Coordinate
+		 * de un Edge
+		 * 
+		 * */
+		
+		/*
+		 * We compute params of p1 and p2 point in q1q2 parametric
+		 * line equation
+		 * */		
+		
+		
+//REHACER ESTO
+//DADAS DOS LINEAS PARALELAS, SI EST�N A UNA DISTANCIA (LAS LINEAS)
+//INTERIOR A LA DE SNAP, HAY QUE CONSIDERARLAS COLINEALES..........
+//PERO ES MUY IMPORTANTE SNAPEAR P1 CON Q1-Q2 Y P2 CON Q1-Q2 PARA QUE
+//NO SALGAN COSAS RARAS (EDGEINTERSECTION NO PROPIAS)
+//
+//TAMBIEN HAY QUE DEFINIR UNA POLITICA DE SNAP:
+//QUE LINEA SE MANTIENE Y QUE LINEA SE MUEVE
+//(NO HACER ARBITRARIAMENTE)
+		
+		double rP1 = getParametrizedLineFactor(p1, q1, q2);
+		double rP2 = getParametrizedLineFactor(p2, q1, q2);
+		
+		if(rP1 <= 0 && rP2 <= 0)
+		{
+			// p1---p2--q1----q2
+			intPt[0] = q1;
+			return DO_INTERSECT;
+		}
+		
+		if(rP1 <= 0 && ( (rP2 > 0 && rP2 <=1))){
+			// p1---q1---p2----q2
+			isProper = false;
+			intPt[0] = q1;
+			intPt[1] = p2;
+			return COLLINEAR;
+		}
+		
+		if( (rP1 >0 && rP1 <=1) && (rP2 > 0 && rP2 <= 1)){
+			//p1--q1---q2---p2
+			intPt[0] = q1;
+			intPt[1] = q2;
+			return COLLINEAR;
+		}
+		
+		if((rP1 >0 && rP1 <= 1) && (rP2 > 1)){
+			//q1--p1--q2--p2
+			intPt[0] = p1;
+			intPt[1] = q2;
+			return COLLINEAR;
+			
+		}
+		
+		if((rP1 < 0) && (rP2 > 1)){
+			//p1---q1---q2--p2
+			intPt[0] = q1;
+			intPt[1] = q2;
+			return COLLINEAR;
+		}
+		
+		if((rP1 > 1) && (rP2 > 1)){
+			//q1--q2--p1--p2
+			intPt[0] = q2;
+			return DO_INTERSECT;
+		}
+		return DONT_INTERSECT;
+	}
+
+	
+	
+
+	/**
+	 * Test whether a point lies in the envelopes of both input segments. A
+	 * correctly computed intersection point should return <code>true</code>
+	 * for this test. Since this test is for debugging purposes only, no attempt
+	 * is made to optimize the envelope test.
+	 * 
+	 * @return <code>true</code> if the input point lies within both input
+	 *         segment envelopes
+	 */
+	private boolean isInSegmentEnvelopes(Coordinate intPt) {
+		Envelope env0 = new Envelope(inputLines[0][0], inputLines[0][1]);
+		Envelope env1 = new Envelope(inputLines[1][0], inputLines[1][1]);
+		
+		
+	    Envelope snapEnvelope = new Envelope(intPt.x - snapTolerance,
+									    		intPt.x + snapTolerance,
+									    		intPt.y - snapTolerance,
+									    		intPt.y + snapTolerance);
+	    //TODO Review if we must chech for intersections of containtment
+		return env0.intersects(snapEnvelope) && env1.intersects(snapEnvelope);
+//		return env0.contains(intPt) && env1.contains(intPt);
+	}
+	
+	
+	/***********************************
+	 * *********************************
+	 * Overwrited methods of LineIntersector
+	 * *********************************
+	 * *********************************
+	 * */
+	
+	  /**
+	   * Test whether a point is a intersection point of two line segments.
+	   * Note that if the intersection is a line segment, this method only tests for
+	   * equality with the endpoints of the intersection segment.
+	   * It does <b>not</b> return true if
+	   * the input point is internal to the intersection segment.
+	   *
+	   * @return true if the input point is one of the intersection points.
+	   */
+	  public boolean isIntersection(Coordinate pt) {
+	    for (int i = 0; i < result; i++) {
+	      if (intPt[i].distance(pt) <= snapTolerance) {
+	        return true;
+	      }
+	    }
+	    return false;
+	  }
+
+	 
+	  /**
+	   * Tests whether either intersection point is an interior point of the specified input segment.
+	   *
+	   * @return <code>true</code> if either intersection point is in the interior of the input segment
+	   */
+	  public boolean isInteriorIntersection(int inputLineIndex)
+	  {
+	    for (int i = 0; i < result; i++) {
+	      if (! (   intPt[i].distance(inputLines[inputLineIndex][0] ) <= snapTolerance
+	             || intPt[i].distance(inputLines[inputLineIndex][1])<= snapTolerance )) {
+	        return true;
+	      }
+	    }
+	    return false;
+	  }
+
+	  /*
+	   * TODO
+	   * Estos dos metodos finales hacen uso de static getEdgeDistance, que se ha
+	   * hecho sin tener en cuenta ning�n tipo de snap o redondeo.
+	   * 
+	   * No se en que puede afectar (comprobar)
+	   * 
+	   * 
+	   * */
+	  protected void computeIntLineIndex(int segmentIndex) {
+	    double dist0 = getEdgeDistance(segmentIndex, 0);
+	    double dist1 = getEdgeDistance(segmentIndex, 1);
+	    if (dist0 > dist1) {
+	      intLineIndex[segmentIndex][0] = 0;
+	      intLineIndex[segmentIndex][1] = 1;
+	    }
+	    else {
+	      intLineIndex[segmentIndex][0] = 1;
+	      intLineIndex[segmentIndex][1] = 0;
+	    }
+	  }
+
+	  /**
+	   * Computes the "edge distance" of an intersection point along the specified input line segment.
+	   *
+	   * @param segmentIndex is 0 or 1
+	   * @param intIndex is 0 or 1
+	   *
+	   * @return the edge distance of the intersection point
+	   */
+	  public double getEdgeDistance(int segmentIndex, int intIndex) {
+	    double dist = computeEdgeDistance(intPt[intIndex], inputLines[segmentIndex][0],
+	        inputLines[segmentIndex][1]);
+	    return dist;
+	  }
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnapLineIntersector.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnapPolygonBuilder.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnapPolygonBuilder.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnapPolygonBuilder.java	(revision 12191)
@@ -0,0 +1,332 @@
+/*
+ * Created on 09-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.2  2006-10-17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/09 19:10:56  azabala
+* First version in CVS
+*
+*
+*/
+package com.vividsolutions.jts.operation.overlay;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import com.vividsolutions.jts.algorithm.CGAlgorithms;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Envelope;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.LinearRing;
+import com.vividsolutions.jts.geom.Polygon;
+import com.vividsolutions.jts.geomgraph.DirectedEdge;
+import com.vividsolutions.jts.geomgraph.EdgeRing;
+import com.vividsolutions.jts.geomgraph.SnappingPlanarGraph;
+import com.vividsolutions.jts.operation.overlay.MaximalEdgeRing;
+import com.vividsolutions.jts.operation.overlay.PolygonBuilder;
+import com.vividsolutions.jts.util.Assert;
+
+public class SnapPolygonBuilder extends PolygonBuilder {
+
+	 private GeometryFactory geometryFactory;
+	  private CGAlgorithms cga;
+	  //private List dirEdgeList;
+	  //private NodeMap nodes;
+	  private List shellList        = new ArrayList();
+
+	  public SnapPolygonBuilder(GeometryFactory geometryFactory, 
+			  CGAlgorithms cga)
+	  {
+		super(geometryFactory, cga);
+	    this.geometryFactory = geometryFactory;
+	    this.cga = cga;
+	  }
+
+	  /**
+	   * Add a complete graph.
+	   * The graph is assumed to contain one or more polygons,
+	   * possibly with holes.
+	   */
+	  public void add(SnappingPlanarGraph graph)
+	  {
+	    add(graph.getEdgeEnds(), graph.getNodes());
+	  }
+
+	  /**
+	   * Add a set of edges and nodes, which form a graph.
+	   * The graph is assumed to contain one or more polygons,
+	   * possibly with holes.
+	   */
+	  public void add(Collection dirEdges, Collection nodes)
+	  {
+		SnappingPlanarGraph.linkResultDirectedEdges(nodes);
+	    List maxEdgeRings = buildMaximalEdgeRings(dirEdges);
+	    List freeHoleList = new ArrayList();
+	    List edgeRings = buildMinimalEdgeRings(maxEdgeRings, shellList, freeHoleList);
+	    sortShellsAndHoles(edgeRings, shellList, freeHoleList);
+	    placeFreeHoles(shellList, freeHoleList);
+	  }
+
+	  public List getPolygons()
+	  {
+	    List resultPolyList = computePolygons(shellList);
+	    return resultPolyList;
+	  }
+
+
+	  /**
+	   * for all DirectedEdges in result, form them into MaximalEdgeRings
+	   */
+	  private List buildMaximalEdgeRings(Collection dirEdges)
+	  {
+	    List maxEdgeRings     = new ArrayList();
+	    for (Iterator it = dirEdges.iterator(); it.hasNext(); ) {
+	      DirectedEdge de = (DirectedEdge) it.next();
+	      if (de.isInResult() && de.getLabel().isArea() ) {
+	        // if this edge has not yet been processed
+	        if (de.getEdgeRing() == null) {
+	          MaximalEdgeRing er = new MaximalEdgeRing(de, geometryFactory, cga);
+	          maxEdgeRings.add(er);
+	          er.setInResult();
+//	System.out.println("max node degree = " + er.getMaxDegree());
+	        }
+	      }
+	    }
+	    return maxEdgeRings;
+	  }
+
+	  private List buildMinimalEdgeRings(List maxEdgeRings, List shellList, List freeHoleList)
+	  {
+	    List edgeRings = new ArrayList();
+	    for (Iterator it = maxEdgeRings.iterator(); it.hasNext(); ) {
+	      MaximalEdgeRing er = (MaximalEdgeRing) it.next();
+	      if (er.getMaxNodeDegree() > 2) {
+	        er.linkDirectedEdgesForMinimalEdgeRings();
+	        List minEdgeRings = er.buildMinimalRings();
+	        // at this point we can go ahead and attempt to place holes, if this EdgeRing is a polygon
+	        EdgeRing shell = findShell(minEdgeRings);
+	        if (shell != null) {
+	          placePolygonHoles(shell, minEdgeRings);
+	          shellList.add(shell);
+	        }
+	        else {
+	          freeHoleList.addAll(minEdgeRings);
+	        }
+	      }
+	      else {
+	        edgeRings.add(er);
+	      }
+	    }
+	    return edgeRings;
+	  }
+
+	  /**
+	   * This method takes a list of MinimalEdgeRings derived from a MaximalEdgeRing,
+	   * and tests whether they form a Polygon.  This is the case if there is a single shell
+	   * in the list.  In this case the shell is returned.
+	   * The other possibility is that they are a series of connected holes, in which case
+	   * no shell is returned.
+	   *
+	   * @return the shell EdgeRing, if there is one
+	   * @return null, if all the rings are holes
+	   */
+	  private EdgeRing findShell(List minEdgeRings)
+	  {
+	    int shellCount = 0;
+	    EdgeRing shell = null;
+	    for (Iterator it = minEdgeRings.iterator(); it.hasNext(); ) {
+	      EdgeRing er = (MinimalEdgeRing) it.next();
+	      if (! er.isHole()) {
+	        shell = er;
+	        shellCount++;
+	      }
+	    }
+	    Assert.isTrue(shellCount <= 1, "found two shells in MinimalEdgeRing list");
+	    return shell;
+	  }
+	  /**
+	   * This method assigns the holes for a Polygon (formed from a list of
+	   * MinimalEdgeRings) to its shell.
+	   * Determining the holes for a MinimalEdgeRing polygon serves two purposes:
+	   * <ul>
+	   * <li>it is faster than using a point-in-polygon check later on.
+	   * <li>it ensures correctness, since if the PIP test was used the point
+	   * chosen might lie on the shell, which might return an incorrect result from the
+	   * PIP test
+	   * </ul>
+	   */
+	  private void placePolygonHoles(EdgeRing shell, List minEdgeRings)
+	  {
+	    for (Iterator it = minEdgeRings.iterator(); it.hasNext(); ) {
+	      MinimalEdgeRing er = (MinimalEdgeRing) it.next();
+	      if (er.isHole()) {
+	        er.setShell(shell);
+	      }
+	    }
+	  }
+	  /**
+	   * For all rings in the input list,
+	   * determine whether the ring is a shell or a hole
+	   * and add it to the appropriate list.
+	   * Due to the way the DirectedEdges were linked,
+	   * a ring is a shell if it is oriented CW, a hole otherwise.
+	   */
+	  private void sortShellsAndHoles(List edgeRings, List shellList, List freeHoleList)
+	  {
+	    for (Iterator it = edgeRings.iterator(); it.hasNext(); ) {
+	      EdgeRing er = (EdgeRing) it.next();
+//	      er.setInResult();
+	      if (er.isHole() ) {
+	        freeHoleList.add(er);
+	      }
+	      else {
+	        shellList.add(er);
+	      }
+	    }
+	  }
+	  /**
+	   * This method determines finds a containing shell for all holes
+	   * which have not yet been assigned to a shell.
+	   * These "free" holes should
+	   * all be <b>properly</b> contained in their parent shells, so it is safe to use the
+	   * <code>findEdgeRingContaining</code> method.
+	   * (This is the case because any holes which are NOT
+	   * properly contained (i.e. are connected to their
+	   * parent shell) would have formed part of a MaximalEdgeRing
+	   * and been handled in a previous step).
+	   */
+	  private void placeFreeHoles(List shellList, List freeHoleList)
+	  {
+	    for (Iterator it = freeHoleList.iterator(); it.hasNext(); ) {
+	      EdgeRing hole = (EdgeRing) it.next();
+	      // only place this hole if it doesn't yet have a shell
+	      if (hole.getShell() == null) {
+	        EdgeRing shell = findEdgeRingContaining(hole, shellList);
+	        Assert.isTrue(shell != null, "unable to assign hole to a shell");
+	        hole.setShell(shell);
+	      }
+	    }
+	  }
+	  /**
+	   * Find the innermost enclosing shell EdgeRing containing the argument EdgeRing, if any.
+	   * The innermost enclosing ring is the <i>smallest</i> enclosing ring.
+	   * The algorithm used depends on the fact that:
+	   * <br>
+	   *  ring A contains ring B iff envelope(ring A) contains envelope(ring B)
+	   * <br>
+	   * This routine is only safe to use if the chosen point of the hole
+	   * is known to be properly contained in a shell
+	   * (which is guaranteed to be the case if the hole does not touch its shell)
+	   *
+	   * @return containing EdgeRing, if there is one
+	   * @return null if no containing EdgeRing is found
+	   */
+	  
+	  
+	  //TODO Estudiar como meter el snapping
+	  private EdgeRing findEdgeRingContaining(EdgeRing testEr, List shellList)
+	  {
+	    LinearRing testRing = testEr.getLinearRing();
+	    Envelope testEnv = testRing.getEnvelopeInternal();
+	    Coordinate testPt = testRing.getCoordinateN(0);
+
+	    EdgeRing minShell = null;
+	    Envelope minEnv = null;
+	    for (Iterator it = shellList.iterator(); it.hasNext(); ) {
+	      EdgeRing tryShell = (EdgeRing) it.next();
+	      LinearRing tryRing = tryShell.getLinearRing();
+	      Envelope tryEnv = tryRing.getEnvelopeInternal();
+	      if (minShell != null) minEnv = minShell.getLinearRing().getEnvelopeInternal();
+	      boolean isContained = false;
+	      if (tryEnv.contains(testEnv)
+	          && CGAlgorithms.isPointInRing(testPt, tryRing.getCoordinates()) )
+	        isContained = true;
+	      // check if this new containing ring is smaller than the current minimum ring
+	      if (isContained) {
+	        if (minShell == null
+	            || minEnv.contains(tryEnv)) {
+	          minShell = tryShell;
+	        }
+	      }
+	    }
+	    return minShell;
+	  }
+	  private List computePolygons(List shellList)
+	  {
+	    List resultPolyList   = new ArrayList();
+	    // add Polygons for all shells
+	    for (Iterator it = shellList.iterator(); it.hasNext(); ) {
+	      EdgeRing er = (EdgeRing) it.next();
+	      Polygon poly = er.toPolygon(geometryFactory);
+	      resultPolyList.add(poly);
+	    }
+	    return resultPolyList;
+	  }
+
+	  /**
+	   * Checks the current set of shells (with their associated holes) to
+	   * see if any of them contain the point.
+	   */
+	  
+	  //TODO METER SNAPPING
+	  public boolean containsPoint(Coordinate p)
+	  {
+	    for (Iterator it = shellList.iterator(); it.hasNext(); ) {
+	      EdgeRing er = (EdgeRing) it.next();
+	      if (er.containsPoint(p))
+	       return true;
+	    }
+	    return false;
+	  }
+
+
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnapPolygonBuilder.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnappingOverlayOperation.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnappingOverlayOperation.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnappingOverlayOperation.java	(revision 12191)
@@ -0,0 +1,771 @@
+/*
+ * Created on 12-sep-2006 by azabala
+ *
+ */
+package com.vividsolutions.jts.operation.overlay;
+
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import com.vividsolutions.jts.algorithm.CGAlgorithms;
+import com.vividsolutions.jts.algorithm.LineIntersector;
+import com.vividsolutions.jts.algorithm.PointLocator;
+import com.vividsolutions.jts.algorithms.SnapPointLocator;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.Location;
+import com.vividsolutions.jts.geom.Point;
+import com.vividsolutions.jts.geomgraph.Depth;
+import com.vividsolutions.jts.geomgraph.DirectedEdge;
+import com.vividsolutions.jts.geomgraph.DirectedEdgeStar;
+import com.vividsolutions.jts.geomgraph.Edge;
+import com.vividsolutions.jts.geomgraph.EdgeList;
+import com.vividsolutions.jts.geomgraph.Label;
+import com.vividsolutions.jts.geomgraph.Node;
+import com.vividsolutions.jts.geomgraph.PlanarGraph;
+import com.vividsolutions.jts.geomgraph.Position;
+import com.vividsolutions.jts.geomgraph.SnapEdgeList;
+import com.vividsolutions.jts.geomgraph.SnappingGeometryGraph;
+import com.vividsolutions.jts.geomgraph.SnappingPlanarGraph;
+import com.vividsolutions.jts.io.ParseException;
+import com.vividsolutions.jts.operation.overlay.LineBuilder;
+import com.vividsolutions.jts.operation.overlay.OverlayNodeFactory;
+import com.vividsolutions.jts.operation.overlay.OverlayOp;
+import com.vividsolutions.jts.operation.overlay.PointBuilder;
+import com.vividsolutions.jts.operation.overlay.PolygonBuilder;
+import com.vividsolutions.jts.util.Assert;
+
+/**
+ * TODO 
+ * El codigo esta lleno de coordinateA.distance(coordinateB)
+ * <= snapTolerance;
+ * 
+ * CAMBIAR POR SnapCoordinate, de forma que equals haga
+ * esta comprobacin
+ * 
+ * 
+ */
+public class SnappingOverlayOperation extends OverlayOp {
+	
+	protected final SnapPointLocator ptLocator = new SnapPointLocator();
+	protected GeometryFactory geomFact;
+	protected Geometry resultGeom;
+
+	protected LineIntersector li;
+	
+	protected double snapTolerance;
+	
+	
+	/*Planar graph of the overlay operation*/
+	protected SnappingPlanarGraph graph;
+	
+	/*Geometry graph of each individual geometry*/
+	protected SnappingGeometryGraph[] arg;
+
+	
+	/*It saves all the new edges resulting from intersections of
+	 * edges of geometries A and B. It is a temporal repository, before
+	 * to save them in SnappingPlanarGraph*/
+	protected SnapEdgeList edgeList = null;
+
+	
+/*
+ * El resultado de una operacion de overlay puede contener
+ * puntos, lineas y poligonos.
+ * */	
+	protected List resultPolyList = new ArrayList();
+
+	protected List resultLineList = new ArrayList();
+
+	protected List resultPointList = new ArrayList();
+	
+
+	
+	public static Geometry overlayOp(Geometry geom0, Geometry geom1,
+			int opCode, double tolerance) {
+		SnappingOverlayOperation gov = new SnappingOverlayOperation(geom0,
+				geom1, tolerance);
+		Geometry geomOv = gov.getResultGeometry(opCode);
+		return geomOv;
+	}
+	
+
+	
+	public SnappingOverlayOperation(Geometry g0, Geometry g1, double tolerance) {
+		super(g0, g1);
+		graph = new SnappingPlanarGraph(new OverlayNodeFactory(), tolerance);
+		arg = new SnappingGeometryGraph[2];
+		arg[0] = new SnappingGeometryGraph(tolerance, 0, g0);
+		arg[1] = new SnappingGeometryGraph(tolerance, 1, g1);
+		geomFact = g0.getFactory();
+		li = new SnapLineIntersector(tolerance);
+		edgeList = new SnapEdgeList(tolerance);
+		this.snapTolerance = tolerance;
+	}
+
+	public Geometry getResultGeometry(int funcCode) {
+		computeOverlay(funcCode);
+		return resultGeom;
+	}
+
+	
+	public PlanarGraph getGraph() {
+		return graph;
+	}
+	
+	
+	private boolean isReused = false;
+	/**
+	 * Metodo de utilidad cuando vayamos a intersectar la geometria
+	 * g1 con varias geometrias (g2, g3, g4, .... , etc.)
+	 * 
+	 * Los calculos basicos no se repiten para g1
+	 * 
+	 * */
+	
+	
+	public void setSecondGeometry(Geometry geometry){
+		Geometry g0 = arg[0].getGeometry();
+		 if (g0.getPrecisionModel().compareTo(geometry.getPrecisionModel()) >= 0)
+		      setComputationPrecision(g0.getPrecisionModel());
+		    else
+		      setComputationPrecision(geometry.getPrecisionModel());
+		graph = new SnappingPlanarGraph(new OverlayNodeFactory(), snapTolerance);
+		
+		
+		/*
+		 *TODO
+		 *Deberiamos borrar todos los nodos del GeometryGraph,
+		 *o solo las intersecciones?????
+		 *De todos modos, aunque borrasemos los nodos, getBoundaryNodes
+		 *devolveria nodos cacheados 
+		 * 
+		 * TODO REVISAR
+		 * */
+		arg[0].clearIntersections();
+		
+		
+		
+		arg[1] = new SnappingGeometryGraph(snapTolerance, 1, geometry);
+		geomFact = g0.getFactory();
+		edgeList = new SnapEdgeList(snapTolerance);
+		
+		resultPolyList.clear();
+		resultLineList.clear();
+		resultPointList.clear();
+		
+		resultGeom = null;
+		
+		isReused = true;
+	}
+
+	
+	/*
+	 * ************************************************************
+	 * METODO PRINCIPAL
+	 * ************************************************************
+	 * */
+	private void computeOverlay(int opCode) {
+		
+		/*
+		 * Se copian los NODOS de las dos geometrias. 
+		 * ESTO ES IMPORTANTE, PUES:
+		 * a) un punto origina un nodo.
+		 * b) una linea origina dos nodos
+		 * c) un poligono origina un nodo.
+		 * 
+		 * */
+		copyPoints(0);
+		copyPoints(1);
+		if(! isReused) //esto solo se hace si no se ha calculado ya
+			arg[0].computeSelfNodes(li, false);
+		arg[1].computeSelfNodes(li, false);
+
+		
+		/*
+		 * Calcula las intersecciones.
+		 * Se supone que daran lugar a Nodes, �NO?
+		 * Como resultado, cada Edge guardar� en sus EdgeIntersectionList
+		 * las intersecciones que hay en sus segmentos (EdgeIntersection).
+		 * 
+		 * Estas intersecciones se representan por:
+		 * -segmento del edge en que ocurren.
+		 * -coordenada
+		 * -distancia al primer vertice del segmento
+		 * 
+		 * �OJO� COMO RESULTADO DE ESTO NO SE GENERAN EJES NUEVOS.
+		 * PARA HACER SNAP EN LAS INTERSECCIONES TENDRIAMOS QUE RETOCAR LA 
+		 * CLASE EDGEINTERSECTIONLIST
+		 * 
+		 * */
+		arg[0].computeEdgeIntersections(arg[1], li, true);
+		/*
+		 * Ahora lo que se hace es: para cada Edge del grafo,
+		 * se parte (en funci�n de sus intersecciones) y se a�aden
+		 * los Edges fragmentados a la colecci�n baseSplitEdges
+		 * 
+		 * */
+		
+		List baseSplitEdges = new ArrayList();
+		arg[0].computeSplitEdges(baseSplitEdges);
+		//TODO Quizas la clave est� tambien en la 2� geometria
+		arg[1].computeSplitEdges(baseSplitEdges);
+		
+		
+		/*
+		 * Edges resulting of A intersection B, that are in baseSplitEdges 
+		 * Collection, are saved in EdgeList.
+		 * �OJO� Si aparecen ejes repetidos, no se duplican (pero si 
+		 * que se cambia su etiqueta)
+		 * */
+		//Se copian los nuevos Edges generados en EdgeList
+		insertUniqueEdges(baseSplitEdges);
+		
+		
+		/*Se etiquetan*/
+		computeLabelsFromDepths();
+		
+		/*
+		 * Quita los Edges que hayan sufrido colapso dimensional
+		 * (en la documentac�on de JTS viene algo de esto)
+		 * */
+		replaceCollapsedEdges();
+
+		
+        /*
+         * Finalmente, se a�ade al SnappingPlanarGraph resultado los Edges
+         * calculados como fruto de las intersecciones (contenidos en EdgeList).
+         * 
+         * Aqu� se hace algo muy importante tambi�n: se a�aden nuevos nodos
+         * al grafo (correspondientes con los extremos de los nuevos Edge
+         * que no estuvieran ya en el grafo)
+         * 
+         * */
+		graph.addEdges(edgeList.getEdges());
+		
+		
+		computeLabelling();
+		labelIncompleteNodes();
+		
+		/**
+		 * The ordering of building the result Geometries is important. Areas
+		 * must be built before lines, which must be built before points. This
+		 * is so that lines which are covered by areas are not included
+		 * explicitly, and similarly for points.
+		 */
+		findResultAreaEdges(opCode);
+		cancelDuplicateResultEdges();
+		
+		
+		//TODO Todos los builders deber�n usar los metodos snap de locator
+		SnapPolygonBuilder polyBuilder = new SnapPolygonBuilder(geomFact, cga);
+		polyBuilder.add(graph);
+		resultPolyList = polyBuilder.getPolygons();
+
+		LineBuilder lineBuilder = new LineBuilder(this, geomFact, ptLocator);
+		resultLineList = lineBuilder.build(opCode);
+
+		PointBuilder pointBuilder = new PointBuilder(this, geomFact, ptLocator){
+			 public List build(int opCode)
+			  {
+				 for (Iterator nodeit = getGraph().getNodes().iterator(); nodeit.hasNext(); ) {
+				      Node n = (Node) nodeit.next();
+
+				      // filter out nodes which are known to be in the result
+				      if (n.isInResult())
+				        continue;
+				      // if an incident edge is in the result, then the node coordinate is included already
+				      if (n.isIncidentEdgeInResult())
+				        continue;
+				      if (n.getEdges().getDegree() == 0 || opCode == OverlayOp.INTERSECTION) {
+
+				        /**
+				         * For nodes on edges, only INTERSECTION can result in edge nodes being included even
+				         * if none of their incident edges are included
+				         */
+				          Label label = n.getLabel();
+				          if (SnappingOverlayOperation.checkLabelLocation(label.getLocation(0),
+				        		  label.getLocation(1), opCode)) {
+				            filterCoveredNodeToPoint(n);
+				          }
+				      }
+				 }
+			    return resultPointList;
+			  }
+			 
+			 
+				 
+			 private void filterCoveredNodeToPoint(Node n)
+			  {
+			    Coordinate coord = n.getCoordinate();
+			    if (! isCoveredByLA(coord)) {
+			      Point pt = geomFact.createPoint(coord);
+			      resultPointList.add(pt);
+			    }
+			  }	
+		};
+		resultPointList = pointBuilder.build(opCode);
+
+		// gather the results from all calculations into a single Geometry for
+		// the result set
+		resultGeom = computeGeometry(resultPointList, resultLineList,
+				resultPolyList);
+	}
+	
+	
+	 /**
+	   * This method will handle arguments of Location.NONE correctly
+	   *
+	   * @return true if the locations correspond to the opCode
+	   */
+	  public static boolean isResultOfOp(int loc0, int loc1, int opCode)
+	  {
+	    if (loc0 == Location.BOUNDARY) loc0 = Location.INTERIOR;
+	    if (loc1 == Location.BOUNDARY) loc1 = Location.INTERIOR;
+	    switch (opCode) {
+	    case INTERSECTION:
+	      return loc0 == Location.INTERIOR
+	          && loc1 == Location.INTERIOR;
+	    case UNION:
+	      return loc0 == Location.INTERIOR
+	          || loc1 == Location.INTERIOR;
+	    case DIFFERENCE:
+	      return loc0 == Location.INTERIOR
+	          && loc1 != Location.INTERIOR;
+	    case SYMDIFFERENCE:
+	      return   (     loc0 == Location.INTERIOR &&  loc1 != Location.INTERIOR)
+	            || (     loc0 != Location.INTERIOR &&  loc1 == Location.INTERIOR);
+	    }
+	    return false;
+	  }
+	  
+	  public static boolean isResultOfOp(Label label, int opCode)
+	  {
+	    int loc0 = label.getLocation(0);
+	    int loc1 = label.getLocation(1);
+	    return isResultOfOp(loc0, loc1, opCode);
+	  }
+
+	
+	//TODO Quitar esto de aqui
+	
+	 public static boolean checkLabelLocation(int loc0, int loc1, int opCode)
+	  {
+	    if (loc0 == Location.BOUNDARY) loc0 = Location.INTERIOR;
+	    if (loc1 == Location.BOUNDARY) loc1 = Location.INTERIOR;
+	    switch (opCode) {
+	    case INTERSECTION:
+	      return loc0 == Location.INTERIOR
+	          && loc1 == Location.INTERIOR;
+	    case UNION:
+	      return loc0 == Location.INTERIOR
+	          || loc1 == Location.INTERIOR;
+	    case DIFFERENCE:
+	      return loc0 == Location.INTERIOR
+	          && loc1 != Location.INTERIOR;
+	    case SYMDIFFERENCE:
+	      return   (     loc0 == Location.INTERIOR &&  loc1 != Location.INTERIOR)
+	            || (     loc0 != Location.INTERIOR &&  loc1 == Location.INTERIOR);
+	    }
+	    return false;
+	  }
+
+	private void insertUniqueEdges(List edges) {
+		for (Iterator i = edges.iterator(); i.hasNext();) {
+			Edge e = (Edge) i.next();
+			insertUniqueEdge(e);
+		}
+	}
+
+	/**
+	 * Insert an edge from one of the noded input graphs. Checks edges that are
+	 * inserted to see if an identical edge already exists. If so, the edge is
+	 * not inserted, but its label is merged with the existing edge.
+	 */
+	protected void insertUniqueEdge(Edge e) {
+		
+		//TODO Crear una clase SnapEdge y SnapEdgeList puede ser necesario???
+		//creo que si pq SnapEdgeList mantiene una cache que no considera snap
+		Edge existingEdge = edgeList.findEqualEdge(e);
+		// If an identical edge already exists, simply update its label
+		if (existingEdge != null) {
+			Label existingLabel = existingEdge.getLabel();
+			Label labelToMerge = e.getLabel();
+			
+			// check if new edge is in reverse direction to existing edge
+			// if so, must flip the label before merging it
+			if (!existingEdge.isPointwiseEqual(e)) {
+				labelToMerge = new Label(e.getLabel());
+				labelToMerge.flip();
+			}
+			Depth depth = existingEdge.getDepth();
+			// if this is the first duplicate found for this edge, initialize
+			// the depths
+			if (depth.isNull()) {
+				depth.add(existingLabel);
+			}
+			depth.add(labelToMerge);
+			existingLabel.merge(labelToMerge);
+		} else { // no matching existing edge was found
+			// add this new edge to the list of edges in this graph
+			edgeList.add(e);
+		}
+	}
+
+	
+	/**
+	 * Update the labels for edges according to their depths. For each edge, the
+	 * depths are first normalized. Then, if the depths for the edge are equal,
+	 * this edge must have collapsed into a line edge. If the depths are not
+	 * equal, update the label with the locations corresponding to the depths
+	 * (i.e. a depth of 0 corresponds to a Location of EXTERIOR, a depth of 1
+	 * corresponds to INTERIOR)
+	 */
+	private void computeLabelsFromDepths() {
+		for (Iterator it = edgeList.iterator(); it.hasNext();) {
+			Edge e = (Edge) it.next();
+			Label lbl = e.getLabel();
+			Depth depth = e.getDepth();
+			/*
+			 * Only check edges for which there were duplicates, since these are
+			 * the only ones which might be the result of dimensional collapses.
+			 */
+			if (!depth.isNull()) {
+				depth.normalize();
+				for (int i = 0; i < 2; i++) {
+					if (!lbl.isNull(i) && lbl.isArea() && !depth.isNull(i)) {
+						/**
+						 * if the depths are equal, this edge is the result of
+						 * the dimensional collapse of two or more edges. It has
+						 * the same location on both sides of the edge, so it
+						 * has collapsed to a line.
+						 */
+						if (depth.getDelta(i) == 0) {
+							lbl.toLine(i);
+						} else {
+							/**
+							 * This edge may be the result of a dimensional
+							 * collapse, but it still has different locations on
+							 * both sides. The label of the edge must be updated
+							 * to reflect the resultant side locations indicated
+							 * by the depth values.
+							 */
+							Assert
+									.isTrue(!depth.isNull(i, Position.LEFT),
+											"depth of LEFT side has not been initialized");
+							lbl.setLocation(i, Position.LEFT, depth
+									.getLocation(i, Position.LEFT));
+							Assert
+									.isTrue(!depth.isNull(i, Position.RIGHT),
+											"depth of RIGHT side has not been initialized");
+							lbl.setLocation(i, Position.RIGHT, depth
+									.getLocation(i, Position.RIGHT));
+						}
+					}
+				}
+			}
+		}
+	}
+
+	/**
+	 * If edges which have undergone dimensional collapse are found, replace
+	 * them with a new edge which is a L edge
+	 */
+	private void replaceCollapsedEdges() {
+		List newEdges = new ArrayList();
+		for (Iterator it = edgeList.iterator(); it.hasNext();) {
+			Edge e = (Edge) it.next();
+			if (e.isCollapsed()) {
+				//	Debug.print(e);
+				it.remove();
+				newEdges.add(e.getCollapsedEdge());
+			}
+		}
+		edgeList.addAll(newEdges);
+	}
+
+	/**
+	 * Copy all nodes from an arg geometry into this graph. The node label in
+	 * the arg geometry overrides any previously computed label for that
+	 * argIndex. (E.g. a node may be an intersection node with a previously
+	 * computed label of BOUNDARY, but in the original arg Geometry it is
+	 * actually in the interior due to the Boundary Determination Rule)
+	 */
+	private void copyPoints(int argIndex) {
+		for (Iterator i = arg[argIndex].getNodeIterator(); i.hasNext();) {
+			Node graphNode = (Node) i.next();
+			Node newNode = graph.addNode(graphNode.getCoordinate());
+			newNode.setLabel(argIndex, graphNode.getLabel().getLocation(
+					argIndex));
+		}
+	}
+
+	/**
+	 * Compute initial labelling for all DirectedEdges at each node. In this
+	 * step, DirectedEdges will acquire a complete labelling (i.e. one with
+	 * labels for both Geometries) only if they are incident on a node which has
+	 * edges for both Geometries
+	 */
+	private void computeLabelling() {
+		for (Iterator nodeit = graph.getNodes().iterator(); nodeit.hasNext();) {
+			Node node = (Node) nodeit.next();
+			node.getEdges().computeLabelling(arg);
+		}
+		mergeSymLabels();
+		updateNodeLabelling();
+		
+	}
+
+	/**
+	 * For nodes which have edges from only one Geometry incident on them, the
+	 * previous step will have left their dirEdges with no labelling for the
+	 * other Geometry. However, the sym dirEdge may have a labelling for the
+	 * other Geometry, so merge the two labels.
+	 */
+	private void mergeSymLabels() {
+		for (Iterator nodeit = graph.getNodes().iterator(); nodeit.hasNext();) {
+			Node node = (Node) nodeit.next();
+			((DirectedEdgeStar) node.getEdges()).mergeSymLabels();
+		}
+	}
+
+	private void updateNodeLabelling() {
+		// update the labels for nodes
+		// The label for a node is updated from the edges incident on it
+		// (Note that a node may have already been labelled
+		// because it is a point in one of the input geometries)
+		for (Iterator nodeit = graph.getNodes().iterator(); nodeit.hasNext();) {
+			Node node = (Node) nodeit.next();
+			Label lbl = ((DirectedEdgeStar) node.getEdges()).getLabel();
+			Label otherLbl = node.getLabel();
+			otherLbl.merge(lbl);
+		}
+	}
+
+	/**
+	 * Incomplete nodes are nodes whose labels are incomplete. (e.g. the
+	 * location for one Geometry is null). These are either isolated nodes, or
+	 * nodes which have edges from only a single Geometry incident on them.
+	 * 
+	 * Isolated nodes are found because nodes in one graph which don't intersect
+	 * nodes in the other are not completely labelled by the initial process of
+	 * adding nodes to the nodeList. To complete the labelling we need to check
+	 * for nodes that lie in the interior of edges, and in the interior of
+	 * areas.
+	 * <p>
+	 * When each node labelling is completed, the labelling of the incident
+	 * edges is updated, to complete their labelling as well.
+	 */
+	private void labelIncompleteNodes() {
+		for (Iterator ni = graph.getNodes().iterator(); ni.hasNext();) {
+			Node n = (Node) ni.next();
+			Label label = n.getLabel();
+			if (n.isIsolated()) {
+				if (label.isNull(0))
+					labelIncompleteNode(n, 0);
+				else
+					labelIncompleteNode(n, 1);
+			}
+			// now update the labelling for the DirectedEdges incident on this
+			// node
+			((DirectedEdgeStar) n.getEdges()).updateLabelling(label);
+		}
+	}
+
+	/**
+	 * Label an isolated node with its relationship to the target geometry.
+	 */
+	private void labelIncompleteNode(Node n, int targetIndex) {
+	    //TODO Ver si el pointLocator deberia snapear
+		Coordinate coord = n.getCoordinate();
+	    Geometry geom = arg[targetIndex].getGeometry();
+		int loc = ptLocator.locate(coord, geom, snapTolerance);
+		n.getLabel().setLocation(targetIndex, loc);
+	}
+
+	/**
+	 * Find all edges whose label indicates that they are in the result area(s),
+	 * according to the operation being performed. Since we want polygon shells
+	 * to be oriented CW, choose dirEdges with the interior of the result on the
+	 * RHS. Mark them as being in the result. Interior Area edges are the result
+	 * of dimensional collapses. They do not form part of the result area
+	 * boundary.
+	 */
+	private void findResultAreaEdges(int opCode) {
+		for (Iterator it = graph.getEdgeEnds().iterator(); it.hasNext();) {
+			DirectedEdge de = (DirectedEdge) it.next();
+			// mark all dirEdges with the appropriate label
+			Label label = de.getLabel();
+			if (label.isArea()
+					&& !de.isInteriorAreaEdge()
+					&& isResultOfOp(label.getLocation(0, Position.RIGHT), label
+							.getLocation(1, Position.RIGHT), opCode)) {
+				de.setInResult(true);
+				//	Debug.print("in result "); Debug.println(de);
+			}
+		}
+	}
+
+	/**
+	 * If both a dirEdge and its sym are marked as being in the result, cancel
+	 * them out.
+	 */
+	private void cancelDuplicateResultEdges() {
+		// remove any dirEdges whose sym is also included
+		// (they "cancel each other out")
+		for (Iterator it = graph.getEdgeEnds().iterator(); it.hasNext();) {
+			DirectedEdge de = (DirectedEdge) it.next();
+			DirectedEdge sym = de.getSym();
+			if (de.isInResult() && sym.isInResult()) {
+				de.setInResult(false);
+				sym.setInResult(false);
+				//	Debug.print("cancelled "); Debug.println(de);
+				// Debug.println(sym);
+			}
+		}
+	}
+
+	/**
+	 * This method is used to decide if a point node should be included in the
+	 * result or not.
+	 * 
+	 * @return true if the coord point is covered by a result Line or Area
+	 *         geometry
+	 */
+	public boolean isCoveredByLA(Coordinate coord) {
+		if (isCovered(coord, resultLineList))
+			return true;
+		if (isCovered(coord, resultPolyList))
+			return true;
+		return false;
+	}
+
+	/**
+	 * This method is used to decide if an L edge should be included in the
+	 * result or not.
+	 * 
+	 * @return true if the coord point is covered by a result Area geometry
+	 */
+	public boolean isCoveredByA(Coordinate coord) {
+		if (isCovered(coord, resultPolyList))
+			return true;
+		return false;
+	}
+
+	/**
+	 * @return true if the coord is located in the interior or boundary of a
+	 *         geometry in the list.
+	 */
+	private boolean isCovered(Coordinate coord, List geomList) {
+		for (Iterator it = geomList.iterator(); it.hasNext();) {
+			Geometry geom = (Geometry) it.next();
+			int loc = ptLocator.locate(coord, geom, snapTolerance);
+			if (loc != Location.EXTERIOR)
+				return true;
+		}
+		return false;
+	}
+
+	private Geometry computeGeometry(List resultPointList, List resultLineList,
+			List resultPolyList) {
+		List geomList = new ArrayList();
+		// element geometries of the result are always in the order P,L,A
+		geomList.addAll(resultPointList);
+		geomList.addAll(resultLineList);
+		geomList.addAll(resultPolyList);
+		// build the most specific geometry possible
+		return geomFact.buildGeometry(geomList);
+	}
+	
+	
+	public static void main(String[] args){
+		GeometryFactory factory = new GeometryFactory();
+		com.vividsolutions.jts.io.WKTReader reader = new com.vividsolutions.jts.io.WKTReader(factory);
+		Geometry a, b, c, d;
+		try {
+		
+			//Snap en un extremo y en un vertice intermedio
+			a = reader.read("LINESTRING(0.001 0.001, 5.001 5.001)");
+			b = reader.read("LINESTRING(2.1 -3, 0.0 -0.001, -2.22 4.88, 10.0 10.0, 5.002 5.002)");
+			System.out.println(SnappingOverlayOperation.overlayOp(a, b, OverlayOp.INTERSECTION, 0.01));			
+//			//snap mediante l�neas paralelas
+			c = reader.read("LINESTRING(0 0, 5 0, 10 0.001)");
+			d = reader.read("LINESTRING(0.001 0.01, 5.001 0.002, 10.001 0.002)");		
+			long t0 = System.currentTimeMillis();
+			System.out.println(SnappingOverlayOperation.overlayOp(c, d, OverlayOp.INTERSECTION, 0.1));		
+			long t1 = System.currentTimeMillis();
+			System.out.println(OverlayOp.overlayOp(c, d, OverlayOp.INTERSECTION));
+			long t2 = System.currentTimeMillis();
+			System.out.println("Con snap: "+(t1-t0)+" ms");
+			System.out.println("Sin snap: "+(t2-t1)+" ms");
+			
+			d = reader.read("LINESTRING(0 0, 5 0, 10 0.001)");
+			System.out.println(OverlayOp.overlayOp(c, d, OverlayOp.INTERSECTION));
+			
+			//lineas paralelas a una distancia superior a la de snap
+			//(para comprobar el criterio de paralelismo en LineIntersector
+			c = reader.read("LINESTRING(0 0, 5 0, 10 0.001)");
+			d = reader.read("LINESTRING(0 0.11, 5 0.12, 10 0.14)");
+			System.out.println(SnappingOverlayOperation.overlayOp(c, d, OverlayOp.INTERSECTION, 0.001));
+//			
+			c = reader.read("LINESTRING(1 0, 3 2)");
+			d = reader.read("LINESTRING(3.05 2.01, 5 1.25, 0.25 1.75)");
+			System.out.println(OverlayOp.overlayOp(c, d, OverlayOp.INTERSECTION));
+			System.out.println((SnappingOverlayOperation.overlayOp(c, d, OverlayOp.INTERSECTION, 0.1)));
+//			
+//			
+			d = reader.read("LINESTRING(3 2, 5 1.25, 0.25 1.75)");
+			System.out.println(OverlayOp.overlayOp(c, d, OverlayOp.INTERSECTION));
+			System.out.println((SnappingOverlayOperation.overlayOp(c, d, OverlayOp.INTERSECTION, 0.1)));
+			
+			//Que un pol�gono est� cerrado o no no es snap, sino regla topologica
+			
+			//TODO CON POLIGONOS EST� DANDO PROBLEMAS. HABRA QUE REVISAR LINEAS Y POLIGONOS
+//			c = reader.read("POLYGON((0 0, 0 5, 5 5, 5 0,  0 0))");
+//			d = reader.read("POLYGON((-0.01 0, 3 8, 6 6 ,  -0.01 0))");
+			
+			c = reader.read("POLYGON((5 0, 5 5, 10 5, 10 0,  5 0))");
+			d = reader.read("POLYGON((4 3, 4.99 3.5, 10.01 3.5, 12 3,  4 3))");
+			
+			
+			
+			//REVISI�N TOPOLOGICA 
+			/*
+			 * Un aspecto esencial de la topologia en JTS es el etiquetado.
+			 * Todo Eje del grafo asociado a un pol�gono tiene una etiqueta o Label, 
+			 * con tres valores posibles para la izquierda, derecha y encima del poligono
+			 * (EXTERIOR, BOUNDARY, INTERIOR)
+			 * 
+			 * Por tanto, si la orientaci�n no es la correcta, todo se va al traste
+			 * (pues las cosas se invierten especularmente)
+			 * */
+			if(CGAlgorithms.isCCW(c.getCoordinates())){
+				System.out.println("Anillo exterior de poligono en orden incorrecto");
+			    System.out.println(c.toText());
+				System.exit(-2);
+			}
+			if(CGAlgorithms.isCCW(d.getCoordinates())){
+				System.out.println("Anillo exterior de poligono en orden incorrecto");
+				   System.out.println(d.toText());
+				System.exit(-2);
+			}
+		
+			System.out.println((SnappingOverlayOperation.overlayOp(c, d, OverlayOp.INTERSECTION, 0.1)));
+
+			Geometry pol1 = reader.read("POLYGON((0 0, -5 0, -10 5, 0 10,  10 5, 5 0, 0 0))");
+			Geometry pol2 = reader.read("POLYGON((10.01 0, 5 5, 5 10, 10 10, 10.01 0))");
+			
+			System.out.println((SnappingOverlayOperation.overlayOp(pol1, pol2, OverlayOp.INTERSECTION, 0.1)));
+			System.out.println((OverlayOp.overlayOp(pol1, pol2, OverlayOp.INTERSECTION)));
+			
+			
+		} catch (ParseException e) {
+			e.printStackTrace();
+		}
+		   
+
+	}
+
+}
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnappingOverlayOperation.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnappingOverlayOperationTest.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnappingOverlayOperationTest.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnappingOverlayOperationTest.java	(revision 12191)
@@ -0,0 +1,182 @@
+/*
+ * Created on 03-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-10-19 16:06:48  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.3  2006/10/10 18:50:57  azabala
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/09 19:10:56  azabala
+* First version in CVS
+*
+* Revision 1.1  2006/10/05 19:20:57  azabala
+* first version in cvs
+*
+*
+*/
+package com.vividsolutions.jts.operation.overlay;
+
+import junit.framework.TestCase;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryCollection;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.Polygon;
+import com.vividsolutions.jts.operation.overlay.OverlayOp;
+
+
+public class SnappingOverlayOperationTest extends TestCase {
+	
+	//test 1
+	Geometry a,b;
+	GeometryFactory factory ;
+	com.vividsolutions.jts.io.WKTReader reader;
+	
+	//test 2
+	Geometry c,d;
+	
+	//test 4
+	Geometry f;
+	
+	//test 5
+	Geometry g, h;
+	
+	
+	//test 6
+	Geometry pol1, pol2;
+	
+	public static void main(String[] args) {
+	}
+
+	public SnappingOverlayOperationTest(String name) {
+		super(name);
+	}
+
+	
+	protected void setUp() throws Exception {
+		super.setUp();
+		factory = new GeometryFactory();
+		reader = new com.vividsolutions.jts.io.WKTReader(factory);
+		a = reader.read("LINESTRING(0.001 0.001, 5.001 5.001)");
+		b = reader.read("LINESTRING(2.1 -3, 0.0 -0.001, -2.22 4.88, 10.0 10.0, 5.002 5.002)");
+		
+		c = reader.read("LINESTRING(0 0, 5 0, 10 0.001)");
+		d = reader.read("LINESTRING(0 0.01, 5 0.002, 10 0.002)");
+		
+		f = reader.read("LINESTRING(0 0.11, 5 0.12, 10 0.14)");
+		
+		
+		g = reader.read("LINESTRING(1 0, 3 2)");
+		h = reader.read("LINESTRING(3.05 2.01, 5 1.25, 0.25 1.75)");
+		
+		
+		pol1 = reader.read("POLYGON((0 0, -5 0, -10 5, 0 10,  10 5, 5 0, 0 0))");
+		pol2 = reader.read("POLYGON((10.01 0, 5 5, 5 10, 10 10, 10.01 0))");
+	}
+	
+		
+
+	protected void tearDown() throws Exception {
+		super.tearDown();
+		factory = null;
+		reader = null;
+		a = null;
+		b = null;
+	}
+
+	/*
+	 * Test method for 'com.iver.cit.gvsig.fmap.topology.SnappingOverlayOperation.SnappingOverlayOperation(Geometry, Geometry, double)'
+	 */
+	public void testSnappingOverlayOperation() {
+		//test 1: dos lineas que intersectan en dos puntos: uno Nodo y otro vertice
+		Geometry geom = SnappingOverlayOperation.overlayOp(a, b, 
+									OverlayOp.INTERSECTION, 0.01);
+		assertTrue(geom.toString().equals("MULTIPOINT (0.001 0.001, 5.001 5.001)"));
+		
+		//test 2: dos lineas paralelas separadas por una distancia inferior a la
+		//de snap
+		geom = SnappingOverlayOperation.overlayOp(c, d, 
+				OverlayOp.INTERSECTION, 0.1);
+
+		assertTrue(geom.toString().equals("MULTILINESTRING ((0 0, 5 0), (5 0, 10 0.001))"));
+		
+		//test 3: identicas l�neas pero reducimos la distancia de snap
+		geom = SnappingOverlayOperation.overlayOp(c, d, 
+				OverlayOp.INTERSECTION, 0.0001);
+		assertTrue(geom.toString().equals("GEOMETRYCOLLECTION EMPTY"));
+		
+		//test 4: identicas l�neas, pero se separan un poco mas
+		geom = SnappingOverlayOperation.overlayOp(c, f, OverlayOp.INTERSECTION, 0.1);
+		assertTrue(geom.toString().equals("GEOMETRYCOLLECTION EMPTY"));
+		
+		
+		//test 5: interseccion de dos lineas, la solucion son dos puntos:
+		//uno con snap y el otro normal. Presentan cambios de orientacion
+		geom = SnappingOverlayOperation.overlayOp(g, h, OverlayOp.INTERSECTION, 0.1);
+		assertTrue(geom instanceof GeometryCollection);
+		assertTrue(geom.toString().equals("MULTIPOINT (2.511904761904762 1.5119047619047619, 3 2)"));
+		
+		geom = SnappingOverlayOperation.overlayOp(pol1, 
+												  pol2, 
+											OverlayOp.INTERSECTION, 
+											0.01);
+		assertTrue(geom instanceof Polygon);
+		assertTrue(geom.toString().equals("POLYGON ((5 7.5, 10 5, 7.502497502497502 2.5024975024975022, 5 5, 5 7.5))"));
+		
+
+		
+		
+		
+	}
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/overlay/SnappingOverlayOperationTest.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/JtsTests.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/JtsTests.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/JtsTests.java	(revision 12191)
@@ -0,0 +1,78 @@
+/*
+ * Created on 03-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.2  2006-10-19 16:06:48  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/05 19:20:57  azabala
+* first version in cvs
+*
+*
+*/
+package com.vividsolutions.jts.operation;
+
+import com.vividsolutions.jts.operation.overlay.SnappingOverlayOperationTest;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class JtsTests {
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite(
+				"Test for com.iver.cit.gvsig.fmap.topology");
+		//$JUnit-BEGIN$
+		suite.addTestSuite(SnappingOverlayOperationTest.class);
+		//$JUnit-END$
+		return suite;
+	}
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/vividsolutions/jts/operation/JtsTests.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/NodeError.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/NodeError.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/NodeError.java	(revision 12191)
@@ -0,0 +1,81 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.topology;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.planargraph.Node;
+
+public class NodeError  extends Node
+{
+	public static int DANGLE = 1;
+	public static int FUZZY = 2;
+	
+	int occurrences;
+	int errorType;
+	
+	public NodeError(Coordinate pt) {
+		super(pt);
+		occurrences = 1;
+	}
+
+	
+
+	public int getOccurrences() {
+		return occurrences;
+	}
+
+	public void setOccurrences(int occurrences) {
+		this.occurrences = occurrences;
+	}
+
+	public int getErrorType() {
+		return errorType;
+	}
+
+
+
+	public void setErrorType(int errorType) {
+		this.errorType = errorType;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/NodeError.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/Triangulation.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/Triangulation.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/Triangulation.java	(revision 12191)
@@ -0,0 +1,181 @@
+/*
+ * Copyright (c) 2005 by L. Paul Chew.
+ * 
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, subject to the following 
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+
+package com.iver.cit.gvsig.topology.triangulation;
+
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+/**
+ * A Triangulation on vertices (generic type V).
+ * A Triangulation is a set of Simplices (see Simplex below).
+ * For efficiency, we keep track of the neighbors of each Simplex.
+ * Two Simplices are neighbors of they share a facet.
+ * 
+ * @author Paul Chew
+ * 
+ * Created July 2005.  Derived from an earlier, messier version.
+ */
+public class Triangulation {
+    
+    private HashMap neighbors;  // Maps Simplex to Set of neighbors
+    
+    /**
+     * Constructor.
+     * @param simplex the initial Simplex.
+     */
+    public Triangulation (Simplex simplex) {
+        neighbors = new HashMap();
+        neighbors.put(simplex, new HashSet());
+    }
+    
+    /**
+     * String representation.
+     * Shows number of simplices currently in the Triangulation.
+     * @return a String representing the Triangulation
+     */
+    public String toString () {
+        return "Triangulation (with " + neighbors.size() + " elements)";
+    }
+    
+    /**
+     * Size (# of Simplices) in Triangulation.
+     * @return the number of Simplices in this Triangulation
+     */
+    public int size () {
+        return neighbors.size();
+    }
+    
+    /**
+     * True iff the simplex is in this Triangulation.
+     * @param simplex the simplex to check
+     * @return true iff the simplex is in this Triangulation
+     */
+    public boolean contains (Simplex simplex) {
+        return this.neighbors.containsKey(simplex);
+    }
+    
+    /**
+     * Iterator.
+     * @return an iterator for every Simplex in the Triangulation
+     */
+    public Iterator iterator () {
+        return Collections.unmodifiableSet(this.neighbors.keySet()).iterator();
+    }
+    
+    /**
+     * Print stuff about a Triangulation.
+     * Used for debugging.
+     */
+    public void printStuff () {
+        boolean remember = Simplex.moreInfo;
+        System.out.println("Neighbor data for " + this);
+        for (Iterator it = neighbors.keySet().iterator(); it.hasNext();) {
+            Simplex simplex = (Simplex) it.next();
+            Simplex.moreInfo = true;
+            System.out.print("    " + simplex + ":");
+            Simplex.moreInfo = false;
+            for (Iterator otherIt = ((Set) neighbors.get(simplex)).iterator(); 
+                 otherIt.hasNext();)
+                System.out.print(" " + otherIt.next());
+            System.out.println();
+        }
+        Simplex.moreInfo = remember;
+    }
+    
+    /* Navigation */
+    
+    /**
+     * Report neighbor opposite the given vertex of simplex.
+     * @param vertex a vertex of simplex
+     * @param simplex we want the neighbor of this Simplex
+     * @return the neighbor opposite vertex of simplex; null if none
+     * @throws IllegalArgumentException if vertex is not in this Simplex
+     */
+    public Simplex neighborOpposite (Object vertex, Simplex simplex) {
+        if (!simplex.contains(vertex))
+            throw new IllegalArgumentException("Bad vertex; not in simplex");
+        SimplexLoop: for (Iterator it = ((Set) neighbors.get(simplex)).iterator(); 
+                          it.hasNext();) {
+            Simplex s = (Simplex) it.next();
+            for (Iterator otherIt = simplex.iterator(); otherIt.hasNext(); ) {
+                Object v = otherIt.next();
+                if (v.equals(vertex)) continue;
+                if (!s.contains(v)) continue SimplexLoop;
+            }
+            return s;
+        }
+        return null;
+    }
+    
+    /**
+     * Report neighbors of the given simplex.
+     * @param simplex a Simplex
+     * @return the Set of neighbors of simplex
+     */
+    public Set neighbors (Simplex simplex) {
+        return new HashSet((Set) this.neighbors.get(simplex));
+    }
+    
+    /* Modification */
+    
+    /**
+     * Update by replacing one set of Simplices with another.
+     * Both sets of simplices must fill the same "hole" in the
+     * Triangulation.
+     * @param oldSet set of Simplices to be replaced
+     * @param newSet set of replacement Simplices
+     */
+    public void update (Set oldSet, 
+                        Set newSet) {
+        // Collect all simplices neighboring the oldSet
+        Set allNeighbors = new HashSet();
+        for (Iterator it = oldSet.iterator(); it.hasNext();)
+            allNeighbors.addAll((Set) neighbors.get((Simplex) it.next()));
+        // Delete the oldSet
+        for (Iterator it = oldSet.iterator(); it.hasNext();) {
+            Simplex simplex = (Simplex) it.next();
+            for (Iterator otherIt = ((Set) neighbors.get(simplex)).iterator(); 
+                 otherIt.hasNext();)
+                ((Set) neighbors.get(otherIt.next())).remove(simplex);
+            neighbors.remove(simplex);
+            allNeighbors.remove(simplex);
+        }
+        // Include the newSet simplices as possible neighbors
+        allNeighbors.addAll(newSet);
+        // Create entries for the simplices in the newSet
+        for (Iterator it = newSet.iterator(); it.hasNext();)
+            neighbors.put((Simplex) it.next(), new HashSet());
+        // Update all the neighbors info
+        for (Iterator it = newSet.iterator(); it.hasNext();) {
+            Simplex s1 = (Simplex) it.next();
+            for (Iterator otherIt = allNeighbors.iterator(); otherIt.hasNext();) {
+                Simplex s2 = (Simplex) otherIt.next();
+                if (!s1.isNeighbor(s2)) continue;
+                ((Set) neighbors.get(s1)).add(s2);
+                ((Set) neighbors.get(s2)).add(s1);
+            }
+        }
+    }
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/Triangulation.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/Pnt.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/Pnt.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/Pnt.java	(revision 12191)
@@ -0,0 +1,483 @@
+/*
+ * Copyright (c) 2005 by L. Paul Chew.
+ * 
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, subject to the following 
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+package com.iver.cit.gvsig.topology.triangulation;
+/**
+ * Points in Euclidean space, implemented as double[].
+ * 
+ * Includes simple geometric operations.
+ * Uses matrices; a matrix is represented as an array of Pnts.
+ * Uses simplices; a simplex is represented as an array of Pnts.
+ * 
+ * @author Paul Chew
+ * 
+ * Created July 2005.  Derived from an earlier, messier version.
+ */
+public class Pnt {
+    
+    private double[] coordinates;          // The point's coordinates
+    
+    /**
+     * Constructor.
+     * @param coords the coordinates
+     */
+    public Pnt (double[] coords) {
+        // Copying is done here to ensure that Pnt's coords cannot be altered.
+        coordinates = new double[coords.length];
+        System.arraycopy(coords, 0, coordinates, 0, coords.length);
+    }
+    
+    /**
+     * Constructor.
+     * @param coordA
+     * @param coordB
+     */
+    public Pnt (double coordA, double coordB) {
+        this(new double[] {coordA, coordB});
+    }
+    
+    /**
+     * Constructor.
+     * @param coordA
+     * @param coordB
+     * @param coordC
+     */
+    public Pnt (double coordA, double coordB, double coordC) {
+        this(new double[] {coordA, coordB, coordC});
+    }
+    
+    /**
+     * Create a String for this Pnt.
+     * @return a String representation of this Pnt.
+     */
+    public String toString () {
+        if (coordinates.length == 0) return "()";
+        String result = "Pnt(" + coordinates[0];
+        for (int i = 1; i < coordinates.length; i++)
+            result = result + "," + coordinates[i];
+        result = result + ")";
+        return result;
+    }
+    
+    /**
+     * Equality.
+     * @param other the other Object to compare to
+     * @return true iff the Pnts have the same coordinates
+     */
+    public boolean equals (Object other) {
+        if (!(other instanceof Pnt)) return false;
+        Pnt p = (Pnt) other;
+        if (this.coordinates.length != p.coordinates.length) return false;
+        for (int i = 0; i < this.coordinates.length; i++)
+            if (this.coordinates[i] != p.coordinates[i]) return false;
+        return true;
+    }
+    
+    /**
+     * HashCode.
+     * @return the hashCode for this Pnt
+     */
+    public int hashCode () {
+        int hash = 0;
+        for (int i = 0; i < this.coordinates.length; i++) {
+            long bits = Double.doubleToLongBits(this.coordinates[i]);
+            hash = (31*hash) ^ (int)(bits ^ (bits >> 32));
+        }
+        return hash;
+    }
+    
+    /* Pnts as vectors */
+    
+    /**
+     * @return the specified coordinate of this Pnt
+     * @throws ArrayIndexOutOfBoundsException for bad coordinate
+     */
+    public double coord (int i) {
+        return this.coordinates[i];
+    }
+    
+    /**
+     * @return this Pnt's dimension.
+     */
+    public int dimension () {
+        return coordinates.length;
+    }
+    
+    /**
+     * Check that dimensions match.
+     * @param p the Pnt to check (against this Pnt)
+     * @return the dimension of the Pnts
+     * @throws IllegalArgumentException if dimension fail to match
+     */
+    public int dimCheck (Pnt p) {
+        int len = this.coordinates.length;
+        if (len != p.coordinates.length)
+            throw new IllegalArgumentException("Dimension mismatch");
+        return len;
+    }
+    
+    /**
+     * Create a new Pnt by adding additional coordinates to this Pnt.
+     * @param coords the new coordinates (added on the right end)
+     * @return a new Pnt with the additional coordinates
+     */
+    public Pnt extend (double[] coords) {
+        double[] result = new double[coordinates.length + coords.length];
+        System.arraycopy(coordinates, 0, result, 0, coordinates.length);
+        System.arraycopy(coords, 0, result, coordinates.length, coords.length);
+        return new Pnt(result);
+    }
+    
+    /**
+     * Dot product.
+     * @param p the other Pnt
+     * @return dot product of this Pnt and p
+     */
+    public double dot (Pnt p) {
+        int len = dimCheck(p);
+        double sum = 0;
+        for (int i = 0; i < len; i++)
+            sum += this.coordinates[i] * p.coordinates[i];
+        return sum;
+    }
+    
+    /**
+     * Magnitude (as a vector).
+     * @return the Euclidean length of this vector
+     */
+    public double magnitude () {
+        return Math.sqrt(this.dot(this));
+    }
+    
+    /**
+     * Subtract.
+     * @param p the other Pnt
+     * @return a new Pnt = this - p
+     */
+    public Pnt subtract (Pnt p) {
+        int len = dimCheck(p);
+        double[] coords = new double[len];
+        for (int i = 0; i < len; i++)
+            coords[i] = this.coordinates[i] - p.coordinates[i];
+        return new Pnt(coords);
+    }
+    
+    /**
+     * Add.
+     * @param p the other Pnt
+     * @return a new Pnt = this + p
+     */
+    public Pnt add (Pnt p) {
+        int len = dimCheck(p);
+        double[] coords = new double[len];
+        for (int i = 0; i < len; i++)
+            coords[i] = this.coordinates[i] + p.coordinates[i];
+        return new Pnt(coords);
+    }
+    
+    /**
+     * Angle (in radians) between two Pnts (treated as vectors).
+     * @param p the other Pnt
+     * @return the angle (in radians) between the two Pnts
+     */
+    public double angle (Pnt p) {
+        return Math.acos(this.dot(p) / (this.magnitude() * p.magnitude()));
+    }
+    
+    /**
+     * Perpendicular bisector of two Pnts.
+     * Works in any dimension.  The coefficients are returned as a Pnt of one
+     * higher dimension (e.g., (A,B,C,D) for an equation of the form
+     * Ax + By + Cz + D = 0).
+     * @param point the other point
+     * @return the coefficients of the perpendicular bisector
+     */
+    public Pnt bisector (Pnt point) {
+        int dim = dimCheck(point);
+        Pnt diff = this.subtract(point);
+        Pnt sum = this.add(point);
+        double dot = diff.dot(sum);
+        return diff.extend(new double[] {-dot / 2});
+    }
+    
+    /* Pnts as matrices */
+    
+    /**
+     * Create a String for a matrix.
+     * @param matrix the matrix (an array of Pnts)
+     * @return a String represenation of the matrix
+     */
+    public static String toString (Pnt[] matrix) {
+        StringBuffer buf = new StringBuffer("{");
+        for (int i = 0; i < matrix.length; i++) buf.append(" " + matrix[i]);
+        buf.append(" }");
+        return buf.toString();
+    }
+    
+    /**
+     * Compute the determinant of a matrix (array of Pnts).
+     * This is not an efficient implementation, but should be adequate 
+     * for low dimension.
+     * @param matrix the matrix as an array of Pnts
+     * @return the determinnant of the input matrix
+     * @throws IllegalArgumentException if dimensions are wrong
+     */
+    public static double determinant (Pnt[] matrix) {
+        if (matrix.length != matrix[0].dimension())
+            throw new IllegalArgumentException("Matrix is not square");
+        boolean[] columns = new boolean[matrix.length];
+        for (int i = 0; i < matrix.length; i++) columns[i] = true;
+        try {return determinant(matrix, 0, columns);}
+        catch (ArrayIndexOutOfBoundsException e) {
+            throw new IllegalArgumentException("Matrix is wrong shape");
+        }
+    }
+    
+    /**
+     * Compute the determinant of a submatrix specified by starting row
+     * and by "active" columns.
+     * @param matrix the matrix as an array of Pnts
+     * @param row the starting row
+     * @param columns a boolean array indicating the "active" columns
+     * @return the determinant of the specified submatrix
+     * @throws ArrayIndexOutOfBoundsException if dimensions are wrong
+     */
+    private static double determinant(Pnt[] matrix, int row, boolean[] columns) {
+        if (row == matrix.length) return 1;
+        double sum = 0;
+        int sign = 1;
+        for (int col = 0; col < columns.length; col++) {
+            if (!columns[col]) continue;
+            columns[col] = false;
+            sum += sign * matrix[row].coordinates[col] *
+                   determinant(matrix, row+1, columns);
+            columns[col] = true;
+            sign = -sign;
+        }
+        return sum;
+    }
+    
+    /**
+     * Compute generalized cross-product of the rows of a matrix.
+     * The result is a Pnt perpendicular (as a vector) to each row of
+     * the matrix.  This is not an efficient implementation, but should 
+     * be adequate for low dimension.
+     * @param matrix the matrix of Pnts (one less row than the Pnt dimension)
+     * @return a Pnt perpendicular to each row Pnt
+     * @throws IllegalArgumentException if matrix is wrong shape
+     */
+    public static Pnt cross (Pnt[] matrix) {
+        int len = matrix.length + 1;
+        if (len != matrix[0].dimension())
+            throw new IllegalArgumentException("Dimension mismatch");
+        boolean[] columns = new boolean[len];
+        for (int i = 0; i < len; i++) columns[i] = true;
+        double[] result = new double[len];
+        int sign = 1;
+        try {
+            for (int i = 0; i < len; i++) {
+                columns[i] = false;
+                result[i] = sign * determinant(matrix, 0, columns);
+                columns[i] = true;
+                sign = -sign;
+            }
+        } catch (ArrayIndexOutOfBoundsException e) {
+            throw new IllegalArgumentException("Matrix is wrong shape");
+        }
+        return new Pnt(result);
+    }
+    
+    /* Pnts as simplices */
+    
+    /**
+     * Determine the signed content (i.e., area or volume, etc.) of a simplex.
+     * @param simplex the simplex (as an array of Pnts)
+     * @return the signed content of the simplex
+     */
+    public static double content (Pnt[] simplex) {
+        Pnt[] matrix = new Pnt[simplex.length];
+        for (int i = 0; i < matrix.length; i++)
+            matrix[i] = simplex[i].extend(new double[] {1});
+        int fact = 1;
+        for (int i = 1; i < matrix.length; i++) fact = fact*i;
+        return determinant(matrix) / fact;
+    }
+    
+    /**
+     * Relation between this Pnt and a simplex (represented as an array of Pnts).
+     * Result is an array of signs, one for each vertex of the simplex, indicating
+     * the relation between the vertex, the vertex's opposite facet, and this
+     * Pnt. <pre>
+     *   -1 means Pnt is on same side of facet
+     *    0 means Pnt is on the facet
+     *   +1 means Pnt is on opposite side of facet</pre>
+     * @param simplex an array of Pnts representing a simplex
+     * @return an array of signs showing relation between this Pnt and the simplex
+     * @throws IllegalArgumentExcpetion if the simplex is degenerate
+     */
+    public int[] relation (Pnt[] simplex) {
+        /* In 2D, we compute the cross of this matrix:
+         *    1   1   1   1
+         *    p0  a0  b0  c0
+         *    p1  a1  b1  c1
+         * where (a, b, c) is the simplex and p is this Pnt.  The result
+         * is a vector in which the first coordinate is the signed area
+         * (all signed areas are off by the same constant factor) of
+         * the simplex and the remaining coordinates are the *negated*
+         * signed areas for the simplices in which p is substituted for
+         * each of the vertices. Analogous results occur in higher dimensions.
+         */
+        int dim = simplex.length - 1;
+        if (this.dimension() != dim)
+            throw new IllegalArgumentException("Dimension mismatch");
+        
+        /* Create and load the matrix */
+        Pnt[] matrix = new Pnt[dim+1];
+        /* First row */
+        double[] coords = new double[dim+2];
+        for (int j = 0; j < coords.length; j++) coords[j] = 1;
+        matrix[0] = new Pnt(coords);
+        /* Other rows */
+        for (int i = 0; i < dim; i++) {
+            coords[0] = this.coordinates[i];
+            for (int j = 0; j < simplex.length; j++) 
+                coords[j+1] = simplex[j].coordinates[i];
+            matrix[i+1] = new Pnt(coords);
+        }
+        
+        /* Compute and analyze the vector of areas/volumes/contents */
+        Pnt vector = cross(matrix);
+        double content = vector.coordinates[0];
+        int[] result = new int[dim+1];
+        for (int i = 0; i < result.length; i++) {
+            double value = vector.coordinates[i+1];
+            if (Math.abs(value) <= 1.0e-6 * Math.abs(content)) result[i] = 0;
+            else if (value < 0) result[i] = -1;
+            else result[i] = 1;
+        }
+        if (content < 0) {
+            for (int i = 0; i < result.length; i++) result[i] = -result[i];
+        }
+        if (content == 0) {
+            for (int i = 0; i < result.length; i++) result[i] = Math.abs(result[i]);
+        }
+        return result;
+    }
+    
+    /**
+     * Test if this Pnt is outside of simplex.
+     * @param simplex the simplex (an array of Pnts)
+     * @return the simplex Pnt that "witnesses" outsideness (or null if not outside)
+     */
+    public Pnt isOutside (Pnt[] simplex) {
+        int[] result = this.relation(simplex);
+        for (int i = 0; i < result.length; i++) {
+            if (result[i] > 0) return simplex[i];
+        }
+        return null;
+    }
+    
+    /**
+     * Test if this Pnt is on a simplex.
+     * @param simplex the simplex (an array of Pnts)
+     * @return the simplex Pnt that "witnesses" on-ness (or null if not on)
+     */
+    public Pnt isOn (Pnt[] simplex) {
+        int[] result = this.relation(simplex);
+        Pnt witness = null;
+        for (int i = 0; i < result.length; i++) {
+            if (result[i] == 0) witness = simplex[i];
+            else if (result[i] > 0) return null;
+        }
+        return witness;
+    }
+    
+    /**
+     * Test if this Pnt is inside a simplex.
+     * @param simplex the simplex (an arary of Pnts)
+     * @return true iff this Pnt is inside simplex.
+     */
+    public boolean isInside (Pnt[] simplex) {
+        int[] result = this.relation(simplex);
+        for (int i = 0; i < result.length; i++) if (result[i] >= 0) return false;
+        return true;
+    }
+    
+    /**
+     * Test relation between this Pnt and circumcircle of a simplex.
+     * @param simplex the simplex (as an array of Pnts)
+     * @return -1, 0, or +1 for inside, on, or outside of circumcircle
+     */
+    public int vsCircumcircle (Pnt[] simplex) {
+        Pnt[] matrix = new Pnt[simplex.length + 1];
+        for (int i = 0; i < simplex.length; i++)
+            matrix[i] = simplex[i].extend(new double[] {1, simplex[i].dot(simplex[i])});
+        matrix[simplex.length] = this.extend(new double[] {1, this.dot(this)});
+        double d = determinant(matrix);
+        int result = (d < 0)? -1 : ((d > 0)? +1 : 0);
+        if (content(simplex) < 0) result = - result;
+        return result;
+    }
+    
+    /**
+     * Circumcenter of a simplex.
+     * @param simplex the simplex (as an array of Pnts)
+     * @return the circumcenter (a Pnt) of simplex
+     */
+    public static Pnt circumcenter (Pnt[] simplex) {
+        int dim = simplex[0].dimension();
+        if (simplex.length - 1 != dim)
+            throw new IllegalArgumentException("Dimension mismatch");
+        Pnt[] matrix = new Pnt[dim];
+        for (int i = 0; i < dim; i++) 
+            matrix[i] = simplex[i].bisector(simplex[i+1]);
+        Pnt hCenter = cross(matrix);      // Center in homogeneous coordinates
+        double last = hCenter.coordinates[dim];
+        double[] result = new double[dim];
+        for (int i = 0; i < dim; i++) result[i] = hCenter.coordinates[i] / last;
+        return new Pnt(result);
+    }
+     
+    /**
+     * Main program (used for testing).
+     */
+    public static void main (String[] args) {
+        Pnt p = new Pnt(1, 2, 3);
+        System.out.println("Pnt created: " + p);
+        Pnt[] matrix1 = {new Pnt(1,2), new Pnt(3,4)};
+        Pnt[] matrix2 = {new Pnt(7,0,5), new Pnt(2,4,6), new Pnt(3,8,1)};
+        System.out.print("Results should be -2 and -288: ");
+        System.out.println(determinant(matrix1) + " " + determinant(matrix2));
+        Pnt p1 = new Pnt(1,1); Pnt p2 = new Pnt(-1,1);
+        System.out.println("Angle between " + p1 + " and " + p2 + ": " + p1.angle(p2));
+        System.out.println(p1 + " subtract " + p2 + ": " + p1.subtract(p2));
+        Pnt v0 = new Pnt(0,0), v1 = new Pnt(1,1), v2 = new Pnt(2,2);
+        Pnt[] vs = {v0, new Pnt(0,1), new Pnt(1,0)};
+        Pnt vp = new Pnt(.1, .1);
+        System.out.println(vp + " isInside " + toString(vs) + ": " + vp.isInside(vs));
+        System.out.println(v1 + " isInside " + toString(vs) + ": " + v1.isInside(vs));
+        System.out.println(vp + " vsCircumcircle " + toString(vs) + ": " +
+                           vp.vsCircumcircle(vs));
+        System.out.println(v1 + " vsCircumcircle " + toString(vs) + ": " +
+                           v1.vsCircumcircle(vs));
+        System.out.println(v2 + " vsCircumcircle " + toString(vs) + ": " +
+                           v2.vsCircumcircle(vs));
+        System.out.println("Circumcenter of " + toString(vs) + " is " + circumcenter(vs));
+    }
+}
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/Pnt.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/Simplex.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/Simplex.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/Simplex.java	(revision 12191)
@@ -0,0 +1,164 @@
+/*
+ * Copyright (c) 2005 by L. Paul Chew.
+ * 
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, subject to the following 
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+package com.iver.cit.gvsig.topology.triangulation;
+
+import java.util.AbstractSet;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+
+/**
+ * A Simplex is an immutable set of vertices (usually Pnts).
+ * 
+ * @author Paul Chew
+ * 
+ * Created July 2005. Derived from an earlier, messier version.
+ */
+public class Simplex extends AbstractSet implements Set {
+    
+    private List vertices;                  // The simplex's vertices
+    private long idNumber;                  // The id number
+    private static long idGenerator = 0;    // Used to create id numbers
+    public static boolean moreInfo = false; // True iff more info in toString
+    
+    /**
+     * Constructor.
+     * @param collection a Collection holding the Simplex vertices
+     * @throws IllegalArgumentException if there are duplicate vertices
+     */
+    public Simplex (Collection collection) {
+        this.vertices = Collections.unmodifiableList(new ArrayList(collection));
+        this.idNumber = idGenerator++;
+        Set noDups = new HashSet(this);
+        if (noDups.size() != this.vertices.size())
+            throw new IllegalArgumentException("Duplicate vertices in Simplex");
+    }
+    
+    /**
+     * Constructor.
+     * @param vertices the vertices of the Simplex.
+     * @throws IllegalArgumentException if there are duplicate vertices
+     */
+    public Simplex (Object[] vertices) {
+        this(Arrays.asList(vertices));
+    }
+    
+    /**
+     * String representation.
+     * @return the String representation of this Simplex
+     */
+    public String toString () {
+        if (!moreInfo) return "Simplex" + idNumber;
+        return "Simplex" + idNumber + super.toString();
+    }
+    
+    /**
+     * Dimension of the Simplex.
+     * @return dimension of Simplex (one less than number of vertices)
+     */
+    public int dimension () {
+        return this.vertices.size() - 1;
+    }
+    
+    /**
+     * True iff simplices are neighbors.
+     * Two simplices are neighbors if they are the same dimension and they share
+     * a facet.
+     * @param simplex the other Simplex
+     * @return true iff this Simplex is a neighbor of simplex
+     */
+    public boolean isNeighbor (Simplex simplex) {
+        HashSet h = new HashSet(this);
+        h.removeAll(simplex);
+        return (this.size() == simplex.size()) && (h.size() == 1);
+    }
+    
+    /**
+     * Report the facets of this Simplex.
+     * Each facet is a set of vertices.
+     * @return an Iterable for the facets of this Simplex
+     */
+    public List facets () {
+        List theFacets = new LinkedList();
+        for (Iterator it = this.iterator(); it.hasNext();) {
+            Object v = it.next();
+            Set facet = new HashSet(this);
+            facet.remove(v);
+            theFacets.add(facet);
+        }
+        return theFacets;
+    }
+    
+    /**
+     * Report the boundary of a Set of Simplices.
+     * The boundary is a Set of facets where each facet is a Set of vertices.
+     * @return an Iterator for the facets that make up the boundary
+     */
+    public static Set boundary (Set simplexSet) {
+        Set theBoundary = new HashSet();
+        for (Iterator it = simplexSet.iterator(); it.hasNext();) {
+            Simplex simplex = (Simplex) it.next();
+            for (Iterator otherIt = simplex.facets().iterator(); otherIt.hasNext();) {
+                Set facet = (Set) otherIt.next();
+                if (theBoundary.contains(facet)) theBoundary.remove(facet);
+                else theBoundary.add(facet);
+            }
+        }
+        return theBoundary;
+    }
+    
+    /* Remaining methods are those required by AbstractSet */
+    
+    /**
+     * @return Iterator for Simplex's vertices.
+     */
+    public Iterator iterator () {
+        return this.vertices.iterator();
+    }
+    
+    /**
+     * @return the size (# of vertices) of this Simplex
+     */
+    public int size () {
+        return this.vertices.size();
+    }
+    
+    /**
+     * @return the hashCode of this Simplex
+     */
+    public int hashCode () {
+        return (int)(idNumber^(idNumber>>>32));
+    }
+    
+    /**
+     * We want to allow for different simplices that share the same vertex set.
+     * @return true for equal Simplices
+     */
+    public boolean equals (Object o) {
+        return (this == o);
+    }
+}
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/Simplex.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/DelaunayTriangulation.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/DelaunayTriangulation.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/DelaunayTriangulation.java	(revision 12191)
@@ -0,0 +1,183 @@
+/*
+ * Copyright (c) 2005 by L. Paul Chew.
+ * 
+ * Permission is hereby granted, without written agreement and without
+ * license or royalty fees, to use, copy, modify, and distribute this
+ * software and its documentation for any purpose, subject to the following 
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software.
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING 
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
+ * DEALINGS IN THE SOFTWARE.
+ */
+package com.iver.cit.gvsig.topology.triangulation;
+
+import java.awt.geom.Point2D;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.NoSuchElementException;
+import java.util.Set;
+
+import com.vividsolutions.jts.geom.Coordinate;
+
+/**
+ * A 2D Delaunay Triangulation (DT) with incremental site insertion.
+ * This is not the fastest way to build a DT, but it's a reasonable way
+ * to build the DT incrementally and it makes a nice interactive display.
+ * There are several O(n log n) methods, but they require that either (1) 
+ * the sites are all known initially or (2) the sites are inserted in random
+ * order.
+ * 
+ * @author Paul Chew
+ * 
+ * Created July 2005.  Derived from an earlier, messier version.
+ */
+public class DelaunayTriangulation extends Triangulation {
+    
+    private Simplex mostRecent = null;       // Most recently inserted triangle
+    public boolean debug = false;            // Used for debugging
+    private static double initialSize = Double.MAX_VALUE / 2.0;
+//    private static Simplex initialTriangle = new Simplex(new Pnt[] {new Pnt(-10,10), new Pnt(10,10), new Pnt(0,-10)});
+    private static Simplex initialTriangle = new Simplex(new Pnt[] {
+            new Pnt(-initialSize, initialSize),
+            new Pnt( initialSize, initialSize),
+            new Pnt(           0,  -initialSize)});
+    
+    
+    
+    /**
+     * Constructor.
+     * All sites must fall within the initial triangle.
+     * @param triangle the initial triangle
+     */
+    public DelaunayTriangulation (Simplex triangle) {
+        super(triangle);
+        mostRecent = triangle;
+    }
+
+    public DelaunayTriangulation()
+    {
+    	super(initialTriangle);
+    	mostRecent = initialTriangle;
+    }
+
+    /**
+     * Locate the triangle with point (a Pnt) inside (or on) it.
+     * @param point the Pnt to locate
+     * @return triangle (Simplex<Pnt>) that holds the point; null if no such triangle
+     */
+    public Simplex locate (Pnt point) {
+        Simplex triangle = mostRecent;
+        if (!this.contains(triangle)) triangle = null;
+        
+        // Try a directed walk (this works fine in 2D, but can fail in 3D)
+        Set visited = new HashSet();
+        while (triangle != null) {
+            if (visited.contains(triangle)) { // This should never happen
+                System.out.println("Warning: Caught in a locate loop");
+                break;
+            }
+            visited.add(triangle);
+            // Corner opposite point
+            Pnt corner = point.isOutside((Pnt[]) triangle.toArray(new Pnt[0]));
+            if (corner == null) return triangle;
+            triangle = this.neighborOpposite(corner, triangle);
+        }
+        // No luck; try brute force
+        System.out.println("Warning: Checking all triangles for " + point);
+        for (Iterator it = this.iterator(); it.hasNext();) {
+            Simplex tri = (Simplex) it.next();
+            if (point.isOutside((Pnt[])tri.toArray(new Pnt[0])) == null) return tri;
+        }
+        // No such triangle
+        System.out.println("Warning: No triangle holds " + point);
+        return null;
+    }
+    
+    /**
+     * Place a new point site into the DT.
+     * @param site the new Pnt
+     * @return set of all new triangles created
+     */
+    public Set delaunayPlace (Pnt site) {
+        Set newTriangles = new HashSet();
+        Set oldTriangles = new HashSet();
+        Set doneSet = new HashSet();
+        LinkedList waitingQ = new LinkedList();
+        
+        // Locate containing triangle
+        if (debug) System.out.println("Locate");
+        Simplex triangle = locate(site);
+        
+        // Give up if no containing triangle or if site is already in DT
+        if (triangle == null || triangle.contains(site)) return newTriangles;
+        
+        // Find Delaunay cavity (those triangles with site in their circumcircles)
+        if (debug) System.out.println("Cavity");
+        waitingQ.add(triangle);
+        while (!waitingQ.isEmpty()) {
+            triangle = (Simplex) waitingQ.removeFirst();      
+            if (site.vsCircumcircle((Pnt[]) triangle.toArray(new Pnt[0])) == 1) continue;
+            oldTriangles.add(triangle);
+            Iterator it = this.neighbors(triangle).iterator();
+            for (; it.hasNext();) {
+                Simplex tri = (Simplex) it.next();
+                if (doneSet.contains(tri)) continue;
+                doneSet.add(tri);
+                waitingQ.add(tri);
+            }
+        }
+        // Create the new triangles
+        if (debug) System.out.println("Create");
+        for (Iterator it = Simplex.boundary(oldTriangles).iterator(); it.hasNext();) {
+            Set facet = (Set) it.next();
+            facet.add(site);
+            newTriangles.add(new Simplex(facet));
+        }
+        // Replace old triangles with new triangles
+        if (debug) System.out.println("Update");
+        this.update(oldTriangles, newTriangles);
+        
+        // Update mostRecent triangle
+        if (!newTriangles.isEmpty()) mostRecent = (Simplex) newTriangles.iterator().next();
+        return newTriangles;
+    }
+    
+    /**
+     * Main program; used for testing.
+     */
+    public static void main (String[] args) {
+//        Simplex tri = new Simplex(new Pnt[] {new Pnt(-10,10), new Pnt(10,10), new Pnt(0,-10)});
+//        System.out.println("Triangle created: " + tri);
+//        DelaunayTriangulation dt = new DelaunayTriangulation(tri);
+    	DelaunayTriangulation dt = new DelaunayTriangulation();
+        System.out.println("DelaunayTriangulation created: " + dt);
+        dt.delaunayPlace(new Pnt(0,0));
+        dt.delaunayPlace(new Pnt(1,0));
+        dt.delaunayPlace(new Pnt(0,1));
+        System.out.println("After adding 3 points, the DelaunayTriangulation is a " + dt);
+        dt.printStuff();
+    }
+    
+    public void delaunayPlace(Point2D p)
+    {
+    	Pnt aux = new Pnt(p.getX(), p.getY());
+    	delaunayPlace(aux);
+    }
+
+	public void delaunayPlace(Coordinate c) {
+    	Pnt aux = new Pnt(c.x, c.y);
+    	delaunayPlace(aux);		
+	}
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/triangulation/DelaunayTriangulation.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/TopologyBuilder.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/TopologyBuilder.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/TopologyBuilder.java	(revision 12191)
@@ -0,0 +1,254 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.topology;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.core.FPoint2D;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.ShapeFactory;
+import com.iver.cit.gvsig.fmap.core.v02.FConverter;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.layers.FBitSet;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.CoordinateArrays;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.util.LinearComponentExtracter;
+import com.vividsolutions.jts.operation.polygonize.Polygonizer;
+import com.vividsolutions.jts.planargraph.NodeMap;
+
+/**
+ * @author fjp
+ * 
+ * This class do its job thanks to the work of Martin Davis in
+ * JTS (Java Topology Suite).
+ * The code is extracted from JCS (Java Conflation Suite), made by
+ * Vivid Solutions (www.vividsolutions.com)
+ *
+ */
+public class TopologyBuilder {
+	private double fuzzyTolerance;
+	private double dangleTolerance;
+	private FLyrVect inputLayer;
+	private FLyrVect outputLayer;
+	private String statusMessage;
+	private GeometryFactory fact = new GeometryFactory();
+	private boolean nodeInputLines = false;
+	private Polygonizer polygonizer = new Polygonizer();
+	
+	
+	public TopologyBuilder(double fuzzy, double dangle)
+	{
+		fuzzyTolerance = fuzzy;
+		dangleTolerance = dangle;
+	}
+	
+	private Collection getLines(FLyrVect lv) throws DriverException, DriverIOException
+	  {
+	    List linesList = new ArrayList();
+	    LinearComponentExtracter lineFilter = new LinearComponentExtracter(linesList);
+		FBitSet bitSet = lv.getRecordset().getSelection();
+		
+		for(int i=bitSet.nextSetBit(0); i>=0; i=bitSet.nextSetBit(i+1)) {
+			IGeometry g = lv.getSource().getShape(i);
+			Geometry jtsGeom = g.toJTSGeometry();
+			jtsGeom.apply(lineFilter);
+		}
+
+	    return linesList;
+	  }
+
+	  private Collection nodeLines(List lines)
+	  {
+
+	    Geometry linesGeom = fact.createMultiLineString(GeometryFactory.toLineStringArray(lines));
+	    Geometry empty = fact.createMultiLineString(null);
+	    Geometry noded = linesGeom.union(empty);
+	    List nodedList = new ArrayList();
+	    nodedList.add(noded);
+	    return nodedList;
+	  }
+
+	
+	public Collection buildPolygons() throws DriverException
+	{
+	    // monitor.report("Polygonizing...");
+		if (inputLayer == null)
+			throw new RuntimeException("Please, set inputLayer before buildPolygons");
+		
+	    statusMessage = "Polygonizing...";
+
+	    Collection lines;
+		try {
+			lines = getLines(inputLayer);
+	
+		    Collection nodedLines = lines;
+		    if (nodeInputLines) {
+		    	statusMessage = "Noding input lines";
+		    	nodedLines = nodeLines((List) lines);
+		    }
+	
+		    for (Iterator i = nodedLines.iterator(); i.hasNext(); ) {
+		      Geometry g = (Geometry) i.next();
+		      polygonizer.add(g);
+		    }		    
+		    return polygonizer.getPolygons(); 
+		} catch (DriverIOException e) {
+			e.printStackTrace();
+			throw new DriverException(e);
+		}
+	}
+	public void buildLines()
+	{
+		
+	}
+	
+	public List getErrorNodes() throws DriverException
+	{
+		NodeMap nodeMap = new NodeMap();
+		FBitSet bitSet = inputLayer.getRecordset().getSelection();
+		
+		statusMessage = "Creando grafo...";
+		
+		for(int i=bitSet.nextSetBit(0); i>=0; i=bitSet.nextSetBit(i+1)) {
+			statusMessage = "Procesando registro " + i;
+			IGeometry g;
+			try {
+				g = inputLayer.getSource().getShape(i);
+			} catch (DriverIOException e) {
+				e.printStackTrace();
+				throw new DriverException(e);
+			}
+			Geometry jtsG = g.toJTSGeometry();
+			Coordinate[] coords = jtsG.getCoordinates();
+		    if (jtsG.isEmpty()) 
+		    	continue;
+		    Coordinate[] linePts = CoordinateArrays.removeRepeatedPoints(coords);
+		    Coordinate startPt = linePts[0];
+		    Coordinate endPt = linePts[linePts.length - 1];
+
+		    NodeError nStart = (NodeError) nodeMap.find(startPt);
+		    NodeError nEnd = (NodeError) nodeMap.find(endPt);
+		    if (nStart == null)
+		    {
+		    	nStart = new NodeError(startPt);
+		    	nodeMap.add(nStart);
+		    }
+		    else
+		    	nStart.setOccurrences(nStart.getOccurrences()+1);
+		    if (nEnd == null)
+		    {
+		    	nEnd = new NodeError(endPt);
+		    	nodeMap.add(nEnd);
+		    }
+		    else
+		    	nEnd.setOccurrences(nEnd.getOccurrences()+1);
+
+		}
+		
+		// Ahora recorremos todos los nodos y los que solo hayan sido
+		// a�adidos una vez, son dangle o fuzzy.
+		// TODO: Poner una tolerancia para que las coordinate cercanas
+		// formen un solo nodo.
+		statusMessage = "Extrayendo fuzzy y dangle nodes...";
+		ArrayList nodeErrors = new ArrayList();
+		Iterator it = nodeMap.iterator();
+		while (it.hasNext())
+		{
+			NodeError node = (NodeError) it.next();
+			if (node.getOccurrences() == 1)
+			{				
+				FPoint2D p = FConverter.coordinate2FPoint2D(node.getCoordinate());
+				IGeometry gAux = ShapeFactory.createPoint2D(p);
+				nodeErrors.add(gAux);
+
+				
+			}
+		}
+		return nodeErrors;
+
+	}
+
+	public String getStatusMessage() {
+		return statusMessage;
+	}
+
+	public boolean isNodeInputLines() {
+		return nodeInputLines;
+	}
+
+	public void setNodeInputLines(boolean nodeInputLines) {
+		this.nodeInputLines = nodeInputLines;
+	}
+
+	public Collection getCutEdges() {
+		return polygonizer.getCutEdges();
+	}
+
+	public Collection getDangles() {
+		return polygonizer.getDangles();
+	}
+
+	public FLyrVect getInputLayer() {
+		return inputLayer;
+	}
+
+	public void setInputLayer(FLyrVect inputLayer) {
+		this.inputLayer = inputLayer;
+	}
+
+	public FLyrVect getOutputLayer() {
+		return outputLayer;
+	}
+
+	public void setOutputLayer(FLyrVect outputLayer) {
+		this.outputLayer = outputLayer;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/TopologyBuilder.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/LineCleanGeoprocessPlugin.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/LineCleanGeoprocessPlugin.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/LineCleanGeoprocessPlugin.java	(revision 12191)
@@ -0,0 +1,124 @@
+/*
+ * Created on 10-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.2  2006-10-17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/10 18:50:17  azabala
+* First version in CVS
+*
+*
+*/
+package com.iver.cit.gvsig.topology.lineclean;
+
+import java.net.URL;
+import java.util.Locale;
+
+import com.iver.andami.PluginServices;
+import com.iver.cit.gvsig.fmap.layers.FLayers;
+import com.iver.cit.gvsig.geoprocess.core.IGeoprocessController;
+import com.iver.cit.gvsig.geoprocess.core.IGeoprocessPlugin;
+import com.iver.cit.gvsig.geoprocess.core.gui.IGeoprocessPanel;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+import com.iver.cit.gvsig.topology.lineclean.gui.LineCleanGeoprocessPanel;
+
+public class LineCleanGeoprocessPlugin implements IGeoprocessPlugin {
+
+	private static String dataConvertPkg;
+	private static String geoprocessName;
+	
+	static{
+		dataConvertPkg = 
+			PluginServices.getText(null, "Conversion_de_datos");
+		geoprocessName =
+			PluginServices.getText(null, "LineClean");
+	}
+	
+	
+	
+	public IGeoprocessPanel getGeoprocessPanel() {
+		View vista = (View)PluginServices.
+		getMDIManager().
+		getActiveWindow();
+		FLayers layers = vista.getModel().
+			getMapContext().
+			getLayers();
+		
+		return new LineCleanGeoprocessPanel(layers);
+	}
+
+	public URL getHtmlDescription() {
+		Locale locale = Locale.getDefault();
+		String localeStr = locale.getLanguage();
+		String urlStr = "resources/description_" +
+										localeStr +
+											".html";
+		URL url = LineCleanGeoprocessPlugin.class.
+		getResource(urlStr);
+		return url;
+	}
+
+	public URL getImgDescription() {
+		URL url = LineCleanGeoprocessPlugin.class.
+			getResource("resources/linecleandesc.png");
+		return url;
+	}
+
+	public IGeoprocessController getGpController() {
+		return new LineCleanGeoprocessController();
+	}
+
+	public String getNamespace() {
+		return dataConvertPkg + "/" + geoprocessName;
+	}
+	
+	public String toString(){
+		return geoprocessName;
+	}
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/LineCleanGeoprocessPlugin.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/fmap/LineCleanVisitor.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/fmap/LineCleanVisitor.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/fmap/LineCleanVisitor.java	(revision 12191)
@@ -0,0 +1,824 @@
+/*
+ * Created on 10-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.7  2006-11-14 18:34:16  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.6  2006/11/14 18:01:09  azabala
+ * removed system.out.println
+ *
+ * Revision 1.5  2006/11/13 20:41:08  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.4  2006/10/19 16:06:48  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.3  2006/10/17 18:27:24  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.1  2006/10/10 18:50:17  azabala
+ * First version in CVS
+ *
+ *
+ */
+package com.iver.cit.gvsig.topology.lineclean.fmap;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Iterator;
+
+import com.hardcode.gdbms.engine.data.driver.DriverException;
+import com.hardcode.gdbms.engine.values.Value;
+import com.hardcode.gdbms.engine.values.ValueFactory;
+import com.iver.cit.gvsig.fmap.core.IFeature;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.v02.FConverter;
+import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
+import com.iver.cit.gvsig.fmap.drivers.ILayerDefinition;
+import com.iver.cit.gvsig.fmap.edition.EditionException;
+import com.iver.cit.gvsig.fmap.layers.FBitSet;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
+import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
+import com.iver.cit.gvsig.fmap.layers.layerOperations.VectorialData;
+import com.iver.cit.gvsig.fmap.operations.strategies.FeatureVisitor;
+import com.iver.cit.gvsig.fmap.operations.strategies.Strategy;
+import com.iver.cit.gvsig.fmap.operations.strategies.StrategyManager;
+import com.iver.cit.gvsig.fmap.operations.strategies.VisitException;
+import com.iver.cit.gvsig.geoprocess.core.fmap.FeatureFactory;
+import com.iver.cit.gvsig.geoprocess.core.fmap.FeaturePersisterProcessor2;
+import com.iver.cit.gvsig.geoprocess.core.fmap.FeatureProcessor;
+import com.iver.cit.gvsig.geoprocess.core.fmap.XTypes;
+import com.iver.cit.gvsig.util.SnappingCoordinateMap;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryCollection;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.MultiLineString;
+import com.vividsolutions.jts.geom.MultiPoint;
+import com.vividsolutions.jts.geom.Point;
+import com.vividsolutions.jts.geom.Polygon;
+import com.vividsolutions.jts.geomgraph.Node;
+import com.vividsolutions.jts.geomgraph.NodeFactory;
+import com.vividsolutions.jts.geomgraph.SnappingNodeMap;
+import com.vividsolutions.jts.linearref.LengthIndexedLine;
+import com.vividsolutions.jts.linearref.LinearLocation;
+import com.vividsolutions.jts.linearref.LocationIndexedLine;
+import com.vividsolutions.jts.operation.overlay.SnappingOverlayOperation;
+
+/**
+ * <p>
+ * This visitor operates with features whose geometries are lines. <br>
+ * For each visited feature, it looks for features in its proximity (spatial
+ * query). If these features hasnt been processed, it intersects the visited
+ * feature with all of the neighbour features. If intersection points are not
+ * nodes (end points), it ignores them. split the
+ * </p>
+ * 
+ * @author azabala
+ */
+public class LineCleanVisitor implements FeatureVisitor {
+
+	/**
+	 * Recordset of the layer we are working with
+	 */
+	protected SelectableDataSource recordset;
+
+	/**
+	 * Layer which we are cleaning
+	 */
+	protected FLyrVect layerToClean;
+
+	/**
+	 * marks if we are going to clean only layer selection
+	 */
+	protected boolean cleanOnlySelection;
+
+	/*
+	 * TODO Meter esto en preferencias
+	 */
+	public final static double DEFAULT_SNAP = 0.1;
+
+	protected double snapTolerance = DEFAULT_SNAP;
+
+	/**
+	 * It marks all processed features (to ignore them in future intersections)
+	 */
+	protected FBitSet processedFeatures;
+
+	/**
+	 * Strategy of the layer we are working with.
+	 */
+	protected Strategy strategy;
+
+	/**
+	 * Saves features resulting of cleaning process
+	 */
+	protected FeatureProcessor featureProcessor;
+
+	protected ILayerDefinition layerDefinition;
+	
+	
+	/**
+	 * Saves pseudonodes found
+	 * */
+	protected FeatureProcessor intersectProcessor;
+	protected ILayerDefinition intersectDefinition;
+	
+	
+	/**
+	 * Counter of new features
+	 */
+	int fid = 0;
+	
+	/**
+	 * It caches all written pseudonodes, to avoid 
+	 * writing the same pseudonode twice.
+	 * 
+	 * */
+	SnappingCoordinateMap snapCoordMap;
+	
+	/**
+	 * Constructor.
+	 * @param processor
+	 * @param intersectsProcessor
+	 * @param cleanOnlySelection
+	 * @param layerDefinition
+	 * @param intersectDefinition
+	 * @param firstLayer
+	 * @param source
+	 * @param snapCoordMap
+	 */
+	public LineCleanVisitor(FeatureProcessor processor,
+			FeaturePersisterProcessor2 intersectsProcessor, 
+									boolean cleanOnlySelection, 
+									ILayerDefinition layerDefinition, 
+									ILayerDefinition intersectDefinition, 
+									FLyrVect firstLayer, 
+									SelectableDataSource source,
+									SnappingCoordinateMap snapCoordMap) {
+		this.featureProcessor = processor;
+		this.cleanOnlySelection = cleanOnlySelection;
+		processedFeatures = new FBitSet();
+		this.layerDefinition = layerDefinition;
+		this.intersectProcessor = intersectsProcessor;
+		this.intersectDefinition = intersectDefinition;
+		this.layerToClean = firstLayer;
+		this.recordset = source;
+		this.strategy = StrategyManager.getStrategy(layerToClean);
+		this.snapCoordMap = snapCoordMap;
+	}
+
+	public void setLayerDefinition(ILayerDefinition layerDefinition) {
+		this.layerDefinition = layerDefinition;
+	}
+
+	private boolean checkForLineGeometry(Geometry geometry) {
+		if (geometry instanceof LineString)
+			return true;
+		if (geometry instanceof MultiLineString)
+			return true;
+		if (geometry instanceof GeometryCollection) {
+			GeometryCollection col = (GeometryCollection) geometry;
+			for (int i = 0; i < col.getNumGeometries(); i++) {
+				if (!checkForLineGeometry(col.getGeometryN(i)))
+					return false;
+			}
+			return true;
+		}
+		return false;
+	}
+
+	public void visit(IGeometry g, final int index) throws VisitException {
+		// first, we check it isnt a null geometry and the geometry type
+		// is correct
+		if (g == null)
+			return;
+		int geometryType = g.getGeometryType();
+		if (geometryType != XTypes.ARC && geometryType != XTypes.LINE
+				&& geometryType != XTypes.MULTI)
+			return;
+
+		// after that, if we are going to clean only selected features, we
+		// check if this feature is selected
+		if (cleanOnlySelection) {
+			try {
+				if (!layerToClean.getRecordset().getSelection().get(index))
+					return;
+			} catch (com.iver.cit.gvsig.fmap.DriverException e) {
+				throw new VisitException(
+						"Error verificando seleccion en CLEAN", e);
+			}
+		}// if cleanOnly
+
+		final Geometry jtsGeo = g.toJTSGeometry();
+
+		
+		// we check if jts geometry is a line (or a line collection)
+		if (!checkForLineGeometry(jtsGeo))
+			return;
+
+		final SnappingNodeMap nodes = new SnappingNodeMap(new NodeFactory(),
+				snapTolerance);
+		/*
+		 * Se nos plantea una problematica. Tenemos dos features: A y B, y he
+		 * calculado la interseccion de A y B. Ahora, hay dos alternativas: -a)
+		 * nunca mas calcular esta intersecci�n, pero almacenar su resultado en
+		 * SnappingNodeMap. As�, en una segunda pasada, con todos los "Nodos"
+		 * calculados, podr�amos fragmentar las lineas de forma individual.
+		 * PROBLEMA: SnappingNodeMap ir�a creciendo, almacenando todos los nodos
+		 * de una capa....(si se apoya sobre un IndexedShpDriver, no tendr�a por
+		 * qu�)
+		 * 
+		 * 
+		 * -b) Calcular la intersecci�n en los dos sentidos: A int B, y luego al
+		 * procesar B, B int A. En este caso, pasamos ol�mpicamente del bitset
+		 * 
+		 * De momento, por simplicidad, seguimos la alternativa -b)
+		 */
+
+		final boolean onlySelection = cleanOnlySelection;
+		try {
+			strategy.process(new FeatureVisitor() {
+				
+				
+				SnappingOverlayOperation overlayOp = null;
+
+				/**
+				 * From a given geometry, it returns its nodes (coordinate for a
+				 * point, extreme coordinates for a line, first coordinate for a
+				 * polygon)
+				 */
+				private Coordinate[] getNodesFor(Geometry processedGeometry) {
+					Coordinate[] geomNodes = null;
+					if (processedGeometry instanceof LineString) {
+						LineString line = (LineString) processedGeometry;
+						geomNodes = new Coordinate[2];
+						geomNodes[0] = line.getCoordinateN(0);
+						geomNodes[1] = line
+								.getCoordinateN(line.getNumPoints() - 1);
+					} else if (processedGeometry instanceof MultiLineString) {
+						MultiLineString lines = (MultiLineString) processedGeometry;
+						int numLines = lines.getNumGeometries();
+						geomNodes = new Coordinate[2 * numLines];
+						int index = 0;
+						for (int i = 0; i < numLines; i++) {
+							LineString line = (LineString) lines
+									.getGeometryN(i);
+							geomNodes[index] = line.getCoordinateN(0);
+							index++;
+							geomNodes[index] = line.getCoordinateN(line
+									.getNumPoints() - 1);
+							index++;
+						}
+					} else if (processedGeometry instanceof GeometryCollection) {
+						GeometryCollection col = (GeometryCollection) processedGeometry;
+						ArrayList coordinates = new ArrayList();
+						for (int i = 0; i < col.getNumGeometries(); i++) {
+							Geometry geom = col.getGeometryN(i);
+							Coordinate[] newNodes = getNodesFor(geom);
+							coordinates.addAll(Arrays.asList(newNodes));
+						}
+					}
+//					else {
+//						System.out
+//								.println("Este proceso solo debe trabajar con lineas");
+//						System.out.println(processedGeometry.getGeometryType());
+//					}
+					return geomNodes;
+				}
+
+				/**
+				 * Checks if a coordinate is on a node of a given set of nodes
+				 * 
+				 * @param coord
+				 * @param nodes
+				 * @return
+				 */
+				private boolean checkIsNode(Coordinate coord, Coordinate[] nodes) {
+					for (int i = 0; i < nodes.length; i++) {
+						if (coord.distance(nodes[i]) <= snapTolerance)
+							return true;
+					}
+					return false;
+				}
+
+				/**
+				 * From a given geometry, and the intersection of this geometry
+				 * with another geometry, it creates a new node with these
+				 * intersections if its points are not coincident with the nodes
+				 * of the original goemetry.
+				 * 
+				 */
+				private void processIntersections(com.vividsolutions.jts.geomgraph.SnappingNodeMap nodes,
+						Geometry processedGeometry, Geometry intersections, int fid1, int fid2) {
+
+					Coordinate[] geomNodes = getNodesFor(processedGeometry);
+					if (intersections instanceof Point) {
+						Point p = (Point) intersections;
+						Coordinate coord = p.getCoordinate();
+						if (!checkIsNode(coord, geomNodes)){
+							nodes.addNode(coord);
+							
+							/*
+							 * We are computing intersections twice: A intersection B
+							 * and B intersection A. This is simpler than manage caches.
+							 * With this logic, we avoid to write the same pseudonode twice
+							 * 
+							 * */
+							if(snapCoordMap.containsKey(coord))
+								return;
+							else{
+								snapCoordMap.put(coord, coord);
+								IFeature feature = createIntersectFeature(coord, fid1, fid2);
+								intersectProcessor.processFeature(feature);
+							}
+						} 	
+					} else if (intersections instanceof MultiPoint) {
+						MultiPoint points = (MultiPoint) intersections;
+						for (int i = 0; i < points.getNumGeometries(); i++) {
+							Coordinate coord = ((Point) points.getGeometryN(i))
+									.getCoordinate();
+							if (!checkIsNode(coord, geomNodes)){
+								nodes.addNode(coord);
+								if(snapCoordMap.containsKey(coord))
+									return;
+								else{
+									snapCoordMap.put(coord, coord);
+									IFeature feature = createIntersectFeature(coord, fid1, fid2);
+									intersectProcessor.processFeature(feature);
+								}
+							}	
+						}
+					} else if (intersections instanceof LineString) {
+						LineString line = (LineString) intersections;
+						int numPoints = line.getCoordinates().length;
+						Coordinate coord1 = line.getCoordinateN(0);
+						Coordinate coord2 = line.getCoordinateN(numPoints - 1);
+						if (!checkIsNode(coord1, geomNodes)){
+							nodes.addNode(coord1);
+							if(snapCoordMap.containsKey(coord1))
+								return;
+							else{
+								snapCoordMap.put(coord1, coord1);
+								IFeature feature = createIntersectFeature(coord1, fid1, fid2);
+								intersectProcessor.processFeature(feature);
+							}
+						}	
+						if (!checkIsNode(coord2, geomNodes)){
+							nodes.addNode(coord2);
+							if(snapCoordMap.containsKey(coord2))
+								return;
+							else{
+								snapCoordMap.put(coord2, coord2);
+								IFeature feature = createIntersectFeature(coord2, fid1, fid2);
+								intersectProcessor.processFeature(feature);
+							}
+						}	
+					} else if (intersections instanceof GeometryCollection) {
+						GeometryCollection col = (GeometryCollection) intersections;
+						for (int i = 0; i < col.getNumGeometries(); i++) {
+
+							// El tema est� en que aqu� el calculo de los nodos
+							// de la geometria intersectada se repite cada vez
+							// revisar, pues MultiLineString puede ser un
+							// resultado habitual
+							processIntersections(nodes, processedGeometry, col
+									.getGeometryN(i), fid1, fid2);
+						}
+					}
+//					else if (intersections instanceof Polygon) {
+//						System.out
+//								.println("Un poligono interseccion de 2 lineas???");
+//					}// else
+
+				}
+
+				public void visit(IGeometry g2, int indexOverlay)
+						throws VisitException {
+
+					if (g2 == null)
+						return;
+
+					if (index == indexOverlay)
+						return;
+
+					if (onlySelection) {
+						try {
+							if (!layerToClean.getRecordset().getSelection()
+									.get(indexOverlay))
+								return;
+						} catch (com.iver.cit.gvsig.fmap.DriverException e) {
+							throw new VisitException(
+									"Error verificando seleccion en clean", e);
+						}// geometry g is not selected
+					}// if onlySelection
+
+					int geometryType = g2.getGeometryType();
+					if (geometryType != XTypes.ARC
+							&& geometryType != XTypes.LINE
+							&& geometryType != XTypes.MULTI)
+						return;
+
+					/*
+					 * TODO De momento no vamos a tener en cuenta que la
+					 * interseccion ya ha sido calculada... (Ver comentario al
+					 * instanciar SnappingNodeMap) // ya ha sido tratado
+					 * if(processedFeatures.get(indexOverlay)) return;
+					 */
+					Geometry jtsGeo2 = g2.toJTSGeometry();
+					if (!checkForLineGeometry(jtsGeo2))
+						return;
+
+					if(overlayOp == null)
+						overlayOp = new SnappingOverlayOperation(jtsGeo, jtsGeo2, snapTolerance);	
+					else{
+						overlayOp.setSecondGeometry(jtsGeo2);
+					}
+					
+					Geometry intersections = overlayOp.
+						getResultGeometry(SnappingOverlayOperation.INTERSECTION);
+						
+					processIntersections(nodes, jtsGeo, intersections, index, indexOverlay);
+
+					// IFeature cleanedFeature;
+					// try {
+					// cleanedFeature = createFeature(newGeoJts,
+					// index, indexOverlay);
+					// } catch (DriverException e) {
+					// throw new VisitException(
+					// "Error al crear el feature resultante del CLEAN");
+					// }
+					// featureProcessor.processFeature(cleanedFeature);
+
+				}
+
+				public String getProcessDescription() {
+					return "Computing intersections of a polygon with its adjacents";
+				}
+
+				public void stop(FLayer layer) {
+				}
+
+				public boolean start(FLayer layer) {
+					return true;
+				}
+			}, g.getBounds2D());
+
+			// At this point, nodes variable (SnappingNodeMap)
+			// has all intersections of the visited feature with the rest of
+			// features of the layer
+
+			// It computes linear distance of a point on the given jtsGeo linear
+			// geometry
+			LengthIndexedLine lengthLine = new LengthIndexedLine(jtsGeo);
+			Iterator nodesIt = nodes.iterator();
+			ArrayList nodeIntersections = new ArrayList();
+			while (nodesIt.hasNext()) {
+				Node node = (Node) nodesIt.next();
+				Coordinate coord = node.getCoordinate();
+				double lengthOfNode = lengthLine.indexOf(coord);
+				LineIntersection inters = new LineIntersection();
+				inters.coordinate = coord;
+				inters.lenght = lengthOfNode;
+				nodeIntersections.add(inters);
+			}
+
+			if (nodeIntersections.size() > 0) {
+				//	We sort the intersections by distance along the line (dynamic
+				// segmentation)
+				Collections.sort(nodeIntersections, new Comparator() {
+					public int compare(Object arg0, Object arg1) {
+						LineIntersection l1 = (LineIntersection) arg0;
+						LineIntersection l2 = (LineIntersection) arg1;
+						if (l1.lenght > l2.lenght)
+							return 1;
+						else if (l1.lenght < l2.lenght)
+							return -1;
+						else
+							return 0;
+					}
+				});
+
+				LinearLocation lastLocation = null;
+				LineIntersection lastIntersection = null;
+				LocationIndexedLine indexedLine = new LocationIndexedLine(
+						jtsGeo);
+				for (int i = 0; i < nodeIntersections.size(); i++) {
+					Geometry solution = null;
+					LineIntersection li = (LineIntersection) nodeIntersections
+							.get(i);
+					
+					LinearLocation location = indexedLine
+							.indexOf(li.coordinate);
+					if (lastLocation == null) {
+						LinearLocation from = new LinearLocation(0, 0d);
+						solution = splitLineString(jtsGeo, from, location,
+								null, li);
+						lastLocation = location;
+						lastIntersection = li;
+						/*
+						 * Construimos una linea desde el primer punto hasta el
+						 * punto contenido en LineIntersection, con todos los
+						 * puntos intermedios de la linea.
+						 * 
+						 * 
+						 * 
+						 */
+					} else {
+						// Construimos una linea entre lastIntersection y la
+						// intersection
+						// actual
+						LinearLocation locationFrom = lastLocation;
+						solution = splitLineString(jtsGeo, locationFrom,
+								location, lastIntersection, li);
+						lastLocation = location;
+						lastIntersection = li;
+
+					}
+
+					
+						IFeature feature = createFeature(solution, index);
+						featureProcessor.processFeature(feature);
+						// TODO Podriamos guardar los puntos de interseccion
+						// para
+						// mostrar al usuario que puntos eran pseudonodos
+				}// for
+				
+				//a�adimos el ultimo segmento
+				Coordinate[] geomCoords = jtsGeo.getCoordinates();
+				ArrayList coordinates = new ArrayList();
+				coordinates.add(lastIntersection.coordinate);
+				int startIndex = lastLocation.getSegmentIndex() + 1;
+				for (int i = startIndex; i < geomCoords.length; i++) {
+					coordinates.add(geomCoords[i]);
+				}
+				Coordinate[] solutionCoords = new Coordinate[coordinates.size()];
+				coordinates.toArray(solutionCoords);
+				IFeature lastFeature = createFeature(new GeometryFactory().
+										 createLineString(solutionCoords), 
+										 index);
+				featureProcessor.processFeature(lastFeature);
+				
+				
+			} else {
+				IFeature feature = createFeature(g, index);
+				featureProcessor.processFeature(feature);
+			}
+
+		} catch (com.iver.cit.gvsig.fmap.DriverException e) {
+			throw new VisitException(
+					"Error buscando los overlays que intersectan con un feature");
+		} catch (DriverException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+	private Geometry splitLineString(Geometry linearGeometry,
+			LinearLocation from, LinearLocation to, LineIntersection fromInt,
+			LineIntersection toInt) {
+		Coordinate[] geomCoords = linearGeometry.getCoordinates();
+		ArrayList coordinates = new ArrayList();
+		if (fromInt != null)
+			coordinates.add(fromInt.coordinate);
+		int startIndex = from.getSegmentIndex();
+		/*
+		 * segmentIndex siempre referencia al punto inmediatamente anterior del
+		 * lineString. Nos interesa sumar 1, a no ser que sea el primer punto
+		 * del linestring
+		 */
+		if (startIndex != 0)
+			startIndex++;
+		
+		for (int i = startIndex; i <= to.getSegmentIndex(); i++) {
+			coordinates.add(geomCoords[i]);
+		}
+		coordinates.add(toInt.coordinate);
+		Coordinate[] solutionCoords = new Coordinate[coordinates.size()];
+		coordinates.toArray(solutionCoords);
+		return new GeometryFactory().createLineString(solutionCoords);
+
+	}
+
+	class LineIntersection {
+		Coordinate coordinate;
+
+		double lenght;
+	}
+
+	public String getProcessDescription() {
+		return "Cleaning lines of a vectorial line layer";
+	}
+
+	public void stop(FLayer layer) {
+		this.featureProcessor.finish();
+		this.intersectProcessor.finish();
+	}
+
+	public boolean start(FLayer layer) {
+		if (layer instanceof AlphanumericData && layer instanceof VectorialData) {
+			try {
+				layerToClean = (FLyrVect) layer;
+				recordset = ((AlphanumericData) layer).getRecordset();
+				strategy = StrategyManager.getStrategy(layerToClean);
+				featureProcessor.start();
+				intersectProcessor.start();
+			} catch (com.iver.cit.gvsig.fmap.DriverException e) {
+				return false;
+			} catch (EditionException e) {
+				return false;
+			}
+			return true;
+		}
+		return false;
+	}
+
+	private IFeature createFeature(Geometry jtsGeometry, int firstLayerIndex)
+			throws DriverException {
+		IFeature solution = null;
+		IGeometry cleanedGeometry = FConverter.jts_to_igeometry(jtsGeometry);
+		FieldDescription[] fields = layerDefinition.getFieldsDesc();
+		int numFields = fields.length;
+		Value[] featureAttr = new Value[fields.length];
+		for (int indexField = 0; indexField < numFields; indexField++) {
+			// for each field of firstRs
+			String fieldName = recordset.getFieldName(indexField);
+			for (int j = 0; j < fields.length; j++) {
+				if (fieldName.equalsIgnoreCase(fields[j].getFieldName())) {
+					featureAttr[j] = recordset.getFieldValue(firstLayerIndex,
+							indexField);
+					break;
+				}// if
+			}// for
+		}// for
+		// now we put null values
+		for (int i = 0; i < featureAttr.length; i++) {
+			if (featureAttr[i] == null)
+				featureAttr[i] = ValueFactory.createNullValue();
+		}
+		solution = FeatureFactory.createFeature(featureAttr, cleanedGeometry);
+		return solution;
+	}
+	
+	
+	
+	private IFeature createIntersectFeature(Coordinate coord,  int fid1, int fid2){
+		IFeature solution = null;
+		Point point = FConverter.geomFactory.createPoint(coord);
+		IGeometry cleanedGeometry = FConverter.jts_to_igeometry(point);
+		Value[] values = new Value[2];
+		values[0] = ValueFactory.createValue(fid1);
+		values[1] = ValueFactory.createValue(fid2);
+		solution = FeatureFactory.createFeature(values, cleanedGeometry);
+		return solution;
+	}
+
+	private IFeature createFeature(IGeometry g, int firstLayerIndex)
+			throws DriverException {
+		IFeature solution = null;
+		FieldDescription[] fields = layerDefinition.getFieldsDesc();
+		int numFields = fields.length;
+		Value[] featureAttr = new Value[fields.length];
+		for (int indexField = 0; indexField < numFields; indexField++) {
+			// for each field of firstRs
+			String fieldName = recordset.getFieldName(indexField);
+			for (int j = 0; j < fields.length; j++) {
+				if (fieldName.equalsIgnoreCase(fields[j].getFieldName())) {
+					featureAttr[j] = recordset.getFieldValue(firstLayerIndex,
+							indexField);
+					break;
+				}// if
+			}// for
+		}// for
+		// now we put null values
+		for (int i = 0; i < featureAttr.length; i++) {
+			if (featureAttr[i] == null)
+				featureAttr[i] = ValueFactory.createNullValue();
+		}
+		solution = FeatureFactory.createFeature(featureAttr, g);
+		return solution;
+	}
+
+//	public static void main(String[] args) {
+//		DriverManager dm = new DriverManager();
+//		dm.setValidation(new DriverValidation() {
+//			public boolean validate(Driver d) {
+//				return ((d instanceof ObjectDriver)
+//						|| (d instanceof FileDriver) || (d instanceof DBDriver));
+//			}
+//		});
+//		dm.loadDrivers(new File(
+//				"../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers"));
+//		LayerFactory
+//				.setDriversPath("../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
+//
+//		// Setup del factory de DataSources
+//		DataSourceFactory dsf = LayerFactory.getDataSourceFactory();
+//		dsf.setDriverManager(dm);
+//
+//		// Setup de las tablas
+//		// dsf.addFileDataSource("gdbms dbf driver", "nodes", "c:/nodes.dbf");
+//		// dsf.addFileDataSource("gdbms dbf driver", "edges", "c:/edges.dbf");
+//
+//		IProjection prj = CRSFactory.getCRS("EPSG:23030");
+//		File shpFile = new File("C:/JUMP/datos/cauces_gv.shp");
+//		try {
+//			FLyrVect lyr = (FLyrVect) LayerFactory.createLayer("Ejes",
+//					"gvSIG shp driver", shpFile, prj);
+//			System.out.println(lyr.getSource().getShapeCount());
+//
+//			LayerDefinition definition = new LayerDefinition();
+//			FieldDescription cauNom = new FieldDescription();
+//			cauNom.setFieldName("CAUNOM");
+//			cauNom.setFieldType(XTypes.CHAR);
+//			cauNom.setFieldLength(10);
+//			cauNom.setFieldDecimalCount(0);
+//			definition.setFieldsDesc(new FieldDescription[]{cauNom});
+//			definition.setShapeType(XTypes.LINE);
+//			
+//			
+//			
+//			
+////			LineCleanVisitor visitor = new LineCleanVisitor(
+////					new FeatureProcessor() {
+////
+////						public void processFeature(IRow feature) {
+////							// TODO Auto-generated method stub
+////
+////						}
+////
+////						public void finish() {
+////							// TODO Auto-generated method stub
+////
+////						}
+////
+////						public void start() throws EditionException {
+////							// TODO Auto-generated method stub
+////
+////						}
+////					}, false, definition);
+//			Strategy str = StrategyManager.getStrategy(lyr);
+////			str.process(visitor);
+//
+////		} catch (com.iver.cit.gvsig.fmap.DriverException e) {
+////			// TODO Auto-generated catch block
+////			e.printStackTrace();
+////		} catch (DriverIOException e) {
+////			// TODO Auto-generated catch block
+////			e.printStackTrace();
+////		} catch (VisitException e) {
+////			// TODO Auto-generated catch block
+////			e.printStackTrace();
+////		}
+//	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/fmap/LineCleanVisitor.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/fmap/LineCleanGeoprocess.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/fmap/LineCleanGeoprocess.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/fmap/LineCleanGeoprocess.java	(revision 12191)
@@ -0,0 +1,390 @@
+/*
+ * Created on 10-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.8  2006-11-14 18:34:16  azabala
+* *** empty log message ***
+*
+* Revision 1.7  2006/11/14 18:00:57  azabala
+* internationalized texts
+*
+* Revision 1.6  2006/11/13 20:41:08  azabala
+* *** empty log message ***
+*
+* Revision 1.5  2006/11/10 13:22:57  azabala
+* better syncronization of clean and build network (use of pipetask)
+*
+* Revision 1.4  2006/11/09 21:08:32  azabala
+* *** empty log message ***
+*
+* Revision 1.3  2006/10/19 16:06:48  azabala
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/10 18:50:17  azabala
+* First version in CVS
+*
+*
+*/
+package com.iver.cit.gvsig.topology.lineclean.fmap;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Map;
+
+import com.iver.andami.PluginServices;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
+import com.iver.cit.gvsig.fmap.drivers.ILayerDefinition;
+import com.iver.cit.gvsig.fmap.drivers.LayerDefinition;
+import com.iver.cit.gvsig.fmap.drivers.SHPLayerDefinition;
+import com.iver.cit.gvsig.fmap.edition.EditionException;
+import com.iver.cit.gvsig.fmap.edition.IWriter;
+import com.iver.cit.gvsig.fmap.edition.ShpSchemaManager;
+import com.iver.cit.gvsig.fmap.edition.writers.shp.MultiShpWriter;
+import com.iver.cit.gvsig.fmap.edition.writers.shp.ShpWriter;
+import com.iver.cit.gvsig.fmap.layers.FBitSet;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLayers;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
+import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
+import com.iver.cit.gvsig.fmap.layers.layerOperations.VectorialData;
+import com.iver.cit.gvsig.fmap.operations.strategies.Strategy;
+import com.iver.cit.gvsig.fmap.operations.strategies.StrategyManager;
+import com.iver.cit.gvsig.fmap.operations.strategies.VisitException;
+import com.iver.cit.gvsig.geoprocess.core.fmap.AbstractGeoprocess;
+import com.iver.cit.gvsig.geoprocess.core.fmap.DefinitionUtils;
+import com.iver.cit.gvsig.geoprocess.core.fmap.FeaturePersisterProcessor2;
+import com.iver.cit.gvsig.geoprocess.core.fmap.GeoprocessException;
+import com.iver.cit.gvsig.geoprocess.core.fmap.XTypes;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+import com.iver.cit.gvsig.util.SnappingCoordinateMap;
+import com.iver.utiles.swing.threads.AbstractMonitorableTask;
+import com.iver.utiles.swing.threads.Cancellable;
+import com.iver.utiles.swing.threads.IMonitorableTask;
+import com.iver.utiles.swing.threads.IPipedTask;
+
+public class LineCleanGeoprocess extends AbstractGeoprocess {
+
+	/**
+	 * Schema of the result layer
+	 */
+	private ILayerDefinition resultLayerDefinition;
+
+	
+	/**
+	 * flag to only clip selection of input layer
+	 */
+	private boolean onlyFirstLayerSelection = false;
+	
+	/**
+	 * Processes features (writing them)
+	 */
+	FeaturePersisterProcessor2 processor;
+
+	/**
+	 * Writer to save in a temporal layer intersections
+	 */
+	private IWriter intersectionsWriter;
+	FeaturePersisterProcessor2 intersectsProcessor;
+	
+	
+	public LineCleanGeoprocess(FLyrVect inputLayer){
+		this.firstLayer = inputLayer;
+	}
+	
+	
+	public void setParameters(Map params) throws GeoprocessException {
+		Boolean firstLayerSelection = (Boolean) params.get("firstlayerselection");
+		if (firstLayerSelection != null)
+			this.onlyFirstLayerSelection = 
+				firstLayerSelection.booleanValue();
+
+	}
+
+	public void checkPreconditions() throws GeoprocessException {
+		if (firstLayer == null)
+			throw new GeoprocessException("CLEAN: capa de entrada a null");
+		if (this.writer == null || this.schemaManager == null) {
+			throw new GeoprocessException(
+					"Operacion de CLEAN sin especificar capa de resultados");
+		}
+		try {
+			if(firstLayer.getSource().getShapeCount() == 0){
+				throw new GeoprocessException(
+				"Capa de entrada vacia");
+			}
+		} catch (DriverIOException e) {
+			throw new GeoprocessException(
+			"Error al verificar si la capa est� vac�a");
+		} 
+	}
+
+	public void process() throws GeoprocessException {
+		try {
+			createTask().run();
+		} catch (Exception e) {
+			throw new GeoprocessException("Error al ejecutar el geoproceso");
+		}
+	}
+
+	public ILayerDefinition createLayerDefinition() {
+		if (resultLayerDefinition == null) {
+			try {
+				resultLayerDefinition = DefinitionUtils.
+							createLayerDefinition(firstLayer);
+			} catch (Exception e) {
+				e.printStackTrace();
+			}
+		}
+		return resultLayerDefinition;
+	}
+	
+	
+	class LineCleanTask extends AbstractMonitorableTask implements IPipedTask{
+
+		private LineCleanTask() {
+			setInitialStep(0);
+			try {
+				if (onlyFirstLayerSelection) {
+					int numSelected = firstLayer.getRecordset().getSelection()
+							.cardinality();
+					setFinalStep(numSelected);
+				} else {
+					int numShapes = firstLayer.getSource().getShapeCount();
+					setFinalStep(numShapes);
+				}// else
+			} catch (com.iver.cit.gvsig.fmap.DriverException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (DriverIOException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+			setDeterminatedProcess(true);
+			setStatusMessage(PluginServices.getText(this,
+					"LineClean._Progress_Message"));
+
+		}
+	
+		/**
+		 * Verifies cancelation events, and return a boolean flag if processes must
+		 * be stopped for this cancelations events.
+		 * 
+		 * @param cancel
+		 * @param va
+		 * @param visitor
+		 * @return
+		 * @throws DriverIOException
+		 */
+		protected boolean verifyCancelation(ReadableVectorial va) {
+			if (isCanceled()) {
+				try {
+					va.stop();
+				} finally {
+					return true;
+				}
+			}
+			return false;
+		}
+		
+		
+		public void run() throws Exception {
+			processor =
+				new FeaturePersisterProcessor2(writer);
+			
+			intersectionsWriter = new ShpWriter();
+			String temp = System.getProperty("java.io.tmpdir") + 
+					"/intersections_" + 
+					System.currentTimeMillis() +
+					".shp";
+			File newFile = new File(temp);
+			((ShpWriter) intersectionsWriter).setFile(newFile);
+			
+			ILayerDefinition intersectDefinition = new SHPLayerDefinition();
+			intersectDefinition.setShapeType(XTypes.POINT);
+			FieldDescription[] intersectFields = new FieldDescription[2];
+			intersectFields[0] = new FieldDescription();
+			intersectFields[0].setFieldLength(10);
+			intersectFields[0].setFieldDecimalCount(0);
+			intersectFields[0].setFieldName("FID1");
+			intersectFields[0].setFieldType(XTypes.INTEGER);
+			intersectFields[1] = new FieldDescription();
+			intersectFields[1].setFieldLength(10);
+			intersectFields[1].setFieldDecimalCount(0);
+			intersectFields[1].setFieldName("FID2");
+			intersectFields[1].setFieldType(XTypes.INTEGER);
+			intersectDefinition.setFieldsDesc(intersectFields);
+			
+			((ShpWriter) intersectionsWriter).initialize(
+					(LayerDefinition) intersectDefinition);
+			((SHPLayerDefinition) intersectDefinition).setFile(newFile);
+			
+			ShpSchemaManager interSchMg = 
+				new ShpSchemaManager(newFile.getAbsolutePath());
+			interSchMg.createSchema(intersectDefinition);
+			
+			intersectsProcessor = new 
+				FeaturePersisterProcessor2(intersectionsWriter);
+			
+			FBitSet selection = null;
+			SnappingCoordinateMap coordMap = 
+				new SnappingCoordinateMap(LineCleanVisitor.DEFAULT_SNAP);
+			LineCleanVisitor visitor = 
+				new LineCleanVisitor(processor,
+						             intersectsProcessor,
+						onlyFirstLayerSelection, 
+						resultLayerDefinition,
+						intersectDefinition,
+						firstLayer,
+						firstLayer.getRecordset(), coordMap);
+			
+			try {
+				processor.start();
+				intersectsProcessor.start();
+				
+				ReadableVectorial va = firstLayer.getSource();
+				va.start();
+				for (int i = 0; i < va.getShapeCount(); i++) {// for each geometry
+					if (verifyCancelation(va)) {
+						intersectsProcessor.finish();
+						return;
+					}
+					if(selection != null){
+						if (selection.get(i)) {
+								reportStep();
+								visitor.visit(va.getShape(i), i);
+						}
+							
+					}else{
+						reportStep();
+						visitor.visit(va.getShape(i), i);
+					}
+				}// for
+				va.stop();
+				processor.finish();
+				intersectsProcessor.finish();
+				
+				
+			} catch (DriverIOException e) {
+				e.printStackTrace();
+			}
+		}
+
+		// TODO INTERNACIONALIZAR LOS MENSAJES
+		public String getNote() {
+			String cleaningText = PluginServices.getText(this, "Limpiando_lineas");
+			String of = PluginServices.getText(this, "de");
+			return cleaningText + " " + getCurrentStep() + " "
+					+ of + " " + getFinishStep();
+		}
+
+		public void cancel() {
+			setCanceled(true);
+			LineCleanGeoprocess.this.cancel();
+		}
+
+		/* (non-Javadoc)
+		 * @see com.iver.utiles.swing.threads.IPipedTask#getResult()
+		 */
+		public Object getResult() {
+			try {
+				return LineCleanGeoprocess.this.getResult();
+			} catch (GeoprocessException e) {
+				return null;
+			}
+		}
+
+		/* (non-Javadoc)
+		 * @see com.iver.utiles.swing.threads.IPipedTask#setEntry(java.lang.Object)
+		 */
+		public void setEntry(Object object) {
+			// TODO Auto-generated method stub
+			
+		}
+	}
+
+	
+	public IMonitorableTask createTask() {
+		return new LineCleanTask();
+	}
+	
+	
+	public FLayer getResult() throws GeoprocessException {
+		
+		FLyrVect cleanedLayer = (FLyrVect) createLayerFrom(this.writer);
+		FLyrVect pseudoNodes = (FLyrVect) createLayerFrom(this.intersectionsWriter);
+		try {
+			if(pseudoNodes.getSource().getShapeCount() == 0){
+				return cleanedLayer;
+			}else{
+				MapContext map = ((View)PluginServices.
+						getMDIManager().
+						getActiveWindow()).
+						getModel().
+						getMapContext();
+				FLayers solution = new FLayers(map, null);
+				solution.setName(this.firstLayer.getName()+"_cleaned");
+				solution.addLayer(cleanedLayer);
+				solution.addLayer(pseudoNodes);
+				return solution;
+			}
+		} catch (DriverIOException e) {
+			throw new GeoprocessException("Error de lectura de datos");
+		}
+		
+		
+		
+			
+	}
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/fmap/LineCleanGeoprocess.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/gui/LineCleanGeoprocessPanel.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/gui/LineCleanGeoprocessPanel.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/gui/LineCleanGeoprocessPanel.java	(revision 12191)
@@ -0,0 +1,80 @@
+/*
+ * Created on 10-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.2  2006-10-17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/10 18:50:17  azabala
+* First version in CVS
+*
+*
+*/
+package com.iver.cit.gvsig.topology.lineclean.gui;
+
+import java.awt.event.ItemEvent;
+
+import com.iver.andami.PluginServices;
+import com.iver.cit.gvsig.fmap.layers.FLayers;
+import com.iver.cit.gvsig.geoprocess.core.gui.AbstractGeoprocessGridbagPanel;
+
+public class LineCleanGeoprocessPanel extends AbstractGeoprocessGridbagPanel {
+
+	public LineCleanGeoprocessPanel(FLayers arg0) {
+		super(arg0, PluginServices.getText(null, "Clean_de_lineas"));
+		// TODO Auto-generated constructor stub
+	}
+
+	protected void addSpecificDesign() {
+		initSelectedItemsJCheckBox();
+		updateNumSelectedFeaturesLabel();
+	}
+
+	protected void processLayerComboBoxStateChange(ItemEvent arg0) {
+	}
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/gui/LineCleanGeoprocessPanel.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/LineCleanGeoprocessController.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/LineCleanGeoprocessController.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/LineCleanGeoprocessController.java	(revision 12191)
@@ -0,0 +1,178 @@
+/*
+ * Created on 10-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.3  2006-10-23 16:52:39  azabala
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/17 18:25:53  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/10 18:50:17  azabala
+* First version in CVS
+*
+*
+*/
+package com.iver.cit.gvsig.topology.lineclean;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.util.HashMap;
+
+import com.iver.andami.PluginServices;
+import com.iver.cit.gvsig.fmap.drivers.SHPLayerDefinition;
+import com.iver.cit.gvsig.fmap.edition.IWriter;
+import com.iver.cit.gvsig.fmap.edition.ShpSchemaManager;
+import com.iver.cit.gvsig.fmap.layers.FLayers;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.geoprocess.core.fmap.AbstractGeoprocessController;
+import com.iver.cit.gvsig.geoprocess.core.fmap.GeoprocessException;
+import com.iver.cit.gvsig.geoprocess.core.fmap.IGeoprocess;
+import com.iver.cit.gvsig.geoprocess.core.gui.AddResultLayerTask;
+import com.iver.cit.gvsig.geoprocess.core.gui.IGeoprocessPanel;
+import com.iver.cit.gvsig.topology.lineclean.fmap.LineCleanGeoprocess;
+import com.iver.cit.gvsig.topology.lineclean.gui.LineCleanGeoprocessPanel;
+import com.iver.utiles.swing.threads.IMonitorableTask;
+import com.iver.utiles.swing.threads.MonitorableDecoratorMainFirst;
+
+public class LineCleanGeoprocessController extends AbstractGeoprocessController {
+
+	private LineCleanGeoprocessPanel panel;
+	private LineCleanGeoprocess geoprocess;
+	
+	public void setView(IGeoprocessPanel viewPanel) {
+		this.panel =  
+			(LineCleanGeoprocessPanel) viewPanel;
+	}
+	public IGeoprocess getGeoprocess() {
+		return geoprocess;
+	}
+
+	public boolean launchGeoprocess() {
+		
+		
+		/*
+		 * TODO
+		 * METER TODO ESTO EN LA CLASE ABSTRACTA
+		 * */
+		FLyrVect inputLayer = panel.getInputLayer();
+		FLayers layers = panel.getFLayers();
+		File outputFile = null;
+		try {
+			outputFile = panel.getOutputFile();
+		} catch (FileNotFoundException e3) {
+			String error = PluginServices.getText(this, "Error_entrada_datos");
+			String errorDescription = PluginServices.getText(this, "Error_seleccionar_resultado");
+			panel.error(errorDescription, error);
+			return false;
+		}
+		if (outputFile == null || (outputFile.getAbsolutePath().length() == 0)) {
+			String error = PluginServices.getText(this, "Error_entrada_datos");
+			String errorDescription = PluginServices.getText(this, "Error_seleccionar_resultado");
+			panel.error(errorDescription, error);
+			return false;
+		}
+		if (outputFile.exists()) {
+			if (!panel.askForOverwriteOutputFile(outputFile)) {
+				return false;
+			}
+		}
+		
+		
+		
+		
+		geoprocess = new LineCleanGeoprocess(inputLayer);
+
+		SHPLayerDefinition definition = (SHPLayerDefinition) geoprocess
+				.createLayerDefinition();
+		definition.setFile(outputFile);
+		ShpSchemaManager schemaManager = new ShpSchemaManager(outputFile.getAbsolutePath());
+		IWriter writer = null;
+		try {
+			writer = getShpWriter(definition);
+		} catch (Exception e1) {
+			String error = PluginServices.getText(this, "Error_escritura_resultados");
+			String errorDescription = PluginServices.getText(this, "Error_preparar_escritura_resultados");
+			panel.error(errorDescription, error);
+			return false;
+		} 
+		geoprocess.setResultLayerProperties(writer, schemaManager);
+		HashMap params = new HashMap();
+		boolean onlySelected = panel.isFirstOnlySelected();
+		params.put("layer_selection", new Boolean(onlySelected));
+		try {
+			geoprocess.setParameters(params);
+			geoprocess.checkPreconditions();
+			IMonitorableTask task1 = geoprocess.createTask();
+			if(task1 == null){
+				return false;
+				
+			}
+			AddResultLayerTask task2 = new AddResultLayerTask(geoprocess);
+			task2.setLayers(layers);
+			MonitorableDecoratorMainFirst globalTask = new MonitorableDecoratorMainFirst(task1,
+					task2);
+			if (globalTask.preprocess())
+				PluginServices.cancelableBackgroundExecution(globalTask);
+			
+		} catch (GeoprocessException e) {
+			String error = PluginServices.getText(this, "Error_ejecucion");
+			String errorDescription = PluginServices.getText(this, "Error_fallo_geoproceso");
+			panel.error(errorDescription, error);
+			return false;
+		}
+		return true;
+	}
+	public int getWidth() {
+		return 700;
+	}
+	public int getHeight() {
+		return 600;
+	}
+
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/LineCleanGeoprocessController.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/resources/description_en.html
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/resources/description_en.html	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/resources/description_en.html	(revision 12191)
@@ -0,0 +1,24 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
+	<TITLE>Clean</TITLE>
+</HEAD>
+<BODY DIR="LTR">
+<P><FONT COLOR="#800000"><B>Clean</B></FONT>
+</P>
+<P>This geoprocess forces the input layer to have a correct line topology.
+</P>
+<P>
+"Correct line topology" means this layer cant have pseudonodes (their line geometries
+only could intersect in nodes, extreme points).
+</P>
+<P>
+<IMG SRC="cleandesc.png" NAME="Imagen1" ALIGN=LEFT BORDER=0>
+</P>
+<P>
+When this geoprocess founds a pseudonode, it breaks the intersecting lines
+and creates four new lines which intersects in an extreme point.
+</P>
+</BODY>
+</HTML>
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/resources/description_en.html
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/resources/description_es.html
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/resources/description_es.html	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/resources/description_es.html	(revision 12191)
@@ -0,0 +1,27 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
+<HTML>
+<HEAD>
+	<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
+	<TITLE>Clean</TITLE>
+</HEAD>
+<BODY LANG="es-ES" DIR="LTR">
+<P><FONT COLOR="#800000"><B>Clean</B></FONT>
+</P>
+<P>Este geoproceso corrige topol�gicamente las geometr�as de una capa de l�neas,
+de forma que esta capa pase a tener una topolog�a de l�neas correcta.
+</P>
+<P>
+Por "topolog�a correcta de l�neas", entendemos que las geometr�as lineales de
+esta capa no se autointersecten, y que solamente intersecten con otras geometr�as
+de l�neas por sus puntos extremos (nodos).
+</P>
+<P>
+<IMG SRC="cleandesc.png" NAME="Imagen1" ALIGN=LEFT BORDER=0>
+</P>
+<P>
+Si durante la ejecuci�n del mismo se detecta que dos l�neas intersectan en un
+punto que no es nodo (pseudonodo), se fragmentar� estas geometr�as originando
+cuatro nuevas l�neas que s� intersectar�n en sus extremos.
+</P>
+</BODY>
+</HTML>
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/resources/description_es.html
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/resources/cleandesc.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/resources/cleandesc.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/RegisterGeoprocessPlugin.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/RegisterGeoprocessPlugin.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/RegisterGeoprocessPlugin.java	(revision 12191)
@@ -0,0 +1,81 @@
+/*
+ * Created on 16-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-10-17 18:25:53  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.topology.lineclean;
+
+import com.iver.andami.plugins.Extension;
+import com.iver.utiles.extensionPoints.ExtensionPoints;
+import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
+
+public class RegisterGeoprocessPlugin extends Extension{
+
+	public void initialize() {
+		ExtensionPoints extensionPoints = 
+			ExtensionPointsSingleton.getInstance();
+		extensionPoints.add("GeoprocessManager",
+				"LINECLEAN", 
+				LineCleanGeoprocessPlugin.class);
+	}
+
+	public void execute(String actionCommand) {
+	}
+
+	public boolean isEnabled() {
+		return true;
+	}
+
+	public boolean isVisible() {
+		return true;
+	}
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/topology/lineclean/RegisterGeoprocessPlugin.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/util/GvSession.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/util/GvSession.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/util/GvSession.java	(revision 12191)
@@ -0,0 +1,108 @@
+/*
+ * Created on 06-nov-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.2  2006-11-09 13:30:40  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/11/07 19:50:54  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.util;
+
+import java.util.Map;
+
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.vividsolutions.jump.util.Blackboard;
+
+
+/**
+ * 
+ * Prototype of user's session.
+ * 
+ * This class will save information of the
+ * user session, to recover later.
+ * 
+ * The key of the session will be the Andami's view
+ * (to allows a user to save different user sessions
+ * for different views)
+ * */
+
+public class GvSession {
+	private final static GvSession session = new GvSession();
+	
+	Blackboard blackboard = new Blackboard();
+	
+	private GvSession(){}
+	
+	public static GvSession getInstance(){
+		return session;
+	}
+	
+	public void put(MapControl map, String key, Object sessionObject){
+		String gKey = map.toString() + ":" + key;
+		blackboard.put(gKey, sessionObject );
+	}
+	
+	public Object get(MapControl map, String key){
+		return blackboard.get(map.toString() + ":" + key);
+	}
+	
+	public void delete(MapControl map, String key){
+		Map props = blackboard.getProperties();
+		String newKey = map.toString()+":"+key;
+		if(props.containsKey(newKey))
+		{
+			props.remove(newKey);
+		}
+		
+	}
+	
+	
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/util/GvSession.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/util/SnappingCoordinateMap.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/util/SnappingCoordinateMap.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/util/SnappingCoordinateMap.java	(revision 12191)
@@ -0,0 +1,172 @@
+/*
+ * Created on 09-nov-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.2  2006-11-13 20:41:08  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.1  2006/11/09 21:08:32  azabala
+ * *** empty log message ***
+ *
+ *
+ */
+package com.iver.cit.gvsig.util;
+
+import java.util.Comparator;
+import java.util.Hashtable;
+
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geomgraph.Node;
+
+public class SnappingCoordinateMap extends Hashtable {
+	class SnapCoordinate extends Coordinate {
+		public SnapCoordinate(Coordinate arg0) {
+			super(arg0);
+		}
+
+		public boolean equals(Object obj) {
+			if(! (obj instanceof SnapCoordinate))
+				return false;
+			SnapCoordinate other = (SnapCoordinate) obj;
+			return other.distance(this) <= snapTolerance;
+		}
+
+		public int hashCode() {
+			 int result = 17;
+			 double xs = simplify(x);
+			 double ys = simplify(y);
+			 result = 37 * result + hashCode(xs);
+			 result = 37 * result + hashCode(ys);
+			 return result;
+				
+//			return 1; // esto no es eficiente
+		}
+		
+		public double simplify(double coordinate){
+			if(scaleFactor == 0d)
+				return coordinate;
+			return Math.round(coordinate * scaleFactor) / scaleFactor;
+		}
+	}
+	
+	
+
+	private double snapTolerance;
+	private double scaleFactor;
+
+	public SnappingCoordinateMap(double snapTolerance) {
+		super();
+		this.snapTolerance = snapTolerance;
+		if(snapTolerance != 0d)
+			this.scaleFactor = 1d / snapTolerance;
+	}
+
+	class MinDistCoordComparator implements Comparator {
+		Coordinate coord;
+
+		MinDistCoordComparator(Coordinate coord) {
+			this.coord = coord;
+		}
+
+		public int compare(Object arg0, Object arg1) {
+			Coordinate c1 = ((Node) arg0).getCoordinate();
+			Coordinate c2 = ((Node) arg1).getCoordinate();
+
+			double d1 = c1.distance(coord);
+			double d2 = c2.distance(coord);
+
+			if (d1 < d2)
+				return 1;
+			if (d1 > d2)
+				return -1;
+			else
+				return 0;
+		}
+	}
+	
+	
+	public Object put(Object key, Object obj){
+		if(! (key instanceof Coordinate) )
+			return null;
+		return super.put(new SnapCoordinate((Coordinate)key),
+				obj);
+	}
+	
+	public Object get(Object key){
+		if(! (key instanceof Coordinate) )
+			return null;
+		return super.get(new SnapCoordinate((Coordinate)key));
+	}
+	
+	public boolean containsKey(Object key){
+		if(! (key instanceof Coordinate) )
+			return false;
+		return super.containsKey(new SnapCoordinate((Coordinate)key));
+	}
+	
+	public static void main(String[] args){
+		SnappingCoordinateMap map = 
+			new SnappingCoordinateMap(0.1);
+		Coordinate c0 = new Coordinate(0, 0);
+		Coordinate c1 = new Coordinate(0.01, 0.01);
+		Coordinate c2 = new Coordinate(0.31, 0.41);
+		Coordinate c3 = new Coordinate(0.29, 0.39);
+		Coordinate c4 = new Coordinate(0.299, 0.411);
+		map.put(c0, c0);
+		map.put(c1, c1);
+		map.put(c2, c2);
+		map.put(c3, c3);
+		map.put(c4, c4);
+		System.out.println(map.size());
+		java.util.Set values = map.entrySet();
+		System.out.println(values.size());
+		
+		
+		
+		
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/util/SnappingCoordinateMap.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/package.html
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/package.html	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/package.html	(revision 12191)
@@ -0,0 +1 @@
+este package debe de estar en appgvSIG
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/package.html
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolEditor.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolEditor.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolEditor.java	(revision 12191)
@@ -0,0 +1,427 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.10  2006-11-13 09:15:23  jaume
+* javadoc and some clean-up
+*
+* Revision 1.9  2006/11/06 17:08:45  jaume
+* *** empty log message ***
+*
+* Revision 1.8  2006/11/06 16:06:52  jaume
+* *** empty log message ***
+*
+* Revision 1.7  2006/11/06 07:33:54  jaume
+* javadoc, source style
+*
+* Revision 1.6  2006/11/02 17:19:28  jaume
+* *** empty log message ***
+*
+* Revision 1.5  2006/10/31 16:16:34  jaume
+* *** empty log message ***
+*
+* Revision 1.4  2006/10/30 19:30:35  jaume
+* *** empty log message ***
+*
+* Revision 1.3  2006/10/29 23:53:49  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/27 12:41:09  jaume
+* GUI
+*
+* Revision 1.1  2006/10/26 16:31:21  jaume
+* GUI
+*
+*
+*/
+package com.iver.cit.gvsig.gvsig.gui.styling;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.TreeSet;
+
+import javax.swing.BorderFactory;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+
+import org.gvsig.gui.beans.AcceptCancelPanel;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.andami.ui.mdiManager.WindowInfo;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.utiles.XMLEntity;
+
+/**
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ *
+ */
+public class SymbolEditor extends JPanel implements IWindow {
+
+    private WindowInfo wi;
+    private JPanel pnlWest = null;
+    private JPanel pnlCenter = null;
+    private JPanel pnlPreview = null;
+    private JPanel pnlLayers = null;
+    private AcceptCancelPanel okCancelPanel;
+    private ISymbol symbol;
+    private SymbolPreview symbolPreview = null;
+    private JPanel pnlTypeAndUnits = null;
+    private JComboBox cmbType;
+    private JComboBox cmbUnits;
+    private JTabbedPane tabbedPane = null;
+    private int shapeType;
+    private XMLEntity oldSymbolProperties;
+    private ActionListener cmbTypeActionListener;
+
+    private AbstractTypeSymbolEditorPanel[] tabs;
+	private SymbolLayerManager layerManager;
+
+
+    public SymbolEditor(ISymbol symbol, int shapeType) {
+    	this.symbol = symbol;
+        this.oldSymbolProperties = symbol.getXMLEntity();
+        this.shapeType = shapeType;
+        initialize();
+    }
+
+
+    /**
+     * This method initializes this
+     *
+     */
+    private void initialize() {
+
+    	cmbTypeActionListener = new ActionListener() {
+    		int prevIndex = -2;
+    		public void actionPerformed(ActionEvent e) {
+    			int index = getCmbType().getSelectedIndex();
+    			if (prevIndex != index) {
+    				// needs to refresh
+    				prevIndex = index;
+
+    				if (tabbedPane != null)
+    					getPnlCenter().remove(tabbedPane);
+    				AbstractTypeSymbolEditorPanel options =
+    					(AbstractTypeSymbolEditorPanel) getCmbType().getSelectedItem();
+    				options.refreshControls(getSelectedLayerIndex());
+    				JPanel[] tabs = options.getTabs();
+    				tabbedPane = new JTabbedPane();
+    				tabbedPane.setPreferredSize(new Dimension(300, 300));
+    				for (int i = 0; i < tabs.length; i++) {
+    					tabbedPane.addTab(tabs[i].getName(), tabs[i]);
+    				}
+    				getPnlCenter().add(tabbedPane, BorderLayout.CENTER);
+    				getPnlCenter().doLayout();
+    			}
+    		}
+    	};
+
+    	Comparator tabComparator = new Comparator() {
+			public int compare(Object o1, Object o2) {
+				if (! (o1 instanceof AbstractTypeSymbolEditorPanel
+					|| o1 instanceof AbstractTypeSymbolEditorPanel))
+					throw new IllegalArgumentException(PluginServices.getText(this, "trying_to_add_a_non_TypeSymbolEditor_panel"));
+				AbstractTypeSymbolEditorPanel pnl1 = (AbstractTypeSymbolEditorPanel) o1,
+				pnl2 = (AbstractTypeSymbolEditorPanel) o2;
+				int result = pnl1.getName().compareTo(pnl2.getName());
+				if (result == 0)
+					throw new IllegalArgumentException(PluginServices.getText(this, "two_panels_with_the_same_name"));
+				return result;
+			}
+		};
+		TreeSet set = new TreeSet(tabComparator);
+
+    	if (shapeType == FShape.POLYGON)
+    	{
+    		// Polygon options
+
+        	// add here your options for polygon symbols
+        	set.add(new SimpleFill(SymbolEditor.this));
+        	set.add(new MarkerFill(SymbolEditor.this));
+        }
+        else if (shapeType == FShape.POINT)
+        {
+        	// Point options
+
+        	// add here your options for point symbol
+        	set.add(new CharacterMarker(SymbolEditor.this));
+        }
+    	tabs = (AbstractTypeSymbolEditorPanel[]) set.toArray(new AbstractTypeSymbolEditorPanel[0]);
+
+        this.setLayout(new BorderLayout());
+        this.add(getPnlWest(), BorderLayout.WEST);
+        this.add(getPnlCenter(), BorderLayout.CENTER);
+        this.add(getOkCancelPanel(), BorderLayout.SOUTH);
+
+
+        cmbTypeActionListener.actionPerformed(null);
+        refresh();
+    }
+
+    private AcceptCancelPanel getOkCancelPanel() {
+        if (okCancelPanel == null) {
+            ActionListener action = new ActionListener() {
+                public void actionPerformed(ActionEvent e) {
+                    if ("CANCEL".equals(e.getActionCommand())) {
+                        symbol = null;
+                    }
+                    PluginServices.getMDIManager().closeWindow(SymbolEditor.this);
+                }
+            };
+            okCancelPanel = new AcceptCancelPanel(action, action);
+        }
+        return okCancelPanel;
+    }
+
+
+    public WindowInfo getWindowInfo() {
+        if (wi == null) {
+            wi = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
+            wi.setWidth(600);
+            wi.setHeight(400);
+            wi.setTitle(PluginServices.getText(this, "symbol_property_editor"));
+        }
+        return wi;
+    }
+
+    public ISymbol getSymbol() {
+        return symbol;
+    }
+    /**
+     * This method initializes pnlWest
+     *
+     * @return javax.swing.JPanel
+     */
+    private JPanel getPnlWest() {
+        if (pnlWest == null) {
+            pnlWest = new JPanel();
+            pnlWest.setLayout(new BorderLayout());
+            pnlWest.add(getPnlPreview(), java.awt.BorderLayout.NORTH);
+            pnlWest.add(getPnlLayers(), java.awt.BorderLayout.SOUTH);
+        }
+        return pnlWest;
+    }
+    /**
+     * This method initializes pnlCenter
+     *
+     * @return javax.swing.JPanel
+     */
+    private JPanel getPnlCenter() {
+        if (pnlCenter == null) {
+            pnlCenter = new JPanel(new BorderLayout());
+            pnlCenter.setBorder(BorderFactory.
+                    createTitledBorder(null,
+                            PluginServices.getText(this, "properties")));
+            pnlCenter.add(getPnlTypeAndUnits(), java.awt.BorderLayout.NORTH);
+        }
+        return pnlCenter;
+    }
+    /**
+     * This method initializes pnlPreview
+     *
+     * @return javax.swing.JPanel
+     */
+    private JPanel getPnlPreview() {
+        if (pnlPreview == null) {
+            pnlPreview = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
+            pnlPreview.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "preview")));
+            pnlPreview.add(getSymbolPreview());
+        }
+        return pnlPreview;
+    }
+    /**
+     * This method initializes pnlLayers
+     *
+     * @return javax.swing.JPanel
+     */
+    private JPanel getPnlLayers() {
+        if (pnlLayers == null) {
+            pnlLayers = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
+            pnlLayers.setBorder(
+            		BorderFactory.createTitledBorder(
+            				null, PluginServices.getText(this, "layers")));
+            pnlLayers.add(getLayerManager());
+        }
+        return pnlLayers;
+    }
+
+
+    private SymbolLayerManager getLayerManager() {
+    	if (layerManager == null) {
+    		layerManager = new SymbolLayerManager(this);
+    	}
+    	return layerManager;
+    }
+
+
+	/**
+     * This method initializes symbolPreview
+     *
+     * @return com.iver.cit.gvsig.gvsig.gui.styling.SymbolPreview
+     */
+    private SymbolPreview getSymbolPreview() {
+        if (symbolPreview == null) {
+            symbolPreview = new SymbolPreview();
+            symbolPreview.setPreferredSize(new Dimension(120, 100));
+
+        }
+        return symbolPreview;
+    }
+
+
+
+    /**
+     * This method initializes pnlTypeAndUnits
+     *
+     * @return javax.swing.JPanel
+     */
+    private JPanel getPnlTypeAndUnits() {
+        if (pnlTypeAndUnits == null) {
+            pnlTypeAndUnits = new JPanel();
+            pnlTypeAndUnits.setLayout(new BorderLayout());
+            JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING));
+            aux.add(new JLabel(PluginServices.getText(this, "type")));
+            aux.add(getCmbType());
+            pnlTypeAndUnits.add(aux, BorderLayout.WEST);
+
+            aux =  new JPanel(new FlowLayout(FlowLayout.LEADING));
+            aux.add(new JLabel(PluginServices.getText(this, "units")));
+            aux.add(getCmbUnits());
+            pnlTypeAndUnits.add(aux, BorderLayout.EAST);
+
+        }
+        return pnlTypeAndUnits;
+    }
+
+    private JComboBox getCmbUnits() {
+        if (cmbUnits == null) {
+            cmbUnits = new JComboBox(new String[] {"unidad1", "unidad2"});
+        }
+        return cmbUnits;
+    }
+
+    private JComboBox getCmbType() {
+        if (cmbType == null) {
+            cmbType = new JComboBox(tabs);
+            cmbType.addActionListener(cmbTypeActionListener);
+        }
+        return cmbType;
+    }
+
+    protected void changeSymbolProperties(XMLEntity newXMLEntity) {
+    	XMLEntity symXML = symbol.getXMLEntity();
+    	for (int i = 0; i < newXMLEntity.getPropertyCount(); i++) {
+			String pName = newXMLEntity.getPropertyName(i);
+			symXML.putProperty(pName, newXMLEntity.getStringProperty(pName));
+		}
+		refresh();
+	}
+
+	protected void setLayerToSymbol(int layerIndex, XMLEntity layerXML) {
+    	XMLEntity symXML = symbol.getXMLEntity();
+    	ArrayList layers = new ArrayList();
+    	for (int i = 0; i < symXML.getChildrenCount(); i++) {
+			layers.add(symXML.getChild(i));
+		}
+    	layers.add(layerIndex, layerXML);
+    	symXML.removeAllChildren();
+    	for (int i = 0; i < layers.size(); i++) {
+    		symXML.addChild((XMLEntity) layers.get(i));
+		}
+    	symbol.setXMLEntity(symXML);
+    	refresh();
+    }
+
+    protected void removeAllLayersFromSymbol() {
+    	symbol.getXMLEntity().removeAllChildren();
+    	refresh();
+    }
+
+    public void refresh() {
+    	getSymbolPreview().setSymbol(symbol);
+    	doLayout();
+	}
+
+	public int getSelectedLayerIndex() {
+		int index =getLayerManager().getSelectedLayerIndex();
+		if (index == -1)
+			return 0;
+		return index;
+	}
+
+	/**
+	 * <p>
+	 * Returns the type of the symbol that this panels is created for.<br>
+	 * </p>
+	 * <p>
+	 * Possible values returned by this method are
+	 *   <ol>
+	 *     <li> <b> FShape.POINT </b>, for maker symbols </li>
+	 *     <li> <b> FShape.POLYGON </b>, for fill symbols </li>
+	 *     <li> <b> FShape.LINE </b>, for line symbols (not yet implemented) </li>
+	 *     <li> <b> FShape.TEXT </b>, for text symbols (not yet implemented) </li>
+	 *     <li> maybe some other in the future </li>
+	 *   </ol>
+	 * </p>
+	 * @return
+	 */
+	public int getShapeType() {
+		return shapeType;
+	}
+
+	public Class getNewSymbolClass() {
+		return ((AbstractTypeSymbolEditorPanel) getCmbType()
+					.getSelectedItem()).getSymbolClass();
+	}
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolEditor.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolLayerManager.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolLayerManager.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolLayerManager.java	(revision 12191)
@@ -0,0 +1,464 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.6  2006-11-08 10:56:47  jaume
+* *** empty log message ***
+*
+* Revision 1.5  2006/11/07 08:52:30  jaume
+* *** empty log message ***
+*
+* Revision 1.4  2006/11/06 17:08:45  jaume
+* *** empty log message ***
+*
+* Revision 1.3  2006/11/06 16:06:52  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/11/06 07:33:54  jaume
+* javadoc, source style
+*
+* Revision 1.1  2006/11/02 17:19:28  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.gvsig.gui.styling;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.LayoutManager;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.MouseAdapter;
+import java.awt.event.MouseEvent;
+import java.util.ArrayList;
+
+import javax.swing.AbstractListModel;
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListCellRenderer;
+import javax.swing.ImageIcon;
+import javax.swing.JList;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.event.ListDataListener;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+
+import org.gvsig.gui.beans.swing.JButton;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.messages.NotificationManager;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.cit.gvsig.fmap.core.symbols.CharacterMarkerSymbol;
+import com.iver.cit.gvsig.fmap.core.symbols.SymbolFactory;
+import com.iver.utiles.XMLEntity;
+
+/**
+ * A component linked to a SymbolEditor that shows the layers
+ *
+ * @author jaume
+ *
+ */
+public class SymbolLayerManager extends JPanel implements ActionListener{
+    private SymbolEditor owner;
+    private JList jListLayers;
+    private ISymbol activeLayer;
+    private ISymbol symbol;
+    private JButton btnAddLayer = null;
+    private JPanel pnlButtons = null;
+    private JButton btnRemoveLayer = null;
+    private JButton btnMoveUpLayer = null;
+    private JButton btnMoveDownLayer = null;
+    private final Dimension btnDimension = new Dimension(24, 24);
+    private JScrollPane scroll;
+    private Color cellSelectedBGColor = Color.BLUE;
+
+
+    public SymbolLayerManager(SymbolEditor owner) {
+        this.owner = owner;
+        this.symbol = owner.getSymbol();
+        initialize();
+    }
+
+    private void initialize() {
+        this.setLayout(new BorderLayout());
+        this.setSize(new java.awt.Dimension(155,106));
+        this.add(getJScrollPane(), java.awt.BorderLayout.CENTER);
+        this.add(getPnlButtons(), java.awt.BorderLayout.SOUTH);
+    }
+
+    private JScrollPane getJScrollPane() {
+        if (scroll ==  null) {
+            scroll = new JScrollPane();
+            scroll.setViewportView(getJListLayers());
+            scroll.setPreferredSize(new Dimension(120, 160));
+        }
+        return scroll;
+    }
+
+    /**
+     * This method initializes jList
+     *
+     * @return javax.swing.JList
+     */
+    private JList getJListLayers() {
+        if (jListLayers == null) {
+            jListLayers = new JList();
+            jListLayers.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
+            jListLayers.setLayoutOrientation(JList.HORIZONTAL_WRAP);
+
+            jListLayers.setVisibleRowCount(-1);
+            jListLayers.addListSelectionListener(new ListSelectionListener() {
+                public void valueChanged(ListSelectionEvent e) {
+                    setLayer((ISymbol) jListLayers.getSelectedValue());
+                }
+            });
+            jListLayers.setModel(new SymbolLayerListModel(symbol));
+            jListLayers.setCellRenderer(new DefaultListCellRenderer() {
+
+                public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+                    return getListCell(list, value, index, isSelected, cellHasFocus);
+                }
+
+            });
+
+            jListLayers.addMouseListener(new MouseAdapter() {
+				public void mouseClicked(MouseEvent e) {
+					if (e.getClickCount() == 2 && e.getButton() == MouseEvent.BUTTON1) {
+						SymbolSelector symSel = new SymbolSelector(activeLayer, owner.getShapeType());
+						PluginServices.getMDIManager().addWindow(symSel);
+						updateSymbol(symSel.getSymbol());
+						setLayer(symSel.getSymbol());
+					}
+
+				}
+            });
+        }
+        return jListLayers;
+    }
+
+    public Component getListCell(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+    	ISymbol sym = (ISymbol) value;
+        JPanel pnl = new JPanel();
+        LayoutManager layout = new FlowLayout(FlowLayout.LEFT, 3, 3);
+        pnl.setLayout(layout);
+        Color bgColor = (isSelected) ? cellSelectedBGColor
+                 : Color.WHITE;
+        pnl.setBackground(bgColor);
+        SymbolPreview sp = new SymbolPreview();
+        sp.setBorder(BorderFactory.createLineBorder(Color.BLACK));
+        sp.setAlignmentX(Component.LEFT_ALIGNMENT);
+        sp.setPreferredSize(new Dimension(80, 30));
+        sp.setSize(new Dimension(80, 30));
+        sp.setSymbol(sym);
+        sp.setBackground(Color.WHITE);
+        pnl.add(sp);
+
+        XMLEntity xml = sym.getXMLEntity();
+        String source;
+        if (xml.contains("locked"))
+            source = xml.getBooleanProperty("locked") ?
+                    "images/locked.png" :
+                    "images/unlocked.png";
+         else
+            source = "images/unlocked.png";
+
+        ImageIcon icon = new ImageIcon(getClass().
+                getClassLoader().getResource(source));
+        JButton btnLock = new JButton(icon);
+        btnLock.setSize(btnDimension);
+        btnLock.setPreferredSize(btnDimension);
+        btnLock.setActionCommand("LOCK");
+        btnLock.setBackground(bgColor);
+        btnLock.setAlignmentX(Component.CENTER_ALIGNMENT);
+        pnl.add(btnLock);
+        pnl.setPreferredSize(new Dimension(150,37));
+        return pnl;
+    }
+
+    /**
+     * replaces current selected layer with this symbol
+     * @param layer
+     */
+    private void updateSymbol(ISymbol layer) {
+    	if (layer != null) {
+    		int index = getJListLayers().getSelectedIndex();
+    		XMLEntity xml = symbol.getXMLEntity();
+    		ArrayList layers = new ArrayList() ;
+    		for (int i = 0; i < xml.getChildrenCount(); i++) {
+    			if (i == index) {
+    				layers.add(layer.getXMLEntity());
+    			} else {
+    				layers.add(xml.getChild(i));
+    			}
+    		}
+    		xml.removeAllChildren();
+    		for (int i = 0; i < layers.size(); i++) {
+    			xml.addChild((XMLEntity) layers.get(i));
+    		}
+    		symbol.setXMLEntity(xml);
+    		owner.refresh();
+    		getJListLayers().repaint();
+    	}
+    }
+
+    private void setLayer(ISymbol symbol) {
+    	if (symbol!=null) {
+    		activeLayer = symbol;
+
+    	}
+    }
+
+    /**
+     * This method initializes jButton
+     *
+     * @return javax.swing.JButton
+     */
+    private JButton getBtnAddLayer() {
+        if (btnAddLayer == null) {
+            btnAddLayer = new JButton(new ImageIcon(getClass().
+                    getClassLoader().getResource("images/add-layer.png")));
+            btnAddLayer.setActionCommand("ADD");
+            btnAddLayer.setSize(btnDimension);
+            btnAddLayer.setPreferredSize(btnDimension);
+            btnAddLayer.addActionListener(this);
+        }
+        return btnAddLayer;
+    }
+
+    /**
+     * This method initializes pnlButtons
+     *
+     * @return javax.swing.JPanel
+     */
+    private JPanel getPnlButtons() {
+        if (pnlButtons == null) {
+            pnlButtons = new JPanel();
+            pnlButtons.add(getBtnAddLayer(), null);
+            pnlButtons.add(getBtnRemoveLayer(), null);
+            pnlButtons.add(getBtnMoveUpLayer(), null);
+            pnlButtons.add(getBtnMoveDown(), null);
+        }
+        return pnlButtons;
+    }
+
+    /**
+     * This method initializes jButton1
+     *
+     * @return javax.swing.JButton
+     */
+    private JButton getBtnRemoveLayer() {
+        if (btnRemoveLayer == null) {
+            btnRemoveLayer = new JButton(new ImageIcon(getClass().
+                    getClassLoader().getResource("images/delete.png")));
+            btnRemoveLayer.setActionCommand("REMOVE");
+            btnRemoveLayer.setSize(btnDimension);
+            btnRemoveLayer.setPreferredSize(btnDimension);
+            btnRemoveLayer.addActionListener(this);
+        }
+        return btnRemoveLayer;
+    }
+
+    /**
+     * This method initializes jButton2
+     *
+     * @return javax.swing.JButton
+     */
+    private JButton getBtnMoveUpLayer() {
+        if (btnMoveUpLayer == null) {
+            btnMoveUpLayer = new JButton(new ImageIcon(getClass().
+                    getClassLoader().getResource("images/up-arrow.png")));
+            btnMoveUpLayer.setActionCommand("MOVE_UP");
+            btnMoveUpLayer.setSize(btnDimension);
+            btnMoveUpLayer.setPreferredSize(btnDimension);
+            btnMoveUpLayer.addActionListener(this);
+        }
+        return btnMoveUpLayer;
+    }
+
+    /**
+     * This method initializes jButton3
+     *
+     * @return javax.swing.JButton
+     */
+    private JButton getBtnMoveDown() {
+        if (btnMoveDownLayer == null) {
+            btnMoveDownLayer = new JButton(new ImageIcon(getClass().
+                    getClassLoader().getResource("images/down-arrow.png")));
+            btnMoveDownLayer.setActionCommand("MOVE_DOWN");
+            btnMoveDownLayer.setSize(btnDimension);
+            btnMoveDownLayer.setPreferredSize(btnDimension);
+            btnMoveDownLayer.addActionListener(this);
+        }
+        return btnMoveDownLayer;
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        String command = e.getActionCommand();
+        XMLEntity xml = symbol.getXMLEntity();
+        int index = getJListLayers().getSelectedIndex();
+        if (command.equals("ADD")) {
+    		String className = null;
+    		ISymbol newLayer = null;
+        	try {
+
+        		Class symbolClass = owner.getNewSymbolClass();
+				className = symbolClass.getName();
+				newLayer = (ISymbol) symbolClass.newInstance();
+        	} catch (InstantiationException iE) {
+        		NotificationManager.
+        		addError("Trying to instantiate an interface" +
+        				" or abstract class '"+className+"'", iE);
+        		return;
+        	} catch (IllegalAccessException iaE) {
+        		NotificationManager.addError(null, iaE);
+        		return;
+        	}
+        	xml.addChild(newLayer.getXMLEntity());
+            index = xml.getChildrenCount()-1;
+        } else if (command.equals("REMOVE")) {
+        	int selectedIndex = getJListLayers().getSelectedIndex();
+        	if (selectedIndex == 0)
+        		return;
+        	try {
+        		xml.removeChild(selectedIndex-1);
+        	} catch (Exception ex) {
+        		// Index out of bounds or so, we don't care
+        	}
+        } else if (command.equals("MOVE_UP")) {
+            if (index>0) {
+                ArrayList layers = new ArrayList();
+                for (int i = 0; i < xml.getChildrenCount(); i++) {
+                    if (i == index)
+                        layers.add(i-1, xml.getChild(i));
+                    else
+                        layers.add(xml.getChild(i));
+                }
+                xml.removeAllChildren();
+                for (int i = 0; i < layers.size(); i++) {
+                    xml.addChild((XMLEntity) layers.get(i));
+                }
+                index --;
+            }
+        } else if (command.equals("MOVE_DOWN")) {
+            if (index < xml.getChildrenCount()-1) {
+                ArrayList layers = new ArrayList();
+                for (int i = 0; i < xml.getChildrenCount(); i++) {
+                    if (i == index) {
+                        layers.add(i, xml.getChild(i+1));
+                        layers.add(i+1, xml.getChild(i));
+                        i++;
+                    }
+                    else
+                        layers.add(xml.getChild(i));
+                }
+                xml.removeAllChildren();
+                for (int i = 0; i < layers.size(); i++) {
+                    xml.addChild((XMLEntity) layers.get(i));
+                }
+                index++;
+            }
+        } else if (command.equals("LOCK")) {
+            try {
+                XMLEntity layerXML = xml.getChild(index);
+                boolean locked = !xml.contains("locked") || !xml.getBooleanProperty("locked");
+                layerXML.putProperty("locked", locked);
+            } catch (Exception ex) {
+                // Index out of bounds or so, we don't care
+            }
+        }
+        symbol.setXMLEntity(xml);
+        getJListLayers().setSelectedIndex(index);
+        owner.refresh();
+        getJListLayers().repaint();
+    }
+
+    public int getSelectedLayerIndex() {
+        /*int i = getJListLayers().getSelectedIndex();
+        if (i==-1 && symbol.getXMLEntity().getChildrenCount()==0)
+            i = 0;
+        return i;*/
+        return getJListLayers().getSelectedIndex();
+    }
+}
+
+class SymbolLayerListModel extends AbstractListModel {
+
+    private ISymbol symbol;
+	private ArrayList listeners = new ArrayList();
+
+    public SymbolLayerListModel(ISymbol symbol) {
+        this.symbol = symbol;
+    }
+
+    public int getSize() {
+        return symbol.getXMLEntity().getChildrenCount()+1;
+    }
+
+    public Object getElementAt(int index) {
+    	XMLEntity xml = symbol.getXMLEntity();
+
+    	if (index == 0) {
+    		xml.removeAllChildren();
+    		return SymbolFactory.createFromXML(xml,
+    	        		PluginServices.getText(this, "layer")+0);
+    	}
+        return SymbolFactory.createFromXML(xml.getChild(index-1),
+        		PluginServices.getText(this, "layer")+index);
+    }
+
+    public void addListDataListener(ListDataListener l) {
+    	listeners.add(l);
+    }
+
+    public void removeListDataListener(ListDataListener l) {
+    	listeners.remove(l);
+    }
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolLayerManager.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/CharacterMarker.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/CharacterMarker.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/CharacterMarker.java	(revision 12191)
@@ -0,0 +1,107 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.3  2006-11-06 17:08:45  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/11/06 16:06:52  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/31 16:16:34  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.gvsig.gui.styling;
+
+import java.util.ArrayList;
+
+import javax.swing.JPanel;
+
+import com.iver.andami.PluginServices;
+import com.iver.utiles.XMLEntity;
+
+public class CharacterMarker extends AbstractTypeSymbolEditorPanel{
+
+	private ArrayList tabs = new ArrayList();
+
+	public CharacterMarker(SymbolEditor owner) {
+		super(owner);
+		initialize();
+	}
+
+	private void initialize() {
+		JPanel myTab;
+		{
+			myTab = new JPanel();
+			myTab.setName(PluginServices.getText(this, "character_marker"));
+			tabs.add(myTab);
+		}
+
+	}
+
+	public XMLEntity getXMLEntity() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	public String getName() {
+		return PluginServices.getText(this, "character_marker_symbol");
+	}
+
+	public JPanel[] getTabs() {
+		return (JPanel[]) tabs .toArray(new JPanel[0]);
+	}
+
+	public void refreshControls(int layerIndex) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Class getSymbolClass() {
+		return CharacterMarker.class;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/CharacterMarker.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/package.html
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/package.html	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/package.html	(revision 12191)
@@ -0,0 +1 @@
+este package debe de estar en appgvSIG
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/package.html
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SimpleFill.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SimpleFill.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SimpleFill.java	(revision 12191)
@@ -0,0 +1,135 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.4  2006-11-13 09:15:23  jaume
+* javadoc and some clean-up
+*
+* Revision 1.3  2006/11/06 16:06:52  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/30 19:30:35  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/27 12:41:09  jaume
+* GUI
+*
+*
+*/
+package com.iver.cit.gvsig.gvsig.gui.styling;
+
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.util.ArrayList;
+
+import javax.swing.JPanel;
+
+import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
+
+import com.iver.andami.PluginServices;
+import com.iver.cit.gvsig.gui.panels.ColorChooserPanel;
+import com.iver.utiles.XMLEntity;
+
+import de.ios.framework.swing.JDecimalField;
+
+public class SimpleFill extends AbstractTypeSymbolEditorPanel {
+	private static final String NAME = PluginServices.
+		getText(SimpleFill.class, "simple_fill");
+	private ColorChooserPanel jccFillColor;
+	private ColorChooserPanel jccOutlineColor;
+	private JDecimalField txtOutlineWidth;
+	private ArrayList tabs = new ArrayList();
+
+	public SimpleFill(SymbolEditor owner) {
+		super(owner);
+		initialize();
+	}
+
+	public String getName() {
+		return NAME;
+	}
+
+	public JPanel[] getTabs() {
+		return (JPanel[]) tabs.toArray(new JPanel[0]);
+	}
+
+	private void initialize() {
+		JPanel myTab = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,5));
+		myTab.setName(PluginServices.getText(this, "simple_fill"));
+		GridBagLayoutPanel aux = new GridBagLayoutPanel();
+		jccFillColor = new ColorChooserPanel();
+		jccFillColor.setAlpha(255);
+		// TODO restore previous color
+		aux.addComponent(PluginServices.getText(this, "fill_color")+":",
+			jccFillColor	);
+		jccOutlineColor = new ColorChooserPanel();
+		jccOutlineColor.setAlpha(255);
+		// TODO restore previous outline color
+		aux.addComponent(PluginServices.getText(this, "outline_color")+":",
+			jccOutlineColor	);
+		txtOutlineWidth = new JDecimalField(25);
+		// TODO restore previous outline width
+		aux.addComponent(PluginServices.getText(this, "outline_width")+":",
+			txtOutlineWidth );
+		aux.setPreferredSize(new Dimension(300, 300));
+		myTab.add(aux);
+
+		tabs.add(myTab);
+	}
+
+	public XMLEntity getXMLEntity() {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+	}
+
+	public void refreshControls(int layerIndex) {
+		// TODO Auto-generated method stub
+
+	}
+
+	public Class getSymbolClass() {
+		return SimpleFill.class;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SimpleFill.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/AbstractTypeSymbolEditorPanel.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/AbstractTypeSymbolEditorPanel.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/AbstractTypeSymbolEditorPanel.java	(revision 12191)
@@ -0,0 +1,150 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.6  2006-11-13 09:15:23  jaume
+* javadoc and some clean-up
+*
+* Revision 1.5  2006/11/06 16:06:52  jaume
+* *** empty log message ***
+*
+* Revision 1.4  2006/10/31 16:16:34  jaume
+* *** empty log message ***
+*
+* Revision 1.3  2006/10/30 19:30:35  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/29 23:53:49  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/27 12:41:09  jaume
+* GUI
+*
+*
+*/
+package com.iver.cit.gvsig.gvsig.gui.styling;
+
+import javax.swing.JPanel;
+
+import com.iver.utiles.XMLEntity;
+/**
+ * Abstract class that all the Symbol settings interface must extend.
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public abstract class AbstractTypeSymbolEditorPanel {
+
+	protected SymbolEditor owner;
+	protected int layerIndex = 0;
+
+	/**
+	 * Produces and returns an XMLEntity object describing the ISymbol according with
+	 * the user settings. This XMLEntity must be self-defining far enough to be directly
+	 * passed to the SymbolFactory.createFromXML() in order to produce correctly a new
+	 * ISymbol instance of the class of this panel's ISymbol denoted by the getSymbolClass()
+	 * method.
+	 * @return XMLEntity defining the ISymbol.
+	 * @see getSymbolClass() method
+	 */
+	public abstract XMLEntity getXMLEntity();
+
+	/**
+	 * Creates a new instance of this type symbol editor panel associated to
+	 * its parent SymbolEditor which will be notified of the changes in
+	 * order to keep the symbol preview in sync with the user settings.
+	 * @param owner, the SymbolEditor which created this.
+	 */
+	public AbstractTypeSymbolEditorPanel(SymbolEditor owner) {
+		this.owner = owner;
+	}
+
+	/**
+	 * <p>Returns the name of the config tabs that will be shown in the selector combo box.
+	 * This is typically a human-readable (and also translatable) name for the symbol that
+	 * this TypeEditorPanel deals with, but maybe you prefer to use any other one.<br>
+	 * </p>
+	 * <p>
+	 * The order of the entries in the combo is alphabetically-based. So you can force a
+	 * position by defining a name that suits your needs.
+	 * </p>
+	 * @return A human-readable text naming this panel
+	 */
+	public abstract String getName();
+
+	/**
+	 * <p>Due to the complexity that many symbols settings can reach, the SymbolEditorPanel is
+	 * designed in a tabbed-based fashion. So, you can use as many of pages you want to put
+	 * your components. This pages are regular JPanels that will be automatically added to
+	 * the SymbolEditor dialog.<br>
+	 * </p>
+	 * <p>
+	 * In case you need only one page, just return a JPanel array with a length of 1.
+	 * </p>
+	 * @return An array of JPanel containing the setting's interface.
+	 */
+	public abstract JPanel[] getTabs();
+
+	/**
+	 * Invoked when the user selects or adds a new layer. This method fills up
+	 * the components on the right according on the layer properties
+	 * @param <b>int</b> layerIndex
+	 */
+	public abstract void refreshControls(int layerIndex);
+
+	public final String toString() {
+		return getName();
+	}
+
+	protected final void fireSymbolChangedEvent() {
+		owner.setLayerToSymbol(owner.getSelectedLayerIndex(), getXMLEntity());
+		owner.refresh();
+	}
+
+	/**
+	 * Returns the symbol class that is handled by this configuration panel.
+	 * @return <b>Class</b> (of the concrete ISymbol that this configuration panel deals with)
+	 */
+	public abstract Class getSymbolClass();
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/AbstractTypeSymbolEditorPanel.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolSelectorListModel.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolSelectorListModel.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolSelectorListModel.java	(revision 12191)
@@ -0,0 +1,190 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.6  2006-11-06 16:06:52  jaume
+* *** empty log message ***
+*
+* Revision 1.5  2006/11/06 07:33:54  jaume
+* javadoc, source style
+*
+* Revision 1.4  2006/11/02 17:19:28  jaume
+* *** empty log message ***
+*
+* Revision 1.3  2006/10/30 19:30:35  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/26 16:31:21  jaume
+* GUI
+*
+* Revision 1.1  2006/10/25 10:50:41  jaume
+* movement of classes and gui stuff
+*
+* Revision 1.2  2006/10/24 22:26:18  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/24 16:31:12  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.gvsig.gui.styling;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.TreeSet;
+import java.util.Vector;
+
+import javax.swing.event.ListDataListener;
+
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.ValidationException;
+
+import com.iver.andami.messages.NotificationManager;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.cit.gvsig.fmap.core.symbols.SymbolFactory;
+import com.iver.utiles.XMLEntity;
+import com.iver.utiles.listManager.ListModel;
+import com.iver.utiles.xmlEntity.generate.XmlTag;
+// TODO remove org.castor.exolab....jar from the classpath when moving this to appgvSIG
+public class SymbolSelectorListModel implements ListModel {
+	public static File SYMBOL_DIRECTORY;
+	public static final String SYMBOL_FILE_EXTENSION = ".sym";
+
+	private static final FileFilter filter = new FileFilter() {
+		public boolean accept(File pathname) {
+			return pathname.getAbsolutePath().toLowerCase().endsWith(SYMBOL_FILE_EXTENSION);
+		}
+	};
+
+	private Vector symbols;
+	private ArrayList listeners;
+
+	public SymbolSelectorListModel(File file) {
+		SYMBOL_DIRECTORY = file;
+	}
+
+	public Object remove(int i) throws ArrayIndexOutOfBoundsException {
+		return symbols.remove(i);
+	}
+
+	public void insertAt(int i, Object o) {
+		getObjects().insertElementAt(o, i);
+	}
+
+	public void add(Object o) {
+		TreeSet map = new TreeSet(new Comparator() {
+
+			public int compare(Object o1, Object o2) {
+				ISymbol sym1 = (ISymbol) o1;
+				ISymbol sym2 = (ISymbol) o2;
+				int result = sym1.getDescription().compareTo(sym2.getDescription());
+				return (result!=0) ? result: 1; /* this will allow adding symbols with
+												   the same value for description than
+												   a previous one. */
+			}
+
+		});
+
+		map.addAll(symbols);
+		map.add(o);
+		symbols = new Vector(map);
+
+	}
+
+	public Vector getObjects() {
+		if (symbols == null) {
+			symbols = new Vector();
+
+			File[] ff = SYMBOL_DIRECTORY.listFiles(filter);
+			for (int i = 0; i < ff.length; i++) {
+
+				XMLEntity xml;
+				try {
+					xml = new XMLEntity((XmlTag) XmlTag.unmarshal(new FileReader(ff[i])));
+					ISymbol sym = SymbolFactory.createFromXML(xml, ff[i].getName());
+					add(sym);
+				} catch (MarshalException e) {
+					NotificationManager.
+						addWarning("Error in file ["+ff[i].getAbsolutePath()+"]. " +
+								"File corrupted! Skiping it...", e);
+				} catch (ValidationException e) {
+					NotificationManager.
+						addWarning("Error validating symbol file ["+ff[i].getAbsolutePath()+"].", e);
+				} catch (FileNotFoundException e) {
+					// unreachable code, but anyway...
+					NotificationManager.
+						addWarning("File not found: "+ ff[i].getAbsolutePath(), e);
+				}
+
+			}
+		}
+		return symbols;
+	}
+
+	public int getSize() {
+		return getObjects().size();
+	}
+
+	public Object getElementAt(int index) {
+		return getObjects().get(index);
+	}
+
+	public void addListDataListener(ListDataListener l) {
+		if (listeners == null)
+			listeners = new ArrayList();
+		listeners.add(l);
+	}
+
+	public void removeListDataListener(ListDataListener l) {
+		if (listeners!=null)
+			listeners.remove(l);
+	}
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolSelectorListModel.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolSelector.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolSelector.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolSelector.java	(revision 12191)
@@ -0,0 +1,632 @@
+/*
+ * Created on 26-abr-2005
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.gvsig.gui.styling;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.FileFilter;
+import java.io.FileWriter;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.JComponent;
+import javax.swing.JFileChooser;
+import javax.swing.JLabel;
+import javax.swing.JList;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JSplitPane;
+import javax.swing.JTree;
+import javax.swing.ListCellRenderer;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.event.TreeModelListener;
+import javax.swing.tree.TreeModel;
+import javax.swing.tree.TreePath;
+
+import org.exolab.castor.xml.Marshaller;
+import org.gvsig.gui.beans.AcceptCancelPanel;
+import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
+import org.gvsig.gui.beans.swing.JButton;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.messages.NotificationManager;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.andami.ui.mdiManager.WindowInfo;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.cit.gvsig.gui.panels.ColorChooserPanel;
+import com.iver.utiles.StringUtilities;
+import com.iver.utiles.XMLEntity;
+
+import de.ios.framework.swing.JDecimalField;
+import de.ios.framework.swing.JNumberField;
+
+/**
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public class SymbolSelector extends JPanel implements IWindow{
+
+    private JTree treeFamilies = null;
+    private JList jListSymbols = null;
+    private JPanel jPanel = null;
+    private JScrollPane jScrollPane = null;
+    private JScrollPane jScrollPane1 = null;
+    private SymbolPreview jPanelPreview = null;
+    private GridBagLayoutPanel jPanelOptions = null;
+	private WindowInfo wi;
+	private JSplitPane jSplitPane = null;
+	private File symbolDir;
+	private AcceptCancelPanel okCancelPanel;
+	private ISymbol selectedSymbol = null;
+	private JPanel northPanel;
+	private ColorChooserPanel jcc1;
+	private ColorChooserPanel jcc2;
+	private JNumberField txtSize;
+	private JDecimalField txtAngle;
+	private JPanel jPanelButtons;
+	private JButton btnProperties;
+	private int shapeType;
+	private JButton btnSaveSymbol;
+	private JButton btnResetSymbol;
+	private ActionListener buttonListener = new MyButtonListener();
+    /**
+     * This method initializes
+     *
+     */
+    public SymbolSelector(ISymbol symbol, int shapeType) {
+    	super();
+    	this.selectedSymbol = symbol;
+    	this.shapeType = shapeType;
+    	this.symbolDir = new File(getClass().
+  				getClassLoader().
+  				getResource("symbols").
+  				getFile());
+    	initialize();
+    }
+
+    /**
+     * This method initializes
+     *
+     */
+    public SymbolSelector(ISymbol symbol, int shapeType, File symbolDir) {
+    	super();
+    	this.selectedSymbol = symbol;
+    	this.shapeType = shapeType;
+    	this.symbolDir = symbolDir;
+    	initialize();
+    }
+    /**
+     * This method initializes this
+     *
+     */
+    private void initialize() {
+
+        this.setLayout(new BorderLayout());
+        this.setSize(400, 221);
+
+        this.add(getJNorthPanel(), BorderLayout.NORTH);
+        this.add(getJSplitPane(), BorderLayout.CENTER);
+        this.add(getJEastPanel(), BorderLayout.EAST);
+        ActionListener okAction = new ActionListener() {
+    		public void actionPerformed(ActionEvent e) {
+    			PluginServices.getMDIManager().closeWindow(SymbolSelector.this);
+    		}
+    	}, cancelAction = new ActionListener() {
+    		public void actionPerformed(ActionEvent e) {
+    			setSymbol(null);
+    			PluginServices.getMDIManager().closeWindow(SymbolSelector.this);
+    		}
+    	};
+
+        okCancelPanel = new AcceptCancelPanel(okAction, cancelAction);
+
+
+        this.add(okCancelPanel, BorderLayout.SOUTH);
+    }
+
+    private JPanel getJNorthPanel() throws IllegalArgumentException {
+		if (northPanel == null) {
+			String text = "";
+			switch (shapeType) {
+			case FShape.POINT:
+				text = PluginServices.getText(this, "point_symbols");
+				break;
+			case FShape.LINE:
+				text = PluginServices.getText(this, "line_symbols");
+				break;
+			case FShape.POLYGON:
+				text = PluginServices.getText(this, "polygon_symbols");
+				break;
+			default:
+				throw new IllegalArgumentException(PluginServices.getText(this, "shape_type_not_yet_supported"));
+			}
+			northPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
+			JLabel lbl = new JLabel(text);
+			lbl.setFont(lbl.getFont().deriveFont(Font.BOLD));
+			northPanel.add(lbl);
+		}
+		return northPanel;
+	}
+
+	/**
+     * This method initializes jList
+     *
+     * @return javax.swing.JList
+     */
+    private JTree getJListFav() {
+    	if (treeFamilies == null) {
+    		treeFamilies = new JTree();
+    		treeFamilies.setPreferredSize(new java.awt.Dimension(70,100));
+    		try {
+    			treeFamilies.setModel(new TreeModel() {
+    				final class MyFile extends File {
+    					public MyFile(String pathname) {
+    						super(pathname);
+    					}
+
+    					public String toString() {
+    						if (this.equals(root))
+    							return PluginServices.getText(this, "symbol_library");
+    						String path = getAbsolutePath();
+    						String prefixToRemove = symbolDir.getAbsolutePath();
+    						path = path.substring(prefixToRemove.length()+1, path.length());
+    						return path;
+    					}
+    				};
+    				MyFile root = new MyFile(symbolDir.getAbsolutePath());
+
+    				private FileFilter ff = new FileFilter() {
+    					public boolean accept(File pathname) {
+    						return pathname.isDirectory();
+    					}
+    				};
+
+    				public Object getRoot() {
+    					return root;
+    				}
+
+    				public int getChildCount(Object parent) {
+    					return ((File) parent).listFiles(ff).length;
+    				}
+
+    				public boolean isLeaf(Object node) {
+    					return getChildCount(node)==0;
+    				}
+
+    				public void addTreeModelListener(TreeModelListener l) {
+    					// TODO Necessite?
+
+    				}
+
+    				public void removeTreeModelListener(TreeModelListener l) {
+    					// TODO Auto-generated method stub
+
+    				}
+
+    				public Object getChild(Object parent, int index) {
+    					return new MyFile(((File) parent).listFiles(ff)[index].getAbsolutePath());
+    				}
+
+    				public int getIndexOfChild(Object parent, Object child) {
+    					if (parent == null)
+    						return -1;
+    					File[] files = ((File) parent).listFiles(ff);
+    					for (int i = 0; i < files.length; i++) {
+    						if (files[i].equals((File) child))
+    							return i;
+    					}
+    					return -1;
+    				}
+
+    				public void valueForPathChanged(TreePath path, Object newValue) {
+    					// TODO Auto-generated method stub
+    				}
+
+    			});
+    			treeFamilies.addTreeSelectionListener(new javax.swing.event.TreeSelectionListener() {
+					public void valueChanged(javax.swing.event.TreeSelectionEvent e) {
+						 File node = (File)
+	                       treeFamilies.getLastSelectedPathComponent();
+
+						 	if (node == null) return;
+						 	jListSymbols.setModel(
+					          		new SymbolSelectorListModel(node));
+					}
+				});
+    		} catch ( ExceptionInInitializerError ex ) {
+    			JOptionPane.showMessageDialog(this, PluginServices.getText(this, "could_not_find_symbol_directory"));
+    		}
+    	}
+    	return treeFamilies;
+    }
+
+    /**
+     * This method initializes jList
+     *
+     * @return javax.swing.JList
+     */
+    private JList getJListSymbols() {
+    	if (jListSymbols == null) {
+    		jListSymbols = new JList();
+    		jListSymbols.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
+            jListSymbols.setLayoutOrientation(JList.HORIZONTAL_WRAP);
+            jListSymbols.setVisibleRowCount(-1);
+            jListSymbols.addListSelectionListener(new ListSelectionListener() {
+            	public void valueChanged(ListSelectionEvent e) {
+            		setSymbol((ISymbol) jListSymbols.getSelectedValue());
+            		updateOptionsPanel();
+            	}
+            });
+            ListCellRenderer renderer = new ListCellRenderer() {
+        		private Color mySelectedBGColor = new Color(255,145,100,255);
+    			public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
+    				ISymbol sym = (ISymbol) value;
+    				JPanel pnl = new JPanel();
+    				BoxLayout layout = new BoxLayout(pnl, BoxLayout.Y_AXIS);
+    				pnl.setLayout(layout);
+    				Color bgColor = (isSelected) ? mySelectedBGColor
+    							 : getJListSymbols().getBackground();
+
+    				pnl.setBackground(bgColor);
+    				SymbolPreview sp = new SymbolPreview();
+    				sp.setAlignmentX(Component.CENTER_ALIGNMENT);
+    				sp.setPreferredSize(new Dimension(50, 50));
+    				sp.setSymbol(sym);
+    				sp.setBackground(bgColor);
+    				pnl.add(sp);
+    				JLabel lbl = new JLabel(sym.getDescription());
+    				lbl.setBackground(bgColor);
+    				lbl.setAlignmentX(Component.CENTER_ALIGNMENT);
+    				pnl.add(lbl);
+
+    				return pnl;
+    			}
+
+        	};
+        	jListSymbols.setCellRenderer(renderer);
+    	}
+    	return jListSymbols;
+    }
+
+    protected void updateOptionsPanel() {
+    	ISymbol sym = ((ISymbol) jListSymbols.getSelectedValue());
+    	if (sym == null)
+    		return;
+
+		XMLEntity xml = sym.getXMLEntity();
+
+		Color c = null;
+    	if (xml.contains("color")) {
+    		c = StringUtilities.string2Color(xml.getStringProperty("color"));
+    	}
+		jcc1.setColor(c);
+
+		if (jcc2 == null)
+			return;
+		if (xml.contains("outline")) {
+    		c = StringUtilities.string2Color(xml.getStringProperty("outline"));
+    		jcc2.setEnabled(true);
+    		jcc2.setColor(c);
+    	} else {
+    		jcc2.setEnabled(false);
+    	}
+
+
+	}
+
+	/**
+     * This method initializes jPanel
+     *
+     * @return javax.swing.JPanel
+     */
+    private JPanel getJEastPanel() {
+    	if (jPanel == null) {
+    		jPanel = new JPanel();
+    		jPanel.setLayout(new BorderLayout());
+    		jPanel.add(getJPanelOptions(), BorderLayout.CENTER);
+    		JPanel aux = new JPanel(new FlowLayout(FlowLayout.CENTER, 5, 5));
+    		aux.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "preview")));
+    		aux.add(getJPanelPreview());
+    		jPanel.add(aux, BorderLayout.NORTH);
+
+    		aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
+    		aux.setBorder(BorderFactory.createTitledBorder(null, PluginServices.getText(this, "options")));
+    		aux.add(getJPanelOptions());
+    		jPanel.add(aux, BorderLayout.CENTER);
+    		aux = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5));
+    		aux.add(getJPanelButtons());
+    		jPanel.add(aux, BorderLayout.SOUTH);
+    	}
+    	return jPanel;
+    }
+
+    private JPanel getJPanelButtons() {
+		if (jPanelButtons == null) {
+			jPanelButtons = new JPanel();
+			GridLayout layout = new GridLayout();
+			layout.setColumns(1);
+			layout.setVgap(5);
+			jPanelButtons.add(getBtnSaveSymbol());
+			jPanelButtons.add(getBtnResetSymbol());
+			jPanelButtons.add(getBtnProperties());
+
+			// do not add components bellow this line!
+			layout.setRows(jPanelButtons.getComponentCount());
+			jPanelButtons.setLayout(layout);
+		}
+		return jPanelButtons;
+	}
+
+	private JButton getBtnResetSymbol() {
+		if (btnResetSymbol == null) {
+			btnResetSymbol = new JButton();
+			btnResetSymbol.setName("btnResetSymbol");
+			btnResetSymbol.setText(PluginServices.getText(this, "reset"));
+			btnResetSymbol.addActionListener(buttonListener);
+		}
+		return btnResetSymbol;
+	}
+
+	private JButton getBtnSaveSymbol() {
+		if (btnSaveSymbol == null) {
+			btnSaveSymbol = new JButton();
+			btnSaveSymbol.setName("btnSaveSymbol");
+			btnSaveSymbol.setText(PluginServices.getText(this, "save"));
+			btnSaveSymbol.addActionListener(buttonListener);
+		}
+		return btnSaveSymbol;
+	}
+
+	private JButton getBtnProperties() {
+		if (btnProperties == null) {
+			btnProperties = new JButton();
+			btnProperties.setName("btnProperties");
+			btnProperties.setText(PluginServices.getText(this, "properties"));
+			btnProperties.addActionListener(buttonListener);
+		}
+		return btnProperties;
+	}
+
+	/**
+     * This method initializes jScrollPane
+     *
+     * @return javax.swing.JScrollPane
+     */
+    private JScrollPane getJScrollPane() {
+    	if (jScrollPane == null) {
+    		jScrollPane = new JScrollPane();
+    		jScrollPane.setPreferredSize(new java.awt.Dimension(80,130));
+    		jScrollPane.setHorizontalScrollBarPolicy(javax.swing.JScrollPane.HORIZONTAL_SCROLLBAR_NEVER);
+    		jScrollPane.setViewportView(getJListFav());
+    	}
+    	return jScrollPane;
+    }
+
+    /**
+     * This method initializes jScrollPane1
+     *
+     * @return javax.swing.JScrollPane
+     */
+    private JScrollPane getJScrollPane1() {
+    	if (jScrollPane1 == null) {
+    		jScrollPane1 = new JScrollPane();
+    		jScrollPane1.setViewportView(getJListSymbols());
+    	}
+    	return jScrollPane1;
+    }
+
+    /**
+     * This method initializes jPanel1
+     *
+     * @return javax.swing.JPanel
+     */
+    private SymbolPreview getJPanelPreview() {
+    	if (jPanelPreview == null) {
+    		jPanelPreview = new SymbolPreview();
+    		jPanelPreview.setPreferredSize(new java.awt.Dimension(100,100));
+    		jPanelPreview.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
+    	}
+    	return jPanelPreview;
+    }
+
+    /**
+     * This method initializes jPanel1
+     *
+     * @return javax.swing.JPanel
+     */
+    private JPanel getJPanelOptions() {
+    	if (jPanelOptions == null) {
+    		jPanelOptions = new GridBagLayoutPanel();
+
+    		jcc1 = new ColorChooserPanel();
+    		jcc2 = new ColorChooserPanel();
+    		jcc1.setAlpha(255);
+    		jcc2.setAlpha(255);
+    		jcc1.addActionListener(buttonListener);
+    		jcc2.addActionListener(buttonListener);
+    		if (shapeType == FShape.POINT) {
+    			jPanelOptions.addComponent(
+    					PluginServices.getText(this, "color")+":", jcc1);
+    			jPanelOptions.addComponent(
+    					PluginServices.getText(this, "size")+":",
+    					txtSize = new JNumberField());
+    			jPanelOptions.addComponent(
+    					PluginServices.getText(this, "angle")+":",
+    					txtAngle = new JDecimalField());
+    		} else if (shapeType == FShape.LINE) {
+    			jPanelOptions.addComponent(
+    					PluginServices.getText(this, "color")+":", jcc1);
+    			jPanelOptions.addComponent(
+    					PluginServices.getText(this, "width")+":",
+    					txtSize = new JNumberField());
+    			jPanelOptions.addComponent(new JLabel("AQUI VA EL COMBO DE PATTERN DE LINEA"));
+    		} else if (shapeType == FShape.POLYGON) {
+    			jPanelOptions.addComponent(
+    					PluginServices.getText(this, "fill_color")+":", jcc1);
+    			jPanelOptions.addComponent(
+    					PluginServices.getText(this, "outline_color")+":", jcc2);
+    			jPanelOptions.addComponent(
+    					new JLabel("AQUI VA EL ANCHO DEL CONTORNO"));
+    		}
+    	}
+    	return jPanelOptions;
+    }
+
+	public WindowInfo getWindowInfo() {
+		if (wi == null) {
+			wi = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.RESIZABLE);
+			wi.setWidth(706);
+			wi.setHeight(500);
+			wi.setTitle(PluginServices.getText(this, "symbol_selector"));
+		}
+		return wi;
+	}
+
+	/**
+	 * This method initializes jSplitPane
+	 *
+	 * @return javax.swing.JSplitPane
+	 */
+	private JSplitPane getJSplitPane() {
+		if (jSplitPane == null) {
+			jSplitPane = new JSplitPane();
+			jSplitPane.setDividerLocation(200);
+			jSplitPane.setResizeWeight(0.4);
+	        jSplitPane.setLeftComponent(getJScrollPane());
+	        jSplitPane.setRightComponent(getJScrollPane1());
+		}
+		return jSplitPane;
+	}
+
+	/**
+	 * Returns the symbol selected by the user or null if none
+	 * @return
+	 */
+	public ISymbol getSymbol() {
+		return selectedSymbol;
+	}
+
+	private void setSymbol(ISymbol symbol) {
+		selectedSymbol = symbol;
+		jPanelPreview.setSymbol(symbol);
+	}
+
+
+	private class MyButtonListener implements ActionListener {
+		public void actionPerformed(ActionEvent e) {
+			if (selectedSymbol ==null)
+				return;
+
+			JComponent comp = (JComponent) e.getSource();
+			XMLEntity xml = selectedSymbol.getXMLEntity();
+
+			if ( comp.equals(getBtnProperties()) ) {
+				// properties pressed
+				SymbolEditor se = new SymbolEditor(selectedSymbol, shapeType);
+				PluginServices.getMDIManager().addWindow(se);
+				setSymbol(se.getSymbol());
+			} else if ( comp.equals(getBtnResetSymbol()) ) {
+				// reset pressed
+				setSymbol(null);
+			} else if ( comp.equals(getBtnSaveSymbol()) ) {
+				// save pressed
+				JFileChooser jfc = new JFileChooser(SymbolSelectorListModel.SYMBOL_DIRECTORY);
+				javax.swing.filechooser.FileFilter ff = new javax.swing.filechooser.FileFilter() {
+					public boolean accept(File f) {
+						return f.getAbsolutePath().
+						toLowerCase().
+						endsWith(SymbolSelectorListModel.
+								SYMBOL_FILE_EXTENSION);
+					}
+
+					public String getDescription() {
+						return PluginServices.getText(
+								this, "gvSIG_symbol_definition_file")+ " (*.sym)";
+					}
+				};
+				jfc.setFileFilter(ff);
+				if (jfc.showSaveDialog(SymbolSelector.this) == JFileChooser.APPROVE_OPTION) {
+					File targetFile = jfc.getSelectedFile();
+					String fExtension = SymbolSelectorListModel.SYMBOL_FILE_EXTENSION;
+					if (!targetFile.
+							getAbsolutePath().
+							toLowerCase().
+							endsWith(fExtension))
+						targetFile = new File(targetFile.getAbsolutePath() + fExtension);
+					FileWriter writer;
+					try {
+						writer = new FileWriter(targetFile.getAbsolutePath());
+						Marshaller m = new Marshaller(writer);
+						m.setEncoding("ISO-8859-1");
+						m.marshal(xml.getXmlTag());
+
+					} catch (Exception ex) {
+						NotificationManager.addError(
+								PluginServices.getText(this, "save_error"), ex);
+					}
+				}
+			} else if (comp.equals(jcc1) && xml != null) {
+				xml.putProperty("color", StringUtilities.color2String(jcc1.getColor()));
+				selectedSymbol.setXMLEntity(xml);
+				setSymbol(selectedSymbol);
+			} else if (comp.equals(jcc2) && xml != null) {
+				xml.putProperty("outline", StringUtilities.color2String(jcc2.getColor()));
+				selectedSymbol.setXMLEntity(xml);
+				setSymbol(selectedSymbol);
+			}
+
+			SymbolSelector.this.repaint();
+		}
+	}
+}  //  @jve:decl-index=0:visual-constraint="10,10"

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolSelector.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolPreview.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolPreview.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolPreview.java	(revision 12191)
@@ -0,0 +1,131 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.7  2006-10-30 19:30:35  jaume
+* *** empty log message ***
+*
+* Revision 1.6  2006/10/29 23:53:49  jaume
+* *** empty log message ***
+*
+* Revision 1.5  2006/10/29 21:45:12  jaume
+* centers in x the "none selected message"
+*
+* Revision 1.4  2006/10/29 21:43:34  jaume
+* *** empty log message ***
+*
+* Revision 1.3  2006/10/29 21:40:29  jaume
+* centers in x the "none selected message"
+*
+* Revision 1.2  2006/10/26 07:46:58  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/25 10:50:41  jaume
+* movement of classes and gui stuff
+*
+* Revision 1.2  2006/10/24 19:54:55  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/24 16:31:12  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.gvsig.gui.styling;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.FontMetrics;
+import java.awt.Graphics;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.font.FontRenderContext;
+import java.awt.geom.AffineTransform;
+
+import javax.swing.JPanel;
+
+import com.iver.andami.PluginServices;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+
+public class SymbolPreview extends JPanel {
+	private int hGap = 5, vGap = 5;
+	private ISymbol symbol;
+
+
+	public SymbolPreview() {
+		super();
+		setBackground(Color.WHITE);
+	}
+
+	public ISymbol getSymbol() {
+		return symbol;
+	}
+
+	public void setSymbol(ISymbol symbol) {
+		this.symbol = symbol;
+		repaint();
+	}
+
+	public void paint(Graphics g) {
+		super.paint(g);
+		Graphics2D g2 = (Graphics2D) g;
+		g2.translate(hGap, vGap);
+		Rectangle r = getBounds();
+		r = new Rectangle(0, 0, (int) (r.getWidth()-(hGap*2)), (int) (r.getHeight()-(vGap*2)));
+
+		if (symbol != null) {
+			symbol.drawInsideRectangle(g2, new AffineTransform(), r);
+		} else {
+			String noneSelected = "["+PluginServices.getText(this, "none_selected")+"]";
+			FontMetrics fm = g2.getFontMetrics();
+			int lineWidth = fm.stringWidth(noneSelected);
+			float scale = (float) r.getWidth() / lineWidth;
+			Font f = g2.getFont();
+			float fontSize = f.getSize()*scale;
+			g2.setFont(	f.deriveFont( fontSize ) );
+
+			g2.drawString(noneSelected,	 (r.x*scale) - (hGap/2), r.height/2+vGap*scale);
+		}
+	}
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/SymbolPreview.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/MarkerFill.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/MarkerFill.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/MarkerFill.java	(revision 12191)
@@ -0,0 +1,310 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.7  2006-11-13 09:15:23  jaume
+* javadoc and some clean-up
+*
+* Revision 1.6  2006/11/06 16:06:52  jaume
+* *** empty log message ***
+*
+* Revision 1.5  2006/11/02 17:19:28  jaume
+* *** empty log message ***
+*
+* Revision 1.4  2006/10/31 16:16:34  jaume
+* *** empty log message ***
+*
+* Revision 1.3  2006/10/30 19:30:35  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/29 23:53:49  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/27 12:41:09  jaume
+* GUI
+*
+*
+*/
+package com.iver.cit.gvsig.gvsig.gui.styling;
+
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+
+import javax.swing.BorderFactory;
+import javax.swing.ButtonGroup;
+import javax.swing.JComponent;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+
+import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
+import org.gvsig.gui.beans.swing.JBlank;
+import org.gvsig.gui.beans.swing.JButton;
+
+import com.iver.andami.PluginServices;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.symbols.AbstractFillSymbol;
+import com.iver.cit.gvsig.fmap.core.symbols.AbstractMarkerSymbol;
+import com.iver.cit.gvsig.fmap.core.symbols.MarkerFillSymbol;
+import com.iver.cit.gvsig.gui.panels.ColorChooserPanel;
+import com.iver.utiles.StringUtilities;
+import com.iver.utiles.XMLEntity;
+
+import de.ios.framework.swing.JDecimalField;
+
+public class MarkerFill extends AbstractTypeSymbolEditorPanel implements ActionListener {
+    private static final String NAME = PluginServices.
+    getText(MarkerFill.class, "marker_fill");
+    private static final double DEFAULT_SEPARATION = 20;
+    private static final double DEFAULT_OFFSET = 10;
+    private ArrayList tabs = new ArrayList();
+    private JDecimalField txtOffsetX;
+    private JDecimalField txtOffsetY;
+    private JDecimalField txtSeparationX;
+    private JDecimalField txtSeparationY;
+    private ColorChooserPanel markerCC;
+    private JButton btnChooseMarker;
+    private JButton btnOutline;
+    private JRadioButton rdGrid;
+    private JRadioButton rdRandom;
+    private MarkerFillSymbol mfs = new MarkerFillSymbol();
+    public MarkerFill(SymbolEditor owner) {
+        super(owner);
+        initialize();
+    }
+
+    private void initialize() {
+        GridLayout layout;
+        JPanel myTab;
+        // Marker fill tab
+
+        {
+        	myTab = new JPanel(new FlowLayout(FlowLayout.LEFT, 10, 10));
+        	myTab.setName(PluginServices.getText(this, "marker_fill"));
+
+        	GridBagLayoutPanel p = new GridBagLayoutPanel();
+        	JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
+            markerCC = new ColorChooserPanel();
+            markerCC.setAlpha(255);
+            markerCC.addActionListener(this);
+            aux.add(markerCC);
+
+            p.addComponent(PluginServices.getText(this, "color"), aux);
+            btnChooseMarker = new JButton(PluginServices.getText(this, "choose_marker"));
+            btnChooseMarker.addActionListener(this);
+            aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
+            aux.add(btnChooseMarker);
+            p.addComponent("", aux);
+
+            aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
+            btnOutline = new JButton(PluginServices.getText(this, "outline"));
+            aux.add(btnOutline);
+            btnOutline.setEnabled(false);
+            p.addComponent("", aux);
+
+            ButtonGroup group = new ButtonGroup();
+            rdGrid = new JRadioButton(PluginServices.getText(this, "grid"));
+            rdGrid.addActionListener(this);
+            rdRandom = new JRadioButton(PluginServices.getText(this, "random"));
+            rdRandom.addActionListener(this);
+            group.add(rdGrid);
+            group.add(rdRandom);
+
+
+
+            aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5, 5));
+            aux.add(rdGrid);
+            aux.add(rdRandom);
+
+            p.addComponent("", aux);
+
+            myTab.add(p);
+
+        }
+        tabs.add(myTab);
+
+        // Fill properties tab
+        {
+            layout = new GridLayout();
+            layout.setColumns(1);
+            layout.setVgap(5);
+            myTab = new JPanel();
+            myTab.setName(PluginServices.getText(this, "fill_properties"));
+            JPanel offsetPnl = new JPanel();
+            offsetPnl.setBorder(BorderFactory.
+                        createTitledBorder(null,
+                                PluginServices.getText(this, "offset")));
+
+            // add components to the offset panel here
+            {
+                JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,5));
+                aux.add(new JLabel("X:"));
+                aux.add(txtOffsetX = new JDecimalField(10));
+                offsetPnl.add(aux);
+
+                aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,5));
+                aux.add(new JLabel("Y:"));
+                aux.add(txtOffsetY = new JDecimalField(10));
+                offsetPnl.add(aux);
+
+
+
+            }
+            layout.setRows(offsetPnl.getComponentCount());
+            offsetPnl.setLayout(layout);
+
+            myTab.add(offsetPnl);
+
+            JPanel separationPnl = new JPanel();
+            layout = new GridLayout();
+            layout.setColumns(1);
+            layout.setVgap(5);
+            separationPnl.setBorder(BorderFactory.
+                        createTitledBorder(null,
+                                PluginServices.getText(this, "separation")));
+
+            // add components to the separation panel here
+            {
+                JPanel aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,5));
+                aux.add(new JLabel("X:"));
+                aux.add(txtSeparationX = new JDecimalField(10));
+                separationPnl.add(aux);
+
+                aux = new JPanel(new FlowLayout(FlowLayout.LEADING, 5,5));
+                aux.add(new JLabel("Y:"));
+                aux.add(txtSeparationY = new JDecimalField(10));
+                separationPnl.add(aux);
+            }
+            layout.setRows(separationPnl.getComponentCount());
+            separationPnl.setLayout(layout);
+            myTab.add(separationPnl);
+            layout = new GridLayout();
+            layout.setColumns(1);
+            layout.setVgap(5);
+            layout.setRows(myTab.getComponentCount());
+            myTab.setLayout(layout);
+        }
+       tabs.add(myTab);
+    }
+
+    public void refreshControls(int layerIndex) {
+        AbstractFillSymbol sym = (AbstractFillSymbol) owner.getSymbol();
+        if (sym.getLayer(layerIndex) == null) {
+        	// set defaults
+           	markerCC.setColor(Color.BLACK);
+           	rdGrid.setSelected(true);
+    		rdRandom.setSelected(false);
+    		txtOffsetX.setText(String.valueOf(DEFAULT_OFFSET));
+    		txtOffsetY.setText(String.valueOf(DEFAULT_OFFSET));
+    		txtSeparationX.setText(String.valueOf(DEFAULT_SEPARATION));
+    		txtSeparationY.setText(String.valueOf(DEFAULT_SEPARATION));
+        } else {
+        	XMLEntity xml = sym.getLayer(layerIndex).getXMLEntity();
+
+        	// TODO este marker color es del MarkerSymbol,
+        	// no del MarkerFill (l'has de buscar dins del fill d'este xmlEntity)
+//        	markerCC.setColor(StringUtilities.string2Color(xml.getStringProperty("color")));
+        	boolean b = xml.getBooleanProperty("grid");
+        	rdGrid.setSelected(b);
+        	rdRandom.setSelected(!b);
+
+        	txtOffsetX.setText(String.valueOf(xml.getDoubleProperty("xOffset")));
+        	txtOffsetY.setText(String.valueOf(xml.getDoubleProperty("yOffset")));
+
+        	txtSeparationX.setText(String.valueOf(xml.getDoubleProperty("xSeparation")));
+        	txtSeparationY.setText(String.valueOf(xml.getDoubleProperty("ySeparation")));
+        }
+    }
+
+    public XMLEntity getXMLEntity() {
+        return mfs.getXMLEntity();
+    }
+
+    public String getName() {
+        return NAME;
+    }
+
+    public JPanel[] getTabs() {
+        return (JPanel[]) tabs.toArray(new JPanel[0]);
+    }
+
+    public void actionPerformed(ActionEvent e) {
+        JComponent comp = (JComponent) e.getSource();
+        if (comp.equals(btnChooseMarker)) {
+            AbstractFillSymbol ownersSymbol = (AbstractFillSymbol) owner.getSymbol();
+
+
+            SymbolSelector symSelect = new SymbolSelector( ownersSymbol.getLayer(layerIndex), FShape.POINT);
+            PluginServices.getMDIManager().addWindow(symSelect);
+            AbstractMarkerSymbol marker = (AbstractMarkerSymbol) symSelect.getSymbol();
+            mfs.setMarker(marker);
+        }
+        try {
+            mfs.setXOffset(Double.parseDouble(txtOffsetX.getText()));
+        } catch (Exception ex) {}
+        try {
+            mfs.setYOffset(Double.parseDouble(txtOffsetY.getText()));
+        } catch (Exception ex) {}
+        try {
+            mfs.setXSeparation(Double.parseDouble(txtSeparationX.getText()));
+        } catch (Exception ex) {}
+        try {
+            mfs.setYSeparation(Double.parseDouble(txtSeparationY.getText()));
+        } catch (Exception ex) {}
+        try {
+            mfs.setGrid(rdGrid.isSelected());
+        } catch (Exception ex) {}
+
+        fireSymbolChangedEvent();
+    }
+
+	public Class getSymbolClass() {
+		return MarkerFillSymbol.class;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/gvsig/gui/styling/MarkerFill.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/LoadNetworkExtension.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/LoadNetworkExtension.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/LoadNetworkExtension.java	(revision 12191)
@@ -0,0 +1,262 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph;
+
+import java.awt.Component;
+import java.io.File;
+import java.sql.Types;
+import java.util.ArrayList;
+
+import javax.swing.JOptionPane;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.messages.NotificationManager;
+import com.iver.andami.plugins.Extension;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.cit.gvsig.ProjectExtension;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
+import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
+import com.iver.cit.gvsig.graph.core.IGraph;
+import com.iver.cit.gvsig.graph.core.Network;
+import com.iver.cit.gvsig.graph.core.loaders.NetworkLoader;
+import com.iver.cit.gvsig.graph.core.loaders.NetworkRedLoader;
+import com.iver.cit.gvsig.project.documents.table.ProjectTable;
+import com.iver.cit.gvsig.project.documents.view.IProjectView;
+import com.iver.cit.gvsig.project.documents.view.gui.IView;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+
+public class LoadNetworkExtension extends Extension {
+
+	public void initialize() {
+	}
+
+	public void execute(String actionCommand) {
+		IView view = (View) PluginServices.getMDIManager().getActiveWindow();
+		MapControl mapControl = view.getMapControl();
+		MapContext map = mapControl.getMapContext();
+		SingleLayerIterator lyrIterator = new SingleLayerIterator(map
+				.getLayers());
+		while (lyrIterator.hasNext()) {
+			FLayer lyr = lyrIterator.next();
+			if ((lyr.isActive()) && (lyr instanceof FLyrVect))
+			{
+				FLyrVect lyrVect = (FLyrVect) lyr;
+				int shapeType;
+				try {
+					shapeType = lyrVect.getShapeType();
+					if (shapeType == FShape.LINE)
+					{
+						if (actionCommand.equalsIgnoreCase("LOAD_RED")) {
+							loadNetwork(lyrVect);
+							return;
+						}
+					}
+				} catch (DriverException e) {
+					e.printStackTrace();
+					NotificationManager.addError(e);
+				} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
+					e.printStackTrace();
+					NotificationManager.addError(e);
+				}
+
+			}
+		}
+
+
+	}
+
+	/**
+	 * Suponemos que en el proyecto hay 2 tablas, una con los nodos
+	 * y otro con los edges.
+	 * Cargamos la red a partir de esas tablas y se la
+	 * asociamos a la capa. A partir de ah�, nuestras
+	 * herramientas pueden ver si la capa activa tiene
+	 * asociada o no una red y ponerse visibles / invisibles
+	 * Otra posible soluci�n es llevar nuestra propia lista de capas
+	 * con red (que ser� peque�ita), y as�, en lugar de recorrer
+	 * el MapContext, recorremos nuestra lista para ver la
+	 * capa que est� activa y con red. Me empieza a preocupar
+	 * que todas las herramientas iteren por la colecci�n de
+	 * capas para habilitarse/deshabilitarse:
+	 * 100 herramientas * 100 capas = 10.000 comprobaciones
+	 * Si comprobar algo cuesta 1 mseg => 10 segundos!!!
+	 * @param lyrVect
+	 */
+	private void loadNetworkFromTables(FLyrVect lyrVect) {
+		// Aqu� mostrar un di�lgo para seleccionar las tablas
+		// de nodos y edges
+		// y hacer un mapping (si es necesario) entre los
+		// nombres de campos
+		String tableNodes = "Nodes";
+		String tableEdges = "Edges";
+
+		ProjectExtension projectExt = (ProjectExtension) PluginServices.getExtension(ProjectExtension.class);
+
+		ProjectTable ptNodes = projectExt.getProject().getTable(tableNodes);
+		ProjectTable ptEdges = projectExt.getProject().getTable(tableEdges);
+
+		SelectableDataSource sdsNodes = ptNodes.getModelo().getRecordset();
+
+
+		SelectableDataSource sdsEdges = ptEdges.getModelo().getRecordset();
+
+		NetworkLoader netLoader = new NetworkLoader(true);
+
+		netLoader.setNodeReader(sdsNodes);
+		netLoader.setEdgeReader(sdsEdges);
+
+		IGraph g = netLoader.loadNetwork();
+
+		System.out.println("Num nodos=" + g.numVertices() + " numEdges = " + g.numEdges());
+
+		lyrVect.setProperty("network", g);
+
+	}
+	private void loadNetwork(FLyrVect lyrVect) throws com.hardcode.gdbms.engine.data.driver.DriverException, DriverException {
+		// Aqu� mostrar un di�lgo para seleccionar las tablas
+		// de nodos y edges
+		// y hacer un mapping (si es necesario) entre los
+		// nombres de campos
+
+		// TODO: MOSTRAR UN CUADRO DE DI�LOGO CON UN COMBOBOX PARA QUE ESCOJA EL CAMPO DE NOMBRE DE CALLE.
+		ArrayList aux = new ArrayList();
+		FieldDescription[] fields = lyrVect.getRecordset().getFieldsDescription();
+		for (int i=0; i<fields.length; i++)
+		{
+			if (fields[i].getFieldType() == Types.VARCHAR)
+			{
+				aux.add(fields[i].getFieldName());
+			}
+		}
+		String fieldStreetName = (String) JOptionPane.showInputDialog((Component) PluginServices.getMainFrame(),
+				PluginServices.getText(this, "select_street_route_field_name"),
+				"gvSIG",
+				JOptionPane.QUESTION_MESSAGE, 
+				null,
+				(Object[]) aux.toArray(new String[0]), 
+				"NOMBRE");
+		
+		if (fieldStreetName == null)
+			return;
+
+		
+		NetworkRedLoader netLoader = new NetworkRedLoader();
+		File redFile = NetworkUtils.getNetworkFile(lyrVect);
+		netLoader.setNetFile(redFile);
+
+		IGraph g = netLoader.loadNetwork();
+		
+		System.out.println("Num nodos=" + g.numVertices() + " numEdges = " + g.numEdges());
+
+		Network net = new Network();
+		// lyrVect.createSpatialIndex();
+		net.setGraph(g);
+		net.setLayer(lyrVect);
+		ShortestPathExtension.solver.setNetwork(net);
+		ShortestPathExtension.solver.setFielStreetName(fieldStreetName);
+
+		lyrVect.setProperty("network", net);
+
+	}
+
+	public boolean isEnabled() {
+		IWindow f = PluginServices.getMDIManager().getActiveWindow();
+
+		if (f == null) {
+			return false;
+		}
+
+		if (f instanceof View) {
+			View vista = (View) f;
+			IProjectView model = vista.getModel();
+			MapContext mapa = model.getMapContext();
+			FLayer[] activeLayers = mapa.getLayers().getActives();
+			if (activeLayers.length > 0)
+				if (activeLayers[0] instanceof FLyrVect){
+					FLyrVect lyrVect = (FLyrVect) activeLayers[0];
+					File netFile = NetworkUtils.getNetworkFile(lyrVect);
+					if (netFile.exists())
+						return true;
+
+				}
+		}
+		return false;
+	}
+
+	public boolean isVisible() {
+		IWindow f = PluginServices.getMDIManager().getActiveWindow();
+
+		if (f == null) {
+			return false;
+		}
+
+		if (f instanceof View) {
+			View vista = (View) f;
+			IProjectView model = vista.getModel();
+			MapContext mapa = model.getMapContext();
+			FLayer[] activeLayers = mapa.getLayers().getActives();
+			if (activeLayers.length > 0)
+				if (activeLayers[0] instanceof FLyrVect){
+					FLyrVect lyrVect = (FLyrVect) activeLayers[0];
+					int shapeType ;
+					try {
+						shapeType = lyrVect.getShapeType();
+						if (shapeType == FShape.LINE)
+							return true;
+					} catch (DriverException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
+				}	
+		}
+		return false;
+
+	}
+
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/LoadNetworkExtension.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/NetworkAddFlag.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/NetworkAddFlag.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/NetworkAddFlag.java	(revision 12191)
@@ -0,0 +1,158 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph;
+
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.plugins.Extension;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
+import com.iver.cit.gvsig.fmap.tools.Behavior.PointBehavior;
+import com.iver.cit.gvsig.graph.core.Network;
+import com.iver.cit.gvsig.graph.tools.BarrierListener;
+import com.iver.cit.gvsig.graph.tools.FlagListener;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+
+public class NetworkAddFlag extends Extension {		
+    FlagListener flagListener = null;
+    BarrierListener barrierListener = null;
+	public void initialize() {
+	}
+
+	public void execute(String actionCommand) {
+		View v = (View) PluginServices.getMDIManager().getActiveWindow();
+        MapControl mapCtrl = v.getMapControl();
+
+        if (!mapCtrl.hasTool("addFlag")) // We create it for the first time.
+        {
+        	flagListener = new FlagListener(mapCtrl);
+            mapCtrl.addMapTool("addFlag", new PointBehavior(flagListener));
+        }
+
+        if (!mapCtrl.hasTool("addBarrier")) // We create it for the first time.
+        {
+        	barrierListener = new BarrierListener(mapCtrl);
+            mapCtrl.addMapTool("addBarrier", new PointBehavior(barrierListener));
+        }
+        
+        if (actionCommand.compareTo("ADD_FLAG_TO_NETWORK") == 0)
+        {
+        	flagListener.setMode(FlagListener.TO_ARC);
+            mapCtrl.setTool("addFlag");
+        }
+        if (actionCommand.compareTo("ADD_FLAG_TO_NODE") == 0)
+        {
+        	flagListener.setMode(FlagListener.TO_NODE);
+            mapCtrl.setTool("addFlag");
+        }
+        if (actionCommand.compareTo("ADD_BARRIER") == 0)
+        {
+            mapCtrl.setTool("addBarrier");
+        }        
+//        else
+//        {
+//        	JOptionPane.showMessageDialog((JComponent) PluginServices.getMDIManager().getActiveWindow(), 
+//        			"Not implemented yet");
+//        }
+
+		
+	}
+
+	public boolean isEnabled() {
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if (window instanceof View)
+		{
+			View v = (View) window;
+	        MapControl mapCtrl = v.getMapControl();
+			MapContext map = mapCtrl.getMapContext();
+			
+			SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+				
+				if ( net != null)
+				{
+					return true;
+				}
+			}
+		}
+		return false;
+
+	}
+
+	public boolean isVisible() {
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if (window instanceof View)
+		{
+			View v = (View) window;
+	        MapControl mapCtrl = v.getMapControl();
+			MapContext map = mapCtrl.getMapContext();
+			
+			SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+				
+				if ( net != null)
+				{
+					return true;
+				}
+			}
+		}
+		return false;
+
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/NetworkAddFlag.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ClearFlagsExtension.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ClearFlagsExtension.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ClearFlagsExtension.java	(revision 12191)
@@ -0,0 +1,150 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.plugins.Extension;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
+import com.iver.cit.gvsig.graph.core.Network;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+
+public class ClearFlagsExtension extends Extension {
+
+	public void initialize() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void execute(String actionCommand) {
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if (window instanceof View)
+		{
+			View v = (View) window;
+	        MapControl mapCtrl = v.getMapControl();
+			MapContext map = mapCtrl.getMapContext();
+			
+			SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+				
+				if ( net != null)
+				{
+					if (actionCommand.equalsIgnoreCase("CLEAR_FLAGS"))
+					{
+						if (net.getFlags().length > 0)
+						{
+							net.removeFlags();
+							NetworkUtils.clearFlagsFromGraphics(mapCtrl);
+							mapCtrl.drawMap(false);
+						}
+					}
+				}
+			}
+		}
+		
+	}
+
+	public boolean isEnabled() {
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if (window instanceof View)
+		{
+			View v = (View) window;
+	        MapControl mapCtrl = v.getMapControl();
+			MapContext map = mapCtrl.getMapContext();
+			
+			SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+				
+				if ( net != null)
+				{
+					if (net.getFlags().length > 0)
+					{
+						return true;
+					}
+				}
+			}
+		}
+		return false;
+
+	}
+
+	public boolean isVisible() {
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if (window instanceof View)
+		{
+			View v = (View) window;
+	        MapControl mapCtrl = v.getMapControl();
+			MapContext map = mapCtrl.getMapContext();
+			
+			SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+				
+				if ( net != null)
+				{
+					return true;
+				}
+			}
+		}
+		return false;
+
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ClearFlagsExtension.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/GenerateNetworkExtension.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/GenerateNetworkExtension.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/GenerateNetworkExtension.java	(revision 12191)
@@ -0,0 +1,500 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph;
+
+import java.awt.Component;
+import java.io.File;
+import java.util.HashMap;
+
+import javax.swing.ImageIcon;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.messages.NotificationManager;
+import com.iver.andami.plugins.Extension;
+import com.iver.andami.preferences.IPreference;
+import com.iver.andami.preferences.IPreferenceExtension;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.drivers.SHPLayerDefinition;
+import com.iver.cit.gvsig.fmap.edition.EditionException;
+import com.iver.cit.gvsig.fmap.edition.IWriter;
+import com.iver.cit.gvsig.fmap.edition.ShpSchemaManager;
+import com.iver.cit.gvsig.fmap.edition.writers.dbf.DbfWriter;
+import com.iver.cit.gvsig.fmap.edition.writers.shp.MultiShpWriter;
+import com.iver.cit.gvsig.fmap.edition.writers.shp.ShpWriter;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLayers;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
+import com.iver.cit.gvsig.geoprocess.core.fmap.GeoprocessException;
+import com.iver.cit.gvsig.geoprocess.core.fmap.XTypes;
+import com.iver.cit.gvsig.graph.core.writers.NetworkFileRedWriter;
+import com.iver.cit.gvsig.graph.core.writers.NetworkGvTableWriter;
+import com.iver.cit.gvsig.graph.gui.wizard.NetWizard;
+import com.iver.cit.gvsig.graph.preferences.RoutePage;
+import com.iver.cit.gvsig.project.documents.view.IProjectView;
+import com.iver.cit.gvsig.project.documents.view.gui.IView;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+import com.iver.cit.gvsig.project.documents.view.toc.FLyrVectEditPropertiesTocMenuEntry2;
+import com.iver.cit.gvsig.topology.lineclean.fmap.LineCleanGeoprocess;
+import com.iver.utiles.SimpleFileFilter;
+import com.iver.utiles.extensionPoints.ExtensionPoint;
+import com.iver.utiles.extensionPoints.ExtensionPoints;
+import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
+import com.iver.utiles.swing.threads.AbstractMonitorableTask;
+import com.iver.utiles.swing.threads.IPipedTask;
+import com.iver.utiles.swing.threads.PipeTask;
+
+
+public class GenerateNetworkExtension extends Extension implements
+		IPreferenceExtension {
+	private static final IPreference thePreferencePage = new RoutePage();
+	public void initialize() {
+		ExtensionPoints extensionPoints = ExtensionPointsSingleton.getInstance();
+		((ExtensionPoint) extensionPoints.get("View_TocActions")).remove("FLyrVectEditProperties");
+		((ExtensionPoint) extensionPoints.get("View_TocActions")).remove("FLyrVectEditProperties2");
+		((ExtensionPoint) extensionPoints.get("View_TocActions")).put("FLyrVectEditProperties",new FLyrVectEditPropertiesTocMenuEntry2());
+    	//extensionPoints.add("View_TocActions","FLyrVectEditProperties2",new FLyrVectEditPropertiesTocMenuEntry2());
+		
+	}
+
+	public void execute(String actionCommand) {
+		IView view = (View) PluginServices.getMDIManager().getActiveWindow();
+		MapControl mapControl = view.getMapControl();
+		MapContext map = mapControl.getMapContext();
+		FLayers tocLyrs = map.getLayers();
+		SingleLayerIterator lyrIterator = new SingleLayerIterator(tocLyrs);
+		while (lyrIterator.hasNext()) {
+			FLayer lyr = lyrIterator.next();
+			if ((lyr.isActive()) && (lyr instanceof FLyrVect)) {
+				FLyrVect lyrVect = (FLyrVect) lyr;
+				int shapeType;
+				try {
+					shapeType = lyrVect.getShapeType();
+					if (shapeType == FShape.LINE) {
+						if (actionCommand.equalsIgnoreCase("GENERATE_RED")) {
+							generateRedNetwork(lyrVect, tocLyrs);
+							return;
+						}
+					}
+				} catch (DriverException e) {
+					e.printStackTrace();
+					NotificationManager.addError(e);
+				}
+
+			}
+		}
+
+	}
+
+	private void generateNetwork(FLyrVect lyr) {
+		NetworkGvTableWriter netBuilder = new NetworkGvTableWriter();
+		// Por ahora, a pelo, pero hay que sacar un cuadro
+		// de di�logo para hecer el mapping.
+		// Tambi�n un cuadro de di�logo para seleccionar
+		// en qu� tablas quiere escribir, y su formato
+		// (dbf, postgres, etc)
+		String fieldType = "tipored";
+		String fieldDist = "length";
+		String fieldSense = "sen";
+		String fieldCost = "cost";
+		try {
+			netBuilder.setLayer(lyr);
+			netBuilder.setFieldType(fieldType);
+			netBuilder.setFieldDist(fieldDist);
+			netBuilder.setFieldSense(fieldSense);
+			netBuilder.setFieldCost(fieldCost);
+			DbfWriter nodeWriter = new DbfWriter();
+			nodeWriter.setFile(new File("c:/nodes.dbf"));
+
+			DbfWriter edgeWriter = new DbfWriter();
+			edgeWriter.setFile(new File("c:/edges.dbf"));
+
+			netBuilder.setEdgeWriter(edgeWriter);
+			netBuilder.setNodeWriter(nodeWriter);
+
+			netBuilder.writeNetwork();
+		} catch (DriverException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		} catch (EditionException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}
+		JOptionPane.showMessageDialog(null, PluginServices
+				.getText(this, "done"));
+	}
+	
+	class GenerateRedNetworkAfterCleanTask 
+		extends AbstractMonitorableTask implements IPipedTask{
+		
+		File redFile;
+		NetworkFileRedWriter netBuilder;
+		
+		FLyrVect inputLayer;
+		FLyrVect pseudonodes;
+		FLayers tocLyrs;
+		
+		/**
+		 * Constructor
+		 * @param tocLyrs
+		 */
+		GenerateRedNetworkAfterCleanTask(NetworkFileRedWriter netBuilder, FLayers tocLyrs) {
+			this.netBuilder = netBuilder;
+			this.tocLyrs = tocLyrs;
+			setInitialStep(0);
+			setDeterminatedProcess(true);
+			setStatusMessage(PluginServices.getText(this,
+			"Generando_red_a_partir_de_capa_lineal"));
+		}
+
+		public void run() throws Exception {
+			int numShapes;
+			try { 	
+				numShapes = inputLayer.getSource().getShapeCount();
+				// lo del 10 es para que termine despu�s de 
+				// escribir los puntos
+				setFinalStep(numShapes + 10);
+				
+				
+			} catch (DriverIOException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+			netBuilder.setLayer(inputLayer);
+			netBuilder.setCancellableMonitorable(this);
+			netBuilder.setRedFile(redFile);
+			netBuilder.writeNetwork();
+			tocLyrs.addLayer(inputLayer);
+			tocLyrs.addLayer(pseudonodes);
+			enableControls();
+		}
+
+		public String getNote() {
+			String processText = PluginServices.getText(this, "Procesando_linea");
+			String of = PluginServices.getText(this, "de");
+			return processText + " " + getCurrentStep() + " " + of
+					+ " " + getFinishStep();
+		}
+
+		public void cancel() {
+			setCanceled(true);
+		}
+		
+		public boolean isFinished() {
+			return (getCurrentStep() >= getFinalStep());
+		}
+
+		/* (non-Javadoc)
+		 * @see com.iver.utiles.swing.threads.IPipedTask#getResult()
+		 */
+		public Object getResult() {
+			// TODO Auto-generated method stub
+			return null;
+		}
+
+		/**
+		 * Implementation of PipeTask interface
+		 * */
+		public void setEntry(Object object) {
+			//The previous task of this piped task is clean geoprocess
+			//whose result es FLayers with two layers
+			//first layer has cleaned layer
+			//and second layer has pseudonodes layer
+			FLayers layers  = (FLayers) object;
+			this.inputLayer = (FLyrVect) layers.getLayer(0);
+			inputLayer.createSpatialIndex();
+			this.redFile = NetworkUtils.getNetworkFile(inputLayer);
+			this.pseudonodes = (FLyrVect) layers.getLayer(1);
+		}
+	}
+	
+	public void enableControls(){
+		PluginServices.backgroundExecution(new Runnable(){
+			public void run() {
+				PluginServices.getMainFrame().enableControls();
+				
+			}});
+	}
+	
+
+	class GenerateRedNetworkTask extends AbstractMonitorableTask {
+		FLyrVect layer;
+
+		File redFile;
+
+		NetworkFileRedWriter netBuilder;
+		
+		
+
+		/**
+		 * Constructor
+		 */
+		GenerateRedNetworkTask(FLyrVect layer, File redFile,
+				NetworkFileRedWriter netBuilder) {
+			this.layer = layer;
+			if(! layer.isSpatiallyIndexed())
+				layer.createSpatialIndex();
+			
+			this.redFile = redFile;
+			this.netBuilder = netBuilder;
+			setInitialStep(0);
+			int numShapes;
+			try {
+				numShapes = layer.getSource().getShapeCount();
+				// lo del 10 es porque escribimos los nodos despu�s de
+				// los tramos.
+				setFinalStep(numShapes + 10);
+				setDeterminatedProcess(true);
+				setStatusMessage(PluginServices.getText(this,
+						"Generando_red_a_partir_de_capa_lineal"));
+			} catch (DriverIOException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+
+		}
+
+		public void run() throws Exception {
+			netBuilder.setLayer(layer);
+			netBuilder.setCancellableMonitorable(this);
+			netBuilder.setRedFile(redFile);
+			netBuilder.writeNetwork();
+			enableControls();
+		}
+
+		public String getNote() {
+			String processText = PluginServices.getText(this, "Procesando_linea");
+			String of = PluginServices.getText(this, "de");
+			return processText + " " + getCurrentStep() + " " + of
+					+ " " + getFinishStep();
+		}
+
+		public void cancel() {
+			setCanceled(true);
+		}
+		
+		public Object getResult(){
+			return null;
+		
+		}
+		public void setEntry(Object object){
+			this.layer = (FLyrVect) object;
+		}
+	}
+
+	/**
+	 * It returns a geoprocess to make a CLEAN of the input layer 
+	 * */
+	private LineCleanGeoprocess createCleanGeoprocess(FLyrVect lineLyr) {
+		 File outputFile = null;
+		 JOptionPane.showMessageDialog(null,
+				PluginServices.getText(null, "Especifique_fichero_shp_resultante"),
+				PluginServices.getText(null, "Fichero_para_capa_corregida"),
+				JOptionPane.INFORMATION_MESSAGE);
+		 JFileChooser jfc = new JFileChooser();
+		SimpleFileFilter filterShp = new SimpleFileFilter("shp", PluginServices
+				.getText(this, "shp_files"));
+		jfc.setFileFilter(filterShp);
+		if (jfc.showSaveDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) {
+			File newFile = jfc.getSelectedFile();
+			String path = newFile.getAbsolutePath();
+			if (newFile.exists()) {
+				int resp = JOptionPane.showConfirmDialog(
+						(Component) PluginServices.getMainFrame(),
+						PluginServices.getText(this,
+								"fichero_ya_existe_seguro_desea_guardarlo"),
+						PluginServices.getText(this, "guardar"),
+						JOptionPane.YES_NO_OPTION);
+				if (resp != JOptionPane.YES_OPTION) {
+					return null;
+				}
+			}// if
+			if (!(path.toLowerCase().endsWith(".shp"))) {
+				path = path + ".shp";
+			}
+			outputFile = new File(path);
+		} else {
+			return null;
+		}
+		LineCleanGeoprocess geoprocess = new LineCleanGeoprocess(lineLyr);
+		SHPLayerDefinition definition = (SHPLayerDefinition) geoprocess
+				.createLayerDefinition();
+		definition.setFile(outputFile);
+		ShpSchemaManager schemaManager = new ShpSchemaManager(outputFile
+				.getAbsolutePath());
+		IWriter writer = null;
+		try {
+			int shapeType = definition.getShapeType();
+			if (shapeType != XTypes.MULTI) {
+				writer = new ShpWriter();
+				((ShpWriter) writer).setFile(definition.getFile());
+				writer.initialize(definition);
+			} else {
+				writer = new MultiShpWriter();
+				((MultiShpWriter) writer).setFile(definition.getFile());
+				writer.initialize(definition);
+			}
+		} catch (Exception e1) {
+			String error = PluginServices.getText(this,
+					"Error_escritura_resultados");
+			String errorDescription = PluginServices.getText(this,
+					"Error_preparar_escritura_resultados");
+			return null;
+		}
+		geoprocess.setResultLayerProperties(writer, schemaManager);
+		HashMap params = new HashMap();
+		params.put("layer_selection", new Boolean(false));
+		try {
+			geoprocess.setParameters(params);
+			geoprocess.checkPreconditions();
+			return geoprocess;
+			
+		} catch (GeoprocessException e) {
+			String error = PluginServices.getText(this, "Error_ejecucion");
+			String errorDescription = PluginServices.getText(this,
+					"Error_fallo_geoproceso");
+			return null;
+		}
+
+	}
+
+	private void generateRedNetwork(FLyrVect lyr, FLayers tocLyrs) {
+		lyr.createSpatialIndex();
+		NetworkFileRedWriter netBuilder = new NetworkFileRedWriter();
+		// Por ahora, a pelo, pero hay que sacar un cuadro
+		// de di�logo para hecer el mapping.
+		// Tambi�n un cuadro de di�logo para seleccionar
+		// en qu� tablas quiere escribir, y su formato
+		// (dbf, postgres, etc)
+
+		ImageIcon icon = new ImageIcon(this.getClass().getClassLoader()
+				.getResource("images/net-wizard-logo.jpg"));
+
+		NetWizard wiz = new NetWizard(icon, lyr);
+		PluginServices.getMDIManager().addWindow(wiz);
+		if (!wiz.wasFinishPressed())
+			return;
+		// try {
+		String fieldType = wiz.getFieldType();
+		String fieldLength = wiz.getFieldLength();
+		String fieldCost = wiz.getFieldCost();
+		String fieldSense = wiz.getFieldSense();
+		netBuilder.setLayer(lyr);
+		netBuilder.setFieldType(fieldType);
+		netBuilder.setFieldDist(fieldLength);
+		netBuilder.setFieldSense(fieldSense);
+		netBuilder.setFieldCost(fieldCost);
+		File redFile = NetworkUtils.getNetworkFile(lyr);
+
+		boolean cleanOrigLyr = wiz.getCleanOriginalLayer();
+		LineCleanGeoprocess clean = null;
+		if(cleanOrigLyr)
+			clean = createCleanGeoprocess(lyr);
+		boolean applySnap = wiz.getApplySnapTolerance();
+		if(applySnap){
+			double snapTolerance = wiz.getSnapTolerance();
+			netBuilder.setSnapTolerance(snapTolerance);
+		}	
+		if(clean != null){
+			//we wont start the process of network creation
+			//until clean geoprocess will be finished
+			IPipedTask cleanTask = (IPipedTask) clean.createTask();
+			GenerateRedNetworkAfterCleanTask task = 
+				new GenerateRedNetworkAfterCleanTask(netBuilder, tocLyrs);
+			
+			PipeTask pipe = new PipeTask(cleanTask, (IPipedTask)task);
+			
+			PluginServices.cancelableBackgroundExecution(pipe);
+//			PluginServices.cancelableBackgroundExecution(task);
+			
+		}else{
+			GenerateRedNetworkTask task = new GenerateRedNetworkTask(lyr, redFile,
+					netBuilder);
+			PluginServices.cancelableBackgroundExecution(task);
+		}
+	}
+
+	public boolean isEnabled() {
+		return true;
+	}
+
+	public boolean isVisible() {
+		IWindow f = PluginServices.getMDIManager().getActiveWindow();
+
+		if (f == null) {
+			return false;
+		}
+
+		if (f instanceof View) {
+			View vista = (View) f;
+			IProjectView model = vista.getModel();
+			MapContext mapa = model.getMapContext();
+			FLayer[] activeLayers = mapa.getLayers().getActives();
+			if (activeLayers.length > 0)
+				if (activeLayers[0] instanceof FLyrVect) {
+					FLyrVect lyrVect = (FLyrVect) activeLayers[0];
+					int shapeType;
+					try {
+						shapeType = lyrVect.getShapeType();
+						if (shapeType == FShape.LINE)
+							return true;
+					} catch (DriverException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
+				}
+		}
+		return false;
+
+	}
+
+	public IPreference getPreferencesPage() {
+		return thePreferencePage;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/GenerateNetworkExtension.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ClearRouteExtension.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ClearRouteExtension.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ClearRouteExtension.java	(revision 12191)
@@ -0,0 +1,155 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph;
+
+import java.util.List;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.plugins.Extension;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
+import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
+import com.iver.cit.gvsig.fmap.rendering.FGraphic;
+import com.iver.cit.gvsig.graph.core.Network;
+import com.iver.cit.gvsig.graph.gui.RouteReportPanel;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+import com.iver.cit.gvsig.util.GvSession;
+
+public class ClearRouteExtension extends Extension {
+
+	public void initialize() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void execute(String actionCommand) {
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if (window instanceof View)
+		{
+			View v = (View) window;
+	        MapControl mapCtrl = v.getMapControl();
+			MapContext map = mapCtrl.getMapContext();
+			
+			SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+				
+				if ( net != null)
+				{
+					if (actionCommand.equalsIgnoreCase("CLEAR_ROUTES"))
+					{
+						NetworkUtils.clearRouteFromGraphics(mapCtrl);
+						GvSession.getInstance().delete(mapCtrl, "Route");
+						List reportPanels = (List) GvSession.
+												getInstance().
+												get(mapCtrl, "RouteReport");
+						if(reportPanels != null){
+							for(int i = 0; i < reportPanels.size(); i++){
+								PluginServices.getMDIManager().
+								closeWindow((RouteReportPanel)reportPanels.get(i));
+							}
+						}
+				
+						GvSession.getInstance().delete(mapCtrl, "RouteReport");
+						mapCtrl.drawMap(false);
+					}
+					
+				}
+			}
+		}
+		
+	}
+
+	public boolean isEnabled() {
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if (window instanceof View)
+		{
+			View v = (View) window;
+	        MapControl mapCtrl = v.getMapControl();
+	        GraphicLayer grafLayer = mapCtrl.getMapContext().getGraphicsLayer(); 
+	        for (int i=0; i < grafLayer.getNumGraphics(); i++)
+	        {
+	        	FGraphic graf = grafLayer.getGraphic(i);
+	        	if (graf.getTag() != null)
+	        		if (graf.getTag().compareTo("ROUTE") == 0)
+						return true;
+			}
+		}
+		return false;
+
+	}
+
+	public boolean isVisible() {
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if (window instanceof View)
+		{
+			View v = (View) window;
+	        MapControl mapCtrl = v.getMapControl();
+			MapContext map = mapCtrl.getMapContext();
+			
+			SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+				
+				if ( net != null)
+				{
+					return true;
+				}
+			}
+		}
+		return false;
+
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ClearRouteExtension.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ManageFlagsExtension.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ManageFlagsExtension.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ManageFlagsExtension.java	(revision 12191)
@@ -0,0 +1,182 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph;
+
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.plugins.Extension;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
+import com.iver.cit.gvsig.graph.core.Network;
+import com.iver.cit.gvsig.graph.gui.RouteControlPanel;
+import com.iver.cit.gvsig.project.documents.view.IProjectView;
+import com.iver.cit.gvsig.project.documents.view.gui.IView;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+import com.iver.cit.gvsig.util.GvSession;
+
+public class ManageFlagsExtension extends Extension {
+	/**
+	 * Component to control flags and routes
+	 * */
+	private RouteControlPanel controlPanel;
+	
+//	private String fieldType;
+//	private String fieldDist;
+//	private String fieldSense;
+
+	public void initialize() {
+	}
+
+	public void execute(String actionCommand) {
+		IView view = (View) PluginServices.getMDIManager().getActiveWindow();
+		MapControl mapControl = view.getMapControl();
+		MapContext map = mapControl.getMapContext();
+		SingleLayerIterator lyrIterator = new SingleLayerIterator(map
+				.getLayers());
+		while (lyrIterator.hasNext()) {
+			FLayer lyr = lyrIterator.next();
+			if ((lyr.isActive()) && (lyr instanceof FLyrVect))
+			{
+				FLyrVect lyrVect = (FLyrVect) lyr;
+				Network net = (Network) lyr.getProperty("network");
+
+				if ( net != null)
+				{
+					manageFlags(lyrVect, mapControl);
+				}
+			}
+		}
+
+
+	}
+
+	private void manageFlags(FLyrVect lyrVect, MapControl mapControl) {
+		Network net = (Network) lyrVect.getProperty("network");
+
+		if ( net != null)
+		{
+				if(controlPanel == null)
+				{
+				
+					controlPanel = new RouteControlPanel(net);
+				}
+				controlPanel.setMapControl(mapControl, net);
+				//lo guardamos en una variable de sesion para poder recuperarlo
+				//(ejemplo: cuando borremos los flags de la red de la capa activa
+				//borraremos a su vez el contenido del control panel		
+				controlPanel = (RouteControlPanel) PluginServices.getMDIManager().addWindow(controlPanel);
+				GvSession.getInstance().put(mapControl, "RouteControlPanel", controlPanel);
+		}
+		else
+		{
+			JOptionPane.showMessageDialog((JComponent) PluginServices.getMDIManager().getActiveWindow(),
+						PluginServices.getText(this, "la_capa_no_tiene_red_asociada"));
+		}
+	}
+
+	public boolean isEnabled() {
+		IWindow f = PluginServices.getMDIManager()
+		 .getActiveWindow();
+		if (f == null) {
+		    return false;
+		}
+		if (f instanceof View) {
+		    View v = (View) f;
+			MapContext map = v.getMapControl().getMapContext();
+			SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+
+				if ( net != null)
+				{
+					return true;
+				}
+			}
+			return false;
+
+		}
+		return false;
+
+	}
+
+	public boolean isVisible() {
+		IWindow f = PluginServices.getMDIManager().getActiveWindow();
+
+		if (f == null) {
+			return false;
+		}
+
+		if (f instanceof View) {
+			View vista = (View) f;
+			IProjectView model = vista.getModel();
+			MapContext mapa = model.getMapContext();
+			FLayer[] activeLayers = mapa.getLayers().getActives();
+			if (activeLayers.length > 0)
+				if (activeLayers[0] instanceof FLyrVect){
+					FLyrVect lyrVect = (FLyrVect) activeLayers[0];
+					int shapeType ;
+					try {
+						shapeType = lyrVect.getShapeType();
+						if (shapeType == FShape.LINE)
+							return true;
+					} catch (DriverException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
+				}	
+		}
+		return false;
+
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ManageFlagsExtension.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/ImageView.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/ImageView.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/ImageView.java	(revision 12191)
@@ -0,0 +1,874 @@
+/*
+ * Created on 20-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-10-20 19:54:01  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.graph.gui;
+
+import java.awt.*;
+import java.awt.event.*;
+import java.awt.image.ImageObserver;
+import java.io.*;
+import java.net.*;
+import java.util.Dictionary;
+import javax.swing.*;
+import javax.swing.text.*;
+import javax.swing.text.html.*;
+import javax.swing.event.*;
+
+import com.iver.cit.gvsig.geoprocess.wizard.GeoProcessingExtension;
+
+public class ImageView extends View implements ImageObserver, MouseListener, MouseMotionListener{
+
+ // --- Attribute Values ------------------------------------------
+    
+    public static final String
+    	TOP = "top",
+    	TEXTTOP = "texttop",
+    	MIDDLE = "middle",
+    	ABSMIDDLE = "absmiddle",
+    	CENTER = "center",
+    	BOTTOM = "bottom";
+    
+    Class pluginEnvironmentClass;
+    // --- Construction ----------------------------------------------
+
+    /**
+     * Creates a new view that represents an IMG element.
+     *
+     * @param elem the element to create a view for
+     */
+    public ImageView(Element elem, Class aClass) {
+    	super(elem);
+    	this.pluginEnvironmentClass = aClass;
+    	initialize(elem);
+	StyleSheet sheet = getStyleSheet();
+	attr = sheet.getViewAttributes(this);
+	
+    }
+    
+    
+    private void initialize( Element elem ) {
+	synchronized(this) {
+	    loading = true;
+	    fWidth = fHeight = 0;
+	}
+	int width = 0;
+	int height = 0;
+	boolean customWidth = false;
+	boolean customHeight = false;
+	try {
+	    fElement = elem;
+        
+	    // Request image from document's cache:
+	    AttributeSet attr = elem.getAttributes();
+            if (isURL()) {
+	      URL src = getSourceURL();
+	      if( src != null ) {
+		  Dictionary cache = (Dictionary) getDocument().getProperty(IMAGE_CACHE_PROPERTY);
+		  if( cache != null )
+		      fImage = (Image) cache.get(src);
+		  else
+		      fImage = Toolkit.getDefaultToolkit().getImage(src);
+	      }
+            }
+            else {
+
+              /******** Code to load from relative path *************/
+              String src =
+                (String) fElement.getAttributes().getAttribute
+                   (HTML.Attribute.SRC);
+//TODO
+// src = processSrcPath(src);
+              URL url = pluginEnvironmentClass.getClassLoader().getResource(src);
+              fImage = Toolkit.getDefaultToolkit().createImage(url);
+              try { waitForImage(); }
+              catch (InterruptedException e) { fImage = null; }
+              /******************************************************/
+
+            }
+	
+	    // Get height/width from params or image or defaults:
+	    height = getIntAttr(HTML.Attribute.HEIGHT,-1);
+	    customHeight = (height>0);
+	    if( !customHeight && fImage != null )
+		height = fImage.getHeight(this);
+	    if( height <= 0 )
+		height = DEFAULT_HEIGHT;
+		
+	    width = getIntAttr(HTML.Attribute.WIDTH,-1);
+	    customWidth = (width>0);
+	    if( !customWidth && fImage != null )
+		width = fImage.getWidth(this);
+	    if( width <= 0 )
+		width = DEFAULT_WIDTH;
+
+	    // Make sure the image starts loading:
+	    if( fImage != null )
+		if( customWidth && customHeight )
+		    Toolkit.getDefaultToolkit().prepareImage(fImage,height,
+							     width,this);
+		else
+		    Toolkit.getDefaultToolkit().prepareImage(fImage,-1,-1,
+							     this);
+	
+            /********************************************************
+            // Rob took this out. Changed scope of src.
+	    if( DEBUG ) {
+		if( fImage != null )
+		    System.out.println("ImageInfo: new on "+src+
+				       " ("+fWidth+"x"+fHeight+")");
+		else
+		    System.out.println("ImageInfo: couldn't get image at "+
+				       src);
+		if(isLink())
+		    System.out.println("           It's a link! Border = "+
+				       getBorder());
+		//((AbstractDocument.AbstractElement)elem).dump(System.out,4);
+	    }
+            ********************************************************/
+	} finally {
+	    synchronized(this) {
+		loading = false;
+		if (customWidth || fWidth == 0) {
+		    fWidth = width;
+		}
+		if (customHeight || fHeight == 0) {
+		    fHeight = height;
+		}
+	    }
+	}
+    }
+
+    /** Determines if path is in the form of a URL */
+    private boolean isURL() {
+        String src =
+          (String) fElement.getAttributes().getAttribute(HTML.Attribute.SRC);
+        return src.toLowerCase().startsWith("file") ||
+               src.toLowerCase().startsWith("http");
+    }    
+
+    /** Checks to see if the absolute path is availabe thru an application
+        global static variable or thru a system variable. If so, appends
+        the relative path to the absolute path and returns the String. */
+//    private String processSrcPath(String src) {
+//      String val = src; 
+//
+//      File imageFile = new File(src);
+//      if (imageFile.isAbsolute()) return src;
+//
+//      //try to get application images path...
+//      if (PicTest.ApplicationImagePath != null) {
+//        String imagePath = PicTest.ApplicationImagePath;
+//        val = (new File(imagePath, imageFile.getPath())).toString();
+//      }
+//      //try to get system images path...
+//      else {
+//        String imagePath = System.getProperty("system.image.path.key");
+//        if (imagePath != null) {
+//          val = (new File(imagePath, imageFile.getPath())).toString();
+//        }
+//      }
+//
+//      //System.out.println("src before: " + src + ", src after: " + val);
+//      return val;
+//    }
+
+    /** Added this guy to make sure an image is loaded - ie no broken 
+        images. So far its used only for images loaded off the disk (non-URL). 
+        It seems to work marvelously. By the way, it does the same thing as
+        MediaTracker, but you dont need to know the component its being 
+        rendered on. Rob */
+    private void waitForImage() throws InterruptedException { 
+      int w = fImage.getWidth(this);
+      int h = fImage.getHeight(this);
+
+      while (true) {
+        int flags = Toolkit.getDefaultToolkit().checkImage(fImage, w, h, this);
+
+        if ( ((flags & ERROR) != 0) || ((flags & ABORT) != 0 ) )
+          throw new InterruptedException();
+        else if ((flags & (ALLBITS | FRAMEBITS)) != 0) 
+          return;
+        Thread.sleep(10);
+        //System.out.println("rise and shine...");
+      }
+    }
+
+    
+    /**
+     * Fetches the attributes to use when rendering.  This is
+     * implemented to multiplex the attributes specified in the
+     * model with a StyleSheet.
+     */
+    public AttributeSet getAttributes() {
+	return attr;
+    }
+
+    /** Is this image within a link? */
+    boolean isLink( ) {
+        //! It would be nice to cache this but in an editor it can change
+        // See if I have an HREF attribute courtesy of the enclosing A tag:
+	AttributeSet anchorAttr = (AttributeSet)
+	    fElement.getAttributes().getAttribute(HTML.Tag.A);
+	if (anchorAttr != null) {
+	    return anchorAttr.isDefined(HTML.Attribute.HREF);
+	}
+	return false;
+    }
+    
+    /** Returns the size of the border to use. */
+    int getBorder( ) {
+        return getIntAttr(HTML.Attribute.BORDER, isLink() ?DEFAULT_BORDER :0);
+    }
+    
+    /** Returns the amount of extra space to add along an axis. */
+    int getSpace( int axis ) {
+    	return getIntAttr( axis==X_AXIS ?HTML.Attribute.HSPACE :HTML.Attribute.VSPACE,
+    			   0 );
+    }
+    
+    /** Returns the border's color, or null if this is not a link. */
+    Color getBorderColor( ) {
+    	StyledDocument doc = (StyledDocument) getDocument();
+        return doc.getForeground(getAttributes());
+    }
+    
+    /** Returns the image's vertical alignment. */
+    float getVerticalAlignment( ) {
+	String align = (String) fElement.getAttributes().getAttribute(HTML.Attribute.ALIGN);
+	if( align != null ) {
+	    align = align.toLowerCase();
+	    if( align.equals(TOP) || align.equals(TEXTTOP) )
+	        return 0.0f;
+	    else if( align.equals(this.CENTER) || align.equals(MIDDLE)
+					       || align.equals(ABSMIDDLE) )
+	        return 0.5f;
+	}
+	return 1.0f;		// default alignment is bottom
+    }
+    
+    boolean hasPixels( ImageObserver obs ) {
+        return fImage != null && fImage.getHeight(obs)>0
+			      && fImage.getWidth(obs)>0;
+    }
+    
+
+    /** Return a URL for the image source, 
+        or null if it could not be determined. */
+    private URL getSourceURL( ) {
+ 	String src = (String) fElement.getAttributes().getAttribute(HTML.Attribute.SRC);
+ 	if( src==null ) return null;
+
+	URL reference = ((HTMLDocument)getDocument()).getBase();
+        try {
+ 	    URL u = new URL(reference,src);
+	    return u;
+        } catch (MalformedURLException e) {
+	    return null;
+        }
+    }
+    
+    /** Look up an integer-valued attribute. <b>Not</b> recursive. */
+    private int getIntAttr(HTML.Attribute name, int deflt ) {
+    	AttributeSet attr = fElement.getAttributes();
+    	if( attr.isDefined(name) ) {		// does not check parents!
+    	    int i;
+ 	    String val = (String) attr.getAttribute(name);
+ 	    if( val == null )
+ 	    	i = deflt;
+ 	    else
+ 	    	try{
+ 	            i = Math.max(0, Integer.parseInt(val));
+ 	    	}catch( NumberFormatException x ) {
+ 	    	    i = deflt;
+ 	    	}
+	    return i;
+	} else
+	    return deflt;
+    }
+    
+
+    /**
+     * Establishes the parent view for this view.
+     * Seize this moment to cache the AWT Container I'm in.
+     */
+    public void setParent(View parent) {
+	super.setParent(parent);
+	fContainer = parent!=null ?getContainer() :null;
+	if( parent==null && fComponent!=null ) {
+	    fComponent.getParent().remove(fComponent);
+	    fComponent = null;
+	}
+    }
+
+    /** My attributes may have changed. */
+    public void changedUpdate(DocumentEvent e, Shape a, ViewFactory f) {
+if(DEBUG) System.out.println("ImageView: changedUpdate begin...");
+    	super.changedUpdate(e,a,f);
+    	float align = getVerticalAlignment();
+    	
+    	int height = fHeight;
+    	int width  = fWidth;
+    	
+    	initialize(getElement());
+    	
+    	boolean hChanged = fHeight!=height;
+    	boolean wChanged = fWidth!=width;
+    	if( hChanged || wChanged || getVerticalAlignment()!=align ) {
+    	    if(DEBUG) System.out.println("ImageView: calling preferenceChanged");
+    	    getParent().preferenceChanged(this,hChanged,wChanged);
+    	}
+if(DEBUG) System.out.println("ImageView: changedUpdate end; valign="+getVerticalAlignment());
+    }
+
+
+    // --- Painting --------------------------------------------------------
+
+    /**
+     * Paints the image.
+     *
+     * @param g the rendering surface to use
+     * @param a the allocated region to render into
+     * @see View#paint
+     */
+    public void paint(Graphics g, Shape a) {
+	Color oldColor = g.getColor();
+	fBounds = a.getBounds();
+        int border = getBorder();
+	int x = fBounds.x + border + getSpace(X_AXIS);
+	int y = fBounds.y + border + getSpace(Y_AXIS);
+	int width = fWidth;
+	int height = fHeight;
+	int sel = getSelectionState();
+	
+	// Make sure my Component is in the right place:
+/*
+	if( fComponent == null ) {
+	    fComponent = new Component() { };
+	    fComponent.addMouseListener(this);
+	    fComponent.addMouseMotionListener(this);
+	    fComponent.setCursor(Cursor.getDefaultCursor());	// use arrow cursor
+	    fContainer.add(fComponent);
+	}
+	fComponent.setBounds(x,y,width,height);
+	*/
+	// If no pixels yet, draw gray outline and icon:
+	if( ! hasPixels(this) ) {
+	    g.setColor(Color.lightGray);
+	    g.drawRect(x,y,width-1,height-1);
+	    g.setColor(oldColor);
+	    loadIcons();
+	    Icon icon = fImage==null ?sMissingImageIcon :sPendingImageIcon;
+	    if( icon != null )
+	        icon.paintIcon(getContainer(), g, x, y);
+	}
+		    
+	// Draw image:
+	if( fImage != null ) {
+	    g.drawImage(fImage,x, y,width,height,this);
+	    // Use the following instead of g.drawImage when
+	    // BufferedImageGraphics2D.setXORMode is fixed (4158822).
+
+	    //  Use Xor mode when selected/highlighted.
+	    //! Could darken image instead, but it would be more expensive.
+/*
+	    if( sel > 0 )
+	    	g.setXORMode(Color.white);
+	    g.drawImage(fImage,x, y,
+	    		width,height,this);
+	    if( sel > 0 )
+	        g.setPaintMode();
+*/
+	}
+	
+	// If selected exactly, we need a black border & grow-box:
+	Color bc = getBorderColor();
+	if( sel == 2 ) {
+	    // Make sure there's room for a border:
+	    int delta = 2-border;
+	    if( delta > 0 ) {
+	    	x += delta;
+	    	y += delta;
+	    	width -= delta<<1;
+	    	height -= delta<<1;
+	    	border = 2;
+	    }
+	    bc = null;
+	    g.setColor(Color.black);
+	    // Draw grow box:
+	    g.fillRect(x+width-5,y+height-5,5,5);
+	}
+
+	// Draw border:
+	if( border > 0 ) {
+	    if( bc != null ) g.setColor(bc);
+	    // Draw a thick rectangle:
+	    for( int i=1; i<=border; i++ )
+	        g.drawRect(x-i, y-i, width-1+i+i, height-1+i+i);
+	    g.setColor(oldColor);
+	}
+    }
+
+    /** Request that this view be repainted.
+        Assumes the view is still at its last-drawn location. */
+    protected void repaint( long delay ) {
+    	if( fContainer != null && fBounds!=null ) {
+	    fContainer.repaint(delay,
+	   	      fBounds.x,fBounds.y,fBounds.width,fBounds.height);
+    	}
+    }
+    
+    /** Determines whether the image is selected, and if it's the only thing selected.
+    	@return  0 if not selected, 1 if selected, 2 if exclusively selected.
+    		 "Exclusive" selection is only returned when editable. */
+    protected int getSelectionState( ) {
+    	int p0 = fElement.getStartOffset();
+    	int p1 = fElement.getEndOffset();
+	if (fContainer instanceof JTextComponent) {
+	    JTextComponent textComp = (JTextComponent)fContainer;
+	    int start = textComp.getSelectionStart();
+	    int end = textComp.getSelectionEnd();
+	    if( start<=p0 && end>=p1 ) {
+		if( start==p0 && end==p1 && isEditable() )
+		    return 2;
+		else
+		    return 1;
+	    }
+	}
+    	return 0;
+    }
+    
+    protected boolean isEditable( ) {
+    	return fContainer instanceof JEditorPane
+    	    && ((JEditorPane)fContainer).isEditable();
+    }
+    
+    /** Returns the text editor's highlight color. */
+    protected Color getHighlightColor( ) {
+    	JTextComponent textComp = (JTextComponent)fContainer;
+    	return textComp.getSelectionColor();
+    }
+
+    // --- Progressive display ---------------------------------------------
+    
+    // This can come on any thread. If we are in the process of reloading
+    // the image and determining our state (loading == true) we don't fire
+    // preference changed, or repaint, we just reset the fWidth/fHeight as
+    // necessary and return. This is ok as we know when loading finishes
+    // it will pick up the new height/width, if necessary.
+    public boolean imageUpdate( Image img, int flags, int x, int y,
+    				int width, int height ) {
+    	if( fImage==null || fImage != img )
+    	    return false;
+    	    
+    	// Bail out if there was an error:
+        if( (flags & (ABORT|ERROR)) != 0 ) {
+            fImage = null;
+            repaint(0);
+            return false;
+        }
+        
+        // Resize image if necessary:
+	short changed = 0;
+        if( (flags & ImageObserver.HEIGHT) != 0 )
+            if( ! getElement().getAttributes().isDefined(HTML.Attribute.HEIGHT) ) {
+		changed |= 1;
+            }
+        if( (flags & ImageObserver.WIDTH) != 0 )
+            if( ! getElement().getAttributes().isDefined(HTML.Attribute.WIDTH) ) {
+		changed |= 2;
+            }
+	synchronized(this) {
+	    if ((changed & 1) == 1) {
+		fWidth = width;
+	    }
+	    if ((changed & 2) == 2) {
+		fHeight = height;
+	    }
+	    if (loading) {
+		// No need to resize or repaint, still in the process of
+		// loading.
+		return true;
+	    }
+	}
+        if( changed != 0 ) {
+            // May need to resize myself, asynchronously:
+            if( DEBUG ) System.out.println("ImageView: resized to "+fWidth+"x"+fHeight);
+	    
+	    Document doc = getDocument();
+	    try {
+	      if (doc instanceof AbstractDocument) {
+		((AbstractDocument)doc).readLock();
+	      }
+	      preferenceChanged(this,true,true);
+	    } finally {
+	      if (doc instanceof AbstractDocument) {
+		((AbstractDocument)doc).readUnlock();
+	      }
+	    }			
+	      
+	    return true;
+        }
+	
+	// Repaint when done or when new pixels arrive:
+	if( (flags & (FRAMEBITS|ALLBITS)) != 0 )
+	    repaint(0);
+	else if( (flags & SOMEBITS) != 0 )
+	    if( sIsInc )
+	        repaint(sIncRate);
+        
+        return ((flags & ALLBITS) == 0);
+    }
+					  /*        
+    /**
+     * Static properties for incremental drawing.
+     * Swiped from Component.java
+     * @see #imageUpdate
+     */
+    private static boolean sIsInc = true;
+    private static int sIncRate = 100;
+
+    // --- Layout ----------------------------------------------------------
+
+    /**
+     * Determines the preferred span for this view along an
+     * axis.
+     *
+     * @param axis may be either X_AXIS or Y_AXIS
+     * @returns  the span the view would like to be rendered into.
+     *           Typically the view is told to render into the span
+     *           that is returned, although there is no guarantee.  
+     *           The parent may choose to resize or break the view.
+     */
+    public float getPreferredSpan(int axis) {
+//if(DEBUG)System.out.println("ImageView: getPreferredSpan");
+        int extra = 2*(getBorder()+getSpace(axis));
+	switch (axis) {
+	case View.X_AXIS:
+	    return fWidth+extra;
+	case View.Y_AXIS:
+	    return fHeight+extra;
+	default:
+	    throw new IllegalArgumentException("Invalid axis: " + axis);
+	}
+    }
+
+    /**
+     * Determines the desired alignment for this view along an
+     * axis.  This is implemented to give the alignment to the
+     * bottom of the icon along the y axis, and the default
+     * along the x axis.
+     *
+     * @param axis may be either X_AXIS or Y_AXIS
+     * @returns the desired alignment.  This should be a value
+     *   between 0.0 and 1.0 where 0 indicates alignment at the
+     *   origin and 1.0 indicates alignment to the full span
+     *   away from the origin.  An alignment of 0.5 would be the
+     *   center of the view.
+     */
+    public float getAlignment(int axis) {
+	switch (axis) {
+	case View.Y_AXIS:
+	    return getVerticalAlignment();
+	default:
+	    return super.getAlignment(axis);
+	}
+    }
+
+    /**
+     * Provides a mapping from the document model coordinate space
+     * to the coordinate space of the view mapped to it.
+     *
+     * @param pos the position to convert
+     * @param a the allocated region to render into
+     * @return the bounding box of the given position
+     * @exception BadLocationException  if the given position does not represent a
+     *   valid location in the associated document
+     * @see View#modelToView
+     */
+    public Shape modelToView(int pos, Shape a, Position.Bias b) throws BadLocationException {
+	int p0 = getStartOffset();
+	int p1 = getEndOffset();
+	if ((pos >= p0) && (pos <= p1)) {
+	    Rectangle r = a.getBounds();
+	    if (pos == p1) {
+		r.x += r.width;
+	    }
+	    r.width = 0;
+	    return r;
+	}
+	return null;
+    }
+
+    /**
+     * Provides a mapping from the view coordinate space to the logical
+     * coordinate space of the model.
+     *
+     * @param x the X coordinate
+     * @param y the Y coordinate
+     * @param a the allocated region to render into
+     * @return the location within the model that best represents the
+     *  given point of view
+     * @see View#viewToModel
+     */
+    public int viewToModel(float x, float y, Shape a, Position.Bias[] bias) {
+	Rectangle alloc = (Rectangle) a;
+	if (x < alloc.x + alloc.width) {
+	    bias[0] = Position.Bias.Forward;
+	    return getStartOffset();
+	}
+	bias[0] = Position.Bias.Backward;
+	return getEndOffset();
+    }
+
+    /**
+     * Set the size of the view. (Ignored.)
+     *
+     * @param width the width
+     * @param height the height
+     */
+    public void setSize(float width, float height) {
+    	// Ignore this -- image size is determined by the tag attrs and
+    	// the image itself, not the surrounding layout!
+    }
+    
+    /** Change the size of this image. This alters the HEIGHT and WIDTH
+    	attributes of the Element and causes a re-layout. */
+    protected void resize( int width, int height ) {
+    	if( width==fWidth && height==fHeight )
+    	    return;
+    	
+    	fWidth = width;
+    	fHeight= height;
+    	
+    	// Replace attributes in document:
+	MutableAttributeSet attr = new SimpleAttributeSet();
+	attr.addAttribute(HTML.Attribute.WIDTH ,Integer.toString(width));
+	attr.addAttribute(HTML.Attribute.HEIGHT,Integer.toString(height));
+	((StyledDocument)getDocument()).setCharacterAttributes(
+			fElement.getStartOffset(),
+			fElement.getEndOffset(),
+			attr, false);
+    }
+    
+    // --- Mouse event handling --------------------------------------------
+    
+    /** Select or grow image when clicked. */
+    public void mousePressed(MouseEvent e){
+    	Dimension size = fComponent.getSize();
+    	if( e.getX() >= size.width-7 && e.getY() >= size.height-7
+    			&& getSelectionState()==2 ) {
+    	    // Click in selected grow-box:
+    	    if(DEBUG)System.out.println("ImageView: grow!!! Size="+fWidth+"x"+fHeight);
+    	    Point loc = fComponent.getLocationOnScreen();
+    	    fGrowBase = new Point(loc.x+e.getX() - fWidth,
+    	    			  loc.y+e.getY() - fHeight);
+    	    fGrowProportionally = e.isShiftDown();
+    	} else {
+    	    // Else select image:
+    	    fGrowBase = null;
+    	    JTextComponent comp = (JTextComponent)fContainer;
+    	    int start = fElement.getStartOffset();
+    	    int end = fElement.getEndOffset();
+    	    int mark = comp.getCaret().getMark();
+    	    int dot  = comp.getCaret().getDot();
+    	    if( e.isShiftDown() ) {
+    	    	// extend selection if shift key down:
+    	    	if( mark <= start )
+    	    	    comp.moveCaretPosition(end);
+    	    	else
+    	    	    comp.moveCaretPosition(start);
+    	    } else {
+    	    	// just select image, without shift:
+    	    	if( mark!=start )
+    	            comp.setCaretPosition(start);
+    	        if( dot!=end )
+    	            comp.moveCaretPosition(end);
+    	    }
+    	}
+    }
+    
+    /** Resize image if initial click was in grow-box: */
+    public void mouseDragged(MouseEvent e ) {
+    	if( fGrowBase != null ) {
+    	    Point loc = fComponent.getLocationOnScreen();
+    	    int width = Math.max(2, loc.x+e.getX() - fGrowBase.x);
+    	    int height= Math.max(2, loc.y+e.getY() - fGrowBase.y);
+    	    
+    	    if( e.isShiftDown() && fImage!=null ) {
+    	    	// Make sure size is proportional to actual image size:
+    	    	float imgWidth = fImage.getWidth(this);
+    	    	float imgHeight = fImage.getHeight(this);
+    	    	if( imgWidth>0 && imgHeight>0 ) {
+    	    	    float prop = imgHeight / imgWidth;
+    	    	    float pwidth = height / prop;
+    	    	    float pheight= width * prop;
+    	    	    if( pwidth > width )
+    	    	        width = (int) pwidth;
+    	    	    else
+    	    	        height = (int) pheight;
+    	    	}
+    	    }
+    	    
+    	    resize(width,height);
+    	}
+    }
+
+    public void mouseReleased(MouseEvent e){
+    	fGrowBase = null;
+    	//! Should post some command to make the action undo-able
+    }
+
+    /** On double-click, open image properties dialog. */
+    public void mouseClicked(MouseEvent e){
+    	if( e.getClickCount() == 2 ) {
+    	    //$ IMPLEMENT
+    	}
+    }
+
+    public void mouseEntered(MouseEvent e){
+    }
+    public void mouseMoved(MouseEvent e ) {
+    }
+    public void mouseExited(MouseEvent e){
+    }
+    
+    // --- Static icon accessors -------------------------------------------
+
+    private Icon makeIcon(final String gifFile) throws IOException {
+        /* Copy resource into a byte array.  This is
+         * necessary because several browsers consider
+         * Class.getResource a security risk because it
+         * can be used to load additional classes.
+         * Class.getResourceAsStream just returns raw
+         * bytes, which we can convert to an image.
+         */
+	InputStream resource = ImageView.class.getResourceAsStream(gifFile);
+
+        if (resource == null) {
+            System.err.println(ImageView.class.getName() + "/" + 
+                               gifFile + " not found.");
+            return null; 
+        }
+        BufferedInputStream in = 
+            new BufferedInputStream(resource);
+        ByteArrayOutputStream out = 
+            new ByteArrayOutputStream(1024);
+        byte[] buffer = new byte[1024];
+        int n;
+        while ((n = in.read(buffer)) > 0) {
+            out.write(buffer, 0, n);
+        }
+        in.close();
+        out.flush();
+
+        buffer = out.toByteArray();
+        if (buffer.length == 0) {
+            System.err.println("warning: " + gifFile + 
+                               " is zero-length");
+            return null;
+        }
+        return new ImageIcon(buffer);
+    }
+
+    private void loadIcons( ) {
+        try{
+            if( sPendingImageIcon == null )
+            	sPendingImageIcon = makeIcon(PENDING_IMAGE_SRC);
+            if( sMissingImageIcon == null )
+            	sMissingImageIcon = makeIcon(MISSING_IMAGE_SRC);
+	}catch( Exception x ) {
+	    System.err.println("ImageView: Couldn't load image icons");
+	}
+    }
+    
+    protected StyleSheet getStyleSheet() {
+	HTMLDocument doc = (HTMLDocument) getDocument();
+	return doc.getStyleSheet();
+    }
+
+    // --- member variables ------------------------------------------------
+
+    private AttributeSet attr;
+    private Element   fElement;
+    private Image     fImage;
+    private int       fHeight,fWidth;
+    private Container fContainer;
+    private Rectangle fBounds;
+    private Component fComponent;
+    private Point     fGrowBase;        // base of drag while growing image
+    private boolean   fGrowProportionally;	// should grow be proportional?
+    /** Set to true, while the receiver is locked, to indicate the reciever
+     * is loading the image. This is used in imageUpdate. */
+    private boolean   loading;
+    
+    // --- constants and static stuff --------------------------------
+
+    private static Icon sPendingImageIcon,
+    			sMissingImageIcon;
+    private static final String
+        PENDING_IMAGE_SRC = "icons/image-delayed.gif",  // both stolen from HotJava
+        MISSING_IMAGE_SRC = "icons/image-failed.gif";
+    
+    private static final boolean DEBUG = false;
+    
+    //$ move this someplace public
+    static final String IMAGE_CACHE_PROPERTY = "imageCache";
+    
+    // Height/width to use before we know the real size:
+    private static final int
+        DEFAULT_WIDTH = 32,
+        DEFAULT_HEIGHT= 32,
+    // Default value of BORDER param:      //? possibly move into stylesheet?
+        DEFAULT_BORDER=  2;
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/ImageView.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/RouteControlPanel.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/RouteControlPanel.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/RouteControlPanel.java	(revision 12191)
@@ -0,0 +1,1228 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.25.2.4  2007-06-14 10:02:25  fjp
+ * Pliego de redes a publicar SIN el cuadro de di�logo setVelocities (bueno, con , pero invisible)
+ *
+ * Revision 1.25.2.3  2007/05/24 11:33:36  fjp
+ * Para que puedas a�adir los puntos que est�n cerca de la red. Los que no lo est�n, lanzan un error informando de qu� punto no est� cerca de la red.
+ *
+ * Revision 1.25.2.2  2007/05/15 07:08:21  fjp
+ * Para calcular matrices de distancias
+ *
+ * Revision 1.25  2006/11/14 18:32:32  fjp
+ * *** empty log message ***
+ *
+ * Revision 1.24  2006/11/14 16:12:01  fjp
+ * *** empty log message ***
+ *
+ * Revision 1.23  2006/11/14 09:23:30  fjp
+ * cargar paradas desde cualquier tema de puntos
+ *
+ * Revision 1.22  2006/11/10 13:57:04  fjp
+ * *** empty log message ***
+ *
+ * Revision 1.21  2006/11/09 21:08:32  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.20  2006/11/09 12:51:12  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.19  2006/11/09 11:00:43  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.18  2006/11/09 10:59:53  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.17  2006/11/09 10:27:50  fjp
+ * *** empty log message ***
+ *
+ * Revision 1.16  2006/11/09 10:24:11  fjp
+ * *** empty log message ***
+ *
+ * Revision 1.15  2006/11/09 09:16:35  fjp
+ * Ya va!!
+ *
+ * Revision 1.14  2006/11/08 20:14:52  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.13  2006/11/08 19:32:22  azabala
+ * saveroute and saveflags modifications
+ *
+ * Revision 1.12  2006/11/08 18:16:28  fjp
+ * *** empty log message ***
+ *
+ * Revision 1.11  2006/11/08 16:48:19  fjp
+ * *** empty log message ***
+ *
+ * Revision 1.10  2006/11/08 16:00:39  fjp
+ * Por terminar el enlace flags-cuadro de di�logo
+ *
+ * Revision 1.9  2006/11/08 13:18:46  fjp
+ * Por terminar el enlace flags-cuadro de di�logo
+ *
+ * Revision 1.8  2006/11/07 19:49:38  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.7  2006/11/06 13:13:53  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.6  2006/11/06 10:29:32  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.5  2006/11/03 19:39:29  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.4  2006/10/27 18:26:22  azabala
+ * added implementation of load stages method
+ *
+ * Revision 1.3  2006/10/27 12:41:09  jaume
+ * GUI
+ *
+ * Revision 1.2  2006/10/26 16:31:21  jaume
+ * GUI
+ *
+ * Revision 1.1  2006/10/25 10:50:41  jaume
+ * movement of classes and gui stuff
+ *
+ * Revision 1.4  2006/10/24 08:04:41  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.3  2006/10/23 16:00:20  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.2  2006/10/23 08:05:39  jaume
+ * GUI
+ *
+ * Revision 1.1  2006/10/20 12:02:50  jaume
+ * GUI
+ *
+ *
+ */
+package com.iver.cit.gvsig.graph.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.Dimension;
+import java.awt.FlowLayout;
+import java.awt.Font;
+import java.awt.GridLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.geom.Rectangle2D;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Hashtable;
+import java.util.List;
+
+import javax.swing.ImageIcon;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.ListSelectionModel;
+import javax.swing.event.ListSelectionEvent;
+import javax.swing.event.ListSelectionListener;
+import javax.swing.event.TableModelEvent;
+import javax.swing.event.TableModelListener;
+import javax.swing.table.AbstractTableModel;
+import javax.swing.table.TableColumnModel;
+import javax.swing.table.TableModel;
+
+import org.cresques.cts.IProjection;
+import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
+import org.gvsig.gui.beans.swing.JBlank;
+import org.gvsig.gui.beans.swing.JButton;
+
+import com.hardcode.gdbms.engine.values.Value;
+import com.hardcode.gdbms.engine.values.ValueFactory;
+import com.iver.andami.PluginServices;
+import com.iver.andami.messages.NotificationManager;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.andami.ui.mdiManager.SingletonWindow;
+import com.iver.andami.ui.mdiManager.WindowInfo;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.ViewPort;
+import com.iver.cit.gvsig.fmap.core.DefaultFeature;
+import com.iver.cit.gvsig.fmap.core.FPoint2D;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.ShapeFactory;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.edition.EditionException;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLayers;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.LayerEvent;
+import com.iver.cit.gvsig.fmap.layers.LayerFactory;
+import com.iver.cit.gvsig.fmap.layers.LayerListenerAdapter;
+import com.iver.cit.gvsig.fmap.layers.ReadableVectorial;
+import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
+import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
+import com.iver.cit.gvsig.graph.GraphException;
+import com.iver.cit.gvsig.graph.NetworkUtils;
+import com.iver.cit.gvsig.graph.core.GvEdge;
+import com.iver.cit.gvsig.graph.core.GvFlag;
+import com.iver.cit.gvsig.graph.core.IFlagListener;
+import com.iver.cit.gvsig.graph.core.Network;
+import com.iver.cit.gvsig.graph.solvers.FlagsMemoryDriver;
+import com.iver.cit.gvsig.graph.solvers.Route;
+import com.iver.cit.gvsig.graph.solvers.RouteMemoryDriver;
+import com.iver.cit.gvsig.graph.tools.FlagListener;
+import com.iver.cit.gvsig.project.documents.gui.FOpenDialog;
+import com.iver.cit.gvsig.project.documents.view.gui.IView;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+import com.iver.cit.gvsig.util.GvSession;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.MultiPoint;
+import com.vividsolutions.jts.geom.Point;
+
+public class RouteControlPanel extends JPanel implements SingletonWindow,
+		ActionListener, IFlagListener {
+	WindowInfo wi;
+
+	private JPanel westPanel = null;
+
+	private JScrollPane scrlStages = null;
+
+	private JTable tblStages = null;
+
+	private GridBagLayoutPanel eastPanel = null;
+
+	private MyTableModel tableModel = new MyTableModel(); // @jve:decl-index=0:visual-constraint=""
+
+	private JButton btnLoadStage = null;
+
+	private JButton btnSaveStage = null;
+	
+	private JButton btnSetVelocities = null;
+
+	private Network network;
+
+	private ArrayList routeFlags;
+
+	private JLabel lblCost;
+
+	private JLabel lblFlagAmout;
+
+	private JButton btnPullDownStage;
+
+	private JButton btnPushUpStage;
+
+	private JButton btnRemoveStage;
+
+	private JPanel southPanel;
+
+	private final String[] colName = new String[] {
+			PluginServices.getText(this, "enable"),
+			PluginServices.getText(this, "stage"),
+			PluginServices.getText(this, "cost"), };
+
+	private JButton btnCenterOnFlag;
+
+	private JButton btnSaveRoute;
+
+	private MapControl mapCtrl;
+
+	private class MyTableModel extends AbstractTableModel {
+		public int getColumnCount() {
+			return 3;
+		}
+
+		public int getRowCount() {
+			return _getFlags().size();
+		}
+
+		public Object getValueAt(int rowIndex, int columnIndex) {
+			GvFlag flag = (GvFlag) _getFlags().get(rowIndex);
+			switch (columnIndex) {
+			case 0:
+				return new Boolean(flag.isEnabled());
+			case 1:
+				return flag.getDescription();
+			case 2:
+				return new Double(flag.getCost());
+			}
+
+			return null;
+		}
+
+		public Class getColumnClass(int columnIndex) {
+			switch (columnIndex)
+			{
+			case 0:
+				return Boolean.class;
+			case 1:
+				return String.class;
+			case 2:
+				return Double.class;
+
+			}
+			return super.getColumnClass(columnIndex);
+		}
+
+		public String getColumnName(int column) {
+			return colName[column];
+		}
+
+		public boolean isCellEditable(int rowIndex, int columnIndex) {
+			if (columnIndex == 2)
+				return false;
+			return true;
+
+		}
+
+		public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
+			GvFlag flag = (GvFlag) _getFlags().get(rowIndex);
+			switch (columnIndex)
+			{
+			case 0:
+				Boolean bAux = (Boolean) aValue;
+				flag.setEnabled(bAux.booleanValue());
+				PluginServices.getMainFrame().enableControls();
+				return;
+			case 1:
+				String strAux = (String) aValue;
+				flag.setDescription(strAux);
+				return;
+
+//			case 2: // No es editable
+//				Double dblAux = (Double) aValue;
+//				flag.setCost(dblAux.doubleValue());
+//				return;
+
+			}
+
+		}
+
+	}
+
+	/**
+	 * This method initializes
+	 *
+	 */
+	public RouteControlPanel(Network network) {
+		super();
+		this.network = network;
+//		GvFlag[] flags = network.getFlags();
+//		List vflags = _getFlags();
+//		for (int i = 0; i < flags.length; i++) {
+//			vflags.add(flags[i]);
+//		}
+		initialize();
+	}
+
+	/**
+	 * Method to remove all flags (use
+	 * */
+	public void refresh(){
+//		GvFlag[] flags = network.getFlags();
+//		List vflags = _getFlags();
+//		List tempFlags = Arrays.asList(flags);
+//		vflags.addAll(tempFlags);
+		lblFlagAmout.setText(String.valueOf(_getFlags()
+				.size()));
+		updateTotalCost();
+		ListSelectionModel rowSM = tblStages.getSelectionModel();
+		if (_getFlags().size() == 0)
+			getBtnCenterOnFlag().setEnabled(false);
+		else
+			getBtnCenterOnFlag().setEnabled(!rowSM.isSelectionEmpty());
+		getTblStages().revalidate();
+		System.out.println("Actualizo tabla");
+
+	}
+	private void processLayer(FLayer layer) {
+		if (layer.isActive()) {
+			if (layer instanceof FLyrVect) {
+				Network net = (Network) layer
+						.getProperty("network");
+				if (net != null) {
+					network = net;
+					network.addFlagListener(this);
+					refresh();
+				}// if
+			}// if
+		}// if
+
+	}
+
+	public void setMapControl(MapControl mapCtrl, Network net) {
+		if (mapCtrl != null) {
+			this.mapCtrl = mapCtrl;
+			LayerListenerAdapter listener = new LayerListenerAdapter() {
+				public void activationChanged(LayerEvent e) {
+					processLayer(e.getSource());
+				}
+			};
+			mapCtrl.getMapContext().getLayers().addLayerListener(listener);
+			mapCtrl.getMapContext().getLayers().addLayerCollectionListener(
+					listener);
+			if (net != null) {
+				network = net;
+				network.addFlagListener(this);
+			}
+		}
+	}
+
+	public RouteControlPanel() {
+		super();
+		initialize();
+	}
+
+	public void setCostUnits(String unitsName) {
+		colName[2] = unitsName;
+		getTblStages().repaint();
+	}
+
+	/**
+	 * This method initializes this
+	 *
+	 */
+	private void initialize() {
+		BorderLayout borderLayout = new BorderLayout();
+		borderLayout.setHgap(10);
+		borderLayout.setVgap(10);
+		JPanel cont = new JPanel(borderLayout);
+//		cont.setPreferredSize(new Dimension(490, 320));
+		this.setPreferredSize(new Dimension(460, 280));
+		cont.add(getWestPanel(), BorderLayout.CENTER);
+		cont.add(getEastPanel(), BorderLayout.EAST);
+		cont.add(getSouthPanel(), BorderLayout.SOUTH);
+		this.setLayout(new FlowLayout(FlowLayout.LEADING, 10, 10));
+		this.add(cont);
+		updateFlags();
+	}
+
+	private void updateFlags() {
+		lblFlagAmout.setText(String.valueOf(_getFlags().size()));
+		updateTotalCost();
+		getTblStages().repaint();
+	}
+
+	private JPanel getSouthPanel() {
+		if (southPanel == null) {
+			southPanel = new JPanel(new FlowLayout(FlowLayout.LEADING));
+			southPanel.add(getBtnRemoveStage());
+			southPanel.add(new JBlank(50, 20));
+			southPanel.add(getBtnPushUpStage());
+			southPanel.add(getBtnPullDownStage());
+			southPanel.add(new JLabel(PluginServices.getText(this,
+					"flag_amount")));
+			lblFlagAmout = new JLabel();
+			lblFlagAmout.setFont(lblFlagAmout.getFont().deriveFont(Font.BOLD));
+			southPanel.add(lblFlagAmout);
+		}
+		return southPanel;
+	}
+
+	public Object getWindowModel() {
+		return this.getClass();
+	}
+
+	public WindowInfo getWindowInfo() {
+		if (wi == null) {
+			wi = new WindowInfo(WindowInfo.MODELESSDIALOG
+				    | WindowInfo.MAXIMIZABLE
+					| WindowInfo.ICONIFIABLE | WindowInfo.PALETTE);
+			wi.setWidth((int) this.getPreferredSize().getWidth());
+			wi.setHeight((int) this.getPreferredSize().getHeight());
+			wi.setTitle(PluginServices.getText(this, "route_control_panel"));
+		}
+		return wi;
+	}
+
+	/**
+	 * This method initializes westPanel
+	 *
+	 * @return javax.swing.JPanel
+	 */
+	private JPanel getWestPanel() {
+		if (westPanel == null) {
+			westPanel = new JPanel(new BorderLayout(5, 5));
+			lblCost = new JLabel();
+			lblCost.setFont(lblCost.getFont().deriveFont(Font.BOLD));
+			GridBagLayoutPanel aux = new GridBagLayoutPanel();
+			aux.addComponent(PluginServices.getText(this, "total_route_cost")
+					+ ":", lblCost);
+			aux.addComponent(getScrlStages());
+
+			westPanel.add(aux);
+		}
+		return westPanel;
+	}
+
+	private JButton getBtnPullDownStage() {
+		if (btnPullDownStage == null) {
+			btnPullDownStage = new JButton(new ImageIcon(this.getClass()
+					.getClassLoader().getResource("images/down-arrow.png")));
+			// btnPullDownStage.setName("btnPullDownStage");
+			btnPullDownStage.addActionListener(this);
+		}
+		return btnPullDownStage;
+	}
+
+	private JButton getBtnPushUpStage() {
+		if (btnPushUpStage == null) {
+			btnPushUpStage = new JButton(new ImageIcon(this.getClass()
+					.getClassLoader().getResource("images/up-arrow.png")));
+			// btnPushUpStage.setName("btnPushUpStage");
+			btnPushUpStage.addActionListener(this);
+		}
+		return btnPushUpStage;
+	}
+
+	private JButton getBtnRemoveStage() {
+		if (btnRemoveStage == null) {
+			btnRemoveStage = new JButton(new ImageIcon(this.getClass()
+					.getClassLoader().getResource("images/delete.png")));
+			// btnRemoveStage.setName("btnRemoveStage");
+			btnRemoveStage.addActionListener(this);
+		}
+		return btnRemoveStage;
+	}
+
+	/**
+	 * This method initializes scrlStages
+	 *
+	 * @return javax.swing.JScrollPane
+	 */
+	private JScrollPane getScrlStages() {
+		if (scrlStages == null) {
+			scrlStages = new JScrollPane();
+			scrlStages.setViewportView(getTblStages());
+			scrlStages.setPreferredSize(new Dimension(270, 200));
+		}
+		return scrlStages;
+	}
+
+	/**
+	 * @deprecated
+	 * @param flag
+	 */
+	public void addFlag(GvFlag flag) {
+		_getFlags().add(flag);
+		lblFlagAmout.setText(String.valueOf(_getFlags().size()));
+		updateTotalCost();
+		getTblStages().repaint();
+	}
+
+	private void updateTotalCost() {
+		GvFlag[] flags = getFlags();
+		double cost = 0;
+		for (int i = 0; i < flags.length; i++) {
+			if (!flags[i].isEnabled())
+				continue;
+			if (flags[i].getCost() >= Double.MAX_VALUE)
+			{
+				lblCost.setText(PluginServices.getText(this, "no_se_puede_pasar_por_todas_las_paradas"));
+				return;
+			}
+			if (flags[i].getCost() < 0)
+			{
+				lblCost.setText(PluginServices.getText(this, "solucion_no_valida"));
+				return;
+			}
+				
+			cost += flags[i].getCost();
+		}
+		NumberFormat nf = NumberFormat.getInstance();
+		nf.setMaximumFractionDigits(2);
+		lblCost.setText(nf.format(cost) + getCostUnitName());
+	}
+
+	private String getCostUnitName() {
+		if (colName[2].equals(PluginServices.getText(this, "cost")))
+			return "";
+		return colName[2];
+	}
+
+	public void removeFlag(GvFlag flag) {
+		removeFlag(_getFlags().indexOf(flag));
+	}
+
+	public void removeFlag(int index) {
+		_getFlags().remove(index);
+		lblFlagAmout.setText(String.valueOf(_getFlags().size()));
+		getTblStages().repaint();
+	}
+
+	/**
+	 * This method initializes tblStages
+	 *
+	 * @return javax.swing.JTable
+	 */
+	private JTable getTblStages() {
+		if (tblStages == null) {
+			tblStages = new JTable();
+			tblStages
+					.setAutoResizeMode(javax.swing.JTable.AUTO_RESIZE_SUBSEQUENT_COLUMNS);
+			tblStages.setModel(getTableModel());
+			TableColumnModel cm = tblStages.getColumnModel();
+
+			int tablePreferredWidth = (int) tblStages.getPreferredSize()
+					.getWidth();
+			int colSize = tblStages.getFontMetrics(tblStages.getFont())
+					.stringWidth(tblStages.getModel().getColumnName(0)) * 2;
+			cm.getColumn(0).setPreferredWidth((int) (colSize));
+			cm.getColumn(0).setMinWidth((int) (colSize));
+			cm.getColumn(0).setMaxWidth((int) (colSize));
+			tablePreferredWidth -= colSize;
+			cm.getColumn(1)
+					.setPreferredWidth((int) (tablePreferredWidth * 0.7));
+			cm.getColumn(2)
+					.setPreferredWidth((int) (tablePreferredWidth * 0.3));
+
+			// Ask to be notified of selection changes.
+			ListSelectionModel rowSM = tblStages.getSelectionModel();
+			rowSM.addListSelectionListener(new ListSelectionListener() {
+			    public void valueChanged(ListSelectionEvent e) {
+			        //Ignore extra messages.
+			        if (e.getValueIsAdjusting())
+			        	return;
+
+			        ListSelectionModel lsm =
+			            (ListSelectionModel)e.getSource();
+		        	getBtnCenterOnFlag().setEnabled(!lsm.isSelectionEmpty());
+			    }
+			});
+			
+			tblStages.getModel().addTableModelListener(new TableModelListener() {
+
+				public void tableChanged(TableModelEvent e) {
+					System.out.println("Table model changed");
+//					getBtnCenterOnFlag().setEnabled(false);
+				}
+				
+			});
+
+			
+		}
+		return tblStages;
+	}
+
+	protected int getFlagCount() {
+		return _getFlags().size();
+	}
+
+	private List _getFlags() {
+//		if (routeFlags == null) {
+//			routeFlags = new ArrayList();
+//		}
+//		return routeFlags;
+
+		return network.getOriginaFlags();
+	}
+
+	protected boolean isSelected(int row) {
+		return ((GvFlag) _getFlags().get(row)).isEnabled();
+	}
+
+	/**
+	 * This method initializes eastPanel
+	 *
+	 * @return javax.swing.JPanel
+	 */
+	private JPanel getEastPanel() {
+		if (eastPanel == null) {
+			GridLayout layout = new GridLayout();
+			layout.setColumns(1);
+			layout.setVgap(5);
+			JPanel aux = new JPanel();
+			aux.add(getBtnLoadStage());
+			aux.add(getBtnSaveStage());
+			aux.add(getBtnSaveRoute());
+			aux.add(getBtnCenterOnFlag());
+			aux.add(getBtnSetVelocities());
+			layout.setRows(aux.getComponentCount());
+			aux.setLayout(layout);
+			eastPanel = new GridBagLayoutPanel();
+			eastPanel.addComponent(aux);
+		}
+		return eastPanel;
+	}
+
+	private JButton getBtnCenterOnFlag() {
+		if (btnCenterOnFlag == null) {
+			btnCenterOnFlag = new JButton();
+			btnCenterOnFlag.setText(PluginServices.getText(this,
+					"center_on_flag"));
+			btnCenterOnFlag.setEnabled(false);
+			btnCenterOnFlag.addActionListener(this);
+		}
+		return btnCenterOnFlag;
+	}
+
+	private JButton getBtnSetVelocities() {
+		if (btnSetVelocities == null) {
+			btnSetVelocities = new JButton();
+			btnSetVelocities.setText(PluginServices.getText(this,
+					"set_velocities"));
+//			btnSetVelocities.setEnabled(false);
+			
+			// TODO: PONERLO VISIBLE CUANDO SE CORRIJA LO DE ABRIR EL
+			// DIALOGO Y LEER LAS VELOCIDADES QUE HAB�A ANTES.
+			btnSetVelocities.setVisible(false);
+			btnSetVelocities.addActionListener(this);
+		}
+		return btnSetVelocities;
+	}
+
+	private JButton getBtnSaveRoute() {
+		if (btnSaveRoute == null) {
+			btnSaveRoute = new JButton();
+			btnSaveRoute.setText(PluginServices.getText(this, "save_route"));
+			btnSaveRoute.addActionListener(this);
+		}
+		return btnSaveRoute;
+	}
+
+	/**
+	 * This method initializes defaultTableModel
+	 *
+	 * @return javax.swing.table.DefaultTableModel
+	 */
+	private TableModel getTableModel() {
+		return tableModel;
+	}
+
+	/**
+	 * This method initializes btnLoadStage
+	 *
+	 * @return javax.swing.JButton
+	 */
+	private JButton getBtnLoadStage() {
+		if (btnLoadStage == null) {
+			btnLoadStage = new JButton();
+			btnLoadStage.setText(PluginServices.getText(this, "load_stages"));
+			btnLoadStage.addActionListener(this);
+		}
+		return btnLoadStage;
+	}
+
+	/**
+	 * This method initializes btnSaveStages
+	 *
+	 * @return javax.swing.JButton
+	 */
+	private JButton getBtnSaveStage() {
+		if (btnSaveStage == null) {
+			btnSaveStage = new JButton();
+			btnSaveStage.setText(PluginServices.getText(this, "save_stages"));
+			btnSaveStage.addActionListener(this);
+		}
+		return btnSaveStage;
+	}
+
+	class FormatSelectionPanel extends JPanel implements IWindow {
+
+		JComboBox formats;
+		WindowInfo wi = null;
+
+		public FormatSelectionPanel(String introductoryText) {
+			super(new BorderLayout());
+			String[] formatos = { "SHP", "DXF", "POSTGIS", "GML" };
+			formats = new JComboBox(formatos);
+			GridBagLayoutPanel contentPanel =
+				new GridBagLayoutPanel();
+			contentPanel.addComponent(new JLabel(introductoryText));
+			contentPanel.addComponent(formats);
+			JButton okButton = new JButton(PluginServices.getText(null,
+					"Aceptar"));
+			okButton.addActionListener(new ActionListener() {
+				public void actionPerformed(ActionEvent arg0) {
+					close();
+				}
+			});
+			contentPanel.addComponent(okButton);
+
+			add(contentPanel);
+		}
+
+		void close() {
+			PluginServices.getMDIManager().closeWindow(this);
+		}
+
+		public String getSelectedFormat() {
+			return (String) formats.getSelectedItem();
+		}
+
+		public WindowInfo getWindowInfo() {
+			if (wi == null) {
+				wi = new WindowInfo(WindowInfo.MODALDIALOG | WindowInfo.PALETTE);
+				wi.setTitle(PluginServices
+						.getText(null, "Seleccion_de_formato"));// Internacionalizar
+																// esto
+				wi.setWidth(300);
+				wi.setHeight(55);
+			}
+			return wi;
+		}
+
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		Component c = (Component) e.getSource();
+		if (c.equals(getBtnLoadStage())) {
+			loadStages();
+		} else if (c.equals(getBtnSaveStage())) {
+			saveStage();
+		} else if (c.equals(getBtnPushUpStage())) {
+			int[] selected = tblStages.getSelectedRows();
+			if (selected.length == 0 || selected[0] == 0)
+				return;
+			tblStages.clearSelection();
+			for (int i = 0; i < selected.length; i++) {
+				Object aux = _getFlags().get(selected[i] - 1);
+				_getFlags().set(selected[i] - 1, _getFlags().get(selected[i]));
+				_getFlags().set(selected[i], aux);
+				selected[i]--;
+				tblStages.addRowSelectionInterval(selected[i], selected[i]);
+			}
+			invalidateSolution();
+		} else if (c.equals(getBtnPullDownStage())) {
+			// pull down
+			int[] selected = tblStages.getSelectedRows();
+			if (selected.length == 0
+					|| selected[selected.length - 1] >= _getFlags().size() - 1)
+				return;
+
+			// move rows
+			tblStages.clearSelection();
+			for (int i = selected.length - 1; i >= 0; i--) {
+				Object aux = _getFlags().get(selected[i] + 1);
+				_getFlags().set(selected[i] + 1, _getFlags().get(selected[i]));
+				_getFlags().set(selected[i], aux);
+				selected[i]++;
+				tblStages.addRowSelectionInterval(selected[i], selected[i]);
+			}
+			invalidateSolution();
+
+		} else if (c.equals(getBtnRemoveStage())) {
+			removeStage();			
+		} else if (c.equals(getBtnSaveRoute())) {
+			saveRoute();
+		} else if (c.equals(getBtnSetVelocities())) {
+			setVelocities();			
+		} else if (c.equals(getBtnCenterOnFlag())) {
+			// Center on first selected flag.
+			int[] selected = tblStages.getSelectedRows();
+			if (selected.length == 0)
+				return;
+			GvFlag flag = (GvFlag) _getFlags().get(selected[0]);
+			IWindow window = PluginServices.getMDIManager().getActiveWindow();
+			if(! (window instanceof IView))
+				return;
+			IView view = (IView) window;
+			ViewPort vp = view.getMapControl().getViewPort();
+			Rectangle2D extent = vp.getAdjustedExtent();
+			double xNC = flag.getOriginalPoint().getX();
+			double yNC = flag.getOriginalPoint().getY();
+			double width = extent.getWidth();
+			double height = extent.getHeight();
+			
+			Rectangle2D.Double r = new Rectangle2D.Double();
+			
+			r.width = width;
+			r.height = height;
+			r.x = xNC - width/2;
+			r.y = yNC - height/2;
+
+			vp.setExtent(r);
+
+			
+				
+		}
+		repaint();
+	}
+
+	private void setVelocities() {
+		if(network == null){
+			IWindow window = PluginServices.getMDIManager().getActiveWindow();
+			if(! (window instanceof IView))
+				return;
+			IView view = (View) window;
+			MapControl mapControl = view.getMapControl();
+			MapContext map = mapControl.getMapContext();
+			FLayers layers = map.getLayers();
+			SingleLayerIterator it = new SingleLayerIterator(layers);
+			while (it.hasNext() && network == null) {
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				network = (Network) aux.getProperty("network");
+			}
+		}
+		if (network == null)
+			return;
+		
+		ArrayList lstTipoTramo = network.getEdgeTypes();		
+		try
+		{
+			String msg = PluginServices.getText(this, "msg_set_velocities");
+			MultiInputDlg dlg = new MultiInputDlg(msg, lstTipoTramo);
+			String col1 = PluginServices.getText(this, "col_arc_type");
+			String col2 = PluginServices.getText(this, "col_km_per_hour");
+			dlg.setColumnNames(col1, col2);
+			dlg.setModal(true);
+			dlg.setVisible(true);
+			if (dlg.isCanceled())
+				return;
+			
+			ArrayList veloKm = dlg.getRightValues(); //{120, 110, 90, 80, 70, 60, 50, 40};
+			Hashtable veloMeters = new Hashtable(veloKm.size());
+			for (int i=0; i<veloKm.size(); i++)
+			{
+				Object key = lstTipoTramo.get(i);
+				veloMeters.put(key, new Double(Double.parseDouble((String) veloKm.get(i)) / 3.6));
+			}
+			
+			for (int i=0; i < network.getGraph().numEdges(); i++)
+			{
+				GvEdge edge = network.getGraph().getEdgeByID(i);
+				
+				Integer key = new Integer(edge.getType());
+				Double vel = (Double) veloMeters.get(key);
+				edge.setWeight(edge.getDistance() / vel.doubleValue()); // segundos
+			}
+			
+		}
+		catch(Exception e)
+		{
+			e.printStackTrace();
+		}
+
+		
+	}
+
+	private void invalidateSolution() {
+		for (int i=0; i < _getFlags().size(); i++)
+		{
+			GvFlag flag = (GvFlag) _getFlags().get(i);
+			flag.setCost(-1.0);
+		}
+		updateTotalCost();
+	}
+
+	private void saveStage(){
+		if(network == null){
+			IWindow window = PluginServices.getMDIManager().getActiveWindow();
+			if(! (window instanceof IView))
+				return;
+			IView view = (View) window;
+			MapControl mapControl = view.getMapControl();
+			MapContext map = mapControl.getMapContext();
+			FLayers layers = map.getLayers();
+			SingleLayerIterator it = new SingleLayerIterator(layers);
+			while (it.hasNext() && network == null) {
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				network = (Network) aux.getProperty("network");
+			}
+		}
+		if (network == null)
+			return;
+
+		List features = new ArrayList();
+		GvFlag[] flags = network.getFlags();
+		for(int i = 0; i < flags.length; i++){
+			GvFlag flag = flags[i];
+			// Solo se guardan los flags habilitados
+			if (!flag.isEnabled())
+				continue;
+			FPoint2D point = new FPoint2D(flag.getOriginalPoint());
+			Value[] values = new Value[6];
+			values[GvFlag.ID_FLAG_INDEX] = ValueFactory.createValue(flag.getIdFlag());
+			values[GvFlag.ID_ARC_INDEX] = ValueFactory.createValue(flag.getIdArc());
+			values[GvFlag.DESCRIPTION_INDEX] = ValueFactory.createValue(flag.getDescription());
+			values[GvFlag.DIREC_INDEX] = ValueFactory.createValue(flag.getDirec());
+			values[GvFlag.PCT_INDEX] = ValueFactory.createValue(flag.getPct());
+			values[GvFlag.COST_INDEX] = ValueFactory.createValue(flag.getCost());
+			IGeometry geo = ShapeFactory.createPoint2D(point);
+			DefaultFeature feature = new DefaultFeature(geo, values, new Integer(flag.getIdFlag()).toString() );
+			features.add(feature);
+		}
+
+		FlagsMemoryDriver driver = new FlagsMemoryDriver(features);
+		IProjection projection = FOpenDialog.getLastProjection();
+		FLyrVect routeLayer = (FLyrVect) LayerFactory.createLayer("Flags",
+				driver, projection);
+
+		FormatSelectionPanel selectionPanel =
+			new FormatSelectionPanel(PluginServices.
+					getText(null,
+				"Seleccione_un_formato_para_guardar_los_flags"));
+		PluginServices.getMDIManager().addWindow(selectionPanel);
+
+		String format = selectionPanel.getSelectedFormat();
+		com.iver.cit.gvsig.ExportTo export = new com.iver.cit.gvsig.ExportTo();
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if(! (window instanceof IView))
+			return;
+		IView view = (View) window;
+		MapControl mapControl = view.getMapControl();
+		MapContext context = mapControl.getMapContext();
+		try {
+			if (format.equalsIgnoreCase("SHP")) {
+				export.saveToShp(context, routeLayer);
+			} else if (format.equalsIgnoreCase("DXF")) {
+				export.saveToDxf(context, routeLayer);
+			} else if (format.equalsIgnoreCase("GML")) {
+				export.saveToGml(context, routeLayer);
+			} else if (format.equalsIgnoreCase("POSTGIS")) {
+				export.saveToPostGIS(context, routeLayer);
+			}
+		} catch (EditionException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		} catch (DriverIOException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}
+
+	}
+	private void saveRoute() {
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if(! (window instanceof IView))
+			return;
+		IView view = (View) window;
+		MapControl mapControl = view.getMapControl();
+		List routes = (List) GvSession.getInstance().get(mapControl, "Route");
+		if(routes == null || routes.size() == 0){
+			JOptionPane.showMessageDialog(this, PluginServices.getText(this, "Ruta_borrada_o_inexistente"),
+					PluginServices.getText(this, "Ruta_no_encontrada"),
+					JOptionPane.ERROR_MESSAGE);
+			return;
+		}	
+		Route lastRoute = (Route) routes.get(routes.size() - 1);
+		RouteMemoryDriver driver = new RouteMemoryDriver(lastRoute.getFeatureList());
+		IProjection projection = FOpenDialog.getLastProjection();
+		FLyrVect routeLayer = (FLyrVect) LayerFactory.createLayer("Route",
+				driver, projection);
+
+		FormatSelectionPanel selectionPanel = new FormatSelectionPanel(PluginServices.getText(null,
+		"Seleccione_un_formato_para_guardar_la_ruta"));
+		PluginServices.getMDIManager().addWindow(selectionPanel);
+
+		String format = selectionPanel.getSelectedFormat();
+		com.iver.cit.gvsig.ExportTo export = new com.iver.cit.gvsig.ExportTo();
+		MapContext context = mapControl.getMapContext();
+		try {
+			if (format.equalsIgnoreCase("SHP")) {
+				export.saveToShp(context, routeLayer);
+			} else if (format.equalsIgnoreCase("DXF")) {
+				export.saveToDxf(context, routeLayer);
+			} else if (format.equalsIgnoreCase("GML")) {
+				export.saveToGml(context, routeLayer);
+			} else if (format.equalsIgnoreCase("POSTGIS")) {
+				export.saveToPostGIS(context, routeLayer);
+			}
+		} catch (EditionException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		} catch (DriverIOException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}
+	}
+
+	/**
+	 * Converts a point layer loaded in the active view's toc in a collection of
+	 * flags of the active network
+	 *
+	 */
+	private void loadStages() {
+
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if(! (window instanceof IView))
+			return;
+		IView view = (IView) window;
+		MapControl mapControl = view.getMapControl();
+		MapContext map = mapControl.getMapContext();
+		FLayers layers = map.getLayers();
+
+		String title = PluginServices.getText(this,
+				"Seleccionar_capa_con_puntos_de_parada");
+		String introductoryText = PluginServices.getText(this,
+				"Seleccione_una_capa_de_puntos_para_crear_paradas");
+
+		LayerSelectionPanel selectionPanel = new LayerSelectionPanel(layers,
+				title, introductoryText, FLyrVect.class, FShape.POINT);
+		PluginServices.getMDIManager().addWindow(selectionPanel);
+
+		if (!selectionPanel.wasFinishPressed())
+			return;
+		else {
+			FLayer layer = selectionPanel.getLayer();
+			if (layer == null)
+				return;
+			if (!(layer instanceof FLyrVect))
+				return;
+			FLyrVect vectLyr = (FLyrVect) layer;
+
+			try {
+				if (vectLyr.getShapeType() != FShape.POINT)
+					return;
+
+				// TODO
+				// Hay que refinar bastante, para que el usuario elija
+				// con que red y con qu� capa lineal quiere trabajar
+				// tal y como est�, si hubiese varias se trabajaria
+				// con la primera que devuelva el iterador
+
+				Network net = null;
+				SingleLayerIterator it = new SingleLayerIterator(layers);
+				while (it.hasNext() && net == null) {
+					FLayer aux = it.next();
+					if (!aux.isActive())
+						continue;
+					net = (Network) aux.getProperty("network");
+				}
+				if (net == null)
+					return;
+
+				// Por si queremos a�adir paradas a otras ya existentes
+//				_getFlags().clear();
+				
+				GvFlag flag;
+				ReadableVectorial reader = vectLyr.getSource();
+				SelectableDataSource recordset = vectLyr.getRecordset();
+				int numShapes = reader.getShapeCount();
+
+				double realTol = mapCtrl.getViewPort()
+						.toMapDistance(FlagListener.pixelTolerance);
+				reader.start();
+				for (int i = 0; i < numShapes; i++) {
+					Geometry geo = reader.getShape(i).toJTSGeometry();
+					if (!((geo instanceof Point) || (geo instanceof MultiPoint)))
+						continue;
+					
+					
+
+					Coordinate[] coords = geo.getCoordinates();
+					for (int j = 0; j < coords.length; j++) {
+
+						try {
+							flag = net.addFlag(coords[j].x, coords[j].y, realTol);
+							if (flag == null)
+							{
+								// segundo intento:
+								flag = net.addFlag(coords[j].x, coords[j].y, 4*realTol);
+								if (flag == null)
+								{								
+									NullPointerException e = new NullPointerException("Punto " + i + " fuera de la red. Tolerancia=" + realTol);
+									NotificationManager.addError("No se puedo situar el registro " + i + 
+											"Por favor, compruebe que est� encima de la red o aumente la toleracina.", e);
+								}
+							}
+							if (flag != null)
+							{
+							// TODO: Create use a IFlagListener to do this
+							// inside flagsChanged. The best solution is
+							// to put all the code in RouteControlPanel
+								NetworkUtils.addGraphicFlag(mapControl, flag);
+							}
+						} catch (GraphException e) {
+							e.printStackTrace();
+							NotificationManager.addError("No se puedo situar el registro " + i + 
+									"Por favor, compruebe que est� encima de la red.", e);
+						}
+
+					} // for j
+				} // for i
+				reader.stop();
+				mapControl.drawGraphics();
+				PluginServices.getMainFrame().enableControls();
+
+			} catch (DriverException e1) {
+				return;
+			} catch (DriverIOException e2) {
+				return;
+			}
+		}
+	}
+
+	/**
+	 * Removes the selected flags in the component's table from: -the graphic
+	 * layer of the active view -the active network -the own table
+	 *
+	 */
+	private void removeStage() {
+		int[] selected = tblStages.getSelectedRows();
+
+		for (int i = selected.length - 1; i >= 0; i--) {
+			try {
+				// removeFlag(selected[i]);
+				if (network != null) {
+					final GvFlag flag = (GvFlag) _getFlags().get(selected[i]);
+					NetworkUtils.clearFlagFromGraphics(mapCtrl, flag);
+					network.removeFlag(flag);
+					mapCtrl.repaint();
+				}
+			} catch (IndexOutOfBoundsException iobEx) {
+			}
+
+		}// for
+		tblStages.clearSelection();
+		invalidateSolution();
+		mapCtrl.drawMap(false);
+	}
+
+	public GvFlag[] getFlags() {
+		return (GvFlag[]) _getFlags().toArray(new GvFlag[0]);
+	}
+
+	public void flagsChanged(int reason) {
+		refresh();
+		mapCtrl.drawGraphics();
+
+	}
+} // @jve:decl-index=0:visual-constraint="17,9"

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/RouteControlPanel.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetCancelAction.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetCancelAction.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetCancelAction.java	(revision 12191)
@@ -0,0 +1,76 @@
+/*
+ * Created on 25-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.2  2006-12-04 17:13:39  fjp
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/25 19:13:55  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.graph.gui.wizard;
+
+import jwizardcomponent.CancelAction;
+
+import com.iver.andami.PluginServices;
+
+public class NetCancelAction extends CancelAction {
+	
+	private NetWizard owner;
+	public NetCancelAction(NetWizard wizard) {
+		super(wizard.getWizardComponents());
+		this.owner = wizard;
+	}
+
+	public void performAction() {
+		owner.setWasFinishPressed(false);
+		PluginServices.getMDIManager().closeWindow(owner);
+	}
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetCancelAction.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage0.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage0.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage0.java	(revision 12191)
@@ -0,0 +1,188 @@
+/*
+ * Created on 09-nov-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.9  2006-12-04 17:13:39  fjp
+ * *** empty log message ***
+ *
+ * Revision 1.8  2006/11/13 20:41:08  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.7  2006/11/09 21:08:32  azabala
+ * *** empty log message ***
+ *
+ *
+ */
+package com.iver.cit.gvsig.graph.gui.wizard;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JEditorPane;
+import javax.swing.JRadioButton;
+import javax.swing.JSpinner;
+import javax.swing.SpinnerNumberModel;
+
+import jwizardcomponent.JWizardPanel;
+
+import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
+
+import com.iver.andami.PluginServices;
+import com.iver.cit.gvsig.graph.gui.HTMLEditorKit;
+
+/**
+ * First page of the wizard.
+ * It prevents user of pseudonodes in a linear layer, and offers
+ * them to launch clean geoprocess to remove pseudonodes.
+ * 
+ * Also, it offers users to work with a snap tolerance in node definition.
+ * 
+ * @author alzabord
+ *
+ */
+public class NetPage0 extends JWizardPanel  {
+	private NetWizard owner;
+	
+	JRadioButton originalLayerBtn;
+	JRadioButton cleanedLayerBtn;
+	JRadioButton originalCoordinatesBtn;
+	JRadioButton snappedCoordinatesBtn;
+	JSpinner snapTolerance;
+	
+	NetPage0(NetWizard wizard) {
+		super(wizard.getWizardComponents());
+		this.owner = wizard;
+		initialize();
+	}
+	
+	
+	public boolean cleanOriginalLayer(){
+		return cleanedLayerBtn.isSelected();
+	}
+	
+	public boolean applySnapTolerance(){
+		return snappedCoordinatesBtn.isSelected();
+	}
+	
+	public double getSnapTolerance(){
+		if(applySnapTolerance())
+			return ((Number) snapTolerance.getValue()).doubleValue();
+		else
+			return 0d;
+	}
+	
+	
+	 public void next() {
+        super.next();
+        owner.setCleanOriginalLayer(cleanOriginalLayer());
+        boolean applySnap = applySnapTolerance();
+        if(applySnap){
+        	owner.setSnapTolerance(getSnapTolerance());
+        }
+	 	owner.setApplySnapTolerance(applySnap);  
+    }
+	
+
+	private void initialize() {
+		// this.setSize(new java.awt.Dimension(319,234));
+		GridBagLayoutPanel contentPane = new GridBagLayoutPanel();
+		
+		JEditorPane htmlPanel = new JEditorPane();
+		htmlPanel.setEditable(false);
+		htmlPanel.setEditorKit(new HTMLEditorKit());
+		String layerName = owner.getLayer().getName();
+		String htmlText = "<p><font face='Arial, Helvetica, sans-serif'>Se va a construir una red para la capa de l�neas " + 
+		layerName +
+		" .<br> La presencia de pseudonodos puede originar <br>resultados no deseados. " +
+		"<img src=\"images/lmust_not_dangle.gif\">" +
+		"<br> Por favor, marque lo que desea hacer: </font></p>";
+		htmlPanel.setText(htmlText);
+		contentPane.addComponent(htmlPanel);
+		
+		
+		contentPane.addBlank();
+		contentPane.addBlank();
+		contentPane.addBlank();
+		
+		originalLayerBtn = new JRadioButton(PluginServices.getText(this, "Calcular_la_red_sobre_la_capa_original"));
+		originalLayerBtn.setSelected(true);
+		
+		cleanedLayerBtn = new JRadioButton(PluginServices.getText(this, "Aplicar_un_CLEAN_sobre_la_capa_original"));
+		
+		ButtonGroup cleanGroup = new ButtonGroup();
+		cleanGroup.add(originalLayerBtn);
+		cleanGroup.add(cleanedLayerBtn);
+		
+		contentPane.addComponent(originalLayerBtn);
+		contentPane.addComponent(cleanedLayerBtn);
+		
+		contentPane.addBlank();
+		contentPane.addBlank();
+		contentPane.addBlank();
+		
+		originalCoordinatesBtn = new JRadioButton(PluginServices.getText(this, "Trabajar_con_las_coordenadas_originales"));
+		originalCoordinatesBtn.setSelected(true);
+		
+		snappedCoordinatesBtn = new JRadioButton(PluginServices.getText(this, "Aplicar_tolerancia_de_snap"));
+		SpinnerNumberModel spinnerModel =
+			new SpinnerNumberModel(0.01, 0d, 100d, 0.01 );
+		snapTolerance = new JSpinner(spinnerModel);
+//		 Disable keyboard edits in the spinner
+//		JFormattedTextField tf = ((JSpinner.DefaultEditor) snapTolerance
+//				.getEditor()).getTextField();
+//		tf.setEditable(false);
+//		tf.setBackground(Color.white);
+		               
+		ButtonGroup snapGroup = new ButtonGroup();
+		snapGroup.add(originalCoordinatesBtn);
+		snapGroup.add(snappedCoordinatesBtn);
+		
+		contentPane.addComponent(originalCoordinatesBtn);
+		contentPane.addComponent(snappedCoordinatesBtn, snapTolerance);
+		
+		
+		this.add(contentPane);
+	}
+
+}  //  @jve:decl-index=0:visual-constraint="10,10"

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage0.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage1.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage1.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage1.java	(revision 12191)
@@ -0,0 +1,225 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.5  2006-12-04 17:13:39  fjp
+* *** empty log message ***
+*
+* Revision 1.4  2006/11/20 08:44:55  fjp
+* borrar tramos amarillos, seleccionar solo campos num�ricos y situar las barreras encima del tramo invalidado
+*
+* Revision 1.3  2006/11/09 10:12:24  fjp
+* Traducciones
+*
+* Revision 1.2  2006/10/24 08:04:41  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/19 15:12:10  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.graph.gui.wizard;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.Hashtable;
+
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+
+import jwizardcomponent.JWizardPanel;
+
+import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
+
+import com.iver.andami.PluginServices;
+/**
+ * Configures the length
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+class NetPage1 extends JWizardPanel implements ActionListener {
+	private NetWizard owner;
+	private JComboBox cmbLengthField;
+	// TODO comprobar si  es necesario
+	private Hashtable exceptions;
+	private JComboBox cmbTypeField;
+	private JComboBox cmbSenseField;
+	private JComboBox cmbCostUnits;
+	private JComboBox cmbCostField;
+
+	private Object useLineLengthItem = "< "+PluginServices.getText(this, "use_line_length")+" >";
+
+	private Object nullValue = "- "+PluginServices.getText(this, "none")+" -";
+	private JCheckBox chkTypeField;
+	private JCheckBox chkLengthField;
+	private JCheckBox chkCostUnits;
+	private JCheckBox chkSenseField;
+	private JCheckBox chkCostField;
+
+	NetPage1(NetWizard wizard) {
+		super(wizard.getWizardComponents());
+		this.owner = wizard;
+		initialize();
+	}
+
+	private void initialize() {
+		GridBagLayoutPanel contentPane = new GridBagLayoutPanel();
+		contentPane.setBorder(javax.swing.BorderFactory.createTitledBorder(null,
+				PluginServices.getText(this, "field_configuration"),
+				javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
+				javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
+
+		// Way type
+		cmbTypeField = new JComboBox();
+		cmbTypeField.addItem(nullValue);
+		cmbTypeField.setToolTipText(PluginServices.getText(this, "type_field_text"));
+		String[] ss = owner.getNumericLayerFieldNames();
+		for (int i = 0; i < ss.length; i++) {
+			cmbTypeField.addItem(ss[i]);
+		}
+		chkTypeField = new JCheckBox(PluginServices.getText(this, "select_type_field")+":");
+		chkTypeField.addActionListener(this);
+		contentPane.addComponent(chkTypeField, cmbTypeField);
+
+		// Length
+		cmbLengthField = new JComboBox();
+		cmbLengthField.addItem(nullValue);
+		cmbLengthField.setToolTipText(PluginServices.getText(this, "length_field_text"));
+		ss = owner.getNumericLayerFieldNames();
+		for (int i = 0; i < ss.length; i++) {
+			cmbLengthField.addItem(ss[i]);
+		}
+		chkLengthField = new JCheckBox(PluginServices.getText(this, "select_length_field")+":");
+		chkLengthField.addActionListener(this);
+		contentPane.addComponent(chkLengthField, cmbLengthField);
+
+		// Cost
+		chkCostField = new JCheckBox(PluginServices.getText(this, "cost_field")+":");
+		chkCostField.addActionListener(this);
+		contentPane.addComponent(chkCostField, cmbCostField = new JComboBox());
+
+		cmbCostField.addItem(useLineLengthItem );
+		cmbCostField.setToolTipText(PluginServices.getText(this, "cost_field_text"));
+		cmbCostField.addActionListener(this);
+		String[] numericFields = owner.getNumericLayerFieldNames();
+
+		for (int i = 0; i < numericFields.length; i++)
+			cmbCostField.addItem(numericFields[i]);
+
+		// Costs units
+		cmbCostUnits = new JComboBox(NetWizard.COST_UNITS);
+		chkCostUnits = new JCheckBox(PluginServices.getText(this, "cost_units")+":");
+		chkCostUnits.addActionListener(this);
+		contentPane.addComponent(chkCostUnits, cmbCostUnits);
+		cmbCostUnits.setToolTipText(PluginServices.getText(this, "cost_units_text"));
+
+		// Sense
+		cmbSenseField = new JComboBox();
+		cmbSenseField.addItem(nullValue);
+		String[] fieldNames = owner.getNumericLayerFieldNames();
+		for (int i = 0; i < fieldNames.length; i++) {
+			cmbSenseField.addItem(fieldNames[i]);
+		}
+		cmbSenseField.addActionListener(this);
+		cmbSenseField.setToolTipText(PluginServices.getText(this, "sense_field_text"));
+		chkSenseField = new JCheckBox(PluginServices.getText(this, "select_sense_field")+":");
+		chkSenseField.addActionListener(this);
+		contentPane.addComponent(chkSenseField, cmbSenseField);
+		contentPane.addComponent(new JLabel(PluginServices.getText(this,
+				"explanation_sense_field")));
+		actionPerformed(null);
+		this.add(contentPane);
+	}
+
+	public void actionPerformed(ActionEvent e) {
+
+		cmbCostUnits.setEnabled(
+				!cmbCostField.getSelectedItem().equals(useLineLengthItem));
+		if (chkTypeField.isSelected()) {
+			owner.setTypeField(cmbTypeField.getSelectedItem().equals(nullValue)?
+					null : (String) cmbTypeField.getSelectedItem());
+			cmbTypeField.setEnabled(true);
+		} else {
+			owner.setTypeField(null);
+			cmbTypeField.setEnabled(false);
+		}
+
+		if (chkLengthField.isSelected()) {
+			owner.setLengthField(cmbLengthField.getSelectedItem().equals(nullValue)?
+				null : (String) cmbLengthField.getSelectedItem());
+			cmbLengthField.setEnabled(true);
+		} else {
+			owner.setLengthField(null);
+			cmbLengthField.setEnabled(false);
+		}
+
+		if (chkSenseField.isSelected()) {
+			owner.setSenseField(cmbSenseField.getSelectedItem().equals(nullValue)?
+					null : (String) cmbSenseField.getSelectedItem());
+			cmbSenseField.setEnabled(true);
+		} else {
+			owner.setSenseField(null);
+			cmbSenseField.setEnabled(false);
+		}
+
+		if (chkCostField.isSelected()) {
+			owner.setCostField(cmbCostField.getSelectedItem().equals(useLineLengthItem)?
+				null : (String) cmbCostField.getSelectedItem());
+			cmbCostField.setEnabled(true);
+		} else {
+			owner.setCostField(null);
+			cmbCostField.setEnabled(false);
+		}
+
+		if (chkCostUnits.isSelected()) {
+			owner.setCostsUnit((String) cmbCostUnits.getSelectedItem());
+			cmbCostUnits.setEnabled(true);
+		} else {
+			owner.setCostsUnit(null); // TODO use unknown?
+			cmbCostUnits.setEnabled(false);
+		}
+	}
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage1.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetFinishAction.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetFinishAction.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetFinishAction.java	(revision 12191)
@@ -0,0 +1,75 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.3  2006-12-04 17:13:39  fjp
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/25 19:13:55  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/19 15:12:10  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.graph.gui.wizard;
+
+import jwizardcomponent.FinishAction;
+
+import com.iver.andami.PluginServices;
+
+class NetFinishAction extends FinishAction {
+	private NetWizard owner;
+
+	NetFinishAction(NetWizard wizard) {
+		super(wizard.getWizardComponents());
+		this.owner = wizard;
+	}
+	public void performAction() {
+		owner.setWasFinishPressed(true);
+		PluginServices.getMDIManager().closeWindow(owner);
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetFinishAction.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage2.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage2.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage2.java	(revision 12191)
@@ -0,0 +1,124 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.4  2006-12-04 17:13:39  fjp
+* *** empty log message ***
+*
+* Revision 1.3  2006/11/14 11:10:27  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/19 15:15:27  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/19 15:12:10  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.graph.gui.wizard;
+
+import javax.swing.ButtonGroup;
+import javax.swing.JRadioButton;
+
+import jwizardcomponent.JWizardPanel;
+
+import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
+
+import com.iver.andami.PluginServices;
+/**
+ * Select costs or way type.
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ * @deprecated
+ */
+public class NetPage2 extends JWizardPanel {
+
+	private NetWizard owner;
+	private JRadioButton rdBtnCosts;
+	private JRadioButton rdBtnWayType;
+
+	NetPage2(NetWizard wizard) {
+		super(wizard.getWizardComponents());
+		this.owner = wizard;
+		initialize();
+	}
+
+	private void initialize() {
+		GridBagLayoutPanel contentPane = new GridBagLayoutPanel();
+		contentPane.setBorder(javax.swing.BorderFactory.createTitledBorder(null,
+				PluginServices.getText(this, "criterium"),
+				javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION,
+				javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
+
+		contentPane.addComponent(
+				rdBtnCosts = new JRadioButton(
+						PluginServices.getText(this, "cost_from_a_table_field")));
+		contentPane.addComponent(
+				rdBtnWayType = new JRadioButton(
+						PluginServices.getText(this, "based_upon_the_road_type")));
+
+		ButtonGroup group = new ButtonGroup();
+		group.add(rdBtnCosts);
+		group.add(rdBtnWayType);
+		this.add(contentPane);
+	}
+
+	public void next() {
+		Boolean costs = null;
+		if (rdBtnCosts.isSelected())
+			costs = new Boolean(true);
+		if (rdBtnWayType.isSelected())
+			costs = new Boolean(false);
+
+		if (costs!=null) {
+			owner.setUsingCosts(costs);
+			((NetPage3) owner.getWizardComponents().getWizardPanel(2))
+				.refresh();
+			goNext();
+		}
+
+	}
+
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage2.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage3.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage3.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage3.java	(revision 12191)
@@ -0,0 +1,134 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.3  2006-10-24 08:04:41  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/19 15:15:27  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/19 15:12:10  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.graph.gui.wizard;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import jwizardcomponent.JWizardPanel;
+
+import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
+
+import com.iver.andami.PluginServices;
+import com.iver.utiles.swing.JComboBox;
+/**
+ * Configure costs or way types
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ * @deprecated
+ */
+class NetPage3 extends JWizardPanel implements ActionListener {
+
+	private NetWizard owner;
+	private JComboBox cmbCostField;
+	private JComboBox cmbCostUnits;
+	private Boolean usingCosts;
+	private Object useLineLengthItem = "< "+PluginServices.getText(this, "use_line_length")+" >";
+
+	NetPage3(NetWizard wizard) {
+		super(wizard.getWizardComponents());
+		this.owner = wizard;
+	}
+
+	public void refresh() {
+		removeAll();
+		GridBagLayoutPanel contentPane = new GridBagLayoutPanel();
+		usingCosts = owner.isUsingCosts();
+		if (usingCosts == null) {
+			goBack();
+		} else if (usingCosts.booleanValue() == true) {
+			contentPane.addComponent(
+					PluginServices.getText(this, "cost_field"),
+					cmbCostField = new JComboBox());
+
+			cmbCostField.addItem(useLineLengthItem );
+			cmbCostField.addActionListener(this);
+			String[] numericFields = owner.getNumericLayerFieldNames();
+
+			for (int i = 0; i < numericFields.length; i++)
+				cmbCostField.addItem(numericFields[i]);
+
+			contentPane.addComponent(
+					PluginServices.getText(this, "cost_units"),
+					cmbCostUnits = new JComboBox(NetWizard.COST_UNITS));
+		} else {
+			// TODO missing configure tipo de via
+		}
+		this.add(contentPane);
+		actionPerformed(null);
+	}
+
+	public void next() {
+		if (usingCosts==null) return;
+
+		if (usingCosts.equals(Boolean.TRUE)) {
+			owner.setCostField(
+					cmbCostField.getSelectedIndex() == 0 ?
+							"" : (String)cmbCostField.getSelectedItem());
+			owner.setCostsUnit(
+					(String) NetWizard.COST_UNITS[cmbCostUnits.getSelectedIndex()]);
+		} else {
+
+		}
+		goNext();
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		cmbCostUnits.setEnabled(
+			!cmbCostField.getSelectedItem().equals(useLineLengthItem));
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage3.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage4.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage4.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage4.java	(revision 12191)
@@ -0,0 +1,111 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.4  2006-12-04 17:13:39  fjp
+* *** empty log message ***
+*
+* Revision 1.3  2006/10/24 08:04:41  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/19 15:15:27  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/19 15:12:10  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.graph.gui.wizard;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import jwizardcomponent.JWizardPanel;
+
+import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
+
+import com.iver.andami.PluginServices;
+import com.iver.utiles.swing.JComboBox;
+
+/**
+ * Configuring sense
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ * @deprecated
+ */
+class NetPage4 extends JWizardPanel implements ActionListener {
+	private NetWizard owner;
+	private JComboBox cmbSenseField;
+	private Object nullValue = "- "+PluginServices.getText(this, "none")+" -";
+
+	NetPage4(NetWizard wizard) {
+		super(wizard.getWizardComponents());
+		this.owner = wizard;
+		initialize();
+	}
+
+	private void initialize() {
+		GridBagLayoutPanel contentPane = new GridBagLayoutPanel();
+
+		cmbSenseField = new JComboBox();
+		cmbSenseField.addItem(nullValue);
+		String[] fieldNames = owner.getLayerFieldNames();
+		for (int i = 0; i < fieldNames.length; i++) {
+			cmbSenseField.addItem(fieldNames[i]);
+		}
+		cmbSenseField.addActionListener(this);
+		contentPane.addComponent(PluginServices.getText(this, "select_sense_field"),cmbSenseField);
+		add(contentPane);
+		actionPerformed(null);
+	}
+
+	public void actionPerformed(ActionEvent e) {
+		// refresh table
+		owner.setSenseField(cmbSenseField.getSelectedItem().equals(nullValue)?
+				"" : (String) cmbSenseField.getSelectedItem());
+	}
+
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetPage4.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetWizard.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetWizard.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetWizard.java	(revision 12191)
@@ -0,0 +1,272 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.9  2006-12-04 17:13:39  fjp
+* *** empty log message ***
+*
+* Revision 1.8  2006/11/09 13:30:40  azabala
+* *** empty log message ***
+*
+* Revision 1.7  2006/11/09 12:51:12  jaume
+* *** empty log message ***
+*
+* Revision 1.6  2006/11/09 09:01:05  azabala
+* *** empty log message ***
+*
+* Revision 1.5  2006/11/08 20:14:42  azabala
+* *** empty log message ***
+*
+* Revision 1.4  2006/10/25 19:13:55  azabala
+* *** empty log message ***
+*
+* Revision 1.3  2006/10/24 08:04:41  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/20 12:02:50  jaume
+* GUI
+*
+* Revision 1.1  2006/10/19 15:12:10  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.graph.gui.wizard;
+
+import java.sql.Types;
+import java.util.ArrayList;
+
+import javax.swing.ImageIcon;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.andami.ui.mdiManager.WindowInfo;
+import com.iver.andami.ui.wizard.WizardAndami;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+
+public class NetWizard extends WizardAndami implements IWindow{
+    public final static String[] COST_UNITS = {
+    	PluginServices.getText(NetWizard.class, "seconds" ),
+    	PluginServices.getText(NetWizard.class, "hours" ),
+        PluginServices.getText(NetWizard.class, "minutes" ),
+                                                "hh:mm:ss" ,
+        PluginServices.getText(NetWizard.class, "millimeters" ),
+        PluginServices.getText(NetWizard.class, "meters" ),
+        PluginServices.getText(NetWizard.class, "inches" ),
+        PluginServices.getText(NetWizard.class, "feet" ),
+        PluginServices.getText(NetWizard.class, "yards" ),
+        PluginServices.getText(NetWizard.class, "miles" ),
+        PluginServices.getText(NetWizard.class, "nautic_miles" ),
+        PluginServices.getText(NetWizard.class, "monetary" ), // unidades monetarias
+        PluginServices.getText(NetWizard.class, "unknown_longitude_units" ),
+        PluginServices.getText(NetWizard.class, "unknown_time_units" ),
+        PluginServices.getText(NetWizard.class, "unknown_units" ),
+    }; // TODO push it to the corresponding geoprocess class
+    private FLyrVect lyr;
+    private WindowInfo wi;
+    private String[] numericLayerFieldNames;
+    private String fieldLength;
+    private Boolean usingCosts;
+    private String costUnit;
+	private String[] layerFieldNames;
+	private String fieldType;
+	private String fieldSense;
+	private String fieldCost;
+	
+	/**
+	 * flag that tells us if user pressed finish button
+	 * or cancel button
+	 * */
+	private boolean wasFinishPressed = false;
+	
+	
+	private boolean cleanOriginalLayer = false;
+	private boolean applySnapTolerance = false;
+	private double snapTolerance = 0d;
+	
+
+    public NetWizard(ImageIcon logo, FLyrVect lyr) {
+        super(logo);
+        this.lyr = lyr;
+        getWizardComponents().addWizardPanel(new NetPage0(this));
+        getWizardComponents().addWizardPanel(new NetPage1(this));
+//        getWizardComponents().addWizardPanel(new NetPage2(this));
+//        getWizardComponents().addWizardPanel(new NetPage3(this));
+//        getWizardComponents().addWizardPanel(new NetPage4(this));
+        getWizardComponents().setFinishAction(new NetFinishAction(this));
+        getWizardComponents().setCancelAction(new NetCancelAction(this));
+    }
+    
+    
+    public FLyrVect getLayer(){
+    	return lyr;
+    }
+
+    public WindowInfo getWindowInfo() {
+        if (wi==null) {
+            wi = new WindowInfo(WindowInfo.RESIZABLE | WindowInfo.MODALDIALOG);
+            wi.setWidth(720);
+            wi.setHeight(370);
+            wi.setTitle(PluginServices.getText(this, "create_network") + "...");
+        }
+        return wi;
+    }
+    
+    public void setCleanOriginalLayer(boolean value){
+    	this.cleanOriginalLayer = value;
+    }
+    
+    public boolean getCleanOriginalLayer(){
+    	return cleanOriginalLayer;
+    }
+    
+    public void setApplySnapTolerance(boolean value){
+    	this.applySnapTolerance = value;
+    }
+    
+    public boolean getApplySnapTolerance(){
+    	return applySnapTolerance;
+    }
+    
+    public void setSnapTolerance(double value){
+    	this.snapTolerance = value;
+    }
+    
+    public double getSnapTolerance(){
+    	return snapTolerance;
+    }
+    
+    
+    public void setWasFinishPressed(boolean wasFinish){
+    	this.wasFinishPressed = wasFinish;
+    }
+    
+    public boolean wasFinishPressed(){
+    	return wasFinishPressed;
+    }
+
+    public String[] getNumericLayerFieldNames() {
+        if (numericLayerFieldNames == null) {
+            try {
+                String[] aux = lyr.getRecordset().getFieldNames();
+                ArrayList temp = new ArrayList();
+                for (int i = 0; i < aux.length; i++) {
+                    switch (lyr.getRecordset().getFieldType(i)) {
+                    case Types.BIGINT:
+                    case Types.DECIMAL:
+                    case Types.DOUBLE:
+                    case Types.FLOAT:
+                    case Types.INTEGER:
+                    case Types.NUMERIC:
+                    case Types.REAL:
+                    case Types.SMALLINT:
+                    case Types.TINYINT:
+                        temp.add(aux[i]);
+                    }
+                }
+                numericLayerFieldNames = (String[]) temp.toArray(new String[0]);
+            } catch (Exception e) {
+                return new String[] {PluginServices.getText(this, "invalid_layer")+"!"};
+            }
+        }
+        return numericLayerFieldNames;
+    }
+
+    public String[] getLayerFieldNames() {
+    	if (layerFieldNames == null) {
+            try {
+            	layerFieldNames = lyr.getRecordset().getFieldNames();
+            } catch (Exception e) {
+            	return new String[] {PluginServices.getText(this, "invalid_layer")+"!"};
+            }
+    	}
+    	return layerFieldNames;
+    }
+
+    public void setLengthField(String lengthField) {
+        this.fieldLength = lengthField;
+    }
+
+	public void setTypeField(String fieldType) {
+		this.fieldType = fieldType;
+	}
+
+	public void setCostField(String fieldCost) {
+        this.fieldCost = fieldCost;
+    }
+
+	public void setSenseField(String fieldSense) {
+		this.fieldSense = fieldSense;
+	}
+
+    public void setCostsUnit(String costUnit) {
+        this.costUnit = costUnit;
+    }
+
+    public void setUsingCosts(Boolean costs) {
+        this.usingCosts = costs;
+    }
+
+    public Boolean isUsingCosts() {
+        return usingCosts;
+    }
+
+	public String getFieldType() {
+		return this.fieldType;
+	}
+
+	public String getFieldLength() {
+		return this.fieldLength;
+	}
+
+	public String getFieldSense() {
+		return this.fieldSense;
+	}
+
+	public String getFieldCost() {
+		return this.fieldCost;
+	}
+
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/wizard/NetWizard.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/MultiInputDlg.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/MultiInputDlg.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/MultiInputDlg.java	(revision 12191)
@@ -0,0 +1,170 @@
+package com.iver.cit.gvsig.graph.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.TextArea;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+
+import javax.swing.JDialog;
+import javax.swing.JLabel;
+import javax.swing.JScrollPane;
+import javax.swing.JTable;
+import javax.swing.JTextArea;
+import javax.swing.table.DefaultTableModel;
+
+import org.gvsig.gui.beans.AcceptCancelPanel;
+import java.awt.SystemColor;
+
+public class MultiInputDlg extends JDialog {
+	private boolean canceled = false;
+	private class MyListener implements ActionListener {
+
+		private MultiInputDlg dlg;
+		public MyListener(MultiInputDlg dlg)
+		{
+			this.dlg = dlg;
+		}
+		public void actionPerformed(ActionEvent e) {
+			if (e.getActionCommand().equalsIgnoreCase("OK"))
+			{
+				dlg.dispose();
+			}
+			if (e.getActionCommand().equalsIgnoreCase("CANCEL"))
+			{
+				dlg.canceled = true;
+				dlg.dispose();
+				
+			}			
+		}
+		
+	}
+
+	private class MyModel extends DefaultTableModel {
+
+		private ArrayList l;
+		private ArrayList r;
+
+		MyModel(ArrayList leftList, ArrayList rightList) {
+			l = leftList;
+			r = rightList;
+		}
+		
+		public ArrayList getRigthValues()
+		{
+			return r;
+		}
+		public int getColumnCount() {
+			return 2;
+		}
+
+		public int getRowCount() {
+			if (l == null) return 0;
+			return l.size();
+		}
+
+		public Object getValueAt(int row, int column) {
+			if (column == 0)
+				return l.get(row);
+			return r.get(row);
+		}
+
+		public boolean isCellEditable(int row, int column) {
+			if (column == 1)
+				return true;
+			else
+				return false;
+		}
+
+		public void setValueAt(Object aValue, int row, int column) {
+			r.set(row, aValue);
+		}
+		
+	}
+	private ArrayList firstList;
+	private ArrayList secondList;
+	
+	private String msg;
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 1914037292995440998L;
+	private JTextArea jLblMsg = null;  //  @jve:decl-index=0:visual-constraint="220,10"
+	private JScrollPane jScrollPane = null;  //  @jve:decl-index=0:visual-constraint="183,139"
+	private JTable jTable = null;
+	private String colName1;
+	private String colName2;
+
+	public MultiInputDlg(String msg, ArrayList leftValues) {
+		firstList = leftValues;
+		secondList = new ArrayList();
+		for (int i=0; i < firstList.size(); i++)
+			secondList.add("60");
+		this.msg = msg;
+		initialize();
+	}
+	/**
+	 * This method initializes this
+	 * 
+	 */
+	private void initialize() {
+		jLblMsg = new JTextArea();
+		jLblMsg.setText(msg);
+		jLblMsg.setBackground(SystemColor.control);
+		jLblMsg.setLineWrap(true);
+		jLblMsg.setPreferredSize(new Dimension(173, 49));
+		
+		this.getContentPane().setLayout(new BorderLayout());
+		this.getContentPane().add(jLblMsg, BorderLayout.NORTH);
+		this.setSize(new Dimension(200, 300));
+		this.getContentPane().add(getJScrollPane(), BorderLayout.CENTER);
+		MyListener myListener = new MyListener(this);
+		AcceptCancelPanel okCancelPanel = new AcceptCancelPanel(myListener, myListener);
+		this.getContentPane().add(okCancelPanel, BorderLayout.SOUTH);
+	
+	}
+
+	public ArrayList getRightValues() {
+		return secondList;
+	}
+	/**
+	 * This method initializes jScrollPane	
+	 * 	
+	 * @return javax.swing.JScrollPane	
+	 */
+	private JScrollPane getJScrollPane() {
+		if (jScrollPane == null) {
+			jScrollPane = new JScrollPane();
+			jScrollPane.setViewportView(getJTable());
+		}
+		return jScrollPane;
+	}
+	/**
+	 * This method initializes jTable	
+	 * 	
+	 * @return javax.swing.JTable	
+	 */
+	private JTable getJTable() {
+		if (jTable == null) {
+			jTable = new JTable();
+			MyModel myModel = new MyModel(firstList, secondList);
+			jTable.setModel(myModel);
+		}
+		return jTable;
+	}
+	public void actionPerformed(ActionEvent e) {
+		
+		
+	}
+	public boolean isCanceled() {
+		return canceled;
+	}
+	public void setColumnNames(String col1, String col2) {
+		this.colName1 = col1;
+		this.colName2 = col2;
+		jTable.getColumnModel().getColumn(0).setHeaderValue(col1);
+		jTable.getColumnModel().getColumn(1).setHeaderValue(col2);
+	}
+
+}  //  @jve:decl-index=0:visual-constraint="10,10"

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/MultiInputDlg.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/LayerSelectionPanel.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/LayerSelectionPanel.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/LayerSelectionPanel.java	(revision 12191)
@@ -0,0 +1,283 @@
+/*
+ * Created on 27-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.3  2006-11-08 19:32:44  azabala
+* *** empty log message ***
+*
+* Revision 1.2  2006/11/03 19:39:29  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/27 18:26:07  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.graph.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Container;
+import java.awt.GridBagConstraints;
+import java.awt.Window;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import javax.swing.DefaultComboBoxModel;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import org.gvsig.gui.beans.AcceptCancelPanel;
+import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.andami.ui.mdiManager.WindowInfo;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLayers;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+
+/**
+ * Component that shows in a combobox all the TOC's layers, and allows
+ * user to select one of them.
+ * 
+ * It optionally allows to filter layers for a given geometry type.
+ * 
+ * 
+ * */
+public class LayerSelectionPanel extends JPanel implements IWindow{
+
+	private GridBagLayoutPanel contentPanel;
+	
+	FLayers layers = null;
+	JComboBox layersComboBox = null;
+	AcceptCancelPanel buttonPanel = null;
+	
+	
+	private ActionListener okActionListener = new ActionListener(){
+		public void actionPerformed(ActionEvent arg0) {
+			wasFinishPressed = true;
+			closeParent(LayerSelectionPanel.this);
+		}
+	};
+
+	private ActionListener cancelActionListener = new ActionListener(){
+		public void actionPerformed(ActionEvent arg0) {
+			wasFinishPressed = false;
+			closeParent(LayerSelectionPanel.this);
+		}
+	};
+	String title = null;
+	String introductoryText = null;
+	
+	boolean wasFinishPressed = false;
+	
+	/**
+	 * Optinal filter to show in the combo box layers of a given
+	 * geometry typ0e
+	 * */
+	int geometryType = -1;
+	
+	/**
+	 * If it is not null, we'll filter layers to only show
+	 * types of this class
+	 * */
+	Class layerType;
+	private WindowInfo wi;
+	
+	
+	
+	public LayerSelectionPanel(FLayers tocLayers, 
+			String title, 
+			String introductoryText){
+		this(tocLayers, title, introductoryText, (Class) null, -1);
+		
+	}
+	
+	public LayerSelectionPanel(FLayers layers, String title, 
+				String introductoryText, Class class1, int geometryType) {
+		super();
+		this.layers = layers;
+		this.introductoryText = introductoryText;
+		this.layerType = class1;
+		this.geometryType = geometryType;
+		initialize();
+	}
+
+	public void setGeometryTypeConstraint(int geometryType){
+		if(layerType == null || !(layerType.isAssignableFrom(FLyrVect.class)))
+			return;
+		this.geometryType = geometryType;
+	}
+	
+	public void setLayerTypeConstraint(Class layerClass){
+		this.layerType = layerClass;
+	}
+		
+	
+	public FLayer getLayer() {
+		FLayer solution = null;
+		String selectedLayer = (String)layersComboBox.getSelectedItem();
+		if(selectedLayer != null){
+			if(!(selectedLayer.trim().equals("")))
+				solution = layers.getLayer(selectedLayer);
+		}
+        
+        return solution;
+	}
+	
+	public void setFLayers(FLayers layers){
+		this.layers = layers;
+		updateLayerCombo();
+	}
+	
+	public void initialize(){
+		setLayout(new BorderLayout());
+		contentPanel = new GridBagLayoutPanel();
+		contentPanel.addComponent(new JLabel(introductoryText), GridBagConstraints.BOTH);
+		JComboBox comboBox = getLayersComboBox();
+		contentPanel.addComponent(PluginServices.getText(null, "Capas:"), comboBox);
+		add(contentPanel, BorderLayout.NORTH);
+		add(getButtonPanel(), BorderLayout.SOUTH);
+		
+	}
+	
+	AcceptCancelPanel getButtonPanel() {
+		if (buttonPanel == null) {
+			buttonPanel = new AcceptCancelPanel();
+			buttonPanel.setOkButtonActionListener(okActionListener);
+			buttonPanel.setCancelButtonActionListener(cancelActionListener);
+		}
+		return buttonPanel;
+	}
+	
+	
+	void updateLayerCombo(){
+		DefaultComboBoxModel defaultModel = 
+        	new DefaultComboBoxModel(getLayerNames());
+        layersComboBox.setModel(defaultModel);
+	}
+	
+	public boolean wasFinishPressed(){
+		return wasFinishPressed;
+	}
+	
+	protected FLayer[] getLayerForType(FLayers layers){
+		FLayer[] solution = null;
+		int numLayers = layers.getLayersCount();
+		if(layers != null &&  numLayers > 0){
+			ArrayList list = new ArrayList();
+			for(int i = 0; i < numLayers; i++){
+				FLayer layer = layers.getLayer(i);
+				if(layerType != null){
+					if(!layer.getClass().isAssignableFrom(layerType))
+						continue;
+					if(layer instanceof FLyrVect){
+						try {
+							if(((FLyrVect)layer).getShapeType() != geometryType)
+								continue;
+							list.add(layer);
+						} catch (DriverException e) {
+							continue;
+						}
+					}//if	
+				}//if
+				if(layer instanceof FLayers){
+					list.addAll(Arrays.asList(getLayerForType((FLayers)layer)));
+				}
+			}//for
+			solution = new FLyrVect[list.size()];
+			list.toArray(solution);
+		}//if
+		return solution;
+	}
+	
+	protected String[] getLayerNames() {
+		String[] solution = null;
+		ArrayList nameList = new ArrayList();
+		FLayer[] layers = getLayerForType(this.layers);
+		for(int i = 0; i < layers.length; i++){
+			nameList.add(layers[i].getName());
+		}
+		solution = new String[nameList.size()];
+		nameList.toArray(solution);
+		return solution;
+	}
+	
+	private JComboBox getLayersComboBox() {
+		if (layersComboBox == null) {
+            layersComboBox = new JComboBox();
+		}
+		updateLayerCombo();
+		return layersComboBox;
+	}
+	
+	public static void closeParent(JPanel component){
+		Container container = component.getParent();
+		Container parentOfContainer = null;
+		while(! (container instanceof Window)){
+			parentOfContainer = container.getParent();
+			container = parentOfContainer;
+		}
+		((Window)container).dispose();
+	}
+	
+	
+	
+	public WindowInfo getWindowInfo() {
+		  if (wi==null) {
+	            wi = new WindowInfo(WindowInfo.MODALDIALOG);
+	            wi.setWidth(290);
+	            wi.setHeight(120);
+	            wi.setTitle(title);
+	        }
+	        return wi;
+	}
+
+}  //  @jve:decl-index=0:visual-constraint="10,10"
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/LayerSelectionPanel.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/HTMLEditorKit.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/HTMLEditorKit.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/HTMLEditorKit.java	(revision 12191)
@@ -0,0 +1,90 @@
+/*
+ * Created on 20-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.2  2006-11-09 12:25:06  fjp
+* El fichero de red pasa a llamarse .net y se escribe sobre el directorio temporal del usuario. Tambi�n se mira si existe ah� para habilitar/deshabilitar la opci�n de carga.
+*
+* Revision 1.1  2006/10/20 19:54:01  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.graph.gui;
+
+import javax.swing.text.Element;
+import javax.swing.text.StyleConstants;
+import javax.swing.text.View;
+import javax.swing.text.ViewFactory;
+import javax.swing.text.html.HTML;
+
+import com.iver.cit.gvsig.graph.GenerateNetworkExtension;
+
+
+public class HTMLEditorKit extends javax.swing.text.html.HTMLEditorKit {
+	 public ViewFactory getViewFactory() {
+		    return new HTMLFactoryX();
+		  }
+
+
+		  public static class HTMLFactoryX extends HTMLFactory
+		    implements ViewFactory {
+		    
+		    public View create(Element elem) {
+		      Object o = 
+		        elem.getAttributes().getAttribute(StyleConstants.NameAttribute);
+		      if (o instanceof HTML.Tag) {
+			HTML.Tag kind = (HTML.Tag) o;
+		        if (kind == HTML.Tag.IMG) 
+		          return new ImageView(elem, GenerateNetworkExtension.class );
+		      }
+		      return super.create( elem );
+		    }
+		  }
+}
+
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/HTMLEditorKit.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/DlgDirections.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/DlgDirections.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/DlgDirections.java	(revision 12191)
@@ -0,0 +1,147 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.gui;
+
+import java.awt.Frame;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+
+import javax.swing.JDialog;
+import javax.swing.JScrollPane;
+import javax.swing.JTextPane;
+import com.hardcode.gdbms.engine.values.DoubleValue;
+import com.iver.cit.gvsig.fmap.core.IFeature;
+
+public class DlgDirections extends JDialog {
+
+	private JScrollPane jScrollPane = null;
+
+	private JTextPane jTextPane = null;
+
+	/**
+	 * This method initializes
+	 *
+	 * @param b
+	 * @param frame
+	 *
+	 */
+	public DlgDirections(Frame frame, boolean b) {
+		super(frame, b);
+		initialize();
+	}
+
+	/**
+	 * Es responsabilidad del interfaz de usuario presentar el modelo a su
+	 * manera.
+	 *
+	 * @param features
+	 */
+	public void setModel(ArrayList featureList) {
+		String cad = "Pasa por:";
+		int cont = 0;
+		double longitud = 0, sumaLong = 0, longAnt = 0;
+		String cadAnt = "";
+		NumberFormat nf = NumberFormat.getInstance();
+		nf.setMaximumFractionDigits(2);
+		for (int i = featureList.size() - 1; i >= 0; i--) {
+			// INSTRUCCIONES
+			IFeature feat = (IFeature) featureList.get(i);
+			DoubleValue length = (DoubleValue) feat.getAttribute(2);
+			double dist = length.doubleValue();
+			longitud = longitud + dist;
+			sumaLong = sumaLong + dist;
+
+			String cadProv = feat.getAttribute(3).toString();
+			if ((cadAnt.compareTo(cadProv) != 0) && (cont > 0)) {
+				longitud = dist;
+				cad = cad + "\n" + cadAnt + " " + nf.format(longAnt)
+						+ " metros";
+
+			}
+			longAnt = longitud;
+			cadAnt = cadProv;
+
+			cont = cont + 1;
+		}
+		cad = cad + "\n" + cadAnt + " " + nf.format(longAnt) + " metros";
+		cad = cad + "\n" + "=================" + "\n"
+				+ "Distancia total recorrida: " + nf.format(sumaLong)
+				+ " metros";
+		getJTextPane().setText(cad);
+	}
+
+	/**
+	 * This method initializes this
+	 *
+	 */
+	private void initialize() {
+		this.setSize(new java.awt.Dimension(363, 254));
+		this.setContentPane(getJScrollPane());
+
+	}
+
+	/**
+	 * This method initializes jScrollPane
+	 *
+	 * @return javax.swing.JScrollPane
+	 */
+	private JScrollPane getJScrollPane() {
+		if (jScrollPane == null) {
+			jScrollPane = new JScrollPane();
+			jScrollPane.setViewportView(getJTextPane());
+		}
+		return jScrollPane;
+	}
+
+	/**
+	 * This method initializes jTextPane
+	 *
+	 * @return javax.swing.JTextPane
+	 */
+	private JTextPane getJTextPane() {
+		if (jTextPane == null) {
+			jTextPane = new JTextPane();
+		}
+		return jTextPane;
+	}
+
+} // @jve:decl-index=0:visual-constraint="10,10"
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/DlgDirections.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/RouteReportPanel.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/RouteReportPanel.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/RouteReportPanel.java	(revision 12191)
@@ -0,0 +1,478 @@
+/*
+ * Created on 19-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.14  2006-11-20 08:44:55  fjp
+* borrar tramos amarillos, seleccionar solo campos num�ricos y situar las barreras encima del tramo invalidado
+*
+* Revision 1.13  2006/11/14 16:12:01  fjp
+* *** empty log message ***
+*
+* Revision 1.12  2006/11/08 16:48:20  fjp
+* *** empty log message ***
+*
+* Revision 1.11  2006/11/06 17:19:02  fjp
+* Depurando el aspecto
+*
+* Revision 1.10  2006/11/06 13:21:38  fjp
+* detalles
+*
+* Revision 1.9  2006/10/27 10:17:27  fjp
+* Correcto. Falta ponerlo bonito.
+*
+* Revision 1.8  2006/10/26 17:47:14  fjp
+* previo a formato
+*
+* Revision 1.7  2006/10/26 11:42:42  fjp
+* Ya pita, ya.
+*
+* Revision 1.6  2006/10/25 15:51:20  fjp
+* por terminar lo de los giros
+*
+* Revision 1.5  2006/10/25 14:47:34  fjp
+* *** empty log message ***
+*
+* Revision 1.4  2006/10/24 18:42:05  azabala
+* *** empty log message ***
+*
+* Revision 1.3  2006/10/23 18:51:42  azabala
+* *** empty log message ***
+*
+* Revision 1.2  2006/10/20 19:54:01  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/19 19:09:43  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.graph.gui;
+
+import java.awt.BasicStroke;
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.geom.Rectangle2D;
+import java.text.NumberFormat;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.StringTokenizer;
+
+import javax.swing.JEditorPane;
+import javax.swing.JPanel;
+import javax.swing.JScrollPane;
+import javax.swing.event.HyperlinkEvent;
+import javax.swing.event.HyperlinkListener;
+
+
+
+import com.hardcode.gdbms.engine.values.DoubleValue;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.andami.ui.mdiManager.WindowInfo;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.IFeature;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
+import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
+import com.iver.cit.gvsig.fmap.rendering.FGraphic;
+import com.iver.cit.gvsig.graph.core.TurnUtil;
+import com.iver.cit.gvsig.graph.solvers.Route;
+
+public class RouteReportPanel extends JPanel implements IWindow{
+	
+	private final String START_IMAGE = "<img src=\"images/drapeau_depart.gif\">";
+	private final String STOP_IMAGE = "<img src=\"images/drapeau_arrivee.gif\">";
+	private final String LEFT_IMAGE = "<img src=\"images/turn-left.png\">";
+	private final String RIGHT_IMAGE = "<img src=\"images/turn-right.png\">";
+	private final String STRAIGHT_IMAGE = "<img src=\"images/gtk-go-up.png\">";
+	
+	private final String LINE_SEPARATOR = "<hr width =\"70%\">";
+	
+	private Route route;
+	
+	private JScrollPane scrollPanel;
+	private JEditorPane htmlPanel;
+	private WindowInfo viewInfo;
+	
+	
+	private String htmlText;
+	private MapControl mapControl;
+	
+	//Para poder poner duraci�n, etc.
+	private String weightText = "Longitud:";
+	
+	//Distancias y costes acumulados (entre dos cambios de calles)
+	private double acumuledLenght = 0d;
+	private double acumuledWeight = 0d;
+	
+	private double totalLenght = 0d;
+	private double totalWeight = 0d;
+	
+	
+	
+	private int numberOfStreets = 1;//partimos de 1 porque consideramos la salida
+	private ArrayList tramesOfSameStreet = new ArrayList();
+	
+	NumberFormat nf = NumberFormat.getInstance();
+	
+	
+	public RouteReportPanel(Route route, MapControl mapControl){
+		super();
+		setLayout(new BorderLayout());
+		this.route = route;
+		this.mapControl = mapControl;
+		scrollPanel = new JScrollPane();
+		htmlPanel = new JEditorPane();
+		htmlPanel.setEditable(false);
+		htmlPanel.setEditorKit(new HTMLEditorKit());
+		
+		nf.setMaximumFractionDigits(2);
+		
+		final MapControl map = mapControl;
+		final Route routeTemp = route;
+		final MapControl mapControlTemp = mapControl;
+		htmlPanel.addHyperlinkListener(new HyperlinkListener(){
+			ArrayList previousSelection;
+			public void hyperlinkUpdate(HyperlinkEvent e) {
+				if (e.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+					Rectangle2D bounds = null; 
+					StringTokenizer st = new StringTokenizer(e.getDescription(),",");
+					System.err.println("E.GETDESCRIPTION():" + e.getDescription());
+					ArrayList features = new ArrayList();
+				     while (st.hasMoreTokens()) {
+				    	 int indexOfFeature = Integer.parseInt(st.nextToken());
+				    	 IFeature feature = (IFeature) routeTemp.getFeatureList().get(indexOfFeature);
+				    	 if(bounds == null)
+				    		 bounds = feature.getGeometry().getBounds2D();
+				    	 else
+				    		 bounds.add(feature.getGeometry().getBounds2D());
+				    	 features.add(feature);
+				     }
+					if(bounds != null){
+						bounds = expand(bounds);
+						GraphicLayer graphicLayer = mapControlTemp.getMapContext().getGraphicsLayer();
+						if(previousSelection != null){
+							for(int i = 0; i < previousSelection.size(); i++){
+								graphicLayer.removeGraphic((FGraphic) previousSelection.get(i));
+							}
+						}
+						previousSelection = new ArrayList();
+						FSymbol lineSymbol = new FSymbol(FShape.LINE, Color.YELLOW);
+						lineSymbol.setStroke(new BasicStroke(3.0f));
+						int idSymbolLine = graphicLayer.addSymbol(lineSymbol);
+						for(int i = 0; i < features.size(); i++ ){
+							IGeometry gAux = ((IFeature)features.get(i)).getGeometry();
+							FGraphic graphic = new FGraphic(gAux, idSymbolLine);
+							graphic.setTag("ROUTE");
+							graphicLayer.addGraphic( graphic);
+							previousSelection.add(graphic);
+						}
+						mapControlTemp.drawGraphics();
+						map.getMapContext().getViewPort().setExtent(bounds);
+					}	
+			      }
+			}});
+		initialize();
+		scrollPanel.setViewportView(htmlPanel);
+		add(scrollPanel, BorderLayout.CENTER);
+	}
+	
+	
+	private Rectangle2D expand(Rectangle2D rect){
+		double xmin = rect.getMinX();
+		double ymin = rect.getMinY();
+		double width = rect.getWidth();
+		double height = rect.getHeight();
+		
+		xmin -= width ;
+		ymin -= height ;
+		double newWidth = width * 2;
+		double newHeight = height * 2 ;
+		return new Rectangle2D.Double(xmin, ymin, newWidth, newHeight);
+	}
+	
+	
+	public void setRoute(Route route){
+		this.route = route;
+		initialize();
+	}
+	
+	private void initialize(){
+		htmlText = "<head>";
+		htmlText += "<style type='text/css'>";
+		htmlText += "<!-- ";
+		htmlText += "  .normal { ";
+		htmlText += "	font-family: Arial, Helvetica, sans-serif;	font-size: 10px; font-style: normal; color: #333333;";
+		htmlText += "}";
+		htmlText += "  a { ";
+		htmlText += "	font-family: Arial, Helvetica, sans-serif;	font-size: 10px; font-style: italic; font-weight: bold;";
+		htmlText += "}";
+		htmlText += "  h1 { ";
+		htmlText += "	font-family: Arial, Helvetica, sans-serif;	font-size: 14px;";
+		htmlText += "}";		
+		htmlText += "  .distancia { ";
+		htmlText += "	font-family: Arial, Helvetica, sans-serif;	font-size: 10px; color: #666666;";
+		htmlText += "}";
+		htmlText += "  .resumen { ";
+		htmlText += "	font-family: Arial, Helvetica, sans-serif;	font-size: 12px; color: #333333;";
+		htmlText += "}";
+		htmlText += "  .left { ";
+		htmlText += "	font-weight: bold; color: #990000;";
+		htmlText += "}";
+		htmlText += "  .right { ";
+		htmlText += "	font-weight: bold; color: #0033FF;";
+		htmlText += "}";
+		
+		htmlText += " -->";
+		htmlText += "</style>";
+		htmlText += "</head>";
+		htmlText += "<body>";
+		ArrayList features = route.getFeatureList();
+		
+		//Route is ordered from the the start to the end
+		IFeature firstFeature = (IFeature) features.get(0);
+		IFeature lastFeature = (IFeature) features.get(features.size() - 1);
+		
+		renderHeader(firstFeature, lastFeature);
+		renderFirstStrech(firstFeature);
+		
+		IFeature previousFeature = firstFeature;
+		for (int i = 1; i < features.size() ; i++) {
+			IFeature feature = (IFeature) features.get(i);
+			renderStrech(feature , previousFeature, i);
+			previousFeature = feature;
+		}
+		
+		//TODO
+		//Invertir el FIRST y el LAST
+		//Borrar el graphics resaltado cuando se resalte otro
+		renderLastStretch((IFeature)features.get(features.size() -1), previousFeature);
+		htmlText += "</body>";
+		System.out.println(htmlText);
+		htmlPanel.setText(htmlText);
+		
+	}
+	
+	
+	
+	
+	
+	private void renderHeader(IFeature firstFeature, IFeature lastFeature){
+		String startName = firstFeature.getAttribute(Route.TEXT_INDEX).toString();
+		String stopName = lastFeature.getAttribute(Route.TEXT_INDEX).toString();
+		htmlText += "<h1>";
+		htmlText += "Informe de Ruta:" + startName + "-" + stopName ;//TODO INTERNACIONALIZAR ESTO
+		htmlText += "</h1><br>";
+		htmlText += "<span class='resumen'>Salida desde: <b>";//TODO INTERNAC
+		htmlText += startName;
+		htmlText += "</b><br>";
+		htmlText += "Llegada a:<b> ";//TODO INTERNAC
+		htmlText += stopName + "</b><br>";
+		
+		//TODO METER LA LONGITUD TOTAL DEL TRAYECTO AQUI
+		htmlText += "Longitud total del trayecto: <b>" + nf.format(getLengthOfRoute()) + "</b></span>";
+		htmlText += LINE_SEPARATOR;
+	}
+	
+	private double getLengthOfRoute() {
+		double solution = 0d;
+		ArrayList featureList = route.getFeatureList();
+		for(int i = 0; i < featureList.size(); i++){
+			IFeature feature = (IFeature) featureList.get(i);
+			solution += ((DoubleValue)feature.getAttribute(Route.LENGTH_INDEX)).getValue();
+		}
+		return solution;
+	}
+
+
+	private void renderFirstStrech(IFeature feature){
+		htmlText += "<table>";
+		htmlText += "<tr>";
+		htmlText += "<td width='40'>";
+		htmlText += START_IMAGE;
+		htmlText += "</td>";
+		htmlText += "<td class='normal'>";
+		htmlText += "1. Salir de:<b> ";//TODO INTERNAC
+		htmlText += feature.getAttribute(Route.TEXT_INDEX);
+		htmlText += "</b></td></tr>";
+		htmlText += "<tr>"; 
+		htmlText += "<td width='40'></td><td><a href=\""+0+"\">Ver sobre el mapa</a><td></tr>";
+		htmlText += "</table>";
+		htmlText += LINE_SEPARATOR;
+		
+		double length = ((DoubleValue)feature.getAttribute(Route.LENGTH_INDEX)).getValue();
+		double weight = ((DoubleValue)feature.getAttribute(Route.WEIGHT_INDEX)).getValue();
+		acumuledLenght += length;
+		acumuledWeight += weight;
+		
+		totalLenght += length;
+		totalWeight += weight;
+		
+		tramesOfSameStreet.add(new Integer(0));
+	}
+	
+	private void renderStrech(IFeature feature, IFeature previousFeature, int index){
+		String street1 =  previousFeature.getAttribute(Route.TEXT_INDEX).toString();
+		String street2 = feature.getAttribute(Route.TEXT_INDEX).toString();
+		boolean changeStreet = ! street1.equalsIgnoreCase(street2);
+		double length = ((DoubleValue)feature.getAttribute(Route.LENGTH_INDEX)).getValue();
+		double weight = ((DoubleValue)feature.getAttribute(Route.WEIGHT_INDEX)).getValue();
+		
+		String textoTramo = null;
+		String imageTurn = null;
+		
+		if(changeStreet){
+			numberOfStreets++;
+			String prefix = "Contin�e por <b>" + street1 + "</b> durante  "+
+			nf.format(acumuledLenght)+" y ";
+			int direction = TurnUtil.getDirection(previousFeature, feature);
+			
+			if(direction == TurnUtil.GO_STRAIGH_ON){
+				textoTramo = prefix + " prosiga por <b>"+ street2 + "</b>";
+				imageTurn = STRAIGHT_IMAGE;
+				
+			}else if(direction == TurnUtil.TURN_LEFT){
+				textoTramo = prefix += " gire a la <span class='left'><b>izquierda</b></span> por <b>" + street2 + "</b>";
+				imageTurn = LEFT_IMAGE;
+				
+			}else if(direction == TurnUtil.TURN_RIGHT){
+				textoTramo = prefix += " gire a la <span class='right'><b>derecha</b></span> por <b>" + street2 + "</b>";
+				imageTurn = RIGHT_IMAGE;	
+			}
+			htmlText += "<table>";
+			htmlText += "<tr>";
+			htmlText += "<td width='40'>";
+			htmlText += imageTurn;
+			htmlText += "</td>";
+			htmlText += "<td class='normal'>";
+			htmlText += numberOfStreets+" "+textoTramo;//TODO INTERNAC
+			htmlText += "</td></tr>";
+			htmlText += "<tr>";
+			htmlText += "<td with='40'></td><td class='distancia'>Distancia acumulada:"+nf.format(totalLenght)+"</td></tr>";
+			
+			if(!weightText.equalsIgnoreCase("Longitud:"))
+			{
+				htmlText += "<tr>";
+				htmlText += "<td with='40'></td><td class='distancia'>Coste:"+nf.format(totalWeight)+"</td></tr>";
+			}
+			
+			String features = "";
+			for(int i = 0; i < tramesOfSameStreet.size() -1; i++){
+				int featureIndex = ((Integer) tramesOfSameStreet.get(i)).intValue();
+				features += featureIndex + ",";
+			}
+			
+			features += ((Integer)tramesOfSameStreet.get(tramesOfSameStreet.size()-1)).intValue();
+//			System.out.println("features = " + features);
+			htmlText += "<tr><td with='40'></td><td><a href=\""+features+"\">Ver sobre el mapa</a><td></tr>";
+			htmlText += "</table>";
+			htmlText += LINE_SEPARATOR;
+			
+			acumuledLenght = length;
+			acumuledWeight = weight;
+			tramesOfSameStreet.clear();
+	
+			
+		}else{
+			acumuledLenght += length;
+			acumuledWeight += weight;
+		}
+		
+		tramesOfSameStreet.add(new Integer(index));
+		totalLenght += length;
+		totalWeight += weight;
+		
+	}
+	
+	
+	
+	private void renderLastStretch(IFeature feature, IFeature previousFeature){
+		
+//		double length = ((DoubleValue)feature.getAttribute(Route.LENGTH_INDEX)).getValue();
+//		double weight = ((DoubleValue)feature.getAttribute(Route.WEIGHT_INDEX)).getValue();
+//		
+//		
+//		totalLenght += length;
+//		totalWeight += weight;
+		
+		htmlText += "<table>";
+		htmlText += "<tr>";
+		htmlText += "<td width='40'>";
+		htmlText += STOP_IMAGE;
+		htmlText += "</td>";
+		htmlText += "<td>";
+		htmlText += numberOfStreets+". Llegada: ";//TODO INTERNAC
+		htmlText += feature.getAttribute(Route.TEXT_INDEX);
+		htmlText += "</td></tr>";
+		htmlText += "<tr><td with='40'></td><td>Longitud:"+nf.format(totalLenght)+"</td></tr>";
+		
+		if(!weightText.equalsIgnoreCase("Longitud:"))
+			htmlText += "<tr><td with='40'></td><td class='distancia'>Coste:"+totalWeight+"</td></tr>";
+		htmlText += "<tr><td with='40'></td><td><a href=\""+(route.getFeatureList().size()-1)+"\">Ver sobre el mapa</a><td></tr>";
+		htmlText += "</table>";
+	}
+
+	public WindowInfo getWindowInfo() {
+		if (viewInfo == null) {
+			viewInfo = new WindowInfo(WindowInfo.MODELESSDIALOG | 
+										WindowInfo.RESIZABLE | 
+										WindowInfo.MAXIMIZABLE |
+										WindowInfo.ICONIFIABLE | 
+										WindowInfo.PALETTE);
+			viewInfo.setTitle("Informe de la ruta calculada");//Internacionalizar esto
+			viewInfo.setWidth(400);
+			viewInfo.setHeight(350);
+		}
+		return viewInfo;
+	}
+	
+	
+	
+	
+	
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/gui/RouteReportPanel.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvNode.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvNode.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvNode.java	(revision 12191)
@@ -0,0 +1,162 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+import java.util.ArrayList;
+
+public class GvNode {
+	public final static int statNotInList = 0;
+	public final static int statNowInList = 1;
+	public final static int statWasInList = 2;
+	private int idNode;
+	private double x;
+	private double y;
+	
+	int from_link = -1; // id del Arco desde el que hemos llegado
+	int   numSoluc = 0; // Empezamos con esto a cero en toda la red. 
+					// De manera global, habr� una variable numSolucGlobal que indica el n� de cada petici�n de ruta.
+					// Sirve para no tener que inicializar siempre tooooda la red. Lo que hacemos es comparar el 
+					// n� de petici�n global con este. Si no coinciden, antes de hacer nada hay que inicializar su
+					// best_cost a infinito.
+
+	double best_cost = Double.MAX_VALUE;
+	double accumulatedLength = 0;
+	double stimation = Double.MAX_VALUE; // bestCost + algo relacionado con la distancia al destino
+	int status;
+	ArrayList enlaces  = new ArrayList(); // Enlaces con los vecinos
+	ArrayList giros = new ArrayList(); // Costes de los giros. Si existe un CGiro, miraremos su coste y lo a�adimos.
+						  // Si es negativo, suponemos que es un giro prohibido.
+
+	public GvNode() {
+		initialize();
+	}
+	
+	public void initialize() {
+		numSoluc = AbstractNetSolver.numSolucGlobal;
+		from_link = -1;
+		best_cost = Double.MAX_VALUE;
+		stimation = Double.MAX_VALUE;
+		accumulatedLength = 0;
+		status = statNotInList;
+
+	}
+	
+	public int getIdNode() {
+		return idNode;
+	}
+	public void setIdNode(int idNode) {
+		this.idNode = idNode;
+	}
+	public double getX() {
+		return x;
+	}
+	public void setX(double x) {
+		this.x = x;
+	}
+	public double getY() {
+		return y;
+	}
+	public void setY(double y) {
+		this.y = y;
+	}
+	public double getBestCost() {
+		return best_cost;
+	}
+	public void setBestCost(double best_cost) {
+		this.best_cost = best_cost;
+	}
+	public ArrayList getEnlaces() {
+		return enlaces;
+	}
+	public void setEnlaces(ArrayList enlaces) {
+		this.enlaces = enlaces;
+	}
+	public double getStimation() {
+		return stimation;
+	}
+	public void setStimation(double estimacion) {
+		this.stimation = estimacion;
+	}
+	public int getFromLink() {
+		return from_link;
+	}
+	public void setFromLink(int from_link) {
+		this.from_link = from_link;
+	}
+	public ArrayList getTurns() {
+		return giros;
+	}
+	public void setTurns(ArrayList turns) {
+		this.giros = turns;
+	}
+	public int getNumSoluc() {
+		return numSoluc;
+	}
+	public void setNumSoluc(int numSoluc) {
+		this.numSoluc = numSoluc;
+	}
+	public int getStatus() {
+		return status;
+	}
+	public void setStatus(int status) {
+		this.status = status;
+	}
+
+	public void calculateStimation(GvNode finalNode, double newCost) {
+		double DeltaX = ((finalNode.getX() - x)/1000.0)*((finalNode.getX() - x)/1000.0);
+		double DeltaY = ((finalNode.getY() - y)/1000.0)*((finalNode.getY() - y)/1000.0);
+		double distLineaRecta = Math.sqrt(DeltaX + DeltaY); // En Km
+		stimation = newCost + (distLineaRecta* 30.0);  // Segundos que tardamos en recorrer esos Km a 120 Km/hora
+
+		
+	}
+
+	public double getAccumulatedLength() {
+		return accumulatedLength;
+	}
+
+	public void setAccumulatedLength(double accumulatedLength) {
+		this.accumulatedLength = accumulatedLength;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvNode.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/NodeGv.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/NodeGv.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/NodeGv.java	(revision 12191)
@@ -0,0 +1,68 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+import com.vividsolutions.jts.geom.Coordinate;
+
+public class NodeGv {
+
+	private Integer id;
+	private Coordinate c;
+	public NodeGv(Coordinate pt, int id) {
+		c = pt;
+		this.id = new Integer(id);
+	}
+	public Coordinate getCoordinate() {
+		return c;
+	}
+	public void setCoordinate(Coordinate c) {
+		this.c = c;
+	}
+	public Integer getId() {
+		return id;
+	}
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/NodeGv.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/JungGraph.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/JungGraph.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/JungGraph.java	(revision 12191)
@@ -0,0 +1,110 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+import java.util.ArrayList;
+
+import edu.uci.ics.jung.graph.Vertex;
+import edu.uci.ics.jung.graph.impl.AbstractSparseGraph;
+
+public class JungGraph extends AbstractSparseGraph {
+	// Estamos obligados a mantener una lista privada porque los nodos
+	// y los edges en Jung se numeran incrementando una variable
+	// est�tica (ver nextGlobalEdgeId, en AbstractSparseEdge)
+	// TODO: NO heredar de AbstractSparseGraph, sino copiar y pegar c�digo.
+	// de esta forma quiz�s obtengamos una clase de jung, pero mucho m�s r�pida y
+	// eficiente en consumo de memoria. Y compatible por completo con IGraph
+	private ArrayList myVertexList;
+	private ArrayList myEdgeList;
+	public JungGraph(IGraph g) {
+		super();
+		long t1 = System.currentTimeMillis();
+		myVertexList = new ArrayList(g.numVertices());
+		myEdgeList = new ArrayList(g.numEdges());
+		for (int i=0; i < g.numVertices(); i++)
+		{
+			GvNode n = g.getNodeByID(i);
+			FNode v = new FNode(i, n.getX(), n.getY());
+			addVertex(v);
+			myVertexList.add(v);
+			
+		}
+		for (int i=0; i < g.numEdges(); i++)
+		{
+			GvEdge e = g.getEdgeByID(i);
+			Vertex vFrom = getVertexByID(e.getIdNodeOrig()); // (Vertex) indexer.getVertex(e.getIdNodeOrig());
+			Vertex vTo = getVertexByID(e.getIdNodeEnd()); //indexer.getVertex(e.getIdNodeEnd());
+			
+			FEdge edge = new FEdge(vFrom, vTo);
+			edge.setArcID(e.getIdArc());
+			edge.setDirection(e.getDirec());
+			edge.setIdNodeOrig(e.getIdNodeOrig());
+			edge.setIdNodeEnd(e.getIdNodeEnd());
+			edge.setType(e.getType());
+			edge.setWeight(e.getDistance());
+			edge.setCost2(e.getWeight());
+			
+			addEdge(edge);
+			myEdgeList.add(edge);
+		}
+		long t2 = System.currentTimeMillis();
+		System.out.println("Tiempo de carga copiando desde IGraph a JUNG network: " + (t2-t1) + " msecs");
+		
+	}
+	
+	public FNode getVertexByID(int idNode) {
+		
+		return (FNode) myVertexList.get(idNode);
+	}
+
+	public FEdge getEdgeByID(int idEdge) {
+		return (FEdge) myEdgeList.get(idEdge);
+	}
+
+//	public EdgePair getEdgesByIdArc(int idArc) {
+//		// TODO Auto-generated method stub
+//		return null;
+//	}
+	
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/JungGraph.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvTurn.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvTurn.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvTurn.java	(revision 12191)
@@ -0,0 +1,49 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+public class GvTurn {
+	int idTramoOrigen;
+	int idTramoDestino;
+	double cost;
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvTurn.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/TurnUtil.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/TurnUtil.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/TurnUtil.java	(revision 12191)
@@ -0,0 +1,156 @@
+/*
+ * Created on 20-oct-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.4  2006-10-26 11:42:42  fjp
+* Ya pita, ya.
+*
+* Revision 1.3  2006/10/25 15:51:20  fjp
+* por terminar lo de los giros
+*
+* Revision 1.2  2006/10/23 18:51:42  azabala
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/20 19:54:01  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.graph.core;
+
+import com.iver.andami.PluginServices;
+import com.iver.cit.gvsig.fmap.core.IFeature;
+import com.vividsolutions.jts.algorithm.CGAlgorithms;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.LineSegment;
+import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.MultiLineString;
+
+public class TurnUtil {
+	public static final int TURN_RIGHT = 0;
+	public static final int TURN_LEFT = 1;
+	public static final int GO_STRAIGH_ON = 2;
+	public static final int TURN_U = 4;
+	
+	
+	public static boolean checkIsLine(Geometry geometry){
+		if(geometry instanceof LineString || geometry instanceof MultiLineString)
+			return true;
+		else
+			return false;
+		
+	}	
+	
+	
+	
+	public static final int getDirection(IFeature feature1, IFeature feature2){
+		Geometry geom1 = feature1.getGeometry().toJTSGeometry();
+		Geometry geom2 = feature2.getGeometry().toJTSGeometry();
+		if(!checkIsLine(geom1))
+			return -1;
+		if(!checkIsLine(geom2))
+			return -1;
+	    Coordinate[] coords1 = geom1.getCoordinates();
+	    Coordinate p0 = coords1[coords1.length -2];
+	    Coordinate p1 = coords1[coords1.length -1];
+	    Coordinate[] coords2 = geom2.getCoordinates();
+	    Coordinate p2 = coords2[1];
+	    
+	     double deegreeAngle = angle(p0, p1, p2);
+	         
+	     if(Math.abs(deegreeAngle) <= 30)
+	    	 return GO_STRAIGH_ON;
+	     else if(deegreeAngle > 180)
+	    	 return TURN_LEFT;
+	     else
+	    	 return TURN_RIGHT;
+	}	
+	public static double angle(Coordinate c1, Coordinate c2, Coordinate c3) {
+		double resul = 0.0;
+		// Normalizamos:
+		Coordinate origin = new Coordinate(0.0, 0.0);
+		Coordinate cAux1 = new Coordinate(c2.x-c1.x, c2.y-c1.y);
+		Coordinate cAux2 = new Coordinate(c3.x-c2.x, c3.y-c2.y);
+		LineSegment v1 = new LineSegment(origin, cAux1);
+		LineSegment v2 = new LineSegment(origin, cAux2);
+		double prodEscalar = cAux1.x*cAux2.x + cAux1.y*cAux2.y;
+		double cosAlpha = prodEscalar / (v1.getLength() * v2.getLength()) ; 
+		resul = Math.toDegrees(Math.acos(cosAlpha));
+		
+        if (cAux1.x * cAux2.y > cAux1.y * cAux2.x) {
+            resul = 360 - resul;
+        }
+
+//		System.out.println("angulo = " + resul);
+		return resul;
+	}
+	
+	/**
+	 * 
+	 * Code extracted from JUMP
+	 * 
+	   * Returns the angle between two vectors.
+	   * @param a1 the angle of one vector, between -Pi and Pi
+	   * @param a2 the angle of the other vector, between -Pi and Pi
+	   * @return the angle (in radians) between the two vectors, between 0 and Pi
+	   */
+//	  public static double diff(double a1, double a2) {
+//	      double da;
+//
+//	      if (a1 < a2) {
+//	          da = a2 - a1;
+//	      } else {
+//	          da = a1 - a2;
+//	      }
+//
+//	      if (da > Math.PI) {
+//	          da = (2 * Math.PI) - da;
+//	      }
+//	      return da;
+//	  }
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/TurnUtil.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/IFlagListener.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/IFlagListener.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/IFlagListener.java	(revision 12191)
@@ -0,0 +1,59 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+/**
+ * @author fjp
+ * Util para avisar de un cambio en los flags (a�adido, borrado
+ * cambio de orden....). Los listener (el manager, por ejemplo)
+ * tendr�n que refrescar su contenido y redibujar el graphics
+ * del mapcontrol
+ */
+public interface IFlagListener {
+	public final static int FLAG_ADDED = 0;
+	public final static int FLAG_REMOVED = 1;
+	public final static int FLAG_REORDER = 2;
+	public final static int FLAG_MANY_CHANGES = 3;
+	
+	void flagsChanged(int reason);
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/IFlagListener.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/Network.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/Network.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/Network.java	(revision 12191)
@@ -0,0 +1,931 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+import java.awt.geom.PathIterator;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.Map;
+import java.util.TreeMap;
+
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.v02.FConverter;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.layers.CancelationException;
+import com.iver.cit.gvsig.fmap.layers.FBitSet;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.VectorialAdapter;
+import com.iver.cit.gvsig.graph.GraphException;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.LineSegment;
+import com.vividsolutions.jts.geom.MultiLineString;
+
+public class Network {
+	protected FLyrVect lyrVect;
+
+	protected IGraph graph;
+
+	protected ArrayList flags = new ArrayList();
+
+	protected int numOriginalEdges;
+
+	protected int numOriginalNodes;
+
+	private ArrayList modifiedCosts = new ArrayList();
+	private ArrayList flagListeners = new ArrayList();
+	private boolean dispatching = true;
+
+	public void reconstruyeTramo(int idArc) {
+		GvNode pN1;
+		int i;
+		
+		// Si encontramos un enlace con idEdge >= numOriginalEdges, lo cambiamos.
+		// Y CON ESE IDarc!!
+		// Si hay varios, no pasa nada, volvemos a llamar a esta funci�n con IdTramo
+
+		EdgePair edgePair = graph.getEdgesByIdArc(idArc);
+		if (edgePair.getIdEdge() != -1)
+		{
+			// Restauramos los enlaces de los nodos de ese tramo.
+//			pN1 = &Nodos[Arcos[IndiceArcos[idTramo].idArco].idNodo1];
+//			pN2 = &Nodos[Arcos[IndiceArcos[idTramo].idArco].idNodo2];
+			GvEdge edge = graph.getEdgeByID(edgePair.getIdEdge());
+			pN1 = graph.getNodeByID(edge.getIdNodeOrig());
+
+			// Metemos idArco en los enlaces de Nodo1
+			for (i=0; i< pN1.getEnlaces().size(); i++)
+			{
+				GvEdge auxEdge = (GvEdge) pN1.getEnlaces().get(i);
+				if (auxEdge.getIdArc() == idArc)
+				{
+					if (auxEdge.getIdEdge() >= numOriginalEdges) 
+					{
+						pN1.getEnlaces().set(i, graph.getEdgeByID(edgePair.getIdEdge()));
+						break;
+					}
+				}
+			}
+		}
+
+		if (edgePair.idInverseEdge != -1)
+		{
+//			pN1 = &Nodos[Arcos[IndiceArcos[idTramo].idContraArco].idNodo1];
+//			pN2 = &Nodos[Arcos[IndiceArcos[idTramo].idContraArco].idNodo2];
+			GvEdge edge = graph.getEdgeByID(edgePair.getIdInverseEdge());
+			pN1 = graph.getNodeByID(edge.getIdNodeOrig());
+
+			for (i=0; i< pN1.getEnlaces().size(); i++)
+			{
+				if (edge.getIdArc() == idArc)
+				{
+					GvEdge auxEdge = (GvEdge) pN1.getEnlaces().get(i);
+					if (auxEdge.getIdEdge() >= numOriginalEdges) 
+					{
+						pN1.getEnlaces().set(i, graph.getEdgeByID(edgePair.getIdInverseEdge()));
+						break;
+					}
+				}
+			}
+		}
+
+		int numEdges = graph.numEdges();
+		int numNodes = graph.numVertices();
+		for (int idEdge = numEdges-1; idEdge >= numOriginalEdges; idEdge--)
+		{
+			graph.removeEdge(idEdge);
+		}
+		for (int idNode = numNodes-1; idNode >= numOriginalNodes; idNode--)
+		{
+			graph.removeNode(idNode);
+		}
+
+	}
+
+	/**
+	 * Closest ID to this point. -1 if out from tolerance.
+	 * @param x
+	 * @param y
+	 * @param tolerance
+	 * @param nearest. Point to receive the nearest point ON arc.
+	 * @return
+	 */
+	public int findClosestArc(double x, double y, double tolerance, Point2D nearestPoint) {
+		Point2D p = new Point2D.Double(x, y);
+		FBitSet bitSet;
+		try {
+			bitSet = lyrVect.queryByPoint(p, tolerance);
+			VectorialAdapter va = (VectorialAdapter) lyrVect.getSource();
+			va.start();
+			double minDist = tolerance;
+			int foundGeom = -1;
+			for (int i = bitSet.nextSetBit(0); i >= 0; i = bitSet
+					.nextSetBit(i + 1)) {
+				IGeometry geom;
+				geom = va.getShape(i);
+				Point2D nearest = getNearestPoint(p, geom, tolerance);
+				if (nearest != null) {
+					double dist = nearest.distance(p);
+					if (dist < minDist) {
+						minDist = dist;
+						foundGeom = i;
+						nearestPoint.setLocation(nearest);
+					}
+				}
+			}
+			va.stop();
+			return foundGeom;
+		} catch (DriverException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		} catch (DriverIOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return -1;
+
+	}
+
+	protected Point2D getNearestPoint(Point2D point, IGeometry geom,
+			double tolerance) {
+		Point2D resul = null;
+		Coordinate c = new Coordinate(point.getX(), point.getY());
+
+		PathIterator theIterator = geom.getPathIterator(null,
+				FConverter.FLATNESS); // polyLine.getPathIterator(null,
+										// flatness);
+		double[] theData = new double[6];
+		double minDist = tolerance;
+		Coordinate from = null, first = null;
+		while (!theIterator.isDone()) {
+			// while not done
+			int theType = theIterator.currentSegment(theData);
+
+			switch (theType) {
+			case PathIterator.SEG_MOVETO:
+				from = new Coordinate(theData[0], theData[1]);
+				first = from;
+				break;
+
+			case PathIterator.SEG_LINETO:
+
+				// System.out.println("SEG_LINETO");
+				Coordinate to = new Coordinate(theData[0], theData[1]);
+				LineSegment line = new LineSegment(from, to);
+				Coordinate closestPoint = line.closestPoint(c);
+				double dist = c.distance(closestPoint);
+				if ((dist < minDist)) {
+					resul = new Point2D.Double(closestPoint.x, closestPoint.y);
+					minDist = dist;
+				}
+
+				from = to;
+				break;
+			case PathIterator.SEG_CLOSE:
+				line = new LineSegment(from, first);
+				closestPoint = line.closestPoint(c);
+				dist = c.distance(closestPoint);
+				if ((dist < minDist)) {
+					resul = new Point2D.Double(closestPoint.x, closestPoint.y);
+					minDist = dist;
+				}
+
+				from = first;
+				break;
+
+			} // end switch
+
+			theIterator.next();
+		}
+
+		return resul;
+	}
+
+	/**
+	 * TODO: POR TERMINAR!!!
+	 * 
+	 * @param flag
+	 * @return
+	 */
+	public int creaArcosVirtuales(GvFlag flag) {
+		// Devuelve el idNodo del nodo virtual creado.
+		/*
+		 * 0.- Creamos el nuevo Nodo virtual. 1.- Recorremos los arcos nuevos
+		 * mirando su idTramo. 2.- Si existe ese idtramo=> Ya hemos partido
+		 * antes ese idTramo. Buscamos el arco virtual que contiene ese nodo y
+		 * lo partimos. Ojo, recorrer hasta el final los tramos para asegurarnos
+		 * de que es el trozo m�s peque�o. 3.- Si NO existe, utilizamos el
+		 * IndiceArcos para coger los arcos que toca y partirlos.
+		 * 
+		 * 4.- OJO: Si el porcentaje es 0 � 100, no partimos el arco, devolvemos
+		 * el id del nodo que toca.
+		 */
+		// NUEVO: 20/7/2004:
+		// Cuando trabajamos con sentidos, al partir un arco no podemos insertar
+		// 2 nuevos sin mirar
+		// si es o no de un �nico sentido.) (Mirar idArco. Si es -1, no partimos
+		// el arco).
+		// FIN NUEVO
+		int idNodo1, idNodo2;
+		int idArco, elIdArco, elIdContraArco;
+		boolean encontrado;
+		GvNode newNode;
+
+		// Sacamos los idNodos del tramo
+		EdgePair edgePair = graph.getEdgesByIdArc(flag.getIdArc());
+		if (edgePair.getIdEdge() != -1) {
+			// idNodo1 = Arcos[IndiceArcos[idTramo].idArco].idNodo1;
+			// idNodo2 = Arcos[IndiceArcos[idTramo].idArco].idNodo2;
+			idNodo1 = graph.getEdgeByID(edgePair.getIdEdge()).getIdNodeOrig();
+			idNodo2 = graph.getEdgeByID(edgePair.getIdEdge()).getIdNodeEnd();
+
+		} else {
+			// idNodo2 = Arcos[IndiceArcos[idTramo].idContraArco].idNodo1;
+			// idNodo1 = Arcos[IndiceArcos[idTramo].idContraArco].idNodo2;
+			idNodo2 = graph.getEdgeByID(edgePair.getIdInverseEdge())
+					.getIdNodeOrig();
+			idNodo1 = graph.getEdgeByID(edgePair.getIdInverseEdge())
+					.getIdNodeEnd();
+
+		}
+
+		if (flag.getPct() == 0)
+			return idNodo1;
+		if (flag.getPct() == 1)
+			return idNodo2;
+
+		// Creamos el nodo de enmedio
+
+		// if (numNodos == maxNodos) // La jodimos, T�rtola, hay que usar
+		// reallocate
+		// {
+		// // NOTA: ESTO EN DEBUG HACE QUE FALLE AL USAR DESPUES EnlacesSTL. ES
+		// POR NO S� QU� HISTORIA
+		// // DEL HEAP. EN RELEASE NO FALLA. (TAMPOCO S� SI FASTIDIA ALGO).
+		// Nodos = (CNode *) realloc(Nodos,(numNodos + MAX_RESERVA_NODOS) *
+		// sizeof(CNode)); // Deber�amos chequear que devuelve algo correcto
+		// maxNodos = numNodos + MAX_RESERVA_NODOS;
+		// }
+
+		newNode = new GvNode();
+		// Nodo = &Nodos[numNodos];
+
+		// pNuevoNodo->idNodo = numNodos;
+		newNode.setIdNode(graph.numVertices());
+
+		// OJO: Las coordenadas estas puede que no tengan que ver con la
+		// realidad. Algo m�s correcto
+		// ser�a tener en cuenta el shape de verdad, pero creo que no influye en
+		// el resultado final.
+		// pNuevoNodo->x = Nodos[idNodo1].x + (Nodos[idNodo2].x -
+		// Nodos[idNodo1].x) * Porcentaje;
+		// pNuevoNodo->y = Nodos[idNodo1].y + (Nodos[idNodo2].y -
+		// Nodos[idNodo1].y) * Porcentaje;
+		GvNode node1 = graph.getNodeByID(idNodo1);
+		GvNode node2 = graph.getNodeByID(idNodo2);
+		newNode.setX(node1.getX() + (node2.getX() - node1.getX())
+				* flag.getPct());
+		newNode.setY(node1.getY() + (node2.getY() - node1.getY())
+				* flag.getPct());
+		graph.addNode(newNode);
+		Coordinate newC = new Coordinate(newNode.getX(), newNode.getY());
+
+		encontrado = false;
+
+		elIdArco = -1;
+		elIdContraArco = -1;
+
+		boolean bIdTramoYaPartido = false;
+
+		// TODO: POR AQUI VOY
+		for (idArco = numOriginalEdges; idArco < graph.numEdges(); idArco++) {
+			GvEdge addedEdge = graph.getEdgeByID(idArco);
+			if (addedEdge.getIdArc() == flag.getIdArc()) {
+				bIdTramoYaPartido = true;
+
+				idNodo1 = addedEdge.getIdNodeOrig();
+				idNodo2 = addedEdge.getIdNodeEnd();
+
+				// Comprobamos si est� enmedio
+				GvNode n1 = graph.getNodeByID(idNodo1);
+				GvNode n2 = graph.getNodeByID(idNodo2);
+				Coordinate c1 = new Coordinate(n1.getX(), n1.getY());
+				Coordinate c2 = new Coordinate(n2.getX(), n2.getY());
+				LineSegment line = new LineSegment(c1, c2);
+				double t = line.projectionFactor(newC);
+
+				// Si la proyecci�n es positiva y menor que la magnitud d, est�
+				// en medio
+				if ((t >= 0) && (t <= 1)) {
+					encontrado = true;
+					if (t == 0)
+						return idNodo1; // No partimos
+					if (t == 1)
+						return idNodo2; // Tampoco partimos
+
+					if (addedEdge.getDirec() == 1)
+						elIdArco = idArco;
+					else
+						elIdContraArco = idArco;
+
+				} // if est� enmedio
+			} // if idTramo encontrado
+		} // for idArco
+		if (bIdTramoYaPartido && (!encontrado))
+			throw new RuntimeException(
+					"Algo va mal con lo del producto escalar");
+
+		if (encontrado) {
+			// sprintf(Mensaje,"Voy a partir el idTramo= %ld (idArco
+			// %ld)",idTramo,elIdArco);
+			// MessageBox(NULL,Mensaje,"",MB_OK);
+			if (elIdArco != -1)
+				PartirArco(elIdArco, newNode.getIdNode());
+
+			if (elIdContraArco != -1)
+				PartirArco(elIdContraArco, newNode.getIdNode());
+		} else {
+			// Creamos 2 Arcos por cada arco que ten�amos antes.
+			if (edgePair.getIdEdge() != -1)
+				PartirArco(edgePair.getIdEdge(), newNode.getIdNode());
+
+			if (edgePair.getIdInverseEdge() != -1)
+				PartirArco(edgePair.getIdInverseEdge(), newNode.getIdNode());
+
+		} // else encontrado
+
+		return newNode.getIdNode();
+
+	}
+
+	/**
+	 * Cogemos el nodo m�s cercano y ponemos el pct a ese flag.
+	 * 
+	 * @param flag
+	 * @return
+	 */
+	public int getClosestIdNode(GvFlag flag) {
+		EdgePair pair = graph.getEdgesByIdArc(flag.getIdArc());
+		if (pair.getIdEdge() != -1) {
+			GvEdge edge = graph.getEdgeByID(pair.getIdEdge());
+			GvNode from = graph.getNodeByID(edge.getIdNodeOrig());
+			GvNode to = graph.getNodeByID(edge.getIdNodeEnd());
+
+			double dist1 = flag.getOriginalPoint().distance(from.getX(),
+					from.getY());
+			double dist2 = flag.getOriginalPoint().distance(to.getX(),
+					to.getY());
+			if (dist1 < dist2) {
+				flag.setPct(0);
+				return from.getIdNode();
+			}
+			else
+			{
+				flag.setPct(1.0);
+				return to.getIdNode();
+			}
+		} else {
+			GvEdge edge = graph.getEdgeByID(pair.getIdInverseEdge());
+			GvNode from = graph.getNodeByID(edge.getIdNodeOrig());
+			GvNode to = graph.getNodeByID(edge.getIdNodeEnd());
+
+			double dist1 = flag.getOriginalPoint().distance(from.getX(),
+					from.getY());
+			double dist2 = flag.getOriginalPoint().distance(to.getX(),
+					to.getY());
+			if (dist1 < dist2)
+			{
+				flag.setPct(0);
+				return from.getIdNode();
+			}
+			else
+			{
+				flag.setPct(1.0);
+				return to.getIdNode();
+			}
+			// if (flag.getPct() < 0.5)
+			// return to.getIdNode();
+			// else
+			// return from.getIdNode();
+		}
+	}
+
+	/**
+	 * @param idArc
+	 * @param x
+	 * @param y
+	 * @return entre 0.0 y 1.0
+	 * @throws DriverIOException
+	 */
+	private double percentAlong(int idArc, double x, double y)
+			throws DriverIOException {
+		// Le pasamos el idTramo, la coordenada X de donde hemos pulsado y la
+		// coordenada Y
+		// Primero calculamos la longitud total del shape.
+		// Luego calculamos el punto m�s cercano y su distancia para cada
+		// segmento del shape.
+		// Nos quedamos con el que est� m�s cerca y luego recorremos hasta �l
+		// acumulando distancia.
+		// Finalmente, dividimos esa distancia por la longitud total.
+		lyrVect.getSource().start();
+		IGeometry geom = lyrVect.getSource().getShape(idArc);
+		MultiLineString jtsGeom = (MultiLineString) geom.toJTSGeometry();
+
+		Coordinate[] coords = jtsGeom.getCoordinates();
+
+		Coordinate userCoord = new Coordinate(x, y);
+
+		double longReal = 0;
+		// Le pegamos una primera pasada para saber su longitud real.
+		// OJO, NO TRABAJAMOS CON SHAPES MULTIPARTE, NO TIENE SENTIDO CON LAS
+		// REDES (CREO)
+		// POR ESO SUPONEMOS UNA �NICA PARTE (L�NEA CONT�NUA)
+		// A la vez calculamos el punto m�s cercano y su distancia para cada
+		// segmento.
+		double minDist = Double.MAX_VALUE;
+		double distTo = 0;
+		double dist = 0;
+		Coordinate cOrig = null;
+		Coordinate closestPoint = null;
+		for (int j = 0; j < coords.length - 1; j++) {
+			Coordinate c1 = coords[j];
+			Coordinate c2 = coords[j + 1];
+			LineSegment line = new LineSegment(c1, c2);
+
+			Coordinate auxPoint = line.closestPoint(userCoord);
+			dist = userCoord.distance(auxPoint);
+			if ((dist < minDist)) {
+				minDist = dist;
+				cOrig = c1;
+				closestPoint = auxPoint;
+				distTo = longReal;
+			}
+			longReal += line.getLength();
+		}
+		lyrVect.getSource().stop();
+		dist = cOrig.distance(closestPoint);
+		double longBuscada = distTo + dist;
+
+		double pct;
+		if (longReal > 0)
+			pct = longBuscada / longReal;
+		else
+			pct = 0.0;
+
+		return pct;
+	}
+
+	/**
+	 * Adds a flag on a network. flagDirection set if the flag must be on left
+	 * or right edge.
+	 * 
+	 * @param x
+	 * @param y
+	 * @param flagDirection
+	 * @param tol
+	 *            tolerance in map units
+	 * @return null if there is no place to add flag. You can increase the
+	 *         tolerance, then.
+	 * @throws GraphException
+	 */
+	public GvFlag addFlag(double x, double y, int flagDirection, double tol)
+			throws GraphException {
+		try {
+			Point2D nearestPoint = new Point2D.Double();
+			int idArc = findClosestArc(x, y, tol, nearestPoint);
+			if (idArc == -1)
+				return null;
+			GvFlag flag = new GvFlag(x, y);
+			flag.setIdArc(idArc);
+
+			flag.setPct(percentAlong(idArc, x, y));
+			flag.setDirec(flagDirection);
+			flag.setIdFlag(flags.size());
+			callFlagsChanged(IFlagListener.FLAG_ADDED);
+			return flag;
+		} catch (DriverIOException e) {
+			e.printStackTrace();
+			throw new GraphException(e);
+		}
+
+	}
+
+	/**
+	 * Adds 2 flags on a network. (On both sides of an arc)
+	 * 
+	 * @param x
+	 * @param y
+	 * @param tol
+	 *            tolerance in map units
+	 * @return null if there is no place to add flag. You can increase the
+	 *         tolerance, then.
+	 * @throws GraphException 
+	 */
+	public GvFlag addFlag(double x, double y, double tol) throws GraphException {
+		try {
+			Point2D nearestPoint = new Point2D.Double();
+			int idArc = findClosestArc(x, y, tol, nearestPoint);
+			if (idArc == -1)
+				return null;
+
+			GvFlag flag = new GvFlag(x, y);
+			flag.setIdArc(idArc);
+			EdgePair edgePair = graph.getEdgesByIdArc(idArc);
+			flag.setDirec(GvFlag.BOTH_DIRECTIONS);
+
+			flag.setPct(percentAlong(idArc, x, y));
+			flag.setIdFlag(flags.size());
+			flags.add(flag);
+			callFlagsChanged(IFlagListener.FLAG_ADDED);
+			return flag;
+		} catch (DriverIOException e) {
+			e.printStackTrace();
+			throw new GraphException(e);
+		}
+
+	}
+
+	/**
+	 * Create a flag in both directions, but NOT add it to the Network.
+	 * We use it on onetomany solver
+	 * @param x
+	 * @param y
+	 * @param tol
+	 * @return
+	 * @throws GraphException
+	 */
+	public GvFlag createFlag(double x, double y, double tol) throws GraphException {
+		try {
+			Point2D nearestPoint = new Point2D.Double();
+			int idArc = findClosestArc(x, y, tol, nearestPoint);
+			if (idArc == -1)
+				return null;
+
+			GvFlag flag = new GvFlag(x, y);
+			flag.setIdArc(idArc);
+//			EdgePair edgePair = graph.getEdgesByIdArc(idArc);
+			flag.setDirec(GvFlag.BOTH_DIRECTIONS);
+
+			flag.setPct(percentAlong(idArc, x, y));
+			flag.setIdFlag(flags.size());
+			return flag;
+		} catch (DriverIOException e) {
+			e.printStackTrace();
+			throw new GraphException(e);
+		}
+
+	}
+
+	public GvFlag addFlagToNode(double x, double y, double tol) throws GraphException {
+		Point2D nearestPoint = new Point2D.Double();
+		int idArc = findClosestArc(x, y, tol, nearestPoint);
+		if (idArc == -1)
+			return null;
+
+		GvFlag flag = new GvFlag(x, y);
+		flag.setIdArc(idArc);
+		flag.setDirec(GvFlag.BOTH_DIRECTIONS);
+		int idNode = getClosestIdNode(flag);
+		
+		GvNode node = graph.getNodeByID(idNode);
+		flag.setOriginalPoint(node.getX(), node.getY());
+		flag.setIdFlag(flags.size());
+		flags.add(flag);
+		callFlagsChanged(IFlagListener.FLAG_ADDED);
+		return flag;
+
+	}
+
+
+	public void addFlag(GvFlag flag) {
+		flags.add(flag);
+		callFlagsChanged(IFlagListener.FLAG_ADDED);
+	}
+
+	public GvFlag[] getFlags() {
+		ArrayList aux = new ArrayList();
+		for (int i=0; i < getOriginaFlags().size(); i++)
+		{
+			GvFlag flag = (GvFlag) getOriginaFlags().get(i);
+			if (flag.isEnabled()) aux.add(flag);
+		}
+
+		return (GvFlag[]) aux.toArray(new GvFlag[0]);
+	}
+	
+	/**
+	 * Suitable to change directly the flags collection
+	 * @return
+	 */
+	public ArrayList getOriginaFlags() {
+		return flags;
+	}
+
+
+	public void setFlags(ArrayList flags) {
+		this.flags = flags;
+	}
+
+	public IGraph getGraph() {
+		return graph;
+	}
+
+	public void setGraph(IGraph graph) {
+		this.graph = graph;
+		numOriginalEdges = graph.numEdges();
+		numOriginalNodes = graph.numVertices();
+	}
+
+	public FLyrVect getLayer() {
+		return lyrVect;
+	}
+
+	public void setLayer(FLyrVect lyr) {
+		this.lyrVect = lyr;
+	}
+
+	public void removeFlags() {
+		flags = new ArrayList();
+		callFlagsChanged(IFlagListener.FLAG_REMOVED);
+	}
+	
+	public void removeFlag(GvFlag flag){
+		flags.remove(flag);
+		callFlagsChanged(IFlagListener.FLAG_REMOVED);
+	}
+
+	void PartirArco(int idEdge, int idNode) {
+		// Se supone que el nuevo Nodo YA est� creado. Aqui dentro se coge el
+		// arco viejo y se le pega un tajo.
+		// (Se modifican los enlaces de los nodos de ese arco y se crean los
+		// arcos nuevos, fijando sus costes).
+		// Para sacar el porcentaje nos aprovechamos de que el nuevo nodo est�
+		// puesto en base a ese porcentaje
+		// en distancia de los extremos.
+		GvEdge oldEdge;
+		GvNode pN1, pN2;
+		double pct;
+
+		oldEdge = graph.getEdgeByID(idEdge);
+
+		// OJO, controlando los ceros por si acaso la recta es horizontal o
+		// vertical (Y si mide cero???)
+
+		// pN1 = &Nodos[Arcos[idArco].idNodo1];
+		// pN2 = &Nodos[Arcos[idArco].idNodo2];
+		pN1 = graph.getNodeByID(graph.getEdgeByID(idEdge).getIdNodeOrig());
+		pN2 = graph.getNodeByID(graph.getEdgeByID(idEdge).getIdNodeEnd());
+		GvNode newNode = graph.getNodeByID(idNode);
+
+		if (newNode.getX() != pN1.getX())
+			pct = Math.abs((newNode.getX() - pN1.getX())
+					/ (pN2.getX() - pN1.getX()));
+		else
+			pct = Math.abs((newNode.getY() - pN1.getY())
+					/ (pN2.getY() - pN1.getY()));
+
+		GvEdge first = new GvEdge();
+		first.setIdEdge(graph.numEdges());
+		first.setIdArc(oldEdge.getIdArc());
+		first.setDistance(oldEdge.getDistance() * pct);
+		first.setWeight(oldEdge.getWeight() * pct);
+
+		first.setDirec(oldEdge.getDirec());
+		first.setIdNodeOrig(oldEdge.getIdNodeOrig());
+		first.setType(oldEdge.getType());
+		first.setIdNodeEnd(idNode);
+		graph.addEdge(first);
+
+		GvEdge second = new GvEdge();
+		second.setIdEdge(graph.numEdges());
+		second.setDistance(oldEdge.getDistance() * (1.0 - pct));
+		second.setWeight(oldEdge.getWeight() * (1.0 - pct));
+		second.setIdArc(oldEdge.getIdArc());
+		second.setDirec(oldEdge.getDirec());
+		second.setType(oldEdge.getType());
+		second.setIdNodeOrig(idNode);
+		second.setIdNodeEnd(oldEdge.getIdNodeEnd());
+		graph.addEdge(second);
+
+		// ////////////////////////////////////////////////////
+		// Ahora retocamos los enlaces que salen de cada nodo
+		// ////////////////////////////////////////////////////
+		int i;
+		// boolean encontrado = false;
+		for (i = 0; i < pN1.getEnlaces().size(); i++) {
+			GvEdge aux = (GvEdge) pN1.getEnlaces().get(i);
+			if (aux.getIdEdge() == idEdge) {
+				pN1.getEnlaces().set(i, first);
+				// encontrado = true;
+				break;
+			}
+		} // for
+
+		newNode.getEnlaces().add(second);
+
+	}
+
+	public ArrayList getModifiedCosts() {
+		return modifiedCosts;
+		
+	}
+
+	/**
+	 * Create, add and apply a new modified cost to the graph. 
+	 * @param idArc where the cost will be applied.
+	 * @param newCost. -1 if you want tu put a BARRIER.
+	 * @param direction. 1-> edge of digitalized direction. 2-> inverse edge. 3-> Both directions
+	 */
+	public GvModifiedCost addModifiedCost(int idArc, double newCost, int direction) {
+		GvModifiedCost modifiedCost = new GvModifiedCost(idArc, newCost, direction);
+		EdgePair edgePair = getGraph().getEdgesByIdArc(idArc);
+		modifiedCost.setIdEdge(edgePair.idEdge);
+		modifiedCost.setIdInverseEdge(edgePair.idInverseEdge);
+		if (direction == 3)
+		{
+			if (edgePair.getIdEdge() != -1)
+			{
+				GvEdge edge = getGraph().getEdgeByID(edgePair.getIdEdge());
+				modifiedCost.setOldCost(edge.getWeight());
+				edge.setWeight(-1.0);
+			}
+			if (edgePair.getIdInverseEdge() != -1)
+			{
+				GvEdge inverseEdge = getGraph().getEdgeByID(edgePair.getIdInverseEdge());
+				modifiedCost.setOldInverseCost(inverseEdge.getWeight());
+				inverseEdge.setWeight(-1.0);
+			}
+		}
+		if (direction == 1)
+		{
+			if (edgePair.getIdEdge() != -1)
+			{
+				GvEdge edge = getGraph().getEdgeByID(edgePair.getIdEdge());
+				modifiedCost.setOldCost(edge.getWeight());
+				edge.setWeight(-1.0);
+			}
+		}
+		if (direction == 2)
+		{
+			if (edgePair.getIdInverseEdge() != -1)
+			{
+				GvEdge inverseEdge = getGraph().getEdgeByID(edgePair.getIdInverseEdge());
+				modifiedCost.setOldInverseCost(inverseEdge.getWeight());
+				inverseEdge.setWeight(-1.0);
+			}
+		}
+		modifiedCosts.add(modifiedCost);
+		modifiedCost.setApplied(true);
+		return modifiedCost;
+	}
+
+	/**
+	 * Be careful about the ORDER!!!!
+	 * @param modifiedCost
+	 */
+	public boolean removeModifiedCost(GvModifiedCost modifiedCost) {
+		if (!modifiedCosts.remove(modifiedCost))
+			return false;
+		int idArc = modifiedCost.getIdArc();
+		int direction = modifiedCost.getDirection();
+		EdgePair edgePair = getGraph().getEdgesByIdArc(idArc);
+		if (direction == 3)
+		{
+			if (edgePair.getIdEdge() != -1)
+			{
+				GvEdge edge = getGraph().getEdgeByID(edgePair.getIdEdge());
+				edge.setWeight(modifiedCost.getOldCost());
+			}
+			if (edgePair.getIdInverseEdge() != -1)
+			{
+				GvEdge inverseEdge = getGraph().getEdgeByID(edgePair.getIdInverseEdge());
+				inverseEdge.setWeight(modifiedCost.getOldInverseCost());
+			}
+		}
+		if (direction == 1)
+		{
+			if (edgePair.getIdEdge() != -1)
+			{
+				GvEdge edge = getGraph().getEdgeByID(edgePair.getIdEdge());
+				edge.setWeight(modifiedCost.getOldCost());
+			}
+		}
+		if (direction == 2)
+		{
+			if (edgePair.getIdInverseEdge() != -1)
+			{
+				GvEdge inverseEdge = getGraph().getEdgeByID(edgePair.getIdInverseEdge());
+				inverseEdge.setWeight(modifiedCost.getOldInverseCost());
+			}
+		}
+		return true;
+	}
+
+	public void addFlagListener(IFlagListener listener) {
+		if (!flagListeners.contains(listener)) {
+			flagListeners.add(listener);
+		}
+	}
+	
+	private void callFlagsChanged(int reason) {
+		if (dispatching) {
+			for (int i=0; i < flagListeners.size(); i++)
+			{
+				IFlagListener listener = (IFlagListener) flagListeners.get(i);
+				listener.flagsChanged(reason);
+			}
+		}
+	}
+	
+	/**
+	 * Useful to do batch modifies. (For example, add lot of flags
+	 * and when finished (endModifying), throw event.
+	 */
+	public void beginModifyingFlags() {
+		dispatching = false;
+	}
+
+	public void endModifyingFlags() {
+		dispatching = true;
+		callFlagsChanged(IFlagListener.FLAG_MANY_CHANGES);
+	}
+	/**
+	 * Mueve un flag de la posici�n from a la posici�n to.
+	 *
+	 * @param from origen.
+	 * @param to destino.
+	 * 
+	 */
+	public void moveTo(int from, int to) throws CancelationException {
+		int newfrom=flags.size()-from-1;
+		int newto=flags.size()-to-1;
+		if ( newfrom < 0 || newfrom >=flags.size() || newto < 0 || newto >= flags.size()) return;
+		GvFlag aux = (GvFlag) flags.get(newfrom);
+		flags.remove(newfrom);
+		flags.add(newto, aux);
+		callFlagsChanged(IFlagListener.FLAG_REORDER);
+	}
+
+	public ArrayList getEdgeTypes() {
+		// TODO: Tener esto precalculado
+		TreeMap map = new TreeMap();
+		ArrayList ret = new ArrayList();
+		for (int i = 0; i < graph.numEdges(); i++)
+		{
+			GvEdge edge = graph.getEdgeByID(i);
+			Integer type = new Integer(edge.getType());
+			if (!map.containsKey(type))
+			{
+				map.put(type, type);				
+			}
+		}
+		Iterator it = map.entrySet().iterator();
+		while (it.hasNext())
+		{
+			Map.Entry entry = (Map.Entry) it.next();
+			Integer type = (Integer) entry.getKey();
+			ret.add(type);
+		}
+		return ret;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/Network.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/INetworkLoader.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/INetworkLoader.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/INetworkLoader.java	(revision 12191)
@@ -0,0 +1,49 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+
+public interface INetworkLoader {
+	IGraph loadNetwork();
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/INetworkLoader.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/INetSolver.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/INetSolver.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/INetSolver.java	(revision 12191)
@@ -0,0 +1,51 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+package com.iver.cit.gvsig.graph.core;
+
+
+public interface INetSolver {
+
+	public void setNetwork(Network net);
+	
+	public Network getNetwork();
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/INetSolver.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/JungConverter.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/JungConverter.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/JungConverter.java	(revision 12191)
@@ -0,0 +1,116 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+import java.awt.geom.Point2D;
+
+import com.hardcode.gdbms.engine.values.NumericValue;
+
+import edu.uci.ics.jung.graph.ArchetypeGraph;
+import edu.uci.ics.jung.graph.Graph;
+import edu.uci.ics.jung.graph.Vertex;
+import edu.uci.ics.jung.graph.decorators.Indexer;
+import edu.uci.ics.jung.graph.impl.DirectedSparseVertex;
+import edu.uci.ics.jung.graph.impl.SparseGraph;
+import edu.uci.ics.jung.utils.UserData;
+import edu.uci.ics.jung.visualization.DefaultSettableVertexLocationFunction;
+import edu.uci.ics.jung.visualization.SettableVertexLocationFunction;
+
+public class JungConverter {
+	
+	IGraph g;
+	Graph gJ;
+	Indexer indexer;
+	
+	
+	public void setGraph(IGraph g) {
+		this.g = g;
+	}
+	
+	public void convert() {
+		// TODO: Hacer y lanzar una excepci�n si algo ha ido mal
+		if (g == null)
+			throw new RuntimeException("Please, use setGraph() before convert()");
+		gJ = new SparseGraph();
+		long t1 = System.currentTimeMillis();
+		
+		for (int i=0; i < g.numVertices(); i++)
+		{
+			GvNode n = g.getNodeByID(i);
+			FNode v = new FNode(i, n.getX(), n.getY());
+			gJ.addVertex(v);				
+		}
+		indexer = Indexer.getIndexer(gJ);
+		
+		for (int i=0; i < g.numEdges(); i++)
+		{
+			GvEdge e = g.getEdgeByID(i);
+			Vertex vFrom = (Vertex) indexer.getVertex(e.getIdNodeOrig());
+			Vertex vTo = (Vertex) indexer.getVertex(e.getIdNodeEnd());
+			
+			FEdge edge = new FEdge(vFrom, vTo);
+			edge.setArcID(e.getIdArc());
+			edge.setDirection(e.getDirec());
+			edge.setIdNodeOrig(e.getIdNodeOrig());
+			edge.setIdNodeEnd(e.getIdNodeEnd());
+			edge.setType(e.getType());
+			edge.setWeight(e.getDistance());
+			edge.setCost2(e.getWeight());
+			
+			gJ.addEdge(edge);
+		}
+		long t2 = System.currentTimeMillis();
+		System.out.println("Tiempo de carga desde nodes.dbf y edges.dbf y generando JUNG network: " + (t2-t1) + " msecs");
+	}
+	
+	public ArchetypeGraph getJungGraph() {
+		if (gJ == null)
+			throw new RuntimeException("You should call convert() before use this method.");
+		return gJ;
+	}
+	
+	public Indexer getIndexer() {
+		return indexer;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/JungConverter.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/FNode.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/FNode.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/FNode.java	(revision 12191)
@@ -0,0 +1,74 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+import java.util.ArrayList;
+
+import edu.uci.ics.jung.graph.impl.DirectedSparseVertex;
+
+public class FNode extends DirectedSparseVertex {
+	private int idNode;
+	private double x;
+	private double y;
+	
+	private int numSoluc;
+	private double estimation;
+	private int status;
+	ArrayList conectors;
+	ArrayList turnCosts;
+	
+	public FNode(int i, double x, double y) {
+		idNode = i;
+		this.x = x;
+		this.y = y;
+	}
+	public int getIdNode() {
+		return idNode;
+	}
+	public double getX() {
+		return x;
+	}
+	public double getY() {
+		return y;
+	}
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/FNode.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvGraph.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvGraph.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvGraph.java	(revision 12191)
@@ -0,0 +1,132 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Hashtable;
+
+import edu.uci.ics.jung.utils.Pair;
+
+public class GvGraph implements IGraph {
+	private ArrayList nodes;
+	private ArrayList edges;
+	private Hashtable indexArcsEdges;
+
+	public GvGraph()
+	{
+		nodes = new ArrayList();
+		edges = new ArrayList();
+		indexArcsEdges = new Hashtable();		
+	}
+
+	public GvGraph(int numArcs, int numEdges, int numNodes) {
+		nodes = new ArrayList(numNodes);
+		edges = new ArrayList(numEdges);
+		indexArcsEdges = new Hashtable(numArcs);					
+	}
+
+	public GvNode getNodeByID(int idNode) {
+		return (GvNode) nodes.get(idNode);
+	}
+
+	public GvEdge getEdgeByID(int idEdge) {
+		return (GvEdge) edges.get(idEdge);
+	}
+
+	public int numVertices() {
+		return nodes.size();
+	}
+
+	public int numEdges() {
+		return edges.size();
+	}
+
+	public EdgePair getEdgesByIdArc(int idArc) {
+		// if (idArc < indexArcsEdges.size())
+			return (EdgePair) indexArcsEdges.get(new Integer(idArc));
+		// return null;
+	}
+
+	public void addEdge(GvEdge edge) {
+		edges.add(edge);
+	}
+
+	public void addNode(GvNode node) {
+		nodes.add(node);
+		
+	}
+
+	public void addEdgePair(int idArc, EdgePair edgePair) {
+//		assert(indexArcsEdges.size() == edgePair.idArc);
+		Object aux = indexArcsEdges.put(new Integer(idArc), edgePair);
+		// assert(aux == null);
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.gvsig.graph.core.IGraph#removeEdge(int)
+	 */
+	public void removeEdge(int idEdge) {
+		// TODO: Solo se usa para edges a�adidos debido a la incorporaci�n
+		// de flags. Si se usara para los otros arcos, habr�a que 
+		// revisar indexArcsEdges para ver si es necesario quitarlo
+		// tambi�n de ah�.
+		edges.remove(idEdge);
+	}
+
+	public void removeNode(int idNode) {
+		nodes.remove(idNode);		
+	}
+
+//	public void addEdge(int i, GvEdge edge) {
+//		edges.set(i, edge);
+//		
+//	}
+//	public void addNode(int i, GvNode node) {
+//		nodes.set(i, node);
+//		
+//	}
+	
+	
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvGraph.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/INetworkWriter.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/INetworkWriter.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/INetworkWriter.java	(revision 12191)
@@ -0,0 +1,65 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+package com.iver.cit.gvsig.graph.core;
+
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.edition.EditionException;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+
+public interface INetworkWriter {
+
+	public void setLayer(FLyrVect lyr);
+
+	/**
+	 * We iterate by each geometry and add Nodes and Edges using writers. Each
+	 * node must have its own ID.
+	 * 
+	 * @throws DriverIOException
+	 * @throws EditionException
+	 * @throws DriverException
+	 * 
+	 */
+	public void writeNetwork() throws EditionException,
+			DriverException;
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/INetworkWriter.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvEdge.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvEdge.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvEdge.java	(revision 12191)
@@ -0,0 +1,114 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+public class GvEdge {
+
+	private int idArc;
+	private int idEdge;
+	private int direc;
+	private int idNodeOrig;
+	private int idNodeEnd;
+	private int type;
+	private double distance;
+	private double weight;
+	
+	private int numSoluc;
+	
+	public int getDirec() {
+		return direc;
+	}
+	public void setDirec(int direc) {
+		this.direc = direc;
+	}
+	public double getDistance() {
+		return distance;
+	}
+	public void setDistance(double distance) {
+		this.distance = distance;
+	}
+	public int getIdArc() {
+		return idArc;
+	}
+	public void setIdArc(int idArc) {
+		this.idArc = idArc;
+	}
+	public int getIdNodeEnd() {
+		return idNodeEnd;
+	}
+	public void setIdNodeEnd(int idNodeEnd) {
+		this.idNodeEnd = idNodeEnd;
+	}
+	public int getIdNodeOrig() {
+		return idNodeOrig;
+	}
+	public void setIdNodeOrig(int idNodeOrig) {
+		this.idNodeOrig = idNodeOrig;
+	}
+	public int getType() {
+		return type;
+	}
+	public void setType(int type) {
+		this.type = type;
+	}
+	public double getWeight() {
+		return weight;
+	}
+	public void setWeight(double weight) {
+		this.weight = weight;
+	}
+	public int getNumSoluc() {
+		return numSoluc;
+	}
+	public void setNumSoluc(int numSoluc) {
+		this.numSoluc = numSoluc;
+	}
+	public int getIdEdge() {
+		return idEdge;
+	}
+	public void setIdEdge(int idEdge) {
+		this.idEdge = idEdge;
+	}
+
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvEdge.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/AbstractNetSolver.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/AbstractNetSolver.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/AbstractNetSolver.java	(revision 12191)
@@ -0,0 +1,59 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+
+public class AbstractNetSolver implements INetSolver {
+	public static int numSolucGlobal = 0;
+	protected Network net;
+	public Network getNetwork() {
+		return net;
+	}
+	public void setNetwork(Network net) {
+		this.net = net;
+	}
+	
+	
+	
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/AbstractNetSolver.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvFlag.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvFlag.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvFlag.java	(revision 12191)
@@ -0,0 +1,216 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+import java.awt.geom.Point2D;
+
+import com.iver.andami.PluginServices;
+
+public class GvFlag {
+	/*
+	 * Indexes of flag features' fields.
+	 * 
+	 * */
+	public static final int ID_FLAG_INDEX = 0;
+	public static final int ID_ARC_INDEX = 1;
+	public static final int PCT_INDEX = 2;
+	public static final int COST_INDEX = 3;
+	public static final int DIREC_INDEX = 4;
+	public static final int DESCRIPTION_INDEX = 5;
+	
+	
+	
+	
+	
+	public final static int DIGIT_DIRECTION = 1;
+	public final static int INVERSE_DIGIT_DIRECTION = -1;
+	public final static int BOTH_DIRECTIONS = 0;
+
+
+	private int idArc;
+	private int direc;
+	private double pct;
+	private int idFlag;
+	private Point2D originalPoint;
+	private String description;
+	private boolean enabled = true;
+	private double cost = -1;
+	private double accumulatedLength;
+	private static int flagNumber = 0;
+
+	public GvFlag(double x, double y) {
+		this.originalPoint = new Point2D.Double(x, y);
+		this.description = PluginServices.getText(this, "new_flag")+flagNumber++;
+	}
+
+	public GvFlag(double x, double y, double cost) {
+		this.originalPoint = new Point2D.Double(x, y);
+		this.description = PluginServices.getText(this, "new_flag")+flagNumber++;
+		this.cost = cost;
+	}
+
+
+	public GvFlag(double x, double y, String description) {
+		this.originalPoint = new Point2D.Double(x, y);
+		this.description = description;
+	}
+
+
+	public GvFlag(double x, double y, String description, double cost) {
+		this.originalPoint = new Point2D.Double(x, y);
+		this.description = description;
+		this.cost = cost;
+	}
+
+	/**
+	 * Returns the cost for this flag. The cost represents the amount of resource of
+	 * the user's cost unit required to reach this flag from the previous one in
+	 * the route.
+	 * @return
+	 */
+	public double getCost() {
+		return cost;
+	}
+
+	/**
+	 * Sets the cost of this flag. The cost represents the amount of resource of
+	 * the user's cost unit required to reach this flag from the previous one in
+	 * the route.
+	 * @param cost
+	 */
+	public void setCost(double cost) {
+		this.cost = cost;
+	}
+
+	/**
+	 * Returns a human-readable description of this flag. This is typically a name
+	 * for this marker.
+	 * @return
+	 */
+	public String getDescription() {
+		return description;
+	}
+
+	/**
+	 * Sets the description of this flag. The description should be a human readable
+	 * description for this flag such is street name or something like that. But
+	 * it can be whatever.
+	 *
+	 * @param description
+	 */
+	public void setDescription(String description) {
+		this.description = description;
+	}
+
+	/**
+	 * Tells if this flag is being taken in account when calculating the route.
+	 * @return
+	 */
+	public boolean isEnabled() {
+		return enabled;
+	}
+
+	/**
+	 * Enables or disables this flag. A disabled flag is not taken in account to
+	 * compute the route.
+	 * @param enabled
+	 */
+	public void setEnabled(boolean enabled) {
+		this.enabled = enabled;
+	}
+
+	public int getIdArc() {
+		return idArc;
+	}
+
+	public void setIdArc(int idArc) {
+		this.idArc = idArc;
+	}
+
+	public int getDirec() {
+		return direc;
+	}
+
+	public void setDirec(int sense) {
+		this.direc = sense;
+	}
+
+	public double getPct() {
+		return pct;
+	}
+
+	public void setPct(double pct) {
+		this.pct = pct;
+	}
+
+	public void setIdFlag(int i) {
+		idFlag = i;
+	}
+
+	public int getIdFlag() {
+		return idFlag;
+	}
+
+	public Point2D getOriginalPoint() {
+		return originalPoint;
+	}
+
+	public String toString() {
+		return description;
+	}
+
+	public void setOriginalPoint(double x, double y) {
+		originalPoint.setLocation(x, y);
+		
+	}
+
+	public void setAccumulatedLength(double accumulatedLength) {
+		this.accumulatedLength = accumulatedLength;
+		
+	}
+
+	public double getAccumulatedLength() {
+		return accumulatedLength;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvFlag.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvModifiedCost.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvModifiedCost.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvModifiedCost.java	(revision 12191)
@@ -0,0 +1,117 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+/**
+ * @author fjp
+ * To set barriers or modified cost to a graph.
+ * This objects are stored in arrayList modifiedCosts (inside
+ * Network class). Useful to remove barriers, for example (restore
+ * a cost). Be careful: You need to call applyModifiedCosts 
+ * each time you call setVelocities (setVelocities recalculate
+ * cost (weight?) field in graph 
+ */
+public class GvModifiedCost {
+	private int idArc;
+	private int idEdge;
+	private int idInverseEdge;
+	private int direction; // 1, 2 -> inverse, 3 -> both
+	private double oldCost;
+	private double newCost;
+	private double oldInverseCost;
+	
+	private boolean applied;
+	public GvModifiedCost(int idArc, double newCost, int direction) {
+		this.idArc = idArc;
+		this.newCost = newCost;
+		this.direction = direction;
+	}
+	public boolean isApplied() {
+		return applied;
+	}
+	public void setApplied(boolean applied) {
+		this.applied = applied;
+	}
+	public int getIdArc() {
+		return idArc;
+	}
+	public void setIdArc(int idArc) {
+		this.idArc = idArc;
+	}
+	public int getIdEdge() {
+		return idEdge;
+	}
+	public void setIdEdge(int idEdge) {
+		this.idEdge = idEdge;
+	}
+	public int getDirection() {
+		return direction;
+	}
+	public void setDirection(int direction) {
+		this.direction = direction;
+	}
+	public int getIdInverseEdge() {
+		return idInverseEdge;
+	}
+	public void setIdInverseEdge(int idInverseEdge) {
+		this.idInverseEdge = idInverseEdge;
+	}
+	public double getNewCost() {
+		return newCost;
+	}
+	public void setNewCost(double newCost) {
+		this.newCost = newCost;
+	}
+	public double getOldCost() {
+		return oldCost;
+	}
+	public void setOldCost(double oldCost) {
+		this.oldCost = oldCost;
+	}
+	public double getOldInverseCost() {
+		return oldInverseCost;
+	}
+	public void setOldInverseCost(double oldInverseCost) {
+		this.oldInverseCost = oldInverseCost;
+	}
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/GvModifiedCost.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/loaders/NetworkRedLoader.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/loaders/NetworkRedLoader.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/loaders/NetworkRedLoader.java	(revision 12191)
@@ -0,0 +1,300 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core.loaders;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.ByteOrder;
+import java.nio.MappedByteBuffer;
+import java.nio.channels.FileChannel;
+import java.util.ArrayList;
+
+import javax.imageio.stream.FileImageOutputStream;
+
+import com.iver.cit.gvsig.graph.core.EdgePair;
+import com.iver.cit.gvsig.graph.core.GvEdge;
+import com.iver.cit.gvsig.graph.core.GvGraph;
+import com.iver.cit.gvsig.graph.core.GvNode;
+import com.iver.cit.gvsig.graph.core.IGraph;
+import com.iver.cit.gvsig.graph.core.INetworkLoader;
+
+import edu.uci.ics.jung.graph.Graph;
+import edu.uci.ics.jung.graph.Vertex;
+import edu.uci.ics.jung.graph.decorators.Indexer;
+import edu.uci.ics.jung.graph.impl.DirectedSparseEdge;
+import edu.uci.ics.jung.graph.impl.DirectedSparseVertex;
+import edu.uci.ics.jung.graph.impl.SparseGraph;
+
+/**
+ * @author fjp
+ * 
+ * Primero vienen los arcos, y luego los nodos. En la cabecera, 3 enteros
+ * con el numero de tramos, el de arcos y el de nodos.
+ *
+ */
+public class NetworkRedLoader implements INetworkLoader {
+	
+	private File netFile = new File("c:/ejes.red");
+
+	public IGraph loadNetwork() {
+		
+		long t1 = System.currentTimeMillis();
+		
+		int numArcs;
+		int numEdges;
+		int numNodes;
+		
+		short sentidoDigit; // => 1 en esa direcci�n. 0=> Al contrario. SOLO
+		// SE UTILIZA PARA LOS CALCULOS POR IDTRAMO Y
+		// PORCENTAJE
+		// PARA SABER SI EST� M�S CERCA DE UN NODO O DEL OTRO.
+
+
+			RandomAccessFile file;
+			try {
+				file = new RandomAccessFile(netFile.getPath(),
+						"r");
+				FileChannel channel = file.getChannel();
+				MappedByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
+				buf.order(ByteOrder.LITTLE_ENDIAN);
+	
+				numArcs = buf.getInt();
+				numEdges = buf.getInt();
+				numNodes = buf.getInt();
+		
+				GvGraph g = new GvGraph(numArcs, numEdges, numNodes);
+
+				// Nodes
+				
+				// NOTE: EDGES ARE WRITEN BEFORE. LOOK TO NetworkFileRedWriter.
+//					output.writeInt(id);    		4
+//					output.writeInt(sense);			4
+//
+//					output.writeInt(idNodeOrig);	4
+//					output.writeInt(idNodeEnd);		4
+//					output.writeInt(tipoTramo);		4
+//					output.writeDouble(dist);		8
+//					output.writeDouble(cost);		8
+				// TOTAL = 5x4 + 2x8 = 20 + 16 = 36 bytes /edge
+
+				buf.position(36*numEdges + 12);
+				for (int i=0; i < numNodes; i++)
+				{
+					GvNode node = readNode(buf);
+					g.addNode(node);
+				}
+				// Arcos			
+				buf.position(12);
+				for (int i=0; i < numEdges; i++)
+				{
+					GvEdge edge = readEdge(buf);
+					edge.setIdEdge(i);
+					g.addEdge(edge);
+					GvNode node = g.getNodeByID(edge.getIdNodeOrig());
+					node.getEnlaces().add(edge);
+					EdgePair edgePair = g.getEdgesByIdArc(edge.getIdArc());
+					if (edgePair == null)
+					{
+						edgePair = new EdgePair();						
+						g.addEdgePair(edge.getIdArc(), edgePair);
+					}
+					if (edge.getDirec() == 1)
+						edgePair.setIdEdge(i);
+					else
+						edgePair.setIdInverseEdge(i);
+					
+				}
+			
+			long t2 = System.currentTimeMillis();
+			System.out.println("Tiempo de carga: " + (t2-t1) + " msecs");
+			System.out.println("NumEdges = " + g.numEdges());
+			return g;
+			} catch (FileNotFoundException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (IOException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+
+		return null;
+	}
+	
+	public Graph loadJungNetwork()
+	{
+		SparseGraph g = new SparseGraph();
+		long t1 = System.currentTimeMillis();
+		
+		RandomAccessFile file;
+		try {
+			file = new RandomAccessFile(netFile.getPath(),
+					"r");
+			FileChannel channel = file.getChannel();
+			MappedByteBuffer buf = channel.map(FileChannel.MapMode.READ_ONLY, 0, channel.size());
+			buf.order(ByteOrder.LITTLE_ENDIAN);
+
+			int numArcs = buf.getInt();
+			int numEdges = buf.getInt();
+			int numNodes = buf.getInt();
+			
+			// Nodes
+			buf.position(24*numEdges + 12);
+			for (int i=0; i < numNodes; i++)
+			{
+				GvNode node = readNode(buf);
+				
+				Vertex v = new DirectedSparseVertex();
+//				v.addUserDatum("ID", node.idNode, UserData.CLONE);
+//				v.addUserDatum("X", node.x, UserData.CLONE);
+//				v.addUserDatum("Y", node.y, UserData.CLONE);
+	//			v_locations.setLocation(v, new Point2D.Double(x.doubleValue(),y.doubleValue()));
+				g.addVertex(v);				
+			}
+			Indexer indexer = Indexer.getIndexer(g);
+		
+			buf.position(12);
+			for (int i=0; i < numEdges; i++)
+			{
+				GvEdge edge = readEdge(buf);
+				
+				int nodeOrig = edge.getIdNodeOrig();
+				int nodeEnd = edge.getIdNodeEnd();
+				
+				Vertex vFrom = (Vertex) indexer.getVertex(nodeOrig);
+				Vertex vTo = (Vertex) indexer.getVertex(nodeEnd);
+				
+				DirectedSparseEdge edgeJ = new DirectedSparseEdge(vFrom, vTo);
+				g.addEdge(edgeJ);
+			}
+			long t2 = System.currentTimeMillis();
+			System.out.println("Tiempo de carga: " + (t2-t1) + " msecs");
+			return g;
+		} catch (FileNotFoundException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (IOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+	private GvNode readNode(MappedByteBuffer buf) {
+		GvNode node = new GvNode();
+		node.setIdNode(buf.getInt());
+		node.setX(buf.getDouble());
+		node.setY(buf.getDouble());
+		return node;
+	}
+
+	private GvEdge readEdge(MappedByteBuffer buf) {
+		GvEdge edge = new GvEdge();
+		// memcpy(&Arcos[link_num].idTramo,puntero,sizeof(long));
+		edge.setIdArc(buf.getInt());
+
+		
+		// Sentido de digitalizaci�n.Un 1 indica que va en ese sentido, un cero al contrario.
+		// memcpy(&Arcos[link_num].sentido,puntero,sizeof(int));
+		edge.setDirec(buf.getInt());
+
+		// idNodeOrig
+		edge.setIdNodeOrig(buf.getInt());
+		// memcpy(&node_num1,puntero,sizeof(long));
+		
+		// idNodeEnd
+		edge.setIdNodeEnd(buf.getInt());
+//		memcpy(&node_num2,puntero,sizeof(long));
+
+		// Read the link costs.
+		// Type
+		edge.setType(buf.getInt());
+//		memcpy(&Arcos[link_num].TipoTramo,puntero,sizeof(int));
+
+		// Distance
+		edge.setDistance(buf.getDouble());
+		edge.setWeight(buf.getDouble());
+		
+//		memcpy(&Arcos[link_num].Coste2,puntero,sizeof(float));
+
+//		pNodo1 = &Nodos[node_num1];
+//		Arcos[link_num].idNodo1 = node_num1;
+//
+//		Arcos[link_num].idNodo2 = node_num2;
+		// pNodo2->Enlaces.Add(link_num);
+
+//		// NUEVO 11-JUL-2002
+//			if (Arcos[link_num].sentido)
+//			IndiceArcos[Arcos[link_num].idTramo].idArco = link_num;
+//		else
+//			IndiceArcos[Arcos[link_num].idTramo].idContraArco = link_num;
+//
+//		// NUEVO 27-JUL-2003
+//		Arcos[link_num].numSoluc = 0;
+//
+//		// NUEVO 23_2_2005
+//		CreaConectores(link_num);
+		return edge;
+	}
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		NetworkRedLoader redLoader = new NetworkRedLoader();
+		
+		redLoader.loadNetwork();
+		redLoader.loadJungNetwork();
+
+	}
+
+	public File getNetFile() {
+		return netFile;
+	}
+
+	public void setNetFile(File netFile) {
+		this.netFile = netFile;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/loaders/NetworkRedLoader.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/loaders/NetworkLoader.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/loaders/NetworkLoader.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/loaders/NetworkLoader.java	(revision 12191)
@@ -0,0 +1,432 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core.loaders;
+
+import java.awt.geom.Point2D;
+import java.io.File;
+
+import com.hardcode.driverManager.Driver;
+import com.hardcode.driverManager.DriverLoadException;
+import com.hardcode.driverManager.DriverManager;
+import com.hardcode.driverManager.DriverValidation;
+import com.hardcode.gdbms.engine.data.DataSource;
+import com.hardcode.gdbms.engine.data.DataSourceFactory;
+import com.hardcode.gdbms.engine.data.NoSuchTableException;
+import com.hardcode.gdbms.engine.data.driver.DBDriver;
+import com.hardcode.gdbms.engine.data.driver.DriverException;
+import com.hardcode.gdbms.engine.data.driver.FileDriver;
+import com.hardcode.gdbms.engine.data.driver.ObjectDriver;
+import com.hardcode.gdbms.engine.values.NumericValue;
+import com.iver.cit.gvsig.fmap.layers.LayerFactory;
+import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
+import com.iver.cit.gvsig.graph.core.EdgeWeightLabeller;
+import com.iver.cit.gvsig.graph.core.FEdge;
+import com.iver.cit.gvsig.graph.core.GvEdge;
+import com.iver.cit.gvsig.graph.core.GvGraph;
+import com.iver.cit.gvsig.graph.core.GvNode;
+import com.iver.cit.gvsig.graph.core.IGraph;
+import com.iver.cit.gvsig.graph.core.INetworkLoader;
+
+import edu.uci.ics.jung.algorithms.shortestpath.DijkstraDistance;
+import edu.uci.ics.jung.graph.ArchetypeVertex;
+import edu.uci.ics.jung.graph.Graph;
+import edu.uci.ics.jung.graph.Vertex;
+import edu.uci.ics.jung.graph.decorators.Indexer;
+import edu.uci.ics.jung.graph.impl.DirectedSparseVertex;
+import edu.uci.ics.jung.graph.impl.SparseGraph;
+import edu.uci.ics.jung.utils.UserData;
+import edu.uci.ics.jung.visualization.DefaultSettableVertexLocationFunction;
+import edu.uci.ics.jung.visualization.SettableVertexLocationFunction;
+
+public class NetworkLoader implements INetworkLoader {
+
+	private String fieldNodeId = "NODEID";
+	private String fieldNodeX = "X";
+	private String fieldNodeY = "Y";
+
+	private String fieldArcId = "ARCID";
+	private String fieldDirection = "DIRECTION";
+	private String fieldNodeOrig = "NODEORIGIN";
+	private String fieldNodeEnd = "NODEEND";
+	private String fieldType = "TYPE";
+	private String fieldDist = "DIST";
+	private String fieldCost = "COST";
+
+	private SelectableDataSource nodeReader;
+	private SelectableDataSource edgeReader;
+
+	private Indexer indexer;
+
+	private boolean bUseCostField;
+
+	/**
+     * The user data key used to retrieve the vertex locations (if any) defined by this class.
+     */
+    public static final String LOCATIONS = "jung.io.GvSIGNetReader.LOCATIONS";
+
+	protected SettableVertexLocationFunction v_locations = new DefaultSettableVertexLocationFunction();
+
+
+	/**
+	 * By default, the fields are:
+	 * private String fieldNodeId = "NODEID";
+	 * 	 fieldNodeX = "X";
+	 * 	 fieldNodeY = "Y";
+	 *
+	 * 	 fieldArcId = "NODEID";
+	 * 	 fieldDirection = "X";
+	 * 	 fieldNodeOrig = "Y";
+	 * 	 fieldNodeEnd = "NODEORIGIN";
+	 * 	 fieldType = "NODEEND";
+	 * 	 fieldDist = "DIST";
+	 *
+	 * If you need to change any, use the correspondant "setFieldXXXX"
+	 * BEFORE calling loadNetwork. And remember to set nodeReader and
+	 * edgeReader also.
+	 */
+	public NetworkLoader(boolean bUseCostField) {
+		this.bUseCostField = bUseCostField;
+	}
+
+
+	public String getFieldArcId() {
+		return fieldArcId;
+	}
+
+	public void setFieldArcId(String fieldArcId) {
+		this.fieldArcId = fieldArcId;
+	}
+
+	public String getFieldDirection() {
+		return fieldDirection;
+	}
+
+	public void setFieldDirection(String fieldDirection) {
+		this.fieldDirection = fieldDirection;
+	}
+
+	public String getFieldDist() {
+		return fieldDist;
+	}
+
+	public void setFieldDist(String fieldDist) {
+		this.fieldDist = fieldDist;
+	}
+
+	public String getFieldNodeEnd() {
+		return fieldNodeEnd;
+	}
+
+	public void setFieldNodeEnd(String fieldNodeEnd) {
+		this.fieldNodeEnd = fieldNodeEnd;
+	}
+
+	public String getFieldNodeId() {
+		return fieldNodeId;
+	}
+
+	public void setFieldNodeId(String fieldNodeId) {
+		this.fieldNodeId = fieldNodeId;
+	}
+
+	public String getFieldNodeOrig() {
+		return fieldNodeOrig;
+	}
+
+	public void setFieldNodeOrig(String fieldNodeOrig) {
+		this.fieldNodeOrig = fieldNodeOrig;
+	}
+
+	public String getFieldNodeX() {
+		return fieldNodeX;
+	}
+
+	public void setFieldNodeX(String fieldNodeX) {
+		this.fieldNodeX = fieldNodeX;
+	}
+
+	public String getFieldNodeY() {
+		return fieldNodeY;
+	}
+
+	public void setFieldNodeY(String fieldNodeY) {
+		this.fieldNodeY = fieldNodeY;
+	}
+
+	public String getFieldType() {
+		return fieldType;
+	}
+
+	public void setFieldType(String fieldType) {
+		this.fieldType = fieldType;
+	}
+
+	public void setEdgeReader(SelectableDataSource edgeReader) {
+		this.edgeReader = edgeReader;
+	}
+
+	public void setNodeReader(SelectableDataSource nodeReader) {
+		this.nodeReader = nodeReader;
+	}
+
+	/**
+	 * @param args
+	 */
+	public static void main(String[] args) {
+		NetworkLoader netLoader = new NetworkLoader(false);
+
+		//Setup de los drivers
+		DriverManager dm = new DriverManager();
+		dm.setValidation(new DriverValidation() {
+				public boolean validate(Driver d) {
+					return ((d instanceof ObjectDriver) ||
+					(d instanceof FileDriver) ||
+					(d instanceof DBDriver));
+				}
+			});
+		dm.loadDrivers(new File("../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers"));
+
+		//Setup del factory de DataSources
+        DataSourceFactory dsf = LayerFactory.getDataSourceFactory();
+		dsf.setDriverManager(dm);
+
+		//Setup de las tablas
+		dsf.addFileDataSource("gdbms dbf driver", "nodes", "c:/nodes.dbf");
+		dsf.addFileDataSource("gdbms dbf driver", "edges", "c:/edges.dbf");
+
+        DataSource dsNodes;
+		try {
+			dsNodes = dsf.createRandomDataSource("nodes",
+			        DataSourceFactory.AUTOMATIC_OPENING);//MANUAL_OPENING);
+
+	        DataSource dsEdges = dsf.createRandomDataSource("edges",
+	                DataSourceFactory.AUTOMATIC_OPENING);//MANUAL_OPENING);
+
+
+			SelectableDataSource sdsNodes = new SelectableDataSource(dsNodes);
+			SelectableDataSource sdsEdges = new SelectableDataSource(dsEdges);
+
+			netLoader.setNodeReader(sdsNodes);
+			netLoader.setEdgeReader(sdsEdges);
+
+
+			Graph g = netLoader.loadJungNetwork();
+
+			System.out.println("Num nodos=" + g.numVertices() + " numEdges = " + g.numEdges());
+
+			// Probamos la algoritmia: distancia entre nodo 1 y nodo 1000
+			DijkstraDistance distCalculator = new DijkstraDistance(g, new EdgeWeightLabeller());
+			ArchetypeVertex vOrig = netLoader.indexer.getVertex(1);
+			ArchetypeVertex vEnd = netLoader.indexer.getVertex(1000);
+			long t1 = System.currentTimeMillis();
+			Number dist = distCalculator.getDistance(vOrig, vEnd);
+			long t2 = System.currentTimeMillis();
+
+
+			System.out.println("dist =" + dist + " meters. msecs: " + (t2-t1));
+			System.out.println(vOrig + " - " + vEnd);
+			System.out.println(vOrig.getUserDatum("X") + ", " + vOrig.getUserDatum("Y")
+							+ " - " + vEnd.getUserDatum("X") + ", " + vEnd.getUserDatum("Y"));
+
+		} catch (DriverLoadException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (NoSuchTableException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (DriverException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+	}
+
+	public Graph loadJungNetwork() {
+		try {
+			int fieldIndexIdNode = nodeReader.getFieldIndexByName(fieldNodeId);
+			int fieldIndexX = nodeReader.getFieldIndexByName(fieldNodeX);;
+			int fieldIndexY = nodeReader.getFieldIndexByName(fieldNodeY);;
+
+			int fieldIndexArcID = edgeReader.getFieldIndexByName(fieldArcId);
+			int fieldIndexDirection = edgeReader.getFieldIndexByName(fieldDirection);
+			int fieldIndexNodeOrig = edgeReader.getFieldIndexByName(fieldNodeOrig);
+			int fieldIndexNodeEnd = edgeReader.getFieldIndexByName(fieldNodeEnd);
+			int fieldIndexType = edgeReader.getFieldIndexByName(fieldType);
+			int fieldIndexDist = edgeReader.getFieldIndexByName(fieldDist);
+
+
+			SparseGraph g = new SparseGraph();
+//			g.getEdgeConstraints().clear();
+			long t1 = System.currentTimeMillis();
+
+			// Mirar NumberEdgeVAlue e Indexer
+			for (int i=0; i < nodeReader.getRowCount(); i++)
+			{
+				NumericValue id = (NumericValue) nodeReader.getFieldValue(i, fieldIndexIdNode);
+				NumericValue x = (NumericValue) nodeReader.getFieldValue(i, fieldIndexX);
+				NumericValue y = (NumericValue) nodeReader.getFieldValue(i, fieldIndexY);
+				Vertex v = new DirectedSparseVertex();
+				v.addUserDatum("ID", id, UserData.CLONE);
+				v.addUserDatum("X", x, UserData.CLONE);
+				v.addUserDatum("Y", y, UserData.CLONE);
+				v_locations.setLocation(v, new Point2D.Double(x.doubleValue(),y.doubleValue()));
+				g.addVertex(v);
+			}
+			indexer = Indexer.getIndexer(g);
+
+			for (int i=0; i < edgeReader.getRowCount(); i++)
+			{
+				NumericValue arcID = (NumericValue) edgeReader.getFieldValue(i, fieldIndexArcID);
+				NumericValue direc = (NumericValue) edgeReader.getFieldValue(i, fieldIndexDirection);
+				NumericValue nodeOrig = (NumericValue) edgeReader.getFieldValue(i, fieldIndexNodeOrig);
+				NumericValue nodeEnd = (NumericValue) edgeReader.getFieldValue(i, fieldIndexNodeEnd);
+				NumericValue type = (NumericValue) edgeReader.getFieldValue(i, fieldIndexType);
+				NumericValue dist = (NumericValue) edgeReader.getFieldValue(i, fieldIndexDist);
+
+				Vertex vFrom = (Vertex) indexer.getVertex(nodeOrig.intValue());
+				Vertex vTo = (Vertex) indexer.getVertex(nodeEnd.intValue());
+
+				FEdge edge = new FEdge(vFrom, vTo);
+				edge.setArcID(arcID.intValue());
+				edge.setDirection(direc.intValue());
+				edge.setIdNodeOrig(nodeOrig.intValue());
+				edge.setIdNodeEnd(nodeEnd.intValue());
+				edge.setType(type.intValue());
+				edge.setWeight(dist.doubleValue());
+
+				g.addEdge(edge);
+			}
+			long t2 = System.currentTimeMillis();
+			System.out.println("Tiempo de carga desde nodes.dbf y edges.dbf y generando JUNG network: " + (t2-t1) + " msecs");
+			return g;
+		} catch (DriverException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+	}
+
+
+	public IGraph loadNetwork() {
+		try {
+			int fieldIndexIdNode = nodeReader.getFieldIndexByName(fieldNodeId);
+			int fieldIndexX = nodeReader.getFieldIndexByName(fieldNodeX);;
+			int fieldIndexY = nodeReader.getFieldIndexByName(fieldNodeY);;
+
+			int fieldIndexArcID = edgeReader.getFieldIndexByName(fieldArcId);
+			int fieldIndexDirection = edgeReader.getFieldIndexByName(fieldDirection);
+			int fieldIndexNodeOrig = edgeReader.getFieldIndexByName(fieldNodeOrig);
+			int fieldIndexNodeEnd = edgeReader.getFieldIndexByName(fieldNodeEnd);
+			int fieldIndexType = edgeReader.getFieldIndexByName(fieldType);
+			int fieldIndexDist = edgeReader.getFieldIndexByName(fieldDist);
+			int fieldIndexCost = edgeReader.getFieldIndexByName(fieldCost);
+
+
+			GvGraph g = new GvGraph();
+			long t1 = System.currentTimeMillis();
+
+			// Mirar NumberEdgeVAlue e Indexer
+			for (int i=0; i < nodeReader.getRowCount(); i++)
+			{
+				NumericValue id = (NumericValue) nodeReader.getFieldValue(i, fieldIndexIdNode);
+				NumericValue x = (NumericValue) nodeReader.getFieldValue(i, fieldIndexX);
+				NumericValue y = (NumericValue) nodeReader.getFieldValue(i, fieldIndexY);
+				GvNode node = new GvNode();
+				node.setX(x.doubleValue());
+				node.setY(y.doubleValue());
+				node.setIdNode(i);
+				g.addNode(node);
+			}
+
+			for (int i=0; i < edgeReader.getRowCount(); i++)
+			{
+				NumericValue arcID = (NumericValue) edgeReader.getFieldValue(i, fieldIndexArcID);
+				NumericValue direc = (NumericValue) edgeReader.getFieldValue(i, fieldIndexDirection);
+				NumericValue nodeOrig = (NumericValue) edgeReader.getFieldValue(i, fieldIndexNodeOrig);
+				NumericValue nodeEnd = (NumericValue) edgeReader.getFieldValue(i, fieldIndexNodeEnd);
+				NumericValue type = (NumericValue) edgeReader.getFieldValue(i, fieldIndexType);
+				NumericValue dist = (NumericValue) edgeReader.getFieldValue(i, fieldIndexDist);
+
+				GvEdge edge = new GvEdge();
+				edge.setIdArc(arcID.intValue());
+				edge.setIdEdge(i);
+				edge.setDirec(direc.intValue());
+				edge.setIdNodeOrig(nodeOrig.intValue());
+				edge.setIdNodeEnd(nodeEnd.intValue());
+				edge.setType(type.intValue());
+				edge.setDistance(dist.doubleValue());
+				if (bUseCostField)
+				{
+					NumericValue cost = (NumericValue) edgeReader.getFieldValue(i, fieldIndexCost);
+					edge.setWeight(cost.doubleValue());
+				}
+
+				g.addEdge(edge);
+			}
+			long t2 = System.currentTimeMillis();
+			System.out.println("Tiempo de carga desde nodes.dbf y edges.dbf y generando JUNG network: " + (t2-t1) + " msecs");
+			return g;
+		} catch (DriverException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		return null;
+
+	}
+
+
+	public String getFieldCost() {
+		return fieldCost;
+	}
+
+
+	public void setFieldCost(String fieldCost) {
+		this.fieldCost = fieldCost;
+	}
+
+
+	public Indexer getIndexer() {
+		return indexer;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/loaders/NetworkLoader.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/IGraph.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/IGraph.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/IGraph.java	(revision 12191)
@@ -0,0 +1,66 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+/**
+ * @author fjp
+ * 
+ * Grafo simple que nos permitir� trabajar en el futuro con
+ * ficheros en lugar de en memoria. Como se puede comprobar, su
+ * modelo puede ser un arrayList, o simplemente 2 tablas.
+ *
+ */
+public interface IGraph {
+	public GvNode getNodeByID(int idNode);
+	public GvEdge getEdgeByID(int idEdge);
+	public int numVertices();
+	public int numEdges();
+	
+	public EdgePair getEdgesByIdArc(int idArc);
+	
+	public void addEdge(GvEdge edge);
+	public void addNode(GvNode node);
+	public void addEdgePair(int arcId, EdgePair edgePair);
+	public void removeEdge(int idEdge);
+	public void removeNode(int idNode);
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/IGraph.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/FEdge.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/FEdge.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/FEdge.java	(revision 12191)
@@ -0,0 +1,113 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+import edu.uci.ics.jung.graph.Vertex;
+import edu.uci.ics.jung.graph.impl.DirectedSparseEdge;
+
+public class FEdge extends DirectedSparseEdge {
+
+	private int arcID;
+	private int type;
+	private int direction;
+	private double cost1;
+	private double cost2;
+	private int idNodeOrig;
+	private int idNodeEnd;
+	private int numSoluc;
+	public FEdge(Vertex from, Vertex to) {
+		super(from, to);
+	}
+	public double getWeight() {
+		return cost1;
+	}
+	public int getArcID() {
+		return arcID;
+	}
+	public void setArcID(int arcID) {
+		this.arcID = arcID;
+	}
+	public double getCost1() {
+		return cost1;
+	}
+	public void setWeight(double cost1) {
+		this.cost1 = cost1;
+	}
+	public double getCost2() {
+		return cost2;
+	}
+	public void setCost2(double d) {
+		this.cost2 = d;
+	}
+	public int getDirection() {
+		return direction;
+	}
+	public void setDirection(int direction) {
+		this.direction = direction;
+	}
+	public int getIdNodeEnd() {
+		return idNodeEnd;
+	}
+	public void setIdNodeEnd(int idNodeEnd) {
+		this.idNodeEnd = idNodeEnd;
+	}
+	public int getIdNodeOrig() {
+		return idNodeOrig;
+	}
+	public void setIdNodeOrig(int idNodeOrig) {
+		this.idNodeOrig = idNodeOrig;
+	}
+	public int getNumSoluc() {
+		return numSoluc;
+	}
+	public void setNumSoluc(int numSoluc) {
+		this.numSoluc = numSoluc;
+	}
+	public int getType() {
+		return type;
+	}
+	public void setType(int type) {
+		this.type = type;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/FEdge.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/EdgeWeightLabeller.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/EdgeWeightLabeller.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/EdgeWeightLabeller.java	(revision 12191)
@@ -0,0 +1,66 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+import edu.uci.ics.jung.graph.ArchetypeEdge;
+import edu.uci.ics.jung.graph.decorators.NumberEdgeValue;
+
+/**
+ * @author fjp
+ * Suponemos que edge es de tipo FEdge, que extiendo ArchetypeEdge
+ *
+ */
+public class EdgeWeightLabeller implements NumberEdgeValue {
+		
+	public Number getNumber(ArchetypeEdge e) {
+		FEdge fe = (FEdge) e;
+		double weight = fe.getWeight();
+		return new Double(weight);
+	}
+
+	public void setNumber(ArchetypeEdge e, Number n) {
+		FEdge fe = (FEdge) e;
+		fe.setWeight(n.doubleValue());
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/EdgeWeightLabeller.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/NetworkJdbcWriter.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/NetworkJdbcWriter.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/NetworkJdbcWriter.java	(revision 12191)
@@ -0,0 +1,298 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core.writers;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.Hashtable;
+
+import com.hardcode.gdbms.engine.values.NumericValue;
+import com.hardcode.gdbms.engine.values.ValueFactory;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.edition.EditionException;
+import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
+import com.iver.cit.gvsig.fmap.layers.VectorialAdapter;
+import com.iver.cit.gvsig.graph.core.NodeGv;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+
+public class NetworkJdbcWriter extends AbstractNetworkWriter {
+
+	private Connection conn;
+	private ResultSet rsNodes;
+	private ResultSet rsEdges;
+
+	private void createTables() throws SQLException {
+		Statement stCreate = conn.createStatement();
+		int indexPoint = lyr.getName().indexOf('.');
+		String layerName;
+		if (indexPoint == -1)
+			layerName = lyr.getName();
+		else
+			layerName = lyr.getName().substring(0, indexPoint);
+		
+		try {
+			stCreate.execute("DROP TABLE " + layerName + "_nodes;");
+		} catch (SQLException e1) {
+			// Si no existe la tabla, no hay que borrarla.
+		}
+		try {
+			stCreate.execute("DROP TABLE " + layerName + "_edges;");
+		} catch (SQLException e1) {
+			// Si no existe la tabla, no hay que borrarla.
+		}
+
+		stCreate.execute("CREATE TABLE " + layerName
+				+ "_nodes (NODEID int4, X float8, Y float8);");
+		stCreate.execute("ALTER TABLE "
+						+ layerName
+						+ "_nodes MODIFY COLUMN NODEID INTEGER, ADD PRIMARY KEY(NODEID);");
+		stCreate.execute("CREATE TABLE "
+						+ layerName
+						+ "_edges (EdgeId int4, ArcID int4, Direction int2, NodeOrigin int4, "
+						+ "NodeEnd int4, Type int4, Dist float8, Cost float8);");
+		stCreate.execute("ALTER TABLE "
+						+ layerName
+						+ "_edges MODIFY COLUMN EdgeId INTEGER, ADD PRIMARY KEY(EdgeId);");
+
+		conn.setAutoCommit(false);
+		conn.commit();
+		// conn.setAutoCommit(true);
+
+		Statement st = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
+				ResultSet.CONCUR_UPDATABLE);
+		rsNodes = st.executeQuery("SELECT * FROM " + layerName + "_nodes;");
+		if (rsNodes.getConcurrency() != ResultSet.CONCUR_UPDATABLE) {
+			System.err.println("Error: No se puede editar la tabla nodes");
+			return;
+		}
+		Statement st2 = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
+				ResultSet.CONCUR_UPDATABLE);
+
+		rsEdges = st2.executeQuery("SELECT * FROM " + layerName + "_edges;");
+
+	}
+
+	public void writeNetwork() throws EditionException, DriverException {
+		try {
+			createTables();
+			
+			conn.setAutoCommit(false);
+			
+			double distance;
+			double cost;
+			short arcType;
+			int direction;
+			int i;
+			int idNodo1, idNodo2, nodeCount, edgeCount;
+			short sentidoDigit; // => 1 en esa direcci�n. 0=> Al contrario. SOLO
+			// SE UTILIZA PARA LOS CALCULOS POR IDTRAMO Y
+			// PORCENTAJE
+			// PARA SABER SI EST� M�S CERCA DE UN NODO O DEL OTRO.
+
+			VectorialAdapter adapter = (VectorialAdapter) lyr.getSource();
+
+			int numEntities = adapter.getShapeCount();
+			Hashtable nodeHash = new Hashtable();
+			SelectableDataSource sds = lyr.getRecordset();
+
+			int senseFieldIndex = -1;
+			int distFieldIndex = -1;
+			int typeFieldIndex = -1;
+			int costFieldIndex = -1;
+
+			if (fieldSense != null)
+				senseFieldIndex = sds.getFieldIndexByName(fieldSense);
+			if (fieldDist != null)
+				distFieldIndex = sds.getFieldIndexByName(fieldDist);
+			if (fieldType != null)
+				typeFieldIndex = sds.getFieldIndexByName(fieldType);
+			if (fieldCost != null)
+				costFieldIndex = sds.getFieldIndexByName(fieldCost);
+
+			edgeCount = 0;
+			nodeCount = 0;
+
+			NumericValue valAux = null;
+
+			for (i = 0; i < numEntities; i++) {
+				IGeometry geom = adapter.getShape(i);
+				Geometry jtsGeom = geom.toJTSGeometry();
+				Coordinate[] coords = jtsGeom.getCoordinates();
+				Coordinate c1 = coords[0];
+				Coordinate c2 = coords[coords.length - 1];
+
+				NodeGv nodeAux;
+				if (!nodeHash.containsKey(c1)) // No est�.
+				{
+					idNodo1 = nodeCount++;
+					nodeAux = new NodeGv(c1, idNodo1);
+					nodeHash.put(c1, nodeAux);
+					writeNode(nodeAux);
+				} else {
+					nodeAux = (NodeGv) nodeHash.get(c1);
+				}
+				idNodo1 = nodeAux.getId().intValue();
+
+				if (!nodeHash.containsKey(c2)) // No est�.
+				{
+					idNodo2 = nodeCount++;
+					nodeAux = new NodeGv(c2, idNodo2);
+					nodeHash.put(c2, nodeAux);
+					writeNode(nodeAux);
+				} else {
+					nodeAux = (NodeGv) nodeHash.get(c2);
+				}
+				idNodo2 = nodeAux.getId().intValue();
+
+				if (typeFieldIndex != -1)
+					valAux = (NumericValue) sds
+							.getFieldValue(i, typeFieldIndex);
+				else
+					valAux = ValueFactory.createValue(0); // no hay tipo
+				arcType = valAux.shortValue();
+				// TipoTramo = DBFReadIntegerAttribute(hDBF, i, indiceCampo1);
+
+				if (distFieldIndex != -1)
+					valAux = (NumericValue) sds
+							.getFieldValue(i, distFieldIndex);
+				else
+					valAux = ValueFactory.createValue(jtsGeom.getLength());
+				distance = valAux.floatValue();
+				// Distancia = (float) DBFReadDoubleAttribute(hDBF, i,
+				// indiceCampo2);
+				if (costFieldIndex != -1) {
+					valAux = (NumericValue) sds
+							.getFieldValue(i, costFieldIndex);
+					cost = valAux.doubleValue();
+				} else
+					cost = distance;
+
+				direction = -1;
+
+				if (senseFieldIndex == -1)
+					direction = 3; // 3-> Doble sentido, 1-> seg�n viene, 2 ->
+				// al rev�s, cualquier otro valor-> No hay
+				// arco
+				else {
+					valAux = (NumericValue) sds.getFieldValue(i,
+							senseFieldIndex);
+					direction = valAux.shortValue();
+				}
+
+				if (direction == 3) {
+					sentidoDigit = 1; // En esa direcci�n
+					writeEdge(edgeCount, i, sentidoDigit, idNodo1, idNodo2,
+							arcType, distance, cost);
+					edgeCount++;
+
+					sentidoDigit = 0;
+					writeEdge(edgeCount, i, sentidoDigit, idNodo2, idNodo1,
+							arcType, distance, cost);
+					edgeCount++;
+
+				}
+				if (direction == 1) {
+					sentidoDigit = 1; // En esa direcci�n
+					writeEdge(edgeCount, i, sentidoDigit, idNodo1, idNodo2,
+							arcType, distance, cost);
+					edgeCount++;
+				}
+				if (direction == 2) {
+					sentidoDigit = 0;
+					writeEdge(edgeCount, i, sentidoDigit, idNodo2, idNodo1,
+							arcType, distance, cost);
+					edgeCount++;
+
+				}
+
+			}
+			conn.commit();
+
+		} catch (SQLException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
+			e.printStackTrace();
+			throw new DriverException(e);
+		} catch (DriverIOException e) {
+			e.printStackTrace();
+			throw new DriverException(e);
+		}
+
+	}
+
+	private void writeEdge(int edgeId, int id, short sense, int idNodeOrig,
+			int idNodeEnd, short tipoTramo, double dist, double cost) throws SQLException
+			 {
+		rsEdges.moveToInsertRow();
+		rsEdges.updateInt(1, edgeId);
+		rsEdges.updateInt(2, id);
+		rsEdges.updateInt(3, sense);
+		rsEdges.updateInt(4, idNodeOrig);
+		rsEdges.updateInt(5, idNodeEnd);
+		rsEdges.updateInt(6, tipoTramo);
+		rsEdges.updateDouble(7, dist);
+		rsEdges.updateDouble(8, cost);
+		rsEdges.insertRow();
+//		System.out.println("writing edge " + edgeId);
+	}
+
+	private void writeNode(NodeGv node) throws SQLException {
+		rsNodes.moveToInsertRow();
+		int id = node.getId().intValue();
+		rsNodes.updateInt(1, id);
+		rsNodes.updateDouble(2, node.getCoordinate().x);
+		rsNodes.updateDouble(3, node.getCoordinate().y);
+		rsNodes.insertRow();		
+//		System.out.println("writing node " + id);
+
+	}
+
+	public void setConnection(Connection conn) {
+		this.conn = conn;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/NetworkJdbcWriter.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/AbstractNetworkWriter.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/AbstractNetworkWriter.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/AbstractNetworkWriter.java	(revision 12191)
@@ -0,0 +1,99 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core.writers;
+
+import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.graph.core.INetworkWriter;
+
+public abstract class AbstractNetworkWriter implements INetworkWriter {
+
+	protected FLyrVect lyr;
+	protected String fieldType;
+	protected String fieldDist;
+	protected String fieldCost;
+	protected String fieldSense;
+	protected FieldDescription[] nodeFields;
+	protected FieldDescription[] edgeFields;
+
+	public FLyrVect getLayer() {
+		return lyr;
+	}
+
+	public void setLayer(FLyrVect lyr) {
+		this.lyr = lyr;
+	}
+
+	public String getFieldCost() {
+		return fieldCost;
+	}
+
+	public void setFieldCost(String fieldCost) {
+		this.fieldCost = fieldCost;
+	}
+
+	public String getFieldDist() {
+		return fieldDist;
+	}
+
+	public void setFieldDist(String fieldDist) {
+		this.fieldDist = fieldDist;
+	}
+
+	public String getFieldSense() {
+		return fieldSense;
+	}
+
+	public void setFieldSense(String fieldSense) {
+		this.fieldSense = fieldSense;
+	}
+
+	public String getFieldType() {
+		return fieldType;
+	}
+
+	public void setFieldType(String fieldType) {
+		this.fieldType = fieldType;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/AbstractNetworkWriter.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/NetworkGvTableWriter.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/NetworkGvTableWriter.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/NetworkGvTableWriter.java	(revision 12191)
@@ -0,0 +1,337 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core.writers;
+
+import java.sql.Types;
+import java.util.Hashtable;
+
+import com.hardcode.gdbms.engine.values.NumericValue;
+import com.hardcode.gdbms.engine.values.Value;
+import com.hardcode.gdbms.engine.values.ValueFactory;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.core.DefaultRow;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
+import com.iver.cit.gvsig.fmap.drivers.ITableDefinition;
+import com.iver.cit.gvsig.fmap.drivers.TableDefinition;
+import com.iver.cit.gvsig.fmap.edition.DefaultRowEdited;
+import com.iver.cit.gvsig.fmap.edition.EditionException;
+import com.iver.cit.gvsig.fmap.edition.IRowEdited;
+import com.iver.cit.gvsig.fmap.edition.IWriter;
+import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
+import com.iver.cit.gvsig.fmap.layers.VectorialAdapter;
+import com.iver.cit.gvsig.graph.core.NodeGv;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+
+public class NetworkGvTableWriter extends AbstractNetworkWriter {
+	
+	private IWriter nodeWriter;
+
+	private IWriter edgeWriter;
+
+	private void createFields() {
+		// Set up fields for table nodes
+		nodeFields = new FieldDescription[3];
+		FieldDescription fieldNodeId = new FieldDescription();
+		fieldNodeId.setFieldName("NODEID");
+		fieldNodeId.setFieldType(Types.INTEGER);
+
+		FieldDescription fieldX = new FieldDescription();
+		fieldX.setFieldName("X");
+		fieldX.setFieldType(Types.DOUBLE);
+		fieldX.setFieldDecimalCount(2);
+
+		FieldDescription fieldY = new FieldDescription();
+		fieldY.setFieldName("Y");
+		fieldY.setFieldType(Types.DOUBLE);
+		fieldY.setFieldDecimalCount(2);
+		
+		nodeFields[0] = fieldNodeId;
+		nodeFields[1] = fieldX;
+		nodeFields[2] = fieldY;
+
+		
+		// Set up fields for table edges
+		edgeFields = new FieldDescription[7];
+
+		// ID_TRAMO ORIGINAL!!!
+		FieldDescription fieldArcID = new FieldDescription();
+		fieldArcID.setFieldName("ArcID");
+		fieldArcID.setFieldType(Types.INTEGER);
+
+		FieldDescription fieldDirection = new FieldDescription();
+		fieldDirection.setFieldName("Direction");
+		fieldDirection.setFieldType(Types.SMALLINT);
+		
+		FieldDescription fieldNodeOrigin = new FieldDescription();
+		fieldNodeOrigin.setFieldName("NodeOrigin");
+		fieldNodeOrigin.setFieldType(Types.INTEGER);
+		FieldDescription fieldNodeEnd = new FieldDescription();
+		fieldNodeEnd.setFieldName("NodeEnd");
+		fieldNodeEnd.setFieldType(Types.INTEGER);
+
+		FieldDescription fieldType = new FieldDescription();
+		fieldType.setFieldName("Type");
+		fieldType.setFieldType(Types.SMALLINT);
+
+		FieldDescription fieldDistanceDist = new FieldDescription();
+		fieldDistanceDist.setFieldName("Dist");
+		fieldDistanceDist.setFieldType(Types.DOUBLE);
+		
+		FieldDescription fieldDistanceCost = new FieldDescription();
+		fieldDistanceCost.setFieldName("Cost");
+		fieldDistanceCost.setFieldType(Types.DOUBLE);
+		
+		edgeFields[0] = fieldArcID;
+		edgeFields[1] = fieldDirection;
+		edgeFields[2] = fieldNodeOrigin;
+		edgeFields[3] = fieldNodeEnd;
+		edgeFields[4] = fieldType;
+		edgeFields[5] = fieldDistanceDist;
+		edgeFields[6] = fieldDistanceCost;
+		
+	}
+	public void writeNetwork() throws EditionException, DriverException {
+		double distance;
+		double cost;
+		short arcType;
+		int direction;
+		int i;
+		int idNodo1, idNodo2, nodeCount, edgeCount;
+		short sentidoDigit; // => 1 en esa direcci�n. 0=> Al contrario. SOLO
+		// SE UTILIZA PARA LOS CALCULOS POR IDTRAMO Y
+		// PORCENTAJE
+		// PARA SABER SI EST� M�S CERCA DE UN NODO O DEL OTRO.
+
+		createFields();
+		
+		VectorialAdapter adapter = (VectorialAdapter) lyr.getSource();
+
+		try {
+			int numEntities = adapter.getShapeCount();
+			Hashtable nodeHash = new Hashtable();
+
+			SelectableDataSource sds = lyr.getRecordset();
+			
+			int senseFieldIndex = -1;
+			int distFieldIndex = -1;
+			int typeFieldIndex = -1;
+			int costFieldIndex = -1;
+			
+			if (fieldSense != null)
+				senseFieldIndex = sds.getFieldIndexByName(fieldSense);
+			if (fieldDist != null)
+				distFieldIndex = sds.getFieldIndexByName(fieldDist);
+			if (fieldType != null)
+				typeFieldIndex = sds.getFieldIndexByName(fieldType);
+			if (fieldCost != null)
+				costFieldIndex = sds.getFieldIndexByName(fieldCost);
+
+			// We create a table definition for node table.
+			ITableDefinition nodesTableDef = new TableDefinition();
+			nodesTableDef.setFieldsDesc(nodeFields);
+			nodesTableDef.setName("Nodes");
+
+			// We create a table definition for edges table.
+			ITableDefinition edgeTableDef = new TableDefinition();
+			edgeTableDef.setFieldsDesc(edgeFields);
+			edgeTableDef.setName("Edges");
+
+			nodeWriter.initialize(nodesTableDef);
+			edgeWriter.initialize(edgeTableDef);
+			
+			nodeWriter.preProcess();
+			edgeWriter.preProcess();
+			
+			edgeCount = 0;
+			nodeCount = 0; 
+			
+			NumericValue valAux = null;
+
+			for (i = 0; i < numEntities; i++) {
+				IGeometry geom = adapter.getShape(i);
+				Geometry jtsGeom = geom.toJTSGeometry();
+				Coordinate[] coords = jtsGeom.getCoordinates();
+				Coordinate c1 = coords[0];
+				Coordinate c2 = coords[coords.length - 1];
+
+				NodeGv nodeAux;
+				if (!nodeHash.containsKey(c1)) // No est�.
+				{
+					idNodo1 = nodeCount++;
+					nodeAux = new NodeGv(c1, idNodo1);
+					nodeHash.put(c1, nodeAux);
+					writeNode(nodeAux);
+				} else {
+					nodeAux = (NodeGv) nodeHash.get(c1);
+				}
+				idNodo1 = nodeAux.getId().intValue();
+
+				if (!nodeHash.containsKey(c2)) // No est�.
+				{
+					idNodo2 = nodeCount++;
+					nodeAux = new NodeGv(c2, idNodo2);
+					nodeHash.put(c2, nodeAux);
+					writeNode(nodeAux);
+				} else {
+					nodeAux = (NodeGv) nodeHash.get(c2);
+				}
+				idNodo2 = nodeAux.getId().intValue();
+
+				if (typeFieldIndex != -1)
+					valAux = (NumericValue) sds.getFieldValue(i, typeFieldIndex);
+				else
+					valAux = ValueFactory.createValue(0); // no hay tipo
+				arcType = valAux.shortValue();
+				// TipoTramo = DBFReadIntegerAttribute(hDBF, i, indiceCampo1);
+				
+				if (distFieldIndex != -1)
+					valAux = (NumericValue) sds.getFieldValue(i, distFieldIndex);
+				else
+					valAux = ValueFactory.createValue(jtsGeom.getLength());
+				distance = valAux.floatValue();
+				// Distancia = (float) DBFReadDoubleAttribute(hDBF, i,
+				// indiceCampo2);
+				if (costFieldIndex != -1)
+				{
+					valAux = (NumericValue) sds.getFieldValue(i, costFieldIndex);
+					cost = valAux.doubleValue();
+				}
+				else
+					cost = distance;
+				
+				direction = -1;
+
+				if (senseFieldIndex == -1)
+					direction = 3; // 3-> Doble sentido, 1-> seg�n viene, 2 ->
+				// al rev�s, cualquier otro valor-> No hay
+				// arco
+				else {
+					valAux = (NumericValue) sds.getFieldValue(i,
+							senseFieldIndex);
+					direction = valAux.shortValue();
+				}
+				
+				if (direction == 3) {
+					sentidoDigit = 1; // En esa direcci�n
+					writeEdge(i, sentidoDigit, idNodo1, idNodo2, arcType,
+							distance, cost);
+					edgeCount++;
+
+					sentidoDigit = 0;
+					writeEdge(i, sentidoDigit, idNodo2, idNodo1, arcType,
+							distance, cost);
+					edgeCount++;
+
+				}
+				if (direction == 1) {
+					sentidoDigit = 1; // En esa direcci�n
+					writeEdge(i, sentidoDigit, idNodo1, idNodo2, arcType,
+							distance, cost);
+					edgeCount++;
+				}
+				if (direction == 2) {
+					sentidoDigit = 0;
+					writeEdge(i, sentidoDigit, idNodo2, idNodo1, arcType,
+							distance, cost);
+					edgeCount++;
+
+				}
+
+			}
+
+			nodeWriter.postProcess();
+			edgeWriter.postProcess();
+		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
+			e.printStackTrace();
+			throw new DriverException(e);
+		} catch (DriverIOException e) {
+			e.printStackTrace();
+			throw new DriverException(e);
+		}
+
+		
+	}
+
+	private void writeEdge(int id, short sense, int idNodeOrig, int idNodeEnd,
+			short tipoTramo, double dist, double cost) throws EditionException {
+		Value[] values = new Value[edgeFields.length];
+		values[0] = ValueFactory.createValue(id);
+		values[1] = ValueFactory.createValue(sense);
+		values[2] = ValueFactory.createValue(idNodeOrig);
+		values[3] = ValueFactory.createValue(idNodeEnd);
+		values[4] = ValueFactory.createValue(tipoTramo);
+		values[5] = ValueFactory.createValue(dist);
+		values[6] = ValueFactory.createValue(cost);
+		DefaultRow myRow = new DefaultRow(values, id + "");
+		IRowEdited editedRow = new DefaultRowEdited(myRow,
+				DefaultRowEdited.STATUS_ADDED, id);
+
+		edgeWriter.process(editedRow);
+	}
+	
+	private void writeNode(NodeGv node) throws EditionException {
+		Value[] values = new Value[nodeFields.length];
+		int id = node.getId().intValue();
+		values[0] = ValueFactory.createValue(id);
+		values[1] = ValueFactory.createValue(node.getCoordinate().x);
+		values[2] = ValueFactory.createValue(node.getCoordinate().y);
+		DefaultRow myRow = new DefaultRow(values, id + "");
+		IRowEdited editedRow = new DefaultRowEdited(myRow,
+				DefaultRowEdited.STATUS_ADDED, id);
+
+		nodeWriter.process(editedRow);	
+	}
+
+	public void setEdgeWriter(IWriter edgeWriter) {
+		this.edgeWriter = edgeWriter;
+	}
+
+	public void setNodeWriter(IWriter nodeWriter) {
+		this.nodeWriter = nodeWriter;
+	}
+
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/NetworkGvTableWriter.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/NetworkFileRedWriter.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/NetworkFileRedWriter.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/NetworkFileRedWriter.java	(revision 12191)
@@ -0,0 +1,433 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core.writers;
+
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.RandomAccessFile;
+import java.nio.ByteOrder;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Hashtable;
+
+import javax.imageio.stream.FileImageOutputStream;
+
+import org.cresques.cts.ICoordTrans;
+
+import com.hardcode.gdbms.engine.values.NumericValue;
+import com.hardcode.gdbms.engine.values.ValueFactory;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.drivers.DriverAttributes;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
+import com.iver.cit.gvsig.fmap.edition.EditionException;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
+import com.iver.cit.gvsig.fmap.layers.VectorialAdapter;
+import com.iver.cit.gvsig.graph.core.NodeGv;
+import com.iver.cit.gvsig.util.SnappingCoordinateMap;
+import com.iver.utiles.swing.threads.CancellableMonitorable;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+
+/**
+ * @author fjp
+ *
+ * 
+ */
+public class NetworkFileRedWriter extends AbstractNetworkWriter {
+	File redFile;
+	CancellableMonitorable cancel;
+	private double snapTolerance = 0d;
+	public NetworkFileRedWriter() {
+		
+		// Set up fields for table nodes
+		nodeFields = new FieldDescription[3];
+		FieldDescription fieldNodeId = new FieldDescription();
+		fieldNodeId.setFieldName("NODEID");
+		fieldNodeId.setFieldType(Types.INTEGER);
+
+		FieldDescription fieldX = new FieldDescription();
+		fieldX.setFieldName("X");
+		fieldX.setFieldType(Types.DOUBLE);
+		fieldX.setFieldDecimalCount(2);
+
+		FieldDescription fieldY = new FieldDescription();
+		fieldY.setFieldName("Y");
+		fieldY.setFieldType(Types.DOUBLE);
+		fieldY.setFieldDecimalCount(2);
+		
+		nodeFields[0] = fieldNodeId;
+		nodeFields[1] = fieldX;
+		nodeFields[2] = fieldY;
+
+		
+		// Set up fields for table edges
+		edgeFields = new FieldDescription[7];
+
+		// ID_TRAMO ORIGINAL!!!
+		FieldDescription fieldArcID = new FieldDescription();
+		fieldArcID.setFieldName("ArcID");
+		fieldArcID.setFieldType(Types.INTEGER);
+
+		FieldDescription fieldDirection = new FieldDescription();
+		fieldDirection.setFieldName("Direction");
+		fieldDirection.setFieldType(Types.SMALLINT);
+		
+		FieldDescription fieldNodeOrigin = new FieldDescription();
+		fieldNodeOrigin.setFieldName("NodeOrigin");
+		fieldNodeOrigin.setFieldType(Types.INTEGER);
+		FieldDescription fieldNodeEnd = new FieldDescription();
+		fieldNodeEnd.setFieldName("NodeEnd");
+		fieldNodeEnd.setFieldType(Types.INTEGER);
+
+		FieldDescription fieldType = new FieldDescription();
+		fieldType.setFieldName("Type");
+		fieldType.setFieldType(Types.SMALLINT);
+
+		FieldDescription fieldDistanceDist = new FieldDescription();
+		fieldDistanceDist.setFieldName("Dist");
+		fieldDistanceDist.setFieldType(Types.DOUBLE);
+		
+		FieldDescription fieldDistanceCost = new FieldDescription();
+		fieldDistanceCost.setFieldName("Cost");
+		fieldDistanceCost.setFieldType(Types.DOUBLE);
+		
+		edgeFields[0] = fieldArcID;
+		edgeFields[1] = fieldDirection;
+		edgeFields[2] = fieldNodeOrigin;
+		edgeFields[3] = fieldNodeEnd;
+		edgeFields[4] = fieldType;
+		edgeFields[5] = fieldDistanceDist;
+		edgeFields[6] = fieldDistanceCost;
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.cit.gvsig.graph.core.INetworkWriter#writeNetwork(boolean)
+	 */
+	public void writeNetwork() throws EditionException {
+		// PRIMERO VAN EL NUMERO DE TRAMOS, LUEGO EL NUMERO DE ARCOS Y LUEGO
+		// EL NUMERO DE NODOS, DESPUES
+		// IDTRAMO-SENTIDO_DIGITALIZACION-IDNODOORIGEN-IDNODODESTINO-TIPOTRAMO-DISTANCIA
+		// Y POR FIN
+		// IDNODO-Xdouble-Ydouble
+
+		// El campo sentido indica //3-> Doble sentido, 1-> seg�n viene, 2
+		// -> al rev�s, cualquier otro valor-> No hay arco
+		// TipoTamo va a ser un campo num�rico, entero.
+		// 0-> Autopista.
+		// 1-> Autov�a.
+		// 2-> Nacional.
+		// 3-> Nacional - Comarcal.
+		// 4-> Comarcal.
+		// 5-> Otras.
+		// 6-> Ferry.
+		// 7-> Conexiones
+		// Los nombres son orientativos. Basta saber que puede haber hasta X
+		// tipos distintos de tramos, cada uno
+		// con su velocidad. Esa velocidad se fijar� en la funci�n
+		// FijaVelocidades. OJO, empezar siempre desde el 0
+
+		double distance, cost;
+		short arcType;
+		int direction;
+		int i;
+		int idNodo1, idNodo2, nodeCount, edgeCount;
+		short sentidoDigit; // => 1 en esa direcci�n. 0=> Al contrario. SOLO
+		// SE UTILIZA PARA LOS CALCULOS POR IDTRAMO Y
+		// PORCENTAJE
+		// PARA SABER SI EST� M�S CERCA DE UN NODO O DEL OTRO.
+		Hashtable nodeHash = null;
+		if(snapTolerance != 0d)
+			nodeHash = new SnappingCoordinateMap(snapTolerance);
+		else
+			nodeHash = new Hashtable();
+		ArrayList nodes = new ArrayList();
+
+		try {
+			if (lyr.getShapeType() != FShape.LINE) {
+				return;
+			}
+			RandomAccessFile file = new RandomAccessFile(redFile.getPath(),
+					"rw");
+			FileImageOutputStream output = new FileImageOutputStream(file);
+//			FileChannel channel = file.getChannel();
+//			MappedByteBuffer buf = channel.map(MapMode.READ_WRITE, 0,
+//					16 * 1024);
+//			buf.order(ByteOrder.LITTLE_ENDIAN);
+			output.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+
+			nodeCount = 0;
+			VectorialAdapter adapter = (VectorialAdapter) lyr.getSource();
+			adapter.start();
+			int numTramos;
+			
+			ICoordTrans ct = lyr.getCoordTrans();
+
+			numTramos = adapter.getShapeCount();
+			// Cambiamos otra vez: Escribimos primero el n� de tramos. Luego va
+			// el n� de arcos y el de nodos.
+			// buf.putInt(numTramos);
+			output.writeInt(numTramos);
+			// /////// Cambiamos el formato: primero van los arcos y luego los
+			// nodos
+			// file.writeInt(0);
+			output.writeInt(0);
+			// OJO: El numero de arcos todav�a no lo sabemos, habr� que volver
+			// luego y escribir el numero correcto. Es por lo de los sentidos.
+			// Metemos 2 arcos si es doble sentido, y uno si es de un solo
+			// sentido
+
+			// Guardamos un long. Luego volveremos aqu� y grabaremos el n� de
+			// nodos
+			// file.writeInt(0);
+			output.writeInt(numTramos);
+			// AHORA METEMOS LOS NOMBRES DE LOS CAMPOS. EN EL CARGA RED LOS
+			// USAREMOS PARA LEER DEL DBF.
+
+			edgeCount = 0;
+
+			SelectableDataSource sds = lyr.getRecordset();
+			int senseFieldIndex = -1;
+			int distFieldIndex = -1;
+			int typeFieldIndex = -1;
+			int costFieldIndex = -1;
+			
+			if (fieldSense != null)
+				senseFieldIndex = sds.getFieldIndexByName(fieldSense);
+			if (fieldDist != null)
+				distFieldIndex = sds.getFieldIndexByName(fieldDist);
+			if (fieldType != null)
+				typeFieldIndex = sds.getFieldIndexByName(fieldType);
+			if (fieldCost != null)
+				costFieldIndex = sds.getFieldIndexByName(fieldCost);
+
+	        DriverAttributes attr = adapter.getDriverAttributes();
+	        boolean bMustClone = false;
+	        if (attr != null)
+	        {
+	            if (attr.isLoadedInMemory())
+	            {
+	                bMustClone = attr.isLoadedInMemory();               
+	            }
+	        }
+
+			
+			NumericValue valAux = null;
+			for (i = 0; i < numTramos; i++) {
+				IGeometry geom = adapter.getShape(i);
+				if (ct != null)
+				{
+	                if (bMustClone)
+	                    geom = geom.cloneGeometry();
+	                geom.reProject(ct);
+
+				}
+				Geometry jtsGeom = geom.toJTSGeometry();
+				Coordinate[] coords = jtsGeom.getCoordinates();
+				Coordinate c1 = coords[0];
+				Coordinate c2 = coords[coords.length - 1];
+				
+				NodeGv nodeAux;
+				if (!nodeHash.containsKey(c1)) // No est�.
+				{
+					idNodo1 = nodeCount++;
+					nodeAux = new NodeGv(c1, idNodo1);
+					nodeHash.put(c1, nodeAux);
+					nodes.add(nodeAux);
+				} else {
+					nodeAux = (NodeGv) nodeHash.get(c1);
+				}
+				idNodo1 = nodeAux.getId().intValue();
+
+				if (!nodeHash.containsKey(c2)) // No est�.
+				{
+					idNodo2 = nodeCount++;
+					nodeAux = new NodeGv(c2, idNodo2);
+					nodeHash.put(c2, nodeAux);
+					nodes.add(nodeAux);
+
+				} else {
+					nodeAux = (NodeGv) nodeHash.get(c2);
+				}
+				idNodo2 = nodeAux.getId().intValue();
+
+				if (typeFieldIndex != -1)
+					valAux = (NumericValue) sds.getFieldValue(i, typeFieldIndex);
+				else
+					valAux = ValueFactory.createValue(0); // no hay tipo
+				arcType = valAux.shortValue();
+				// TipoTramo = DBFReadIntegerAttribute(hDBF, i, indiceCampo1);
+				
+				if (distFieldIndex != -1)
+					valAux = (NumericValue) sds.getFieldValue(i, distFieldIndex);
+				else
+					valAux = ValueFactory.createValue(jtsGeom.getLength());
+				distance = valAux.floatValue();
+				// Distancia = (float) DBFReadDoubleAttribute(hDBF, i,
+				// indiceCampo2);
+				if (costFieldIndex != -1)
+				{
+					valAux = (NumericValue) sds.getFieldValue(i, costFieldIndex);
+					cost = valAux.doubleValue();
+				}
+				else
+					cost = distance;
+				
+				
+
+				direction = -1;
+
+				if (senseFieldIndex == -1)
+					direction = 3; // 3-> Doble sentido, 1-> seg�n viene, 2 ->
+				// al rev�s, cualquier otro valor-> No hay
+				// arco
+				else {
+					valAux = (NumericValue) sds.getFieldValue(i,
+							senseFieldIndex);
+					direction = valAux.shortValue();
+				}
+
+				if (direction == 3) {
+					sentidoDigit = 1; // En esa direcci�n
+					writeEdge(output, i, sentidoDigit, idNodo1, idNodo2, arcType,
+							distance, cost);
+					edgeCount++;
+
+					sentidoDigit = 0;
+					writeEdge(output, i, sentidoDigit, idNodo2, idNodo1, arcType,
+							distance, cost);
+					edgeCount++;
+
+				}
+				if (direction == 1) {
+					sentidoDigit = 1; // En esa direcci�n
+					writeEdge(output, i, sentidoDigit, idNodo1, idNodo2, arcType,
+							distance, cost);
+					edgeCount++;
+				}
+				if (direction == 2) {
+					sentidoDigit = 0;
+					writeEdge(output, i, sentidoDigit, idNodo2, idNodo1, arcType,
+							distance, cost);
+					edgeCount++;
+
+				}
+				
+				if(cancel != null){
+					cancel.reportStep();
+					
+				}
+			}//for
+
+
+			for (int j=0; j < nodes.size(); j++) {
+				NodeGv node = (NodeGv) nodes.get(j);
+				output.writeInt(node.getId().intValue());
+				output.writeDouble(node.getCoordinate().x);
+				output.writeDouble(node.getCoordinate().y);
+			}
+
+			output.seek(0);
+			// buf.position(0);
+			output.writeInt(numTramos);
+			output.writeInt(edgeCount);
+			output.writeInt(nodes.size());
+
+			// buf.force();
+			output.close();
+			file.close();
+			
+			adapter.stop();
+			
+			cancel.setCurrentStep(cancel.getFinalStep());
+
+			return ;
+		} catch (DriverIOException e) {
+			e.printStackTrace();
+		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
+			e.printStackTrace();
+			throw new EditionException(e);
+		} catch (FileNotFoundException e) {
+			e.printStackTrace();
+			throw new EditionException(e);
+		} catch (IOException e) {
+			e.printStackTrace();
+			throw new EditionException(e);
+		} catch (DriverException e) {		
+			e.printStackTrace();
+			throw new EditionException(e);
+		}
+	}
+
+
+	public void setCancellableMonitorable(CancellableMonitorable cancel) {
+		this.cancel = cancel;
+		
+	}
+
+	public void setRedFile(File redFile) {
+		this.redFile = redFile;
+		
+	}
+
+	private void writeEdge(FileImageOutputStream output, int id, short sense,
+			int idNodeOrig, int idNodeEnd, short tipoTramo, double dist, double cost)
+			throws IOException {
+		output.writeInt(id);
+		output.writeInt(sense);
+
+		output.writeInt(idNodeOrig);
+		output.writeInt(idNodeEnd);
+		output.writeInt(tipoTramo);
+		output.writeDouble(dist);
+		output.writeDouble(cost);
+
+	}
+
+	public void setSnapTolerance(double snapTolerance) {
+		this.snapTolerance = snapTolerance;
+	}
+
+}
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/writers/NetworkFileRedWriter.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/EdgePair.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/EdgePair.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/EdgePair.java	(revision 12191)
@@ -0,0 +1,66 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.core;
+
+public class EdgePair {
+	int idEdge = -1;
+	int idInverseEdge = -1;
+//	int idArc;
+//	
+//	public EdgePair(int idArc) {
+//		this.idArc = idArc;
+//	}
+	public int getIdEdge() {
+		return idEdge;
+	}
+	public void setIdEdge(int idEdge) {
+		this.idEdge = idEdge;
+	}
+	public int getIdInverseEdge() {
+		return idInverseEdge;
+	}
+	public void setIdInverseEdge(int idInverseEdge) {
+		this.idInverseEdge = idInverseEdge;
+	}
+	
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/core/EdgePair.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/TopologyExtension.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/TopologyExtension.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/TopologyExtension.java	(revision 12191)
@@ -0,0 +1,384 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph;
+
+import java.awt.Color;
+import java.awt.geom.Rectangle2D;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.Set;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.messages.NotificationManager;
+import com.iver.andami.plugins.Extension;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.core.FPoint2D;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.GeneralPathX;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.ShapeFactory;
+import com.iver.cit.gvsig.fmap.core.v02.FConstant;
+import com.iver.cit.gvsig.fmap.core.v02.FConverter;
+import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.layers.FBitSet;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
+import com.iver.cit.gvsig.fmap.rendering.FGraphic;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+import com.iver.cit.gvsig.project.documents.view.toc.FLyrVectEditPropertiesTocMenuEntry2;
+import com.iver.cit.gvsig.topology.TopologyBuilder;
+import com.iver.cit.gvsig.topology.triangulation.DelaunayTriangulation;
+import com.iver.cit.gvsig.topology.triangulation.Pnt;
+import com.iver.cit.gvsig.topology.triangulation.Simplex;
+import com.iver.utiles.extensionPoints.ExtensionPoint;
+import com.iver.utiles.extensionPoints.ExtensionPoints;
+import com.iver.utiles.extensionPoints.ExtensionPointsSingleton;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.CoordinateArrays;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.Polygon;
+import com.vividsolutions.jts.planargraph.Node;
+import com.vividsolutions.jts.planargraph.NodeMap;
+
+/**
+ * @author fjp Primera prueba acerca de la creaci�n de pol�gonos a partir de una
+ *         capa de l�neas
+ *
+ */
+public class TopologyExtension extends Extension {
+
+	private class MyNode extends Node {
+		public MyNode(Coordinate pt) {
+			super(pt);
+			occurrences = 1;
+		}
+
+		int occurrences;
+
+		public int getOccurrences() {
+			return occurrences;
+		}
+
+		public void setOccurrences(int occurrences) {
+			this.occurrences = occurrences;
+		}
+
+	}
+
+	/**
+	 * @see com.iver.andami.plugins.IExtension#initialize()
+	 */
+	public void initialize() {
+
+	}
+
+	/**
+	 * @see com.iver.andami.plugins.IExtension#execute(java.lang.String)
+	 */
+	public void execute(String s) {
+		View v = (View) PluginServices.getMDIManager().getActiveWindow();
+		MapControl mc = v.getMapControl();
+		FLayer[] actives = mc.getMapContext().getLayers().getActives();
+		try {
+			for (int i = 0; i < actives.length; i++) {
+				if (actives[i] instanceof FLyrVect) {
+					FLyrVect lv = (FLyrVect) actives[i];
+					if (s.compareTo("CLEAN") == 0)
+						doClean(lv);
+					if (s.compareTo("TRIANGULATION") == 0)
+						doTriangulation(lv);
+					if (s.compareTo("SHOW_ERRORS") == 0)
+						doShowNodeErrors(lv);
+
+				}
+			}
+		} catch (DriverException e) {
+			e.printStackTrace();
+			NotificationManager.addError(e);
+		} catch (DriverIOException e) {
+			e.printStackTrace();
+			NotificationManager.addError(e);
+		}
+
+	}
+
+	private void doTriangulation(FLyrVect lv) throws DriverException,
+			DriverIOException {
+		View v = (View) PluginServices.getMDIManager().getActiveWindow();
+		MapControl mc = v.getMapControl();
+
+		FBitSet bitSet = lv.getRecordset().getSelection();
+		Rectangle2D fullExtent = lv.getFullExtent();
+	    Simplex initialTriangle = new Simplex(new Pnt[] {
+	            new Pnt(fullExtent.getX(), fullExtent.getY()),
+	            new Pnt(fullExtent.getMaxX(), fullExtent.getY()),
+	            new Pnt(fullExtent.getCenterX(),  fullExtent.getMaxY())});
+
+		DelaunayTriangulation triangulator = new DelaunayTriangulation(initialTriangle);
+
+		for (int i = bitSet.nextSetBit(0); i >= 0; i = bitSet.nextSetBit(i + 1)) {
+			IGeometry g = lv.getSource().getShape(i);
+			Geometry jtsG = g.toJTSGeometry();
+			Coordinate[] coords = jtsG.getCoordinates();
+			if (jtsG.isEmpty())
+				continue;
+			Coordinate[] linePts = CoordinateArrays
+					.removeRepeatedPoints(coords);
+			Coordinate startPt = linePts[0];
+			Coordinate endPt = linePts[linePts.length - 1];
+			triangulator.delaunayPlace(startPt);
+			triangulator.delaunayPlace(endPt);
+
+		}
+
+		// Ahora recorremos todos los nodos y los que solo hayan sido
+		// a�adidos una vez, son dangle o fuzzy.
+		// TODO: Poner una tolerancia para que las coordinate cercanas
+		// formen un solo nodo.
+		GraphicLayer graphicLayer = mc.getMapContext().getGraphicsLayer();
+		FSymbol simNodeError = new FSymbol(FShape.POINT, Color.RED);
+		simNodeError.setSize(10);
+		simNodeError.setStyle(FConstant.SYMBOL_STYLE_MARKER_SQUARE);
+		simNodeError.setFill(null);
+		simNodeError.setOutlined(true);
+		simNodeError.setOutlineColor(Color.RED);
+
+		int idSymbolPoint = graphicLayer.addSymbol(simNodeError);
+
+		Iterator it = triangulator.iterator();
+
+		while (it.hasNext()) {
+			Simplex triangle = (Simplex) it.next();
+			for (Iterator otherIt = triangle.facets().iterator(); otherIt
+					.hasNext();) {
+				Set facet = (Set) otherIt.next();
+				Pnt[] endpoint = (Pnt[]) facet.toArray(new Pnt[2]);
+				GeneralPathX gp = new GeneralPathX();
+				System.err.println(endpoint[0].toString());
+				gp.moveTo(endpoint[0].coord(0), endpoint[0].coord(1));
+				gp.lineTo(endpoint[1].coord(0), endpoint[1].coord(1));
+				IGeometry gAux = ShapeFactory.createPolyline2D(gp);
+				FGraphic graphic = new FGraphic(gAux, idSymbolPoint);
+				graphicLayer.addGraphic(graphic);
+			}
+		}
+		mc.drawGraphics();
+
+	}
+
+	/**
+	 * @param lv
+	 *            FLayerVect de l�neas para convertir a pol�gonos.
+	 */
+	private void doClean(FLyrVect lv) {
+		TopologyBuilder topologyBuilder = new TopologyBuilder(0, 0);
+		topologyBuilder.setInputLayer(lv);
+
+		View v = (View) PluginServices.getMDIManager().getActiveWindow();
+		MapControl mc = v.getMapControl();
+
+		try {
+			FBitSet bitSet = lv.getRecordset().getSelection();
+
+			// // First, we need to do "noding"
+			// // TODO: This step must be optional
+			// ArrayList lineStrings = new ArrayList();
+			// for(int i=bitSet.nextSetBit(0); i>=0; i=bitSet.nextSetBit(i+1)) {
+			// IGeometry g = lv.getSource().getShape(i);
+			// lineStrings.add(g.toJTSGeometry());
+			// }
+			//
+			// Geometry nodedLineStrings = (Geometry) lineStrings.get(0);
+			// for (int i = 1; i < lineStrings.size(); i++) {
+			// nodedLineStrings =
+			// nodedLineStrings.union((Geometry)lineStrings.get(i));
+			// }
+			//
+			// // FIN noding
+			//
+			//
+			// polygonizer.add(nodedLineStrings);
+
+			Collection polygons = topologyBuilder.buildPolygons();
+			Iterator it = polygons.iterator();
+			GraphicLayer graphicLayer = mc.getMapContext().getGraphicsLayer();
+			int idSymbolPol = graphicLayer
+					.addSymbol(new FSymbol(FShape.POLYGON));
+			int idSymbolCutEdge = graphicLayer.addSymbol(new FSymbol(
+					FShape.LINE, Color.BLUE));
+			int idSymbolDangle = graphicLayer.addSymbol(new FSymbol(
+					FShape.LINE, Color.RED));
+			while (it.hasNext()) {
+				Polygon pol = (Polygon) it.next();
+				IGeometry gAux = FConverter.jts_to_igeometry(pol);
+				FGraphic graphic = new FGraphic(gAux, idSymbolPol);
+				graphicLayer.addGraphic(graphic);
+			}
+
+			// LINEAS QUE PARTEN POLIGONOS
+			Collection cutEdges = topologyBuilder.getCutEdges();
+			it = cutEdges.iterator();
+			while (it.hasNext()) {
+				LineString lin = (LineString) it.next();
+				IGeometry gAux = FConverter.jts_to_igeometry(lin);
+				FGraphic graphic = new FGraphic(gAux, idSymbolCutEdge);
+				graphicLayer.addGraphic(graphic);
+			}
+
+			// LINEAS COLGANTES, QUE NO FORMAN POLIGONO
+			Collection dangles = topologyBuilder.getDangles();
+			it = dangles.iterator();
+			while (it.hasNext()) {
+				LineString lin = (LineString) it.next();
+				IGeometry gAux = FConverter.jts_to_igeometry(lin);
+				FGraphic graphic = new FGraphic(gAux, idSymbolDangle);
+				graphicLayer.addGraphic(graphic);
+			}
+
+			mc.drawGraphics();
+		} catch (DriverException e) {
+			e.printStackTrace();
+			NotificationManager.addError(e);
+		}
+
+	}
+
+	/**
+	 * We search for origin-endpoints in LineString. Each one will generate a
+	 * Node. We also fill a map Node-numOccurrences. Dangle and Fuzzy nodes will
+	 * be those that have an occurrence count = 1. (Node with degree cero in
+	 * graph's language)
+	 *
+	 * @param lyr
+	 * @throws DriverException
+	 * @throws DriverIOException
+	 */
+	private void doShowNodeErrors(FLyrVect lv) throws DriverException,
+			DriverIOException {
+		View v = (View) PluginServices.getMDIManager().getActiveWindow();
+		MapControl mc = v.getMapControl();
+
+		// ArrayList nodeErrors = new ArrayList();
+		NodeMap nodeMap = new NodeMap();
+		FBitSet bitSet = lv.getRecordset().getSelection();
+
+		for (int i = bitSet.nextSetBit(0); i >= 0; i = bitSet.nextSetBit(i + 1)) {
+			IGeometry g = lv.getSource().getShape(i);
+			Geometry jtsG = g.toJTSGeometry();
+			Coordinate[] coords = jtsG.getCoordinates();
+			if (jtsG.isEmpty())
+				continue;
+			Coordinate[] linePts = CoordinateArrays
+					.removeRepeatedPoints(coords);
+			Coordinate startPt = linePts[0];
+			Coordinate endPt = linePts[linePts.length - 1];
+
+			MyNode nStart = (MyNode) nodeMap.find(startPt);
+			MyNode nEnd = (MyNode) nodeMap.find(endPt);
+			if (nStart == null) {
+				nStart = new MyNode(startPt);
+				nodeMap.add(nStart);
+			} else
+				nStart.setOccurrences(nStart.getOccurrences() + 1);
+			if (nEnd == null) {
+				nEnd = new MyNode(endPt);
+				nodeMap.add(nEnd);
+			} else
+				nEnd.setOccurrences(nEnd.getOccurrences() + 1);
+
+		}
+
+		// Ahora recorremos todos los nodos y los que solo hayan sido
+		// a�adidos una vez, son dangle o fuzzy.
+		// TODO: Poner una tolerancia para que las coordinate cercanas
+		// formen un solo nodo.
+		GraphicLayer graphicLayer = mc.getMapContext().getGraphicsLayer();
+		FSymbol simNodeError = new FSymbol(FShape.POINT, Color.RED);
+		simNodeError.setSize(10);
+		simNodeError.setStyle(FConstant.SYMBOL_STYLE_MARKER_SQUARE);
+		simNodeError.setFill(null);
+		simNodeError.setOutlined(true);
+		simNodeError.setOutlineColor(Color.RED);
+
+		int idSymbolPoint = graphicLayer.addSymbol(simNodeError);
+
+		Iterator it = nodeMap.iterator();
+		while (it.hasNext()) {
+			MyNode node = (MyNode) it.next();
+			if (node.getOccurrences() == 1) {
+				FPoint2D p = FConverter.coordinate2FPoint2D(node
+						.getCoordinate());
+				IGeometry gAux = ShapeFactory.createPoint2D(p);
+				FGraphic graphic = new FGraphic(gAux, idSymbolPoint);
+				graphicLayer.addGraphic(graphic);
+
+			}
+		}
+		mc.drawGraphics();
+	}
+
+	/**
+	 * @see com.iver.andami.plugins.IExtension#isEnabled()
+	 */
+	public boolean isEnabled() {
+		View v = (View) PluginServices.getMDIManager().getActiveWindow();
+		MapControl mc = v.getMapControl();
+		if (mc.getMapContext().getLayers().getActives().length > 0)
+			return true;
+		return false;
+	}
+
+	/**
+	 * @see com.iver.andami.plugins.IExtension#isVisible()
+	 */
+	public boolean isVisible() {
+//		IWindow v = PluginServices.getMDIManager().getActiveWindow();
+//		if (v instanceof View)
+//			return true;
+		return false;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/TopologyExtension.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/NetworkUtils.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/NetworkUtils.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/NetworkUtils.java	(revision 12191)
@@ -0,0 +1,128 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph;
+
+import java.awt.Color;
+import java.io.File;
+
+import javax.swing.ImageIcon;
+
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.ShapeFactory;
+import com.iver.cit.gvsig.fmap.core.v02.FConstant;
+import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
+import com.iver.cit.gvsig.fmap.rendering.FGraphic;
+import com.iver.cit.gvsig.graph.core.GvFlag;
+import com.iver.cit.gvsig.util.GvSession;
+
+public class NetworkUtils {
+	static int idSymbolFlag = -1;
+	public static void clearBarriersFromGraphics(MapControl mc) {
+		GraphicLayer graphics = mc.getMapContext().getGraphicsLayer();
+		for (int i = graphics.getNumGraphics() - 1; i >= 0; i--) {
+			FGraphic aux = graphics.getGraphic(i);
+			if (aux.getTag() != null)
+				if (aux.getTag().equalsIgnoreCase("BARRIER"))
+					graphics.removeGraphic(aux);
+		}
+	}
+
+	public static void clearFlagsFromGraphics(MapControl mc) {
+		GraphicLayer graphics = mc.getMapContext().getGraphicsLayer();
+		for (int i = graphics.getNumGraphics() - 1; i >= 0; i--) {
+			FGraphic aux = graphics.getGraphic(i);
+			if (aux.getTag() != null)
+				if (aux.getTag().equalsIgnoreCase("FLAG"))
+					graphics.removeGraphic(aux);
+		}
+	}
+
+	public static void clearFlagFromGraphics(MapControl mc, GvFlag flag) {
+		GraphicLayer graphics = mc.getMapContext().getGraphicsLayer();
+		FGraphic graphic = graphics.getGraphicByObjectTag(flag);
+		graphics.removeGraphic(graphic);
+	}
+
+	public static void clearRouteFromGraphics(MapControl mc) {
+		GraphicLayer graphics = mc.getMapContext().getGraphicsLayer();
+		for (int i = graphics.getNumGraphics() - 1; i >= 0; i--) {
+			FGraphic aux = graphics.getGraphic(i);
+			if (aux.getTag() != null)
+				if (aux.getTag().equalsIgnoreCase("ROUTE"))
+					graphics.removeGraphic(aux);
+		}
+	}
+	
+	public static File getNetworkFile(FLayer lyr) {
+			String directoryName = System.getProperty("java.io.tmpdir");
+			String aux = lyr.getName().replaceAll("\\Q.shp\\E", ".net");
+			File newFile = new File(directoryName +
+					File.separator +
+					aux);
+			return newFile;
+
+	}
+
+	public static void addGraphicFlag(MapControl mapControl, GvFlag flag) {
+		GraphicLayer graphicLayer = mapControl.getMapContext().getGraphicsLayer();
+		if (idSymbolFlag == -1)
+		{
+			FSymbol simFlag = new FSymbol(FShape.POINT, Color.BLUE);
+			simFlag.setSize(24);
+			simFlag.setStyle(FConstant.SYMBOL_STYLE_MARKER_IMAGEN);
+			ImageIcon icon = new ImageIcon(NetworkUtils.class.getClassLoader()
+					.getResource("images/pushpin.png"));
+			simFlag.setIcon(icon.getImage());
+			idSymbolFlag = graphicLayer.addSymbol(simFlag);
+		}
+		IGeometry gAux = ShapeFactory.createPoint2D(
+				flag.getOriginalPoint().getX(), flag.getOriginalPoint().getY());
+		FGraphic graphic = new FGraphic(gAux, idSymbolFlag);
+		graphic.setTag("FLAG");
+		graphic.setObjectTag(flag);
+		graphicLayer.addGraphic(graphic);
+
+	}
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/NetworkUtils.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/TestExtension.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/TestExtension.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/TestExtension.java	(revision 12191)
@@ -0,0 +1,247 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Component;
+import java.io.BufferedWriter;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.ListIterator;
+
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.plugins.Extension;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.IFeature;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
+import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
+import com.iver.cit.gvsig.fmap.layers.VectorialAdapter;
+import com.iver.cit.gvsig.fmap.rendering.FGraphic;
+import com.iver.cit.gvsig.graph.core.FEdge;
+import com.iver.cit.gvsig.graph.core.GvEdge;
+import com.iver.cit.gvsig.graph.core.GvFlag;
+import com.iver.cit.gvsig.graph.core.Network;
+import com.iver.cit.gvsig.graph.solvers.OneToManySolver;
+import com.iver.cit.gvsig.graph.solvers.ShortestPathSolverDijkstra;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+
+public class TestExtension extends Extension {
+
+	public static ShortestPathSolverDijkstra solver = new ShortestPathSolverDijkstra();
+	private int idSymbolLine = -1;
+
+	public void initialize() {
+	}
+
+	public void execute(String actionCommand) {
+		
+		View v = (View) PluginServices.getMDIManager().getActiveWindow();
+		MapContext map = v.getMapControl().getMapContext();
+		SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+		
+		if (actionCommand.equals("ODMATRIX")) {
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+
+				if ( net != null)
+				{
+					GvFlag[] flags = net.getFlags();
+					if(flags.length == 0)
+					{
+						JOptionPane.showMessageDialog(null, "Primero carga las paradas.");
+						return;
+					}
+					setVelocities(net);
+//					PluginServices.getMDIManager().addWindow(new RouteControlPanel(net));
+					JFileChooser dlg = new JFileChooser();
+					if (dlg.showSaveDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION)
+					{
+//						RandomAccessFile file = null;
+//						try {
+//							file = new RandomAccessFile(dlg.getSelectedFile(), "rw");
+//						} catch (FileNotFoundException e1) {
+//							// TODO Auto-generated catch block
+//							e1.printStackTrace();
+//						}
+						BufferedWriter output;
+						try {
+							output = new BufferedWriter(new FileWriter(dlg.getSelectedFile()));
+	//						output.setByteOrder(ByteOrder.LITTLE_ENDIAN);
+	
+							OneToManySolver solver = new OneToManySolver();
+							solver.setNetwork(net);
+							solver.putDestinationsOnNetwork();
+							for (int i=0; i < flags.length; i++)
+							{
+								
+								solver.setSourceFlag(flags[i]);
+								long t1 = System.currentTimeMillis();
+								
+								solver.calculate();
+								long t2 = System.currentTimeMillis();
+								System.out.println("Punto " + i + " de " + flags.length + ". " + (t2-t1) + " msecs.");
+								// Escribe el resultado
+								// idNodo1 idNodo2 tiempo distancia
+								
+								for (int j=0; j < flags.length; j++)
+								{
+									// String aux2 = NumberFormat.getInstance().format(flags[j].getCost());
+//									long secs = Math.round(flags[j].getCost());
+									long meters = Math.round(flags[j].getAccumulatedLength());
+									String strAux = i + "\t" + j + "\t" + meters;
+									output.write(strAux);
+									output.newLine();
+									
+								}
+								long t3 = System.currentTimeMillis();
+								System.out.println("T. de escritura: " + (t3-t2) + " msecs.");
+								
+							}
+							solver.removeDestinationsFromNetwork();
+							output.flush();
+							output.close();
+						} catch (IOException e) {
+							// TODO Auto-generated catch block
+							e.printStackTrace();
+						} catch (GraphException e) {
+							// TODO Auto-generated catch block
+							e.printStackTrace();
+						}
+					} // if
+					
+					return;
+				}
+			}
+		}
+		
+
+	}
+
+	/**
+	 * Asignamos el coste en funci�n de un array de velocidades y el tipo de via. Las velocidades, en metros/seg
+	 * @param net
+	 */
+	private void setVelocities(Network net) {
+		double[] veloKm = {120, 110, 90, 80, 70, 60, 50, 40};
+		ArrayList veloMeters = new ArrayList();
+		for (int i=0; i<veloKm.length; i++)
+		{
+			veloMeters.add(new Double(veloKm[i] / 3.6));
+		}
+		
+		for (int i=0; i < net.getGraph().numEdges(); i++)
+		{
+			GvEdge edge = net.getGraph().getEdgeByID(i);
+			Double vel = (Double) veloMeters.get(edge.getType());
+			edge.setWeight(edge.getDistance() / vel.doubleValue()); // segundos
+		}
+		
+	}
+
+	private void createGraphicsFrom(Collection featureList, MapControl mapControl) {
+		Iterator it = featureList.iterator();
+		GraphicLayer graphicLayer = mapControl.getMapContext().getGraphicsLayer();
+		if (idSymbolLine == -1)
+		{
+			Color color = new Color(0.9f, 0.0f, 0.0f, 0.3f);
+			FSymbol lineSymbol = new FSymbol(FShape.LINE, color);
+			lineSymbol.setStroke(new BasicStroke(3.0f));
+			idSymbolLine = graphicLayer.addSymbol(lineSymbol);
+		}
+		while (it.hasNext()) {
+			IFeature feat = (IFeature) it.next();
+			IGeometry gAux = feat.getGeometry();
+			FGraphic graphic = new FGraphic(gAux, idSymbolLine);
+			graphicLayer.insertGraphic(0, graphic);
+		}
+		mapControl.drawGraphics();
+
+	}
+
+	private void createGraphicsFrom(ListIterator it, MapControl mapControl) throws DriverException {
+		GraphicLayer graphicLayer = mapControl.getMapContext().getGraphicsLayer();
+		Color color = new Color(0.5f, 0.8f, 0.0f, 0.5f);
+		FSymbol lineSymbol = new FSymbol(FShape.LINE, color);
+		lineSymbol.setStroke(new BasicStroke(7.0f));
+		int idSymbol = graphicLayer.addSymbol(lineSymbol);
+		VectorialAdapter va = (VectorialAdapter) solver.getNetwork().getLayer().getSource();
+		while (it.hasNext()) {
+			FEdge edge = (FEdge) it.next();
+			IFeature feat = va.getFeature(edge.getArcID());
+			IGeometry gAux = feat.getGeometry();
+			FGraphic graphic = new FGraphic(gAux, idSymbol);
+			graphicLayer.insertGraphic(0, graphic);
+		}
+		mapControl.drawGraphics();
+
+	}
+
+
+	public boolean isEnabled() {
+		// TODO Auto-generated method stub
+		return true;
+	}
+
+	public boolean isVisible() {
+		// TODO Auto-generated method stub
+		return true;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/TestExtension.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/SingletonRegisteredNetworks.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/SingletonRegisteredNetworks.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/SingletonRegisteredNetworks.java	(revision 12191)
@@ -0,0 +1,74 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph;
+
+import java.util.Hashtable;
+
+/**
+ * @author fjp
+ * TODO: Esto ser� necesario si creamos un objeto que 
+ * contenga la capa, el grafo y los flags sobre ese grafo.
+ * Cada solver, pedir� los flags a este objeto (o crear� los
+ * suyos propios) y luego resolver� el problema.
+ */
+public class SingletonRegisteredNetworks {
+	private static SingletonRegisteredNetworks singleton;
+	
+	private Hashtable networks = new Hashtable();
+
+	static SingletonRegisteredNetworks getInstance() {
+		if (singleton == null)
+			singleton = new SingletonRegisteredNetworks();
+		return singleton;
+	}
+
+	
+	private SingletonRegisteredNetworks() {
+		
+	}
+	
+//	public void registerNetwork(IGraph graph, FLyrVect lyr) {
+//		
+//	}
+	
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/SingletonRegisteredNetworks.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ClearBarriersExtension.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ClearBarriersExtension.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ClearBarriersExtension.java	(revision 12191)
@@ -0,0 +1,156 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.plugins.Extension;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
+import com.iver.cit.gvsig.graph.core.GvModifiedCost;
+import com.iver.cit.gvsig.graph.core.Network;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+
+public class ClearBarriersExtension extends Extension {
+
+	public void initialize() {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public void execute(String actionCommand) {
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if (window instanceof View)
+		{
+			View v = (View) window;
+	        MapControl mapCtrl = v.getMapControl();
+			MapContext map = mapCtrl.getMapContext();
+			
+			SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+				
+				if ( net != null)
+				{
+					if (actionCommand.equalsIgnoreCase("CLEAR_BARRIERS"))
+					{
+						if (net.getModifiedCosts().size() > 0)
+						{
+							for (int i=net.getModifiedCosts().size()-1; i >=0; i--)
+							{
+								GvModifiedCost barrier = (GvModifiedCost) net.getModifiedCosts().get(i);
+								net.removeModifiedCost(barrier);
+							}
+							NetworkUtils.clearBarriersFromGraphics(mapCtrl);
+							mapCtrl.drawMap(false);
+						}
+					}
+				}
+			}
+		}
+		
+	}
+
+	public boolean isEnabled() {
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if (window instanceof View)
+		{
+			View v = (View) window;
+	        MapControl mapCtrl = v.getMapControl();
+			MapContext map = mapCtrl.getMapContext();
+			
+			SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+				
+				if ( net != null)
+				{
+					// TODO:
+					// if (net.getModifiedCosts().length > 0)
+					{
+						return true;
+					}
+				}
+			}
+		}
+		return false;
+
+	}
+
+	public boolean isVisible() {
+		IWindow window = PluginServices.getMDIManager().getActiveWindow();
+		if (window instanceof View)
+		{
+			View v = (View) window;
+	        MapControl mapCtrl = v.getMapControl();
+			MapContext map = mapCtrl.getMapContext();
+			
+			SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+				
+				if ( net != null)
+				{
+					return true;
+				}
+			}
+		}
+		return false;
+
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ClearBarriersExtension.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/ShortestPathSolverDijkstra.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/ShortestPathSolverDijkstra.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/ShortestPathSolverDijkstra.java	(revision 12191)
@@ -0,0 +1,663 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.solvers;
+
+import java.util.ArrayList;
+import java.util.Stack;
+
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.core.IFeature;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.v02.FConverter;
+import com.iver.cit.gvsig.fmap.layers.VectorialAdapter;
+import com.iver.cit.gvsig.graph.GraphException;
+import com.iver.cit.gvsig.graph.core.AbstractNetSolver;
+import com.iver.cit.gvsig.graph.core.GvEdge;
+import com.iver.cit.gvsig.graph.core.GvFlag;
+import com.iver.cit.gvsig.graph.core.GvNode;
+import com.iver.cit.gvsig.graph.core.GvTurn;
+import com.iver.cit.gvsig.graph.core.IGraph;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.MultiLineString;
+
+public class ShortestPathSolverDijkstra extends AbstractNetSolver {
+	
+	private GeometryFactory geomFactory = new GeometryFactory();
+	
+	protected Route route = new Route();
+	private int fieldIndexStreetName;
+	
+	private class InfoShp {
+		public int idArc;
+		public double pct;
+		public double cost;
+		public double distance;
+		public int direction;
+		public boolean bFlip;
+
+	}
+	
+	public void setFielStreetName(String name) {
+		try {
+			int aux = net.getLayer().getRecordset().getFieldIndexByName(name);
+			if (aux == -1)
+				throw new RuntimeException("Field " + name + " not found.");
+			fieldIndexStreetName = aux;
+		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (DriverException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+	}
+
+	/**
+	 * @return a list of features
+	 * @throws GraphException 
+	 */
+	public Route calculateRoute() throws GraphException {
+		GvFlag[] flags = net.getFlags();
+		if (flags.length == 0)
+			throw new RuntimeException("Please, add flags before");
+		int desde = 0;
+		int hasta = 1;
+		double elCoste1 = 0;
+		route = new Route();
+		for (int i = 0; i < flags.length - 1; i++) {
+			GvFlag fFrom = flags[desde];
+			GvFlag fTo = flags[hasta];
+
+			if (fFrom != fTo) {
+				int idStart = net.creaArcosVirtuales(fFrom);
+				int idStop = net.creaArcosVirtuales(fTo);
+
+				double newCost = dijkstra(idStart, idStop);
+				elCoste1 += newCost;
+
+				if (newCost != Double.MAX_VALUE)
+				{
+					try {
+						populateRoute(fFrom, fTo, idStart, idStop);
+					} catch (DriverException e) {
+						e.printStackTrace();
+						throw new GraphException(e);
+					}
+				}
+				else
+				{
+					// No way
+				}
+
+				net.reconstruyeTramo(fFrom.getIdArc());
+				net.reconstruyeTramo(fTo.getIdArc());
+				desde = hasta;
+			} // if son puntos distintos
+			hasta++;
+		}
+
+		return route;
+	}
+
+	private void populateRouteSimple(int idStart, int idEnd) throws DriverException {
+		int idEnlace;
+		GvNode node;
+		GvEdge link;
+		double costeEntrada;
+
+		// Trazar el camino desde idEnd hasta idStart hacia atr�s marcando los Enlaces
+		double Coste = 0;
+		double Coste2 = 0;
+		IGraph graph = net.getGraph();
+		node = graph.getNodeByID(idEnd);
+		int from_link = node.getFromLink();
+		VectorialAdapter va = (VectorialAdapter) net.getLayer().getSource();
+		while (node.getIdNode() != idStart)
+		{
+			if (from_link == -1)
+			{
+				throw new RuntimeException("Fallo al recorrer de manera inversa la soluci�n. Encontrado arco con -1");
+				// break; // FALLO!!
+			} 
+			link = graph.getEdgeByID(from_link);
+			IFeature feat = va.getFeature(link.getIdArc());
+			route.addRouteFeature(feat.getGeometry(), link.getIdArc(), 
+					link.getWeight(), link.getDistance(), feat.getAttribute(getFieldIndexStreetName()).toString());
+
+			node = graph.getNodeByID(link.getIdNodeOrig());
+
+			Coste = Coste + link.getWeight();
+			Coste2 = Coste2 + link.getDistance();
+
+			// TODO:
+			// from_link = node.get_from_link(idEnlace, &costeEntrada);
+			from_link = node.getFromLink();
+			
+	    }	
+		System.out.println("Salgo con node = " + node.getIdNode());
+	}
+
+	private void populateRoute(GvFlag origin, GvFlag dest, int idStart, int idEnd) throws DriverException {
+		int idEnlace;
+		GvNode node;
+		GvEdge link;
+		double costeEntrada;
+
+		// Trazar el camino desde idEnd hasta idStart hacia atr�s marcando los Enlaces
+		IGraph graph = net.getGraph();
+		node = graph.getNodeByID(idEnd);
+		int from_link = node.getFromLink();
+		VectorialAdapter va = (VectorialAdapter) net.getLayer().getSource();
+		
+		/*	Miramos los nodos de los tramos inicio y final, y cogemos el nodo que tenga el from_link rellenado. E IGUAL A NUMSOLUCGLOBAL!!!!
+			A partir de ah�, recorremos hacia atr�s y tenemos el cuerpo principal del shape. Luego, para
+			las puntas hay que tener en cuenta los porcentajes, viendo el trozo que est� pegando a los nodos
+			que sabemos que est�n en el path
+		*/
+
+		/* 22/9/2003 Corregimos el fallo que hab�a de escribir el shape de atr�s adelante.
+		*  Guardamos lo que necesitamos en listaShapes y recorremos esa lista guardando los tramos
+		*	con el sentido adecuado.
+		*/
+
+		/* 3/Febrero/2005 Limpieza de c�digo superfluo y correci�n de un fallo raro. Ahora es m�s simple y parece
+		* que no falla. A ver si dura. IDEA: quiz�s se necesite meter el porcentaje en los arcos partidos.
+		*/	
+
+		// Define a template class for a vector of IDs.
+		InfoShp infoShp;
+		Stack pilaShapes = new Stack();
+//		typedef stack<CInfoShp> PILAINFO;
+//		PILAINFO pilaShapes;
+
+		double costeTramoFinal=-1;
+		GvNode nodeEnd = graph.getNodeByID(idEnd);
+		GvEdge finalEdge = graph.getEdgeByID(nodeEnd.getFromLink());
+		costeTramoFinal = finalEdge.getWeight();
+
+		GvNode pNodo;
+		GvEdge pEnlace;
+		
+		boolean bFlipearShape = false;
+
+		double pctMax, pctMin;
+
+
+
+		//////////////////////////////////////////////////////////////////////////////////////
+		// Trozo del final
+		// El shape va de idStop1 a idStop2, y el porcentaje viene en ese sentido.
+		// Si el idEnd es idStop1, quiere decir que el tramo que falta va en ese sentido tambi�n,
+		// as� que recorremos ese shape desde idStop1 hasta que rebasemos o igualemos ese porcentaje.
+		// Si no, hemos pasado por idStop2 y la parte que hay que meter es desde el pto interior a idStop2
+		///////////////////////////////////////////////////////////////////////////////////////
+		IFeature feat = va.getFeature(finalEdge.getIdArc());
+		MultiLineString jtsGeom = (MultiLineString) feat.getGeometry().toJTSGeometry();
+//		CoordinateFilter removeDuplicates = new UniqueCoordinateArrayFilter(); 
+//		jtsGeom.apply(removeDuplicates);
+//		jtsGeom.geometryChanged();
+		
+		
+		
+		// SI ESTAMOS SOBRE EL MISMO TRAMO, CASO PARTICULAR
+		// y el sentido de circulaci�n es correcto
+		if ((origin.getIdArc() == dest.getIdArc()) && (nodeEnd.getBestCost() <= costeTramoFinal))
+		{
+			if (dest.getPct() > origin.getPct())
+			{
+				pctMax = dest.getPct();
+				pctMin = origin.getPct(); 
+			}
+			else
+			{
+				pctMax = origin.getPct();
+				pctMin = dest.getPct();
+				bFlipearShape = true;
+			}
+
+			LineString line = SituaSobreTramo(jtsGeom,dest.getIdArc(), dest.getPct(),1);
+			
+			pctMin = pctMin / pctMax; // Porque ha cambiado la longitud del shape
+
+			line = SituaSobreTramo(line,dest.getIdArc(), pctMin,0);
+
+			if (bFlipearShape)
+				line = line.reverse();
+			
+			IGeometry geom = FConverter.jts_to_igeometry(line);
+			// TODO: Calcular bien el length de este arco, 
+			// basandonos en el porcentaje costeTramoFinal / costeOriginal
+			route.addRouteFeature(geom, origin.getIdArc(), 
+					costeTramoFinal, line.getLength(), feat.getAttribute(getFieldIndexStreetName()).toString());
+
+
+			return ; // Deber�a sacar el coste
+		}
+
+		
+
+		// Trazar el camino desde idEnd hasta idStart hacia atr�s marcando los Enlaces
+		pNodo = graph.getNodeByID(idEnd);
+
+		while ((pNodo.getIdNode() != idStart)) 
+		{
+			idEnlace = pNodo.getFromLink();
+			pEnlace = graph.getEdgeByID(idEnlace);
+
+			pNodo = graph.getNodeByID(pEnlace.getIdNodeOrig());
+			
+			infoShp = new InfoShp();
+			infoShp.distance = pEnlace.getDistance();
+			infoShp.cost = pEnlace.getWeight();
+
+			if ((pEnlace.getIdArc() == origin.getIdArc()) || (pEnlace.getIdArc() == dest.getIdArc()))
+			{
+				if (pEnlace.getIdArc() == origin.getIdArc())
+				{
+					infoShp.pct = origin.getPct();
+					infoShp.idArc = origin.getIdArc();
+					if (pEnlace.getDirec() == 0) 
+					{
+						infoShp.direction = 1;
+						infoShp.bFlip = true;
+					}
+					else // Hemos pasado por el 2
+					{
+						infoShp.direction = 0;
+						infoShp.bFlip = false;
+					} // if else */
+				}
+				else
+				{
+					infoShp.pct = dest.getPct();
+					infoShp.idArc = dest.getIdArc();
+					if (pEnlace.getDirec() == 0)
+					{
+						infoShp.direction = 0;
+						infoShp.bFlip = true;
+					}
+					else
+					{
+						infoShp.direction = 1;
+						infoShp.bFlip = false;
+					} // if else */
+				}
+			}
+			else
+			{
+				infoShp.pct = 1.0;
+				infoShp.idArc = pEnlace.getIdArc();
+				
+				infoShp.direction =1;
+				if (pEnlace.getDirec() == 1)
+					infoShp.bFlip = false;
+				else
+					infoShp.bFlip = true;
+			}
+
+			pilaShapes.push(infoShp);
+		}
+
+		// Y ahora recorremos hacia atr�s el vector y escribimos los shapes.
+		// VECTORINFO::iterator theIterator;
+		int auxC = 0;
+		
+		while (!pilaShapes.empty())  
+		{
+			infoShp = (InfoShp) pilaShapes.peek();
+			feat = va.getFeature(infoShp.idArc);
+			MultiLineString line = (MultiLineString) feat.getGeometry().toJTSGeometry();
+//			line.apply(removeDuplicates);
+//			line.geometryChanged();
+			
+			LineString aux = null;
+			if (infoShp.pct < 1.0)
+				aux = SituaSobreTramo(line,infoShp.idArc, infoShp.pct, infoShp.direction);
+
+			IGeometry geom = null;
+			if (aux == null)
+			{
+				if (infoShp.bFlip)
+					line = line.reverse();
+				geom = FConverter.jts_to_igeometry(line);
+			}	
+			else
+			{
+				if (infoShp.bFlip)
+					aux = aux.reverse();
+				geom = FConverter.jts_to_igeometry(aux);
+			}	
+
+
+			route.addRouteFeature(geom, infoShp.idArc, 
+					infoShp.cost, infoShp.distance, feat.getAttribute(getFieldIndexStreetName()).toString());
+
+
+			pilaShapes.pop();
+			auxC++;
+			
+		}
+
+		return;
+
+		
+	}
+
+	LineString SituaSobreTramo(Geometry geom, int idArc, double pct, int parte)
+//	 Si parte vale cero, los v�lidos son los primeros. Si no, los segundos.
+	{
+		int j, numVertices;
+		double longAcum, longReal, longBuscada, distSobre, miniPorcentaje;
+		double nuevaX, nuevaY; // Por cuestiones de claridad al programar
+		double dist=0;
+
+		longAcum = 0;
+		longReal = geom.getLength();
+		longBuscada = longReal * pct;
+		Coordinate[] coords = geom.getCoordinates();
+		Coordinate c1 = null, c2 = null;
+		ArrayList savedCoords = new ArrayList();
+
+	 	if (parte > 0) // Hemos entrado por el 1 hacia el 2 (al 2 no llegamos)
+		{
+			for( j = 0; j < coords.length-1; j++ ) 
+			{
+				c1 = coords[j];
+				c2 = coords[j+1];
+				dist = c1.distance(c2);
+				longAcum += dist;
+				savedCoords.add(c1);
+				if (longAcum >= longBuscada)
+				{
+					// Hasta aqu�. Ahora ahi que poner el punto sobre el tramo
+					distSobre = dist - (longAcum - longBuscada);
+					miniPorcentaje = distSobre/dist;
+
+					nuevaX = c1.x + (c2.x-c1.x) * miniPorcentaje;
+					nuevaY = c1.y + (c2.y-c1.y) * miniPorcentaje;
+		
+					savedCoords.add(new Coordinate(nuevaX, nuevaY));
+					break;
+				} // if longAcum >= longBuscada
+			} // for j
+			
+		}
+		else // Hemos entrado por el 2 hacia el 1
+		{
+			numVertices = 0;
+			for( j = 0; j < coords.length; j++ ) 
+			{
+				////////////////////////////////////////////////////////////////
+				// 13_ene_2005: Si el �ltimo punto es el �ltimo punto no
+				// podemos acceder al elemento j+1 porque nos salimos del shape
+				/////////////////////////////////////////////////////////////////
+				c1 = coords[j];
+				if (j < coords.length -1)
+				{					
+					c2 = coords[j+1];
+
+					dist = c1.distance(c2);
+					longAcum += dist;
+				}
+
+				if (longAcum >= longBuscada)
+				{
+					// Hasta aqu�. Empezamos a meter puntos
+
+					if (numVertices == 0) 
+					{
+						distSobre = dist - (longAcum - longBuscada);
+						miniPorcentaje = distSobre/dist;
+						nuevaX = c1.x + (c2.x-c1.x) * miniPorcentaje;
+						nuevaY = c1.y + (c2.y-c1.y) * miniPorcentaje;
+						
+						savedCoords.add(new Coordinate(nuevaX, nuevaY));
+					}
+					else
+					{
+						savedCoords.add(c2);
+					}
+					numVertices ++;
+					// break;
+				} // if longAcum >= longBuscada
+			} // for j
+			
+			// savedCoords.add(c2);
+			
+		} // if else
+
+	 	
+	 	return geomFactory.createLineString((Coordinate[] )savedCoords.toArray(new Coordinate[0]));
+	}
+
+	private int getFieldIndexStreetName() {
+		return fieldIndexStreetName;
+	}
+
+	private double dijkstra(int idStart, int idStop) {
+		int nodeNum;
+		int linkNum;
+		double newCost;
+		int idSiguienteNodo;
+		GvNode node, toNode, finalNode, bestNode; // , *pNodoProv;
+		GvEdge link;
+		boolean bExit = false;
+		double bestCost;
+
+		boolean bGiroProhibido;
+		ArrayList candidatos = new ArrayList();
+
+		GvTurn elGiro;
+		// char Mensaje[200];
+		
+		IGraph graph = net.getGraph();
+
+		// NUEVO: 27-6-2003
+		// Cada nodo y cada arco llevan un nuemero de soluci�n. Se supone
+		// que si lo del nodo y el arco no coincide con
+		// este numero, todav�a no ha sido inicializado y hay que hacerlo.
+		// Para evitar coincidencias cuando de la vuelta el contador, cada
+		// 65000 peticiones (por ejemplo), repasamos toda
+		// la red y ponemos numSolucGlobal a -1
+		if (numSolucGlobal > 65000) {
+			numSolucGlobal = -1;
+
+			for (nodeNum = 0; nodeNum < graph.numVertices(); nodeNum++) {
+				node = graph.getNodeByID(nodeNum);
+				node.initialize();
+			} // for nodeNum */
+
+		}
+		numSolucGlobal++;
+
+		candidatos.clear();
+		// A�adimos el Start Node a la lista de candidatosSTL
+		// Nodo final
+		finalNode = graph.getNodeByID(idStop);
+		finalNode.initialize();
+
+		node = graph.getNodeByID(idStart);
+		node.initialize();
+		bestNode = node;
+
+		candidatos.add(node);
+		node.setBestCost(0);
+		node.setStatus(GvNode.statNowInList);
+		bestCost = Double.MAX_VALUE;
+
+		// Mientras que la lista de candidatosSTL no est� vac�a, procesamos
+		// Nodos
+
+		while ((!bExit) && (candidatos.size() > 0)) {
+			// Buscamos el nodo con m�nimo coste
+			node = (GvNode) candidatos.get(0);
+			bestNode = node;
+			bestCost = node.getBestCost();
+			for (nodeNum = 1; nodeNum < candidatos.size(); nodeNum++) {
+				node = (GvNode) candidatos.get(nodeNum);
+				if (node.getBestCost() < bestCost) {
+					bestCost = node.getBestCost();
+					bestNode = node;
+				}
+			} // for nodeNum candidatosSTL
+
+			node = bestNode;
+			// Borramos el mejor nodo de la lista de candidatosSTL
+			node.setStatus(GvNode.statWasInList);
+			// TODO: BORRAR POR INDEX, NO AS�. ES M�S LENTO QUE SI BORRAMOS EL i-�simo.
+			candidatos.remove(node);
+			// System.out.println("LINK " + link.getIdArc() + " from ");
+			// System.out.println("from " + idStart + " to " + finalNode.getIdNode() + ". node=" + node.getIdNode());
+			// Miramos si hemos llegado donde quer�amos
+			if (bestNode.getIdNode() == idStop) {
+				bExit = true;
+				break;
+			}
+
+			// sprintf(Mensaje,"Enlaces en el nodo %ld:
+			// %ld.",pNodo->idNodo,pNodo->Enlaces.GetSize());
+			// AfxMessageBox(Mensaje);
+
+			// A�adimos a la lista de candidatosSTL los vecinos del nodo que
+			// acabamos de borrar
+			// HAY Arcos QUE SALEN Y Arcos QUE LLEGAN. SOLO MIRAMOS LOS QUE
+			// SALEN.
+			for (linkNum = 0; linkNum < node.getEnlaces().size(); linkNum++) {
+				// Pillamos el nodo vecino
+				link = (GvEdge) node.getEnlaces().get(linkNum);
+				idSiguienteNodo = link.getIdNodeEnd();
+
+				toNode = graph.getNodeByID(idSiguienteNodo);
+
+				// 27_5_2004
+				// Si un arco tiene coste negativo, lo ignoramos
+				if (link.getWeight() < 0)
+					continue;
+
+				// Fin arco con coste negativo
+
+				// NUEVO: 26-7-2003: Comprobamos si est� inicializado
+				if (toNode.getNumSoluc() != numSolucGlobal) {
+					toNode.initialize();
+				}
+				else
+				{
+					// System.out.println("Nodo ya inicializado");
+				}
+
+				// Miramos si ese nodo ya ha estado antes en la lista de
+				// candidatos
+				if (toNode.getStatus() != GvNode.statWasInList) {
+					// Miramos a ver si podemos mejorar su best_cost
+					newCost = node.getBestCost() + link.getWeight();
+
+					// Miramos la lista de Giros de ese nodo
+					bGiroProhibido = false;
+					for (int idGiro = 0; idGiro < node.getTurns().size(); idGiro++) {
+						// Si est� prohibido, a por otro
+						elGiro = (GvTurn) node.getTurns().get(idGiro);
+						// TODO: HABILITAR ESTO
+						// if ((elGiro.idTramoOrigen ==
+						// Arcos[pNodo->from_link].idTramo) &&
+						// (elGiro.idTramoDestino == pEnlace->idTramo))
+						// {
+						// if (elGiro.cost < 0)
+						// {
+						// bGiroProhibido = true;
+						// // No podemos inicializar por completo el nodo porque
+						// entonces
+						// // perdemos el fromLink (el arco desde donde hemos
+						// llegado hasta
+						// // este nodo, que es necesario para calcular los
+						// costes y generar
+						// // el shape recorriendo hacia atr�s el camino
+						// realizado.
+						// // Si hab�a m�s de un nodo con costes prohibidos,
+						// cab�a la posibilidad
+						// // de que perdieramos este enlace.
+						//									
+						// // Para que pueda volver a entrar en c�lculos
+						// pNodo->status = statNotInList;
+						// pNodo->best_cost = INFINITO;
+						//
+						// }
+						// else
+						// newCost += elGiro.cost;
+						// break; // Salimos del for porque ya hemos encontrado
+						// el giro
+						// }
+					}
+					// Si est� prohibido, vamos a por otro enlace, PERO
+					// MARCAMOS EL NODO
+					// COMO NO VISITADO PARA QUE PUEDA VOLVER A ENTRAR EN LA
+					// LISTA DE CANDIDATOS
+					// SI VENIMOS POR OTRO LADO.
+					if (bGiroProhibido) {
+						continue;
+					}
+
+					if (newCost < toNode.getBestCost()) {
+						// Es una mejora, as� que actualizamos el vecino y
+						// lo a�adimos a los candidatosSTL
+						toNode.setBestCost(newCost);
+						 
+						toNode.setFromLink(link.getIdEdge());
+
+						if (toNode.getStatus() != GvNode.statNowInList) {
+							toNode.setStatus(GvNode.statNowInList);
+							candidatos.add(toNode);
+						}
+					} // Si hay mejora
+				} // if ese nodo no ha estado en la lista de candidatosSTL
+
+			} // for linkNum
+		} // while candidatosSTL
+
+		newCost = finalNode.getBestCost();
+
+		return newCost;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/ShortestPathSolverDijkstra.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/FlagsMemoryDriver.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/FlagsMemoryDriver.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/FlagsMemoryDriver.java	(revision 12191)
@@ -0,0 +1,303 @@
+/*
+ * Created on 07-nov-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.2  2006-11-08 19:32:36  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.1  2006/11/07 19:49:28  azabala
+ * *** empty log message ***
+ *
+ *
+ */
+package com.iver.cit.gvsig.graph.solvers;
+
+import java.awt.geom.Rectangle2D;
+import java.io.IOException;
+import java.sql.Types;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.swing.table.DefaultTableModel;
+
+import com.hardcode.gdbms.engine.data.DataSourceFactory;
+import com.hardcode.gdbms.engine.data.driver.DriverException;
+import com.hardcode.gdbms.engine.data.edition.DataWare;
+import com.hardcode.gdbms.engine.values.Value;
+import com.hardcode.gdbms.engine.values.ValueFactory;
+import com.iver.cit.gvsig.fmap.core.DefaultFeature;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.IFeature;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.ShapeFactory;
+import com.iver.cit.gvsig.fmap.drivers.DriverAttributes;
+import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
+import com.iver.cit.gvsig.fmap.drivers.MemoryDriver;
+import com.iver.cit.gvsig.fmap.drivers.VectorialDriver;
+import com.iver.cit.gvsig.fmap.operations.strategies.MemoryShapeInfo;
+
+public class FlagsMemoryDriver extends MemoryDriver implements VectorialDriver {
+
+	// TODO Internationalize field names
+	static FieldDescription[] fields = new FieldDescription[6];
+	static {
+		FieldDescription fieldDesc = new FieldDescription();
+		fieldDesc.setFieldName("IDFLAG");
+		fieldDesc.setFieldType(Types.INTEGER);
+		fieldDesc.setFieldLength(20);
+		fieldDesc.setFieldDecimalCount(0);
+		fields[0] = fieldDesc;
+
+		fieldDesc = new FieldDescription();
+		fieldDesc.setFieldName("IDARC");
+		fieldDesc.setFieldType(Types.INTEGER);
+		fieldDesc.setFieldLength(20);
+		fieldDesc.setFieldDecimalCount(0);
+		fields[1] = fieldDesc;
+
+		fieldDesc = new FieldDescription();
+		fieldDesc.setFieldName("PCT");
+		fieldDesc.setFieldType(Types.DOUBLE);
+		fieldDesc.setFieldLength(20);
+		fieldDesc.setFieldDecimalCount(5);
+		fields[2] = fieldDesc;
+
+		fieldDesc = new FieldDescription();
+		fieldDesc.setFieldName("COST");
+		fieldDesc.setFieldType(Types.DOUBLE);
+		fieldDesc.setFieldLength(20);
+		fieldDesc.setFieldDecimalCount(5);
+		fields[3] = fieldDesc;
+
+		fieldDesc = new FieldDescription();
+		fieldDesc.setFieldName("DIREC");
+		fieldDesc.setFieldType(Types.INTEGER);
+		fieldDesc.setFieldLength(20);
+		fieldDesc.setFieldDecimalCount(0);
+		fields[4] = fieldDesc;
+
+		fieldDesc = new FieldDescription();
+		fieldDesc.setFieldName("DESCRIPTION");
+		fieldDesc.setFieldType(Types.VARCHAR);
+		fieldDesc.setFieldLength(254);
+		fieldDesc.setFieldDecimalCount(0);
+		fields[5] = fieldDesc;
+	}
+
+	/*
+	 * TODO Eliminar FlagsMemoryDriver y RouteMemoryDriver y crear una clase que
+	 * sea SchemedMemoryDriver. En el constructor habr�a que pasar: a)
+	 * FieldDescription[] (esquema) b) Tipo de geometria
+	 * 
+	 * o bien un LayerDefinition....
+	 * 
+	 * 
+	 */
+
+	List features;
+
+	Rectangle2D fullExtent;
+
+	public FlagsMemoryDriver(List features) {
+		this.features = features;
+		computeFullExtent();
+	}
+
+	void computeFullExtent() {
+		if (features.size() > 0) {
+			IFeature feature = (IFeature) features.get(0);
+			fullExtent = feature.getGeometry().getBounds2D();
+			for (int i = 1; i < features.size(); i++) {
+				feature = (IFeature) features.get(i);
+				Rectangle2D rAux = feature.getGeometry().getBounds2D();
+				fullExtent.add(rAux);
+			}
+		}
+	}
+
+	public int getShapeType() {
+		return FShape.POINT;
+	}
+
+	public String getName() {
+		return "";
+	}
+
+	public DriverAttributes getDriverAttributes() {
+		return null;
+	}
+
+	public boolean isWritable() {
+		return false;
+	}
+
+	public int[] getPrimaryKeys()
+			throws com.hardcode.gdbms.engine.data.driver.DriverException {
+		return null;
+	}
+
+	public void write(DataWare dataWare)
+			throws com.hardcode.gdbms.engine.data.driver.DriverException {
+	}
+
+	/**
+	 * Returns de field type of the specified field index.
+	 * 
+	 * @return field type of i field
+	 */
+	public int getFieldType(int i) throws DriverException {
+		// azabala: we overwrite MemoryDriver because type resolution
+		// is based in first register value (it could be null)
+		if (i >= fields.length)
+			throw new DriverException("Excedido el numero de campos del dxf");
+		return fields[i].getFieldType();
+	}
+
+	public int getShapeCount() throws IOException {
+		return features.size();
+	}
+
+	public Rectangle2D getFullExtent() throws IOException {
+		return fullExtent;
+	}
+
+	public IGeometry getShape(int index) {
+		if (index < features.size())
+			return ((IFeature) features.get(index)).getGeometry();
+		else
+			return null;
+	}
+
+	public void reload() throws IOException, DriverException {
+	}
+	
+	
+	/**
+	 * Devuelve el modelo de la tabla.
+	 *
+	 * @return modelo de la tabla.
+	 */
+	public DefaultTableModel getTableModel() {
+		return null;
+	}
+
+	/**
+	 * A�ade un shape.
+	 *
+	 * @param geom shape.
+	 * @param row fila.
+	 */
+	public void addGeometry(IGeometry geom, Object[] row) {
+	}
+
+	
+	/**
+	 * M�todo de conveniencia, para poder a�adir directamente un shape
+	 * o una IGeometry. (Arriba est� el de a�adir una IGeometry.
+	 * @param shp
+	 * @param row
+	 */
+	public void addShape(FShape shp, Object[] row) {
+	}
+
+	/**
+	 * Devuelve el extent a partir de un �ndice.
+	 *
+	 * @param index �ndice.
+	 *
+	 * @return Extent.
+	 *
+	 * @throws IOException
+	 */
+	public Rectangle2D getShapeBounds(int index) throws IOException {
+		return ((IFeature)features.get(index)).getGeometry().getBounds2D();
+	}
+
+	
+	public int getShapeType(int index) {
+		return ((IFeature)features.get(index)).getGeometry().getGeometryType();
+	}
+
+
+	/* (non-Javadoc)
+	 * @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldValue(long, int)
+	 */
+	public Value getFieldValue(long rowIndex, int fieldId)
+		throws DriverException {
+		IFeature feature = (IFeature) features.get((int) rowIndex);
+		return feature.getAttributes()[fieldId];
+	}
+
+	
+	public int getFieldCount() throws DriverException {
+		return fields.length;
+	}
+
+	
+	public String getFieldName(int fieldId) throws DriverException {
+		return fields[fieldId].getFieldName();
+	}
+
+	/* (non-Javadoc)
+	 * @see com.hardcode.gdbms.engine.data.ReadDriver#getRowCount()
+	 */
+	public long getRowCount() throws DriverException {
+		return features.size();
+	}
+    
+    /* (non-Javadoc)
+     * @see com.hardcode.gdbms.engine.data.driver.GDBMSDriver#setDataSourceFactory(com.hardcode.gdbms.engine.data.DataSourceFactory)
+     */
+    public void setDataSourceFactory(DataSourceFactory dsf) {
+    }
+
+    public int getFieldWidth(int fieldId)
+    {
+    	// TODO
+    	return 30;
+    }
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/FlagsMemoryDriver.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/RouteMemoryDriver.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/RouteMemoryDriver.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/RouteMemoryDriver.java	(revision 12191)
@@ -0,0 +1,279 @@
+/*
+ * Created on 06-nov-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.2  2006-11-08 19:32:36  azabala
+ * *** empty log message ***
+ *
+ * Revision 1.1  2006/11/07 19:49:28  azabala
+ * *** empty log message ***
+ *
+ *
+ */
+package com.iver.cit.gvsig.graph.solvers;
+
+import java.awt.geom.Rectangle2D;
+import java.io.IOException;
+import java.sql.Types;
+import java.util.List;
+
+import javax.swing.table.DefaultTableModel;
+
+import com.hardcode.gdbms.engine.data.DataSourceFactory;
+import com.hardcode.gdbms.engine.data.driver.DriverException;
+import com.hardcode.gdbms.engine.data.edition.DataWare;
+import com.hardcode.gdbms.engine.values.Value;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.IFeature;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.drivers.DriverAttributes;
+import com.iver.cit.gvsig.fmap.drivers.FieldDescription;
+import com.iver.cit.gvsig.fmap.drivers.MemoryDriver;
+import com.iver.cit.gvsig.fmap.drivers.VectorialDriver;
+
+/**
+ * Memory driver to work with Network's Route features
+ * 
+ * @author azabala
+ * 
+ */
+public class RouteMemoryDriver extends MemoryDriver implements VectorialDriver {
+	// TODO Internationalize field names
+	static FieldDescription[] fields = new FieldDescription[4];
+	static {
+		FieldDescription fieldDesc = new FieldDescription();
+		fieldDesc.setFieldName("IDARC");
+		fieldDesc.setFieldType(Types.INTEGER);
+		fieldDesc.setFieldLength(20);
+		fieldDesc.setFieldDecimalCount(0);
+		fields[0] = fieldDesc;
+
+		fieldDesc = new FieldDescription();
+		fieldDesc.setFieldName("WEIGHT");
+		fieldDesc.setFieldType(Types.DOUBLE);
+		fieldDesc.setFieldLength(20);
+		fieldDesc.setFieldDecimalCount(5);
+		fields[1] = fieldDesc;
+
+		fieldDesc = new FieldDescription();
+		fieldDesc.setFieldName("LENGTH");
+		fieldDesc.setFieldType(Types.DOUBLE);
+		fieldDesc.setFieldLength(20);
+		fieldDesc.setFieldDecimalCount(5);
+		fields[2] = fieldDesc;
+
+		fieldDesc = new FieldDescription();
+		fieldDesc.setFieldName("TEXT");
+		fieldDesc.setFieldType(Types.VARCHAR);
+		fieldDesc.setFieldLength(254);
+		fieldDesc.setFieldDecimalCount(0);
+		fields[3] = fieldDesc;
+	}
+
+	
+	List features;
+
+	Rectangle2D fullExtent;
+
+	public RouteMemoryDriver(List features) {
+		this.features = features;
+		computeFullExtent();
+	}
+
+	void computeFullExtent() {
+		if (features.size() > 0) {
+			IFeature feature = (IFeature) features.get(0);
+			fullExtent = feature.getGeometry().getBounds2D();
+			for (int i = 1; i < features.size(); i++) {
+				feature = (IFeature) features.get(i);
+				Rectangle2D rAux = feature.getGeometry().getBounds2D();
+				fullExtent.add(rAux);
+			}
+		}
+	}
+
+	public int getShapeType() {
+		return FShape.LINE;
+	}
+
+	public String getName() {
+		return "";
+	}
+
+	public DriverAttributes getDriverAttributes() {
+		return null;
+	}
+
+	public boolean isWritable() {
+		return false;
+	}
+
+	public int[] getPrimaryKeys()
+			throws com.hardcode.gdbms.engine.data.driver.DriverException {
+		return null;
+	}
+
+	public void write(DataWare dataWare)
+			throws com.hardcode.gdbms.engine.data.driver.DriverException {
+	}
+
+	/**
+	 * Returns de field type of the specified field index.
+	 * 
+	 * @return field type of i field
+	 */
+	public int getFieldType(int i) throws DriverException {
+		// azabala: we overwrite MemoryDriver because type resolution
+		// is based in first register value (it could be null)
+		if (i >= fields.length)
+			throw new DriverException("Excedido el numero de campos");
+		return fields[i].getFieldType();
+	}
+
+	public int getShapeCount() throws IOException {
+		return features.size();
+	}
+
+	public Rectangle2D getFullExtent() throws IOException {
+		return fullExtent;
+	}
+
+	public IGeometry getShape(int index) {
+		if(index <  features.size())
+			return ((IFeature) features.get(index)).getGeometry();
+		else
+			return null;
+	}
+
+	public void reload() throws IOException, DriverException {
+
+	}
+	
+	/**
+	 * Devuelve el modelo de la tabla.
+	 *
+	 * @return modelo de la tabla.
+	 */
+	public DefaultTableModel getTableModel() {
+		return null;
+	}
+
+	/**
+	 * A�ade un shape.
+	 *
+	 * @param geom shape.
+	 * @param row fila.
+	 */
+	public void addGeometry(IGeometry geom, Object[] row) {
+	}
+
+	
+	/**
+	 * M�todo de conveniencia, para poder a�adir directamente un shape
+	 * o una IGeometry. (Arriba est� el de a�adir una IGeometry.
+	 * @param shp
+	 * @param row
+	 */
+	public void addShape(FShape shp, Object[] row) {
+	}
+
+	/**
+	 * Devuelve el extent a partir de un �ndice.
+	 *
+	 * @param index �ndice.
+	 *
+	 * @return Extent.
+	 *
+	 * @throws IOException
+	 */
+	public Rectangle2D getShapeBounds(int index) throws IOException {
+		return ((IFeature)features.get(index)).getGeometry().getBounds2D();
+	}
+
+	
+	public int getShapeType(int index) {
+		return ((IFeature)features.get(index)).getGeometry().getGeometryType();
+	}
+
+
+	/* (non-Javadoc)
+	 * @see com.hardcode.gdbms.engine.data.ReadDriver#getFieldValue(long, int)
+	 */
+	public Value getFieldValue(long rowIndex, int fieldId)
+		throws DriverException {
+		IFeature feature = (IFeature) features.get((int) rowIndex);
+		return feature.getAttributes()[fieldId];
+	}
+
+	
+	public int getFieldCount() throws DriverException {
+		return fields.length;
+	}
+
+	
+	public String getFieldName(int fieldId) throws DriverException {
+		return fields[fieldId].getFieldName();
+	}
+
+	/* (non-Javadoc)
+	 * @see com.hardcode.gdbms.engine.data.ReadDriver#getRowCount()
+	 */
+	public long getRowCount() throws DriverException {
+		return features.size();
+	}
+    
+    /* (non-Javadoc)
+     * @see com.hardcode.gdbms.engine.data.driver.GDBMSDriver#setDataSourceFactory(com.hardcode.gdbms.engine.data.DataSourceFactory)
+     */
+    public void setDataSourceFactory(DataSourceFactory dsf) {
+    }
+
+    public int getFieldWidth(int fieldId)
+    {
+    	// TODO
+    	return 30;
+    }
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/RouteMemoryDriver.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/OneToManySolver.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/OneToManySolver.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/OneToManySolver.java	(revision 12191)
@@ -0,0 +1,385 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.solvers;
+
+import java.util.ArrayList;
+
+import com.iver.cit.gvsig.graph.GraphException;
+import com.iver.cit.gvsig.graph.core.AbstractNetSolver;
+import com.iver.cit.gvsig.graph.core.GvEdge;
+import com.iver.cit.gvsig.graph.core.GvFlag;
+import com.iver.cit.gvsig.graph.core.GvNode;
+import com.iver.cit.gvsig.graph.core.IGraph;
+
+public class OneToManySolver extends AbstractNetSolver {
+
+	private int idStart = -1;
+	private ArrayList idStops = null;
+	
+	private class StopAux {
+		public StopAux(Integer idStop2) {
+			idStop = idStop2;
+			bFound = false;
+		}
+		private Integer idStop;
+		private boolean bFound;
+		public boolean isFound() {
+			return bFound;
+		}
+		public void setFound(boolean found) {
+			bFound = found;
+		}
+		public Integer getIdStop() {
+			return idStop;
+		}
+	}
+	
+	private GvFlag sourceFlag;
+	
+
+	
+	/**
+	 * We have this method separated from calculate to speed up odmatrix calculations.
+	 * The developer can position flags once, and call calculate only changing source
+	 * (idStart). This way, destination flags are positionned only once.
+	 * @throws GraphException
+	 */
+	public void putDestinationsOnNetwork() throws GraphException
+	{
+		GvFlag[] flags = net.getFlags(); // Destinations
+		
+		if (flags.length == 0)
+			throw new RuntimeException("Please, add flags before");
+		
+		idStops = new ArrayList();
+		for (int i = 0; i < flags.length; i++) {
+			GvFlag fTo = flags[i];
+
+			int idStop = net.creaArcosVirtuales(fTo);
+			idStops.add(new Integer(idStop));
+		}
+		
+	}
+	public void removeDestinationsFromNetwork()
+	{
+		GvFlag[] flags = net.getFlags(); // Destinations
+		for (int i = 0; i < flags.length; i++)
+		{
+			GvFlag fTo = flags[i];
+			net.reconstruyeTramo(fTo.getIdArc());			
+		}
+		
+	}
+	/**
+	 * @throws GraphException 
+	 */
+	public void calculate() throws GraphException {
+		if (idStops == null)
+		{
+			throw new RuntimeException("Please, call putDestinationsOnNetwork before calculate()");
+		}
+		GvFlag[] flags = net.getFlags(); // Destinations
+		idStart = net.creaArcosVirtuales(sourceFlag);
+		dijkstra(idStart, idStops);
+		
+		IGraph graph = net.getGraph();
+		for (int i = 0; i < flags.length; i++)
+		{
+			GvFlag fTo = flags[i];
+			Integer auxId = (Integer) idStops.get(i);
+			GvNode auxNode = graph.getNodeByID(auxId.intValue());
+//			System.out.println("Asigno bestCost = " + auxNode.getBestCost());
+			if (auxNode.getBestCost() == Double.MAX_VALUE)
+			{
+				fTo.setCost(-1);
+				fTo.setAccumulatedLength(-1);
+			}
+			else
+			{
+				fTo.setCost(auxNode.getBestCost());
+				fTo.setAccumulatedLength(auxNode.getAccumulatedLength());				
+			}
+		}
+		
+		// TODO: No podemos reconstruir el tramo porque perdemos la conectividad
+		// con el resto de destinos.
+//		net.reconstruyeTramo(sourceFlag.getIdArc());
+	}
+
+
+	private void dijkstra(int idStart, ArrayList stops) {
+		int nodeNum;
+		int linkNum;
+		double newCost;
+		int idSiguienteNodo;
+		GvNode node, toNode, bestNode; // , *pNodoProv;
+		GvEdge link;
+		boolean bExit = false;
+		double bestCost;
+
+		boolean bGiroProhibido;
+		// List clonedStops = Collections.synchronizedList(stops);
+		ArrayList clonedStops = new ArrayList();
+		for (int i=0; i < stops.size(); i++)
+		{
+			Integer idStop = (Integer) stops.get(i);
+			clonedStops.add(new StopAux(idStop));
+		}
+		ArrayList candidatos = new ArrayList();
+
+//		GvTurn elGiro;
+		// char Mensaje[200];
+		
+		IGraph graph = net.getGraph();
+
+		// NUEVO: 27-6-2003
+		// Cada nodo y cada arco llevan un nuemero de soluci�n. Se supone
+		// que si lo del nodo y el arco no coincide con
+		// este numero, todav�a no ha sido inicializado y hay que hacerlo.
+		// Para evitar coincidencias cuando de la vuelta el contador, cada
+		// 65000 peticiones (por ejemplo), repasamos toda
+		// la red y ponemos numSolucGlobal a -1
+		if (numSolucGlobal > 65000) {
+			numSolucGlobal = -1;
+
+			for (nodeNum = 0; nodeNum < graph.numVertices(); nodeNum++) {
+				node = graph.getNodeByID(nodeNum);
+				node.initialize();
+			} // for nodeNum */
+
+		}
+		numSolucGlobal++;
+
+		candidatos.clear();
+		// A�adimos el Start Node a la lista de candidatosSTL
+		// Nodos finales
+		for (int h=0; h < clonedStops.size(); h++)
+		{
+			StopAux auxStop = (StopAux) clonedStops.get(h);
+			int idStop = auxStop.getIdStop().intValue();
+		
+			GvNode auxNode = graph.getNodeByID(idStop);
+			auxNode.initialize();
+		}
+		node = graph.getNodeByID(idStart);
+		node.initialize();
+		bestNode = node;
+
+		candidatos.add(node);
+		node.setBestCost(0);
+		node.setStatus(GvNode.statNowInList);
+		bestCost = Double.MAX_VALUE;
+
+		// Mientras que la lista de candidatosSTL no est� vac�a, procesamos
+		// Nodos
+		int stopActual = 0;
+
+		while ((!bExit) && (candidatos.size() > 0)) {
+			// Buscamos el nodo con m�nimo coste
+			node = (GvNode) candidatos.get(0);
+			bestNode = node;
+			bestCost = node.getBestCost();
+			for (nodeNum = 1; nodeNum < candidatos.size(); nodeNum++) {
+				node = (GvNode) candidatos.get(nodeNum);
+				if (node.getBestCost() < bestCost) {
+					bestCost = node.getBestCost();
+					bestNode = node;
+				}
+			} // for nodeNum candidatosSTL
+
+			node = bestNode;
+			// Borramos el mejor nodo de la lista de candidatosSTL
+			node.setStatus(GvNode.statWasInList);
+			// TODO: BORRAR POR INDEX, NO AS�. ES M�S LENTO QUE SI BORRAMOS EL i-�simo.
+			candidatos.remove(node);
+			// System.out.println("LINK " + link.getIdArc() + " from ");
+			// System.out.println("from " + idStart + " to " + finalNode.getIdNode() + ". node=" + node.getIdNode());
+			// Miramos si hemos llegado donde quer�amos
+			StopAux auxStop = (StopAux) clonedStops.get(stopActual);
+			int idStop = auxStop.getIdStop().intValue();
+			
+			if (bestNode.getIdNode() == idStop) {
+				// Hemos llegado a ese punto. Miramos el resto de puntos destino
+				// a ver si ya hemos pasado por alguno de ellos.
+				// Si con algun punto no pasamos por aqu�, no habremos llegado a ese punto.
+				// No importa, puede que al resto s�, y esos nodos a los que s� hemos llegado
+				// tendr�n bien rellenado el coste.
+				auxStop.setFound(true);
+				for (int i=stopActual; i < clonedStops.size(); i++)
+				{
+					auxStop = (StopAux) clonedStops.get(i);
+					if (!auxStop.isFound())
+					{
+						Integer id = auxStop.getIdStop();
+	
+						GvNode auxNode = graph.getNodeByID(id.intValue());
+						if (auxNode.getStatus() == GvNode.statWasInList)
+						{
+							auxStop.setFound(true);
+						}
+						else
+						{
+							stopActual = i;
+							break;
+						}
+					}
+				}						
+				if (clonedStops.size() == 0)
+				{
+					bExit = true;
+					break; // Ya hemos llegado a todos los nodos
+				}				
+			}
+			// sprintf(Mensaje,"Enlaces en el nodo %ld:
+			// %ld.",pNodo->idNodo,pNodo->Enlaces.GetSize());
+			// AfxMessageBox(Mensaje);
+
+			// A�adimos a la lista de candidatosSTL los vecinos del nodo que
+			// acabamos de borrar
+			// HAY Arcos QUE SALEN Y Arcos QUE LLEGAN. SOLO MIRAMOS LOS QUE
+			// SALEN.
+			for (linkNum = 0; linkNum < node.getEnlaces().size(); linkNum++) {
+				// Pillamos el nodo vecino
+				link = (GvEdge) node.getEnlaces().get(linkNum);
+				idSiguienteNodo = link.getIdNodeEnd();
+
+				toNode = graph.getNodeByID(idSiguienteNodo);
+
+				// 27_5_2004
+				// Si un arco tiene coste negativo, lo ignoramos
+				if (link.getWeight() < 0)
+					continue;
+
+				// Fin arco con coste negativo
+
+				// NUEVO: 26-7-2003: Comprobamos si est� inicializado
+				if (toNode.getNumSoluc() != numSolucGlobal) {
+					toNode.initialize();
+				}
+				else
+				{
+					// System.out.println("Nodo ya inicializado");
+				}
+
+				// Miramos si ese nodo ya ha estado antes en la lista de
+				// candidatos
+				if (toNode.getStatus() != GvNode.statWasInList) {
+					// Miramos a ver si podemos mejorar su best_cost
+					newCost = node.getBestCost() + link.getWeight();
+					
+
+					// Miramos la lista de Giros de ese nodo
+					bGiroProhibido = false;
+					for (int idGiro = 0; idGiro < node.getTurns().size(); idGiro++) {
+						// Si est� prohibido, a por otro
+//						elGiro = (GvTurn) node.getTurns().get(idGiro);
+						// TODO: HABILITAR ESTO
+						// if ((elGiro.idTramoOrigen ==
+						// Arcos[pNodo->from_link].idTramo) &&
+						// (elGiro.idTramoDestino == pEnlace->idTramo))
+						// {
+						// if (elGiro.cost < 0)
+						// {
+						// bGiroProhibido = true;
+						// // No podemos inicializar por completo el nodo porque
+						// entonces
+						// // perdemos el fromLink (el arco desde donde hemos
+						// llegado hasta
+						// // este nodo, que es necesario para calcular los
+						// costes y generar
+						// // el shape recorriendo hacia atr�s el camino
+						// realizado.
+						// // Si hab�a m�s de un nodo con costes prohibidos,
+						// cab�a la posibilidad
+						// // de que perdieramos este enlace.
+						//									
+						// // Para que pueda volver a entrar en c�lculos
+						// pNodo->status = statNotInList;
+						// pNodo->best_cost = INFINITO;
+						//
+						// }
+						// else
+						// newCost += elGiro.cost;
+						// break; // Salimos del for porque ya hemos encontrado
+						// el giro
+						// }
+					}
+					// Si est� prohibido, vamos a por otro enlace, PERO
+					// MARCAMOS EL NODO
+					// COMO NO VISITADO PARA QUE PUEDA VOLVER A ENTRAR EN LA
+					// LISTA DE CANDIDATOS
+					// SI VENIMOS POR OTRO LADO.
+					if (bGiroProhibido) {
+						continue;
+					}
+
+					if (newCost < toNode.getBestCost()) {
+						// Es una mejora, as� que actualizamos el vecino y
+						// lo a�adimos a los candidatosSTL
+						toNode.setBestCost(newCost);
+						double newLength = node.getAccumulatedLength() + link.getDistance();
+						toNode.setAccumulatedLength(newLength);
+						toNode.setFromLink(link.getIdEdge());
+
+						if (toNode.getStatus() != GvNode.statNowInList) {
+							toNode.setStatus(GvNode.statNowInList);
+							candidatos.add(toNode);
+						}
+					} // Si hay mejora
+				} // if ese nodo no ha estado en la lista de candidatosSTL
+
+			} // for linkNum
+		} // while candidatosSTL
+
+	}
+
+
+	public GvFlag getSourceFlag() {
+		return sourceFlag;
+	}
+
+
+	public void setSourceFlag(GvFlag sourceFlag) {
+		this.sourceFlag = sourceFlag;
+		
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/OneToManySolver.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/Route.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/Route.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/Route.java	(revision 12191)
@@ -0,0 +1,133 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.solvers;
+
+import java.util.ArrayList;
+
+import com.hardcode.gdbms.engine.values.DoubleValue;
+import com.hardcode.gdbms.engine.values.Value;
+import com.hardcode.gdbms.engine.values.ValueFactory;
+import com.iver.cit.gvsig.fmap.core.DefaultFeature;
+import com.iver.cit.gvsig.fmap.core.IFeature;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+
+/**
+ * @author fjp
+ * featureList es un array de IFeature.
+ * Los campos que tiene cada feature son:
+ * 0-> Id_Tramo (idArc sobre el que est� ese tramo de ruta.
+ * 1-> Weight
+ * 2-> Length
+ * 3-> Texto calle o via por la que pasa.
+ *
+ */
+public class Route {
+	
+	public static final int ID_ARC_INDEX = 0;
+	public static final int WEIGHT_INDEX = 1;
+	public static final int LENGTH_INDEX = 2;
+	public static final int TEXT_INDEX = 3;
+	
+	
+	
+	
+	
+	
+	
+	public IFeature addRouteFeature(IGeometry geom, int idArc, double weight, double length, String text)
+	{
+		Value[] values = new Value[4];
+		values[0] = ValueFactory.createValue(idArc);
+		values[1] = ValueFactory.createValue(weight);
+		values[2] = ValueFactory.createValue(length);
+		values[3] = ValueFactory.createValue(text);
+		// System.out.println("A�ado text= " + idArc + ": " + text);
+		DefaultFeature feat = new DefaultFeature(geom, values, featureList.size() + "");
+		featureList.add(feat);
+		return feat;
+	}
+	private ArrayList featureList = new ArrayList();
+	
+	public ArrayList getFeatureList() 
+	{
+		return featureList;
+	}
+	
+	public String getInstructions() {
+		String instructions = "";
+		double  distTotal = 0;
+		for (int i=featureList.size()-1; i>=0; i--)
+		{
+			IFeature feat = (IFeature) featureList.get(i);
+			DoubleValue length = (DoubleValue) feat.getAttribute(2);
+			double dist = length.doubleValue();
+			distTotal += dist;
+			instructions = instructions + "\n" + feat.getAttribute(3) + " dist=" + dist;
+		}
+		return instructions;
+	}
+	
+	public double getLength() {
+		double  distTotal = 0;
+		for (int i=0; i < featureList.size(); i++)
+		{
+			IFeature feat = (IFeature) featureList.get(i);
+			DoubleValue length = (DoubleValue) feat.getAttribute(2);
+			double dist = length.doubleValue();
+			distTotal += dist;
+		}
+		return distTotal;
+	}
+	
+	public double getCost() {
+		double  costTotal = 0;
+		for (int i=0; i < featureList.size(); i++)
+		{
+			IFeature feat = (IFeature) featureList.get(i);
+			DoubleValue costVal = (DoubleValue) feat.getAttribute(1);
+			double cost = costVal.doubleValue();
+			costTotal += cost;
+		}
+		return costTotal;		
+	}
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/Route.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/ShortestPathSolverAStar.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/ShortestPathSolverAStar.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/ShortestPathSolverAStar.java	(revision 12191)
@@ -0,0 +1,634 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.solvers;
+
+import java.util.ArrayList;
+import java.util.Stack;
+
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.core.IFeature;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.v02.FConverter;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.layers.VectorialAdapter;
+import com.iver.cit.gvsig.graph.GraphException;
+import com.iver.cit.gvsig.graph.core.AbstractNetSolver;
+import com.iver.cit.gvsig.graph.core.GvEdge;
+import com.iver.cit.gvsig.graph.core.GvFlag;
+import com.iver.cit.gvsig.graph.core.GvNode;
+import com.iver.cit.gvsig.graph.core.GvTurn;
+import com.iver.cit.gvsig.graph.core.IGraph;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.Geometry;
+import com.vividsolutions.jts.geom.GeometryFactory;
+import com.vividsolutions.jts.geom.LineString;
+import com.vividsolutions.jts.geom.MultiLineString;
+
+/**
+ * @author fjp
+ * Este es �til solo cuando podemos calcular la distancia estimada entre
+ * 2 nodos. (Es decir, para temas de cartograf�a). Para analizar relaciones
+ * creo que no servir�a).
+ */
+public class ShortestPathSolverAStar extends AbstractNetSolver {
+	
+	private GeometryFactory geomFactory = new GeometryFactory();
+	
+	protected Route route = new Route();
+	private int fieldIndexStreetName;
+	
+	private class InfoShp {
+		public int idArc;
+		public double pct;
+		public double cost;
+		public double distance;
+		public int direction;
+		public boolean bFlip;
+
+	}
+	
+	public void setFielStreetName(String name) {
+		try {
+			int aux = net.getLayer().getRecordset().getFieldIndexByName(name);
+			if (aux == -1)
+				throw new RuntimeException("Field " + name + " not found.");
+			fieldIndexStreetName = aux;
+		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (DriverException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		
+	}
+
+	/**
+	 * @return a list of features
+	 * @throws GraphException 
+	 */
+	public Route calculateRoute() throws GraphException {
+		GvFlag[] flags = net.getFlags();
+		if (flags.length == 0)
+			throw new RuntimeException("Please, add flags before");
+		int desde = 0;
+		int hasta = 1;
+		double elCoste1 = 0;
+		route = new Route();
+		GvFlag fFrom = flags[0];
+		fFrom.setCost(0);
+		for (int i = 0; i < flags.length - 1; i++) {
+			fFrom = flags[desde];
+			GvFlag fTo = flags[hasta];
+
+			if (fFrom != fTo) {
+				int idStart = net.creaArcosVirtuales(fFrom);
+				int idStop = net.creaArcosVirtuales(fTo);
+
+				double newCost = AStar(idStart, idStop);
+				
+				elCoste1 += newCost;
+				fTo.setCost(elCoste1);
+
+				if (newCost != Double.MAX_VALUE)
+				{
+					try {
+						populateRoute(fFrom, fTo, idStart, idStop);
+					} catch (DriverException e) {
+						e.printStackTrace();
+						throw new GraphException(e);
+					}
+				}
+				else
+				{
+					// No way
+				}
+
+				net.reconstruyeTramo(fFrom.getIdArc());
+				net.reconstruyeTramo(fTo.getIdArc());
+				desde = hasta;
+			} // if son puntos distintos
+			hasta++;
+		}
+
+		return route;
+	}
+
+	private void populateRouteSimple(int idStart, int idEnd) throws DriverException {
+		int idEnlace;
+		GvNode node;
+		GvEdge link;
+		double costeEntrada;
+
+		// Trazar el camino desde idEnd hasta idStart hacia atr�s marcando los Enlaces
+		double Coste = 0;
+		double Coste2 = 0;
+		IGraph graph = net.getGraph();
+		node = graph.getNodeByID(idEnd);
+		int from_link = node.getFromLink();
+		VectorialAdapter va = (VectorialAdapter) net.getLayer().getSource();
+		while (node.getIdNode() != idStart)
+		{
+			if (from_link == -1)
+			{
+				throw new RuntimeException("Fallo al recorrer de manera inversa la soluci�n. Encontrado arco con -1");
+				// break; // FALLO!!
+			} 
+			link = graph.getEdgeByID(from_link);
+			IFeature feat = va.getFeature(link.getIdArc());
+			route.addRouteFeature(feat.getGeometry(), link.getIdArc(), 
+					link.getWeight(), link.getDistance(), feat.getAttribute(getFieldIndexStreetName()).toString());
+
+			node = graph.getNodeByID(link.getIdNodeOrig());
+
+			Coste = Coste + link.getWeight();
+			Coste2 = Coste2 + link.getDistance();
+
+			// TODO:
+			// from_link = node.get_from_link(idEnlace, &costeEntrada);
+			from_link = node.getFromLink();
+			
+	    }	
+		System.out.println("Salgo con node = " + node.getIdNode());
+	}
+
+	private void populateRoute(GvFlag origin, GvFlag dest, int idStart, int idEnd) throws DriverException {
+		int idEnlace;
+		GvNode node;
+		GvEdge link;
+		double costeEntrada;
+
+		// Trazar el camino desde idEnd hasta idStart hacia atr�s marcando los Enlaces
+		
+		if (idStart == idEnd)
+			return;
+		IGraph graph = net.getGraph();
+		node = graph.getNodeByID(idEnd);
+		int from_link = node.getFromLink();
+		VectorialAdapter va = (VectorialAdapter) net.getLayer().getSource();
+		try {
+			va.start();
+		/*	Miramos los nodos de los tramos inicio y final, y cogemos el nodo que tenga el from_link rellenado. E IGUAL A NUMSOLUCGLOBAL!!!!
+			A partir de ah�, recorremos hacia atr�s y tenemos el cuerpo principal del shape. Luego, para
+			las puntas hay que tener en cuenta los porcentajes, viendo el trozo que est� pegando a los nodos
+			que sabemos que est�n en el path
+		*/
+
+		/* 22/9/2003 Corregimos el fallo que hab�a de escribir el shape de atr�s adelante.
+		*  Guardamos lo que necesitamos en listaShapes y recorremos esa lista guardando los tramos
+		*	con el sentido adecuado.
+		*/
+
+		/* 3/Febrero/2005 Limpieza de c�digo superfluo y correci�n de un fallo raro. Ahora es m�s simple y parece
+		* que no falla. A ver si dura. IDEA: quiz�s se necesite meter el porcentaje en los arcos partidos.
+		*/	
+
+		// Define a template class for a vector of IDs.
+		InfoShp infoShp;
+		Stack pilaShapes = new Stack();
+//		typedef stack<CInfoShp> PILAINFO;
+//		PILAINFO pilaShapes;
+
+		double costeTramoFinal=-1;
+		GvNode nodeEnd = graph.getNodeByID(idEnd);
+		GvEdge finalEdge = graph.getEdgeByID(nodeEnd.getFromLink());
+		costeTramoFinal = finalEdge.getWeight();
+
+		GvNode pNodo;
+		GvEdge pEnlace;
+		
+		boolean bFlipearShape = false;
+
+		double pctMax, pctMin;
+
+
+
+		//////////////////////////////////////////////////////////////////////////////////////
+		// Trozo del final
+		// El shape va de idStop1 a idStop2, y el porcentaje viene en ese sentido.
+		// Si el idEnd es idStop1, quiere decir que el tramo que falta va en ese sentido tambi�n,
+		// as� que recorremos ese shape desde idStop1 hasta que rebasemos o igualemos ese porcentaje.
+		// Si no, hemos pasado por idStop2 y la parte que hay que meter es desde el pto interior a idStop2
+		///////////////////////////////////////////////////////////////////////////////////////
+		IFeature feat = va.getFeature(finalEdge.getIdArc());
+		MultiLineString jtsGeom = (MultiLineString) feat.getGeometry().toJTSGeometry();
+//		CoordinateFilter removeDuplicates = new UniqueCoordinateArrayFilter(); 
+//		jtsGeom.apply(removeDuplicates);
+//		jtsGeom.geometryChanged();
+		
+		
+		
+		// SI ESTAMOS SOBRE EL MISMO TRAMO, CASO PARTICULAR
+		// y el sentido de circulaci�n es correcto
+		if ((origin.getIdArc() == dest.getIdArc()) && (nodeEnd.getBestCost() <= costeTramoFinal))
+		{
+			if (dest.getPct() > origin.getPct())
+			{
+				pctMax = dest.getPct();
+				pctMin = origin.getPct(); 
+			}
+			else
+			{
+				pctMax = origin.getPct();
+				pctMin = dest.getPct();
+				bFlipearShape = true;
+			}
+
+			LineString line = SituaSobreTramo(jtsGeom,dest.getIdArc(), dest.getPct(),1);
+			
+			pctMin = pctMin / pctMax; // Porque ha cambiado la longitud del shape
+
+			line = SituaSobreTramo(line,dest.getIdArc(), pctMin,0);
+
+			if (bFlipearShape)
+				line = line.reverse();
+			
+			IGeometry geom = FConverter.jts_to_igeometry(line);
+			// TODO: Calcular bien el length de este arco, 
+			// basandonos en el porcentaje costeTramoFinal / costeOriginal
+			route.addRouteFeature(geom, origin.getIdArc(), 
+					costeTramoFinal, line.getLength(), feat.getAttribute(getFieldIndexStreetName()).toString());
+
+
+			return ; // Deber�a sacar el coste
+		}
+
+		
+
+		// Trazar el camino desde idEnd hasta idStart hacia atr�s marcando los Enlaces
+		pNodo = graph.getNodeByID(idEnd);
+
+		while ((pNodo.getIdNode() != idStart)) 
+		{
+			idEnlace = pNodo.getFromLink();
+			pEnlace = graph.getEdgeByID(idEnlace);
+
+			pNodo = graph.getNodeByID(pEnlace.getIdNodeOrig());
+			
+			infoShp = new InfoShp();
+			infoShp.distance = pEnlace.getDistance();
+			infoShp.cost = pEnlace.getWeight();
+
+			if ((pEnlace.getIdArc() == origin.getIdArc()) || (pEnlace.getIdArc() == dest.getIdArc()))
+			{
+				if (pEnlace.getIdArc() == origin.getIdArc())
+				{
+					infoShp.pct = origin.getPct();
+					infoShp.idArc = origin.getIdArc();
+					if (pEnlace.getDirec() == 0) 
+					{
+						infoShp.direction = 1;
+						infoShp.bFlip = true;
+					}
+					else // Hemos pasado por el 2
+					{
+						infoShp.direction = 0;
+						infoShp.bFlip = false;
+					} // if else */
+				}
+				else
+				{
+					infoShp.pct = dest.getPct();
+					infoShp.idArc = dest.getIdArc();
+					if (pEnlace.getDirec() == 0)
+					{
+						infoShp.direction = 0;
+						infoShp.bFlip = true;
+					}
+					else
+					{
+						infoShp.direction = 1;
+						infoShp.bFlip = false;
+					} // if else */
+				}
+			}
+			else
+			{
+				infoShp.pct = 1.0;
+				infoShp.idArc = pEnlace.getIdArc();
+				
+				infoShp.direction =1;
+				if (pEnlace.getDirec() == 1)
+					infoShp.bFlip = false;
+				else
+					infoShp.bFlip = true;
+			}
+
+			pilaShapes.push(infoShp);
+		}
+
+		// Y ahora recorremos hacia atr�s el vector y escribimos los shapes.
+		// VECTORINFO::iterator theIterator;
+		int auxC = 0;
+		
+		while (!pilaShapes.empty())  
+		{
+			infoShp = (InfoShp) pilaShapes.peek();
+			feat = va.getFeature(infoShp.idArc);
+			MultiLineString line = (MultiLineString) feat.getGeometry().toJTSGeometry();
+//			line.apply(removeDuplicates);
+//			line.geometryChanged();
+			
+			LineString aux = null;
+			if (infoShp.pct < 1.0)
+				aux = SituaSobreTramo(line,infoShp.idArc, infoShp.pct, infoShp.direction);
+
+			IGeometry geom = null;
+			if (aux == null)
+			{
+				if (infoShp.bFlip)
+					line = line.reverse();
+				geom = FConverter.jts_to_igeometry(line);
+			}	
+			else
+			{
+				if (infoShp.bFlip)
+					aux = aux.reverse();
+				geom = FConverter.jts_to_igeometry(aux);
+			}	
+
+
+			route.addRouteFeature(geom, infoShp.idArc, 
+					infoShp.cost, infoShp.distance, feat.getAttribute(getFieldIndexStreetName()).toString());
+
+
+			pilaShapes.pop();
+			auxC++;
+			
+		}
+		va.stop();
+		} catch (DriverIOException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+		return;
+
+		
+	}
+
+	LineString SituaSobreTramo(Geometry geom, int idArc, double pct, int parte)
+//	 Si parte vale cero, los v�lidos son los primeros. Si no, los segundos.
+	{
+		int j, numVertices;
+		double longAcum, longReal, longBuscada, distSobre, miniPorcentaje;
+		double nuevaX, nuevaY; // Por cuestiones de claridad al programar
+		double dist=0;
+
+		longAcum = 0;
+		longReal = geom.getLength();
+		longBuscada = longReal * pct;
+		Coordinate[] coords = geom.getCoordinates();
+		Coordinate c1 = null, c2 = null;
+		ArrayList savedCoords = new ArrayList();
+
+	 	if (parte > 0) // Hemos entrado por el 1 hacia el 2 (al 2 no llegamos)
+		{
+			for( j = 0; j < coords.length-1; j++ ) 
+			{
+				c1 = coords[j];
+				c2 = coords[j+1];
+				dist = c1.distance(c2);
+				longAcum += dist;
+				savedCoords.add(c1);
+				if (longAcum >= longBuscada)
+				{
+					// Hasta aqu�. Ahora ahi que poner el punto sobre el tramo
+					distSobre = dist - (longAcum - longBuscada);
+					miniPorcentaje = distSobre/dist;
+
+					nuevaX = c1.x + (c2.x-c1.x) * miniPorcentaje;
+					nuevaY = c1.y + (c2.y-c1.y) * miniPorcentaje;
+		
+					savedCoords.add(new Coordinate(nuevaX, nuevaY));
+					break;
+				} // if longAcum >= longBuscada
+			} // for j
+			
+		}
+		else // Hemos entrado por el 2 hacia el 1
+		{
+			numVertices = 0;
+			for( j = 0; j < coords.length; j++ ) 
+			{
+				////////////////////////////////////////////////////////////////
+				// 13_ene_2005: Si el �ltimo punto es el �ltimo punto no
+				// podemos acceder al elemento j+1 porque nos salimos del shape
+				/////////////////////////////////////////////////////////////////
+				c1 = coords[j];
+				if (j < coords.length -1)
+				{					
+					c2 = coords[j+1];
+
+					dist = c1.distance(c2);
+					longAcum += dist;
+				}
+
+				if (longAcum >= longBuscada)
+				{
+					// Hasta aqu�. Empezamos a meter puntos
+
+					if (numVertices == 0) 
+					{
+						distSobre = dist - (longAcum - longBuscada);
+						miniPorcentaje = distSobre/dist;
+						nuevaX = c1.x + (c2.x-c1.x) * miniPorcentaje;
+						nuevaY = c1.y + (c2.y-c1.y) * miniPorcentaje;
+						
+						savedCoords.add(new Coordinate(nuevaX, nuevaY));
+					}
+					else
+					{
+						savedCoords.add(c2);
+					}
+					numVertices ++;
+					// break;
+				} // if longAcum >= longBuscada
+			} // for j
+			
+			// savedCoords.add(c2);
+			
+		} // if else
+
+	 	
+	 	return geomFactory.createLineString((Coordinate[] )savedCoords.toArray(new Coordinate[0]));
+	}
+
+	private int getFieldIndexStreetName() {
+		return fieldIndexStreetName;
+	}
+
+	private double AStar(int idStart, int idStop) {
+		int nodeNum;
+		int linkNum;
+		double newCost;
+		int idSiguienteNodo;
+		GvNode node, toNode, finalNode, bestNode; // , *pNodoProv;
+		GvEdge link;
+		boolean bExit = false;
+
+		boolean bGiroProhibido;
+		ArrayList candidatos = new ArrayList();
+
+		// char Mensaje[200];
+		
+		IGraph graph = net.getGraph();
+
+		// NUEVO: 27-6-2003
+		// Cada nodo y cada arco llevan un nuemero de soluci�n. Se supone
+		// que si lo del nodo y el arco no coincide con
+		// este numero, todav�a no ha sido inicializado y hay que hacerlo.
+		// Para evitar coincidencias cuando de la vuelta el contador, cada
+		// 65000 peticiones (por ejemplo), repasamos toda
+		// la red y ponemos numSolucGlobal a -1
+		if (numSolucGlobal > 65000) {
+			numSolucGlobal = -1;
+
+			for (nodeNum = 0; nodeNum < graph.numVertices(); nodeNum++) {
+				node = graph.getNodeByID(nodeNum);
+				node.initialize();
+			} // for nodeNum */
+
+		}
+		numSolucGlobal++;
+
+		candidatos.clear();
+		// A�adimos el Start Node a la lista de candidatosSTL
+		// Nodo final
+		finalNode = graph.getNodeByID(idStop);
+		finalNode.initialize();
+
+		node = graph.getNodeByID(idStart);
+		node.initialize();
+		bestNode = node;
+
+		candidatos.add(node);
+		node.setBestCost(0);
+		node.setStatus(GvNode.statNowInList);
+		node.calculateStimation(finalNode, 0);
+
+		// Mientras que la lista de candidatosSTL no est� vac�a, procesamos
+		// Nodos
+		double bestStimation;
+
+		while ((!bExit) && (candidatos.size() > 0)) {
+			// Buscamos el nodo con m�nimo coste
+			node = (GvNode) candidatos.get(0);
+			bestNode = node;
+			bestStimation = node.getStimation();
+			for (nodeNum = 1; nodeNum < candidatos.size(); nodeNum++) {
+				node = (GvNode) candidatos.get(nodeNum);
+				if (node.getStimation() < bestStimation) {
+					bestStimation = node.getStimation();
+					bestNode = node;
+				}
+			} // for nodeNum candidatosSTL
+
+			node = bestNode;
+			// Borramos el mejor nodo de la lista de candidatosSTL
+			node.setStatus(GvNode.statWasInList);
+			// TODO: BORRAR POR INDEX, NO AS�. ES M�S LENTO QUE SI BORRAMOS EL i-�simo.
+			candidatos.remove(node);
+			// System.out.println("LINK " + link.getIdArc() + " from ");
+			// System.out.println("from " + idStart + " to " + finalNode.getIdNode() + ". node=" + node.getIdNode());
+			// Miramos si hemos llegado donde quer�amos
+			if (bestNode.getIdNode() == idStop) {
+				bExit = true;
+				break;
+			}
+
+			// sprintf(Mensaje,"Enlaces en el nodo %ld:
+			// %ld.",pNodo->idNodo,pNodo->Enlaces.GetSize());
+			// AfxMessageBox(Mensaje);
+
+			// A�adimos a la lista de candidatosSTL los vecinos del nodo que
+			// acabamos de borrar
+			// HAY Arcos QUE SALEN Y Arcos QUE LLEGAN. SOLO MIRAMOS LOS QUE
+			// SALEN.
+			for (linkNum = 0; linkNum < node.getEnlaces().size(); linkNum++) {
+				// Pillamos el nodo vecino
+				link = (GvEdge) node.getEnlaces().get(linkNum);
+				idSiguienteNodo = link.getIdNodeEnd();
+
+				toNode = graph.getNodeByID(idSiguienteNodo);
+
+				// 27_5_2004
+				// Si un arco tiene coste negativo, lo ignoramos
+				if (link.getWeight() < 0)
+					continue;
+
+				// Fin arco con coste negativo
+
+				// NUEVO: 26-7-2003: Comprobamos si est� inicializado
+				if (toNode.getNumSoluc() != numSolucGlobal) {
+					toNode.initialize();
+				}
+				else
+				{
+					// System.out.println("Nodo ya inicializado");
+				}
+
+				// Miramos a ver si podemos mejorar su best_cost
+				newCost = node.getBestCost() + link.getWeight();
+
+				if (newCost < toNode.getBestCost()) {
+					// Es una mejora, as� que actualizamos el vecino y
+					// lo a�adimos a los candidatosSTL
+					toNode.setBestCost(newCost);					 
+					toNode.setFromLink(link.getIdEdge());
+					
+					toNode.calculateStimation(finalNode, newCost);
+
+					if (toNode.getStatus() != GvNode.statNowInList) {
+						toNode.setStatus(GvNode.statNowInList);
+						candidatos.add(toNode);
+					}
+				} // Si hay mejora
+
+			} // for linkNum
+		} // while candidatosSTL
+
+		newCost = finalNode.getBestCost();
+
+		return newCost;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/solvers/ShortestPathSolverAStar.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/package.html
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/package.html	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/package.html	(revision 12191)
@@ -0,0 +1,7 @@
+<p>
+This package has classes to work with network analysis
+algorithms in gvSIG.
+By the moment, we are going to work with
+edu.uci.ics.jung.graph.Graph (JUNG graph implementation)
+
+</p>
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/package.html
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/tools/BarrierListener.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/tools/BarrierListener.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/tools/BarrierListener.java	(revision 12191)
@@ -0,0 +1,155 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.tools;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Image;
+import java.awt.geom.Point2D;
+
+import javax.swing.ImageIcon;
+import javax.swing.JOptionPane;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.messages.NotificationManager;
+import com.iver.andami.plugins.PluginClassLoader;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.ShapeFactory;
+import com.iver.cit.gvsig.fmap.core.v02.FConstant;
+import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
+import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
+import com.iver.cit.gvsig.fmap.rendering.FGraphic;
+import com.iver.cit.gvsig.fmap.tools.BehaviorException;
+import com.iver.cit.gvsig.fmap.tools.Events.PointEvent;
+import com.iver.cit.gvsig.fmap.tools.Listeners.PointListener;
+import com.iver.cit.gvsig.graph.GraphException;
+import com.iver.cit.gvsig.graph.core.EdgePair;
+import com.iver.cit.gvsig.graph.core.GvEdge;
+import com.iver.cit.gvsig.graph.core.GvFlag;
+import com.iver.cit.gvsig.graph.core.Network;
+
+public class BarrierListener implements PointListener {
+	private MapControl mapCtrl;
+
+	private int idSymbolBarrier = -1;
+
+	private Cursor cur = java.awt.Cursor
+			.getPredefinedCursor(Cursor.HAND_CURSOR);
+
+	public BarrierListener(MapControl mc) {
+		this.mapCtrl = mc;
+	}
+
+	/*
+	 * (non-Javadoc)
+	 * 
+	 * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.Events.PointEvent)
+	 *      The PointEvent method bring you a point in pixel coordinates. You
+	 *      need to transform it to world coordinates. The class to do
+	 *      conversions is ViewPort, obtained thru the MapContext of mapCtrl.
+	 */
+	public void point(PointEvent event) throws BehaviorException {
+
+		Point2D pReal = mapCtrl.getMapContext().getViewPort().toMapPoint(
+				event.getPoint());
+
+		SingleLayerIterator it = new SingleLayerIterator(mapCtrl
+				.getMapContext().getLayers());
+		while (it.hasNext()) {
+			FLayer aux = it.next();
+			if (!aux.isActive())
+				continue;
+			Network net = (Network) aux.getProperty("network");			
+
+			if (net != null) {
+				Point2D nearestPoint = new Point2D.Double();
+				double realTol = mapCtrl.getViewPort().toMapDistance(
+						FlagListener.pixelTolerance);
+				int idArc = net.findClosestArc(pReal.getX(), pReal.getY(),
+						realTol, nearestPoint);
+				if (idArc == -1) {
+					JOptionPane.showMessageDialog(null, "No est� sobre la red");
+					return;
+				}
+				
+				net.addModifiedCost(idArc, -1.0, 3);
+				GraphicLayer graphicLayer = mapCtrl.getMapContext()
+						.getGraphicsLayer();
+				if (idSymbolBarrier == -1) {
+					FSymbol simFlag = new FSymbol(FShape.POINT, Color.BLUE);
+					simFlag.setSize(16);
+					simFlag.setStyle(FConstant.SYMBOL_STYLE_MARKER_IMAGEN);
+					ImageIcon icon = new ImageIcon(this.getClass()
+							.getClassLoader().getResource("images/barrier.png"));
+					simFlag.setIcon(icon.getImage());
+
+					idSymbolBarrier = graphicLayer.addSymbol(simFlag);
+				}
+				IGeometry gAux = ShapeFactory.createPoint2D(nearestPoint.getX(),
+						nearestPoint.getY());
+				FGraphic graphic = new FGraphic(gAux, idSymbolBarrier);
+				graphic.setTag("BARRIER");
+				graphicLayer.addGraphic(graphic);
+				mapCtrl.drawGraphics();
+				PluginServices.getMainFrame().enableControls();
+
+			}
+		}
+
+	}
+
+	public Cursor getCursor() {
+		return cur;
+	}
+
+	public boolean cancelDrawing() {
+		return false;
+	}
+
+	public void pointDoubleClick(PointEvent event) throws BehaviorException {
+
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/tools/BarrierListener.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/tools/FlagListener.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/tools/FlagListener.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/tools/FlagListener.java	(revision 12191)
@@ -0,0 +1,154 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph.tools;
+
+import java.awt.Color;
+import java.awt.Cursor;
+import java.awt.Image;
+import java.awt.geom.Point2D;
+
+import javax.swing.ImageIcon;
+import javax.swing.JOptionPane;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.messages.NotificationManager;
+import com.iver.andami.plugins.PluginClassLoader;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.ShapeFactory;
+import com.iver.cit.gvsig.fmap.core.v02.FConstant;
+import com.iver.cit.gvsig.fmap.core.v02.FSymbol;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
+import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
+import com.iver.cit.gvsig.fmap.rendering.FGraphic;
+import com.iver.cit.gvsig.fmap.tools.BehaviorException;
+import com.iver.cit.gvsig.fmap.tools.Events.PointEvent;
+import com.iver.cit.gvsig.fmap.tools.Listeners.PointListener;
+import com.iver.cit.gvsig.graph.GraphException;
+import com.iver.cit.gvsig.graph.NetworkUtils;
+import com.iver.cit.gvsig.graph.core.GvFlag;
+import com.iver.cit.gvsig.graph.core.Network;
+
+public class FlagListener implements PointListener {
+	public static final int TO_ARC = 0;
+	public static final int TO_NODE = 1;
+	public static int pixelTolerance = 10;
+    private MapControl mapCtrl;
+    private int idSymbolFlag = -1;
+    private Cursor cur = java.awt.Cursor.getPredefinedCursor(Cursor.HAND_CURSOR);
+	private int mode;
+
+    
+    public FlagListener(MapControl mc) {
+        this.mapCtrl = mc;
+    }
+
+
+    /* (non-Javadoc)
+     * @see com.iver.cit.gvsig.fmap.tools.Listeners.PointListener#point(com.iver.cit.gvsig.fmap.tools.Events.PointEvent)
+     * The PointEvent method bring you a point in pixel coordinates. You
+     * need to transform it to world coordinates. The class to do conversions
+     * is ViewPort, obtained thru the MapContext of mapCtrl.
+     */
+    public void point(PointEvent event) throws BehaviorException {
+        
+        Point2D pReal = mapCtrl.getMapContext().getViewPort().toMapPoint(event.getPoint());
+        
+		SingleLayerIterator it = new SingleLayerIterator(mapCtrl.getMapContext().getLayers());
+		while (it.hasNext())
+		{
+			FLayer aux = it.next();
+			if (!aux.isActive())
+				continue;
+			Network net = (Network) aux.getProperty("network");
+			
+			if ( net != null)
+			{
+				double realTol = mapCtrl.getViewPort().toMapDistance(pixelTolerance);
+				GvFlag flag;
+				try {
+					if (mode == TO_ARC)
+						flag = net.addFlag(pReal.getX(), pReal.getY(), realTol);
+					else
+						flag = net.addFlagToNode(pReal.getX(), pReal.getY(), realTol);
+					if (flag == null)
+					{
+						JOptionPane.showMessageDialog(null, "No est� sobre la red");
+						return;
+					}
+					NetworkUtils.addGraphicFlag(mapCtrl, flag);
+					mapCtrl.drawGraphics();
+					PluginServices.getMainFrame().enableControls();
+				} catch (GraphException e) {
+					e.printStackTrace();
+					NotificationManager.addError(e);
+				}
+				
+			}
+		}
+        
+        
+    }
+
+    public Cursor getCursor() {
+        return cur;
+    }
+
+    public boolean cancelDrawing() {
+        return false;
+    }
+
+
+	public void pointDoubleClick(PointEvent event) throws BehaviorException {
+		
+	}
+
+
+	public void setMode(int mode) {
+		this.mode = mode;
+		
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/tools/FlagListener.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/GraphException.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/GraphException.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/GraphException.java	(revision 12191)
@@ -0,0 +1,30 @@
+/*
+ * Created on 20-jun-2006 by azabala
+ *
+ */
+package com.iver.cit.gvsig.graph;
+
+/**
+ * Exception throwed by any class of the Graph package.
+ * @author alzabord
+ *
+ */
+public class GraphException extends Exception {
+	public GraphException(Exception e){
+		super(e);
+	}
+	
+	public GraphException(){
+		super();
+	}
+	
+	public GraphException(String msg){
+		super(msg);
+	}
+	
+	public GraphException(String msg, Exception e){
+		super(msg, e);
+	}
+	
+	
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/GraphException.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/preferences/RoutePage.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/preferences/RoutePage.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/preferences/RoutePage.java	(revision 12191)
@@ -0,0 +1,159 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.7  2006-10-30 19:30:35  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.6  2006/10/26 16:31:21  jaume
+ * GUI
+ *
+ * Revision 1.5  2006/10/26 07:46:58  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.4  2006/10/25 10:50:41  jaume
+ * movement of classes and gui stuff
+ *
+ * Revision 1.3  2006/10/24 16:31:40  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.2  2006/10/23 16:00:20  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.1  2006/10/23 08:05:39  jaume
+ * GUI
+ *
+ *
+ */
+package com.iver.cit.gvsig.graph.preferences;
+
+import java.awt.Dimension;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.ImageIcon;
+import javax.swing.JPanel;
+
+import org.gvsig.gui.beans.swing.JButton;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.preferences.AbstractPreferencePage;
+import com.iver.andami.preferences.StoreException;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.cit.gvsig.gvsig.gui.styling.SymbolPreview;
+import com.iver.cit.gvsig.gvsig.gui.styling.SymbolSelector;
+
+public class RoutePage extends AbstractPreferencePage {
+	private ImageIcon icon;
+	private SymbolPreview symbolPreview;
+	private JButton btnChangeSymbol;
+
+	public RoutePage() {
+		icon = new ImageIcon(this.getClass().getClassLoader().getResource(
+				"images/net-analyst-icon.png"));
+		symbolPreview = new SymbolPreview();
+		symbolPreview.setPreferredSize(new Dimension(100, 100));
+		symbolPreview.setBorder(BorderFactory.createBevelBorder(1));
+
+		JPanel aux = new JPanel();
+		aux.add(symbolPreview);
+		addComponent(PluginServices.getText(this, "use_symbol") +":", aux);
+		aux = new JPanel();
+		aux.add(btnChangeSymbol = new JButton(PluginServices.getText(this, "change")));
+		btnChangeSymbol.addActionListener(new ActionListener() {
+			public void actionPerformed(ActionEvent e) {
+				SymbolSelector symbSelec = new SymbolSelector(null, FShape.POLYGON);
+				PluginServices.getMDIManager().addWindow(symbSelec);
+				ISymbol sym = symbSelec.getSymbol();
+				if (sym!=null)
+					symbolPreview.setSymbol(sym);
+			}
+		});
+		addComponent("", aux);
+	}
+
+	public void storeValues() throws StoreException {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void setChangesApplied() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public String getID() {
+		return getClass().getName();
+	}
+
+	public String getTitle() {
+		return PluginServices.getText(this, "net_analyst");
+	}
+
+	public JPanel getPanel() {
+		return this;
+	}
+
+	public void initializeValues() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void initializeDefaults() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public ImageIcon getIcon() {
+		return icon;
+	}
+
+	public boolean isValueChanged() {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/preferences/RoutePage.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ShortestPathExtension.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ShortestPathExtension.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ShortestPathExtension.java	(revision 12191)
@@ -0,0 +1,219 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graph;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.List;
+
+import javax.swing.JComponent;
+import javax.swing.JOptionPane;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.plugins.Extension;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.core.IFeature;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.v02.FArrowSymbol;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
+import com.iver.cit.gvsig.fmap.layers.SingleLayerIterator;
+import com.iver.cit.gvsig.fmap.rendering.FGraphic;
+import com.iver.cit.gvsig.graph.core.GvFlag;
+import com.iver.cit.gvsig.graph.core.IFlagListener;
+import com.iver.cit.gvsig.graph.core.Network;
+import com.iver.cit.gvsig.graph.gui.RouteControlPanel;
+import com.iver.cit.gvsig.graph.gui.RouteReportPanel;
+import com.iver.cit.gvsig.graph.solvers.Route;
+import com.iver.cit.gvsig.graph.solvers.ShortestPathSolverAStar;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+import com.iver.cit.gvsig.util.GvSession;
+
+public class ShortestPathExtension extends Extension {
+
+	public static ShortestPathSolverAStar solver = new ShortestPathSolverAStar();
+	private int idSymbolLine = -1;
+
+	public void initialize() {
+	}
+
+	public void execute(String actionCommand) {
+		View v = (View) PluginServices.getMDIManager().getActiveWindow();
+		MapControl mapCtrl = v.getMapControl();
+		MapContext map = mapCtrl.getMapContext();
+		SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+		while (it.hasNext())
+		{
+			FLayer aux = it.next();
+			if (!aux.isActive())
+				continue;
+			Network net = (Network) aux.getProperty("network");
+
+			if ( net != null)
+			{
+				Route route;
+				try {
+					solver.setNetwork(net);
+//					solver.setFielStreetName("STREET_NAM");
+					route = solver.calculateRoute();
+					if (route.getFeatureList().size() == 0)
+					{
+						JOptionPane.showMessageDialog((JComponent) PluginServices.getMDIManager().getActiveWindow(),
+								PluginServices.getText(this, "shortest_path_not_found"));
+						return;
+					}
+					List routes = (List) GvSession.getInstance().get(mapCtrl, "Route");
+					if(routes == null){
+						routes = new ArrayList();
+						GvSession.getInstance().put(mapCtrl, "Route", routes);
+					}
+					routes.add(route);
+					
+					createGraphicsFrom(route.getFeatureList(), v.getMapControl());
+					RouteReportPanel routeReport = new RouteReportPanel(route, v.getMapControl());
+					PluginServices.getMDIManager().addWindow(routeReport);
+					List reportsPanels = (List) GvSession.getInstance().get(mapCtrl, "RouteReport");
+					if(reportsPanels == null){
+						reportsPanels = new ArrayList();
+						GvSession.getInstance().put(mapCtrl, "RouteReport", reportsPanels);
+					}	
+					reportsPanels.add(routeReport);
+					RouteControlPanel controlPanel = (RouteControlPanel) GvSession.getInstance().get(mapCtrl, "RouteControlPanel");
+					if (controlPanel != null)
+						controlPanel.refresh();
+					
+				} catch (GraphException e) {
+					// TODO Auto-generated catch block
+					e.printStackTrace();
+				}
+			}
+		}
+
+
+
+	}
+
+	private void createGraphicsFrom(Collection featureList, MapControl mapControl) {
+		Iterator it = featureList.iterator();
+		GraphicLayer graphicLayer = mapControl.getMapContext().getGraphicsLayer();
+//		if (idSymbolLine == -1)
+		{
+			FArrowSymbol arrowSymbol = new FArrowSymbol(Color.RED);
+			// FSymbol arrowSymbol = new FSymbol(FConstant.SYMBOL_TYPE_LINE);
+			arrowSymbol.setStroke(new BasicStroke(3.0f));
+			idSymbolLine = graphicLayer.addSymbol(arrowSymbol);
+			
+		}
+		// Para evitar hacer reallocate de los elementos de la
+		// graphicList cada vez, creamos primero la lista
+		// y la insertamos toda de una vez.
+		ArrayList graphicsRoute = new ArrayList();
+		while (it.hasNext()) {
+			IFeature feat = (IFeature) it.next();
+			IGeometry gAux = feat.getGeometry();
+			FGraphic graphic = new FGraphic(gAux, idSymbolLine);
+			graphic.setTag("ROUTE");
+			graphicsRoute.add(graphic);
+//			graphicLayer.insertGraphic(0, graphic);
+		}
+		// Lo insertamos al principio de la lista para que los
+		// pushpins se dibujen despu�s.
+
+		graphicLayer.inserGraphics(0, graphicsRoute);
+		mapControl.drawGraphics();
+
+	}
+
+	public boolean isEnabled() {
+		com.iver.andami.ui.mdiManager.IWindow f = PluginServices.getMDIManager()
+		 .getActiveWindow();
+		if (f == null) {
+		    return false;
+		}
+		if (f instanceof View) {
+		    View v = (View) f;
+			MapContext map = v.getMapControl().getMapContext();
+			SingleLayerIterator it = new SingleLayerIterator(map.getLayers());
+			while (it.hasNext())
+			{
+				FLayer aux = it.next();
+				if (!aux.isActive())
+					continue;
+				Network net = (Network) aux.getProperty("network");
+
+				if ( net != null)
+				{
+					int count = 0;
+					for (int i=0; i < net.getOriginaFlags().size(); i++)
+					{
+						GvFlag flag = (GvFlag) net.getOriginaFlags().get(i);
+						if (flag.isEnabled()) count++;
+					}
+					if (count > 1) return true;
+				}
+			}
+			return false;
+
+		}
+		return false;
+	}
+
+	public boolean isVisible() {
+		IWindow f = PluginServices.getMDIManager()
+		 .getActiveWindow();
+		if (f == null) {
+		    return false;
+		}
+		if (f instanceof View) {
+			return true;
+		}
+		return false;
+
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/graph/ShortestPathExtension.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/v02/FArrowSymbol.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/v02/FArrowSymbol.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/v02/FArrowSymbol.java	(revision 12191)
@@ -0,0 +1,314 @@
+/*
+ * Created on 25-oct-2006 by azabala
+ *
+ */
+package com.iver.cit.gvsig.fmap.core.v02;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.Stroke;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.PathIterator;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+
+import javax.print.attribute.PrintRequestAttributeSet;
+
+import com.iver.cit.gvsig.fmap.core.FPolygon2D;
+import com.iver.cit.gvsig.fmap.core.FPolyline2D;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.GeneralPathX;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.utiles.StringUtilities;
+import com.iver.utiles.XMLEntity;
+
+/**
+ * Symbol to draw a line with an arrow at the end.
+ * @author alzabord
+ */
+public class FArrowSymbol implements ISymbol {
+
+	protected static Color selectionColor = Color.YELLOW;
+	
+	protected static BufferedImage img = new BufferedImage(1, 1,
+			BufferedImage.TYPE_INT_ARGB);
+	
+	protected static Rectangle rect = new Rectangle(0, 0, 1, 1);
+	
+	protected Color symColor;
+	
+	protected Stroke m_Stroke;
+	
+	protected int m_symbolType = FConstant.SYMBOL_TYPE_LINE;
+
+	protected String m_Descrip;
+	
+	protected int rgb;
+
+	protected boolean m_bDrawShape = true;
+	
+	protected int lenghtArrow = 15;
+	protected int widthArrow = 10;
+	
+	
+	
+	
+	public FArrowSymbol(Color symColor){
+		this.symColor = symColor;
+		calculateRgb();
+	}
+	
+	public void calculateRgb() {
+		// Recalculamos el RGB
+		Graphics2D g2 = img.createGraphics();
+		drawInsideRectangle(g2, g2.getTransform(), rect);
+		rgb = img.getRGB(0, 0);
+	}
+	
+	/**
+	 * Devuelve el color que se aplica a los shapes seleccionados.
+	 *
+	 * @return DOCUMENT ME!
+	 */
+	public static Color getSelectionColor() {
+		return selectionColor;
+	}
+	
+	
+	public Color getColor(){
+		return symColor;
+	}
+	
+	public Stroke getStroke(){
+		return m_Stroke;
+	}
+	
+	public void setStroke(Stroke stroke){
+		this.m_Stroke = stroke;
+	}
+	
+	
+	/* (non-Javadoc)
+	 * @see com.iver.cit.gvsig.fmap.core.ISymbol#getSymbolForSelection()
+	 */
+	public ISymbol getSymbolForSelection() {
+		FArrowSymbol solution = new FArrowSymbol(selectionColor);
+		solution.m_bDrawShape = m_bDrawShape;
+		solution.m_Stroke = m_Stroke;
+		return solution;
+	}
+	
+	
+	
+
+	
+	public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp) {
+		
+		//1� dibujamos la linea
+		if (shp == null || (! isShapeVisible())) {
+			return;
+		}
+        g.setColor(getColor());
+		if (getStroke() != null) {
+			g.setStroke(getStroke());
+		}
+		g.draw(shp);	
+		
+		/*
+		 * Ahora intentamos obtener el ultimo segmento
+		 * */
+		PathIterator theIterator;
+		theIterator = shp.getPathIterator(null, 0.8);
+		int theType;
+		double[] theData = new double[2];
+		ArrayList arrayCoords = new ArrayList();
+		while (!theIterator.isDone()) {
+			theType = theIterator.currentSegment(theData);
+		    if(theType == PathIterator.SEG_LINETO || theType == PathIterator.SEG_MOVETO)
+		    	arrayCoords.add(theData);
+		    theData = new double[2];
+			theIterator.next();
+		} //end while loop
+		
+		double length = 0d;
+		double[] previous = null;
+		for(int i = 0; i < arrayCoords.size(); i++ ){
+			double[] coords = (double[]) arrayCoords.get(i);
+			if(previous == null)
+				previous = coords;
+			else{
+				double dx = coords[0] - previous[0];
+				double dy = coords[1] - previous[1];
+				double dist = Math.sqrt( ( dx * dx ) + (dy * dy));
+				length += dist;
+			}//else
+		}//for
+		
+		if(lenghtArrow > (0.5 * length))//to avoid arrows collisions
+			return;
+		
+		double[] last = (double[]) arrayCoords.get(arrayCoords.size() -1);
+		double[] prevLast = (double[]) arrayCoords.get(arrayCoords.size() -2);
+		
+		
+		double mx = last[0];
+		double my = last[1];
+		double Mx = prevLast[0];
+		double My = prevLast[1];
+//		
+
+		// tama�o de la flecha
+		double tipLength = lenghtArrow;
+		double tipWidth = widthArrow;
+
+		double	tip1x = mx + (((Mx - mx) * tipLength + ( tipWidth / 2)*(my - My))/
+						Math.sqrt(( my - My) * (my - My)+(mx-Mx)*(mx-Mx)));
+		
+		double  tip2x = mx + (((Mx-mx) * tipLength-(tipWidth/2)*(my-My))/
+						Math.sqrt((my-My)*(my-My)+(mx-Mx)*(mx-Mx)));
+		
+		double  tip1y = my + (((My-my)*tipLength-(tipWidth/2)*(mx-Mx))/
+				 		Math.sqrt((my-My)*(my-My)+(mx-Mx)*(mx-Mx)));
+		
+		double tip2y = my + (((My-my)*tipLength+(tipWidth/2)*(mx-Mx))/
+			            Math.sqrt((my-My)*(my-My)+(mx-Mx)*(mx-Mx)));
+		
+		GeneralPathX path = new GeneralPathX();
+		path.moveTo(mx, my);
+		path.lineTo(tip1x, tip1y);
+		path.lineTo(tip2x, tip2y);
+		path.closePath();
+		FPolygon2D arrow = new FPolygon2D(path);
+		g.fill(arrow);
+	}
+
+	
+	public int getPixExtentPlus(Graphics2D g, AffineTransform affineTransform, Shape shp) {
+		// TODO Auto-generated method stub
+		return 0;
+	}
+
+	
+	
+	
+	
+	public int getOnePointRgb() {
+		return rgb;
+	}
+
+	
+	public XMLEntity getXMLEntity() {
+		XMLEntity xml = new XMLEntity();
+		xml.putProperty("className",this.getClass().getName());
+		xml.putProperty("m_symbolType", getSymbolType());
+		if (getColor() != null) {
+			xml.putProperty("m_Color", StringUtilities.color2String(getColor()));
+		}
+		xml.putProperty("m_bDrawShape", isShapeVisible());
+		
+		
+		//Ancho del stroke en float
+		if (getStroke() != null) {
+			xml.putProperty("m_stroke",
+				((BasicStroke) getStroke()).getLineWidth());
+		} else {
+			xml.putProperty("m_stroke", 0f);
+		}
+		xml.putProperty("rgb", rgb);
+
+		return xml;
+	}
+
+	
+	
+	public String getDescription() {
+		return null;
+	}
+
+	
+	
+	
+	
+	public boolean isShapeVisible() {
+		return m_bDrawShape;
+	}
+	
+	
+	
+	public void setDescription(String m_Descrip) {
+		this.m_Descrip = m_Descrip;
+	}
+
+	
+	public int getSymbolType() {
+		return m_symbolType;
+	}
+	
+	
+
+	public boolean isSuitableFor(IGeometry geom) {
+		return true;
+	}
+
+	//TODO Copypasteado de graphics utilities para symboltype LINE
+	public void drawInsideRectangle(Graphics2D g, 
+			AffineTransform scaleInstance, 
+			Rectangle r) {
+		
+		FShape shp;
+		AffineTransform mT = new AffineTransform();
+		mT.setToIdentity();
+
+		Rectangle rect = mT.createTransformedShape(r).getBounds();
+		GeneralPathX line = new GeneralPathX();
+		
+		
+		
+		line.moveTo(rect.x, rect.y + (rect.height / 2));
+		line.curveTo(rect.x + (rect.width / 3),
+			rect.y + (2 * rect.height),
+			rect.x + ((2 * rect.width) / 3), rect.y - rect.height,
+			rect.x + rect.width, rect.y + (rect.height / 2));
+
+		shp = new FPolyline2D(line);
+		draw(g, mT, shp);
+	}
+
+	
+	
+
+	
+	public void setXMLEntity(XMLEntity xml) {
+		
+		
+	}
+
+
+	public String getClassName() {
+		// TODO Auto-generated method stub
+		return null;
+	}
+	
+	
+	/**
+	 * @return Returns the m_bDrawShape.
+	 */
+	public boolean isM_bDrawShape() {
+		return m_bDrawShape;
+	}
+	/**
+	 * @param drawShape The m_bDrawShape to set.
+	 */
+	public void setM_bDrawShape(boolean drawShape) {
+		m_bDrawShape = drawShape;
+	}
+
+	public void setPrintingProperties(PrintRequestAttributeSet printProperties) {
+		// TODO Auto-generated method stub
+		
+	}
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/v02/FArrowSymbol.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/SymbolFactory.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/SymbolFactory.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/SymbolFactory.java	(revision 12191)
@@ -0,0 +1,121 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.3  2006-11-06 16:06:52  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/11/06 07:33:54  jaume
+* javadoc, source style
+*
+* Revision 1.1  2006/10/30 19:30:35  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.fmap.core.symbols;
+
+import com.iver.andami.messages.NotificationManager;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.utiles.NotExistInXMLEntity;
+import com.iver.utiles.XMLEntity;
+
+/**
+ * Factory for obtaining ISymbols of any kind from several sources like.
+ * <ol>
+ * 	<li>
+ * 		<b>XMLEntity's</b> that, at least, contains a full class name
+ * 			string property that defines which class handles such symbol.
+ *  </li>
+ * </ol>
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public class SymbolFactory {
+	/**
+	 * Factory that allows to create ISymbol from an ISymbol xml
+	 * descriptor. A barely specific XMLEntity object. The string passed in the
+	 * second argument is the description text that will be used in case no description
+	 * is supplied by the symbol
+	 */
+	public static ISymbol createFromXML(XMLEntity xml, String defaultDescription) {
+		String className = null;
+		try {
+			className = xml.getStringProperty("className");
+		} catch (NotExistInXMLEntity e) {
+			NotificationManager.
+				addError("Symbol class name not set.\n" +
+						" Maybe you forgot to add the" +
+						" putProperty(\"className\", yourClassName)" +
+						" call in the getXMLEntity method of your symbol", e);
+		}
+
+		if (!xml.contains("desc"))
+			xml.putProperty("desc", defaultDescription);
+
+		Class clazz = null;
+		ISymbol sym = null;
+
+		try {
+			clazz = Class.forName(className);
+			sym = (ISymbol) clazz.newInstance();
+			sym.setXMLEntity(xml);
+		} catch (InstantiationException e) {
+			NotificationManager.
+				addError("Trying to instantiate an interface" +
+						" or abstract class + "+className, e);
+		} catch (IllegalAccessException e) {
+			NotificationManager.addError(null, e);
+		} catch (ClassNotFoundException e) {
+			NotificationManager.addError("No class called " + className +
+					" was found.\nCheck the following.\n<br>" +
+					"\t- The fullname of the class you're looking " +
+						"for matches the value in the className " +
+						"property of the XMLEntity ("+className+").\n<br>" +
+					"\t- The jar file containing your symbol class is in" +
+						"the application classpath<br>", e);
+		}
+		return sym;
+	}
+}
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/SymbolFactory.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/MarkerFillSymbol.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/MarkerFillSymbol.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/MarkerFillSymbol.java	(revision 12191)
@@ -0,0 +1,283 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.10  2006-11-09 18:39:05  jaume
+* *** empty log message ***
+*
+* Revision 1.9  2006/11/09 10:22:50  jaume
+* *** empty log message ***
+*
+* Revision 1.8  2006/11/08 13:05:51  jaume
+* *** empty log message ***
+*
+* Revision 1.7  2006/11/08 10:56:47  jaume
+* *** empty log message ***
+*
+* Revision 1.6  2006/11/07 08:52:30  jaume
+* *** empty log message ***
+*
+* Revision 1.5  2006/11/06 17:08:45  jaume
+* *** empty log message ***
+*
+* Revision 1.4  2006/11/06 16:06:52  jaume
+* *** empty log message ***
+*
+* Revision 1.3  2006/11/06 07:33:54  jaume
+* javadoc, source style
+*
+* Revision 1.2  2006/10/31 16:16:34  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/30 19:30:35  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.fmap.core.symbols;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Dimension;
+import java.awt.Graphics2D;
+import java.awt.Paint;
+import java.awt.Rectangle;
+import java.awt.RenderingHints;
+import java.awt.Shape;
+import java.awt.TexturePaint;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+import java.awt.image.BufferedImage;
+import java.util.ArrayList;
+
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.utiles.StringUtilities;
+import com.iver.utiles.XMLEntity;
+
+public class MarkerFillSymbol extends AbstractFillSymbol {
+	private double rotation;
+	private AbstractMarkerSymbol markerSymbol = new CharacterMarkerSymbol();
+	private boolean grid = true;
+	private double xOffset = 0;
+	private double yOffset = 0;
+	private double xSeparation = 20;
+	private double ySeparation = 20;
+
+	public boolean isGrid() {
+		return grid;
+	}
+
+	public void setGrid(boolean grid) {
+		this.grid = grid;
+	}
+
+	public AbstractMarkerSymbol getMarkerSymbol() {
+		return markerSymbol;
+	}
+
+	public void setMarkerSymbol(AbstractMarkerSymbol markerSymbol) {
+		this.markerSymbol = markerSymbol;
+	}
+
+	public double getRotation() {
+		return rotation;
+	}
+
+	public void setRotation(double rotation) {
+		this.rotation = rotation;
+	}
+
+	public double getXOffset() {
+		return xOffset;
+	}
+
+	public void setXOffset(double offset) {
+		xOffset = offset;
+	}
+
+	public double getXSeparation() {
+		return xSeparation;
+	}
+
+	public void setXSeparation(double separation) {
+		xSeparation = separation;
+	}
+
+	public double getYOffset() {
+		return yOffset;
+	}
+
+	public void setYOffset(double offset) {
+		yOffset = offset;
+	}
+
+	public double getYSeparation() {
+		return ySeparation;
+	}
+
+	public void setYSeparation(double separation) {
+		ySeparation = separation;
+	}
+
+	public ISymbol getSymbolForSelection() {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+	}
+
+	public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp) {
+		g.setColor(null);
+		g.setStroke(new BasicStroke(0));
+		int w=7;
+		int h=7;
+
+		BufferedImage bi = null;
+
+
+		Rectangle rProv = new Rectangle();
+		rProv.setFrame(0, 0,w,h);
+
+		Paint resulPatternFill = null;
+		bi= new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
+		Graphics2D gAux = bi.createGraphics();
+		markerSymbol.drawInsideRectangle(gAux, new AffineTransform(), rProv);
+		resulPatternFill = new TexturePaint(bi,rProv);
+		g.setColor(null);
+		g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+				RenderingHints.VALUE_ANTIALIAS_ON);
+
+		g.setPaint(resulPatternFill);
+		g.fill(shp);
+		//g.draw(shp);
+		if (layers!=null)  {
+			for (int i = 0; i < layers.length; i++) {
+				layers[i].draw(g, affineTransform, shp);
+			}
+		}
+	}
+
+	public int getPixExtentPlus(Graphics2D g, AffineTransform affineTransform, Shape shp) {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+	}
+
+	public XMLEntity getXMLEntity() {
+		XMLEntity xml = new XMLEntity();
+		xml.putProperty("className", getClassName());
+		// color
+		xml.putProperty("color", StringUtilities.color2String(color));
+
+		xml.putProperty("rotation", rotation);
+		xml.putProperty("grid", grid);
+		xml.putProperty("xOffset", xOffset);
+		xml.putProperty("yOffset", yOffset);
+		xml.putProperty("xSeparation", xSeparation);
+		xml.putProperty("ySeparation", ySeparation);
+
+		xml.addChild(markerSymbol.getXMLEntity());
+		return xml;
+	}
+
+	public int getSymbolType() {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+	}
+
+	public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r) {
+		if (isGrid()) {
+			// Use a TexturePaint
+			int w=7;
+			int h=7;
+
+			BufferedImage bi = null;
+
+			Rectangle rProv = new Rectangle();
+			rProv.setFrame(0, 0,w,h);
+
+			Paint resulPatternFill = null;
+			bi= new BufferedImage(w, h, BufferedImage.TYPE_INT_ARGB);
+			Graphics2D gAux = bi.createGraphics();
+			markerSymbol.drawInsideRectangle(gAux, new AffineTransform(), rProv);
+			resulPatternFill = new TexturePaint(bi,rProv);
+			g.setColor(null);
+			g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
+					RenderingHints.VALUE_ANTIALIAS_ON);
+
+			g.setPaint(resulPatternFill);
+			g.fill(r);
+			g.drawRect(0, 0, r.width, r.height);
+		} else {
+			Point2D[] points = ramdonizePoints(r);
+			for (int i = 0; i < points.length; i++) {
+
+			}
+		}
+	}
+
+	private Point2D[] ramdonizePoints(Rectangle r) {
+		ArrayList points = new ArrayList();
+			throw new Error("Not yet implemented!");
+//		return (Point2D[]) points.toArray(new Point2D[0]);
+	}
+
+	public String getClassName() {
+		return getClass().getName();
+	}
+
+	public void setXMLEntity(XMLEntity xml) {
+		rotation = xml.getDoubleProperty("rotation");
+		grid = xml.getBooleanProperty("grid");
+		xOffset = xml.getDoubleProperty("xOffset");
+		yOffset = xml.getDoubleProperty("yOffset");
+		xSeparation = xml.getDoubleProperty("xSeparation");
+		ySeparation = xml.getDoubleProperty("ySeparation");
+		markerSymbol = (AbstractMarkerSymbol) SymbolFactory.
+							createFromXML(xml.getChild(0), null);
+	}
+
+	public void setMarker(AbstractMarkerSymbol marker) {
+		this.markerSymbol = marker;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/MarkerFillSymbol.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/AbstractFillSymbol.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/AbstractFillSymbol.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/AbstractFillSymbol.java	(revision 12191)
@@ -0,0 +1,126 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.6  2006-12-04 17:13:39  fjp
+* *** empty log message ***
+*
+* Revision 1.5  2006/11/14 11:10:27  jaume
+* *** empty log message ***
+*
+* Revision 1.4  2006/11/09 18:39:05  jaume
+* *** empty log message ***
+*
+* Revision 1.3  2006/11/06 07:33:54  jaume
+* javadoc, source style
+*
+* Revision 1.2  2006/10/31 16:16:34  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/30 19:30:35  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.fmap.core.symbols;
+
+import java.awt.Color;
+
+import javax.print.attribute.PrintRequestAttributeSet;
+
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+
+/**
+ * Abstract class that any FILL SYMBOL should extend
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ *
+ */
+public abstract class AbstractFillSymbol implements ISymbol {
+	Color color = Color.WHITE;
+	Color outline = Color.BLACK; // TODO aix� canviar� a AbsrtactLineSymbol quan existisca
+	protected boolean isShapeVisible;
+	protected String desc;
+	protected ISymbol[] layers;
+
+	public boolean isShapeVisible() {
+		return isShapeVisible;
+	}
+
+	public void setDescription(String desc) {
+		this.desc = desc;
+	}
+
+	public String getDescription() {
+		return desc;
+	}
+
+	public boolean isSuitableFor(IGeometry geom) {
+		return geom.getGeometryType() == FShape.POLYGON;
+	}
+
+	public ISymbol getLayer(int layerIndex) {
+		try{
+			return layers[layerIndex];
+		} catch (Exception e) {
+			return null;
+		}
+	}
+
+	public int getOnePointRgb() {
+		return outline.getRGB();
+	}
+
+	public ISymbol getLayerByIndex(int i) {
+		return layers[i];
+	}
+	
+	public void setPrintingProperties(PrintRequestAttributeSet printProperties) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/AbstractFillSymbol.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleMarkerSymbol.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleMarkerSymbol.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleMarkerSymbol.java	(revision 12191)
@@ -0,0 +1,123 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-11-14 11:10:27  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.fmap.core.symbols;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.utiles.StringUtilities;
+import com.iver.utiles.XMLEntity;
+
+public class SimpleMarkerSymbol extends AbstractMarkerSymbol {
+	private boolean outline;
+	private Color outlineColor;
+	private double outlineSize;
+
+
+	private ISymbol selectionSymbol;
+
+	public ISymbol getSymbolForSelection() {
+		if (selectionSymbol == null) {
+			XMLEntity xml = getXMLEntity();
+			xml.putProperty("color", StringUtilities.color2String(Color.YELLOW));
+			selectionSymbol = SymbolFactory.createFromXML(xml, getDescription() + " version for selection.");
+		}
+		return selectionSymbol;
+	}
+
+	public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp) {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+
+	}
+
+	public int getPixExtentPlus(Graphics2D g, AffineTransform affineTransform, Shape shp) {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+
+	}
+
+	public XMLEntity getXMLEntity() {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+
+	}
+
+	public int getSymbolType() {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+
+	}
+
+	public void drawInsideRectangle(Graphics2D g, AffineTransform scaleInstance, Rectangle r) {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+
+	}
+
+	public String getClassName() {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+
+	}
+
+	public void setXMLEntity(XMLEntity xml) {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+
+	}
+
+}
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleMarkerSymbol.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/DotDensityFillSymbol.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/DotDensityFillSymbol.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/DotDensityFillSymbol.java	(revision 12191)
@@ -0,0 +1,234 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.4  2006-11-14 11:10:27  jaume
+* *** empty log message ***
+*
+* Revision 1.3  2006/11/13 09:15:23  jaume
+* javadoc and some clean-up
+*
+* Revision 1.2  2006/11/09 18:39:05  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/11/09 10:22:50  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.fmap.core.symbols;
+
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+import java.util.Random;
+
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.utiles.StringUtilities;
+import com.iver.utiles.XMLEntity;
+
+/**
+ * <p>
+ * Symbol that draws a set of points within a polygon. The amount of points is
+ * defined by the field dotCount.<br>
+ * </p>
+ * <p>
+ * This symbol only draws the points. The outline and the fill of the polygon is
+ * handled by a SimpleFillSymboll where a DotDensityFillSymbol should be
+ * embedded.<br>
+ * </p>
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ *
+ */
+public class DotDensityFillSymbol extends AbstractFillSymbol {
+	private int  dotCount;
+	private double dotSize;
+	private double dotSpacing;
+	private boolean fixedPlacement;
+	public DotDensityFillSymbol() {
+		super();
+		isShapeVisible = true;
+	}
+
+	public ISymbol getSymbolForSelection() {
+		return this; // the selection color is applied in the SimpleFillSymbol
+	}
+
+	public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp) {
+		int width = shp.getBounds().width;
+		int height = shp.getBounds().height;
+		int minx = shp.getBounds().x;
+		int miny = shp.getBounds().y;
+		Random random = new Random();
+		g.setClip(shp);
+		g.setColor(color);
+		g.setBackground(null);
+		int size = (int) dotSize;
+		for (int i = 0; i < dotCount; i++) {
+			int x = (int) Math.abs(random.nextDouble() * width);
+			int y = (int) Math.abs(random.nextDouble() * height);
+			x = x + minx;
+			y = y + miny;
+			g.fillRect(x, y, size, size);
+		}
+		g.setClip(null);
+	}
+
+	public int getPixExtentPlus(Graphics2D g, AffineTransform affineTransform,
+			Shape shp) {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+	}
+
+	public XMLEntity getXMLEntity() {
+		XMLEntity xml = new XMLEntity();
+		xml.putProperty("className", getClassName());
+
+		// color
+		xml.putProperty("color", StringUtilities.color2String(color));
+
+		// description
+		xml.putProperty("desc", desc);
+
+		// is shape visible
+		xml.putProperty("isShapeVisible", isShapeVisible);
+
+		// dot count
+		xml.putProperty("dotCount", dotCount);
+
+		// dot size
+		xml.putProperty("dotSize", dotSize);
+
+		// dot spacing
+		xml.putProperty("dotSpacing", dotSpacing);
+
+		return xml;
+	}
+
+	public int getSymbolType() {
+		return FShape.POLYGON;
+	}
+
+	public void drawInsideRectangle(Graphics2D g,
+			AffineTransform scaleInstance, Rectangle r) {
+		int x = r.x;
+		int y = r.y;
+		int width = r.width;
+		int height= r.height;
+		int size = height / 8;
+		g.setColor(color);
+		g.setBackground(null);
+		g.fillRect((int) (x+height*0.2), (int) (y+width*0.2), size, size);
+		g.fillRect((int) (x+height*0.25), (int) (y+width*0.7), size, size);
+		g.fillRect((int) (x+height*0.65), (int) (y+width*0.5), size, size);
+		g.fillRect((int) (x+height*0.8), (int) (y+width*0.1), size, size);
+		g.fillRect((int) (x+height*0.8), (int) (y+width*0.8), size, size);
+		g.fillRect((int) (x+height*0.9), (int) (y+width*0.3), size, size);
+		g.fillRect((int) (x+height*1.1), (int) (y+width*0.8), size, size);
+	}
+
+	public String getClassName() {
+		return getClass().getName();
+	}
+
+	public void setXMLEntity(XMLEntity xml) {
+		// color
+		color = StringUtilities.string2Color(xml.getStringProperty("color"));
+
+		// description
+		desc = xml.getStringProperty("desc");
+
+		// is shape visible
+		isShapeVisible = xml.getBooleanProperty("isShapeVisible");
+
+		// dot count
+		dotCount = xml.getIntProperty("dotCount");
+
+		// dot size
+		dotSize = xml.getDoubleProperty("dotSize");
+
+		// dot spacing
+		dotSpacing = xml.getDoubleProperty("dotSpacing");
+
+		layers = new ISymbol[xml.getChildrenCount()];
+
+	}
+
+	public int getDotCount() {
+		return dotCount;
+	}
+
+	public void setDotCount(int dotCount) {
+		this.dotCount = dotCount;
+	}
+
+	public double getDotSize() {
+		return dotSize;
+	}
+
+	public void setDotSize(double dotSize) {
+		this.dotSize = dotSize;
+	}
+
+	public double getDotSpacing() {
+		return dotSpacing;
+	}
+
+	public void setDotSpacing(double dotSpacing) {
+		this.dotSpacing = dotSpacing;
+	}
+
+	public Color getDotColor() {
+		return color;
+	}
+
+	public void setDotColor(Color dotColor) {
+		this.color = dotColor;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/DotDensityFillSymbol.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/CharacterMarkerSymbol.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/CharacterMarkerSymbol.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/CharacterMarkerSymbol.java	(revision 12191)
@@ -0,0 +1,306 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.6  2006-12-04 17:13:39  fjp
+ * *** empty log message ***
+ *
+ * Revision 1.5  2006/11/14 11:10:27  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.4  2006/11/09 18:39:05  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.3  2006/11/08 10:56:47  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.2  2006/11/06 17:08:45  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.1  2006/10/31 16:16:34  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.4  2006/10/30 19:30:35  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.3  2006/10/29 23:53:49  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.2  2006/10/26 16:27:33  jaume
+ * support for composite marker symbols (not tested)
+ *
+ * Revision 1.1  2006/10/25 10:50:41  jaume
+ * movement of classes and gui stuff
+ *
+ * Revision 1.3  2006/10/24 19:54:16  jaume
+ * added IPersistence
+ *
+ * Revision 1.2  2006/10/24 08:02:51  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.1  2006/10/18 07:54:06  jaume
+ * *** empty log message ***
+ *
+ *
+ */
+package com.iver.cit.gvsig.fmap.core.symbols;
+
+import java.awt.Color;
+import java.awt.Font;
+import java.awt.Graphics2D;
+import java.awt.Point;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+import java.awt.geom.Point2D;
+
+import javax.print.attribute.PrintRequestAttributeSet;
+
+import org.apache.batik.ext.awt.geom.PathLength;
+
+import com.iver.cit.gvsig.fmap.core.FPoint2D;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.cit.gvsig.fmap.core.v02.FConstant;
+import com.iver.cit.gvsig.fmap.core.v02.FConverter;
+import com.iver.utiles.StringUtilities;
+import com.iver.utiles.XMLEntity;
+import com.vividsolutions.jts.geom.Geometry;
+
+
+// TODO quitar batik-util.jar del classpath de extGraph cuando movamos esto a FMap
+/**
+ * Symbol that manages symbols from a TrueType font source
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public class CharacterMarkerSymbol extends AbstractMarkerSymbol {
+	private Font font = new Font("Arial", Font.PLAIN, 20);
+	private int symbol;
+	private ISymbol selectionSymbol;
+
+	/**
+	 * Creates a new instance of CharacterMarker with default values
+	 *
+	 */
+	public CharacterMarkerSymbol() {
+		super();
+	}
+
+	/**
+	 * Creates a new instance of CharacterMarker specifying the marker source
+	 * font, the character code corresponding to the symbol, and the color that
+	 * will be used in rendering time.
+	 *
+	 * @param font -
+	 *            src Font
+	 * @param charCode -
+	 *            character code of the symbol for this font
+	 * @param color -
+	 *            color to be used in when rendering.
+	 */
+	public CharacterMarkerSymbol(Font font, int charCode, Color color) {
+		super();
+		this.font = font;
+		symbol = charCode;
+		this.color = color;
+	}
+
+	public Font getFont() {
+		return font;
+	}
+
+	public void setFont(Font font) {
+		this.font = font;
+	}
+
+	public ISymbol getSymbolForSelection() {
+		if (selectionSymbol == null) {
+			XMLEntity xml = getXMLEntity();
+			xml.putProperty("color", StringUtilities.color2String(Color.YELLOW));
+			selectionSymbol = SymbolFactory.createFromXML(xml, getDescription() + " version for selection.");
+		}
+		return selectionSymbol;
+	}
+
+	public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp) {
+		g.setFont(getFont());
+		g.setColor(color);
+		g.rotate(getRotation());
+		Point2D p = null;
+		switch (shp.getShapeType()) {
+		case FShape.POINT:
+			p = new Point2D.Double(((FPoint2D) shp).getX(), ((FPoint2D) shp)
+					.getY());
+			break;
+		case FShape.LINE:
+			PathLength pathLen = new PathLength(shp);
+			float midDistance = pathLen.lengthOfPath() / 2;
+			p = pathLen.pointAtLength(midDistance);
+			break;
+		case FShape.POLYGON:
+			Geometry geom = FConverter.java2d_to_jts(shp);
+			com.vividsolutions.jts.geom.Point centroid = geom.getCentroid();
+			p = new Point2D.Double(centroid.getX(), centroid.getY());
+		}
+		// p = affineTransform.transform(p, null);
+
+		char[] text = new char[] { (char) symbol };
+		g.drawChars(text, 0, text.length, (int) p.getX(), (int) p.getY());
+
+		if (subSymbols!=null) {
+			for (int i = 0; i < subSymbols.length; i++) {
+				subSymbols[i].draw(g, affineTransform, shp);
+			}
+		}
+	}
+
+	public int getPixExtentPlus(Graphics2D g, AffineTransform affineTransform,
+			Shape shp) {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+	}
+
+	public XMLEntity getXMLEntity() {
+		XMLEntity xml = new XMLEntity();
+
+		// the class name
+		xml.putProperty("className", getClassName());
+
+		// color
+		xml.putProperty("color", StringUtilities.color2String(color));
+
+		// font
+		xml.putProperty("font", font.getFontName());
+
+		// font style
+		xml.putProperty("fontStyle", font.getStyle());
+
+		// symbol code
+		xml.putProperty("symbolCode", symbol);
+
+		// description
+		xml.putProperty("desc", desc);
+
+		// is shape visible
+		xml.putProperty("isShapeVisible", isShapeVisible);
+
+		// x offset
+		xml.putProperty("xOffset", getOffset().getX());
+
+		// y offset
+		xml.putProperty("yOffset", getOffset().getY());
+
+		// rotation
+		xml.putProperty("rotation", rotation);
+		return xml;
+	}
+
+	public int getSymbolType() {
+		return CHARACTER_MARKER;
+	}
+
+	public void drawInsideRectangle(Graphics2D g,
+			AffineTransform scaleInstance, Rectangle r) {
+		g.rotate(getRotation());
+		// Sirve de algo el scaleInstance???
+		// g.setFont(font.deriveFont(scaleInstance));
+		double h = r.getHeight();
+		Font myFont = font.deriveFont(
+				(float) (h * FConstant.FONT_HEIGHT_SCALE_FACTOR)).deriveFont(
+						scaleInstance);
+		g.setFont(myFont);
+		g.setColor(color);
+		r.y = (int) h;
+
+		// center character in case the rectangle is not square
+		int x = r.x;
+		int y = r.y;
+		int width = (int) r.getHeight();
+		int height = (int) r.getWidth();
+		int diff = (width-height);
+		if (diff<0) {
+			x -= diff /2;
+		} else {
+			y += diff /2;
+		}
+
+		// and apply the offset
+		x = x + (int) offset.getX(); // TODO scale offset
+		y = y + (int) offset.getY(); // TODO scale offset
+		char[] text = new char[] { (char) symbol };
+		g.drawChars(text, 0, text.length, x, y);
+
+		// finally, draw the subsymbols if any
+		if (subSymbols!=null) {
+			for (int i = 0; i < subSymbols.length; i++) {
+				subSymbols[i].drawInsideRectangle(g, scaleInstance, r);
+			}
+		}
+	}
+
+	public void setCharacter(int symbol) {
+		this.symbol = symbol;
+	}
+
+	public String getClassName() {
+		return this.getClass().getName();
+	}
+
+	public void setXMLEntity(XMLEntity xml) {
+		color = StringUtilities.string2Color(xml.getStringProperty("color"));
+		Point p = new Point();
+		p.setLocation(xml.getDoubleProperty("xOffset"), xml.getDoubleProperty("yOffset"));
+
+		desc = xml.getStringProperty("desc");
+		font = new Font(xml.getStringProperty("font"),
+				xml.getIntProperty("fontStyle"),
+				100 /* or whatever*/);
+		isShapeVisible = xml.getBooleanProperty("isShapeVisible");
+		symbol = xml.getIntProperty("symbolCode");
+		offset = p;
+		rotation = xml.getDoubleProperty("rotation");
+
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/CharacterMarkerSymbol.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleFillSymbol.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleFillSymbol.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleFillSymbol.java	(revision 12191)
@@ -0,0 +1,192 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.7  2006-11-14 11:10:27  jaume
+* *** empty log message ***
+*
+* Revision 1.6  2006/11/09 18:39:05  jaume
+* *** empty log message ***
+*
+* Revision 1.5  2006/11/09 10:22:50  jaume
+* *** empty log message ***
+*
+* Revision 1.4  2006/11/08 13:05:51  jaume
+* *** empty log message ***
+*
+* Revision 1.3  2006/11/08 10:56:47  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/11/06 16:06:52  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/30 19:30:35  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.fmap.core.symbols;
+
+import java.awt.BasicStroke;
+import java.awt.Color;
+import java.awt.Graphics2D;
+import java.awt.Rectangle;
+import java.awt.Shape;
+import java.awt.geom.AffineTransform;
+
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.utiles.StringUtilities;
+import com.iver.utiles.XMLEntity;
+
+/**
+ * Basic fill symbol. It will allow to paint a shape with its filling color (and transparency)
+ * and the outline.
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ *
+ */
+public class SimpleFillSymbol extends AbstractFillSymbol {
+	private SimpleFillSymbol symbolForSelection;
+
+	public ISymbol getSymbolForSelection() {
+		if (symbolForSelection == null) {
+			XMLEntity xml = getXMLEntity();
+			xml.putProperty("color", StringUtilities.color2String(Color.YELLOW));
+			symbolForSelection = (SimpleFillSymbol) SymbolFactory.
+					createFromXML(xml, getDescription()+" version for selection");
+		}
+		return symbolForSelection;
+	}
+
+	public void draw(Graphics2D g, AffineTransform affineTransform, FShape shp) {
+		g.setColor(color);
+		g.fill(shp);
+		g.setColor(outline);
+		g.setStroke(new BasicStroke(1));
+		g.draw(shp);
+		for (int i = 0; i < layers.length; i++) {
+			layers[i].draw(g, affineTransform, shp);
+		}
+	}
+
+	public int getPixExtentPlus(Graphics2D g, AffineTransform affineTransform,
+			Shape shp) {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+	}
+
+	public XMLEntity getXMLEntity() {
+		XMLEntity xml = new XMLEntity();
+
+		// the class name
+		xml.putProperty("className", getClassName());
+
+		// color
+		xml.putProperty("color", StringUtilities.color2String(color));
+
+		// outline
+		xml.putProperty("outline", StringUtilities.color2String(outline));
+
+		// description
+		xml.putProperty("desc", desc);
+
+		// is shape visible
+		xml.putProperty("isShapeVisible", isShapeVisible);
+
+		// layers
+		if (layers!=null)
+			for (int i = 0; i < layers.length; i++) {
+				xml.addChild(layers[i].getXMLEntity());
+			}
+		return xml;
+	}
+
+	public int getSymbolType() {
+		// TODO Auto-generated method stub
+		throw new Error("Not yet implemented!");
+	}
+
+	public void drawInsideRectangle(Graphics2D g,
+			AffineTransform scaleInstance, Rectangle r) {
+		int height = (int) r.getHeight();
+		int width = (int) r.getWidth();
+		g.setColor(color);
+		for (int i = 0; i < height; i++) {
+			g.drawLine(0, i, width, i);
+		}
+		g.setColor(outline);
+		// TODO canviar esto per draw de AbstractLineSymbol
+		g.drawRect(0, 0, width, height);
+
+
+		r.setFrame(((int) r.getMinX())+1, ((int) r.getMinY())+1, ((int) r.getMaxX())-1, ((int) r.getMaxY())-1);
+		for (int i = 0; layers != null && i < layers.length; i++) {
+			layers[i].drawInsideRectangle(g, scaleInstance, r);
+		}
+	}
+
+	public String getClassName() {
+		return getClass().getName();
+	}
+
+	public void setXMLEntity(XMLEntity xml) {
+		// color
+		color = StringUtilities.string2Color(xml.getStringProperty("color"));
+
+		// outline
+		outline = StringUtilities.string2Color(xml.getStringProperty("outline"));
+
+		// description
+		desc = xml.getStringProperty("desc");
+
+		// is shape visible
+		isShapeVisible = xml.getBooleanProperty("isShapeVisible");
+
+		// layers
+		layers = new ISymbol[xml.getChildrenCount()];
+		for (int i = 0; i < layers.length; i++) {
+			layers[i] = SymbolFactory.createFromXML(xml.getChild(i), null);
+		}
+	}
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/SimpleFillSymbol.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/AbstractMarkerSymbol.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/AbstractMarkerSymbol.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/AbstractMarkerSymbol.java	(revision 12191)
@@ -0,0 +1,177 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.4  2006-12-04 17:13:39  fjp
+* *** empty log message ***
+*
+* Revision 1.3  2006/11/14 11:10:27  jaume
+* *** empty log message ***
+*
+* Revision 1.2  2006/11/09 18:39:05  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/31 16:16:34  jaume
+* *** empty log message ***
+*
+* Revision 1.4  2006/10/30 19:30:35  jaume
+* *** empty log message ***
+*
+* Revision 1.3  2006/10/26 16:27:33  jaume
+* support for composite marker symbols (not tested)
+*
+* Revision 1.2  2006/10/26 07:46:58  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/10/25 10:50:41  jaume
+* movement of classes and gui stuff
+*
+* Revision 1.1  2006/10/18 07:54:06  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.fmap.core.symbols;
+
+import java.awt.Color;
+import java.awt.Point;
+import java.awt.geom.Point2D;
+import java.util.ArrayList;
+
+import javax.print.attribute.PrintRequestAttributeSet;
+
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+
+/**
+ * Abstract class that any MARKER SYMBOL should extend.
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ */
+public abstract class AbstractMarkerSymbol implements ISymbol {
+	protected Color color = Color.BLACK;
+	protected boolean isShapeVisible = true;
+	protected String desc;
+	protected double rotation;
+	protected Point2D offset;
+	protected ISymbol[] subSymbols; // TODO maybe push it up to ISymbol
+
+	public String getDescription() {
+		return desc;
+	}
+
+	public boolean isShapeVisible() {
+		return isShapeVisible;
+	}
+	public void setDescription(String desc) {
+		this.desc = desc;
+	}
+
+	public double getRotation() {
+		return rotation;
+	}
+
+	public void setRotation(double r) {
+		this.rotation = r;
+	}
+	public Point2D getOffset() {
+		if (offset == null) {
+			offset = new Point();
+		}
+		return offset;
+	}
+
+	public void setOffset(Point offset) {
+		this.offset = offset;
+	}
+
+	/**
+	 * TODO maybe push it up to ISymbol
+	 * @param sym
+	 */
+	public void addSymbol(ISymbol sym) {
+		int capacity = 0;
+		if (subSymbols != null)
+			capacity = subSymbols.length;
+		ArrayList lst = new ArrayList(capacity);
+		for (int i = 0; i < capacity; i++) {
+			lst.add(subSymbols[i]);
+		}
+		subSymbols = (ISymbol[])lst.toArray(new ISymbol[0]);
+	}
+
+	/**
+	 * TODO maybe push it up to ISymbol
+	 * @param sym
+	 * @return true if this symbol contains the removed one
+	 */
+	public boolean removeSymbol(ISymbol sym) {
+
+		int capacity = 0;
+		if (subSymbols != null)
+			capacity = subSymbols.length;
+		ArrayList lst = new ArrayList(capacity);
+		for (int i = 0; i < capacity; i++) {
+			lst.add(subSymbols[i]);
+		}
+		boolean contains = lst.remove(sym);
+		subSymbols = (ISymbol[])lst.toArray(new ISymbol[0]);
+		return contains;
+	}
+
+	public boolean isSuitableFor(IGeometry geom) {
+		return geom.getGeometryType() == FShape.POINT;
+	}
+
+	public int getOnePointRgb() {
+		return color.getRGB();
+	}
+	
+	public void setPrintingProperties(PrintRequestAttributeSet printProperties) {
+		// TODO Auto-generated method stub
+		
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/core/symbols/AbstractMarkerSymbol.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/rendering/DotDensityLegend.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/rendering/DotDensityLegend.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/rendering/DotDensityLegend.java	(revision 12191)
@@ -0,0 +1,148 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.2  2006-11-17 12:49:58  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/11/14 12:30:26  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.fmap.rendering;
+
+import java.awt.Color;
+
+import com.hardcode.gdbms.engine.values.NumericValue;
+import com.hardcode.gdbms.engine.values.Value;
+import com.iver.cit.gvsig.fmap.core.IFeature;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.cit.gvsig.fmap.core.symbols.DotDensityFillSymbol;
+import com.iver.cit.gvsig.fmap.core.symbols.SimpleFillSymbol;
+import com.iver.cit.gvsig.fmap.core.symbols.SymbolFactory;
+import com.iver.utiles.StringUtilities;
+import com.iver.utiles.XMLEntity;
+
+
+public class DotDensityLegend extends VectorialUniqueValueLegend {
+
+
+    private double dotValue;
+
+    public ISymbol getSymbolByValue(Value key) {
+        SimpleFillSymbol sym = (SimpleFillSymbol) getDefaultSymbol();
+        ((DotDensityFillSymbol) sym.getLayerByIndex(0)).
+            setDotCount((int) (((NumericValue) key).doubleValue()/dotValue));
+        return sym;
+    }
+
+    public ISymbol getSymbolByFeature(IFeature feat) {
+        return getSymbolByValue(feat.getAttribute(fieldId));
+    }
+
+    public void setDotValue(double dotValue) {
+        this.dotValue = dotValue;
+    }
+
+    public XMLEntity getXMLEntity() {
+        XMLEntity xml = new XMLEntity();
+        xml.putProperty("className", getClass().getName());
+        xml.putProperty("dotValue", dotValue);
+        xml.putProperty("fieldName", getFieldName());
+        xml.addChild(getDefaultSymbol().getXMLEntity());
+        return xml;
+    }
+
+    public void setXMLEntity(XMLEntity xml) {
+        dotValue = xml.getDoubleProperty("dotValue");
+        setFieldName(xml.getStringProperty("fieldName"));
+        setDefaultSymbol(SymbolFactory.createFromXML(xml.getChild(0), null));
+    }
+
+    public Color getOutlineColor() {
+    	try {
+            XMLEntity xml = getDefaultSymbol().getXMLEntity();
+        	return StringUtilities.string2Color(xml.getStringProperty("outline"));
+        } catch (NullPointerException npE) {
+        	return null;
+        }
+    }
+
+    public Color getDotColor() {
+    	try {
+            XMLEntity xml = getDefaultSymbol().getXMLEntity().getChild(0);
+        	return StringUtilities.string2Color(xml.getStringProperty("color"));
+        } catch (NullPointerException npE) {
+        	return null;
+        }
+    }
+
+    public Color getBGColor() {
+    	try {
+            XMLEntity xml = getDefaultSymbol().getXMLEntity();
+        	return StringUtilities.string2Color(xml.getStringProperty("color"));
+        } catch (NullPointerException npE) {
+        	return null;
+        }
+    }
+
+    public double getDotValue() {
+    	try {
+        	XMLEntity xml = getXMLEntity();
+    		return xml.getDoubleProperty("dotValue");
+    	} catch (NullPointerException npE) {
+    		return 0;
+    	}
+    }
+
+    public double getDotSize() {
+    	try {
+    		XMLEntity xml = getDefaultSymbol().getXMLEntity().getChild(0);
+    		return xml.getDoubleProperty("dotSize");
+    	} catch (NullPointerException npE) {
+    		return -1; // TODO define default
+    	}
+    }
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/rendering/DotDensityLegend.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/layers/LayerListenerAdapter.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/layers/LayerListenerAdapter.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/layers/LayerListenerAdapter.java	(revision 12191)
@@ -0,0 +1,104 @@
+/*
+ * Created on 06-nov-2006
+ *
+ * gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.1  2006-11-07 19:49:55  azabala
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.fmap.layers;
+
+/**
+ * Empty implementation of LayerCollectionListener
+ * 
+ * (allows to extending classes to implements only interesting
+ * methods, for example, only listen for layer selection events)
+ * 
+ * */
+public class LayerListenerAdapter implements LayerCollectionListener, LayerListener {
+
+	public void layerAdded(LayerCollectionEvent e) {
+	}
+
+	public void layerMoved(LayerPositionEvent e) {
+	}
+
+	public void layerRemoved(LayerCollectionEvent e) {
+	}
+
+	public void layerAdding(LayerCollectionEvent e) throws CancelationException {
+	}
+
+	public void layerMoving(LayerPositionEvent e) throws CancelationException {
+	}
+
+	public void layerRemoving(LayerCollectionEvent e)
+			throws CancelationException {
+	}
+
+	public void activationChanged(LayerCollectionEvent e)
+			throws CancelationException {
+	}
+
+	public void visibilityChanged(LayerCollectionEvent e)
+			throws CancelationException {
+	}
+
+	public void visibilityChanged(LayerEvent e) {
+	}
+
+	public void activationChanged(LayerEvent e) {
+	}
+
+	public void nameChanged(LayerEvent e) {
+	}
+
+	public void editionChanged(LayerEvent e) {
+	}
+
+}
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/fmap/layers/LayerListenerAdapter.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/SymbolTest.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/SymbolTest.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/SymbolTest.java	(revision 12191)
@@ -0,0 +1,154 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.plugins.Extension;
+import com.iver.andami.preferences.IPreference;
+import com.iver.andami.preferences.IPreferenceExtension;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.IGeometry;
+import com.iver.cit.gvsig.fmap.core.ISymbol;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.GraphicLayer;
+import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
+import com.iver.cit.gvsig.fmap.rendering.FGraphic;
+import com.iver.cit.gvsig.graph.preferences.RoutePage;
+import com.iver.cit.gvsig.gvsig.gui.styling.SymbolSelector;
+import com.iver.cit.gvsig.project.documents.view.gui.View;
+
+public class SymbolTest extends Extension implements IPreferenceExtension{
+	private static final IPreference thePreferencePage = new RoutePage();
+
+	public void initialize() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void execute(String actionCommand) {
+		IWindow w = PluginServices.getMDIManager().getActiveWindow();
+
+		View v = (View) w;
+		MapControl mCtrl = v.getMapControl();
+		MapContext mc = mCtrl.getMapContext();
+
+		GraphicLayer graphicLayer = mc.getGraphicsLayer();
+
+
+		if (actionCommand.equals("DALE!")) {
+			FLayer lyr = null;
+
+			SymbolSelector symSel = new SymbolSelector(null, FShape.POLYGON);
+			PluginServices.getMDIManager().addWindow(symSel);
+			ISymbol sym = symSel.getSymbol();
+//			DotDensityFillSymbol sym = new DotDensityFillSymbol();
+//			sym.setDotColor(Color.RED);
+//			sym.setDotCount(20);
+//			sym.setDotSize(2);
+
+			FLayer[] actives = mc.getLayers().getActives();
+			for (int i = 0; i < actives.length; i++) {
+				if (actives[i] instanceof FLyrVect)
+					lyr = actives[i];
+			}
+			if (lyr == null) {
+				System.err.println("no hay capas");
+				return;
+			}
+			FLyrVect l = (FLyrVect) lyr;
+			int idSymbol = graphicLayer.addSymbol(sym);
+			graphicLayer.clearAllGraphics();
+			try {
+				SelectableDataSource sds = l.getRecordset();
+				long rows = sds.getRowCount();
+				for (int i = 0; i < rows; i++) {
+					IGeometry geom = l.getSource().getShape(i);
+					System.err.println(i+") "+geom.toString());
+					FGraphic gra = new FGraphic(geom, idSymbol);
+					graphicLayer.addGraphic(gra);
+				}
+
+
+			} catch (DriverException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			} catch (DriverIOException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+			mCtrl.drawGraphics();
+		} else if (actionCommand.equals("CLEAN_GRAPHICS")) {
+			graphicLayer.clearAllGraphics();
+		}
+	}
+
+	public boolean isEnabled() {
+		return true;
+	}
+
+	public boolean isVisible() {
+		IWindow w = PluginServices.getMDIManager().getActiveWindow();
+		try {
+			View v = (View) w;
+			MapContext mc = v.getMapControl().getMapContext();
+			FLayer[] actives = mc.getLayers().getActives();
+			for (int i = 0; i < actives.length; i++) {
+				if (actives[i] instanceof FLyrVect)
+					return true;
+			}
+		} catch (Exception e) {}
+		return false;
+	}
+
+	public IPreference getPreferencesPage() {
+		return thePreferencePage;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/SymbolTest.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/legend/gui/FThemeManagerWindow2.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/legend/gui/FThemeManagerWindow2.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/legend/gui/FThemeManagerWindow2.java	(revision 12191)
@@ -0,0 +1,553 @@
+package com.iver.cit.gvsig.project.documents.view.legend.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Component;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileReader;
+import java.io.FileWriter;
+import java.text.NumberFormat;
+import java.text.ParseException;
+
+import javax.swing.JButton;
+import javax.swing.JDialog;
+import javax.swing.JFileChooser;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.JTabbedPane;
+
+import org.exolab.castor.xml.MarshalException;
+import org.exolab.castor.xml.Marshaller;
+import org.exolab.castor.xml.ValidationException;
+
+import com.hardcode.gdbms.engine.data.DataSource;
+import com.hardcode.gdbms.engine.instruction.FieldNotFoundException;
+import com.iver.andami.PluginServices;
+import com.iver.andami.messages.NotificationManager;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.andami.ui.mdiManager.WindowInfo;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.drivers.DriverIOException;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLayers;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.XMLException;
+import com.iver.cit.gvsig.fmap.layers.layerOperations.AlphanumericData;
+import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial;
+import com.iver.cit.gvsig.fmap.rendering.ClassifiedLegend;
+import com.iver.cit.gvsig.fmap.rendering.Legend;
+import com.iver.cit.gvsig.fmap.rendering.LegendFactory;
+import com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend;
+import com.iver.cit.gvsig.fmap.rendering.VectorialLegend;
+import com.iver.cit.gvsig.gui.panels.LinkPanel;
+import com.iver.cit.gvsig.project.documents.view.IProjectView;
+import com.iver.cit.gvsig.project.documents.view.legend.CreateSpatialIndexMonitorableTask;
+import com.iver.cit.gvsig.project.documents.view.legend.scale.gui.FPanelScaleManager;
+import com.iver.utiles.GenericFileFilter;
+import com.iver.utiles.XMLEntity;
+import com.iver.utiles.swing.threads.IMonitorableTask;
+import com.iver.utiles.xmlEntity.generate.XmlTag;
+
+/**
+ * @author jmorell (jose.morell@gmail.com)
+ * @version 24-ene-2005
+ */
+public final class FThemeManagerWindow2 extends AbstractPanel implements IWindow {
+	private MapContext mapContext;
+	private FLayer layer;
+    private Legend renderer; // Le asignaremos la leyenda del primer tema activo.
+	private FPanelScaleManager fPanelScaleManager;
+    private FPanelLegendManager2 fPanelLegendManager;
+    private LinkPanel linkPanel;
+    private JTabbedPane organizador = new JTabbedPane();  //  @jve:decl-index=0:
+    private ComandosListener m_actionListener = new ComandosListener(this);
+	//private ProjectView view;
+	private NumberFormat nf = NumberFormat.getInstance();
+
+    /**
+     * Creates new form JPanel
+     */
+    public FThemeManagerWindow2() {
+        initialize();
+		this.setSize(650, 420);
+    }
+
+    /**
+     * Sobrecarga del constructor. Este se utiliza cuando se llama a este
+     * di�logo desde la barra de comandos.
+     *
+     */
+    public FThemeManagerWindow2(FLayer l, MapContext fMap) {
+    	initialize();
+    	layer = l;
+    	mapContext = fMap;
+		try {
+			ClassifiableVectorial aux = (ClassifiableVectorial) layer;
+			renderer = (Legend) aux.getLegend().cloneLegend();
+			fPanelScaleManager.setMapContext(mapContext);
+			fPanelLegendManager.setMapContext(mapContext);
+		} catch (XMLException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (DriverException e1) {
+			// TODO Auto-generated catch block
+			e1.printStackTrace();
+		}
+
+        fPanelScaleManager.setLayer(layer, renderer);
+        fPanelLegendManager.setLayer(layer, renderer);
+
+        organizador.setSelectedIndex(0);
+
+		this.setSize(650, 420);
+    }
+
+	/**
+	 * This method initializes this
+	 *
+	 * @return void
+	 */
+	private  void initialize() {
+
+		fPanelScaleManager = new FPanelScaleManager();
+		fPanelLegendManager = new FPanelLegendManager2();
+
+		organizador.addTab(PluginServices.getText(this,"General"), fPanelScaleManager);
+		organizador.addTab(PluginServices.getText(this,"Simbologia"), fPanelLegendManager);
+
+        JPanel panelButtons = new JPanel();
+
+        JButton btnAceptar = new JButton(PluginServices.getText(this,"Aceptar"));
+        btnAceptar.setActionCommand("OK");
+        btnAceptar.addActionListener(m_actionListener);
+
+        JButton btnApply = new JButton(PluginServices.getText(this,"Aplicar"));
+        btnApply.setActionCommand("APPLY");
+        btnApply.addActionListener(m_actionListener);
+
+        JButton btnSaveLegend = new JButton(PluginServices.getText(this,"Guardar_leyenda")+"...");
+        btnSaveLegend.setActionCommand("SAVE_LEGEND");
+        btnSaveLegend.addActionListener(m_actionListener);
+
+        JButton btnLoadLegend = new JButton(PluginServices.getText(this,"Recuperar_leyenda")+"...");
+        btnLoadLegend.setActionCommand("LOAD_LEGEND");
+        btnLoadLegend.addActionListener(m_actionListener);
+
+        JButton btnCancelar = new JButton(PluginServices.getText(this,"Cerrar"));
+        btnCancelar.setActionCommand("CANCEL");
+        btnCancelar.addActionListener(m_actionListener);
+
+        panelButtons.add(btnApply, null);
+
+		setLayout(new BorderLayout());
+		panelButtons.setLayout(null);
+		organizador.setPreferredSize(new java.awt.Dimension(640,390));
+		btnAceptar.setBounds(9, 5, 89, 23);
+		btnApply.setBounds(107, 5, 89, 23);
+		btnSaveLegend.setBounds(205, 5, 159, 23);
+		btnLoadLegend.setBounds(373, 5, 159, 23);
+		btnCancelar.setBounds(541, 5, 89, 23);
+		panelButtons.setPreferredSize(new java.awt.Dimension(493,33));
+		add(organizador, java.awt.BorderLayout.NORTH);
+		panelButtons.add(btnAceptar, null);
+		add(panelButtons, java.awt.BorderLayout.SOUTH);
+		panelButtons.add(btnSaveLegend, null);
+		panelButtons.add(btnLoadLegend, null);
+		panelButtons.add(btnCancelar, null);
+	}
+
+
+
+    /**
+     * En esta funci�n se coge el primer tema activo del TOC y se usa su
+     * renderer para inicializar. Hay que llamarla SIEMPRE que se abra el
+     * cuadro de di�logo, en el  openLegendManager() de la vista.
+     *
+     * @param mapContext TOC que abre este cuadro de di�logo.
+     * @throws DriverException
+     */
+    public void setMapContext(MapContext mapContext) throws DriverException {
+        this.mapContext = mapContext;
+        layer = getFirstActiveLayerVect(mapContext.getLayers());
+		try {
+			ClassifiableVectorial aux = (ClassifiableVectorial) layer;
+			renderer = (Legend) aux.getLegend().cloneLegend();
+		} catch (XMLException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+		fPanelScaleManager.setMapContext(mapContext);
+		fPanelLegendManager.setMapContext(mapContext);
+        actualizar();
+    }
+
+    /**
+     * DOCUMENT ME!
+     */
+    private void actualizar() {
+    	FLayer lyrSelected = getFirstActiveLayerVect(mapContext.getLayers());
+
+        fPanelScaleManager.setLayer(lyrSelected, renderer);
+        fPanelLegendManager.setLayer(lyrSelected, renderer);
+
+        organizador.setSelectedIndex(0);
+    }
+
+    private void btnApply_actionPerformed(ActionEvent evt) {
+       // ClassifiableVectorial aux = (ClassifiableVectorial) layer;
+
+    	switch (fPanelLegendManager.getVisibleCard()) {
+        case 0: // default symbol
+            renderer = fPanelLegendManager.getM_defaultLegendPanel().getLegend();
+            fPanelLegendManager.getJComboBox().getModel().setSelectedItem(layer.getName() + PluginServices.getText(this,"_(Simbolo_unico)"));
+            break;
+        case 1: // Unique Values
+            renderer = fPanelLegendManager.getM_valuesLegendPanel().getLegend();
+            fPanelLegendManager.getJComboBox().getModel().setSelectedItem(layer.getName() + "_(Valores_unicos)");
+            break;
+        case 2:// break values
+           	renderer = fPanelLegendManager.getM_breaksLegendPanel().getLegend();
+            fPanelLegendManager.getJComboBox().getModel().setSelectedItem(layer.getName() + "_(Intervalos)");
+           	break;
+        case 3://text
+        	fPanelLegendManager.getJComboBox().getModel().setSelectedItem(layer.getName() + "_(Etiquetas_estandar)");
+        	break;
+        case 4://
+        	renderer = fPanelLegendManager.getPanelDotDensityLegend().getLegend();
+        	break;
+        }
+        // System.out.println("Color punto 1 " + renderer.getDefaultSymbol().getColor().toString());
+    	// fPanelLegendManager.getM_labelsLegendPanel().setFSymbol(renderer.getDefaultSymbol());
+    	// boolean bShapesVisibles = renderer.getDefaultSymbol().isShapeVisible();
+    	fPanelLegendManager.getM_labelsLegendPanel().updateValuesFromControls((VectorialLegend)renderer);
+    	// renderer.getDefaultSymbol().setShapeVisible(bShapesVisibles);
+        // System.out.println("Color punto 2 " + renderer.getDefaultSymbol().getColor().toString());
+        try {
+			// Intentamos aplicar la leyenda a todas
+            // las capas activas a las que se les pueda aplicar
+            FLayer[] activeLyrs =  mapContext.getLayers().getActives();
+            for (int i=0; i < activeLyrs.length; i++)
+            {
+            	FLayer laux=activeLyrs[i];
+            	if (activeLyrs[i] instanceof FLayers){
+            		laux=getFirstActiveLayerVect((FLayers)activeLyrs[i]);
+            	}
+                if (laux instanceof ClassifiableVectorial)
+                {
+                    ClassifiableVectorial aux2 = (ClassifiableVectorial) laux;
+                    if (renderer instanceof ClassifiedLegend)
+                    {
+                        // Es una leyenda que necesita un recordset con un
+                        // nombre de campo. Comprobamos que ese recordset
+                        // tiene ese nombre de campo y es del tipo esperado
+                        ClassifiedLegend cl = (ClassifiedLegend) renderer;
+                        if (aux2 instanceof AlphanumericData)
+                        {
+                            DataSource rs = ((AlphanumericData) aux2).getRecordset();
+                            if (cl.getValues().length==0) {
+                            	JOptionPane.showMessageDialog((Component)PluginServices.getMainFrame(),PluginServices.getText(this,"no_es_posible_aplicar_leyenda_vacia"));
+                            	return;
+                            }
+                            int idField = rs.getFieldIndexByName(cl.getFieldName());
+                            if (idField != -1)
+                            {
+                                //TODO: Aqu� deber�amos comprobar si el tipo de campo
+                                // es el tipo de campo esperado.
+                            	/*if (renderer instanceof VectorialUniqueValueLegend){
+                            		((VectorialUniqueValueLegend)renderer).setLabelHeightField(null);
+                            		((VectorialUniqueValueLegend)renderer).setLabelRotationField(null);
+                            	}
+                            	*/
+                                aux2.setLegend((VectorialLegend) renderer);
+                            }
+
+                        }
+                    }
+                    else if (renderer instanceof SingleSymbolLegend)
+                        aux2.setLegend((VectorialLegend) renderer);
+                }
+
+            }
+			// aux.setLegend((VectorialLegend) m_Renderer);
+
+		} catch (FieldNotFoundException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (DriverException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (com.hardcode.gdbms.engine.data.driver.DriverException e) {
+            // TODO Auto-generated catch block
+            e.printStackTrace();
+        }
+
+		if (fPanelScaleManager.getJRadioButton1().isSelected()) {
+			try
+			{
+				layer.setMinScale((nf.parse(fPanelScaleManager.getJTextField1().getText())).doubleValue());
+			}
+			catch (ParseException ex)
+			{
+			    if (fPanelScaleManager.getJTextField1().getText().compareTo("") == 0)
+			        layer.setMinScale(-1);
+			    else
+			        System.err.print(ex.getLocalizedMessage());
+			}
+			try
+			{
+			    layer.setMaxScale((nf.parse(fPanelScaleManager.getJTextField2().getText())).doubleValue());
+			}
+			catch (ParseException ex)
+			{
+			    if (fPanelScaleManager.getJTextField2().getText().compareTo("") == 0)
+			        layer.setMaxScale(-1);
+			    else
+			        System.err.print(ex.getLocalizedMessage());
+			}
+
+		} else {
+	        layer.setMinScale(-1);
+	        layer.setMaxScale(-1);
+		}
+		if (!fPanelScaleManager.getLayerName().equals(layer.getName())){
+			layer.setName(fPanelScaleManager.getLayerName());
+		}
+        if (layer instanceof FLyrVect)
+        {
+            FLyrVect lyrVect = (FLyrVect) layer;
+            if (fPanelScaleManager.isSpatialIndexSelected())
+            {
+//                if (lyrVect.getSpatialIndex() == null)
+            	if(lyrVect.getISpatialIndex() == null)
+                {
+                	//AZABALA
+                	try {
+						PluginServices.
+							cancelableBackgroundExecution(getCreateSpatialIndexTask());
+					} catch (DriverIOException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					} catch (DriverException e) {
+						// TODO Auto-generated catch block
+						e.printStackTrace();
+					}
+//                    lyrVect.createSpatialIndex();
+                }
+            }
+            //AZABALA
+            /*
+             * If we unselect the spatial index checkbox...Must we delete
+             * spatial index file, or we only have to put Spatial Index
+             * reference to null?. I have followed the second choice
+             */
+            else{
+                lyrVect.deleteSpatialIndex();
+            }
+
+
+        }
+		//layer.getFMap().invalidate();
+		layer.getMapContext().callLegendChanged();
+    }
+
+
+    /**
+     * Instanciates a ITask (@see com.iver.utiles.swing.threads.ITask)
+     * to create a spatial index for the selected layer in background.
+     * This task also allow to monitor process evolution, and to cancel
+     * this process.
+     * @throws DriverException
+     * @throws DriverIOException
+     */
+    public IMonitorableTask getCreateSpatialIndexTask() throws DriverIOException,
+    															DriverException{
+
+//    	  FIXME REVISAR ESTO (Quizas lanzar TaskException)
+			return new CreateSpatialIndexMonitorableTask((FLyrVect)layer);
+    }
+
+    /**
+     * DOCUMENT ME!
+     *
+     * @author Fernando Gonz�lez Cort�s
+     */
+    private class ComandosListener implements ActionListener {
+        private FThemeManagerWindow2 fLayerPropertiesWindow;
+
+        /**
+         * Creates a new ComandosListener object.
+         *
+         * @param lg DOCUMENT ME!
+         */
+        public ComandosListener(FThemeManagerWindow2 fLayerPropertiesWindow) {
+        	this.fLayerPropertiesWindow = fLayerPropertiesWindow;
+        }
+
+        /* (non-Javadoc)
+         * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+         */
+        public void actionPerformed(ActionEvent e) {
+            if (e.getActionCommand() == "OK") {
+                // Implementaci�n para hacer funcionar el hyperlink ...
+                //com.iver.cit.gvsig.gui.View theView = (com.iver.cit.gvsig.gui.View)PluginServices.getMDIManager().getActiveView();
+                //ProjectView view = theView.getModel();
+            	if (PluginServices.getMainFrame() != null)
+            	{
+            		IProjectView view = fPanelScaleManager.getView();
+            		view.setTypeLink(fPanelScaleManager.getLinkType());
+            		if (fPanelScaleManager.getSelectedLinkField()!=null)
+            		{
+            			view.setSelectedField(fPanelScaleManager.getSelectedLinkField().toString().trim());
+            			view.setExtLink(fPanelScaleManager.getExtensionLink());
+            		}
+            	}
+                //
+                fLayerPropertiesWindow.btnApply_actionPerformed(e);
+            	if (PluginServices.getMainFrame() == null)
+            		((JDialog) (getParent().getParent().getParent().getParent())).dispose();
+            	else
+            		PluginServices.getMDIManager().closeWindow(FThemeManagerWindow2.this);
+                System.out.println("Ok");
+            } else if (e.getActionCommand() == "CANCEL") {
+            	if (PluginServices.getMainFrame() == null)
+            		((JDialog) (getParent().getParent().getParent().getParent())).dispose();
+            	else
+            		PluginServices.getMDIManager().closeWindow(FThemeManagerWindow2.this);
+                System.out.println("CANCEL");
+            } else if (e.getActionCommand() == "APPLY") {
+                fLayerPropertiesWindow.btnApply_actionPerformed(e);
+                System.out.println("APPLY");
+            } else if (e.getActionCommand() == "LOAD_LEGEND") {
+	        	JFileChooser jfc = new JFileChooser();
+	    		jfc.addChoosableFileFilter(new GenericFileFilter("gvl",
+	    				PluginServices.getText(this, "tipo_de_leyenda")));
+	    		//jfc.addChoosableFileFilter(new GenericFileFilter("sld","sld"));
+
+	    		if (jfc.showOpenDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION) {
+	    			File file=jfc.getSelectedFile();
+	    			if (!(file.getPath().endsWith(".gvl") || file.getPath().endsWith(".GVL")))
+	    			{
+	    				file=new File(file.getPath()+".gvl");
+	    			}
+	    			readLegend(file);
+	    			fPanelLegendManager.setRenderer(renderer);
+	    			fPanelLegendManager.actualizar();
+	    		}
+            } else if (e.getActionCommand() == "SAVE_LEGEND") {
+				fLayerPropertiesWindow.btnApply_actionPerformed(e);
+				JFileChooser jfc = new JFileChooser();
+				jfc.addChoosableFileFilter(new GenericFileFilter("sld","*.sld"));
+				jfc.addChoosableFileFilter(new GenericFileFilter("gvl",
+						PluginServices.getText(this, "tipo_de_leyenda")));
+
+
+				if (jfc.showSaveDialog((Component) PluginServices.getMainFrame()) == JFileChooser.APPROVE_OPTION)
+				{
+					File file=jfc.getSelectedFile();
+					if (jfc.getFileFilter().accept(new File("dummy.sld")))
+					{
+						if (!(file.getPath().toLowerCase().endsWith(".sld"))){
+							file=new File(file.getPath()+".sld");
+						}
+						export2SLD(file);
+					}
+					else{
+						if (!(file.getPath().toLowerCase().endsWith(".gvl"))){
+							file=new File(file.getPath()+".gvl");
+						}
+						writeLegend(file);
+					}
+				}
+            } else {}
+        }
+    }
+
+    private void export2SLD(File file) {
+		try {
+			FileWriter writer = new FileWriter(file.getAbsolutePath());
+			writer.write( renderer.getSLDString(layer.getName()));
+			writer.close();
+
+//			Marshaller m = new Marshaller(writer);
+//			m.setEncoding("ISO-8859-1");
+//			m.marshal(renderer.getSLDString());
+		} catch (Exception e) {
+			NotificationManager.addError(PluginServices.getText(this, "Error_exportando_SLD"), e);
+		}
+	}
+
+    private void writeLegend(File file) {
+		try {
+			FileWriter writer = new FileWriter(file.getAbsolutePath());
+			Marshaller m = new Marshaller(writer);
+			m.setEncoding("ISO-8859-1");
+			m.marshal(renderer.getXMLEntity().getXmlTag());
+		} catch (Exception e) {
+			NotificationManager.addError(PluginServices.getText(this, "Error_guardando_la_leyenda"), e);
+		}
+	}
+
+	public void readLegend(File file) {
+		try {
+			File xmlFile = new File(file.getAbsolutePath());
+			FileReader reader;
+			reader = new FileReader(xmlFile);
+
+			XmlTag tag = (XmlTag) XmlTag.unmarshal(reader);
+			renderer = LegendFactory.createFromXML(new XMLEntity(tag));
+			//fPanelLegendManager.setRenderer(LegendFactory.createFromXML(new XMLEntity(tag)));
+		} catch (FileNotFoundException e) {
+			NotificationManager.addError(PluginServices.getText(this, "Al_leer_la_leyenda"), e);
+		} catch (MarshalException e) {
+			NotificationManager.addError(PluginServices.getText(this, "Al_leer_la_leyenda"), e);
+		} catch (ValidationException e) {
+			NotificationManager.addError(PluginServices.getText(this, "Al_leer_la_leyenda"), e);
+		} catch (XMLException e) {
+			NotificationManager.addError(PluginServices.getText(this, "Al_leer_la_leyenda"), e);
+		}
+	}
+
+	/* (non-Javadoc)
+	 * @see com.iver.andami.ui.mdiManager.View#getViewInfo()
+	 */
+	public WindowInfo getWindowInfo() {
+		// Solo se llama una vez
+		WindowInfo viewInfo = new WindowInfo(WindowInfo.MODELESSDIALOG);
+		viewInfo.setWidth(650);
+		viewInfo.setHeight(420);
+		viewInfo.setTitle(PluginServices.getText(this,"propiedades_de_la_capa"));
+		return viewInfo;
+	}
+
+	/**
+	 * @see com.iver.mdiApp.ui.MDIManager.View#viewActivated()
+	 */
+	/*public void viewActivated() {
+	}
+
+	public FMap getMapContext() {
+		return mapContext;
+	}
+	public FLayer getLayer() {
+		return layer;
+	}
+	public Legend getRenderer() {
+		return renderer;
+	}*/
+
+	/**
+	 * @return Returns the organizador.
+	 */
+	public JTabbedPane getOrganizador() {
+		return organizador;
+	}
+	/**
+	 * @param organizador The organizador to set.
+	 */
+	public void setOrganizador(JTabbedPane organizador) {
+		this.organizador = organizador;
+	}
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/legend/gui/FThemeManagerWindow2.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/legend/gui/FPanelLegendManager2.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/legend/gui/FPanelLegendManager2.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/legend/gui/FPanelLegendManager2.java	(revision 12191)
@@ -0,0 +1,520 @@
+package com.iver.cit.gvsig.project.documents.view.legend.gui;
+
+import java.awt.CardLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.ButtonGroup;
+import javax.swing.ImageIcon;
+import javax.swing.JButton;
+import javax.swing.JCheckBox;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JScrollPane;
+import javax.swing.JTextArea;
+
+import com.iver.andami.PluginServices;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.MapContext;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.XMLException;
+import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial;
+import com.iver.cit.gvsig.fmap.rendering.IntervalLegend;
+import com.iver.cit.gvsig.fmap.rendering.Legend;
+import com.iver.cit.gvsig.fmap.rendering.SingleSymbolLegend;
+import com.iver.cit.gvsig.fmap.rendering.UniqueValueLegend;
+import com.iver.cit.gvsig.fmap.rendering.VectorialIntervalLegend;
+import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend;
+/**
+ *
+ * @author jmorell
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Style - Code Templates
+ */
+public class FPanelLegendManager2 extends AbstractPanel {
+
+ private ImageIcon iuniqueValues= new ImageIcon(this.getClass().getClassLoader()
+		 	.getResource("images/ValoresUnicos.png"));
+	private ImageIcon iintervalValues= new ImageIcon(this.getClass().getClassLoader()
+			.getResource("images/Intervalos.png"));
+//	private ImageIcon iuniqueValues= new ImageIcon("images/ValoresUnicos.png");
+//	private ImageIcon iintervalValues= new ImageIcon("images/Intervalos.png");
+	private MapContext mapContext;
+	private FLayer layer;
+    private Legend renderer; // Le asignaremos la leyenda del primer tema activo.
+    private FPanelLegendDefault m_defaultLegendPanel;
+    private FPanelLegendValues m_valuesLegendPanel;
+    private PanelLegendBreaks m_breaksLegendPanel;
+    private FPanelLegendLabels m_labelsLegendPanel;
+    private PanelLegendDotDensity dotDensityLegendPanel;
+    private JPanel cards;
+    private ComandosListener m_actionListener = new ComandosListener(this);
+    private int visibleCard;
+    private final String oneSymHelp = PluginServices.getText(this,"Muestra_todos_los_elementos_de_una_capa_usando_el_mismo_simbolo");
+    private final String oneValHelp = PluginServices.getText(this,"Dado_un_campo_de_atributos") + "," + PluginServices.getText(this,"muestra_los_elementos_de_la_capa_usando_un_simbolo_por_cada_valor_unico") + ".";
+    private final String intervalsHelp = PluginServices.getText(this,"Muestra_los_elementos_de_la_capa_usando_una_gama_de_colores_en_funcion_del_valor_de_un_determinado_campo_de_atributos") + ".";
+    private final String labelsHelp = PluginServices.getText(this,"Permite_etiquetar_los_elementos_del_mapa_con_el_valor_de_un_determinado_campo") + ".";
+    private final String dotDensityHelp = PluginServices.getText(this,"Defines_a_dot_density_symbol_based_on_a_field_value") + ".";
+
+	private JPanel topPanel = null;
+	private JLabel jLabel = null;
+	private JComboBox jComboBox = null;
+	private JButton jButton = null;
+	private JButton jButton1 = null;
+	private JCheckBox jCheckBox = null;
+	private JPanel jPanel = null;
+	private JTextArea titleTextArea = null;
+
+	private JPanel jPanel1 = null;
+
+	private JRadioButton symbolButton;
+	private JRadioButton valuesButton;
+	private JRadioButton intervalsButton;
+	private JRadioButton labelsButton;
+
+	private JScrollPane jScrollPane = null;
+	private JRadioButton dotDensityButton = null;
+	public FPanelLegendManager2() {
+		initialize();
+		this.setSize(500, 360);
+	}
+
+    private void initialize() {
+		visibleCard=0;
+        JPanel selector = new JPanel();
+        selector.setLayout(null);
+
+        symbolButton = new JRadioButton();
+        symbolButton.setText(PluginServices.getText(this,"Simbolo_unico"));
+        symbolButton.setActionCommand("SYMBOL_CHOICE");
+        symbolButton.addActionListener(m_actionListener);
+
+        valuesButton = new JRadioButton();
+        valuesButton.setText(PluginServices.getText(this,"Valores_unicos"));
+        valuesButton.setActionCommand("VALUES_CHOICE");
+        valuesButton.addActionListener(m_actionListener);
+
+        intervalsButton = new JRadioButton();
+        intervalsButton.setText(PluginServices.getText(this,"Intervalos"));
+        intervalsButton.setActionCommand("BREAKS_CHOICE");
+        intervalsButton.addActionListener(m_actionListener);
+
+		labelsButton = new JRadioButton();
+		labelsButton.setText(PluginServices.getText(this,"Etiquetados"));
+		labelsButton.setActionCommand("LABELS_CHOICE");
+		labelsButton.addActionListener(m_actionListener);
+
+		dotDensityButton = new JRadioButton();
+		dotDensityButton.setText(PluginServices.getText(this, "dot_density"));
+		dotDensityButton.setActionCommand("DOT_DENSITY_CHOICE");
+		dotDensityButton.addActionListener(m_actionListener);
+
+		ButtonGroup jButtonGroup = new ButtonGroup();
+		jButtonGroup.add(symbolButton);
+		jButtonGroup.add(valuesButton);
+		jButtonGroup.add(intervalsButton);
+		jButtonGroup.add(labelsButton);
+		jButtonGroup.add(dotDensityButton);
+
+
+    	//Create the cards.
+        m_defaultLegendPanel = new FPanelLegendDefault();
+        m_valuesLegendPanel = new FPanelLegendValues();
+        m_breaksLegendPanel = new PanelLegendBreaks();
+        m_labelsLegendPanel = new FPanelLegendLabels(this);
+        dotDensityLegendPanel = new PanelLegendDotDensity();
+
+        //Create the panel that contains the cards.
+        cards = new JPanel(new CardLayout());
+        this.setLayout(null);
+        selector.setBounds(5, 41, 134, 197);
+        selector.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
+        selector.setBackground(java.awt.SystemColor.text);
+        cards.setBounds(143, 88, 502, 270);
+        cards.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
+        symbolButton.setBounds(5, 5, 131, 23);
+        symbolButton.setSelected(true);
+        symbolButton.setBackground(java.awt.SystemColor.text);
+        valuesButton.setBounds(5, 28, 131, 23);
+        valuesButton.setBackground(java.awt.SystemColor.text);
+        intervalsButton.setBounds(5, 51, 131, 23);
+        intervalsButton.setBackground(java.awt.SystemColor.text);
+        labelsButton.setBounds(5, 74, 131, 23);
+        labelsButton.setBackground(java.awt.SystemColor.text);
+        dotDensityButton.setBounds(5,97,131,21);
+		dotDensityButton.setBackground(java.awt.SystemColor.text);
+        this.setSize(649, 377);
+        cards.add(m_defaultLegendPanel, "symbol");
+        this.add(selector, null);
+        selector.add(symbolButton, null);
+        cards.add(m_valuesLegendPanel, "values");
+        this.add(cards, null);
+        selector.add(valuesButton, null);
+        cards.add(m_breaksLegendPanel, "breaks");
+        selector.add(intervalsButton, null);
+        this.add(getTopPanel(), null);
+        cards.add(m_labelsLegendPanel, "labels");
+        selector.add(labelsButton, null);
+        cards.add(dotDensityLegendPanel, "dot_density");
+        selector.add(dotDensityButton, null);
+        this.add(getJPanel(), null);
+        this.add(getPreviewPanel(), null);
+    }
+
+
+
+    /**
+     * En esta funci�n se coge el primer tema activo del TOC y se usa su
+     * renderer para inicializar. Hay que llamarla SIEMPRE que se abra el
+     * cuadro de di�logo, en el  openLegendManager() de la vista.
+     *
+     * @param mapContext TOC que abre este cuadro de di�logo.
+     * @throws DriverException
+     */
+    public void setMapContext(MapContext mapContext) throws DriverException {
+        this.mapContext = mapContext;
+        layer = getFirstActiveLayerVect(mapContext.getLayers());
+		try {
+			ClassifiableVectorial aux = (ClassifiableVectorial) layer;
+			renderer = aux.getLegend().cloneLegend();
+		} catch (XMLException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+        actualizar();
+    }
+
+    /**
+     * DOCUMENT ME!
+     */
+    public void actualizar() {
+    	FLayer lyrSelected = getFirstActiveLayerVect(mapContext.getLayers());
+
+        m_defaultLegendPanel.setLayer(lyrSelected, renderer);
+        m_valuesLegendPanel.setLayer(lyrSelected, renderer);
+        m_breaksLegendPanel.setLayer(lyrSelected, renderer);
+        m_labelsLegendPanel.setLayer(lyrSelected, renderer);
+        dotDensityLegendPanel.setLayer(lyrSelected, renderer);
+        CardLayout cl = (CardLayout)(cards.getLayout());
+        if (renderer instanceof SingleSymbolLegend) {
+        	titleTextArea.setText(oneSymHelp);
+        	getPreviewPanel().removeAll();
+    		getPreviewPanel().add(m_defaultLegendPanel.getM_previewSymbol());
+    		getPreviewPanel().repaint();
+        	symbolButton.setSelected(true);
+            getJComboBox().getModel().setSelectedItem(layer.getName() + " (" + PluginServices.getText(this,"Simbolo_unico") + ")");
+            cl.show(cards, "symbol");
+            setVisibleCard(0);
+        }
+        if (renderer instanceof UniqueValueLegend) {
+        	titleTextArea.setText(oneValHelp);
+        	getPreviewPanel().removeAll();
+        	getPreviewPanel().repaint();
+        	valuesButton.setSelected(true);
+            getJComboBox().getModel().setSelectedItem(layer.getName() + " (" + PluginServices.getText(this,"Valores_unicos") + ")");
+            cl.show(cards, "values");
+            setVisibleCard(1);
+        }
+        if (renderer instanceof IntervalLegend) {
+        	titleTextArea.setText(intervalsHelp);
+        	getPreviewPanel().removeAll();
+    		getPreviewPanel().repaint();
+        	intervalsButton.setSelected(true);
+            getJComboBox().getModel().setSelectedItem(layer.getName() + " (" + PluginServices.getText(this,"Intervalos") + ")");
+            cl.show(cards, "breaks");
+            setVisibleCard(2);
+        }
+
+    }
+
+	public void setLayer(FLayer lyr, Legend r) {
+		layer = lyr;
+		if (r instanceof SingleSymbolLegend) {
+			getJComboBox().getModel().setSelectedItem(layer.getName() + " (" + PluginServices.getText(this,"Simbolo_unico") + ")");
+			renderer = (SingleSymbolLegend)r;
+			getPreviewPanel().add(m_defaultLegendPanel.getM_previewSymbol());
+            CardLayout cl = (CardLayout)(cards.getLayout());
+            cl.show(cards, "symbol");
+            setVisibleCard(0);
+		} else if (r instanceof VectorialUniqueValueLegend) {
+            getJComboBox().getModel().setSelectedItem(layer.getName() + " (" + PluginServices.getText(this,"Valores_unicos") + ")");
+			renderer = (VectorialUniqueValueLegend)r;
+            CardLayout cl = (CardLayout)(cards.getLayout());
+            cl.show(cards, "values");
+            setVisibleCard(1);
+		} else if (r instanceof VectorialIntervalLegend) {
+            getJComboBox().getModel().setSelectedItem(layer.getName() + " (" + PluginServices.getText(this,"Intervalos") + ")");
+			renderer = (VectorialIntervalLegend)r;
+            CardLayout cl = (CardLayout)(cards.getLayout());
+            cl.show(cards, "breaks");
+            setVisibleCard(2);
+		} else {
+            getJComboBox().getModel().setSelectedItem(layer.getName() + " (" + PluginServices.getText(this,"Etiquetas_estandar") + ")");
+			renderer = (SingleSymbolLegend)r;
+            CardLayout cl = (CardLayout)(cards.getLayout());
+            cl.show(cards, "labels");
+            setVisibleCard(3);
+		}
+	}
+
+    private class ComandosListener implements ActionListener {
+
+
+	//   private FPanelLegendManager fPanSimMan;
+
+        public ComandosListener(FPanelLegendManager2 fPanSimMan) {
+        //	this.fPanSimMan = fPanSimMan;
+        }
+
+        public void actionPerformed(ActionEvent e) {
+        	getPreviewPanel().removeAll();
+
+            if (e.getActionCommand() == "SYMBOL_CHOICE") {
+            	titleTextArea.setText(oneSymHelp);
+        		getPreviewPanel().add(m_defaultLegendPanel.getM_previewSymbol());
+        	    CardLayout cl = (CardLayout)(cards.getLayout());
+                cl.show(cards, "symbol");
+                visibleCard=0;
+            } else if (e.getActionCommand() == "VALUES_CHOICE") {
+            	titleTextArea.setText(oneValHelp);
+        		getPreviewPanel().add(new JLabel(iuniqueValues));
+        	    CardLayout cl = (CardLayout)(cards.getLayout());
+                cl.show(cards, "values");
+                visibleCard=1;
+            } else if (e.getActionCommand() == "BREAKS_CHOICE") {
+            	titleTextArea.setText(intervalsHelp);
+        		getPreviewPanel().add(new JLabel(iintervalValues));
+        	    CardLayout cl = (CardLayout)(cards.getLayout());
+                cl.show(cards, "breaks");
+                visibleCard=2;
+            } else if (e.getActionCommand() == "LABELS_CHOICE") {
+            	titleTextArea.setText(labelsHelp);
+        		getPreviewPanel().add(m_labelsLegendPanel.getFPreviewSymbol());
+        	    CardLayout cl = (CardLayout)(cards.getLayout());
+                cl.show(cards, "labels");
+                visibleCard=3;
+            } else if (e.getActionCommand() == "DOT_DENSITY_CHOICE") {
+            	titleTextArea.setText(dotDensityHelp);
+//    TODO set a preview        	getPreviewPanel().add(dotDensityLegendPanel.getFPreviewSymbol());
+        	    CardLayout c1 = (CardLayout) (cards.getLayout());
+            	c1.show(cards, "dot_density");
+            	visibleCard=4;
+            } else {}
+        	getPreviewPanel().repaint();
+
+        }
+    }
+
+	public int getVisibleCard() {
+		return visibleCard;
+	}
+
+	/**
+	 * This method initializes jPanel
+	 *
+	 * @return javax.swing.JPanel
+	 */
+	private JPanel getTopPanel() {
+		if (topPanel == null) {
+			jLabel = new JLabel();
+			topPanel = new JPanel();
+			topPanel.setLayout(null);
+			topPanel.setBounds(5, 5, 638, 31);
+			topPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "", javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, null, null));
+			jLabel.setBounds(6, 4, 68, 22);
+			jLabel.setText(PluginServices.getText(this,"Leyenda") + ":");
+			topPanel.add(jLabel, null);
+			topPanel.add(getJComboBox(), null);
+			topPanel.add(getJButton(), null);
+			topPanel.add(getJButton1(), null);
+			topPanel.add(getJCheckBox(), null);
+		}
+		return topPanel;
+	}
+	/**
+	 * This method initializes jComboBox
+	 *
+	 * @return javax.swing.JComboBox
+	 */
+	public JComboBox getJComboBox() {
+		if (jComboBox == null) {
+			jComboBox = new JComboBox();
+			jComboBox.setBounds(78, 5, 250, 22);
+		}
+		return jComboBox;
+	}
+	/**
+	 * This method initializes jButton
+	 *
+	 * @return javax.swing.JButton
+	 */
+	private JButton getJButton() {
+		if (jButton == null) {
+			jButton = new JButton();
+			jButton.setBounds(345, 4, 22, 22);
+			jButton.setEnabled(false);
+		}
+		return jButton;
+	}
+	/**
+	 * This method initializes jButton1
+	 *
+	 * @return javax.swing.JButton
+	 */
+	private JButton getJButton1() {
+		if (jButton1 == null) {
+			jButton1 = new JButton();
+			jButton1.setBounds(371, 4, 22, 22);
+			jButton1.setEnabled(false);
+		}
+		return jButton1;
+	}
+	/**
+	 * This method initializes jCheckBox
+	 *
+	 * @return javax.swing.JCheckBox
+	 */
+	private JCheckBox getJCheckBox() {
+		if (jCheckBox == null) {
+			jCheckBox = new JCheckBox();
+			jCheckBox.setBounds(417, 4, 202, 22);
+			jCheckBox.setText(PluginServices.getText(this,"Leyenda_Por_Defecto"));
+			jCheckBox.setEnabled(false);
+		}
+		return jCheckBox;
+	}
+	/**
+	 * This method initializes jPanel
+	 *
+	 * @return javax.swing.JPanel
+	 */
+	private JPanel getJPanel() {
+		if (jPanel == null) {
+			jPanel = new JPanel();
+			jPanel.setLayout(null);
+			jPanel.setBounds(143, 39, 501, 46);
+			jPanel.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
+			jPanel.add(getJScrollPane(), null);
+		}
+		return jPanel;
+	}
+	/**
+	 * This method initializes jTextArea
+	 *
+	 * @return javax.swing.JTextArea
+	 */
+	private JTextArea getJTextArea() {
+		if (titleTextArea == null) {
+			titleTextArea = new JTextArea();
+			titleTextArea.setText(oneSymHelp);
+			titleTextArea.setBackground(java.awt.SystemColor.control);
+			titleTextArea.setLineWrap(true);
+			titleTextArea.setRows(0);
+			titleTextArea.setWrapStyleWord(false);
+			titleTextArea.setEditable(false);
+			titleTextArea.setPreferredSize(new java.awt.Dimension(495,40));
+		}
+		return titleTextArea;
+	}
+	/**
+	 * This method initializes jPanel1
+	 *
+	 * @return javax.swing.JPanel
+	 */
+	private JPanel getPreviewPanel() {
+		if (jPanel1 == null) {
+			jPanel1 = new JPanel();
+			jPanel1.setBounds(6, 242, 132, 117);
+			jPanel1.setBorder(javax.swing.BorderFactory.createBevelBorder(javax.swing.border.BevelBorder.LOWERED));
+			jPanel1.setBackground(java.awt.SystemColor.text);
+		}
+		return jPanel1;
+	}
+	/**
+	 * @return Returns the m_breaksLegendPanel.
+	 */
+	public PanelLegendBreaks getM_breaksLegendPanel() {
+		return m_breaksLegendPanel;
+	}
+	/**
+	 * @param legendPanel The m_breaksLegendPanel to set.
+	 */
+	public void setM_breaksLegendPanel(PanelLegendBreaks legendPanel) {
+		m_breaksLegendPanel = legendPanel;
+	}
+	/**
+	 * @return Returns the m_defaultLegendPanel.
+	 */
+	public FPanelLegendDefault getM_defaultLegendPanel() {
+		return m_defaultLegendPanel;
+	}
+	/**
+	 * @param legendPanel The m_defaultLegendPanel to set.
+	 */
+	public void setM_defaultLegendPanel(FPanelLegendDefault legendPanel) {
+		m_defaultLegendPanel = legendPanel;
+	}
+	/**
+	 * @return Returns the m_labelsLegendPanel.
+	 */
+	public FPanelLegendLabels getM_labelsLegendPanel() {
+		return m_labelsLegendPanel;
+	}
+	/**
+	 * @param legendPanel The m_labelsLegendPanel to set.
+	 */
+	public void setM_labelsLegendPanel(FPanelLegendLabels legendPanel) {
+		m_labelsLegendPanel = legendPanel;
+	}
+	/**
+	 * @return Returns the m_valuesLegendPanel.
+	 */
+	public FPanelLegendValues getM_valuesLegendPanel() {
+		return m_valuesLegendPanel;
+	}
+
+	public PanelLegendDotDensity getPanelDotDensityLegend() {
+		return dotDensityLegendPanel;
+	}
+	/**
+	 * @param legendPanel The m_valuesLegendPanel to set.
+	 */
+	public void setM_valuesLegendPanel(FPanelLegendValues legendPanel) {
+		m_valuesLegendPanel = legendPanel;
+	}
+	/**
+	 * @return Returns the renderer.
+	 */
+	public Legend getRenderer() {
+		return renderer;
+	}
+	/**
+	 * @param renderer The renderer to set.
+	 */
+	public void setRenderer(Legend renderer) {
+		this.renderer = renderer;
+	}
+	/**
+	 * @param visibleCard The visibleCard to set.
+	 */
+	public void setVisibleCard(int visibleCard) {
+		this.visibleCard = visibleCard;
+	}
+	/**
+	 * This method initializes jScrollPane
+	 *
+	 * @return javax.swing.JScrollPane
+	 */
+	private JScrollPane getJScrollPane() {
+		if (jScrollPane == null) {
+			jScrollPane = new JScrollPane();
+			jScrollPane.setBounds(2, 2, 498, 42);
+			jScrollPane.setViewportView(getJTextArea());
+		}
+		return jScrollPane;
+	}
+
+}  //  @jve:decl-index=0:visual-constraint="26,17"
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/legend/gui/FPanelLegendManager2.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/legend/gui/PanelLegendDotDensity.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/legend/gui/PanelLegendDotDensity.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/legend/gui/PanelLegendDotDensity.java	(revision 12191)
@@ -0,0 +1,568 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2005 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+
+/* CVS MESSAGES:
+*
+* $Id$
+* $Log$
+* Revision 1.4.2.1  2007-04-20 07:49:39  caballero
+* cambio de key para el s�mbolo
+*
+* Revision 1.4  2006/11/17 13:53:45  cesar
+* *** empty log message ***
+*
+* Revision 1.3  2006/11/17 12:50:36  jaume
+* tama�o de punto defecto 2
+*
+* Revision 1.2  2006/11/15 12:57:31  jaume
+* *** empty log message ***
+*
+* Revision 1.1  2006/11/14 11:10:27  jaume
+* *** empty log message ***
+*
+*
+*/
+package com.iver.cit.gvsig.project.documents.view.legend.gui;
+
+import java.awt.BorderLayout;
+import java.awt.Color;
+import java.awt.Component;
+import java.awt.ComponentOrientation;
+import java.awt.FlowLayout;
+import java.awt.GridLayout;
+import java.awt.LayoutManager;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+import java.awt.event.ItemEvent;
+import java.awt.event.ItemListener;
+import java.sql.Types;
+import java.text.NumberFormat;
+
+import javax.swing.BorderFactory;
+import javax.swing.BoxLayout;
+import javax.swing.ButtonGroup;
+import javax.swing.ImageIcon;
+import javax.swing.JComboBox;
+import javax.swing.JLabel;
+import javax.swing.JPanel;
+import javax.swing.JRadioButton;
+import javax.swing.JSlider;
+import javax.swing.JTextField;
+import javax.swing.event.ChangeEvent;
+import javax.swing.event.ChangeListener;
+
+import org.gvsig.gui.beans.swing.GridBagLayoutPanel;
+
+import com.hardcode.gdbms.engine.data.DataSource;
+import com.hardcode.gdbms.engine.data.DataSourceFactory;
+import com.hardcode.gdbms.engine.values.NumericValue;
+import com.hardcode.gdbms.engine.values.Value;
+import com.hardcode.gdbms.engine.values.ValueFactory;
+import com.iver.andami.PluginServices;
+import com.iver.andami.messages.NotificationManager;
+import com.iver.cit.gvsig.fmap.core.FShape;
+import com.iver.cit.gvsig.fmap.core.symbols.DotDensityFillSymbol;
+import com.iver.cit.gvsig.fmap.core.symbols.SimpleFillSymbol;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
+import com.iver.cit.gvsig.fmap.rendering.DotDensityLegend;
+import com.iver.cit.gvsig.fmap.rendering.Legend;
+import com.iver.cit.gvsig.fmap.rendering.VectorialUniqueValueLegend;
+import com.iver.cit.gvsig.gui.panels.ColorChooserPanel;
+import com.iver.cit.gvsig.project.documents.view.legend.gui.ILegendPanel;
+import com.iver.utiles.StringUtilities;
+import com.iver.utiles.XMLEntity;
+
+/**
+ *
+ * @author jaume dominguez faus - jaume.dominguez@iver.es
+ *
+ */
+public class PanelLegendDotDensity extends JPanel implements ILegendPanel {
+	private FLyrVect layer;
+	private JPanel northPanel = null;
+	private GridBagLayoutPanel densityButtonsPanel = null;
+	private JPanel pnlDensities = null;
+	private JComboBox cmbLegendField = null;
+	private JRadioButton rdBtnHigh = null;
+	private JRadioButton rdBtnMedium = null;
+	private JRadioButton rdBtnLow = null;
+	private JTextField numDotSize = null;
+	private double max, min, mean;
+	private JTextField nmbrDotValue = null;
+	private JLabel lblLabellingField = null;
+	private DotDensityLegend legend;
+	private String fieldName;
+	private MyListener cmbAction = new MyListener();
+	NumberFormat nf = NumberFormat.getInstance();
+
+	{
+		nf.setMaximumFractionDigits(3);
+	}
+
+	private class MyListener implements ItemListener, ActionListener {
+
+		public void itemStateChanged(ItemEvent e) {
+			doIt();
+		}
+
+		public void actionPerformed(ActionEvent e) {
+			doIt();
+		}
+
+		private void doIt() {
+			int index = cmbLegendField.getSelectedIndex();
+            try {
+                SelectableDataSource sds = layer.getRecordset();
+
+                if (index != -1) {
+                    fieldName = (String) cmbLegendField.getSelectedItem();
+                } else {
+                    fieldName = (String) cmbLegendField.getItemAt(0);
+                }
+
+                String sql = "select "+fieldName+" from '"+sds.getName()+"';";
+
+                DataSource recordset = sds.getDataSourceFactory().executeSQL(sql, DataSourceFactory.AUTOMATIC_OPENING );
+                // TODO implement MAX() and MIN() functions in GDBMS!!!!!
+                max = Double.MIN_VALUE;
+                min = Double.MAX_VALUE;
+                for (int i = 0; i < sds.getRowCount(); i++) {
+                    double value = ((NumericValue) recordset.getFieldValue(i,0)).doubleValue();
+                    max = Math.max(max, value);
+                    min = Math.min(min, value);
+                }
+                mean = (max+min) /2;
+                buttonsListener.actionPerformed(null);
+
+            } catch (Exception ex) {
+                ex.printStackTrace();
+            }
+		}
+	};
+	private ActionListener buttonsListener = new ActionListener() {
+    	public void actionPerformed(ActionEvent e) {
+    		if (getRdBtnHigh().isSelected()) {
+    			getSldDensity().setValue(66);
+    		} else if (getRdBtnLow().isSelected()) {
+    			getSldDensity().setValue(33);
+    		} else if (getRdBtnMedium().isSelected()) {
+    			getSldDensity().setValue(50);
+    		}
+    	}
+    };
+	private JPanel centerPanel = null;
+	private JSlider sldDensity = null;
+	private JPanel pnlSldDensity;
+	private ChangeListener sldListener = new ChangeListener() {
+
+		public void stateChanged(ChangeEvent e) {
+
+			// This is my messy statistic aggregation function
+			// TODO if I can, I'll have a look to my statistic books to figure out one better
+			int quantileIndex = getSldDensity().getValue();
+			final int topLimit = 98;
+			if (quantileIndex > topLimit)
+				quantileIndex = topLimit;
+			double quantileAmount = (max-min)/100;
+			nmbrDotValue.setText(nf.format(3*quantileAmount/Math.log(quantileIndex)));
+		}
+
+	};
+	private ColorChooserPanel jcc;
+	private ColorChooserPanel outlineColorChooserPanel;
+	public PanelLegendDotDensity() {
+        super();
+        initialize();
+    }
+
+    /**
+     * This method initializes this
+     *
+     */
+    private void initialize() {
+        this.setLayout(new BorderLayout());
+        this.setSize(new java.awt.Dimension(492,278));
+        this.add(getNorthPanel(), java.awt.BorderLayout.NORTH);
+
+        this.add(getCenterPanel(), java.awt.BorderLayout.CENTER);
+    }
+
+    public void setLayer(FLayer lyr, Legend legend) {
+        this.layer = (FLyrVect) lyr;
+        try {
+        	SelectableDataSource sds = layer.getRecordset();
+        	cmbLegendField.removeItemListener(cmbAction);
+        	cmbLegendField.removeAllItems();
+        	String[] fNames = sds.getFieldNames();
+        	for (int i = 0; i < fNames.length; i++) {
+        		if (isNumericField(sds.getFieldType(i))) {
+        			cmbLegendField.addItem(fNames[i]);
+        		}
+        	}
+        	if (!(legend instanceof DotDensityLegend)) {
+        		legend = new DotDensityLegend();
+        		((DotDensityLegend) legend).setFieldName((String) cmbLegendField.getItemAt(0));
+        	}
+
+        	DotDensityLegend theLegend = (DotDensityLegend) legend;
+
+        	cmbLegendField.addItemListener(cmbAction);
+        	cmbLegendField.addActionListener(cmbAction);
+        	cmbLegendField.setSelectedItem(theLegend.getFieldName());
+        	try {
+        		getDotColorChooserPanel().setColor(theLegend.getDotColor());
+        	} catch (NullPointerException npEx) {
+        		getDotColorChooserPanel().setColor(Color.RED);
+        	}
+        	try {
+        		getOutlineColorChooserPanel().setColor(theLegend.getOutlineColor());
+        	} catch (NullPointerException npEx) {
+        		getOutlineColorChooserPanel().setColor(Color.BLACK);
+        	}
+        	try {
+        		double dotValue = theLegend.getDotValue();
+        		if (dotValue <= 0)
+        			dotValue = 100;
+        		getNmbrDotValue().setText(String.valueOf(dotValue));
+        	} catch (NullPointerException npEx) {
+        		getNmbrDotValue().setText(String.valueOf(max));
+        	}
+        	try {
+        		double dotSize = theLegend.getDotSize();
+        		if (dotSize <= 0)
+        			dotSize = 2;
+        		getNumDotSize().setText(String.valueOf(dotSize));
+        	} catch (NullPointerException npEx) {
+        		getNumDotSize().setText(String.valueOf(3));
+        	}
+
+        } catch (Exception e) {
+        	e.printStackTrace();
+        }
+    }
+
+    private boolean isNumericField(int fieldType) {
+        switch (fieldType) {
+        case Types.BIGINT:
+        case Types.DECIMAL:
+        case Types.DOUBLE:
+        case Types.FLOAT:
+        case Types.INTEGER:
+        case Types.NUMERIC:
+        case Types.REAL:
+        case Types.SMALLINT:
+        case Types.TINYINT:
+            return true;
+        default:
+            return false;
+        }
+
+    }
+
+    public Legend getLegend() {
+    	try {
+			SimpleFillSymbol symbol = null;
+
+
+    		int shapeType = layer.getShapeType(); // should be always polygon
+    		if (shapeType != FShape.POLYGON) {
+    			NotificationManager.addError(PluginServices.getText(this, "cannot_apply_to_a_non_polygon_layer"), new Exception());
+    		}
+    		SelectableDataSource sds;
+    		sds = layer.getRecordset();
+    		if (-1 == sds.getFieldIndexByName(fieldName))
+    			return null;
+
+    		double dotValue;
+    		double dotSize;
+    		try {
+    			dotValue = Double.parseDouble(nmbrDotValue.getText());
+    		} catch (Exception e) {
+    			dotValue = nf.parse(nmbrDotValue.getText()).doubleValue();
+    		}
+    		if (dotValue == 0)
+    			dotValue = 1;
+    		try {
+    			dotSize = Double.parseDouble(numDotSize.getText());
+    		} catch (Exception e) {
+    			dotSize = nf.parse(numDotSize.getText()).doubleValue();
+    		}
+    		DotDensityFillSymbol densitySym = new DotDensityFillSymbol();
+    		densitySym.setDotSize(dotSize);
+    		densitySym.setDotColor(getDotColorChooserPanel().getColor());
+    		symbol = new SimpleFillSymbol();
+    		XMLEntity xml = symbol.getXMLEntity();
+    		xml.putProperty("color", StringUtilities.color2String(Color.WHITE));
+    		xml.putProperty("outline", StringUtilities.color2String(getOutlineColorChooserPanel().getColor()));
+
+    		xml.addChild(densitySym.getXMLEntity());
+    		symbol.setXMLEntity(xml);
+
+    		legend = new DotDensityLegend();
+    		legend.addSymbol(ValueFactory.createValue("theSymbol"), symbol);
+    		legend.setDefaultSymbol(symbol);
+    		legend.setDotValue(dotValue);
+    		legend.setFieldName(fieldName);
+
+
+    	} catch (Exception e) {
+    		NotificationManager.addError(PluginServices.getText(this, "could_not_setup_legend"), e);
+    	}
+    	return legend;
+
+    }
+
+    /**
+     * This method initializes centerPanel
+     *
+     * @return javax.swing.JPanel
+     */
+    private JPanel getNorthPanel() {
+        if (northPanel == null) {
+            lblLabellingField = new JLabel();
+            lblLabellingField.setText(PluginServices.getText(this, "labelling_field"));
+            northPanel = new JPanel(new FlowLayout(FlowLayout.LEADING,15,0));
+            northPanel.add(lblLabellingField, null);
+            northPanel.add(getCmbLegendField(), null);
+
+        }
+        return northPanel;
+    }
+
+    private ColorChooserPanel getDotColorChooserPanel() {
+    	if (jcc == null) {
+    		jcc = new ColorChooserPanel() ;
+    		jcc.setAlpha(255);
+    	}
+    	return jcc;
+	}
+
+	/**
+     * This method initializes southPanel
+     *
+     * @return javax.swing.JPanel
+     */
+    private JPanel getDensityButtonsPanel() {
+        if (densityButtonsPanel == null) {
+        	densityButtonsPanel = new GridBagLayoutPanel();
+        	LayoutManager layout = new FlowLayout(FlowLayout.LEADING, 0,0);
+        	JPanel aux = new JPanel(layout);
+        	aux.add(getNumDotSize());
+        	densityButtonsPanel.addComponent(
+        			PluginServices.getText(this, "dot_size"), aux);
+        	aux = new JPanel(layout);
+        	aux.add(getNmbrDotValue());
+            densityButtonsPanel.addComponent(
+            		PluginServices.getText(this,"dot_value"), aux);
+            aux = new JPanel(layout);
+            aux.add(getDotColorChooserPanel());
+            densityButtonsPanel.addComponent(
+            		PluginServices.getText(this, "color"), aux);
+            aux = new JPanel(layout);
+            aux.add(getOutlineColorChooserPanel());
+            densityButtonsPanel.addComponent(
+            		PluginServices.getText(this, "outline_color"), aux);
+        }
+        return densityButtonsPanel;
+    }
+
+    private ColorChooserPanel getOutlineColorChooserPanel() {
+    	if (outlineColorChooserPanel == null) {
+    		outlineColorChooserPanel = new ColorChooserPanel();
+    		outlineColorChooserPanel.setAlpha(255);
+    	}
+    	return outlineColorChooserPanel;
+	}
+
+	/**
+     * This method initializes pnlDensities
+     *
+     * @return javax.swing.JPanel
+     */
+    private JPanel getPnlDensities() {
+        if (pnlDensities == null) {
+            pnlDensities = new JPanel(new BorderLayout(5,0));
+            pnlDensities.setBorder(BorderFactory.createTitledBorder(null,
+					PluginServices.getText(this, "densities")));
+            JPanel aux2 = new JPanel();
+            JPanel aux;
+			aux = new JPanel(new GridLayout(1,3));
+            aux.add(new JLabel(PluginServices.getText(this, "high")));
+            aux.add(new JLabel(PluginServices.getText(this, "medium")));
+            aux.add(new JLabel(PluginServices.getText(this, "low")));
+
+            aux2.add(aux);
+
+			aux = new JPanel(new GridLayout(1,3));
+            aux.add(getRdBtnHigh());
+            aux.add(getRdBtnMedium());
+            aux.add(getRdBtnLow());
+
+            aux2.add(aux);
+            aux2.setLayout(new BoxLayout(aux2, BoxLayout.Y_AXIS));
+
+            pnlDensities.add(aux2, BorderLayout.NORTH);
+            pnlDensities.add(getSldDensity(), BorderLayout.CENTER);
+            pnlDensities.add(getDensityButtonsPanel(), BorderLayout.SOUTH);
+
+            ButtonGroup group = new ButtonGroup();
+            group.add(getRdBtnHigh());
+            group.add(getRdBtnLow());
+            group.add(getRdBtnMedium());
+            getRdBtnMedium().setSelected(true);
+        }
+        return pnlDensities;
+    }
+
+
+	/**
+     * This method initializes cmbLegendField
+     *
+     * @return javax.swing.JComboBox
+     */
+    private JComboBox getCmbLegendField() {
+        if (cmbLegendField == null) {
+            cmbLegendField = new JComboBox();
+        }
+        return cmbLegendField;
+    }
+
+    /**
+     * This method initializes rdBtnHigh
+     *
+     * @return javax.swing.JRadioButton
+     */
+    private JRadioButton getRdBtnHigh() {
+        if (rdBtnHigh == null) {
+            rdBtnHigh = new JRadioButton(new ImageIcon(
+            		getClass().getClassLoader().
+            			getResource("images/high-density-sample.png")));
+            rdBtnHigh.addActionListener(buttonsListener);
+        }
+        return rdBtnHigh;
+    }
+
+    /**
+     * This method initializes rdBtnMedium
+     *
+     * @return javax.swing.JRadioButton
+     */
+    private JRadioButton getRdBtnMedium() {
+        if (rdBtnMedium == null) {
+            rdBtnMedium = new JRadioButton(new ImageIcon(
+            		getClass().getClassLoader().
+        			getResource("images/medium-density-sample.png")));
+            rdBtnMedium.addActionListener(buttonsListener);
+        }
+        return rdBtnMedium;
+    }
+
+    /**
+     * This method initializes rdBtnMax
+     *
+     * @return javax.swing.JRadioButton
+     */
+    private JRadioButton getRdBtnLow() {
+        if (rdBtnLow == null) {
+            rdBtnLow = new JRadioButton(new ImageIcon(
+            		getClass().getClassLoader().
+        			getResource("images/low-density-sample.png")));
+            rdBtnLow.addActionListener(buttonsListener);
+        }
+        return rdBtnLow;
+    }
+
+    /**
+     * This method initializes numDotSize
+     *
+     * @return de.ios.framework.swing.JNumberField
+     */
+    private JTextField getNumDotSize() {
+        if (numDotSize == null) {
+            numDotSize = new JTextField(4);
+        }
+        return numDotSize;
+    }
+
+	/**
+	 * This method initializes nmbrDotValue
+	 *
+	 * @return de.ios.framework.swing.JNumberField
+	 */
+	private JTextField getNmbrDotValue() {
+		if (nmbrDotValue == null) {
+			nmbrDotValue = new JTextField(15);
+
+		}
+		return nmbrDotValue;
+	}
+
+	/**
+	 * This method initializes centerPanel
+	 *
+	 * @return javax.swing.JPanel
+	 */
+	private JPanel getCenterPanel() {
+		if (centerPanel == null) {
+			centerPanel = new JPanel();
+			centerPanel.setLayout(new BorderLayout(5, 5));
+			centerPanel.add(getPnlDensities(), java.awt.BorderLayout.WEST);
+		}
+		return centerPanel;
+	}
+
+	/**
+	 * This method initializes sldDensity
+	 *
+	 * @return javax.swing.JSlider
+	 */
+	private JSlider getSldDensity() {
+		if (sldDensity == null) {
+			sldDensity = new JSlider();
+			sldDensity.setComponentOrientation(ComponentOrientation.RIGHT_TO_LEFT);
+			sldDensity.addChangeListener(sldListener);
+		}
+		return sldDensity;
+	}
+
+}  //  @jve:decl-index=0:visual-constraint="10,10"

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/legend/gui/PanelLegendDotDensity.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/gui/FPanelLocConfig2.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/gui/FPanelLocConfig2.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/gui/FPanelLocConfig2.java	(revision 12191)
@@ -0,0 +1,484 @@
+/*
+ * Created on 18-jun-2004
+ *
+ * TODO To change the template for this generated file go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.project.documents.view.gui;
+
+import java.awt.Color;
+import java.awt.FlowLayout;
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.BorderFactory;
+import javax.swing.DefaultListModel;
+import javax.swing.JDialog;
+import javax.swing.JOptionPane;
+import javax.swing.JPanel;
+import javax.swing.plaf.basic.BasicArrowButton;
+
+import org.gvsig.gui.beans.swing.JButton;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.ui.mdiManager.IWindow;
+import com.iver.andami.ui.mdiManager.WindowInfo;
+import com.iver.cit.gvsig.AddLayer;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.MapControl;
+import com.iver.cit.gvsig.fmap.layers.CancelationException;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLayers;
+import com.iver.cit.gvsig.fmap.layers.layerOperations.Classifiable;
+import com.iver.cit.gvsig.project.documents.view.MapOverview;
+import com.iver.cit.gvsig.project.documents.view.legend.gui.FThemeManagerWindow2;
+
+/**
+ * @author FJP
+ *
+ * TODO To change the template for this generated type comment go to
+ * Window - Preferences - Java - Code Generation - Code and Comments
+ */
+public class FPanelLocConfig2 extends JPanel implements ActionListener,IWindow {
+	private javax.swing.JLabel jLabel = null;
+	private javax.swing.JList jList = null;  //  @jve:decl-index=0:visual-constraint="390,10"
+	private JButton jBtnAddLayer = null;  //
+	private JButton jBtnRemoveLayer = null;
+	private JButton jBtnEditLegend = null;
+	private JButton jBtnCancel = null;
+
+	//private JDialog m_Owner;
+	private MapControl mapCtrl;
+	private WindowInfo m_viewinfo = null;
+	private JPanel pnlButtons = null;  //  @jve:decl-index=0:visual-constraint="10,159"
+	private BasicArrowButton jBtnUp;
+	private BasicArrowButton jBtnDown;
+	/**
+	 * This is the default constructor
+	 */
+	public FPanelLocConfig2( MapControl mc) {
+		super();
+		mapCtrl = mc;
+		initialize();
+		refreshList();
+		updateControls(null);
+	}
+
+	private void refreshList()
+	{
+		DefaultListModel lstModel = (DefaultListModel) getJList().getModel();
+		lstModel.clear();
+		for (int i=mapCtrl.getMapContext().getLayers().getLayersCount()-1; i >=0; i--)
+		{
+			FLayer lyr = mapCtrl.getMapContext().getLayers().getLayer(i);
+			lstModel.addElement(lyr.getName());
+		}
+	}
+
+	/**
+	 * This method initializes this
+	 *
+	 * @return void
+	 */
+	private  void initialize() {
+		this.setLayout(null);
+		this.setSize(550, 200);
+//		this.setPreferredSize(new java.awt.Dimension(370,200));
+		this.add(getJLabel(), null);
+		this.add(getJList(), null);
+		this.add(getJBtnUp(), null);
+		this.add(getJBtnDown(), null);
+		this.add(getJPanel(), null);
+	}
+	/**
+
+	 * This method initializes jLabel
+
+	 *
+
+	 * @return javax.swing.JLabel
+
+	 */
+	private javax.swing.JLabel getJLabel() {
+		if (jLabel == null) {
+			jLabel = new javax.swing.JLabel();
+			jLabel.setText(PluginServices.getText(this,"Capas_del_localizador")+":");
+			jLabel.setBounds(10, 15, 132, 25);
+		}
+		return jLabel;
+	}
+
+	/**
+
+	 * This method initializes jList
+
+	 *
+
+	 * @return javax.swing.JList
+
+	 */
+	private javax.swing.JList getJList() {
+		if (jList == null) {
+			jList = new javax.swing.JList(new DefaultListModel());
+			jList.setBounds(10, 49, 357, 139);
+			jList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
+			jList.setBorder(BorderFactory.createLineBorder(Color.BLACK));
+			jList.addListSelectionListener(new javax.swing.event.ListSelectionListener() {
+
+				public void valueChanged(javax.swing.event.ListSelectionEvent e) {
+					updateControls(e);
+				}
+			});
+
+		}
+		return jList;
+	}
+
+	private void updateControls(javax.swing.event.ListSelectionEvent e)
+	{
+		System.out.println("valueChanged()"); // TODO Auto-generated Event stub valueChanged()
+		DefaultListModel lstModel = (DefaultListModel) getJList().getModel();
+		int selIndex = jList.getSelectedIndex();
+		jBtnDown.setEnabled(false);
+		jBtnUp.setEnabled(false);
+
+		if (selIndex != -1)
+		{
+			if (lstModel.getSize() > 1)
+			{
+				if (selIndex < (lstModel.getSize()-1))
+					jBtnDown.setEnabled(true);
+
+				if (selIndex > 0)
+					jBtnUp.setEnabled(true);
+			}
+
+		}
+
+
+	}
+
+	/**
+
+	 * This method initializes jBtnUp
+
+	 *
+
+	 * @return JButton
+
+	 */
+	private BasicArrowButton getJBtnUp() {
+		if (jBtnUp == null) {
+			jBtnUp = new javax.swing.plaf.basic.BasicArrowButton(
+					javax.swing.SwingConstants.NORTH);
+			jBtnUp.setBounds(374, 49, 25, 23);
+			jBtnUp.setToolTipText(PluginServices.getText(this,"Subir_capa"));
+			jBtnUp.addActionListener(this);
+			jBtnUp.setActionCommand("UP");
+
+		}
+		return jBtnUp;
+	}
+
+	/**
+
+	 * This method initializes jBtnDown
+
+	 *
+
+	 * @return JButton
+
+	 */
+	private BasicArrowButton getJBtnDown() {
+		if (jBtnDown == null) {
+			jBtnDown = new javax.swing.plaf.basic.BasicArrowButton(
+					javax.swing.SwingConstants.SOUTH);
+			jBtnDown.setBounds(374, 164, 25, 23);
+			jBtnDown.setToolTipText(PluginServices.getText(this,"Bajar_capa"));
+			jBtnDown.setActionCommand("DOWN");
+			jBtnDown.addActionListener(this);
+		}
+		return jBtnDown;
+	}
+
+	/**
+
+	 * This method initializes jButton2
+
+	 *
+
+	 * @return JButton
+
+	 */
+	private JButton getJBtnAddLayer() {
+		if (jBtnAddLayer == null) {
+			jBtnAddLayer = new JButton();
+			jBtnAddLayer.setText(PluginServices.getText(this,"Anadir_capa")+"...");
+			jBtnAddLayer.addActionListener(this);
+			jBtnAddLayer.setActionCommand("ADD_LAYER");
+		}
+		return jBtnAddLayer;
+	}
+
+	/**
+
+	 * This method initializes jBtnRemoveLayer
+
+	 *
+
+	 * @return JButton
+
+	 */
+	private JButton getJBtnRemoveLayer() {
+		if (jBtnRemoveLayer == null) {
+			jBtnRemoveLayer = new JButton();
+			jBtnRemoveLayer.setText(PluginServices.getText(this,"Quitar_capa")+"...");
+			jBtnRemoveLayer.addActionListener(this);
+			jBtnRemoveLayer.setActionCommand("REMOVE_LAYER");
+
+		}
+		return jBtnRemoveLayer;
+	}
+
+	/**
+
+	 * This method initializes jBtnEditLegend
+
+	 *
+
+	 * @return JButton
+
+	 */
+	private JButton getJBtnEditLegend() {
+		if (jBtnEditLegend == null) {
+			jBtnEditLegend = new JButton();
+			jBtnEditLegend.setText(PluginServices.getText(this,"Editar_leyenda")+"...");
+			jBtnEditLegend.addActionListener(this);
+			jBtnEditLegend.setActionCommand("EDIT_LEGEND");
+		}
+		return jBtnEditLegend;
+	}
+
+	/**
+
+	 * This method initializes jBtnCancel
+
+	 *
+
+	 * @return JButton
+
+	 */
+	private JButton getJBtnCancel() {
+		if (jBtnCancel == null) {
+			jBtnCancel = new JButton();
+			jBtnCancel.setText(PluginServices.getText(this,"Cerrar"));
+			jBtnCancel.setActionCommand("CANCEL");
+			jBtnCancel.addActionListener(this);
+
+		}
+		return jBtnCancel;
+	}
+
+	/* (non-Javadoc)
+	 * @see java.awt.event.ActionListener#actionPerformed(java.awt.event.ActionEvent)
+	 */
+	public void actionPerformed(ActionEvent e)
+	{
+		DefaultListModel lstModel = (DefaultListModel) getJList().getModel();
+		FLayers theLayers = mapCtrl.getMapContext().getLayers();
+       // IProjection proj = null;
+
+		int numLayers = theLayers.getLayersCount()-1;
+
+		if (e.getActionCommand() == "CANCEL")
+		{
+			if (PluginServices.getMainFrame() != null)
+			{
+				PluginServices.getMDIManager().closeWindow(FPanelLocConfig2.this);
+			}
+			else
+			{
+				((JDialog) (getParent().getParent().getParent().getParent())).dispose();
+			}
+		}
+		if (e.getActionCommand() == "ADD_LAYER")
+		{
+            AddLayer addLayer = (AddLayer)PluginServices.getExtension( AddLayer.class);//new AddLayer();
+            //addLayer.initialize();
+            if (addLayer.addLayers(mapCtrl)) {
+	            refreshList();
+	            updateControls(null);
+            }
+            if (mapCtrl instanceof MapOverview){
+            	((MapOverview)mapCtrl).refreshExtent();
+            }
+
+ 		}
+		if (e.getActionCommand() == "REMOVE_LAYER")
+		{
+			if (jList.getSelectedIndex() != -1)
+			{
+				theLayers.removeLayer((String) lstModel.get(jList.getSelectedIndex()));
+				lstModel.remove(jList.getSelectedIndex());
+				///mapCtrl.drawMap();
+				updateControls(null);
+				  if (mapCtrl instanceof MapOverview){
+                	((MapOverview)mapCtrl).refreshExtent();
+                }
+			}
+		}
+		if (e.getActionCommand() == "EDIT_LEGEND")
+		{
+			int idSelec = jList.getSelectedIndex();
+			if (idSelec != -1)
+			{
+				FLayer lyr = theLayers.getLayer((String) lstModel.get(idSelec));
+				if (lyr instanceof Classifiable)
+				{
+					FThemeManagerWindow2 m_LegendEditor = new FThemeManagerWindow2();
+					try {
+						theLayers.setActive(false);
+						lyr.setActive(true);
+						m_LegendEditor.setMapContext(mapCtrl.getMapContext());
+					} catch (DriverException e1) {
+						// TODO Auto-generated catch block
+						e1.printStackTrace();
+					}
+					if (PluginServices.getMainFrame() == null) {
+						JDialog dlg = new JDialog();
+
+						m_LegendEditor.setPreferredSize(m_LegendEditor.getSize());
+						dlg.getContentPane().add(m_LegendEditor);
+						dlg.setModal(true);
+						dlg.pack();
+						dlg.show();
+
+					} else {
+						PluginServices.getMDIManager().addWindow(m_LegendEditor);
+					}
+				}
+				else
+				{
+					JOptionPane.showMessageDialog(null, PluginServices.getText(this,"Solo_para_capas_vectoriales")+".");
+				}
+
+			}
+
+		}
+		if (e.getActionCommand() == "UP")
+		{
+			int idSelec = jList.getSelectedIndex();
+		    int fromIndex = idSelec;
+		    int toIndex = idSelec-1;
+		        FLayer aux = theLayers.getLayer((String) lstModel.get(fromIndex));
+		        try {
+					theLayers.moveTo(numLayers-fromIndex, numLayers-toIndex);
+				} catch (CancelationException e1) {
+					e1.printStackTrace();
+				}
+
+		        lstModel.remove(fromIndex);
+		        lstModel.add(toIndex,aux.getName());
+
+		        jList.setSelectedIndex(toIndex);
+
+		        ///mapCtrl.drawMap();
+		}
+		if (e.getActionCommand() == "DOWN")
+		{
+			int idSelec = jList.getSelectedIndex();
+		    int fromIndex = idSelec;
+		    int toIndex = idSelec+1;
+		        FLayer aux = theLayers.getLayer((String) lstModel.get(fromIndex));
+		        try {
+		        	theLayers.moveTo(numLayers-fromIndex, numLayers-toIndex);
+				} catch (CancelationException e1) {
+					e1.printStackTrace();
+				}
+
+		        lstModel.remove(fromIndex);
+		        lstModel.add(toIndex,aux.getName());
+
+		        jList.setSelectedIndex(toIndex);
+
+		        ///mapCtrl.drawMap();
+		}
+
+
+	}
+	/* (non-Javadoc)
+	 * @see com.iver.mdiApp.ui.MDIManager.View#getViewInfo()
+	 */
+	public WindowInfo getWindowInfo() {
+		if (m_viewinfo==null){
+    		m_viewinfo=new WindowInfo(WindowInfo.MODALDIALOG);
+			m_viewinfo.setTitle(PluginServices.getText(this,"Configurar_localizador"));
+			m_viewinfo.setWidth(this.getWidth()+8);
+			m_viewinfo.setHeight(this.getHeight()+8);
+		}
+			return m_viewinfo;
+		}
+	/**
+	 * @see com.iver.mdiApp.ui.MDIManager.IWindow#windowActivated()
+	 */
+	public void viewActivated() {
+	}
+
+	/**
+	 * This method initializes jPanel
+	 *
+	 * @return javax.swing.JPanel
+	 */
+	private JPanel getJPanel() {
+		if (pnlButtons == null) {
+			pnlButtons = new JPanel(new FlowLayout(FlowLayout.RIGHT, 5, 5));
+			pnlButtons.setBounds(new java.awt.Rectangle(0,200, this.getWidth(),37));
+			pnlButtons.add(getJBtnAddLayer(), null);
+			pnlButtons.add(getJBtnRemoveLayer(), null);
+			pnlButtons.add(getJBtnEditLegend(), null);
+			pnlButtons.add(getJBtnCancel(), null);
+		}
+		return pnlButtons;
+	}
+
+        }  //  @jve:visual-info  decl-index=0 visual-constraint="10,10"

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/gui/FPanelLocConfig2.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/toc/FLyrVectEditPropertiesTocMenuEntry2.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/toc/FLyrVectEditPropertiesTocMenuEntry2.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/toc/FLyrVectEditPropertiesTocMenuEntry2.java	(revision 12191)
@@ -0,0 +1,172 @@
+package com.iver.cit.gvsig.project.documents.view.toc;
+
+import javax.swing.JDialog;
+
+import com.iver.andami.PluginServices;
+import com.iver.cit.gvsig.fmap.layers.FLayer;
+import com.iver.cit.gvsig.fmap.layers.FLyrAnnotation;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.layerOperations.ClassifiableVectorial;
+import com.iver.cit.gvsig.project.documents.view.legend.gui.FThemeManagerWindow2;
+import com.iver.cit.gvsig.project.documents.view.toc.AbstractTocContextMenuAction;
+import com.iver.cit.gvsig.project.documents.view.toc.ITocItem;
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+/* CVS MESSAGES:
+ *
+ * $Id$
+ * $Log$
+ * Revision 1.1.2.2  2007-04-10 14:38:10  jmvivo
+ * Sustituida la entrada del toc de 'propiedades'
+ *
+ * Revision 1.1.2.1  2007/04/10 11:05:45  jaume
+ * REMOVED UPDATE WINDOW PROPERTIES FROM build.xml
+ *
+ * Revision 1.1.2.1  2007/04/10 10:51:49  jaume
+ * *** empty log message ***
+ *
+ * Revision 1.2.2.2  2007/01/23 12:25:44  caballero
+ * No mostrar propiedades de una capa de anotaciones
+ *
+ * Revision 1.2.2.1  2006/11/15 04:10:44  jjdelcerro
+ * *** empty log message ***
+ *
+ * Revision 1.2  2006/10/02 13:52:34  jaume
+ * organize impots
+ *
+ * Revision 1.1  2006/09/15 10:41:30  caballero
+ * extensibilidad de documentos
+ *
+ * Revision 1.1  2006/09/12 15:58:14  jorpiell
+ * "Sacadas" las opcines del men� de FPopupMenu
+ *
+ *
+ */
+/**
+ * Muestra el men� de propiedades del tema.
+ *
+ * @author jmorell
+ */
+
+
+public class FLyrVectEditPropertiesTocMenuEntry2 extends AbstractTocContextMenuAction {
+	public String getGroup() {
+		return "group2"; //FIXME
+	}
+
+	public int getGroupOrder() {
+		return 20;
+	}
+
+	public int getOrder() {
+		return 0;
+	}
+
+	public String getText() {
+		return PluginServices.getText(this, "propiedades");
+	}
+
+	public boolean isEnabled(ITocItem item, FLayer[] selectedItems) {
+		return selectedItems.length == 1;
+	}
+
+	public boolean isVisible(ITocItem item, FLayer[] selectedItems) {
+		if (isTocItemBranch(item)) {
+			FLayer lyr = getNodeLayer(item);
+            if ((lyr instanceof ClassifiableVectorial)) {
+            	if (!((lyr instanceof FLyrVect) &&
+            			!((FLyrVect)lyr).isPropertiesMenuVisible())){
+            		if (!(lyr instanceof FLyrAnnotation))
+            			return true;
+            	}
+
+            }
+		}
+		return false;
+
+	}
+
+
+	public void execute(ITocItem item, FLayer[] selectedItems) {
+		FLayer[] actives = selectedItems;
+		FThemeManagerWindow2 fThemeManagerWindow;
+    	if (actives.length==1) {
+    		if (!actives[0].isAvailable()) return;
+    		System.out.println("openPliegoThemeProperties(): Una sola capa. Abrimos el panel para la capa " + actives[0]);
+    		fThemeManagerWindow = new FThemeManagerWindow2();
+    		try {
+    			fThemeManagerWindow.setMapContext(getMapContext());
+    		} catch (com.iver.cit.gvsig.fmap.DriverException e1) {
+    			e1.printStackTrace();
+    		}
+            //PluginServices.getMDIManager().addView(fThemeManagerWindow);
+    		if (PluginServices.getMainFrame() == null) {
+    			JDialog dlg = new JDialog();
+    			fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
+    			dlg.getContentPane().add(fThemeManagerWindow);
+    			dlg.setModal(false);
+    			dlg.pack();
+    			dlg.show();
+    		} else {
+    			PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
+    		}
+    	} else {
+        	for (int i = 0; i < actives.length; i++){
+        		if (actives[0].isAvailable()) {
+        			System.out.println("openPliegoThemeProperties(): Muchas capas. Abrimos el panel para la capa " + actives[i]);
+        			fThemeManagerWindow = new FThemeManagerWindow2(actives[i], getMapContext());
+        			//PluginServices.getMDIManager().addView(fThemeManagerWindow);
+        			if (PluginServices.getMainFrame() == null) {
+        				JDialog dlg = new JDialog();
+        				fThemeManagerWindow.setPreferredSize(fThemeManagerWindow.getSize());
+        				dlg.getContentPane().add(fThemeManagerWindow);
+        				dlg.setModal(false);
+        				dlg.pack();
+        				dlg.show();
+        			} else {
+        				PluginServices.getMDIManager().addWindow(fThemeManagerWindow);
+        			}
+        		}
+        	}
+    	}
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/project/documents/view/toc/FLyrVectEditPropertiesTocMenuEntry2.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/AboutGraphExtension.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/AboutGraphExtension.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/AboutGraphExtension.java	(revision 12191)
@@ -0,0 +1,41 @@
+package com.iver.cit.gvsig;
+
+import com.iver.andami.PluginServices;
+import com.iver.andami.plugins.Extension;
+import com.iver.cit.gvsig.About;
+import com.iver.cit.gvsig.gui.panels.FPanelAbout;
+
+/**
+ * About extension.
+ *
+ * Add the about coments to the gvSIG About panel
+ */
+
+public class AboutGraphExtension extends Extension {
+
+	public void initialize() {
+		// TODO Auto-generated method stub
+
+	}
+
+	public void postInitialize() {
+		About about=(About)PluginServices.getExtension(About.class);
+		FPanelAbout panelAbout=about.getAboutPanel();
+		java.net.URL aboutURL = this.getClass().getResource(
+	        "/about.htm");
+	        panelAbout.addAboutUrl(PluginServices.getText(this,"piloto_de_redes"),aboutURL);
+	}
+
+	public void execute(String actionCommand) {
+
+	}
+
+	public boolean isEnabled() {
+		return false;
+	}
+
+	public boolean isVisible() {
+		return false;
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src/com/iver/cit/gvsig/AboutGraphExtension.java
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/symbols/Red and Cyan MarkerFi.ll+SimpleFill.sym
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/symbols/Red and Cyan MarkerFi.ll+SimpleFill.sym
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/symbols/Base Symbols/Marker Symbols/Red and Cyan SimpleFill.sym
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/symbols/Base Symbols/Marker Symbols/Red and Cyan SimpleFill.sym
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/symbols/General Symbols/Copia de smoking area.sym
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/symbols/General Symbols/Copia de smoking area.sym
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/symbols/General Symbols/restaurant.sym
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/symbols/General Symbols/restaurant.sym
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/symbols/General Symbols/smoking area.sym
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/symbols/General Symbols/smoking area.sym
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/.cvsignore
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/.cvsignore	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/.cvsignore	(revision 12191)
@@ -0,0 +1 @@
+dist-src

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/.cvsignore
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/build.xml
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/build.xml	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/build.xml	(revision 12191)
@@ -0,0 +1,143 @@
+<project name="Generar extension en Andami" default="generate-without-source" basedir=".">
+    <description>
+        Instala el plugin de ejemplo en Andami.
+    </description>
+  <!-- set global properties for this build -->
+  <property name="src" location="src"/>
+  <property name="build" location="bin"/>
+  <property name="dist"  location="dist"/>
+  <property name="dist-src-name"  value="dist-src"/>
+  <property name="dist-src"  location="${dist-src-name}"/>
+  <property name="plugin" value="com.iver.cit.gvsig.graph"/>
+  <property name="plugin-fmap-gvsig" value="com.iver.cit.gvsig.graph-fmap-gvsig"/>
+  <property name="plugin-graph-gvsig" value="com.iver.cit.gvsig.graph-gvsig"/>
+  <property name="extension-dir" location="../_fwAndami/gvSIG/extensiones"/>
+  <property name="mainPlugin" value="com.iver.cit.gvsig" />
+  <property name="fmapLibs"  location="../libFMap/lib"/>
+  <target name="init">
+    <!-- Create the time stamp -->
+    <tstamp/>
+    <!-- Create the build directory structure used by compile -->
+    <mkdir dir="${build}"/>
+    <mkdir dir="${dist}"/>
+
+  </target>
+	
+  <target name="generate-source-package">
+  	<delete dir="${dist-src}" quiet="yes"/>
+  	<mkdir dir="${dist-src}"/>
+  	<basename file="${basedir}" property="extensionProjectDir"/>
+  	<mkdir dir="${dist-src}/${extensionProjectDir}"/>
+    <copy todir="${dist-src}/${extensionProjectDir}">
+      <fileset dir="${basedir}"/>
+    </copy>
+  	<copy todir="${dist-src}">
+  		<fileset dir="${basedir}/install/resources" includes="Leeme-predes.txt, Readme-predes.txt"/>
+  	</copy>
+  	<delete dir="${dist-src}/${extensionProjectDir}/bin"/>
+  	<mkdir dir="${dist-src}/${extensionProjectDir}/bin"/>
+  	<delete dir="${dist-src}/${extensionProjectDir}/src-test"/>
+  	<mkdir dir="${dist-src}/${extensionProjectDir}/src-test"/>
+  	<delete dir="${dist-src}/${extensionProjectDir}/install"/>
+  	<delete dir="${dist-src}/${extensionProjectDir}/dist" quiet="yes"/>
+  	<delete dir="${dist-src}/${extensionProjectDir}/dist-src" quiet="yes"/>
+  	<delete dir="${dist-src}/${extensionProjectDir}/test-files" quiet="yes"/>
+  	<delete dir="${dist-src}/${extensionProjectDir}/test-file" quiet="yes"/>
+  	<loadproperties srcFile="build.number"/>
+  	<replace casesensitive="true"
+  	  	token="#build.number#"
+  		value="${build.number}"
+  		dir="${dist-src}"
+  		includes="Leeme-predes.txt, Readme-predes.txt"/>  		
+  	 <zip destfile="${dist-src}/gvSIG_pilot_redes-10_${build.number}-src.zip"
+  	       basedir="${dist-src-name}"
+  	       excludes="*.zip"
+  	  />
+  		
+  </target>
+	
+  <target name="buildNumber">
+	<propertyfile
+			file="build.number"
+			comment="Build Number for ANT. Do not edit!">
+			<entry  key="build.number" default="0" type="int" operation="+"/>
+	</propertyfile>
+	<property file="build.number"/>
+  </target>
+
+  <target name="distribution"
+	description="increment build number and generate the distribution without the source file"
+	depends="buildNumber,generate-without-source">
+  </target>
+	
+  <target name="generate-without-source" description="generate the distribution without the source file" >
+    <!-- Create the distribution directory -->
+    <mkdir dir="${dist}"/>
+    <mkdir dir="${dist}/lib"/>
+
+
+
+    <!--
+    - ->
+    <jar jarfile="${fmapLibs}/jts-1.7.jar" basedir="${build}" update="yes" includes="com/vividsolutions/**"/>
+
+    <!- - Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
+    <jar jarfile="${dist}/lib/${plugin-fmap-gvsig}.jar" basedir="${build}" includes="com/iver/cit/fmap/**,com/iver/cit/gvsig/**,com/iver/cit/project/**"
+     excludes="com/iver/cit/gvsig/project/documents/view/**" />
+    <jar jarfile="${dist}/lib/${plugin}.jar" basedir="${build}" includes="com/iver/cit/**"/>
+  	<jar jarfile="${extension-dir}/${mainPlugin}/lib/${plugin-graph-gvsig}.jar"
+  			basedir="${build}"
+  			includes="com/iver/cit/gvsig/project/documents/view/**"
+  			/>
+
+
+    <copy file="config/config.xml" todir="${dist}"/>
+    <copy file="config/about.htm" todir="${dist}"/>
+  	<loadproperties srcFile="build.number"/>
+  	<replace casesensitive="true"
+  		file="${dist}/about.htm"
+  	  	token="#build.number#"
+  		value="${build.number}"/>
+  	<copy file="build.number" todir="${dist}"/>
+    <copy todir="${dist}">
+      <fileset dir="config/" includes="text*.properties"/>
+    </copy>
+    <copy todir="${dist}/lib">
+      <fileset dir="lib" includes="*"/>
+    </copy>
+    <copy todir="${dist}/images">
+      <fileset dir="images/" includes="*"/>
+    </copy>
+    <copy todir="${dist}/symbols">
+      <fileset dir="symbols/" includes="**/**"/>
+    </copy>
+
+    <copy todir="${extension-dir}/${plugin}/">
+      <!--<fileset dir="${dist}" includes="**/**"/>-->
+      <fileset dir="${dist}">
+      	<exclude name="**/${plugin-fmap-gvsig}.jar"/>
+      	<include name="**/**"/>
+	  </fileset>
+    </copy>
+  	<copy todir="${extension-dir}/${mainPlugin}/lib/">
+  	  		<fileset dir="${dist}/lib" includes="**/${plugin-fmap-gvsig}.jar"/>
+  	</copy>
+  <!--${extension-dir}/${mainPlugin}/lib/${mainPlugin}.jar	<copy todir="${fmapLibs}">
+  		<fileset dir="${dist}/lib" includes="**/${plugin-fmap-gvsig}.jar"/>
+  	</copy> -->
+ 	<delete dir="${dist}"/>
+    </target>
+
+    <target name="save-gvsig-jar-to-install-dir" description="Save the gvsig.jar to installdir" >
+  	<!-- ******************************* -->
+
+  	<copy todir="./install">
+  		<fileset dir="${extension-dir}/com.iver.cit.gvsig/lib/">
+  			<include name="{plugin-graph-gvsig}.jar"/>
+		</fileset>
+  	</copy>
+  	<!-- ******************************* -->
+
+  </target>
+</project>
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/build.xml
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/.classpath
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/.classpath	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/.classpath	(revision 12191)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src"/>
+	<classpathentry kind="src" path="src-test"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="src" path="/_fwAndami"/>
+	<classpathentry kind="src" path="/libFMap"/>
+	<classpathentry kind="src" path="/libCq CMS for java"/>
+	<classpathentry kind="src" path="/libIverUtiles"/>
+	<classpathentry kind="src" path="/appgvSIG"/>
+	<classpathentry kind="lib" path="lib/colt.jar"/>
+	<classpathentry kind="lib" path="lib/commons-collections-3.2.jar"/>
+	<classpathentry sourcepath="/JUNG_1_7_4" kind="lib" path="lib/jung-1.7.4.jar"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/libGDBMS"/>
+	<classpathentry sourcepath="ECLIPSE_HOME/plugins/org.eclipse.jdt.source_3.1.1/src/org.junit_3.8.1/junitsrc.zip" kind="var" path="JUNIT_HOME/junit.jar"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/extGeoProcessing"/>
+	<classpathentry sourcepath="D:/eclipse_3_1/workspace_pruebas/jts/src" kind="lib" path="/libFMap/lib/jts-1.7.jar"/>
+	<classpathentry kind="lib" path="/appgvSIG/lib/batik-awt-util.jar"/>
+	<classpathentry kind="lib" path="/_fwAndami/lib/castor-0.9.5.3-xml.jar"/>
+	<classpathentry sourcepath="/libUI/src" kind="lib" path="/_fwAndami/lib/beans.jar"/>
+	<classpathentry combineaccessrules="false" kind="src" path="/extCAD"/>
+	<classpathentry sourcepath="/libDriverManager" kind="lib" path="/libFMap/lib/driver-manager-1.1.jar"/>
+	<classpathentry kind="output" path="bin"/>
+</classpath>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/.classpath
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/.project
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/.project	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/.project	(revision 12191)
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>extGraph_predes</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+		<buildCommand>
+			<name>de.loskutov.FileSync.FSBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+		<nature>org.eclipse.jem.beaninfo.BeanInfoNature</nature>
+	</natures>
+</projectDescription>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/.project
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestAngle.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestAngle.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestAngle.java	(revision 12191)
@@ -0,0 +1,111 @@
+/* gvSIG. Sistema de Informaci�n Geogr�fica de la Generalitat Valenciana
+ *
+ * Copyright (C) 2004 IVER T.I. and Generalitat Valenciana.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * 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.
+ *
+ * For more information, contact:
+ *
+ *  Generalitat Valenciana
+ *   Conselleria d'Infraestructures i Transport
+ *   Av. Blasco Ib��ez, 50
+ *   46010 VALENCIA
+ *   SPAIN
+ *
+ *      +34 963862235
+ *   gvsig@gva.es
+ *      www.gvsig.gva.es
+ *
+ *    or
+ *
+ *   IVER T.I. S.A
+ *   Salamanca 50
+ *   46005 Valencia
+ *   Spain
+ *
+ *   +34 963163400
+ *   dac@iver.es
+ */
+package com.iver.cit.gvsig.graphtests;
+
+import com.iver.cit.gvsig.graph.core.TurnUtil;
+import com.vividsolutions.jts.algorithm.CGAlgorithms;
+import com.vividsolutions.jts.geom.Coordinate;
+import com.vividsolutions.jts.geom.LineSegment;
+
+import junit.framework.TestCase;
+
+public class TestAngle extends TestCase {
+	
+	public void testAngle() {
+		Coordinate c1, c2, c3;
+		double grados;
+		
+		// 0 grados (no hay giro
+		c1 = new Coordinate(-1, 0);
+		c2 = new Coordinate(0, 0);
+		c3 = new Coordinate(1, 0);
+		grados = TurnUtil.angle(c1, c2, c3);
+		assertEquals(0.0, grados, 0.0);
+		
+		
+		// 90 grados (giro a la izquierda)
+		c1 = new Coordinate(0, -1);
+		c2 = new Coordinate(0, 0);
+		c3 = new Coordinate(-1, 0);
+		grados = TurnUtil.angle(c1, c2, c3);
+		assertEquals(90.0, grados, 0.0);
+
+		
+		// 180 grados (360 grados) giro completo
+		c1 = new Coordinate(-1, 0);
+		c2 = new Coordinate(0, 0);
+		c3 = new Coordinate(-1, 0);
+		grados = TurnUtil.angle(c1, c2, c3);
+		assertEquals(180.0, grados, 0.0);
+		
+		// 270 grados (giro a la derecha)
+		c1 = new Coordinate(-1, 0);
+		c2 = new Coordinate(0, 0);
+		c3 = new Coordinate(0, 1);
+		grados = TurnUtil.angle(c1, c2, c3);
+		assertEquals(270.0, grados, 0.0);
+		
+	}
+	
+	private double angle(Coordinate c1, Coordinate c2, Coordinate c3) {
+		double resul = 0.0;
+		// Normalizamos:
+		Coordinate origin = new Coordinate(0.0, 0.0);
+		Coordinate cAux1 = new Coordinate(c2.x-c1.x, c2.y-c1.y);
+		Coordinate cAux2 = new Coordinate(c3.x-c2.x, c3.y-c2.y);
+		LineSegment v1 = new LineSegment(origin, cAux1);
+		LineSegment v2 = new LineSegment(origin, cAux2);
+		double jtsResul = CGAlgorithms.orientationIndex(c1, c2, c3);
+		double prodEscalar = cAux1.x*cAux2.x + cAux1.y*cAux2.y;
+		double cosAlpha = prodEscalar / (v1.getLength() * v2.getLength()) ; 
+		resul = Math.toDegrees(Math.acos(cosAlpha));
+		
+        if (cAux1.x * cAux2.y > cAux1.y * cAux2.x) {
+            resul = 360 - resul;
+        }
+
+		System.out.println(resul);
+		return resul;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestAngle.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestLoader.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestLoader.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestLoader.java	(revision 12191)
@@ -0,0 +1,201 @@
+package com.iver.cit.gvsig.graphtests;
+
+
+import java.io.File;
+import java.sql.Driver;
+import java.sql.DriverManager;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import org.cresques.cts.IProjection;
+
+import com.hardcode.driverManager.DriverLoadException;
+import com.hardcode.driverManager.DriverValidation;
+import com.hardcode.gdbms.engine.data.DataSource;
+import com.hardcode.gdbms.engine.data.DataSourceFactory;
+import com.hardcode.gdbms.engine.data.NoSuchTableException;
+import com.hardcode.gdbms.engine.data.driver.DBDriver;
+import com.hardcode.gdbms.engine.data.driver.DriverException;
+import com.hardcode.gdbms.engine.data.driver.FileDriver;
+import com.hardcode.gdbms.engine.data.driver.ObjectDriver;
+import com.iver.cit.gvsig.fmap.crs.CRSFactory;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.LayerFactory;
+import com.iver.cit.gvsig.fmap.layers.SelectableDataSource;
+import com.iver.cit.gvsig.graph.GraphException;
+import com.iver.cit.gvsig.graph.core.EdgeWeightLabeller;
+import com.iver.cit.gvsig.graph.core.FNode;
+import com.iver.cit.gvsig.graph.core.IGraph;
+import com.iver.cit.gvsig.graph.core.JungGraph;
+import com.iver.cit.gvsig.graph.core.Network;
+import com.iver.cit.gvsig.graph.core.loaders.NetworkLoader;
+import com.iver.cit.gvsig.graph.core.loaders.NetworkRedLoader;
+import com.iver.cit.gvsig.graph.solvers.Route;
+import com.iver.cit.gvsig.graph.solvers.ShortestPathSolverAStar;
+import com.iver.cit.gvsig.graph.solvers.ShortestPathSolverDijkstra;
+
+import edu.uci.ics.jung.algorithms.shortestpath.DijkstraDistance;
+import edu.uci.ics.jung.algorithms.shortestpath.DijkstraShortestPath;
+import edu.uci.ics.jung.graph.ArchetypeVertex;
+import edu.uci.ics.jung.graph.Graph;
+
+public class TestLoader extends TestCase {
+	DataSourceFactory dsf;
+
+	FLyrVect lyr;
+
+	public void testLoadRedNetwork() {
+		NetworkRedLoader netLoader = new NetworkRedLoader();
+		IGraph g = netLoader.loadNetwork();
+
+		// Probamos la algoritmia: distancia entre nodo 1 y nodo 1000
+		Network net = new Network();
+		ShortestPathSolverDijkstra solver = new ShortestPathSolverDijkstra();
+		net.setLayer(lyr);
+		net.setGraph(g);
+		solver.setNetwork(net);
+		
+		ShortestPathSolverAStar solverAstar = new ShortestPathSolverAStar();
+		solverAstar.setNetwork(net);
+		
+		try {
+
+			// Primer punto
+			net.addFlag(433647.09370, 4488029, 10);
+
+			// Segundo punto
+			net.addFlag(437290.96875, 4481547, 10);
+			long t1 = System.currentTimeMillis();
+			Route resul;
+			solver.setFielStreetName("Nombre");
+			resul = solver.calculateRoute();
+			long t2 = System.currentTimeMillis();
+
+			// assertEquals(dist.doubleValue(), 8887, 0);
+
+			System.out.println("fjp dist =" + resul.getLength()
+					+ " meters. msecs: " + (t2 - t1));
+
+			t1 = System.currentTimeMillis();
+			Route resul2;
+			solverAstar.setFielStreetName("Nombre");
+			resul2 = solverAstar.calculateRoute();
+			t2 = System.currentTimeMillis();
+
+			System.out.println("ASTAR dist =" + resul2.getLength()
+					+ " meters. msecs: " + (t2 - t1));
+			
+			assertEquals(resul.getLength(), resul2.getLength(), 0.0);
+			
+			JungGraph jG = new JungGraph(g);
+			// Probamos la algoritmia: distancia entre nodo 1 y nodo 1000
+			DijkstraShortestPath distCalculator = new DijkstraShortestPath(jG,
+					new EdgeWeightLabeller());
+			FNode vOrig = jG.getVertexByID(1);
+			FNode vEnd = jG.getVertexByID(1000);
+			t1 = System.currentTimeMillis();
+			Number dist = distCalculator.getDistance(vOrig, vEnd);
+			t2 = System.currentTimeMillis();
+
+			// assertEquals(dist.doubleValue(), 8887, 0);
+
+			System.out
+					.println("dist =" + dist + " meters. msecs: " + (t2 - t1));
+
+			System.out.println(vOrig + " - " + vEnd);
+			System.out.println(vOrig.getX() + ", " + vOrig.getY() + " - "
+					+ vEnd.getX() + ", " + vEnd.getY());
+			
+			assertEquals(resul.getLength(), dist.doubleValue(), 0.4);
+
+		} catch (GraphException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+	}
+
+	/*
+	 * Test method for
+	 * 'com.iver.cit.gvsig.graph.core.NetworkLoader.loadNetwork()'
+	 */
+	public void testLoadNetwork() {
+		// if (true) return;
+		NetworkLoader netLoader = new NetworkLoader(true);
+
+		DataSource dsNodes;
+		try {
+			dsNodes = dsf.createRandomDataSource("nodes",
+					DataSourceFactory.MANUAL_OPENING);
+
+			DataSource dsEdges = dsf.createRandomDataSource("edges",
+					DataSourceFactory.MANUAL_OPENING);
+
+			SelectableDataSource sdsNodes = new SelectableDataSource(dsNodes);
+			SelectableDataSource sdsEdges = new SelectableDataSource(dsEdges);
+
+			netLoader.setNodeReader(sdsNodes);
+			netLoader.setEdgeReader(sdsEdges);
+
+			Graph g = netLoader.loadJungNetwork();
+
+			System.out.println("Num nodos=" + g.numVertices() + " numEdges = "
+					+ g.numEdges());
+
+			// Probamos la algoritmia: distancia entre nodo 1 y nodo 1000
+			DijkstraDistance distCalculator = new DijkstraDistance(g,
+					new EdgeWeightLabeller());
+			ArchetypeVertex vOrig = netLoader.getIndexer().getVertex(1);
+			ArchetypeVertex vEnd = netLoader.getIndexer().getVertex(1000);
+			long t1 = System.currentTimeMillis();
+			Number dist = distCalculator.getDistance(vOrig, vEnd);
+			long t2 = System.currentTimeMillis();
+
+			// assertEquals(dist.doubleValue(), 8887, 0);
+
+			System.out
+					.println("dist =" + dist + " meters. msecs: " + (t2 - t1));
+			System.out.println(vOrig + " - " + vEnd);
+			System.out.println(vOrig.getUserDatum("X") + ", "
+					+ vOrig.getUserDatum("Y") + " - " + vEnd.getUserDatum("X")
+					+ ", " + vEnd.getUserDatum("Y"));
+
+		} catch (DriverLoadException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (NoSuchTableException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (DriverException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+
+	}
+
+	protected void setUp() throws Exception {
+		// Setup de los drivers
+		LayerFactory
+				.setDriversPath("../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
+
+		// Setup del factory de DataSources
+		dsf = LayerFactory.getDataSourceFactory();
+
+		// Setup de las tablas
+		dsf.addFileDataSource("gdbms dbf driver", "nodes", "c:/nodes.dbf");
+		dsf.addFileDataSource("gdbms dbf driver", "edges", "c:/edges.dbf");
+
+		IProjection prj = CRSFactory.getCRS("EPSG:23030");
+		File shpFile = new File("c:/ejes.shp");
+		lyr = (FLyrVect) LayerFactory.createLayer("Ejes", "gvSIG shp driver",
+				shpFile, prj);
+
+	}
+
+	protected void tearDown() throws Exception {
+		// TODO Auto-generated method stub
+		super.tearDown();
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestLoader.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestOneToMany.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestOneToMany.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestOneToMany.java	(revision 12191)
@@ -0,0 +1,89 @@
+package com.iver.cit.gvsig.graphtests;
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.cresques.cts.IProjection;
+
+import com.iver.cit.gvsig.fmap.crs.CRSFactory;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.LayerFactory;
+import com.iver.cit.gvsig.graph.GraphException;
+import com.iver.cit.gvsig.graph.core.GvFlag;
+import com.iver.cit.gvsig.graph.core.IGraph;
+import com.iver.cit.gvsig.graph.core.Network;
+import com.iver.cit.gvsig.graph.core.loaders.NetworkRedLoader;
+import com.iver.cit.gvsig.graph.solvers.OneToManySolver;
+import com.iver.cit.gvsig.graph.solvers.Route;
+
+public class TestOneToMany extends TestCase {
+
+	FLyrVect lyr;
+	Network net;
+	IGraph g;
+
+
+	protected void setUp() throws Exception {
+		super.setUp();
+		// Setup de los drivers
+		LayerFactory
+				.setDriversPath("../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
+
+		// Setup del factory de DataSources
+
+		IProjection prj = CRSFactory.getCRS("EPSG:23030");
+		File shpFile = new File("test_files/ejes.shp");
+		lyr = (FLyrVect) LayerFactory.createLayer("Ejes", "gvSIG shp driver",
+				shpFile, prj);
+		
+		NetworkRedLoader netLoader = new NetworkRedLoader();
+		netLoader.setNetFile(new File("test_files/ejes.net"));
+		g = netLoader.loadNetwork();
+		
+		net = new Network();
+		
+		
+		
+		
+		
+		
+		
+	}
+
+	public void testCalculate() throws GraphException {
+		OneToManySolver solver = new OneToManySolver();
+		net.setLayer(lyr);
+		net.setGraph(g);
+		solver.setNetwork(net);
+		
+		//		 Source flag
+		GvFlag sourceFlag = net.createFlag(441901, 4475977, 10);
+		solver.setSourceFlag(sourceFlag);
+
+		//		 Destination flags
+		net.addFlag(441901, 4475977, 10);
+		net.addFlag(442830, 4476201, 200);
+		net.addFlag(442673, 4475125, 200);
+		long t1 = System.currentTimeMillis();
+		solver.putDestinationsOnNetwork();
+		solver.calculate();
+		solver.removeDestinationsFromNetwork();
+		long t2 = System.currentTimeMillis();
+		System.out.println("tiempo:" + (t2-t1));
+		
+		GvFlag flags[] = net.getFlags();
+
+		for (int i=0; i < flags.length; i++)
+		{
+			System.out.println("Flag " + i + " " + flags[i].getCost());
+		}
+		// assertEquals(dist.doubleValue(), 8887, 0);
+
+		
+		
+
+
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestOneToMany.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/AllTests.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/AllTests.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/AllTests.java	(revision 12191)
@@ -0,0 +1,20 @@
+package com.iver.cit.gvsig.graphtests;
+
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+
+public class AllTests {
+
+	public static Test suite() {
+		TestSuite suite = new TestSuite(
+				"Test for com.iver.cit.gvsig.graph.test");
+		//$JUnit-BEGIN$
+		suite.addTestSuite(TestLoader.class);
+		//$JUnit-END$
+		return suite;
+	}
+
+}
+
+

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/AllTests.java
___________________________________________________________________
Added: svn:eol-style
   + native
Added: svn:keywords
   + Author Date Id Revision

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestNetworkGvTableWriter.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestNetworkGvTableWriter.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestNetworkGvTableWriter.java	(revision 12191)
@@ -0,0 +1,84 @@
+package com.iver.cit.gvsig.graphtests;
+
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import junit.framework.TestCase;
+
+import org.cresques.cts.IProjection;
+
+import com.hardcode.gdbms.driver.mysql.MySQLDriver;
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.crs.CRSFactory;
+import com.iver.cit.gvsig.fmap.edition.EditionException;
+import com.iver.cit.gvsig.fmap.edition.writers.JdbcWriter;
+import com.iver.cit.gvsig.fmap.edition.writers.dbf.DbfWriter;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.LayerFactory;
+import com.iver.cit.gvsig.graph.GraphException;
+import com.iver.cit.gvsig.graph.core.writers.NetworkFileRedWriter;
+import com.iver.cit.gvsig.graph.core.writers.NetworkGvTableWriter;
+
+public class TestNetworkGvTableWriter extends TestCase {
+	NetworkGvTableWriter netBuilder = new NetworkGvTableWriter();
+	FLyrVect lyr;
+	/*
+	 * Test method for
+	 * 'com.iver.cit.gvsig.graph.core.NetworkWriter.writeNetwork()'
+	 */
+	public void testWriteNetwork() {
+		try {
+			long t1 = System.currentTimeMillis();
+			netBuilder.writeNetwork();
+			long t2 = System.currentTimeMillis();
+			System.out.println("Building DBF time:" + (t2-t1) + " msecs.");
+		} catch (EditionException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (DriverException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+
+	protected void setUp() throws Exception {
+		LayerFactory
+				.setDriversPath("../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
+		IProjection prj = CRSFactory.getCRS("EPSG:23030");
+		File shpFile = new File("c:/ejes.shp");
+		lyr = (FLyrVect) LayerFactory.createLayer("Ejes",
+				"gvSIG shp driver", shpFile, prj);
+
+		String fieldType = "tipored";
+		String fieldDist = "length";
+		String fieldCost = "cost";
+		String fieldSense = "";
+
+		netBuilder.setLayer(lyr);
+		netBuilder.setFieldCost(fieldCost);
+		netBuilder.setFieldType(fieldType);
+		netBuilder.setFieldDist(fieldDist);
+		netBuilder.setFieldSense(fieldSense);
+		DbfWriter nodeWriter = new DbfWriter();
+		File nodeFile = new File("c:/nodes.dbf");
+		nodeFile.delete();
+		nodeWriter.setFile(nodeFile);
+
+		File edgeFile = new File("c:/edges.dbf");
+		DbfWriter edgeWriter = new DbfWriter();
+		edgeWriter.setFile(edgeFile);
+		
+		
+		netBuilder.setEdgeWriter(edgeWriter);
+		netBuilder.setNodeWriter(nodeWriter);
+		
+		
+		
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestNetworkGvTableWriter.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestNetworJdbcWriter.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestNetworJdbcWriter.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestNetworJdbcWriter.java	(revision 12191)
@@ -0,0 +1,74 @@
+package com.iver.cit.gvsig.graphtests;
+
+
+import java.io.File;
+import java.sql.Connection;
+import java.sql.DriverManager;
+
+import junit.framework.TestCase;
+
+import org.cresques.cts.IProjection;
+
+import com.iver.cit.gvsig.fmap.DriverException;
+import com.iver.cit.gvsig.fmap.crs.CRSFactory;
+import com.iver.cit.gvsig.fmap.edition.EditionException;
+import com.iver.cit.gvsig.fmap.edition.writers.dbf.DbfWriter;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.LayerFactory;
+import com.iver.cit.gvsig.graph.core.writers.NetworkJdbcWriter;
+
+public class TestNetworJdbcWriter extends TestCase {
+	NetworkJdbcWriter netBuilder = new NetworkJdbcWriter();
+	FLyrVect lyr;
+	/*
+	 * Test method for
+	 * 'com.iver.cit.gvsig.graph.core.NetworkWriter.writeNetwork()'
+	 */
+	public void testWriteNetwork() {
+		try {
+			long t1 = System.currentTimeMillis();
+			netBuilder.writeNetwork();
+			long t2 = System.currentTimeMillis();
+			System.out.println("Building MYSQL time:" + (t2-t1) + " msecs.");
+		} catch (EditionException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		} catch (DriverException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+
+	protected void setUp() throws Exception {
+		LayerFactory
+				.setDriversPath("../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
+		IProjection prj = CRSFactory.getCRS("EPSG:23030");
+		File shpFile = new File("c:/ejes.shp");
+		lyr = (FLyrVect) LayerFactory.createLayer("Ejes",
+				"gvSIG shp driver", shpFile, prj);
+
+		String fieldType = "tipored";
+		String fieldDist = "length";
+		String fieldCost = "cost";
+		String fieldSense = "";
+
+		netBuilder.setLayer(lyr);
+		netBuilder.setFieldCost(fieldCost);
+		netBuilder.setFieldType(fieldType);
+		netBuilder.setFieldDist(fieldDist);
+		netBuilder.setFieldSense(fieldSense);
+
+        String dbURL = "jdbc:mysql://localhost:3306/test";  
+        String user = "root";
+        String pwd = "aquilina";
+        Connection conn;
+		conn = DriverManager.getConnection(dbURL, user, pwd);
+
+		netBuilder.setConnection(conn);
+		
+		
+		
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestNetworJdbcWriter.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestNetworkRedWriter.java
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestNetworkRedWriter.java	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestNetworkRedWriter.java	(revision 12191)
@@ -0,0 +1,67 @@
+package com.iver.cit.gvsig.graphtests;
+
+
+import java.io.File;
+
+import junit.framework.TestCase;
+
+import org.cresques.cts.IProjection;
+
+import com.iver.cit.gvsig.fmap.crs.CRSFactory;
+import com.iver.cit.gvsig.fmap.edition.EditionException;
+import com.iver.cit.gvsig.fmap.layers.FLyrVect;
+import com.iver.cit.gvsig.fmap.layers.LayerFactory;
+import com.iver.cit.gvsig.graph.core.writers.NetworkFileRedWriter;
+
+public class TestNetworkRedWriter extends TestCase {
+	NetworkFileRedWriter netBuilder = new NetworkFileRedWriter();
+	FLyrVect lyr;
+	File redFile;
+	/*
+	 * Test method for
+	 * 'com.iver.cit.gvsig.graph.core.NetworkWriter.writeNetwork()'
+	 */
+	public void testWriteNetwork() {
+		try {
+			long t1 = System.currentTimeMillis();
+			netBuilder.writeNetwork();
+			long t2 = System.currentTimeMillis();
+			System.out.println("Building RED time:" + (t2-t1) + " msecs.");
+		} catch (EditionException e) {
+			// TODO Auto-generated catch block
+			e.printStackTrace();
+		}
+	}
+
+
+	protected void setUp() throws Exception {
+		LayerFactory
+				.setDriversPath("../_fwAndami/gvSIG/extensiones/com.iver.cit.gvsig/drivers");
+		IProjection prj = CRSFactory.getCRS("EPSG:23030");
+		File shpFile = new File("c:/ejes.shp");
+		lyr = (FLyrVect) LayerFactory.createLayer("Ejes",
+				"gvSIG shp driver", shpFile, prj);
+
+		String redFilePath = lyr.getName().replaceFirst("\\Q.shp\\E", "");
+		redFile = new File("c:/" + redFilePath + ".red");
+		
+		redFile.delete();
+		
+		String fieldType = "tipored";
+		String fieldDist = "length";
+		String fieldCost = "cost";
+		String fieldSense = "";
+
+		netBuilder.setLayer(lyr);
+		netBuilder.setFieldCost(fieldCost);
+		netBuilder.setFieldType(fieldType);
+		netBuilder.setFieldDist(fieldDist);
+		netBuilder.setFieldSense(fieldSense);
+		
+		netBuilder.setRedFile(redFile);
+		
+		
+		
+	}
+
+}

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/src-test/com/iver/cit/gvsig/graphtests/TestNetworkRedWriter.java
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/text.properties
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/text.properties	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/text.properties	(revision 12191)
@@ -0,0 +1,153 @@
+Aplicar_tolerancia_de_snap=Usar tolerancia para crear la topolog\u00EDa de red
+Aplicar_un_CLEAN_sobre_la_capa_original=Corregir topol\u00F3gicamente la capa original
+Calcular_la_red_sobre_la_capa_original=Calcular la red sobre la capa original
+center_on_flag=Centrar sobre parada
+Clean_de_lineas=Correcci\u00F3n autom\u00E1tica de errores topol\u00F3gicos
+Clean_Test=Clean
+Clear=Borrar
+Clear_Barriers=Quitar todas las barreras
+Clear_Flags=Quitar todas las paradas
+Clear_Routes=Borrar todas las rutas
+Conversion_de_datos=Conversi\u00F3n de datos
+Create_Network=Generar topolog\u00EDa de red
+de=de
+Defines_a_dot_density_symbol_based_on_a_field_value=Define simbolog\u00EDa de densidad de puntos basada en el valor de un campo determinado
+Error_ejecucion=Error de ejecuci\u00f3n
+Error_entrada_datos=Error de entrada de datos
+Error_entrada_datos=
+Error_escritura_resultados=Error de escritura de resultados
+Error_fallo_geoproceso=Se ha producido un fallo durante la ejecuci\u00f3n del geoproceso
+Error_preparar_escritura_resultados=Se ha producido un error al preparar la capa de resultados
+Error_seleccionar_resultado=Es necesario especificar un fichero de resultados
+Especifique_fichero_shp_resultante=Especifique el fichera Shape resultante
+Fichero_para_capa_corregida=Fichero para la capa corregida
+Generando_red_a_partir_de_capa_lineal=Generando red a partir de capa lineal
+Generar_Red==Generar topolog\u00EDa de red
+Limpiando_lineas=Limpiando l\u00EDneas
+LineClean=Correcci\u00F3n de errores topol\u00F3gicos en capa lineal
+LineClean._Progress_Message=Corrigiendo topolog\u00EDa de la capa...
+Load_Network=Cargar topolog\u00EDa de red previamente generada
+Load_Red=Cargar fichero de topolog\u00EDa de red previamente calculado
+Manage_Flags=Gesti\u00F3n de paradas
+Network=Red
+no_se_puede_pasar_por_todas_las_paradas=No se puede pasar por todas las paradas
+Procesando_linea=Construyendo red
+Ruta_borrada_o_inexistente=Ruta borrada o inexistente
+Ruta_no_encontrada=Ruta no encontrada
+Seleccionar_capa_con_puntos_de_parada=Convertir capa en puntos de parada
+Seleccione_una_capa_de_puntos_para_crear_paradas=Escoja una capa de puntos para importar paradas
+Seleccione_un_formato_para_guardar_la_ruta=Seleccione un formato vectorial para guardar la ruta mas reciente.
+Seleccione_un_formato_para_guardar_los_flags=Seleccione un formato vectorial para guardar las paradas.
+Shortest_Path=Camino m\u00EDnimo
+Trabajar_con_las_coordenadas_originales=Trabajar con las coordenadas originales
+angle=\u00E1ngulo
+based_upon_the_road_type=
+cannot_apply_to_a_non_polygon_layer=S\u00F3lo se puede aplicar la leyenda a una capa de pol\u00EDgonos
+change=cambiar
+character_marker=Marcador de car\u00E1cter
+character_marker_symbol=S\u00EDmbolo Marcador de car\u00E1cter
+choose_marker=Elija marcador
+color=color
+cost=coste
+cost_field=campo de coste
+cost_field_text=Cost
+cost_from_a_table_field=
+cost_units=unidades de coste
+cost_units_text=unidades de coste
+could_not_find_symbol_directory=
+could_not_setup_legend=No se pudo crear la leyenda. Por favor, revise los valores
+create_network=Generar topolog\u00EDa de red
+criterium=Criterio
+densities=Densidades
+done=hecho
+dot_density=Densidad de puntos
+dot_size=Tama\u00F1o de punto
+dot_value=Valor del punto
+enable=habilitado
+explanation_sense_field=<html>1-> Seg\u00FAn est\u00E1 digitalizado<br>2-> inverso<br>3-> Se puede circular en los 2 sentidos)</html>
+feet=pies
+field_configuration=Configuraci\u00F3n de campos
+fill_color=Color de relleno
+fill_properties=Propiedades de relleno
+flag_amount=N\u00BA de paradas
+generate_report=Ver informe de ruta
+grid=Malla
+high=Alta
+hours=horas
+inches=pulgadas
+invalid_layer=capa inv\u00E1lida
+la_capa_no_tiene_red_asociada=La capa no tiene ninguna red asociada
+labelling_field=Campo de densidad
+layer=capa
+layers=Capas
+length_field_text=Length
+line_symbols=s\u00EDmbolos de l\u00EDnea
+load_stages=Cargar paradas
+low=Baja
+marker_fill=Relleno de marcadores
+medium=Media
+meters=metros
+miles=millas
+millimeters=
+minutes=
+monetary=
+nautic_miles=
+net_analyst=
+new_flag=Nueva parada
+offset=Desplazamiento
+options=opciones
+outline=Borde
+outline_color=Color del borde
+outline_color=Color del borde
+outline_width=Tama\u00F1o del borde
+point_symbols=S\u00EDmbolos para puntos
+polygon_symbols=S\u00EDmbolos para pol\u00EDgonos
+preview=Previsualizaci\u00F3n
+properties=Propiedades
+put_barrier=Establecer tramo prohibido
+put_flag_on_arc=Situar parada encima de tramo
+put_flag_on_node=Situar parada encima de nodo
+random=Aleatorio
+reset=Limpiar
+route_control_panel=Gestor de paradas
+save=Guardar
+save_error=Error guardando
+save_route=Salvar ruta
+save_stages=Salvar paradas
+seconds=segundos
+select_length_field=Seleccione el campo de longitud (metros)
+select_sense_field=Seleccione el campo de sentido
+select_street_route_field_name=Seleccione el campo para crear el informe de ruta (nombre de v\u00EDa por donde se pasa)
+select_type_field=Seleccione el campo de tipo de v\u00EDa.
+sense_field_text=Direction
+separation=Separaci\u00F3n
+shape_type_not_yet_supported=
+shortest_path_not_found=No se ha encontrado ninguna ruta.
+shortestpath=Camino m\u00EDnimo
+simple_fill=Relleno sencillo
+size=tama\u00F1o
+solucion_no_valida=Soluci�n no valida
+stage=parada
+symbol_library=
+symbol_property_editor=Editor de propiedades del s\u00EDmbolo
+symbol_selector=
+Topology_Test=Topolog�a
+Triangulation_Test=Triangulacion
+total_route_cost=
+trying_to_add_a_non_TypeSymbolEditor_panel=Se est\u00E1 intentando a\u00F1adir un panel que no es del tipo TypeSymbolEditor
+two_panels_with_the_same_name=Dos paneles con el mismo nombre
+type=Tipo
+type_field_text=
+units=Unidades
+unknown_longitude_units=
+unknown_time_units=
+unknown_units=
+use_line_length=Usar longitud de l\u00EDnea
+use_symbol=
+width=ancho
+yards=
+piloto_de_redes=Piloto de redes
+msg_set_velocities=Por favor, establezca la velocidad para cada tipo de tramo (en Km / hora)
+col_arc_type=Tipo de via
+col_km_per_hour=Km/hora
+set_velocities=Fijar velocidades

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/text.properties
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/about.htm
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/about.htm	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/about.htm	(revision 12191)
@@ -0,0 +1,21 @@
+<html>
+  <head>
+    <title>Extesi&oacute;n del piloto de redes.</title>
+    <meta content="">
+    <style></style>
+  </head>
+  <body>
+<table width="60%" border="0">
+  <tr>
+    <td width="64%"><img src="images/logo_horiz_bicolor_gva.png" width="329" height="50"></td>
+    <td width="36%"><div align="right"><img src="images/logoIver.png" width="87" height="50"></div></td>
+  </tr>
+  <tr>
+    <td colspan="2"><font face="Arial, Helvetica, sans-serif">&copy; Copyright
+      Generalitat Valenciana, IVER T.I. 2007.</font></td>
+  </tr>
+</table>
+  <h3>Piloto gandador del concurso de Redes.</h3>
+  <p><br><br><b> Build Number: #build.number#</b></p>
+  </body>
+</html>
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/about.htm
___________________________________________________________________
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/text_en.properties
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/text_en.properties	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/text_en.properties	(revision 12191)
@@ -0,0 +1,129 @@
+Aplicar_tolerancia_de_snap=Apply snap tolerance
+Aplicar_un_CLEAN_sobre_la_capa_original=CLEAN the original layer
+Calcular_la_red_sobre_la_capa_original=Compute the net over the original layer
+Clean_de_lineas=Line clean
+Conversion_de_datos=Data conversion
+de=of
+Defines_a_dot_density_symbol_based_on_a_field_value=Defines a dot density symbol based on a value of a given field
+Error_ejecucion=Execution error
+Error_entrada_datos=Data entry error
+Error_entrada_datos=Data entry error
+Error_escritura_resultados=Error writing results
+Error_fallo_geoproceso=Error in geoprocess execution
+Error_preparar_escritura_resultados=Error preparing writing of results
+Error_seleccionar_resultado=You must select a result file layer
+Especifique_fichero_shp_resultante=Specify a resulting Shape file
+Fichero_para_capa_corregida=File for corrected layer
+Limpiando_lineas=Cleaning lines
+LineClean=Topology errors correction in lineal vectorial layer.
+LineClean._Progress_Message=Cleaning topology of layer...
+Generando_red_a_partir_de_capa_lineal=Create network from layer of lines
+Procesando_linea=Building network
+Ruta_borrada_o_inexistente=Route deleted or inexisting
+Ruta_no_encontrada=Route not found
+Seleccionar_capa_con_puntos_de_parada=Creating flags from a point layer
+Seleccione_una_capa_de_puntos_para_crear_paradas=Choose a point layer whose features will be converted in flags
+Seleccione_un_formato_para_guardar_la_ruta=Choose a format to save the lastest route. 
+Seleccione_un_formato_para_guardar_los_flags=Choose a format to save flags.
+Trabajar_con_las_coordenadas_originales=Work with original coordinates
+angle=Angle
+based_upon_the_road_type=Based upon the road type
+cannot_apply_to_a_non_polygon_layer=Cannot apply to a non polygon layer
+change=Change
+character_marker=Character marker
+character_marker_symbol=Character marker
+choose_marker=Choose marker
+color=Color
+cost=Cost
+cost_field=Cost field
+cost_field_text=<html>Explicaci\u00F3n cost</html>
+cost_from_a_table_field=Compute cost from a table\u0092s field
+cost_units=Cost units
+cost_units_text=<html>Explicaci\u00F3n cost units</html>
+could_not_find_symbol_directory=Unable to locate the symbol\u0092s library\u0092s source folder
+could_not_setup_legend=Could not setup legend. Please check values.
+create_network=Create Network
+criterium=Criterium
+densities=Densities
+done=Done
+dot_density=Dot density
+dot_size=Dot size
+dot_value=Dot value
+enable=Enable
+feet=Feet
+field_configuration=Field configuration
+fill_color=Fill color
+fill_color=Fill color
+fill_properties=Fill properties
+flag_amount=Flag amount
+grid=Grid
+high=High
+hours=Hours
+inches=Inches
+invalid_layer=Invalid layer
+la_capa_no_tiene_red_asociada=
+labelling_field=Labelling field
+layers=Layers
+length_field_text=<html>Explicaci\u00F3n campo longitud</html>
+line_symbols=Line Symbols
+load_stages=Load stages
+low=Low
+marker_fill=Marker fill
+medium=Medium
+meters=Meters
+miles=Miles
+millimeters=Millimeters
+minutes=Minutes
+monetary=Monetary
+nautic_miles=Nautic miles
+net_analyst=Net Analyst
+new_flag=New flag
+offset=Offset
+options=Options
+outline=Outline
+outline_color=Outline color
+outline_width=Outline width
+point_symbols=Point symbols
+polygon_symbols=Polygon symbols
+preview=Preview
+properties=Properties
+random=Random
+reset=Reset
+route_control_panel=Route control panel
+save=Save
+save_error=Error saving
+save_route=Save route
+save_stages=Save stages
+seconds=Seconds
+select_length_field=Select length field
+select_sense_field=Select sense field
+select_street_route_field_name=
+select_type_field=Select type field
+sense_field_text=<html>Explicaci\u00F3n sense text field</html>
+separation=Separation
+shape_type_not_yet_supported=Shape type not yet supported
+shortest_path_not_found=
+simple_fill=Simple fill
+size=Size
+stage=Stage
+symbol_library=Symbol library
+symbol_property_editor=Symbol property editor
+symbol_selector=Symbol selector
+total_route_cost=Total route cost
+trying_to_add_a_non_TypeSymbolEditor_panel=Attempting to add a non TypeSymbolEditor panel
+two_panels_with_the_same_name=Two panels with the same name
+type=Type
+type_field_text=<html>Explicaci\u00F3n type text field</html>
+units=Units
+unknown_longitude_units=Unknown longitude units
+unknown_time_units=Unknown time units
+unknown_units=Unkown units
+use_line_length=Use line length
+use_symbol=Use symbol
+width=Width
+yards=Yards
+piloto_de_redes=
+msg_set_velocities=Please, set speeds for each type of arc (Km / hour)
+col_arc_type=Arc Type
+col_km_per_hour=Km/hour
+set_velocities=Set speeds

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/text_en.properties
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/text_ca.properties
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/text_ca.properties	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/text_ca.properties	(revision 12191)
@@ -0,0 +1,65 @@
+Clean_de_lineas=
+Conversion_de_datos=
+Error_ejecucion=
+Error_entrada_datos=
+Error_entrada_datos=
+Error_escritura_resultados=
+Error_fallo_geoproceso=
+Error_preparar_escritura_resultados=
+Error_seleccionar_resultado=
+LineClean=
+angle=
+based_upon_the_road_type=
+change=
+color=
+cost=
+cost_field=
+cost_field_text=
+cost_from_a_table_field=
+cost_units=
+cost_units_text=
+could_not_find_symbol_directory=
+create_network=
+done=
+enable=
+feet=
+flag_amount=
+hours=
+inches=
+invalid_layer=
+length_field_text=
+line_symbols=
+load_stages=
+meters=
+miles=
+millimeters=
+minutes=
+monetary=
+nautic_miles=
+net_analyst=
+new_flag=
+options=
+point_symbols=
+polygon_symbols=
+preview=
+properties=
+save_stages=
+seconds=
+select_length_field=
+select_sense_field=
+select_type_field=
+sense_field_text=
+shape_type_not_yet_supported=
+size=
+stage=
+symbol_library=
+symbol_selector=
+total_route_cost=
+type_field_text=
+unknown_longitude_units=
+unknown_time_units=
+unknown_units=
+use_line_length=
+use_symbol=
+yards=
+piloto_de_redes=
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/text_ca.properties
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/config.xml
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/config.xml	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/config.xml	(revision 12191)
@@ -0,0 +1,128 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<plugin-config>
+	<libraries library-dir="./lib">
+	</libraries>
+	<depends plugin-name="com.iver.cit.gvsig"/>
+	<depends plugin-name="com.iver.cit.gvsig.geoprocess"/>
+	<depends plugin-name="com.iver.cit.gvsig.cad"/>
+		<resourceBundle name="text"/>
+	<extensions>
+		<!-- <extension class-name="com.iver.cit.gvsig.SymbolTest"
+			description="Symbol test"
+			active="true">
+			<menu text="Test/Symbol test"	tooltip="Try symbol"
+				action-command="DALE!"
+			 />
+			
+		</extension> -->
+		<extension class-name="com.iver.cit.gvsig.graph.GenerateNetworkExtension"
+			description="Generate Network Extension for gvSIG."
+			active="true">
+			<menu text="Network/Create_Network"	tooltip="Generar_Red"
+				action-command="GENERATE_RED"
+				icon="images/build_graph.gif" />
+
+		</extension>
+		<extension class-name="com.iver.cit.gvsig.graph.LoadNetworkExtension"
+			description="Load Network for gvSIG."
+			active="true">
+
+			<menu text="Network/Load_Network"	tooltip="Load_Red"
+				action-command="LOAD_RED"
+				icon="images/network.png" />
+				
+<!--			<menu text="Network/Load_Network_from_tables"	tooltip="Load_Red"
+				action-command="LOAD_NETWORK_FROM_TABLES"
+				icon="images/network.png" /> -->
+
+		</extension>
+		
+		<extension class-name="com.iver.cit.gvsig.graph.ManageFlagsExtension"
+			description="Manage flags."
+			active="true">
+			<menu text="Network/Manage_Flags"	tooltip="Manage_Flags"
+				action-command="MANAGE_FLAGS"
+				icon="images/manage_flags.png" />
+			
+		</extension>
+		<extension class-name="com.iver.cit.gvsig.graph.ShortestPathExtension"
+			description="Shortest path"
+			active="true">
+			<menu text="Network/separator" is_separator="true"/>
+
+			<menu text="Network/Shortest_Path"	tooltip="Shortest_Path"
+				action-command="SHORTEST_PATH"
+				icon="images/shortest_path.png" />
+			<tool-bar name="Networks">
+				<action-tool icon="images/shortest_path.png"
+					action-command="SHORTEST_PATH"
+					tooltip="shortestpath"
+					position="1"/>
+			</tool-bar>
+
+		</extension>
+
+		<extension class-name="com.iver.cit.gvsig.graph.ClearRouteExtension"
+			description="Remove routes"
+			active="true">
+			<menu text="Network/Clear/Clear_Routes" action-command="CLEAR_ROUTES"  />
+		</extension>
+		<extension class-name="com.iver.cit.gvsig.graph.ClearFlagsExtension"
+			description="Remove routes"
+			active="true">
+			<menu text="Network/Clear/Clear_Flags" action-command="CLEAR_FLAGS"  />
+		</extension>
+		<extension class-name="com.iver.cit.gvsig.graph.ClearBarriersExtension"
+			description="Remove barriers"
+			active="true">
+			<menu text="Network/Clear/Clear_Barriers" action-command="CLEAR_BARRIERS"  />
+		</extension>
+
+
+		<extension class-name="com.iver.cit.gvsig.graph.NetworkAddFlag"
+			description="Flags"
+			active="true">
+			<tool-bar name="Networks">
+				<selectable-tool icon="images/add_flag_on_arc.png"
+					action-command="ADD_FLAG_TO_NETWORK"
+					tooltip="put_flag_on_arc"
+					position="2"/>
+				<selectable-tool icon="images/add_flag_on_node.png"
+					action-command="ADD_FLAG_TO_NODE"
+					tooltip="put_flag_on_node"
+					position="3"/>
+				<selectable-tool icon="images/no_way.png"
+					action-command="ADD_BARRIER"
+					tooltip="put_barrier"
+					position="4"/>
+					
+			</tool-bar>
+		</extension>
+		<!-- <extension class-name="com.iver.cit.gvsig.graph.TestExtension"
+			description="ODMATRIX"
+			active="true">
+			<tool-bar name="Networks">
+				<selectable-tool icon="images/gtk-about.png"
+					action-command="ODMATRIX"
+					tooltip="ODMATRIX"
+					/>
+			</tool-bar>
+			<menu text="Test/ODMATRIX" action-command="ODMATRIX"/> 
+		</extension> -->
+		<!-- <extension class-name="com.iver.cit.gvsig.graph.TopologyExtension"
+			description="Extensi�n para crear topolog�a."
+			active="true">
+			<menu text="Capa/Topology_Test/Clean_Test" action-command="CLEAN"/>
+			<menu text="Capa/Topology_Test/Show Errors" action-command="SHOW_ERRORS"/>
+			<menu text="Capa/Topology_Test/Triangulation_Test" action-command="TRIANGULATION"/>
+		</extension> -->
+
+		<extension class-name="com.iver.cit.gvsig.topology.lineclean.RegisterGeoprocessPlugin"
+			description="Extensiones de geoprocesamiento"
+			active="true" />
+
+		<extension class-name="com.iver.cit.gvsig.AboutGraphExtension"
+			description="Extension to add about panel."
+			active="true"/>
+	</extensions>
+</plugin-config>
\ No newline at end of file

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/config/config.xml
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/gtk-go-left.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/gtk-go-left.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/orange_flag_26_26.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/orange_flag_26_26.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/plantilla.htm
===================================================================
--- tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/plantilla.htm	(revision 0)
+++ tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/plantilla.htm	(revision 12191)
@@ -0,0 +1,21 @@
+<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
+<html>
+<head>
+<title>Documento sin t&iacute;tulo</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
+<style type='text/css'>
+<!--   .normal { 	font-family: Arial, Helvetica, sans-serif;	font-size: 10px; font-style: normal; color: #0000FF;} --> 
+</style>
+
+</head>
+
+<body>
+<h1>Informe de Ruta:SOMONTES AL PALACIO DE LA REAL QUINTA-MONTE CARMELO</h1>
+<br>Salida desde: <b>SOMONTES AL PALACIO DE LA REAL QUINTA</b><br>
+Llegada a:<b> MONTE CARMELO</b><br>Longitud total del trayecto: <b>9,020.31</b>
+<hr width ="70%">
+<table>
+<tr>
+<td><img src="images/drapeau_depart.gif"></td><td class='normal'>1. Salir de:<b> SOMONTES AL PALACIO DE LA REAL QUINTA</b></td></tr><tr><td class='normal'><a href="0">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-left.png"></td><td class='normal'>2 Contin�e por <b>SOMONTES AL PALACIO DE LA REAL QUINTA</b> durante  447.44 y  gire a la <b>izquierda</b> por <b>M-30 (CTRA DEL PARDO)</b></td></tr><tr><td>Distancia acumulada:</td><td>447.44</td></tr><tr><td><a href="0">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-left.png"></td><td class='normal'>3 Contin�e por <b>M-30 (CTRA DEL PARDO)</b> durante  2,320.58 y  gire a la <b>izquierda</b> por <b>LA ALBERCA</b></td></tr><tr><td>Distancia acumulada:</td><td>2,768.02</td></tr><tr><td><a href="1,2,3">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-right.png"></td><td class='normal'>4 Contin�e por <b>LA ALBERCA</b> durante  355.99 y  gire a la <b>derecha</b> por <b>SOMONTES</b></td></tr><tr><td>Distancia acumulada:</td><td>3,124.01</td></tr><tr><td><a href="4,5,6">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-left.png"></td><td class='normal'>5 Contin�e por <b>SOMONTES</b> durante  136.05 y  gire a la <b>izquierda</b> por <b>TORREBELE�A</b></td></tr><tr><td>Distancia acumulada:</td><td>3,260.06</td></tr><tr><td><a href="7">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-right.png"></td><td class='normal'>6 Contin�e por <b>TORREBELE�A</b> durante  289.31 y  gire a la <b>derecha</b> por <b>SIGUERO</b></td></tr><tr><td>Distancia acumulada:</td><td>3,549.37</td></tr><tr><td><a href="8,9">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-right.png"></td><td class='normal'>7 Contin�e por <b>SIGUERO</b> durante  92.16 y  gire a la <b>derecha</b> por <b>NAVARREDONDA DE GREDOS</b></td></tr><tr><td>Distancia acumulada:</td><td>3,641.53</td></tr><tr><td><a href="10">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-left.png"></td><td class='normal'>8 Contin�e por <b>NAVARREDONDA DE GREDOS</b> durante  322.42 y  gire a la <b>izquierda</b> por <b>FRESNEDILLAS</b></td></tr><tr><td>Distancia acumulada:</td><td>3,963.95</td></tr><tr><td><a href="11">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-left.png"></td><td class='normal'>9 Contin�e por <b>FRESNEDILLAS</b> durante  315.69 y  gire a la <b>izquierda</b> por <b>BRAOJOS</b></td></tr><tr><td>Distancia acumulada:</td><td>4,279.64</td></tr><tr><td><a href="12,13">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-left.png"></td><td class='normal'>10 Contin�e por <b>BRAOJOS</b> durante  98.91 y  gire a la <b>izquierda</b> por <b>ARROYO DEL FRESNO</b></td></tr><tr><td>Distancia acumulada:</td><td>4,378.55</td></tr><tr><td><a href="14">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-left.png"></td><td class='normal'>11 Contin�e por <b>ARROYO DEL FRESNO</b> durante  1,506.38 y  gire a la <b>izquierda</b> por <b>BURGOS (MONTECARMELO)</b></td></tr><tr><td>Distancia acumulada:</td><td>5,884.93</td></tr><tr><td><a href="15,16">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-left.png"></td><td class='normal'>12 Contin�e por <b>BURGOS (MONTECARMELO)</b> durante  428.68 y  gire a la <b>izquierda</b> por <b>MONTIJA</b></td></tr><tr><td>Distancia acumulada:</td><td>6,313.61</td></tr><tr><td><a href="17">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-right.png"></td><td class='normal'>13 Contin�e por <b>MONTIJA</b> durante  999.9 y  gire a la <b>derecha</b> por <b>OTERUELO DEL VALLE</b></td></tr><tr><td>Distancia acumulada:</td><td>7,313.51</td></tr><tr><td><a href="18,19">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-left.png"></td><td class='normal'>14 Contin�e por <b>OTERUELO DEL VALLE</b> durante  95.17 y  gire a la <b>izquierda</b> por <b>RASCAFRIA</b></td></tr><tr><td>Distancia acumulada:</td><td>7,408.68</td></tr><tr><td><a href="20">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-right.png"></td><td class='normal'>15 Contin�e por <b>RASCAFRIA</b> durante  259.48 y  gire a la <b>derecha</b> por <b>CELEORAMA GOMEZ</b></td></tr><tr><td>Distancia acumulada:</td><td>7,668.16</td></tr><tr><td><a href="21">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/gtk-go-left.png"></td><td class='normal'>16 Contin�e por <b>CELEORAMA GOMEZ</b> durante  82.8 y  gire a la <b>izquierda</b> por <b>VILELA</b></td></tr><tr><td>Distancia acumulada:</td><td>7,750.96</td></tr><tr><td><a href="22">Ver sobre el mapa</a><td></tr></table><hr width ="70%"><table><tr><td><img src="images/drapeau_arrivee.gif"></td><td>16. Llegada: MONTE CARMELO</td></tr><tr><td>Longitud:</td><td>9,020.31</td></tr><tr><td><a href="24">Ver sobre el mapa</a><td></tr></table>
+ </body>
+</html>

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/plantilla.htm
___________________________________________________________________
Added: svn:keywords
   + Author Date Id Revision
Added: svn:eol-style
   + native

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/net-analyst-icon.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/net-analyst-icon.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/barrier.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/barrier.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/logoIver.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/logoIver.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/shortest_path.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/shortest_path.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/icon_pushpin.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/icon_pushpin.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/down-arrow.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/down-arrow.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/layers.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/layers.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/locked.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/locked.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/drapeau_depart.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/drapeau_depart.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/add_flag_on_arc.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/add_flag_on_arc.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/delete.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/delete.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/gtk-go-right.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/gtk-go-right.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/orange_flag.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/orange_flag.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/unlocked.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/unlocked.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/gtk-go-up.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/gtk-go-up.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/medium-density-sample.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/medium-density-sample.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/net-wizard-logo.jpg
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/net-wizard-logo.jpg
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/disconnect_co_004.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/disconnect_co_004.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/drapeau_arrivee.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/drapeau_arrivee.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/turn-left.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/turn-left.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/logo_horiz_bicolor_gva.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/logo_horiz_bicolor_gva.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/add_flag_on_node.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/add_flag_on_node.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/dissolve_group.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/dissolve_group.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/Intervalos.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/Intervalos.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/pushpin.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/pushpin.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/network.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/network.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/no_way.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/no_way.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/ValoresUnicos.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/ValoresUnicos.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/low-density-sample.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/low-density-sample.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/gtk-about.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/gtk-about.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/build_graph.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/build_graph.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/add-layer.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/add-layer.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/turn-right.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/turn-right.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/manage_flags.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/manage_flags.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/high-density-sample.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/high-density-sample.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/up-arrow.png
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/up-arrow.png
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

Index: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/lmust_not_dangle.gif
===================================================================
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream

Property changes on: tags/PilotoRedes_Build_4/extensions/extGraph_predes/images/lmust_not_dangle.gif
___________________________________________________________________
Added: svn:mime-type
   + application/octet-stream

