I have GoGeneralNode and GoIconicNode with custom shape drawn in source code or from .jpg file. How to save the information in xml file and load the shape later?
I think I miss something in RegisterTransformer method …
Well, your AddBinding code doesn’t match the XML you show later.
GoIconicNode.Icon is a GoObject. GoXml doesn’t know how to save as GoObject.
GoIconicNode.Image is Icon as GoImage. You can do Image.Name and Image.Index if those are appropriate.
GoIconicNode.Shape is Icon as GoShape (all 3 are synonyms for the same object in the node).
OctagonalStar is derived from GoShape, but it’s a custom object. GoXml doesn’t know how to do a “new OctagonalStar()”.
Note you can save a GoFigure in XML as “Shape.Figure”. If you were using a GoDrawing(GoFigure.EightPointedStar), you could save the shape that way. (at least I think that works, I don’t see a sample of it anywhere)
Well, you can, but you have to write the code a slightly different way. Look at what FlowCharter does in GraphNode. It has a Kind property (with an enum GraphNodeKind) that will set the background shape. You can save
Kind in an XML, and restoring it will set the shape.
Hi Jake, I have another question:
I want to create a node object with custom shape (drawn by myself in source code) and custom ports. I will create a new class MyNode inherited a Node of GoDiagram. But I wonder which node should I inherited from?
Which sample should I look at?