FdoGeometryType: bug due to enum values

4 messages Options
Embed this post
Permalink
VJ

FdoGeometryType: bug due to enum values

Reply Threaded More More options
Print post
Permalink
Hello,

I noticed that the FdoGeometryType is an enum, where
FdoPoint = 1 (00000001)
FdoLineString = 2 (00000010)
FdoPolygon = 3 (00000011)
...

Now, consider FdoGeometricPropertyDefinition::GetGeometryTypes(). The description says "Gets the FdoGeometricTypes that can be stored in this geometric property. The returned value may be any combination of the values from the FdoGeometricType enumeration combined via a bit-wise or operation."

If the allowed types are FdoPoint and FdoLineString, this yields a bitwise or of 00000011. This can be interpreted as an FdoPolygon.
To avoid this, the enum constants should be powers of 2...


Jörg

Jackie Ng

Re: FdoGeometryType: bug due to enum values

Reply Threaded More More options
Print post
Permalink
I think you are getting FdoGeometryType mixed up with FdoGeometricType.

- Jackie

VJ wrote:
Hello,

I noticed that the FdoGeometryType is an enum, where
FdoPoint = 1 (00000001)
FdoLineString = 2 (00000010)
FdoPolygon = 3 (00000011)
...

Now, consider FdoGeometricPropertyDefinition::GetGeometryTypes(). The description says "Gets the FdoGeometricTypes that can be stored in this geometric property. The returned value may be any combination of the values from the FdoGeometricType enumeration combined via a bit-wise or operation."

If the allowed types are FdoPoint and FdoLineString, this yields a bitwise or of 00000011. This can be interpreted as an FdoPolygon.
To avoid this, the enum constants should be powers of 2...


Jörg
VJ

Re: FdoGeometryType: bug due to enum values

Reply Threaded More More options
Print post
Permalink
I stand corrected...

The documentation reads:
-
FDO_API FdoInt32 GetGeometryTypes ()
  Gets the FdoGeometricTypes that can be stored in this geometric property. The returned value may be any combination of the values from the FdoGeometricType enumeration combined via a bit-wise or operation.
-
and it indeed mentions FdoGeometricTypes, and those are indeed encoded as powers of 2.
I was so focused on the name for the method...

Thanks for clearing it up!

Jörg
Jackie Ng

Re: FdoGeometryType: bug due to enum values

Reply Threaded More More options
Print post
Permalink
It's a rather poor choice of names if I may say so. It so easy to get confused.

- Jackie

VJ wrote:
I stand corrected...

The documentation reads:
-
FDO_API FdoInt32 GetGeometryTypes ()
  Gets the FdoGeometricTypes that can be stored in this geometric property. The returned value may be any combination of the values from the FdoGeometricType enumeration combined via a bit-wise or operation.
-
and it indeed mentions FdoGeometricTypes, and those are indeed encoded as powers of 2.
I was so focused on the name for the method...

Thanks for clearing it up!

Jörg