From 40eeab9c924f0fdbac13f33c72f39613d093316e Mon Sep 17 00:00:00 2001 From: valerio <valerio@5a81b35b-ba03-0410-adc8-b2c5c5119f08> Date: Fri, 7 May 2010 09:45:39 +0000 Subject: [PATCH] Fixes to map downsampling git-svn-id: https://dng.biozentrum.unibas.ch/svn/openstructure/trunk@2200 5a81b35b-ba03-0410-adc8-b2c5c5119f08 --- modules/gfx/pymod/export_map.cc | 2 +- modules/gfx/src/map_iso.cc | 14 +++++--------- modules/gfx/src/map_iso.hh | 4 ++-- modules/gui/src/scene_win/context_menu.cc | 3 ++- 4 files changed, 10 insertions(+), 13 deletions(-) diff --git a/modules/gfx/pymod/export_map.cc b/modules/gfx/pymod/export_map.cc index 966ee0d8c..f4957efb4 100644 --- a/modules/gfx/pymod/export_map.cc +++ b/modules/gfx/pymod/export_map.cc @@ -69,7 +69,7 @@ void export_Map() .def("IsDownsampledMapAvailable", &MapIso::IsDownsampledMapAvailable) .def("GetShownMapType", &MapIso::GetShownMapType) .def("MakeOctreeDirty", &MapIso::MakeOctreeDirty) - .def("IsOctreeDirty", &MapIso::IsOctreeDirty) + .def("IfOctreeDirty", &MapIso::IfOctreeDirty) .def("Rebuild", &MapIso::Rebuild) .def("SetNSF",&MapIso::SetNSF) .def("SetColor", &MapIso::SetColor) diff --git a/modules/gfx/src/map_iso.cc b/modules/gfx/src/map_iso.cc index 20fb4b8e8..9acb420c4 100644 --- a/modules/gfx/src/map_iso.cc +++ b/modules/gfx/src/map_iso.cc @@ -73,9 +73,6 @@ MapIso::MapIso(const String& name, const img::MapHandle& mh, float level): color_(Color::GREY) { // TODO replace with def mat for this gfx obj type - if (mh.IsFrequency() == true){ - throw Error("Error: Map not in real space. Cannot create of this map"); - } if (mh_ != original_mh_) { downsampled_mh_ = mh_; } @@ -105,10 +102,10 @@ MapIso::MapIso(const String& name, const img::MapHandle& mh, color_(Color::GREY) { // TODO replace with def mat for this gfx obj type - if (downsampled_mh_ == original_mh_) { - mh_ = original_mh_; - downsampled_mh_ = img::ImageHandle(); + if (mh_ != original_mh_) { + downsampled_mh_ = mh_; } + octree_.Initialize(); SetMatAmb(Color(0,0,0)); SetMatDiff(Color(1,1,1)); SetMatSpec(Color(0.1,0.1,0.1)); @@ -279,10 +276,9 @@ void MapIso::Rebuild() if (octree_.IsMapManageable(mh_) == false) { throw Error("Error: Map is too big for visualization"); } - if (IsOctreeDirty()==true) { + if (IfOctreeDirty()==true) { octree_.SetNewMap(mh_); octree_.Initialize(); - dirty_octree_=false; } va_.Clear(); va_.SetMode(0x2); @@ -380,7 +376,7 @@ MapIsoType MapIso::GetShownMapType() const return ret; } -bool MapIso::IsOctreeDirty() const +bool MapIso::IfOctreeDirty() const { return dirty_octree_; } diff --git a/modules/gfx/src/map_iso.hh b/modules/gfx/src/map_iso.hh index cf2481575..5e45bd82f 100644 --- a/modules/gfx/src/map_iso.hh +++ b/modules/gfx/src/map_iso.hh @@ -96,7 +96,7 @@ public: // that never goes out of scope, so I get a reference from here img::ImageHandle& GetDownsampledMap(); - /// \brief sets the donsampled map to active + /// \brief sets the donwsampled map to active void ShowDownsampledMap(); /// \brief sets the original map to active @@ -127,7 +127,7 @@ public: void MakeOctreeDirty(); /// \brief checks is the octree needs to be rebuilt - bool IsOctreeDirty() const; + bool IfOctreeDirty() const; protected: virtual void CustomPreRenderGL(bool flag); diff --git a/modules/gui/src/scene_win/context_menu.cc b/modules/gui/src/scene_win/context_menu.cc index 5734b6368..22a4b6b01 100644 --- a/modules/gui/src/scene_win/context_menu.cc +++ b/modules/gui/src/scene_win/context_menu.cc @@ -31,6 +31,7 @@ #if OST_IMG_ENABLED #include <ost/gfx/map_iso.hh> +#include <ost/dyn_cast.hh> #endif // OST_IMG_ENABLED #include "custom_part_node.hh" @@ -154,7 +155,7 @@ void ContextMenu::ShowMenu(const QPoint& pos) { flags &= ~MAP; } else { - gfx::MapIso* mapisop = dynamic_cast<gfx::MapIso*> (gfx_node.get()); + gfx::MapIsoP mapisop = dyn_cast<gfx::MapIso> (gfx_node); if (mapisop->GetShownMapType() == gfx::ORIGINAL_MAP){ flags &= ~MAP_DOWNSAMPLED; } else { -- GitLab