Commit d76bc1dc authored by Jørgen Lind's avatar Jørgen Lind
Browse files

FloatRange and some capitalization

parent 04e3d865
......@@ -166,6 +166,13 @@ void test_function()
}
bool DownloadJson(const std::string &region, const std::string& bucket, const std::string &key, std::string &json, Error &error)
{
if (bucket.empty() || key.empty())
{
error.code = -1;
error.string = "AWS Config error. Empty bucket or key";
return false;
}
initializeAWSSDK();
Aws::Client::ClientConfiguration config;
config.region = region.c_str();
......
This diff is collapsed.
......@@ -36,10 +36,10 @@ template <typename T>
struct IndexRegion
{
T min;
T Max;
T max;
IndexRegion() {}
IndexRegion(T min, T max) : Min(min), Max(max) {}
IndexRegion(T min, T max) : min(min), max(max) {}
};
class VolumeDataAccessor
......
......@@ -30,7 +30,7 @@ class VolumeDataAxisDescriptor
int m_numSamples;
const char *m_name;
const char *m_unit;
Range<float> m_coordinateRange;
FloatRange m_coordinateRange;
public:
VolumeDataAxisDescriptor() : m_numSamples(-1), m_name(nullptr), m_unit(nullptr), m_coordinateRange({0.0f, 0.0f}) {}
......@@ -43,14 +43,14 @@ public:
VolumeDataAxisDescriptor(int numSamples, const char *name, const char *unit, float coordinateMin, float coordinateMax)
: m_numSamples(numSamples), m_name(name), m_unit(unit), m_coordinateRange({coordinateMin, coordinateMax}) {}
VolumeDataAxisDescriptor(int numSamples, const char *name, const char *unit, const Range<float> &coordinateRange)
VolumeDataAxisDescriptor(int numSamples, const char *name, const char *unit, const FloatRange &coordinateRange)
: m_numSamples(numSamples), m_name(name), m_unit(unit), m_coordinateRange(coordinateRange) {}
int getNumSamples() const { return m_numSamples; }
const char *getName() const { return m_name; }
const char *getUnit() const { return m_unit; }
float getCoordinateMin() const { return m_coordinateRange.min; }
float getCoordinateMax() const { return m_coordinateRange.max; }
const Range<float> &getCoordinateRange() const { return m_coordinateRange; }
const FloatRange &getCoordinateRange() const { return m_coordinateRange; }
float getCoordinateStep() const { return (m_numSamples > 1) ? ((m_coordinateRange.max - m_coordinateRange.min) / (m_numSamples - 1)) : 0; }
/// Convert a sample index on this axis to a coordinate value
......
......@@ -66,7 +66,7 @@ private:
Components m_components;
const char *m_name;
const char *m_unit;
Range<float> m_valueRange;
FloatRange m_valueRange;
VolumeDataMapping m_mapping;
int m_mappedValueCount;
......@@ -183,7 +183,7 @@ public:
bool isUseZipForLosslessCompression() const { return (m_flags & NoLossyCompressionUseZip) == NoLossyCompressionUseZip; }
const char *getName() const { return m_name; }
const char *getUnit() const { return m_unit; }
const Range<float> &getValueRange() const { return m_valueRange; }
const FloatRange &getValueRange() const { return m_valueRange; }
float getValueRangeMin() const { return m_valueRange.min; }
float getValueRangeMax() const { return m_valueRange.max; }
......
......@@ -171,12 +171,12 @@ const VolumeDataChannelDescriptor & VolumeDataLayer::getVolumeDataChannelDescrip
return m_volumeDataLayout->getVolumeDataChannelDescriptor(m_channel);
}
Range<float> const &VolumeDataLayer::getValueRange() const
FloatRange const &VolumeDataLayer::getValueRange() const
{
return m_volumeDataLayout->getChannelValueRange(m_channel);
}
Range<float> const &VolumeDataLayer::getActualValueRange() const
FloatRange const &VolumeDataLayer::getActualValueRange() const
{
return m_volumeDataLayout->getChannelActualValueRange(m_channel);
}
......@@ -382,7 +382,7 @@ FloatVec2 VolumeDataLayer::getTextureScaleOffset(VolumeDataChannelDescriptor::Fo
return staticGetTextureScaleOffset(getValueRange(), getIntegerScale(), getIntegerOffset(), isUseNoValue(), getFormat(), eDataBlockFormat);
}
FloatVec2 VolumeDataLayer::staticGetTextureScaleOffset(const Range<float> &valueRange, float integerScale, float integerOffset, bool isUseNoValue, VolumeDataChannelDescriptor::Format originalFormat, VolumeDataChannelDescriptor::Format dataBlockFormat)
FloatVec2 VolumeDataLayer::staticGetTextureScaleOffset(const FloatRange &valueRange, float integerScale, float integerOffset, bool isUseNoValue, VolumeDataChannelDescriptor::Format originalFormat, VolumeDataChannelDescriptor::Format dataBlockFormat)
{
FloatVec2 scaleAndOffset= {1.0f, 0.0f};
......
......@@ -179,9 +179,9 @@ public:
const VolumeDataChannelDescriptor& getVolumeDataChannelDescriptor() const;
Range<float> const& getValueRange() const;
FloatRange const& getValueRange() const;
Range<float> const& getActualValueRange() const;
FloatRange const& getActualValueRange() const;
VolumeDataChannelDescriptor::Format getFormat() const;
......@@ -222,7 +222,7 @@ public:
void setProduceStatus(ProduceStatus produceStatus);
static FloatVec2 staticGetTextureScaleOffset(const Range<float> &valueRange, float integerScale, float integerOffset, bool isUseNoValue, VolumeDataChannelDescriptor::Format originalFormat, VolumeDataChannelDescriptor::Format dataBlockFormat);
static FloatVec2 staticGetTextureScaleOffset(const FloatRange &valueRange, float integerScale, float integerOffset, bool isUseNoValue, VolumeDataChannelDescriptor::Format originalFormat, VolumeDataChannelDescriptor::Format dataBlockFormat);
};
}
#endif //VOLUMEDATALAYER_H
......@@ -29,7 +29,7 @@ VolumeDataLayout::VolumeDataLayout(const VolumeDataLayoutDescriptor &layoutDescr
const std::vector<VolumeDataAxisDescriptor> &axisDescriptor,
const std::vector<VolumeDataChannelDescriptor> &volumeDataChannelDescriptor,
int32_t actualValueRangeChannel,
Range<float> const &actualValueRange,
FloatRange const &actualValueRange,
VolumeDataHash const &volumeDataHash,
CompressionMethod compressionMethod,
float compressionTolerance,
......@@ -90,7 +90,7 @@ VolumeDataLayer* VolumeDataLayout::getBaseLayer(DimensionGroup dimensionGroup, i
return volumeDataLayer;
}
Range<float> const& VolumeDataLayout::getChannelActualValueRange(int32_t channel) const
FloatRange const& VolumeDataLayout::getChannelActualValueRange(int32_t channel) const
{
return (channel == m_actualValueRangeChannel) ? m_actualValueRange : m_volumeDataChannelDescriptor[channel].getValueRange();
}
......@@ -100,7 +100,7 @@ int32_t VolumeDataLayout::getMappedValueCount(int32_t channel) const
return m_volumeDataChannelDescriptor[channel].getMappedValueCount();
}
Range<float> const& VolumeDataLayout::getDimensionRange(int32_t dimension) const
FloatRange const& VolumeDataLayout::getDimensionRange(int32_t dimension) const
{
assert(dimension >= 0 && dimension < m_dimensionality);
return m_dimensionRange[dimension];
......@@ -274,7 +274,7 @@ void VolumeDataLayout::setContentsHash(VolumeDataHash const &contentsHash)
m_contentsHash = contentsHash;
}
void VolumeDataLayout::setActualValueRange(int32_t actualValueRangeChannel, Range<float> const& actualValueRange)
void VolumeDataLayout::setActualValueRange(int32_t actualValueRangeChannel, FloatRange const& actualValueRange)
{
m_actualValueRangeChannel = actualValueRangeChannel;
m_actualValueRange = actualValueRange;
......
......@@ -53,7 +53,7 @@ private:
IndexArray m_dimensionNumSamples;
const char *m_dimensionName[Dimensionality_Max];
const char *m_dimensionUnit[Dimensionality_Max];
Range<float> m_dimensionRange[Dimensionality_Max];
FloatRange m_dimensionRange[Dimensionality_Max];
int32_t m_fullResolutionDimension;
public:
......@@ -61,7 +61,7 @@ public:
const std::vector<VolumeDataAxisDescriptor> &axisDescriptor,
const std::vector<VolumeDataChannelDescriptor> &volumeDataChannelDescriptor,
int32_t actualValueRangeChannel,
Range<float> const &actualValueRange,
FloatRange const &actualValueRange,
VolumeDataHash const &volumeDataHash,
CompressionMethod compressionMethod,
float compressionTolerance,
......@@ -71,14 +71,14 @@ public:
uint64_t getContentsHash() const { return m_contentsHash; }
VolumeDataLayer::VolumeDataLayerID addDataLayer(VolumeDataLayer *layer);
Range<float> const &getChannelValueRange(int32_t channel) const { assert(channel >= 0 && channel < getChannelCount()); return m_volumeDataChannelDescriptor[channel].getValueRange(); }
FloatRange const &getChannelValueRange(int32_t channel) const { assert(channel >= 0 && channel < getChannelCount()); return m_volumeDataChannelDescriptor[channel].getValueRange(); }
Range<float> const &getChannelActualValueRange(int32_t channel) const;
FloatRange const &getChannelActualValueRange(int32_t channel) const;
//TODO SHOULD THIS BE REMOVED
int32_t getMappedValueCount(int32_t channel) const;
Range<float> const &getDimensionRange(int32_t dimension) const;
FloatRange const &getDimensionRange(int32_t dimension) const;
VolumeDataLayer *getVolumeDataLayerFromID(VolumeDataLayer::VolumeDataLayerID volumeDataLayerID) const;
VolumeDataLayer *getVolumeDataLayerFromID(VolumeDataLayer::VolumeDataLayerID volumeDataLayerID) { return const_cast<VolumeDataLayer *>(const_cast<const VolumeDataLayout *>(this)->getVolumeDataLayerFromID(volumeDataLayerID)); }
......@@ -116,12 +116,12 @@ public:
virtual VolumeDataChannelDescriptor::Components getChannelComponents(int32_t channel) const { assert(channel >= 0 && channel < getChannelCount()); return m_volumeDataChannelDescriptor[channel].getComponents(); }
virtual const const char *getChannelName(int32_t channel) const { assert(channel >= 0 && channel < getChannelCount()); return m_volumeDataChannelDescriptor[channel].getName(); }
virtual const char *getChannelName(int32_t channel) const { assert(channel >= 0 && channel < getChannelCount()); return m_volumeDataChannelDescriptor[channel].getName(); }
virtual float getChannelValueRangeMin(int32_t channel) const { return getChannelValueRange(channel).min; }
virtual float getChannelValueRangeMax(int32_t channel) const { return getChannelValueRange(channel).max; }
virtual const const char *getChannelUnit(int32_t channel) const { assert(channel >= 0 && channel < getChannelCount()); return m_volumeDataChannelDescriptor[channel].getUnit(); }
virtual const char *getChannelUnit(int32_t channel) const { assert(channel >= 0 && channel < getChannelCount()); return m_volumeDataChannelDescriptor[channel].getUnit(); }
virtual bool isChannelDiscrete(int32_t channel) const { assert(channel >= 0 && channel < getChannelCount()); return m_volumeDataChannelDescriptor[channel].isDiscrete(); }
virtual bool isChannelRenderable(int32_t channel) const { assert(channel >= 0 && channel < getChannelCount()); return m_volumeDataChannelDescriptor[channel].isRenderable(); }
......@@ -150,7 +150,7 @@ public:
// Mutators
void setContentsHash(VolumeDataHash const &contentsHash);
void setActualValueRange(int32_t actualValueRangeChannel, Range<float> const &actualValueRange); // This should probably be implemented with VDSMetadata
void setActualValueRange(int32_t actualValueRangeChannel, FloatRange const &actualValueRange); // This should probably be implemented with VDSMetadata
void createRenderLayers(DimensionGroup dimensions, int32_t brickSize, int32_t physicalLodLevels); //-> TODO: rename at some point
......
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