diff --git a/library.xml b/library.xml index d783746..37f5cd8 100644 --- a/library.xml +++ b/library.xml @@ -224,6 +224,34 @@ + + + + + + diff --git a/src/attributetable/AttributeTable.java b/src/attributetable/AttributeTable.java index d82738f..d2e619c 100644 --- a/src/attributetable/AttributeTable.java +++ b/src/attributetable/AttributeTable.java @@ -84,7 +84,10 @@ public class AttributeTable extends JTable { private final TableCellEditor archedBarGraphOptionEditor; private final TableCellEditor outputStringOptionEditor; private final TableCellEditor outputNumberOptionEditor; - private final TableCellEditor booleanAnalogEditor; + private final TableCellEditor auxFunction2OptionEditor; + private final TableCellEditor auxInput2OptionEditor; + private final TableCellEditor booleanAnalogEditor; + private final TableCellEditor aux2typeEditor; private final TableCellEditor validationTypeEditor; private final TableCellEditor maskTypeEditor; @@ -124,7 +127,13 @@ private AttributeTable(TableModel model) { archedBarGraphOptionEditor = new CheckBoxListCellEditor("border", "targetline", "nofill", "clockwise"); outputStringOptionEditor = new CheckBoxListCellEditor("transparent", "autowrap"); outputNumberOptionEditor = new CheckBoxListCellEditor("transparent", "leadingzeros", "blankzero"); + auxFunction2OptionEditor = new CheckBoxListCellEditor("criticalcontrol", "assignmentlock", "singleassignment"); + auxInput2OptionEditor = new CheckBoxListCellEditor("criticalcontrol", "singleassignment"); booleanAnalogEditor = createEditor("boolean", "analog"); + aux2typeEditor = createEditor("latchingboolean", "analog", "nonlatchingboolean", "analogreturnto50", "analogreturnto0", + "bothlatchingdualboolean", "bothnonlatchingdualboolean", "latchingdualbooleanup", + "latchingdualbooleandown", "combinedanalogreturnto50duallatchingboolean", "combinedanalogduallatchingboolean", + "nonlatchingquadboolean", "analogquad", "analogreturnto50quad", "encoder"); validationTypeEditor = createEditor("invalidcharacters", "validcharacters"); maskTypeEditor = createEditor("datamask", "alarmmask"); @@ -300,11 +309,15 @@ else if (Utils.equals(type, LINEARBARGRAPH)) { else if (Utils.equals(type, ARCHEDBARGRAPH)) { return archedBarGraphOptionEditor; } - else if (Utils.equals(type, OUTPUTSTRING)) { + else if (Utils.equals(type, OUTPUTSTRING, INPUTSTRING)) { return outputStringOptionEditor; } else if (Utils.equals(type, OUTPUTNUMBER, INPUTNUMBER)) { return outputNumberOptionEditor; + } else if (Utils.equals(type, AUXILIARYFUNCTION2)) { + return auxFunction2OptionEditor; + } else if (Utils.equals(type, AUXILIARYINPUT2)) { + return auxInput2OptionEditor; } else { return super.getCellEditor(row, col); @@ -347,7 +360,11 @@ else if (Utils.equals(attr, BACKGROUND_COLOUR, ARC_AND_TICK_COLOUR, return colorEditor; } else if (Utils.equals(attr, FUNCTION_TYPE)) { - return booleanAnalogEditor; + if (Utils.equals(type, AUXILIARYFUNCTION, AUXILIARYINPUT)) { + return booleanAnalogEditor; + } else { + return aux2typeEditor; + } } else if (Utils.equals(attr, VALIDATION_TYPE)) { return validationTypeEditor; diff --git a/src/images/auxiliaryfunction2.png b/src/images/auxiliaryfunction2.png new file mode 100644 index 0000000..8c1a307 Binary files /dev/null and b/src/images/auxiliaryfunction2.png differ diff --git a/src/images/auxiliaryinput2.png b/src/images/auxiliaryinput2.png new file mode 100644 index 0000000..013dca1 Binary files /dev/null and b/src/images/auxiliaryinput2.png differ diff --git a/src/objectview/GraphicObjectOperations.java b/src/objectview/GraphicObjectOperations.java index 03024b5..652796d 100644 --- a/src/objectview/GraphicObjectOperations.java +++ b/src/objectview/GraphicObjectOperations.java @@ -1062,6 +1062,24 @@ public void opAuxiliaryInput(Graphics2D gfx, XMLTreeNode node, int w, int h) { drawBorders(gfx, w, h); } + @Override + public void opAuxiliaryFunction2(Graphics2D gfx, XMLTreeNode node, int w, int h) { + // fill back ground + gfx.setColor(node.getBackgroundColor(colorDepth)); + gfx.fillRect(0, 0, w, h); + + drawBorders(gfx, w, h); + } + + @Override + public void opAuxiliaryInput2(Graphics2D gfx, XMLTreeNode node, int w, int h) { + // fill back ground + gfx.setColor(node.getBackgroundColor(colorDepth)); + gfx.fillRect(0, 0, w, h); + + drawBorders(gfx, w, h); + } + /** * Sets depth. * @param depth diff --git a/src/objectview/ObjectOperations.java b/src/objectview/ObjectOperations.java index 4c2225f..30cd0cd 100644 --- a/src/objectview/ObjectOperations.java +++ b/src/objectview/ObjectOperations.java @@ -47,6 +47,10 @@ public interface ObjectOperations { void opAuxiliaryFunction(Graphics2D gfx, XMLTreeNode node, int w, int h); void opAuxiliaryInput(Graphics2D gfx, XMLTreeNode node, int w, int h); + + void opAuxiliaryFunction2(Graphics2D gfx, XMLTreeNode node, int w, int h); + + void opAuxiliaryInput2(Graphics2D gfx, XMLTreeNode node, int w, int h); void opButton(Graphics2D gfx, XMLTreeNode node); diff --git a/src/objectview/ObjectView.java b/src/objectview/ObjectView.java index 6b60b05..f7bd62a 100644 --- a/src/objectview/ObjectView.java +++ b/src/objectview/ObjectView.java @@ -711,6 +711,12 @@ else switch (type) { case AUXILIARYINPUT: shape = processAuxiliaryInput(gfx, node, oper); break; + case AUXILIARYFUNCTION2: + shape = processAuxiliaryFunction2(gfx, node, oper); + break; + case AUXILIARYINPUT2: + shape = processAuxiliaryInput2(gfx, node, oper); + break; default: // node is not drawable, do nothing break; @@ -1281,6 +1287,58 @@ else if (nd.isType(OBJECTS)) { return restoreClip(gfx, oldc); } + + public Shape processAuxiliaryFunction2(Graphics2D gfx, XMLTreeNode node, ObjectOperations oper) { + dmsg("paintAuxiliaryFunction2"); + Shape oldc = changeClip(gfx, sk_width, sk_height); + + oper.opAuxiliaryFunction2(gfx, node, sk_width, sk_height); + + // paint children + oper.incDepth(); + for (int i = 0, n = model.getChildCount(node); i < n; i++) { + XMLTreeNode nd = (XMLTreeNode) model.getChild(node, i); + if (nd.isType(MACRO)) { + // do nothing? + } + // this could be more specific + else if (nd.isType(OBJECTS)) { + AffineTransform oldx = gfx.getTransform(); + gfx.translate(nd.getX(), nd.getY()); + processNode(gfx, nd, oper); + gfx.setTransform(oldx); + } + } + oper.decDepth(); + + return restoreClip(gfx, oldc); + } + + public Shape processAuxiliaryInput2(Graphics2D gfx, XMLTreeNode node, ObjectOperations oper) { + dmsg("paintAuxiliaryInput2"); + Shape oldc = changeClip(gfx, sk_width, sk_height); + + oper.opAuxiliaryInput2(gfx, node, sk_width, sk_height); + + // paint children + oper.incDepth(); + for (int i = 0, n = model.getChildCount(node); i < n; i++) { + XMLTreeNode nd = (XMLTreeNode) model.getChild(node, i); + if (nd.isType(MACRO)) { + // do nothing? + } + // this could be more specific + else if (nd.isType(OBJECTS)) { + AffineTransform oldx = gfx.getTransform(); + gfx.translate(nd.getX(), nd.getY()); + processNode(gfx, nd, oper); + gfx.setTransform(oldx); + } + } + oper.decDepth(); + + return restoreClip(gfx, oldc); + } /** * Calculates required size by using a very limited recursion. @@ -1314,7 +1372,8 @@ else if (node.isType(SOFTKEYMASK)) { // reserve roperm for one extra key lim.set(sk_width, (model.getChildCount(node) + 1) * sk_height); } - else if (node.isType(KEY, AUXILIARYFUNCTION, AUXILIARYINPUT)) { + else if (node.isType(KEY, AUXILIARYFUNCTION, AUXILIARYINPUT, + AUXILIARYFUNCTION2, AUXILIARYINPUT2)) { lim.set(sk_width, sk_height); } else if (node.isType(CONTAINER, BUTTON, diff --git a/src/objectview/PointObjectOperations.java b/src/objectview/PointObjectOperations.java index 061e9f9..c7e6fa3 100644 --- a/src/objectview/PointObjectOperations.java +++ b/src/objectview/PointObjectOperations.java @@ -133,6 +133,16 @@ public void opAuxiliaryFunction(Graphics2D gfx, XMLTreeNode node, int w, int h) public void opAuxiliaryInput(Graphics2D gfx, XMLTreeNode node, int w, int h) { check(gfx, node); } + + @Override + public void opAuxiliaryFunction2(Graphics2D gfx, XMLTreeNode node, int w, int h) { + check(gfx, node); + } + + @Override + public void opAuxiliaryInput2(Graphics2D gfx, XMLTreeNode node, int w, int h) { + check(gfx, node); + } @Override public void opButton(Graphics2D gfx, XMLTreeNode node) { diff --git a/src/pooledit/Definitions.java b/src/pooledit/Definitions.java index f760a5b..651c4bb 100644 --- a/src/pooledit/Definitions.java +++ b/src/pooledit/Definitions.java @@ -83,6 +83,8 @@ public class Definitions { static public final String MACROS_ = "Macros"; static public final String AUXILIARYFUNCTIONS_ = "AuxiliaryFunctions"; static public final String AUXILIARYINPUTS_ = "AuxiliaryInputs"; + static public final String AUXILIARYFUNCTIONS2_ = "AuxiliaryFunctions2"; + static public final String AUXILIARYINPUTS2_ = "AuxiliaryInputs2"; static public final String[][] SUBCATEGORYGROUPS = { {WORKINGSETS_, DATAMASKS_, ALARMMASKS_, CONTAINERS_}, @@ -96,7 +98,7 @@ public class Definitions { {FONTATTRIBUTES_, LINEATTRIBUTES_, FILLATTRIBUTES_, INPUTATTRIBUTES_}, {OBJECTPOINTERS_}, {MACROS_}, - {AUXILIARYFUNCTIONS_, AUXILIARYINPUTS_} + {AUXILIARYFUNCTIONS_, AUXILIARYINPUTS_, AUXILIARYFUNCTIONS2_, AUXILIARYINPUTS2_} }; static public final String[] SUBCATEGORIES = { @@ -111,7 +113,7 @@ public class Definitions { FONTATTRIBUTES_, LINEATTRIBUTES_, FILLATTRIBUTES_, INPUTATTRIBUTES_, OBJECTPOINTERS_, MACROS_, - AUXILIARYFUNCTIONS_, AUXILIARYINPUTS_ + AUXILIARYFUNCTIONS_, AUXILIARYINPUTS_, AUXILIARYFUNCTIONS2_, AUXILIARYINPUTS2_ }; // objects @@ -146,6 +148,8 @@ public class Definitions { static public final String MACRO = "macro"; static public final String AUXILIARYFUNCTION = "auxiliaryfunction"; static public final String AUXILIARYINPUT = "auxiliaryinput"; + static public final String AUXILIARYFUNCTION2 = "auxiliaryfunction2"; + static public final String AUXILIARYINPUT2 = "auxiliaryinput2"; static public final String[] OBJECTS = { WORKINGSET, DATAMASK, ALARMMASK, CONTAINER, @@ -157,7 +161,8 @@ public class Definitions { METER, LINEARBARGRAPH, ARCHEDBARGRAPH, PICTUREGRAPHIC, NUMBERVARIABLE, STRINGVARIABLE, FONTATTRIBUTES, LINEATTRIBUTES, FILLATTRIBUTES, INPUTATTRIBUTES, - OBJECTPOINTER, MACRO, AUXILIARYFUNCTION, AUXILIARYINPUT + OBJECTPOINTER, MACRO, AUXILIARYFUNCTION, AUXILIARYINPUT, + AUXILIARYFUNCTION2, AUXILIARYINPUT2 }; // pseudo objects @@ -187,7 +192,7 @@ public class Definitions { FONTATTRIBUTES_, LINEATTRIBUTES_, FILLATTRIBUTES_, INPUTATTRIBUTES_, OBJECTPOINTERS_, MACROS_, - AUXILIARYFUNCTIONS_, AUXILIARYINPUTS_, + AUXILIARYFUNCTIONS_, AUXILIARYINPUTS_, AUXILIARYFUNCTIONS2_, AUXILIARYINPUTS2_, WORKINGSET, DATAMASK, ALARMMASK, CONTAINER, SOFTKEYMASK, KEY, BUTTON, INPUTBOOLEAN, INPUTSTRING, @@ -198,6 +203,7 @@ public class Definitions { NUMBERVARIABLE, STRINGVARIABLE, FONTATTRIBUTES, LINEATTRIBUTES, FILLATTRIBUTES, INPUTATTRIBUTES, OBJECTPOINTER, MACRO, AUXILIARYFUNCTION, AUXILIARYINPUT, + AUXILIARYFUNCTION2, AUXILIARYINPUT2, POINT, LANGUAGE, INCLUDE_OBJECT, FIXEDBITMAP, COMMAND }; @@ -226,6 +232,7 @@ public class Definitions { "macro.png", // --- objects --- "auxiliaryfunction.png", "auxiliaryinput.png", + "auxiliaryfunction2.png", "auxiliaryinput2.png", "workingset.png", "datamask.png", "alarmmask.png", "container.png", "softkeymask.png", "softkey.png", "button.png", "inputbooleanfield.png", "inputstringfield.png", "inputnumberfield.png", "inputlistfield.png", @@ -238,6 +245,7 @@ public class Definitions { "objectpointer.png", "macro.png", "auxiliaryfunction.png", "auxiliaryinput.png", + "auxiliaryfunction2.png", "auxiliaryinput2.png", // --- pseudo objects --- "point.png", "language.png", "includeobject.png", "fixedbitmap.png", "command.png" }; diff --git a/src/pooledit/Tools.java b/src/pooledit/Tools.java index f2e4ad4..a21dbd0 100644 --- a/src/pooledit/Tools.java +++ b/src/pooledit/Tools.java @@ -984,7 +984,8 @@ else if (actual != null) { // objects with x-y-object references if (Utils.equals(trgName, WORKINGSET, DATAMASK, ALARMMASK, - CONTAINER, KEY, BUTTON, AUXILIARYFUNCTION, AUXILIARYINPUT) && + CONTAINER, KEY, BUTTON, AUXILIARYFUNCTION, AUXILIARYINPUT, + AUXILIARYFUNCTION2, AUXILIARYINPUT2) && Utils.equals(frgName, CONTAINER, BUTTON, INPUTBOOLEAN, INPUTSTRING, INPUTNUMBER, INPUTLIST, OUTPUTSTRING, OUTPUTNUMBER, LINE, RECTANGLE, ELLIPSE, POLYGON, METER, @@ -1621,7 +1622,8 @@ private static void markAllChildMasksAndDesignators(PrintStream out, markChildrenMask(out, element, nameMap); } // marking softkeymask is necessary as it can contain pointers as well as keys - else if (Utils.equals(name, WORKINGSET, SOFTKEYMASK, KEY, AUXILIARYFUNCTION, AUXILIARYINPUT)) { + else if (Utils.equals(name, WORKINGSET, SOFTKEYMASK, KEY, + AUXILIARYFUNCTION, AUXILIARYINPUT, AUXILIARYFUNCTION2, AUXILIARYINPUT2)) { markChildrenDesignator(out, element, nameMap); } } diff --git a/src/pooledit/TreeEditPopup.java b/src/pooledit/TreeEditPopup.java index fbcc027..d2bbb3b 100644 --- a/src/pooledit/TreeEditPopup.java +++ b/src/pooledit/TreeEditPopup.java @@ -877,7 +877,7 @@ public static void geometricTransformation(XMLTreeNode node, int xform) { width = root.getDimension(); height = width; } - else if (Utils.equals(type, KEY, AUXILIARYFUNCTION, AUXILIARYINPUT, WORKINGSET)) { + else if (Utils.equals(type, KEY, AUXILIARYFUNCTION, AUXILIARYINPUT, AUXILIARYFUNCTION2, AUXILIARYINPUT2, WORKINGSET)) { XMLTreeNode root = (XMLTreeNode) node.getModel().getRoot(); width = root.getSKWidth(); height = root.getSKHeight(); @@ -1022,7 +1022,8 @@ private static void geometricTransformationRecursive(XMLTreeNode node, } if (Utils.equals(type, CONTAINER, BUTTON, DATAMASK, ALARMMASK, KEY, - AUXILIARYFUNCTION, AUXILIARYINPUT, WORKINGSET, OBJECTPOINTER)) { + AUXILIARYFUNCTION, AUXILIARYINPUT, AUXILIARYFUNCTION2, AUXILIARYINPUT2, + WORKINGSET, OBJECTPOINTER)) { // search through all childs and apply transformation for them XMLTreeModel model = node.getModel(); for (int i = 0, n = node.getModel().getChildCount(node); i < n; i++) { diff --git a/src/poolimporter/PoolImporter.java b/src/poolimporter/PoolImporter.java index 18cf0ee..d19257e 100644 --- a/src/poolimporter/PoolImporter.java +++ b/src/poolimporter/PoolImporter.java @@ -101,6 +101,8 @@ public class PoolImporter { static public final String MACRO = "macro"; static public final String AUXILIARYFUNCTION = "auxiliaryfunction"; static public final String AUXILIARYINPUT = "auxiliaryinput"; + static public final String AUXILIARYFUNCTION2 = "auxiliaryfunction2"; + static public final String AUXILIARYINPUT2 = "auxiliaryinput2"; static public final String POINT_OBJECT = "point"; static public final String DIMENSION = "dimension"; @@ -1003,6 +1005,26 @@ public String getPictureGraphicOptions(int opt) { final String[] OPTS = {"transparent", "flashing"}; // FIXME: STUFF MISSING! CHECK THE STANDARD! return getOptions(opt, OPTS); } + + /** + * This method is used by auxiliary function2. + * @param opt + * @return + */ + public String getFunction2Options(int opt) { + final String[] OPTS = {"criticalcontrol", "assignmentlock", "singleassignment"}; + return getOptions(opt, OPTS); + } + + /** + * This method is used by auxiliary input2. + * @param opt + * @return + */ + public String getInput2Options(int opt) { + final String[] OPTS = {"criticalcontrol", "singleassignment"}; + return getOptions(opt, OPTS); + } public String getFontType(int opt) { //0|1|2|255|latin1|latin9|latin5|proprietary @@ -2576,6 +2598,84 @@ public void appendDoc(Map map, Document doc) { } public String getType() { return "auxiliaryinput"; } }; + case 31: // aux2 function + return new VTAbstObj() { + int bgcol; + int funtype; + int options; + List objects; + public void read(ByteReader br) { + bgcol = br.readColor(); + funtype = br.readByte(); + options = br.readByte(); + int nroObjects = br.readByte(); + objects = br.readRefXYs(nroObjects); + } + public void emitXML(Map map, PrintStream out) { + out.format("\n", name); + for (RefXY ref : objects) { + out.format(" \n", + map.get(ref.id), ref.x, ref.y); + } + out.format("\n"); + } + public void appendDoc(Map map, Document doc) { + Element root = doc.getDocumentElement(); + Element auxiliaryfunction2 = doc.createElement(AUXILIARYFUNCTION2); + auxiliaryfunction2.setAttribute(NAME, map.get(id)); + auxiliaryfunction2.setAttribute(BACKGROUND_COLOUR, getColor(bgcol)); + auxiliaryfunction2.setAttribute(FUNCTION_TYPE, getFunctionType(funtype)); + auxiliaryfunction2.setAttribute(OPTIONS, getFunction2Options(options)); + for (RefXY ref : objects) { + Element child = doc.createElement(INCLUDE_OBJECT); + child.setAttribute(NAME, map.get(ref.id)); + child.setAttribute(POS_X, Integer.toString(ref.x)); + child.setAttribute(POS_Y, Integer.toString(ref.y)); + auxiliaryfunction2.appendChild(child); + } + root.appendChild(auxiliaryfunction2); + } + public String getType() { return "auxiliaryfunction2"; } + }; + case 32: // aux2 input + return new VTAbstObj() { + int bgcol; + int funtype; + int options; + List objects; + public void read(ByteReader br) { + bgcol = br.readColor(); + funtype = br.readByte(); + options = br.readByte(); + int nroObjects = br.readByte(); + objects = br.readRefXYs(nroObjects); + } + public void emitXML(Map map, PrintStream out) { + out.format("\n", name); + for (RefXY ref : objects) { + out.format(" \n", + map.get(ref.id), ref.x, ref.y); + } + out.format("\n"); + } + public void appendDoc(Map map, Document doc) { + Element root = doc.getDocumentElement(); + Element auxiliaryinput2 = doc.createElement(AUXILIARYINPUT2); + auxiliaryinput2.setAttribute(NAME, map.get(id)); + auxiliaryinput2.setAttribute(BACKGROUND_COLOUR, getColor(bgcol)); + auxiliaryinput2.setAttribute(FUNCTION_TYPE, getFunctionType(funtype)); + auxiliaryinput2.setAttribute(OPTIONS, getInput2Options(options)); + for (RefXY ref : objects) { + Element child = doc.createElement(INCLUDE_OBJECT); + child.setAttribute(NAME, map.get(ref.id)); + child.setAttribute(POS_X, Integer.toString(ref.x)); + child.setAttribute(POS_Y, Integer.toString(ref.y)); + auxiliaryinput2.appendChild(child); + } + root.appendChild(auxiliaryinput2); + } + public String getType() { return "auxiliaryinput2"; } + }; default: throw new RuntimeException("unknown type encountered: " + type); } diff --git a/src/schema/iso11783.xsd b/src/schema/iso11783.xsd index 65a7085..2c1097c 100644 --- a/src/schema/iso11783.xsd +++ b/src/schema/iso11783.xsd @@ -226,6 +226,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1038,6 +1070,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -1243,6 +1321,9 @@ + + + diff --git a/src/treemodel/XMLTreeNode.java b/src/treemodel/XMLTreeNode.java index 96f6628..aae8703 100644 --- a/src/treemodel/XMLTreeNode.java +++ b/src/treemodel/XMLTreeNode.java @@ -1314,7 +1314,7 @@ public Integer getEffectiveTargetValue() { * @return */ public Dimension getNodeSize(Dimension dim) { - if (isType(WORKINGSET, KEY, AUXILIARYFUNCTION, AUXILIARYINPUT)) { + if (isType(WORKINGSET, KEY, AUXILIARYFUNCTION, AUXILIARYINPUT, AUXILIARYFUNCTION2, AUXILIARYINPUT2)) { XMLTreeNode root = (XMLTreeNode) model.getRoot(); dim.setSize(root.getSKWidth(), root.getSKHeight()); }