00001
00002
00003
00004
00005
00006
00007
00008 #ifndef GRAPHMODULE_H_
00009 #define GRAPHMODULE_H_
00010
00011 #include "OglGui/GroupBox.h"
00012 #include "OglGui/Window.h"
00013
00014 #include "Application/TagsLife/LabeledGraph.h"
00015
00016 namespace Impala { namespace Application { namespace MediaTable {
00017 typedef LabeledGraph Graph;
00018
00019 class GraphModule : public VisualizationModule {
00020 public:
00021 GraphModule() : VisualizationModule("Graph") {}
00022
00023 void ButtonSelectionEvent(OglGui::Button *src, void *userData) {
00024 if(src->GetLabel() == "New " + GetName())
00025 {
00026 StoreConfigWindowValues();
00027 DoHandleNewWindow(GetName(), mConfigWindow);
00028 delete mConfigWindow;
00029 DoReleaseConfigWindow();
00030 }
00031 else
00032 VisualizationModule::ButtonSelectionEvent(src, userData);
00033 }
00034
00035 void ViewSelected() {
00036 VisualizationModule::DrawConfigWindow();
00037 OglGui::GroupBox* grp = new OglGui::GroupBox(mConfigWindow, mConfigWindow->W()-2, 362, "");
00038
00039 AddSelectorWithColumnsOfType(grp, "Source", mStringValues["View"],
00040 TableDataSource::TYPE_FLAG_ALL, true);
00041 AddSelectorWithColumnsOfType(grp, "Target", mStringValues["View"],
00042 TableDataSource::TYPE_FLAG_ALL, true);
00043 AddSelectorWithColumnsOfType(grp, "Image", mStringValues["View"],
00044 TableDataSource::TYPE_FLAG_IMAGE, true);
00045 (new OglGui::Button(grp, grp->W()-4, 26, "New "+GetName(), BEV_ETCHED))
00046 ->SetButtonListener(this);
00047
00048 grp->RepositionViewports();
00049 grp->ScaleChildren();
00050 }
00051
00052 void NewWindow(OglGui::Window* window) {
00053 Graph* graph = new Graph(window, window->W(), window->H());
00054 TableDataView* view = TableDataStore::GetInstance()->GetTableDataView(mStringValues["View"]);
00055
00056 map<string, vector<string> > nodemap;
00057 nodemap["a"].push_back("b");
00058 nodemap["a"].push_back("c");
00059 nodemap["a"].push_back("d");
00060 nodemap["b"].push_back("d");
00061 nodemap[mStringValues["Source"]].push_back(mStringValues["Target"]);
00062 nodemap[mStringValues["Source"]].push_back(mStringValues["Image"]);
00063
00064 graph->addNodes(nodemap);
00065 }
00066 };
00067
00068 } } }
00069
00070 #endif