Exemplo n.º 1
0
    public static void ParseBinValues(BinaryReader br, PointData pointData)
    {
        // Allocate point data memory
        pointData.InitPointData();

        byte[] bytes = null;

        // Read values
        PatchDataIO.ReadArray(br, ref bytes, pointData.lons, 8);
        PatchDataIO.ReadArray(br, ref bytes, pointData.lats, 8);
        PatchDataIO.ReadArray(br, ref bytes, pointData.values, 4);

        // Read distribution values
        var count = br.ReadByte();

        if (count > 0)
        {
            int[] distributionValues = new int[count];
            PatchDataIO.ReadArray(br, ref bytes, distributionValues, 4);

            // Read max distribution value
            int maxDistributionValue = br.ReadInt32();
            pointData.SetDistribution(distributionValues, maxDistributionValue);
        }
    }
Exemplo n.º 2
0
    public static void ParseBinValues(BinaryReader br, GridData grid)
    {
        // Allocate grid memory
        grid.InitGridValues(false);

        byte[] bytes = null;

        // Read values
        PatchDataIO.ReadArray(br, ref bytes, grid.values, 4);

        // Read if it has values mask
        var withMask = br.ReadBoolean();

        if (withMask)
        {
            grid.CreateMaskBuffer();

            // Read values mask
            PatchDataIO.ReadArray(br, ref bytes, grid.valuesMask);
        }

        // Read distribution values
        var count = br.ReadByte();

        if (count > 0)
        {
            int[] distributionValues = new int[count];
            PatchDataIO.ReadArray(br, ref bytes, distributionValues, 4);

            // Read max distribution value
            int maxDistributionValue = br.ReadInt32();
            grid.SetDistribution(distributionValues, maxDistributionValue);
        }
    }