Exemplo n.º 1
0
    private static float ReadNext(BinaryReader reader, BinaryFileMetadata metadata)
    {
        switch (metadata.GetDataType())
        {
        case BinaryDataType.Single: return(reader.ReadSingle());

        case BinaryDataType.Double: return((float)reader.ReadDouble());

        case BinaryDataType.Int16: return(reader.ReadInt16());

        case BinaryDataType.Int32: return(reader.ReadInt32());

        case BinaryDataType.Int64: return(reader.ReadInt64());

        case BinaryDataType.UInt8: return(reader.ReadByte());

        case BinaryDataType.UInt16: return(reader.ReadUInt16());

        case BinaryDataType.UInt32: return(reader.ReadUInt32());

        case BinaryDataType.UInt64: return(reader.ReadUInt64());

        default: throw new System.ArgumentException("Unsupported BinaryDataType " + metadata.GetDataType());
        }
    }
Exemplo n.º 2
0
 public void MetaDataFromSampleFileWorks()
 {
     Assert.True(Mathf.Abs((float)metadata.GetCellsize() - 10.0F) < precision, "Cellsize not correct.");
     Assert.True(metadata.GetColumns() == 10, "ncols not correct.");
     Assert.True(metadata.GetRows() == 13, "nrows not correct.");
     Assert.True(Mathf.Abs(metadata.GetMaxHeight() - 1960.91F) < precision, "maxheight not correct.");
     Assert.True(Mathf.Abs(metadata.GetMinHeight() - 1951.887F) < precision, "minheight not correct.");
     Assert.True(metadata.GetDataType() == BinaryDataType.Single, "Data type not correct.");
     Assert.True(Mathf.Abs((float)(metadata.GetLowerLeftCornerX() - (-12492736.0119444))) < precision, "Lower left corner X value not correct.");
     Assert.True(Mathf.Abs((float)(metadata.GetLowerLeftCornerY() - (4302859.27676796))) < precision, "Lower left corner Y value not correct.");
 }