Commit c6ed24a5 authored by Morten Ofstad's avatar Morten Ofstad
Browse files

Changed Format enum to use '_' between the prefix (enum name) and the actual...

Changed Format enum to use '_' between the prefix (enum name) and the actual enumerated value. The reasoning is that this is intentionally not an 'enum class' and in this case the enum values are prefixed with the enum name which is made clear by the inclusion of the '_'. This change will match the coming changes to the JSON serialization.
parent c639390c
......@@ -42,25 +42,23 @@ public:
enum Format
{
FormatAny = -1, ///< The DataBlock can be in any format
Format1Bit, ///< data is in packed 1-bit format
FormatU8, ///< data is in unsigned 8 bit
FormatU16, ///< data is in unsigned 16 bit
FormatR32, ///< data is in 32 bit float
FormatU32, ///< data is in unsigned 32 bit
FormatR64, ///< data is in 64 bit double
FormatU64 ///< data is in unsigned 64 bit
Format_Any = -1, ///< The DataBlock can be in any format
Format_1Bit, ///< data is in packed 1-bit format
Format_U8, ///< data is in unsigned 8 bit
Format_U16, ///< data is in unsigned 16 bit
Format_R32, ///< data is in 32 bit float
Format_U32, ///< data is in unsigned 32 bit
Format_R64, ///< data is in 64 bit double
Format_U64 ///< data is in unsigned 64 bit
};
enum Components
{
Components_1 = 1,
Components_2 = 2,
Components_4 = 4,
ComponentsMax = Components_4
Components_4 = 4
};
private:
Format m_format;
Components m_components;
......@@ -81,7 +79,7 @@ private:
public:
VolumeDataChannelDescriptor()
: m_format(FormatAny), m_components(Components_1), m_name(nullptr), m_unit(nullptr), m_valueRange({0.0f,0.0f}), m_mapping(VolumeDataMapping::Direct), m_mappedValueCount(1), m_flags(Default), m_useNoValue(false), m_noValue(0.0f), m_integerScale(1.0f), m_integerOffset(0.0f) {}
: m_format(Format_Any), m_components(Components_1), m_name(nullptr), m_unit(nullptr), m_valueRange({0.0f,0.0f}), m_mapping(VolumeDataMapping::Direct), m_mappedValueCount(1), m_flags(Default), m_useNoValue(false), m_noValue(0.0f), m_integerScale(1.0f), m_integerOffset(0.0f) {}
/// The minimum constructor for a VolumeDataChannelDescriptor. This will use direct mapping, default flags, and no No Value
/// \param format the data format for this channel
......@@ -177,7 +175,7 @@ public:
Format getFormat() const { return m_format; }
Components getComponents() const { return m_components; }
bool isDiscrete() const { return (m_flags & DiscreteData) || m_format == Format1Bit; }
bool isDiscrete() const { return (m_flags & DiscreteData) || m_format == Format_1Bit; }
bool isRenderable() const { return !(m_flags & NotRenderable); }
bool isAllowLossyCompression() const { return !(m_flags & NoLossyCompression) && !isDiscrete(); }
bool isUseZipForLosslessCompression() const { return (m_flags & NoLossyCompressionUseZip) == NoLossyCompressionUseZip; }
......
......@@ -323,13 +323,13 @@ createChannelDescriptors(SEGYFileInfo const &fileInfo, OpenVDS::FloatRange const
channelDescriptors;
// Primary channel
channelDescriptors.push_back(OpenVDS::VolumeDataChannelDescriptor(OpenVDS::VolumeDataChannelDescriptor::Format::FormatR32, OpenVDS::VolumeDataChannelDescriptor::Components::Components_1, "Amplitude", "", valueRange.min, valueRange.max));
channelDescriptors.push_back(OpenVDS::VolumeDataChannelDescriptor(OpenVDS::VolumeDataChannelDescriptor::Format_R32, OpenVDS::VolumeDataChannelDescriptor::Components_1, "Amplitude", "", valueRange.min, valueRange.max));
// Trace defined flag
channelDescriptors.push_back(OpenVDS::VolumeDataChannelDescriptor(OpenVDS::VolumeDataChannelDescriptor::Format::FormatU8, OpenVDS::VolumeDataChannelDescriptor::Components::Components_1, "Trace", "", 0, 1, OpenVDS::VolumeDataMapping::PerTrace));
channelDescriptors.push_back(OpenVDS::VolumeDataChannelDescriptor(OpenVDS::VolumeDataChannelDescriptor::Format_U8, OpenVDS::VolumeDataChannelDescriptor::Components_1, "Trace", "", 0, 1, OpenVDS::VolumeDataMapping::PerTrace));
// SEG-Y trace headers
channelDescriptors.push_back(OpenVDS::VolumeDataChannelDescriptor(OpenVDS::VolumeDataChannelDescriptor::Format::FormatU8, OpenVDS::VolumeDataChannelDescriptor::Components::Components_1, "SEGYTraceHeaders", "", 0, 255, OpenVDS::VolumeDataMapping::PerTrace, SEGY::TraceHeaderSize, OpenVDS::VolumeDataChannelDescriptor::Flags::Default, 1.0f, 0.0f));
channelDescriptors.push_back(OpenVDS::VolumeDataChannelDescriptor(OpenVDS::VolumeDataChannelDescriptor::Format_U8, OpenVDS::VolumeDataChannelDescriptor::Components_1, "SEGYTraceHeaders", "", 0, 255, OpenVDS::VolumeDataMapping::PerTrace, SEGY::TraceHeaderSize, OpenVDS::VolumeDataChannelDescriptor::Flags::Default, 1.0f, 0.0f));
return channelDescriptors;
}
......
......@@ -242,31 +242,31 @@ static VolumeDataChannelDescriptor::Format convertToVoxelFormat(Json::Value cons
if(voxelFormatString == "HUEVOXELFORMAT_R32")
{
return VolumeDataChannelDescriptor::FormatR32;
return VolumeDataChannelDescriptor::Format_R32;
}
else if(voxelFormatString == "HUEVOXELFORMAT_R64")
{
return VolumeDataChannelDescriptor::FormatR64;
return VolumeDataChannelDescriptor::Format_R64;
}
else if(voxelFormatString == "HUEVOXELFORMAT_U8")
{
return VolumeDataChannelDescriptor::FormatU8;
return VolumeDataChannelDescriptor::Format_U8;
}
else if(voxelFormatString == "HUEVOXELFORMAT_U16")
{
return VolumeDataChannelDescriptor::FormatU16;
return VolumeDataChannelDescriptor::Format_U16;
}
else if(voxelFormatString == "HUEVOXELFORMAT_U32")
{
return VolumeDataChannelDescriptor::FormatU32;
return VolumeDataChannelDescriptor::Format_U32;
}
else if(voxelFormatString == "HUEVOXELFORMAT_U64")
{
return VolumeDataChannelDescriptor::FormatU64;
return VolumeDataChannelDescriptor::Format_U64;
}
else if(voxelFormatString == "HUEVOXELFORMAT_1BIT")
{
return VolumeDataChannelDescriptor::Format1Bit;
return VolumeDataChannelDescriptor::Format_1Bit;
}
throw Json::Exception("Illegal voxel format");
}
......
......@@ -199,7 +199,7 @@ uint64_t VolumeDataLayer::getFormatHash(VolumeDataChannelDescriptor::Format actu
{
VolumeDataChannelDescriptor const & volumeDataChannelDescriptor = m_volumeDataLayout->getVolumeDataChannelDescriptor(m_channel);
if(actualFormat == VolumeDataChannelDescriptor::FormatAny)
if(actualFormat == VolumeDataChannelDescriptor::Format_Any)
{
actualFormat = volumeDataChannelDescriptor.getFormat();
}
......@@ -208,15 +208,15 @@ uint64_t VolumeDataLayer::getFormatHash(VolumeDataChannelDescriptor::Format actu
hashCombiner.add(volumeDataChannelDescriptor.getComponents());
bool isConvertWithValueRange = (actualFormat == VolumeDataChannelDescriptor::FormatU8 || actualFormat == VolumeDataChannelDescriptor::FormatU16) &&
(volumeDataChannelDescriptor.getFormat() != VolumeDataChannelDescriptor::FormatU8 && volumeDataChannelDescriptor.getFormat() != VolumeDataChannelDescriptor::FormatU16);
bool isConvertWithValueRange = (actualFormat == VolumeDataChannelDescriptor::Format_U8 || actualFormat == VolumeDataChannelDescriptor::Format_U16) &&
(volumeDataChannelDescriptor.getFormat() != VolumeDataChannelDescriptor::Format_U8 && volumeDataChannelDescriptor.getFormat() != VolumeDataChannelDescriptor::Format_U16);
if(isConvertWithValueRange)
{
hashCombiner.add(volumeDataChannelDescriptor.getValueRange());
}
if(volumeDataChannelDescriptor.getFormat() == VolumeDataChannelDescriptor::FormatU8 || volumeDataChannelDescriptor.getFormat() == VolumeDataChannelDescriptor::FormatU16)
if(volumeDataChannelDescriptor.getFormat() == VolumeDataChannelDescriptor::Format_U8 || volumeDataChannelDescriptor.getFormat() == VolumeDataChannelDescriptor::Format_U16)
{
hashCombiner.add(volumeDataChannelDescriptor.getIntegerScale());
hashCombiner.add(volumeDataChannelDescriptor.getIntegerOffset());
......@@ -356,12 +356,12 @@ FloatVector2 VolumeDataLayer::getQuantizingScaleOffset(VolumeDataChannelDescript
FloatVector2 scaleAndOffset = {getIntegerScale(), getIntegerOffset()};
if (format == VolumeDataChannelDescriptor::FormatU8 || format == VolumeDataChannelDescriptor::FormatU16)
if (format == VolumeDataChannelDescriptor::Format_U8 || format == VolumeDataChannelDescriptor::Format_U16)
{
if ((layerFormat != VolumeDataChannelDescriptor::FormatU8 && layerFormat != VolumeDataChannelDescriptor::FormatU16) ||
(layerFormat == VolumeDataChannelDescriptor::FormatU16 && format == VolumeDataChannelDescriptor::FormatU8))
if ((layerFormat != VolumeDataChannelDescriptor::Format_U8 && layerFormat != VolumeDataChannelDescriptor::Format_U16) ||
(layerFormat == VolumeDataChannelDescriptor::Format_U16 && format == VolumeDataChannelDescriptor::Format_U8))
{
if (format == VolumeDataChannelDescriptor::FormatU8)
if (format == VolumeDataChannelDescriptor::Format_U8)
{
scaleAndOffset[0] = rangeSize(getValueRange()) / (isUseNoValue() ? 254.0f : 255.0f);
}
......@@ -385,14 +385,14 @@ FloatVector2 VolumeDataLayer::staticGetTextureScaleOffset(const FloatRange &valu
{
FloatVector2 scaleAndOffset= {1.0f, 0.0f};
if (dataBlockFormat == VolumeDataChannelDescriptor::FormatU8 || dataBlockFormat == VolumeDataChannelDescriptor::FormatU16)
if (dataBlockFormat == VolumeDataChannelDescriptor::Format_U8 || dataBlockFormat == VolumeDataChannelDescriptor::Format_U16)
{
if (originalFormat == VolumeDataChannelDescriptor::FormatU8)
if (originalFormat == VolumeDataChannelDescriptor::Format_U8)
{
scaleAndOffset[0] = integerScale * 255.0f;
scaleAndOffset[1] = integerOffset;
}
else if (originalFormat == VolumeDataChannelDescriptor::FormatU16 && dataBlockFormat != VolumeDataChannelDescriptor::FormatU8)
else if (originalFormat == VolumeDataChannelDescriptor::Format_U16 && dataBlockFormat != VolumeDataChannelDescriptor::Format_U8)
{
scaleAndOffset[0] = integerScale * 65535.0f;
scaleAndOffset[1] = integerOffset;
......@@ -404,11 +404,11 @@ FloatVector2 VolumeDataLayer::staticGetTextureScaleOffset(const FloatRange &valu
if (isUseNoValue)
{
if (dataBlockFormat == VolumeDataChannelDescriptor::FormatU8)
if (dataBlockFormat == VolumeDataChannelDescriptor::Format_U8)
{
scaleAndOffset[0] = scaleAndOffset[0] * 255.0f / 254.0f;
}
else if (dataBlockFormat == VolumeDataChannelDescriptor::FormatU16)
else if (dataBlockFormat == VolumeDataChannelDescriptor::Format_U16)
{
scaleAndOffset[0] = scaleAndOffset[0] * 65535.0f / 65534.0f;
}
......
......@@ -190,7 +190,7 @@ public:
bool isDiscrete() const;
uint64_t getFormatHash(VolumeDataChannelDescriptor::Format actualFormat = VolumeDataChannelDescriptor::FormatAny) const
uint64_t getFormatHash(VolumeDataChannelDescriptor::Format actualFormat = VolumeDataChannelDescriptor::Format_Any) const
{
return getFormatHash(actualFormat, false, 0);
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment