/** Internal parse method - made protected for unit testing */ protected ColorMapEntry parseColorMapEntry(Node root) { ColorMapEntry symbol = factory.createColorMapEntry(); NamedNodeMap atts = root.getAttributes(); if (atts.getNamedItem(colorMapLabelString) != null) { symbol.setLabel(atts.getNamedItem(colorMapLabelString).getNodeValue()); } if (atts.getNamedItem(colorMapColorString) != null) { symbol.setColor(ff.literal(atts.getNamedItem(colorMapColorString).getNodeValue())); } if (atts.getNamedItem(colorMapOpacityString) != null) { symbol.setOpacity(ff.literal(atts.getNamedItem(colorMapOpacityString).getNodeValue())); } if (atts.getNamedItem(colorMapQuantityString) != null) { symbol.setQuantity( ff.literal(atts.getNamedItem(colorMapQuantityString).getNodeValue())); } return symbol; }
while (!"Value".equals(children.get(i).getComponent().getName())) i++; ColorMapEntry entry = styleFactory.createColorMapEntry(); entry.setColor((Expression) children.get(i++).getValue()); map.addColorMapEntry(entry); entry = styleFactory.createColorMapEntry(); entry.setQuantity((Expression) children.get(i).getValue()); if (i + 1 >= children.size()) {
public void visit(ColorMapEntry colorMapEntry) { ColorMapEntry copy = sf.createColorMapEntry(); copy.setColor(copy(colorMapEntry.getColor())); copy.setLabel(colorMapEntry.getLabel()); copy.setOpacity(copy(colorMapEntry.getOpacity())); copy.setQuantity(copy(colorMapEntry.getQuantity())); if (STRICT && !copy.equals(colorMapEntry)) { throw new IllegalStateException( "Was unable to duplicate provided ColorMapEntry:" + colorMapEntry); } pages.push(copy); }
public void visit(ColorMapEntry colorMapEntry) { ColorMapEntry copy = sf.createColorMapEntry(); copy.setColor(copyCqlExpression(colorMapEntry.getColor())); copy.setLabel(colorMapEntry.getLabel()); copy.setOpacity(copyCqlExpression(colorMapEntry.getOpacity())); copy.setQuantity(copyCqlExpression(colorMapEntry.getQuantity())); if (STRICT && !copy.equals(colorMapEntry)) { throw new IllegalStateException( "Was unable to duplicate provided ColorMapEntry:" + colorMapEntry); } pages.push(copy); } }
@Override public ColorMapEntry build() { if (unset) { return null; } ColorMapEntry entry = sf.createColorMapEntry(); entry.setLabel(label); entry.setColor(color); entry.setOpacity(opacity); entry.setQuantity(quantity); if (parent == null) { reset(); } return entry; }
/** * Creates a simple color entity based on a fixed value and a color.<br> * The color alpha will be used as the entry's opacity * * @param quantity The entry's quantity * @param color The entry's color. */ private ColorMapEntry createColorMapEntry(String label, double quantity, Color color) { ColorMapEntry entry = sf.createColorMapEntry(); entry.setQuantity(literalExpression(quantity)); entry.setColor(colorExpression(color)); entry.setOpacity(literalExpression(color.getAlpha() / 255.0)); entry.setLabel(label); return entry; }
/** * * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { ColorMapEntry entry = styleFactory.createColorMapEntry(); // <xsd:element ref="se:Data"/> entry.setQuantity(filterFactory.literal(node.getChildValue("Data"))); // <xsd:element ref="se:Value"/> entry.setColor((Expression) node.getChildValue("Value")); return entry; } }
ColorMapEntry entry = styleFactory.createColorMapEntry();
ColorMapEntry e = factory.style.createColorMapEntry(); if (q.at(0) != null) { e.setColor(Util.color(Util.stripQuotes(q.strAt(0)), factory));
private ColorMapEntry parseColorMapEntry(Node root) { ColorMapEntry symbol = factory.createColorMapEntry(); //Expression exp = null; NamedNodeMap atts = root.getAttributes(); if( atts.getNamedItem("label") != null ) { symbol.setLabel(atts.getNamedItem("label").getNodeValue()); } if( atts.getNamedItem("color") != null ) { symbol.setColor(ff.literal(atts.getNamedItem("color").getNodeValue())); } if( atts.getNamedItem("opacity") != null ) { symbol.setOpacity(ff.literal(atts.getNamedItem("opacity").getNodeValue())); } if( atts.getNamedItem("quantity") != null ) { symbol.setQuantity(ff.literal(atts.getNamedItem("quantity").getNodeValue())); } return symbol; }
/** Internal parse method - made protected for unit testing */ protected ColorMapEntry parseColorMapEntry(Node root) { ColorMapEntry symbol = factory.createColorMapEntry(); NamedNodeMap atts = root.getAttributes(); if (atts.getNamedItem(colorMapLabelString) != null) { symbol.setLabel(atts.getNamedItem(colorMapLabelString).getNodeValue()); } if (atts.getNamedItem(colorMapColorString) != null) { symbol.setColor(ff.literal(atts.getNamedItem(colorMapColorString).getNodeValue())); } if (atts.getNamedItem(colorMapOpacityString) != null) { symbol.setOpacity(ff.literal(atts.getNamedItem(colorMapOpacityString).getNodeValue())); } if (atts.getNamedItem(colorMapQuantityString) != null) { symbol .setQuantity(ff.literal(atts.getNamedItem(colorMapQuantityString) .getNodeValue())); } return symbol; }
ColorMapEntry e1 = styleFactory.createColorMapEntry(); e1.setColor(filterFactory.literal("#000011")); e1.setQuantity(filterFactory.literal(0.0d)); ColorMapEntry e2 = styleFactory.createColorMapEntry(); e2.setColor(filterFactory.literal("#0000EE")); e2.setQuantity(
ColorMapEntry e1 = styleFactory.createColorMapEntry(); e1.setColor(filterFactory.literal("#000011")); e1.setQuantity(filterFactory.literal(0.0d)); ColorMapEntry e2 = styleFactory.createColorMapEntry(); e2.setColor(filterFactory.literal("#0000EE")); e2.setQuantity(filterFactory.literal(1.0d));
/** * <!-- 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; }
private ColorMapEntry createColorMapEntry(StyleBuilder sb, double quantity, Color color) { ColorMapEntry entry = sf.createColorMapEntry(); entry.setQuantity(sb.literalExpression(quantity)); entry.setColor(sb.colorExpression(color)); entry.setOpacity(sb.literalExpression(color.getAlpha() / 255.0)); return entry; }
public void visit(ColorMapEntry colorMapEntry) { ColorMapEntry copy = sf.createColorMapEntry(); copy.setColor(copy(colorMapEntry.getColor())); copy.setLabel(colorMapEntry.getLabel()); copy.setOpacity(copy(colorMapEntry.getOpacity())); copy.setQuantity(colorMapEntry.getQuantity()); if (STRICT && !copy.equals(colorMapEntry)) { throw new IllegalStateException("Was unable to duplicate provided ColorMapEntry:" + colorMapEntry); } pages.push(copy); }
public void testColorMapEntryDuplication() throws Exception { ColorMapEntry cme = sf.createColorMapEntry(); cme.setColor(sb.colorExpression(Color.YELLOW)); cme.setLabel("thelabel"); cme.setQuantity(sb.literalExpression(66.66)); cme.setOpacity(sb.literalExpression(0.77)); cme.accept(visitor); ColorMapEntry cme2 = (ColorMapEntry) visitor.getCopy(); assertEquals( "Colormaps LABEL must be equal after duplication ", cme.getLabel(), cme2.getLabel()); assertEquals( "Colormaps QUANTITY must be equal after duplication ", cme.getQuantity(), cme2.getQuantity()); assertEquals( "Colormaps COLOR must be equal after duplication ", cme.getColor(), cme2.getColor()); assertEquals( "Colormaps OPACITY must be equal after duplication ", cme.getOpacity(), cme2.getOpacity()); }
/** * <!-- begin-user-doc --> <!-- end-user-doc --> * * @generated modifiable */ public Object parse(ElementInstance instance, Node node, Object value) throws Exception { ColorMapEntry entry = styleFactory.createColorMapEntry(); //<xsd:element ref="se:Data"/> entry.setQuantity(filterFactory.literal(node.getChildValue("Data"))); //<xsd:element ref="se:Value"/> entry.setColor((Expression) node.getChildValue("Value")); return entry; }
/** * Creates a simple color entity based on a fixed value and a color.<br> * The color alpha will be used as the entry's opacity * @param quantity The entry's quantity * @param color The entry's color. */ private ColorMapEntry createColorMapEntry(String label, double quantity, Color color) { ColorMapEntry entry = sf.createColorMapEntry(); entry.setQuantity(literalExpression(quantity)); entry.setColor(colorExpression(color)); entry.setOpacity(literalExpression(color.getAlpha() / 255.0)); entry.setLabel(label); return entry; } public class EqualClasses {
/** * Creates a simple color entity based on a fixed value and a color.<br> * The color alpha will be used as the entry's opacity * @param quantity The entry's quantity * @param color The entry's color. */ private ColorMapEntry createColorMapEntry(String label, double quantity, Color color) { ColorMapEntry entry = sf.createColorMapEntry(); entry.setQuantity(literalExpression(quantity)); entry.setColor(colorExpression(color)); entry.setOpacity(literalExpression(color.getAlpha() / 255.0)); entry.setLabel(label); return entry; } public class EqualClasses {