public ColorMapParser(Factory factory) { super(factory); colorMap = factory.style.createColorMap(); }
ColorMap map = styleFactory.createColorMap();
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { ColorMap map = styleFactory.createColorMap(); List<Node> children = node.getChildren(); int i = 0; while(!"Value".equals(children.get(i).getComponent().getName())) i++; ColorMapEntry entry = styleFactory.createColorMapEntry(); entry.setColor((Expression)children.get(i++).getValue()); map.addColorMapEntry(entry); while(i < children.size()) { entry = styleFactory.createColorMapEntry(); entry.setQuantity((Expression)children.get(i).getValue()); if (i+1 >= children.size()) { throw new IllegalArgumentException("Incorrectly specified color map Threshold/Value pair"); } entry.setColor((Expression)children.get(i+1).getValue()); map.addColorMapEntry(entry); i+=2; } return map; }
/** * * <!-- 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; } }
nodataEntry.setLabel("No Data"); //$NON-NLS-1$ ColorMap colorMap = sf.createColorMap(); colorMap.setType(ColorMap.TYPE_RAMP);
/** * * <!-- 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; } }
ColorMap symbol = factory.createColorMap();
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); }
/** * 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; }
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; }
public ColorMapParser(Factory factory) { super(factory); colorMap = factory.style.createColorMap(); }
/** * <!-- 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; } }
private ColorMap parseColorMap(Node root) { ColorMap symbol = factory.createColorMap(); NodeList children = root.getChildNodes(); for (int i = 0; i < children.getLength(); i++) { Node child = children.item(i); if ((child == null) || (child.getNodeType() != Node.ELEMENT_NODE)) { continue; } String childName = child.getLocalName(); if (childName == null) { childName = child.getNodeName(); } if (childName.equalsIgnoreCase("ColorMapEntry")) { symbol.addColorMapEntry(parseColorMapEntry(child)); } } return symbol; }
/** * <!-- 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; } }
/** * <!-- 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; }
/** * 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; }
/** * 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; }
ColorMap symbol = factory.createColorMap();
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); }