private void copy(Coordinate co, double[] ordinates, DimensionalFlag flag) {
   ordinates[flag.X] = co.x;
   ordinates[flag.Y] = co.y;
   if (flag.is3D()) ordinates[flag.Z] = co.z;
   if (flag.isMeasured()) {
     ordinates[flag.M] =
         (co instanceof DimensionalCoordinate) ? ((DimensionalCoordinate) co).m : Double.NaN;
   }
 }
 protected void writeTypeCodeAndSrid(
     Geometry geometry, DimensionalFlag dimension, ByteBuffer output) {
   int typeCode = getGeometryType(geometry);
   boolean hasSrid = (geometry.getSRID() > 0);
   if (hasSrid && !hasWrittenSrid) typeCode |= PostgisWkbTypeMasks.SRID_FLAG;
   if (dimension.isMeasured()) typeCode |= PostgisWkbTypeMasks.M_FLAG;
   if (dimension.is3D()) typeCode |= PostgisWkbTypeMasks.Z_FLAG;
   output.putUInt(typeCode);
   if (hasSrid && !hasWrittenSrid) {
     output.putInt(geometry.getSRID());
     hasWrittenSrid = true;
   }
 }