Changeset 424
- Timestamp:
- 03/21/12 13:54:38 (12 years ago)
- Location:
- ether_megapoli/trunk
- Files:
-
- 14 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/domain/interface/com/medias/annuaire/Personne.java
r89 r424 1 1 package com.medias.annuaire; 2 3 import com.medias.ConversionException; 4 import com.medias.utils.Entity; 5 import com.medias.xml.metadata.Contact; 6 import org.jdom.Attribute; 7 import org.jdom.Element; 2 8 3 9 import java.util.ArrayList; 4 10 import java.util.Iterator; 5 11 import java.util.List; 6 7 import com.medias.ConversionException;8 import com.medias.xml.metadata.Contact;9 import org.jdom.Attribute;10 import org.jdom.Element;11 import com.medias.xml.metadata.Contact;12 import com.medias.ConversionException;13 import org.medias.megapoli.utils.Entity;14 12 15 13 /** … … 18 16 * Created on 22 févr. 2005 19 17 */ 20 public class Personne implements Entity { 18 public class Personne implements Entity 19 { 21 20 /** 22 21 * -
ether_megapoli/trunk/domain/interface/com/medias/database/objects/Jeu.java
r89 r424 71 71 private Set<Fichier> fichiers = new HashSet<Fichier>(0); 72 72 73 private Set<RequeteNbvalsJeu> requeteNbvalsJeus = new HashSet<RequeteNbvalsJeu>( 74 0); 73 private Set<RequeteNbvalsJeu> requeteNbvalsJeus = new HashSet<RequeteNbvalsJeu>(0); 74 75 private int nbFichiers; 75 76 76 77 public Jeu() { … … 353 354 this.jeuNumversion = jeuNumversion; 354 355 } 356 357 public int getNbFichiers() { 358 return nbFichiers; 359 } 360 361 public void setNbFichiers(int nbFichiers) { 362 this.nbFichiers = nbFichiers; 363 } 355 364 } -
ether_megapoli/trunk/domain/interface/com/medias/database/objects/Valeur.java
r89 r424 29 29 private Double valeurDelta; 30 30 31 private Double valeurLod; 32 31 33 public Valeur() { 32 34 } … … 43 45 public Valeur(int valeurId, Flag flagByValeurFlag, Capteur capteur, 44 46 Parametre parametre, Flag flagByValiditeFlag, Mesure mesure, 45 double valeurVal, Double valeurDelta ) {47 double valeurVal, Double valeurDelta, Double valeurLod) { 46 48 this.valeurId = valeurId; 47 49 this.flagByValeurFlag = flagByValeurFlag; … … 52 54 this.valeurVal = valeurVal; 53 55 this.valeurDelta = valeurDelta; 56 this.valeurLod = valeurLod; 54 57 } 55 58 … … 118 121 } 119 122 123 public Double getValeurLod() { 124 return valeurLod; 125 } 126 127 public void setValeurLod(Double valeurLod) { 128 this.valeurLod = valeurLod; 129 } 120 130 } -
ether_megapoli/trunk/domain/interface/com/medias/xml/metadata/Contact.java
r89 r424 2 2 3 3 import com.medias.ConversionException; 4 import com.medias.utils.Entity; 4 5 import org.jdom.Element; 5 import com.medias.ConversionException;6 import org.medias.megapoli.utils.Entity;7 6 8 7 /** … … 12 11 * Représente un contact (une personne) 13 12 */ 14 public class Contact implements Entity{ 13 public class Contact implements Entity 14 { 15 15 /** 16 16 * -
ether_megapoli/trunk/domain/interface/com/medias/xml/metadata/Contenu.java
r89 r424 1 1 package com.medias.xml.metadata; 2 3 import com.medias.ConversionException; 4 import com.medias.utils.Entity; 5 import org.jdom.Element; 2 6 3 7 import java.util.ArrayList; 4 8 import java.util.Iterator; 5 9 import java.util.List; 6 7 import org.jdom.Element;8 import com.medias.ConversionException;9 import org.medias.megapoli.utils.Entity;10 10 11 11 /** … … 14 14 * Created on 24 févr. 2005 15 15 */ 16 public class Contenu implements Entity { 16 public class Contenu implements Entity 17 { 17 18 /** 18 19 * -
ether_megapoli/trunk/domain/interface/com/medias/xml/metadata/Description.java
r89 r424 1 1 package com.medias.xml.metadata; 2 2 3 import org.jdom.*;4 3 import com.medias.ConversionException; 5 import org.medias.megapoli.utils.Entity; 4 import com.medias.utils.Entity; 5 import org.jdom.Element; 6 6 7 7 /** … … 10 10 * Created on 10 févr. 2005 11 11 */ 12 public class Description implements Entity{ 12 public class Description implements Entity 13 { 13 14 /** 14 15 * -
ether_megapoli/trunk/domain/interface/com/medias/xml/metadata/Duree.java
r89 r424 1 1 package com.medias.xml.metadata; 2 2 3 import org.jdom.*;4 3 import com.medias.ConversionException; 5 import org.medias.megapoli.utils.Entity; 4 import com.medias.utils.Entity; 5 import org.jdom.Element; 6 6 7 7 /** … … 10 10 * Created on 10 févr. 2005 11 11 */ 12 public class Duree implements Entity { 12 public class Duree implements Entity 13 { 13 14 /** 14 15 * -
ether_megapoli/trunk/domain/interface/com/medias/xml/metadata/ExactTime.java
r89 r424 2 2 3 3 import com.medias.ConversionException; 4 import org.medias.megapoli.utils.Entity;5 4 import com.medias.DateTime; 5 import com.medias.utils.Entity; 6 import org.jdom.Element; 7 8 import java.sql.Timestamp; 6 9 import java.util.Date; 7 import java.sql.Timestamp;8 import org.jdom.*;9 10 10 11 /** … … 14 15 * Window - Preferences - Java - Code Style - Code Templates 15 16 */ 16 public class ExactTime implements Entity { 17 public class ExactTime implements Entity 18 { 17 19 /** 18 20 * -
ether_megapoli/trunk/domain/interface/com/medias/xml/metadata/Integration.java
r89 r424 1 1 package com.medias.xml.metadata; 2 2 3 import org.jdom.*;4 3 import com.medias.ConversionException; 5 import org.medias.megapoli.utils.Entity; 4 import com.medias.utils.Entity; 5 import org.jdom.Element; 6 6 7 7 /** … … 11 11 * Window - Preferences - Java - Code Style - Code Templates 12 12 */ 13 public class Integration implements Entity { 13 public class Integration implements Entity 14 { 14 15 /** 15 16 * -
ether_megapoli/trunk/domain/interface/com/medias/xml/metadata/Metadata.java
r89 r424 2 2 3 3 4 import com.medias.ConversionException; 5 import com.medias.utils.Entity; 6 import com.medias.xml.XMLBuilder; 4 7 import com.medias.xml.hierarchie.Hierarchie; 5 import com.medias.ConversionException; 6 import org.medias.megapoli.utils.Entity; 7 import com.medias.xml.XMLBuilder; 8 import org.jdom.*; 8 import org.jdom.Element; 9 import org.jdom.JDOMException; 9 10 10 11 import java.io.IOException; … … 17 18 * 18 19 */ 19 public class Metadata implements Entity { 20 public class Metadata implements Entity 21 { 20 22 21 23 /** -
ether_megapoli/trunk/domain/interface/com/medias/xml/metadata/Parametre.java
r89 r424 1 1 package com.medias.xml.metadata; 2 2 3 import com.medias.Constantes; 4 import com.medias.ConversionException; 5 import com.medias.utils.Entity; 6 import org.jdom.Element; 7 3 8 import java.util.Comparator; 4 5 import com.medias.ConversionException;6 import org.jdom.*;7 import com.medias.ConversionException;8 import org.medias.megapoli.utils.Entity;9 import com.medias.Constantes;10 9 11 10 /** … … 15 14 * Window - Preferences - Java - Code Style - Code Templates 16 15 */ 17 public class Parametre implements Entity { 16 public class Parametre implements Entity 17 { 18 18 /** 19 19 * -
ether_megapoli/trunk/domain/interface/com/medias/xml/metadata/Plateforme.java
r89 r424 1 1 package com.medias.xml.metadata; 2 3 import com.medias.Constantes; 4 import com.medias.ConversionException; 5 import com.medias.utils.Entity; 6 import org.apache.struts.upload.FormFile; 7 import org.jdom.Element; 2 8 3 9 import java.util.ArrayList; … … 5 11 import java.util.Iterator; 6 12 import java.util.List; 7 8 import org.apache.struts.upload.FormFile;9 import org.jdom.*;10 import com.medias.ConversionException;11 import org.medias.megapoli.utils.Entity;12 import com.medias.Constantes;13 13 14 14 /** … … 17 17 * Created on 10 févr. 2005 18 18 */ 19 public class Plateforme implements Entity { 19 public class Plateforme implements Entity 20 { 20 21 /** 21 22 * -
ether_megapoli/trunk/domain/interface/com/medias/xml/metadata/Presentation.java
r89 r424 1 1 package com.medias.xml.metadata; 2 3 import com.medias.ConversionException; 4 import com.medias.utils.Entity; 5 import org.jdom.Element; 2 6 3 7 import java.util.ArrayList; 4 8 import java.util.Iterator; 5 9 import java.util.List; 6 7 import org.jdom.*;8 import com.medias.ConversionException;9 import org.medias.megapoli.utils.Entity;10 10 11 11 /** … … 15 15 * Represente la partie "Presentation" des metadonnees. 16 16 */ 17 public class Presentation implements Entity{ 17 public class Presentation implements Entity 18 { 18 19 /** 19 20 * -
ether_megapoli/trunk/service/test/com/ether/SGTTest.java
r294 r424 1 1 package com.ether; 2 2 3 import com.ether.annotation.ControllerMethod;4 import com.ether.annotation.Mandatory;5 import com.ether.annotation.ParamName;6 3 //import com.ether.tutorial.src.tutorial.Example1; 7 4 //import com.ether.tutorial.src.tutorial.SBExample1; … … 10 7 //import com.keypoint.PngEncoder; 11 8 //import com.keypoint.PngEncoderB; 12 import gov.noaa.pmel.sgt.JPane;13 import gov.noaa.pmel.sgt.LineAttribute;14 import gov.noaa.pmel.sgt.beans.*;15 import gov.noaa.pmel.sgt.dm.SGTMetaData;16 import gov.noaa.pmel.sgt.dm.SimpleLine;17 import gov.noaa.pmel.sgt.swing.JPlotLayout;18 import gov.noaa.pmel.util.GeoDateArray;19 import net.sf.json.JSONObject;20 import org.jetbrains.annotations.NotNull;21 import org.jetbrains.annotations.Nullable;22 import org.junit.Test;23 24 import javax.imageio.ImageIO;25 import javax.servlet.ServletException;26 import javax.servlet.http.HttpServletResponse;27 import javax.swing.*;28 import java.awt.*;29 import java.awt.image.BufferedImage;30 import java.io.File;31 import java.io.FileInputStream;32 import java.io.IOException;33 import java.text.ParseException;34 import java.util.Date;35 import java.util.Map;36 9 37 10 /** … … 42 15 extends EtherTest 43 16 { 44 @Test45 public void testImageKeroppi()46 throws Exception47 {48 JFrame frame = new JFrame( "Test de superposition" );49 JLayeredPane lp = frame.getLayeredPane();50 JPanel p1 = new JPanel();51 ImageIcon ic = new ImageIcon( "service/test/kerropi1.jpg" );52 JLabel l = new JLabel( ic );53 p1.setBounds( 0, 0, 640, 480 );54 55 p1.add( l );56 lp.add( p1, 1 );57 58 p1.setVisible( true ); //Quand on met à false, le rectangle apparait !59 frame.setSize( 700, 550 );60 frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );61 frame.setVisible( true );62 63 copyToFile( frame, "service/test/test_ImageIcon.jpg" );64 }65 66 @Test67 public void testJLabel()68 throws Exception69 {70 final JFrame frame = new JFrame( "Frame principale" );71 final JPanel panel = new JPanel( new BorderLayout() );72 73 final JLabel jlbHelloWorld = new JLabel( "Hello World" );74 panel.add( jlbHelloWorld, BorderLayout.EAST );75 panel.setVisible( true );76 frame.setContentPane( panel );77 78 frame.setSize( 700, 550 );79 frame.setVisible( true );80 81 copyToFile( frame, "service/test/test_JLabel.jpg" );82 }83 84 @Test85 public void testJPlotLayout()86 throws Exception87 {88 final JFrame frame = new JFrame( "Frame principale" );89 final JPanel panel = new JPanel( new BorderLayout() );90 91 final JLabel jlbHelloWorld = new JLabel( "Hello World" );92 panel.add( jlbHelloWorld, BorderLayout.SOUTH );93 94 final ImageIcon ic = new ImageIcon( "service/test/kerropi1.jpg" );95 final JLabel jLabel = new JLabel( ic );96 panel.add( jLabel, BorderLayout.EAST );97 98 final JPlotLayout jPlotLayout = new JPlotLayout( false, false, false, "Trajectory data", null, false );99 jPlotLayout.setTitles( "title1", "title2", "title3" );100 jPlotLayout.setVisible( true );101 panel.add( jPlotLayout, BorderLayout.NORTH );102 103 panel.setVisible( true );104 frame.setContentPane( panel );105 106 frame.setSize( 700, 550 );107 frame.setVisible( true );108 109 Thread.sleep( 100 );110 copyToFile( frame, "service/test/test_JPlotLayout.jpg" );111 }112 113 17 // @Test 114 // public void test Example1()18 // public void testImageKeroppi() 115 19 // throws Exception 116 20 // { 117 // new Example1(); 21 // JFrame frame = new JFrame( "Test de superposition" ); 22 // JLayeredPane lp = frame.getLayeredPane(); 23 // JPanel p1 = new JPanel(); 24 // ImageIcon ic = new ImageIcon( "service/test/kerropi1.jpg" ); 25 // JLabel l = new JLabel( ic ); 26 // p1.setBounds( 0, 0, 640, 480 ); 27 // 28 // p1.add( l ); 29 // lp.add( p1, 1 ); 30 // 31 // p1.setVisible( true ); //Quand on met à false, le rectangle apparait ! 32 // frame.setSize( 700, 550 ); 33 // frame.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); 34 // frame.setVisible( true ); 35 // 36 // copyToFile( frame, "service/test/test_ImageIcon.jpg" ); 118 37 // } 119 38 // 120 39 // @Test 121 // public void test SBExamples()40 // public void testJLabel() 122 41 // throws Exception 123 42 // { 124 // final SBExample1 frame = new SBExample1(); 125 // frame.pack(); 126 // frame.setResizable( false ); 43 // final JFrame frame = new JFrame( "Frame principale" ); 44 // final JPanel panel = new JPanel( new BorderLayout() ); 45 // 46 // final JLabel jlbHelloWorld = new JLabel( "Hello World" ); 47 // panel.add( jlbHelloWorld, BorderLayout.EAST ); 48 // panel.setVisible( true ); 49 // frame.setContentPane( panel ); 50 // 51 // frame.setSize( 700, 550 ); 127 52 // frame.setVisible( true ); 53 // 54 // copyToFile( frame, "service/test/test_JLabel.jpg" ); 55 // } 56 // 57 // @Test 58 // public void testJPlotLayout() 59 // throws Exception 60 // { 61 // final JFrame frame = new JFrame( "Frame principale" ); 62 // final JPanel panel = new JPanel( new BorderLayout() ); 63 // 64 // final JLabel jlbHelloWorld = new JLabel( "Hello World" ); 65 // panel.add( jlbHelloWorld, BorderLayout.SOUTH ); 66 // 67 // final ImageIcon ic = new ImageIcon( "service/test/kerropi1.jpg" ); 68 // final JLabel jLabel = new JLabel( ic ); 69 // panel.add( jLabel, BorderLayout.EAST ); 70 // 71 // final JPlotLayout jPlotLayout = new JPlotLayout( false, false, false, "Trajectory data", null, false ); 72 // jPlotLayout.setTitles( "title1", "title2", "title3" ); 73 // jPlotLayout.setVisible( true ); 74 // panel.add( jPlotLayout, BorderLayout.NORTH ); 75 // 76 // panel.setVisible( true ); 77 // frame.setContentPane( panel ); 78 // 79 // frame.setSize( 700, 550 ); 80 // frame.setVisible( true ); 81 // 128 82 // Thread.sleep( 100 ); 129 // copyToFile( frame, "service/test/test_SBExample1.jpg" ); 130 // 131 // final SBExample2 frame2 = new SBExample2(); 132 // frame2.pack(); 133 // frame2.setResizable( false ); 134 // frame2.setVisible( true ); 135 // Thread.sleep( 100 ); 136 // copyToFile( frame2, "service/test/test_SBExample2.jpg" ); 137 // 138 // final SBExample3 frame3 = new SBExample3(); 139 // frame3.pack(); 140 // //Center the window 141 // final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 142 // final Dimension frameSize = frame3.getSize(); 143 // if( frameSize.height > screenSize.height ) 144 // { 145 // frameSize.height = screenSize.height; 146 // } 147 // if( frameSize.width > screenSize.width ) 148 // { 149 // frameSize.width = screenSize.width; 150 // } 151 // frame3.setLocation( ( screenSize.width - frameSize.width ) / 2, ( screenSize.height - frameSize.height ) / 2 ); 152 // frame3.setResizable( false ); 153 // frame3.setVisible( true ); 154 // Thread.sleep( 100 ); 155 // copyToFile( frame3, "service/test/test_SBExample3.jpg" ); 156 // } 157 158 @Test 159 /** 160 * TODO : 161 * - démarrer plot à (0,0) 162 * - légende de l'axe des temps 163 * - titre du graph ?? 164 * - légende générale 165 * 166 */ 167 public void testTimeSeriePlot() 168 throws Exception 169 { 170 // Values to configure plot 171 final String parameterName = "OZONE"; 172 final String parameterUnit = "ppbv"; 173 final boolean startToZero = true; 174 final boolean markPoint = false; 175 176 final GeoDateArray dateArray = createTimeArray( 10, null ); 177 final double[] dataArray = createDataArray( 10, 5 ); 178 179 // for( int i = 0; i < dateArray.getLength(); i++ ) 180 // System.out.println( dateArray.getGeoDate( i ).toString() ); 181 // 182 // for( int i = 0; i < dataArray.length; i++ ) 183 // System.out.println( dataArray[i] ); 184 185 SimpleLine data = new SimpleLine( dateArray, dataArray, "legend" ); 186 SGTMetaData meta = new SGTMetaData( "Longitude", "degrees East", false, false ); 187 data.setXMetaData( meta ); 188 189 meta = new SGTMetaData( parameterName, parameterUnit, false, false ); 190 data.setYMetaData( meta ); 191 192 final LineAttribute lineAttribute = createLineAttribute( markPoint ); 193 194 final MegapoliPlot timeSeriesPlot = new MegapoliPlot(); 195 timeSeriesPlot.setTitle( "Keroppi title" ); 196 timeSeriesPlot.setLogoMegapoli( "keroppi1.jpg" ); 197 // timeSeriesPlot.setData( data ); 198 // timeSeriesPlot.setLineAttribute( lineAttribute ); 199 200 // getEtherPlotService().createTimeSeriesPlot( timeSeriesPlot ); 201 // timeSeriesPlot.createTimeSeriesPlot(); 202 // 203 // timeSeriesPlot.pack(); 204 // timeSeriesPlot.setResizable( false ); 205 // timeSeriesPlot.setVisible( true ); 206 // 207 Thread.sleep( 100 ); 208 // copyToFile( timeSeriesPlot, "service/test/test_TimeSeriesFrameeee.jpg" ); 209 // 210 // final Image image = timeSeriesPlot.createImage( 400, 400 ); 211 212 // BufferedImage bufferedImage = toBufferedImage( image ); 213 // BASE64Encoder encoder = new BASE64Encoder(); 214 // encoder.encode( bufferedImage ); 215 216 // PngEncoder pngEncoder = new PngEncoder(); 217 // pngEncoder.setImage( image ); 218 // byte[] bytes = pngEncoder.pngEncode(); 219 } 220 83 // copyToFile( frame, "service/test/test_JPlotLayout.jpg" ); 84 // } 85 // 86 //// @Test 87 //// public void testExample1() 88 //// throws Exception 89 //// { 90 //// new Example1(); 91 //// } 92 //// 93 //// @Test 94 //// public void testSBExamples() 95 //// throws Exception 96 //// { 97 //// final SBExample1 frame = new SBExample1(); 98 //// frame.pack(); 99 //// frame.setResizable( false ); 100 //// frame.setVisible( true ); 101 //// Thread.sleep( 100 ); 102 //// copyToFile( frame, "service/test/test_SBExample1.jpg" ); 103 //// 104 //// final SBExample2 frame2 = new SBExample2(); 105 //// frame2.pack(); 106 //// frame2.setResizable( false ); 107 //// frame2.setVisible( true ); 108 //// Thread.sleep( 100 ); 109 //// copyToFile( frame2, "service/test/test_SBExample2.jpg" ); 110 //// 111 //// final SBExample3 frame3 = new SBExample3(); 112 //// frame3.pack(); 113 //// //Center the window 114 //// final Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize(); 115 //// final Dimension frameSize = frame3.getSize(); 116 //// if( frameSize.height > screenSize.height ) 117 //// { 118 //// frameSize.height = screenSize.height; 119 //// } 120 //// if( frameSize.width > screenSize.width ) 121 //// { 122 //// frameSize.width = screenSize.width; 123 //// } 124 //// frame3.setLocation( ( screenSize.width - frameSize.width ) / 2, ( screenSize.height - frameSize.height ) / 2 ); 125 //// frame3.setResizable( false ); 126 //// frame3.setVisible( true ); 127 //// Thread.sleep( 100 ); 128 //// copyToFile( frame3, "service/test/test_SBExample3.jpg" ); 129 //// } 130 // 221 131 // @Test 222 // public void testSerializationImage() throws Exception { 223 // Example1 example = new Example1(); 224 // 225 // Image createdImage = example.createImage(example.getWidth(), example.getHeight()); 226 // 227 // FileInputStream fichierKer = new FileInputStream("kerropi1.jpg"); 228 // BufferedImage bImageKer = ImageIO.read(fichierKer); 229 // Image imageKer = bImageKer; 230 // 231 //// int w = createdImage.getWidth(null); 232 //// int h = createdImage.getHeight(null); 233 //// BufferedImage bImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); 234 // BufferedImage bImage = ImageHelper.createBufferedImage(createdImage); 235 // BufferedImage bImageKer2 = ImageHelper.createBufferedImage(imageKer); 236 // 237 //// final byte[] bytes = createdImage.toString().getBytes(); 238 //// final String pif = Base64.encode(bytes); 239 // 240 // try { 241 // File outKer = new File("outKer.jpg"); 242 // ImageIO.write(bImageKer2, "jpeg", outKer); 243 // 244 // File out = new File("out.jpg"); 245 // ImageIO.write(bImage, "jpeg", out); 246 // 247 // 248 //// FileOutputStream flux = new FileOutputStream("bob_image.jpg"); 249 //// BufferedOutputStream fluxBuf = new BufferedOutputStream(flux); 250 //// JPEGImageEncoder codec = JPEGCodec.createJPEGEncoder(fluxBuf, JPEGCodec.getDefaultJPEGEncodeParam(bImage)); 251 //// codec.encode(bImage); 252 //// fluxBuf.close(); 253 // 254 //// FileWriter fichier = new FileWriter("bob_encode.gif"); 255 //// BufferedWriter output = new BufferedWriter(fichier); 256 //// output.write(pif); 257 //// output.flush(); 258 //// output.close(); 259 //// 260 //// FileWriter fichier1 = new FileWriter("bob.gif"); 261 //// BufferedWriter output1 = new BufferedWriter(fichier1); 262 //// String bytesS = new String(bytes); 263 //// output1.write(bytesS); 264 //// output1.flush(); 265 //// output1.close(); 266 //// 267 //// FileWriter fichier2 = new FileWriter("bob_decode.gif"); 268 //// BufferedWriter output2 = new BufferedWriter(fichier2); 269 //// byte[] paf = Base64.decode(pif); 270 //// String bytesS2 = new String(paf); 271 //// output2.write(bytesS2); 272 //// output2.flush(); 273 //// output2.close(); 274 // 275 // } catch (IOException e) { 276 // e.printStackTrace(); 277 // } 278 // } 279 280 281 // Image createdImage = example.createImage(example.getWidth(), example.getHeight()); 282 // final byte[] bytes = createdImage.toString().getBytes(); 283 // final String pif = Base64.encode( bytes ); 284 // 285 // try { 286 // FileWriter fichier = new FileWriter("bob_encode.gif"); 287 // fichier.write(pif); 288 // 289 // FileWriter fichier1 = new FileWriter("bob.gif"); 290 // String bytesS = new String(bytes); 291 // fichier.write(bytesS); 292 // } catch (IOException e) { 293 // e.printStackTrace(); 294 // } 295 296 @Test 297 public void doGetImage() 298 throws Exception 299 { 300 // Appel .jsp 301 // <img src="plotEther?agentId=15" width="150px" height="150px"/> 302 final FileInputStream fichierKer = new FileInputStream( "/home_local/workspaces/Megapoli/service/test/kerropi1.jpg" ); 303 final BufferedImage bImageKer = ImageIO.read( fichierKer ); 304 305 if( bImageKer != null ) 306 { 307 // final PngEncoderB pngEncoderB = new PngEncoderB(); 308 // pngEncoderB.setImage( bImageKer ); 309 310 // ImageIO.write( bImageKer, "png", response.getOutputStream() ); 311 } 312 } 313 314 @Test 315 public void doGetImage_withFrame() 316 throws Exception 317 { 318 final GeoDateArray dateArray = createTimeArray( 10, null ); 319 final double[] dataArray = createDataArray( 10, 5 ); 320 321 final SimpleLine data = new SimpleLine( dateArray, dataArray, "legend" ); 322 SGTMetaData meta = new SGTMetaData( "Longitude", "degrees East", false, false ); 323 data.setXMetaData( meta ); 324 325 meta = new SGTMetaData( "parameterName", "parameterUnit", false, false ); 326 data.setYMetaData( meta ); 327 328 final JFrame frame = new JFrame( "Frame principale" ); 329 final JPane jPane = new JPane(); 330 331 final JLabel jlbHelloWorld = new JLabel( "Hello World" ); 332 jPane.add( jlbHelloWorld, BorderLayout.SOUTH ); 333 334 final ImageIcon ic = new ImageIcon( "/home_local/workspaces/Megapoli/service/test/kerropi1.jpg" ); 335 final JLabel jLabel = new JLabel( ic ); 336 jPane.add( jLabel, BorderLayout.EAST ); 337 338 final JPlotLayout jPlotLayout = new JPlotLayout( false, true, false, "Trajectory data", null, false ); 339 jPlotLayout.setTitles( "title1", "title2", "title3" ); 340 jPlotLayout.addData( data, data.getTitle() ); 341 jPlotLayout.setVisible( true ); 342 jPane.add( jPlotLayout, BorderLayout.EAST ); 343 344 jPane.setVisible( true ); 345 frame.setContentPane( jPane ); 346 347 frame.setSize( 700, 550 ); 348 frame.setEnabled( false ); 349 frame.pack(); 350 frame.setVisible( true ); 351 352 353 final BufferedImage bufferedImage = new BufferedImage( jPlotLayout.getWidth(), jPlotLayout.getHeight(), BufferedImage.TYPE_INT_RGB ); 354 final Graphics2D graphics2D = bufferedImage.createGraphics(); 355 graphics2D.setBackground( Color.WHITE ); 356 jPlotLayout.getComponent().addNotify(); 357 jPlotLayout.getComponent().validate(); 358 359 jPlotLayout.draw( graphics2D ); 360 361 try 362 { 363 final File outFile = new File( "/home_local/workspaces/Megapoli/service/test/keroppi_out.jpg" ); 364 ImageIO.write( bufferedImage, "jpg", outFile ); 365 } 366 catch( Exception e ) 367 { 368 } 369 } 370 371 372 protected GeoDateArray createTimeArray( @NotNull final Integer size, @Nullable String day ) 373 throws ParseException 374 { 375 if( null == day ) 376 day = "2009-07-13"; 377 378 final Date[] dates = new Date[size]; 379 for( int i = 0; i < size; i++ ) 380 { 381 final String dateString = day + ' ' + i + ":32"; 382 final Date date = DateHelper.parseDate( dateString, DateHelper.ENGLISH_DATE_PATTERN ); 383 dates[i] = date; 384 } 385 return new GeoDateArray( dates ); 386 } 387 388 @NotNull 389 protected double[] createDataArray( @NotNull final Integer size, @NotNull final Integer begin ) 390 throws ParseException 391 { 392 final double[] datas = new double[size]; 393 for( int i = 0; i < size; i++ ) 394 { 395 datas[i] = Double.valueOf( i + begin ); 396 } 397 return datas; 398 } 399 400 private MegapoliPlot createPlot() 401 throws ParseException, ServiceException 402 { 403 final String parameterName = "OZONE"; 404 final String parameterUnit = "ppbv"; 405 final boolean startToZero = true; 406 final boolean markPoint = false; 407 408 final GeoDateArray dateArray = createTimeArray( 10, null ); 409 final double[] dataArray = createDataArray( 10, 5 ); 410 411 final SimpleLine data = new SimpleLine( dateArray, dataArray, "legend" ); 412 SGTMetaData meta = new SGTMetaData( "Longitude", "degrees East", false, false ); 413 data.setXMetaData( meta ); 414 415 meta = new SGTMetaData( parameterName, parameterUnit, false, false ); 416 data.setYMetaData( meta ); 417 418 final LineAttribute lineAttribute = new LineAttribute( LineAttribute.SOLID, Color.red ); 419 420 final MegapoliPlot timeSeriesPlot = new MegapoliPlot(); 421 timeSeriesPlot.setTitle( "Keroppi title" ); 422 timeSeriesPlot.setLogoMegapoli( "keroppi1.jpg" ); 423 // timeSeriesPlot.setData( data ); 424 // timeSeriesPlot.setLineAttribute( lineAttribute ); 425 426 createTimeSeriesPlot(); 427 return timeSeriesPlot; 428 } 429 430 private JPlotLayout createLayout( @Nullable final String plateformName, @Nullable final String parameterName ) 431 { 432 final JFrame frame = new JFrame( "Frame principale" ); 433 final JPanel panel = new JPanel( new BorderLayout() ); 434 435 final JLabel jlbHelloWorld = new JLabel( "Hello World" ); 436 panel.add( jlbHelloWorld, BorderLayout.SOUTH ); 437 438 final ImageIcon ic = new ImageIcon( "kerropi1.jpg" ); 439 final JLabel jLabel = new JLabel( ic ); 440 panel.add( jLabel, BorderLayout.EAST ); 441 442 final JPlotLayout jPlotLayout = new JPlotLayout( false, false, false, "Trajectory data", null, false ); 443 jPlotLayout.setTitles( plateformName, parameterName, "title3" ); 444 // jPlotLayout.setTitleHeightP(0.2, 0.2); 445 jPlotLayout.setVisible( true ); 446 panel.add( jPlotLayout, BorderLayout.NORTH ); 447 448 panel.setVisible( true ); 449 frame.setContentPane( panel ); 450 451 frame.setSize( MAIN_WIDTH, 550 ); 452 frame.setVisible( true ); 453 454 return jPlotLayout; 455 } 456 457 public void doGet_Layout( final HttpServletResponse response, final SimpleLine data ) 458 throws ServletException, IOException 459 { 460 try 461 { 462 final JPlotLayout jPlotLayout = new JPlotLayout( false, true, false, "Trajectory data", null, false ); 463 jPlotLayout.setTitles( "title1", "title2", "title3" ); 464 jPlotLayout.addData( data, data.getTitle() ); 465 jPlotLayout.setVisible( true ); 466 467 jPlotLayout.addNotify(); 468 jPlotLayout.validate(); 469 470 final BufferedImage bufferedImage = new BufferedImage( jPlotLayout.getWidth(), jPlotLayout.getHeight(), BufferedImage.TYPE_INT_RGB ); 471 final Graphics2D graphics2D = bufferedImage.createGraphics(); 472 graphics2D.setBackground( Color.red ); 473 jPlotLayout.draw( graphics2D ); 474 475 ImageIO.write( bufferedImage, "png", response.getOutputStream() ); 476 } 477 478 catch( Exception e ) 479 { 480 e.printStackTrace(); 481 } 482 } 483 484 @ControllerMethod(jsonResult = true) 485 public JSONObject searchDatasByPlateformByParameterByPeriod( 486 @Mandatory @ParamName(ParameterConstants.PARAMETER_PLATEFORM_ID) final Integer plateformId, 487 @Mandatory @ParamName(ParameterConstants.PARAMETER_PARAMETER_ID) final Integer parameterId, 488 @ParamName(ParameterConstants.PARAMETER_DATE_BEGIN) final String dateBegin, 489 @ParamName(ParameterConstants.PARAMETER_DATE_END) final String dateEnd ) 490 throws ServiceException, ParseException 491 { 492 // final String pofBegin = "2009-07-13 13:00"; 493 // final String pofEnd = "2009-07-13 14:00"; 494 // final Date formatedDateBegin = DateHelper.parseDate( pofBegin, DateHelper.ENGLISH_DATE_PATTERN ); 495 // final Date formatedDateEnd = DateHelper.parseDate( pofEnd, DateHelper.ENGLISH_DATE_PATTERN ); 496 497 // final Plateforme plateform = _etherService.getPlateformById( plateformId ); 498 // final Parametre parameter = _etherService.getParameterById( parameterId ); 499 // final List<Data> values = _etherService.getValuesByPlateformByParameterByPeriod( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 500 501 //JPlotLayout layout = createLayout( plateform.getPlateformeNom(), parameter.getParametreNom() ); 502 // final TimeSeriesPlot timeSeriesPlot = createPlot(); 503 // final Image image = timeSeriesPlot.createImage( 400, 400 ); 504 505 // BufferedImage bufferedImage = toBufferedImage( image ); 506 // BASE64Encoder encoder = new BASE64Encoder(); 507 // encoder.encode( bufferedImage ); 508 509 // PngEncoder pngEncoder = new PngEncoder(); 510 // pngEncoder.setImage( image ); 511 // byte[] bytes = pngEncoder.pngEncode(); 512 513 //final BufferedImage bufferedImage = ImageHelper.createBufferedImage( timeSeriesPlot ); 514 final BufferedImage bufferedImage = new BufferedImage( 400, 400, BufferedImage.TYPE_INT_RGB ); 515 final Graphics2D g2 = bufferedImage.createGraphics(); 516 // timeSeriesPlot.paint( g2 ); 517 g2.dispose(); 518 519 // final PngEncoderB pngEncoderB = new PngEncoderB(); 520 // pngEncoderB.setImage( bufferedImage ); 521 // final byte[] bytesB = pngEncoderB.pngEncode(); 522 523 final JSONObject result = new JSONObject(); 524 // result.put( ParameterConstants.PARAMETER_IMAGE, bytesB ); 525 return result; 526 // return new JSONObject(); 527 } 528 529 // public void searchDatasByPlateformByParameterByPeriod( final HttpServletRequest request, final HttpServletResponse response ) 530 // throws ParseException, ServiceException, IOException 531 // { 532 // final TimeSeriesPlot timeSeriesPlot = createPlot(); 533 // final Image image = timeSeriesPlot.createImage( 400, 400 ); 534 // 535 // //final BufferedImage bufferedImage = ImageHelper.createBufferedImage( timeSeriesPlot ); 536 // final BufferedImage bufferedImage = new BufferedImage( 400, 400, BufferedImage.TYPE_INT_RGB ); 537 // final Graphics2D g2 = bufferedImage.createGraphics(); 538 // timeSeriesPlot.paint( g2 ); 539 // g2.dispose(); 540 // 541 // final PngEncoderB pngEncoderB = new PngEncoderB(); 542 // pngEncoderB.setImage( bufferedImage ); 543 // final byte[] bytesB = pngEncoderB.pngEncode(); 544 // 545 // ImageIO.write( (RenderedImage) image, "png", response.getOutputStream() ); 546 // } 547 // 548 // private TimeSeriesPlot createPlot() 549 // throws ParseException, ServiceException 550 // { 551 // 132 // /** 133 // * TODO : 134 // * - démarrer plot à (0,0) 135 // * - légende de l'axe des temps 136 // * - titre du graph ?? 137 // * - légende générale 138 // * 139 // */ 140 // public void testTimeSeriePlot() 141 // throws Exception 142 // { 143 // // Values to configure plot 552 144 // final String parameterName = "OZONE"; 553 145 // final String parameterUnit = "ppbv"; … … 558 150 // final double[] dataArray = createDataArray( 10, 5 ); 559 151 // 152 //// for( int i = 0; i < dateArray.getLength(); i++ ) 153 //// System.out.println( dateArray.getGeoDate( i ).toString() ); 154 //// 155 //// for( int i = 0; i < dataArray.length; i++ ) 156 //// System.out.println( dataArray[i] ); 157 // 158 // SimpleLine data = new SimpleLine( dateArray, dataArray, "legend" ); 159 // SGTMetaData meta = new SGTMetaData( "Longitude", "degrees East", false, false ); 160 // data.setXMetaData( meta ); 161 // 162 // meta = new SGTMetaData( parameterName, parameterUnit, false, false ); 163 // data.setYMetaData( meta ); 164 // 165 // final LineAttribute lineAttribute = createLineAttribute( markPoint ); 166 // 167 // final MegapoliPlot timeSeriesPlot = new MegapoliPlot(); 168 // timeSeriesPlot.setTitle( "Keroppi title" ); 169 // timeSeriesPlot.setLogoMegapoli( "keroppi1.jpg" ); 170 //// timeSeriesPlot.setData( data ); 171 //// timeSeriesPlot.setLineAttribute( lineAttribute ); 172 // 173 //// getEtherPlotService().createTimeSeriesPlot( timeSeriesPlot ); 174 //// timeSeriesPlot.createTimeSeriesPlot(); 175 //// 176 //// timeSeriesPlot.pack(); 177 //// timeSeriesPlot.setResizable( false ); 178 //// timeSeriesPlot.setVisible( true ); 179 //// 180 // Thread.sleep( 100 ); 181 //// copyToFile( timeSeriesPlot, "service/test/test_TimeSeriesFrameeee.jpg" ); 182 //// 183 //// final Image image = timeSeriesPlot.createImage( 400, 400 ); 184 // 185 //// BufferedImage bufferedImage = toBufferedImage( image ); 186 //// BASE64Encoder encoder = new BASE64Encoder(); 187 //// encoder.encode( bufferedImage ); 188 // 189 //// PngEncoder pngEncoder = new PngEncoder(); 190 //// pngEncoder.setImage( image ); 191 //// byte[] bytes = pngEncoder.pngEncode(); 192 // } 193 // 194 //// @Test 195 //// public void testSerializationImage() throws Exception { 196 //// Example1 example = new Example1(); 197 //// 198 //// Image createdImage = example.createImage(example.getWidth(), example.getHeight()); 199 //// 200 //// FileInputStream fichierKer = new FileInputStream("kerropi1.jpg"); 201 //// BufferedImage bImageKer = ImageIO.read(fichierKer); 202 //// Image imageKer = bImageKer; 203 //// 204 ////// int w = createdImage.getWidth(null); 205 ////// int h = createdImage.getHeight(null); 206 ////// BufferedImage bImage = new BufferedImage(w, h, BufferedImage.TYPE_INT_RGB); 207 //// BufferedImage bImage = ImageHelper.createBufferedImage(createdImage); 208 //// BufferedImage bImageKer2 = ImageHelper.createBufferedImage(imageKer); 209 //// 210 ////// final byte[] bytes = createdImage.toString().getBytes(); 211 ////// final String pif = Base64.encode(bytes); 212 //// 213 //// try { 214 //// File outKer = new File("outKer.jpg"); 215 //// ImageIO.write(bImageKer2, "jpeg", outKer); 216 //// 217 //// File out = new File("out.jpg"); 218 //// ImageIO.write(bImage, "jpeg", out); 219 //// 220 //// 221 ////// FileOutputStream flux = new FileOutputStream("bob_image.jpg"); 222 ////// BufferedOutputStream fluxBuf = new BufferedOutputStream(flux); 223 ////// JPEGImageEncoder codec = JPEGCodec.createJPEGEncoder(fluxBuf, JPEGCodec.getDefaultJPEGEncodeParam(bImage)); 224 ////// codec.encode(bImage); 225 ////// fluxBuf.close(); 226 //// 227 ////// FileWriter fichier = new FileWriter("bob_encode.gif"); 228 ////// BufferedWriter output = new BufferedWriter(fichier); 229 ////// output.write(pif); 230 ////// output.flush(); 231 ////// output.close(); 232 ////// 233 ////// FileWriter fichier1 = new FileWriter("bob.gif"); 234 ////// BufferedWriter output1 = new BufferedWriter(fichier1); 235 ////// String bytesS = new String(bytes); 236 ////// output1.write(bytesS); 237 ////// output1.flush(); 238 ////// output1.close(); 239 ////// 240 ////// FileWriter fichier2 = new FileWriter("bob_decode.gif"); 241 ////// BufferedWriter output2 = new BufferedWriter(fichier2); 242 ////// byte[] paf = Base64.decode(pif); 243 ////// String bytesS2 = new String(paf); 244 ////// output2.write(bytesS2); 245 ////// output2.flush(); 246 ////// output2.close(); 247 //// 248 //// } catch (IOException e) { 249 //// e.printStackTrace(); 250 //// } 251 //// } 252 // 253 // 254 //// Image createdImage = example.createImage(example.getWidth(), example.getHeight()); 255 //// final byte[] bytes = createdImage.toString().getBytes(); 256 //// final String pif = Base64.encode( bytes ); 257 //// 258 //// try { 259 //// FileWriter fichier = new FileWriter("bob_encode.gif"); 260 //// fichier.write(pif); 261 //// 262 //// FileWriter fichier1 = new FileWriter("bob.gif"); 263 //// String bytesS = new String(bytes); 264 //// fichier.write(bytesS); 265 //// } catch (IOException e) { 266 //// e.printStackTrace(); 267 //// } 268 // 269 // @Test 270 // public void doGetImage() 271 // throws Exception 272 // { 273 // // Appel .jsp 274 // // <img src="plotEther?agentId=15" width="150px" height="150px"/> 275 // final FileInputStream fichierKer = new FileInputStream( "/home_local/workspaces/Megapoli/service/test/kerropi1.jpg" ); 276 // final BufferedImage bImageKer = ImageIO.read( fichierKer ); 277 // 278 // if( bImageKer != null ) 279 // { 280 //// final PngEncoderB pngEncoderB = new PngEncoderB(); 281 //// pngEncoderB.setImage( bImageKer ); 282 // 283 //// ImageIO.write( bImageKer, "png", response.getOutputStream() ); 284 // } 285 // } 286 // 287 // @Test 288 // public void doGetImage_withFrame() 289 // throws Exception 290 // { 291 // final GeoDateArray dateArray = createTimeArray( 10, null ); 292 // final double[] dataArray = createDataArray( 10, 5 ); 293 // 560 294 // final SimpleLine data = new SimpleLine( dateArray, dataArray, "legend" ); 561 295 // SGTMetaData meta = new SGTMetaData( "Longitude", "degrees East", false, false ); 562 296 // data.setXMetaData( meta ); 563 297 // 298 // meta = new SGTMetaData( "parameterName", "parameterUnit", false, false ); 299 // data.setYMetaData( meta ); 300 // 301 // final JFrame frame = new JFrame( "Frame principale" ); 302 // final JPane jPane = new JPane(); 303 // 304 // final JLabel jlbHelloWorld = new JLabel( "Hello World" ); 305 // jPane.add( jlbHelloWorld, BorderLayout.SOUTH ); 306 // 307 // final ImageIcon ic = new ImageIcon( "/home_local/workspaces/Megapoli/service/test/kerropi1.jpg" ); 308 // final JLabel jLabel = new JLabel( ic ); 309 // jPane.add( jLabel, BorderLayout.EAST ); 310 // 311 // final JPlotLayout jPlotLayout = new JPlotLayout( false, true, false, "Trajectory data", null, false ); 312 // jPlotLayout.setTitles( "title1", "title2", "title3" ); 313 // jPlotLayout.addData( data, data.getTitle() ); 314 // jPlotLayout.setVisible( true ); 315 // jPane.add( jPlotLayout, BorderLayout.EAST ); 316 // 317 // jPane.setVisible( true ); 318 // frame.setContentPane( jPane ); 319 // 320 // frame.setSize( 700, 550 ); 321 // frame.setEnabled( false ); 322 // frame.pack(); 323 // frame.setVisible( true ); 324 // 325 // 326 // final BufferedImage bufferedImage = new BufferedImage( jPlotLayout.getWidth(), jPlotLayout.getHeight(), BufferedImage.TYPE_INT_RGB ); 327 // final Graphics2D graphics2D = bufferedImage.createGraphics(); 328 // graphics2D.setBackground( Color.WHITE ); 329 // jPlotLayout.getComponent().addNotify(); 330 // jPlotLayout.getComponent().validate(); 331 // 332 // jPlotLayout.draw( graphics2D ); 333 // 334 // try 335 // { 336 // final File outFile = new File( "/home_local/workspaces/Megapoli/service/test/keroppi_out.jpg" ); 337 // ImageIO.write( bufferedImage, "jpg", outFile ); 338 // } 339 // catch( Exception e ) 340 // { 341 // } 342 // } 343 // 344 // 345 // protected GeoDateArray createTimeArray( @NotNull final Integer size, @Nullable String day ) 346 // throws ParseException 347 // { 348 // if( null == day ) 349 // day = "2009-07-13"; 350 // 351 // final Date[] dates = new Date[size]; 352 // for( int i = 0; i < size; i++ ) 353 // { 354 // final String dateString = day + ' ' + i + ":32"; 355 // final Date date = DateHelper.parseDate( dateString, DateHelper.ENGLISH_DATE_PATTERN ); 356 // dates[i] = date; 357 // } 358 // return new GeoDateArray( dates ); 359 // } 360 // 361 // @NotNull 362 // protected double[] createDataArray( @NotNull final Integer size, @NotNull final Integer begin ) 363 // throws ParseException 364 // { 365 // final double[] datas = new double[size]; 366 // for( int i = 0; i < size; i++ ) 367 // { 368 // datas[i] = Double.valueOf( i + begin ); 369 // } 370 // return datas; 371 // } 372 // 373 // private MegapoliPlot createPlot() 374 // throws ParseException, ServiceException 375 // { 376 // final String parameterName = "OZONE"; 377 // final String parameterUnit = "ppbv"; 378 // final boolean startToZero = true; 379 // final boolean markPoint = false; 380 // 381 // final GeoDateArray dateArray = createTimeArray( 10, null ); 382 // final double[] dataArray = createDataArray( 10, 5 ); 383 // 384 // final SimpleLine data = new SimpleLine( dateArray, dataArray, "legend" ); 385 // SGTMetaData meta = new SGTMetaData( "Longitude", "degrees East", false, false ); 386 // data.setXMetaData( meta ); 387 // 564 388 // meta = new SGTMetaData( parameterName, parameterUnit, false, false ); 565 389 // data.setYMetaData( meta ); … … 567 391 // final LineAttribute lineAttribute = new LineAttribute( LineAttribute.SOLID, Color.red ); 568 392 // 569 // final TimeSeriesPlot timeSeriesPlot = new TimeSeriesPlot();393 // final MegapoliPlot timeSeriesPlot = new MegapoliPlot(); 570 394 // timeSeriesPlot.setTitle( "Keroppi title" ); 571 395 // timeSeriesPlot.setLogoMegapoli( "keroppi1.jpg" ); 572 // timeSeriesPlot.setData( data );573 // timeSeriesPlot.setLineAttribute( lineAttribute );574 // 575 // timeSeriesPlot.createTimeSeriesPlot();396 //// timeSeriesPlot.setData( data ); 397 //// timeSeriesPlot.setLineAttribute( lineAttribute ); 398 // 399 // createTimeSeriesPlot(); 576 400 // return timeSeriesPlot; 577 401 // } … … 598 422 // frame.setContentPane( panel ); 599 423 // 600 // frame.setSize( 700, 550 );601 // frame.setVisible( true );602 //603 // return jPlotLayout;604 // }605 606 // @ControllerMethod(jsonResult = true)607 // public JSONObject searchDatasByPlateformByParameterByPeriod(608 // @Mandatory @ParamName(ParameterConstants.PARAMETER_PLATEFORM_ID) final Integer plateformId,609 // @Mandatory @ParamName(ParameterConstants.PARAMETER_PARAMETER_ID) final Integer parameterId,610 // @ParamName(ParameterConstants.PARAMETER_DATE_BEGIN) final String dateBegin,611 // @ParamName(ParameterConstants.PARAMETER_DATE_END) final String dateEnd)612 // throws ServiceException, EtherException, ParseException613 // {614 // final long time1 = Calendar.getInstance().getTimeInMillis();615 // LOGGER.error("Date Controller begin : "+Calendar.getInstance().getTime());616 //// final Date formatedDateBegin = DateHelper.parseDate(dateBegin, DateHelper.ENGLISH_DATE_PATTERN_SHORT);617 //// final Date formatedDateEnd = DateHelper.parseDate(dateEnd, DateHelper.ENGLISH_DATE_PATTERN_SHORT);618 //619 // final Date formatedDateBegin = null;620 // final Date formatedDateEnd = null;621 //622 // final long time2 = Calendar.getInstance().getTimeInMillis();623 // LOGGER.error("Date Controller before request : "+Calendar.getInstance().getTime()+", Duration : "+(time2-time1));624 // final List<Data> values = _etherService.getValuesByPlateformByParameterByPeriod(plateformId, parameterId, formatedDateBegin, formatedDateEnd);625 // final long time3 = Calendar.getInstance().getTimeInMillis();626 // LOGGER.error("Date Controller after request : "+Calendar.getInstance().getTime()+", Duration : "+(time3-time2));627 //628 // final JSONObject result = new JSONObject();629 // result.put( ParameterConstants.PARAMETER_VALUES, values );630 // final long time4 = Calendar.getInstance().getTimeInMillis();631 // LOGGER.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");632 // LOGGER.error("Date Controller before return Result : "+Calendar.getInstance().getTime()+", Duration : "+(time4-time3)+", Total : "+(time4-time1)+", Taille : "+values.size());633 // LOGGER.error("plateformId : "+plateformId+", parameterId : "+parameterId);634 // LOGGER.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!");635 // return result;636 // }637 638 // private void createPlot() {639 // JPlotLayout layout_ = new JPlotLayout(false, false, false,640 // "Trajectory data", null, false);641 // /*642 // * Batch changes to layout.643 // */644 // layout_.setBatch(true);645 // /*646 // * Set the titles.647 // */648 // layout_.setTitles(649 // "Steller's Sea Lion Climate Research Profiling Floats",650 // "Trajectories", "");651 // /*652 // * Change the title sizes from the defaults. (0.25, 0.15)653 // */654 // layout_.setTitleHeightP(0.2, 0.2);655 // /*656 // * Use a BorderLayout for the JFrame and and the JPlotLayout to the657 // * "Center". Pack the frame and make it visible.658 // */659 // JFrame pif = new JFrame();660 // pif.getContentPane().setLayout(new BorderLayout());661 // pif.getContentPane().add(layout_, BorderLayout.CENTER);662 // pif.pack();663 // pif.setVisible(true);664 // /*665 // * Read trajectory data from local file666 // */667 // SGTData data = readTrajectory("service/implementation/com/ether/tutorial/data/trajectory");668 // /*669 // * Add the trajectory data to the plot using the data title as the data670 // * description. The description is used in the LineKey.671 // */672 // layout_.addData(data, data.getTitle());673 // /*674 // * Read the North Pacific hi-resolution coastline and add it to the675 // * layout. Coastlines are handled differently by JPlotLayout. Coastlines676 // * are not used to compute the X and Y ranges and are always clipped to677 // * the axes.678 // */679 // // SGTLine coastLine = getCoastLine("support/npac_hi_rez", 120000);680 // // layout_.setCoastLine(coastLine);681 // /*682 // * Turn batching off. All batched changes to the JPlotLayout will now be683 // * executed.684 // */685 // layout_.setBatch(false);686 // }687 688 689 // public void doGet_OK( final HttpServletRequest request, final HttpServletResponse response )690 // throws ServletException, IOException691 // {692 // final JFrame frame = new JFrame( "Frame principale" );693 // final JPanel panel = new JPanel( new BorderLayout() );694 //695 // final JLabel jlbHelloWorld = new JLabel( "Hello World" );696 // panel.add( jlbHelloWorld, BorderLayout.SOUTH );697 //698 // final ImageIcon ic = new ImageIcon( "/home_local/workspaces/Megapoli/kerropi1.jpg" );699 // final JLabel jLabel = new JLabel( ic );700 // panel.add( jLabel, BorderLayout.EAST );701 //702 // final JPlotLayout jPlotLayout = new JPlotLayout( false, false, false, "Trajectory data", null, false );703 // jPlotLayout.setTitles( "title1", "title2", "title3" );704 // jPlotLayout.setVisible( true );705 // panel.add( jPlotLayout, BorderLayout.NORTH );706 //707 // panel.setVisible( true );708 // frame.setContentPane( panel );709 //710 424 // frame.setSize( MAIN_WIDTH, 550 ); 711 425 // frame.setVisible( true ); 712 426 // 713 // final BufferedImage bufferedImage = new BufferedImage( frame.getWidth(), frame.getHeight(), BufferedImage.TYPE_INT_RGB );714 // 715 // final Graphics2D g2 = bufferedImage.createGraphics();716 // frame.paint( g2 );717 // g2.dispose();718 // 427 // return jPlotLayout; 428 // } 429 // 430 // public void doGet_Layout( final HttpServletResponse response, final SimpleLine data ) 431 // throws ServletException, IOException 432 // { 719 433 // try 720 434 // { 721 // final File out = new File( "/home_local/workspaces/Megapoli/test_JPlotLayout.jpg" );722 // ImageIO.write( bufferedImage, "JPEG", out );723 // }724 // catch( Exception e )725 // {726 // }727 // ImageIO.write( bufferedImage, "JPEG", response.getOutputStream() );728 // }729 //730 // public void doGet_OKK( final HttpServletRequest request, final HttpServletResponse response )731 // throws ServletException, IOException732 // {733 // try734 // {735 // final GeoDateArray dateArray = createTimeArray( 10, null );736 // final double[] dataArray = createDataArray( 10, 5 );737 //738 // final SimpleLine data = new SimpleLine( dateArray, dataArray, "legend" );739 // SGTMetaData meta = new SGTMetaData( "Longitude", "degrees East", false, false );740 // data.setXMetaData( meta );741 //742 // meta = new SGTMetaData( "parameterName", "parameterUnit", false, false );743 // data.setYMetaData( meta );744 //745 // final JPane jPane = new JPane();746 //747 // final JLabel jlbHelloWorld = new JLabel( "Hello World" );748 // jPane.add( jlbHelloWorld, BorderLayout.SOUTH );749 //750 // final ImageIcon ic = new ImageIcon( "/home_local/workspaces/Megapoli/kerropi1.jpg" );751 // final JLabel jLabel = new JLabel( ic );752 // jPane.add( jLabel, BorderLayout.EAST );753 //754 435 // final JPlotLayout jPlotLayout = new JPlotLayout( false, true, false, "Trajectory data", null, false ); 755 436 // jPlotLayout.setTitles( "title1", "title2", "title3" ); 756 437 // jPlotLayout.addData( data, data.getTitle() ); 757 438 // jPlotLayout.setVisible( true ); 758 // jPane.add( jPlotLayout, BorderLayout.EAST ); 759 // 760 // jPane.setVisible( true ); 761 // 439 // 440 // jPlotLayout.addNotify(); 441 // jPlotLayout.validate(); 762 442 // 763 443 // final BufferedImage bufferedImage = new BufferedImage( jPlotLayout.getWidth(), jPlotLayout.getHeight(), BufferedImage.TYPE_INT_RGB ); 764 444 // final Graphics2D graphics2D = bufferedImage.createGraphics(); 765 // graphics2D.setBackground( Color.WHITE ); 766 // jPlotLayout.getComponent().addNotify(); 767 // jPlotLayout.getComponent().validate(); 768 // 445 // graphics2D.setBackground( Color.red ); 769 446 // jPlotLayout.draw( graphics2D ); 770 447 // 771 // try772 // {773 // final File outFile = new File( "/home_local/workspaces/Megapoli/keroppi_out.jpg" );774 // ImageIO.write( bufferedImage, "jpg", outFile );775 // }776 // catch( Exception e )777 // {778 // throw new IOException( e );779 // }780 448 // ImageIO.write( bufferedImage, "png", response.getOutputStream() ); 781 449 // } 450 // 782 451 // catch( Exception e ) 783 452 // { 784 // throw new IOException( e);453 // e.printStackTrace(); 785 454 // } 786 455 // } 787 788 789 public void createTimeSeriesPlot() 790 throws ServiceException 791 { 792 // Enable WindowEvents. Set the layout of the content pane to a BorderLayout. 793 // enableEvents( AWTEvent.WINDOW_EVENT_MASK ); 794 // getContentPane().setLayout( new BorderLayout() ); 795 // 796 // // Add the page object to graphicPanel 797 // getjPanel().add( getPage(), BorderLayout.CENTER ); 798 // 799 // // DATA MODEL 800 // getPage().setDataModel( getDataModel() ); 801 // 802 // // PANEL MODEL 803 // final PanelModel panelModel = extractPanelModel(); 804 // setPanelModel( panelModel ); 805 // getPage().setPanelModel( getPanelModel() ); 806 // 807 // // PANEL HOLDER 808 // final PanelHolder panelHolder = panelModel.findPanelHolder( PANEL_GRAPH ); 809 // if( null != panelHolder ) 456 // 457 // @ControllerMethod(jsonResult = true) 458 // public JSONObject searchDatasByPlateformByParameterByPeriod( 459 // @Mandatory @ParamName(ParameterConstants.PARAMETER_PLATEFORM_ID) final Integer plateformId, 460 // @Mandatory @ParamName(ParameterConstants.PARAMETER_PARAMETER_ID) final Integer parameterId, 461 // @ParamName(ParameterConstants.PARAMETER_DATE_BEGIN) final String dateBegin, 462 // @ParamName(ParameterConstants.PARAMETER_DATE_END) final String dateEnd ) 463 // throws ServiceException, ParseException 464 // { 465 //// final String pofBegin = "2009-07-13 13:00"; 466 //// final String pofEnd = "2009-07-13 14:00"; 467 //// final Date formatedDateBegin = DateHelper.parseDate( pofBegin, DateHelper.ENGLISH_DATE_PATTERN ); 468 //// final Date formatedDateEnd = DateHelper.parseDate( pofEnd, DateHelper.ENGLISH_DATE_PATTERN ); 469 // 470 //// final Plateforme plateform = _etherService.getPlateformById( plateformId ); 471 //// final Parametre parameter = _etherService.getParameterById( parameterId ); 472 //// final List<Data> values = _etherService.getValuesByPlateformByParameterByPeriod( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 473 // 474 // //JPlotLayout layout = createLayout( plateform.getPlateformeNom(), parameter.getParametreNom() ); 475 //// final TimeSeriesPlot timeSeriesPlot = createPlot(); 476 //// final Image image = timeSeriesPlot.createImage( 400, 400 ); 477 // 478 //// BufferedImage bufferedImage = toBufferedImage( image ); 479 //// BASE64Encoder encoder = new BASE64Encoder(); 480 //// encoder.encode( bufferedImage ); 481 // 482 //// PngEncoder pngEncoder = new PngEncoder(); 483 //// pngEncoder.setImage( image ); 484 //// byte[] bytes = pngEncoder.pngEncode(); 485 // 486 // //final BufferedImage bufferedImage = ImageHelper.createBufferedImage( timeSeriesPlot ); 487 // final BufferedImage bufferedImage = new BufferedImage( 400, 400, BufferedImage.TYPE_INT_RGB ); 488 // final Graphics2D g2 = bufferedImage.createGraphics(); 489 //// timeSeriesPlot.paint( g2 ); 490 // g2.dispose(); 491 // 492 //// final PngEncoderB pngEncoderB = new PngEncoderB(); 493 //// pngEncoderB.setImage( bufferedImage ); 494 //// final byte[] bytesB = pngEncoderB.pngEncode(); 495 // 496 // final JSONObject result = new JSONObject(); 497 //// result.put( ParameterConstants.PARAMETER_IMAGE, bytesB ); 498 // return result; 499 //// return new JSONObject(); 500 // } 501 // 502 //// public void searchDatasByPlateformByParameterByPeriod( final HttpServletRequest request, final HttpServletResponse response ) 503 //// throws ParseException, ServiceException, IOException 504 //// { 505 //// final TimeSeriesPlot timeSeriesPlot = createPlot(); 506 //// final Image image = timeSeriesPlot.createImage( 400, 400 ); 507 //// 508 //// //final BufferedImage bufferedImage = ImageHelper.createBufferedImage( timeSeriesPlot ); 509 //// final BufferedImage bufferedImage = new BufferedImage( 400, 400, BufferedImage.TYPE_INT_RGB ); 510 //// final Graphics2D g2 = bufferedImage.createGraphics(); 511 //// timeSeriesPlot.paint( g2 ); 512 //// g2.dispose(); 513 //// 514 //// final PngEncoderB pngEncoderB = new PngEncoderB(); 515 //// pngEncoderB.setImage( bufferedImage ); 516 //// final byte[] bytesB = pngEncoderB.pngEncode(); 517 //// 518 //// ImageIO.write( (RenderedImage) image, "png", response.getOutputStream() ); 519 //// } 520 //// 521 //// private TimeSeriesPlot createPlot() 522 //// throws ParseException, ServiceException 523 //// { 524 //// 525 //// final String parameterName = "OZONE"; 526 //// final String parameterUnit = "ppbv"; 527 //// final boolean startToZero = true; 528 //// final boolean markPoint = false; 529 //// 530 //// final GeoDateArray dateArray = createTimeArray( 10, null ); 531 //// final double[] dataArray = createDataArray( 10, 5 ); 532 //// 533 //// final SimpleLine data = new SimpleLine( dateArray, dataArray, "legend" ); 534 //// SGTMetaData meta = new SGTMetaData( "Longitude", "degrees East", false, false ); 535 //// data.setXMetaData( meta ); 536 //// 537 //// meta = new SGTMetaData( parameterName, parameterUnit, false, false ); 538 //// data.setYMetaData( meta ); 539 //// 540 //// final LineAttribute lineAttribute = new LineAttribute( LineAttribute.SOLID, Color.red ); 541 //// 542 //// final TimeSeriesPlot timeSeriesPlot = new TimeSeriesPlot(); 543 //// timeSeriesPlot.setTitle( "Keroppi title" ); 544 //// timeSeriesPlot.setLogoMegapoli( "keroppi1.jpg" ); 545 //// timeSeriesPlot.setData( data ); 546 //// timeSeriesPlot.setLineAttribute( lineAttribute ); 547 //// 548 //// timeSeriesPlot.createTimeSeriesPlot(); 549 //// return timeSeriesPlot; 550 //// } 551 //// 552 //// private JPlotLayout createLayout( @Nullable final String plateformName, @Nullable final String parameterName ) 553 //// { 554 //// final JFrame frame = new JFrame( "Frame principale" ); 555 //// final JPanel panel = new JPanel( new BorderLayout() ); 556 //// 557 //// final JLabel jlbHelloWorld = new JLabel( "Hello World" ); 558 //// panel.add( jlbHelloWorld, BorderLayout.SOUTH ); 559 //// 560 //// final ImageIcon ic = new ImageIcon( "kerropi1.jpg" ); 561 //// final JLabel jLabel = new JLabel( ic ); 562 //// panel.add( jLabel, BorderLayout.EAST ); 563 //// 564 //// final JPlotLayout jPlotLayout = new JPlotLayout( false, false, false, "Trajectory data", null, false ); 565 //// jPlotLayout.setTitles( plateformName, parameterName, "title3" ); 566 ////// jPlotLayout.setTitleHeightP(0.2, 0.2); 567 //// jPlotLayout.setVisible( true ); 568 //// panel.add( jPlotLayout, BorderLayout.NORTH ); 569 //// 570 //// panel.setVisible( true ); 571 //// frame.setContentPane( panel ); 572 //// 573 //// frame.setSize( 700, 550 ); 574 //// frame.setVisible( true ); 575 //// 576 //// return jPlotLayout; 577 //// } 578 // 579 //// @ControllerMethod(jsonResult = true) 580 //// public JSONObject searchDatasByPlateformByParameterByPeriod( 581 //// @Mandatory @ParamName(ParameterConstants.PARAMETER_PLATEFORM_ID) final Integer plateformId, 582 //// @Mandatory @ParamName(ParameterConstants.PARAMETER_PARAMETER_ID) final Integer parameterId, 583 //// @ParamName(ParameterConstants.PARAMETER_DATE_BEGIN) final String dateBegin, 584 //// @ParamName(ParameterConstants.PARAMETER_DATE_END) final String dateEnd) 585 //// throws ServiceException, EtherException, ParseException 586 //// { 587 //// final long time1 = Calendar.getInstance().getTimeInMillis(); 588 //// LOGGER.error("Date Controller begin : "+Calendar.getInstance().getTime()); 589 ////// final Date formatedDateBegin = DateHelper.parseDate(dateBegin, DateHelper.ENGLISH_DATE_PATTERN_SHORT); 590 ////// final Date formatedDateEnd = DateHelper.parseDate(dateEnd, DateHelper.ENGLISH_DATE_PATTERN_SHORT); 591 //// 592 //// final Date formatedDateBegin = null; 593 //// final Date formatedDateEnd = null; 594 //// 595 //// final long time2 = Calendar.getInstance().getTimeInMillis(); 596 //// LOGGER.error("Date Controller before request : "+Calendar.getInstance().getTime()+", Duration : "+(time2-time1)); 597 //// final List<Data> values = _etherService.getValuesByPlateformByParameterByPeriod(plateformId, parameterId, formatedDateBegin, formatedDateEnd); 598 //// final long time3 = Calendar.getInstance().getTimeInMillis(); 599 //// LOGGER.error("Date Controller after request : "+Calendar.getInstance().getTime()+", Duration : "+(time3-time2)); 600 //// 601 //// final JSONObject result = new JSONObject(); 602 //// result.put( ParameterConstants.PARAMETER_VALUES, values ); 603 //// final long time4 = Calendar.getInstance().getTimeInMillis(); 604 //// LOGGER.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); 605 //// LOGGER.error("Date Controller before return Result : "+Calendar.getInstance().getTime()+", Duration : "+(time4-time3)+", Total : "+(time4-time1)+", Taille : "+values.size()); 606 //// LOGGER.error("plateformId : "+plateformId+", parameterId : "+parameterId); 607 //// LOGGER.error("!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"); 608 //// return result; 609 //// } 610 // 611 //// private void createPlot() { 612 //// JPlotLayout layout_ = new JPlotLayout(false, false, false, 613 //// "Trajectory data", null, false); 614 //// /* 615 //// * Batch changes to layout. 616 //// */ 617 //// layout_.setBatch(true); 618 //// /* 619 //// * Set the titles. 620 //// */ 621 //// layout_.setTitles( 622 //// "Steller's Sea Lion Climate Research Profiling Floats", 623 //// "Trajectories", ""); 624 //// /* 625 //// * Change the title sizes from the defaults. (0.25, 0.15) 626 //// */ 627 //// layout_.setTitleHeightP(0.2, 0.2); 628 //// /* 629 //// * Use a BorderLayout for the JFrame and and the JPlotLayout to the 630 //// * "Center". Pack the frame and make it visible. 631 //// */ 632 //// JFrame pif = new JFrame(); 633 //// pif.getContentPane().setLayout(new BorderLayout()); 634 //// pif.getContentPane().add(layout_, BorderLayout.CENTER); 635 //// pif.pack(); 636 //// pif.setVisible(true); 637 //// /* 638 //// * Read trajectory data from local file 639 //// */ 640 //// SGTData data = readTrajectory("service/implementation/com/ether/tutorial/data/trajectory"); 641 //// /* 642 //// * Add the trajectory data to the plot using the data title as the data 643 //// * description. The description is used in the LineKey. 644 //// */ 645 //// layout_.addData(data, data.getTitle()); 646 //// /* 647 //// * Read the North Pacific hi-resolution coastline and add it to the 648 //// * layout. Coastlines are handled differently by JPlotLayout. Coastlines 649 //// * are not used to compute the X and Y ranges and are always clipped to 650 //// * the axes. 651 //// */ 652 //// // SGTLine coastLine = getCoastLine("support/npac_hi_rez", 120000); 653 //// // layout_.setCoastLine(coastLine); 654 //// /* 655 //// * Turn batching off. All batched changes to the JPlotLayout will now be 656 //// * executed. 657 //// */ 658 //// layout_.setBatch(false); 659 //// } 660 // 661 // 662 //// public void doGet_OK( final HttpServletRequest request, final HttpServletResponse response ) 663 //// throws ServletException, IOException 664 //// { 665 //// final JFrame frame = new JFrame( "Frame principale" ); 666 //// final JPanel panel = new JPanel( new BorderLayout() ); 667 //// 668 //// final JLabel jlbHelloWorld = new JLabel( "Hello World" ); 669 //// panel.add( jlbHelloWorld, BorderLayout.SOUTH ); 670 //// 671 //// final ImageIcon ic = new ImageIcon( "/home_local/workspaces/Megapoli/kerropi1.jpg" ); 672 //// final JLabel jLabel = new JLabel( ic ); 673 //// panel.add( jLabel, BorderLayout.EAST ); 674 //// 675 //// final JPlotLayout jPlotLayout = new JPlotLayout( false, false, false, "Trajectory data", null, false ); 676 //// jPlotLayout.setTitles( "title1", "title2", "title3" ); 677 //// jPlotLayout.setVisible( true ); 678 //// panel.add( jPlotLayout, BorderLayout.NORTH ); 679 //// 680 //// panel.setVisible( true ); 681 //// frame.setContentPane( panel ); 682 //// 683 //// frame.setSize( MAIN_WIDTH, 550 ); 684 //// frame.setVisible( true ); 685 //// 686 //// final BufferedImage bufferedImage = new BufferedImage( frame.getWidth(), frame.getHeight(), BufferedImage.TYPE_INT_RGB ); 687 //// 688 //// final Graphics2D g2 = bufferedImage.createGraphics(); 689 //// frame.paint( g2 ); 690 //// g2.dispose(); 691 //// 692 //// try 693 //// { 694 //// final File out = new File( "/home_local/workspaces/Megapoli/test_JPlotLayout.jpg" ); 695 //// ImageIO.write( bufferedImage, "JPEG", out ); 696 //// } 697 //// catch( Exception e ) 698 //// { 699 //// } 700 //// ImageIO.write( bufferedImage, "JPEG", response.getOutputStream() ); 701 //// } 702 //// 703 //// public void doGet_OKK( final HttpServletRequest request, final HttpServletResponse response ) 704 //// throws ServletException, IOException 705 //// { 706 //// try 707 //// { 708 //// final GeoDateArray dateArray = createTimeArray( 10, null ); 709 //// final double[] dataArray = createDataArray( 10, 5 ); 710 //// 711 //// final SimpleLine data = new SimpleLine( dateArray, dataArray, "legend" ); 712 //// SGTMetaData meta = new SGTMetaData( "Longitude", "degrees East", false, false ); 713 //// data.setXMetaData( meta ); 714 //// 715 //// meta = new SGTMetaData( "parameterName", "parameterUnit", false, false ); 716 //// data.setYMetaData( meta ); 717 //// 718 //// final JPane jPane = new JPane(); 719 //// 720 //// final JLabel jlbHelloWorld = new JLabel( "Hello World" ); 721 //// jPane.add( jlbHelloWorld, BorderLayout.SOUTH ); 722 //// 723 //// final ImageIcon ic = new ImageIcon( "/home_local/workspaces/Megapoli/kerropi1.jpg" ); 724 //// final JLabel jLabel = new JLabel( ic ); 725 //// jPane.add( jLabel, BorderLayout.EAST ); 726 //// 727 //// final JPlotLayout jPlotLayout = new JPlotLayout( false, true, false, "Trajectory data", null, false ); 728 //// jPlotLayout.setTitles( "title1", "title2", "title3" ); 729 //// jPlotLayout.addData( data, data.getTitle() ); 730 //// jPlotLayout.setVisible( true ); 731 //// jPane.add( jPlotLayout, BorderLayout.EAST ); 732 //// 733 //// jPane.setVisible( true ); 734 //// 735 //// 736 //// final BufferedImage bufferedImage = new BufferedImage( jPlotLayout.getWidth(), jPlotLayout.getHeight(), BufferedImage.TYPE_INT_RGB ); 737 //// final Graphics2D graphics2D = bufferedImage.createGraphics(); 738 //// graphics2D.setBackground( Color.WHITE ); 739 //// jPlotLayout.getComponent().addNotify(); 740 //// jPlotLayout.getComponent().validate(); 741 //// 742 //// jPlotLayout.draw( graphics2D ); 743 //// 744 //// try 745 //// { 746 //// final File outFile = new File( "/home_local/workspaces/Megapoli/keroppi_out.jpg" ); 747 //// ImageIO.write( bufferedImage, "jpg", outFile ); 748 //// } 749 //// catch( Exception e ) 750 //// { 751 //// throw new IOException( e ); 752 //// } 753 //// ImageIO.write( bufferedImage, "png", response.getOutputStream() ); 754 //// } 755 //// catch( Exception e ) 756 //// { 757 //// throw new IOException( e ); 758 //// } 759 //// } 760 // 761 // 762 // public void createTimeSeriesPlot() 763 // throws ServiceException 764 // { 765 // // Enable WindowEvents. Set the layout of the content pane to a BorderLayout. 766 //// enableEvents( AWTEvent.WINDOW_EVENT_MASK ); 767 //// getContentPane().setLayout( new BorderLayout() ); 768 //// 769 //// // Add the page object to graphicPanel 770 //// getjPanel().add( getPage(), BorderLayout.CENTER ); 771 //// 772 //// // DATA MODEL 773 //// getPage().setDataModel( getDataModel() ); 774 //// 775 //// // PANEL MODEL 776 //// final PanelModel panelModel = extractPanelModel(); 777 //// setPanelModel( panelModel ); 778 //// getPage().setPanelModel( getPanelModel() ); 779 //// 780 //// // PANEL HOLDER 781 //// final PanelHolder panelHolder = panelModel.findPanelHolder( PANEL_GRAPH ); 782 //// if( null != panelHolder ) 783 //// { 784 //// changeTitle( getTitle(), panelHolder.getLabels() ); 785 //// changeLogos( panelHolder.getLabels() ); 786 //// 787 //// 788 //// final DataGroup dataGroup = panelHolder.findDataGroup( DATA_GROUP ); 789 //// final Legend timeLegend = panelHolder.findLegend( LEGEND ); 790 //// getDataModel().addData( getData(), getLineAttribute(), panelHolder, dataGroup, timeLegend ); 791 //// } 792 //// else 793 //// getDataModel().addData( getData(), getLineAttribute(), panelHolder, null, null ); 794 //// 795 ////// final PanelHolder panelHolderImage = panelModel.findPanelHolder( PANEL_IMAGE ); 796 ////// getDataModel().addData( getData(), getLineAttribute(), panelHolderImage, null, null); 797 //// 798 //// // Add the graphic to the content pane of the JFrame. 799 //// getContentPane().add( getjPanel(), BorderLayout.CENTER ); 800 // } 801 // 802 //// private void changeTitle( @Nullable final String title, @Nullable final Map panelHolderLabels ) 803 //// { 804 ////// if( null != title && null != panelHolderLabels && null != panelHolderLabels.get( LABEL_TITLE ) ) 805 ////// { 806 ////// final gov.noaa.pmel.sgt.beans.Label labelTitle = (gov.noaa.pmel.sgt.beans.Label) panelHolderLabels.get( LABEL_TITLE ); 807 ////// labelTitle.setText( title ); 808 ////// } 809 //// } 810 //// 811 //// 812 //// private void changeLogos( @Nullable final Map panelHolderLabels ) 813 //// { 814 //// if( null != getLogoMegapoli() && null != panelHolderLabels && null != panelHolderLabels.get( LABEL_LOGO_MEGAPOLI ) ) 815 //// { 816 //// final gov.noaa.pmel.sgt.beans.Label labelLogoMegapoli = (gov.noaa.pmel.sgt.beans.Label) panelHolderLabels.get( LABEL_LOGO_MEGAPOLI ); 817 //// labelLogoMegapoli.setText( getLogoMegapoli() ); 818 //// } 819 //// } 820 //// 821 //// /** 822 //// * Create panelModel by de-serializing an existing PanelModel. 823 //// * The file megapoli.xml was created using gov.noaa.pmel.sgt.beans.PanelModelEditor. 824 //// */ 825 //// private PanelModel extractPanelModel() 826 //// throws ServiceException 827 //// { 828 //// try 829 //// { 830 //// return PanelModel.loadFromXML( getClass().getResource( FILE_NAME ).openStream() ); 831 //// } 832 //// catch( Exception e ) 833 //// { 834 //// throw new ServiceException( ServiceException.ServiceCode.PANEL_MODEL_NOT_FOUND, e ); 835 //// } 836 //// } 837 // 838 // @NotNull 839 // public LineAttribute createLineAttribute( final boolean markPoint ) 840 // { 841 // final LineAttribute lineAttribute = new LineAttribute( LineAttribute.SOLID, Color.red ); 842 // if( markPoint ) 810 843 // { 811 // changeTitle( getTitle(), panelHolder.getLabels() ); 812 // changeLogos( panelHolder.getLabels() ); 813 // 814 // 815 // final DataGroup dataGroup = panelHolder.findDataGroup( DATA_GROUP ); 816 // final Legend timeLegend = panelHolder.findLegend( LEGEND ); 817 // getDataModel().addData( getData(), getLineAttribute(), panelHolder, dataGroup, timeLegend ); 844 // lineAttribute.setStyle( LineAttribute.MARK ); 845 // // int to display cross 846 // lineAttribute.setMark( 2 ); 818 847 // } 819 // else 820 // getDataModel().addData( getData(), getLineAttribute(), panelHolder, null, null ); 821 // 822 //// final PanelHolder panelHolderImage = panelModel.findPanelHolder( PANEL_IMAGE ); 823 //// getDataModel().addData( getData(), getLineAttribute(), panelHolderImage, null, null); 824 // 825 // // Add the graphic to the content pane of the JFrame. 826 // getContentPane().add( getjPanel(), BorderLayout.CENTER ); 827 } 828 829 // private void changeTitle( @Nullable final String title, @Nullable final Map panelHolderLabels ) 830 // { 831 //// if( null != title && null != panelHolderLabels && null != panelHolderLabels.get( LABEL_TITLE ) ) 832 //// { 833 //// final gov.noaa.pmel.sgt.beans.Label labelTitle = (gov.noaa.pmel.sgt.beans.Label) panelHolderLabels.get( LABEL_TITLE ); 834 //// labelTitle.setText( title ); 835 //// } 836 // } 837 // 838 // 839 // private void changeLogos( @Nullable final Map panelHolderLabels ) 840 // { 841 // if( null != getLogoMegapoli() && null != panelHolderLabels && null != panelHolderLabels.get( LABEL_LOGO_MEGAPOLI ) ) 842 // { 843 // final gov.noaa.pmel.sgt.beans.Label labelLogoMegapoli = (gov.noaa.pmel.sgt.beans.Label) panelHolderLabels.get( LABEL_LOGO_MEGAPOLI ); 844 // labelLogoMegapoli.setText( getLogoMegapoli() ); 845 // } 846 // } 847 // 848 // /** 849 // * Create panelModel by de-serializing an existing PanelModel. 850 // * The file megapoli.xml was created using gov.noaa.pmel.sgt.beans.PanelModelEditor. 851 // */ 852 // private PanelModel extractPanelModel() 853 // throws ServiceException 854 // { 855 // try 856 // { 857 // return PanelModel.loadFromXML( getClass().getResource( FILE_NAME ).openStream() ); 858 // } 859 // catch( Exception e ) 860 // { 861 // throw new ServiceException( ServiceException.ServiceCode.PANEL_MODEL_NOT_FOUND, e ); 862 // } 863 // } 864 865 @NotNull 866 public LineAttribute createLineAttribute( final boolean markPoint ) 867 { 868 final LineAttribute lineAttribute = new LineAttribute( LineAttribute.SOLID, Color.red ); 869 if( markPoint ) 870 { 871 lineAttribute.setStyle( LineAttribute.MARK ); 872 // int to display cross 873 lineAttribute.setMark( 2 ); 874 } 875 return lineAttribute; 876 } 848 // return lineAttribute; 849 // } 877 850 878 851 -
ether_megapoli/trunk/web/resources/js/classesForJQuery/LoginButton.js
r423 r424 228 228 { 229 229 this.errors = jQuery.parseJSON( result ).errors; 230 this.setJSONUser( null != jQuery.parseJSON( result ).jSON User ? jQuery.parseJSON( result ).jSONUser: false );230 this.setJSONUser( null != jQuery.parseJSON( result ).jSONPeople ? jQuery.parseJSON( result ).jSONPeople : false ); 231 231 if( null == this.errors ) 232 232 this.updateLoginOrLogout();
Note: See TracChangeset
for help on using the changeset viewer.