Ignore:
Timestamp:
04/26/10 19:12:49 (14 years ago)
Author:
cbipsl
Message:

maj eccad V3.2

File:
1 edited

Legend:

Unmodified
Added
Removed
  • ether_eccad/trunk/ECCAD_INTERFACE/WEB-INF/src/org/medias/eccad/metier/statistique/ServiceStatistique.java

    r68 r70  
    55import java.util.Map; 
    66 
    7  
    8 import org.medias.eccad.helpers.LoggerPerso; 
    97import org.medias.eccad.helpers.SpringBeanFactory; 
    10 import org.medias.eccad.helpers.XmlHelper; 
    118import org.medias.eccad.metier.generationRaster.GenerateurLegendRaster; 
    129import org.medias.eccad.metier.generationRaster.GenerateurLegendeImg; 
    13 import org.medias.eccad.metier.generationRaster.GenerateurWorldFile; 
    1410import org.medias.eccad.metier.generationRaster.InformationLegend; 
    1511import org.medias.eccad.metier.generationRaster.colorMap.ColorMapping; 
     
    2016import org.medias.eccad.modele.StatReponse; 
    2117import org.medias.eccad.modele.Valeur; 
    22 import org.medias.eccad.modele.Zone; 
    2318import org.medias.eccad.persistance.dao.ColorTabDAO; 
    2419import org.medias.eccad.persistance.exception.PersistanceException; 
     
    3530        } 
    3631         
    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 
    4035                // TODO: ici modifier pour prendre en compte la librairie de jean-luc 
    4136                //RasterDAO rasterdao = new RasterDAO(); 
    4237                GrapheCGI rasterdao = new GrapheCGI(); 
    43                 ////system.out.println(xml); 
     38 
    4439                reponse = decodeReponse(rasterdao.getStatistique(xml)); 
    4540                if (reponse.getError() != null && !reponse.getError().equals("")) 
    4641                        return null; 
    4742                 
    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)); 
    5348                 
    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(); 
    6255                return reponse; 
    6356        } 
    6457         
    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); 
    6861                InformationLegend info_legend = new InformationLegend(); 
    6962                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)); 
    7265                gen_legend.enregistreLegend(fichier+".legend.png"); 
    73                  
     66 
    7467                return fichier+".legend.png"; 
    7568        } 
    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) { 
    7871                //RasterDAO rasterdao = new RasterDAO(); 
    7972                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); 
    8374                reponse = decodeReponse(rasterdao.getStatistique(xml)); 
    8475                if (reponse == null) 
    85                         return new ResultatStat("0", "0", "0", "0", "0"); 
     76                        return new ResultatStat("0", "0", "0", "0", "0",type); 
    8677                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); 
    8879        } 
    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) { 
    9182                //RasterDAO rasterdao = new RasterDAO(); 
    9283                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); 
    9586                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); 
    9788                reponse = decodeReponse(str_reponse); 
    98                 LoggerPerso.log(ServiceStatistique.class, LoggerPerso.DEBUG, "decodage OK"); 
    9989                List<Valeur> graphe; 
    10090                if (reponse == null) 
     
    10292                else 
    10393                        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); 
    10696        } 
    107          
    108          
    109          
     97 
    11098        public StatReponse decodeReponse(String reponse_xml) { 
    11199                reponse = traducteur.getReponse(reponse_xml); 
    112                  
     100 
    113101                if (reponse.getError() != null && !reponse.getError().equals("")) 
    114102                        return null; 
    115103                return reponse; 
    116104        } 
    117          
     105 
    118106        /** 
    119107         * Interroge la base de données pour obtenir la table de couleur de la grille 
     
    122110         * @return la table de couleur par défaut 
    123111         */ 
    124         private ColorMapping getColorMap(long colormapid) { 
     112        private ColorMapping getColorMap(long colormapid, long classdisid) { 
    125113                ColorTabDAO colorDAO = (ColorTabDAO) xmlbean.getBean("colorTabDAO"); 
    126                  
     114 
    127115                ColorTab colortab = null; 
    128                  
     116 
    129117                try { 
    130                         colortab = colorDAO.getColorMapByID(colormapid); 
     118                        colortab = colorDAO.getColorMapByID(colormapid,classdisid); 
    131119                } catch (PersistanceException e) { 
    132120                        e.printStackTrace(); 
    133121                } 
    134                  
     122 
    135123                ColorMapping colormap = new ColorMappingLineaire(); 
    136124                colormap.setColorTable(colortab); 
Note: See TracChangeset for help on using the changeset viewer.