/** * Returns whether or not this product node equals another object. */ @Override public boolean equals(Object object) { if (!super.equals(object)) { return false; } final BitmaskDef def = (BitmaskDef) object; return ObjectUtils.equalObjects(getExpr(), def.getExpr()) && ObjectUtils.equalObjects(getColor(), def.getColor()) && getTransparency() == def.getTransparency(); }
public Mask createMask(int width, int height) { return Mask.BandMathsType.create(getName(), getDescription(), width, height, getExpr(), getColor(), getTransparency()); } }
/** * Creates and returns a copy of this object. * * @return a copy of this object */ public BitmaskDef createCopy() { return new BitmaskDef(getName(), getDescription(), getExpr(), getColor(), getTransparency()); }
private void addBitmaskDefinitions() { //Übernommen final String[] defNames = _product.getBitmaskDefNames(); for (String defName : defNames) { final BitmaskDef bitmaskDef = _product.getBitmaskDef(defName); final Element bitmaskDefElem = new Element(DimapProductConstants.TAG_BITMASK_DEFINITION); bitmaskDefElem.setAttribute(DimapProductConstants.ATTRIB_NAME, bitmaskDef.getName()); Element descElem = new Element(DimapProductConstants.TAG_BITMASK_DESCRIPTION); bitmaskDefElem.addContent(descElem); if (bitmaskDef.getDescription() != null) { descElem.setAttribute(DimapProductConstants.ATTRIB_VALUE, bitmaskDef.getDescription()); } else { descElem.setAttribute(DimapProductConstants.ATTRIB_VALUE, ""); } final Element exprElem = new Element(DimapProductConstants.TAG_BITMASK_EXPRESSION); exprElem.setAttribute(DimapProductConstants.ATTRIB_VALUE, bitmaskDef.getExpr()); bitmaskDefElem.addContent(exprElem); bitmaskDefElem.addContent(createColorElement(bitmaskDef.getColor())); final Element transparency = new Element(DimapProductConstants.TAG_BITMASK_TRANSPARENCY); transparency.setAttribute(DimapProductConstants.ATTRIB_VALUE, String.valueOf(bitmaskDef.getTransparency())); bitmaskDefElem.addContent(transparency); _root.addContent(bitmaskDefElem); } }
public void writeXML(XmlWriter writer, int indent) { Guardian.assertNotNull("writer", writer); Guardian.assertGreaterThan("indent", indent, -1); String[][] attributes = new String[1][]; attributes[0] = new String[]{DimapProductConstants.ATTRIB_NAME, getName()}; String[] bdTags = XmlWriter.createTags(indent, DimapProductConstants.TAG_BITMASK_DEFINITION, attributes); writer.println(bdTags[0]); String description = getDescription(); if (description == null) { description = ""; } attributes[0] = new String[]{DimapProductConstants.ATTRIB_VALUE, description}; writer.printLine(indent + 1, DimapProductConstants.TAG_BITMASK_DESCRIPTION, attributes, null); String expr = getExpr(); if (expr == null) { expr = ""; } attributes[0] = new String[]{DimapProductConstants.ATTRIB_VALUE, expr}; writer.printLine(indent + 1, DimapProductConstants.TAG_BITMASK_EXPRESSION, attributes, null); DimapProductHelpers.printColorTag(indent + 1, getColor(), writer); attributes[0] = new String[]{DimapProductConstants.ATTRIB_VALUE, String.valueOf(getTransparency())}; writer.printLine(indent + 1, DimapProductConstants.TAG_BITMASK_TRANSPARENCY, attributes, null); writer.println(bdTags[1]); }