narsdani

Mysteriously empty polygons in 10.1

Discussion created by narsdani on May 29, 2013
Latest reply on Jun 3, 2013 by narsdani
We're finally running 10.1 in our shop and one of my add-ins is behaving strangely and I can't quite track down the problem.  The add-in takes some input (1+ geometries, strings, & numbers) and uses them to create an object of class OrdinanceShape, excerpted below.  All the wacky message boxes are my hackish attempt at sorting through this problem.  At 9.x & 10.0, this stuff worked without a problem, but in 10.1 the class's "Shape" property has started returning empty geometry.  This has been replicated on at least two computers running 64-bit Windows 7.  The geometries are not empty when they are dumped into the class's constructor, but my message boxes indicate that they ARE empty by the time the class's "Shape" property is called.  None of the class's other methods or properties touch the "ordShape" variable.  Any ideas?

One thought: I've experienced similar empty geometries in python when I've tried to store them in python collections.  The OrdinanceShape objects I create get put into a C# list.  Could something similar be happening here?

Thanks,
Dan

public class OrdinanceShape
{
    private IPolygon ordShape;
    private int ordOrdinanceID;
    private int ordToZoneCodeID;
    private string ordToZoneCodeSuffix;
    private int ordFromZoneCodeID;
    private string ordFromZoneCodeSuffix;
    private int ordFromTaxCodeAreaID;
    private int ordToTaxCodeAreaID;

[...Other constructors...] 

    public OrdinanceShape(IPolygon pPolygon, int OrdinanceID)
    {
        ordShape = pPolygon;
        if (ordShape.IsEmpty)
            System.Windows.Forms.MessageBox.Show("EmptyInBeginning");
        else
            System.Windows.Forms.MessageBox.Show(ordShape.Envelope.Width.ToString());
        ordOrdinanceID = OrdinanceID;
        ordToZoneCodeID = -999;
        ordToZoneCodeSuffix = "";
        if (ordShape.IsEmpty)
            System.Windows.Forms.MessageBox.Show("EmptyInEnd");
        else
            System.Windows.Forms.MessageBox.Show(ordShape.Envelope.Width.ToString());
    }

[...Other properties & methods...]

    public IPolygon Shape
    {
        get 
        {
            if (ordShape.IsEmpty)
                System.Windows.Forms.MessageBox.Show("EmptyOutBeginning");
            IZAware pGeom = (IZAware)ordShape;
            pGeom.DropZs();
            pGeom.ZAware = false;
            if (ordShape.IsEmpty)
                System.Windows.Forms.MessageBox.Show("EmptyOutEnd");
            return ordShape;
        }
    }
[...Other properties & methods...]
}

Outcomes