private boolean emptyColourMap(ColorMap map) { if (map == null) return true; ColorMapEntry[] entries = map.getColorMapEntries(); if (entries == null) return true; return map.getColorMapEntries().length == 0; }
public void visit(ColorMap colorMap) { ColorMap copy = sf.createColorMap(); copy.setType(colorMap.getType()); copy.setExtendedColors(colorMap.getExtendedColors()); ColorMapEntry[] entries = colorMap.getColorMapEntries(); if (entries != null) { for (int i = 0; i < entries.length; i++) { ColorMapEntry entry = entries[i]; copy.addColorMapEntry(copy(entry)); } } if (STRICT && !copy.equals(colorMap)) { throw new IllegalStateException( "Was unable to duplicate provided ColorMap:" + colorMap); } pages.push(copy); }
protected ColorMap copy(ColorMap colorMap) { if (colorMap == null) return null; colorMap.accept(this); return (ColorMap) pages.pop(); }
public ColorMapBuilder reset(ColorMap original) { if (original == null) { return reset(); } type = original.getType(); extended = original.getExtendedColors(); entries = new ArrayList<ColorMapEntry>(Arrays.asList(original.getColorMapEntries())); unset = false; return this; }
public ColorMap build() { // force the dump of the last entry builder entry(); if (unset) { return null; } ColorMap colorMap = sf.createColorMap(); colorMap.setType(type); colorMap.setExtendedColors(extended); for (ColorMapEntry entry : entries) { colorMap.addColorMapEntry(entry); } if (parent == null) { reset(); } return colorMap; }
ColorMapEntry startEntry = entries[0].getColorMapEntry(start); fillColorInEntry(startEntry, beforeColor); colorMap.addColorMapEntry(startEntry); colorMap.setType(ColorMap.TYPE_INTERVALS); for (int i = 1; i < numEntries - 1; i += 2) { colorMap.addColorMapEntry(entries[i].getColorMapEntry(min, range)); colorMap.setType(ColorMap.TYPE_RAMP); for (int i = 0; i < numEntries - 1; i++) { colorMap.addColorMapEntry(entries[i].getColorMapEntry(min, range)); colorMap.addColorMapEntry(entries[numEntries - 1].getColorMapEntry(max)); colorMap.addColorMapEntry(endEntry);
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { ColorMap colorMap = styleFactory.createColorMap(); List entries = (List) node.getChildValues("ColorMapEntry"); for (Iterator itr = entries.iterator(); itr.hasNext(); ) { colorMap.addColorMapEntry((ColorMapEntry) itr.next()); } return colorMap; } }
public void setEdited(ColorMap map) { this.colorMap = map; if (map != null) { guiType.setValue(map.getType()); guiEntrys.setEdited(map.getColorMapEntries()); } }
&& colorMap.getColorMapEntries() != null && colorMap.getColorMapEntries().length > 0) { colorMap.accept(this);
@Override public void handle(YamlObject<?> obj, YamlParseContext context) { colorMap(colorMap); YamlMap map = obj.map(); if (map.has("type")) { String value = map.str("type"); if ("ramp".equals(value)) { colorMap.setType(ColorMap.TYPE_RAMP); } else if ("intervals".equals(value)) { colorMap.setType(ColorMap.TYPE_INTERVALS); } else if ("values".equals(value)) { colorMap.setType(ColorMap.TYPE_VALUES); } else { LOG.warning("Unknown color map type: " + value); } } context.push("entries", new EntriesParser()); }
@Override public void visit(ColorMap colorMap) { for (ColorMapEntry cme : colorMap.getColorMapEntries()) { cme.accept(this); } if (colorMap.getFunction() != null) { //colorMap.getFunction().accept(visitor, extraData) } }
ColorMap resampledColorMap = null; int numClasses = originalColorMap.getColorMapEntries().length; labels, quantities, realColorRamp.toArray(new Color[1]), colorMapType); FilterFactory2 filterFactory = CommonFactoryFinder.getFilterFactory2(null); resampledColorMap.getColorMapEntry(0).setOpacity(filterFactory.literal(0)); } else { return defaultStyle.getStyle();
@Override protected void encode(ColorMap colorMap) { push("color-map"); switch (colorMap.getType()) { case ColorMap.TYPE_INTERVALS: put("type", "intervals"); break; case ColorMap.TYPE_RAMP: put("type", "ramp"); break; case ColorMap.TYPE_VALUES: put("type", "values"); break; } put("entries", new ColorMapEntryIterator(colorMap)); } }
}, ColorMap.TYPE_RAMP); cm.setExtendedColors(true); rs.setColorMap(cm);
public void visit(ColorMap colorMap) { // The type of the ColorMap is stored in an attribute "type" and may store // string-values: "ramp", "intervals" or "values". AttributesImpl atts = new AttributesImpl(); String typeString; if (colorMap.getType() == ColorMap.TYPE_INTERVALS) typeString = "intervals"; else if (colorMap.getType() == ColorMap.TYPE_VALUES) typeString = "values"; else typeString = "ramp"; // Also the default in the parser if (!"ramp".equals(typeString)) { atts.addAttribute("", "type", "type", "", typeString); } final boolean extended = colorMap.getExtendedColors(); if (extended) { atts.addAttribute("", "extended", "extended", "", "" + extended); } start("ColorMap", atts); ColorMapEntry[] mapEntries = colorMap.getColorMapEntries(); for (int i = 0; i < mapEntries.length; i++) { mapEntries[i].accept(this); } end("ColorMap"); }
/** * Creates a color map based on fixed quantities and colors. * * @param quantities The values that begin a category, or break points in a ramp, or isolated * values, according to the type of color map specified by Type * @param colors The colors that will be associated to the categories, break points, or isolated * values * @param type Either @link ColorMap#TYPE_RAMP, @link ColorMap#TYPE_INTERVALS or @link * ColorMap#TYPE_VALUES */ public ColorMap createColorMap(String[] labels, double[] quantities, Color[] colors, int type) { ColorMap colorMap = sf.createColorMap(); colorMap.setType(type); if ((labels == null) || (quantities == null) || (colors == null) || (labels.length != quantities.length) || (quantities.length != colors.length)) { throw new IllegalArgumentException( "Labels, quantities and colors arrays should be not null and have the same size"); } for (int i = 0; i < colors.length; i++) { colorMap.addColorMapEntry(createColorMapEntry(labels[i], quantities[i], colors[i])); } return colorMap; }
symbol.setType(ColorMap.TYPE_RAMP); } else if ("intervals".equalsIgnoreCase(type)) { symbol.setType(ColorMap.TYPE_INTERVALS); } else if ("values".equalsIgnoreCase(type)) { symbol.setType(ColorMap.TYPE_VALUES); } else if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine(Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$2, "ColorMapType", type)); symbol.setExtendedColors(true); } else if ("false".equalsIgnoreCase(type)) { symbol.setExtendedColors(false); } else if (LOGGER.isLoggable(Level.FINE)) LOGGER.fine(Errors.format(ErrorKeys.ILLEGAL_ARGUMENT_$2, "Extended", type)); symbol.addColorMapEntry(parseColorMapEntry(child));
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { ColorMap map = styleFactory.createColorMap(); for (ColorMapEntry e : (List<ColorMapEntry>) node.getChildValues(ColorMapEntry.class)) { map.addColorMapEntry(e); } return map; } }
if (colorMap != null && colorMap.getColorMapEntries() != null && colorMap.getColorMapEntries().length > 0) { colorMap.accept(this);
public void apply() { if (colorMap != null) { colorMap.setType((Integer)guiType.getValue()); } }