Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
128 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
77 changes: 77 additions & 0 deletions
77
topcat/src/main/uk/ac/starlink/topcat/plot2/TimeAxisControl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
package uk.ac.starlink.topcat.plot2; | ||
|
||
import java.util.ArrayList; | ||
import java.util.List; | ||
import uk.ac.starlink.ttools.plot2.SurfaceFactory; | ||
import uk.ac.starlink.ttools.plot2.config.ConfigKey; | ||
import uk.ac.starlink.ttools.plot2.config.StyleKeys; | ||
import uk.ac.starlink.ttools.plot2.geom.TimeAspect; | ||
import uk.ac.starlink.ttools.plot2.geom.TimeSurfaceFactory; | ||
|
||
/** | ||
* Axis control for plot with a horizontal time axis. | ||
* | ||
* @author Mark Taylor | ||
* @since 24 Jul 2013 | ||
*/ | ||
public class TimeAxisControl | ||
extends CartesianAxisControl<TimeSurfaceFactory.Profile,TimeAspect> { | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param stack control stack | ||
*/ | ||
public TimeAxisControl( ControlStack stack ) { | ||
super( new TimeSurfaceFactory(), createAxisLabelKeys(), stack ); | ||
SurfaceFactory surfFact = getSurfaceFactory(); | ||
|
||
/* Log/flip tab. */ | ||
addSpecifierTab( "Coords", new ConfigSpecifier( new ConfigKey[] { | ||
TimeSurfaceFactory.YLOG_KEY, | ||
TimeSurfaceFactory.YFLIP_KEY, | ||
} ) ); | ||
|
||
/* Range tab. */ | ||
addAspectConfigTab( "Range", | ||
new ConfigSpecifier( surfFact.getAspectKeys() ) ); | ||
|
||
/* Grid tab. */ | ||
addSpecifierTab( "Grid", new ConfigSpecifier( new ConfigKey[] { | ||
TimeSurfaceFactory.TFORMAT_KEY, | ||
TimeSurfaceFactory.GRID_KEY, | ||
StyleKeys.MINOR_TICKS, | ||
TimeSurfaceFactory.TCROWD_KEY, | ||
TimeSurfaceFactory.YCROWD_KEY, | ||
} ) ); | ||
|
||
/* Labels tab. */ | ||
addLabelsTab(); | ||
|
||
/* Font tab. */ | ||
addSpecifierTab( "Font", | ||
new ConfigSpecifier( StyleKeys.getCaptionerKeys() ) ); | ||
|
||
assert assertHasKeys( surfFact.getProfileKeys() ); | ||
} | ||
|
||
@Override | ||
protected boolean logChanged( TimeSurfaceFactory.Profile prof1, | ||
TimeSurfaceFactory.Profile prof2 ) { | ||
return prof1.getYLog() != prof2.getYLog(); | ||
} | ||
|
||
/** | ||
* Returns the config keys for axis labelling. | ||
* | ||
* @return T, Y axis label config keys | ||
*/ | ||
private static ConfigKey<String>[] createAxisLabelKeys() { | ||
List<ConfigKey<String>> list = new ArrayList<ConfigKey<String>>(); | ||
list.add( TimeSurfaceFactory.TLABEL_KEY ); | ||
list.add( TimeSurfaceFactory.YLABEL_KEY ); | ||
@SuppressWarnings("unchecked") | ||
ConfigKey<String>[] keys = list.toArray( new ConfigKey[ 0 ] ); | ||
return keys; | ||
} | ||
} |
45 changes: 45 additions & 0 deletions
45
topcat/src/main/uk/ac/starlink/topcat/plot2/TimePlotWindow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package uk.ac.starlink.topcat.plot2; | ||
|
||
import java.awt.Component; | ||
import uk.ac.starlink.ttools.plot2.PlotType; | ||
import uk.ac.starlink.ttools.plot2.geom.TimeAspect; | ||
import uk.ac.starlink.ttools.plot2.geom.TimePlotType; | ||
import uk.ac.starlink.ttools.plot2.geom.TimeSurfaceFactory; | ||
|
||
/** | ||
* Layer plot window for plots with a horizontal time axis. | ||
* | ||
* @author Mark Taylor | ||
* @since 24 Jul 2013 | ||
*/ | ||
public class TimePlotWindow | ||
extends StackPlotWindow<TimeSurfaceFactory.Profile,TimeAspect> { | ||
private static final TimePlotType PLOT_TYPE = TimePlotType.getInstance(); | ||
private static final TimePlotTypeGui PLOT_GUI = new TimePlotTypeGui(); | ||
|
||
/** | ||
* Constructor. | ||
* | ||
* @param parent parent component | ||
*/ | ||
public TimePlotWindow( Component parent ) { | ||
super( "Time", parent, PLOT_TYPE, PLOT_GUI ); | ||
addHelp( "TimePlotWindow" ); | ||
} | ||
|
||
/** | ||
* Defines GUI features specific to time plot. | ||
*/ | ||
private static class TimePlotTypeGui | ||
implements PlotTypeGui<TimeSurfaceFactory.Profile,TimeAspect> { | ||
public AxisControl<TimeSurfaceFactory.Profile,TimeAspect> | ||
createAxisControl( ControlStack stack ) { | ||
return new TimeAxisControl( stack ); | ||
} | ||
public PositionCoordPanel createPositionCoordPanel() { | ||
return new SimplePositionCoordPanel( PLOT_TYPE | ||
.getPointDataGeoms()[ 0 ], | ||
true ); | ||
} | ||
} | ||
} |
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.