Changeset 547 for ether_megapoli/trunk
- Timestamp:
- 09/10/12 17:05:06 (12 years ago)
- Location:
- ether_megapoli/trunk
- Files:
-
- 2 added
- 13 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/common/implementation/com/ether/EtherHelper.java
r530 r547 13 13 import java.security.NoSuchAlgorithmException; 14 14 import java.util.ArrayList; 15 import java.util.Arrays; 15 16 import java.util.Calendar; 16 17 import java.util.List; … … 60 61 doubleArray = list.toArray( doubleArray ); 61 62 return ArrayUtils.toPrimitive( doubleArray ); 63 } 64 65 public static List<Double> convertArrayDoubleToListDouble( @NotNull final double[] array ) 66 { 67 final Double[] wrappedArray = ArrayUtils.toObject( array ); 68 return Arrays.asList( wrappedArray ); 62 69 } 63 70 -
ether_megapoli/trunk/common/implementation/com/ether/ParameterConstants.java
r545 r547 39 39 public static final String PARAMETER_MODEL_ID = "modelId"; 40 40 public static final String PARAMETER_VARIABLE_ID = "variableId"; 41 public static final String PARAMETER_VARIABLE_NAME = "variableName"; 41 42 } -
ether_megapoli/trunk/persistence/implementation/com/ether/dao/simulation/SimulationDAOImpl.java
r544 r547 64 64 } 65 65 66 @Nullable 67 public String getLocationByModelId( @NotNull final Integer modelId ) 68 throws PersistenceException 69 { 70 final DetachedCriteria criteria = DetachedCriteria.forClass( Simulation.class ) 71 .add( Restrictions.idEq( modelId ) ) 72 .setProjection( Projections.property( "location" ) ); 73 74 return selectByCriteria( String.class, criteria ); 75 } 76 66 77 @Override 67 78 protected DetachedCriteria searchCriteria( @NotNull final SimulationFilter filter, final boolean isForCount ) -
ether_megapoli/trunk/persistence/interface/com/ether/dao/simulation/SimulationDAO.java
r544 r547 24 24 List<List<String>> getAllModels() 25 25 throws PersistenceException; 26 27 String getLocationByModelId( @NotNull final Integer modelId ) 28 throws PersistenceException; 26 29 } -
ether_megapoli/trunk/service/implementation/com/ether/EtherPlotContentServiceImpl.java
r371 r547 60 60 * @return 61 61 */ 62 @N ullable63 public JPane createTimeSeriePlot( @NotNull final MegapoliPlot megapoliPlot, @NotNull final Integer plotWidth, @NotNull final Integer plotHeight, final Locale locale )62 @NotNull 63 public JPane createTimeSeriePlot( @NotNull final VisualisationPlot megapoliPlot, @NotNull final Integer plotWidth, @NotNull final Integer plotHeight, final Locale locale ) 64 64 throws ServiceException 65 65 { … … 181 181 182 182 @NotNull 183 public JPane create2DPlot( @NotNull final MegapoliPlot megapoliPlot, @NotNull final Integer plotWidth, @NotNull final Integer plotHeight, @Nullable final Locale locale )183 public JPane create2DPlot( @NotNull final VisualisationPlot megapoliPlot, @NotNull final Integer plotWidth, @NotNull final Integer plotHeight, @Nullable final Locale locale ) 184 184 throws ServiceException 185 185 { … … 228 228 jPlotLayout.setEditClasses( false ); 229 229 jPlotLayout.addData( simpleGrid, gridAttribute, legend ); 230 jPlotLayout.setTitles( "", "", "" ); 231 jPlotLayout.setSize( new Dimension( plotWidth, plotHeight ) ); 232 233 try 234 { 235 // jPlotLayout.setKeyLayerSizeP( new Dimension2D( 12.0, 24.0 ) ); 236 // jPlotLayout.setKeyBoundsP( new Rectangle2D.Double( 0.01, 1.01, 5.98, 1.0 ) ); 237 final Layer keyLayer = jPlotLayout.getKeyPane().getLayer( "Key Layer" ); 238 jPlotLayout.add( keyLayer ); 239 } 240 catch( LayerNotFoundException e ) 241 { 242 throw new ServiceException( ServiceException.ServiceCode.LEGEND_LAYER_NOT_FOUND, new Throwable( ServiceException.ServiceCode.LEGEND_LAYER_NOT_FOUND.toString() ) ); 243 } 244 245 // Copyright 246 displayCopyright( jPlotLayout, 1.0, 1.0, 1.15, 0.03 ); 247 248 // Period 249 displayPeriod( jPlotLayout, megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() ); 250 251 return jPlotLayout; 252 } 253 254 @NotNull 255 public JPane createSimulationPlot( @NotNull final SimulationPlot megapoliPlot, @NotNull final Integer plotWidth, @NotNull final Integer plotHeight, @Nullable final Locale locale ) 256 throws ServiceException 257 { 258 final ResourceBundle bundle = WebHelper.getBundle( locale ); 259 260 // final List<Double> parameterValues = (List<Double>) megapoliPlot.getData().getFirstArray(); 261 // final List<Double> latitudeValues = (List<Double>) megapoliPlot.getData().getSecondArray(); 262 // final List<Double> longitudeValues = (List<Double>) megapoliPlot.getData().getThirdArray(); 263 // final double[] parameterValuesArray = EtherHelper.convertListDoubleToDoubleArray( parameterValues ); 264 // final double[] latitudeValuesArray = EtherHelper.convertListDoubleToDoubleArray( latitudeValues ); 265 // final double[] longitudeValuesArray = EtherHelper.convertListDoubleToDoubleArray( longitudeValues ); 266 267 final double[] parameterValuesArray = _etherService.extractValuesByModelByVariableFromFile( megapoliPlot.getModelId(), megapoliPlot.getVariableName(), true ); 268 final double[] latitudeValuesArray = _etherService.extractValuesByModelByVariableFromFile( megapoliPlot.getModelId(), "lat", true ); 269 final double[] longitudeValuesArray = _etherService.extractValuesByModelByVariableFromFile( megapoliPlot.getModelId(), "lon", true ); 270 271 // Create the grid 272 final SGTMetaData xMeta = new SGTMetaData( bundle.getString( "plot.longitude" ), bundle.getString( "plot.degres" ) ); 273 final SGTMetaData yMeta = new SGTMetaData( bundle.getString( "plot.latitude" ), bundle.getString( "plot.degres" ) ); 274 275 final SimpleGrid simpleGrid = new SimpleGrid( parameterValuesArray, longitudeValuesArray, latitudeValuesArray, "Grid" ); 276 simpleGrid.setXMetaData( xMeta ); 277 simpleGrid.setYMetaData( yMeta ); 278 simpleGrid.setRealFullGrid( false ); 279 280 // Create the contour levels and color map 281 List<Double> parameterValues = EtherHelper.convertArrayDoubleToListDouble( parameterValuesArray ); 282 final Double min = Collections.min( parameterValues ); 283 final Double max = Collections.max( parameterValues ); 284 final Double delta = ( max - min ) / _numberOfColorsFor2D; 285 final Range2D datar = new Range2D( min, max, delta ); 286 final ContourLevels clevels = ContourLevels.getDefault( datar ); 287 final ColorMap cmap = createColorMap( datar ); 288 289 // Create a gridAttribute for contour data 290 final GridAttribute gridAttribute = new GridAttribute( clevels ); 291 gridAttribute.setColorMap( cmap ); 292 gridAttribute.setStyle( GridAttribute.RASTER ); 293 294 // Create the legend 295 // final Pair<Integer, Integer> pIdPId = megapoliPlot.getPfIdPIdList().get( 0 ); 296 // final Integer parameterId = pIdPId.getSecondValue(); 297 298 // final Parametre parametre = _etherService.getParameterById( parameterId ); 299 // if( null == parametre ) 300 // throw new ServiceException( ServiceException.ServiceCode.PARAMETER_IS_NULL, new Throwable( ServiceException.ServiceCode.PARAMETER_IS_NULL.toString() ) ); 301 // final String legend = parametre.getParametreNom() + " (" + parametre.getUnite().getUniteCode() + ")"; 302 303 // Create the plot 304 final JPlotLayout jPlotLayout = new JPlotLayout( true, false, false, "JPlotLayout Pane", null, true ); 305 jPlotLayout.setEditClasses( false ); 306 // jPlotLayout.addData( simpleGrid, gridAttribute, legend ); 307 jPlotLayout.addData( simpleGrid, gridAttribute, "legend" ); 230 308 jPlotLayout.setTitles( "", "", "" ); 231 309 jPlotLayout.setSize( new Dimension( plotWidth, plotHeight ) ); … … 269 347 */ 270 348 @NotNull 271 private CartesianGraph createGraphForFirstLine( @NotNull final MegapoliPlot megapoliPlot, @NotNull final JPane mainPane, final double xsize, final double ysize, final double ystart, final double yend, @NotNull final TimeAxis xTimeAxis, @NotNull final LinearTransform xt, @NotNull final SimpleLine firstLine, @NotNull final SoTRange ynRange, @NotNull final PlainAxis yAxis )349 private CartesianGraph createGraphForFirstLine( @NotNull final VisualisationPlot megapoliPlot, @NotNull final JPane mainPane, final double xsize, final double ysize, final double ystart, final double yend, @NotNull final TimeAxis xTimeAxis, @NotNull final LinearTransform xt, @NotNull final SimpleLine firstLine, @NotNull final SoTRange ynRange, @NotNull final PlainAxis yAxis ) 272 350 { 273 351 final Layer layer = new Layer( "Layer", new Dimension2D( xsize, ysize ) ); … … 411 489 */ 412 490 @NotNull 413 private LineKey createLineKey( final MegapoliPlot megapoliPlot, final double ysize, final Layer layer, final SimpleLine firstLine, final CartesianGraph graph )491 private LineKey createLineKey( final VisualisationPlot megapoliPlot, final double ysize, final Layer layer, final SimpleLine firstLine, final CartesianGraph graph ) 414 492 { 415 493 final LineKey lkey = new LineKey(); -
ether_megapoli/trunk/service/implementation/com/ether/EtherPlotServiceImpl.java
r286 r547 68 68 jPane.add( jPaneTop, BorderLayout.NORTH ); 69 69 70 final Integer valuesNumber = ( null != megapoliPlot.getValuesNumber() ) ? megapoliPlot.getValuesNumber() : getEtherService().getNumberValuesByPlateformByParameterByPeriod( megapoliPlot.getPfIdPIdList(), megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() );71 72 70 // Bottom Pane 73 final JPane jPaneBottom = createBottomPane( valuesNumber, locale );71 final JPane jPaneBottom = createBottomPane( megapoliPlot.getValuesNumber(), locale ); 74 72 jPane.add( jPaneBottom, BorderLayout.SOUTH ); 75 73 76 74 // Center Pane 77 75 final Integer centerHeight = maxHeight - jPaneTop.getHeight() - jPaneBottom.getHeight(); 78 if( valuesNumber> 0 )76 if( null != megapoliPlot.getValuesNumber() && megapoliPlot.getValuesNumber() > 0 ) 79 77 { 80 78 final JPane jPaneCenter = createCenterPane( megapoliPlot, maxWidth, centerHeight, locale ); … … 254 252 */ 255 253 @Nullable 256 public JPane createCenterPane( @NotNull final MegapoliPlotmegapoliPlot, @NotNull final Integer maxWidth, @NotNull final Integer maxHeight, @Nullable final Locale locale )254 public <T extends MegapoliPlot> JPane createCenterPane( @NotNull final T megapoliPlot, @NotNull final Integer maxWidth, @NotNull final Integer maxHeight, @Nullable final Locale locale ) 257 255 throws ServiceException 258 256 { … … 260 258 final Integer plotHeight = Math.min( maxHeight - MARGIN_LEFT_RIGHT, maxHeight ); 261 259 262 if( megapoliPlot.isTimeSerie() ) 263 return createTimeSeriePlot( megapoliPlot, plotWidth, plotHeight, locale ); 260 if( megapoliPlot instanceof VisualisationPlot ) 261 if( ( (VisualisationPlot) megapoliPlot ).isTimeSerie() ) 262 return createTimeSeriePlot( (VisualisationPlot) megapoliPlot, plotWidth, plotHeight, locale ); 263 else 264 return create2DPlot( (VisualisationPlot) megapoliPlot, plotWidth, plotHeight, locale ); 265 else if( megapoliPlot instanceof SimulationPlot ) 266 return createSimulationPlot( (SimulationPlot) megapoliPlot, plotWidth, plotHeight, locale ); 264 267 else 265 return create2DPlot( megapoliPlot, plotWidth, plotHeight, locale );268 return null; 266 269 } 267 270 -
ether_megapoli/trunk/service/implementation/com/ether/EtherServiceImpl.java
r545 r547 39 39 import javax.xml.bind.PropertyException; 40 40 import javax.xml.bind.Unmarshaller; 41 import java.io.BufferedReader; 41 42 import java.io.File; 43 import java.io.FileReader; 42 44 import java.io.IOException; 45 import java.io.InputStreamReader; 43 46 import java.util.ArrayList; 47 import java.util.Calendar; 44 48 import java.util.Date; 45 49 import java.util.HashSet; … … 732 736 } 733 737 738 /** 739 * This method extract data (parameters, latitudes, longitutes) from the file corresponding to the simulation for the megapoliPlot 740 * 741 * @param modelId 742 * @param variableName 743 * @param writeInTemporaryFiles : 744 * - if true, temporary files will be created in the directory filePath, and the values will be extract from this files. 745 * - if false, the values will be extract directory from the process 746 * @return 747 * @throws IOException 748 * @throws ServiceException 749 */ 750 @Nullable 751 @Transactional(readOnly = true) 752 public double[] extractValuesByModelByVariableFromFile( @NotNull final Integer modelId, @NotNull final String variableName, final boolean writeInTemporaryFiles ) 753 throws ServiceException 754 { 755 final String filePath = getLocationByModelId( modelId ); 756 final String resultFile = filePath + '_' + variableName; 757 758 try 759 { 760 Calendar cal = Calendar.getInstance(); 761 LOGGER.info( "extractValuesByModelByVariableFromFile _ START : " + cal.getTime().toString() ); 762 763 final Runtime runtime = Runtime.getRuntime(); 764 final String processString = writeInTemporaryFiles ? "/usr/bin/ncdump -v " + variableName + ' ' + filePath + " | sed -e '1,/data:/d' -e '1,/" + variableName + "/d' -e '$d' > " + resultFile : "/usr/bin/ncdump -v " + variableName + ' ' + filePath + " | sed -e '1,/data:/d' -e '1,/" + variableName + "/d' -e '$d'"; 765 final String[] argsNcdump = {"/bin/sh", "-c", processString}; 766 final Process exec = runtime.exec( argsNcdump ); 767 if( writeInTemporaryFiles ) 768 EtherHelper.waitForFileWithMax( new File( resultFile ), 5000 ); 769 770 // TODO : voir avec java 7 pour utiliser le Files.readAllLines() et obtenir directement une List<>, http://adiguba.developpez.com/tutoriels/java/7/ 771 772 final BufferedReader bufferedReader = writeInTemporaryFiles ? new BufferedReader( new FileReader( resultFile ) ) : new BufferedReader( new InputStreamReader( exec.getInputStream() ) ); 773 final StringBuffer stringBuffer = new StringBuffer(); 774 String line; 775 while( ( line = bufferedReader.readLine() ) != null ) 776 stringBuffer.append( line ); 777 778 final String bufferContent = stringBuffer.toString(); 779 final String[] valuesString = bufferContent.replaceAll( " ", "" ).replaceAll( ";", "" ).split( "," ); 780 final double[] values = new double[valuesString.length]; 781 int i = 0; 782 for( final String valueString : valuesString ) 783 { 784 if( null != valuesString ) 785 { 786 values[i] = Double.valueOf( valueString ); 787 i++; 788 } 789 } 790 791 // if( writeInTemporaryFiles && new File( resultFile ).exists() ) 792 // new File( resultFile ).delete(); 793 794 cal = Calendar.getInstance(); 795 LOGGER.info( "extractValuesByModelByVariableFromFile _ STOP : " + cal.getTime().toString() ); 796 797 return values; 798 } 799 catch( InterruptedException e ) 800 { 801 if( new File( resultFile ).exists() ) 802 new File( resultFile ).delete(); 803 804 throw new ServiceException( ServiceException.ServiceCode.ERROR_PROCESS_SIMULATION_NCDUMP_WAIT, e ); 805 } 806 catch( IOException e ) 807 { 808 if( new File( resultFile ).exists() ) 809 new File( resultFile ).delete(); 810 811 throw new ServiceException( ServiceException.ServiceCode.ERROR_PROCESS_SIMULATION_NCDUMP, e ); 812 } 813 } 814 734 815 @Nullable 735 816 @Transactional(readOnly = true) … … 890 971 { 891 972 throw new ServiceException( ServiceException.ServiceCode.VARIABLE_NOT_FOUND, e ); 973 } 974 } 975 976 @Nullable 977 @Transactional(readOnly = true) 978 public String getLocationByModelId( @NotNull final Integer modelId ) 979 throws ServiceException 980 { 981 try 982 { 983 return _simulationDAO.getLocationByModelId( modelId ); 984 } 985 catch( PersistenceException e ) 986 { 987 throw new ServiceException( ServiceException.ServiceCode.SIMULATION_NOT_FOUND, e ); 892 988 } 893 989 } -
ether_megapoli/trunk/service/implementation/com/ether/VisualisationPlot.java
r423 r547 1 1 package com.ether; 2 2 3 import com.medias.megapoli.utils.MegapoliInitialisation;4 3 import org.jetbrains.annotations.NotNull; 5 4 import org.jetbrains.annotations.Nullable; 6 5 7 import java.util.Date;8 6 import java.util.List; 9 7 … … 12 10 * @date 31 may 2011 13 11 */ 14 public class MegapoliPlot 12 public class VisualisationPlot 13 extends MegapoliPlot 15 14 { 16 @Nullable17 public String getTitle()18 {19 return _title;20 }21 22 public void setTitle( @Nullable final String title )23 {24 _title = title;25 }26 27 @NotNull28 public String getLogoMegapoli()29 {30 return _logoMegapoli;31 }32 33 public void setLogoMegapoli( @NotNull final String logoMegapoli )34 {35 _logoMegapoli = logoMegapoli;36 }37 38 @NotNull39 public String getLogoEther()40 {41 return _logoEther;42 }43 44 public void setLogoEther( @NotNull final String logoEther )45 {46 _logoEther = logoEther;47 }48 49 15 @Nullable 50 16 public Data getData() … … 78 44 } 79 45 80 @Nullable81 public Integer getValuesNumber()82 {83 return _valuesNumber;84 }85 86 public void setValuesNumber( @Nullable final Integer valuesNumber )87 {88 _valuesNumber = valuesNumber;89 }90 91 46 @NotNull 92 47 public String getAxeType() … … 112 67 113 68 @Nullable 114 public Date getBeginDate()115 {116 return _beginDate;117 }118 119 public void setBeginDate( @Nullable final Date beginDate )120 {121 _beginDate = beginDate;122 }123 124 @Nullable125 public Date getEndDate()126 {127 return _endDate;128 }129 130 public void setEndDate( @Nullable final Date endDate )131 {132 _endDate = endDate;133 }134 135 @Nullable136 private String _title;137 @Nullable138 69 private Data _data; 139 @NotNull140 private String _logoMegapoli = MegapoliInitialisation.pathImages + "/logo_Megapoli.png";141 // private String _logoMegapoli = "/home_local/PROJETS/MEGAPOLI/megapoli/data/images/logo_Megapoli.png";142 @NotNull143 private String _logoEther = MegapoliInitialisation.pathImages + "/logo_Ether.jpg";144 // private String _logoEther = "/home_local/PROJETS/MEGAPOLI/megapoli/data/images/logo_Ether.jpg";145 70 146 71 private boolean _legendToHide = true; 147 72 private boolean _isTimeSerie = true; 148 @Nullable149 private Integer _valuesNumber;150 73 @NotNull 151 74 private String _axeType; … … 154 77 @Nullable 155 78 private List<Pair<Integer, Integer>> _pfIdPIdList; 156 @Nullable157 private Date _beginDate;158 @Nullable159 private Date _endDate;160 79 } -
ether_megapoli/trunk/service/interface/com/ether/EtherPlotService.java
r195 r547 32 32 33 33 @Nullable 34 public JPane createCenterPane( @NotNull final MegapoliPlot megapoliPlot, @NotNull final Integer maxWidth, @NotNull final Integer maxHeight, @Nullable final Locale locale ) 35 throws ServiceException; 36 37 @Nullable 38 public JPane createTimeSeriePlot( @NotNull final MegapoliPlot megapoliPlot, @NotNull final Integer plotWidth, @NotNull final Integer plotHeight, @Nullable final Locale locale ) 34 public <T extends MegapoliPlot> JPane createCenterPane( @NotNull final T megapoliPlot, @NotNull final Integer maxWidth, @NotNull final Integer maxHeight, @Nullable final Locale locale ) 39 35 throws ServiceException; 40 36 41 37 @NotNull 42 public JPane create2DPlot( @NotNull final MegapoliPlot megapoliPlot, @NotNull final Integer plotWidth, @NotNull final Integer plotHeight, @Nullable final Locale locale ) 38 public JPane createTimeSeriePlot( @NotNull final VisualisationPlot megapoliPlot, @NotNull final Integer plotWidth, @NotNull final Integer plotHeight, @Nullable final Locale locale ) 39 throws ServiceException; 40 41 @NotNull 42 public JPane create2DPlot( @NotNull final VisualisationPlot megapoliPlot, @NotNull final Integer plotWidth, @NotNull final Integer plotHeight, @Nullable final Locale locale ) 43 throws ServiceException; 44 45 @NotNull 46 public JPane createSimulationPlot( @NotNull final SimulationPlot megapoliPlot, @NotNull final Integer plotWidth, @NotNull final Integer plotHeight, @Nullable final Locale locale ) 43 47 throws ServiceException; 44 48 } -
ether_megapoli/trunk/service/interface/com/ether/EtherService.java
r545 r547 181 181 182 182 @Nullable 183 double[] extractValuesByModelByVariableFromFile( @NotNull final Integer modelId, @NotNull final String variableName, final boolean writeInTemporaryFiles ) 184 throws ServiceException; 185 186 @Nullable 183 187 Dimension getDimensionById( @NotNull final Integer dimensionId ) 184 188 throws ServiceException; … … 219 223 List<Variable> getVariablesByModelId( @NotNull final Integer modelId ) 220 224 throws ServiceException; 225 226 @Nullable 227 String getLocationByModelId( @NotNull final Integer modelId ) 228 throws ServiceException; 229 221 230 } -
ether_megapoli/trunk/web/resources/css/visu_parameter_by_pf.css
r546 r547 4 4 } 5 5 6 #generalContainerModels, # containerOptionCalendar{6 #generalContainerModels, #generalContainerOptions { 7 7 min-height: 150px; 8 8 } -
ether_megapoli/trunk/web/src/com/ether/ControllerPlot.java
r216 r547 2 2 3 3 import com.medias.Context; 4 import gov.noaa.pmel.util.SoTValue;5 4 import org.apache.commons.logging.Log; 6 5 import org.apache.commons.logging.LogFactory; … … 96 95 97 96 // Create plot 98 final MegapoliPlot megapoliPlot = new MegapoliPlot();97 final VisualisationPlot megapoliPlot = new VisualisationPlot(); 99 98 megapoliPlot.setTitle( title ); 100 99 megapoliPlot.setAxeType( axeType ); … … 107 106 megapoliPlot.setTimeSerie( true ); 108 107 megapoliPlot.setLegendToHide( pIdPIdList.size() == 1 ); 108 final Integer valuesNumber = _etherService.getNumberValuesByPlateformByParameterByPeriod( megapoliPlot.getPfIdPIdList(), megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() ); 109 megapoliPlot.setValuesNumber( valuesNumber ); 109 110 } 110 111 else -
ether_megapoli/trunk/web/src/com/ether/ControllerSimulationPlot.java
r545 r547 61 61 final Integer modelId = Integer.valueOf( request.getParameter( ParameterConstants.PARAMETER_MODEL_ID ) ); 62 62 final Integer variableId = Integer.valueOf( request.getParameter( ParameterConstants.PARAMETER_VARIABLE_ID ) ); 63 final String variableName = request.getParameter( ParameterConstants.PARAMETER_VARIABLE_NAME ); 63 64 64 65 // Dates … … 84 85 85 86 // Create plot 86 // final MegapoliPlot megapoliPlot = new MegapoliPlot(); 87 // megapoliPlot.setTitle( title ); 88 // megapoliPlot.setAxeType( axeType ); 89 // megapoliPlot.setPfIdPIdList( pIdPIdList ); 90 // megapoliPlot.setBeginDate( formatedDateBegin ); 91 // megapoliPlot.setEndDate( formatedDateEnd ); 92 // 93 // if( AxeTypeForFixedPlateform.TIME_LINE.name().equals( axeType ) || AxeTypeForFixedPlateform.TIME_POINTS.name().equals( axeType ) ) 94 // { 95 // megapoliPlot.setTimeSerie( true ); 96 // megapoliPlot.setLegendToHide( pIdPIdList.size() == 1 ); 97 // } 98 // else 99 // { 100 // // 2D plot : only one parameter to display 101 // final Integer plateformId = (Integer) pIdPIdList.get( 0 ).getFirstValue(); 102 // final Integer parameterId = (Integer) pIdPIdList.get( 0 ).getSecondValue(); 103 // final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodFor2D( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 104 //// final Data<List, List, List> valuesLists = BouchonHelper.createValuesFor2D( 50 ); 105 // megapoliPlot.setData( valuesLists ); 106 // 107 // megapoliPlot.setTimeSerie( false ); 108 // megapoliPlot.setLegendToHide( false ); 109 // megapoliPlot.setValuesNumber( ( (ArrayList) valuesLists.getFirstArray() ).size() ); 110 // } 111 // 112 // final BufferedImage bufferedImage = _etherPlotService.createMainPane( megapoliPlot, Context.getLocale( request ) ); 113 // ImageIO.write( bufferedImage, "png", response.getOutputStream() ); 87 final SimulationPlot megapoliPlot = new SimulationPlot(); 88 megapoliPlot.setTitle( title ); 89 megapoliPlot.setModelId( modelId ); 90 megapoliPlot.setVariableId( variableId ); 91 megapoliPlot.setVariableName( variableName ); 92 megapoliPlot.setBeginDate( formatedDateBegin ); 93 megapoliPlot.setEndDate( formatedDateEnd ); 94 // TODO : calculer le nombre de valeurs 95 megapoliPlot.setValuesNumber( 10 ); 96 97 final BufferedImage bufferedImage = _etherPlotService.createMainPane( megapoliPlot, Context.getLocale( request ) ); 98 ImageIO.write( bufferedImage, "png", response.getOutputStream() ); 114 99 } 115 100 // catch( ServiceException se ) -
ether_megapoli/trunk/web/visualization/visu_simulation-script.jsp
r545 r547 131 131 onSelectVariable: function( objVariable ) 132 132 { 133 if( this.selectedVariable )133 if( this.selectedVariable && objVariable.getId() == this.selectedVariable.getId() ) 134 134 return; 135 135 … … 177 177 onClickVisualize: function() 178 178 { 179 <%--if( this.selectedModel && this.selectedVariable )--%> 180 <%--{--%> 181 <%--var parameters = "dateBegin=" + this.beginDate--%> 182 <%--+ "&dateEnd=" + this.endDate--%> 183 <%--+ "&modelId =" + this.selectedModel.getId()--%> 184 <%--+ "$variableId" + this.selectedVariable.getId();--%> 185 186 <%--var url = "simulation/simulationPlotEther?" + parameters;--%> 187 <%--var $dialog = $( '<div></div>' )--%> 188 <%--.html( '<img src=' + url + ' />' )--%> 189 <%--.dialog( {--%> 190 <%--autoOpen: false,--%> 191 <%--title: interfaceTexts["app.title"] + "-" + interfaceTexts["simulation.quicklook"],--%> 192 <%--minHeight: <%=EtherPlotServiceImpl.getMaxHeight()%>,--%> 193 <%--minWidth: <%=EtherPlotServiceImpl.getMaxWidth()%> + 28--%> 194 <%--} );--%> 195 <%--}--%> 196 <%--else--%> 197 <%--{--%> 198 <%--var $dialog = $( '<div></div>' )--%> 199 <%--.html( '<BR/><center>' + interfaceTexts["visualization.graph.noPlot"] + '</center>' )--%> 200 <%--.dialog( {--%> 201 <%--autoOpen: false,--%> 202 <%--title: interfaceTexts["app.title"] + "-" + interfaceTexts["visualization.quicklook"],--%> 203 <%--height: 50,--%> 204 <%--width: 400--%> 205 <%--} );--%> 206 <%--}--%> 207 208 <%--$dialog.dialog( 'open' );--%> 179 if( this.selectedModel && this.selectedVariable ) 180 { 181 var parameters = "dateBegin=" + this.beginDate 182 + "&dateEnd=" + this.endDate 183 + "&modelId=" + this.selectedModel.getId() 184 + "&variableId=" + this.selectedVariable.getId() 185 + "&variableName=" + this.selectedVariable.getName() 186 + "&title=" + encodeURIComponent( $( "#textareaTitle" ).val() ); 187 188 var url = "simulation/simulationPlotEther?" + parameters; 189 var $dialog = $( '<div></div>' ) 190 .html( '<img src=' + url + ' />' ) 191 .dialog( { 192 autoOpen: false, 193 title: interfaceTexts["app.title"] + "-" + interfaceTexts["simulation.quicklook"], 194 minHeight: <%=EtherPlotServiceImpl.getMaxHeight()%>, 195 minWidth: <%=EtherPlotServiceImpl.getMaxWidth()%> + 28 196 } ); 197 } 198 else 199 { 200 var $dialog = $( '<div></div>' ) 201 .html( '<BR/><center>' + interfaceTexts["visualization.graph.noPlot"] + '</center>' ) 202 .dialog( { 203 autoOpen: false, 204 title: interfaceTexts["app.title"] + "-" + interfaceTexts["visualization.quicklook"], 205 height: 50, 206 width: 400 207 } ); 208 } 209 210 $dialog.dialog( 'open' ); 209 211 }, 210 212
Note: See TracChangeset
for help on using the changeset viewer.