PartRange.Extent

Developer
Aug 29, 2011 at 10:31 PM

I just filed an issue (344) regarding the value returned from PartRange.Extent for ShapeTypes having M or Z.  I plan to work on this tomorrow.  I am a little concerned it may have some unintended consequences.  If you work with 2D shapefiles, you will not be affected.  However, if you work with 3D(or M) shapefiles, behavior could change a little.  I am confident that this is the right thing to do, but I just wanted to let folks know, so if you run into issues later, you might remember this post.  Thanks. Kyle

Developer
Aug 30, 2011 at 9:07 PM

Been looking at this in detail today.   I think I have found a bug, but it is hard to believe this has been here this long:

The ExtentMZ class has a property that is implemented thusly:

        public override bool HasZ
        {
            get
            {
                if (double.IsNaN(MinZ) || double.IsNaN(MaxZ))
                {
                    return false;
                }
                return MinZ > MaxZ;
            }
        }

I think the return statement should return the inverse (return MinZ <= MaxZ).  Having a MinZ that is less than or equal to the MaxZ should be the normal case when you  have Z.  The HasM property on the ExtentM class has a similar logic error, I think.  Anyway, I plan to change this and if it fixes some of the problems I am having, will post it.  Anybody have any comment on this?

Also, my Resharper license has expired, so no guarantees that I will make a 'clean' post.

Thanks,

Kyle