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 ceaff5fb authored by Jakob Weiss's avatar Jakob Weiss

Necessary changes to get the default modules to build again

parent 22ef73e9
......@@ -194,8 +194,8 @@ namespace campvis {
break;
// gather image
cgtAssert(dynamic_cast<const ImageData*>(_textures[index].getData()), "Found sth. else than ImageData in render texture vector. This should not happen!");
const ImageData* id = static_cast<const ImageData*>(_textures[index].getData());
cgtAssert(_textures[index].getData<ImageData>(), "Found sth. else than ImageData in render texture vector. This should not happen!");
auto id = _textures[index].getData<ImageData>();
// compute transformation matrices
float renderTargetRatio = static_cast<float>(_quadSize.x) / static_cast<float>(_quadSize.y);
......@@ -281,7 +281,7 @@ namespace campvis {
if (texIndx < 0 || texIndx >= static_cast<int>(_textures.size()))
return;
const ImageData* id = static_cast<const ImageData*>(_textures[texIndx].getData());
auto id = _textures[texIndx].getData<ImageData>();
const cgt::Texture* tex = id->getRepresentation<ImageRepresentationGL>()->getTexture();
const ImageRepresentationLocal* localRep = id->getRepresentation<ImageRepresentationLocal>();
cgt::svec2 imageSize = id->getSize().xy();
......@@ -394,13 +394,13 @@ namespace campvis {
p_viewportSize.setValue(cgt::ivec2(width(), height()));
for (std::map<QString, QtDataHandle>::iterator it = _handles.begin(); it != _handles.end(); ++it) {
if (const ImageData* img = dynamic_cast<const ImageData*>(it->second.getData())) {
if (auto img = it->second.getData<ImageData>()) {
if (const ImageRepresentationGL* imgGL = img->getRepresentation<ImageRepresentationGL>()) {
_textures.push_back(it->second);
maxSlices = std::max(maxSlices, imgGL->getTexture()->getDimensions().z);
}
}
else if (const RenderData* rd = dynamic_cast<const RenderData*>(it->second.getData())) {
else if (auto rd = it->second.getData<RenderData>()) {
for (size_t i = 0; i < rd->getNumColorTextures(); ++i) {
const ImageRepresentationGL* imgGL = rd->getColorTexture(i)->getRepresentation<ImageRepresentationGL>();
if (imgGL) {
......@@ -415,7 +415,7 @@ namespace campvis {
}
}
else if (const GeometryData* gd = dynamic_cast<const GeometryData*>(it->second.getData())) {
else if (auto gd = it->second.getData<GeometryData>()) {
std::string name = it->first.toStdString();
// copy geometry over to local
......@@ -481,7 +481,7 @@ namespace campvis {
// check whether we have to render geometries
cgt::Bounds unionBounds;
for (std::map<QString, QtDataHandle>::iterator it = _handles.begin(); it != _handles.end(); ++it) {
if (const GeometryData* gd = dynamic_cast<const GeometryData*>(it->second.getData())) {
if (auto gd = it->second.getData<GeometryData>()) {
unionBounds.addVolume(gd->getWorldBounds());
}
}
......
......@@ -260,7 +260,7 @@ namespace campvis {
QModelIndex idxName = index->sibling(index->row(), 0);
// only consider non-empty DataHandles
if (handle.getData() != 0) {
if (handle) {
handles.push_back(std::make_pair(idxName.data(Qt::DisplayRole).toString(), handle));
_localFootprint += handle.getData()->getLocalMemoryFootprint();
_videoFootprint += handle.getData()->getVideoMemoryFootprint();
......@@ -272,7 +272,7 @@ namespace campvis {
_lblName->setText("Name: " + handles.front().first);
_lblTimestamp->setText("Timestamp: " + QString::number(handles.front().second.getTimestamp()));
if (const ImageData* tester = dynamic_cast<const ImageData*>(handles.front().second.getData())) {
if (auto tester = handles.front().second.getData<ImageData>()) {
_canvas->p_transferFunction.setImageHandle(handles.front().second);
_lblNumChannels->setText(tr("Number of Channels: ") + QString::number(tester->getNumChannels()));
......@@ -294,7 +294,7 @@ namespace campvis {
_canvas->p_renderAChannel.setVisible(true);
_canvas->p_geometryRendererProperties.setVisible(false);
}
else if (const GeometryData* tester = dynamic_cast<const GeometryData*>(handles.front().second.getData())) {
else if (auto tester = handles.front().second.getData<GeometryData>()) {
_lblSize->setText(tr("Size: n/a"));
_lblNumChannels->setText(tr("Number of Channels: n/a"));
......@@ -310,7 +310,7 @@ namespace campvis {
_canvas->p_renderAChannel.setVisible(false);
_canvas->p_geometryRendererProperties.setVisible(true);
}
else if (const RenderData* tester = dynamic_cast<const RenderData*>(handles.front().second.getData())) {
else if (auto tester = handles.front().second.getData<RenderData>()) {
const ImageData* id = tester->getNumColorTextures() > 0 ? tester->getColorTexture() : tester->getDepthTexture();
if (id != 0) {
_lblNumChannels->setText(tr("Number of Channels: ") + QString::number(id->getNumChannels()));
......@@ -445,7 +445,7 @@ namespace campvis {
// only consider non-empty DataHandles that are ImageData and have render target representations
if (handle.getData() != 0) {
if (dynamic_cast<const ImageData*>(handle.getData()) && dynamic_cast<const ImageData*>(handle.getData())->getDimensionality() == 3) {
if (handle.getData<ImageData>() && handle.getData<ImageData>()->getDimensionality() == 3) {
QString dialogCaption = "Export " + name + " as MHD Image";
QString directory = tr("");
const QString fileFilter = tr("*.mhd;;MHD images (*.mhd)");
......@@ -458,7 +458,7 @@ namespace campvis {
writer.invalidate(AbstractProcessor::INVALID_RESULT);
writer.process(*_dataContainer);
}
else if (dynamic_cast<const ImageData*>(handle.getData()) || dynamic_cast<const RenderData*>(handle.getData())) {
else if (handle.getData<ImageData>() || handle.getData<RenderData>()) {
QString dialogCaption = "Export " + name + " as Image";
QString directory = tr("");
const QString fileFilter = tr("*.png;;PNG images (*.png)");
......@@ -484,10 +484,10 @@ namespace campvis {
// get the ImageData object (either directly or from the RenderData)
const ImageData* id = 0;
if (const RenderData* tester = dynamic_cast<const RenderData*>(handle.getData())) {
if (auto tester = handle.getData<RenderData>()) {
id = tester->getColorTexture(0);
}
else if (const ImageData* tester = dynamic_cast<const ImageData*>(handle.getData())) {
else if (auto tester = handle.getData<ImageData>()) {
id = tester;
}
else {
......
......@@ -153,7 +153,7 @@ namespace campvis {
DataHandle dh = prop->getImageHandle();
if (dh.getData() != 0) {
const ImageRepresentationLocal* idl = static_cast<const ImageData*>(dh.getData())->getRepresentation<ImageRepresentationLocal>();
const ImageRepresentationLocal* idl = dh.getData<ImageData>()->getRepresentation<ImageRepresentationLocal>();
if (idl != 0) {
Interval<float> intensityInterval = idl->getNormalizedIntensityRange();
tf->setIntensityDomain(cgt::vec2(intensityInterval.getLeft(), intensityInterval.getRight()));
......
......@@ -49,14 +49,14 @@ namespace campvis {
size_t ImageSeries::getLocalMemoryFootprint() const {
size_t toReturn = sizeof(DataHandle) * _images.capacity();
for (size_t i = 0; i < _images.size(); ++i)
toReturn += static_cast<const ImageData*>(_images[i].getData())->getLocalMemoryFootprint();
toReturn += _images[i].getData()->getLocalMemoryFootprint();
return toReturn;
}
size_t ImageSeries::getVideoMemoryFootprint() const {
size_t toReturn = 0;
for (size_t i = 0; i < _images.size(); ++i)
toReturn += static_cast<const ImageData*>(_images[i].getData())->getVideoMemoryFootprint();
toReturn += _images[i].getData()->getVideoMemoryFootprint();
return toReturn;
}
......@@ -65,7 +65,7 @@ namespace campvis {
}
void ImageSeries::addImage(DataHandle dh) {
cgtAssert(dynamic_cast<const ImageData*>(dh.getData()) != 0, "DataHandle must contain ImageData!");
cgtAssert(dh.getData<ImageData>() != 0, "DataHandle must contain ImageData!");
_images.push_back(dh);
}
......@@ -85,7 +85,7 @@ namespace campvis {
cgt::Bounds ImageSeries::getWorldBounds() const {
cgt::Bounds b;
for (size_t i = 0; i < _images.size(); ++i) {
b.addVolume(static_cast<const ImageData*>(_images[i].getData())->getWorldBounds());
b.addVolume(_images[i].getData<ImageData>()->getWorldBounds());
}
return b;
}
......
......@@ -101,12 +101,12 @@ namespace campvis {
return _colorTextures.size();
}
const ImageData* RenderData::getColorTexture(size_t index /*= 0*/) const {
ScopedTypedData<ImageData> RenderData::getColorTexture(size_t index /*= 0*/) const {
cgtAssert(index < _colorTextures.size(), "Index out of bounds.");
if (index >= _colorTextures.size())
return 0;
return ScopedTypedData<ImageData>(DataHandle(nullptr), true);
return static_cast<const ImageData*>(_colorTextures[index].getData());
return _colorTextures[index].getData<ImageData>();
}
campvis::DataHandle RenderData::getColorDataHandle(size_t index /*= 0*/) const {
......@@ -121,12 +121,10 @@ namespace campvis {
return _depthTexture.getData() != 0;
}
const ImageData* RenderData::getDepthTexture() const {
const AbstractData* d = _depthTexture.getData();
if (d == 0)
return 0;
ScopedTypedData<ImageData> RenderData::getDepthTexture() const {
auto d = _depthTexture.getData<ImageData>();
return static_cast<const ImageData*>(d);
return d;
}
campvis::DataHandle RenderData::getDepthDataHandle() const {
......@@ -146,7 +144,7 @@ namespace campvis {
if (index >= _colorTextures.size())
return;
const ImageData* id = static_cast<const ImageData*>(_colorTextures[index].getData());
auto id = _colorTextures[index].getData<ImageData>();
cgtAssert(id != 0, "WTF, color texture with 0 pointer?!");
const ImageRepresentationGL* rep = id->getRepresentation<ImageRepresentationGL>(true);
......@@ -158,7 +156,7 @@ namespace campvis {
if (_depthTexture.getData() == 0)
return;
const ImageData* id = static_cast<const ImageData*>(_depthTexture.getData());
const ImageData* id = _depthTexture.getData<ImageData>();
const ImageRepresentationGL* rep = id->getRepresentation<ImageRepresentationGL>(true);
rep->bind(shader, depthTexUnit, depthTexUniform, texParamsUniform);
}
......
......@@ -89,7 +89,7 @@ namespace campvis {
* \param index Index of the color texture to return.
* \return _colorTextures[index], 0 if index out of bounds.
*/
const ImageData* getColorTexture(size_t index = 0) const;
ScopedTypedData<ImageData> getColorTexture(size_t index = 0) const;
/**
* Gets the DataHandle with the color texture in this RenderData.
......@@ -109,7 +109,7 @@ namespace campvis {
* Returns 0 if no depth texture is present.
* \return _depthTexture, may be 0.
*/
const ImageData* getDepthTexture() const;
ScopedTypedData<ImageData> getDepthTexture() const;
/**
* Gets the DataHandle with the depth texture in this RenderData, if present.
......
......@@ -64,11 +64,10 @@ namespace campvis {
// try get Data
DataHandle dh = _pipeline->getDataContainer().getData(_pipeline->getRenderTargetID());
const RenderData* rd = nullptr;
ScopedTypedData<RenderData> rd(dh);
const ImageRepresentationGL* repGL = nullptr;
if (dh.getData() != nullptr) {
rd = dynamic_cast<const RenderData*>(dh.getData());
if (const ImageData* id = dynamic_cast<const ImageData*>(dh.getData()))
if (rd != nullptr) {
if (auto id = dh.getData<ImageData>())
repGL = id->getRepresentation<ImageRepresentationGL>();
}
......
......@@ -162,7 +162,7 @@ namespace campvis {
// we need an image as reference
if (_currentImage.getData() != nullptr) {
if (const ImageData* id = static_cast<const ImageData*>(_currentImage.getData())) {
if (auto id = _currentImage.getData<ImageData>()) {
// we only handle mouse events
if (cgt::MouseEvent* me = dynamic_cast<cgt::MouseEvent*>(e)) {
......
......@@ -98,11 +98,11 @@ namespace campvis {
void TransferFunctionProperty::setImageHandle(DataHandle imageHandle) {
cgtAssert(
imageHandle.getData() == 0 || dynamic_cast<const ImageData*>(imageHandle.getData()) != 0,
!imageHandle || imageHandle.getData<ImageData>(),
"The data in the image handle must either be 0 or point to a valid ImageData object!");
if (_autoFitWindowToData && imageHandle.getData() != 0) {
if (const ImageData* id = dynamic_cast<const ImageData*>(imageHandle.getData())) {
if (auto id = imageHandle.getData<ImageData>()) {
const ImageRepresentationLocal* localRep = id->getRepresentation<ImageRepresentationLocal>();
if (localRep != 0) {
const Interval<float>& ii = localRep->getNormalizedIntensityRange();
......
......@@ -175,7 +175,7 @@ namespace campvis {
std::vector<int> toReturn = std::vector<int>(p_histogram.getPredicateHistogram()->getPredicates().size(), 0);
if (_bitmaskHandle.getData() != nullptr) {
const ImageData* id = static_cast<const ImageData*>(_bitmaskHandle.getData());
auto id = _bitmaskHandle.getData<ImageData>();
if (const GenericImageRepresentationLocal<BitmaskType, 1>* repLocal = id->getRepresentation< GenericImageRepresentationLocal<BitmaskType, 1> >()) {
// traverse all voxels and for each bitmask check each bit whether its set
for (size_t i = 0; i < voxels.size(); ++i) {
......
......@@ -59,12 +59,11 @@ namespace campvis {
void DevilImageWriter::updateResult(DataContainer& data) {
// try get Data
DataHandle dh = data.getData(p_inputImage.getValue());
const RenderData* rd = nullptr;
ScopedTypedData<RenderData> rd(dh);
const ImageRepresentationLocal* repLocal = nullptr;
if (dh.getData() != nullptr) {
rd = dynamic_cast<const RenderData*>(dh.getData());
if (const ImageData* id = dynamic_cast<const ImageData*>(dh.getData()))
if (dh) {
if (auto id = dh.getData<ImageData>())
repLocal = id->getRepresentation<ImageRepresentationLocal>();
std::string filename = p_url.getValue();
......
......@@ -235,8 +235,8 @@ namespace campvis {
const GenericImageRepresentationLocal<float, 3>* evalRep = 0;
const GenericImageRepresentationLocal<float, 9>* evecRep = 0;
if (_eigenvalues.getData() != 0 && _eigenvectors.getData() != 0) {
evalRep = static_cast<const ImageData*>(_eigenvalues.getData())->getRepresentation< GenericImageRepresentationLocal<float, 3> >(false);
evecRep = static_cast<const ImageData*>(_eigenvectors.getData())->getRepresentation< GenericImageRepresentationLocal<float, 9> >(false);
evalRep = _eigenvalues.getData<ImageData>()->getRepresentation< GenericImageRepresentationLocal<float, 3> >(false);
evecRep = _eigenvectors.getData<ImageData>()->getRepresentation< GenericImageRepresentationLocal<float, 9> >(false);
}
if (evalRep == 0 || evecRep == 0) {
LERROR("Could not compute output, no eigensystem present.");
......
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