CVSS_Module.h
class CVSS_Module:
void AddCommand(int nCmdType, IVSS_Command* pCommand);
CVSS_Commands.h
class CVSS_Commands:
void AddCommand(int nCmdType, IVSS_Command* pCommand);
CVSS_ModuleFactory.h
class CVSS_ModuleFactory
void AddCommand(int nType, IVSS_Command* pCommand);
CVSS_Commands.cpp
void CVSS_Commands::AddCommand(int nCmdType, IVSS_Command* pCommand){
if(pCommand == 0) {
return;
}
m_mapCommands.insert(COMMAND_MAP::value_type(nCmdType, pCommand));
}
CVSS_Module.cpp
void CVSS_Module::AddCommand(int nCmdType, IVSS_Command* pCommand){
if(pCommand == NULL) return;
CVSS_ModuleFactory* pFactory = CVSS_ModuleFactory::GetFactory();
pFactory->AddCommand(nCmdType, pCommand);
}
CVSS_ModuleFactory.cpp
void CVSS_ModuleFactory::AddCommand(int nType, IVSS_Command* pCommand){
m_Commands.AddCommand(nType, pCommand);
}
CVSS_ModuleFactory.cpp
void CVSS_ModuleFactory::InitFactory(){
GetModuleFileName(NULL, m_pszWorkDir, 255);
(_tcsrchr(m_pszWorkDir,_T('\\')))[1] = NULL;
MODULE_MAP::iterator it = m_mapModules.begin();
for (; !(it == m_mapModules.end()); it++){
CVSS_Module* pModule = (*it).second;
pModule->ModuleInit();
}
Broadcast(MSG_SYSTEM_STARTED, (WPARAM)m_pszWorkDir, 0);
AddCommand(CMD_SYS_OPENDB, new CVSS_OpenDBCommand);
}
CVSS_DataManager.cpp
void CVSS_DataManager::ModuleInit()
{
CVSS_DataEditCommand* pDataEditor = new CVSS_DataEditCommand(this);
if(NULL == pDataEditor)
{
char msg[512];
sprintf(msg, "%s(%d) : ERROR %d : %s", __FILE__, __LINE__, VSS_OUT_OF_MEMORY, "The param \"pDataEditor\" allocate failed.");
GetLogPtr->Debug(msg);
return;
}
AddCommand(CMD_DATAEDIT, pDataEditor);
}
CVSS_MapViewer.cpp
void CVSS_MapViewer::ModuleInit(){
// 添加鼠标监听器
CVSS_MapCtrlMouseListener* mml = new CVSS_MapCtrlMouseListener;
if(mml == NULL){
char msg[512];
sprintf(msg, "%s(%d) : ERROR %d : %s", __FILE__, __LINE__, VSS_OUT_OF_MEMORY, "Out of memory.");
GetLogPtr->Debug(msg);
}
else{
m_pMouseListenerPool->AddMouseListener(MAT_MAPZOOMIN, mml);
}
mml = new CVSS_MapCtrlMouseListener;
if(mml == NULL){
char msg[512];
sprintf(msg, "%s(%d) : ERROR %d : %s", __FILE__, __LINE__, VSS_OUT_OF_MEMORY, "Out of memory.");
GetLogPtr->Debug(msg);
}
else{
m_pMouseListenerPool->AddMouseListener(MAT_MAPZOOMOUT, mml);
}
mml = new CVSS_MapCtrlMouseListener;
if(mml == NULL){
char msg[512];
sprintf(msg, "%s(%d) : ERROR %d : %s", __FILE__, __LINE__, VSS_OUT_OF_MEMORY, "Out of memory.");
GetLogPtr->Debug(msg);
}
else{
m_pMouseListenerPool->AddMouseListener(MAT_MAPPAN, mml);
}
// 添加命令
CVSS_MapCtrlCommand* pmcc = new CVSS_MapCtrlCommand(this);
if(pmcc == NULL){
char msg[512];
sprintf(msg, "%s(%d) : ERROR %d : %s", __FILE__, __LINE__, VSS_OUT_OF_MEMORY, "Out of memory.");
GetLogPtr->Debug(msg);
}
else{
AddCommand(CMD_MAP_VIEW, pmcc);
}
class CVSS_Module:
void AddCommand(int nCmdType, IVSS_Command* pCommand);
CVSS_Commands.h
class CVSS_Commands:
void AddCommand(int nCmdType, IVSS_Command* pCommand);
CVSS_ModuleFactory.h
class CVSS_ModuleFactory
void AddCommand(int nType, IVSS_Command* pCommand);
CVSS_Commands.cpp
void CVSS_Commands::AddCommand(int nCmdType, IVSS_Command* pCommand){
if(pCommand == 0) {
return;
}
m_mapCommands.insert(COMMAND_MAP::value_type(nCmdType, pCommand));
}
CVSS_Module.cpp
void CVSS_Module::AddCommand(int nCmdType, IVSS_Command* pCommand){
if(pCommand == NULL) return;
CVSS_ModuleFactory* pFactory = CVSS_ModuleFactory::GetFactory();
pFactory->AddCommand(nCmdType, pCommand);
}
CVSS_ModuleFactory.cpp
void CVSS_ModuleFactory::AddCommand(int nType, IVSS_Command* pCommand){
m_Commands.AddCommand(nType, pCommand);
}
CVSS_ModuleFactory.cpp
void CVSS_ModuleFactory::InitFactory(){
GetModuleFileName(NULL, m_pszWorkDir, 255);
(_tcsrchr(m_pszWorkDir,_T('\\')))[1] = NULL;
MODULE_MAP::iterator it = m_mapModules.begin();
for (; !(it == m_mapModules.end()); it++){
CVSS_Module* pModule = (*it).second;
pModule->ModuleInit();
}
Broadcast(MSG_SYSTEM_STARTED, (WPARAM)m_pszWorkDir, 0);
AddCommand(CMD_SYS_OPENDB, new CVSS_OpenDBCommand);
}
CVSS_DataManager.cpp
void CVSS_DataManager::ModuleInit()
{
CVSS_DataEditCommand* pDataEditor = new CVSS_DataEditCommand(this);
if(NULL == pDataEditor)
{
char msg[512];
sprintf(msg, "%s(%d) : ERROR %d : %s", __FILE__, __LINE__, VSS_OUT_OF_MEMORY, "The param \"pDataEditor\" allocate failed.");
GetLogPtr->Debug(msg);
return;
}
AddCommand(CMD_DATAEDIT, pDataEditor);
}
CVSS_MapViewer.cpp
void CVSS_MapViewer::ModuleInit(){
// 添加鼠标监听器
CVSS_MapCtrlMouseListener* mml = new CVSS_MapCtrlMouseListener;
if(mml == NULL){
char msg[512];
sprintf(msg, "%s(%d) : ERROR %d : %s", __FILE__, __LINE__, VSS_OUT_OF_MEMORY, "Out of memory.");
GetLogPtr->Debug(msg);
}
else{
m_pMouseListenerPool->AddMouseListener(MAT_MAPZOOMIN, mml);
}
mml = new CVSS_MapCtrlMouseListener;
if(mml == NULL){
char msg[512];
sprintf(msg, "%s(%d) : ERROR %d : %s", __FILE__, __LINE__, VSS_OUT_OF_MEMORY, "Out of memory.");
GetLogPtr->Debug(msg);
}
else{
m_pMouseListenerPool->AddMouseListener(MAT_MAPZOOMOUT, mml);
}
mml = new CVSS_MapCtrlMouseListener;
if(mml == NULL){
char msg[512];
sprintf(msg, "%s(%d) : ERROR %d : %s", __FILE__, __LINE__, VSS_OUT_OF_MEMORY, "Out of memory.");
GetLogPtr->Debug(msg);
}
else{
m_pMouseListenerPool->AddMouseListener(MAT_MAPPAN, mml);
}
// 添加命令
CVSS_MapCtrlCommand* pmcc = new CVSS_MapCtrlCommand(this);
if(pmcc == NULL){
char msg[512];
sprintf(msg, "%s(%d) : ERROR %d : %s", __FILE__, __LINE__, VSS_OUT_OF_MEMORY, "Out of memory.");
GetLogPtr->Debug(msg);
}
else{
AddCommand(CMD_MAP_VIEW, pmcc);
}
大部分转载 小部分自写