Changeset 365


Ignore:
Timestamp:
01/31/12 18:42:46 (12 years ago)
Author:
vmipsl
Message:

copyright + indication timeZone (UTC)

Location:
ether_megapoli/trunk/service/implementation
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • ether_megapoli/trunk/service/implementation/com/ether/EtherPlotContentServiceImpl.java

    r295 r365  
    3838import java.util.ArrayList; 
    3939import java.util.Arrays; 
     40import java.util.Calendar; 
    4041import java.util.Collections; 
    4142import java.util.Date; 
     
    170171        displayLegendForEmptyLines( emptyLineToDisplayOnlyInLegend, lkey, mainPane, xsize, ysize, xt, (LinearTransform) graph.getYTransform(), megapoliPlot.getAxeType() ); 
    171172 
     173        // Copyright 
     174        displayCopyright( mainPane, xsize, ysize, xsize - 0.15, 0.1 ); 
     175 
    172176        return mainPane; 
    173177    } 
     
    235239            throw new ServiceException( ServiceException.ServiceCode.LEGEND_LAYER_NOT_FOUND, new Throwable( ServiceException.ServiceCode.LEGEND_LAYER_NOT_FOUND.toString() ) ); 
    236240        } 
     241 
     242        // Copyright 
     243        displayCopyright( jPlotLayout, 1.0, 1.0, 1.15, 0.03 ); 
    237244 
    238245        return jPlotLayout; 
     
    322329 
    323330    /** 
     331     * This method display the copyright in the bottom right corner of the plot 
     332     * 
     333     * @param mainPane 
     334     * @param xSize 
     335     * @param ySize 
     336     * @param xPosition 
     337     * @param yPosition 
     338     */ 
     339    private void displayCopyright( @NotNull final JPane mainPane, final double xSize, final double ySize, final double xPosition, final double yPosition ) 
     340    { 
     341        final Layer copyrightLayer = new Layer( "Copyright", new Dimension2D( xSize, ySize ) ); 
     342        mainPane.add( copyrightLayer ); 
     343 
     344        final Calendar calendar = Calendar.getInstance(); 
     345        final int year = calendar.get( Calendar.YEAR ); 
     346        final String copyright = "@" + year + _copyright; 
     347        final SGLabel copyrightLabel = new SGLabel( "copyright", copyright, new Point2D.Double( xPosition, yPosition ) ); 
     348        copyrightLabel.setAlign( SGLabel.TOP, SGLabel.CENTER ); 
     349        copyrightLabel.setFont( _copyrightFont ); 
     350 
     351        copyrightLayer.addChild( copyrightLabel ); 
     352    } 
     353 
     354    /** 
    324355     * This method removes from a list the lines with no data 
    325356     * 
     
    380411        xbot.setLabelFont( _axisFont ); 
    381412        xbot.setLabelHeightP( _heightAxisFont ); 
     413        // TimeZone indication 
     414        xbot.setTitle( new SGLabel( "timeZone", " (UTC)", null ) ); 
    382415//        xbot.setMajorLabelFormat( _majorLabelFormat ); 
    383416        return xbot; 
     
    618651 
    619652    protected static final Font _axisFont = new Font( "Helvetica", Font.PLAIN, 15 ); 
     653    protected static final Font _copyrightFont = new Font( "Helvetica", Font.PLAIN, 8 ); 
     654    protected static final String _copyright = " CNES-CNRS"; 
    620655    protected static final double _heightAxisFont = 0.14; 
    621656    protected static final double _markHeight = 0.1; 
  • ether_megapoli/trunk/service/implementation/gov/noaa/pmel/sgt/TimeAxis.java

    r192 r365  
    273273    Color saved = g.getColor(); 
    274274    SGLabel label; 
    275     if(orientation_ == Axis.HORIZONTAL) { 
    276       label = new SGLabel("major", time.toString(majorLabelFormat_), 
     275      // VMIPSL 
     276      String labelStr = time.toString( majorLabelFormat_ ); 
     277      if( title_ != null ) 
     278          labelStr += title_.getText(); 
     279      if(orientation_ == Axis.HORIZONTAL) { 
     280      label = new SGLabel("major", labelStr, 
    277281                          new Point2D.Double(val, ymajor_)); 
    278282      label.setOrientation(SGLabel.HORIZONTAL); 
    279283    } else { 
    280       label = new SGLabel("major", time.toString(majorLabelFormat_), 
     284      label = new SGLabel("major", labelStr, 
    281285                          new Point2D.Double(xmajor_, val)); 
    282286      label.setOrientation(SGLabel.VERTICAL); 
     
    776780    } 
    777781  } 
    778   public void setTitle(SGLabel title) { 
    779   // Time axes don't use title_ 
    780     title_ = null; 
    781   } 
     782 
     783    public void setTitle( final SGLabel title ) 
     784    { 
     785        // Time axes don't use title_ 
     786//        title_ = null; 
     787        // VMIPSL 
     788        if( title_ == null || !title_.equals( title ) ) 
     789        { 
     790            title_ = title; 
     791            title_.setMoveable( false ); 
     792            modified( "Axis: setTitle()" ); 
     793        } 
     794    } 
    782795} 
    783796 
Note: See TracChangeset for help on using the changeset viewer.