Hierarchical Edge Bundle 1.0
|
00001 #pragma once 00002 #include "View.h" 00003 #include <map> 00004 #include <boost/shared_ptr.hpp> 00005 00011 class Strip 00012 { 00013 public: 00014 typedef boost::shared_ptr<Strip> StripPtr; 00015 00019 Strip(); 00023 ~Strip(); 00024 00025 unsigned int GetNumberOfItems(); 00031 VertexPtr GetItemAt(int at); 00032 00033 void AddItem(VertexPtr item); 00039 void SetItemAtt(VertexPtr item, int pos); 00040 00044 void RemoveLastItem(); 00049 void RemoveItemAt(int at); 00054 void RemoveItemAt(VertexPtr item); 00055 00056 00057 private: 00058 VertexPtr m_owner; 00059 std::vector<VertexPtr> m_items; 00060 }; 00061 00067 class MapVertex 00068 { 00069 public: 00070 typedef boost::shared_ptr<Strip> StripPtr; 00071 typedef boost::shared_ptr<MapVertex> MapVertexPtr; 00072 00076 MapVertex(VertexPtr owner, double width, double height); 00077 00082 double GetWidth(); 00087 double GetHeight(); 00088 00093 void SetWidth(double width); 00098 void SetHeight(double height); 00099 00104 double CalculateAvarangeAspectRatio(); 00109 double CalculateLastAspectRatio(); 00114 double CalculateAspectRatioOfStrip(int at); 00115 00121 double GetWidthOfItemsAtStrip(unsigned int at); 00126 double GetWidthOfItemsAtLastStrip(); 00131 double GetHeightOfItems(); 00132 00137 unsigned int GetNumberOfStrips(); 00142 void AddStrip(StripPtr strip); 00148 void SetStripAt(StripPtr strip, unsigned int at); 00154 StripPtr GetStripAt(unsigned int at); 00159 StripPtr GetLastStrip(); 00164 void RemoveStripAt(int at); 00165 00170 VertexPtr GetOwner(); 00175 void SetOwner(VertexPtr owner); 00176 00177 00178 private: 00179 double m_width; 00180 double m_height; 00181 VertexPtr m_owner; 00182 std::vector<StripPtr> m_strips; 00183 }; 00184 00194 class TreeMap : public View 00195 { 00196 public: 00197 typedef boost::shared_ptr<Strip> StripPtr; 00198 typedef boost::shared_ptr<MapVertex> MapVertexPtr; 00199 00203 TreeMap(int type); 00207 ~TreeMap(void); 00208 00212 virtual void Calculate(); 00213 00217 std::map<unsigned int, MapVertexPtr> m_mapVertex; 00218 private: 00219 void CalculateStripSliceAndDice(MapVertexPtr actStrip, bool horizontal); 00220 void CalculateStrip(MapVertexPtr actstrip); 00221 int m_type; 00222 00223 };