Notice: If you are member of any public project or group, please make sure that your GitLab username is not the same as the LRZ identifier/Kennung (see https://gitlab.lrz.de/profile/account). Please change your username if necessary. For more information see the section "Public projects / Öffentliche Projekte" at https://doku.lrz.de/display/PUBLIC/GitLab . Thank you!

Commit 22ef73e9 authored by Jakob Weiss's avatar Jakob Weiss

Image representation adapted to cope with new API

Only minimum necessary changes to get image representations to work, no real writable representations.
parent cd8768b5
......@@ -56,12 +56,11 @@ namespace campvis {
*/
ScopedRepresentation(const DataContainer& dc, const std::string& name, bool silent = false)
: dh(dc.getData(name))
, data(0)
, representation(0)
, data(dh, silent)
, representation(nullptr)
{
if (dh.getData() != 0) {
data = dynamic_cast<const ImageData*>(dh.getData());
if (data != 0) {
if (dh) {
if (data != nullptr) {
representation = data->getRepresentation<T>();
}
else {
......@@ -69,8 +68,8 @@ namespace campvis {
LDEBUGC("CAMPVis.core.ScopedTypedData", "Found DataHandle with id '" << name << "', but it is of wrong type (" << typeid(*dh.getData()).name() << " instead of " << typeid(T).name() << ").");
}
if (data == 0 || representation == 0) {
dh = DataHandle(0);
if (data == nullptr || representation == nullptr) {
dh = DataHandle(nullptr);
}
}
else {
......@@ -85,16 +84,15 @@ namespace campvis {
*/
ScopedRepresentation(DataHandle dataHandle)
: dh(dataHandle)
, data(0)
, representation(0)
, data(dh)
, representation(nullptr)
{
if (dh.getData() != 0) {
data = dynamic_cast<const ImageData*>(dh.getData());
if (data != 0) {
if (dh) {
if (data != nullptr) {
representation = data->getRepresentation<T>();
}
if (data == 0 || representation == 0) {
dh = DataHandle(0);
if (data == nullptr || representation == nullptr) {
dh = DataHandle(nullptr);
}
}
};
......@@ -129,7 +127,7 @@ namespace campvis {
* Returns the parent ImageData of this image representation.
* \return data
*/
const ImageData* getImageData() const {
const ScopedTypedData<ImageData>& getImageData() const {
return data;
}
......@@ -140,7 +138,7 @@ namespace campvis {
ScopedRepresentation& operator=(const ScopedRepresentation& rhs);
DataHandle dh; ///< DataHandle
const ImageData* data; ///< strongly-typed pointer to data, may be 0
ScopedTypedData<ImageData> data;///< strongly-typed pointer to data, may be 0
const T* representation; ///< strongly-typed pointer to the image representation, may be 0
};
......
......@@ -62,12 +62,11 @@ namespace campvis {
*/
ScopedRepresentation(const DataContainer& dc, const std::string& name, bool silent = false)
: dh(dc.getData(name))
, data(0)
, representation(0)
, data(dh)
, representation(nullptr)
{
if (dh.getData() != 0) {
data = dynamic_cast<const ImageData*>(dh.getData());
if (data != 0) {
if (dh) {
if (data != nullptr) {
representation = data->getRepresentation< GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS> >();
}
else {
......@@ -75,8 +74,8 @@ namespace campvis {
LDEBUGC("CAMPVis.core.ScopedTypedData", "Found DataHandle with id '" << name << "', but it is of wrong type (" << typeid(*dh.getData()).name() << " instead of " << typeid(GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>).name() << ").");
}
if (data == 0 || representation == 0) {
dh = DataHandle(0);
if (data == nullptr || representation == nullptr) {
dh = DataHandle(nullptr);
}
}
else {
......@@ -91,16 +90,15 @@ namespace campvis {
*/
ScopedRepresentation(DataHandle dataHandle)
: dh(dataHandle)
, data(0)
, representation(0)
, data(dh)
, representation(nullptr)
{
if (dh.getData() != 0) {
data = dynamic_cast<const ImageData*>(dh.getData());
if (data != 0) {
if (dh.getData() != nullptr) {
if (data != nullptr) {
representation = data->getRepresentation<ThisType>();
}
if (data == 0 || representation == 0) {
dh = DataHandle(0);
if (data == nullptr || representation == nullptr) {
dh = DataHandle(nullptr);
}
}
};
......@@ -146,7 +144,7 @@ namespace campvis {
ScopedRepresentation& operator=(const ScopedRepresentation& rhs);
DataHandle dh; ///< DataHandle
const ImageData* data; ///< strongly-typed pointer to data, may be 0
ScopedTypedData<ImageData> data; ///< strongly-typed pointer to data, may be 0
const GenericImageRepresentationLocal<BASETYPE, NUMCHANNELS>* representation; ///< strongly-typed pointer to the image representation, may be 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