Subversion Repositories eFlore/Archives.cel-v2

Rev

Rev 4 | Rev 16 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package org.tela_botanica.client.modeles;

import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;

import com.google.gwt.json.client.JSONObject;

/**
 * 
 * Classe representant une image du carnet,
 * elle ne contient pas d'image à proprement parler mais
 * plutôt les informations associées ainsi que l'url distante 
 * 
 */
public class ImageCarnet extends HashMap {
        
        /*
        // infos sur l'image
        private String url = " " ;
        private String ordre = " " ;
        private String utilisateur = " " ;
        private boolean publiable = false ;
        private String height = "0" ;
        private String width = "0" ;
        private String make = " " ;
        private String model = " " ;
        private String xResolution = "0" ;
        private String yResolution = "0" ;
        private String date = " " ;
        private String GPS = " " ;
        private String comment = " " ;
        
        // metadonnees exif
        private String exifExposureTime = " " ;
        private String exifFNumber = " " ;
        private String exifVersion = " " ;
        private String exifCompressedBitsPerPixel = " " ;
        private String exifShutterSpeedValue = " " ;
        private String exifApertureValue = " " ;
        private String exifExposureBiasValue = " " ;
        private String exifMaxApertureValue = " " ;
        private String exifMeteringMode = " " ;
        private String exifLightSource = " " ;
        private String exifFlash = "  " ;
        private String exifFocalLength = " " ;
        private String exifFlashPixVersion = " " ;
        private String exifColorSpace = " " ;
        private String exifInteroperabilityOffset = " " ;
        private String exifFocalPlaneXResolution = " " ;
        private String exifFocalPlaneYResolution = " " ;
        private String exifFocalPlaneResolutionUnit = " " ;
        private String exifSensingMethod = " " ;
        private String exifFileSource = " " ;
        private String exifCustomRendered = " " ;
        private String exifExposureMode = " " ;
        private String exifWhiteBalance = " " ;
        private String exifDigitalZoomRatio = " " ;
        private String exifSceneCaptureType = " " ;
        private String exifGainControl = " " ;
        private String exifContrast = " " ;
        private String exifSaturation = " " ;
        private String exifSharpness = " " ;
        private String exifSubjectDistanceRange = " " ;
        private String exifAutres = " " ;
        
        // metadonnes iptc
        private String iptcMotsCles = " " ;
        private String iptcByLine = " " ;
        private String iptcByLineTitle = " " ;
        private String iptcCity = " " ;
        private String iptcSubLocation = " " ;
        private String iptcProvinceState = " " ;
        private String iptcCountryPrimaryLocationCode = " " ;
        private String iptcHeadline = " " ;
        private String iptcCredit = " " ;
        private String iptcCopyrightNotice = " " ;
        private String iptcContact = " " ;
        private String iptcAutres = " " ;
        */

        public ImageCarnet(JSONObject image)
        {       
                Set im = image.keySet() ;
                
                for (Iterator iterator = im.iterator(); iterator.hasNext();) {
                        
                        String key = (String) iterator.next();
                        if(image.get(key).isString() != null)
                        {
                                String valeur = image.get(key).isString().stringValue() ;
                                this.put(key, valeur) ;
                        }
                        
                }

        }
        
        public String renvoyerValeurCorrecte(String cle)
        {
                if(this.containsKey((cle)))
                {
                        String valeur = (String)this.get(cle) ;
                        if(valeur.equals("null"))
                        {
                                return " " ;
                        }
                        else
                        {
                                return valeur ;
                        }
                }
                else
                {
                        return " " ;
                }
        }

        
        public String getOrdre() {
                
                return renvoyerValeurCorrecte("ci_ordre") ;
        }
        
        public String getBaseUrl()
        {
                return "http://localhost/Documents/images_serveur/" ;
        }

        public String getUrl() {
                
                return getBaseUrl()+(String)this.get("ci_id_image")+".jpg" ;
        }
        
        public String getSUrl() {
                
                return getBaseUrl()+(String)this.get("ci_id_image")+"_S.jpg" ;
        }
        
        public String getMUrl() {
                
                return getBaseUrl()+(String)this.get("ci_id_image")+"_M.jpg" ;
        }
        


        public String getDate() {
                
                return renvoyerValeurCorrecte("ci_meta_date_time") ;
        }


        public Object getIptcCity() {
                
                return renvoyerValeurCorrecte("ci_meta_iptc_city") ;
        }


        public String getMake() {
                
                return renvoyerValeurCorrecte("ci_meta_make") ;
        }


        public String getModel() {
                
                return renvoyerValeurCorrecte("ci_meta_model") ;
        }
}