Example #1
0
        public static int GetComponentCountFromAttributeDataType(LASPointAttributeDataType dataType)
        {
            if (!Enum.IsDefined(typeof(LASPointAttributeDataType), dataType) || dataType == LASPointAttributeDataType.Undocumented)
            {
                return(1);
            }

            return(((int)dataType - 1) / 10 + 1);
        }
Example #2
0
        public LASPointAttributeBase(string name, LASPointAttributeDataType dataType, ulong[] noData, ulong[] min, ulong[] max, double[] scale, double[] offset, string description)
        {
            m_dataType = dataType;
            m_name     = name;

            m_noData = noData;
            m_min    = min;
            m_max    = max;

            m_scale  = scale;
            m_offset = offset;

            m_description = description;

            m_type       = LASPointExtraBytes.GetTypeFromAttributeDataType(m_dataType);
            m_components = LASPointExtraBytes.GetComponentCountFromAttributeDataType(m_dataType);

            // todo: handle unknown format
            m_typeSize = (m_type != null) ? SupportedType.GetSize(m_type) : 0;            // m_options;
            m_size     = m_typeSize * m_components;
        }
Example #3
0
        public LASPointExtraBytes(BinaryReader reader)
        {
            reader.ReadBytes(2);

            m_dataType = (LASPointAttributeDataType)reader.ReadByte();
            m_options = reader.ReadByte();
            m_name = reader.ReadBytes(32).ToAsciiString();

            reader.ReadBytes(4);

            m_noData = reader.ReadUInt64Array(3);
            m_min = reader.ReadUInt64Array(3);
            m_max = reader.ReadUInt64Array(3);

            m_scale = reader.ReadDoubleArray(3);
            m_offset = reader.ReadDoubleArray(3);

            m_description = reader.ReadBytes(32).ToAsciiString();

            m_type = GetTypeFromAttributeDataType(m_dataType);
            m_components = GetComponentCountFromAttributeDataType(m_dataType);

            m_typeSize = (m_type != null) ? SupportedType.GetSize(m_type) : m_options;
        }
Example #4
0
        public static Type GetTypeFromAttributeDataType(LASPointAttributeDataType dataType)
        {
            // return the underlying type, even if the actual data is an array

            if (!Enum.IsDefined(typeof(LASPointAttributeDataType), dataType) || dataType == LASPointAttributeDataType.Undocumented)
            {
                return(null);
            }

            var dataTypeIndex = (LASPointAttributeDataType)((int)dataType % 10);

            switch (dataTypeIndex)
            {
            case LASPointAttributeDataType.Byte:   return(typeof(Byte));

            case LASPointAttributeDataType.SByte:  return(typeof(SByte));

            case LASPointAttributeDataType.UShort: return(typeof(UInt16));

            case LASPointAttributeDataType.Short:  return(typeof(Int16));

            case LASPointAttributeDataType.UInt:   return(typeof(UInt32));

            case LASPointAttributeDataType.Int:    return(typeof(Int32));

            case LASPointAttributeDataType.ULong:  return(typeof(UInt64));

            case LASPointAttributeDataType.Long:   return(typeof(Int64));

            case LASPointAttributeDataType.Single: return(typeof(Single));

            case LASPointAttributeDataType.Double: return(typeof(Double));
            }

            return(null);
        }
Example #5
0
        public LASPointExtraBytes(BinaryReader reader)
        {
            reader.ReadBytes(2);

            m_dataType = (LASPointAttributeDataType)reader.ReadByte();
            m_options  = reader.ReadByte();
            m_name     = reader.ReadBytes(32).ToAsciiString();

            reader.ReadBytes(4);

            m_noData = reader.ReadUInt64Array(3);
            m_min    = reader.ReadUInt64Array(3);
            m_max    = reader.ReadUInt64Array(3);

            m_scale  = reader.ReadDoubleArray(3);
            m_offset = reader.ReadDoubleArray(3);

            m_description = reader.ReadBytes(32).ToAsciiString();

            m_type       = GetTypeFromAttributeDataType(m_dataType);
            m_components = GetComponentCountFromAttributeDataType(m_dataType);

            m_typeSize = (m_type != null) ? SupportedType.GetSize(m_type) : m_options;
        }
Example #6
0
        public static Type GetTypeFromAttributeDataType(LASPointAttributeDataType dataType)
        {
            // return the underlying type, even if the actual data is an array

            if (!Enum.IsDefined(typeof(LASPointAttributeDataType), dataType) || dataType == LASPointAttributeDataType.Undocumented)
                return null;

            var dataTypeIndex = (LASPointAttributeDataType)((int)dataType % 10);
            switch (dataTypeIndex)
            {
                case LASPointAttributeDataType.Byte:   return typeof(Byte);
                case LASPointAttributeDataType.SByte:  return typeof(SByte);
                case LASPointAttributeDataType.UShort: return typeof(UInt16);
                case LASPointAttributeDataType.Short:  return typeof(Int16);
                case LASPointAttributeDataType.UInt:   return typeof(UInt32);
                case LASPointAttributeDataType.Int:    return typeof(Int32);
                case LASPointAttributeDataType.ULong:  return typeof(UInt64);
                case LASPointAttributeDataType.Long:   return typeof(Int64);
                case LASPointAttributeDataType.Single: return typeof(Single);
                case LASPointAttributeDataType.Double: return typeof(Double);
            }

            return null;
        }
Example #7
0
        public static int GetComponentCountFromAttributeDataType(LASPointAttributeDataType dataType)
        {
            if (!Enum.IsDefined(typeof(LASPointAttributeDataType), dataType) || dataType == LASPointAttributeDataType.Undocumented)
                return 1;

            return ((int)dataType - 1) / 10 + 1;
        }