Changeset 186
- Timestamp:
- 09/08/11 17:03:25 (13 years ago)
- Location:
- ether_megapoli/trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/persistence/implementation/hibernate-domain.cfg.xml
r185 r186 7 7 <session-factory> 8 8 9 < mapping resource="com/medias/objects/Adresse.hbm.xml"/>10 < mapping resource="com/medias/objects/Bilan.hbm.xml"/>11 < mapping resource="com/medias/objects/Capteur.hbm.xml"/>12 < mapping resource="com/medias/objects/Categorie.hbm.xml"/>13 < mapping resource="com/medias/objects/CategorieParam.hbm.xml"/>14 < mapping resource="com/medias/objects/Commentaire.hbm.xml"/>15 < mapping resource="com/medias/objects/DeltaMesure.hbm.xml"/>16 < mapping resource="com/medias/objects/Fabriquant.hbm.xml"/>17 < mapping resource="com/medias/objects/Fichier.hbm.xml"/>18 < mapping resource="com/medias/objects/Flag.hbm.xml"/>19 < mapping resource="com/medias/objects/Jeu.hbm.xml"/>20 < mapping resource="com/medias/objects/Langue.hbm.xml"/>21 < mapping resource="com/medias/objects/Localisation.hbm.xml"/>22 < mapping resource="com/medias/objects/Mesure.hbm.xml"/>23 < mapping resource="com/medias/objects/Organisme.hbm.xml"/>24 < mapping resource="com/medias/objects/Parametre.hbm.xml"/>25 < mapping resource="com/medias/objects/Personne.hbm.xml"/>26 < mapping resource="com/medias/objects/Plateforme.hbm.xml"/>27 < mapping resource="com/medias/objects/RequeteNbvalsJeu.hbm.xml"/>28 < mapping resource="com/medias/objects/RequetePlatLoc.hbm.xml"/>29 < mapping resource="com/medias/objects/Sequence.hbm.xml"/>30 < mapping resource="com/medias/objects/TypeCapteur.hbm.xml"/>31 < mapping resource="com/medias/objects/TypePlateforme.hbm.xml"/>32 < mapping resource="com/medias/objects/Unite.hbm.xml"/>33 < mapping resource="com/medias/objects/Valeur.hbm.xml"/>34 < mapping resource="com/medias/objects/Zone.hbm.xml"/>9 <!--<mapping resource="com/medias/objects/Adresse.hbm.xml"/>--> 10 <!--<mapping resource="com/medias/objects/Bilan.hbm.xml"/>--> 11 <!--<mapping resource="com/medias/objects/Capteur.hbm.xml"/>--> 12 <!--<mapping resource="com/medias/objects/Categorie.hbm.xml"/>--> 13 <!--<mapping resource="com/medias/objects/CategorieParam.hbm.xml"/>--> 14 <!--<mapping resource="com/medias/objects/Commentaire.hbm.xml"/>--> 15 <!--<mapping resource="com/medias/objects/DeltaMesure.hbm.xml"/>--> 16 <!--<mapping resource="com/medias/objects/Fabriquant.hbm.xml"/>--> 17 <!--<mapping resource="com/medias/objects/Fichier.hbm.xml"/>--> 18 <!--<mapping resource="com/medias/objects/Flag.hbm.xml"/>--> 19 <!--<mapping resource="com/medias/objects/Jeu.hbm.xml"/>--> 20 <!--<mapping resource="com/medias/objects/Langue.hbm.xml"/>--> 21 <!--<mapping resource="com/medias/objects/Localisation.hbm.xml"/>--> 22 <!--<mapping resource="com/medias/objects/Mesure.hbm.xml"/>--> 23 <!--<mapping resource="com/medias/objects/Organisme.hbm.xml"/>--> 24 <!--<mapping resource="com/medias/objects/Parametre.hbm.xml"/>--> 25 <!--<mapping resource="com/medias/objects/Personne.hbm.xml"/>--> 26 <!--<mapping resource="com/medias/objects/Plateforme.hbm.xml"/>--> 27 <!--<mapping resource="com/medias/objects/RequeteNbvalsJeu.hbm.xml"/>--> 28 <!--<mapping resource="com/medias/objects/RequetePlatLoc.hbm.xml"/>--> 29 <!--<mapping resource="com/medias/objects/Sequence.hbm.xml"/>--> 30 <!--<mapping resource="com/medias/objects/TypeCapteur.hbm.xml"/>--> 31 <!--<mapping resource="com/medias/objects/TypePlateforme.hbm.xml"/>--> 32 <!--<mapping resource="com/medias/objects/Unite.hbm.xml"/>--> 33 <!--<mapping resource="com/medias/objects/Valeur.hbm.xml"/>--> 34 <!--<mapping resource="com/medias/objects/Zone.hbm.xml"/>--> 35 35 36 36 </session-factory> -
ether_megapoli/trunk/service/implementation/com/ether/BouchonHelper.java
r185 r186 5 5 import com.medias.database.objects.TypePlateforme; 6 6 import com.medias.database.objects.Unite; 7 7 import org.jetbrains.annotations.NotNull; 8 import org.jetbrains.annotations.Nullable; 9 10 import java.util.ArrayList; 8 11 import java.util.Calendar; 9 12 import java.util.Date; 13 import java.util.List; 10 14 11 15 public class BouchonHelper … … 14 18 { 15 19 final Plateforme plateform = new Plateforme(); 16 plateform.setPlateformeId( 1);20 plateform.setPlateformeId( 3 ); 17 21 plateform.setPlateformeNom( "LHVP" ); 18 22 plateform.setTypePlateforme( new TypePlateforme( 1, "FIXE" ) ); … … 20 24 } 21 25 26 public static List<Plateforme> createPlateforms() 27 { 28 final List<Plateforme> plateforms = new ArrayList<Plateforme>(); 29 final Plateforme pf = createPlateform(); 30 plateforms.add( pf ); 31 32 final Plateforme pf2 = new Plateforme(); 33 pf2.setPlateformeId( 1 ); 34 pf2.setPlateformeNom( "SIRTA" ); 35 pf2.setTypePlateforme( new TypePlateforme( 1, "FIXE" ) ); 36 plateforms.add( pf2 ); 37 38 final Plateforme pf3 = new Plateforme(); 39 pf3.setPlateformeId( 4 ); 40 pf3.setPlateformeNom( "ATR-42" ); 41 pf3.setTypePlateforme( new TypePlateforme( 1, "MOBILE" ) ); 42 plateforms.add( pf3 ); 43 44 final Plateforme pf4 = new Plateforme(); 45 pf4.setPlateformeId( 6 ); 46 pf4.setPlateformeNom( "Piper-Aztec" ); 47 pf4.setTypePlateforme( new TypePlateforme( 1, "MOBILE" ) ); 48 plateforms.add( pf4 ); 49 50 return plateforms; 51 } 52 53 public static Plateforme getPlateformById( @NotNull final Integer plateformId ) 54 { 55 if( null != plateformId && plateformId == 1 ) 56 { 57 final Plateforme pf2 = new Plateforme(); 58 pf2.setPlateformeId( 1 ); 59 pf2.setPlateformeNom( "SIRTA" ); 60 pf2.setTypePlateforme( new TypePlateforme( 1, "FIXE" ) ); 61 return pf2; 62 } 63 else if( null != plateformId && plateformId == 3 ) 64 { 65 return createPlateform(); 66 } 67 else if( null != plateformId && plateformId == 4 ) 68 { 69 final Plateforme pf3 = new Plateforme(); 70 pf3.setPlateformeId( 4 ); 71 pf3.setPlateformeNom( "ATR-42" ); 72 pf3.setTypePlateforme( new TypePlateforme( 1, "MOBILE" ) ); 73 return pf3; 74 } 75 else if( null != plateformId && plateformId == 6 ) 76 { 77 final Plateforme pf4 = new Plateforme(); 78 pf4.setPlateformeId( 6 ); 79 pf4.setPlateformeNom( "Piper-Aztec" ); 80 pf4.setTypePlateforme( new TypePlateforme( 1, "MOBILE" ) ); 81 return pf4; 82 } 83 else return null; 84 } 85 22 86 public static Parametre createParameter() 23 87 { 24 88 final Parametre parametre = new Parametre(); 89 parametre.setParametreId( 3 ); 25 90 parametre.setParametreNom( "Ozone" ); 26 parametre.setParametreCode( "Ozone" ); 91 parametre.setParametreCode( "O3" ); 92 27 93 final Unite unit = new Unite(); 28 unit.setUniteCode( "ppb " );94 unit.setUniteCode( "ppbv" ); 29 95 parametre.setUnite( unit ); 96 30 97 return parametre; 31 98 } 32 99 33 private Data createValuesTemp( final Integer size, final Integer delta ) 100 public static List<Parametre> createParameters( @Nullable final Integer plateformId ) 101 { 102 final Unite unitPpbv = new Unite(); 103 unitPpbv.setUniteCode( "ppbv" ); 104 final Unite units_1 = new Unite(); 105 units_1.setUniteCode( "s-1" ); 106 final Unite unitMbar = new Unite(); 107 unitMbar.setUniteCode( "mbar" ); 108 final Unite unitC = new Unite(); 109 unitC.setUniteCode( "°C" ); 110 111 112 final List<Parametre> parameters = new ArrayList<Parametre>(); 113 114 final Parametre pOzone = createParameter(); 115 116 final Parametre pJNO2 = new Parametre(); 117 pJNO2.setParametreId( 1 ); 118 pJNO2.setParametreNom( "Photolysis Frequency JNO2" ); 119 pJNO2.setParametreCode( "JNO2" ); 120 pJNO2.setUnite( units_1 ); 121 122 final Parametre pPressure = new Parametre(); 123 pPressure.setParametreId( 9 ); 124 pPressure.setParametreNom( "Pressure" ); 125 pPressure.setParametreCode( "P" ); 126 pPressure.setUnite( unitMbar ); 127 128 final Parametre pTemperature = new Parametre(); 129 pTemperature.setParametreId( 10 ); 130 pTemperature.setParametreNom( "Temperature" ); 131 pTemperature.setParametreCode( "T" ); 132 pTemperature.setUnite( unitC ); 133 134 final Parametre pNO = new Parametre(); 135 pNO.setParametreId( 4 ); 136 pNO.setParametreNom( "Nitrogen Monoxide" ); 137 pNO.setParametreCode( "NO" ); 138 pNO.setUnite( unitPpbv ); 139 140 final Parametre pNOx = new Parametre(); 141 pNOx.setParametreId( 23 ); 142 pNOx.setParametreNom( "Nitrogen Oxides" ); 143 pNOx.setParametreCode( "NOx" ); 144 pNOx.setUnite( unitPpbv ); 145 146 147 if( null != plateformId && plateformId == 1 ) 148 { 149 // SIRTA 150 parameters.add( pOzone ); 151 parameters.add( pJNO2 ); 152 parameters.add( pPressure ); 153 parameters.add( pTemperature ); 154 parameters.add( pNO ); 155 156 } 157 else if( null != plateformId && plateformId == 3 ) 158 { 159 // LHVP 160 parameters.add( pOzone ); 161 parameters.add( pNO ); 162 parameters.add( pNOx ); 163 } 164 else if( null != plateformId && plateformId == 4 ) 165 { 166 // ATR-42 167 parameters.add( pPressure ); 168 parameters.add( pTemperature ); 169 } 170 else if( null != plateformId && plateformId == 6 ) 171 { 172 // Piper-Aztec 173 } 174 else 175 { 176 parameters.add( pOzone ); 177 parameters.add( pJNO2 ); 178 parameters.add( pPressure ); 179 parameters.add( pTemperature ); 180 parameters.add( pNO ); 181 parameters.add( pNOx ); 182 } 183 184 return parameters; 185 } 186 187 public static Parametre getParameterById( @NotNull final Integer parameterId ) 188 { 189 if( parameterId == 3 ) 190 return createParameter(); 191 192 else if( parameterId == 1 ) 193 { 194 final Parametre pJNO2 = new Parametre(); 195 pJNO2.setParametreId( 1 ); 196 pJNO2.setParametreNom( "Photolysis Frequency JNO2" ); 197 pJNO2.setParametreCode( "JNO2" ); 198 final Unite units_1 = new Unite(); 199 units_1.setUniteCode( "s-1" ); 200 pJNO2.setUnite( units_1 ); 201 return pJNO2; 202 } 203 else if( parameterId == 9 ) 204 { 205 final Parametre pPressure = new Parametre(); 206 pPressure.setParametreId( 9 ); 207 pPressure.setParametreNom( "Pressure" ); 208 pPressure.setParametreCode( "P" ); 209 final Unite unitMbar = new Unite(); 210 unitMbar.setUniteCode( "mbar" ); 211 212 pPressure.setUnite( unitMbar ); 213 return pPressure; 214 } 215 else if( parameterId == 10 ) 216 { 217 final Parametre pTemperature = new Parametre(); 218 pTemperature.setParametreId( 10 ); 219 pTemperature.setParametreNom( "Temperature" ); 220 pTemperature.setParametreCode( "T" ); 221 final Unite unitC = new Unite(); 222 unitC.setUniteCode( "°C" ); 223 pTemperature.setUnite( unitC ); 224 return pTemperature; 225 } 226 else if( parameterId == 4 ) 227 { 228 229 final Parametre pNO = new Parametre(); 230 pNO.setParametreId( 4 ); 231 pNO.setParametreNom( "Nitrogen Monoxide" ); 232 pNO.setParametreCode( "NO" ); 233 final Unite unitPpbv = new Unite(); 234 unitPpbv.setUniteCode( "ppbv" ); 235 pNO.setUnite( unitPpbv ); 236 return pNO; 237 } 238 else if( parameterId == 23 ) 239 { 240 241 final Parametre pNOx = new Parametre(); 242 pNOx.setParametreId( 23 ); 243 pNOx.setParametreNom( "Nitrogen Oxides" ); 244 pNOx.setParametreCode( "NOx" ); 245 final Unite unitPpbv = new Unite(); 246 unitPpbv.setUniteCode( "ppbv" ); 247 pNOx.setUnite( unitPpbv ); 248 return pNOx; 249 } 250 else return null; 251 } 252 253 public static Data createValuesForTimeSerie( final Integer size, final Integer delta ) 34 254 { 35 255 final double[] values = new double[size]; … … 46 266 } 47 267 268 public static Data createValuesFor2D( final Integer size, final Integer delta ) 269 { 270 // final double[] latitudeArray = {2.1, 2.2, 2.3}; 271 // final double[] longitudeValues = {112.1, 12.2, 22.3}; 272 final double[] latitudeValues = new double[size]; 273 final double[] longitudeValues = new double[size]; 274 final double[] parameterValues = new double[size]; 275 276 for( int i = 0; i < size; i++ ) 277 { 278 parameterValues[i] = Math.random() * i; 279 latitudeValues[i] = Math.random() * i; 280 longitudeValues[i] = Math.random() * i; 281 } 282 283 return new Data( parameterValues, latitudeValues, longitudeValues ); 284 } 285 286 public static Data createRealValuesFor2D() 287 { 288 final double[] latitudeArray = {488993.0, 489001.0, 488984.0, 489010.0, 490005.0, 490015.0}; 289 final double[] longitudeValues = {-1829.0, -1829.0, -1828.0, -1828.0, -1827.0, -1826.0}; 290 final double[] parameterValues = {7.029, 0.0, 0.0, 0.0, 8.547, 0.0, 0.0, 0.0, 8.845, 0.0, 0.0, 0.0, 9.248, 0.0, 0.0, 0.0, 9.58, 0.0, 0.0, 0.0, 9.98, 0.0, 0.0, 0.0, 7.98, 0.0, 0.0, 0.0, 6.58, 0.0, 0.0, 0.0, 8.08, 0.0, 0.0, 0.0}; 291 292 return new Data( parameterValues, latitudeArray, longitudeValues ); 293 } 48 294 49 295 } -
ether_megapoli/trunk/service/implementation/com/ether/EtherPlotContentServiceImpl.java
r185 r186 87 87 88 88 /** *********** FIRST Y-AXIS ************ **/ 89 final List<SimpleLine> lines ForFirstAxis= createLines( pIdPIdListForFirstAxis, megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() );90 final SimpleLine firstLine ForFirstAxis = linesForFirstAxis.get( 0 );91 92 final SoTRange xnRange = firstLine ForFirstAxis.getXRange();93 final SoTRange yRange ForFirstAxis = firstLineForFirstAxis.getYRange();94 for( final SimpleLine line : lines ForFirstAxis)95 yRange ForFirstAxis.add( line.getYRange() );89 final List<SimpleLine> lines = createLines( pIdPIdListForFirstAxis, megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() ); 90 final SimpleLine firstLine = lines.get( 0 ); 91 92 final SoTRange xnRange = firstLine.getXRange(); 93 final SoTRange yRange = firstLine.getYRange(); 94 for( final SimpleLine line : lines ) 95 yRange.add( line.getYRange() ); 96 96 97 97 // TODO : automatiser le nb d'intervalles en fonction des valeurs de y 98 98 final Integer intervalsNumber = 10; 99 final SoTRange ynRange ForFirstAxis = Graph.computeRange( yRangeForFirstAxis, intervalsNumber );99 final SoTRange ynRange = Graph.computeRange( yRange, intervalsNumber ); 100 100 101 101 // Origin point 102 final SoTPoint originPoint ForFirstAxis = new SoTPoint( ynRangeForFirstAxis.getStart(), xnRange.getStart() );102 final SoTPoint originPoint = new SoTPoint( ynRange.getStart(), xnRange.getStart() ); 103 103 104 104 // Create the time axis, set its range in user units and its origin. … … 106 106 final TimeAxis xbot = new TimeAxis( "X-Axis", TimeAxis.AUTO ); 107 107 xbot.setRangeU( xnRange ); 108 xbot.setLocationU( originPoint ForFirstAxis);108 xbot.setLocationU( originPoint ); 109 109 xbot.setLabelFont( _axisFont ); 110 110 // xbot.setMinorLabelInterval( 1 ); 111 111 112 112 // Create the vertical axis, set its range in user units and its origin. Create the axis title. 113 final PlainAxis yleft ForFirstAxis= new PlainAxis( "Y-Axis" );114 yleft ForFirstAxis.setRangeU( ynRangeForFirstAxis);115 yleft ForFirstAxis.setLocationU( originPointForFirstAxis);116 yleft ForFirstAxis.setLabelFont( _axisFont );117 final String yLabel ForFirstAxis = firstLineForFirstAxis.getYMetaData().getName() + " (" + firstLineForFirstAxis.getYMetaData().getUnits() + ")";118 final SGLabel ytitle ForFirstAxis = new SGLabel( "Y-Axis Title", yLabelForFirstAxis, new Point2D.Double( 0.0, 0.0 ) );119 ytitle ForFirstAxis.setFont( _axisFont );120 ytitle ForFirstAxis.setHeightP( _heightAxisFont );121 yleft ForFirstAxis.setTitle( ytitleForFirstAxis);113 final PlainAxis yleft = new PlainAxis( "Y-Axis" ); 114 yleft.setRangeU( ynRange ); 115 yleft.setLocationU( originPoint ); 116 yleft.setLabelFont( _axisFont ); 117 final String yLabel = firstLine.getYMetaData().getName() + " (" + firstLine.getYMetaData().getUnits() + ")"; 118 final SGLabel ytitle = new SGLabel( "Y-Axis Title", yLabel, new Point2D.Double( 0.0, 0.0 ) ); 119 ytitle.setFont( _axisFont ); 120 ytitle.setHeightP( _heightAxisFont ); 121 yleft.setTitle( ytitle ); 122 122 123 123 /** ************ GRAPH ********** **/ 124 124 // Create first CartesianGraph and transforms 125 125 final CartesianGraph graph = new CartesianGraph( "First Graph" ); 126 final LinearTransform xt ForFirstAxis= new LinearTransform( new Range2D( xstart, xend ), xnRange );127 graph.setXTransform( xt ForFirstAxis);128 final LinearTransform yt ForFirstAxis = new LinearTransform( new Range2D( ystart, yend ), ynRangeForFirstAxis);129 graph.setYTransform( yt ForFirstAxis);126 final LinearTransform xt = new LinearTransform( new Range2D( xstart, xend ), xnRange ); 127 graph.setXTransform( xt ); 128 final LinearTransform yt = new LinearTransform( new Range2D( ystart, yend ), ynRange ); 129 graph.setYTransform( yt ); 130 130 131 131 graph.addXAxis( xbot ); 132 graph.addYAxis( yleftForFirstAxis ); 133 134 final LineAttribute attrForFirstAxis = createRandomLineAttrbute( megapoliPlot.getAxeType() ); 135 graph.setData( firstLineForFirstAxis, attrForFirstAxis ); 136 137 /** *********** LEGEND ********* **/ 138 final LineKey lkey = new LineKey(); 139 if( !megapoliPlot.isLegendToHide() ) 140 { 141 lkey.setId( "Legend" ); 142 lkey.setLocationP( new Point2D.Double( 0.1, ysize - 0.1 ) ); 143 lkey.setBorderStyle( LineKey.NO_BORDER ); 144 layer.addChild( lkey ); 145 lkey.addLineGraph( (LineCartesianRenderer) graph.getRenderer(), firstLineForFirstAxis.getKeyTitle() ); 146 } 147 148 /** ********************************** **/ 149 /** *********** OTHER LAYERS ********* **/ 150 /** ********************************** **/ 151 for( final SimpleLine line : linesForFirstAxis.subList( 1, linesForFirstAxis.size() ) ) 152 { 153 final Layer otherLayer = new Layer( "Other Layer", new Dimension2D( xsize, ysize ) ); 154 mainPane.add( otherLayer ); 155 final CartesianGraph otherGraph = new CartesianGraph( "Second Graph", xtForFirstAxis, ytForFirstAxis ); 156 otherLayer.setGraph( otherGraph ); 157 158 final LineAttribute otherLineAttribute = createRandomLineAttrbute( megapoliPlot.getAxeType() ); 159 otherGraph.setData( line, otherLineAttribute ); 160 lkey.addLineGraph( (LineCartesianRenderer) otherGraph.getRenderer(), line.getKeyTitle() ); 161 } 162 163 /** *********** SECOND Y-AXIS (optional) ************ **/ 132 graph.addYAxis( yleft ); 133 134 SimpleLine firstLineForSecondAxis = null; 135 List<SimpleLine> linesForSecondAxis = new ArrayList<SimpleLine>(); 136 LinearTransform ytForSecondAxis = null; 164 137 if( !pIdPIdListForSecondAxis.isEmpty() ) 165 138 { 166 final List<SimpleLine>linesForSecondAxis = createLines( pIdPIdListForSecondAxis, megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() );167 fi nal SimpleLine firstLineForSecondAxis = linesForSecondAxis.get( 0 );139 linesForSecondAxis = createLines( pIdPIdListForSecondAxis, megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() ); 140 firstLineForSecondAxis = linesForSecondAxis.get( 0 ); 168 141 169 142 final SoTRange yRangeForSecondAxis = firstLineForSecondAxis.getYRange(); … … 179 152 yleftForSecondAxis.setLabelFont( _axisFont ); 180 153 yleftForSecondAxis.setLabelPosition( Axis.POSITIVE_SIDE ); 181 final SGLabel ytitleForSecondAxis = new SGLabel( "Y-Axis Title", firstLineForSecondAxis.getYMetaData().getName(), new Point2D.Double( 0.0, 0.0 ) ); 154 final String yLabelForSecondAxis = firstLineForSecondAxis.getYMetaData().getName() + " (" + firstLineForSecondAxis.getYMetaData().getUnits() + ")"; 155 final SGLabel ytitleForSecondAxis = new SGLabel( "Y-Axis Title", yLabelForSecondAxis, new Point2D.Double( 0.0, 0.0 ) ); 182 156 ytitleForSecondAxis.setFont( _axisFont ); 183 157 ytitleForSecondAxis.setHeightP( _heightAxisFont ); 184 158 yleftForSecondAxis.setTitle( ytitleForSecondAxis ); 185 159 186 /** ************ GRAPH ********** **/ 187 final LinearTransform ytForSecondAxis = new LinearTransform( new Range2D( ystart, yend ), ynRangeForSecondAxis ); 160 ytForSecondAxis = new LinearTransform( new Range2D( ystart, yend ), ynRangeForSecondAxis ); 188 161 graph.setYTransform( ytForSecondAxis ); 189 162 graph.addYAxis( yleftForSecondAxis ); 190 191 final LineAttribute attrForSecondAxis = createRandomLineAttrbute( megapoliPlot.getAxeType() ); 192 graph.setData( firstLineForSecondAxis, attrForSecondAxis ); 193 194 for( final SimpleLine line : linesForSecondAxis.subList( 1, linesForSecondAxis.size() ) ) 163 } 164 165 layer.setGraph( graph ); 166 167 final LineAttribute lineAttribute = createRandomLineAttrbute( megapoliPlot.getAxeType() ); 168 graph.setData( firstLine, lineAttribute ); 169 170 // if( !pIdPIdListForSecondAxis.isEmpty() ) 171 // { 172 // final LineAttribute attrForSecondAxis = createRandomLineAttrbute( megapoliPlot.getAxeType() ); 173 // graph.setData( firstLineForSecondAxis, attrForSecondAxis ); 174 // } 175 176 /** *********** LEGEND ********* **/ 177 final LineKey lkey = new LineKey(); 178 if( !megapoliPlot.isLegendToHide() ) 179 { 180 lkey.setId( "Legend" ); 181 lkey.setLocationP( new Point2D.Double( 0.1, ysize - 0.1 ) ); 182 lkey.setBorderStyle( LineKey.NO_BORDER ); 183 layer.addChild( lkey ); 184 lkey.addLineGraph( (LineCartesianRenderer) graph.getRenderer(), firstLine.getKeyTitle() ); 185 } 186 187 /** ********************************** **/ 188 /** *********** OTHER LAYERS ********* **/ 189 /** ********************************** **/ 190 for( final SimpleLine line : lines.subList( 1, lines.size() ) ) 191 { 192 final Layer otherLayer = new Layer( "Other Layer", new Dimension2D( xsize, ysize ) ); 193 mainPane.add( otherLayer ); 194 final CartesianGraph otherGraph = new CartesianGraph( "Second Graph", xt, yt ); 195 otherLayer.setGraph( otherGraph ); 196 197 final LineAttribute otherLineAttribute = createRandomLineAttrbute( megapoliPlot.getAxeType() ); 198 otherGraph.setData( line, otherLineAttribute ); 199 lkey.addLineGraph( (LineCartesianRenderer) otherGraph.getRenderer(), line.getKeyTitle() ); 200 } 201 202 /** *********** SECOND Y-AXIS (optional) ************ **/ 203 if( !pIdPIdListForSecondAxis.isEmpty() ) 204 { 205 // final Layer layerForSecondAxis = new Layer( "First Layer", new Dimension2D( xsize, ysize ) ); 206 // mainPane.add( layerForSecondAxis ); 207 // 208 // final List<SimpleLine> linesForSecondAxis = createLines( pIdPIdListForSecondAxis, megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() ); 209 // final SimpleLine firstLineForSecondAxis = linesForSecondAxis.get( 0 ); 210 211 // final SoTRange yRangeForSecondAxis = firstLineForSecondAxis.getYRange(); 212 // for( final SimpleLine line : linesForSecondAxis ) 213 // yRangeForSecondAxis.add( line.getYRange() ); 214 // 215 // final SoTRange ynRangeForSecondAxis = Graph.computeRange( yRangeForSecondAxis, intervalsNumber ); 216 // final SoTPoint endPointForSecondAxis = new SoTPoint( ynRangeForSecondAxis.getStart(), xnRange.getEnd() ); 217 // 218 // final PlainAxis yleftForSecondAxis = new PlainAxis( "YY-Axis" ); 219 // yleftForSecondAxis.setRangeU( yRangeForSecondAxis ); 220 // yleftForSecondAxis.setLocationU( endPointForSecondAxis ); 221 // yleftForSecondAxis.setLabelFont( _axisFont ); 222 // yleftForSecondAxis.setLabelPosition( Axis.POSITIVE_SIDE ); 223 // final String yLabelForSecondAxis = firstLineForSecondAxis.getYMetaData().getName() + " (" + firstLineForSecondAxis.getYMetaData().getUnits() + ")"; 224 // final SGLabel ytitleForSecondAxis = new SGLabel( "Y-Axis Title", yLabelForSecondAxis, new Point2D.Double( 0.0, 0.0 ) ); 225 // ytitleForSecondAxis.setFont( _axisFont ); 226 // ytitleForSecondAxis.setHeightP( _heightAxisFont ); 227 // yleftForSecondAxis.setTitle( ytitleForSecondAxis ); 228 229 /** ************ GRAPH ********** **/ 230 // final CartesianGraph graphForSecondAxis = new CartesianGraph( "First Graph" ); 231 // final LinearTransform ytForSecondAxis = new LinearTransform( new Range2D( ystart, yend ), ynRangeForSecondAxis ); 232 // graphForSecondAxis.setYTransform( ytForSecondAxis ); 233 // graphForSecondAxis.addYAxis( yleftForSecondAxis ); 234 // layerForSecondAxis.setGraph( graphForSecondAxis ); 235 236 237 for( final SimpleLine line : linesForSecondAxis.subList( 0, linesForSecondAxis.size() ) ) 195 238 { 196 final Layer otherLayer = new Layer( "Other Layer", new Dimension2D( xsize, ysize ) );197 mainPane.add( otherLayer );198 final CartesianGraph otherGraph = new CartesianGraph( "Second Graph", xtForFirstAxis, ytForSecondAxis );199 otherLayer .setGraph( otherGraph);239 final Layer otherLayerForSecondAxis = new Layer( "Other Layer 2", new Dimension2D( xsize, ysize ) ); 240 mainPane.add( otherLayerForSecondAxis ); 241 final CartesianGraph otherGraphForSecondAxis = new CartesianGraph( "Second Graph 2", xt, ytForSecondAxis ); 242 otherLayerForSecondAxis.setGraph( otherGraphForSecondAxis ); 200 243 201 244 final LineAttribute otherLineAttribute = createRandomLineAttrbute( megapoliPlot.getAxeType() ); 202 otherGraph .setData( line, otherLineAttribute );203 lkey.addLineGraph( (LineCartesianRenderer) otherGraph .getRenderer(), line.getKeyTitle() );245 otherGraphForSecondAxis.setData( line, otherLineAttribute ); 246 lkey.addLineGraph( (LineCartesianRenderer) otherGraphForSecondAxis.getRenderer(), line.getKeyTitle() ); 204 247 } 205 248 } 206 layer.setGraph( graph );207 249 208 250 return mainPane; … … 280 322 final Integer parameterId = pIdPId.getSecondValue(); 281 323 282 final Plateforme plateform = _etherService.getPlateformById( plateformId );283 // final Plateforme plateform = BouchonHelper.createPlateform();324 // final Plateforme plateform = _etherService.getPlateformById( plateformId ); 325 final Plateforme plateform = BouchonHelper.getPlateformById( plateformId ); 284 326 if( null == plateform ) 285 327 throw new ServiceException( ServiceException.ServiceCode.PLATEFORM_IS_NULL, new Throwable( ServiceException.ServiceCode.PLATEFORM_IS_NULL.toString() ) ); 286 328 287 final Parametre parametre = _etherService.getParameterById( parameterId );288 // final Parametre parametre = BouchonHelper.createParameter();329 // final Parametre parametre = _etherService.getParameterById( parameterId ); 330 final Parametre parametre = BouchonHelper.getParameterById( parameterId ); 289 331 if( null == parametre ) 290 332 throw new ServiceException( ServiceException.ServiceCode.PARAMETER_IS_NULL, new Throwable( ServiceException.ServiceCode.PARAMETER_IS_NULL.toString() ) ); 291 333 292 final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodForTimeSerie( plateformId, parameterId, beginDate, endDate );293 // final Data valuesLists = BouchonHelper.createValuesTemp( 50, 5 );334 // final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodForTimeSerie( plateformId, parameterId, beginDate, endDate ); 335 final Data valuesLists = BouchonHelper.createValuesForTimeSerie( 50, 5 ); 294 336 295 337 final double[] dataArray = (double[]) valuesLists.getFirstArray(); … … 321 363 final ResourceBundle bundle = WebHelper.getBundle( locale ); 322 364 323 final double[] parameterArray = (double[]) megapoliPlot.getData().getFirstArray(); 324 final double[] latitudeArray = (double[]) megapoliPlot.getData().getSecondArray(); 325 final double[] longitudeValues = (double[]) megapoliPlot.getData().getThirdArray(); 365 final Data realValuesFor2D = BouchonHelper.createRealValuesFor2D(); 366 // final double[] parameterValues = (double[]) megapoliPlot.getData().getFirstArray(); 367 // final double[] latitudeValues = (double[]) megapoliPlot.getData().getSecondArray(); 368 // final double[] longitudeValues = (double[]) megapoliPlot.getData().getThirdArray(); 369 370 final double[] parameterValues = (double[]) realValuesFor2D.getFirstArray(); 371 final double[] latitudeValues = (double[]) realValuesFor2D.getSecondArray(); 372 final double[] longitudeValues = (double[]) realValuesFor2D.getThirdArray(); 326 373 327 374 // final SimpleLine data = new SimpleLine( longitudeValues, latitudeArray, "legend" ); 328 final SimpleGrid data = new SimpleGrid( parameterArray, longitudeValues, latitudeArray, "Test Series" );329 SGTMetaData meta = new SGTMetaData( bundle.getString( "plot.longitude" ), bundle.getString( "plot.degres" ), false, true );375 // final SimpleGrid data = new SimpleGrid( parameterArray, longitudeValues, latitudeArray, "Test Series" ); 376 // SGTMetaData meta = new SGTMetaData( bundle.getString( "plot.longitude" ), bundle.getString( "plot.degres" ), false, true ); 330 377 // TODO : vérifier modulo = 360 331 378 // meta.setModuloValue( 360 ); 332 data.setXMetaData( meta );333 334 meta = new SGTMetaData( bundle.getString( "plot.latitude" ), bundle.getString( "plot.degres" ), false, true );379 // data.setXMetaData( meta ); 380 381 // meta = new SGTMetaData( bundle.getString( "plot.latitude" ), bundle.getString( "plot.degres" ), false, true ); 335 382 // TODO : vérifier modulo = 360 336 383 // meta.setModuloValue( 360 ); 337 data.setYMetaData( meta );384 // data.setYMetaData( meta ); 338 385 /* 339 386 * Create a test grid with sinasoidal-ramp data. … … 343 390 Range2D xr = new Range2D( 190.0f, 250.0f, 1.0f ); 344 391 Range2D yr = new Range2D( 0.0f, 45.0f, 1.0f ); 345 newData = testDataa( xr, yr, TestData.SINE_RAMP, 12.0f, 30.f, 5.0f, parameterArray, latitudeArray, longitudeValues ); 392 // newData = testDataa( xr, yr, TestData.SINE_RAMP, 12.0f, 30.f, 5.0f, parameterArray, latitudeArray, longitudeValues ); 393 394 395 // public SGTData testDataa( Range2D range1, Range2D range2, int type, float amp, float off, float per, final double[] parameterArray, final double[] latitudeArray, final double[] longitudeValues ) 396 final SimpleGrid simpleGrid; 397 final SGTMetaData xMeta; 398 final SGTMetaData yMeta; 399 final SGTMetaData zMeta; 400 401 final int num1 = (int) ( ( xr.end - xr.start ) / xr.delta ) + 1; 402 final double[] axis1 = new double[num1]; 403 final int num2 = (int) ( ( yr.end - yr.start ) / yr.delta ) + 1; 404 final double[] axis2 = new double[num2]; 405 406 for( int count = 0; count < num1; count++ ) 407 axis1[count] = xr.start + count * xr.delta; 408 409 for( int count = 0; count < num2; count++ ) 410 axis2[count] = yr.start + count * yr.delta; 411 412 final double[] valuesOrig = getValues( axis1, num1, axis2, num2, TestData.SINE_RAMP, 12.0f, 30.f, 5.0f ); 413 final double[] values = getValues( longitudeValues, longitudeValues.length, latitudeValues, latitudeValues.length, TestData.SINE_RAMP, 12.0f, 30.f, 5.0f ); 414 415 SGLabel keyLabel = new SGLabel( "Key Label", "", new Point2D.Double( 0.0, 0.0 ) ); 416 keyLabel.setHeightP( 0.16 ); 417 // 418 // create SimpleGrid 419 // 420 zMeta = new SGTMetaData( "ts", "m s-1" ); 421 keyLabel.setText( "XY test grid" ); 422 xMeta = new SGTMetaData( "lon", "degE" ); 423 yMeta = new SGTMetaData( "lat", "deg" ); 424 final SimpleGrid sg = new SimpleGrid( valuesOrig, axis1, axis2, "Test Series" ); 425 simpleGrid = new SimpleGrid( parameterValues, longitudeValues, latitudeValues, "Test Series" ); 426 // simpleGrid = new SimpleGrid( values, longitudeValues, latitudeValues, "Test Series" ); 427 // simpleGrid = new SimpleGrid( valuesOrig, axis1, axis2, "Test Series" ); 428 429 simpleGrid.setXMetaData( xMeta ); 430 simpleGrid.setYMetaData( yMeta ); 431 simpleGrid.setZMetaData( zMeta ); 432 simpleGrid.setKeyTitle( keyLabel ); 433 346 434 347 435 // Create the contour levels and color map 348 final Range2D datar = new Range2D( -20.0f, 50.0f, 5.0f ); 436 // final Range2D datar = new Range2D( -20.0f, 50.0f, 5.0f ); 437 final Range2D datar = new Range2D( 5f, 10.0f, 1f ); 349 438 final ContourLevels clevels = ContourLevels.getDefault( datar ); 350 439 final ColorMap cmap = createColorMap( datar ); … … 358 447 final JPlotLayout jPlotLayout = new JPlotLayout( true, false, false, "JPlotLayout Pane", null, true ); 359 448 jPlotLayout.setEditClasses( false ); 360 jPlotLayout.addData( newData, gridAttribute, "First Data" );449 jPlotLayout.addData( simpleGrid, gridAttribute, "First Data" ); 361 450 jPlotLayout.setTitles( "", "", "" ); 362 451 jPlotLayout.setSize( new Dimension( plotWidth, plotHeight ) ); -
ether_megapoli/trunk/service/implementation/com/ether/EtherPlotServiceImpl.java
r185 r186 68 68 jPane.add( jPaneTop, BorderLayout.NORTH ); 69 69 70 // TODO : gérer values Number 71 // final Integer valuesNumber = 10; 72 final Integer valuesNumber = getEtherService().getNumberValuesByPlateformByParameterByPeriod( megapoliPlot.getpIdPIdList(), megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() ); 70 final Integer valuesNumber = 10; 71 // final Integer valuesNumber = ( null != megapoliPlot.getValuesNumber() ) ? megapoliPlot.getValuesNumber() : getEtherService().getNumberValuesByPlateformByParameterByPeriod( megapoliPlot.getpIdPIdList(), megapoliPlot.getBeginDate(), megapoliPlot.getEndDate() ); 73 72 74 73 // Bottom Pane … … 256 255 final JPane jPaneGraph; 257 256 258 if( AxeTypeForFixedPlateform.TIME_LINE.name().equals( megapoliPlot.getAxeType() ) || AxeTypeForFixedPlateform.TIME_POINTS.name().equals( megapoliPlot.getAxeType()) )257 if( megapoliPlot.isTimeSerie() ) 259 258 jPaneGraph = createTimeSeriePlot( megapoliPlot, plotWidth, plotHeight ); 260 259 else -
ether_megapoli/trunk/service/implementation/com/ether/MegapoliPlot.java
r185 r186 1 1 package com.ether; 2 2 3 import com.medias.megapoli.utils.MegapoliInitialisation; 3 4 import org.jetbrains.annotations.NotNull; 4 5 import org.jetbrains.annotations.Nullable; … … 46 47 } 47 48 48 @N otNull49 @Nullable 49 50 public Data getData() 50 51 { … … 52 53 } 53 54 54 public void setData( @N otNullfinal Data data )55 public void setData( @Nullable final Data data ) 55 56 { 56 57 _data = data; … … 77 78 } 78 79 80 @Nullable 81 public Integer getValuesNumber() 82 { 83 return _valuesNumber; 84 } 85 86 public void setValuesNumber( @Nullable final Integer valuesNumber ) 87 { 88 _valuesNumber = valuesNumber; 89 } 90 79 91 @NotNull 80 92 public String getAxeType() … … 88 100 } 89 101 90 @N otNull102 @Nullable 91 103 public List<Pair> getpIdPIdList() 92 104 { … … 94 106 } 95 107 96 public void setpIdPIdList( @N otNullfinal List<Pair> pIdPIdList )108 public void setpIdPIdList( @Nullable final List<Pair> pIdPIdList ) 97 109 { 98 110 _pIdPIdList = pIdPIdList; … … 123 135 @Nullable 124 136 private String _title; 125 @N otNull137 @Nullable 126 138 private Data _data; 127 139 @NotNull 128 // private String _logoMegapoli = MegapoliInitialisation.pathImages + "/logo_Megapoli.png"; 129 private String _logoMegapoli = "/home_local/PROJETS/MEGAPOLI/megapoli/data/images/logo_Megapoli.png"; 140 private String _logoMegapoli = MegapoliInitialisation.pathImages + "/logo_Megapoli.png"; 141 // private String _logoMegapoli = "/home_local/PROJETS/MEGAPOLI/megapoli/data/images/logo_Megapoli.png"; 142 @NotNull 143 private String _logoEther = MegapoliInitialisation.pathImages + "/logo_Ether.jpg"; 144 // private String _logoEther = "/home_local/PROJETS/MEGAPOLI/megapoli/data/images/logo_Ether.jpg"; 130 145 131 @NotNull132 // private String _logoEther = MegapoliInitialisation.pathImages + "/logo_Ether.jpg";133 private String _logoEther = "/home_local/PROJETS/MEGAPOLI/megapoli/data/images/logo_Ether.jpg";134 146 private boolean _legendToHide = true; 135 147 private boolean _isTimeSerie = true; 148 @Nullable 149 private Integer _valuesNumber; 136 150 @NotNull 137 151 private String _axeType; 138 152 139 153 // List of <plateformId, parameterId> to display 140 @N otNull154 @Nullable 141 155 private List<Pair> _pIdPIdList; 142 156 @Nullable -
ether_megapoli/trunk/web/src/com/ether/Controller.java
r185 r186 6 6 import com.medias.database.objects.Parametre; 7 7 import com.medias.database.objects.Plateforme; 8 import com.medias.database.objects.TypePlateforme;9 8 import net.sf.json.JSONObject; 10 9 import org.apache.commons.logging.Log; … … 51 50 throws ServiceException 52 51 { 53 final List<Plateforme> plateforms = _etherService.getAllPlateforms(); 54 // final List<Plateforme> plateforms = new ArrayList<Plateforme>(); 55 // final Plateforme pf = new Plateforme(); 56 // pf.setPlateformeId( 1 ); 57 // pf.setPlateformeNom( "LHVP" ); 58 // pf.setTypePlateforme( new TypePlateforme( 1, "FIXE" ) ); 59 // plateforms.add( pf ); 60 // final Plateforme pf2 = new Plateforme(); 61 // pf2.setPlateformeId( 2 ); 62 // pf2.setPlateformeNom( "SIRTA" ); 63 // pf2.setTypePlateforme( new TypePlateforme( 1, "FIXE" ) ); 64 // plateforms.add( pf2 ); 52 // final List<Plateforme> plateforms = _etherService.getAllPlateforms(); 53 final List<Plateforme> plateforms = BouchonHelper.createPlateforms(); 65 54 66 55 final Map<String, Object> model = new HashMap<String, Object>(); … … 80 69 throws ServiceException, EtherException 81 70 { 82 final List<Parametre> parametersByPlateform = _etherService.getParametersByPlateformId( plateformId ); 83 // final List<Parametre> parametersByPlateform = new ArrayList<Parametre>( 2 ); 84 // final Parametre p1 = new Parametre(); 85 // p1.setParametreId( 1 ); 86 // p1.setParametreNom( "JNO2" ); 87 // parametersByPlateform.add( p1 ); 88 // final Parametre p2 = new Parametre(); 89 // p2.setParametreId( 2 ); 90 // p2.setParametreNom( "CO2" ); 91 // parametersByPlateform.add( p2 ); 92 // 93 // if( plateformId == 1 ) 94 // { 95 // final Parametre p3 = new Parametre(); 96 // p3.setParametreId( 3 ); 97 // p3.setParametreNom( "Ethane" ); 98 // parametersByPlateform.add( p3 ); 99 // } 100 // else 101 // { 102 // final Parametre p3 = new Parametre(); 103 // p3.setParametreId( 3 ); 104 // p3.setParametreNom( "Sulfate" ); 105 // parametersByPlateform.add( p3 ); 106 // final Parametre p4 = new Parametre(); 107 // p4.setParametreId( 4 ); 108 // p4.setParametreNom( "Benzene" ); 109 // parametersByPlateform.add( p4 ); 110 // } 71 // final List<Parametre> parametersByPlateform = _etherService.getParametersByPlateformId( plateformId ); 72 final List<Parametre> parametersByPlateform = BouchonHelper.createParameters( plateformId ); 111 73 112 74 final JSONObject result = new JSONObject(); -
ether_megapoli/trunk/web/src/com/ether/ControllerPlot.java
r185 r186 36 36 final ApplicationContext appContext = WebApplicationContextUtils.getRequiredWebApplicationContext( servletConfig.getServletContext() ); 37 37 _etherPlotService = (EtherPlotService) appContext.getBean( "etherPlotService", EtherPlotService.class ); 38 _etherService = (EtherService) appContext.getBean( "etherService", EtherService.class ); 38 39 } 39 40 catch( Throwable tx ) … … 108 109 else 109 110 { 111 // 2D plot : only one parameter to display 112 final Integer plateformId = (Integer) pIdPIdList.get( 0 ).getFirstValue(); 113 final Integer parameterId = (Integer) pIdPIdList.get( 0 ).getSecondValue(); 110 114 // final Data valuesLists = _etherService.getListsByPlateformByParameterByPeriodFor2D( plateformId, parameterId, formatedDateBegin, formatedDateEnd ); 111 final double[] latitudeValues = new double[50]; 112 final double[] longitudeValues = new double[50]; 113 final double[] parameterValues = new double[50]; 114 115 for( int i = 0; i < 50; i++ ) 116 { 117 parameterValues[i] = Math.random() * i; 118 latitudeValues[i] = Math.random() * i; 119 longitudeValues[i] = Math.random() * i; 120 } 121 final Data valuesLists = new Data( parameterValues, latitudeValues, longitudeValues ); 122 123 megapoliPlot.setData( valuesLists ); 124 // final double[] latitudeArray = {2.1, 2.2, 2.3}; 125 // final double[] longitudeValues = {112.1, 12.2, 22.3}; 115 // megapoliPlot.setData( valuesLists ); 126 116 127 117 megapoliPlot.setTimeSerie( false ); 128 118 megapoliPlot.setLegendToHide( false ); 129 119 // megapoliPlot.setValuesNumber( ( (double[]) valuesLists.getFirstArray() ).length ); 120 megapoliPlot.setValuesNumber( 5 ); 130 121 } 131 122 … … 194 185 195 186 private EtherPlotService _etherPlotService; 196 187 private EtherService _etherService; 197 188 }
Note: See TracChangeset
for help on using the changeset viewer.