IEnvelope
ArcGIS IEnvelope: An illustation of both –
- Properties v. Methods
- ByVal v. ByRef
An ArcGIS envelope appears to be defined by four main properties:
- co-ordinates (XMin, YMin) and (XMax, YMax).
Properties v. Methods
Are properties such as “Width” really properties or are they methods?
Are they held by variables or calculated on the fly, e.g. XMax – XMin?
… and what, as another example, of “LowerRight” …
ByVal v. ByRef
Notice that “Spatial Reference” is different to all the other properties. The “write”hand-side of its (read/write) dumbell is hollow, which means you need to use SET:
SET pEnvelope.SpatialReference = pSpatialReference
None of the other write-able properties need SET, e.g.
pEnvelope.LowerRight = pLowerRight
The consequences are significant – if pSpatialReference and pLowerRight are subsequently changed then:
- pEnvelope.SpatialReference is also changed, but
- pEnvelope.LowerRight is not affected.
Even though you might have wanted it to have been changed! The “.LowerRight” property seems to behave as a method, assigning new values to XMax and YMin.
