Changeset 70 for ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF
- Timestamp:
- 04/26/10 19:12:49 (14 years ago)
- Location:
- ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF
- Files:
-
- 131 edited
Legend:
- Unmodified
- Added
- Removed
-
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/classes/build.xml
r68 r70 1 <project name="Eccad" default=" war" basedir=".">1 <project name="Eccad" default="deploy" basedir="."> 2 2 3 3 <property file="${basedir}/build.properties" /> 4 <property name="build" value="../ build" />4 <property name="build" value="../classes" /> 5 5 <property name="lib" value="../lib" /> 6 <property name="dist" value="../../.." /> 6 7 <property name="src" value="." /> 7 8 <path id="libPath"> … … 17 18 </path> 18 19 20 <!-- Déploiement de l'archive --> 21 <target name="deploy" depends="war"> 22 <!--<delete dir="${tomcat}/webapps/${app.name}"/>--> 23 <!--<unjar src="${dist}/${app.name}.war" dest="${tomcat}/webapps/${app.name}"/>--> 24 <copy todir="${tomcat}/webapps" includeEmptyDirs="no"> 25 <fileset file="${dist}/${app.name}.war"/> 26 </copy> 27 </target> 28 19 29 <target name="war" depends="compile"> 20 <war destfile=" ../../../${app.name}.war" webxml="../web.xml">30 <war destfile="${dist}/${app.name}.war" webxml="../web.xml"> 21 31 <zipfileset dir="../../" includes="**/*" prefix="" excludes=".tomcatplugin .classpath .project"/> 22 <lib dir="${lib}"> 23 <exclude name="servlet-api.jar" /> 24 <exclude name="gnujaxp.jar" /> 32 <!--lib dir="${lib}"> 25 33 <exclude name="xercesImpl.jar" /> 26 34 </lib> 27 <classes dir="${build}" / >35 <classes dir="${build}" /--> 28 36 </war> 29 37 </target> … … 38 46 <classpath refid="libPath" /> 39 47 </javac> 40 41 48 </target> 42 49 </project> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/classes/eccad_spring.xml
r68 r70 7 7 8 8 <beans> 9 10 11 <property name="url_home"><value>http://ether.ipsl.jussieu.fr/etherTypo/?id=1218</value></property> <!-- l'url home d'eccad -->12 13 <property name="url_tools"><value>http://ether.ipsl.jussieu.fr/etherTypo/?id=1235</value></property>14 15 9 10 <bean id="urlbean" class="org.medias.eccad.presentation.bean.URLBeanValue"> 11 <property name="url_home"><value>http://ether.ipsl.jussieu.fr/etherTypo/?id=1218</value></property> 12 <property name="url_products"><value>http://ether.ipsl.jussieu.fr/etherTypo/?id=1228</value></property> 13 <property name="url_tools"><value>http://ether.ipsl.jussieu.fr/etherTypo/?id=1226</value></property> 14 <property name="url_manual"><value>http://ether.ipsl.jussieu.fr/etherTypo/fileadmin/files/ECCAD/doc/Eccad_users_manual.pdf</value></property> 15 </bean> 16 16 17 17 <!-- Information extracteur --> … … 24 24 <!-- Information Connexion jdbc --> 25 25 <bean id="infoConnect" class="org.medias.eccad.persistance.InfoConnectBean"> 26 <property name="db_url"><value> eccad.ipsl.jussieu.fr</value></property>27 <property name="db_name"><value> ECCAD3FINAL</value></property>26 <property name="db_url"><value>eccad.ipsl.jussieu.fr</value></property> 27 <property name="db_name"><value>ECCAD3FINAL</value></property> 28 28 <property name="db_port"><value>5432</value></property> 29 <property name="db_login"><value>eccad 30 <property name="db_passwd"><value> 29 <property name="db_login"><value>eccad</value></property> 30 <property name="db_passwd"><value></value></property> 31 31 </bean> 32 32 … … 44 44 <property name="sgbd"><ref local="sgbd"/></property> 45 45 </bean> 46 46 47 47 <bean id="catParametreDAO" class="org.medias.eccad.persistance.jdbc.CatParametreDAOjdbc"> 48 48 <property name="sgbd"><ref local="sgbd"/></property> … … 50 50 51 51 <bean id="parametreDAO" class="org.medias.eccad.persistance.jdbc.ParametreDAOjdbc"> 52 <property name="sgbd"><ref local="sgbd"/></property> 53 </bean> 54 55 <bean id="secteurDAO" class="org.medias.eccad.persistance.jdbc.SecteurDAOjdbc"> 56 <property name="sgbd"><ref local="sgbd"/></property> 57 </bean> 58 59 <bean id="rcpDAO" class="org.medias.eccad.persistance.jdbc.RcpDAOjdbc"> 52 60 <property name="sgbd"><ref local="sgbd"/></property> 53 61 </bean> … … 71 79 </bean> 72 80 81 <bean id="classDistributionTabDAO" class="org.medias.eccad.persistance.jdbc.ClassDistributionTabDAOjdbc"> 82 <property name="sgbd"><ref local="sgbd"/></property> 83 </bean> 84 73 85 <bean id="xmlDAO" class="org.medias.eccad.persistance.hibernate.XmlDAOhibernate"> 74 86 </bean> 75 87 76 88 <!-- fin info jdbc --> 77 89 78 90 <!-- Generation des rasters --> 79 <bean id="worldfile" class="org.medias.eccad.metier.generationRaster.GenerateurWorldFile" singleton="false">80 81 82 83 84 85 91 <bean id="worldfile" class="org.medias.eccad.metier.generationRaster.GenerateurWorldFile"> 92 <property name="pixelX"><value>-180</value></property> 93 <property name="pixelY"><value>90</value></property> 94 </bean> 95 <bean id="colormap" class="org.medias.eccad.metier.generationRaster.colorMap.ColorMappingIntervalle" singleton="false"> 96 </bean> 97 <!-- fin generation des rasters --> 86 98 87 99 <!-- Gestion des visualisation et des traducteurs associés --> 88 100 <bean id="traducteur_temporel" class="org.medias.eccad.metier.traducteur.TraducteurVisuTemporel"/> 89 101 <bean id="traducteur_multiplan" class="org.medias.eccad.metier.traducteur.TraducteurVisuMultiplan"/> 90 <bean id="traducteur_facteur" class="org.medias.eccad.metier.traducteur.TraducteurVisuTemporel"/> 91 102 92 103 <bean id="monoplan" class="org.medias.eccad.modele.Visualisation"> 93 104 <property name="page_jsp"><value>./visualisation/classe.jsp</value></property> 94 <property name="traducteur"><value>traducteur_ temporel</value></property>105 <property name="traducteur"><value>traducteur_multiplan</value></property> 95 106 </bean> 96 107 … … 104 115 <property name="traducteur"><value>traducteur_temporel</value></property> 105 116 </bean> 106 107 <bean id="facteur" class="org.medias.eccad.modele.Visualisation"> 108 <property name="page_jsp"><value>./visualisation/temporel.jsp</value></property> 109 <property name="traducteur"><value>traducteur_facteur</value></property> 110 </bean> 111 117 112 118 <!-- Fin de la gestion des visualisations --> 113 119 114 120 </beans> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/classes/eccad_spring_test.xml
r68 r70 68 68 </bean> 69 69 70 <bean id="classDistributionTabDAO" class="org.medias.eccad.persistance.jdbc.ClassDistributionTabDAOjdbc"> 71 <property name="sgbd"><ref local="sgbd"/></property> 72 </bean> 73 70 74 <bean id="xmlDAO" class="org.medias.eccad.persistance.hibernate.XmlDAOhibernate"> 71 75 </bean> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/classes/hibernate.cfg.xml
r68 r70 8 8 <property name="hibernate.connection.driver_class">org.postgresql.Driver</property> 9 9 <!-- <property name="hibernate.connection.password">www001</property> --> 10 <property name="hibernate.connection.url"> 10 <property name="hibernate.connection.url">jdbc:postgresql://eccad.ipsl.jussieu.fr:5432/ECCAD3FINAL</property> 11 11 <property name="hibernate.connection.username">eccad</property> 12 12 <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property> … … 21 21 22 22 23 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Fichier.hbm.xml" /> 24 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/ColorIndex.hbm.xml" /> 25 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Lienorganisme.hbm.xml" /> 26 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Metadata.hbm.xml" /> 23 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Categorieparametre.hbm.xml" /> 27 24 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Code.hbm.xml" /> 28 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Produitorig.hbm.xml" />29 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Produit.hbm.xml" />30 25 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Codification.hbm.xml" /> 31 26 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Color.hbm.xml" /> 32 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Unite.hbm.xml" /> 27 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/ColorIndex.hbm.xml" /> 28 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Colormap.hbm.xml" /> 29 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Concerne.hbm.xml" /> 30 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Contact.hbm.xml" /> 33 31 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Domaine.hbm.xml" /> 34 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Contact.hbm.xml" /> 32 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Fichier.hbm.xml" /> 33 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Fournit.hbm.xml" /> 34 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Grille.hbm.xml" /> 35 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Lienpersonne.hbm.xml" /> 36 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Metadata.hbm.xml" /> 37 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Organisme.hbm.xml" /> 38 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/ParamColor.hbm.xml" /> 39 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Parametre.hbm.xml" /> 40 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Personne.hbm.xml" /> 41 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Produit.hbm.xml" /> 42 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Produitorig.hbm.xml" /> 43 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/References.hbm.xml" /> 35 44 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Requete.hbm.xml" /> 36 45 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Typecodification.hbm.xml" /> 37 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Colormap.hbm.xml" />38 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Categorieparametre.hbm.xml" />39 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/ParamColor.hbm.xml" />40 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Organisme.hbm.xml" />41 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Personne.hbm.xml" />42 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/References.hbm.xml" />43 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Grille.hbm.xml" />44 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Concerne.hbm.xml" />45 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Sequence.hbm.xml" />46 <!-- > <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Ceoslevel.hbm.xml" />-->47 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Fournit.hbm.xml" />48 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Lienpersonne.hbm.xml" />49 46 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Typeproduit.hbm.xml" /> 50 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/ Parametre.hbm.xml" />47 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Unite.hbm.xml" /> 51 48 </session-factory> 52 49 </hibernate-configuration> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/classes/org/medias/eccad/persistance/hibernate/domaine/Metadata.hbm.xml
r68 r70 24 24 <one-to-many class="org.medias.eccad.persistance.hibernate.domaine.Produit" /> 25 25 </set> 26 <set name="lienorganismes" inverse="true">27 <key>28 <column name="id_metadata" not-null="true" />29 </key>30 <one-to-many class="org.medias.eccad.persistance.hibernate.domaine.Lienorganisme" />31 </set>32 26 <set name="lienpersonnes" inverse="true"> 33 27 <key> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/classes/org/medias/eccad/persistance/hibernate/domaine/Organisme.hbm.xml
r68 r70 42 42 <one-to-many class="org.medias.eccad.persistance.hibernate.domaine.Fournit" /> 43 43 </set> 44 <set name="lienorganismes" inverse="true">45 <key>46 <column name="id_organisme" not-null="true" />47 </key>48 <one-to-many class="org.medias.eccad.persistance.hibernate.domaine.Lienorganisme" />49 </set>50 44 </class> 51 45 </hibernate-mapping> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/classes/org/medias/eccad/persistance/hibernate/domaine/Produitorig.hbm.xml
r68 r70 15 15 <column name="title_produitorig" length="128" unique="true" /> 16 16 </property> 17 <property name="orgProduitorig" type="string"> 18 <column name="org_produitorig" length="128" /> 19 </property> 20 <property name="dateProduitorig" type="date"> 21 <column name="date_produitorig" length="4" /> 17 <property name="dateProduitorig" type="string"> 18 <column name="date_produitorig" length="128" /> 22 19 </property> 23 20 <property name="editionProduitorig" type="string"> 24 21 <column name="edition_produitorig" length="128" /> 25 22 </property> 26 <property name="begintimeProduitorig" type=" date">27 <column name="begintime_produitorig" length=" 4" />23 <property name="begintimeProduitorig" type="string"> 24 <column name="begintime_produitorig" length="128" /> 28 25 </property> 29 <property name="endtimeProduitorig" type=" date">30 <column name="endtime_produitorig" length=" 4" />26 <property name="endtimeProduitorig" type="string"> 27 <column name="endtime_produitorig" length="128" /> 31 28 </property> 32 29 <property name="earthellipsProduitorig" type="string"> … … 38 35 <property name="spatialresProduitorig" type="string"> 39 36 <column name="spatialres_produitorig" length="128" /> 40 </property>41 <property name="projectionProduitorig" type="string">42 <column name="projection_produitorig" length="128" />43 37 </property> 44 38 <property name="methodProduitorig" type="string"> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/javaface-config.xml
r68 r70 56 56 57 57 <managed-bean> 58 <managed-bean-name>grapheBean</managed-bean-name> 59 <managed-bean-class>org.medias.eccad.presentation.bean.GrapheBean</managed-bean-class> 60 <managed-bean-scope>request</managed-bean-scope> 61 </managed-bean> 62 63 <managed-bean> 58 64 <managed-bean-name>emissionBean</managed-bean-name> 59 65 <managed-bean-class>org.medias.eccad.presentation.bean.emission.EmissionBean</managed-bean-class> … … 101 107 </navigation-case> 102 108 <navigation-case> 109 <from-outcome>page_extract_before</from-outcome> 110 <to-view-id>/JSF/page_extract_before.jsp</to-view-id> 111 </navigation-case> 112 <navigation-case> 103 113 <from-outcome>page_extract_emission</from-outcome> 104 114 <to-view-id>/JSF/page_extract_emission.jsp</to-view-id> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/build.xml
r68 r70 1 <project name="Eccad" default=" war" basedir=".">1 <project name="Eccad" default="deploy" basedir="."> 2 2 3 3 <property file="${basedir}/build.properties" /> 4 <property name="build" value="../ build" />4 <property name="build" value="../classes" /> 5 5 <property name="lib" value="../lib" /> 6 <property name="dist" value="../../.." /> 6 7 <property name="src" value="." /> 7 8 <path id="libPath"> … … 17 18 </path> 18 19 20 <!-- Déploiement de l'archive --> 21 <target name="deploy" depends="war"> 22 <!--<delete dir="${tomcat}/webapps/${app.name}"/>--> 23 <!--<unjar src="${dist}/${app.name}.war" dest="${tomcat}/webapps/${app.name}"/>--> 24 <copy todir="${tomcat}/webapps" includeEmptyDirs="no"> 25 <fileset file="${dist}/${app.name}.war"/> 26 </copy> 27 </target> 28 19 29 <target name="war" depends="compile"> 20 <war destfile=" ../../../${app.name}.war" webxml="../web.xml">30 <war destfile="${dist}/${app.name}.war" webxml="../web.xml"> 21 31 <zipfileset dir="../../" includes="**/*" prefix="" excludes=".tomcatplugin .classpath .project"/> 22 <lib dir="${lib}"> 23 <exclude name="servlet-api.jar" /> 24 <exclude name="gnujaxp.jar" /> 32 <!--lib dir="${lib}"> 25 33 <exclude name="xercesImpl.jar" /> 26 34 </lib> 27 <classes dir="${build}" / >35 <classes dir="${build}" /--> 28 36 </war> 29 37 </target> … … 38 46 <classpath refid="libPath" /> 39 47 </javac> 40 41 48 </target> 42 49 </project> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/eccad_spring.xml
r68 r70 7 7 8 8 <beans> 9 10 11 <property name="url_home"><value>http://ether.ipsl.jussieu.fr/etherTypo/?id=1218</value></property> <!-- l'url home d'eccad -->12 13 <property name="url_tools"><value>http://ether.ipsl.jussieu.fr/etherTypo/?id=1235</value></property>14 15 9 10 <bean id="urlbean" class="org.medias.eccad.presentation.bean.URLBeanValue"> 11 <property name="url_home"><value>http://ether.ipsl.jussieu.fr/etherTypo/?id=1218</value></property> 12 <property name="url_products"><value>http://ether.ipsl.jussieu.fr/etherTypo/?id=1228</value></property> 13 <property name="url_tools"><value>http://ether.ipsl.jussieu.fr/etherTypo/?id=1226</value></property> 14 <property name="url_manual"><value>http://ether.ipsl.jussieu.fr/etherTypo/fileadmin/files/ECCAD/doc/Eccad_users_manual.pdf</value></property> 15 </bean> 16 16 17 17 <!-- Information extracteur --> … … 24 24 <!-- Information Connexion jdbc --> 25 25 <bean id="infoConnect" class="org.medias.eccad.persistance.InfoConnectBean"> 26 <property name="db_url"><value> eccad.ipsl.jussieu.fr</value></property>27 <property name="db_name"><value> ECCAD3FINAL</value></property>26 <property name="db_url"><value>eccad.ipsl.jussieu.fr</value></property> 27 <property name="db_name"><value>ECCAD3FINAL</value></property> 28 28 <property name="db_port"><value>5432</value></property> 29 <property name="db_login"><value>eccad 30 <property name="db_passwd"><value> 29 <property name="db_login"><value>eccad</value></property> 30 <property name="db_passwd"><value></value></property> 31 31 </bean> 32 32 … … 44 44 <property name="sgbd"><ref local="sgbd"/></property> 45 45 </bean> 46 46 47 47 <bean id="catParametreDAO" class="org.medias.eccad.persistance.jdbc.CatParametreDAOjdbc"> 48 48 <property name="sgbd"><ref local="sgbd"/></property> … … 50 50 51 51 <bean id="parametreDAO" class="org.medias.eccad.persistance.jdbc.ParametreDAOjdbc"> 52 <property name="sgbd"><ref local="sgbd"/></property> 53 </bean> 54 55 <bean id="secteurDAO" class="org.medias.eccad.persistance.jdbc.SecteurDAOjdbc"> 56 <property name="sgbd"><ref local="sgbd"/></property> 57 </bean> 58 59 <bean id="rcpDAO" class="org.medias.eccad.persistance.jdbc.RcpDAOjdbc"> 52 60 <property name="sgbd"><ref local="sgbd"/></property> 53 61 </bean> … … 71 79 </bean> 72 80 81 <bean id="classDistributionTabDAO" class="org.medias.eccad.persistance.jdbc.ClassDistributionTabDAOjdbc"> 82 <property name="sgbd"><ref local="sgbd"/></property> 83 </bean> 84 73 85 <bean id="xmlDAO" class="org.medias.eccad.persistance.hibernate.XmlDAOhibernate"> 74 86 </bean> 75 87 76 88 <!-- fin info jdbc --> 77 89 78 90 <!-- Generation des rasters --> 79 <bean id="worldfile" class="org.medias.eccad.metier.generationRaster.GenerateurWorldFile" singleton="false">80 81 82 83 84 85 91 <bean id="worldfile" class="org.medias.eccad.metier.generationRaster.GenerateurWorldFile"> 92 <property name="pixelX"><value>-180</value></property> 93 <property name="pixelY"><value>90</value></property> 94 </bean> 95 <bean id="colormap" class="org.medias.eccad.metier.generationRaster.colorMap.ColorMappingIntervalle" singleton="false"> 96 </bean> 97 <!-- fin generation des rasters --> 86 98 87 99 <!-- Gestion des visualisation et des traducteurs associés --> 88 100 <bean id="traducteur_temporel" class="org.medias.eccad.metier.traducteur.TraducteurVisuTemporel"/> 89 101 <bean id="traducteur_multiplan" class="org.medias.eccad.metier.traducteur.TraducteurVisuMultiplan"/> 90 <bean id="traducteur_facteur" class="org.medias.eccad.metier.traducteur.TraducteurVisuTemporel"/> 91 102 92 103 <bean id="monoplan" class="org.medias.eccad.modele.Visualisation"> 93 104 <property name="page_jsp"><value>./visualisation/classe.jsp</value></property> 94 <property name="traducteur"><value>traducteur_ temporel</value></property>105 <property name="traducteur"><value>traducteur_multiplan</value></property> 95 106 </bean> 96 107 … … 104 115 <property name="traducteur"><value>traducteur_temporel</value></property> 105 116 </bean> 106 107 <bean id="facteur" class="org.medias.eccad.modele.Visualisation"> 108 <property name="page_jsp"><value>./visualisation/temporel.jsp</value></property> 109 <property name="traducteur"><value>traducteur_facteur</value></property> 110 </bean> 111 117 112 118 <!-- Fin de la gestion des visualisations --> 113 119 114 120 </beans> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/eccad_spring.xml.template
r68 r70 26 26 <!-- fin generation des rasters --> 27 27 28 <!-- Gestion des visualisation et des traducteurs associ és -->28 <!-- Gestion des visualisation et des traducteurs associï¿œs --> 29 29 <bean id="traducteur_temporel" class="org.medias.eccad.metier.traducteur.TraducteurVisuTemporel"/> 30 30 <bean id="traducteur_multiplan" class="org.medias.eccad.metier.traducteur.TraducteurVisuMultiplan"/> … … 39 39 <property name="traducteur"><value>traducteur_multiplan</value></property> 40 40 </bean> 41 41 42 42 <bean id="temporal" class="org.medias.eccad.modele.Visualisation"> 43 43 <property name="page_jsp"><value>./visualisation/temporel.jsp</value></property> 44 44 <property name="traducteur"><value>traducteur_temporel</value></property> 45 45 </bean> 46 46 47 47 <!-- Fin de la gestion des visualisations --> 48 48 -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/eccad_spring_test.xml
r68 r70 68 68 </bean> 69 69 70 <bean id="classDistributionTabDAO" class="org.medias.eccad.persistance.jdbc.ClassDistributionTabDAOjdbc"> 71 <property name="sgbd"><ref local="sgbd"/></property> 72 </bean> 73 70 74 <bean id="xmlDAO" class="org.medias.eccad.persistance.hibernate.XmlDAOhibernate"> 71 75 </bean> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/hibernate.cfg.xml
r68 r70 8 8 <property name="hibernate.connection.driver_class">org.postgresql.Driver</property> 9 9 <!-- <property name="hibernate.connection.password">www001</property> --> 10 <property name="hibernate.connection.url"> 10 <property name="hibernate.connection.url">jdbc:postgresql://eccad.ipsl.jussieu.fr:5432/ECCAD3FINAL</property> 11 11 <property name="hibernate.connection.username">eccad</property> 12 12 <property name="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</property> … … 21 21 22 22 23 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Fichier.hbm.xml" /> 24 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/ColorIndex.hbm.xml" /> 25 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Lienorganisme.hbm.xml" /> 26 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Metadata.hbm.xml" /> 23 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Categorieparametre.hbm.xml" /> 27 24 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Code.hbm.xml" /> 28 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Produitorig.hbm.xml" />29 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Produit.hbm.xml" />30 25 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Codification.hbm.xml" /> 31 26 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Color.hbm.xml" /> 32 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Unite.hbm.xml" /> 27 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/ColorIndex.hbm.xml" /> 28 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Colormap.hbm.xml" /> 29 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Concerne.hbm.xml" /> 30 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Contact.hbm.xml" /> 33 31 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Domaine.hbm.xml" /> 34 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Contact.hbm.xml" /> 32 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Fichier.hbm.xml" /> 33 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Fournit.hbm.xml" /> 34 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Grille.hbm.xml" /> 35 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Lienpersonne.hbm.xml" /> 36 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Metadata.hbm.xml" /> 37 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Organisme.hbm.xml" /> 38 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/ParamColor.hbm.xml" /> 39 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Parametre.hbm.xml" /> 40 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Personne.hbm.xml" /> 41 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Produit.hbm.xml" /> 42 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Produitorig.hbm.xml" /> 43 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/References.hbm.xml" /> 35 44 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Requete.hbm.xml" /> 36 45 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Typecodification.hbm.xml" /> 37 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Colormap.hbm.xml" />38 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Categorieparametre.hbm.xml" />39 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/ParamColor.hbm.xml" />40 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Organisme.hbm.xml" />41 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Personne.hbm.xml" />42 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/References.hbm.xml" />43 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Grille.hbm.xml" />44 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Concerne.hbm.xml" />45 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Sequence.hbm.xml" />46 <!-- > <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Ceoslevel.hbm.xml" />-->47 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Fournit.hbm.xml" />48 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Lienpersonne.hbm.xml" />49 46 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Typeproduit.hbm.xml" /> 50 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/ Parametre.hbm.xml" />47 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Unite.hbm.xml" /> 51 48 </session-factory> 52 49 </hibernate-configuration> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/hibernate.cfg.xml.template
r68 r70 23 23 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Fichier.hbm.xml" /> 24 24 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/ColorIndex.hbm.xml" /> 25 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Lienorganisme.hbm.xml" />26 25 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Metadata.hbm.xml" /> 27 26 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Code.hbm.xml" /> … … 43 42 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Grille.hbm.xml" /> 44 43 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Concerne.hbm.xml" /> 45 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Sequence.hbm.xml" />46 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/CeosLoggerPerso.hbm.xml" />47 44 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Fournit.hbm.xml" /> 48 45 <mapping resource="org/medias/eccad/persistance/hibernate/domaine/Lienpersonne.hbm.xml" /> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/helpers/CharactereHelper.java
r68 r70 10 10 try { 11 11 temp = valeur.getBytes(format); 12 } catch (UnsupportedEncodingException e) { }12 } catch (UnsupportedEncodingException e) {e.printStackTrace(); } 13 13 14 14 if (temp != null) -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/helpers/InfoConfigVisu.java
r68 r70 5 5 6 6 import org.medias.eccad.Lanceur; 7 import org.medias.eccad.persistance.PropertiesDatabase;8 7 9 8 public class InfoConfigVisu { … … 17 16 18 17 private static void init() { 19 LoggerPerso.log(PropertiesDatabase.class, LoggerPerso.DEBUG, "chargement fichier de properties");18 // LoggerPerso.log(PropertiesDatabase.class, LoggerPerso.DEBUG, "chargement fichier de properties"); 20 19 String fichierProp = Lanceur.class.getResource("").getPath() + "/../../../../../propriete/serveur.properties"; 21 20 fichierProp.replaceAll("%20", " "); 22 21 Properties prop = new Properties(); 23 22 try { 24 LoggerPerso.log(PropertiesDatabase.class, LoggerPerso.DEBUG, "chargement de : " + fichierProp);23 // LoggerPerso.log(PropertiesDatabase.class, LoggerPerso.DEBUG, "chargement de : " + fichierProp); 25 24 prop.load(new FileInputStream(fichierProp)); 26 25 } catch (Exception e) { 27 LoggerPerso.log( PropertiesDatabase.class, LoggerPerso.ERROR, "impossible de charger le fichier de properties valeur par défaut mise en place", e);26 LoggerPerso.log(InfoConfigVisu.class, LoggerPerso.ERROR, "impossible de charger le fichier de properties valeur par défaut mise en place", e); 28 27 prop = null; 29 28 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/helpers/LoggerPerso.java
r68 r70 12 12 public static int INFO = 3; 13 13 14 public static void log(Class appelant, int level, Object message) {14 public static void log(Class<?> appelant, int level, Object message) { 15 15 log = Logger.getLogger(appelant); 16 16 log.log(getPriority(level), message); 17 17 } 18 18 19 public static void log(Class appelant, int level, Object message, Exception e) {19 public static void log(Class<?> appelant, int level, Object message, Exception e) { 20 20 log = Logger.getLogger(appelant); 21 21 log.log(getPriority(level), message, e); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/helpers/XmlHelper.java
r68 r70 63 63 } 64 64 65 public static String listToString(String nom, Set liste) {65 public static String listToString(String nom, Set<?> liste) { 66 66 String retour = new String(); 67 67 … … 87 87 * @return 88 88 */ 89 public static String listToString(String nom, Set liste, int index) {89 public static String listToString(String nom, Set<?> liste, int index) { 90 90 String retour = new String(); 91 91 … … 93 93 return ""; 94 94 95 Iterator< Object> ite = liste.iterator();95 Iterator<?> ite = liste.iterator(); 96 96 retour += ite.next().toString(); 97 97 … … 101 101 102 102 public static Document getXMLtoDocument(InputStream is_xml, String identifiant) { 103 103 104 // LoggerPerso.log(XmlHelper.class, LoggerPerso.WARN, "LECTURE XML"); 104 105 Document dom = null; 105 106 InputSource is = null; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/ServiceMetadata.java
r68 r70 1 1 package org.medias.eccad.metier; 2 2 3 import org.medias.eccad.helpers.CharactereHelper;4 3 import org.medias.eccad.helpers.SpringBeanFactory; 5 4 import org.medias.eccad.persistance.dao.XmlDAO; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/ServiceMetier.java
r68 r70 7 7 8 8 import javax.faces.model.SelectItem; 9 10 9 11 10 import org.medias.eccad.helpers.LoggerPerso; … … 15 14 import org.medias.eccad.persistance.ServicePersistance; 16 15 import org.medias.eccad.persistance.dao.ColorTabDAO; 16 import org.medias.eccad.persistance.dao.ClassDistributionTabDAO; 17 17 import org.medias.eccad.persistance.dao.GrilleDAO; 18 18 import org.medias.eccad.persistance.exception.PersistanceException; … … 49 49 50 50 public List<SelectItem> getListCatParametre() { 51 // TODO : ici mettre un traducteur plutot ^^LoggerPerso.log(ServiceMetier.class, LoggerPerso.DEBUG, "youhou!!");51 // TODO : ici mettre un traducteur plutot 52 52 List<SelectItem> liste_catParam = new ArrayList<SelectItem>(); 53 LoggerPerso.log(ServiceMetier.class, LoggerPerso.DEBUG, "youhou!!");54 53 List<CatParametre> tempo = spm.getListcatParametre(); 55 54 if (tempo == null) { 56 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de Catparametre vide");55 // LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de Catparametre vide"); 57 56 return new ArrayList<SelectItem>(); 58 57 } 59 58 60 59 for (CatParametre catParametreDAO : tempo) { 61 62 LoggerPerso.log(ServiceMetier.class, LoggerPerso.DEBUG, "youhou!!");63 60 liste_catParam.add(new SelectItem(new Long(catParametreDAO.getIdentifiant()), catParametreDAO.getNom())); 64 61 } … … 72 69 List<Parametre> tempo = spm.getListParametre(); 73 70 if (tempo == null) { 74 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de parametre vide");71 // LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de parametre vide"); 75 72 return new ArrayList<SelectItem>(); 76 73 } … … 81 78 82 79 return liste_param; 80 } 81 82 public List<SelectItem> getListSecteur() { 83 // 84 List<SelectItem> liste_secteur = new ArrayList<SelectItem>(); 85 List<Secteur> tempo = spm.getListSecteur(); 86 if (tempo == null) { 87 // LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de secteurs vide"); 88 return new ArrayList<SelectItem>(); 89 } 90 91 for (Secteur secteurDAO : tempo) { 92 liste_secteur.add(new SelectItem(new Long(secteurDAO.getIdentifiant()), secteurDAO.getNom())); 93 } 94 95 return liste_secteur; 83 96 } 84 97 … … 88 101 List<Parametre> tempo = spm.getListParamByCatParam(catParam); 89 102 if (tempo == null) { 90 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de parametre vide");91 return new ArrayList<SelectItem>(); 92 } 93 103 // LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de parametre vide"); 104 return new ArrayList<SelectItem>(); 105 } 106 String nomParam; 94 107 for (Parametre parametreDAO : tempo) { 95 108 96 LoggerPerso.log(ServiceMetier.class, LoggerPerso.DEBUG, "----------------------->id nom"+parametreDAO.getIdentifiant()+" "+ parametreDAO.getNom()); 97 liste_param.add(new SelectItem(new Long(parametreDAO.getIdentifiant()), parametreDAO.getNom())); 109 // LoggerPerso.log(ServiceMetier.class, LoggerPerso.DEBUG, "----------------------->id nom"+parametreDAO.getIdentifiant()+" "+ parametreDAO.getNom()); 110 111 // On enlÚve du nom du paramÚtre le nom de la catégorie 112 nomParam = parametreDAO.getNom(); 113 if (nomParam.startsWith("biomassBurning_") || nomParam.startsWith("anthro_") 114 || nomParam.startsWith("biogenic_") || nomParam.startsWith("oceanic_")) { 115 nomParam = nomParam.substring(nomParam.indexOf("_")+1); 116 } 117 liste_param.add(new SelectItem(new Long(parametreDAO.getIdentifiant()), nomParam)); 98 118 } 99 119 100 120 return liste_param; 121 } 122 123 public List<SelectItem> getListSectorByParam(int param, int prod, int rcp) { 124 // 125 List<SelectItem> liste_secteur = new ArrayList<SelectItem>(); 126 List<Secteur> tempo = spm.getListSectorByParam(param,prod,rcp); 127 128 if (tempo == null) { 129 // LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de secteurs vide"); 130 return new ArrayList<SelectItem>(); 131 } 132 133 for (Secteur secteurDAO : tempo) { 134 135 // LoggerPerso.log(ServiceMetier.class, LoggerPerso.DEBUG, "----------------------->id nom"+secteurDAO.getIdentifiant()+" "+ secteurDAO.getNom()); 136 liste_secteur.add(new SelectItem(new Long(secteurDAO.getIdentifiant()), secteurDAO.getNom())); 137 138 } 139 140 return liste_secteur; 141 } 142 143 public List<SelectItem> getListRcpByParam(int param, int prod, int sector) { 144 List<SelectItem> liste_rcp = new ArrayList<SelectItem>(); 145 List<Rcp> tempo = spm.getListRcpByParam(param,prod,sector); 146 147 if (tempo == null) { 148 return new ArrayList<SelectItem>(); 149 } 150 151 for (Rcp rcpDAO : tempo) { 152 liste_rcp.add(new SelectItem(new Long(rcpDAO.getIdentifiant()), rcpDAO.getNom())); 153 } 154 155 return liste_rcp; 101 156 } 102 157 … … 105 160 List<Produit> tempo = spm.getListProductByParam(id_param); 106 161 if (tempo == null) { 107 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de produit vide");162 // LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de produit vide"); 108 163 return new ArrayList<SelectItem>(); 109 164 } … … 123 178 * @return une liste d'item de sélection de type oid - legende de la grille 124 179 */ 125 public List<SelectItem> getListGrille(long id_produit,long id_parametre, String date_debut, String date_fin) { 126 Produit produit = spm.getProduitByID(id_produit); 127 List<Grille> liste_grille = spm.getListGrille(id_produit, id_parametre, date_debut, date_fin); 180 public List<SelectItem> getListGrille(long id_produit,long id_parametre, long id_secteur, long id_rcp, String date_debut, String date_fin, String deltaDate, Produit produit, String legend) { 181 List<Grille> liste_grille = spm.getListGrille(id_produit, id_parametre, id_secteur, id_rcp, date_debut, date_fin, produit.getNom(), legend, produit.getType()); 128 182 Visualisation visu = spm.getVisuByProduit(produit.getType()); 129 130 183 TraducteurVisu traducteur = (TraducteurVisu) xmlbean.getBean(visu.getTraducteur()); 131 184 132 185 if (liste_grille == null) { 133 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de produit vide");134 return new ArrayList<SelectItem>(); 135 } 136 137 return traducteur.getListGrille(liste_grille );138 } 139 140 public List<SelectItem> getListGrille(long id_produit, String date_debut, String date_fin ) {186 // LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de produit vide"); 187 return new ArrayList<SelectItem>(); 188 } 189 190 return traducteur.getListGrille(liste_grille,deltaDate,produit.getNom()); 191 } 192 193 public List<SelectItem> getListGrille(long id_produit, String date_debut, String date_fin, String deltaDate) { 141 194 Produit produit = spm.getProduitByID(id_produit); 142 195 List<Grille> liste_grille = spm.getListGrille(id_produit, date_debut, date_fin); … … 146 199 147 200 if (liste_grille == null) { 148 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de produit vide"); 149 return new ArrayList<SelectItem>(); 150 } 151 152 return traducteur.getListGrille(liste_grille); 153 } 154 155 public List<SelectItem> getListMappingColor(long oid) { 201 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de grille vide"); 202 return new ArrayList<SelectItem>(); 203 } 204 205 return traducteur.getListGrille(liste_grille,deltaDate, produit.getNom()); 206 } 207 208 /** 209 * Renvoie la liste d'altitudes associées à la date fournie en paramÚtre 210 */ 211 public List<SelectItem> getListAlt(long id_secteur, String date_debut) { 212 List<String> liste_alt = spm.getListAlt(id_secteur, date_debut); 213 List<SelectItem> liste_altitem = new ArrayList<SelectItem>(); 214 if (liste_alt != null) { 215 String nomAlt; 216 for (int num = 0; num < liste_alt.size(); num++) { 217 nomAlt = liste_alt.get(num); 218 if (nomAlt.equals("Sum")) 219 liste_altitem.add(new SelectItem(nomAlt, nomAlt)); 220 else 221 liste_altitem.add(new SelectItem(nomAlt, nomAlt+" km")); 222 } 223 } 224 return liste_altitem; 225 } 226 227 public List<SelectItem> getListMappingColor() { 156 228 ColorTabDAO colortabDAO = (ColorTabDAO) xmlbean.getBean("colorTabDAO"); 157 229 List<ColorMap> liste_color = null; 158 230 try { 159 liste_color = colortabDAO.getListColorTabByGrille( oid);231 liste_color = colortabDAO.getListColorTabByGrille(); 160 232 } 161 233 catch (PersistanceException e) { … … 165 237 166 238 if (liste_color == null) { 167 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, " pas de colormap pour la grille :/");239 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de colormap vide"); 168 240 return new ArrayList<SelectItem>(); 169 241 } … … 177 249 } 178 250 179 public List<SelectItem> getListColorDynamique() { 251 public List<SelectItem> getListClassDistribution(long param_id) { 252 ClassDistributionTabDAO classDistributionTabDAO = (ClassDistributionTabDAO) xmlbean.getBean("classDistributionTabDAO"); 253 List<ClassDistribution> liste_distrib = null; 254 try { 255 liste_distrib = classDistributionTabDAO.getListClassMap(param_id); 256 } 257 catch (PersistanceException e) { 258 e.printStackTrace(); 259 liste_distrib = null; 260 } 261 262 if (liste_distrib == null) { 263 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de class level vide"); 264 return new ArrayList<SelectItem>(); 265 } 266 267 List<SelectItem> liste_select = new LinkedList<SelectItem>(); 268 for (ClassDistribution classdistrib : liste_distrib) { 269 liste_select.add(new SelectItem(new Long(classdistrib.getIdentifiant()), classdistrib.getNom())); 270 // long tt=new Long(classdistrib.getIdentifiant()); 271 // LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "ADD LISTE DISTRIB = "+tt); 272 } 273 274 return liste_select; 275 } 276 277 /** 278 * Renvoie la liste des régions 279 */ 280 public List<SelectItem> getListRegion() { 281 List<Grille> liste_reg = spm.getListMasques("region_codif"); 282 List<SelectItem> liste_regitem = new ArrayList<SelectItem>(); 283 if (liste_reg != null) { 284 String nomReg; 285 long idGrille; 286 for (int num = 0; num < liste_reg.size(); num++) { 287 nomReg = liste_reg.get(num).getLegend(); 288 idGrille = liste_reg.get(num).getId_grille(); 289 if (nomReg.equals("Water")) 290 liste_regitem.add(new SelectItem(idGrille, "All regions")); 291 else 292 liste_regitem.add(new SelectItem(idGrille, nomReg)); 293 } 294 } 295 return liste_regitem; 296 } 297 298 /** 299 * Renvoie la liste des pays 300 */ 301 public List<SelectItem> getListCountry() { 302 List<Grille> liste_co = spm.getListMasques("GPW3country_codif"); 303 List<SelectItem> liste_coitem = new ArrayList<SelectItem>(); 304 if (liste_co != null) { 305 String nomCo; 306 long idGrille; 307 for (int num = 0; num < liste_co.size(); num++) { 308 nomCo = liste_co.get(num).getLegend(); 309 idGrille = liste_co.get(num).getId_grille(); 310 if (nomCo.equals("Water")) 311 liste_coitem.add(new SelectItem(idGrille, "All countries")); 312 else 313 liste_coitem.add(new SelectItem(idGrille, nomCo)); 314 } 315 } 316 return liste_coitem; 317 } 318 319 /* public List<SelectItem> getListColorDynamique() { 180 320 ColorTabDAO colortabDAO = (ColorTabDAO) xmlbean.getBean("colorTabDAO"); 181 321 List<ColorMap> liste_color = null; … … 189 329 190 330 if (liste_color == null) { 191 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "pas de colormap pour la grille :/");331 // LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "pas de colormap pour la grille :/"); 192 332 return new ArrayList<SelectItem>(); 193 333 } … … 199 339 200 340 return liste_select; 201 } 202 203 public List<SelectItem> getListColorDynamique(boolean lineaire) {204 if (!lineaire) 341 }*/ 342 343 /* public List<SelectItem> getListColorDynamique(boolean lineaire) { 344 if (!lineaire) { 205 345 return getListColorDynamique(); 206 346 } 207 347 ColorTabDAO colortabDAO = (ColorTabDAO) xmlbean.getBean("colorTabDAO"); 208 348 List<ColorMap> liste_color = null; … … 216 356 217 357 if (liste_color == null) { 218 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "pas de colormap pour la grille :/");358 // LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "pas de colormap pour la grille :/"); 219 359 return new ArrayList<SelectItem>(); 220 360 } … … 222 362 List<SelectItem> liste_select = new LinkedList<SelectItem>(); 223 363 for (ColorMap colormap : liste_color) { 224 if (colormap.getNom().equalsIgnoreCase("logarithm"))364 // if (colormap.getNom().equalsIgnoreCase("logarithm")) 225 365 liste_select.add(new SelectItem(new Long(colormap.getIdentifiant()), colormap.getNom())); 226 366 } 227 367 228 368 return liste_select; 229 } 230 231 /** 232 * 369 }*/ 370 371 public List<SelectItem> getListClassDynamique() { 372 373 ClassDistributionTabDAO classtabDAO = (ClassDistributionTabDAO) xmlbean.getBean("classDistributionTabDAO"); 374 List<ClassDistribution> liste_distrib = null; 375 try { 376 liste_distrib = classtabDAO.getListClassDisDynamique(); 377 } 378 catch (PersistanceException e) { 379 e.printStackTrace(); 380 liste_distrib = null; 381 } 382 383 if (liste_distrib == null) { 384 LoggerPerso.log(ServiceMetier.class, LoggerPerso.WARN, "liste de class level vide"); 385 return new ArrayList<SelectItem>(); 386 } 387 388 List<SelectItem> liste_select = new LinkedList<SelectItem>(); 389 for (ClassDistribution classdis : liste_distrib) { 390 liste_select.add(new SelectItem(new Long(classdis.getIdentifiant()), classdis.getNom())); 391 } 392 393 return liste_select; 394 } 395 396 public Secteur getSecteurById(int id_secteur) { 397 Secteur secteur = spm.getSecteurByID(id_secteur); 398 return secteur; 399 } 400 401 public Rcp getRcpById(int id_rcp) { 402 Rcp rcp = spm.getRcpByID(id_rcp); 403 return rcp; 404 } 405 406 /** 407 * 233 408 * @param id_produit 234 409 * @return … … 236 411 public Produit getProduitById(int id_produit) { 237 412 Produit produit = spm.getProduitByID(id_produit); 238 LoggerPerso.log(ServiceMetier.class, LoggerPerso.DEBUG, "getProduitById::nom::"+ produit.getNom() + "::date::" + produit.getBeginDate());239 413 return produit; 240 414 } 241 242 /*public Produit getProduitById(long id_produit) {243 Produit produit = spm.getProduitByID(id_produit);244 LoggerPerso.log(ServiceMetier.class, LoggerPerso.DEBUG, "getProduitById::nom::"+ produit.getNom() + "::date::" + produit.getBeginDate());245 return produit;246 }*/247 415 248 416 public Grille getGrilleById(Long id_grille) { … … 252 420 grille = grilleDAO.getGrille(id_grille); 253 421 } catch (PersistanceException e) { 254 LoggerPerso.log(ServiceMetier.class, LoggerPerso.ERROR, "erreur getgrillebyid");422 LoggerPerso.log(ServiceMetier.class, LoggerPerso.ERROR, "erreur getgrillebyid"); 255 423 return null; 256 424 } … … 271 439 return spm.getVisuByProduit(type_produit); 272 440 } 441 442 public String getTypeCodif(long idGrille) { 443 return spm.getTypeCodif(idGrille); 444 } 445 446 public ArrayList<String> getDates(long id_produit,long id_parametre, long id_secteur, long id_rcp, String nomprod) { 447 ArrayList<String> dates = spm.getDates(id_produit,id_parametre, id_secteur, id_rcp, nomprod); 448 if (dates == null) { 449 return new ArrayList<String>(); 450 } 451 return dates; 452 } 273 453 } 274 454 -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/dessinCarte/CarteMapScript.java
r68 r70 2 2 3 3 import java.awt.Point; 4 import java.beans.FeatureDescriptor;5 import java.io.File;6 import java.io.FileNotFoundException;7 import java.io.FileOutputStream;8 4 import java.io.IOException; 9 5 import java.io.OutputStream; 10 import java.io.PrintStream;11 6 import java.util.Iterator; 12 7 import java.util.List; 13 8 14 15 import org.medias.eccad.helpers.LoggerPerso;16 9 import org.medias.eccad.modele.Zone; 17 10 18 import edu.umn.gis.mapscript.DBFInfo;19 import edu.umn.gis.mapscript.MS_FONT_TYPE;20 //import edu.umn.gis.mapscript.MS_LABEL_POSITIONS;21 11 import edu.umn.gis.mapscript.MS_LAYER_TYPE; 22 import edu.umn.gis.mapscript.MS_SHAPE_TYPE;23 import edu.umn.gis.mapscript.MS_UNITS;24 import edu.umn.gis.mapscript.SWIGTYPE_p_FILE;25 import edu.umn.gis.mapscript.SWIGTYPE_p_int;26 12 import edu.umn.gis.mapscript.classObj; 27 13 import edu.umn.gis.mapscript.colorObj; 28 14 import edu.umn.gis.mapscript.imageObj; 29 import edu.umn.gis.mapscript.labelObj;30 15 import edu.umn.gis.mapscript.layerObj; 31 import edu.umn.gis.mapscript.lineObj;32 16 import edu.umn.gis.mapscript.mapObj; 33 17 import edu.umn.gis.mapscript.pointObj; 34 import edu.umn.gis.mapscript.projectionObj;35 18 import edu.umn.gis.mapscript.rectObj; 36 19 import edu.umn.gis.mapscript.referenceMapObj; 37 import edu.umn.gis.mapscript.shapeObj;38 20 import edu.umn.gis.mapscript.styleObj; 39 21 // faire la fonction dans spm qui retourne une Zone 40 22 /** 41 * Classe permettant la manipulation des objets issus de MapScript. Son but est de rendre possible la crà ¯Â¿Âœation de l'image d'une carte suivant des coordonnᅵes prᅵcises et en fonction des couches ᅵafficher.23 * Classe permettant la manipulation des objets issus de MapScript. Son but est de rendre possible la création de l'image d'une carte suivant des coordonnées précises et en fonction des couches à afficher. 42 24 * REMARQUE : CLASSE DEPRECIE, CODE A MODIFIER CAR FONCTIONNE SEULEMENT POUR DEGRES DECIMAUX 43 25 * : S'INSPIRER DE LA CLASSE CARTEMAPSERVER … … 56 38 57 39 /** 58 * Constructeur par dà ¯Â¿Âœfaut de la CarteMapScript59 * @param nomCarte nom du fichier .map dà ¯Â¿Âœcrivant les informations spatiales60 * @param path chemin d'accà ¯Â¿Âœs au fichier .map ex: c:\mapFile\ ou /mapFile/40 * Constructeur par défaut de la CarteMapScript 41 * @param nomCarte nom du fichier .map décrivant les informations spatiales 42 * @param path chemin d'accÚs au fichier .map ex: c:\mapFile\ ou /mapFile/ 61 43 */ 62 44 public CarteMapScript(String nomCarte, String path) { 63 45 map = new mapObj(path + nomCarte); 64 65 46 if (map == null) 66 47 throw new RuntimeException("Erreur initialisation map: Class CarteMapScript::CarteMapScript()"); 67 48 nom = nomCarte; 68 //map.setExtent(-180, -90, 180, 90); 69 //map.setSize(720, 360); 70 49 // map.setUnits(MS_UNITS.MS_DD); 50 // map.setExtent(-180, -90, 180, 90); 51 // map.setSize(720, 360); 52 // map.setResolution(0.5); 71 53 72 54 } // end CarteMapScript() … … 93 75 94 76 /** 95 * Positionne les couches à ¯Â¿Âœafficher sur la carte96 * @param couches liste des couches qui devront apparaà ¯Â¿Âœtre97 */ 98 public void choixCouches(List couches) {77 * Positionne les couches à afficher sur la carte 78 * @param couches liste des couches qui devront apparaître 79 */ 80 public void choixCouches(List<String> couches) { 99 81 /*** variables ***/ 100 82 int nbr_layer = map.getNumlayers(); 101 83 layerObj layer; 102 84 103 /*** parcourt des couches et mise à ¯Â¿ÂœOFF de leur statut ***/85 /*** parcourt des couches et mise à OFF de leur statut ***/ 104 86 for (int i=0; i<nbr_layer; i++) 105 87 { … … 111 93 112 94 113 Iterator i_couches = couches.iterator();114 /*** parcourt des couches à ¯Â¿Âœafficher ***/95 Iterator<String> i_couches = couches.iterator(); 96 /*** parcourt des couches à afficher ***/ 115 97 while (i_couches.hasNext()) { 116 98 layer = map.getLayerByName((String) i_couches.next()); … … 118 100 layer.setStatus(1); 119 101 else 120 System.err.println("couche non detectà ¯Â¿Âœe dans la map\nCarte.java:choixCouches:");102 System.err.println("couche non detectée dans la map\nCarte.java:choixCouches:"); 121 103 } // end while 122 104 } 123 105 124 106 /** 125 * Cree l'image de la carte dans le dossier indiquà ¯Â¿Âœ126 * @param path dossier oà ¯Â¿Âœ sera crᅵᅵl'image107 * Cree l'image de la carte dans le dossier indiqué 108 * @param path dossier où sera créé l'image 127 109 * @param session session de l'utilisateur sans lui nom = 'img[map]defaut.png' 128 110 * @return le nom de l'image 129 111 */ 130 112 public String dessinerCarte(String path, String session) { 131 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "dessin cartera");113 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "dessin carte, PATH="+path+" SESSION="+session); 132 114 /**** variables ****/ 133 115 imageObj img = map.draw(); 134 String imageNom; 135 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "dessin carte1"); 116 fixExtendMap(); 136 117 /**** gestion erreurs ****/ 137 118 if (img == null) 138 119 throw new RuntimeException("Erreur création image: CarteMapScript::dessinerCarte"); 139 140 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "dessin carte2");120 121 String imageNom; 141 122 /**** sauvegarde ****/ 142 123 if (session==null) … … 145 126 imageNom = session + ".png"; 146 127 img.save(path + imageNom, map); 147 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "fin dessin carte");148 128 return imageNom; 149 } // end dessinerCarte()150 129 } 130 151 131 public String dessinerCarte(String path, int identifiant) { 152 132 /**** variables ****/ 153 133 imageObj img = map.draw(); 134 fixExtendMap(); 154 135 String imageNom; 155 136 156 137 /**** gestion erreurs ****/ 157 138 if (img == null) … … 163 144 imageNom = "img_" + identifiant + ".png"; 164 145 img.save(path + imageNom, map); 165 146 166 147 return imageNom; 167 148 } // end dessinerCarte() 168 149 169 150 public void dessinerCarte(OutputStream os) { 170 151 imageObj img = map.draw(); 171 152 172 153 /**** gestion erreurs ****/ 173 154 if (img == null) 174 155 throw new RuntimeException("Erreur création image: CarteMapScript::dessinerCarte"); 175 156 176 157 byte[] b = img.getBytes(); 177 158 178 159 try { 179 160 os.write(b); … … 184 165 } 185 166 /** 186 * Permet de recentrer la carte sur un point donnà ¯Â¿Âœ avec un coefficient donnᅵ167 * Permet de recentrer la carte sur un point donné avec un coefficient donné 187 168 * @param coef coefficient du zoom 188 * @param clic point qui servira de nouveau centre à ¯Â¿Âœl'image169 * @param clic point qui servira de nouveau centre à l'image 189 170 */ 190 171 public void definirZoom(double coef, Point clic, double resol) { 191 172 // TODO: tester ici 192 // passage du coef à ¯Â¿Âœ 1 pour ᅵviter unecoef nul lors du dessin de la carte173 // passage du coef à 1 pour éviter un coef nul lors du dessin de la carte 193 174 int icoef; 194 if (coef==0)195 icoef = 1;196 if (coef<0)197 icoef = (int) -(1/coef);198 else175 // if (coef==0) 176 // icoef = 1; 177 // if (coef<0) 178 // icoef = (int) -(1/coef); 179 // else 199 180 icoef = (int) coef; 200 181 201 182 pointObj my_clic; 202 183 //System.out.println("clic="+clic.x+","+clic.y); 203 184 // si clic en dehors de l'image on centre le clic 204 185 if (clic.x !=0 && clic.y != 0) … … 207 188 my_clic = new pointObj(map.getWidth()/2, map.getHeight()/2, 0); 208 189 209 210 Zone zonCouverte = getZoneCouverte(); 211 212 int coeff = (int) ((360 / ( zonCouverte.getEastbc() - zonCouverte.getWestbc() ) )*(1/resol));213 214 //blocage du zoom a 8215 if ( coeff<16)190 // Zone zonCouverte = getZoneCouverte(); 191 192 // int coeff = (int) ((360 / ( zonCouverte.getEastbc() - zonCouverte.getWestbc() ) )*(1/resol)); 193 // Long coefLong = new Long(Math.round((360 / ( zonCouverte.getEastbc() - zonCouverte.getWestbc() ) )*(1/resol))); 194 // int coeff = coefLong.intValue(); 195 //blocage du zoom à un certain palier 196 if ( getExtent().getMaxx()-getExtent().getMinx() >= 6) 216 197 { 217 double maxX = map.getExtent().getMaxx(); 218 int diffX = (int)(map.getExtent().getMaxx() -map.getExtent().getMinx()); 219 double minX = map.getExtent().getMaxx() - diffX; 220 221 222 double maxY = map.getExtent().getMaxy(); 223 int diffY = (int)(map.getExtent().getMaxy() -map.getExtent().getMiny()); 224 double minY = map.getExtent().getMaxy() - diffY; 225 226 map.getExtent().setMaxx(maxX); 227 map.getExtent().setMinx(minX); 228 map.getExtent().setMaxy(maxY); 229 map.getExtent().setMiny(minY); 230 231 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++++++++++++++++++++++++++++++++++++++___________coeff "+ coeff); 232 233 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++++++++++++++++++++++++++++++++++++++getMaxx "+ map.getExtent().getMaxx()); 234 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++++++++++++++++++++++++++++++++++++++getMinx "+ map.getExtent().getMinx()); 235 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++++++++++++++++++++++++++++++++++++++getMaxy "+ map.getExtent().getMaxy()); 236 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++++++++++++++++++++++++++++++++++++++getMiny "+ map.getExtent().getMiny()); 237 238 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++++++++++++++++++++++++++++++++++++++ getWidth"+ ((int)(map.getWidth() / coeff))*coeff); 239 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++++++++++++++++++++++++++++++++++++++ getHeight"+ ((int)(map.getHeight() / coeff))*coeff); 240 241 // mise ᅵ jour du zoom ᅵ null c'est le maxExtend mais son rᅵle :/ ? 242 243 map.zoomPoint(icoef, my_clic, ((int)(map.getWidth() / coeff))*coeff , ((int)(map.getHeight() / coeff))*coeff, map.getExtent(), null); 244 } 198 // double maxX = map.getExtent().getMaxx(); 199 // int diffX = (int)(map.getExtent().getMaxx() -map.getExtent().getMinx()); 200 // double minX = map.getExtent().getMaxx() - diffX; 201 202 // double maxY = map.getExtent().getMaxy(); 203 // int diffY = (int)(map.getExtent().getMaxy() -map.getExtent().getMiny()); 204 // double minY = map.getExtent().getMaxy() - diffY; 205 206 // map.getExtent().setMaxx(maxX); 207 // map.getExtent().setMinx(minX); 208 // map.getExtent().setMaxy(maxY); 209 // map.getExtent().setMiny(minY); 210 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++clic="+ clic.x+","+clic.y); 211 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++getMaxx="+ getExtent().getMaxx()); 212 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++getMinx="+ getExtent().getMinx()); 213 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++getMaxy="+ getExtent().getMaxy()); 214 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++getMiny="+ getExtent().getMiny()); 215 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++getWidth="+ map.getWidth()+", calc="+((int)(map.getWidth() / coeff))*coeff); 216 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++getHeight="+ map.getHeight()+", calc="+((int)(map.getHeight() / coeff))*coeff); 217 218 // mise à jour du zoom à null c'est le maxExtend mais son rÃŽle :/ ? 219 // rectObj maxExtend = new rectObj(-180, -90, 180, 90, 0); 220 // map.zoomPoint(icoef, my_clic, ((int)(map.getWidth() / coeff))*coeff , ((int)(map.getHeight() / coeff))*coeff, map.getExtent(), null); 221 rectObj orig = new rectObj(getExtent().getMinx(), getExtent().getMiny(), getExtent().getMaxx(), getExtent().getMaxy(), 0); 222 map.zoomPoint(icoef, my_clic, map.getWidth(), map.getHeight(), getExtent(), null); 223 // map.zoomRectangle(zoomExtend, map.getWidth(), map.getHeight(), getExtent(), null); 224 fixExtendZoom(my_clic,orig,resol); 225 } 226 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "APRES++++getMaxx="+ getExtent().getMaxx()); 227 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "APRES++++getMinx="+ getExtent().getMinx()); 228 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "APRES++++getMaxy="+ getExtent().getMaxy()); 229 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "APRES++++getMiny="+ getExtent().getMiny()); 230 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "APRES++++getWidth="+ map.getWidth()+", calc="+((int)(map.getWidth() / coeff))*coeff); 231 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "APRES++++getHeight="+ map.getHeight()+", calc="+((int)(map.getHeight() / coeff))*coeff); 245 232 //map.zoomPoint(icoef, my_clic, 80 , 40, map.getExtent(), null); 246 233 247 234 } // end definirZoom() 235 236 237 /** 238 * Une erreur dans Mapserver ne permet pas de restituer les limites de la carte de façon exacte, 239 * notamment en longitude, il est donc nécessaire de recalculer les bonnes valeurs 240 */ 241 public void fixExtendMap() { 242 // if (map.getExtent().getMaxx() > 180) map.getExtent().setMaxx(180); 243 // if (map.getExtent().getMinx() < -180) map.getExtent().setMinx(-180); 244 // if (map.getExtent().getMaxy() > 90) map.getExtent().setMaxy(90); 245 // if (map.getExtent().getMiny() < -90) map.getExtent().setMiny(-90); 246 // arrondi au dixiÚme 247 double maxx = map.getExtent().getMaxx(); 248 maxx = (double)Math.round(maxx*10)/10; 249 double minx = map.getExtent().getMinx(); 250 minx = (double)Math.round(minx*10)/10; 251 // cas particulier lors d'un premier affichage 252 if (maxx == 180.3) maxx = 180; 253 if (minx == -180.3) minx = -180; 254 // arrondi à 0.5 prÚs 255 maxx = (double)Math.round(maxx*2)/2; 256 minx = (double)Math.round(minx*2)/2; 257 map.getExtent().setMaxx(maxx); 258 map.getExtent().setMinx(minx); 259 } 260 261 /** 262 * Lors d'un zoom, les coordonnées des extrémités de la carte sont mal recalculées par Mapserver. 263 * Cette fonction permet donc de recalculer manuellement les nouvelles extrémités en fonction: 264 * - des coordonnées du point sur lequel on a cliqué 265 * - des coordonnées des extrémités de la carte originale 266 * - de la résolution de la carte 267 */ 268 public void fixExtendZoom(pointObj clic, rectObj orig,double resol) { 269 double largeur = orig.getMaxx()-orig.getMinx(); 270 double lon1 = (clic.getX()-1)*largeur; 271 double lon2 = 720 * resol; 272 int xAjuste = 1+(int)Math.floor(lon1/lon2); 273 double hauteur = orig.getMaxy()-orig.getMiny(); 274 double lat1 = (clic.getY()-1)*hauteur; 275 double lat2 = 360 * resol; 276 int yAjuste = 1+(int)Math.floor(lat1/lat2); 277 //System.out.println("x="+clic.getX()+"->"+xAjuste+", y="+clic.getY()+"->"+yAjuste); 278 rectObj centre = new rectObj(orig.getMinx()+(xAjuste-1)*resol, orig.getMaxy()-yAjuste*resol, 279 orig.getMinx()+xAjuste*resol, orig.getMaxy()-(yAjuste-1)*resol, 0); 280 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "CENTRE++++getMaxx="+ centre.getMaxx()); 281 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "CENTRE++++getMinx="+ centre.getMinx()); 282 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "CENTRE++++getMaxy="+ centre.getMaxy()); 283 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "CENTRE++++getMiny="+ centre.getMiny()); 284 rectObj zoom = getExtent(); 285 // ZOOM 1 : largeur/hauteur = 360/180 -> 180/90 286 if (largeur >= 360) { 287 zoom = new rectObj(centre.getMaxx()-90, centre.getMiny()-45, 288 centre.getMaxx()+90, centre.getMiny()+45, 0); 289 } 290 // ZOOM 2 : largeur/hauteur = 180/90 -> 90/45 291 else if (largeur >= 180) { 292 zoom = new rectObj(centre.getMaxx()-45, centre.getMiny()-22, 293 centre.getMaxx()+45, centre.getMiny()+23, 0); 294 } 295 // ZOOM 3 : largeur/hauteur = 90/45 -> 44/22 296 else if (largeur >= 90) { 297 zoom = new rectObj(centre.getMaxx()-22, centre.getMiny()-11, 298 centre.getMaxx()+22, centre.getMiny()+11, 0); 299 } 300 // ZOOM 4 : largeur/hauteur = 44/22 -> 22/11 301 else if (largeur >= 44) { 302 zoom = new rectObj(centre.getMaxx()-11, centre.getMiny()-5, 303 centre.getMaxx()+11, centre.getMiny()+6, 0); 304 } 305 // ZOOM 5 : largeur/hauteur = 22/11 -> 12/6 306 else if (largeur >= 22) { 307 zoom = new rectObj(centre.getMaxx()-6, centre.getMiny()-3, 308 centre.getMaxx()+6, centre.getMiny()+3, 0); 309 } 310 // ZOOM 6 : largeur/hauteur = 12/6 -> 6/3 311 else if (largeur >= 12) { 312 zoom = new rectObj(centre.getMaxx()-3, centre.getMiny()-1, 313 centre.getMaxx()+3, centre.getMiny()+2, 0); 314 } 315 // ZOOM 7 : largeur/hauteur = 6/3 -> 4/2 316 else if (largeur >= 6) { 317 zoom = new rectObj(centre.getMaxx()-2, centre.getMiny()-1, 318 centre.getMaxx()+2, centre.getMiny()+1, 0); 319 } 320 map.setExtent(zoom); 321 } 322 323 248 324 249 325 public void modifDataLayer(String nom, String data) { … … 257 333 */ 258 334 public void deleteAllLayer() { 259 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "delete all layer");335 // LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "delete all layer"); 260 336 int nbr_layer = map.getNumlayers(); 261 /*** parcourt des couches et mise à ¯Â¿ÂœOFF de leur statut ***/337 /*** parcourt des couches et mise à OFF de leur statut ***/ 262 338 for (int i=0; i<nbr_layer; i++) 263 339 { … … 267 343 268 344 /** 269 * Equivalent à ¯Â¿ÂœchoixCouche270 */ 271 public void doLayerChoice(List layer) {345 * Equivalent à choixCouche 346 */ 347 public void doLayerChoice(List<String> layer) { 272 348 this.choixCouches(layer); 273 349 } 274 350 275 351 private rectObj getExtent() { 352 // map.getExtent().setMaxx(Math.round(map.getExtent().getMaxx())); 353 // map.getExtent().setMinx(Math.round(map.getExtent().getMinx())); 354 // map.getExtent().setMaxy(Math.round(map.getExtent().getMaxy())); 355 // map.getExtent().setMiny(Math.round(map.getExtent().getMiny())); 356 // if (map.getExtent().getMaxx() > 180) map.getExtent().setMaxx(180); 357 // if (map.getExtent().getMinx() < -180) map.getExtent().setMinx(-180); 358 // if (map.getExtent().getMaxy() > 90) map.getExtent().setMaxy(90); 359 // if (map.getExtent().getMiny() < -90) map.getExtent().setMiny(-90); 276 360 return map.getExtent(); 277 278 361 } 279 362 … … 281 364 public Zone getZoneCouverte() { 282 365 rectObj rect = getExtent(); 283 366 284 367 /*double maxX = map.getExtent().getMaxx(); 285 368 int diffX = (int)(map.getExtent().getMaxx() -map.getExtent().getMinx()); 286 369 double minX = map.getExtent().getMaxx() - diffX; 287 288 370 289 371 double maxY = map.getExtent().getMaxy(); … … 296 378 rect.setMiny(minY); 297 379 298 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++++++++++++++++++++++++++++++++++++++getMaxx "+ rect.getMaxx()); 299 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++++++++++++++++++++++++++++++++++++++getMinx "+ rect.getMinx()); 300 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++++++++++++++++++++++++++++++++++++++getMaxy "+ rect.getMaxy()); 301 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "++++++++++++++++++++++++++++++++++++++++getMiny "+ rect.getMiny());*/ 302 303 304 380 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "+++getMaxx "+ rect.getMaxx()); 381 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "+++getMinx "+ rect.getMinx()); 382 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "+++getMaxy "+ rect.getMaxy()); 383 LoggerPerso.log(CarteMapScript.class, LoggerPerso.DEBUG, "+++getMiny "+ rect.getMiny());*/ 384 305 385 Zone zone = new Zone(rect.getMaxy(), rect.getMiny(), rect.getMaxx(), rect.getMinx()); 306 386 return zone; … … 308 388 309 389 /** 310 * Equivalent à ¯Â¿ÂœdessinerCarte390 * Equivalent à dessinerCarte 311 391 */ 312 392 public String getMapDraw(String path, String session) { … … 315 395 316 396 /** 317 * Equivalent à ¯Â¿ÂœdefinirZoom397 * Equivalent à definirZoom 318 398 */ 319 399 public void doZoomDefine(double coef, Point clic) { … … 323 403 324 404 public void zoneAffiche(double latmax, double latmin, double lonmax, double lonmin) { 325 rectObj rectangle = map.getExtent();405 rectObj rectangle = getExtent(); 326 406 rectangle.setMaxx(lonmax); 327 407 rectangle.setMinx(lonmin); 328 408 rectangle.setMiny(latmin); 329 409 rectangle.setMaxy(latmax); 410 // System.out.println("zone="+latmax+","+latmin+","+lonmax+","+lonmin); 330 411 map.setExtent(rectangle); 331 412 } … … 337 418 */ 338 419 public void doSelectZone(Point clicMin, Point clicMax) { 339 rectObj rectangle = map.getExtent();420 rectObj rectangle = getExtent(); 340 421 double longExtX, longExtY; // longueur du rectangle extent 341 422 double facteurX, facteurY; // facteur multiplicatif (extent/taille image) … … 365 446 366 447 /** 367 * Dessine la carte de rà ¯Â¿Âœfᅵrence dont le fond de carte est situᅵ dans le path passᅵ en parametre et porte le nom donnᅵ.448 * Dessine la carte de référence dont le fond de carte est situé dans le path passé en parametre et porte le nom donné. 368 449 * La fonction retourne le nom de l'image 369 450 * @deprecated utiliser getMapRefDraw(String path, String idImage) 370 * @param path chemin d'acces à ¯Â¿Âœl'image371 * @param idImage numà ¯Â¿Âœro de l'image ᅵ crᅵer (utilisᅵ pour crᅵer le nom de l'image)372 * @param IMGREF nom de l'image de rà ¯Â¿Âœfᅵrence373 * @return le nom dà ¯Â¿Âœfinitif de l'image451 * @param path chemin d'acces à l'image 452 * @param idImage numéro de l'image à créer (utilisé pour créer le nom de l'image) 453 * @param IMGREF nom de l'image de référence 454 * @return le nom définitif de l'image 374 455 */ 375 456 public String getMapRefDraw(String path, String idImage, String IMGREF) { … … 402 483 /**** gestion erreurs ****/ 403 484 if (img == null) 404 throw new RuntimeException("Erreur crà ¯Â¿Âœation ref image: CarteMapScript::dessinerCarte");485 throw new RuntimeException("Erreur création ref image: CarteMapScript::dessinerCarte"); 405 486 img.save(path + imageNom, map); 406 487 … … 409 490 410 491 /** 411 * Dessine la carte de rà ¯Â¿Âœfᅵrence dᅵfinie pour la carte.492 * Dessine la carte de référence définie pour la carte. 412 493 * La fonction retourne le nom de l'image 413 * @param path chemin d'acces à ¯Â¿Âœl'image414 * @param idImage numà ¯Â¿Âœro de l'image ᅵ crᅵer (utilisᅵ pour crᅵer le nom de l'image)415 * @return le nom dà ¯Â¿Âœfinitif de l'image494 * @param path chemin d'acces à l'image 495 * @param idImage numéro de l'image à créer (utilisé pour créer le nom de l'image) 496 * @return le nom définitif de l'image 416 497 */ 417 498 public String getMapRefDraw(String path, String idImage) { … … 420 501 /**** sauvegarde ****/ 421 502 if (refmap == null) 422 System.err.println("MapServer::fichier de reference à ¯Â¿Âœla carte non initialise ");503 System.err.println("MapServer::fichier de reference à la carte non initialise "); 423 504 424 505 if (idImage==null || refmap==null) { … … 433 514 /**** gestion erreurs ****/ 434 515 if (img == null) 435 throw new RuntimeException("Erreur crà ¯Â¿Âœation ref image: CarteMapScript::dessinerCarte");516 throw new RuntimeException("Erreur création ref image: CarteMapScript::dessinerCarte"); 436 517 437 518 img.save(path + imageNom, map); … … 461 542 couche.setName(name); 462 543 couche.setData(data); 544 // couche.setExtent(-180, -90, 180, 90); 545 // couche.setSizeunits(MS_UNITS.MS_PIXELS.swigValue()); 546 // couche.setUnits(MS_UNITS.MS_DD.swigValue()); 463 547 couche.setType(MS_LAYER_TYPE.MS_LAYER_LINE); 464 548 couche.setStatus(1); … … 477 561 couche.setName(name); 478 562 couche.setData(data); 563 // couche.setExtent(-180, -90, 180, 90); 564 // couche.setSizeunits(MS_UNITS.MS_PIXELS.swigValue()); 565 // couche.setUnits(MS_UNITS.MS_PIXELS.swigValue()); 479 566 couche.setType(MS_LAYER_TYPE.MS_LAYER_RASTER); 480 567 couche.setStatus(1); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/dessinCarte/ServiceCarte.java
r68 r70 37 37 38 38 /** 39 * Initialisation de l'emplacement de l'application40 *41 */39 * Initialisation de l'emplacement de l'application 40 * 41 */ 42 42 private void initEmplacement() { 43 43 emplacement = Donnees.getHome(); … … 50 50 */ 51 51 private void initMap() { 52 LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "chargement neutre.map");52 // LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "chargement neutre.map"); 53 53 carte = new CarteMapScript("neutre.map", emplacement + "/mapfile/"); 54 54 carte.setOTFRaster("donnees", "null"); … … 58 58 59 59 /** 60 * Cette fonction génÚre une image de carte pour la grille passée en paramà ªtre avec la table de couleur demandée60 * Cette fonction génÚre une image de carte pour la grille passée en paramÚtre avec la table de couleur demandée 61 61 * @param id_grille 62 62 * @param id_colormap … … 67 67 * @throws PersistanceException 68 68 */ 69 public StatReponse getCarte(long id_grille, long id_colormap, Zone zone_aff, String identifiant_unique){ 70 String img_temporaire = new String(); 69 public StatReponse getCarte(long id_grille, long id_colormap, long id_classdis, Zone zone_aff, String identifiant_unique, String nomProd, long id_sector, boolean zoom, boolean firstAff, long maskId){ 71 70 ServiceRaster serviceRaster = new ServiceRaster(); 72 73 StatReponse statReponse = serviceRaster.genereRaster(id_grille, id_colormap, zone_aff); 74 img_temporaire = statReponse.getUrlImage(); 75 double center = statReponse.getCenter(); 76 71 StatReponse statReponse = serviceRaster.genereRaster(id_grille, id_colormap, id_classdis, zone_aff, nomProd, id_sector, maskId); 72 String img_temporaire = statReponse.getUrlImage(); 73 // LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "img_temporaire ="+img_temporaire); 74 // double center = statReponse.getCenter(); 77 75 78 76 // TODO: placer le generateur de worldfile au niveau du service raster 79 77 GenerateurWorldFile gen_worldfile = (GenerateurWorldFile) xmlbean.getBean("worldfile"); 80 81 78 //initialiser la resolution 82 79 double resolution= getResolution(id_grille); 83 84 80 gen_worldfile.setPasX(resolution); 85 81 gen_worldfile.setPasY(-resolution); 86 87 82 // gen_worldfile.setPixelY(statReponse.getZone().getNorthbc() - (resolution/2)); 83 // gen_worldfile.setPixelX(statReponse.getZone().getWestbc() + (resolution/2)); 84 gen_worldfile.setPixelY(statReponse.getZone().getNorthbc()); 85 gen_worldfile.setPixelX(statReponse.getZone().getWestbc()); 88 86 gen_worldfile.writeWorldFile("/tmp/" + id_grille + "." + id_colormap); 89 90 String urlImage = gestionImageCarte(img_temporaire, zone_aff, identifiant_unique); 91 LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "urlImage " +urlImage); 92 87 String urlImage = gestionImageCarte(img_temporaire, zone_aff, identifiant_unique, zoom, firstAff); 88 // LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "urlImage " +urlImage); 93 89 statReponse.setUrlImage(urlImage); 94 90 … … 101 97 GrilleDAO grilleDAO = (GrilleDAO) xmlbean.getBean("grilleDAO"); 102 98 103 try {resolution = grilleDAO.getGrilleResolution(id_grille);}catch (PersistanceException e) {LoggerPerso.log(ServiceRaster.class, LoggerPerso.ERROR, "ERROR generateRaster " + e.getM_message(), e);} 104 LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "resolution------------------------------------------------------> :: " + resolution); 99 try { 100 resolution = grilleDAO.getGrilleResolution(id_grille); 101 }catch (PersistanceException e) { 102 LoggerPerso.log(ServiceRaster.class, LoggerPerso.ERROR, "ERROR generateRaster " + e.getM_message(), e); 103 } 104 // LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "resolution------------------------------------------------------> :: " + resolution); 105 105 106 106 return resolution; 107 107 } 108 108 109 110 111 112 113 114 public StatReponse getStatReponse(long id_grille, long id_colormap, Zone zone_aff){ 109 public StatReponse getStatReponse(long id_grille, long id_colormap, long id_classdis, Zone zone_aff, String nomProd, long id_sector, long id_mask){ 115 110 ServiceRaster serviceRaster = new ServiceRaster(); 116 StatReponse statReponse = serviceRaster.genereRaster(id_grille, id_colormap, zone_aff); 117 118 LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "********************getStatReponse***************************"); 119 return statReponse; 120 } 121 122 123 124 /* 125 public StatReponse getCenter(long id_grille, long id_colormap, Zone zone_affiche, String identifiant_unique){ 126 127 } 128 */ 129 130 131 132 /** 133 * Genere une carte calculé à partir des données moyennes, somme, min, max ou ecart-type 111 StatReponse statReponse = serviceRaster.genereRaster(id_grille, id_colormap, id_classdis, zone_aff, nomProd, id_sector, id_mask); 112 113 return statReponse; 114 } 115 116 /** 117 * Genere une carte résultante comportant des statistiques sur les données 134 118 * @param criteres 135 119 * @param id_param … … 140 124 * @return 141 125 */ 142 public StatReponse getCarteStat(Map<String, String> criteres, long id_param, long id_produit, long id_colormap, String fonction, String id_unique, Zone selection) { 143 String img_temporaire = new String(); 144 145 StatReponse statReponse = serviceStat.getCarteStat(criteres, id_param, id_produit, id_colormap, fonction, id_unique); 146 img_temporaire = statReponse.getUrlImage(); 126 public StatReponse getCarteStat(Map<String, String> criteres, long id_param, long id_produit, long id_colormap, long id_classdis, long id_secteur, long id_rcp, String alt, String fonction, String id_unique, Zone selection, boolean zoom, boolean firstAff, long maskId) { 127 StatReponse statReponse = serviceStat.getCarteStat(criteres, id_param, id_produit, id_colormap, id_classdis, id_secteur, id_rcp, alt, fonction, maskId); 128 String img_temporaire = statReponse.getUrlImage(); 147 129 // TODO: placer le generateur de worldfile au niveau du service raster 148 130 GenerateurWorldFile gen_worldfile = (GenerateurWorldFile) xmlbean.getBean("worldfile"); 149 gen_worldfile.writeWorldFile(img_temporaire);150 151 152 131 // initialiser la resolution 153 float resolution=0;132 double resolution = 0; 154 133 GrilleDAO grilleDAO = (GrilleDAO) xmlbean.getBean("grilleDAO"); 155 156 try {resolution = grilleDAO.getGrilleResolution(id_produit);}catch (PersistanceException e) {LoggerPerso.log(ServiceRaster.class, LoggerPerso.ERROR, "ERROR generateRaster " + e.getM_message(), e);} 157 LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "resolution------------------------------------------------------> :: " + resolution); 134 try { 135 resolution = grilleDAO.getProduitResolution(id_produit); 136 }catch (PersistanceException e) { 137 LoggerPerso.log(ServiceRaster.class, LoggerPerso.ERROR, "ERROR generateRaster " + e.getM_message(), e); 138 } 139 // LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "resolution--> :: " + resolution); 140 158 141 gen_worldfile.setPasX(resolution); 159 142 gen_worldfile.setPasY(-resolution); 160 161 162 163 String urlImage = gestionImageCarte(img_temporaire, selection, id_unique); 164 LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "urlImage " +urlImage); 143 // gen_worldfile.setPixelY(statReponse.getZone().getNorthbc() - (resolution/2)); 144 // gen_worldfile.setPixelX(statReponse.getZone().getWestbc() + (resolution/2)); 145 gen_worldfile.setPixelY(statReponse.getZone().getNorthbc()); 146 gen_worldfile.setPixelX(statReponse.getZone().getWestbc()); 147 gen_worldfile.writeWorldFile(img_temporaire.substring(0, img_temporaire.length()-4)); 148 149 String urlImage = gestionImageCarte(img_temporaire, selection, id_unique, zoom, firstAff); 150 // LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "urlImage " +urlImage); 165 151 166 152 statReponse.setUrlImage(urlImage); … … 170 156 } 171 157 172 public StatReponse getStatReponse(Map<String, String> criteres, long id_param, long id_produit, long id_colormap, String fonction, String id_unique, Zone selection) { 173 174 StatReponse statReponse = serviceStat.getCarteStat(criteres, id_param, id_produit, id_colormap, fonction, id_unique); 175 176 return statReponse; 177 178 } 179 180 181 182 public String getLegendStat(long id_grille, long id_colormap, String fonction, String id) { 183 if (!fonction.equals("ecartCarte") && !fonction.equals("moyenneCarte") &&!fonction.equals("sommeCarte")) 184 return getLegend(id_grille, id_colormap); 185 String legend = serviceStat.getLegend(emplacement + "/images/cartes_temporaires/" + id_grille + "_" + id_colormap +"_" + id , id_colormap, id_grille); 186 LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "getLegendCarte :: " + legend); 187 return "/images/cartes_temporaires/" + id_grille + "_" + id_colormap +"_" + id +".legend.png"; 158 public StatReponse getStatReponse(Map<String, String> criteres, long id_param, long id_produit, long id_colormap, long id_classdis, long id_secteur, long id_rcp, String alt, String fonction, long id_mask) { 159 StatReponse statReponse = serviceStat.getCarteStat(criteres, id_param, id_produit, id_colormap, id_classdis, id_secteur, id_rcp, alt, fonction, id_mask); 160 return statReponse; 161 } 162 163 164 165 public String getLegendStat(long id_grille, long id_colormap, long id_classdis, String fonction, String id) { 166 // if (!fonction.equals("ecartCarte") && !fonction.equals("moyenneCarte") &&!fonction.equals("sommeCarte")) { 167 if (!fonction.equals("ecartCarte") && !fonction.equals("sommeCarte") 168 && !fonction.equals("totalDay") && !fonction.equals("totalMonth") 169 && !fonction.equals("totalYear") && !fonction.equals("totalPeriod")) { 170 return getLegend(id_grille, id_colormap, id_classdis); 171 } 172 serviceStat.getLegend(emplacement + "/images/cartes_temporaires/" + id_grille + "_" + id_colormap +"_" + id_classdis +"_"+ id , id_colormap, id_classdis, id_grille, fonction); 173 // LoggerPerso.log(ServiceCarte.class, LoggerPerso.DEBUG, "getLegendCarte :: " + legend); 174 return "/images/cartes_temporaires/" + id_grille + "_" + id_colormap +"_" +id_classdis+"_"+ id +".legend.png"; 188 175 } 189 176 /** … … 196 183 * @return 197 184 */ 198 public String gestionImageCarte(String image_temporaire,Zone zone_aff, String identifiant_unique ) {199 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "gestion image carte");185 public String gestionImageCarte(String image_temporaire,Zone zone_aff, String identifiant_unique, boolean zoom, boolean firstAff) { 186 // LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "gestion image carte"); 200 187 String img_erreur = "/images/nodata.png"; 201 188 String nom_image_final; 202 189 203 190 try { 204 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "modif layer : donnees " + image_temporaire);191 // LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "modif layer : donnees " + image_temporaire); 205 192 carte.modifDataLayer("donnees", image_temporaire); 206 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "modif layer ok"); 207 if (zone_aff != null) 193 if (firstAff && !zoom) { 208 194 carte.zoneAffiche(zone_aff.getNorthbc(), zone_aff.getSouthbc(), zone_aff.getEastbc(), zone_aff.getWestbc()); 195 } 209 196 //carte.changeProjection(""); 210 197 nom_image_final = carte.dessinerCarte(emplacement + "/images/cartes_temporaires/", identifiant_unique); … … 229 216 * @return 230 217 */ 231 public String getLegend(long id_grille, long id_colormap ) {232 File legend_img = new File(emplacement + "/images/cartes_temporaires/" + id_grille + "_" + id_colormap +".legend.png");218 public String getLegend(long id_grille, long id_colormap, long id_classdis) { 219 File legend_img = new File(emplacement + "/images/cartes_temporaires/" + id_grille + "_" + id_colormap+"_"+id_classdis +".legend.png"); 233 220 234 221 if (legend_img.exists()) 235 return "/images/cartes_temporaires/" + id_grille + "_" + id_colormap +".legend.png"; 236 222 return "/images/cartes_temporaires/" + id_grille + "_" + id_colormap +"_"+id_classdis+".legend.png"; 237 223 ServiceRaster serviceRaster = new ServiceRaster(); 238 serviceRaster.genereLegend(id_grille, id_colormap, emplacement + "/images/cartes_temporaires/" + id_grille + "_" + id_colormap);239 240 return "/images/cartes_temporaires/" + id_grille + "_" + id_colormap +" .legend.png";224 serviceRaster.genereLegend(id_grille, id_colormap, id_classdis, emplacement + "/images/cartes_temporaires/" + id_grille + "_" + id_colormap+"_"+id_classdis); 225 226 return "/images/cartes_temporaires/" + id_grille + "_" + id_colormap +"_"+id_classdis+".legend.png"; 241 227 } 242 228 … … 251 237 Zone zone = carte.getZoneCouverte(); 252 238 253 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "zonnnnnnnnnnnnnnnnnnnnnnnne : getEastbc "+ zone.getEastbc());254 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "zonnnnnnnnnnnnnnnnnnnnnnnne : getWestbc "+ zone.getWestbc());255 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "zonnnnnnnnnnnnnnnnnnnnnnnne : getNorthbc "+ zone.getNorthbc());256 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "zonnnnnnnnnnnnnnnnnnnnnnnne : getSouthbc "+ zone.getSouthbc());257 258 239 /*if (zone.getEastbc() <180) { if((zone.getEastbc()- ((int)zone.getEastbc())) < 0.5) zone.setEastbc(((int)zone.getEastbc()+ 0.25)); else zone.setEastbc(((int)zone.getEastbc()+ 0.75));}; 259 240 if (zone.getWestbc() > -180 ) { if((zone.getWestbc()- ((int)zone.getWestbc())) < 0.5) zone.setWestbc(((int)zone.getWestbc()+ 0.25)); else zone.setWestbc(((int)zone.getWestbc()+ 0.75));}; … … 261 242 if (zone.getSouthbc() >-90) { if((zone.getSouthbc()- ((int)zone.getSouthbc())) < 0.5) zone.setSouthbc(((int)zone.getSouthbc()+ 0.25)); else zone.setSouthbc(((int)zone.getSouthbc()+ 0.75));}; 262 243 */ 263 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "zonnnnnnnnnnnnnnnnnnnnnnnne : getEastbcN "+ zone.getEastbcN());264 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "zonnnnnnnnnnnnnnnnnnnnnnnne : getWestbcN "+ zone.getWestbcN());265 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "zonnnnnnnnnnnnnnnnnnnnnnnne : getNorthbcN "+ zone.getNorthbcN());266 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "zonnnnnnnnnnnnnnnnnnnnnnnne : getSouthbcN "+ zone.getSouthbcN());267 268 269 244 270 245 return zone; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/emission/ServiceEmission.java
r68 r70 15 15 import org.medias.eccad.metier.generationRaster.colorMap.ColorMappingLineaire; 16 16 import org.medias.eccad.metier.statistique.GrapheCGI; 17 import org.medias.eccad.metier.statistique.ServiceStatistique;18 17 import org.medias.eccad.metier.traducteur.TraducteurStat; 19 18 import org.medias.eccad.modele.ColorTab; … … 29 28 import org.medias.eccad.persistance.dao.ProduitDAO; 30 29 import org.medias.eccad.persistance.exception.PersistanceException; 31 import org.medias.jni.RasterDAO;32 30 import org.springframework.beans.factory.xml.XmlBeanFactory; 33 31 … … 116 114 LoggerPerso.log(ServiceEmission.class, LoggerPerso.ERROR, "erreur getGazFacteurEmission parametre : ", e); 117 115 } 118 LoggerPerso.log(ServiceEmission.class, LoggerPerso.DEBUG, " get produit :" + " " + prod + " ");116 // LoggerPerso.log(ServiceEmission.class, LoggerPerso.DEBUG, " get produit :" + " " + prod + " "); 119 117 return prod; 120 118 } … … 134 132 LoggerPerso.log(ServiceEmission.class, LoggerPerso.ERROR, "erreur getGazFacteurEmission parametre : ", e); 135 133 } 136 LoggerPerso.log(ServiceEmission.class, LoggerPerso.DEBUG, " getGazFacteurEmission param" + " " + liste.size() + " " + liste);134 // LoggerPerso.log(ServiceEmission.class, LoggerPerso.DEBUG, " getGazFacteurEmission param" + " " + liste.size() + " " + liste); 137 135 return liste; 138 136 } … … 149 147 LoggerPerso.log(ServiceEmission.class, LoggerPerso.ERROR, "erreur getGazFacteurEmission produit : " + id_produit, e); 150 148 } 151 LoggerPerso.log(ServiceEmission.class, LoggerPerso.DEBUG, " getGazFacteurEmission produit : " + id_produit + " " + liste.size() + " " + liste);149 // LoggerPerso.log(ServiceEmission.class, LoggerPerso.DEBUG, " getGazFacteurEmission produit : " + id_produit + " " + liste.size() + " " + liste); 152 150 return liste; 153 151 } … … 156 154 157 155 public List<Produit> getListLand(Long facteur) { 158 ProduitDAO produitdao 156 ProduitDAO produitdao = (ProduitDAO) xmlbean.getBean("produitDAO"); 159 157 List<Produit> liste = null; 160 158 … … 165 163 LoggerPerso.log(ServiceEmission.class, LoggerPerso.ERROR, "erreur getListLand parametre : ", e); 166 164 } 167 LoggerPerso.log(ServiceEmission.class, LoggerPerso.DEBUG, " getListLand param" + " " + liste.size() + " " + liste);165 // LoggerPerso.log(ServiceEmission.class, LoggerPerso.DEBUG, " getListLand param" + " " + liste.size() + " " + liste); 168 166 return liste; 169 167 } … … 190 188 * @return 191 189 */ 192 public String getCarte(RequeteFacteurEmission requete, Zone affiche, String id_unique ) {190 public String getCarte(RequeteFacteurEmission requete, Zone affiche, String id_unique, boolean zoom, boolean firstAff) { 193 191 String temp = getRasterFacteur(requete); 194 return carte.gestionImageCarte(temp, affiche, id_unique );195 } 196 197 public String getLegend(long id_colormap, long id_ grille, String url_images) {198 ColorMapping colormap = getColorMap(id_colormap );192 return carte.gestionImageCarte(temp, affiche, id_unique, zoom, firstAff); 193 } 194 195 public String getLegend(long id_colormap, long id_classdis, long id_grille, String url_images) { 196 ColorMapping colormap = getColorMap(id_colormap,id_classdis); 199 197 InformationLegend info_legend = new InformationLegend(); 200 198 GenerateurLegendRaster gen_legend = new GenerateurLegendeImg(); 201 199 gen_legend.genereLegendVertical(colormap, info_legend.getLegendDynamic(colormap.getColorTable(), reponse.getMaximal(), reponse.getMinimal()), "g(X)/m2/jour"); 202 //system.out.println(reponse);203 200 //gen_legend.genereLegendVertical(colormap, info_legend.getLegendDynamic(colormap.getColorTable(), 150, 0), info_legend.getInfoSup(id_grille)); 204 201 gen_legend.enregistreLegend(Donnees.getHome() +url_images+".legend.png"); … … 222 219 private String getRasterFacteur(RequeteFacteurEmission requete) { 223 220 String xml = requete.toXml(); 224 System.out.println(xml);225 // TODO: ATTENDRE LIB DE HAKIM226 221 GrapheCGI rasterdao = new GrapheCGI(); 227 228 //system.out.println(rasterdao.getStatistique(xml));229 230 222 reponse = decodeReponse(rasterdao.getStatistique(xml)); 231 223 if (reponse.getError() != null && !reponse.getError().equals("")) 232 224 return "erreur"; 233 234 225 GenerateurWorldFile gen_worldfile = (GenerateurWorldFile) xmlbean.getBean("worldfile"); 235 226 gen_worldfile.setPasX(reponse.getCarte().getPasX()); 236 227 gen_worldfile.setPasY(reponse.getCarte().getPasY()); 237 gen_worldfile.setPixelY(reponse.getZone().getNorthbc() - (reponse.getCarte().getPasY()/2));238 gen_worldfile.setPixelX(reponse.getZone().getWestbc() + (reponse.getCarte().getPasY()/2));239 240 228 gen_worldfile.setPixelY(reponse.getZone().getNorthbc()); 229 gen_worldfile.setPixelX(reponse.getZone().getWestbc()); 230 // gen_worldfile.setPixelY(reponse.getZone().getNorthbc() - (reponse.getCarte().getPasY()/2)); 231 // gen_worldfile.setPixelX(reponse.getZone().getWestbc() + (reponse.getCarte().getPasX()/2)); 241 232 String nom = reponse.getUrlImage(); 242 243 233 nom = nom.substring(0, nom.length()-4); 244 234 gen_worldfile.writeWorldFile(nom); 245 246 //system.out.println("\n\n\n" + nom);247 235 return reponse.getUrlImage(); 248 //return "/tmp/4113.31.png"; 249 } 250 251 private String encodeData() { 252 return ""; 253 } 236 } 237 238 // private String encodeData() { 239 // return ""; 240 // } 254 241 255 242 private StatReponse decodeReponse(String reponse_xml) { … … 258 245 if (reponse.getError() != null && !reponse.getError().equals("")) 259 246 return null; 260 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, reponse_xml);247 // LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, reponse_xml); 261 248 return reponse; 262 249 } … … 268 255 * @return la table de couleur par défaut 269 256 */ 270 private ColorMapping getColorMap(long colormapid ) {257 private ColorMapping getColorMap(long colormapid, long classdisid) { 271 258 ColorTabDAO colorDAO = (ColorTabDAO) xmlbean.getBean("colorTabDAO"); 272 259 … … 276 263 // mais la j'ai un résultat chelou :/ 277 264 try { 278 colortab = colorDAO.getColorMapByID(colormapid );265 colortab = colorDAO.getColorMapByID(colormapid, classdisid); 279 266 } catch (PersistanceException e) { 280 267 e.printStackTrace(); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/extracteur/CritereExtractBean.java
r68 r70 7 7 private String produit = null; 8 8 private String parametre = null; 9 private String secteur = null; 10 private String rcp = null; 11 9 12 private String dateDebut = null; 10 13 … … 129 132 public void setSeparator(String separator) { 130 133 this.separator = separator; 134 } 135 public String getSecteur() { 136 return secteur; 137 } 138 public void setSecteur(String secteur) { 139 this.secteur = secteur; 140 } 141 public String getRcp() { 142 return rcp; 143 } 144 public void setRcp(String rcp) { 145 this.rcp = rcp; 131 146 } 132 147 -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/extracteur/Extract.java
r68 r70 30 30 requete +="<idproduit>" + ef.getProduit() + "</idproduit>"; 31 31 requete +="<idparametre>" + ef.getParametre() + "</idparametre>"; 32 requete +="<idsecteur>" + ef.getSecteur() + "</idsecteur>"; 33 requete +="<idrcp>" + ef.getRcp() + "</idrcp>"; 32 34 requete +="<dateDebut>" + ef.getDateDebut() + "</dateDebut>"; 33 35 requete +="<dateFin>" + ef.getDateFin() + "</dateFin>"; … … 52 54 XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); 53 55 54 55 56 ExtracteurConfig configuration = (ExtracteurConfig) SpringBeanFactory.getXmlFactory().getBean("extracteur"); 56 57 String urlCgi = configuration.getUrl(); 57 58 58 59 //URL url = new URL("http://zeus/cgi-bin/eccad_extract.cgi");60 59 URL url = new URL(urlCgi); 61 60 config.setServerURL(url); … … 66 65 67 66 Object[] params = new Object[]{requete,mode}; 68 LoggerPerso.log(Extract.class, LoggerPerso.DEBUG, "extraction :: " + requete);67 // LoggerPerso.log(Extract.class, LoggerPerso.DEBUG, "extraction :: " + requete); 69 68 String rslt = (String) client.execute("extract", params); 70 LoggerPerso.log(Extract.class, LoggerPerso.DEBUG, "extraction result :: " + r esult);69 LoggerPerso.log(Extract.class, LoggerPerso.DEBUG, "extraction result :: " + rslt); 71 70 setResult(rslt); 72 71 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/generationRaster/GenerateurLegendRaster.java
r68 r70 1 1 package org.medias.eccad.metier.generationRaster; 2 3 import java.util.List;4 2 5 3 import org.medias.eccad.metier.generationRaster.colorMap.ColorMapping; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/generationRaster/GenerateurLegendeImg.java
r68 r70 4 4 import java.awt.Color; 5 5 import java.awt.Font; 6 import java.awt.Graphics;7 6 import java.awt.Graphics2D; 8 7 import java.awt.image.BufferedImage; … … 14 13 import javax.imageio.ImageIO; 15 14 16 17 import org.medias.eccad.helpers.LoggerPerso;18 15 import org.medias.eccad.metier.generationRaster.colorMap.ColorMapping; 19 16 import org.medias.eccad.modele.ColorTab; … … 47 44 e.printStackTrace(); 48 45 } 49 LoggerPerso.log(GenerateurLegendeImg.class, LoggerPerso.DEBUG, "fin write"); 50 46 // LoggerPerso.log(GenerateurLegendeImg.class, LoggerPerso.DEBUG, "fin write"); 51 47 } 52 48 … … 56 52 57 53 initcolor(); 58 genereCarre( );54 genereCarre(texte_legende.getType()); 59 55 genereText(texte_legende.getType()); 60 56 genereCadre(); … … 65 61 valeur = texte_legende; 66 62 tab_unique = getTabCouleurUnique(colortab); 67 nbr_case = tab_unique.size(); 63 // nbr_case = tab_unique.size(); 64 nbr_case = (valeur.size()==1?2:valeur.size()); 68 65 longueur = 15; 69 66 //hauteur = haut_image/nbr_case; 70 67 hauteur = 20; 71 haut_image = hauteur*nbr_case+3 + 15;68 haut_image = hauteur*nbr_case+30; 72 69 //larg_image = calculer le nombre de chiffre 73 70 buff_image = new BufferedImage(larg_image, haut_image, BufferedImage.TYPE_INT_ARGB); … … 84 81 private void genereInfoSup(String info) { 85 82 image.setColor(new Color (0,0,0)); 86 image.drawString(info, 1 , haut_image- 1);87 LoggerPerso.log(GenerateurLegendeImg.class, LoggerPerso.DEBUG, info);83 image.drawString(info, 1 , haut_image-3); 84 // LoggerPerso.log(GenerateurLegendeImg.class, LoggerPerso.DEBUG, info); 88 85 } 89 86 90 87 private void genereCadre() { 91 88 image.setColor(new Color(0, 0, 0)); 92 image.drawRect(0, 0, longueur + 1, hauteur*nbr_case+1);89 image.drawRect(0, 10, longueur + 1, hauteur*nbr_case+1); 93 90 } 94 91 95 private void genereCarre( ) {92 private void genereCarre(int type_legend) { 96 93 for (int i=0; i<nbr_case; i++) { 97 image.setColor(tab_unique.get(nbr_case - 1 - i)); 98 image.fillRect(1, i*hauteur + 1, longueur, hauteur); 94 if (type_legend == Legende.TYPE_VALUE) { 95 image.setColor(tab_unique.get(nbr_case - 1 - i)); 96 } else { 97 image.setColor(tab_unique.get(i)); 98 } 99 image.fillRect(1, i*hauteur + 11, longueur, hauteur); 99 100 } 100 101 } … … 105 106 if (nbr_case > valeur.size()+1) 106 107 return; 107 108 108 if (type_legend == Legende.TYPE_VALUE) 109 for (int i=0; i< nbr_case -1; i++) {110 image.drawString(valeur.get(i), longueur + 6, hauteur*(nbr_case - i - 1)+ 6);109 for (int i=0; i<valeur.size(); i++) { 110 image.drawString(valeur.get(i), longueur + 6, hauteur*(nbr_case - i - 1)+16); 111 111 } 112 else 112 else { 113 113 for (int i=1; i<=valeur.size(); i++) { 114 image.drawString(valeur.get(i-1), longueur + 6, hauteur*(nbr_case - i + 1) - (hauteur/2) + 6); 114 // image.drawString(valeur.get(i-1), longueur + 6, hauteur*(nbr_case - i + 1) - (hauteur/2) + 16); 115 image.drawString(valeur.get(valeur.size()-i), longueur + 6, hauteur*(nbr_case - i + 1) - (hauteur/2) + 16); 115 116 } 117 } 116 118 } 117 119 -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/generationRaster/GenerateurRasterImg.java
r68 r70 10 10 11 11 import org.medias.eccad.helpers.Donnees; 12 import org.medias.eccad.helpers.LoggerPerso;13 12 import org.medias.eccad.metier.generationRaster.colorMap.ColorMapping; 14 13 import org.medias.eccad.metier.generationRaster.colorMap.ColorMappingJaune; … … 34 33 e.printStackTrace(); 35 34 } 36 LoggerPerso.log(GenerateurRasterImg.class, LoggerPerso.DEBUG, "fin write");35 // LoggerPerso.log(GenerateurRasterImg.class, LoggerPerso.DEBUG, "fin write"); 37 36 } 38 37 … … 58 57 59 58 private void dessineCadre(Zone zone) { 60 LoggerPerso.log(GenerateurRasterImg.class, LoggerPerso.DEBUG, "generation cadre");61 LoggerPerso.log(GenerateurRasterImg.class, LoggerPerso.DEBUG, "zone :: " + zone);59 // LoggerPerso.log(GenerateurRasterImg.class, LoggerPerso.DEBUG, "generation cadre"); 60 // LoggerPerso.log(GenerateurRasterImg.class, LoggerPerso.DEBUG, "zone :: " + zone); 62 61 63 62 Double tmp = zone.getNorthbc(); … … 70 69 int droite = (tmp.intValue() + 180)*2 + 3; 71 70 72 LoggerPerso.log(GenerateurRasterImg.class, LoggerPerso.DEBUG, "coord : " + haut + ":" + bas + ":" + droite + ":" + gauche);71 // LoggerPerso.log(GenerateurRasterImg.class, LoggerPerso.DEBUG, "coord : " + haut + ":" + bas + ":" + droite + ":" + gauche); 73 72 74 73 … … 85 84 image.drawRect(gauche+1, haut+1, droite-gauche-2, bas-haut-2); 86 85 87 LoggerPerso.log(GenerateurRasterImg.class, LoggerPerso.DEBUG, "fin cadre");86 // LoggerPerso.log(GenerateurRasterImg.class, LoggerPerso.DEBUG, "fin cadre"); 88 87 } 89 88 -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/generationRaster/InformationLegend.java
r68 r70 7 7 import org.medias.eccad.helpers.LoggerPerso; 8 8 import org.medias.eccad.helpers.SpringBeanFactory; 9 import org.medias.eccad.metier.generationRaster.colorMap.ColorMapping;10 import org.medias.eccad.metier.statistique.ServiceStatistique;11 9 import org.medias.eccad.modele.ColorTab; 12 10 import org.medias.eccad.modele.Legende; 13 11 import org.medias.eccad.persistance.dao.CodeDAO; 14 import org.medias.eccad.persistance.dao.ColorTabDAO;15 12 import org.medias.eccad.persistance.dao.GrilleDAO; 16 13 import org.medias.eccad.persistance.dao.ParametreDAO; … … 25 22 } 26 23 27 public List<String> getLegendValeur(ColorTab colortab ) {24 public List<String> getLegendValeur(ColorTab colortab, String unit) { 28 25 int taille = colortab.getLength(); 29 26 float tableau_valeur[] = colortab.getTab_min(); 30 27 float valeur; 31 32 28 List<String> liste = new LinkedList<String>(); 33 29 … … 36 32 valeur = tableau_valeur[i]; 37 33 liste.add(Float.toString(valeur)); 34 } 35 if (unit.equals("%")) { 36 liste.add(Float.toString(colortab.getMax())); 37 } else { 38 liste.add("\u2265 "+Float.toString(colortab.getMax())); 38 39 } 39 40 … … 45 46 * Cette fonction a pour vocation d'obtenir les informations suplémentaires à afficher sous la légende (par exemple les unités) 46 47 * @param id_grille l'identifiant de la grille 48 * @param fonction la fonction permettant de déterminer le mode d'affichage choisi 47 49 * @return la chaine de caractÚre représentant les informations 48 50 */ 49 public String getInfoSup(long id_grille) { 50 String information; 51 information = "Unit : "; 51 public String getInfoSup(long id_grille, String fonction) { 52 String information = ""; 52 53 ParametreDAO paramDAO = (ParametreDAO) xmlbean.getBean("parametreDAO"); 53 54 try { … … 55 56 } catch (PersistanceException e) { 56 57 e.printStackTrace(); 57 information += " none";58 information += "No unit"; 58 59 } 59 60 // Cas particulier: les totaux -> on change l'unité si besoin 61 if (fonction != null && (fonction.equals("totalDay") || fonction.equals("totalMonth") 62 || fonction.equals("totalYear") || fonction.equals("totalPeriod"))) { 63 if (information.equals("pers/km2")) { 64 information = "pers"; 65 } else if (information.equals("kg(X).m-2.s-1")) { 66 if (fonction.equals("totalDay")) { 67 information = "Tg(X)/day"; 68 } else if (fonction.equals("totalMonth")) { 69 information = "Tg(X)/month"; 70 } else if (fonction.equals("totalYear")) { 71 information = "Tg(X)/year"; 72 } else { 73 information = "Tg(X)/period"; 74 } 75 } 76 } 60 77 return information; 61 78 } … … 67 84 * @return 68 85 */ 69 public Legende getLegendText(long id_grille, ColorTab colortab ) {86 public Legende getLegendText(long id_grille, ColorTab colortab, String unit) { 70 87 GrilleDAO grille = (GrilleDAO) xmlbean.getBean("grilleDAO"); 71 88 CodeDAO codedao = (CodeDAO) xmlbean.getBean("codeDAO"); … … 75 92 try { 76 93 codif = grille.getCodification(id_grille); 94 // LoggerPerso.log(ServiceRaster.class, LoggerPerso.WARN, "type codification :" + codif); 77 95 } 78 96 catch (PersistanceException perse) { 79 97 LoggerPerso.log(ServiceRaster.class, LoggerPerso.WARN, "erreur récupération codif grille " + id_grille, perse); 80 return new Legende(getLegendValeur(colortab ), Legende.TYPE_VALUE);98 return new Legende(getLegendValeur(colortab,unit), Legende.TYPE_VALUE); 81 99 } 82 100 … … 84 102 if (codif.equals("coded")) { 85 103 legende = new Legende(codedao.getListCodeByGrille(id_grille), Legende.TYPE_CODED); 86 } 87 else { 88 legende = new Legende(getLegendValeur(colortab), Legende.TYPE_VALUE); 104 } else { 105 legende = new Legende(getLegendValeur(colortab,unit), Legende.TYPE_VALUE); 89 106 } 90 107 } 91 108 catch (PersistanceException perse) { 92 109 LoggerPerso.log(ServiceRaster.class, LoggerPerso.WARN, "erreur récupération liste des légendes de la grille " + id_grille, perse); 93 return legende = new Legende(getLegendValeur(colortab ), Legende.TYPE_VALUE);110 return legende = new Legende(getLegendValeur(colortab,unit), Legende.TYPE_VALUE); 94 111 } 95 112 … … 102 119 int taille = colortab.getLength(); 103 120 float tableau_valeur[] = colortab.getTab_min(); 104 121 105 122 // on prend n-1 valeur ^^ 106 123 for (int i=1; i<taille; i++) { 107 valeur = tableau_valeur[i]; 108 valeur = (valeur *(max-min))+min; 124 valeur = (tableau_valeur[i] *(max-min))+min; 109 125 liste.add(fixeDecimal(Float.toString(valeur))); 110 126 } 127 valeur = (colortab.getMax() *(max-min))+min; 128 liste.add(fixeDecimal(Float.toString(valeur))); 111 129 return new Legende(liste , Legende.TYPE_VALUE); 112 130 } … … 115 133 116 134 private String fixeDecimal(String entree) { 117 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "-------------Legende------------------------******------>entree "+entree);135 // LoggerPerso.log(this.getClass(), LoggerPerso.DEBUG, "-------------Legende------------------------******------>entree "+entree); 118 136 if (entree == null) 119 137 return "nc"; 120 138 int index = entree.lastIndexOf("."); 121 139 int indexE = entree.lastIndexOf("E"); 122 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "entree --lll-->2 "+indexE+" "+index+" "+entree.length());123 if ( indexE == -1 && index != -1 && entree.length() >= index + 5) 140 // LoggerPerso.log(this.getClass(), LoggerPerso.DEBUG, "entree --lll-->2 "+indexE+" "+index+" "+entree.length()); 141 if ( indexE == -1 && index != -1 && entree.length() >= index + 5) { 124 142 entree = entree.substring(0, entree.lastIndexOf(".")+5); 125 if ( indexE != -1 && index != -1 && entree.length() >= index + 5) 143 } 144 else if ( indexE != -1 && index != -1 && entree.length() >= index + 5) 126 145 { 127 146 String aEntree = entree; 128 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "aEntree "+aEntree.lastIndexOf("E")+" "+aEntree.length()+" "+aEntree.lastIndexOf("E")+" "+aEntree.length());147 // LoggerPerso.log(this.getClass(), LoggerPerso.DEBUG, "aEntree "+aEntree.lastIndexOf("E")+" "+aEntree.length()+" "+aEntree.lastIndexOf("E")+" "+aEntree.length()); 129 148 aEntree=aEntree.substring(aEntree.lastIndexOf("E"), aEntree.lastIndexOf("E")+aEntree.length()-aEntree.lastIndexOf("E")); 130 entree = entree.substring(0, entree.lastIndexOf(".")+5)+aEntree; 149 //entree = entree.substring(0, entree.lastIndexOf(".")+5)+aEntree; 150 entree = entree.substring(0, 3)+aEntree; 131 151 } 132 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "entree "+entree);152 // LoggerPerso.log(this.getClass(), LoggerPerso.DEBUG, "entree "+entree); 133 153 return entree; 134 154 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/generationRaster/IntServiceRaster.java
r68 r70 5 5 6 6 public interface IntServiceRaster { 7 public StatReponse genereRaster(long id_grille, long id_colormap, Zone zone);8 public String genereLegend(long id_grille, long id_colormap, String fichier);7 public StatReponse genereRaster(long id_grille, long id_colormap, long id_classdis, Zone zone, String nomProd, long id_sector, long id_mask); 8 public String genereLegend(long id_grille, long id_colormap, long id_classdis, String fichier); 9 9 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/generationRaster/ServiceRaster.java
r68 r70 18 18 import org.medias.eccad.persistance.dao.GrilleDAO; 19 19 import org.medias.eccad.persistance.exception.PersistanceException; 20 import org.medias.eccad.presentation.traducteur.TraducteurCarte;21 20 import org.springframework.beans.factory.xml.XmlBeanFactory; 22 21 … … 34 33 */ 35 34 public ServiceRaster() { 36 LoggerPerso.log(ServiceRaster.class, LoggerPerso.DEBUG, "création du service");35 // LoggerPerso.log(ServiceRaster.class, LoggerPerso.DEBUG, "création du service"); 37 36 xmlbean = SpringBeanFactory.getXmlFactory(); 38 37 gen_worldfile = (GenerateurWorldFile) xmlbean.getBean("worldfile"); … … 46 45 * Permet la création de l'image représentant la légende 47 46 */ 48 public String genereLegend(long id_grille, long id_colormap, String fichier) {49 colormap = getColorMap(id_colormap );47 public String genereLegend(long id_grille, long id_colormap, long id_classdis, String fichier) { 48 colormap = getColorMap(id_colormap,id_classdis); 50 49 InformationLegend info_legend = new InformationLegend(); 51 52 gen_legend.genereLegendVertical(colormap, info_legend.getLegendText(id_grille, colormap.getColorTable() ), info_legend.getInfoSup(id_grille));50 String infoSup = info_legend.getInfoSup(id_grille,null); 51 gen_legend.genereLegendVertical(colormap, info_legend.getLegendText(id_grille, colormap.getColorTable(), infoSup), infoSup); 53 52 gen_legend.enregistreLegend(fichier+".legend.png"); 54 53 return fichier+".legend.png"; … … 57 56 58 57 /** 59 * Demande au CGI eccad de générer un raster pour la grille passée en paramà ªtre.58 * Demande au CGI eccad de générer un raster pour la grille passée en paramÚtre. 60 59 */ 61 public StatReponse genereRaster(long id_grille, long id_colormap, Zone zone) { 62 LoggerPerso.log(ServiceRaster.class, LoggerPerso.DEBUG,"------------------------- **********************************++++++++++++++++++++++ "); 60 public StatReponse genereRaster(long id_grille, long id_colormap, long id_classdis, Zone zone, String nomProd, long id_sector, long id_mask) { 63 61 float centerValue = 0, centerLat = 0, centerLon = 0; 64 62 String requete = ""; … … 66 64 Grille grille = null; 67 65 68 try {grille = grilleDAO.getGrille(id_grille);}catch (PersistanceException e) {LoggerPerso.log(ServiceRaster.class, LoggerPerso.ERROR, "ERROR generateRaster " + e.getM_message(), e);} 66 try { 67 grille = grilleDAO.getGrille(id_grille); 68 }catch (PersistanceException e) { 69 LoggerPerso.log(ServiceRaster.class, LoggerPerso.ERROR, "ERROR generateRaster " + e.getM_message(), e); 70 } 69 71 70 72 GrapheCGI rasterdao = new GrapheCGI(); 71 73 Map<String, String> critere = new HashMap<String, String>(); 72 if (zone != null) 73 { 74 if (zone != null) { 74 75 //*************************// 75 76 76 String northbcN = zone.getNorthbcN().replace(",","."); 77 77 String southbcN = zone.getSouthbcN().replace(",","."); 78 78 String eastbcN = zone.getEastbcN().replace(",","."); 79 79 String westbcN = zone.getWestbcN().replace(",","."); 80 81 LoggerPerso.log(ServiceRaster.class, LoggerPerso.DEBUG,"------------------------- "+ northbcN);82 83 80 critere.put("lat-max", northbcN); 84 81 critere.put("lat-min", southbcN); 85 82 critere.put("lon-max", eastbcN); 86 83 critere.put("lon-min", westbcN); 87 88 critere.put("beg-date", grille.getDate().toString());89 critere.put("end-date", grille.getDate().toString());90 TraducteurStat traducteur = new TraducteurStat();91 requete = traducteur.encodeCritere(critere, grille.getId_param(), grille.getId_produit(), id_colormap, "getGridRaster", id_grille);92 StatReponse reponse = traducteur.getReponse(rasterdao.getStatistique(requete));93 centerValue = reponse.getCenter();94 centerLat = reponse.getCenterLat();95 centerLon = reponse.getCenterLon();96 84 } 97 98 LoggerPerso.log(ServiceRaster.class, LoggerPerso.DEBUG,"------------------------- **********************************++++++++++++++++++++++ "); 99 100 critere.put("lat-max", "90"); 101 critere.put("lat-min", "-90"); 102 critere.put("lon-max", "180"); 103 critere.put("lon-min", "-180"); 104 85 else { 86 critere.put("lat-max", "90"); 87 critere.put("lat-min", "-90"); 88 critere.put("lon-max", "180"); 89 critere.put("lon-min", "-180"); 90 } 105 91 critere.put("beg-date", grille.getDate().toString()); 106 92 critere.put("end-date", grille.getDate().toString()); 107 93 TraducteurStat traducteur = new TraducteurStat(); 108 requete = traducteur.encodeCritere(critere, grille.getId_param(), grille.getId_produit(), id_colormap, "getGridRaster", id_grille); 94 // Pour le produit IPCC, si le secteur est 0, cela signifie qu'on souhaite afficher la carte résultante de la somme des grilles associés à tous les secteurs 95 // Sinon, on affiche une seule grille sur la carte 96 if (nomProd.equals("IPCC") && id_sector==0) { 97 requete = traducteur.encodeCritere(critere, grille.getId_param(), grille.getId_produit(), id_colormap, id_classdis, 0, grille.getId_rcp(), "0", "getGridsRaster", id_grille, id_mask); 98 } else { 99 requete = traducteur.encodeCritere(critere, grille.getId_param(), grille.getId_produit(), id_colormap, id_classdis, grille.getId_secteur(), grille.getId_rcp(), grille.getLegend(), "getGridRaster", id_grille, id_mask); 100 } 109 101 StatReponse reponse = traducteur.getReponse(rasterdao.getStatistique(requete)); 110 if (zone != null) 111 { 102 if (zone != null) { 103 centerValue = (reponse.getCenter()==null?0:reponse.getCenter().floatValue()); 104 centerLat = (reponse.getCenterLat()==null?0:reponse.getCenterLat().floatValue()); 105 centerLon = (reponse.getCenterLon()==null?0:reponse.getCenterLon().floatValue()); 112 106 reponse.setCenter(centerValue); 113 107 reponse.setCenterLat(centerLat); … … 125 119 * @return la table de couleur par défaut 126 120 */ 127 private ColorMapping getColorMap(long colormapid ) {121 private ColorMapping getColorMap(long colormapid, long classdisid) { 128 122 ColorTabDAO colorDAO = (ColorTabDAO) xmlbean.getBean("colorTabDAO"); 129 123 … … 131 125 132 126 try { 133 colortab = colorDAO.getColorMapByID(colormapid );127 colortab = colorDAO.getColorMapByID(colormapid,classdisid); 134 128 } catch (PersistanceException e) { 135 129 e.printStackTrace(); … … 160 154 } 161 155 162 163 156 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/generationRaster/colorMap/ColorMappingLineaire.java
r68 r70 2 2 3 3 import java.awt.Color; 4 5 import org.medias.eccad.modele.ColorTab;6 4 7 5 public class ColorMappingLineaire extends ColorMapping { -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/generationRaster/test/TestServiceRaster.java
r68 r70 15 15 public void testGenereRaster() { 16 16 ServiceRaster serv_raster = new ServiceRaster(); 17 System.out.println(serv_raster.genereRaster(5100, 25, null));17 System.out.println(serv_raster.genereRaster(5100, 25, 25, null,null,0,0)); 18 18 19 19 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/statistique/GrapheCGI.java
r68 r70 8 8 import org.apache.xmlrpc.client.XmlRpcClientConfigImpl; 9 9 import org.apache.xmlrpc.client.XmlRpcCommonsTransportFactory; 10 import org.medias.eccad.helpers.LoggerPerso;11 10 import org.medias.eccad.helpers.SpringBeanFactory; 12 import org.medias.eccad.metier.extracteur.Extract;13 11 import org.medias.eccad.metier.extracteur.ExtracteurConfig; 14 12 15 13 public class GrapheCGI { 16 14 public String getStatistique(String requete) { 17 XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); 15 XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); 16 17 ExtracteurConfig configuration = (ExtracteurConfig) SpringBeanFactory.getXmlFactory().getBean("extracteur"); 18 String urlCgi = configuration.getUrl(); 19 //String xmlSchema = configuration.getSchema(); 20 // LoggerPerso.log(GrapheCGI.class, LoggerPerso.DEBUG, "urlcgi="+urlCgi); 21 URL url; 22 try { 23 url = new URL(urlCgi); 24 } catch (MalformedURLException e) { 25 e.printStackTrace(); 26 return "MalformedURLException erreur"; 27 } 28 config.setServerURL(url); 29 XmlRpcClient client = new XmlRpcClient(); 30 client.setTransportFactory(new XmlRpcCommonsTransportFactory(client)); 31 client.setConfig(config); 18 32 19 20 ExtracteurConfig configuration = (ExtracteurConfig) SpringBeanFactory.getXmlFactory().getBean("extracteur"); 21 String urlCgi = configuration.getUrl(); 22 //String xmlSchema = configuration.getSchema(); 23 LoggerPerso.log(GrapheCGI.class, LoggerPerso.DEBUG, urlCgi); 24 //URL url = new URL("http://zeus/cgi-bin/eccad_extract.cgi"); 25 URL url; 26 try { 27 url = new URL(urlCgi); 28 } catch (MalformedURLException e) { 29 e.printStackTrace(); 30 return "MalformedURLException erreur"; 31 } 32 config.setServerURL(url); 33 //String xmlSchema = "./Schema_ECCAD1.xsd"; 34 XmlRpcClient client = new XmlRpcClient(); 35 client.setTransportFactory(new XmlRpcCommonsTransportFactory(client)); 36 client.setConfig(config); 37 //String requete = "<requete> <parametre>1</parametre> <produit>1</produit> <colormap>-1</colormap> <connexion> <host>zeus</host> <dbname>ECCAD2</dbname> <user>wwwadm</user> </connexion> <domaine> <lat-max>20</lat-max> <lat-min>20</lat-min> <lon-max>20</lon-max> <lon-min>20</lon-min> </domaine> <temporel> <begin>2002-11-01</begin> <end>2003-10-31</end> </temporel> <fonction> <nom>getGraphique</nom> </fonction> </requete>"; 38 39 String mode = "visu"; 40 Object[] params = new Object[]{requete, mode}; 41 LoggerPerso.log(Extract.class, LoggerPerso.DEBUG, "visu :: \n" + requete); 42 String rslt; 43 try { 44 rslt = (String) client.execute("extract", params); 45 } catch (XmlRpcException e) { 46 e.printStackTrace(); 47 return "XmlRpcException erreur"; 48 } 49 return rslt; 33 String mode = "visu"; 34 Object[] params = new Object[]{requete, mode}; 35 String rslt; 36 try { 37 rslt = (String) client.execute("extract", params); 38 } catch (XmlRpcException e) { 39 e.printStackTrace(); 40 return "XmlRpcException erreur"; 41 } 42 return rslt; 50 43 } 51 44 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/statistique/ServiceGraphe.java
r68 r70 7 7 import java.io.IOException; 8 8 import java.io.OutputStream; 9 import java.text.DecimalFormat; 10 import java.text.NumberFormat; 11 import java.text.ParseException; 9 12 import java.text.SimpleDateFormat; 13 import java.util.ArrayList; 14 import java.util.Date; 10 15 import java.util.List; 11 12 13 16 14 17 import org.jfree.chart.ChartFactory; … … 16 19 import org.jfree.chart.JFreeChart; 17 20 import org.jfree.chart.axis.DateAxis; 21 import org.jfree.chart.axis.NumberAxis; 22 import org.jfree.chart.axis.NumberTickUnit; 18 23 import org.jfree.chart.plot.XYPlot; 19 24 import org.jfree.chart.renderer.xy.XYErrorRenderer; 20 import org.jfree.data.time. Day;25 import org.jfree.data.time.FixedMillisecond; 21 26 import org.jfree.data.time.TimeSeries; 22 27 import org.jfree.data.time.TimeSeriesCollection; … … 28 33 public class ServiceGraphe { 29 34 30 public String genereGraphe(String identifiant, List<Valeur> liste_valeur ) {35 public String genereGraphe(String identifiant, List<Valeur> liste_valeur, String param, String produit, String unite, String secteur, String rcp, String alt) { 31 36 File fichier = new File(Donnees.getHome() + "/images/graphes_temporaires/" + identifiant +"_graphe.png"); 32 37 OutputStream out = null; … … 34 39 try { 35 40 out = new FileOutputStream(fichier); 36 getGraphe(out, liste_valeur );41 getGraphe(out, liste_valeur, param, produit, unite, secteur, rcp, alt); 37 42 } catch (FileNotFoundException e) { 38 LoggerPerso.log(ServiceGraphe.class, LoggerPerso. DEBUG, "erreur d'écriture du graphe", e);43 LoggerPerso.log(ServiceGraphe.class, LoggerPerso.ERROR, "erreur d'écriture du graphe", e); 39 44 return "/"; 40 45 } catch (IOException e) { 41 LoggerPerso.log(ServiceGraphe.class, LoggerPerso. DEBUG, "erreur d'écriture du graphe", e);46 LoggerPerso.log(ServiceGraphe.class, LoggerPerso.ERROR, "erreur d'écriture du graphe", e); 42 47 return "/"; 43 48 } … … 46 51 } 47 52 48 public void getGraphe(OutputStream out, List<Valeur> liste_valeur )53 public void getGraphe(OutputStream out, List<Valeur> liste_valeur, String param, String produit, String unite, String secteur, String rcp, String alt) 49 54 throws IOException { 50 55 51 // CategoryDataset dataset = new DefaultCategoryDataset(); 52 TimeSeries time = new TimeSeries("", Day.class); 56 // CategoryDataset dataset = new DefaultCategoryDataset(); 57 TimeSeries time = new TimeSeries(""); 58 double min = Double.MAX_VALUE, max = -1; 59 DecimalFormat df = new DecimalFormat("0.##E0"); 60 try { 61 Date dateVal; 62 String datePrec = ""; 63 ArrayList<Double> vals = new ArrayList<Double>(); 64 int nbGrilles = -1; 65 double val; 66 for (Valeur valeur : liste_valeur) { 67 val = Double.parseDouble(valeur.getValeur()); 68 if (!valeur.getNom().equals(datePrec)) { 69 nbGrilles++; 70 vals.add(Double.valueOf(val)); 71 // val = Double.parseDouble(valeur.getValeur()); 72 } else { 73 vals.set(nbGrilles, Double.valueOf(vals.get(nbGrilles).doubleValue()+val)); 74 // val += Double.parseDouble(valeur.getValeur()); 75 } 76 // LoggerPerso.log(ServiceGraphe.class, LoggerPerso.DEBUG, "valeur graphe="+valeur.getValeur()+", nom="+valeur.getNom()+", val="+val+", format="+df.format(val)); 77 dateVal = (new SimpleDateFormat("yyyyMMdd")).parse(valeur.getNom()); 78 time.addOrUpdate(new FixedMillisecond(dateVal),vals.get(nbGrilles).doubleValue()); 79 datePrec = valeur.getNom(); 80 // time.add(new Day(Integer.parseInt(valeur.getNom().substring(6, 8)), 81 // Integer.parseInt(valeur.getNom().substring(4, 6)), 82 // Integer.parseInt(valeur.getNom().substring(0, 4))), 83 // Double.parseDouble(valeur.getValeur())); 84 } 85 for (int num = 0; num < vals.size(); num++) { 86 val = vals.get(num).doubleValue(); 87 if (min > val) min = val; 88 if (max < val) max = val; 89 } 90 } catch (ParseException e) { 91 e.printStackTrace(); 92 } 53 93 54 for (Valeur valeur : liste_valeur) { 55 56 LoggerPerso.log(ServiceGraphe.class, LoggerPerso.DEBUG, "______________________________________________valeur graphe string "+valeur.getValeur()+" double "+ Double.parseDouble(valeur.getValeur())); 57 58 59 time.add(new Day(Integer.parseInt(valeur.getNom().substring(6, 8)), 60 Integer.parseInt(valeur.getNom().substring(4, 6)), 61 Integer.parseInt(valeur.getNom().substring(0, 4))), 62 Double.parseDouble(valeur.getValeur())); 63 } 64 65 /*time.add(new Day(1, 1, 2000), 10); 66 time.add(new Day(2, 1, 2000), 10); 67 time.add(new Day(3, 1, 2000), 10); 68 time.add(new Day(4, 1, 2000), 10); 69 time.add(new Day(5, 1, 2000), 10); 70 time.add(new Day(10, 1, 2000), 100); 71 time.add(new Day(11, 1, 2000), 100); 72 time.add(new Day(12, 1, 2000), 100); 73 time.add(new Day(13, 1, 2000), 100); 74 time.add(new Day(14, 1, 2000), 100); 75 time.add(new Day(15, 1, 2000), 100);*/ 76 77 78 XYDataset dataset = new TimeSeriesCollection(time); 79 //dataset.setDomainIsPointsInTime(true); 80 JFreeChart barChart = ChartFactory.createTimeSeriesChart("", "", 81 "", dataset, false, true, false); 82 XYPlot plot = barChart.getXYPlot(); 83 DateAxis axis = (DateAxis) plot.getDomainAxis(); 84 axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd")); 85 plot.setRenderer(new XYErrorRenderer()); 86 plot.getRenderer().setSeriesPaint(0, Color.blue); 87 88 /*plot.setRenderer(new XYBarRenderer()); 89 svgTest(barChart, "XYBarRenderer"); 90 plot.setRenderer(new XYStepRenderer()); 91 svgTest(barChart, "XYStepRenderer"); 92 plot.setRenderer(new ClusteredXYBarRenderer()); 93 svgTest(barChart, "ClusteredXYBarRenderer"); 94 plot.setRenderer(new CyclicXYItemRenderer()); 95 svgTest(barChart, "CyclicXYItemRenderer"); 96 plot.setRenderer(new DefaultXYItemRenderer()); 97 svgTest(barChart, "DefaultXYItemRenderer"); 98 plot.setRenderer(new DeviationRenderer()); 99 svgTest(barChart, "DeviationRenderer"); 100 plot.setRenderer(new HighLowRenderer()); 101 svgTest(barChart, "HighLowRenderer"); 102 plot.setRenderer(new StandardXYItemRenderer()); 103 svgTest(barChart, "StandardXYItemRenderer"); 104 plot.setRenderer(new VectorRenderer()); 105 svgTest(barChart, "VectorRenderer"); 106 plot.setRenderer(new XYAreaRenderer()); 107 svgTest(barChart, "XYAreaRenderer"); 108 plot.setRenderer(new XYAreaRenderer2()); 109 svgTest(barChart, "XYAreaRenderer2"); 110 plot.setRenderer(new XYBarRenderer()); 111 svgTest(barChart, "XYBarRenderer"); 112 plot.setRenderer(new XYBlockRenderer()); 113 svgTest(barChart, "XYBlockRenderer"); 114 plot.setRenderer(new XYBubbleRenderer()); 115 svgTest(barChart, "XYBubbleRenderer"); 116 plot.setRenderer(new XYDifferenceRenderer()); 117 svgTest(barChart, "XYDifferenceRenderer"); 118 plot.setRenderer(new XYDotRenderer()); 119 svgTest(barChart, "XYDotRenderer"); 120 plot.setRenderer(new XYErrorRenderer()); 121 svgTest(barChart, "XYErrorRenderer"); 122 plot.setRenderer(new XYLine3DRenderer()); 123 svgTest(barChart, "XYLine3DRenderer"); 124 plot.setRenderer(new XYLineAndShapeRenderer()); 125 svgTest(barChart, "XYLineAndShapeRenderer"); 126 plot.setRenderer(new XYStepAreaRenderer()); 127 svgTest(barChart, "XYStepAreaRenderer"); 128 plot.setRenderer(new XYStepRenderer()); 129 svgTest(barChart, "XYStepRenderer"); 130 plot.setRenderer(new YIntervalRenderer()); 131 svgTest(barChart, "YIntervalRenderer");*/ 132 133 134 ChartUtilities.writeChartAsPNG(out, barChart, 720, 360); 135 136 94 XYDataset dataset = new TimeSeriesCollection(time); 95 //dataset.setDomainIsPointsInTime(true); 96 String titre = param; 97 if (produit.equals("IPCC")) { 98 titre += ", "+secteur; 99 if (!rcp.equals("None")) { 100 titre += ", RCP "+rcp; 101 } 102 } 103 titre += " : "+produit; 104 if (produit.equals("IPCC") && !alt.equals("0")) { 105 if (alt.equals("Sum")) 106 titre += " (Sum altitude)"; 107 else 108 titre += " ("+alt+" km)"; 109 } 110 JFreeChart barChart = ChartFactory.createTimeSeriesChart(titre, "Date", 111 unite, dataset, false, true, false); 112 XYPlot plot = barChart.getXYPlot(); 113 DateAxis axis = (DateAxis) plot.getDomainAxis(); 114 axis.setDateFormatOverride(new SimpleDateFormat("yyyy-MM-dd")); 115 plot.setRenderer(new XYErrorRenderer()); 116 plot.getRenderer().setSeriesPaint(0, Color.blue); 117 // if (!unite.equals("pers/km2") && !unite.equals("%") && !unite.equals("km2") && !unite.equals("number of fires")) { 118 // plot.getRangeAxis().setStandardTickUnits(new StandardTickUnitSource()); 119 // } 120 // plot.getRangeAxis().setUpperBound(max); 121 // plot.getRangeAxis().setLowerBound(min); 122 if (max != -1) { 123 NumberAxis na = (NumberAxis)plot.getRangeAxis(); 124 na.setAutoTickUnitSelection(false); 125 if (max == min && min != 0) { 126 min = 0; 127 } else if (max == min && min == 0) { 128 max = 6; 129 } 130 na.setRangeWithMargins(min-(max-min)/20,max+(max-min)/20); 131 if (!unite.equals("pers/km2") && !unite.equals("%") && !unite.equals("km2") && !unite.equals("number of fires")) { 132 na.setTickUnit(new NumberTickUnit((max-min)/6,df)); 133 } else { 134 na.setTickUnit(new NumberTickUnit((max-min)/6,NumberFormat.getIntegerInstance())); 135 } 136 } 137 // plot.setBackgroundPaint(Color.white); 138 139 // plot.setRenderer(new StandardXYItemRenderer( 140 // StandardXYItemRenderer.LINES + StandardXYItemRenderer.SHAPES)); 141 142 /*plot.setRenderer(new XYBarRenderer()); 143 svgTest(barChart, "XYBarRenderer"); 144 plot.setRenderer(new XYStepRenderer()); 145 svgTest(barChart, "XYStepRenderer"); 146 plot.setRenderer(new ClusteredXYBarRenderer()); 147 svgTest(barChart, "ClusteredXYBarRenderer"); 148 plot.setRenderer(new CyclicXYItemRenderer()); 149 svgTest(barChart, "CyclicXYItemRenderer"); 150 plot.setRenderer(new DefaultXYItemRenderer()); 151 svgTest(barChart, "DefaultXYItemRenderer"); 152 plot.setRenderer(new DeviationRenderer()); 153 svgTest(barChart, "DeviationRenderer"); 154 plot.setRenderer(new HighLowRenderer()); 155 svgTest(barChart, "HighLowRenderer"); 156 plot.setRenderer(new StandardXYItemRenderer()); 157 svgTest(barChart, "StandardXYItemRenderer"); 158 plot.setRenderer(new VectorRenderer()); 159 svgTest(barChart, "VectorRenderer"); 160 plot.setRenderer(new XYAreaRenderer()); 161 svgTest(barChart, "XYAreaRenderer"); 162 plot.setRenderer(new XYAreaRenderer2()); 163 svgTest(barChart, "XYAreaRenderer2"); 164 plot.setRenderer(new XYBarRenderer()); 165 svgTest(barChart, "XYBarRenderer"); 166 plot.setRenderer(new XYBlockRenderer()); 167 svgTest(barChart, "XYBlockRenderer"); 168 plot.setRenderer(new XYBubbleRenderer()); 169 svgTest(barChart, "XYBubbleRenderer"); 170 plot.setRenderer(new XYDifferenceRenderer()); 171 svgTest(barChart, "XYDifferenceRenderer"); 172 plot.setRenderer(new XYDotRenderer()); 173 svgTest(barChart, "XYDotRenderer"); 174 plot.setRenderer(new XYErrorRenderer()); 175 svgTest(barChart, "XYErrorRenderer"); 176 plot.setRenderer(new XYLine3DRenderer()); 177 svgTest(barChart, "XYLine3DRenderer"); 178 plot.setRenderer(new XYLineAndShapeRenderer()); 179 svgTest(barChart, "XYLineAndShapeRenderer"); 180 plot.setRenderer(new XYStepAreaRenderer()); 181 svgTest(barChart, "XYStepAreaRenderer"); 182 plot.setRenderer(new XYStepRenderer()); 183 svgTest(barChart, "XYStepRenderer"); 184 plot.setRenderer(new YIntervalRenderer()); 185 svgTest(barChart, "YIntervalRenderer");*/ 186 187 ChartUtilities.writeChartAsPNG(out, barChart, 720, 360); 137 188 } 138 189 -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/statistique/ServiceStatistique.java
r68 r70 5 5 import java.util.Map; 6 6 7 8 import org.medias.eccad.helpers.LoggerPerso;9 7 import org.medias.eccad.helpers.SpringBeanFactory; 10 import org.medias.eccad.helpers.XmlHelper;11 8 import org.medias.eccad.metier.generationRaster.GenerateurLegendRaster; 12 9 import org.medias.eccad.metier.generationRaster.GenerateurLegendeImg; 13 import org.medias.eccad.metier.generationRaster.GenerateurWorldFile;14 10 import org.medias.eccad.metier.generationRaster.InformationLegend; 15 11 import org.medias.eccad.metier.generationRaster.colorMap.ColorMapping; … … 20 16 import org.medias.eccad.modele.StatReponse; 21 17 import org.medias.eccad.modele.Valeur; 22 import org.medias.eccad.modele.Zone;23 18 import org.medias.eccad.persistance.dao.ColorTabDAO; 24 19 import org.medias.eccad.persistance.exception.PersistanceException; … … 35 30 } 36 31 37 public StatReponse getCarteStat(Map<String, String> criteres, long id_param, long id_produit, long id_colormap, String fonction, String id_unique) {38 String xml = traducteur.encodeCritere(criteres, id_param, id_produit, id_colormap, fonction);39 32 public StatReponse getCarteStat(Map<String, String> criteres, long id_param, long id_produit, long id_colormap, long id_classdis, long id_secteur, long id_rcp, String alt, String fonction, long maskId) { 33 String xml = traducteur.encodeCritere(criteres, id_param, id_produit, id_colormap, id_classdis, id_secteur, id_rcp, alt, fonction, maskId); 34 40 35 // TODO: ici modifier pour prendre en compte la librairie de jean-luc 41 36 //RasterDAO rasterdao = new RasterDAO(); 42 37 GrapheCGI rasterdao = new GrapheCGI(); 43 ////system.out.println(xml); 38 44 39 reponse = decodeReponse(rasterdao.getStatistique(xml)); 45 40 if (reponse.getError() != null && !reponse.getError().equals("")) 46 41 return null; 47 42 48 GenerateurWorldFile gen_worldfile = (GenerateurWorldFile) xmlbean.getBean("worldfile");49 gen_worldfile.setPasX(reponse.getCarte().getPasX());50 gen_worldfile.setPasY(reponse.getCarte().getPasY());51 gen_worldfile.setPixelY(reponse.getZone().getNorthbc() - (reponse.getCarte().getPasY()/2));52 gen_worldfile.setPixelX(reponse.getZone().getWestbc() + (reponse.getCarte().getPasY()/2));43 // GenerateurWorldFile gen_worldfile = (GenerateurWorldFile) xmlbean.getBean("worldfile"); 44 // gen_worldfile.setPasX(reponse.getCarte().getPasX()); 45 // gen_worldfile.setPasY(reponse.getCarte().getPasY()); 46 // gen_worldfile.setPixelY(reponse.getZone().getNorthbc() - (reponse.getCarte().getPasY()/2)); 47 // gen_worldfile.setPixelX(reponse.getZone().getWestbc() + (reponse.getCarte().getPasX()/2)); 53 48 54 55 String nom = reponse.getUrlImage(); 56 57 nom = nom.substring(0, nom.length()-4); 58 gen_worldfile.writeWorldFile(nom); 59 60 ////system.out.println(stat.getUrlImage()); 61 //return reponse.getUrlImage(); 49 // String nom = reponse.getUrlImage(); 50 51 // nom = nom.substring(0, nom.length()-4); 52 // gen_worldfile.writeWorldFile(nom); 53 54 //return reponse.getUrlImage(); 62 55 return reponse; 63 56 } 64 57 65 public String getLegend(String fichier, long id_colormap, long id_ grille) {66 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "retour getLegend " + reponse.getMaximal() +" " + reponse.getMinimal());67 ColorMapping colormap = getColorMap(id_colormap );58 public String getLegend(String fichier, long id_colormap, long id_classdis, long id_grille, String fonction) { 59 // LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "retour getLegend " + reponse.getMaximal() + " " + reponse.getMinimal()); 60 ColorMapping colormap = getColorMap(id_colormap,id_classdis); 68 61 InformationLegend info_legend = new InformationLegend(); 69 62 GenerateurLegendRaster gen_legend = new GenerateurLegendeImg(); 70 71 gen_legend.genereLegendVertical(colormap, info_legend.getLegendDynamic(colormap.getColorTable(), reponse.getMaximal(), reponse.getMinimal()), info_legend.getInfoSup(id_grille ));63 64 gen_legend.genereLegendVertical(colormap, info_legend.getLegendDynamic(colormap.getColorTable(), reponse.getMaximal(), reponse.getMinimal()), info_legend.getInfoSup(id_grille,fonction)); 72 65 gen_legend.enregistreLegend(fichier+".legend.png"); 73 66 74 67 return fichier+".legend.png"; 75 68 } 76 77 public ResultatStat getStatistique(Map<String, String> criteres, long id_param, long id_produit, String fonction) {69 70 public ResultatStat getStatistique(Map<String, String> criteres, long id_param, long id_produit, long id_secteur, long id_rcp, String alt, String type, String fonction) { 78 71 //RasterDAO rasterdao = new RasterDAO(); 79 72 GrapheCGI rasterdao = new GrapheCGI(); 80 String xml = traducteur.encodeCritere(criteres, id_param, id_produit, new Long(-1), fonction); 81 //system.out.println(xml); 82 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, ""); 73 String xml = traducteur.encodeCritere(criteres, id_param, id_produit, -1, -1, id_secteur, id_rcp, alt, fonction, 0); 83 74 reponse = decodeReponse(rasterdao.getStatistique(xml)); 84 75 if (reponse == null) 85 return new ResultatStat("0", "0", "0", "0", "0" );76 return new ResultatStat("0", "0", "0", "0", "0",type); 86 77 Map<String, String> map = reponse.getStatistique(); 87 return new ResultatStat(map.get("min"), map.get("max"), map.get("moyenne"), map.get("ecartType"), map.get("somme") );78 return new ResultatStat(map.get("min"), map.get("max"), map.get("moyenne"), map.get("ecartType"), map.get("somme"),type); 88 79 } 89 90 public String getGraphe(String identifiant, Map<String, String> criteres, long id_param, long id_produit, String fonction) {80 81 public String getGraphe(String identifiant, Map<String, String> criteres, long id_param, long id_produit, long id_secteur, long id_rcp, String alt, String param, String produit, String unite, String secteur, String rcp, String fonction) { 91 82 //RasterDAO rasterdao = new RasterDAO(); 92 83 GrapheCGI rasterdao = new GrapheCGI(); 93 String xml = traducteur.encodeCritere(criteres, id_param, id_produit, new Long(-1), fonction);94 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "xml ::\n" + xml);84 String xml = traducteur.encodeCritere(criteres, id_param, id_produit, -1, -1, id_secteur, id_rcp, alt, fonction, 0); 85 // LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "xml ::\n" + xml); 95 86 String str_reponse = rasterdao.getStatistique(xml); 96 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "reception OK");87 // LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "str_reponse ::\n" + str_reponse); 97 88 reponse = decodeReponse(str_reponse); 98 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "decodage OK");99 89 List<Valeur> graphe; 100 90 if (reponse == null) … … 102 92 else 103 93 graphe = reponse.getGraphe(); 104 105 return new ServiceGraphe().genereGraphe(identifiant, graphe );94 95 return new ServiceGraphe().genereGraphe(identifiant, graphe, param, produit, unite, secteur, rcp, alt); 106 96 } 107 108 109 97 110 98 public StatReponse decodeReponse(String reponse_xml) { 111 99 reponse = traducteur.getReponse(reponse_xml); 112 100 113 101 if (reponse.getError() != null && !reponse.getError().equals("")) 114 102 return null; 115 103 return reponse; 116 104 } 117 105 118 106 /** 119 107 * Interroge la base de données pour obtenir la table de couleur de la grille … … 122 110 * @return la table de couleur par défaut 123 111 */ 124 private ColorMapping getColorMap(long colormapid ) {112 private ColorMapping getColorMap(long colormapid, long classdisid) { 125 113 ColorTabDAO colorDAO = (ColorTabDAO) xmlbean.getBean("colorTabDAO"); 126 114 127 115 ColorTab colortab = null; 128 116 129 117 try { 130 colortab = colorDAO.getColorMapByID(colormapid );118 colortab = colorDAO.getColorMapByID(colormapid,classdisid); 131 119 } catch (PersistanceException e) { 132 120 e.printStackTrace(); 133 121 } 134 122 135 123 ColorMapping colormap = new ColorMappingLineaire(); 136 124 colormap.setColorTable(colortab); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/test/TestServiceCarte.java
r68 r70 9 9 private ServiceCarte serv_carte; 10 10 private Zone zone_affiche; 11 private Zone zone_selection;11 // private Zone zone_selection; 12 12 13 13 … … 16 16 serv_carte = new ServiceCarte(); 17 17 zone_affiche = new Zone(45.0, -45.0, 90, -90); 18 zone_selection = new Zone(90.0, -90.0, 180, -180);18 // zone_selection = new Zone(90.0, -90.0, 180, -180); 19 19 } 20 20 21 21 public void testGetCarte() { 22 String nom_image = serv_carte.getCarte( 1, 32, zone_affiche ,"_test_carte_").getUrlImage();22 String nom_image = serv_carte.getCarte( 1, 32, -1, zone_affiche ,"_test_carte_",null,0,false,false,0).getUrlImage(); 23 23 assertEquals("/images/cartes_temporaires/_test_carte__1_32.png", nom_image); 24 24 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/test/TestServiceEmission.java
r68 r70 1 1 package org.medias.eccad.metier.test; 2 2 3 import org.medias.eccad.metier.emission.ServiceEmission;4 3 import org.medias.eccad.modele.RequeteFacteurEmission; 5 4 import org.medias.eccad.modele.Zone; … … 15 14 16 15 public void testGetCarte() { 17 ServiceEmission service = new ServiceEmission();16 // ServiceEmission service = new ServiceEmission(); 18 17 RequeteFacteurEmission requete = new RequeteFacteurEmission(); 19 18 requete.setParamBurnt(new Long(5)); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/test/TestStatistique.java
r68 r70 27 27 28 28 ServiceStatistique service = new ServiceStatistique(); 29 service.getCarteStat(map, 1, 2, 3, "moyenneCarte", "id_unique");30 String retour = "<requete>\n<parametre>1</parametre>\n<produit>2</produit>\n<colormap>3</colormap>\n<connexion>\n<host>zeus</host>\n<dbname>ECCAD2</dbname>\n<user>wwwadm</user>\n</connexion>\n<domaine>\n<lat-max>90.0</lat-max>\n<lat-min>-90.0</lat-min>\n<lon-max>180.0</lon-max>\n<lon-min>-180.0</lon-min>\n</domaine>\n<temporel>\n<begin>1970-01-01</begin>\n<end>1999-12-31</end>\n</temporel>\n<fonction>\n<name>moyenneCarte</name>\n</fonction>\n</requete>\n";29 service.getCarteStat(map, 1, 2, 3, 4, 5, 6, null, "moyenneCarte",0); 30 // String retour = "<requete>\n<parametre>1</parametre>\n<produit>2</produit>\n<colormap>3</colormap>\n<connexion>\n<host>zeus</host>\n<dbname>ECCAD2</dbname>\n<user>wwwadm</user>\n</connexion>\n<domaine>\n<lat-max>90.0</lat-max>\n<lat-min>-90.0</lat-min>\n<lon-max>180.0</lon-max>\n<lon-min>-180.0</lon-min>\n</domaine>\n<temporel>\n<begin>1970-01-01</begin>\n<end>1999-12-31</end>\n</temporel>\n<fonction>\n<name>moyenneCarte</name>\n</fonction>\n</requete>\n"; 31 31 // <requete><parametre>3</parametre><produit>4</produit><colormap>23</colormap><connexion><host>zeus</host><dbname>ECCAD2INT</dbname><user>wwwadm</user></connexion><domaine><lat-max>90.0</lat-max><lat-min>-90.0</lat-min><lon-max>180.0</lon-max><lon-min>-180.0</lon-min></domaine><temporel><begin>2005-01-01</begin><end>2015-01-01</end></temporel><fonction><name>moyenneCarte</name></fonction></requete> 32 32 //assertEquals(retour, service.encodeCritere(map,1, 2, new Long(3), "moyenneCarte")); … … 37 37 RasterDAO rasterdao = new RasterDAO(); 38 38 39 String retour = "<requete>\n<parametre>1</parametre>\n<produit>2</produit>\n<colormap>3</colormap>\n<connexion>\n<host>zeus</host>\n<dbname>ECCAD2</dbname>\n<user>wwwadm</user>\n</connexion>\n<domaine>\n<lat-max>90.0</lat-max>\n<lat-min>-90.0</lat-min>\n<lon-max>180.0</lon-max>\n<lon-min>-180.0</lon-min>\n</domaine>\n<temporel>\n<begin>1970-01-01</begin>\n<end>1999-12-31</end>\n</temporel>\n<fonction>\n<name>moyenneCarte</name>\n</fonction>\n</requete>\n";39 // String retour = "<requete>\n<parametre>1</parametre>\n<produit>2</produit>\n<colormap>3</colormap>\n<connexion>\n<host>zeus</host>\n<dbname>ECCAD2</dbname>\n<user>wwwadm</user>\n</connexion>\n<domaine>\n<lat-max>90.0</lat-max>\n<lat-min>-90.0</lat-min>\n<lon-max>180.0</lon-max>\n<lon-min>-180.0</lon-min>\n</domaine>\n<temporel>\n<begin>1970-01-01</begin>\n<end>1999-12-31</end>\n</temporel>\n<fonction>\n<name>moyenneCarte</name>\n</fonction>\n</requete>\n"; 40 40 //String xml = "<requete><parametre>3</parametre><produit>5</produit><colormap>32</colormap><connexion><host>zeus</host><dbname>ECCAD2</dbname><user>wwwadm</user></connexion><domaine><lat-max>90.0</lat-max><lat-min>-90.0</lat-min><lon-max>180.0</lon-max><lon-min>-180.0</lon-min></domaine><temporel><begin>1900-01-01</begin><end>2015-01-01</end></temporel><fonction><nom>moyenneCarte</nom></fonction></requete>"; 41 41 String xml = "<requete><parametre>3</parametre><produit>18</produit><colormap>32</colormap><connexion><host>zeus</host><dbname>ECCAD2</dbname><user>wwwadm</user></connexion><domaine><lat-max>24</lat-max><lat-min>24</lat-min><lon-max>84</lon-max><lon-min>84</lon-min></domaine><temporel><begin>1900-01-01</begin><end>2015-01-01</end></temporel><fonction><nom>getStatistique</nom></fonction></requete>"; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/test/TimeSeriesDemo.java
r68 r70 51 51 import org.jfree.chart.renderer.xy.StandardXYItemRenderer; 52 52 import org.jfree.chart.renderer.xy.XYItemRenderer; 53 import org.jfree.data.time.Day;54 import org.jfree.data.time.Month;55 import org.jfree.data.time.TimeSeries;56 53 import org.jfree.data.time.TimeSeriesCollection; 57 54 import org.jfree.data.xy.XYDataset; … … 68 65 69 66 /** 67 * 68 */ 69 private static final long serialVersionUID = 1L; 70 71 /** 70 72 * A demonstration application showing how to create a simple time series chart. This 71 73 * example uses monthly data. … … 118 120 XYItemRenderer renderer = plot.getRenderer(); 119 121 if (renderer instanceof StandardXYItemRenderer) { 120 StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer;122 // StandardXYItemRenderer rr = (StandardXYItemRenderer) renderer; 121 123 //rr.setPlotShapes(true); 122 rr.setShapesFilled(true);123 rr.setItemLabelsVisible(true);124 // rr.setShapesFilled(true); 125 // rr.setItemLabelsVisible(true); 124 126 } 125 127 … … 149 151 private XYDataset createDataset() { 150 152 151 TimeSeries s1 = new TimeSeries("L&G European Index Trust", Day.class);152 s1.add(new Day(2, 1, 2001), 181.8);153 s1.add(new Day(3, 1, 2001), 167.3);154 s1.add(new Day(4, 1, 2001), 153.8);155 s1.add(new Day(5, 1, 2001), 167.6);156 s1.add(new Day(6, 1, 2001), 158.8);157 s1.add(new Day(7, 1, 2001), 148.3);158 s1.add(new Day(8, 1, 2001), 153.9);159 s1.add(new Day(9, 1, 2001), 142.7);160 s1.add(new Day(10, 1, 2001), 123.2);161 s1.add(new Day(11, 1, 2001), 131.8);162 s1.add(new Day(12, 1, 2001), 139.6);163 s1.add(new Day(13, 1, 2001), 142.9);164 s1.add(new Day(14, 1, 2001), 138.7);165 s1.add(new Day(15, 1, 2001), 137.3);166 s1.add(new Day(16, 1, 2001), 143.9);167 s1.add(new Day(17, 1, 2001), 139.8);168 s1.add(new Day(18, 1, 2001), 137.0);169 s1.add(new Day(19, 1, 2001), 132.8);153 // TimeSeries s1 = new TimeSeries("L&G European Index Trust", Day.class); 154 // s1.add(new Day(2, 1, 2001), 181.8); 155 // s1.add(new Day(3, 1, 2001), 167.3); 156 // s1.add(new Day(4, 1, 2001), 153.8); 157 // s1.add(new Day(5, 1, 2001), 167.6); 158 // s1.add(new Day(6, 1, 2001), 158.8); 159 // s1.add(new Day(7, 1, 2001), 148.3); 160 // s1.add(new Day(8, 1, 2001), 153.9); 161 // s1.add(new Day(9, 1, 2001), 142.7); 162 // s1.add(new Day(10, 1, 2001), 123.2); 163 // s1.add(new Day(11, 1, 2001), 131.8); 164 // s1.add(new Day(12, 1, 2001), 139.6); 165 // s1.add(new Day(13, 1, 2001), 142.9); 166 // s1.add(new Day(14, 1, 2001), 138.7); 167 // s1.add(new Day(15, 1, 2001), 137.3); 168 // s1.add(new Day(16, 1, 2001), 143.9); 169 // s1.add(new Day(17, 1, 2001), 139.8); 170 // s1.add(new Day(18, 1, 2001), 137.0); 171 // s1.add(new Day(19, 1, 2001), 132.8); 170 172 171 173 172 174 TimeSeriesCollection dataset = new TimeSeriesCollection(); 173 dataset.addSeries(s1);175 // dataset.addSeries(s1); 174 176 175 dataset.setDomainIsPointsInTime(true);177 // dataset.setDomainIsPointsInTime(true); 176 178 177 179 return dataset; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/traducteur/TraducteurStat.java
r68 r70 6 6 import java.util.List; 7 7 import java.util.Map; 8 import java.util.logging.Logger;9 10 8 11 9 import org.dom4j.Document; … … 24 22 public class TraducteurStat { 25 23 XmlBeanFactory xmlbean; 26 24 27 25 public TraducteurStat() { 28 26 xmlbean = SpringBeanFactory.getXmlFactory(); 29 27 } 30 31 public String encodeCritere(Map<String, String> criteres, long id_param, long id_produit, Long id_colormap, String fonction) {32 return encodeCritere(criteres, id_param, id_produit, id_colormap, fonction, null);28 29 public String encodeCritere(Map<String, String> criteres, long id_param, long id_produit, long id_colormap, long id_classdis, long id_secteur, long id_rcp, String alt, String fonction, long id_mask) { 30 return encodeCritere(criteres, id_param, id_produit, id_colormap, id_classdis, id_secteur, id_rcp, alt, fonction, null, id_mask); 33 31 } 34 35 public String encodeCritere(Map<String, String> criteres, long id_param, long id_produit, Long id_colormap, String fonction, Long id_grille) {32 33 public String encodeCritere(Map<String, String> criteres, long id_param, long id_produit, long id_colormap, long id_classdis, long id_secteur, long id_rcp, String alt, String fonction, Long id_grille, long id_mask) { 36 34 String xml = new String(); 37 35 InfoConnectBean infoconnect = (InfoConnectBean) xmlbean.getBean("infoConnect"); 38 36 39 37 xml = "<requete>\n"; 40 38 41 39 xml += XmlHelper.createNode("parametre", id_param); 42 40 xml += XmlHelper.createNode("produit", id_produit); 43 41 xml += XmlHelper.createNode("colormap", id_colormap); 44 42 xml += XmlHelper.createNode("scalevalue", id_classdis); 43 xml += XmlHelper.createNode("secteur", id_secteur); 44 xml += XmlHelper.createNode("rcp", id_rcp); 45 if (alt == null || alt.equals("")) alt = "0"; 46 xml += XmlHelper.createNode("alt", alt); 47 xml += XmlHelper.createNode("mask", id_mask); 48 45 49 xml += "<connexion>\n"; 46 50 xml += XmlHelper.createNode("host", infoconnect.getDb_url()); … … 48 52 xml += XmlHelper.createNode("user", infoconnect.getDb_login()); 49 53 xml += "</connexion>\n"; 50 54 51 55 xml += "<domaine>\n"; 52 56 xml += XmlHelper.createNode("lat-max", getValeur("lat-max", criteres)); … … 55 59 xml += XmlHelper.createNode("lon-min", getValeur("lon-min", criteres)); 56 60 xml += "</domaine>\n"; 57 61 58 62 xml += "<temporel>\n"; 59 63 xml += XmlHelper.createNode("begin", getValeur("beg-date", criteres)); 60 64 xml += XmlHelper.createNode("end", getValeur("end-date", criteres)); 61 65 xml += "</temporel>\n"; 62 66 63 67 xml += "<fonction>\n"; 64 68 xml += XmlHelper.createNode("nom", fonction); … … 72 76 } 73 77 xml += "</fonction>\n"; 74 75 78 76 79 xml += "</requete>\n"; 77 //system.out.println(xml);80 // System.out.println(xml); 78 81 return xml; 79 82 } 80 83 81 84 private String getValeur(String critere, Map<String, String> criteres) { 82 85 String valeur = criteres.get(critere); … … 85 88 return valeur; 86 89 } 87 90 88 91 public StatReponse getReponse(String xml) { 89 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "getXMLtoDocument");90 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "getXMLtoDocument + " + xml + "\n mon xml");91 92 Document doc = null; 92 93 try { 93 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "getXMLtoDocument :: " + xml.getBytes("ISO-8859-1").length); 94 95 doc = XmlHelper.getXMLtoDocument(new ByteArrayInputStream(xml.getBytes("ISO-8859-1")), null); 96 } 97 catch (Exception e) { 94 doc = XmlHelper.getXMLtoDocument(new ByteArrayInputStream(xml.getBytes("ISO-8859-1")), null); 95 } catch (Exception e) { 98 96 LoggerPerso.log(TraducteurStat.class, LoggerPerso.ERROR, "erreur encodage"); 99 97 } 100 101 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "getXMLtoDocument ok :" + xml);98 99 // LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "getXMLtoDocument=\n" + xml); 102 100 String erreur = getError(doc); 103 101 104 102 if (erreur != null) 105 103 return new StatReponse(erreur); 106 107 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "parse zone"); 104 108 105 Zone zone = new Zone(Double.parseDouble(getValue(doc, "//domaine/lat-max")), 109 106 Double.parseDouble(getValue(doc, "//domaine/lat-min")), 110 107 Double.parseDouble(getValue(doc, "//domaine/lon-max")), 111 108 Double.parseDouble(getValue(doc, "//domaine/lon-min"))); 112 113 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "parse zone ok");109 110 // LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "parse zone ok"); 114 111 Temporel tempo = new Temporel(getValue(doc, "//temporel/begin"), getValue(doc, "//temporel/end")); 115 116 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "parse url");112 113 // LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "parse url"); 117 114 String url = getValue(doc, "//image-path"); 118 115 InfoCarte info = null; 119 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "parse info");116 // LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "parse info"); 120 117 if (!getValue(doc, "//pas/pas-lon").equals("") || !getValue(doc, "//pas/pas-lat").equals("")) 121 info = new InfoCarte(Double.parseDouble(getValue(doc, "//pas/pas-lon")), Double.parseDouble(getValue(doc, "//pas/pas-lat"))); 122 123 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "parse variable");118 info = new InfoCarte(Double.parseDouble(getValue(doc, "//pas/pas-lon")), Double.parseDouble(getValue(doc, "//pas/pas-lat"))); 119 120 // LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "parse variable"); 124 121 Map<String, String> map = getMapValue(doc, "//statistique/variable", "nom", "valeur"); 125 126 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "recuperation liste point");127 List<Valeur> graphe 128 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "recuperation liste point ok");122 123 // LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "recuperation liste point"); 124 List<Valeur> graphe = getListValue(doc, "//graphe/point", "x", "y"); 125 // LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "recuperation liste point ok"); 129 126 Float min = getFloatValue(doc, "//extremes/mini"); 130 127 Float max = getFloatValue(doc, "//extremes/maxi"); 131 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "recuperation min max " + min + " : " + max);128 // LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "recuperation min max " + min + " : " + max); 132 129 StatReponse reponse = new StatReponse(zone, tempo, info, url, map, graphe); 133 130 reponse.setMaximal(max); 134 131 reponse.setMinimal(min); 135 132 136 133 Float centerValue = getFloatValue(doc, "//center/center-value"); 137 134 reponse.setCenter(centerValue); 138 135 139 136 Float centerLat = getFloatValue(doc, "//center/center-lat"); 140 137 reponse.setCenterLat(centerLat); 141 138 142 139 Float centerLon = getFloatValue(doc, "//center/center-lon"); 143 140 reponse.setCenterLon(centerLon); 144 141 142 Float globalSum = getFloatValue(doc, "//total"); 143 reponse.setGlobalSum(globalSum); 145 144 return reponse; 146 145 } 147 146 148 147 private String getError(Document doc) { 149 Node noeud = doc.selectSingleNode("//error");148 Node noeud = (doc==null?null:doc.selectSingleNode("//error")); 150 149 if (noeud == null) 151 150 return null; … … 153 152 return noeud.getText(); 154 153 } 155 154 156 155 private Map<String, String> getMapValue(Document doc, String xpath, String nom, String valeur) { 157 List liste_node = doc.selectNodes(xpath);156 List<?> liste_node = doc.selectNodes(xpath); 158 157 Map<String, String> map = new HashMap<String, String>(); 159 158 160 159 for (Object onode : liste_node) { 161 160 map.put(((Node)onode).selectSingleNode("./" + nom).getText(), ((Node)onode).selectSingleNode("./" + valeur).getText()); 162 161 } 163 ////system.out.println(map);164 162 return map; 165 163 } 166 164 167 165 private List<Valeur> getListValue(Document doc, String xpath, String nom, String valeur) { 168 List liste_node = doc.selectNodes(xpath);166 List<?> liste_node = doc.selectNodes(xpath); 169 167 List<Valeur> liste = new LinkedList<Valeur>(); 170 168 171 169 for (Object onode : liste_node) { 172 //LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "node en cours" + onode.toString());170 // LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "nom=" + (((Node)onode).selectSingleNode("./" + nom).getText())+", val="+(((Node)onode).selectSingleNode("./" + valeur).getText())); 173 171 liste.add(new Valeur(((Node)onode).selectSingleNode("./" + nom).getText(), ((Node)onode).selectSingleNode("./" + valeur).getText())); 174 172 } 175 ////system.out.println(liste);176 173 return liste; 177 174 } 178 175 179 176 private String getValue(Document doc, String xpath) { 180 Node noeud = doc.selectSingleNode(xpath);181 177 Node noeud = (doc==null?null:doc.selectSingleNode(xpath)); 178 182 179 if (noeud == null) { 183 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "pas de valeur pour : " + xpath);180 // LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "pas de valeur pour : " + xpath); 184 181 return ""; 185 182 } 186 183 187 184 return noeud.getText(); 188 185 } 189 186 190 187 private Float getFloatValue(Document doc, String xpath) { 191 188 Node noeud = doc.selectSingleNode(xpath); 192 189 193 190 if (noeud == null) { 194 LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "pas de valeur pour : " + xpath);191 // LoggerPerso.log(TraducteurStat.class, LoggerPerso.DEBUG, "pas de valeur pour : " + xpath); 195 192 return new Float(0.0); 196 193 } 197 194 198 195 return Float.parseFloat(noeud.getText()); 199 196 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/traducteur/TraducteurVisu.java
r68 r70 8 8 9 9 public interface TraducteurVisu { 10 public List<SelectItem> getListGrille(List<Grille> liste );10 public List<SelectItem> getListGrille(List<Grille> liste, String delta, String nomProd); 11 11 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/traducteur/TraducteurVisuMultiplan.java
r68 r70 6 6 import javax.faces.model.SelectItem; 7 7 8 9 import org.medias.eccad.helpers.LoggerPerso;10 8 import org.medias.eccad.modele.Grille; 11 9 12 10 public class TraducteurVisuMultiplan implements TraducteurVisu { 13 11 14 public List<SelectItem> getListGrille(List<Grille> liste ) {12 public List<SelectItem> getListGrille(List<Grille> liste, String delta, String nomProd) { 15 13 List<SelectItem> liste_grille = new LinkedList<SelectItem>(); 16 LoggerPerso.log(TraducteurVisu.class, LoggerPerso.DEBUG, "traducteur visu multiplan :: getListGrille " + liste_grille.size());14 // LoggerPerso.log(TraducteurVisu.class, LoggerPerso.DEBUG, "traducteur visu multiplan :: getListGrille " + liste_grille.size()); 17 15 for (Grille grille : liste) { 18 16 if (grille.getLegend() == null) 19 17 grille.setLegend(""); 18 else if (grille.getLegend().equals("Water")) { 19 if (nomProd.indexOf("Country") != -1) 20 grille.setLegend("All countries"); 21 else if (nomProd.indexOf("Region") != -1) 22 grille.setLegend("All regions"); 23 } 20 24 liste_grille.add(new SelectItem(new Long(grille.getId_grille()), grille.getLegend())); 21 25 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/traducteur/TraducteurVisuTemporel.java
r68 r70 6 6 import javax.faces.model.SelectItem; 7 7 8 9 import org.medias.eccad.helpers.LoggerPerso;10 8 import org.medias.eccad.modele.Grille; 11 9 12 10 public class TraducteurVisuTemporel implements TraducteurVisu { 13 11 14 public List<SelectItem> getListGrille(List<Grille> liste ) {12 public List<SelectItem> getListGrille(List<Grille> liste, String delta, String nomProd) { 15 13 List<SelectItem> liste_grille = new LinkedList<SelectItem>(); 16 LoggerPerso.log(TraducteurVisu.class, LoggerPerso.DEBUG, "traducteur visu temporel :: getListGrille");14 // LoggerPerso.log(TraducteurVisu.class, LoggerPerso.DEBUG, "traducteur visu temporel :: getListGrille"); 17 15 for (Grille grille : liste) { 18 liste_grille.add(new SelectItem(new Long(grille.getId_grille()), grille.getDate().toString())); 16 if (delta != null && delta.equals("1 mon")) { 17 liste_grille.add(new SelectItem(new Long(grille.getId_grille()), grille.getDate().toString().substring(0,7))); 18 } else if (delta != null && delta.equals("1 year")) { 19 liste_grille.add(new SelectItem(new Long(grille.getId_grille()), grille.getDate().toString().substring(0,4))); 20 } else { 21 liste_grille.add(new SelectItem(new Long(grille.getId_grille()), grille.getDate().toString())); 22 } 19 23 } 20 24 -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/modele/Grille.java
r68 r70 2 2 3 3 import java.sql.Date; 4 import java.util.Comparator; 4 5 5 6 public class Grille { … … 9 10 private long id_param; 10 11 private long id_produit; 12 private long id_secteur; 13 private long id_rcp; 14 private int number_code; 11 15 12 16 public Grille() { … … 20 24 } 21 25 22 public Grille(long id_grille, Date date, String legend ) {26 public Grille(long id_grille, Date date, String legend, int numberCode) { 23 27 super(); 24 28 this.id_grille = id_grille; 25 29 this.date = date; 26 30 this.legend = legend; 31 this.number_code = numberCode; 27 32 } 28 33 public Date getDate() { … … 65 70 this.id_produit = id_produit; 66 71 } 72 73 public long getId_secteur() { 74 return id_secteur; 75 } 76 77 public void setId_secteur(long idSecteur) { 78 id_secteur = idSecteur; 79 } 80 81 public long getId_rcp() { 82 return id_rcp; 83 } 84 85 public void setId_rcp(long idRcp) { 86 id_rcp = idRcp; 87 } 88 89 public int getNumber_code() { 90 return number_code; 91 } 92 93 public void setNumber_code(int numberCode) { 94 number_code = numberCode; 95 } 96 97 public class ComparatorNumberCode implements Comparator<Grille>{ 98 public int compare(Grille g1, Grille g2){ 99 return new Integer(g1.getNumber_code()).compareTo(new Integer(g2.getNumber_code())); 100 } 101 } 102 67 103 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/modele/Parametre.java
r68 r70 7 7 private String unite; 8 8 private String order; 9 private int colormapDefault; 10 private int classdisDefault; 9 11 10 12 public Parametre(int identifiant, String nom) { … … 52 54 this.order = order; 53 55 } 54 55 56 57 public int getColormapDefault() { 58 return colormapDefault; 59 } 60 61 public void setColormapDefault(int colormapDefault) { 62 this.colormapDefault = colormapDefault; 63 } 64 65 public int getClassdisDefault() { 66 return classdisDefault; 67 } 68 69 public void setClassdisDefault(int classdisDefault) { 70 this.classdisDefault = classdisDefault; 71 } 56 72 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/modele/Produit.java
r68 r70 12 12 private String temporalres; 13 13 private String type; 14 private String citation; 15 private String useconst; 16 private String informpub; 14 17 15 18 public Date getBeginDate() { … … 95 98 this.type = type; 96 99 } 100 101 public String getCitation() { 102 return citation; 103 } 104 105 public void setCitation(String citation) { 106 this.citation = citation; 107 } 108 109 public String getUseconst() { 110 return useconst; 111 } 112 113 public void setUseconst(String useconst) { 114 this.useconst = useconst; 115 } 116 117 public String getInformpub() { 118 return informpub; 119 } 120 121 public void setInformpub(String informpub) { 122 this.informpub = informpub; 123 } 97 124 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/modele/RequeteFacteurEmission.java
r68 r70 13 13 private Long produitBurnt; 14 14 private Long colormap; 15 private Long classdis; 16 private Long id_secteur; 17 private Long id_rcp; 18 private String alt; 19 private Long id_mask; 15 20 private Zone zone; 16 21 private String datedeb; … … 23 28 private long burningEff; 24 29 25 public String toXml( boolean fonction) {26 String xml = new String();30 public String toXml() { 31 String xml = new String(); 27 32 28 33 xml += "<requete>\n"; … … 31 36 xml += XmlHelper.createNode("produit", produitBurnt); 32 37 xml += XmlHelper.createNode("colormap", colormap); 33 38 xml += XmlHelper.createNode("scalevalue", classdis); 39 xml += XmlHelper.createNode("secteur", id_secteur); 40 xml += XmlHelper.createNode("rcp", id_rcp); 41 xml += XmlHelper.createNode("alt", alt); 42 xml += XmlHelper.createNode("mask", id_mask); 34 43 35 44 InfoConnectBean infoconnect = (InfoConnectBean) SpringBeanFactory.getXmlFactory().getBean("infoConnect"); … … 60 69 xml += XmlHelper.createNode("valeur", emissionFactor); 61 70 xml += "</param>\n";*/ 62 63 71 64 72 xml += "<param>\n"; … … 66 74 xml += XmlHelper.createNode("valeur", gaz); 67 75 xml += "</param>\n"; 68 69 76 70 77 /* 71 78 xml += "<param>\n"; … … 90 97 91 98 // FIXME truc crade pour sortir l'id des classes \o/ 92 93 94 95 99 try { 96 100 xml += XmlHelper.createNode("nom", codeDAO.getNumberCode(id_classe)); … … 98 102 e.printStackTrace(); 99 103 } 100 101 104 xml += XmlHelper.createNode("valeur", id_classe); 102 105 xml += "</param>\n"; 103 106 } 104 105 107 xml += "</params>\n"; 106 107 108 xml += "</fonction>\n"; 108 109 109 xml += "</requete>"; 110 110 // System.out.println(xml); 111 111 return xml; 112 }113 114 115 public String toXml() {116 return toXml(true);117 112 } 118 113 … … 125 120 } 126 121 122 public Long getClassdis() { 123 return classdis; 124 } 125 126 public void setClassdis(Long classdis) { 127 this.classdis = classdis; 128 } 129 127 130 public String getDatedeb() { 128 131 return datedeb; … … 212 215 this.burningEff = burningEff; 213 216 } 217 218 public Long getId_secteur() { 219 return id_secteur; 220 } 221 222 public void setId_secteur(Long idSecteur) { 223 id_secteur = idSecteur; 224 } 225 226 public Long getId_rcp() { 227 return id_rcp; 228 } 229 230 public void setId_rcp(Long idRcp) { 231 id_rcp = idRcp; 232 } 233 234 public String getAlt() { 235 return alt; 236 } 237 238 public void setAlt(String alt) { 239 this.alt = alt; 240 } 241 242 public Long getId_mask() { 243 return id_mask; 244 } 245 246 public void setId_mask(Long idMask) { 247 id_mask = idMask; 248 } 214 249 215 250 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/modele/ResultatStat.java
r68 r70 2 2 3 3 import java.lang.Double; 4 5 import org.medias.eccad.helpers.LoggerPerso; 6 import org.medias.eccad.metier.statistique.ServiceStatistique; 4 import java.math.BigDecimal; 7 5 8 6 public class ResultatStat { … … 19 17 } 20 18 21 public ResultatStat(String min, String max, String moyenne, String ecart, String somme ) {19 public ResultatStat(String min, String max, String moyenne, String ecart, String somme, String type) { 22 20 super(); 23 21 … … 28 26 somme = fixeDecimal(somme);*/ 29 27 30 31 32 28 double minFloat = Double.parseDouble(min); 33 29 double maxFloat = Double.parseDouble(max); 34 30 double moyenneFloat = Double.parseDouble(moyenne); 35 31 double ecartFloat = Double.parseDouble(ecart); 36 double sommeFloat = Double.parseDouble(somme); 32 double sommeFloat = Double.parseDouble(somme); 33 // On arrondit le min, le max et la somme si on attend des valeurs entiÚres en sortie 34 if (type.equals("positive integer")) { 35 minFloat = (new BigDecimal(Math.round(minFloat))).doubleValue(); 36 maxFloat = (new BigDecimal(Math.round(maxFloat))).doubleValue(); 37 sommeFloat = (new BigDecimal(Math.round(sommeFloat))).doubleValue(); 38 } 37 39 38 39 40 min = (String)Double.toString(minFloat); 41 max = (String)Double.toString(maxFloat); 42 moyenne = (String)Double.toString(moyenneFloat); 43 ecart = (String)Double.toString(ecartFloat); 44 somme = (String)Double.toString(sommeFloat); 40 min = Double.toString(minFloat); 41 max = Double.toString(maxFloat); 42 moyenne = Double.toString(moyenneFloat); 43 ecart = Double.toString(ecartFloat); 44 somme = Double.toString(sommeFloat); 45 45 46 LoggerPerso.log(ResultatStat.class, LoggerPerso.DEBUG, "min : "+ min +fixeDecimal(moyenne));46 // LoggerPerso.log(ResultatStat.class, LoggerPerso.DEBUG, "min : "+ min + " max : "+ max + " - fixeDecimal : "+fixeDecimal(moyenne)); 47 47 //min = fixeDecimal(min.toString()); 48 48 … … 64 64 65 65 private String fixeDecimal(String entree) { 66 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "entree 1 "+entree);66 // LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "entree 1 "+entree); 67 67 if (entree == null) 68 68 return "nc"; 69 69 int index = entree.lastIndexOf("."); 70 70 int indexE = entree.lastIndexOf("E"); 71 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "entree --lll-->2 "+indexE+" "+index+" "+entree.length()); 72 if ( indexE == -1 && index != -1 && entree.length() >= index + 5) { 73 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "cas 1 entree"); 74 entree = entree.substring(0, entree.lastIndexOf(".")+5); 71 // LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "entree --lll-->2 "+indexE+" "+index+" "+entree.length()); 72 // if ( indexE == -1 && index != -1 && entree.length() >= index + 5) { 73 // entree = entree.substring(0, entree.lastIndexOf(".")+5); 74 // } 75 // else if ( indexE != -1 && index != -1 && entree.length() >= index + 5) 76 // { 77 // String aEntree = entree; 78 // LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "aEntree "+aEntree.lastIndexOf("E")+" "+aEntree.length()+" "+aEntree.lastIndexOf("E")+" "+aEntree.length()); 79 // aEntree = aEntree.substring(aEntree.lastIndexOf("E"), aEntree.lastIndexOf("E")+aEntree.length()-aEntree.lastIndexOf("E")); 80 //entree = entree.substring(0, entree.lastIndexOf(".")+5)+aEntree; 81 // entree = entree.substring(0, entree.substring(0 , entree.lastIndexOf("E")).length()) + aEntree; 82 // } 83 84 // Le nombre a une virgule et pas de puissance de 10 (n=xx.xxx) 85 if (indexE == -1 && index != -1 && entree.length() >= index + 3) { 86 entree = entree.substring(0,index+3); 75 87 } 76 else if ( indexE != -1 && index != -1 && entree.length() >= index + 5) 77 { 78 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "cas 2 entree"); 79 String aEntree = entree; 80 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "aEntree "+aEntree.lastIndexOf("E")+" "+aEntree.length()+" "+aEntree.lastIndexOf("E")+" "+aEntree.length()); 81 aEntree=aEntree.substring(aEntree.lastIndexOf("E"), aEntree.lastIndexOf("E")+aEntree.length()-aEntree.lastIndexOf("E")); 82 entree = entree.substring(0, entree.lastIndexOf(".")+5)+aEntree; 88 // Le nombre a une virgule et une puissance de 10 (n=xx.xxxExx) 89 else if ( indexE != -1 && index != -1 && entree.substring(0,indexE).length() >= index + 3) { 90 entree = entree.substring(0,index+3)+entree.substring(indexE); 83 91 } 84 else { 85 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "entree= "+entree); 86 } 87 92 // LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "entree "+entree); 88 93 return entree; 89 94 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/modele/StatReponse.java
r68 r70 17 17 private Float centerLat; 18 18 private Float centerLon; 19 private Float globalSum; 19 20 20 21 public StatReponse(String error) { … … 27 28 return valeur; 28 29 } 29 30 30 31 31 public StatReponse(Zone zone, Temporel tempo, InfoCarte carte, String urlImage, Map<String, String> statistique, List<Valeur> graphe) { … … 99 99 } 100 100 101 102 103 101 public List<Valeur> getGraphe() { 104 102 return graphe; 105 103 } 106 107 108 104 109 105 public void setGraphe(List<Valeur> graphe) { … … 111 107 } 112 108 113 114 115 109 public Float getMaximal() { 116 110 return maximal; 117 111 } 118 119 120 112 121 113 public void setMaximal(Float maximal) { … … 123 115 } 124 116 125 126 127 117 public Float getMinimal() { 128 118 return minimal; 129 119 } 130 131 132 120 133 121 public void setMinimal(Float minimal) { … … 139 127 } 140 128 141 142 143 129 public void setCenter(Float aCenter) { 144 130 this.center = aCenter; 145 131 } 146 147 132 148 133 public Float getCenterLat() { 149 134 return centerLat; 150 135 } 151 152 153 136 154 137 public void setCenterLat(Float aCenterLat) { … … 160 143 } 161 144 162 163 164 145 public void setCenterLon(Float aCenterLon) { 165 146 this.centerLon = aCenterLon; 166 147 } 167 148 149 public Float getGlobalSum() { 150 return globalSum; 151 } 152 153 public void setGlobalSum(Float globalSum) { 154 this.globalSum = globalSum; 155 } 168 156 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/modele/Zone.java
r68 r70 2 2 3 3 import java.text.NumberFormat; 4 import java.util.Locale; 4 5 5 6 public class Zone { … … 16 17 this.eastbc = eastbc; 17 18 this.westbc = westbc; 18 numberFormat = NumberFormat.getNumberInstance( );19 numberFormat = NumberFormat.getNumberInstance(Locale.US); 19 20 numberFormat.setMaximumFractionDigits(2); 20 21 } … … 26 27 this.eastbc = 0; 27 28 this.westbc = 0; 28 numberFormat = NumberFormat.getNumberInstance( );29 numberFormat = NumberFormat.getNumberInstance(Locale.US); 29 30 numberFormat.setMaximumFractionDigits(2); 30 31 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/GestionFichier.java
r68 r70 36 36 out.close(); 37 37 } catch (IOException e) { 38 //system.out.println(e.toString());38 e.printStackTrace(); 39 39 } 40 40 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/PropertiesDatabase.java
r68 r70 12 12 13 13 public PropertiesDatabase() { 14 LoggerPerso.log(PropertiesDatabase.class, LoggerPerso.DEBUG, "chargement fichier de properties");14 // LoggerPerso.log(PropertiesDatabase.class, LoggerPerso.DEBUG, "chargement fichier de properties"); 15 15 String fichierProp = Lanceur.class.getResource("").getPath() + "/../../../../../propriete/serveur.properties"; 16 16 fichierProp.replaceAll("%20", " "); 17 17 prop = new Properties(); 18 18 try { 19 LoggerPerso.log(PropertiesDatabase.class, LoggerPerso.DEBUG, "chargement de : " + fichierProp);19 // LoggerPerso.log(PropertiesDatabase.class, LoggerPerso.DEBUG, "chargement de : " + fichierProp); 20 20 prop.load(new FileInputStream(fichierProp)); 21 21 } catch (Exception e) { … … 36 36 info.setDb_passwd(prop.getProperty("password")); 37 37 38 LoggerPerso.log(PropertiesDatabase.class, LoggerPerso.DEBUG, "chargement :" + info);38 // LoggerPerso.log(PropertiesDatabase.class, LoggerPerso.DEBUG, "chargement :" + info); 39 39 return info; 40 40 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/SGBD_jdbc.java
r68 r70 17 17 import org.medias.eccad.modele.Parametre; 18 18 import org.medias.eccad.modele.Produit; 19 import org.medias.eccad.modele.Secteur; 19 20 import org.postgresql.ds.PGPoolingDataSource; 20 21 import org.postgresql.largeobject.LargeObject; … … 28 29 public SGBD_jdbc(InfoConnectBean info) { 29 30 con = null; 30 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "construction connection");31 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "construction connection"); 31 32 if (pooling == null) { 32 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "creation pooling :: " + info);33 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "creation pooling :: " + info); 33 34 pooling = new PGPoolingDataSource(); 34 35 pooling.setDatabaseName(info.getDb_name()); … … 188 189 } 189 190 190 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListParametre::taille::"+liste_param.size());191 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListParametre::taille::"+liste_param.size()); 191 192 return liste_param; 192 193 } … … 198 199 199 200 requete = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 200 sql = "select distinct id_produit, title_produit, begintime_produit, endtime_produit from produit join grille using (id_produit) where id_param = " + id_param + ";";201 sql = "select distinct id_produit, title_produit, begintime_produit, endtime_produit, order_produit from produit join grille using (id_produit) where id_param = " + id_param + " order by order_produit;"; 201 202 202 203 ResultSet resultat = requete.executeQuery(sql); … … 209 210 } 210 211 211 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListProduit::taille::"+liste_param.size());212 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListProduit::taille::"+liste_param.size()); 212 213 return liste_param; 213 214 … … 228 229 } 229 230 230 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom());231 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom()); 231 232 232 233 return param; … … 250 251 } 251 252 252 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getProduitById::nom::"+ produit.getNom() + "::date::" + produit.getBeginDate());253 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getProduitById::nom::"+ produit.getNom() + "::date::" + produit.getBeginDate()); 253 254 254 255 return produit; … … 263 264 requete = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 264 265 sql = "select distinct valeurs_grille, date_grille from grille where id_produit = " + id_produit + " and date_grille >= '" + date_debut + "' and date_grille <= '" + date_fin + "' order by date_grille;"; 265 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::requete :: " + sql);266 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::requete :: " + sql); 266 267 ResultSet resultat = requete.executeQuery(sql); 267 268 … … 270 271 } 271 272 272 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::taille::"+liste_param.size() + "id_produit::" + id_produit);273 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::taille::"+liste_param.size() + "id_produit::" + id_produit); 273 274 return liste_param; 274 275 } 275 276 276 277 public List<Secteur> getListSectorByParam(int id_param) throws SQLException { 278 Statement requete; 279 String sql; 280 List<Secteur> liste_secteur = new LinkedList<Secteur>(); 281 282 requete = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 283 sql = "select id_secteur, fullname_secteur, id_categorieparametre from secteur; "; 284 285 ResultSet resultat = requete.executeQuery(sql); 286 287 while (resultat.next()) { 288 liste_secteur.add(new Secteur(resultat.getInt("id_secteur"), resultat.getString("fullname_secteur"))); 289 } 290 291 //LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListSecteur::taille::"+liste_secteur.size()); 292 return liste_secteur; 293 294 } 277 295 278 296 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/ServicePersistance.java
r68 r70 1 1 package org.medias.eccad.persistance; 2 2 3 import java.util.ArrayList; 3 4 import java.util.List; 4 5 5 6 import org.medias.eccad.helpers.LoggerPerso;7 6 import org.medias.eccad.helpers.SpringBeanFactory; 8 7 import org.medias.eccad.modele.*; … … 10 9 import org.medias.eccad.persistance.dao.MappingDAO; 11 10 import org.medias.eccad.persistance.dao.ParametreDAO; 11 import org.medias.eccad.persistance.dao.RcpDAO; 12 import org.medias.eccad.persistance.dao.SecteurDAO; 12 13 import org.medias.eccad.persistance.dao.CatParametreDAO; 13 14 import org.medias.eccad.persistance.dao.ProduitDAO; 14 15 import org.medias.eccad.persistance.exception.PersistanceException; 15 import org.medias.eccad.persistance.jdbc.CatParametreDAOjdbc;16 16 import org.springframework.beans.factory.xml.XmlBeanFactory; 17 17 … … 21 21 22 22 public ServicePersistance() { 23 LoggerPerso.log(ServicePersistance.class, LoggerPerso.DEBUG, "création du service");23 // LoggerPerso.log(ServicePersistance.class, LoggerPerso.DEBUG, "création du service"); 24 24 xmlbean = SpringBeanFactory.getXmlFactory(); 25 25 } 26 26 27 27 public List<CatParametre> getListcatParametre() { 28 LoggerPerso.log(ServicePersistance.class, LoggerPerso.DEBUG, "load DAOCAT");28 // LoggerPerso.log(ServicePersistance.class, LoggerPerso.DEBUG, "load DAOCAT"); 29 29 List<CatParametre> liste_catParam; 30 30 CatParametreDAO catParamdao = (CatParametreDAO) xmlbean.getBean("catParametreDAO"); 31 31 try { 32 LoggerPerso.log(ServicePersistance.class, LoggerPerso.DEBUG, "try...!"); 33 liste_catParam = catParamdao.getListcatParametre(); 32 liste_catParam = catParamdao.getListcatParametre(); 34 33 35 34 } catch (PersistanceException e) { … … 67 66 } 68 67 68 public List<Secteur> getListSectorByParam(int id_param, int id_prod, int id_rcp) { 69 List<Secteur> liste_secteur; 70 SecteurDAO secteur = (SecteurDAO) xmlbean.getBean("secteurDAO"); 71 72 try { 73 liste_secteur = secteur.getListSectorByParam(id_param,id_prod,id_rcp); 74 } catch (PersistanceException e) { 75 e.printStackTrace(); 76 return null; 77 } 78 return liste_secteur; 79 } 80 81 public List<Secteur> getListSecteur() { 82 List<Secteur> liste_secteur; 83 SecteurDAO secteurdao = (SecteurDAO) xmlbean.getBean("secteurDAO"); 84 try { 85 liste_secteur = secteurdao.getListSecteur(); 86 } catch (PersistanceException e) { 87 e.printStackTrace(); 88 return null; 89 } 90 91 return liste_secteur; 92 } 93 94 public List<Rcp> getListRcpByParam(int id_param, int id_prod, int id_sector) { 95 List<Rcp> liste_rcp; 96 RcpDAO rcpdao = (RcpDAO) xmlbean.getBean("rcpDAO"); 97 98 try { 99 liste_rcp = rcpdao.getListRcpByParam(id_param,id_prod,id_sector); 100 } catch (PersistanceException e) { 101 e.printStackTrace(); 102 return null; 103 } 104 return liste_rcp; 105 } 106 69 107 public List<Produit> getListProductByParam(int id_param) { 70 108 List<Produit> liste_param; … … 91 129 } 92 130 93 LoggerPerso.log(ServicePersistance.class, LoggerPerso.DEBUG, "getProduitById::nom::"+ produit.getNom() + "::date::" + produit.getBeginDate());131 // LoggerPerso.log(ServicePersistance.class, LoggerPerso.DEBUG, "getProduitById::nom::"+ produit.getNom() + "::date::" + produit.getBeginDate()); 94 132 return produit; 95 133 } 96 134 97 public List<Grille> getListGrille(long id_produit, long id_parametre,String date_debut, String date_fin) { 135 public Secteur getSecteurByID(long id_secteur) { 136 Secteur secteur = null; 137 SecteurDAO secteurdao = (SecteurDAO) xmlbean.getBean("secteurDAO"); 138 139 try { 140 secteur = secteurdao.getSecteurById(id_secteur); 141 } catch (PersistanceException e) { 142 e.printStackTrace(); 143 return null; 144 } 145 146 // LoggerPerso.log(ServicePersistance.class, LoggerPerso.DEBUG, "getSecteurById::nom::"+ secteur.getNom()); 147 return secteur; 148 } 149 150 public Rcp getRcpByID(long id_rcp) { 151 Rcp rcp = null; 152 RcpDAO rcpdao = (RcpDAO) xmlbean.getBean("rcpDAO"); 153 154 try { 155 rcp = rcpdao.getRcpById(id_rcp); 156 } catch (PersistanceException e) { 157 e.printStackTrace(); 158 return null; 159 } 160 return rcp; 161 } 162 163 public List<Grille> getListGrille(long id_produit, long id_parametre, long id_secteur, long id_rcp, String date_debut, String date_fin, String nomProd, String legend, String typeProd) { 98 164 List<Grille> grille; 99 165 GrilleDAO grilledao = (GrilleDAO) xmlbean.getBean("grilleDAO"); 100 166 try { 101 grille = grilledao.getListGrille(id_produit, id_parametre, date_debut, date_fin);167 grille = grilledao.getListGrille(id_produit, id_parametre, id_secteur, id_rcp, date_debut, date_fin, nomProd, legend, typeProd); 102 168 } catch (PersistanceException e) { 103 169 e.printStackTrace(); … … 121 187 } 122 188 189 public List<String> getListAlt(long id_secteur, String date_debut) { 190 List<String> liste_alt; 191 GrilleDAO grilledao = (GrilleDAO) xmlbean.getBean("grilleDAO"); 192 try { 193 liste_alt = grilledao.getListAlt(id_secteur, date_debut); 194 } catch (PersistanceException e) { 195 e.printStackTrace(); 196 return null; 197 } 198 199 return liste_alt; 200 } 201 202 public List<Grille> getListMasques(String codifMasque) { 203 List<Grille> liste_reg; 204 GrilleDAO grilledao = (GrilleDAO) xmlbean.getBean("grilleDAO"); 205 try { 206 liste_reg = grilledao.getListMasques(codifMasque); 207 } catch (PersistanceException e) { 208 e.printStackTrace(); 209 return null; 210 } 211 212 return liste_reg; 213 } 214 123 215 public Parametre getParametreById(int id_param) { 124 216 Parametre param = null; … … 151 243 return mapping.getVisualisation(type_produit); 152 244 } 245 246 public String getTypeCodif(long idGrille) { 247 String typeCodif; 248 GrilleDAO grilledao = (GrilleDAO) xmlbean.getBean("grilleDAO"); 249 try { 250 typeCodif = grilledao.getTypeCodif(idGrille); 251 } catch (PersistanceException e) { 252 e.printStackTrace(); 253 return null; 254 } 255 return typeCodif; 256 } 257 258 public ArrayList<String> getDates(long idProduit, long idParametre, long idSecteur, long idRcp, String nomprod) { 259 ArrayList<String> dates; 260 GrilleDAO grilledao = (GrilleDAO) xmlbean.getBean("grilleDAO"); 261 try { 262 dates = grilledao.getDates(idProduit, idParametre, idSecteur, idRcp, nomprod); 263 } catch (PersistanceException e) { 264 e.printStackTrace(); 265 return null; 266 } 267 268 return dates; 269 } 153 270 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/dao/ColorTabDAO.java
r68 r70 8 8 9 9 public interface ColorTabDAO { 10 public abstract ColorTab getColorMapByID(long id ) throws PersistanceException;10 public abstract ColorTab getColorMapByID(long id, long idClass) throws PersistanceException; 11 11 public abstract ColorTab getColorMapByParam(int idparam) throws PersistanceException; 12 public abstract ColorTab getColorMapByGrille(long id_grille) throws PersistanceException; 13 public abstract List<ColorMap> getListColorTabByGrille(long id_grille) throws PersistanceException; 14 public abstract List<ColorMap> getListColorTab() throws PersistanceException; 15 public abstract List<ColorMap> getListColorMapDynamique() throws PersistanceException; 12 public abstract ColorTab getColorMapByGrille() throws PersistanceException; 13 public abstract List<ColorMap> getListColorTabByGrille() throws PersistanceException; 16 14 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/dao/FactoryDAO.java
r68 r70 4 4 public GrilleDAO getGrilleDAO(); 5 5 public ParametreDAO getParametreDAO(); 6 public SecteurDAO getSecteurDAO(); 6 7 public ProduitDAO getProduitDAO(); 7 8 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/dao/GrilleDAO.java
r68 r70 1 1 package org.medias.eccad.persistance.dao; 2 2 3 import java.util.ArrayList; 3 4 import java.util.List; 4 5 … … 7 8 8 9 public interface GrilleDAO { 9 public List<Grille> getListGrille(long id_produit,long id_parametre, String date_debut, String date_fin) throws PersistanceException;10 public List<Grille> getListGrille(long id_produit,long id_parametre, long id_secteur, long id_rcp, String date_debut, String date_fin, String nomProd, String legend, String typeProd) throws PersistanceException; 10 11 public List<Grille> getListGrille(long id_produit, String date_debut, String date_fin) throws PersistanceException; 12 public List<String> getListAlt(long id_secteur, String date_debut) throws PersistanceException; 13 public List<Grille> getListMasques(String codifMasque) throws PersistanceException; 11 14 public float[][] getGrilleValue(int oid) throws PersistanceException; 12 15 public String getCodification(long id_grille) throws PersistanceException; … … 16 19 public float getGrilleResolution(long id_grille) throws PersistanceException; 17 20 public float getProduitResolution(long id_produit) throws PersistanceException; 21 public String getTypeCodif(long idGrille) throws PersistanceException; 22 public ArrayList<String> getDates(long idProduit, long idParametre, long idSecteur, long idRcp, String nomProd) throws PersistanceException; 18 23 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/dummy/ColorTabDAOdummy.java
r68 r70 21 21 } 22 22 23 public ColorTab getColorMapByGrille( long oid) {23 public ColorTab getColorMapByGrille() { 24 24 ColorTab colortab = new ColorTab(); 25 25 colortab.setMin(min); … … 44 44 45 45 public ColorTab getColorMapByParam(int id_param) { 46 return getColorMapByGrille( 0);46 return getColorMapByGrille(); 47 47 } 48 48 49 public List<ColorMap> getListColorTabByGrille( long oid) throws PersistanceException {49 public List<ColorMap> getListColorTabByGrille() throws PersistanceException { 50 50 List<ColorMap> liste = new LinkedList<ColorMap>(); 51 51 … … 58 58 } 59 59 60 public List<ColorMap> getListColorTab() throws PersistanceException { 61 List<ColorMap> liste = new LinkedList<ColorMap>(); 62 63 return liste; 64 } 65 66 public ColorTab getColorMapByID(long id) throws PersistanceException { 60 public ColorTab getColorMapByID(long id, long idClass) throws PersistanceException { 67 61 // TODO Auto-generated method stub 68 62 return null; … … 73 67 return null; 74 68 } 75 76 77 69 78 70 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/dummy/GrilleDAOdummy.java
r68 r70 1 1 package org.medias.eccad.persistance.dummy; 2 2 3 import java.util.ArrayList; 3 4 import java.util.LinkedList; 4 5 import java.util.List; … … 20 21 return data; 21 22 } 22 public List<Grille> getListGrille(long id_produit,long id_parametre, String date_debut,23 String date_fin ) throws PersistanceException {23 public List<Grille> getListGrille(long id_produit,long id_parametre, long id_secteur, long id_rcp, String date_debut, 24 String date_fin, String nomProd, String legend, String typeProd) throws PersistanceException { 24 25 25 26 Grille grille; … … 104 105 return 0; 105 106 } 107 public String getTypeCodif(long idGrille) { 108 // TODO Auto-generated method stub 109 return null; 110 } 111 112 public ArrayList<String> getDates(long idProduit, long idParametre, 113 long idSecteur, long idRcp, String nomProd) 114 throws PersistanceException { 115 // TODO Auto-generated method stub 116 return null; 117 } 118 public List<String> getListAlt(long idSecteur, String dateDebut) 119 throws PersistanceException { 120 // TODO Auto-generated method stub 121 return null; 122 } 123 public List<Grille> getListMasques(String codifMasque) throws PersistanceException { 124 // TODO Auto-generated method stub 125 return null; 126 } 127 106 128 107 129 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/HibernateSGBD.java
r68 r70 5 5 6 6 /** 7 * Permet l'int éraction avec un système de gestion persistante de l'information7 * Permet l'intï¿œraction avec un systï¿œme de gestion persistante de l'information 8 8 * @author Jean PINAUD 9 9 * … … 14 14 15 15 /** 16 * D ébut de la transaction16 * Dï¿œbut de la transaction 17 17 * 18 18 */ 19 19 public void connexion() { 20 // //system.out.println("<<< Hibernate::Connexion >>>");21 20 session = HibernateUtil.currentSession(); 22 21 tx = session.beginTransaction(); … … 43 42 44 43 /** 45 * Constructeur par d éfaut44 * Constructeur par dï¿œfaut 46 45 * 47 46 */ -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/HibernateUtil.java
r68 r70 4 4 import org.hibernate.*; 5 5 import org.hibernate.cfg.*; 6 import org.medias.eccad.helpers.LoggerPerso;7 6 8 7 /** … … 24 23 public static Session currentSession() 25 24 throws HibernateException { 26 LoggerPerso.log(HibernateUtil.class, LoggerPerso.DEBUG, "-- connexion --");25 // LoggerPerso.log(HibernateUtil.class, LoggerPerso.DEBUG, "-- connexion --"); 27 26 try { 28 27 if (sessionFactory == null) { … … 30 29 } 31 30 } catch (HibernateException ex) { 32 throw new RuntimeException("Probl ème de configuration : "31 throw new RuntimeException("ProblÚme de configuration : " 33 32 + ex.getMessage(), ex); 34 33 } … … 50 49 public static void closeSession() 51 50 throws HibernateException { 52 LoggerPerso.log(HibernateUtil.class, LoggerPerso.DEBUG, "-- deconnexion --");51 // LoggerPerso.log(HibernateUtil.class, LoggerPerso.DEBUG, "-- deconnexion --"); 53 52 Session s = (Session) session.get(); 54 53 session.set(null); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/XmlDAOhibernate.java
r68 r70 3 3 import java.util.List; 4 4 5 import org.medias.eccad.helpers.CharactereHelper;6 5 import org.medias.eccad.persistance.dao.XmlDAO; 7 6 import org.medias.eccad.persistance.hibernate.domaine.Produit; … … 10 9 11 10 public String getXmlByProduit(long id) { 12 List resultat;11 List<?> resultat; 13 12 Produit produitTO; 14 13 connexion(); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Categorieparametre.java
r68 r70 14 14 15 15 // Fields 16 17 /** 18 * 19 */ 20 private static final long serialVersionUID = 1L; 16 21 17 22 private int idCategorieparametre; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Code.java
r68 r70 9 9 10 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 private int idCode; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Codification.java
r68 r70 12 12 13 13 // Fields 14 15 /** 16 * 17 */ 18 private static final long serialVersionUID = 1L; 14 19 15 20 private int idCodification; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Color.java
r68 r70 12 12 13 13 // Fields 14 15 /** 16 * 17 */ 18 private static final long serialVersionUID = 1L; 14 19 15 20 private int colId; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/ColorIndex.java
r68 r70 9 9 10 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 private ColorIndexId id; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/ColorIndexId.java
r68 r70 9 9 10 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 private int cmId; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Colormap.java
r68 r70 12 12 13 13 // Fields 14 15 /** 16 * 17 */ 18 private static final long serialVersionUID = 1L; 14 19 15 20 private int cmId; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Concerne.java
r68 r70 9 9 10 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 private ConcerneId id; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/ConcerneId.java
r68 r70 9 9 10 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 private int idProduit; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Contact.java
r68 r70 9 9 10 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 private ContactId id; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/ContactId.java
r68 r70 9 9 10 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 private int idProduit; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Domaine.java
r68 r70 14 14 15 15 // Fields 16 17 /** 18 * 19 */ 20 private static final long serialVersionUID = 1L; 16 21 17 22 private int idDomaine; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Fichier.java
r68 r70 11 11 12 12 // Fields 13 14 /** 15 * 16 */ 17 private static final long serialVersionUID = 1L; 13 18 14 19 private int idFichier; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Fournit.java
r68 r70 9 9 10 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 private FournitId id; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/FournitId.java
r68 r70 9 9 10 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 private int idProduit; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Grille.java
r68 r70 2 2 3 3 // Generated 1 Juin 2007 15:03:29 by Hibernate Tools 3.2.0.beta7 4 5 import java.io.Serializable;6 import java.util.Date;7 4 8 5 /** … … 12 9 13 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 14 16 15 17 private int idGrille; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/LienpersonneId.java
r68 r70 9 9 10 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 private int idMetadata; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Metadata.hbm.xml
r68 r70 24 24 <one-to-many class="org.medias.eccad.persistance.hibernate.domaine.Produit" /> 25 25 </set> 26 <set name="lienorganismes" inverse="true">27 <key>28 <column name="id_metadata" not-null="true" />29 </key>30 <one-to-many class="org.medias.eccad.persistance.hibernate.domaine.Lienorganisme" />31 </set>32 26 <set name="lienpersonnes" inverse="true"> 33 27 <key> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Metadata.java
r68 r70 30 30 private Set<Produit> produits = new HashSet<Produit>(0); 31 31 32 private Set<Lienorganisme> lienorganismes = new HashSet<Lienorganisme>(0);33 34 32 private Set<Lienpersonne> lienpersonnes = new HashSet<Lienpersonne>(0); 35 33 … … 48 46 /** full constructor */ 49 47 public Metadata(int idMetadata, String nameMetadata, String dateMetadata, 50 String versionMetadata, Set<Produit> produits, 51 Set<Lienorganisme> lienorganismes, Set<Lienpersonne> lienpersonnes) { 48 String versionMetadata, Set<Produit> produits, Set<Lienpersonne> lienpersonnes) { 52 49 this.idMetadata = idMetadata; 53 50 this.nameMetadata = nameMetadata; … … 55 52 this.versionMetadata = versionMetadata; 56 53 this.produits = produits; 57 this.lienorganismes = lienorganismes;58 54 this.lienpersonnes = lienpersonnes; 59 55 } … … 70 66 valeur += "\n"; 71 67 valeur += XmlHelper.createNode("versionMetadata", versionMetadata); 72 valeur += "\n";73 valeur += XmlHelper.listToString("organismes", lienorganismes);74 68 valeur += "\n"; 75 69 valeur += XmlHelper.listToString("personnes", lienpersonnes); … … 124 118 } 125 119 126 public Set<Lienorganisme> getLienorganismes() {127 return this.lienorganismes;128 }129 130 public void setLienorganismes(Set<Lienorganisme> lienorganismes) {131 this.lienorganismes = lienorganismes;132 }133 134 120 public Set<Lienpersonne> getLienpersonnes() { 135 121 return this.lienpersonnes; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Organisme.hbm.xml
r68 r70 42 42 <one-to-many class="org.medias.eccad.persistance.hibernate.domaine.Fournit" /> 43 43 </set> 44 <set name="lienorganismes" inverse="true">45 <key>46 <column name="id_organisme" not-null="true" />47 </key>48 <one-to-many class="org.medias.eccad.persistance.hibernate.domaine.Lienorganisme" />49 </set>50 44 </class> 51 45 </hibernate-mapping> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Organisme.java
r68 r70 14 14 15 15 // Fields 16 17 /** 18 * 19 */ 20 private static final long serialVersionUID = 1L; 16 21 17 22 private int idOrganisme; … … 37 42 private Set<Fournit> fournits = new HashSet<Fournit>(0); 38 43 39 private Set<Lienorganisme> lienorganismes = new HashSet<Lienorganisme>(0);40 41 44 // Constructors 42 45 … … 55 58 String faxOrganisme, String urlOrganisme, String addressOrganisme, 56 59 String zipcodeOrganisme, String cityOrganisme, 57 String countryOrganisme, Set<Fournit> fournits, 58 Set<Lienorganisme> lienorganismes) { 60 String countryOrganisme, Set<Fournit> fournits) { 59 61 this.idOrganisme = idOrganisme; 60 62 this.fullnameOrganisme = fullnameOrganisme; … … 68 70 this.countryOrganisme = countryOrganisme; 69 71 this.fournits = fournits; 70 this.lienorganismes = lienorganismes;71 72 } 72 73 … … 194 195 } 195 196 196 public Set<Lienorganisme> getLienorganismes() {197 return this.lienorganismes;198 }199 200 public void setLienorganismes(Set<Lienorganisme> lienorganismes) {201 this.lienorganismes = lienorganismes;202 }203 204 197 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/ParamColor.java
r68 r70 9 9 10 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 private ParamColorId id; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/ParamColorId.java
r68 r70 9 9 10 10 // Fields 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 private int cmId; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Parametre.java
r68 r70 14 14 15 15 // Fields 16 17 /** 18 * 19 */ 20 private static final long serialVersionUID = 1L; 16 21 17 22 private int idParam; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Personne.java
r68 r70 14 14 15 15 // Fields 16 17 /** 18 * 19 */ 20 private static final long serialVersionUID = 1L; 16 21 17 22 private int idPersonne; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Produit.java
r68 r70 9 9 10 10 import org.medias.eccad.helpers.CharactereHelper; 11 import org.medias.eccad.helpers.LoggerPerso;12 11 import org.medias.eccad.helpers.XmlHelper; 13 12 … … 159 158 valeur += "<metadonnees>" + "\n"; 160 159 161 valeur += "<produit>" + "\n"; 162 LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "produit");160 valeur += "<produit>" + "\n"; 161 // LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "produit"); 163 162 valeur += XmlHelper.createNode("idProduit", Integer.toString(idProduit)); 164 163 valeur += XmlHelper.createNode("titleProduit", titleProduit); … … 185 184 valeur += XmlHelper.createNode("headerProduit", headerProduit); 186 185 valeur += XmlHelper.createNode("versionProduit", versionProduit); 187 LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "produit_origine");186 // LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "produit_origine"); 188 187 valeur += XmlHelper.objectToString(produitorig); 189 LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "reference");188 // LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "reference"); 190 189 valeur += XmlHelper.listToString("referenceses", concernes); 191 LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "fin produit");190 // LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "fin produit"); 192 191 valeur += "</produit>" + "\n"; 193 192 194 LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "domaine");193 // LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "domaine"); 195 194 valeur += XmlHelper.objectToString(domaine); 196 LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "typeproduit");195 // LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "typeproduit"); 197 196 valeur += XmlHelper.objectToString(typeproduit); 198 LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "metadata_produit");197 // LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "metadata_produit"); 199 198 valeur += XmlHelper.objectToString(metadata); 200 199 201 200 //valeur += "<fichiers>" + listToString(fichiers) + "</fichiers>" + "\n"; 202 LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "organismes");201 // LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "organismes"); 203 202 valeur += XmlHelper.listToString("organismes", fournits); 204 LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "parametre");203 // LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "parametre"); 205 204 valeur += XmlHelper.listToString("parametre", grilles, 1) + "\n"; 206 205 //valeur += "<requetes>" + listToString(requetes) + "</requetes>" + "\n"; 207 LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "contacts");206 // LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "contacts"); 208 207 valeur += XmlHelper.listToString("contacts", contacts); 209 208 valeur += "</metadonnees>" + "\n"; 210 209 211 210 valeur = CharactereHelper.getEncodage(valeur, "ISO-8859-1"); 212 LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "replace all");211 // LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "replace all"); 213 212 valeur = valeur.replaceAll("&", "&"); 214 LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "fin retour valeur");213 // LoggerPerso.log(Produit.class, LoggerPerso.DEBUG, "fin retour valeur"); 215 214 return valeur; 216 215 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Produitorig.hbm.xml
r68 r70 15 15 <column name="title_produitorig" length="128" unique="true" /> 16 16 </property> 17 <property name="orgProduitorig" type="string"> 18 <column name="org_produitorig" length="128" /> 19 </property> 20 <property name="dateProduitorig" type="date"> 21 <column name="date_produitorig" length="4" /> 17 <property name="dateProduitorig" type="string"> 18 <column name="date_produitorig" length="128" /> 22 19 </property> 23 20 <property name="editionProduitorig" type="string"> 24 21 <column name="edition_produitorig" length="128" /> 25 22 </property> 26 <property name="begintimeProduitorig" type=" date">27 <column name="begintime_produitorig" length=" 4" />23 <property name="begintimeProduitorig" type="string"> 24 <column name="begintime_produitorig" length="128" /> 28 25 </property> 29 <property name="endtimeProduitorig" type=" date">30 <column name="endtime_produitorig" length=" 4" />26 <property name="endtimeProduitorig" type="string"> 27 <column name="endtime_produitorig" length="128" /> 31 28 </property> 32 29 <property name="earthellipsProduitorig" type="string"> … … 38 35 <property name="spatialresProduitorig" type="string"> 39 36 <column name="spatialres_produitorig" length="128" /> 40 </property>41 <property name="projectionProduitorig" type="string">42 <column name="projection_produitorig" length="128" />43 37 </property> 44 38 <property name="methodProduitorig" type="string"> -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Produitorig.java
r68 r70 3 3 // Generated 1 Juin 2007 15:03:29 by Hibernate Tools 3.2.0.beta7 4 4 5 import java.util.Date;6 5 import java.util.HashSet; 7 6 import java.util.Set; … … 16 15 // Fields 17 16 17 /** 18 * 19 */ 20 private static final long serialVersionUID = 1L; 21 18 22 private int idProduitorig; 19 23 … … 22 26 private String titleProduitorig; 23 27 24 private String orgProduitorig; 25 26 private Date dateProduitorig; 28 private String dateProduitorig; 27 29 28 30 private String editionProduitorig; 29 31 30 private DatebegintimeProduitorig;31 32 private DateendtimeProduitorig;32 private String begintimeProduitorig; 33 34 private String endtimeProduitorig; 33 35 34 36 private String earthellipsProduitorig; … … 37 39 38 40 private String spatialresProduitorig; 39 40 private String projectionProduitorig;41 41 42 42 private String methodProduitorig; … … 61 61 /** full constructor */ 62 62 public Produitorig(int idProduitorig, Domaine domaine, 63 String titleProduitorig, String orgProduitorig,64 DatedateProduitorig, String editionProduitorig,65 Date begintimeProduitorig, DateendtimeProduitorig,63 String titleProduitorig, 64 String dateProduitorig, String editionProduitorig, 65 String begintimeProduitorig, String endtimeProduitorig, 66 66 String earthellipsProduitorig, String temporalresProduitorig, 67 String spatialresProduitorig, String projectionProduitorig,67 String spatialresProduitorig, 68 68 String methodProduitorig, String dataurlProduitorig, 69 69 String documentationProduitorig, Set<Produit> produits) { … … 71 71 this.domaine = domaine; 72 72 this.titleProduitorig = titleProduitorig; 73 this.orgProduitorig = orgProduitorig;74 73 this.dateProduitorig = dateProduitorig; 75 74 this.editionProduitorig = editionProduitorig; … … 79 78 this.temporalresProduitorig = temporalresProduitorig; 80 79 this.spatialresProduitorig = spatialresProduitorig; 81 this.projectionProduitorig = projectionProduitorig;82 80 this.methodProduitorig = methodProduitorig; 83 81 this.dataurlProduitorig = dataurlProduitorig; … … 95 93 valeur += XmlHelper.createNode("titleProduitorig", titleProduitorig); 96 94 valeur += XmlHelper.objectToString(domaine); 97 valeur += XmlHelper.createNode("orgProduitorig", orgProduitorig);98 95 valeur += XmlHelper.createNode("dateProduitorig", dateProduitorig); 99 96 valeur += XmlHelper.createNode("editionProduitorig", editionProduitorig); … … 103 100 valeur += XmlHelper.createNode("temporalresProduitorig", temporalresProduitorig); 104 101 valeur += XmlHelper.createNode("spatialresProduitorig", spatialresProduitorig); 105 valeur += XmlHelper.createNode("projectionProduitorig", projectionProduitorig);106 102 valeur += XmlHelper.createNode("methodProduitorig", methodProduitorig); 107 103 valeur += XmlHelper.createNode("dataurlProduitorig", dataurlProduitorig); … … 112 108 valeur += "<domaine>" + domaine + "</domaine>" + "\n"; 113 109 valeur += "<titleProduitorig>" + titleProduitorig + "</titleProduitorig>" + "\n"; 114 valeur += "<orgProduitorig>" + orgProduitorig + "</orgProduitorig>" + "\n";115 110 valeur += "<dateProduitorig>" + dateProduitorig + "</dateProduitorig>" + "\n"; 116 111 valeur += "<editionProduitorig>" + editionProduitorig + "</editionProduitorig>" + "\n"; … … 120 115 valeur += "<temporalresProduitorig>" + temporalresProduitorig + "</temporalresProduitorig>" + "\n"; 121 116 valeur += "<spatialresProduitorig>" + spatialresProduitorig + "</spatialresProduitorig>" + "\n"; 122 valeur += "<projectionProduitorig>" + projectionProduitorig + "</projectionProduitorig>" + "\n";123 117 valeur += "<methodProduitorig>" + methodProduitorig + "</methodProduitorig>" + "\n"; 124 118 valeur += "<dataurlProduitorig>" + dataurlProduitorig + "</dataurlProduitorig>" + "\n"; … … 155 149 } 156 150 157 public String getOrgProduitorig() { 158 return this.orgProduitorig; 159 } 160 161 public void setOrgProduitorig(String orgProduitorig) { 162 this.orgProduitorig = orgProduitorig; 163 } 164 165 public Date getDateProduitorig() { 151 public String getDateProduitorig() { 166 152 return this.dateProduitorig; 167 153 } 168 154 169 public void setDateProduitorig( DatedateProduitorig) {155 public void setDateProduitorig(String dateProduitorig) { 170 156 this.dateProduitorig = dateProduitorig; 171 157 } … … 179 165 } 180 166 181 public DategetBegintimeProduitorig() {167 public String getBegintimeProduitorig() { 182 168 return this.begintimeProduitorig; 183 169 } 184 170 185 public void setBegintimeProduitorig( DatebegintimeProduitorig) {171 public void setBegintimeProduitorig(String begintimeProduitorig) { 186 172 this.begintimeProduitorig = begintimeProduitorig; 187 173 } 188 174 189 public DategetEndtimeProduitorig() {175 public String getEndtimeProduitorig() { 190 176 return this.endtimeProduitorig; 191 177 } 192 178 193 public void setEndtimeProduitorig( DateendtimeProduitorig) {179 public void setEndtimeProduitorig(String endtimeProduitorig) { 194 180 this.endtimeProduitorig = endtimeProduitorig; 195 181 } … … 219 205 } 220 206 221 public String getProjectionProduitorig() {222 return this.projectionProduitorig;223 }224 225 public void setProjectionProduitorig(String projectionProduitorig) {226 this.projectionProduitorig = projectionProduitorig;227 }228 229 207 public String getMethodProduitorig() { 230 208 return this.methodProduitorig; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Requete.java
r68 r70 11 11 12 12 // Fields 13 14 /** 15 * 16 */ 17 private static final long serialVersionUID = 1L; 13 18 14 19 private int idRequete; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Typecodification.java
r68 r70 12 12 13 13 // Fields 14 15 /** 16 * 17 */ 18 private static final long serialVersionUID = 1L; 14 19 15 20 private int idTypecodification; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Typeproduit.java
r68 r70 14 14 15 15 // Fields 16 17 /** 18 * 19 */ 20 private static final long serialVersionUID = 1L; 16 21 17 22 private int idTypeproduit; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/hibernate/domaine/Unite.java
r68 r70 14 14 15 15 // Fields 16 17 /** 18 * 19 */ 20 private static final long serialVersionUID = 1L; 16 21 17 22 private int idUnite; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/CatParametreDAOjdbc.java
r68 r70 8 8 import java.util.List; 9 9 10 import org.medias.eccad.helpers.LoggerPerso;11 10 import org.medias.eccad.modele.CatParametre; 12 11 import org.medias.eccad.persistance.dao.CatParametreDAO; … … 33 32 conn = getConnection(); 34 33 35 try { LoggerPerso.log(CatParametreDAOjdbc.class, LoggerPerso.DEBUG, "DAOjdbc youhou!!");34 try { 36 35 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 37 sql = "select distinct id_categorieparametre, fullname_categorieparametre from categorieparametre join parametre using (id_categorieparametre) join grille using (id_param);"; 38 36 // sql = "select distinct id_categorieparametre, fullname_categorieparametre, order_categorieparametre" + 37 // " from categorieparametre join parametre using (id_categorieparametre)" + 38 // " join grille using (id_param) order by order_categorieparametre;"; 39 sql = "select distinct id_categorieparametre, fullname_categorieparametre" + 40 ", order_categorieparametre from categorieparametre" + 41 " where id_categorieparametre in (select id_categorieparametre from parametre" + 42 " where id_param in (select id_param from grille)) order by order_categorieparametre;"; 39 43 resultat = requete.executeQuery(sql); 40 44 … … 51 55 } 52 56 53 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListCatParametre::taille::"+liste_catParam.size());57 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListCatParametre::taille::"+liste_catParam.size()); 54 58 55 59 return liste_catParam; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/CodeDAOjdbc.java
r68 r70 21 21 try { 22 22 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 23 sql = " select legend_code" 24 + " from grille join codification using (id_codification)" 25 + " join code using (id_codification) where id_grille = " + id_grille + " order by id_code;"; 26 23 // sql = " select num_code,legend_code" 24 // + " from grille join codification using (id_codification)" 25 // + " join code using (id_codification) where id_grille = " + id_grille + " order by num_code;"; 26 sql = " select number_code,legend_code" 27 + " from grille left join code on id_grille = num_code" 28 + " where id_grille = " + id_grille + " order by number_code;"; 29 27 30 ResultSet resultat = requete.executeQuery(sql); 28 31 String legend = ""; 29 32 while (resultat.next()) { 30 code.add(resultat.getString("legend_code").toLowerCase()); 33 legend = resultat.getString("legend_code"); 34 code.add(resultat.getString("number_code")+"-"+legend); 35 } 36 if (code.size() == 1) { 37 code.set(0, "1-"+legend); 31 38 } 32 39 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/ColorTabDAOjdbc.java
r68 r70 9 9 import java.util.List; 10 10 11 12 import org.medias.eccad.helpers.LoggerPerso;13 11 import org.medias.eccad.modele.ColorMap; 14 12 import org.medias.eccad.modele.ColorTab; … … 17 15 18 16 public class ColorTabDAOjdbc extends GeneriqueDAOjdbc implements ColorTabDAO { 19 20 21 22 23 public ColorTab getColorMapByGrille(long id_grille) throws PersistanceException { 17 18 public ColorTab getColorMapByGrille() throws PersistanceException { 24 19 ColorTab colortab = new ColorTab(); 25 colortab = getTableDefault( id_grille,colortab);20 colortab = getTableDefault(colortab); 26 21 //colortab = getMinMax(oid, colortab); 27 22 … … 29 24 } 30 25 31 public List<ColorMap> getListColorTab() throws PersistanceException { 32 String sql = " select cm_name, " 33 + " from colormap " 34 + " order by cm_id;"; 35 //+ " join grille using (id_param) " 36 37 38 Statement requete = null; 39 ResultSet resultat = null; 40 Connection conn = getConnection(); 41 42 LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, " récupération liste de colortab " + sql); 26 public List<ColorMap> getListClassMap() throws PersistanceException { 27 String sql = " select clm_id, clm_name, num_order from class_map order by clm_id"; 28 29 Statement requete = null; 30 ResultSet resultat = null; 31 Connection conn = getConnection(); 32 33 // LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, " récupération liste de colortab " + sql); 43 34 44 35 try { … … 54 45 try { 55 46 while (resultat.next()) { 56 liste_colormap.add(new ColorMap(resultat.getLong("c m_id"), resultat.getString("cm_name"), resultat.getInt("pc_defaut")));47 liste_colormap.add(new ColorMap(resultat.getLong("clm_id"), resultat.getString("clm_name"), resultat.getInt("num_order"))); 57 48 } 58 49 } … … 67 58 } 68 59 69 public List<ColorMap> getListColorTabByGrille( long id_grille) throws PersistanceException {70 String sql = " select distinct cm_id, cm_name, pc_defaut"60 public List<ColorMap> getListColorTabByGrille() throws PersistanceException { 61 /*String sql = " select distinct cm_id, cm_name, pc_defaut" 71 62 + " from colormap join param_color using (cm_id) " 72 63 + " join grille using (id_param) " 73 + " where id_grille = " + id_grille + " order by pc_defaut desc;"; 74 75 Statement requete = null; 76 ResultSet resultat = null; 77 Connection conn = getConnection(); 78 79 LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, " récupération liste de colortab " + sql); 64 + " where id_grille = " + id_grille + " order by pc_defaut desc;";*/ 65 66 String sql = " select clm_id as cm_id, clm_name as cm_name, num_order as pc_defaut from class_map order by clm_id"; 67 68 Statement requete = null; 69 ResultSet resultat = null; 70 Connection conn = getConnection(); 71 72 // LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, " récupération liste de colortab " + sql); 80 73 81 74 try { … … 104 97 } 105 98 106 private ColorTab getTableDefault( long id_grille,ColorTab colortab) throws PersistanceException {107 Statement requete = null; 108 String sql = " select distinct col_r, col_g, col_b, ci_min, ci_max"99 private ColorTab getTableDefault(ColorTab colortab) throws PersistanceException { 100 Statement requete = null; 101 /*String sql = " select distinct col_r, col_g, col_b, ci_min, ci_max" 109 102 + " from color join color_index using (col_id)" 110 103 + " join param_color using (cm_id) " 111 104 + " join grille using (id_param) " 112 + " where id_grille = " + id_grille +" and pc_defaut = 1 order by ci_max;"; 113 Connection conn = getConnection(); 114 115 ResultSet resultat = null; 116 117 118 LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, "*************************************REQUETE = " + sql); 105 + " where id_grille = " + id_grille +" and pc_defaut = 1 order by ci_max;";*/ 106 107 String sql = " select distinct col_r, col_g, col_b, class_index.num_order" 108 + " from color join class_index using (col_id)" 109 + " join class_map using (clm_id) " 110 + " where class_map.num_order=1 order by class_index.num_order;"; 111 Connection conn = getConnection(); 112 113 ResultSet resultat = null; 114 115 // LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, "*************************************REQUETE = " + sql); 119 116 try { 120 117 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); … … 129 126 int i=0; 130 127 131 128 float ci_min=-1; 129 float ci_max=0; 132 130 133 131 try { 134 132 while (resultat.next()) { 135 133 liste_couleur.add(new Color(resultat.getInt("col_r"), resultat.getInt("col_g"), resultat.getInt("col_b"))); 136 liste_min.add(resultat.getFloat("ci_min")); 137 colortab.setMax(resultat.getFloat("ci_max")); 134 //liste_min.add(resultat.getFloat("ci_min")); 135 //colortab.setMax(resultat.getFloat("ci_max")); 136 137 liste_min.add(ci_min); 138 colortab.setMax(ci_max); 139 140 if (ci_min==-1) ci_min=0; 141 else ci_min=ci_min+10; 142 143 ci_max=ci_max+10; 138 144 i++; 139 145 } … … 164 170 } 165 171 166 public ColorTab getColorMapByID(long id ) throws PersistanceException {172 public ColorTab getColorMapByID(long id, long idClass) throws PersistanceException { 167 173 Statement requete = null; 168 174 ColorTab colortab = new ColorTab(); 169 175 170 String sql = " select distinct col_r, col_g, col_b, ci_min, ci_max, cm_name"176 /*String sql = " select distinct col_r, col_g, col_b, ci_min, ci_max, cm_name" 171 177 + " from color join color_index using (col_id) join colormap using (cm_id)" 172 + " where cm_id = " + id +" order by ci_min;"; 173 Connection conn = getConnection(); 174 175 ResultSet resultat = null; 176 177 178 LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, "REQUETE = " + sql); 178 + " where cm_id = " + id +" order by ci_min;";*/ 179 180 String sql="select distinct col_r, col_g, col_b, clm_name as cm_name, ci.num_order, val_min, val_max" 181 +" from color as co, class_index as ci, class_map as cm, class_distribution as cd" 182 +" where co.col_id=ci.col_id and ci.clm_id=cm.clm_id and cm.clm_id="+id+" and cd.scl_id="+idClass 183 +" and cd.num_order=ci.num_order order by ci.num_order;"; 184 Connection conn = getConnection(); 185 186 ResultSet resultat = null; 187 188 // LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, "REQUETE = " + sql); 179 189 try { 180 190 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); … … 189 199 int i=0; 190 200 191 192 193 try { 194 201 try { 195 202 while (resultat.next()) { 196 203 colortab.setName(resultat.getString("cm_name")); 197 204 liste_couleur.add(new Color(resultat.getInt("col_r"), resultat.getInt("col_g"), resultat.getInt("col_b"))); 198 liste_min.add(resultat.getFloat("ci_min")); 199 colortab.setMax(resultat.getFloat("ci_max")); 205 liste_min.add(resultat.getFloat("val_min")); 206 colortab.setMax(resultat.getFloat("val_max")); 207 // LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, "NAME="+resultat.getString("cm_name")+", RANGE = " +resultat.getFloat("val_min")+" - "+resultat.getFloat("val_max")); 200 208 i++; 201 209 } … … 221 229 } 222 230 223 public List<ColorMap> getListColorMapDynamique() throws PersistanceException {231 /* public List<ColorMap> getListColorMapDynamique() throws PersistanceException { 224 232 String sql = " select distinct clm_id, clm_name" 225 + " from class_map " 226 + " where clm_name ilike '%exponential%' or clm_name ilike '%linear%' or clm_name ilike '%logarithm%' order by clm_name;"; 227 228 229 230 Statement requete = null; 231 ResultSet resultat = null; 232 Connection conn = getConnection(); 233 234 LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, " récupération liste de colortab " + sql); 233 + " from class_map order by clm_id"; 234 //+ " where clm_name like '%exponential%' or clm_name like '%linear%' or clm_name like '%logarithm%' order by clm_name;"; 235 236 237 Statement requete = null; 238 ResultSet resultat = null; 239 Connection conn = getConnection(); 240 241 // LoggerPerso.log(ColorTabDAOjdbc.class, LoggerPerso.DEBUG, " récupération liste de colortab " + sql); 235 242 236 243 try { … … 246 253 try { 247 254 while (resultat.next()) { 248 liste_colormap.add(new ColorMap(resultat.getLong("c m_id"), resultat.getString("cm_name"), 0));255 liste_colormap.add(new ColorMap(resultat.getLong("clm_id"), resultat.getString("clm_name"), 0)); 249 256 } 250 257 } … … 257 264 258 265 return liste_colormap; 259 } 266 }*/ 260 267 261 268 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/FactoryDAOjdbc.java
r68 r70 4 4 import org.medias.eccad.persistance.dao.GrilleDAO; 5 5 import org.medias.eccad.persistance.dao.ParametreDAO; 6 import org.medias.eccad.persistance.dao.SecteurDAO; 6 7 import org.medias.eccad.persistance.dao.ProduitDAO; 7 8 … … 24 25 return new ParametreDAOjdbc(sgbd); 25 26 } 27 28 public SecteurDAO getSecteurDAO() { 29 return new SecteurDAOjdbc(sgbd); 30 } 26 31 27 32 public ProduitDAO getProduitDAO() { -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/GeneriqueDAOjdbc.java
r68 r70 4 4 import java.sql.SQLException; 5 5 6 7 import org.medias.eccad.helpers.LoggerPerso;8 6 import org.medias.eccad.persistance.exception.PersistanceException; 9 7 … … 40 38 throw new PersistanceException(sqle, "impossible de se connecter au sgbd :: ParametreDAOjdbc.getListParametre"); 41 39 } 42 LoggerPerso.log(GeneriqueDAOjdbc.class, LoggerPerso.DEBUG, "-- jdbc connexion -- ");43 40 return conn; 44 41 } 45 42 46 43 protected void closeConnection() { 47 LoggerPerso.log(GeneriqueDAOjdbc.class, LoggerPerso.DEBUG, "-- jdbc deconnexion -- ");48 44 sgbd.deconnexion(); 49 45 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/GrilleDAOjdbc.java
r68 r70 2 2 3 3 import java.sql.Connection; 4 import java.sql.Date; 4 5 import java.sql.ResultSet; 5 6 import java.sql.SQLException; 6 7 import java.sql.Statement; 8 import java.util.ArrayList; 9 import java.util.Collections; 7 10 import java.util.LinkedList; 8 11 import java.util.List; 9 12 10 11 13 import org.medias.eccad.helpers.Donnees; 12 import org.medias.eccad.helpers.LoggerPerso;13 14 import org.medias.eccad.modele.Grille; 14 15 import org.medias.eccad.persistance.jdbc.SGBD_jdbc; … … 28 29 } 29 30 30 public List<Grille> getListGrille(long id_produit,long id_parametre, String date_debut, String date_fin) throws PersistanceException{ 31 public List<Grille> getListGrille(long id_produit,long id_parametre, long id_secteur, long id_rcp, String date_debut, String date_fin, String nomProd, String legend, String typeProd) throws PersistanceException{ 32 Statement requete; 33 String sql; 34 List<Grille> liste_gril = new LinkedList<Grille>(); 35 Connection conn = getConnection(); 36 37 try { 38 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 39 sql = "select distinct date_grille, id_grille, legend_code, number_code" + 40 " from grille" + 41 " left join code on ((id_grille = num_code) and (grille.id_codification = code.id_codification))" + 42 " where id_produit = "+id_produit+" and id_param = "+id_parametre; 43 if (nomProd.equals("IPCC")) { 44 if (id_secteur > 0) { 45 sql+=" and id_secteur="+id_secteur; 46 } 47 if (id_rcp > 0 ) { 48 sql+=" and id_rcp="+id_rcp; 49 } else { 50 sql+=" and id_rcp is null"; 51 } 52 if (legend != null) { 53 sql+=" and legend_code = '"+legend+"'"; 54 } 55 } 56 if (date_debut != null) { 57 sql += " and date_grille >= '" + date_debut + "' and date_grille <= '" + date_fin + "'"; 58 if (typeProd.equals("monoplan")) { 59 sql += " order by id_grille, number_code"; 60 } else { 61 sql += " order by date_grille, number_code"; 62 } 63 } else { 64 sql += " order by id_grille"; 65 } 66 sql += ";"; 67 //LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::requete grille :: " + sql); 68 ResultSet resultat = requete.executeQuery(sql); 69 70 Date date; 71 long idGrille, idGrillePrec = 0; 72 String datePrec = ""; 73 int numberCode; 74 // NB: On ne stocke qu'une seule grille : 75 // - par plan (dans le cas d'un produit multiplan) 76 // - par date (dans le cas d'un produit temporel) 77 // - par masque (dans le cas d'un produit monoplan) 78 while (resultat.next()) { 79 date = resultat.getDate("date_grille"); 80 idGrille = resultat.getLong("id_grille"); 81 numberCode = resultat.getInt("number_code"); 82 if (typeProd.equals("multiplan") || 83 !date.toString().equals(datePrec) || 84 (typeProd.equals("monoplan") && idGrille != idGrillePrec)) { 85 // Cas monoplan: on place la grille contenant l'ensemble des masques en premiÚre position 86 // if (typeProd.equals("monoplan") && numberCode == 0) { 87 // liste_gril.add(0,new Grille(idGrille, date, resultat.getString("legend_code"),numberCode)); 88 // } else { 89 liste_gril.add(new Grille(idGrille, date, resultat.getString("legend_code"),numberCode)); 90 // } 91 } 92 datePrec = date.toString(); 93 idGrillePrec = idGrille; 94 } 95 // Pour un produit monoplan, on trie les grilles par numéro de code 96 if (typeProd.equals("monoplan")) { 97 Collections.sort(liste_gril,new Grille().new ComparatorNumberCode()); 98 } 99 } 100 catch (SQLException sqle) { 101 throw new PersistanceException(sqle, "erreur lors de l'execution de la requete :: GrilleDAOjdbc.getListGrille"); 102 } 103 finally { 104 closeConnection(); 105 } 106 //System.out.println("nbgrilles="+liste_gril.size()); 107 return liste_gril; 108 } 109 110 public List<Grille> getListGrille(long id_produit, String date_debut, String date_fin) throws PersistanceException{ 31 111 Statement requete; 32 112 String sql; … … 36 116 try { 37 117 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 38 sql = "select distinct id_grille, valeurs_grille, date_grille, legend_code from grille left join code on ((id_grille = num_code) and (grille.id_codification = code.id_codification)) where id_produit = " + id_produit+" and id_param = "+id_parametre; 118 sql = "select distinct id_grille, valeurs_grille, date_grille, legend_code, number_code from grille" + 119 // " inner join codification using (id_codification)" + 120 // " inner join type_codification using (id_typecodification)" + 121 " left join code on ((id_grille = num_code)" + 122 " and (grille.id_codification = code.id_codification)) where id_produit = " + id_produit; 123 // " inner join codification using (id_codification) left join code using (id_codification)" + 124 // " where id_produit = " + id_produit; 39 125 40 126 if (date_debut != null) 41 sql += " and date_grille >= '" + date_debut + "' and date_grille <= '" + date_fin + "' order by date_grille ";127 sql += " and date_grille >= '" + date_debut + "' and date_grille <= '" + date_fin + "' order by date_grille, number_code"; 42 128 else 43 sql += " order by id_grille";129 sql += " order by number_code, id_grille"; 44 130 45 131 sql += ";"; 46 132 47 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::requete :: " + sql);133 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille2::requete :: " + sql); 48 134 ResultSet resultat = requete.executeQuery(sql); 49 135 50 136 while (resultat.next()) { 51 liste_param.add(new Grille(resultat.getLong("id_grille"), resultat.getDate("date_grille"), resultat.getString("legend_code") ));137 liste_param.add(new Grille(resultat.getLong("id_grille"), resultat.getDate("date_grille"), resultat.getString("legend_code"), resultat.getInt("number_code"))); 52 138 } 53 139 } … … 58 144 closeConnection(); 59 145 } 60 61 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::taille::"+liste_param.size() + "id_produit::" + id_produit);146 147 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::taille::"+liste_param.size() + "id_produit::" + id_produit); 62 148 return liste_param; 63 149 } 64 150 65 66 67 public List<Grille> getListGrille(long id_produit, String date_debut, String date_fin) throws PersistanceException{ 68 Statement requete; 69 String sql; 70 List<Grille> liste_param = new LinkedList<Grille>(); 71 Connection conn = getConnection(); 72 73 try { 74 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 75 sql = "select distinct id_grille, valeurs_grille, date_grille, legend_code from grille left join code on ((id_grille = num_code) and (grille.id_codification = code.id_codification)) where id_produit = " + id_produit; 76 151 public List<String> getListAlt(long id_secteur, String date_debut) throws PersistanceException{ 152 Statement requete; 153 String sql; 154 List<String> liste_alt = new LinkedList<String>(); 155 Connection conn = getConnection(); 156 157 try { 158 // On récupÚre les altitudes 159 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 160 //sql = "select distinct cast(legend_code as decimal) as altitude from grille" + 161 sql = "select distinct legend_code, number_code from grille" + 162 " left join code on ((id_grille = num_code) and (grille.id_codification = code.id_codification))" + 163 " where id_secteur = "+id_secteur; 77 164 if (date_debut != null) 78 sql += " and date_grille >= '" + date_debut + "' and date_grille <= '" + date_fin + "' order by date_grille"; 79 else 80 sql += " order by id_grille"; 81 82 sql += ";"; 83 84 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::requete :: " + sql); 85 ResultSet resultat = requete.executeQuery(sql); 86 165 sql += " and date_grille = '" + date_debut+"'"; 166 sql += " order by number_code;"; 167 ResultSet resultat = requete.executeQuery(sql); 87 168 while (resultat.next()) { 88 liste_param.add(new Grille(resultat.getLong("id_grille"), resultat.getDate("date_grille"), resultat.getString("legend_code"))); 89 } 90 } 91 catch (SQLException sqle) { 92 throw new PersistanceException(sqle, "erreur lors de l'execution de la requete :: GrilleDAOjdbc.getListGrille"); 93 } 94 finally { 95 closeConnection(); 96 } 97 98 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListGrille::taille::"+liste_param.size() + "id_produit::" + id_produit); 99 return liste_param; 100 } 101 102 103 169 liste_alt.add(resultat.getString("legend_code")); 170 } 171 } 172 catch (SQLException sqle) { 173 throw new PersistanceException(sqle, "erreur lors de l'execution de la requete :: GrilleDAOjdbc.getListAlt"); 174 } 175 finally { 176 closeConnection(); 177 } 178 return liste_alt; 179 } 180 181 public List<Grille> getListMasques(String codifMasque) throws PersistanceException{ 182 Statement requete; 183 String sql; 184 List<Grille> liste_reg = new LinkedList<Grille>(); 185 Connection conn = getConnection(); 186 187 try { 188 // On récupÚre les régions 189 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 190 sql = "select distinct legend_code, number_code, id_grille from grille" + 191 " inner join codification using (id_codification) left join code on (id_grille = num_code)" + 192 " where nom_codification = '"+codifMasque+"' order by id_grille, number_code;"; 193 ResultSet resultat = requete.executeQuery(sql); 194 long idGrille, idGrillePrec = 0; 195 while (resultat.next()) { 196 idGrille = resultat.getLong("id_grille"); 197 if (idGrille != idGrillePrec) { 198 liste_reg.add(new Grille(idGrille, null, resultat.getString("legend_code"),resultat.getInt("number_code"))); 199 } 200 idGrillePrec = idGrille; 201 } 202 Collections.sort(liste_reg,new Grille().new ComparatorNumberCode()); 203 } 204 catch (SQLException sqle) { 205 throw new PersistanceException(sqle, "erreur lors de l'execution de la requete :: GrilleDAOjdbc.getListAlt"); 206 } 207 finally { 208 closeConnection(); 209 } 210 return liste_reg; 211 } 104 212 105 213 public float[][] getGrilleValue(int oid) throws PersistanceException { … … 184 292 try { 185 293 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 186 sql = " select name_type Codification" +""294 sql = " select name_typecodification" 187 295 + " from grille join codification using (id_codification)" 188 296 + " join typecodification using (id_typeCodification) where id_grille = " + id_grille + ";"; 189 297 190 298 ResultSet resultat = requete.executeQuery(sql); 191 LoggerPerso.log(GrilleDAOjdbc.class, LoggerPerso.DEBUG, "getCodification :: " + sql);299 // LoggerPerso.log(GrilleDAOjdbc.class, LoggerPerso.DEBUG, "getCodification :: " + sql); 192 300 if (resultat.next()) { 193 301 codification = resultat.getString("name_typeCodification").toLowerCase(); … … 216 324 217 325 ResultSet resultat = requete.executeQuery(sql); 218 LoggerPerso.log(GrilleDAOjdbc.class, LoggerPerso.DEBUG, "getCodification :: " + sql);326 // LoggerPerso.log(GrilleDAOjdbc.class, LoggerPerso.DEBUG, "getCodification :: " + sql); 219 327 if (resultat.next()) { 220 328 date = resultat.getString("date_grille").toLowerCase(); … … 237 345 238 346 public Grille getGrille(long id_grille) throws PersistanceException { 239 String sql = "select * from grille where id_grille = " + id_grille + ";"; 347 348 String sql = "select * from grille"; 349 sql += " left join code on id_grille = num_code"; 350 sql += " where id_grille = " + id_grille + ";"; 240 351 Statement requete; 241 352 Connection conn = getConnection(); … … 252 363 grille.setId_param(resultat.getLong("id_param")); 253 364 grille.setId_produit(resultat.getLong("id_produit")); 365 grille.setId_secteur(resultat.getLong("id_secteur")); 366 grille.setId_rcp(resultat.getLong("id_rcp")); 367 grille.setLegend(resultat.getString("legend_code")); 254 368 } 255 369 } … … 275 389 if (resultat.next()) { 276 390 resol = (float)360/resultat.getLong("ncol_grille"); 277 resultat.getLong("nlign_grille");391 // resultat.getLong("nlign_grille"); 278 392 } 279 393 } … … 299 413 if (resultat.next()) { 300 414 resol = (float)360/resultat.getLong("ncol_grille"); 301 resultat.getLong("nlign_grille");415 // resultat.getLong("nlign_grille"); 302 416 } 303 417 } … … 310 424 return resol; 311 425 } 312 313 426 427 public String getTypeCodif(long idGrille) throws PersistanceException { 428 String sql = "select name_typecodification from grille" + 429 " inner join codification using (id_codification)" + 430 " inner join typecodification using (id_typecodification)" + 431 " where id_grille = " + idGrille + ";"; 432 Statement requete; 433 Connection conn = getConnection(); 434 String typeCodif = null; 435 try { 436 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 437 438 439 ResultSet resultat = requete.executeQuery(sql); 440 441 if (resultat.next()) { 442 typeCodif = resultat.getString("name_typecodification"); 443 } 444 } 445 catch (SQLException sqle) { 446 throw new PersistanceException(sqle, "getTypeCodif " + sql); 447 } 448 finally { 449 closeConnection(); 450 } 451 return typeCodif; 452 } 453 454 public ArrayList<String> getDates(long idProduit, long idParametre, long idSecteur, long idRcp, String nomProd) throws PersistanceException { 455 Statement requete; 456 String sql; 457 ArrayList<String> dates = new ArrayList<String>(); 458 Connection conn = getConnection(); 459 460 try { 461 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 462 // sql = "select min(date_grille) as min, max(date_grille) as max from grille" + 463 sql = "select min(date_grille) as min, (cast(max(date_grille+deltadate_grille) as date)-1) as max, min(deltadate_grille) as delta from grille" + 464 " where id_produit = "+idProduit+" and id_param = "+idParametre; 465 if (nomProd.equals("IPCC")) { 466 if (idSecteur > 0) { 467 sql+=" and id_secteur="+idSecteur; 468 } 469 if (idRcp > 0 ) { 470 sql+=" and id_rcp="+idRcp; 471 } else { 472 sql+=" and id_rcp is null"; 473 } 474 } 475 sql += ";"; 476 ResultSet resultat = requete.executeQuery(sql); 477 if (resultat.next()) { 478 dates.add(resultat.getDate("min").toString()); 479 dates.add(resultat.getDate("max").toString()); 480 dates.add(resultat.getString("delta")); 481 } 482 } 483 catch (SQLException sqle) { 484 throw new PersistanceException(sqle, "erreur lors de l'execution de la requete :: GrilleDAOjdbc.getDates"); 485 } 486 finally { 487 closeConnection(); 488 } 489 return dates; 490 } 314 491 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/ParametreDAOjdbc.java
r68 r70 9 9 import java.util.List; 10 10 11 12 import org.medias.eccad.helpers.LoggerPerso;13 11 import org.medias.eccad.modele.Parametre; 14 12 import org.medias.eccad.persistance.jdbc.SGBD_jdbc; … … 62 60 } 63 61 64 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListParametre::taille::"+liste_param.size());62 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListParametre::taille::"+liste_param.size()); 65 63 66 64 return liste_param; … … 84 82 try { 85 83 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 86 sql = "select distinct id_param, fullname_param, shortname_param, order_param from parametre join grille using (id_param) join produit using (id_produit) join typeproduit using (id_typeproduit) where id_categorieparametre= "+id_CatParam+" and name_typeproduit not ilike 'array' order by order_param;"; 87 84 // sql = "select distinct id_param, fullname_param, shortname_param, order_param from parametre" + 85 // " join grille using (id_param) join produit using (id_produit)" + 86 // " join typeproduit using (id_typeproduit)" + 87 // " where id_categorieparametre= "+id_CatParam+ 88 // " and name_typeproduit not ilike 'array' order by order_param;"; 89 sql = "select distinct id_param, fullname_param, shortname_param, order_param from parametre" + 90 " where id_param in (select id_param from grille join produit using (id_produit)" + 91 " join typeproduit using (id_typeproduit)" + 92 " where name_typeproduit not ilike 'array')" + 93 " and id_categorieparametre="+id_CatParam+" order by order_param;"; 88 94 resultat = requete.executeQuery(sql); 89 95 90 96 91 97 while (resultat.next()) { 92 if (resultat.getString("shortname_param").equals("NULL") )98 if (resultat.getString("shortname_param").equals("NULL") || resultat.getString("shortname_param").equals("")) 93 99 liste_param.add(new Parametre(resultat.getInt("id_param"), resultat.getString("fullname_param"))); 94 100 else … … 103 109 } 104 110 105 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListParametre::taille::"+liste_param.size());111 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListParametre::taille::"+liste_param.size()); 106 112 107 113 return liste_param; … … 126 132 try { 127 133 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 128 sql = "select distinct id_param, fullname_param, shortname_param, order_param, shortName_unite from parametre join unite using (id_unite) where id_param = " + id_param + " order by order_param;"; 129 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "sql getParametreById="+sql); 134 sql = "select distinct id_param, fullname_param, shortname_param, order_param, shortName_unite, clm_default_id, scl_default_id" + 135 " from parametre p" + 136 " inner join unite using (id_unite)" + 137 " where id_param = " + id_param + " order by order_param;"; 130 138 131 139 ResultSet resultat = requete.executeQuery(sql); 132 140 133 141 if (resultat.next()) { 134 param = new Parametre(resultat.getInt("id_param"), resultat.getString("fullname_param"), resultat.getString("shortname_param"),resultat.getString("order_param")); 142 param = new Parametre(resultat.getInt("id_param"), resultat.getString("fullname_param") 143 , resultat.getString("shortname_param"),resultat.getString("order_param")); 135 144 param.setUnite(resultat.getString("shortName_unite")); 145 param.setColormapDefault(resultat.getInt("clm_default_id")); 146 param.setClassdisDefault(resultat.getInt("scl_default_id")); 136 147 } 137 148 } … … 142 153 closeConnection(); 143 154 } 144 145 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom());155 156 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom()); 146 157 147 158 return param; … … 159 170 try { 160 171 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 161 sql = "select distinct id_param, fullname_param, shortname_param, order_param, short Name_unite from parametre join grille using (id_param) join unite using (id_unite) where id_grille = " + id_grille + " order by order_param;";172 sql = "select distinct id_param, fullname_param, shortname_param, order_param, shortname_unite from parametre join grille using (id_param) join unite using (id_unite) where id_grille = " + id_grille + " order by order_param;"; 162 173 163 174 ResultSet resultat = requete.executeQuery(sql); … … 168 179 String unite = null; 169 180 try { 170 temp = resultat.getString("short Name_unite").getBytes("ISO-8859-1");171 } catch (UnsupportedEncodingException e) { 181 temp = resultat.getString("shortname_unite").getBytes("ISO-8859-1"); 182 } catch (UnsupportedEncodingException e) {e.printStackTrace();} 172 183 173 184 if (temp != null) … … 182 193 closeConnection(); 183 194 } 184 185 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom());195 196 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom()); 186 197 187 198 return param; … … 213 224 closeConnection(); 214 225 } 215 216 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom());226 227 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getParametreById::nom::"+ param.getNom()); 217 228 218 229 return param; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/ProduitDAOjdbc.java
r68 r70 10 10 11 11 import org.medias.eccad.helpers.CharactereHelper; 12 import org.medias.eccad.helpers.LoggerPerso;13 12 import org.medias.eccad.modele.Produit; 14 13 import org.medias.eccad.persistance.jdbc.SGBD_jdbc; … … 34 33 try { 35 34 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 36 sql = "select distinct id_produit, title_produit, begintime_produit, endtime_produit, header_produit from produit join grille using (id_produit) where id_param = " + id_param + ";"; 37 35 sql = "select distinct id_produit, title_produit, begintime_produit, endtime_produit, header_produit, order_produit from produit join grille using (id_produit) where id_param = " + id_param + " order by order_produit;"; 38 36 ResultSet resultat = requete.executeQuery(sql); 39 37 … … 55 53 } 56 54 57 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListProduit::taille::"+liste_param.size()+"\nSQL::" + sql);58 55 return liste_param; 59 56 } … … 89 86 try { 90 87 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 91 sql = "select distinct id_produit, title_produit, begintime_produit, endtime_produit, header_produit, temporalRes_produit, name_typeproduit from produit join typeproduit using (id_typeproduit) where id_produit = " + id_produit + ";"; 88 sql = "select distinct id_produit, title_produit, begintime_produit" + 89 ", endtime_produit, header_produit, temporalRes_produit, name_typeproduit" + 90 ", textcitation_produit, useconst_produit, informpub_produit" + 91 " from produit join typeproduit using (id_typeproduit)" + 92 " where id_produit = " + id_produit + ";"; 92 93 93 94 ResultSet resultat = requete.executeQuery(sql); … … 101 102 produit.setTemporalres(CharactereHelper.getEncodage(resultat.getString("temporalRes_produit"), "ISO-8859-1")); 102 103 produit.setType(CharactereHelper.getEncodage(resultat.getString("name_typeproduit"), "ISO-8859-1")); 104 produit.setCitation(CharactereHelper.getEncodage(resultat.getString("textcitation_produit"), "ISO-8859-1")); 105 produit.setUseconst(CharactereHelper.getEncodage(resultat.getString("useconst_produit"), "ISO-8859-1")); 106 produit.setInformpub(CharactereHelper.getEncodage(resultat.getString("informpub_produit"), "ISO-8859-1")); 103 107 } 104 108 } … … 109 113 closeConnection(); 110 114 } 111 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getProduitById::nom::"+ produit.getNom() + "::date::" + produit.getBeginDate());115 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getProduitById::nom::"+ produit.getNom() + "::date::" + produit.getBeginDate()); 112 116 113 117 return produit; … … 122 126 try { 123 127 requete = conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE, ResultSet.CONCUR_READ_ONLY); 124 sql = "select distinct id_produit, title_produit, begintime_produit, endtime_produit, header_produit from produit join lienproduit using (id_produit) 128 sql = "select distinct id_produit, title_produit, begintime_produit, endtime_produit, header_produit from produit join lienproduit using (id_produit)"; 125 129 126 130 if (id_produit != null) { … … 149 153 } 150 154 151 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListProductByLink::taille::"+liste_produit.size());155 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "getListProductByLink::taille::"+liste_produit.size()); 152 156 return liste_produit; 153 157 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/jdbc/SGBD_jdbc.java
r68 r70 16 16 public SGBD_jdbc(InfoConnectBean n_info) { 17 17 con = null; 18 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "construction connection");18 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "construction connection"); 19 19 if (pooling == null) { 20 20 info = n_info; 21 LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "creation pooling :: " + info);21 // LoggerPerso.log(SGBD_jdbc.class, LoggerPerso.DEBUG, "creation pooling :: " + info); 22 22 pooling = new PGPoolingDataSource(); 23 23 pooling.setDatabaseName(info.getDb_name()); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/test/MainTest.java
r68 r70 1 1 package org.medias.eccad.persistance.test; 2 2 3 import java.util.List;4 3 5 4 import org.medias.eccad.helpers.SpringBeanFactory; 6 import org.medias.eccad.modele.Grille;7 5 import org.medias.eccad.persistance.exception.PersistanceException; 8 6 import org.medias.eccad.persistance.jdbc.GrilleTestjdbc; … … 17 15 //system.out.println(System.currentTimeMillis()); 18 16 GrilleTestjdbc grilletest = (GrilleTestjdbc) SpringBeanFactory.getXmlFactory("test").getBean("grilleDAO"); 19 List<Grille> liste = grilletest.getListGrille(27,3, "2003-11-01", "2008-01-01");17 // List<Grille> liste = grilletest.getListGrille(27,3, "2003-11-01", "2008-01-01"); 20 18 //system.out.println(System.currentTimeMillis()); 21 19 //system.out.println(liste.size()); 22 20 grilletest.connection(); 23 21 24 for (Grille grille : liste) {22 // for (Grille grille : liste) { 25 23 //grilletest.getGrilleValue(grille.getOid()); 26 }24 // } 27 25 //system.out.println(System.currentTimeMillis()); 28 26 grilletest.disconnect(); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/test/TestColorTabDAO.java
r68 r70 1 1 package org.medias.eccad.persistance.test; 2 3 import java.util.List;4 5 import org.medias.eccad.helpers.SpringBeanFactory;6 import org.medias.eccad.modele.ColorMap;7 import org.medias.eccad.modele.ColorTab;8 import org.medias.eccad.persistance.dao.CodeDAO;9 import org.medias.eccad.persistance.dao.ColorTabDAO;10 import org.medias.eccad.persistance.exception.PersistanceException;11 2 12 3 import junit.framework.TestCase; … … 19 10 20 11 public void testGetColorMapByGrille() { 21 ColorTabDAO colortabDAO = (ColorTabDAO) SpringBeanFactory.getXmlFactory("test").getBean("colorTabDAO");22 ColorTab colortab = null;23 try {24 colortab = colortabDAO.getColorMapByGrille(845767287);25 } catch (PersistanceException e) {12 // ColorTabDAO colortabDAO = (ColorTabDAO) SpringBeanFactory.getXmlFactory("test").getBean("colorTabDAO"); 13 // ColorTab colortab = null; 14 // try { 15 // colortab = colortabDAO.getColorMapByGrille(845767287); 16 // } catch (PersistanceException e) { 26 17 // TODO Auto-generated catch block 27 e.printStackTrace();28 }18 // e.printStackTrace(); 19 // } 29 20 //system.out.println(colortab.toString()); 30 21 } 31 22 32 23 public void testGetListColorMapByGrille() { 33 ColorTabDAO colortabDAO = (ColorTabDAO) SpringBeanFactory.getXmlFactory("test").getBean("colorTabDAO");34 List<ColorMap> colortab = null;35 try {36 colortab = colortabDAO.getListColorTabByGrille(10);37 } catch (PersistanceException e) {24 // ColorTabDAO colortabDAO = (ColorTabDAO) SpringBeanFactory.getXmlFactory("test").getBean("colorTabDAO"); 25 // List<ColorMap> colortab = null; 26 // try { 27 // colortab = colortabDAO.getListColorTabByGrille(10); 28 // } catch (PersistanceException e) { 38 29 // TODO Auto-generated catch block 39 e.printStackTrace();40 }30 // e.printStackTrace(); 31 // } 41 32 42 33 //system.out.println(colortab.size()); … … 45 36 46 37 public void testGetCode() { 47 CodeDAO codedao = (CodeDAO) SpringBeanFactory.getXmlFactory("test").getBean("codeDAO");48 List<String> codes = null;38 // CodeDAO codedao = (CodeDAO) SpringBeanFactory.getXmlFactory("test").getBean("codeDAO"); 39 // List<String> codes = null; 49 40 50 try {51 codes = codedao.getListCodeByGrille(845767287);52 } catch (PersistanceException e) {41 // try { 42 // codes = codedao.getListCodeByGrille(845767287); 43 // } catch (PersistanceException e) { 53 44 // TODO Auto-generated catch block 54 e.printStackTrace();55 }45 // e.printStackTrace(); 46 // } 56 47 //system.out.println(codes.toString()); 57 48 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/test/TestMetierDessin.java
r68 r70 1 1 package org.medias.eccad.persistance.test; 2 2 3 4 import org.medias.eccad.helpers.LoggerPerso;5 import org.medias.eccad.metier.ServiceMetier;6 import org.medias.eccad.modele.Zone;7 3 8 4 import junit.framework.TestCase; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/test/TestPerformance.java
r68 r70 1 1 package org.medias.eccad.persistance.test; 2 2 3 import java.sql.Date;4 import java.util.GregorianCalendar;5 import java.util.List;6 7 3 import org.medias.eccad.helpers.SpringBeanFactory; 8 import org.medias.eccad.modele.Grille;9 4 import org.medias.eccad.persistance.exception.PersistanceException; 10 5 import org.medias.eccad.persistance.jdbc.GrilleTestjdbc; … … 23 18 //system.out.println(System.currentTimeMillis()); 24 19 GrilleTestjdbc grilletest = (GrilleTestjdbc) SpringBeanFactory.getXmlFactory("test").getBean("grilleDAO"); 25 List<Grille> liste = grilletest.getListGrille(27,3, "2003-11-01", "2008-01-01");20 // List<Grille> liste = grilletest.getListGrille(27,3, "2003-11-01", "2008-01-01"); 26 21 //system.out.println(System.currentTimeMillis()); 27 22 //system.out.println(liste.size()); 28 23 grilletest.connection(); 29 24 30 for (Grille grille : liste) {25 // for (Grille grille : liste) { 31 26 //grilletest.getGrilleValue(grille.getId_grille()); 32 }27 // } 33 28 //system.out.println(System.currentTimeMillis()); 34 29 grilletest.disconnect(); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/test/TestServiceMetadata.java
r68 r70 1 1 package org.medias.eccad.persistance.test; 2 3 import org.medias.eccad.metier.ServiceMetadata;4 2 5 3 import junit.framework.TestCase; … … 13 11 14 12 public void testGetXMLTransformResult() { 15 ServiceMetadata service_meta = new ServiceMetadata();16 String xml = service_meta.getXmlMetadata(4);13 // ServiceMetadata service_meta = new ServiceMetadata(); 14 // String xml = service_meta.getXmlMetadata(4); 17 15 //system.out.println(xml); 18 16 //system.out.println(service_meta.getXMLTransformResult(xml, "metadata.xslt")); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/persistance/test/TestXmlDAOhibernate.java
r68 r70 1 1 package org.medias.eccad.persistance.test; 2 2 3 import org.medias.eccad.persistance.dao.XmlDAO;4 import org.medias.eccad.persistance.hibernate.XmlDAOhibernate;5 3 6 4 import junit.framework.TestCase; … … 13 11 14 12 public void testGetXmlByProduit() { 15 XmlDAO xmldao = new XmlDAOhibernate();13 // XmlDAO xmldao = new XmlDAOhibernate(); 16 14 //system.out.println(xmldao.getXmlByProduit(4)); 17 15 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/AbstractVueBean.java
r68 r70 10 10 */ 11 11 protected void controleSession() { 12 if (FacesContext.getCurrentInstance() == null) 12 if (FacesContext.getCurrentInstance() == null) { 13 13 throw new DeconnectionException(); 14 15 if (FacesContext.getCurrentInstance().getExternalContext() == null) 14 } 15 if (FacesContext.getCurrentInstance().getExternalContext() == null) { 16 16 throw new DeconnectionException(); 17 18 if ((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false) == null) 17 } 18 if ((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false) == null) { 19 19 throw new DeconnectionException(); 20 20 } 21 21 22 22 SessionBean sessionbean = (SessionBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("sessionBean"); 23 23 24 if (sessionbean == null) 24 if (sessionbean == null) { 25 25 throw new DeconnectionException(); 26 27 if (sessionbean.getEmail() == null || sessionbean.getEmail() == "") 26 } 27 if (sessionbean.getEmail() == null || sessionbean.getEmail() == "") { 28 28 throw new DeconnectionException(); 29 } 29 30 } 30 31 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/CarteBean.java
r68 r70 7 7 import javax.faces.component.UIInput; 8 8 import javax.faces.component.UIOutput; 9 import javax.faces.component.UISelectItem;10 9 import javax.faces.component.UISelectOne; 11 10 import javax.faces.context.FacesContext; … … 15 14 import javax.servlet.http.HttpSession; 16 15 17 18 import org.medias.eccad.helpers.LoggerPerso;19 16 import org.medias.eccad.metier.ServiceMetier; 20 17 import org.medias.eccad.metier.dessinCarte.ServiceCarte; 21 import org.medias.eccad.metier.generationRaster.ServiceRaster;22 import org.medias.eccad.metier.statistique.ServiceStatistique;23 18 import org.medias.eccad.modele.Parametre; 24 19 import org.medias.eccad.modele.Produit; 20 import org.medias.eccad.modele.Rcp; 21 import org.medias.eccad.modele.Secteur; 25 22 import org.medias.eccad.modele.StatReponse; 23 import org.medias.eccad.modele.Visualisation; 26 24 import org.medias.eccad.modele.Zone; 27 import org.medias.eccad.persistance.dao.GrilleDAO;28 import org.medias.eccad.persistance.exception.PersistanceException;29 25 import org.medias.eccad.presentation.traducteur.TraducteurCarte; 30 import org.springframework.beans.factory.xml.XmlBeanFactory;31 32 26 33 27 public class CarteBean extends AbstractVueBean { 34 28 35 private XmlBeanFactory xmlbean;36 29 // private XmlBeanFactory xmlbean; 30 37 31 private String url; 38 32 private ServiceMetier smp; 39 33 private ServiceCarte serv_carte; 40 34 private String parametre; 35 private String secteur; 36 private String rcp; 41 37 private String produit; 42 private Zone zone_affichee; 38 private String unite; 39 private Long colormapDefault; 40 private Long classdisDefault; 41 private Zone zone_demandee; 42 private Zone zone_visible; 43 43 private Zone zone_click; 44 44 private int clicX; … … 46 46 private String visu; 47 47 private String url_legend; 48 48 49 49 private UIOutput northbc; 50 50 private UIOutput southbc; 51 51 private UIOutput eastbc; 52 52 private UIOutput westbc; 53 54 private boolean gridOn; 55 private boolean statOn; 56 53 54 // private boolean gridOn; 55 // private boolean statOn; 56 private boolean showPosPixel; 57 57 58 private List<SelectItem> liste_colormap; 59 private List<SelectItem> liste_classdis; 58 60 private Long colormap_id; 61 private String colormap_txt; 62 private Long classdis_id; 59 63 private UISelectOne colormapUI; 60 64 private UISelectOne classdisUI; 65 66 private List<SelectItem> liste_region; 67 private Long region; 68 private String regionName; 69 private UISelectOne regionUI; 70 private List<SelectItem> liste_country; 71 private Long country; 72 private String countryName; 73 private UISelectOne countryUI; 74 75 private String mode; 76 private UISelectOne modeUI; 61 77 private String statistique; 62 78 private UISelectOne statistiqueUI; 79 private String total; 80 private UISelectOne totalUI; 81 private List<SelectItem> liste_mask; 82 private String mask; 83 private UISelectOne maskUI; 63 84 64 85 private int nbrGrille; 65 86 public int nbrAlt; 87 66 88 private String mapTitle; 67 89 private UIOutput mapTitleUI; 68 90 69 91 private double minParam; 70 92 private UIInput minParamUI; 71 93 private double maxParam; 72 94 private UIInput maxParamUI; 73 95 74 96 private Long nbrClasses; 75 97 private UISelectOne nbrClassesUI; 76 98 77 99 private double resolution; 78 100 79 101 private String pixelCenter; 80 private double centerLat; 81 private double centerLon; 102 private String centerLat; 103 private String centerLon; 104 private String globalSum; 82 105 private double centerLatClick; 83 106 private double centerLonClick; 84 107 85 108 private UIOutput pixelCenterUI; 86 87 109 110 private String typeCodif; 111 88 112 /** 89 113 * Initialisation de la carte … … 92 116 public CarteBean() { 93 117 controleSession(); 94 CritereBean critereBean = (CritereBean) ((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean");95 smp = critereBean.getSmp(); 118 CritereBean critereBean = (CritereBean) ((HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 119 smp = critereBean.getSmp(); 96 120 serv_carte = new ServiceCarte(); 97 121 initStatistiqueList(); … … 101 125 centerLatClick = 0; 102 126 centerLonClick = 0; 103 104 127 nbrGrille = 0; 105 }106 128 nbrAlt = 0; 129 } 107 130 108 131 /** … … 113 136 */ 114 137 public void dessinCarteInitiale(ActionEvent event) { 115 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 116 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG , "dessin initial"); 117 Produit prod = smp.getProduitById(critereBean.getProduit().intValue()); 138 CritereBean critereBean = (CritereBean) ((HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 139 Produit prod = critereBean.getProduitbean(); 118 140 initStatistiqueList(); 119 critereBean.majGrille(); 120 zone_affichee = new Zone(critereBean.getNorthbc(), critereBean.getSouthbc(), critereBean.getEastbc(), critereBean.getWestbc()); 121 nbrGrille = critereBean.getListe_grille().size(); 122 123 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG , "nbr grilles ="+nbrGrille); 124 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG , "id parametre="+critereBean.getParametre().intValue()); 141 zone_demandee = new Zone(critereBean.getNorthbc(), critereBean.getSouthbc(), critereBean.getEastbc(), critereBean.getWestbc()); 125 142 // récupération des informations sur les données 126 143 Parametre param = smp.getParametreById(critereBean.getParametre().intValue()); 127 144 parametre = param.getNom(); 145 unite = param.getUnite(); 146 Secteur sect = smp.getSecteurById((critereBean.getSector()==null?0:critereBean.getSector().intValue())); 147 secteur = sect.getNom(); 148 Rcp rc = smp.getRcpById(critereBean.getRcp().intValue()); 149 rcp = rc.getNom(); 150 colormapDefault = new Long(param.getColormapDefault()); 151 classdisDefault = new Long(param.getClassdisDefault()); 152 critereBean.majAlt(secteur); 153 critereBean.majGrille(null); 154 //System.out.println("init, date="+critereBean.getDate()+", alt="+critereBean.getAlt()+", grille="+critereBean.getGrille()); 155 nbrGrille = critereBean.getListe_grille().size(); 156 nbrAlt = (critereBean.getListe_alt()==null?0:critereBean.getListe_alt().size()-1); 157 //LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG , "nbr grilles ="+nbrGrille); 128 158 129 produit = prod.getNom(); 130 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG , "produit="+produit); 131 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG , "produit type="+prod.getType()); 132 visu = smp.getVisuByTypeProduct(prod.getType()).getPage_jsp(); 133 majColorMap(-1); 134 135 if (statistiqueUI != null) 136 statistiqueUI.setValue("none"); 137 statistique = "none"; 159 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG , "secteur int value="+critereBean.getSector().intValue()); 160 // secteur=""; 161 // if ( critereBean.getSector().intValue() > 0 ) { 162 // Secteur sec = smp.getSecteurById(critereBean.getSector().intValue()); 163 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG , "id secteur="+critereBean.getSector().intValue()); 164 // secteur = sec.getNom(); 165 // } 166 167 produit = prod.getNom(); 168 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG , "produit="+produit); 169 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG , "produit type="+prod.getType()); 170 171 Visualisation visual = smp.getVisuByTypeProduct(prod.getType()); 172 visu = visual.getPage_jsp(); 173 critereBean.majDayMonthYear(visual.getTraducteur()); 174 typeCodif = smp.getTypeCodif((critereBean.getGrille()==null?0:critereBean.getGrille().longValue())); 175 majColorMap(); 176 majClassDistribution(); 177 // statistique = "moyenneCarte"; 178 // if (statistiqueUI != null) 179 // statistiqueUI.setValue(statistique); 180 // mode = "date"; 181 // if (modeUI != null) 182 // modeUI.setValue(mode); 183 total = "totalYear"; 184 if (totalUI != null) 185 totalUI.setValue(total); 186 if (critereBean.getGrille() == null) { 187 url = "/images/nodata.png"; 188 } else { 189 resolution = serv_carte.getResolution(critereBean.getGrille().longValue()); 190 } 191 majMask(); 192 // mask = "none"; 193 // if (maskUI != null) 194 // maskUI.setValue(mask); 195 majMaskRegion(); 196 majMaskCountry(); 138 197 dessinCarte(event); 139 198 } 140 199 141 142 200 /** 143 201 * Change le mode de visualisation de statistique en normal 144 202 * @param event 145 203 */ 146 public void stopStatistique(ActionEvent event) { 147 initStatistiqueList(); 148 majColorMap(-1); 204 // public void stopStatistique(ActionEvent event) { 205 // initStatistiqueList(); 206 // majColorMap(); 207 // majClassDistribution(); 208 // CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 209 // if (critereBean.getGrille() == null) 210 // url = "/images/nodata.png"; 211 // else 212 // setImageURL(false); 213 // clicX = -1; 214 // clicY = -1; 215 // } 216 217 /** 218 * permet de savoir s'il faut modifier les échelles 219 * @param a_tester 220 * @return 221 */ 222 private boolean testChangeScale(String a_tester) { 223 return (a_tester.equals("ecartCarte") || a_tester.equals("sommeCarte") 224 || a_tester.equals("region") || a_tester.equals("country")); 225 } 226 227 /** 228 * Détermine le mode d'affichage sélectionné 229 * @param event 230 */ 231 public void selectMode(ValueChangeEvent event) { 232 if (modeUI.getValue().toString().equals("date")) { 233 mode = "date"; 234 changeGrille(null); 235 } else if (modeUI.getValue().toString().equals("stats")) { 236 mode = "stats"; 237 changeStatistique(null); 238 } else if (modeUI.getValue().toString().equals("totals")) { 239 mode = "totals"; 240 changeTotal(null); 241 } 242 // System.out.println("changemode="+mode); 243 } 244 245 /** 246 * Activer lors du changement de la statistique visualisé 247 * @param event 248 */ 249 public void changeStatistique(ValueChangeEvent event) { 149 250 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 150 if (critereBean.getGrille() == null) 251 // majColorMap(); 252 if (event != null) { 253 statistique = (String)event.getNewValue(); 254 } 255 if (testChangeScale(statistique)) { 256 majClassDistributionStat(); 257 } else { 258 majClassDistribution(); 259 } 260 261 if (critereBean.getGrille() == null) 151 262 url = "/images/nodata.png"; 152 263 else 153 setImageURL(critereBean.getGrille().longValue(), false); 264 setImageURL(false); 265 } 266 267 /** 268 * Activer lors du changement du total 269 * @param event 270 */ 271 public void changeTotal(ValueChangeEvent event) { 272 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 273 if (event != null) { 274 total = (String)event.getNewValue(); 275 } 276 majClassDistributionStat(); 277 278 if (critereBean.getGrille() == null) 279 url = "/images/nodata.png"; 280 else 281 setImageURL(false); 282 } 283 284 /** 285 * Modification de la grille sélectionnée 286 * @param event 287 */ 288 public void changeGrille(ValueChangeEvent event) { 289 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 290 // if (mode.equals("stats") && testStatistique(statistique)) { 291 // majColorMap(critereBean.getGrille().longValue()); 292 majClassDistribution(); 293 // } 294 295 // zone_affichee = new Zone(critereBean.getNorthbc(), critereBean.getSouthbc(), critereBean.getEastbc(), critereBean.getWestbc()); 296 Long idGrille; 297 if (event == null) { 298 idGrille = critereBean.getGrille(); 299 } else { 300 idGrille = (Long)event.getNewValue(); 301 critereBean.setGrille(idGrille); 302 String dateLabel; 303 if (critereBean.getProduitbean().getType().equals("temporal")) { 304 for (int num = 0; num < critereBean.getListe_grille().size(); num++) { 305 if (critereBean.getListe_grille().get(num).getValue().equals(idGrille)) { 306 dateLabel = critereBean.getListe_grille().get(num).getLabel(); 307 if (dateLabel.length() == 7) { 308 dateLabel += "-01"; 309 } else if (dateLabel.length() == 4) { 310 dateLabel += "-01-01"; 311 } 312 critereBean.setDate(dateLabel); 313 break; 314 } 315 } 316 critereBean.setDay(critereBean.getDate()); 317 critereBean.getDayUI().setValue(critereBean.getDay()); 318 critereBean.setMonth(critereBean.getDate().substring(0,7)); 319 critereBean.getMonthUI().setValue(critereBean.getMonth()); 320 critereBean.setYear(new Integer(critereBean.getDate().substring(0,4))); 321 critereBean.getYearUI().setValue(critereBean.getYear()); 322 } else { 323 for (int num = 0; num < critereBean.getListe_grille().size(); num++) { 324 if (critereBean.getListe_grille().get(num).getValue().equals(idGrille)) { 325 dateLabel = critereBean.getListe_grille().get(num).getLabel(); 326 critereBean.setDate(dateLabel); 327 break; 328 } 329 } 330 } 331 } 332 // gridOn = true; 333 // statOn = false; 334 if (idGrille == null) 335 url = "/images/nodata.png"; 336 else 337 setImageURL(false); 338 // System.out.println("changeGrille, nouvelle date="+critereBean.getDate()+", alt="+critereBean.getAlt()+", grille="+critereBean.getGrille()+", day="+critereBean.getDay()+", month="+critereBean.getMonth()+", year="+critereBean.getYear()+", grilleUI="+critereBean.getGrilleUI().getValue()); 339 } 340 341 /** 342 * Modification de l'altitude sélectionnée 343 * @param event 344 */ 345 public void changeAlt(ValueChangeEvent event) { 346 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 347 348 String alt ; 349 if (event == null) { 350 alt = critereBean.getAlt(); 351 } else { 352 alt = (String)event.getNewValue(); 353 critereBean.setAlt(alt); 354 } 355 String date = critereBean.getDate(); 356 critereBean.majGrille(date); 357 if (critereBean.getGrille() == null) 358 url = "/images/nodata.png"; 359 else 360 setImageURL(false); 361 // System.out.println("changeAlt, date="+date+", alt="+critereBean.getAlt()+", grille="+critereBean.getGrille()+", day="+critereBean.getDay()+", month="+critereBean.getMonth()+", year="+critereBean.getYear()); 362 } 363 364 /** 365 * Activer lors du changement du jour 366 * @param event 367 */ 368 public void changeDay(ValueChangeEvent event) { 369 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 370 if (event != null && mode.equals("totals")) { 371 String day = (String)event.getNewValue(); 372 critereBean.setDay(day); 373 String dateLabel; 374 for (int num = 0; num < critereBean.getListe_grille().size(); num++) { 375 dateLabel = critereBean.getListe_grille().get(num).getLabel(); 376 if (dateLabel.length() == 7) { 377 dateLabel += "-01"; 378 } else if (dateLabel.length() == 4) { 379 dateLabel += "-01-01"; 380 } 381 if (dateLabel.equals(day)) { 382 critereBean.setGrille((Long)critereBean.getListe_grille().get(num).getValue()); 383 critereBean.getGrilleUI().setValue(critereBean.getGrille()); 384 critereBean.setDate(day); 385 break; 386 } 387 } 388 critereBean.setMonth(critereBean.getDate().substring(0,7)); 389 critereBean.getMonthUI().setValue(critereBean.getMonth()); 390 critereBean.setYear(new Integer(critereBean.getDate().substring(0,4))); 391 critereBean.getYearUI().setValue(critereBean.getYear()); 392 } 393 if (critereBean.getGrille() == null) 394 url = "/images/nodata.png"; 395 else 396 setImageURL(false); 397 // System.out.println("changeDay, grille="+critereBean.getGrille()+", day="+critereBean.getDay()+", month="+critereBean.getMonth()+", year="+critereBean.getYear()); 398 } 399 400 /** 401 * Activer lors du changement du mois 402 * @param event 403 */ 404 public void changeMonth(ValueChangeEvent event) { 405 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 406 if (event != null && mode.equals("totals")) { 407 String month = (String)event.getNewValue(); 408 critereBean.setMonth(month); 409 critereBean.setYear(new Integer(month.substring(0,4))); 410 critereBean.getYearUI().setValue(critereBean.getYear()); 411 String dateLabel; 412 for (int num = 0; num < critereBean.getListe_grille().size(); num++) { 413 dateLabel = critereBean.getListe_grille().get(num).getLabel(); 414 if (dateLabel.length() == 7) { 415 dateLabel += "-01"; 416 } else if (dateLabel.length() == 4) { 417 dateLabel += "-01-01"; 418 } 419 if (dateLabel.substring(0,7).equals(month)) { 420 critereBean.setDate(dateLabel); 421 critereBean.setGrille((Long)critereBean.getListe_grille().get(num).getValue()); 422 critereBean.getGrilleUI().setValue(critereBean.getGrille()); 423 critereBean.setDay(dateLabel); 424 critereBean.getDayUI().setValue(critereBean.getDay()); 425 break; 426 } 427 } 428 } 429 if (critereBean.getGrille() == null) 430 url = "/images/nodata.png"; 431 else 432 setImageURL(false); 433 // System.out.println("changeMonth, grille="+critereBean.getGrille()+", day="+critereBean.getDay()+", month="+critereBean.getMonth()+", year="+critereBean.getYear()); 434 } 435 436 /** 437 * Activer lors du changement de l'année 438 * @param event 439 */ 440 public void changeYear(ValueChangeEvent event) { 441 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 442 if (event != null && mode.equals("totals")) { 443 Integer year = (Integer)event.getNewValue(); 444 critereBean.setYear(year); 445 String dateLabel; 446 for (int num = 0; num < critereBean.getListe_grille().size(); num++) { 447 dateLabel = critereBean.getListe_grille().get(num).getLabel(); 448 if (dateLabel.length() == 7) { 449 dateLabel += "-01"; 450 } else if (dateLabel.length() == 4) { 451 dateLabel += "-01-01"; 452 } 453 if (Integer.parseInt(dateLabel.substring(0,4)) == year.intValue()) { 454 critereBean.setDate(dateLabel); 455 critereBean.setGrille((Long)critereBean.getListe_grille().get(num).getValue()); 456 critereBean.getGrilleUI().setValue(critereBean.getGrille()); 457 critereBean.setDay(dateLabel); 458 critereBean.getDayUI().setValue(critereBean.getDay()); 459 critereBean.setMonth(critereBean.getDate().substring(0,7)); 460 critereBean.getMonthUI().setValue(critereBean.getMonth()); 461 break; 462 } 463 } 464 } 465 if (critereBean.getGrille() == null) 466 url = "/images/nodata.png"; 467 else 468 setImageURL(false); 469 // System.out.println("changeYear, grille="+critereBean.getGrille()+", day="+critereBean.getDay()+", month="+critereBean.getMonth()+", year="+critereBean.getYear()); 470 } 471 472 /** 473 * Modification du masque 474 * @param event 475 */ 476 public void changeMask(ValueChangeEvent event) { 477 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 478 if (event != null) { 479 mask = (String)event.getNewValue(); 480 } 481 // if (testChangeScale(mask)) { 482 // majClassDistributionStat(); 483 // } else { 484 // majClassDistribution(); 485 // } 486 if (mask.equals("region")) { 487 majMaskRegion(); 488 } else if (mask.equals("country")) { 489 majMaskCountry(); 490 } 491 if (critereBean.getGrille() == null) 492 url = "/images/nodata.png"; 493 else 494 setImageURL(false); 495 } 496 497 /** 498 * Modification de la région sélectionnée 499 * @param event 500 */ 501 public void changeRegion(ValueChangeEvent event) { 502 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 503 if (event != null) { 504 region = (Long)event.getNewValue(); 505 for (SelectItem si: liste_region) { 506 if (region.equals(si.getValue())) { 507 regionName = si.getLabel(); 508 break; 509 } 510 } 511 } 512 if (critereBean.getGrille() == null) 513 url = "/images/nodata.png"; 514 else 515 setImageURL(false); 516 } 517 518 /** 519 * Modification du pays sélectionné 520 * @param event 521 */ 522 public void changeCountry(ValueChangeEvent event) { 523 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 524 if (event != null) { 525 country = (Long)event.getNewValue(); 526 for (SelectItem si: liste_country) { 527 if (country.equals(si.getValue())) { 528 countryName = si.getLabel(); 529 break; 530 } 531 } 532 } 533 if (critereBean.getGrille() == null) 534 url = "/images/nodata.png"; 535 else 536 setImageURL(false); 537 } 538 539 /** 540 * Modification de la colormap 541 * @param event 542 */ 543 public void changeColormap(ValueChangeEvent event) { 544 if (event != null) { 545 colormap_id = (Long)event.getNewValue(); 546 } 547 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 548 if (critereBean.getGrille() == null) 549 url = "/images/nodata.png"; 550 else 551 setImageURL(false); 154 552 clicX = -1; 155 553 clicY = -1; 156 554 } 157 158 /** 159 * permet de savoir si les statistiques font partie d'une exception (par exemple si elles vont utiliser une colormap dynamique) 160 * il faudrai modifier cela car ce n'est pas propre du tout 161 * de plus il faut penser à le modifier au niveau du service carte dans la fonction getLegendStat 162 * @param a_tester 163 * @return 164 */ 165 private boolean testStatistique(String a_tester) { 166 return (a_tester.equals("ecartCarte") || a_tester.equals("moyenneCarte") || a_tester.equals("sommeCarte")); 167 } 168 169 /** 170 * Activer lors du changement de la statistique visualisé 171 * @param event 172 */ 173 public void changeStatistique(ValueChangeEvent event) { 174 LoggerPerso.log(CarteBean.class,LoggerPerso.DEBUG, "change statistique"); 175 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 176 177 if (testStatistique(statistiqueUI.getValue().toString())) 178 majColorMapStat(); 179 else 180 if (testStatistique(statistique)) 181 majColorMap(critereBean.getGrille().longValue()); 182 183 if (critereBean.getGrille() == null) 555 556 public void changeClassdis(ValueChangeEvent event) { 557 if (event != null) { 558 classdis_id = (Long)event.getNewValue(); 559 } 560 CritereBean critereBean = (CritereBean) ((HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 561 if (critereBean.getGrille() == null) 184 562 url = "/images/nodata.png"; 185 563 else 186 setImageURL(critereBean.getGrille().longValue(), false); 187 } 188 189 /** 190 * Modification de la grille sélectionnée 191 * @param event 192 */ 193 public void dessinCarte(ValueChangeEvent event) { 194 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 195 196 if (testStatistique(statistique)) 197 majColorMap(critereBean.getGrille().longValue()); 198 199 zone_affichee = new Zone(critereBean.getNorthbc(), critereBean.getSouthbc(), critereBean.getEastbc(), critereBean.getWestbc()); 200 critereBean.setGrille((Long)event.getNewValue()); 201 202 initStatistiqueList(); 203 204 setImageURL((Long)event.getNewValue(), false); 205 } 206 207 208 209 564 setImageURL(false); 565 clicX = -1; 566 clicY = -1; 567 } 568 210 569 /** 211 570 * Modification de la colormap 212 571 * @param event 213 572 */ 214 public void changeColormap(ValueChangeEvent event) {573 /* public void changeColormapDynamic(ValueChangeEvent event) { 215 574 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 216 if (critereBean.getGrille() == null) 575 if (critereBean.getGrille() == null) 217 576 url = "/images/nodata.png"; 218 577 else 219 setImageURL(critereBean.getGrille().longValue(), false); 220 578 setImageURL(false); 221 579 clicX = -1; 222 580 clicY = -1; 223 } 224 225 /** 226 * Modification de la colormap581 }*/ 582 583 /** 584 * Sur clique sur la carte 227 585 * @param event 228 586 */ 229 public void changeColormapDynamic(ValueChangeEvent event) {587 public void dessinCarte(ActionEvent event) { 230 588 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 231 if (critereBean.getGrille() == null) 232 url = "/images/nodata.png"; 233 else 234 setImageURL(critereBean.getGrille().longValue(), false); 235 589 if (critereBean.getGrille() != null) { 590 // url = "/images/nodata.png"; 591 // } else { 592 // init resol 593 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "get grille value ="+critereBean.getGrille().longValue()); 594 // resolution = serv_carte.getResolution(critereBean.getGrille().longValue()); 595 //System.out.println("zoom ou unzoom, date="+critereBean.getDate()+", alt="+critereBean.getAlt()+", grille="+critereBean.getGrille()+", day="+critereBean.getDay()+", month="+critereBean.getMonth()+", year="+critereBean.getYear()); 596 setImageURL(true); 597 } 598 236 599 clicX = -1; 237 600 clicY = -1; 238 601 } 239 240 /** 241 * Sur clique sur la carte 242 * @param event 243 */ 244 public void dessinCarte(ActionEvent event) { 245 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 246 if (critereBean.getGrille() == null) 247 url = "/images/nodata.png"; 248 else{ 249 //init resol 250 resolution = serv_carte.getResolution(critereBean.getGrille().longValue()); 251 setImageURL(critereBean.getGrille().longValue(), true); 252 } 253 clicX = -1; 254 clicY = -1; 255 } 256 602 603 /** 604 * permet de charger les types de masques 605 */ 606 private void majMask() { 607 liste_mask = new LinkedList<SelectItem>(); 608 liste_mask.add(new SelectItem("none", "None")); 609 if (resolution == 0.5) { 610 liste_mask.add(new SelectItem("region","Region")); 611 liste_mask.add(new SelectItem("country","Country")); 612 } 613 mask = "none"; 614 if (maskUI != null) 615 maskUI.setValue(mask); 616 } 617 618 /** 619 * permet de charger les masques des régions 620 */ 621 private void majMaskRegion() { 622 liste_region = smp.getListRegion(); 623 if (liste_region.size() != 0) { 624 region = (Long)liste_region.get(0).getValue(); 625 regionName = liste_region.get(0).getLabel(); 626 if (regionUI != null) 627 regionUI.setValue(region); 628 } 629 } 630 631 /** 632 * permet de charger les masques des pays 633 */ 634 private void majMaskCountry() { 635 liste_country = smp.getListCountry(); 636 if (liste_country.size() != 0) { 637 country = (Long)liste_country.get(0).getValue(); 638 countryName = liste_region.get(0).getLabel(); 639 if (countryUI != null) 640 countryUI.setValue(country); 641 } 642 } 643 257 644 /** 258 645 * permet de charger la colormap en fonction de la grille visualisée 259 * @param oid l'identifiant de la grille 260 */ 261 private void majColorMap(long identifiant) { 262 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 263 if (identifiant == -1 && critereBean.getGrille() != null) 264 identifiant = critereBean.getGrille().intValue(); 265 266 liste_colormap = smp.getListMappingColor(identifiant); 267 646 */ 647 private void majColorMap() { 648 // CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 649 // if (identifiant == -1 && critereBean.getGrille() != null) 650 // identifiant = critereBean.getGrille().intValue(); 651 652 liste_colormap = smp.getListMappingColor(); 653 268 654 if (liste_colormap.size() != 0) { 269 colormap_id = (Long) liste_colormap.get(0).getValue(); 655 colormap_id = colormapDefault; 656 for (int num_col = 0; num_col < liste_colormap.size(); num_col++) { 657 if ( Long.parseLong(liste_colormap.get(num_col).getValue().toString()) == colormap_id.longValue() ) { 658 colormap_txt = liste_colormap.get(num_col).getLabel(); 659 break; 660 } 661 } 662 // colormap_id = (Long) liste_colormap.get(0).getValue(); 270 663 if (colormapUI != null) 271 664 colormapUI.setValue(colormap_id); 272 665 } 273 666 } 274 667 668 private void majClassDistribution() { 669 CritereBean critereBean = (CritereBean) ((HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 670 671 // récupération des informations sur les données 672 Parametre param = smp.getParametreById(critereBean.getParametre().intValue()); 673 674 liste_classdis = smp.getListClassDistribution(param.getIdentifiant()); 675 676 if (liste_classdis.size() != 0) { 677 boolean trouve = false; 678 // On recherche l'échelle de valeur déjà sélectionnée dans la liste 679 // Si on ne le trouve pas, on prend l'echelle par défaut 680 // Si on le trouve, on conserve la même echelle 681 for (int i=0; !trouve && i<liste_classdis.size();i++) { 682 if (liste_classdis.get(i).getValue().equals(classdis_id)) { 683 trouve = true; 684 } 685 } 686 if (!trouve) 687 classdis_id = classdisDefault; 688 // classdis_id = (Long) liste_classdis.get(0).getValue(); 689 if (classdisUI != null) 690 classdisUI.setValue(classdis_id); 691 } 692 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "distrib ID !!! :: " + classdis_id); 693 } 694 275 695 /** 276 696 * Permet d'obtenir les colormaps disponible pour les statistiques 277 697 * 278 698 */ 279 private void majColorMapStat() {280 // FIXME : normalement il faudrai que la base de donnée retourne les colormaps qui correspondent au produit utilisé... 281 liste_colormap = smp.getListColorDynamique(); 699 /* private void majColorMapStat() { 700 // FIXME : normalement il faudrai que la base de donnée retourne les colormaps qui correspondent au produit utilisé... 701 liste_colormap = smp.getListColorDynamique();*/ 282 702 /*SelectItem temp = null; 283 if (testStatistique(statistique UI.getValue().toString())) {703 if (testStatistique(statistique)) { 284 704 for (SelectItem iterable_element : liste_colormap) { 285 705 if (iterable_element.getLabel().equalsIgnoreCase("logarithm")) … … 293 713 liste_colormap.add(temp); 294 714 }*/ 295 296 297 if (liste_colormap.size() != 0) {298 colormap_id = (Long) liste_colormap.get(0).getValue();715 716 /* if (liste_colormap.size() != 0) { 717 colormap_id = colormapDefault; 718 // colormap_id = (Long) liste_colormap.get(0).getValue(); 299 719 if (colormapUI != null) 300 720 colormapUI.setValue(colormap_id); 301 721 } 722 }*/ 723 724 private void majClassDistributionStat() { 725 liste_classdis = smp.getListClassDynamique(); 726 727 if (liste_classdis.size() != 0) { 728 boolean trouve = false; 729 for (int i=0; !trouve && i<liste_classdis.size();i++) { 730 if (liste_classdis.get(i).getValue().equals(classdis_id)) { 731 trouve = true; 732 } 733 } 734 if (!trouve) 735 classdis_id = (Long) liste_classdis.get(1).getValue(); 736 if (classdisUI != null) 737 classdisUI.setValue(classdis_id); 738 } 302 739 } 303 740 … … 308 745 private String getIdUnique() { 309 746 HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false); 310 if (session ==null)747 if (session == null) 311 748 return ""; 312 313 String imageID; 314 315 316 imageID = session.getId() + session.getLastAccessedTime() ; 317 749 String imageID = session.getId() + session.getLastAccessedTime(); 318 750 return imageID; 319 751 } 320 752 321 753 /** 322 754 * Permet de générer l'image. 323 755 * Cette fonction détecte s'il s'agit d'une statistique ou d'une carte normale, leur traitement sera différent par la suite 324 756 * @param id_grille de la grille 325 * @param updateAffichedétermine si la zone affichée sera mise à jour ou non (zoom, déplacement, etc...)326 */ 327 private void setImageURL( Long id_grille, boolean updateAffiche) {757 * @param firstAff détermine si la zone affichée sera mise à jour ou non (zoom, déplacement, etc...) 758 */ 759 private void setImageURL(boolean firstAff) { 328 760 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 761 Long id_grille = critereBean.getGrille(); 329 762 if (smp == null) { 330 763 smp = critereBean.getSmp(); 331 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "smp null dans setImageURL"); 332 } 333 334 if (statistique.equals("none")) 335 mapTitle = parametre + " : " + produit; 336 else 337 mapTitle = "statistics on " + parametre + " : " + produit; 338 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "mapTitleUI :: " + mapTitleUI); 339 if (mapTitleUI != null) 340 mapTitleUI.setValue(mapTitle); 341 342 if (colormapUI != null) 343 colormap_id = (Long) colormapUI.getValue(); 344 if (colormap_id == null) 345 colormap_id = new Long(-1); 346 347 348 Zone zone_selection = new Zone(critereBean.getNorthbc(), critereBean.getSouthbc(), critereBean.getEastbc(), critereBean.getWestbc()); 349 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "\nstatistiqueUI="+statistiqueUI); 350 if (statistiqueUI != null && !statistiqueUI.getValue().toString().equals("none")) { 351 gridOn = false; 352 statOn = true; 353 gestionCarteStat(updateAffiche); 354 355 356 zone_affichee = serv_carte.getCarteCoordinate(); 357 358 359 } 360 else { 361 gridOn = true; 362 statOn = false; 363 if (clicX != -1 && clicY != -1) 364 makeZoom(id_grille, getIdUnique(), resolution); 365 else { 366 367 368 //pixelCenterUI.setValue(pixelCenter); 369 370 if (updateAffiche) {//=========================== ici 371 url =serv_carte.getCarte(id_grille, colormap_id.longValue(), zone_selection, getIdUnique()).getUrlImage(); 372 764 } 765 setTitleMap(critereBean); 766 767 // if (colormapUI != null) 768 // colormap_id = (Long) colormapUI.getValue(); 769 // if (colormap_id == null) 770 // colormap_id = new Long(-1); 771 772 // if (classdisUI != null) 773 // classdis_id = (Long) classdisUI.getValue(); 774 // if (classdis_id == null) 775 // classdis_id = new Long(-1); 776 //System.out.println("setImageURL->mode="+mode+", modeUI="+(modeUI==null?"null":modeUI.getValue())+", stats="+statistique+", statsUI="+(statistiqueUI==null?"null":statistiqueUI.getValue())+", grille="+id_grille); 777 if (mode.equals("stats")) { 778 // gridOn = false; 779 // statOn = true; 780 gestionCarteStat(firstAff); 781 } else if (mode.equals("totals")) { 782 // gridOn = false; 783 // statOn = true; 784 gestionCarteTotal(firstAff); 785 } else { 786 // gridOn = true; 787 // statOn = false; 788 String idUnique = getIdUnique(); 789 boolean zoom = false; 790 if (clicX != -1 && clicY != -1) { 791 makeZoom(id_grille, idUnique, resolution); 792 zoom = true; 793 } else { 794 // pixelCenterUI.setValue(pixelCenter); 795 if (firstAff) { 373 796 centerLatClick = 0; 374 797 centerLonClick = 0; 375 798 } 376 else{ 377 url = serv_carte.getCarte(id_grille, colormap_id.longValue(), null, getIdUnique()).getUrlImage(); 378 379 } 380 381 } 382 url_legend = serv_carte.getLegend(id_grille, colormap_id.longValue()); 383 384 385 386 zone_affichee = serv_carte.getCarteCoordinate(); 387 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "************DEBUT " + id_grille); 388 389 390 391 zone_click = new Zone(centerLatClick, centerLatClick , centerLonClick, centerLonClick); 392 393 StatReponse statReponse = serv_carte.getStatReponse(id_grille, colormap_id.longValue(), zone_click); 394 395 String aPixelCenter = (String)Double.toString(statReponse.getCenter()); 396 397 398 pixelCenter = fixeDecimal(aPixelCenter); 399 centerLat = statReponse.getCenterLat(); 400 centerLon = statReponse.getCenterLon(); 401 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "***********pixelCenter :: " +pixelCenter); 402 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "***********centerLat :: " +centerLat ); 403 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "***********centerLon :: " +centerLon); 404 405 } 406 799 } 800 StatReponse statReponse = serv_carte.getCarte(id_grille, colormap_id.longValue(), classdis_id.longValue(), zone_demandee, idUnique, produit, critereBean.getSector().longValue(), zoom, firstAff, getMaskId()); 801 802 url = statReponse.getUrlImage(); 803 url_legend = serv_carte.getLegend(id_grille,colormap_id.longValue(),classdis_id.longValue()); 804 805 //System.out.println("*** latclick="+centerLatClick+", lonclick="+centerLonClick); 806 zone_click = new Zone(centerLatClick, centerLatClick, centerLonClick, centerLonClick); 807 statReponse = serv_carte.getStatReponse(id_grille,colormap_id.longValue(), classdis_id.longValue(), zone_click, produit, critereBean.getSector().longValue(), getMaskId()); 808 // On n'affiche la valeur du pixel cliqué que lors d'un clic sur la carte 809 //ou bien lors d'un recalcul d'un point déjà cliqué 810 if ((clicX != -1 && clicY != -1) || (!firstAff && !pixelCenter.equals(""))) { 811 showPosPixel = true; 812 String aPixelCenter = Double.toString(statReponse.getCenter()); 813 pixelCenter = fixeDecimal(aPixelCenter); 814 centerLat = String.valueOf(statReponse.getCenterLat()); 815 centerLon = String.valueOf(statReponse.getCenterLon()); 816 } else if (firstAff){ 817 showPosPixel = false; 818 pixelCenter = ""; 819 centerLat = ""; 820 centerLon = ""; 821 } 822 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "***********pixelCenter :: " + pixelCenter); 823 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "***********centerLat :: " + centerLat); 824 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "***********centerLon :: " + centerLon); 825 } 826 zone_visible = serv_carte.getCarteCoordinate(); 827 // System.out.println("zone demandée="+zone_demandee); 828 // System.out.println("zone visible="+zone_visible); 407 829 if (northbc != null) { 408 northbc.setValue(zone_affichee.getNorthbcN()); 409 southbc.setValue(zone_affichee.getSouthbcN()); 410 eastbc.setValue(zone_affichee.getEastbcN()); 411 westbc.setValue(zone_affichee.getWestbcN()); 412 } 413 414 415 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "zonnnnnnnnnnnnnnnnnnnnnnnne affichee: getEastbcN "+ zone_affichee.getEastbcN()); 416 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "zonnnnnnnnnnnnnnnnnnnnnnnne affichee: getWestbcN "+ zone_affichee.getWestbcN()); 417 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "zonnnnnnnnnnnnnnnnnnnnnnnne affichee: getNorthbcN "+ zone_affichee.getNorthbcN()); 418 LoggerPerso.log(LoggerPerso.class, LoggerPerso.DEBUG, "zonnnnnnnnnnnnnnnnnnnnnnnne affichee: getSouthbcN "+ zone_affichee.getSouthbcN()); 419 420 421 //pixelCenter = serv_carte.getCarte(id_grille, colormap_id, zone_affichee, getIdUnique()+1).getCenter(); 422 //LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "pixelCenter zoom :: " + pixelCenter); 423 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "************setImageURL.zone :: " + zone_affichee); 424 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "************FIN " ); 425 426 } 427 830 northbc.setValue(zone_demandee.getNorthbcN()); 831 southbc.setValue(zone_demandee.getSouthbcN()); 832 eastbc.setValue(zone_demandee.getEastbcN()); 833 westbc.setValue(zone_demandee.getWestbcN()); 834 } 835 // pixelCenter = serv_carte.getCarte(id_grille, colormap_id, zone_affichee, getIdUnique()+1).getCenter(); 836 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "pixelCenter zoom :: " + pixelCenter); 837 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "zone :: " + zone_affichee); 838 } 839 840 /** 841 * Permet de définir le titre de la carte 842 */ 843 public void setTitleMap(CritereBean critereBean) { 844 String modeDisplay = ""; 845 if (secteur.equals("Aviation")) { 846 modeDisplay += ", "+(critereBean.getAlt().equals("Sum")?"sum altitude":critereBean.getAlt()+" km"); 847 } 848 if (mode.equals("date")) { 849 modeDisplay += ", "+critereBean.getDate(); 850 } else if (mode.equals("stats")) { 851 modeDisplay += ", statistics"; 852 if (statistique.equals("moyenneCarte")) { 853 modeDisplay += " - mean"; 854 } else if (statistique.equals("ecartCarte")) { 855 modeDisplay += " - standard deviation"; 856 } else if (statistique.equals("minimumCarte")) { 857 modeDisplay += " - minimum"; 858 } else if (statistique.equals("maximumCarte")) { 859 modeDisplay += " - maximum"; 860 } else if (statistique.equals("sommeCarte")) { 861 modeDisplay += " - sum"; 862 } 863 } else { 864 modeDisplay += ", totals"; 865 if (total.equals("totalDay")) { 866 modeDisplay += " over day "+critereBean.getDay(); 867 } else if (total.equals("totalMonth")) { 868 modeDisplay += " over month "+critereBean.getMonth(); 869 } else if (total.equals("totalYear")) { 870 modeDisplay += " over year "+critereBean.getYear(); 871 } else if (total.equals("totalPeriod")) { 872 modeDisplay += " over period from "+critereBean.getBegDate()+" to "+critereBean.getEndDate(); 873 } 874 } 875 if (mask.equals("region")) { 876 modeDisplay += ", mask: "+regionName; 877 } else if (mask.equals("country")) { 878 modeDisplay += ", mask: "+countryName; 879 } 880 if (produit.equals("IPCC")) { 881 if (!rcp.equals("None")) { 882 mapTitle = produit+": "+parametre + ", "+secteur + ", RCP "+rcp + modeDisplay; 883 } else { 884 mapTitle = produit+": "+parametre + ", "+secteur + modeDisplay; 885 } 886 } else { 887 mapTitle = produit+": "+parametre+modeDisplay; 888 } 889 890 if (mapTitleUI != null) 891 mapTitleUI.setValue(mapTitle); 892 } 893 428 894 /** 429 895 * Permet de zoomer … … 432 898 */ 433 899 public void makeZoom(long id_grille, String imageID, double resol) { 434 435 /*StatReponse statReponse = serv_carte.getCarte(id_grille, colormap_id.longValue(), zone_selection, getIdUnique());900 901 /* StatReponse statReponse = serv_carte.getCarte(id_grille, colormap_id.longValue(), zone_selection, getIdUnique()); 436 902 pixelCenter = statReponse.getCenter(); 437 903 centerLat = statReponse.getCenterLat(); 438 904 centerLon = statReponse.getCenterLon();*/ 439 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "-------------------------------------------> clicX :: " +clicX);440 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "-------------------------------------------> clicY :: " + clicY);441 442 Zone aZone = serv_carte.getCarteCoordinate();443 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "-------------------------------------------> getEastbc :: " +aZone.getEastbc());444 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "-------------------------------------------> getNorthbc :: " +aZone.getNorthbc());445 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "-------------------------------------------> getSouthbc :: " +aZone.getSouthbc());446 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "-------------------------------------------> getWestbc :: " +aZone.getWestbc());905 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "-------------------------------------------> clicX :: " + clicX); 906 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "-------------------------------------------> clicY :: " + clicY); 907 908 // Zone aZone = serv_carte.getCarteCoordinate(); 909 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "-------------------------------------------> getEastbc :: " + aZone.getEastbc()); 910 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "-------------------------------------------> getNorthbc :: " + aZone.getNorthbc()); 911 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "-------------------------------------------> getSouthbc :: " + aZone.getSouthbc()); 912 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "-------------------------------------------> getWestbc :: " + aZone.getWestbc()); 447 913 448 914 serv_carte.zoomCarte(2, clicX, clicY, resol); 449 url = serv_carte.getCarte(id_grille, colormap_id, null, imageID).getUrlImage(); 450 } 451 915 } 916 452 917 /** 453 918 * Permet de générer une carte statistique 454 * @param updateAffiche permet de savoir si la zone visualisé doit être modifié ou non 455 */ 456 public void gestionCarteStat(boolean updateAffiche) {919 * @param updateAffiche permet de savoir si la zone visualisé doit être modifié ou non 920 */ 921 public void gestionCarteStat(boolean firstAff) { 457 922 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 923 String alt = (critereBean.getAlt()==null?"0":critereBean.getAlt()); 458 924 /* 459 * Traduction des paramà ªtres... Bon ça serai mieux de faire ça dans un traducteur dédié quand même :)925 * Traduction des paramÚtres... Bon ça serai mieux de faire ça dans un traducteur dédié quand même :) 460 926 */ 461 927 Map<String, String> critere = new TraducteurCarte().tradCritere2Stat(critereBean, this); 462 Long id_param = critereBean.getParametre(); 463 Long id_produit = critereBean.getProduit(); 464 Zone zone_selection = new Zone(critereBean.getNorthbc(), critereBean.getSouthbc(), critereBean.getEastbc(), critereBean.getWestbc()); 465 466 String url_retourne; 928 long id_param = critereBean.getParametre().longValue(); 929 long id_produit = critereBean.getProduit().longValue(); 930 long id_secteur = (critereBean.getSector()==null?0:critereBean.getSector().longValue()); 931 long id_rcp = critereBean.getRcp().longValue(); 932 933 StatReponse statReponse; 934 String idUnique = getIdUnique(); 935 boolean zoom = false; 467 936 if (clicX != -1 && clicY != -1) { // en cas de zoom 468 937 serv_carte.zoomCarte(2, clicX, clicY, resolution); 469 url_retourne = serv_carte.getCarteStat(critere, id_param, id_produit, getColormap_id(), getStatistiqueUI().getValue().toString(), getIdUnique(), null).getUrlImage(); 470 471 472 473 } 474 else if (updateAffiche) { // sans zoom mais on fait un update sur la zone affiché (on revient sur la zone sélectionnée) 475 Map<String, String> critere2 = new TraducteurCarte().tradCritere2StatReinit(critereBean, this); 476 url_retourne = serv_carte.getCarteStat(critere2, id_param, id_produit, getColormap_id(), getStatistiqueUI().getValue().toString(), getIdUnique(), zone_selection).getUrlImage(); 477 478 centerLatClick = 0; 479 centerLonClick = 0; 480 } 481 else // sans zoom et on reste sur la zone actuellement visible 482 url_retourne = serv_carte.getCarteStat(critere, id_param, id_produit, getColormap_id(), getStatistiqueUI().getValue().toString(), getIdUnique(), null).getUrlImage(); 483 484 485 486 ////system.out.println(url_retourne); 487 clicX = -1; 488 clicY = -1; 489 490 url = url_retourne; 491 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "::CarteBean::ChangeStatistique::ok::\n" + critere + "::" + id_param + "::" + id_produit + "::" + getStatistiqueUI().getValue().toString()); 492 url_legend = serv_carte.getLegendStat(critereBean.getGrille().longValue(), colormap_id.longValue(), getStatistiqueUI().getValue().toString(), getIdUnique()); 493 if (mapTitleUI != null) 494 mapTitleUI.setValue("statitics on " + parametre + " : " + produit); 495 mapTitle = "statitics on " + parametre + " : " + produit; 496 938 zoom = true; 939 // } else if (updateAffiche) { // sans zoom mais on fait un update sur la zone affiché (on revient sur la zone sélectionnée) 940 // Map<String, String> critere2 = new TraducteurCarte().tradCritere2StatReinit(critereBean, this); 941 // statReponse = serv_carte.getCarteStat(critere, id_param, id_produit, colormap_id.longValue(),classdis_id.longValue(), id_secteur, id_rcp, statistique, idUnique, zone_selection); 942 // centerLatClick = 0; 943 // centerLonClick = 0; 944 } else { 945 if (firstAff) { 946 centerLatClick = 0; 947 centerLonClick = 0; 948 } 949 } 950 statReponse = serv_carte.getCarteStat(critere, id_param, id_produit, colormap_id.longValue(),classdis_id.longValue(), id_secteur, id_rcp, alt,statistique, idUnique, zone_demandee, zoom, firstAff, getMaskId()); 951 // clicX = -1; 952 // clicY = -1; 953 954 url = statReponse.getUrlImage(); 955 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "::CarteBean::ChangeStatistique::ok::\n" + critere + "::" + id_param + "::" + id_produit + "::" + statistique); 956 url_legend = serv_carte.getLegendStat(critereBean.getGrille().longValue(), colormap_id.longValue(),classdis_id.longValue(), statistique, idUnique); 957 497 958 ///initialisation du pixel du centre de la zone 498 499 500 zone_affichee = serv_carte.getCarteCoordinate(); 501 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "************DEBUT " ); 959 // zone_affichee = serv_carte.getCarteCoordinate(); 960 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "************DEBUT "); 502 961 CritereBean critereBeanProvisoire = new CritereBean(); 503 962 critereBeanProvisoire.setBegDate(critereBean.getBegDate()); 504 963 critereBeanProvisoire.setEndDate(critereBean.getEndDate()); 505 506 Zone zone_click = new Zone(centerLatClick, centerLatClick 507 964 965 Zone zone_click = new Zone(centerLatClick, centerLatClick, centerLonClick, centerLonClick); 966 508 967 critereBeanProvisoire.setEastbc(zone_click.getEastbc()); 509 968 critereBeanProvisoire.setWestbc(zone_click.getWestbc()); 510 969 critereBeanProvisoire.setNorthbc(zone_click.getNorthbc()); 511 970 critereBeanProvisoire.setSouthbc(zone_click.getSouthbc()); 512 971 513 972 Map<String, String> critereProvisoire = new TraducteurCarte().tradCritere2StatReinit(critereBeanProvisoire, this); 514 515 StatReponse statReponse = serv_carte.getStatReponse(critereProvisoire, id_param, id_produit, getColormap_id(), getStatistiqueUI().getValue().toString(), getIdUnique(), null); 516 517 518 String aPixelCenter = (String)Double.toString(statReponse.getCenter()); 519 520 pixelCenter = fixeDecimal(aPixelCenter); 521 centerLat = statReponse.getCenterLat(); 522 centerLon = statReponse.getCenterLon(); 523 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "***********pixelCenter stat :: " +pixelCenter); 524 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "***********centerLat stat :: " +centerLat ); 525 LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "***********centerLon stat :: " +centerLon); 973 statReponse = serv_carte.getStatReponse(critereProvisoire, id_param, id_produit, colormap_id.longValue(), classdis_id.longValue(), id_secteur, id_rcp, alt, statistique, getMaskId()); 974 975 // On n'affiche la valeur du pixel cliqué que lors d'un clic sur la carte 976 //ou bien lors d'un recalcul d'un point déjà cliqué 977 if ((clicX != -1 && clicY != -1) || (!firstAff && !pixelCenter.equals(""))) { 978 showPosPixel = true; 979 String aPixelCenter = Double.toString(statReponse.getCenter()); 980 pixelCenter = fixeDecimal(aPixelCenter); 981 centerLat = String.valueOf(statReponse.getCenterLat()); 982 centerLon = String.valueOf(statReponse.getCenterLon()); 983 } else if (firstAff){ 984 showPosPixel = false; 985 pixelCenter = ""; 986 centerLat = ""; 987 centerLon = ""; 988 } 989 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "***********pixelCenter stat :: " + pixelCenter); 990 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "***********centerLat stat :: " + centerLat); 991 // LoggerPerso.log(CarteBean.class, LoggerPerso.DEBUG, "***********centerLon stat :: " + centerLon); 992 } 993 994 /** 995 * Permet de générer une carte de totaux 996 * @param updateAffiche permet de savoir si la zone visualisé doit être modifié ou non 997 */ 998 public void gestionCarteTotal(boolean firstAff) { 999 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 1000 String alt = (critereBean.getAlt()==null?"0":critereBean.getAlt()); 1001 Map<String, String> critere = new TraducteurCarte().tradCritere2Total(critereBean, this); 1002 long id_param = critereBean.getParametre().longValue(); 1003 long id_produit = critereBean.getProduit().longValue(); 1004 long id_secteur = (critereBean.getSector()==null?0:critereBean.getSector().longValue()); 1005 long id_rcp = critereBean.getRcp().longValue(); 1006 1007 StatReponse statReponse; 1008 String idUnique = getIdUnique(); 1009 boolean zoom = false; 1010 if (clicX != -1 && clicY != -1) { // en cas de zoom 1011 serv_carte.zoomCarte(2, clicX, clicY, resolution); 1012 zoom = true; 1013 } else { 1014 if (firstAff) { 1015 centerLatClick = 0; 1016 centerLonClick = 0; 1017 } 1018 } 1019 statReponse = serv_carte.getCarteStat(critere, id_param, id_produit, colormap_id.longValue(),classdis_id.longValue(), id_secteur, id_rcp, alt, total, idUnique, zone_demandee, zoom, firstAff, getMaskId()); 1020 String sumStr = Double.toString(statReponse.getGlobalSum()); 1021 globalSum = fixeDecimal(sumStr); 1022 url = statReponse.getUrlImage(); 1023 url_legend = serv_carte.getLegendStat(critereBean.getGrille().longValue(), colormap_id.longValue(),classdis_id.longValue(), total, idUnique); 1024 1025 ///initialisation du pixel du centre de la zone 1026 // zone_affichee = serv_carte.getCarteCoordinate(); 1027 CritereBean critereBeanProvisoire = new CritereBean(); 1028 critereBeanProvisoire.setBegDate(critereBean.getBegDate()); 1029 critereBeanProvisoire.setEndDate(critereBean.getEndDate()); 1030 1031 Zone zone_click = new Zone(centerLatClick, centerLatClick, centerLonClick, centerLonClick); 1032 1033 critereBeanProvisoire.setEastbc(zone_click.getEastbc()); 1034 critereBeanProvisoire.setWestbc(zone_click.getWestbc()); 1035 critereBeanProvisoire.setNorthbc(zone_click.getNorthbc()); 1036 critereBeanProvisoire.setSouthbc(zone_click.getSouthbc()); 1037 critereBeanProvisoire.setDay(critereBean.getDay()); 1038 critereBeanProvisoire.setMonth(critereBean.getMonth()); 1039 critereBeanProvisoire.setYear(critereBean.getYear()); 1040 Map<String, String> critereProvisoire = new TraducteurCarte().tradCritere2TotalReinit(critereBeanProvisoire, this); 1041 statReponse = serv_carte.getStatReponse(critereProvisoire, id_param, id_produit, getColormap_id(), getClassdis_id(), id_secteur, id_rcp, alt, total, getMaskId()); 1042 1043 // On n'affiche la valeur du pixel cliqué que lors d'un clic sur la carte 1044 //ou bien lors d'un recalcul d'un point déjà cliqué 1045 if ((clicX != -1 && clicY != -1) || (!firstAff && !pixelCenter.equals(""))) { 1046 showPosPixel = true; 1047 String aPixelCenter = Double.toString(statReponse.getCenter()); 1048 pixelCenter = fixeDecimal(aPixelCenter); 1049 centerLat = String.valueOf(statReponse.getCenterLat()); 1050 centerLon = String.valueOf(statReponse.getCenterLon()); 1051 } else if (firstAff){ 1052 showPosPixel = false; 1053 pixelCenter = ""; 1054 centerLat = ""; 1055 centerLon = ""; 1056 } 1057 } 1058 1059 /** 1060 * Méthode fournissant l'identifiant de la grille correspondant au masque sélectionné 1061 * Si aucun masque n'est sélectionné, retourne 0 1062 */ 1063 private long getMaskId() { 1064 if (mask.equals("region")) return region.longValue(); 1065 else if (mask.equals("country")) return country.longValue(); 1066 else return 0; 526 1067 } 527 1068 … … 531 1072 */ 532 1073 private void initStatistiqueList() { 533 gridOn = true; 534 statOn = false; 1074 // gridOn = true; 1075 // statOn = false; 1076 statistique = "moyenneCarte"; 535 1077 if (statistiqueUI != null) 536 statistiqueUI.setValue("none"); 537 statistique = "none"; 538 } 539 540 541 542 543 544 1078 statistiqueUI.setValue(statistique); 1079 mode = "date"; 1080 if (modeUI != null) 1081 modeUI.setValue(mode); 1082 } 1083 545 1084 private String fixeDecimal(String entree) { 546 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "-------------------------------------******------>entree "+entree);1085 // LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "-------------------------------------******------>entree "+entree); 547 1086 if (entree == null) 548 1087 return "nc"; 549 1088 int index = entree.lastIndexOf("."); 550 1089 int indexE = entree.lastIndexOf("E"); 551 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "entree --lll-->2"+indexE+" "+index+" "+entree.length());552 if ( indexE == -1 && index != -1 && entree.length() >= index + 5)1090 // LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "entree ----> == "+indexE+" "+index+" "+entree.length()); 1091 if (indexE == -1 && index != -1 && entree.length() >= index + 5) { 553 1092 entree = entree.substring(0, entree.lastIndexOf(".")+5); 554 if ( indexE != -1 && index != -1 && entree.length() >= index + 5) 555 { 1093 } else if (indexE != -1 && index != -1 && entree.length() >= index + 5) { 556 1094 String aEntree = entree; 557 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "aEntree "+aEntree.lastIndexOf("E")+" "+aEntree.length()+" "+aEntree.lastIndexOf("E")+" "+aEntree.length());558 aEntree =aEntree.substring(aEntree.lastIndexOf("E"), aEntree.lastIndexOf("E")+aEntree.length()-aEntree.lastIndexOf("E"));1095 // LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "aEntree "+aEntree.lastIndexOf("E")+" "+aEntree.length()+" "+aEntree.lastIndexOf("E")+" "+aEntree.length()); 1096 aEntree = aEntree.substring(aEntree.lastIndexOf("E"), aEntree.lastIndexOf("E")+aEntree.length()-aEntree.lastIndexOf("E")); 559 1097 entree = entree.substring(0, entree.lastIndexOf(".")+5)+aEntree; 560 1098 } 561 1099 // LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "entree "+entree); 562 1100 return entree; 563 1101 } 564 565 1102 566 1103 /*===================================================== 567 1104 * Getter and Setter 568 1105 ======================================================*/ 569 1106 1107 public String getUnite() { 1108 controleSession(); 1109 return unite; 1110 } 1111 1112 public void setUnite(String unite) { 1113 this.unite = unite; 1114 } 1115 570 1116 public String getParametre() { 571 1117 controleSession(); … … 640 1186 this.colormapUI = colormapUI; 641 1187 } 642 1188 1189 public UISelectOne getClassdisUI() { 1190 return classdisUI; 1191 } 1192 1193 public void setClassdisUI(UISelectOne classdisUI) { 1194 this.classdisUI = classdisUI; 1195 } 1196 643 1197 public String getUrl() { 644 1198 return url; … … 648 1202 this.url = url; 649 1203 } 1204 650 1205 public Long getColormap_id() { 651 1206 return colormap_id; … … 656 1211 } 657 1212 1213 public Long getClassdis_id() { 1214 return classdis_id; 1215 } 1216 1217 public void setClassdis_id(Long classdis_id) { 1218 this.classdis_id = classdis_id; 1219 } 1220 658 1221 public List<SelectItem> getListe_colormap() { 659 1222 return liste_colormap; … … 664 1227 } 665 1228 1229 public List<SelectItem> getListe_classdis() { 1230 return liste_classdis; 1231 } 1232 1233 public void setListe_classdis(List<SelectItem> liste_classdis) { 1234 this.liste_classdis = liste_classdis; 1235 } 1236 666 1237 public int getClicX() { 667 1238 return clicX; … … 680 1251 } 681 1252 682 public Zone getZone_ affichee() {683 return zone_ affichee;684 } 685 686 public void setZone_ affichee(Zone zone_affichee) {687 this.zone_ affichee = zone_affichee;1253 public Zone getZone_demandee() { 1254 return zone_demandee; 1255 } 1256 1257 public void setZone_demandee(Zone zone_demandee) { 1258 this.zone_demandee = zone_demandee; 688 1259 } 689 1260 … … 712 1283 } 713 1284 714 public boolean isGridOn() { 715 return gridOn; 716 } 717 718 public void setGridOn(boolean gridOn) { 719 this.gridOn = gridOn; 720 } 721 722 public boolean isStatOn() { 723 return statOn; 724 } 725 726 public void setStatOn(boolean statOn) { 727 this.statOn = statOn; 728 } 729 1285 // public boolean isGridOn() { 1286 // return gridOn; 1287 // } 1288 1289 // public void setGridOn(boolean gridOn) { 1290 // this.gridOn = gridOn; 1291 // } 1292 1293 // public boolean isStatOn() { 1294 // return statOn; 1295 // } 1296 1297 // public void setStatOn(boolean statOn) { 1298 // this.statOn = statOn; 1299 // } 730 1300 731 1301 public String getMapTitle() { … … 733 1303 } 734 1304 735 736 1305 public void setMapTitle(String mapTitle) { 737 1306 this.mapTitle = mapTitle; 738 1307 } 739 1308 740 741 1309 public UIOutput getMapTitleUI() { 742 1310 return mapTitleUI; 743 1311 } 744 1312 745 746 1313 public void setMapTitleUI(UIOutput mapTitleUI) { 747 1314 this.mapTitleUI = mapTitleUI; 748 1315 } 749 750 1316 751 1317 public double getMinParam() { … … 756 1322 this.minParam = aMinParam; 757 1323 } 1324 758 1325 public UIInput getMinParamUI() { 759 1326 return minParamUI; … … 763 1330 this.minParamUI = aMinParamUI; 764 1331 } 1332 765 1333 public double getMaxParam() { 766 1334 return maxParam; … … 770 1338 this.maxParam = aMaxParam; 771 1339 } 1340 772 1341 public UIInput getMaxParamUI() { 773 1342 return maxParamUI; … … 777 1346 this.maxParamUI = aMaxParamUI; 778 1347 } 779 1348 780 1349 public Long getNbrClasses() { 781 1350 return nbrClasses; … … 785 1354 this.nbrClasses = aNbrClasses; 786 1355 } 787 1356 788 1357 public UISelectOne getNbrClassesUI() { 789 1358 return nbrClassesUI; … … 793 1362 this.nbrClassesUI = aNbrClassesUI; 794 1363 } 795 1364 796 1365 public String getPixelCenter() { 797 1366 return pixelCenter; 798 1367 } 1368 799 1369 public void setPixelCenter(String aPixelCenter) { 800 1370 this.pixelCenter = aPixelCenter; 801 1371 } 802 803 public doublegetCenterLon() {1372 1373 public String getCenterLon() { 804 1374 return centerLon; 805 1375 } 806 public void setCenterLon(double aCenterLon) { 1376 1377 public void setCenterLon(String aCenterLon) { 807 1378 this.centerLon = aCenterLon; 808 1379 } 809 810 public doublegetCenterLat() {1380 1381 public String getCenterLat() { 811 1382 return centerLat; 812 1383 } 813 public void setCenterLat(double aCenterLat) { 1384 1385 public void setCenterLat(String aCenterLat) { 814 1386 this.centerLat = aCenterLat; 815 1387 } 816 1388 817 1389 public double getCenterLonClick() { 818 1390 return centerLonClick; 819 1391 } 1392 820 1393 public void setCenterLonClick(double aCenterLonClick) { 821 1394 this.centerLonClick = aCenterLonClick; 822 1395 } 823 1396 824 1397 public double getCenterLatClick() { 825 1398 return centerLatClick; 826 1399 } 1400 827 1401 public void setCenterLatClick(double aCenterLatClick) { 828 1402 this.centerLatClick = aCenterLatClick; 829 1403 } 830 1404 831 1405 public UIOutput PixelCenterUI() { 832 1406 return pixelCenterUI; … … 836 1410 this.pixelCenterUI = aPixelCenterUI; 837 1411 } 838 839 1412 840 1413 public double getResolution() { 841 1414 return resolution; 842 1415 } 1416 843 1417 public void setResolution(double aResolution) { 844 1418 this.resolution = aResolution; 845 1419 } 846 1420 1421 public String getSecteur() { 1422 return secteur; 1423 } 1424 1425 public void setSecteur(String secteur) { 1426 this.secteur = secteur; 1427 } 1428 1429 public String getRcp() { 1430 return rcp; 1431 } 1432 1433 public void setRcp(String rcp) { 1434 this.rcp = rcp; 1435 } 1436 1437 public String getColormap_txt() { 1438 return colormap_txt; 1439 } 1440 1441 public void setColormap_txt(String colormapTxt) { 1442 colormap_txt = colormapTxt; 1443 } 1444 1445 public String getTypeCodif() { 1446 return typeCodif; 1447 } 1448 1449 public void setTypeCodif(String typeCodif) { 1450 this.typeCodif = typeCodif; 1451 } 1452 1453 public String getMode() { 1454 return mode; 1455 } 1456 1457 public void setMode(String mode) { 1458 this.mode = mode; 1459 } 1460 1461 public UISelectOne getModeUI() { 1462 return modeUI; 1463 } 1464 1465 public void setModeUI(UISelectOne modeUI) { 1466 this.modeUI = modeUI; 1467 } 1468 1469 public boolean isShowPosPixel() { 1470 return showPosPixel; 1471 } 1472 1473 public void setShowPosPixel(boolean showPosPixel) { 1474 this.showPosPixel = showPosPixel; 1475 } 1476 1477 public String getTotal() { 1478 return total; 1479 } 1480 1481 public void setTotal(String total) { 1482 this.total = total; 1483 } 1484 1485 public UISelectOne getTotalUI() { 1486 return totalUI; 1487 } 1488 1489 public void setTotalUI(UISelectOne totalUI) { 1490 this.totalUI = totalUI; 1491 } 1492 1493 public int getNbrAlt() { 1494 return nbrAlt; 1495 } 1496 1497 public void setNbrAlt(int nbrAlt) { 1498 this.nbrAlt = nbrAlt; 1499 } 1500 1501 public String getGlobalSum() { 1502 return globalSum; 1503 } 1504 1505 public void setGlobalSum(String globalSum) { 1506 this.globalSum = globalSum; 1507 } 1508 1509 public Zone getZone_visible() { 1510 return zone_visible; 1511 } 1512 1513 public void setZone_visible(Zone zoneVisible) { 1514 zone_visible = zoneVisible; 1515 } 1516 1517 public String getMask() { 1518 return mask; 1519 } 1520 1521 public void setMask(String mask) { 1522 this.mask = mask; 1523 } 1524 1525 public UISelectOne getMaskUI() { 1526 return maskUI; 1527 } 1528 1529 public void setMaskUI(UISelectOne maskUI) { 1530 this.maskUI = maskUI; 1531 } 1532 1533 public List<SelectItem> getListe_region() { 1534 return liste_region; 1535 } 1536 1537 public void setListe_region(List<SelectItem> listeRegion) { 1538 liste_region = listeRegion; 1539 } 1540 1541 public Long getRegion() { 1542 return region; 1543 } 1544 1545 public void setRegion(Long region) { 1546 this.region = region; 1547 } 1548 1549 public UISelectOne getRegionUI() { 1550 return regionUI; 1551 } 1552 1553 public void setRegionUI(UISelectOne regionUI) { 1554 this.regionUI = regionUI; 1555 } 1556 1557 public List<SelectItem> getListe_country() { 1558 return liste_country; 1559 } 1560 1561 public void setListe_country(List<SelectItem> listeCountry) { 1562 liste_country = listeCountry; 1563 } 1564 1565 public Long getCountry() { 1566 return country; 1567 } 1568 1569 public void setCountry(Long country) { 1570 this.country = country; 1571 } 1572 1573 public UISelectOne getCountryUI() { 1574 return countryUI; 1575 } 1576 1577 public void setCountryUI(UISelectOne countryUI) { 1578 this.countryUI = countryUI; 1579 } 1580 1581 public String getRegionName() { 1582 return regionName; 1583 } 1584 1585 public void setRegionName(String regionName) { 1586 this.regionName = regionName; 1587 } 1588 1589 public String getCountryName() { 1590 return countryName; 1591 } 1592 1593 public void setCountryName(String countryName) { 1594 this.countryName = countryName; 1595 } 1596 1597 public List<SelectItem> getListe_mask() { 1598 return liste_mask; 1599 } 1600 1601 public void setListe_mask(List<SelectItem> listeMask) { 1602 liste_mask = listeMask; 1603 } 847 1604 } 848 849 -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/CritereBean.java
r68 r70 1 1 package org.medias.eccad.presentation.bean; 2 2 3 import java.util.ArrayList; 3 4 import java.util.List; 4 5 … … 12 13 import javax.faces.model.SelectItem; 13 14 import javax.faces.validator.ValidatorException; 14 //import javax.servlet.http.HttpSession; 15 16 17 import org.medias.eccad.helpers.LoggerPerso; 15 18 16 import org.medias.eccad.metier.ServiceMetier; 19 17 import org.medias.eccad.modele.Produit; … … 36 34 private List<SelectItem> liste_catparametre; 37 35 private Long catparametre; 38 36 37 private List<SelectItem> liste_sector; 38 private Long sector; 39 40 private List<SelectItem> liste_rcp; 41 private Long rcp; 42 39 43 private List<SelectItem> liste_grille; 40 44 private Long grille; 41 45 46 private List<SelectItem> liste_alt; 47 private String alt; 48 49 private List<SelectItem> liste_day; 50 private String day; 51 52 private List<SelectItem> liste_month; 53 private String month; 54 55 private List<SelectItem> liste_year; 56 private Integer year; 57 42 58 private ServiceMetier smp; 43 44 private String ipcc_selection;45 59 46 60 //private String produit_header; … … 59 73 private UISelectOne produitUI; 60 74 private UISelectOne parametreUI; 75 private UISelectOne sectorUI; 76 private UISelectOne rcpUI; 77 private UISelectOne grilleUI; 78 private UISelectOne altUI; 79 private UISelectOne dayUI; 80 private UISelectOne monthUI; 81 private UISelectOne yearUI; 61 82 62 83 // date 63 84 private String begDate; 64 85 private String endDate; 86 private String date; 87 private String deltaDate; 65 88 66 89 private String begDateSauv; … … 73 96 private UIInput uiEndDateSauv; 74 97 75 private boolean prod_change;76 77 98 private Produit produitbean; 78 99 private UIOutput produit_temp; … … 83 104 */ 84 105 public CritereBean() throws DeconnectionException { 85 86 106 smp = new ServiceMetier(); 87 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "creation");88 107 majcatParam(); 89 108 majParam(); 90 109 majProduit(); 110 majSector(); 111 majRcp(); 91 112 majDate(); 92 113 majHeader(); 93 114 majProduitTemp(); 94 LoggerPerso.log(this.getClass(), LoggerPerso.DEBUG, "size liste parametre fin " + liste_parametre.size());95 prod_change = false;96 115 northbc = 90; 97 116 southbc = -90; … … 106 125 */ 107 126 public void catParametreChangement(ValueChangeEvent even) throws DeconnectionException { 108 109 110 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "fonction :: catParametreChangement");111 112 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "");113 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "catParametre changement :: " + even.getNewValue() + " :: old :: " + catparametre);114 127 catparametre = (Long) even.getNewValue(); 115 majParam(); 128 majParam(); 116 129 majProduit(); 130 majSector(); 131 majRcp(); 117 132 majDate(); 118 133 majHeader(); 119 134 majProduitTemp(); 120 prod_change=true;121 135 } 122 136 123 137 public void parametreChangement(ValueChangeEvent even) throws DeconnectionException { 124 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "parametreChangement");125 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "parametre changement :: " + even.getNewValue() + " :: old :: " + parametre);126 138 parametre = (Long) even.getNewValue(); 127 139 majProduit(); 140 majSector(); 141 majRcp(); 128 142 majDate(); 129 143 majHeader(); 130 144 majProduitTemp(); 131 prod_change=true;132 145 } 133 146 … … 137 150 */ 138 151 public void produitChangement(ValueChangeEvent even) { 139 140 141 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "fonction :: produitChangement");142 143 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "produit changement avant :: " + produit + " event " + even.getNewValue() + " uiselect " + produitUI.getValue());144 if (prod_change) {145 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "produit changement non réalisé :: " + produit);146 prod_change = false;147 //return;148 }149 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "produit changement ok :: " + produit);150 152 produit = (Long) even.getNewValue(); 151 153 if (produit != null) { … … 155 157 produitbean = new Produit(-1, "none", null, null); 156 158 } 159 majSector(); 160 majRcp(); 157 161 majDate(); 158 162 majHeader(); … … 160 164 } 161 165 162 163 /** 164 * met à jour la liste des catï¿œgories de parametres (initialisation de la liste) 166 /** 167 * Activé lors du changement du secteur 168 * @param even la nouvelle valeur du secteur 169 */ 170 public void secteurChangement(ValueChangeEvent even) { 171 sector = (Long) even.getNewValue(); 172 majRcp(); 173 majDate(); 174 } 175 176 /** 177 * Activé lors du changement du RCP 178 * @param even la nouvelle valeur du RCP 179 */ 180 public void rcpChangement(ValueChangeEvent even) { 181 rcp = (Long) even.getNewValue(); 182 majSector(); 183 majDate(); 184 } 185 186 private boolean identInList(Long identifiant,List<SelectItem> list) { 187 if (identifiant == null) { 188 return false; 189 } 190 Long idCurrent; 191 for (int num = 0; num < list.size(); num++) { 192 idCurrent = (Long)list.get(num).getValue(); 193 if (idCurrent.longValue() == identifiant.longValue()) 194 return true; 195 } 196 return false; 197 } 198 199 /** 200 * met à jour la liste des catégories de parametres (initialisation de la liste) 165 201 * 166 202 */ 167 203 public void majcatParam() { 168 169 204 controleSession(); 170 171 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "fonction :: majcatParam");172 173 174 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "-8-*catparametre maj :: ");175 205 liste_catparametre = smp.getListCatParametre(); 176 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "------*SIZE catparametre maj :: "+liste_catparametre.size());177 206 if (liste_catparametre.size() > 0) { 178 207 catparametre= (Long) liste_catparametre.get(0).getValue(); … … 188 217 */ 189 218 public void majParam() { 190 191 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "fonction :: majParam");192 193 219 controleSession(); 194 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "parametre maj Catparam :: " + catparametre);195 220 if (catparametre == null) { 196 221 liste_parametre = null; … … 198 223 return; 199 224 } 200 201 225 202 226 liste_parametre = smp.getListParamByCatParam(catparametre.intValue()); 203 LoggerPerso.log(this.getClass(), LoggerPerso.DEBUG, "liste parametre valeur 0>>>>>>" + liste_parametre.get(0).getValue());204 227 if (liste_parametre.size() > 0) { 205 LoggerPerso.log(this.getClass(), LoggerPerso.DEBUG, "liste parametre > 0"); 206 parametre= (Long) liste_parametre.get(0).getValue(); 228 if (!identInList(parametre, liste_parametre)) { 229 parametre= (Long) liste_parametre.get(0).getValue(); 230 } 207 231 if (parametreUI != null) 208 parametreUI.setValue(new Long(parametre)); 209 232 parametreUI.setValue(parametre); 210 233 } 211 234 else … … 214 237 } 215 238 239 /** 240 * met à jour la liste des secteurs (initialisation de la liste) 241 * 242 */ 243 public void majSector() { 244 controleSession(); 245 if (catparametre == null) { 246 liste_sector = null; 247 sector = null; 248 return; 249 } 250 liste_sector = smp.getListSectorByParam(parametre.intValue(),produit.intValue(),(rcp==null?0:rcp.intValue())); 251 if (liste_sector.size() > 0) { 252 if (!identInList(sector, liste_sector)) { 253 sector= (Long) liste_sector.get(0).getValue(); 254 } 255 if (sectorUI != null) 256 sectorUI.setValue(sector); 257 } 258 else { 259 sector = new Long(0); 260 } 261 } 262 263 /** 264 * met à jour la liste des rcp 265 * 266 */ 267 public void majRcp() { 268 controleSession(); 269 if (catparametre == null) { 270 liste_rcp = null; 271 rcp = null; 272 return; 273 } 274 liste_rcp = smp.getListRcpByParam(parametre.intValue(),produit.intValue(),(sector==null?0:sector.intValue())); 275 if (liste_rcp.size() > 0) { 276 if (!identInList(rcp, liste_rcp)) { 277 rcp= (Long) liste_rcp.get(0).getValue(); 278 } 279 if (rcpUI != null) 280 rcpUI.setValue(rcp); 281 } 282 else { 283 rcp = new Long(0); 284 } 285 } 216 286 217 287 /** … … 220 290 */ 221 291 public void majProduit() throws DeconnectionException { 222 223 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "fonction :: majProduit");224 225 292 controleSession(); 226 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "produit maj param :: " + parametre);227 293 if (parametre == null) { 228 294 liste_produit = null; … … 231 297 } 232 298 liste_produit = smp.getListProduit(parametre.intValue()); 233 if (liste_produit.size() > 0) { 234 produit = (Long) liste_produit.get(0).getValue(); 299 if (liste_produit.size() > 0) { 300 if (!identInList(produit, liste_produit)) { 301 produit = (Long) liste_produit.get(0).getValue(); 302 } 235 303 if (produitUI != null) 236 produitUI.setValue( new Long(produit));304 produitUI.setValue(produit); 237 305 produitbean = smp.getProduitById(produit.intValue()); 238 306 } … … 245 313 * 246 314 */ 247 public void majGrille() { 248 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "produit maj grille :: " + grille); 315 public void majGrille(String dateGrille) { 249 316 if (produit == null) { 250 317 liste_grille = null; … … 252 319 return; 253 320 } 254 255 liste_grille = smp.getListGrille(produit.intValue(),parametre.intValue(), begDate, endDate); 256 if (liste_grille.size() > 0) 257 grille = (Long) liste_grille.get(0).getValue(); 258 else 321 liste_grille = smp.getListGrille(produit.longValue(),parametre.longValue(),(sector==null?0:sector.longValue()),(rcp==null?0:rcp.longValue()), begDate, endDate, deltaDate, produitbean, alt); 322 if (liste_grille.size() > 0) { 323 if (dateGrille == null) { 324 grille = (Long) liste_grille.get(0).getValue(); 325 if (grilleUI != null) 326 grilleUI.setValue(grille); 327 date = liste_grille.get(0).getLabel(); 328 if (date.length() == 7) { 329 date += "-01"; 330 } else if (date.length() == 4) { 331 date += "-01-01"; 332 } 333 } else { 334 String dateLabel; 335 for (int num = 0; num < liste_grille.size(); num++) { 336 dateLabel = liste_grille.get(num).getLabel(); 337 if (dateLabel.length() == 7) { 338 dateLabel += "-01"; 339 } else if (dateLabel.length() == 4) { 340 dateLabel += "-01-01"; 341 } 342 if (dateLabel.equals(dateGrille)) { 343 grille = (Long)liste_grille.get(num).getValue(); 344 if (grilleUI != null) 345 grilleUI.setValue(grille); 346 date = dateLabel; 347 break; 348 } 349 } 350 } 351 } else { 259 352 grille = null; 260 } 261 353 } 354 //System.out.println("majGrille, nouvelle date="+date+", alt="+alt+", grille="+grille+", day="+day+", month="+month+", year="+year); 355 } 356 357 /** 358 * Met à jour la liste des altitudes dans le cas où on a un secteur "Aviation" 359 * 360 */ 361 public void majAlt(String secteur) { 362 if (produit == null || !secteur.equals("Aviation")) { 363 liste_alt = null; 364 alt = null; 365 return; 366 } 367 liste_alt = smp.getListAlt(sector.longValue(),begDate); 368 if (liste_alt.size() > 0) { 369 alt = (String) liste_alt.get(0).getValue(); 370 if (altUI != null) 371 altUI.setValue(alt); 372 } else { 373 alt = null; 374 } 375 //System.out.println("majAlt, date="+date+", nouveau alt="+alt+", grille="+grille+", day="+day+", month="+month+", year="+year); 376 } 377 378 /** 379 * Met à jour la liste des jours/mois/années pour la période sélectionnée 380 * 381 */ 382 public void majDayMonthYear(String traducteur) { 383 if (produit == null) { 384 liste_day = null; 385 liste_month = null; 386 liste_year = null; 387 day = null; 388 month = null; 389 year = null; 390 return; 391 } 392 393 liste_day = new ArrayList<SelectItem>(); 394 liste_month = new ArrayList<SelectItem>(); 395 liste_year = new ArrayList<SelectItem>(); 396 if (traducteur.equals("traducteur_temporel")) { 397 String dateGrille, jourGrille, moisGrille, anneeGrille, moisPrec = "", anneePrec = ""; 398 // On parcourt la liste des dates des grilles 399 for (int num = 0; num < liste_grille.size(); num++) { 400 dateGrille = liste_grille.get(num).getLabel(); 401 // On récupÚre le mois et l'année (AAAA-MM-JJ) suivant la date (AAAA-MM ou AAAA-MM-JJ) 402 if (dateGrille.length() == 7) { 403 jourGrille = dateGrille+"-01"; 404 moisGrille = dateGrille; 405 } else if (dateGrille.length() == 4) { 406 jourGrille = dateGrille+"-01-01"; 407 moisGrille = dateGrille+"-01"; 408 } else { 409 jourGrille = dateGrille; 410 moisGrille = dateGrille.substring(0,7); 411 } 412 anneeGrille = dateGrille.substring(0,4); 413 // On ajoute le jour/ mois / année à la liste si celui-ci n'est pas déjà présent 414 liste_day.add(new SelectItem(jourGrille,jourGrille)); 415 if (!moisGrille.equals(moisPrec)) { 416 liste_month.add(new SelectItem(moisGrille, moisGrille)); 417 } 418 if (!anneeGrille.equals(anneePrec)) { 419 liste_year.add(new SelectItem(new Integer(anneeGrille), anneeGrille)); 420 } 421 moisPrec = moisGrille; 422 anneePrec = anneeGrille; 423 } 424 425 if (liste_day.size() > 0) { 426 day = date; 427 if (dayUI != null) 428 dayUI.setValue(day); 429 } else { 430 day = null; 431 } 432 if (liste_month.size() > 0) { 433 month = date.substring(0,7); 434 if (monthUI != null) 435 monthUI.setValue(month); 436 } else { 437 month = null; 438 } 439 if (liste_year.size() > 0) { 440 year = new Integer(date.substring(0,4)); 441 if (yearUI != null) 442 yearUI.setValue(year); 443 } else { 444 year = null; 445 } 446 } 447 //System.out.println("majDayMonthYear, date="+date+", alt="+alt+", grille="+grille+", day="+day+", month="+month+", year="+year); 448 } 262 449 263 450 /** … … 276 463 private void majDate() { 277 464 if (produit == null) { 278 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "maj date produit null");279 465 begDate = null; 280 466 endDate = null; … … 288 474 if (uiEndDate != null){ 289 475 uiEndDate.setValue(endDate); 290 476 } 291 477 if (uiEndDateSauv != null){ 292 478 uiEndDateSauv.setValue(endDate); 293 479 setEndDateSauv(endDate); 294 } 295 return; 296 } 297 298 if (produitbean != null) { 299 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "majDATE::nom::"+ produitbean.getNom() + "::date::" + produitbean.getBeginDate()); 300 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "majDATE::nom::"+ produitbean.getNom() + "::date::" + produitbean.getEndDate()); 301 begDate = produitbean.getBeginDate().toString(); 302 endDate = produitbean.getEndDate().toString(); 303 480 } 481 return; 482 } 483 484 ArrayList<String> dates = smp.getDates(produit.longValue(),parametre.longValue(),(sector==null?0:sector.longValue()),(rcp==null?0:rcp.longValue()),produitbean.getNom()); 485 // if (produitbean != null) { 486 if (dates.size() == 3) { 487 // begDate = produitbean.getBeginDate().toString(); 488 // endDate = produitbean.getEndDate().toString(); 489 begDate = dates.get(0); 490 endDate = dates.get(1); 491 deltaDate = dates.get(2); 304 492 begDateSauv = begDate; 305 493 endDateSauv = endDate; 306 307 494 } 308 495 else { 309 496 begDate = null; 310 497 endDate = null; 498 deltaDate = null; 311 499 begDateSauv = null; 312 500 endDateSauv = null; … … 315 503 if (uiBegDate != null){ 316 504 uiBegDate.setValue(begDate); 317 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "majDATE::nom::"+ produitbean.getNom() + "::begDate::" +begDate);318 319 505 } 320 506 if (uiBegDateSauv != null){ … … 326 512 if (uiEndDateSauv != null){ 327 513 uiEndDateSauv.setValue(endDateSauv); 328 LoggerPerso.log(CritereBean.class, LoggerPerso.DEBUG, "majDATE::nom::"+ produitbean.getNom() + "::endDateSauv::" +endDateSauv);329 330 514 } 331 515 } … … 348 532 } 349 533 350 351 534 /* 352 535 * GETTER & SETTER + VALIDATOR … … 356 539 } 357 540 358 359 541 public void setGrille(Long grille) { 360 542 this.grille = grille; 361 543 } 362 544 363 364 545 public List<SelectItem> getListe_grille() { 365 546 return liste_grille; 366 547 } 367 548 368 369 549 public void setListe_grille(List<SelectItem> liste_grille) { 370 550 this.liste_grille = liste_grille; … … 375 555 } 376 556 377 378 557 public void setProduit(Long produit) { 379 558 this.produit = produit; 380 559 } 381 560 382 383 561 public List<SelectItem> getListe_produit() { 384 562 return liste_produit; … … 405 583 } 406 584 407 408 /////////////409 585 public UIInput getUiBegDateSauv() { 410 586 return uiBegDateSauv; … … 422 598 this.uiEndDateSauv = uiEndDateSauv; 423 599 } 424 ////////////425 426 427 600 428 601 public int getOid() { … … 438 611 } 439 612 440 441 613 public void setListe_catparametre(List<SelectItem> liste_catParametre) { 442 614 this.liste_catparametre = liste_catParametre; 443 615 } 444 445 446 616 447 617 public Long getCatParametre() throws DeconnectionException { … … 450 620 } 451 621 452 453 622 public void setCatParametre(Long catParametre) { 454 623 this.catparametre = catParametre; … … 459 628 } 460 629 461 462 630 public void setListe_parametre(List<SelectItem> liste_parametre) { 463 631 this.liste_parametre = liste_parametre; 464 632 } 465 633 466 467 468 634 public Long getParametre() throws DeconnectionException { 469 635 controleSession(); … … 471 637 } 472 638 473 474 639 public void setParametre(Long parametre) { 475 640 this.parametre = parametre; 476 641 } 477 642 643 public List<SelectItem> getListe_sector() { 644 return liste_sector; 645 } 646 647 public List<SelectItem> getListe_rcp() { 648 return liste_rcp; 649 } 650 651 public void setListe_sector(List<SelectItem> liste_sector) { 652 this.liste_sector = liste_sector; 653 } 654 655 public void setListe_rcp(List<SelectItem> liste_rcp) { 656 this.liste_rcp= liste_rcp; 657 } 658 659 public Long getSector() throws DeconnectionException { 660 return sector; 661 } 662 663 public Long getRcp() throws DeconnectionException { 664 return rcp; 665 } 666 667 public void setSector(Long sector) { 668 this.sector = sector; 669 } 670 671 public void setRcp(Long rcp) { 672 this.rcp = rcp; 673 } 674 478 675 public String getBegDate() { 479 676 return begDate; … … 539 736 } 540 737 541 542 543 738 public UIInput getEastbcInput() { 544 739 return eastbcInput; 545 740 } 546 741 547 548 549 742 public void setEastbcInput(UIInput eastbcInput) { 550 743 this.eastbcInput = eastbcInput; 551 744 } 552 745 553 554 555 746 public UIInput getNorthbcInput() { 556 747 return northbcInput; 557 748 } 558 749 559 560 561 750 public void setNorthbcInput(UIInput northbcInput) { 562 751 this.northbcInput = northbcInput; 563 752 } 564 753 565 566 567 754 public UIInput getSouthbcInput() { 568 755 return southbcInput; 569 756 } 570 757 571 572 573 758 public void setSouthbcInput(UIInput southbcInput) { 574 759 this.southbcInput = southbcInput; 575 760 } 576 761 577 578 579 762 public UIInput getWestbcInput() { 580 763 return westbcInput; 581 764 } 582 765 583 584 585 766 public void setWestbcInput(UIInput westbcInput) { 586 767 this.westbcInput = westbcInput; 587 768 } 588 589 769 590 770 public void validateDate(FacesContext contexte, UIComponent composant, Object objet) throws ValidatorException { … … 612 792 if (uiBegDate.getValue().toString().compareTo(uiEndDate.getValue().toString()) > 0) { 613 793 estValide = false; 614 errMsg = new FacesMessage(" begin date must be smaller than end date");615 } 616 if ((uiBegDate.getValue().toString().compareTo(uiEndDateSauv.getValue().toString()) > 0) && estValide) {794 errMsg = new FacesMessage("Begin date must be lower or equal than End date"); 795 } 796 else if (uiBegDateSauv.getValue().toString().compareTo(uiBegDate.getValue().toString()) > 0) { 617 797 estValide = false; 618 errMsg = new FacesMessage(uiEndDateSauv.getValue().toString()+" - "+ uiBegDate.getValue().toString()); 619 //errMsg = new FacesMessage("no data in this Date selection"); 620 } 621 798 errMsg = new FacesMessage("Begin date must be greater or equal than "+uiBegDateSauv.getValue().toString()); 799 } 800 else if (uiEndDate.getValue().toString().compareTo(uiEndDateSauv.getValue().toString()) > 0) { 801 estValide = false; 802 errMsg = new FacesMessage("End date must be lower or equal than "+uiEndDateSauv.getValue().toString()); 803 } 622 804 if (!estValide) 623 805 throw new ValidatorException(errMsg); 624 625 806 } 626 807 … … 634 815 635 816 /** 636 * Valide la date817 * Valide la zone de sélection 637 818 * @param contexte 638 819 * @param composant … … 675 856 } 676 857 677 678 679 858 public ServiceMetier getSmp() { 680 859 return smp; … … 687 866 public void setProduitUI(UISelectOne produitUI) { 688 867 this.produitUI = produitUI; 689 ////system.out.println("\n\n\n" + produitUI.getValue());690 868 } 691 869 … … 697 875 public void setParametreUI(UISelectOne parametreUI) { 698 876 this.parametreUI = parametreUI; 699 ////system.out.println("\n\n\n" + produitUI.getValue()); 700 } 701 702 877 } 878 879 public UISelectOne getSectorUI() { 880 return sectorUI; 881 } 882 883 public UISelectOne getRcpUI() { 884 return rcpUI; 885 } 886 887 public void setSectorUI(UISelectOne sectorUI) { 888 this.sectorUI = sectorUI; 889 } 890 891 public void setRcpUI(UISelectOne rcpUI) { 892 this.rcpUI = rcpUI; 893 } 894 703 895 /* public String getProduit_header() { 704 896 return produit_header; … … 732 924 this.produit_temp = produit_temp; 733 925 } 926 927 public String getDate() { 928 return date; 929 } 930 931 public void setDate(String date) { 932 this.date = date; 933 } 934 935 public List<SelectItem> getListe_month() { 936 return liste_month; 937 } 938 939 public void setListe_month(List<SelectItem> listeMonth) { 940 liste_month = listeMonth; 941 } 942 943 public String getMonth() { 944 return month; 945 } 946 947 public void setMonth(String month) { 948 this.month = month; 949 } 950 951 public List<SelectItem> getListe_year() { 952 return liste_year; 953 } 954 955 public void setListe_year(List<SelectItem> listeYear) { 956 liste_year = listeYear; 957 } 958 959 public Integer getYear() { 960 return year; 961 } 962 963 public void setYear(Integer year) { 964 this.year = year; 965 } 966 967 public List<SelectItem> getListe_day() { 968 return liste_day; 969 } 970 971 public void setListe_day(List<SelectItem> listeDay) { 972 liste_day = listeDay; 973 } 974 975 public String getDay() { 976 return day; 977 } 978 979 public void setDay(String day) { 980 this.day = day; 981 } 982 983 public UISelectOne getDayUI() { 984 return dayUI; 985 } 986 987 public void setDayUI(UISelectOne dayUI) { 988 this.dayUI = dayUI; 989 } 990 991 public UISelectOne getMonthUI() { 992 return monthUI; 993 } 994 995 public void setMonthUI(UISelectOne monthUI) { 996 this.monthUI = monthUI; 997 } 998 999 public UISelectOne getYearUI() { 1000 return yearUI; 1001 } 1002 1003 public void setYearUI(UISelectOne yearUI) { 1004 this.yearUI = yearUI; 1005 } 1006 1007 public UISelectOne getGrilleUI() { 1008 return grilleUI; 1009 } 1010 1011 public void setGrilleUI(UISelectOne grilleUI) { 1012 this.grilleUI = grilleUI; 1013 } 1014 1015 public List<SelectItem> getListe_alt() { 1016 return liste_alt; 1017 } 1018 1019 public void setListe_alt(List<SelectItem> listeAlt) { 1020 liste_alt = listeAlt; 1021 } 1022 1023 public String getAlt() { 1024 return alt; 1025 } 1026 1027 public void setAlt(String alt) { 1028 this.alt = alt; 1029 } 1030 1031 public UISelectOne getAltUI() { 1032 return altUI; 1033 } 1034 1035 public void setAltUI(UISelectOne altUI) { 1036 this.altUI = altUI; 1037 } 1038 1039 public String getDeltaDate() { 1040 return deltaDate; 1041 } 1042 1043 public void setDeltaDate(String deltaDate) { 1044 this.deltaDate = deltaDate; 1045 } 734 1046 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/DeconnectionException.java
r68 r70 3 3 public class DeconnectionException extends RuntimeException { 4 4 5 /** 6 * 7 */ 8 private static final long serialVersionUID = 1L; 9 5 10 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/ExtractBean.java
r68 r70 3 3 import java.io.IOException; 4 4 5 import javax.faces.application.FacesMessage; 6 import javax.faces.component.UIComponent; 7 import javax.faces.component.UIInput; 5 8 import javax.faces.context.FacesContext; 6 9 import javax.faces.event.ActionEvent; 10 import javax.faces.validator.ValidatorException; 7 11 import javax.servlet.http.HttpSession; 8 12 … … 15 19 import org.medias.eccad.modele.Parametre; 16 20 import org.medias.eccad.modele.Produit; 21 import org.medias.eccad.modele.Rcp; 22 import org.medias.eccad.modele.Secteur; 17 23 18 24 … … 25 31 public CritereExtractBean critere; 26 32 public int nbrGrille; 33 public int nbrAlt; 27 34 public Produit produit; 28 35 public Parametre param; 36 public Secteur secteur; 37 public Rcp rcp; 29 38 30 39 public ExtractBean() throws DeconnectionException { 31 40 controleSession(); 32 41 33 42 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 34 43 SessionBean sessionbean = (SessionBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("sessionBean"); 35 36 44 critereBean.majGrille(null); 37 45 produit = critereBean.getSmp().getProduitById(critereBean.getProduit().intValue()); 38 46 param = critereBean.getSmp().getParametreById(critereBean.getParametre().intValue()); 47 secteur = critereBean.getSmp().getSecteurById(critereBean.getSector().intValue()); 48 rcp = critereBean.getSmp().getRcpById(critereBean.getRcp().intValue()); 39 49 40 50 critere = new CritereExtractBean(); … … 47 57 critere.setParametre(critereBean.getParametre().toString()); 48 58 critere.setProduit(critereBean.getProduit().toString()); 59 critere.setSecteur(critereBean.getSector().toString()); 60 critere.setRcp(critereBean.getRcp().toString()); 49 61 critere.setDataFileFormat("1"); 50 62 critere.setDataFileCompress("0"); … … 54 66 55 67 critere.setMailUser(sessionbean.getEmail()); 56 nbrGrille = critereBean.getSmp().getListGrille(critereBean.getProduit(),critereBean.getParametre(), critere.getDateDebut(), critere.getDateFin()).size(); 68 nbrGrille = (critereBean.getListe_grille()==null?0:critereBean.getListe_grille().size()); 69 nbrAlt = (critereBean.getListe_alt()==null?0:critereBean.getListe_alt().size()); 70 //critereBean.getSmp().getListGrille(critereBean.getProduit(),critereBean.getParametre(), 71 // (critereBean.getSector()==null?0:critereBean.getSector().longValue()), 72 // (critereBean.getRcp()==null?0:critereBean.getRcp().longValue()), 73 // critere.getDateDebut(), critere.getDateFin(),critereBean.getProduitbean(),critereBean.getAlt()).size(); 57 74 } 58 75 … … 91 108 } 92 109 110 /** 111 * Valide la requête d'extraction 112 */ 113 public void validateRequest(FacesContext contexte, UIComponent composant, Object objet) throws ValidatorException { 114 boolean estValide = true; 115 116 if ((contexte == null) || (composant == null)) { 117 throw new NullPointerException("composant ou contexte null"); 118 } 119 120 if (!(composant instanceof UIInput)) 121 return; 122 123 FacesMessage errMsg = null; 124 125 if ( produit.getNom().equals("Region_IPCC") || produit.getNom().equals("GPW3_Country") || 126 (produit.getNom().equals("IPCC") && 127 (secteur.getIdentifiant() == 0 || secteur.getNom().equals("Aviation"))) ) { 128 estValide = false; 129 errMsg = new FacesMessage("Sorry, this request is not available yet. Please try later."); 130 } 131 132 if (!estValide) 133 throw new ValidatorException(errMsg); 134 } 135 93 136 public CritereExtractBean getCritere() { 94 137 return critere; … … 122 165 this.produit = produit; 123 166 } 167 168 public Secteur getSecteur() { 169 return secteur; 170 } 171 172 public void setSecteur(Secteur secteur) { 173 this.secteur = secteur; 174 } 175 176 public Rcp getRcp() { 177 return rcp; 178 } 179 180 public void setRcp(Rcp rcp) { 181 this.rcp = rcp; 182 } 183 184 public int getNbrAlt() { 185 return nbrAlt; 186 } 187 188 public void setNbrAlt(int nbrAlt) { 189 this.nbrAlt = nbrAlt; 190 } 124 191 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/GrapheBean.java
r68 r70 1 1 package org.medias.eccad.presentation.bean; 2 2 3 import java.util.Map; 4 3 5 import javax.faces.context.FacesContext; 6 import javax.faces.event.ActionEvent; 4 7 import javax.servlet.http.HttpSession; 5 8 6 import org.medias.eccad.metier.statistique.ServiceGraphe; 9 import org.medias.eccad.metier.statistique.ServiceStatistique; 10 import org.medias.eccad.modele.Parametre; 11 import org.medias.eccad.modele.Produit; 12 import org.medias.eccad.modele.ResultatStat; 13 import org.medias.eccad.persistance.exception.PersistanceException; 14 import org.medias.eccad.presentation.traducteur.TraducteurCarte; 7 15 8 16 public class GrapheBean extends AbstractVueBean{ 17 private ResultatStat result; 18 private String typeResult; 19 private String lat; 20 private String lon; 21 private Long id_param; 22 private Long id_produit; 23 private Long id_secteur; 24 private Long id_rcp; 25 private String alt; 26 private String type; 27 private String urlGraphe; 28 private String infoSup; 29 private String unite; 30 private String param; 31 private String produit; 32 private String secteur; 33 private String rcp; 9 34 10 public GrapheBean() {35 public GrapheBean() throws PersistanceException { 11 36 controleSession(); 12 37 //CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 13 ServiceGraphe service = new ServiceGraphe(); 14 service.genereGraphe(getIdUnique(), null); 38 // ServiceGraphe service = new ServiceGraphe(); 39 // service.genereGraphe(getIdUnique(), null,"","",""); 40 41 initializeLatLon(); 42 43 urlGraphe = "../images/nographe.png"; 44 drawGraph(null); 45 } 46 47 public void initializeLatLon(){ 48 CarteBean cartebean = (CarteBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("carteBean"); 49 this.setLat(cartebean.getCenterLat()); 50 this.setLon(cartebean.getCenterLon()); 51 } 52 53 public void calculateByPeriod() throws PersistanceException { 54 controleSession(); 55 typeResult = "Statistics"; 56 // LoggerPerso.log(GrapheBean.class, LoggerPerso.DEBUG, "calculateByPeriod"); 57 getStatistique(genereCritere()); 58 } 59 60 public void drawGraph(ActionEvent event) throws PersistanceException { 61 controleSession(); 62 calculateByPeriod(); 63 getGraphe(genereCritere()); 64 } 65 66 private Map<String, String> genereCritere() throws PersistanceException { 67 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 68 CarteBean carteBean = (CarteBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("carteBean"); 69 // LoggerPerso.log(StatBean.class, LoggerPerso.DEBUG, "cartebean = "+cartebean.getUrl()); 70 71 Map<String, String> critere = new TraducteurCarte().tradCritere2Stat(critereBean, carteBean); 72 id_param = critereBean.getParametre(); 73 id_produit = critereBean.getProduit(); 74 id_secteur = critereBean.getSector(); 75 id_rcp = critereBean.getRcp(); 76 alt = (critereBean.getAlt()==null?"0":critereBean.getAlt()); 77 Parametre parametre = critereBean.getSmp().getParametreById(id_param.intValue()); 78 unite = parametre.getUnite(); 79 if (unite.equals("number of fires") || unite.equals("no unit") || unite.equals("code value")) { 80 type = "positive integer"; 81 } else { 82 type = "double"; 83 } 84 param = parametre.getNom(); 85 Produit prod = critereBean.getSmp().getProduitById(id_produit.intValue()); 86 produit = prod.getNom(); 87 secteur = carteBean.getSecteur(); 88 rcp = carteBean.getRcp(); 89 critere.put("lat-max", lat); 90 critere.put("lat-min", lat); 91 critere.put("lon-max", lon); 92 critere.put("lon-min", lon); 93 infoSup = " at " + critere.get("lat-max") + "/" + critere.get("lon-max") 94 +" from " + critere.get("beg-date") + " to " + critere.get("end-date"); 95 return critere; 96 } 97 98 private void getStatistique(Map<String, String> critere) { 99 ServiceStatistique serviceStat = new ServiceStatistique(); 100 result = serviceStat.getStatistique(critere, id_param, id_produit, id_secteur, id_rcp, alt, type, "getStatistique"); 101 } 102 103 private void getGraphe(Map<String, String> critere) { 104 ServiceStatistique serviceStat = new ServiceStatistique(); 105 urlGraphe = ".." + serviceStat.getGraphe(getIdUnique(), critere, id_param, id_produit, id_secteur, id_rcp, alt, param, produit, unite, secteur, rcp, "getGraphique"); 106 // LoggerPerso.log(StatBean.class, LoggerPerso.INFO, "url graphe " + urlGraphe); 15 107 } 16 108 … … 21 113 22 114 String imageID; 23 24 25 115 imageID = session.getId() + session.getLastAccessedTime() ; 26 116 27 117 return imageID; 28 118 } 119 120 public ResultatStat getResult() { 121 return result; 122 } 29 123 124 public void setResult(ResultatStat result) { 125 this.result = result; 126 } 127 128 public String getTypeResult() { 129 return typeResult; 130 } 131 132 public void setTypeResult(String typeResult) { 133 this.typeResult = typeResult; 134 } 135 136 public String getLat() { 137 return lat; 138 } 139 140 public void setLat(String lat) { 141 this.lat = lat; 142 } 143 144 public String getLon() { 145 return lon; 146 } 147 148 public void setLon(String lon) { 149 this.lon = lon; 150 } 151 152 public String getUrlGraphe() { 153 return urlGraphe; 154 } 155 156 public void setUrlGraphe(String urlGraphe) { 157 this.urlGraphe = urlGraphe; 158 } 159 160 public String getInfoSup() { 161 return infoSup; 162 } 163 164 public void setInfoSup(String infoSup) { 165 this.infoSup = infoSup; 166 } 30 167 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/MetadataBean.java
r68 r70 2 2 3 3 import javax.faces.context.FacesContext; 4 //import javax.servlet.http.HttpSession;5 6 7 import org.medias.eccad.helpers.LoggerPerso;8 4 import org.medias.eccad.metier.ServiceMetadata; 9 //import org.medias.eccad.presentation.bean.emission.EmissionBean;10 5 11 6 public class MetadataBean { … … 13 8 14 9 public MetadataBean() { 15 LoggerPerso.log(MetadataBean.class, LoggerPerso.DEBUG, "initialisation");10 // LoggerPerso.log(MetadataBean.class, LoggerPerso.DEBUG, "initialisation"); 16 11 ServiceMetadata service_meta = new ServiceMetadata(); 17 18 12 /*CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 19 13 EmissionBean emission = (EmissionBean) ((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("emissionBean"); … … 28 22 id_produit = emission.getFacteur().getProduit().getId_item().intValue(); 29 23 }*/ 30 31 LoggerPerso.log(MetadataBean.class, LoggerPerso.DEBUG, "initialisation" + FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("produit")); 24 // LoggerPerso.log(MetadataBean.class, LoggerPerso.DEBUG, "initialisation" + FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("produit")); 32 25 String id_produit = (String) FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("produit"); 33 26 ////system.out.println(id_produit); 34 27 35 28 if (id_produit != null) { 36 LoggerPerso.log(MetadataBean.class, LoggerPerso.DEBUG, "en attentrecuperation");29 // LoggerPerso.log(MetadataBean.class, LoggerPerso.DEBUG, "en attente de recuperation"); 37 30 xmlContent = service_meta.getXmlMetadata(Long.parseLong(id_produit)); 38 LoggerPerso.log(MetadataBean.class, LoggerPerso.DEBUG, "en attente transforamtion");31 // LoggerPerso.log(MetadataBean.class, LoggerPerso.DEBUG, "en attente de transformation"); 39 32 xmlContent = service_meta.getXMLTransformResult(xmlContent, "metadata.xslt"); 40 LoggerPerso.log(MetadataBean.class, LoggerPerso.DEBUG, "transformation ok");33 // LoggerPerso.log(MetadataBean.class, LoggerPerso.DEBUG, "transformation ok"); 41 34 } 42 35 else -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/StatBean.java
r68 r70 8 8 import javax.servlet.http.HttpSession; 9 9 10 11 import org.medias.eccad.helpers.LoggerPerso;12 10 import org.medias.eccad.helpers.SpringBeanFactory; 13 11 import org.medias.eccad.metier.statistique.ServiceStatistique; 12 import org.medias.eccad.modele.Parametre; 13 import org.medias.eccad.modele.Produit; 14 14 import org.medias.eccad.modele.ResultatStat; 15 //import org.medias.eccad.modele.Zone;16 15 import org.medias.eccad.persistance.dao.GrilleDAO; 17 16 import org.medias.eccad.persistance.exception.PersistanceException; … … 22 21 private String typeResult; 23 22 private String date; 24 private String lat;25 private String lon;23 // private String lat; 24 // private String lon; 26 25 private Long id_param; 27 26 private Long id_produit; 28 private String urlGraphe; 27 private Long id_secteur; 28 private Long id_rcp; 29 private String alt; 30 private String type; 31 // private String urlGraphe; 29 32 private String infoSup; 33 private String unite; 34 private String param; 35 private String produit; 30 36 31 37 public StatBean() throws PersistanceException { 32 38 controleSession(); 33 39 calculateByArea(null); 34 initializeLatLon(); 35 40 // initializeLatLon(); 36 41 37 42 /*lat = "0.0"; 38 43 lon= "0.0";*/ 39 typeResult = "Result by area"; 40 urlGraphe = "../images/nographe.png"; 41 } 42 43 public void initializeLatLon(){ 44 CarteBean cartebean = (CarteBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("carteBean"); 44 // typeResult = "Result by area"; 45 // urlGraphe = "../images/nographe.png"; 46 // drawGraph(null); 47 } 48 49 // public void initializeLatLon(){ 50 // CarteBean cartebean = (CarteBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("carteBean"); 45 51 46 double lon_zoneAffichee = (cartebean.getCenterLon()); 47 double lat_zoneAffichee = (cartebean.getCenterLat()); 48 49 this.setLat(Double.toString(lat_zoneAffichee)); 50 this.setLon(Double.toString(lon_zoneAffichee)); 51 52 } 53 54 public void calculateByPeriod(ActionEvent event) throws PersistanceException { 55 controleSession(); 56 typeResult = "Result by period"; 57 LoggerPerso.log(StatBean.class, LoggerPerso.DEBUG, "calculateByPeriod"); 58 getStatistique(genereCritere("period")); 59 } 52 // this.setLat(cartebean.getCenterLat()); 53 // this.setLon(cartebean.getCenterLon()); 54 // } 55 56 // public void calculateByPeriod(ActionEvent event) throws PersistanceException { 57 // controleSession(); 58 // typeResult = "Result by period"; 59 // LoggerPerso.log(StatBean.class, LoggerPerso.DEBUG, "calculateByPeriod"); 60 // getStatistique(genereCritere("period")); 61 // } 60 62 61 63 public void calculateByArea(ActionEvent event) throws PersistanceException { 62 64 controleSession(); 63 65 typeResult = "Result by area"; 64 LoggerPerso.log(StatBean.class, LoggerPerso.DEBUG, "calculateByArea"); 65 getStatistique(genereCritere("area")); 66 } 67 68 public void drawGraph(ActionEvent event) throws PersistanceException { 69 controleSession(); 70 LoggerPerso.log(StatBean.class, LoggerPerso.DEBUG, "calculateByArea"); 71 getGraphe(genereCritere("period")); 72 } 73 74 private Map<String, String> genereCritere(String from) throws PersistanceException { 66 // LoggerPerso.log(StatBean.class, LoggerPerso.DEBUG, "calculateByArea"); 67 getStatistique(genereCritere());//"area")); 68 } 69 70 // public void drawGraph(ActionEvent event) throws PersistanceException { 71 // controleSession(); 72 // LoggerPerso.log(StatBean.class, LoggerPerso.DEBUG, "calculateByArea"); 73 // if (event == null) { 74 // getGraphe(genereCritere("period_area")); 75 // } else { 76 // getGraphe(genereCritere("period")); 77 // } 78 // } 79 80 private Map<String, String> genereCritere(/*String from*/) throws PersistanceException { 75 81 CritereBean critereBean = (CritereBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("critereBean"); 76 82 CarteBean cartebean = (CarteBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("carteBean"); 83 // LoggerPerso.log(StatBean.class, LoggerPerso.DEBUG, "cartebean = "+cartebean.getUrl()); 84 77 85 Map<String, String> critere = new TraducteurCarte().tradCritere2Stat(critereBean, cartebean); 78 86 id_param = critereBean.getParametre(); 79 87 id_produit = critereBean.getProduit(); 80 81 82 if (from.equals("area")) { 88 id_secteur = critereBean.getSector(); 89 id_rcp = critereBean.getRcp(); 90 alt = (critereBean.getAlt()==null?"0":critereBean.getAlt()); 91 Parametre parametre = critereBean.getSmp().getParametreById(id_param.intValue()); 92 unite = parametre.getUnite(); 93 if (unite.equals("number of fires") || unite.equals("no unit") || unite.equals("code value")) { 94 type = "positive integer"; 95 } else { 96 type = "double"; 97 } 98 param = parametre.getNom(); 99 Produit prod = critereBean.getSmp().getProduitById(id_produit.intValue()); 100 produit = prod.getNom(); 101 // if (from.equals("area")) { 83 102 GrilleDAO grilledao = (GrilleDAO) SpringBeanFactory.getXmlFactory().getBean("grilleDAO"); 84 date = grilledao.getDateGrille( critereBean.getGrille());103 date = grilledao.getDateGrille((critereBean.getGrille()==null?0:critereBean.getGrille().longValue())); 85 104 critere.put("beg-date", date); 86 105 critere.put("end-date", date); 87 infoSup = " " +critere.get("lat-max") + "/" + critere.get("lat-min") + ", " +106 infoSup = critere.get("lat-max") + "/" + critere.get("lat-min") + ", " + 88 107 critere.get("lon-max") + "/" + critere.get("lon-min") + "" + 89 108 " on date " + critere.get("beg-date"); 90 critere.get("end-date"); 91 } 92 if (from.equals("period")) { 93 critere.put("lat-max", lat); 94 critere.put("lat-min", lat); 95 critere.put("lon-max", lon); 96 critere.put("lon-min", lon); 97 infoSup = " from " + critere.get("beg-date") + " to " + critere.get("end-date") + " on point " + critere.get("lat-max") + "/" + critere.put("lon-max", lon); 98 } 99 109 // } else if (from.equals("period")) { 110 // critere.put("lat-max", lat); 111 // critere.put("lat-min", lat); 112 // critere.put("lon-max", lon); 113 // critere.put("lon-min", lon); 114 // infoSup = " from " + critere.get("beg-date") + " to " + critere.get("end-date")+ 115 // " on point " + critere.get("lat-max") + "/" + critere.get("lon-max"); 116 // } else { 117 // infoSup = critere.get("lat-max") + "/" + critere.get("lat-min") + ", " + 118 // critere.get("lon-max") + "/" + critere.get("lon-min") + "" + 119 // " on date " + critere.get("beg-date"); 120 // critere.put("lat-max", lat); 121 // critere.put("lat-min", lat); 122 // critere.put("lon-max", lon); 123 // critere.put("lon-min", lon); 124 // } 100 125 return critere; 101 126 } … … 104 129 ServiceStatistique serviceStat = new ServiceStatistique(); 105 130 //serviceStat.getGraphe(getIdUnique(), critere, id_param, id_produit, "getStatistique"); 106 result = serviceStat.getStatistique(critere, id_param, id_produit, "getStatistique");107 } 108 109 private void getGraphe(Map<String, String> critere) {110 ServiceStatistique serviceStat = new ServiceStatistique();111 urlGraphe = ".." + serviceStat.getGraphe(getIdUnique(), critere, id_param, id_produit, "getGraphique");112 LoggerPerso.log(StatBean.class, LoggerPerso.INFO, "url graphe " + urlGraphe);113 }131 result = serviceStat.getStatistique(critere, id_param, id_produit, id_secteur, id_rcp, alt, type, "getStatistique"); 132 } 133 134 // private void getGraphe(Map<String, String> critere) { 135 // ServiceStatistique serviceStat = new ServiceStatistique(); 136 // urlGraphe = ".." + serviceStat.getGraphe(getIdUnique(), critere, id_param, id_produit, id_secteur, id_rcp, alt, param, produit, unite, "getGraphique"); 137 // LoggerPerso.log(StatBean.class, LoggerPerso.INFO, "url graphe " + urlGraphe); 138 // } 114 139 115 140 public ResultatStat getResult() { … … 137 162 } 138 163 139 public String getLat() { 140 return lat; 141 } 142 143 public void setLat(String lat) { 144 this.lat = lat; 145 } 146 147 public String getLon() { 148 return lon; 149 } 150 151 public void setLon(String lon) { 152 this.lon = lon; 153 } 154 155 private String getIdUnique() { 156 HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession(false); 157 if (session==null) 158 return ""; 159 160 String imageID; 161 162 163 imageID = session.getId() + session.getLastAccessedTime() ; 164 165 return imageID; 166 } 167 168 public String getUrlGraphe() { 169 return urlGraphe; 170 } 171 172 public void setUrlGraphe(String urlGraphe) { 173 this.urlGraphe = urlGraphe; 174 } 164 // public String getLat() { 165 // return lat; 166 // } 167 168 // public void setLat(String lat) { 169 // this.lat = lat; 170 // } 171 172 // public String getLon() { 173 // return lon; 174 // } 175 176 // public void setLon(String lon) { 177 // this.lon = lon; 178 // } 179 180 // public String getUrlGraphe() { 181 // return urlGraphe; 182 // } 183 184 // public void setUrlGraphe(String urlGraphe) { 185 // this.urlGraphe = urlGraphe; 186 // } 175 187 176 188 public String getInfoSup() { … … 181 193 this.infoSup = infoSup; 182 194 } 195 196 public String getParam() { 197 return param; 198 } 199 200 public void setParam(String param) { 201 this.param = param; 202 } 203 204 public String getProduit() { 205 return produit; 206 } 207 208 public void setProduit(String produit) { 209 this.produit = produit; 210 } 183 211 184 212 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/emission/BurntBean.java
r68 r70 15 15 private String date_debut; 16 16 private String date_fin; 17 private String date_debutSauv; 18 private String date_finSauv; 17 19 private UIInput datedebUI; 18 20 private UIInput datefinUI; … … 29 31 public void init() { 30 32 List<Produit> liste = emission.getService().getProduitBurntArea(); 31 32 33 33 34 34 List<SelectItem> liste_finale = new LinkedList<SelectItem>(); 35 35 for (Produit prod : liste) { 36 36 liste_finale.add(new SelectItem(prod.getIdentifiant(), prod.getNom())); 37 37 } 38 39 38 if (liste.size() != 0) { 40 Produit product = new ServiceMetier().getProduitById( (liste.get(0).getIdentifiant()));39 Produit product = new ServiceMetier().getProduitById(new Long(liste.get(0).getIdentifiant()).intValue()); 41 40 burnt.setId_item(product.getIdentifiant()); 42 41 burnt.setHeader_item(product.getHeader()); 43 42 burnt.setName_item(product.getNom()); 43 frequence = product.getTemporalres(); 44 44 date_debut = product.getBeginDate().toString(); 45 45 date_fin = product.getEndDate().toString(); 46 frequence = product.getTemporalres(); 46 date_debutSauv = date_debut; 47 date_finSauv = date_fin; 48 if (datedebUI != null) { 49 datedebUI.setValue(date_debut); 50 } 51 if (datefinUI != null) { 52 datefinUI.setValue(date_fin); 53 } 47 54 } 48 49 55 burnt.setListe_item(liste_finale); 50 56 } 51 57 52 58 public void majBurnt(ValueChangeEvent event) { 53 Produit prod = new ServiceMetier().getProduitById(( Long)event.getNewValue());59 Produit prod = new ServiceMetier().getProduitById(((Long)event.getNewValue()).intValue()); 54 60 burnt.setId_item(prod.getIdentifiant()); 55 61 burnt.setHeader_item(prod.getHeader()); … … 57 63 date_debut = prod.getBeginDate().toString(); 58 64 date_fin = prod.getEndDate().toString(); 65 date_debutSauv = date_debut; 66 date_finSauv = date_fin; 59 67 burnt.setName_item(prod.getNom()); 60 68 if (datedebUI != null) { 61 69 datedebUI.setValue(date_debut); 62 } 63 70 } 64 71 if (datefinUI != null) { 65 72 datefinUI.setValue(date_fin); … … 114 121 this.frequence = frequence; 115 122 } 116 123 124 public String getDate_debutSauv() { 125 return date_debutSauv; 126 } 127 128 public void setDate_debutSauv(String dateDebutSauv) { 129 date_debutSauv = dateDebutSauv; 130 } 131 132 public String getDate_finSauv() { 133 return date_finSauv; 134 } 135 136 public void setDate_finSauv(String dateFinSauv) { 137 date_finSauv = dateFinSauv; 138 } 117 139 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/emission/EmissionBean.java
r68 r70 2 2 3 3 4 //import org.medias.eccad.helpers.LoggerPerso; 5 import org.medias.eccad.helpers.LoggerPerso; 4 import javax.faces.application.FacesMessage; 5 import javax.faces.component.UIComponent; 6 import javax.faces.component.UIInput; 7 import javax.faces.context.FacesContext; 8 import javax.faces.validator.ValidatorException; 9 6 10 import org.medias.eccad.metier.emission.ServiceEmission; 7 11 import org.medias.eccad.modele.RequeteFacteurEmission; … … 29 33 return "page_em_landcover"; 30 34 } 31 35 36 public String prevLandcover() { 37 controleSession(); 38 return "page_emission"; 39 } 40 32 41 public String nextBurntArea() { 33 42 controleSession(); … … 40 49 return "page_em_burnt"; 41 50 } 42 51 52 public String prevBurntArea() { 53 controleSession(); 54 return "page_em_landcover"; 55 } 56 43 57 public String processData() { 44 58 controleSession(); … … 100 114 } 101 115 116 /** 117 * Valide la zone de sélection 118 * @param contexte 119 * @param composant 120 * @param objet 121 * @throws ValidatorException 122 */ 123 public void validateLatLon(FacesContext contexte, UIComponent composant, Object objet) throws ValidatorException { 124 boolean estValide = true; 125 126 if ((contexte == null) || (composant == null)) { 127 throw new NullPointerException("composant ou contexte null"); 128 } 129 130 if (!(composant instanceof UIInput)) 131 return; 132 if (!(testExiste(facteur.getNorthbcInput()) || testExiste(facteur.getSouthbcInput()) || testExiste(facteur.getEastbcInput()) || testExiste(facteur.getWestbcInput()))) { 133 return; 134 } 135 136 double north = Double.parseDouble(facteur.getNorthbcInput().getValue().toString()); 137 double south = Double.parseDouble(facteur.getSouthbcInput().getValue().toString()); 138 double east = Double.parseDouble(facteur.getEastbcInput().getValue().toString()); 139 double west = Double.parseDouble(facteur.getWestbcInput().getValue().toString()); 140 141 FacesMessage errMsg = null; 142 143 if (north<south) { 144 estValide = false; 145 errMsg = new FacesMessage("north value must be greater than south value"); 146 } 147 148 if (east<west) { 149 estValide = false; 150 errMsg = new FacesMessage("east value must be greater than west value"); 151 } 152 153 if (!estValide) 154 throw new ValidatorException(errMsg); 155 } 156 157 public void validateDate(FacesContext contexte, UIComponent composant, Object objet) throws ValidatorException { 158 boolean estValide = true; 159 if ((contexte == null) || (composant == null)) { 160 throw new NullPointerException("composant ou contexte null"); 161 } 162 if (!(composant instanceof UIInput)) 163 return; 164 165 if (burnt.getDatedebUI() == null || burnt.getDatefinUI() == null) 166 return; 167 168 if (burnt.getDatedebUI().getValue() == null || burnt.getDatefinUI().getValue() == null) 169 return; 170 171 FacesMessage errMsg = null; 172 if (burnt.getDatedebUI().getValue().toString().compareTo(burnt.getDatefinUI().getValue().toString()) > 0) { 173 estValide = false; 174 errMsg = new FacesMessage("Begin date must be lower or equal than End date"); 175 } 176 else if (burnt.getDate_debutSauv().compareTo(burnt.getDatedebUI().getValue().toString()) > 0) { 177 estValide = false; 178 errMsg = new FacesMessage("Begin date must be greater or equal than "+burnt.getDate_debutSauv()); 179 } 180 else if (burnt.getDatefinUI().getValue().toString().compareTo(burnt.getDate_finSauv()) > 0) { 181 estValide = false; 182 errMsg = new FacesMessage("End date must be lower or equal than "+burnt.getDate_finSauv()); 183 } 184 if (!estValide) 185 throw new ValidatorException(errMsg); 186 } 187 188 private boolean testExiste(UIInput compo) { 189 if (compo == null) 190 return false; 191 if (compo.getValue() == null) 192 return false; 193 return true; 194 } 102 195 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/emission/FacteurEmissionBean.java
r68 r70 4 4 import java.util.List; 5 5 6 import javax.faces.component.UIInput; 6 7 import javax.faces.event.ValueChangeEvent; 7 8 import javax.faces.model.SelectItem; 8 9 9 10 import org.medias.eccad.helpers.LoggerPerso;11 10 import org.medias.eccad.metier.ServiceMetier; 12 11 import org.medias.eccad.metier.traducteur.TraducteurVisuMultiplan; … … 22 21 private Zone zone; 23 22 private EmissionBean emissionbean; 23 // binding 24 private UIInput northbcInput; 25 private UIInput southbcInput; 26 private UIInput eastbcInput; 27 private UIInput westbcInput; 24 28 25 29 public FacteurEmissionBean(EmissionBean emissionbean) { … … 34 38 35 39 public void majProduit(ValueChangeEvent event) { 36 Produit prod = new ServiceMetier().getProduitById(( Long) event.getNewValue());40 Produit prod = new ServiceMetier().getProduitById(((Long) event.getNewValue()).intValue()); 37 41 produit.setId_item(prod.getIdentifiant()); 38 42 produit.setName_item(prod.getNom()); … … 63 67 } 64 68 65 List<SelectItem> liste_select = new TraducteurVisuMultiplan().getListGrille(liste_temp );69 List<SelectItem> liste_select = new TraducteurVisuMultiplan().getListGrille(liste_temp, null, null); 66 70 gaz.setListe_item(liste_select); 67 71 … … 78 82 List<Produit> liste_temp = emissionbean.getService().getProduitFacteurEmission(); 79 83 List<SelectItem> liste_select = new LinkedList<SelectItem>(); 80 LoggerPerso.log(FacteurEmissionBean.class, LoggerPerso.DEBUG, "liste " + liste_temp); 81 82 84 // LoggerPerso.log(FacteurEmissionBean.class, LoggerPerso.DEBUG, "liste " + liste_temp); 83 85 84 86 for (Produit prod : liste_temp) { … … 119 121 } 120 122 121 122 123 public Zone getZone() { 123 124 return zone; 124 125 } 125 126 126 127 127 public void setZone(Zone zone) { 128 128 this.zone = zone; 129 129 } 130 131 130 131 public UIInput getEastbcInput() { 132 return eastbcInput; 133 } 134 135 public void setEastbcInput(UIInput eastbcInput) { 136 this.eastbcInput = eastbcInput; 137 } 138 139 public UIInput getNorthbcInput() { 140 return northbcInput; 141 } 142 143 public void setNorthbcInput(UIInput northbcInput) { 144 this.northbcInput = northbcInput; 145 } 146 147 public UIInput getSouthbcInput() { 148 return southbcInput; 149 } 150 151 public void setSouthbcInput(UIInput southbcInput) { 152 this.southbcInput = southbcInput; 153 } 154 155 public UIInput getWestbcInput() { 156 return westbcInput; 157 } 158 159 public void setWestbcInput(UIInput westbcInput) { 160 this.westbcInput = westbcInput; 161 } 132 162 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/emission/FacteurResultatBean.java
r68 r70 20 20 public class FacteurResultatBean extends AbstractVueBean { 21 21 private String url; 22 private Zone zone_affichee; 22 private Zone zone_demandee; 23 private Zone zone_visible; 23 24 private int clicX; 24 25 private int clicY; … … 33 34 private Long colormap_id; 34 35 private UISelectOne colormapUI; 36 37 private List<SelectItem> liste_classdis; 38 private Long classdis_id; 39 private UISelectOne classdisUI; 35 40 36 41 private List<SelectItem> liste_grille; … … 57 62 public void initialisation() { 58 63 // FIXME: virer les colormap exponentielles 59 zone_ affichee = new Zone();64 zone_demandee = new Zone(); 60 65 Zone zone_init = emission.getFacteur().getZone(); 61 zone_ affichee.setNorthbc(zone_init.getNorthbc());62 zone_ affichee.setSouthbc(zone_init.getSouthbc());63 zone_ affichee.setEastbc(zone_init.getEastbc());64 zone_ affichee.setWestbc(zone_init.getWestbc());66 zone_demandee.setNorthbc(zone_init.getNorthbc()); 67 zone_demandee.setSouthbc(zone_init.getSouthbc()); 68 zone_demandee.setEastbc(zone_init.getEastbc()); 69 zone_demandee.setWestbc(zone_init.getWestbc()); 65 70 66 71 liste_grille = serviceMetier.getListGrille(emission.getBurnt().getBurnt().getId_item(), 67 72 emission.getBurnt().getDate_debut(), 68 emission.getBurnt().getDate_fin() );73 emission.getBurnt().getDate_fin(), null); 69 74 grille_id = (Long) liste_grille.get(0).getValue(); 70 75 if (grilleUI != null) 71 76 grilleUI.setValue(grille_id); 72 77 73 liste_colormap = serviceMetier.getListColorDynamique(true); 78 // liste_colormap = serviceMetier.getListColorDynamique(true); 79 liste_colormap = serviceMetier.getListMappingColor(); 74 80 colormap_id = (Long) liste_colormap.get(0).getValue(); 75 81 if (colormapUI != null) 76 82 colormapUI.setValue(colormap_id); 77 83 84 liste_classdis = serviceMetier.getListClassDynamique(); 85 classdis_id = (Long) liste_classdis.get(0).getValue(); 86 if (classdisUI != null) 87 classdisUI.setValue(classdis_id); 88 78 89 requete.setDatedeb(liste_grille.get(0).getLabel()); 79 90 requete.setDatefin(liste_grille.get(0).getLabel()); 80 91 requete.setColormap(colormap_id); 81 82 majURLCarte(); 92 requete.setClassdis(classdis_id); 93 94 majURLCarte(false,true); 83 95 } 84 96 … … 89 101 public void clicOnCarte(ActionEvent event) { 90 102 service.zoom(clicX, clicY); 91 zone_affichee = service.getzone(); 92 93 majURLCarte(); 94 } 95 96 private void majURLCarte() { 97 url = service.getCarte(requete, zone_affichee, getIdUnique()); 98 url_legend = service.getLegend(colormap_id, 5040, url); 103 zone_visible = service.getzone(); 104 105 majURLCarte(true,false); 106 } 107 108 private void majURLCarte(boolean zoom, boolean firstAff) { 109 url = service.getCarte(requete, zone_demandee, getIdUnique(), zoom, firstAff); 110 url_legend = service.getLegend(colormap_id, classdis_id, 5040, url); 111 zone_visible = service.getzone(); 99 112 ////system.out.println(url_legend); 100 113 } … … 113 126 } 114 127 115 majURLCarte( );128 majURLCarte(false,false); 116 129 } 117 130 … … 122 135 requete.setColormap(colormap_id); 123 136 124 majURLCarte( );137 majURLCarte(false,false); 125 138 } 126 139 … … 211 224 public void setWestbc(UIOutput westbc) { 212 225 this.westbc = westbc; 213 }214 215 public Zone getZone_affichee() {216 return zone_affichee;217 }218 219 public void setZone_affichee(Zone zone_affichee) {220 this.zone_affichee = zone_affichee;221 226 } 222 227 … … 261 266 this.liste_grille = liste_grille; 262 267 } 263 264 265 } 268 269 public Zone getZone_demandee() { 270 return zone_demandee; 271 } 272 273 public void setZone_demandee(Zone zoneDemandee) { 274 zone_demandee = zoneDemandee; 275 } 276 277 public Zone getZone_visible() { 278 return zone_visible; 279 } 280 281 public void setZone_visible(Zone zoneVisible) { 282 zone_visible = zoneVisible; 283 } 284 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/emission/LandcoverBean.java
r68 r70 7 7 import javax.faces.model.SelectItem; 8 8 9 import org.medias.eccad.helpers.LoggerPerso;10 9 import org.medias.eccad.metier.ServiceMetier; 11 10 import org.medias.eccad.metier.traducteur.TraducteurVisuMultiplan; … … 21 20 private List<String> selectedClass; 22 21 private String message; 23 24 22 25 23 public LandcoverBean(EmissionBean emission) { 26 24 controleSession(); 27 25 landproduit = new ProduitBean(); 28 this.emissionbean 26 this.emissionbean = emission; 29 27 message = new String(); 30 LoggerPerso.log(LandcoverBean.class, LoggerPerso.DEBUG, "constructeur landcover");28 // LoggerPerso.log(LandcoverBean.class, LoggerPerso.DEBUG, "constructeur landcover"); 31 29 } 32 30 … … 36 34 37 35 38 LoggerPerso.log(FacteurEmissionBean.class, LoggerPerso.DEBUG, "init class landcover " + liste_temp);36 // LoggerPerso.log(FacteurEmissionBean.class, LoggerPerso.DEBUG, "init class landcover " + liste_temp); 39 37 40 38 for (Produit prod : liste_temp) { … … 57 55 58 56 public void majLandCover(ValueChangeEvent event) { 59 Produit prod = new ServiceMetier().getProduitById(( Long) event.getNewValue());57 Produit prod = new ServiceMetier().getProduitById(((Long) event.getNewValue()).intValue()); 60 58 landproduit.setId_item(prod.getIdentifiant()); 61 59 landproduit.setHeader_item(prod.getHeader()); … … 66 64 private void initClass(Long id_produit) { 67 65 List<Grille> liste_temp = emissionbean.getService().getClassEmission(id_produit); 68 liste_classe = new TraducteurVisuMultiplan().getListGrille(liste_temp );66 liste_classe = new TraducteurVisuMultiplan().getListGrille(liste_temp, null, null); 69 67 selectedClass = new LinkedList<String>(); 70 68 liste_vegetation = new LinkedList<ClasseBean>(); … … 84 82 } 85 83 86 LoggerPerso.log(FacteurEmissionBean.class, LoggerPerso.DEBUG, "get class landcover > " + listeId.size() + " :: " + listeId);84 // LoggerPerso.log(FacteurEmissionBean.class, LoggerPerso.DEBUG, "get class landcover > " + listeId.size() + " :: " + listeId); 87 85 88 86 return listeId; -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/emission/ProduitBean.java
r68 r70 6 6 import javax.faces.model.SelectItem; 7 7 8 9 import org.medias.eccad.helpers.LoggerPerso;10 8 11 9 public class ProduitBean { … … 22 20 public ProduitBean() { 23 21 super(); 24 LoggerPerso.log(ProduitBean.class, LoggerPerso.DEBUG, "construction ProduitBean");22 // LoggerPerso.log(ProduitBean.class, LoggerPerso.DEBUG, "construction ProduitBean"); 25 23 } 26 24 -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/bean/emission/traducteur/TraducteurEmission.java
r68 r70 18 18 requete.setParamBurnt(emission.getService().getParamIdBurntArea()); 19 19 requete.setProduitBurnt(burnt.getBurnt().getId_item()); 20 requete.setId_rcp(new Long(0)); 21 requete.setId_secteur(new Long(0)); 22 requete.setAlt("0"); 23 requete.setId_mask(new Long(0)); 20 24 21 25 requete.setDatedeb(burnt.getDate_debut()); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/composant/ComposantPopup.java
r68 r70 3 3 import javax.faces.component.*; 4 4 import javax.faces.context.*; 5 import java.util.*;6 5 import java.io.*; 7 import javax.faces.event.*;8 6 9 7 … … 16 14 17 15 private String classe; 18 private String onclick;16 // private String onclick; 19 17 private String style; 20 private String value;18 // private String value; 21 19 22 20 //**************************************// … … 43 41 style=(String)getAttributes().get("style"); 44 42 } 45 if (getAttributes().containsKey("onclick"))46 onclick=(String)getAttributes().get("onclick");43 // if (getAttributes().containsKey("onclick")) 44 // onclick=(String)getAttributes().get("onclick"); 47 45 48 46 /** ENCODAGE **/ -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/composant/TagDivButton.java
r68 r70 45 45 // **************************************// 46 46 47 @SuppressWarnings("unchecked") 47 48 protected void setProperties(UIComponent component){ 48 49 super.setProperties(component); 49 50 ComposantPopup compo= (ComposantPopup) component; 50 51 51 if (classe != null) 52 if (classe != null) { 52 53 compo.getAttributes().put("styleClass", classe); 54 } 53 55 if (style != null) { 54 56 //system.out.println("ajout du style :: " + style); -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/listener/PhaseEcouteur.java
r68 r70 9 9 10 10 public class PhaseEcouteur implements PhaseListener{ 11 12 /** 13 * 14 */ 15 private static final long serialVersionUID = 1L; 11 16 12 17 public void afterPhase(PhaseEvent pe) { -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/traducteur/TraducteurCarte.java
r68 r70 2 2 3 3 import java.text.NumberFormat; 4 import java.util.Calendar; 5 import java.util.GregorianCalendar; 4 6 import java.util.HashMap; 5 7 import java.util.Map; … … 15 17 16 18 public Map<String, String> tradCritere2Stat(CritereBean critereBean, CarteBean carteBean) { 17 Map<String, String> critere = new HashMap<String, String>();19 Map<String, String> critere = new HashMap<String, String>(); 18 20 19 if (critereBean == null) { 20 LoggerPerso.log(TraducteurCarte.class, LoggerPerso.WARN, "criterebean null"); 21 if (critereBean == null) { 22 LoggerPerso.log(TraducteurCarte.class, LoggerPerso.WARN, "criterebean null"); 23 return critere; 24 } 25 26 String northbcN = carteBean.getZone_demandee().getNorthbcN().replace(",","."); 27 String southbcN = carteBean.getZone_demandee().getSouthbcN().replace(",","."); 28 String eastbcN = carteBean.getZone_demandee().getEastbcN().replace(",","."); 29 String westbcN = carteBean.getZone_demandee().getWestbcN().replace(",","."); 30 31 critere.put("lat-max", northbcN); 32 critere.put("lat-min", southbcN); 33 critere.put("lon-max", eastbcN); 34 critere.put("lon-min", westbcN); 35 // critere.put("lat-max", "90"); 36 // critere.put("lat-min", "-90"); 37 // critere.put("lon-max", "180"); 38 // critere.put("lon-min", "-180"); 39 critere.put("beg-date", critereBean.getBegDate()); 40 critere.put("end-date", critereBean.getEndDate()); 41 ////system.out.println("TraducteurCarte::" + critere); 21 42 return critere; 22 43 } 44 45 public Map<String, String> tradCritere2Total(CritereBean critereBean, CarteBean carteBean) { 46 Map<String, String> critere = new HashMap<String, String>(); 23 47 24 String northbcN = carteBean.getZone_affichee().getNorthbcN().replace(",","."); 25 String southbcN = carteBean.getZone_affichee().getSouthbcN().replace(",","."); 26 String eastbcN = carteBean.getZone_affichee().getEastbcN().replace(",","."); 27 String westbcN = carteBean.getZone_affichee().getWestbcN().replace(",","."); 48 if (critereBean == null) { 49 LoggerPerso.log(TraducteurCarte.class, LoggerPerso.WARN, "criterebean null"); 50 return critere; 51 } 52 String northbcN = carteBean.getZone_demandee().getNorthbcN().replace(",","."); 53 String southbcN = carteBean.getZone_demandee().getSouthbcN().replace(",","."); 54 String eastbcN = carteBean.getZone_demandee().getEastbcN().replace(",","."); 55 String westbcN = carteBean.getZone_demandee().getWestbcN().replace(",","."); 28 56 29 critere.put("lat-max", northbcN); 30 critere.put("lat-min", southbcN); 31 critere.put("lon-max", eastbcN); 32 critere.put("lon-min", westbcN); 33 critere.put("beg-date", critereBean.getBegDate()); 34 critere.put("end-date", critereBean.getEndDate()); 35 ////system.out.println("TraducteurCarte::" + critere); 36 return critere; 57 critere.put("lat-max", northbcN); 58 critere.put("lat-min", southbcN); 59 critere.put("lon-max", eastbcN); 60 critere.put("lon-min", westbcN); 61 // critere.put("lat-max", "90"); 62 // critere.put("lat-min", "-90"); 63 // critere.put("lon-max", "180"); 64 // critere.put("lon-min", "-180"); 65 String begDate, endDate; 66 if (carteBean.getTotal().equals("totalDay")) { 67 begDate = critereBean.getDay(); 68 endDate = critereBean.getDay(); 69 } else if (carteBean.getTotal().equals("totalPeriod")) { 70 begDate = critereBean.getBegDate(); 71 endDate = critereBean.getEndDate(); 72 } else if (carteBean.getTotal().equals("totalYear")) { 73 begDate = critereBean.getYear()+"-01-01"; 74 endDate = critereBean.getYear()+"-12-31"; 75 } else { 76 begDate = critereBean.getMonth()+"-01"; 77 Calendar cal = new GregorianCalendar(critereBean.getYear().intValue(), Integer.parseInt(critereBean.getMonth().substring(5))-1, 1); 78 int jourMax = cal.getActualMaximum(Calendar.DAY_OF_MONTH); 79 endDate = critereBean.getMonth()+"-"+jourMax; 80 } 81 critere.put("beg-date", begDate); 82 critere.put("end-date", endDate); 83 return critere; 37 84 } 38 39 85 40 86 public Map<String, String> tradCritere2StatReinit(CritereBean critereBean, CarteBean carteBean) { … … 48 94 numberFormat = NumberFormat.getNumberInstance(); 49 95 numberFormat.setMaximumFractionDigits(2); 50 //LoggerPerso.log(TraducteurCarte.class, LoggerPerso.DEBUG, "!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!lat-max "+ numberFormat.format(Double.toString(critereBean.getNorthbc())));96 //LoggerPerso.log(TraducteurCarte.class, LoggerPerso.DEBUG, "!!!!lat-max "+ numberFormat.format(Double.toString(critereBean.getNorthbc()))); 51 97 52 98 String northbcN = getNorthbcN(critereBean.getNorthbc()).replace(",","."); … … 65 111 critere.put("lon-min", Double.toString(critereBean.getWestbc())) ;*/ 66 112 67 //LoggerPerso.log(TraducteurCarte.class, LoggerPerso.DEBUG, "!!!! !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!lat-max "+ numberFormat.format(Double.toString(critereBean.getNorthbc())));113 //LoggerPerso.log(TraducteurCarte.class, LoggerPerso.DEBUG, "!!!!lat-max "+ numberFormat.format(Double.toString(critereBean.getNorthbc()))); 68 114 69 115 … … 72 118 ////system.out.println("TraducteurCarte::" + critere); 73 119 return critere; 120 } 121 122 public Map<String, String> tradCritere2TotalReinit(CritereBean critereBean, CarteBean carteBean) { 123 Map<String, String> critere = new HashMap<String, String>(); 124 125 if (critereBean == null) { 126 LoggerPerso.log(TraducteurCarte.class, LoggerPerso.WARN, "criterebean null"); 127 return critere; 74 128 } 129 130 numberFormat = NumberFormat.getNumberInstance(); 131 numberFormat.setMaximumFractionDigits(2); 132 133 String northbcN = getNorthbcN(critereBean.getNorthbc()).replace(",","."); 134 String southbcN = getSouthbcN(critereBean.getSouthbc()).replace(",","."); 135 String eastbcN = getEastbcN(critereBean.getEastbc()).replace(",","."); 136 String westbcN = getWestbcN(critereBean.getWestbc()).replace(",","."); 137 138 critere.put("lat-max", northbcN) ; 139 critere.put("lat-min", southbcN) ; 140 critere.put("lon-max", eastbcN) ; 141 critere.put("lon-min", westbcN) ; 142 143 String begDate, endDate; 144 if (carteBean.getTotal().equals("totalDay")) { 145 begDate = critereBean.getDay(); 146 endDate = critereBean.getDay(); 147 } else if (carteBean.getTotal().equals("totalPeriod")) { 148 begDate = critereBean.getBegDate(); 149 endDate = critereBean.getEndDate(); 150 } else if (carteBean.getTotal().equals("totalYear")) { 151 begDate = critereBean.getYear()+"-01-01"; 152 endDate = critereBean.getYear()+"-12-31"; 153 } else { 154 begDate = critereBean.getMonth()+"-01"; 155 Calendar cal = new GregorianCalendar(critereBean.getYear().intValue(), Integer.parseInt(critereBean.getMonth().substring(5))-1, 1); 156 int jourMax = cal.getActualMaximum(Calendar.DAY_OF_MONTH); 157 endDate = critereBean.getMonth()+"-"+jourMax; 158 } 159 critere.put("beg-date", begDate); 160 critere.put("end-date", endDate); 161 return critere; 162 } 75 163 76 164 public String getEastbcN(Double eastbc) { -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/presentation/validation/DateValidation.java
r68 r70 10 10 import javax.faces.validator.Validator; 11 11 import javax.faces.validator.ValidatorException; 12 13 import org.medias.eccad.helpers.LoggerPerso;14 12 15 13 public class DateValidation implements Validator{ … … 33 31 34 32 if (estValide) { 35 int intYear = getYear(valeur);33 // int intYear = getYear(valeur); 36 34 int intMonth = getMonth(valeur); 37 35 int intDay = getDay(valeur); 38 36 39 // if (intYear < 1900 || intYear > 2200)40 // estValide = false;41 37 if (intMonth < 1 || intMonth > 12) 42 38 estValide = false; … … 53 49 } 54 50 } 55 private int getYear(String date){51 // private int getYear(String date){ 56 52 57 LoggerPerso.log(DateValidation.class, LoggerPerso.DEBUG, "getYear(String date "+Integer.parseInt(date.substring(0,4)));58 return Integer.parseInt(date.substring(0,4));59 }53 // LoggerPerso.log(DateValidation.class, LoggerPerso.DEBUG, "getYear(String date "+Integer.parseInt(date.substring(0,4))); 54 // return Integer.parseInt(date.substring(0,4)); 55 // } 60 56 private int getMonth(String date){ 61 57 62 LoggerPerso.log(DateValidation.class, LoggerPerso.DEBUG, "getMonth(String date) "+Integer.parseInt(date.substring(5,7)));58 // LoggerPerso.log(DateValidation.class, LoggerPerso.DEBUG, "getMonth(String date) "+Integer.parseInt(date.substring(5,7))); 63 59 return Integer.parseInt(date.substring(5,7)); 64 60 } 65 61 private int getDay(String date){ 66 62 67 LoggerPerso.log(DateValidation.class, LoggerPerso.DEBUG, "getDay(String date) "+Integer.parseInt(date.substring(8,10)));63 // LoggerPerso.log(DateValidation.class, LoggerPerso.DEBUG, "getDay(String date) "+Integer.parseInt(date.substring(8,10))); 68 64 return Integer.parseInt(date.substring(8,10)); 69 65 } -
ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/servlet/ServletService.java
r68 r70 10 10 import java.io.PrintWriter; 11 11 12 import javax.faces.context.FacesContext;13 12 import javax.servlet.ServletException; 14 13 import javax.servlet.http.HttpServletRequest; 15 14 import javax.servlet.http.HttpServletResponse; 16 import javax.servlet.http.HttpSession;17 15 18 16 19 17 import org.medias.eccad.helpers.LoggerPerso; 20 18 import org.medias.eccad.metier.ServiceMetadata; 21 import org.medias.eccad.presentation.bean.CritereBean;22 import org.medias.eccad.presentation.bean.DeconnectionException;23 19 import org.medias.eccad.presentation.bean.MetadataBean; 24 import org.medias.eccad.presentation.bean.SessionBean;25 20 import org.medias.jni.RasterDAO; 26 21 … … 43 38 44 39 45 private void controleSession() throws DeconnectionException {46 SessionBean sessionbean = (SessionBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("sessionBean");47 if (sessionbean == null || sessionbean.getEmail() == null || sessionbean.getEmail() == "")48 throw new DeconnectionException();49 }40 // private void controleSession() throws DeconnectionException { 41 // SessionBean sessionbean = (SessionBean)((HttpSession)FacesContext.getCurrentInstance().getExternalContext().getSession(false)).getAttribute("sessionBean"); 42 // if (sessionbean == null || sessionbean.getEmail() == null || sessionbean.getEmail() == "") 43 // throw new DeconnectionException(); 44 // } 50 45 51 46 protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
Note: See TracChangeset
for help on using the changeset viewer.