00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef OST_GFX_MAP_ISO_HH
00020 #define OST_GFX_MAP_ISO_HH
00021
00022
00023
00024
00025
00026 #include <boost/shared_ptr.hpp>
00027
00028 #include <ost/img/map.hh>
00029 #include <ost/img/alg/stat.hh>
00030 #include <ost/img/alg/histogram.hh>
00031
00032 #include <ost/gfx/impl/map_octree.hh>
00033 #include "gfx_object.hh"
00034 #include "map_iso_prop.hh"
00035
00036 namespace ost { namespace gfx {
00037
00038 enum MapIsoType {
00039 ORIGINAL_MAP,
00040 DOWNSAMPLED_MAP
00041 };
00042
00043 class MapIso;
00044 typedef boost::shared_ptr<MapIso> MapIsoP;
00045
00052 class DLLEXPORT_OST_GFX MapIso: public GfxObj {
00053 public:
00054 MapIso(const String& name, const img::MapHandle& mh,float level);
00055
00056 MapIso(const String& name, const img::MapHandle& mh,
00057 float level, uint a);
00058
00059 virtual geom::AlignedCuboid GetBoundingBox() const;
00060
00061 virtual geom::Vec3 GetCenter() const;
00062
00063 virtual void CustomRenderGL(RenderPass pass);
00064
00065 virtual void CustomRenderPov(PovState& pov);
00066
00067 virtual void OnInput(const InputEvent& e);
00068
00069 virtual void OnRenderModeChange();
00070
00071 void Rebuild();
00072
00076 void SetLevel(float l);
00077
00078 float GetMinLevel() const;
00079 float GetMaxLevel() const;
00080
00082 float GetLevel() const;
00083
00085 float GetMean() const;
00086
00088 float GetStdDev() const;
00089
00090
00092 std::vector<int> GetHistogram() const;
00093
00095 void SetHistogramBinCount(int count);
00096
00098 int GetHistogramBinCount() const;
00099
00101
00102
00103 img::ImageHandle& GetMap();
00104
00106
00107
00108 img::ImageHandle& GetOriginalMap();
00109
00111
00112
00113 img::ImageHandle& GetDownsampledMap();
00114
00116 void ShowDownsampledMap();
00117
00119 void ShowOriginalMap();
00120
00122 bool IsDownsampledMapAvailable() const ;
00123
00125 MapIsoType GetShownMapType() const;
00126
00131 void SetColor(const Color& color)
00132 {
00133 color_=color;
00134 this->FlagRebuild();
00135 }
00138 const Color& GetColor() const { return color_; }
00139 void SetNSF(float smoothf);
00140 void SetDebugOctree(bool flag) { debug_octree_=flag; }
00141
00143 void MakeOctreeDirty();
00144
00146 bool IfOctreeDirty() const;
00147
00148 protected:
00149 void UpdateRenderParams();
00150 void CalculateStat() const;
00151 void CalculateHistogram() const;
00152 virtual void CustomPreRenderGL(bool flag);
00153 static img::ImageHandle DownsampleMap(const img::ImageHandle& mh);
00154
00155 private:
00156 img::MapHandle original_mh_;
00157 img::MapHandle downsampled_mh_;
00158 img::MapHandle mh_;
00159 impl::MapOctree octree_;
00160 mutable img::alg::Stat stat_;
00161 mutable bool stat_calculated_;
00162 mutable img::alg::Histogram histogram_;
00163 mutable bool histogram_calculated_;
00164 int histogram_bin_count_;
00165 float level_;
00166 bool normals_calculated_;
00167 uint alg_;
00168 float smoothf_;
00169 float min_;
00170 float max_;
00171 float std_dev_;
00172 float min_max_;
00173 bool debug_octree_;
00174 Color color_;
00175 bool dirty_octree_;
00176 };
00177
00178 }}
00179
00180 #endif