public PositionCoordPanel createPositionCoordPanel( PlotType plotType, PlotTypeGui plotTypeGui) { Coord[] coords = { plotType.getPointDataGeoms()[0].getPosCoords()[0], FloatingCoord.WEIGHT_COORD, }; return new SimplePositionCoordPanel(coords, null); }
/** * Constructor. * * @param stack control stack which this object will manage * @param plotType defines basic plot characteristics * @param plotTypeGui defines GUI-specific plot characteristics * @param baseConfigger configuration source for some global config options * @param tcListener listener for TopcatEvents; this manager will arrange for it to listen to * whatever is the currently selected TopcatModel */ public GangControlManager( ControlStack stack, PlotType plotType, PlotTypeGui plotTypeGui, Configger baseConfigger, TopcatListener tcListener) { stack_ = stack; plotType_ = plotType; plotTypeGui_ = plotTypeGui; baseConfigger_ = baseConfigger; tcListener_ = tcListener; nextSupplier_ = new NextSupplier(); nextSupplier_.putValues(StyleKeys.COLOR, ColorConfigKey.getPlottingColors()); List<Action> stackActList = new ArrayList<Action>(); /* Split the list up by the number of positional coordinates * they have. */ plotterMap_ = new LinkedHashMap<CoordsType, List<Plotter>>(); for (CoordsType ctyp : CoordsType.values()) { plotterMap_.put(ctyp, new ArrayList<Plotter>()); } Plotter[] plotters = plotType_.getPlotters(); for (int i = 0; i < plotters.length; i++) { Plotter plotter = plotters[i]; CoordsType ctyp = CoordsType.getInstance(plotter); plotterMap_.get(ctyp).add(plotter); } /* Add gang controls grouping suitably categorised plotters. */ for (CoordsType ctyp : CoordsType.values()) { if (ctyp.getIcon() != null && !plotterMap_.get(ctyp).isEmpty()) { String actName = "Add " + ctyp.getTypeTitle() + " Control"; String actDescrip = "Add a new " + ctyp.getTypeDescription() + " plot control to the stack"; final CoordsType ctyp0 = ctyp; stackActList.add( new LayerControlAction(actName, ctyp.getIcon(), actDescrip, stack_) { public LayerControl createLayerControl() { return createGangControl(ctyp0, true); } }); } } /* Add single controls for miscellaneous plotters. */ assert CoordsType.MISC.getIcon() == null; for (Plotter plotter : plotterMap_.get(CoordsType.MISC)) { Action stackAct = LayerControlAction.createPlotterAction( plotter, stack, nextSupplier_, tcListener_, baseConfigger_); if (stackAct != null) { stackActList.add(stackAct); } else { logger_.warning("No GUI available for plotter " + plotter.getPlotterName()); } } stackActs_ = stackActList.toArray(new Action[0]); }