This project is read-only.

Saving project xml

Sep 23, 2010 at 8:57 AM

Saving XML project and then reopening (also from DotSpatial.TestForm) I was having an error in XmlDeserializer because the file contains some "Nan" values form Z and M

  <member name="MapFrame" type="1">
    <member name="IsLegendGroup" type="2" value="False" />
    <member name="Extents" type="3">
      <member name="Min" type="4">
        <member name="X" type="5" value="515783.84375" />
        <member name="Y" type="5" value="4771689.94571385" />
        <member name="Z" type="5" value="NaN" />
        <member name="M" type="5" value="NaN" />
      </member>

 

at ReadObjet I was mading this change

 

    private object ReadObject(XElement element)
        {
            // See if this element is an object reference
            var refElement = element.Attribute(XmlConstants.REF);
            if (refElement != null)
                return _references[refElement.Value];

            object result = GetObjectFromFormatter(element);
            if (result != null)
                return result;

            Type type = GetType(element);
            string value = GetValue(element);

            if (type.IsPrimitive)
            {
                if (value != "NaN")
                    result = Convert.ChangeType(value, type);
                else
                    result = Convert.ChangeType(Double.NaN,type);
            }

 

and it seem working

 

Other problem is that afer reading an a map.xml project from a file drag a layer upper or downer from another doesent work.

I can just drag layers on the top o Z order in the map but a copy of the layer remains in the start place.

If I make the same operaton on a project still not saved and reloaded all seem working fine, may be is a problem on XmlSerialization ?

 

 

 

 

Sep 23, 2010 at 4:08 PM

Thanks for taking the time to track that bug down Tummi.  It was added as an issue, so I will add this fix to the SymbologyRefactor branch that I have almost finished debugging, and when I merge that back in, everyone will benefit from your change.  Then I will update the issue so that we only have the layer ordering problem for this bug left.