![]() |
VR-Forces 4.0.4 Class Documentation
|
00001 /******************************************************************************* 00002 ** Copyright (c) 2011 MAK Technologies, Inc. 00003 ** All rights reserved. 00004 *******************************************************************************/ 00005 00006 //\file DtEntityList.h 00007 //\brief Contains makVrf::makVrfEntityListExample::DtEntityList class. 00008 00009 #pragma once 00010 00011 #include <vrvUtil/signalslib.h> 00012 00013 #include "entityListUi.hpp" 00014 00015 #include <vrvCoreQt/DtDockable.h> 00016 #include <vrvCoreQt/DtPage.h> 00017 #include <vrvCore/DtUserInterfaceAssembler.h> 00018 #include <vrvCore/DtStateViewCollection.h> 00019 #include <vrfGuiCore/DtVrfStateViewCollectionManager.h> 00020 #include <vrftasks/simTask.h> 00021 00022 namespace makVrv 00023 { 00024 class DtDe; 00025 } 00026 00027 namespace makVrfEntityListExample 00028 { 00029 00030 //A widget class that displays all existing entities 00031 //as well as their current task and, if available, their destination. 00032 class DtEntityList 00033 : public makVrv::DtPage 00034 , public makVrv::DtDockable 00035 { 00036 public: 00037 DtEntityList( makVrv::DtDe& de, QWidget* parent = 0, Qt::WindowFlags flags = 0); 00038 00039 virtual ~DtEntityList(); 00040 00041 //Get the icon of the page. 00042 virtual QIcon icon(); 00043 00044 //Get the title of the page. 00045 virtual QString title(); 00046 00047 //Get the class name of the page. 00048 virtual const std::string& pageClassName() const; 00049 00050 //Called when the page is displayed. 00051 virtual void activate(); 00052 00053 //Called when the page is hidden. 00054 virtual void deactivate(); 00055 00056 static std::string thePageClassName(); 00057 00058 //Goes through the entire list of entities and populates the tree 00059 virtual void populateEntityList(); 00060 00061 protected: 00062 //Sets up the contents of the widget onto the supplied parent 00063 void setupUi(QWidget* p); 00064 00065 //Clears out widget 00066 virtual void clear(); 00067 00068 00069 protected: 00070 virtual void slot_onObjectAdded(const makVrv::DtStateView<makVrv::DtVrlinkSimulatedEntityState>&); 00071 virtual void slot_onObjectUpdated(makVrv::DtStateView<makVrv::DtVrlinkSimulatedEntityState>*); 00072 virtual void slot_onObjectAboutToBeRemoved(const makVrv::DtStateView<makVrv::DtVrlinkSimulatedEntityState>&); 00073 virtual void slot_onCurrentTaskChanged(const std::string& entityName); 00074 00075 //Using the known task, fill in the destination line in the entity list 00076 void fillDestinationLine(DtSimTask* task,QTreeWidgetItem* displayEntityItem); 00077 00078 public: 00079 Ui_DtEntityListUi myUi; 00080 00081 //A list of all simulated entities. 00082 //Each State View is a collection of similar objects 00083 //that the VR-Forces front end knows about. This particular view 00084 //keeps a list of all simulated entities. 00085 makVrf::DtVrfSimulatedEntityStateViewCollection* mySimulatedEntityStateView; 00086 00087 //This maps keeps track of each line in the target list 00088 std::map<const makVrv::DtStateView<makVrv::DtVrlinkSimulatedEntityState>*, QTreeWidgetItem*> myLineToStateViewMap; 00089 }; 00090 00091 //Create a "creator" helper class using the template. 00092 typedef makVrv::DtPageCreatorTemplate<DtEntityList> DtEntityListWidgetCreator; 00093 }