GeometryFactoryImpl cf = (GeometryFactoryImpl) c.getComponentInstanceOfType(GeometryFactory.class);
PrimitiveFactoryImpl tPrimFactory = (PrimitiveFactoryImpl) c.getComponentInstanceOfType( PrimitiveFactoryImpl.class );
PositionFactory positionFactory = (PositionFactory ) c.getComponentInstanceOfType( PositionFactory.class );
// public DirectPositionImpl createDirectPosition();
DirectPosition dp1 = cf.createDirectPosition();
assertTrue(Double.compare(dp1.getOrdinate(0), Double.NaN) == 0);
assertTrue(Double.compare(dp1.getOrdinate(1), Double.NaN) == 0);
assertTrue(Double.compare(dp1.getOrdinate(2), Double.NaN) == 0);
// public DirectPositionImpl createDirectPosition(double[] coord);
double[] da = new double[3];
da[0] = 10.0;
da[1] = -115000.0;
da[2] = 0.0000000125;
DirectPosition dp2 = cf.createDirectPosition(da);
assertTrue(dp2.getOrdinate(0) == 10.0);
assertTrue(dp2.getOrdinate(1) == -115000.0);
assertTrue(dp2.getOrdinate(2) == 0.0000000125);
// public Envelope createEnvelope(
// DirectPosition lowerCorner,
// DirectPosition upperCorner)
Envelope env1 = cf.createEnvelope(dp1, dp2);
DirectPosition lc = env1.getLowerCorner();
assertTrue(Double.compare(lc.getOrdinate(0), Double.NaN) == 0);
assertTrue(Double.compare(lc.getOrdinate(1), Double.NaN) == 0);
assertTrue(Double.compare(lc.getOrdinate(2), Double.NaN) == 0);
DirectPosition uc = env1.getUpperCorner();
assertTrue(uc.getOrdinate(0) == 10.0);
assertTrue(uc.getOrdinate(1) == -115000.0);
assertTrue(uc.getOrdinate(2) == 0.0000000125);
env1 = cf.createEnvelope(dp2, dp1);
lc = env1.getLowerCorner();
assertTrue(lc.getOrdinate(0) == 10.0);
assertTrue(lc.getOrdinate(1) == -115000.0);
assertTrue(lc.getOrdinate(2) == 0.0000000125);
uc = env1.getUpperCorner();
assertTrue(Double.compare(uc.getOrdinate(0), Double.NaN) == 0);
assertTrue(Double.compare(uc.getOrdinate(1), Double.NaN) == 0);
assertTrue(Double.compare(uc.getOrdinate(2), Double.NaN) == 0);
// public Position createPosition(DirectPosition dp);
Position pos1 = cf.createPosition(dp2);
assertTrue(pos1.getDirectPosition().getOrdinate(0) == 10.0);
assertTrue(pos1.getDirectPosition().getOrdinate(1) == -115000.0);