1
Vote

2 errors:

description

2 errors:
 
  • The Y position automatically marked wrong
  • RegularPolygon deserialization in FigureTypes.ContainsKey (typeName)) will not find at the Dependency and returns null error.

comments

leonli77hot wrote Sep 16, 2011 at 1:52 AM

The problem lies in CompositeFigure.cs:
     public override void ReadXml (System.Xml.Linq.XElement element)
     {
         new DrawingDeserializer (). ReadFigureList (Children, element, Drawing);
     }
Here repeated ReadFigureList

leonli77hot wrote Sep 16, 2011 at 3:02 AM

In RegularPolygon.cs added:
    public override void ReadXml(XElement element)
    {
        Visible = element.ReadBool("Visible", true);
        Locked = element.ReadBool("Locked", false);
        IsHitTestVisible = element.ReadBool("IsHitTestVisible", true);
        var styleAttribute = element.Attribute("Style");
        if (styleAttribute != null
            && Drawing != null
            && Drawing.StyleManager != null)
        {
            var style = Drawing.StyleManager[styleAttribute.Value];
            if (style != null)
            {
                this.polygon.Style = style;
            }
        }
    }

DavidHartmann wrote Sep 16, 2011 at 2:02 PM

Thank you leonli77hot for reporting these issues. I just checked in code that resolves the issues. Your RegularPolygon.ReadXML override would work but instead I removed CompositePolygon.ReadXML (which was being used by RegularPolygon) and CompositePolygon.WriteXML. These methods were descending into the Children when they shouldn't be.

I use the Dynamic Geometry library for a separate project. However, I don't use the RegularPolygon class so I did not notice that error.
  • David

wrote Feb 14, 2013 at 7:31 PM