"Casting" Envelope to a Primitive shouldn't be done with a factory method.

Description

The "...spatialschema.geometry.primitive.PrimitiveFactory" class contains a method called "createPrimitive(Envelope)". This threw me for a bit because factories are for instantiating objects, and "Primitive" is abstract according to 19107.

The comments indicate that this method is included in order to provide a means of using an Envelope in a spatial query, as the Envelope is not actually a Geometry according to 19107.

I think this is a legitimate operation to be performed on an Envelope. However, I think it should be implemented as a method on the Envelope interface rather than in the Factory interface. I'm thinking something like "Envelope.toBoundary()" which could return a GM_PrimitiveBoundary (also abstract) instead of a GM_Primitive. By doing this, "Envelope" is still converted into a GM_Object, and the type of the resultant object seems to reflect the nature of an "Envelope" a little more precisely. Also, a 3D envelope could encapsulate the logic to generate a "cube" solid boundary, a 2D object could encapsulate the logic related to a "SurfaceBoundary" and a 1D envelope could encapsulate the logic related to a CurveBoundary.

Environment

None

Status

Assignee

Unassigned

Reporter

codehaus

Priority

Low
Configure