Changeset 371
- Timestamp:
- 02/22/12 11:32:21 (12 years ago)
- Location:
- ether_megapoli/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
ether_megapoli/trunk/service/implementation/com/ether/EtherPlotContentServiceImpl.java
r366 r371 108 108 109 109 /** ********** AXIS RANGES ********* **/ 110 finalSoTRange xnRange = firstLine.getXRange();110 SoTRange xnRange = firstLine.getXRange(); 111 111 final SoTRange yRange = firstLine.getYRange(); 112 112 for( final SimpleLine line : lines ) … … 118 118 for( final SimpleLine line : linesForSecondAxis ) 119 119 xnRange.add( line.getXRange() ); 120 121 if( xnRange.getStart().equals( xnRange.getEnd() ) ) 122 xnRange = Graph.computeTimeRange( xnRange, _intervalsNumber ); 120 123 121 124 /** ********************************** **/ … … 123 126 /** ********************************** **/ 124 127 final SoTRange ynRange = Graph.computeRange( yRange, _intervalsNumber ); 125 final SoTRange xnRange2 = Graph.computeRange( xnRange, _intervalsNumber );126 128 final SoTPoint originPoint = new SoTPoint( ynRange.getStart(), xnRange.getStart() ); 127 129 … … 370 372 periodStr += null != endDate ? " - " + DateHelper.formatDate( endDate, DateHelper.ENGLISH_DATE_PATTERN ) + "] (UTC)" : " - X] (UTC)"; 371 373 372 final Layer periodLayer = new Layer( "PeriodLayer", new Dimension2D( 1. 0, 1.0 ) );374 final Layer periodLayer = new Layer( "PeriodLayer", new Dimension2D( 1.25, 1.0 ) ); 373 375 jPane.add( periodLayer ); 374 376 375 final SGLabel periodLabel = new SGLabel( "Period", periodStr, new Point2D.Double( 1.04, 0.99 ) );377 final SGLabel periodLabel = new SGLabel( "Period", periodStr, new Point2D.Double( 0.1, 0.99 ) ); 376 378 periodLabel.setAlign( SGLabel.TOP, SGLabel.CENTER ); 377 379 periodLabel.setFont( _periodFont ); -
ether_megapoli/trunk/service/implementation/gov/noaa/pmel/sgt/Graph.java
r192 r371 10 10 * element in other product development. 11 11 */ 12 package gov.noaa.pmel.sgt; 13 12 package gov.noaa.pmel.sgt; 13 14 import gov.noaa.pmel.sgt.dm.SGTData; 14 15 import gov.noaa.pmel.util.Range2D; 15 16 import gov.noaa.pmel.util.SoTRange; 16 import gov.noaa.pmel.util.Debug; 17 18 import gov.noaa.pmel.sgt.dm.SGTData; 19 20 import java.awt.Graphics; 21 import java.awt.Event; 22 import java.awt.Point; 17 import gov.noaa.pmel.util.SoTValue; 18 19 import java.awt.*; 23 20 import java.beans.PropertyChangeListener; 24 21 … … 27 24 * <code>Graph</code> class defines the interfaces for the user to physical 28 25 * coordinate, user to device, and physical to user coordinate systems. 29 * <p >26 * <p/> 30 27 * The following demonstrates how a {@link CartesianGraph} may be 31 28 * used. 32 * <p >29 * <p/> 33 30 * <pre> 34 31 * // Create a CartesianGraph and transforms. … … 86 83 * @author Donald Denbo 87 84 * @version $Revision: 1.12 $, $Date: 2003/08/22 23:02:32 $ 88 * @since 1.089 85 * @see Layer 90 86 * @see LinearTransform … … 92 88 * @see SGLabel 93 89 * @see CartesianGraph 90 * @since 1.0 94 91 */ 95 public abstract class Graph implements PropertyChangeListener { 96 private String ident_; 97 /** @directed 98 * @label layer */ 99 protected Layer layer_; 100 /** 101 * Default constructor. 102 **/ 103 public Graph() { 104 this(""); 105 } 106 /** 107 * Constructor for <code>Graph</code> class. 108 * 109 * @param id identifier 110 **/ 111 public Graph(String id) { 112 ident_ = id; 113 } 114 /** 115 * Copy the <code>Graph</code> object and all attached classes. 116 */ 117 public abstract Graph copy(); 118 /** 119 * Get the <code>Graph</code> identifier 120 * 121 * @return ident 122 **/ 123 public String getId() { 124 return ident_; 125 } 126 // 127 abstract void draw(Graphics g); 128 // 129 void setLayer(Layer l) { 130 layer_ = l; 131 } 132 /** 133 * Get the associated <code>Layer</code>. 134 * 135 * @return <code>Layer</code> object 136 **/ 137 public Layer getLayer() { 138 return layer_; 139 } 140 /** 141 * Return parent pane. 142 * @since 2.0 143 */ 144 public AbstractPane getPane() { 145 return layer_.getPane(); 146 } 147 /** 148 * Used internally by sgt. 149 * @since 2.0 150 */ 151 public void modified(String mess) { 152 if(layer_ != null) 153 layer_.modified(mess); 154 } 155 /** 156 * Compute a "nice" range from a range and number of intervals. 157 * 158 * @param range min and max values 159 * @param num number of intervals 160 * @return "nice" range 161 */ 162 public static Range2D computeRange(Range2D range,int num) { 163 return computeRange(range.start, range.end, num); 164 } 165 /** 166 * Compute a "nice" range from a range and number of intervals. 167 * 168 * @since 2.0 169 * @param range min and max values 170 * @param num number of intervals 171 * @return "nice" range 172 */ 173 public static SoTRange computeRange(SoTRange range, int num) { 174 if(!range.isTime()) { 175 SoTRange.Double drange = (SoTRange.Double)range; 176 return new SoTRange.Double(computeRange(drange.start, 177 drange.end, num)); 178 } 179 return null; 180 } 181 /** 182 * Compute a "nice" range from the minimum, maximum, and number of intervals. 183 * 184 * @param min minimum value 185 * @param max maximum value 186 * @param num number of intervals 187 * @return "nice" range 188 * 189 **/ 190 public static Range2D computeRange(double min,double max,int num) { 191 int interval = Math.abs(num); 192 double temp, pow, delta; 193 int nt; 194 boolean reversed = false; 92 public abstract class Graph 93 implements PropertyChangeListener 94 { 95 private String ident_; 96 /** 97 * @directed 98 * @label layer 99 */ 100 protected Layer layer_; 101 102 /** 103 * Default constructor. 104 */ 105 public Graph() 106 { 107 this( "" ); 108 } 109 110 /** 111 * Constructor for <code>Graph</code> class. 112 * 113 * @param id identifier 114 */ 115 public Graph( String id ) 116 { 117 ident_ = id; 118 } 119 120 /** 121 * Copy the <code>Graph</code> object and all attached classes. 122 */ 123 public abstract Graph copy(); 124 125 /** 126 * Get the <code>Graph</code> identifier 127 * 128 * @return ident 129 */ 130 public String getId() 131 { 132 return ident_; 133 } 134 195 135 // 196 // check inputs to make sure that they are valid 136 abstract void draw( Graphics g ); 137 197 138 // 198 if(min == max) { 199 if(min == 0.0) { 200 min = -1.0; 201 max = 1.0; 202 } else { 203 min = 0.9*max; 204 max = 1.1*max; 205 } 206 } 207 if(min > max) { 208 temp = min; 209 min = max; 210 max = temp; 211 reversed = true; 212 } 213 if(interval == 0) interval = 1; 139 void setLayer( Layer l ) 140 { 141 layer_ = l; 142 } 143 144 /** 145 * Get the associated <code>Layer</code>. 146 * 147 * @return <code>Layer</code> object 148 */ 149 public Layer getLayer() 150 { 151 return layer_; 152 } 153 154 /** 155 * Return parent pane. 156 * 157 * @since 2.0 158 */ 159 public AbstractPane getPane() 160 { 161 return layer_.getPane(); 162 } 163 164 /** 165 * Used internally by sgt. 166 * 167 * @since 2.0 168 */ 169 public void modified( String mess ) 170 { 171 if( layer_ != null ) 172 layer_.modified( mess ); 173 } 174 175 /** 176 * Compute a "nice" range from a range and number of intervals. 177 * 178 * @param range min and max values 179 * @param num number of intervals 180 * @return "nice" range 181 */ 182 public static Range2D computeRange( Range2D range, int num ) 183 { 184 return computeRange( range.start, range.end, num ); 185 } 186 187 /** 188 * Compute a "nice" range from a range and number of intervals. 189 * 190 * @param range min and max values 191 * @param num number of intervals 192 * @return "nice" range 193 * @since 2.0 194 */ 195 public static SoTRange computeRange( SoTRange range, int num ) 196 { 197 if( !range.isTime() ) 198 { 199 SoTRange.Double drange = (SoTRange.Double) range; 200 return new SoTRange.Double( computeRange( drange.start, 201 drange.end, num ) ); 202 } 203 return null; 204 } 205 206 /** 207 * VMIPSL 208 * Compute a time range when the start and the end are similar 209 * 210 * @param timeRange 211 * @param num 212 * @return 213 */ 214 public static SoTRange computeTimeRange( final SoTRange timeRange, final int num ) 215 { 216 if( timeRange.isTime() ) 217 { 218 final SoTValue soTValueStart = timeRange.getStart(); 219 final SoTValue soTValueEnd = timeRange.getEnd(); 220 ( (SoTValue.Time) soTValueStart ).setValue( timeRange.getStart().getLongTime() - num ); 221 ( (SoTValue.Time) soTValueEnd ).setValue( timeRange.getEnd().getLongTime() + num ); 222 return new SoTRange.Time( soTValueStart.getLongTime(), soTValueEnd.getLongTime() ); 223 } 224 return null; 225 } 226 227 /** 228 * Compute a "nice" range from the minimum, maximum, and number of intervals. 229 * 230 * @param min minimum value 231 * @param max maximum value 232 * @param num number of intervals 233 * @return "nice" range 234 */ 235 public static Range2D computeRange( double min, double max, int num ) 236 { 237 int interval = Math.abs( num ); 238 double temp, pow, delta; 239 int nt; 240 boolean reversed = false; 241 // 242 // check inputs to make sure that they are valid 243 // 244 if( min == max ) 245 { 246 if( min == 0.0 ) 247 { 248 min = -1.0; 249 max = 1.0; 250 } 251 else 252 { 253 min = 0.9 * max; 254 max = 1.1 * max; 255 } 256 } 257 if( min > max ) 258 { 259 temp = min; 260 min = max; 261 max = temp; 262 reversed = true; 263 } 264 if( interval == 0 ) interval = 1; 265 // 266 // find the approximate size of the interval 267 // 268 temp = ( max - min ) / (double) interval; 269 if( temp == 0.0 ) temp = max; 270 if( temp == 0.0 ) 271 { 272 min = -1.0; 273 max = 1.0; 274 temp = 2.0 / (double) interval; 275 } 276 // 277 // scale the interval size by powers of ten to a value between 278 // one and ten 279 // 280 nt = (int) log10( temp ); 281 if( temp < 1.0 ) nt--; 282 pow = Math.pow( 10.0, (double) nt ); 283 temp = temp / pow; 284 // 285 // find the closest permissible value for the interval size 286 // 287 if( temp < 1.414213562 ) 288 { 289 delta = pow; 290 } 291 else if( temp < 3.162277660 ) 292 { 293 delta = 2.0 * pow; 294 } 295 else if( temp < 7.071067812 ) 296 { 297 delta = 5.0 * pow; 298 } 299 else 300 { 301 delta = 10.0 * pow; 302 } 303 // 304 // calculate the minimum value of the range 305 // 306 temp = min / delta; 307 nt = (int) temp; 308 if( temp < 0.0 ) nt--; 309 min = delta * nt; 310 // 311 // calculate the maximum value of the range 312 // 313 temp = max / delta; 314 nt = (int) temp; 315 if( temp > 0.0 ) nt++; 316 max = delta * nt; 317 // 318 if( reversed ) 319 { 320 temp = min; 321 min = max; 322 max = temp; 323 delta = -delta; 324 } 325 return new Range2D( min, max, delta ); 326 } 327 328 static final double log10( double x ) 329 { 330 return 0.4342944819 * Math.log( x ); 331 } 332 214 333 // 215 // find the approximate size of the interval 216 // 217 temp = (max - min)/(double)interval; 218 if(temp == 0.0) temp = max; 219 if(temp == 0.0) { 220 min = -1.0; 221 max = 1.0; 222 temp = 2.0/(double)interval; 223 } 224 // 225 // scale the interval size by powers of ten to a value between 226 // one and ten 227 // 228 nt = (int)log10(temp); 229 if(temp < 1.0) nt--; 230 pow = Math.pow(10.0, (double)nt); 231 temp = temp/pow; 232 // 233 // find the closest permissible value for the interval size 234 // 235 if(temp < 1.414213562) { 236 delta = pow; 237 } else if(temp < 3.162277660) { 238 delta = 2.0 * pow; 239 } else if(temp < 7.071067812) { 240 delta = 5.0 * pow; 241 } else { 242 delta = 10.0 * pow; 243 } 244 // 245 // calculate the minimum value of the range 246 // 247 temp = min / delta; 248 nt = (int) temp; 249 if(temp < 0.0) nt--; 250 min = delta*nt; 251 // 252 // calculate the maximum value of the range 253 // 254 temp = max /delta; 255 nt = (int) temp; 256 if(temp > 0.0) nt++; 257 max = delta*nt; 258 // 259 if(reversed) { 260 temp = min; 261 min = max; 262 max = temp; 263 delta = -delta; 264 } 265 return new Range2D(min, max, delta); 266 } 267 static final double log10(double x) { 268 return 0.4342944819*Math.log(x); 269 } 270 // 271 abstract Object getObjectAt(Point pt); 272 /** 273 * Get a <code>String</code> representation of the 274 * <code>Graph</code>. 275 * 276 * @return <code>String</code> representation 277 */ 278 public String toString() { 279 String name = getClass().getName(); 280 return name.substring(name.lastIndexOf(".")+1) + ": " + ident_; 281 } 282 /** 283 * Find data at a <code>Point</code> 284 * @since 3.0 285 */ 286 public abstract SGTData getDataAt(Point pt); 334 abstract Object getObjectAt( Point pt ); 335 336 /** 337 * Get a <code>String</code> representation of the 338 * <code>Graph</code>. 339 * 340 * @return <code>String</code> representation 341 */ 342 public String toString() 343 { 344 String name = getClass().getName(); 345 return name.substring( name.lastIndexOf( "." ) + 1 ) + ": " + ident_; 346 } 347 348 /** 349 * Find data at a <code>Point</code> 350 * 351 * @since 3.0 352 */ 353 public abstract SGTData getDataAt( Point pt ); 287 354 } 288 355 -
ether_megapoli/trunk/web/project/home_dataProtocol_fr.jsp
r366 r371 24 24 <tiles:put name="body" type="string"> 25 25 Conformément à la politique de distribution des données Ether, les données et produits sont libres d'accÚs pour un usage scientifique. 26 Nous encourageons vivement la communauté scientifique internationale à utiliser les observations de la base de données MEGAPOLI qui participent à la recherche atmosphérique et climatologique.26 Nous encourageons vivement la communauté scientifique internationale à utiliser les observations de la base de données MEGAPOLI pour leurs recherches. 27 27 <BR/><BR/> 28 28
Note: See TracChangeset
for help on using the changeset viewer.