public static String[] getRegionNames(IPlottingSystem<?> system, RegionType type) { final Collection<IRegion> regions = system.getRegions(); if (regions == null || regions.size() < 1) return null; final List<String> names = new ArrayList<String>(7); for (IRegion region : regions) { if (type != null && region.getRegionType() != type) continue; names.add(region.getName()); } return names.toArray(new String[names.size()]); }
/** * @param plotter * @return */ public static Color getUniqueColor( IRegion.RegionType type, IRegionSystem plotter, Collection<Color> colours) { final Collection<Color> used = new HashSet<Color>(7); for (IRegion reg : plotter.getRegions()) { if (reg.getRegionType() != type) continue; used.add(reg.getRegionColor()); } for (Color color : colours) { if (!used.contains(color)) return color; } return colours.iterator().next(); }