void Map::Add(T *obj) { CellPair p = LeGACY::ComputeCellPair(obj->GetPositionX(), obj->GetPositionY()); assert(obj); if(p.x_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP || p.y_coord >= TOTAL_NUMBER_OF_CELLS_PER_MAP) { sLog.outError("Map::Add: Object " I64FMTD " have invalid coordinates X:%u Y:%u grid cell [%u,%u]", obj->GetGUID(), obj->GetPositionX(), obj->GetPositionY(), p.x_coord, p.y_coord); return; } Cell cell(p); EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); assert( grid != NULL ); AddToGrid(obj,grid,cell); obj->AddToWorld(); DEBUG_LOG("Object %u enters grid[%u,%u]", GUID_LOPART(obj->GetGUID()), cell.GridX(), cell.GridY()); UpdateObjectVisibility(obj,cell,p); AddNotifier(obj,cell,p); }
/** * @brief Initialise listcontrol containing filters. */ void FileFiltersDlg::InitList() { // Show selection across entire row. // Also enable infotips. m_listFilters.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_INFOTIP); String title = theApp.LoadString(IDS_FILTERFILE_NAMETITLE); m_listFilters.InsertColumn(0, title.c_str(), LVCFMT_LEFT, 150); title = theApp.LoadString(IDS_FILTERFILE_DESCTITLE); m_listFilters.InsertColumn(1, title.c_str(), LVCFMT_LEFT, 350); title = theApp.LoadString(IDS_FILTERFILE_PATHTITLE); m_listFilters.InsertColumn(2, title.c_str(), LVCFMT_LEFT, 350); title = theApp.LoadString(IDS_USERCHOICE_NONE); m_listFilters.InsertItem(1, title.c_str()); m_listFilters.SetItemText(0, 1, title.c_str()); m_listFilters.SetItemText(0, 2, title.c_str()); int count = m_Filters->GetSize(); for (int i = 0; i < count; i++) { AddToGrid(i); } }
void Map::EnsureGridLoadedForPlayer(const Cell &cell, Player *player, bool add_player) { EnsureGridCreated(GridPair(cell.GridX(), cell.GridY())); NGridType *grid = getNGrid(cell.GridX(), cell.GridY()); assert(grid != NULL); if( !isGridObjectDataLoaded(cell.GridX(), cell.GridY()) ) { if( player != NULL ) { player->SendDelayResponse(MAX_GRID_LOAD_TIME); DEBUG_LOG("Player %s enter cell[%u,%u] triggers of loading grid[%u,%u] on map %u", player->GetName(), cell.CellX(), cell.CellY(), cell.GridX(), cell.GridY(), i_id); } else { DEBUG_LOG("Player nearby triggers of loading grid [%u,%u] on map %u", cell.GridX(), cell.GridY(), i_id); } ObjectGridLoader loader(*grid, this, cell); loader.LoadN(); setGridObjectDataLoaded(true, cell.GridX(), cell.GridY()); ResetGridExpiry(*getNGrid(cell.GridX(), cell.GridY()), 0.1f); grid->SetGridState(GRID_STATE_ACTIVE); if( add_player && player != NULL ) (*grid)(cell.CellX(), cell.CellY()).AddWorldObject(player, player->GetAccountId()); } else if( player && add_player ) AddToGrid(player, grid, cell); }
//初始化对话框 BOOL CWordNetDlg::OnInitDialog() { CDialogEx::OnInitDialog(); // TODO: 在此添加额外的初始化 //初始化ListCtrl控件 m_grid.SetExtendedStyle(LVS_EX_FLATSB|LVS_EX_FULLROWSELECT|LVS_EX_HEADERDRAGDROP|LVS_EX_ONECLICKACTIVATE|LVS_EX_GRIDLINES); m_grid.InsertColumn(0,_T("序号"),LVCFMT_LEFT,50,0); m_grid.InsertColumn(1,_T("敏感词"),LVCFMT_LEFT,500,1); //绑定数据 AddToGrid(); return TRUE; // return TRUE unless you set the focus to a control // 异常: OCX 属性页应返回 FALSE }
BOOL CDialogFUN::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_Grid.SetExtendedStyle(LVS_EX_FLATSB|LVS_EX_HEADERDRAGDROP|LVS_EX_FULLROWSELECT|LVS_EX_ONECLICKACTIVATE|LVS_EX_GRIDLINES); m_Grid.InsertColumn(0,"֪ʶÐòºÅ",LVCFMT_LEFT,80,0); m_Grid.InsertColumn(1,"ȺÀàÐÍ",LVCFMT_LEFT,110,1); m_Grid.InsertColumn(2,"ƽ̨̬ÊÆ",LVCFMT_LEFT,110,2); m_Grid.InsertColumn(3,"¹¦ÄÜʼþ",LVCFMT_LEFT,110,3); AddToGrid(); m_typ.InsertString(0,"Ô¤¾¯»ú"); m_typ.InsertString(1,"¸ÉÈÅ»ú"); m_typ.InsertString(2,"¹¥»÷»ú"); // m_typ.SetCurSel(0); m_tra.InsertString(0,"¾¯½ä"); m_tra.InsertString(1,"ѲÂß"); m_tra.InsertString(2,"À¹½Ø"); m_tra.InsertString(3,"¹¥»÷"); m_tra.InsertString(4,"ºäÕ¨"); m_tra.InsertString(5,"Í»·À"); m_tra.InsertString(6,"¸ÉÈÅ"); m_tra.InsertString(7,"Ô¤¾¯Ö¸»Ó"); // m_tra.SetCurSel(0); m_fun.InsertString(0,"¾¯½ä"); m_fun.InsertString(1,"ѲÂß"); m_fun.InsertString(2,"¹¥»÷"); m_fun.InsertString(3,"À¹½Ø"); m_fun.InsertString(4,"ºäÕ¨"); m_fun.InsertString(5,"Í»·À"); m_fun.InsertString(6,"¸ÉÈÅ"); m_fun.InsertString(7,"Ô¤¾¯"); m_fun.InsertString(8,"Õì²ì"); // m_fun.SetCurSel(0); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
//删除涉密词 void CWordNetDlg::OnBnClickedDelete() { // TODO: 在此添加控件通知处理程序代码 //判断是否已有选中 POSITION pos=m_grid.GetFirstSelectedItemPosition(); if(pos==NULL) { MessageBox(_T("请至少选择一项!"),_T("编辑涉密词"),MB_ICONERROR); return; } //得到行号,通过POSITION转化 int nId=(int)m_grid.GetNextSelectedItem(pos); //得到列中的内容(0表示第一列,同理1,2,3...表示第二,三,四...列) CString name=m_grid.GetItemText(nId,1); try{ //删除数据库记录,并更新显示 ADOConn m_AdoConn; m_AdoConn.OnInitADOConn(); _bstr_t sql; sql="select* from dict"; _RecordsetPtr m_pRecordset; m_pRecordset=m_AdoConn.GetRecordSet(sql); //遍历查找 while(m_AdoConn.m_pRecordset->adoEOF==0) { CString strName=(LPCTSTR)(_bstr_t)m_pRecordset->GetCollect(_T("name")); if(strName.Trim()==name.Trim()){ m_pRecordset->Delete(adAffectCurrent); break; } m_pRecordset->MoveNext(); } // m_pRecordset->Update(); m_AdoConn.ExitConnect(); } catch(...) { MessageBox(_T("删除涉密词失败!"),_T("编辑涉密词"),MB_ICONERROR); return; } AfxMessageBox(_T("删除成功")); //删除ListContrl控件中的数据 m_grid.DeleteAllItems(); AddToGrid(); }
void CDialogFUN::OnButDel() { // TODO: Add your control notification handler code here int id=atoi(m_id); CString sql; sql.Format("delete from ¹¦ÄÜȺ where ID=%d",id); try{ theApp.m_DataBase.pConn->Execute((_bstr_t)sql,NULL,adCmdText); } catch(_com_error e) { AfxMessageBox(e.Description()); } m_Grid.DeleteAllItems(); AddToGrid(); }
/** * @brief Update filters to list. */ void FileFiltersDlg::UpdateFiltersList() { int count = m_Filters->GetSize(); m_listFilters.DeleteAllItems(); String title = theApp.LoadString(IDS_USERCHOICE_NONE); m_listFilters.InsertItem(1, title.c_str()); m_listFilters.SetItemText(0, 1, title.c_str()); m_listFilters.SetItemText(0, 2, title.c_str()); for (int i = 0; i < count; i++) { AddToGrid(i); } }
// adds all displacement faces as a series of convex objects // UNDONE: Only add the displacements for this model? void Disp_AddCollisionModels( CUtlVector<CPhysCollisionEntry *> &collisionList, dmodel_t *pModel, int contentsMask) { int dispIndex; // Add each displacement to the grid hash for ( dispIndex = 0; dispIndex < g_CoreDispInfos.Count(); dispIndex++ ) { CCoreDispInfo *pDispInfo = g_CoreDispInfos[ dispIndex ]; mapdispinfo_t *pMapDisp = &mapdispinfo[ dispIndex ]; // not solid for this pass if ( !(pMapDisp->contents & contentsMask) ) continue; int gridIndex = Disp_GridIndex( pDispInfo ); AddToGrid( gridIndex, dispIndex ); } // now make a polysoup for the terrain in each grid for ( int grid = 0; grid < gDispGridList.Count(); grid++ ) { int triCount = 0; CPhysPolysoup *pTerrainPhysics = physcollision->PolysoupCreate(); // iterate the displacements in this grid for ( int listIndex = 0; listIndex < gDispGridList[grid].dispList.Count(); listIndex++ ) { dispIndex = gDispGridList[grid].dispList[listIndex]; CCoreDispInfo *pDispInfo = g_CoreDispInfos[ dispIndex ]; mapdispinfo_t *pMapDisp = &mapdispinfo[ dispIndex ]; // Get the material id. MaterialSystemMaterial_t matID = GetMatIDFromDisp( pMapDisp ); // Build a triangle list. This shares the tesselation code with the engine. CUtlVector<unsigned short> indices; CVBSPTesselateHelper helper; helper.m_pIndices = &indices; helper.m_pActiveVerts = pDispInfo->GetAllowedVerts().Base(); helper.m_pPowerInfo = pDispInfo->GetPowerInfo(); ::TesselateDisplacement( &helper ); Assert( indices.Count() > 0 ); Assert( indices.Count() % 3 == 0 ); // Make sure indices are a multiple of 3. int nTriCount = indices.Count() / 3; triCount += nTriCount; if ( triCount >= 65536 ) { // don't put more than 64K tris in any single collision model CPhysCollide *pCollide = physcollision->ConvertPolysoupToCollide( pTerrainPhysics, false ); if ( pCollide ) { collisionList.AddToTail( new CPhysCollisionEntryStaticMesh( pCollide, NULL ) ); } // Throw this polysoup away and start over for the remaining triangles physcollision->PolysoupDestroy( pTerrainPhysics ); pTerrainPhysics = physcollision->PolysoupCreate(); triCount = nTriCount; } Vector tmpVerts[3]; for ( int iTri = 0; iTri < nTriCount; ++iTri ) { float flAlphaTotal = 0.0f; for ( int iTriVert = 0; iTriVert < 3; ++iTriVert ) { pDispInfo->GetVert( indices[iTri*3+iTriVert], tmpVerts[iTriVert] ); flAlphaTotal += pDispInfo->GetAlpha( indices[iTri*3+iTriVert] ); } int nProp = g_SurfaceProperties[texinfo[pMapDisp->face.texinfo].texdata]; if ( flAlphaTotal > DISP_ALPHA_PROP_DELTA ) { int nProp2 = GetSurfaceProperties2( matID, "surfaceprop2" ); if ( nProp2 != -1 ) { nProp = nProp2; } } int nMaterialIndex = RemapWorldMaterial( nProp ); physcollision->PolysoupAddTriangle( pTerrainPhysics, tmpVerts[0], tmpVerts[1], tmpVerts[2], nMaterialIndex ); } } // convert the whole grid's polysoup to a collide and store in the collision list CPhysCollide *pCollide = physcollision->ConvertPolysoupToCollide( pTerrainPhysics, false ); if ( pCollide ) { collisionList.AddToTail( new CPhysCollisionEntryStaticMesh( pCollide, NULL ) ); } // now that we have the collide, we're done with the soup physcollision->PolysoupDestroy( pTerrainPhysics ); } }
void CDialogFUN::OnButmod() { // TODO: Add your control notification handler code here UpdateData(TRUE); //az int type; CString stype; m_typ.GetLBText(m_typ.GetCurSel(),stype); if(stype=="Ô¤¾¯»ú") { type=1; } if(stype=="¸ÉÈÅ»ú") { type=2; } if(stype=="¹¥»÷»ú") { type=3; } //pre int trackbaseevent; CString strackbaseevent; m_tra.GetLBText(m_tra.GetCurSel(),strackbaseevent); if(strackbaseevent=="¾¯½ä") { trackbaseevent=1; } if(strackbaseevent=="ѲÂß") { trackbaseevent=2; } if(strackbaseevent=="À¹½Ø") { trackbaseevent=3; } if(strackbaseevent=="¹¥»÷") { trackbaseevent=4; } if(strackbaseevent=="ºäÕ¨") { trackbaseevent=5; } if(strackbaseevent=="Í»·À") { trackbaseevent=6; } if(strackbaseevent=="¸ÉÈÅ") { trackbaseevent=7; } if(strackbaseevent=="Ô¤¾¯Ö¸»Ó") { trackbaseevent=8; } //paw int funbaseevent; CString sfunbaseevent; m_fun.GetLBText(m_fun.GetCurSel(),sfunbaseevent); if(sfunbaseevent=="¾¯½ä") { funbaseevent=1; } if(sfunbaseevent=="ѲÂß") { funbaseevent=2; } if(sfunbaseevent=="¹¥»÷") { funbaseevent=3; } if(sfunbaseevent=="À¹½Ø") { funbaseevent=4; } if(sfunbaseevent=="ºäÕ¨") { funbaseevent=5; } if(sfunbaseevent=="Í»·À") { funbaseevent=6; } if(sfunbaseevent=="¸ÉÈÅ") { funbaseevent=7; } if(sfunbaseevent=="Ô¤¾¯") { funbaseevent=8; } if(sfunbaseevent=="Õì²ì") { funbaseevent=9; } CString sql; sql.Format("update ¹¦ÄÜȺ set ȺÀàÐÍ=%d,ƽ̨̬ÊÆ=%d,¹¦ÄÜʼþ=%d where ID=%d",type,trackbaseevent,funbaseevent,ids); try{ theApp.m_DataBase.pConn->Execute((_bstr_t)sql,NULL,adCmdText); } catch(_com_error e) { AfxMessageBox(e.Description()); } m_Grid.DeleteAllItems(); AddToGrid(); }
void CDialogFUN::OnButAdd() { // TODO: Add your control notification handler code here UpdateData(TRUE); /* pConn.CreateInstance("ADODB.Connection"); pConn->ConnectionString="Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\\Users\\Administrator\\Desktop\\Database.accdb;Persist Security Info=False"; pConn->Open("","","",adConnectUnspecified); */ //theApp.m_DataBase.pRst.CreateInstance(__uuidof(Recordset)); theApp.m_DataBase.pRst->Open("select * from ¹¦ÄÜȺ",theApp.m_DataBase.pConn.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText); int type,trackbaseevent,funbaseevent; CString stype,strackbaseevent,sfunbaseevent; m_typ.GetLBText(m_typ.GetCurSel(),stype); m_tra.GetLBText(m_tra.GetCurSel(),strackbaseevent); m_fun.GetLBText(m_fun.GetCurSel(),sfunbaseevent); //type if(stype=="Ô¤¾¯»ú") { type=1; } if(stype=="¸ÉÈÅ»ú") { type=2; } if(stype=="¹¥»÷»ú") { type=3; } // if(strackbaseevent=="¾¯½ä") { trackbaseevent=1; } if(strackbaseevent=="ѲÂß") { trackbaseevent=2; } if(strackbaseevent=="À¹½Ø") { trackbaseevent=3; } if(strackbaseevent=="¹¥»÷") { trackbaseevent=4; } if(strackbaseevent=="ºäÕ¨") { trackbaseevent=5; } if(strackbaseevent=="Í»·À") { trackbaseevent=6; } if(strackbaseevent=="¸ÉÈÅ") { trackbaseevent=7; } if(strackbaseevent=="Ô¤¾¯Ö¸»Ó") { trackbaseevent=8; } // if(sfunbaseevent=="¾¯½ä") { funbaseevent=1; } if(sfunbaseevent=="ѲÂß") { funbaseevent=2; } if(sfunbaseevent=="¹¥»÷") { funbaseevent=3; } if(sfunbaseevent=="À¹½Ø") { funbaseevent=4; } if(sfunbaseevent=="ºäÕ¨") { funbaseevent=5; } if(sfunbaseevent=="Í»·À") { funbaseevent=6; } if(sfunbaseevent=="¸ÉÈÅ") { funbaseevent=7; } if(sfunbaseevent=="Ô¤¾¯") { funbaseevent=8; } if(sfunbaseevent=="Õì²ì") { funbaseevent=9; } try { theApp.m_DataBase.pRst->MoveLast(); theApp.m_DataBase.pRst->AddNew(); theApp.m_DataBase.pRst->PutCollect("ID",atol(m_id)); theApp.m_DataBase.pRst->PutCollect("ȺÀàÐÍ",(long)type); theApp.m_DataBase.pRst->PutCollect("ƽ̨̬ÊÆ",(long)trackbaseevent); theApp.m_DataBase.pRst->PutCollect("¹¦ÄÜʼþ",(long)funbaseevent); theApp.m_DataBase.pRst->Update(); } catch(_com_error e) { e.Description(); } theApp.m_DataBase.pRst->Close(); m_Grid.DeleteAllItems(); AddToGrid(); }
//修改涉密词 void CWordNetDlg::OnBnClickedUpdate() { // TODO: 在此添加控件通知处理程序代码 //判断是否已有选中 POSITION pos=m_grid.GetFirstSelectedItemPosition(); if(pos==NULL) { MessageBox(_T("请至少选择一项!"),_T("编辑涉密词"),MB_ICONERROR); return; } //得到行号,通过POSITION转化 int nId=(int)m_grid.GetNextSelectedItem(pos); //得到列中的内容(0表示第一列,同理1,2,3...表示第二,三,四...列) CString name=m_grid.GetItemText(nId,1); //弹出修改涉密词对话框 CEditDInfoDlg dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: 在此放置处理何时用 // “确定”来关闭对话框的代码 //获取修改的涉密词,并添入数据库 try{ UpdateData(TRUE); //获取涉密词,并判断是否为空 CString m_name=dlg.GetSenseWord(); if(m_name.IsEmpty()) MessageBox(_T("涉密词不能为空!"),_T("编辑涉密词"),MB_ICONERROR); //插入数据库,并更新显示 ADOConn m_AdoConn; m_AdoConn.OnInitADOConn(); _bstr_t sql; sql="select* from dict"; _RecordsetPtr m_pRecordset; m_pRecordset=m_AdoConn.GetRecordSet(sql); try{ while(m_AdoConn.m_pRecordset->adoEOF==0) { CString strName=(LPCTSTR)(_bstr_t)m_pRecordset->GetCollect(_T("name")); if(strName.Trim()==name.Trim()){ m_pRecordset->put_Collect(_variant_t(_T("name")),_variant_t(m_name)); break; } m_pRecordset->MoveNext(); } // m_pRecordset->Update(); m_AdoConn.ExitConnect(); } catch(...) { AfxMessageBox(_T("操作失败")); return; } AfxMessageBox(_T("修改成功")); //删除ListContrl控件中的数据 m_grid.DeleteAllItems(); AddToGrid(); }catch(...) { MessageBox(_T("修改涉密词失败!"),_T("编辑涉密词"),MB_ICONERROR); } } else if (nResponse == IDCANCEL) { // TODO: 在此放置处理何时用 // “取消”来关闭对话框的代码 } }
void CDialogPLA::OnButmod() { // TODO: Add your control notification handler code here UpdateData(TRUE); //trackbaseevent int trackbaseevent; CString strackbaseevent; m_tra.GetLBText(m_tra.GetCurSel(),strackbaseevent); if(strackbaseevent=="匀速直线运动") { trackbaseevent=1; } if(strackbaseevent=="加速直线运动") { trackbaseevent=2; } if(strackbaseevent=="俯冲") { trackbaseevent=3; } if(strackbaseevent=="上升") { trackbaseevent=4; } if(strackbaseevent=="拐弯") { trackbaseevent=5; } if(strackbaseevent=="远离本舰") { trackbaseevent=6; } if(strackbaseevent=="逼近本舰") { trackbaseevent=7; } if(strackbaseevent=="位置固定") { trackbaseevent=8; } if(strackbaseevent=="--------") { trackbaseevent=0; } //rd int rd; CString srd; m_rd.GetLBText(m_rd.GetCurSel(),srd); if(srd=="--------") { rd=0; } if(srd=="不变") { rd=1; } if(srd=="变小") { rd=5; } if(srd=="变大") { rd=3; } //speed int speed; CString sspeed; m_speed.GetLBText(m_speed.GetCurSel(),sspeed); if(sspeed=="--------") { speed=0; } if(sspeed=="不变") { speed=1; } if(sspeed=="变小") { speed=5; } if(sspeed=="变大") { speed=3; } //addspeed int addspeed; CString saddspeed; m_addspeed.GetLBText(m_addspeed.GetCurSel(),saddspeed); if(saddspeed=="--------") { addspeed=0; } if(saddspeed=="不变") { addspeed=1; } if(saddspeed=="变小") { addspeed=5; } if(saddspeed=="变大") { addspeed=3; } //azimuth int azimuth; CString sazimuth; m_azimuth.GetLBText(m_azimuth.GetCurSel(),sazimuth); if(sazimuth=="--------") { azimuth=0; } if(sazimuth=="不变") { azimuth=1; } if(sazimuth=="变小") { azimuth=5; } if(sazimuth=="变大") { azimuth=3; } //high int high; CString shigh; m_high.GetLBText(m_high.GetCurSel(),shigh); if(shigh=="--------") { high=0; } if(shigh=="不变") { high=1; } if(shigh=="变小") { high=5; } if(shigh=="变大") { high=3; } //gogal int gogal; CString sgogal; m_gog.GetLBText(m_gog.GetCurSel(),sgogal); if(sgogal=="战斗机") { gogal=1; } if(sgogal=="轰炸机") { gogal=2; } if(sgogal=="歼击机、攻击机") { gogal=3; } if(sgogal=="预警机") { gogal=4; } if(sgogal=="侦察机") { gogal=5; } if(sgogal=="干扰机") { gogal=6; } if(sgogal=="直升机") { gogal=7; } if(sgogal=="舰艇") { gogal=8; } if(sgogal=="战术导弹") { gogal=9; } if(sgogal=="制导导弹") { gogal=10; } if(sgogal=="--------") { gogal=0; } //esmbaseevent int esmbaseevent; CString sesmbaseevent; m_esm.GetLBText(m_esm.GetCurSel(),sesmbaseevent); if(sesmbaseevent=="搜索") { esmbaseevent=1; } if(sesmbaseevent=="跟踪") { esmbaseevent=2; } if(sesmbaseevent=="干扰") { esmbaseevent=3; } if(sesmbaseevent=="火控引导") { esmbaseevent=4; } if(sesmbaseevent=="--------") { esmbaseevent=0; } //combaseevent int combaseevent; CString scombaseevent; m_com.GetLBText(m_com.GetCurSel(),scombaseevent); if(scombaseevent=="联络") { combaseevent=1; } if(scombaseevent=="指挥") { combaseevent=2; } if(scombaseevent=="--------") { combaseevent=0; } //plat int plat; CString splat; m_pla.GetLBText(m_pla.GetCurSel(),splat); if(splat=="--------") { plat=0; } if(splat=="警戒") { plat=1; } if(splat=="巡逻") { plat=2; } if(splat=="拦截") { plat=3; } if(splat=="攻击") { plat=4; } if(splat=="轰炸") { plat=5; } if(splat=="突防") { plat=6; } if(splat=="干扰") { plat=7; } if(splat=="预警指挥") { plat=8; } if(splat=="不明") { plat=9; } CString sql; sql.Format("update 平台态势 set Track基本事件=%d,Rd=%d,High=%d,Speed=%d,AddSpeed=%d,Azimuth=%d,ESM基本事件=%d,COM基本事件=%d,目标类型=%d,平台态势=%d where ID=%d",trackbaseevent,rd,high,speed,addspeed,azimuth,esmbaseevent,combaseevent,gogal,plat,ids); try { theApp.m_DataBase.pConn->Execute((_bstr_t)sql,NULL,adCmdText); } catch(_com_error e) { AfxMessageBox(e.Description()); } m_Grid.DeleteAllItems(); theApp.m_DataBase.GetPlatEvent(); AddToGrid(); }
BOOL CDialogPLA::OnInitDialog() { CDialog::OnInitDialog(); // TODO: Add extra initialization here m_Grid.SetExtendedStyle(LVS_EX_FLATSB|LVS_EX_HEADERDRAGDROP|LVS_EX_FULLROWSELECT|LVS_EX_ONECLICKACTIVATE|LVS_EX_GRIDLINES); m_Grid.InsertColumn(0,"知识序号",LVCFMT_LEFT,80,0); m_Grid.InsertColumn(1,"航迹基本事件",LVCFMT_LEFT,130,1); m_Grid.InsertColumn(2,"径距",LVCFMT_LEFT,80,2); m_Grid.InsertColumn(3,"高度",LVCFMT_LEFT,80,3); m_Grid.InsertColumn(4,"速度",LVCFMT_LEFT,80,4); m_Grid.InsertColumn(5,"加速度",LVCFMT_LEFT,80,5); m_Grid.InsertColumn(6,"偏航角",LVCFMT_LEFT,80,6); m_Grid.InsertColumn(7,"ESM基本事件",LVCFMT_LEFT,120,7); m_Grid.InsertColumn(8,"COM基本事件",LVCFMT_LEFT,120,8); m_Grid.InsertColumn(9,"目标类型",LVCFMT_LEFT,150,9); m_Grid.InsertColumn(10,"平台态势",LVCFMT_LEFT,120,10); AddToGrid(); //trabaseevent m_tra.InsertString(0,"--------"); m_tra.InsertString(1,"匀速直线运动"); m_tra.InsertString(2,"加速直线运动"); m_tra.InsertString(3,"俯冲"); m_tra.InsertString(4,"上升"); m_tra.InsertString(5,"拐弯"); m_tra.InsertString(6,"远离本舰"); m_tra.InsertString(7,"逼近本舰"); m_tra.InsertString(8,"位置固定"); m_tra.SetCurSel(0); //rd m_rd.InsertString(0,"--------"); m_rd.InsertString(1,"不变"); m_rd.InsertString(2,"变小"); m_rd.InsertString(3,"变大"); m_rd.SetCurSel(0); //high m_high.InsertString(0,"--------"); m_high.InsertString(1,"不变"); m_high.InsertString(2,"变小"); m_high.InsertString(3,"变大"); m_high.SetCurSel(0); //speed m_speed.InsertString(0,"--------"); m_speed.InsertString(1,"不变"); m_speed.InsertString(2,"变小"); m_speed.InsertString(3,"变大"); m_speed.SetCurSel(0); //addspeed m_addspeed.InsertString(0,"--------"); m_addspeed.InsertString(1,"不变"); m_addspeed.InsertString(2,"变小"); m_addspeed.InsertString(3,"变大"); m_addspeed.SetCurSel(0); //azimuth m_azimuth.InsertString(0,"--------"); m_azimuth.InsertString(1,"不变"); m_azimuth.InsertString(2,"变小"); m_azimuth.InsertString(3,"变大"); m_azimuth.SetCurSel(0); //gogal m_gog.InsertString(0,"--------"); m_gog.InsertString(1,"战斗机"); m_gog.InsertString(2,"轰炸机"); m_gog.InsertString(3,"歼击机、攻击机"); m_gog.InsertString(4,"预警机"); m_gog.InsertString(5,"侦察机"); m_gog.InsertString(6,"干扰机"); m_gog.InsertString(7,"直升机"); m_gog.InsertString(8,"舰艇"); m_gog.InsertString(9,"战术导弹"); m_gog.InsertString(10,"制导武器"); m_gog.SetCurSel(0); //esmbaseevent m_esm.InsertString(0,"--------"); m_esm.InsertString(1,"搜索"); m_esm.InsertString(2,"跟踪"); m_esm.InsertString(3,"干扰"); m_esm.InsertString(4,"火控引导"); m_esm.SetCurSel(0); //combaseevent m_com.InsertString(0,"--------"); m_com.InsertString(1,"联络"); m_com.InsertString(2,"指挥"); m_com.SetCurSel(0); //plat m_pla.InsertString(0,"--------"); m_pla.InsertString(1,"警戒"); m_pla.InsertString(2,"巡逻"); m_pla.InsertString(3,"拦截"); m_pla.InsertString(4,"攻击"); m_pla.InsertString(5,"轰炸"); m_pla.InsertString(6,"突防"); m_pla.InsertString(7,"干扰"); m_pla.InsertString(8,"预警指挥"); m_pla.InsertString(9,"不明"); m_pla.SetCurSel(0); return TRUE; // return TRUE unless you set the focus to a control // EXCEPTION: OCX Property Pages should return FALSE }
void CDialogPLA::OnButadd() { // TODO: Add your control notification handler code here UpdateData(TRUE); //theApp.m_DataBase.pRst.CreateInstance(__uuidof(Recordset)); theApp.m_DataBase.pRst->Open("select * from 平台态势",theApp.m_DataBase.pConn.GetInterfacePtr(),adOpenDynamic,adLockOptimistic,adCmdText); int trackbaseevent=0; int rd=0; int high=0; int speed=0; int addspeed=0; int azimuth=0; int esmbaseevent=0; int combaseevent=0; int gogal=0; int plat=0; CString strackbaseevent,srd,shigh,sspeed,saddspeed,sazimuth,sesmbaseevent,scombaseevent,sgogal,splat; m_tra.GetLBText(m_tra.GetCurSel(),strackbaseevent); m_rd.GetLBText(m_rd.GetCurSel(),srd); m_speed.GetLBText(m_speed.GetCurSel(),sspeed); m_addspeed.GetLBText(m_addspeed.GetCurSel(),saddspeed); m_azimuth.GetLBText(m_azimuth.GetCurSel(),sazimuth); m_high.GetLBText(m_high.GetCurSel(),shigh); m_gog.GetLBText(m_gog.GetCurSel(),sgogal); m_esm.GetLBText(m_esm.GetCurSel(),sesmbaseevent); m_com.GetLBText(m_com.GetCurSel(),scombaseevent); m_pla.GetLBText(m_pla.GetCurSel(),splat); //trackbaseevent if(strackbaseevent=="匀速直线运动") { trackbaseevent=1; } if(strackbaseevent=="加速直线运动") { trackbaseevent=2; } if(strackbaseevent=="俯冲") { trackbaseevent=3; } if(strackbaseevent=="上升") { trackbaseevent=4; } if(strackbaseevent=="拐弯") { trackbaseevent=5; } if(strackbaseevent=="远离本舰") { trackbaseevent=6; } if(strackbaseevent=="逼近本舰") { trackbaseevent=7; } if(strackbaseevent=="位置固定") { trackbaseevent=8; } if(strackbaseevent=="--------") { trackbaseevent=0; } //rd if(srd=="--------") { rd=0; } if(srd=="不变") { rd=1; } if(srd=="变大") { rd=3; } if(srd=="变小") { rd=5; } //speed if(sspeed=="--------") { speed=0; } if(sspeed=="不变") { speed=1; } if(sspeed=="变大") { speed=3; } if(sspeed=="变小") { speed=5; } //addspeed if(saddspeed=="--------") { addspeed=0; } if(saddspeed=="不变") { addspeed=1; } if(saddspeed=="变大") { addspeed=3; } if(saddspeed=="变小") { addspeed=5; } //azimuth if(sazimuth=="--------") { azimuth=0; } if(sazimuth=="不变") { azimuth=1; } if(sazimuth=="变大") { azimuth=3; } if(sazimuth=="变小") { azimuth=5; } //high if(shigh=="--------") { high=0; } if(shigh=="不变") { high=1; } if(shigh=="变大") { high=3; } if(shigh=="变小") { high=5; } //gogal if(sgogal=="战斗机") { gogal=1; } if(sgogal=="轰炸机") { gogal=2; } if(sgogal=="歼击机、攻击机") { gogal=3; } if(sgogal=="预警机") { gogal=4; } if(sgogal=="侦察机") { gogal=5; } if(sgogal=="干扰机") { gogal=6; } if(sgogal=="直升机") { gogal=7; } if(sgogal=="舰艇") { gogal=8; } if(sgogal=="战术导弹") { gogal=9; } if(sgogal=="制导导弹") { gogal=10; } if(sgogal=="--------") { gogal=0; } //esmbaseevent if(sesmbaseevent=="搜索") { esmbaseevent=1; } if(sesmbaseevent=="跟踪") { esmbaseevent=2; } if(sesmbaseevent=="干扰") { esmbaseevent=3; } if(sesmbaseevent=="火控引导") { esmbaseevent=4; } if(sesmbaseevent=="--------") { esmbaseevent=0; } //combaseevent if(scombaseevent=="联络") { combaseevent=1; } if(scombaseevent=="指挥") { combaseevent=2; } if(scombaseevent=="--------") { combaseevent=0; } //plat if(splat=="--------") { plat=0; } if(splat=="警戒") { plat=1; } if(splat=="巡逻") { plat=2; } if(splat=="拦截") { plat=3; } if(splat=="攻击") { plat=4; } if(splat=="轰炸") { plat=5; } if(splat=="突防") { plat=6; } if(splat=="干扰") { plat=7; } if(splat=="预警指挥") { plat=8; } if(splat=="不明") { plat=9; } int did=0; while(!theApp.m_DataBase.pRst->adoEOF) { int id=atoi((_bstr_t)theApp.m_DataBase.pRst->GetCollect("ID")); if(id==atoi(m_id)) { did=1; MessageBox("ID号重复,请重新添加!"); } theApp.m_DataBase.pRst->MoveNext(); } //此处可不做判断,由数据库来做唯一性判断 try { if(m_id=="") { MessageBox("ID号不可为空!"); } else if(did==1) { return; } else { theApp.m_DataBase.pRst->MoveLast(); theApp.m_DataBase.pRst->AddNew(); theApp.m_DataBase.pRst->PutCollect("ID",atol(m_id)); theApp.m_DataBase.pRst->PutCollect("Track基本事件",(long)trackbaseevent); theApp.m_DataBase.pRst->PutCollect("Rd",(long)rd); theApp.m_DataBase.pRst->PutCollect("Speed",(long)speed); theApp.m_DataBase.pRst->PutCollect("AddSpeed",(long)addspeed); theApp.m_DataBase.pRst->PutCollect("Azimuth",(long)azimuth); theApp.m_DataBase.pRst->PutCollect("High",(long)high); theApp.m_DataBase.pRst->PutCollect("ESM基本事件",(long)esmbaseevent); theApp.m_DataBase.pRst->PutCollect("COM基本事件",(long)combaseevent); theApp.m_DataBase.pRst->PutCollect("目标类型",(long)gogal); theApp.m_DataBase.pRst->PutCollect("平台态势",(long)plat); theApp.m_DataBase.pRst->Update(); } } catch(_com_error e) { MessageBox(e.Description()); } theApp.m_DataBase.pRst->Close(); m_Grid.DeleteAllItems(); theApp.m_DataBase.GetPlatEvent(); AddToGrid(); }
// adds all displacement faces as a series of convex objects // UNDONE: Only add the displacements for this model? void Disp_AddCollisionModels( CUtlVector<CPhysCollisionEntry *> &collisionList, dmodel_t *pModel, int contentsMask ) { int dispIndex; // Add each displacement to the grid hash for ( dispIndex = 0; dispIndex < g_CoreDispInfos.Count(); dispIndex++ ) { CCoreDispInfo *pDispInfo = &g_CoreDispInfos[ dispIndex ]; mapdispinfo_t *pMapDisp = &mapdispinfo[ dispIndex ]; // not solid for this pass if ( !(pMapDisp->contents & contentsMask) ) continue; int gridIndex = Disp_GridIndex( pDispInfo ); AddToGrid( gridIndex, dispIndex ); } // now make a polysoup for the terrain in each grid for ( int grid = 0; grid < gDispGridList.Count(); grid++ ) { int triCount = 0; CPhysPolysoup *pTerrainPhysics = physcollision->PolysoupCreate(); // iterate the displacements in this grid for ( int listIndex = 0; listIndex < gDispGridList[grid].dispList.Count(); listIndex++ ) { dispIndex = gDispGridList[grid].dispList[listIndex]; CCoreDispInfo *pDispInfo = &g_CoreDispInfos[ dispIndex ]; mapdispinfo_t *pMapDisp = &mapdispinfo[ dispIndex ]; // Get the material id. MaterialSystemMaterial_t matID = GetMatIDFromDisp( pMapDisp ); // Get the triangle count. int nTriCount = pDispInfo->GetTriCount(); if ( nTriCount >= 0xFFFF ) { // if we hit this error, it's probably time to make the grid adaptive (DISP_GRID_SIZEX,etc) Error("Terrain collision overflow!\n"); } // Convert the tristrip into a triangle list. CUtlVector<unsigned short> indices; indices.SetSize( nTriCount * 3 ); for ( int iTri = 0; iTri < nTriCount; ++iTri ) { unsigned short iVert0, iVert1, iVert2; pDispInfo->GetTriIndices( iTri, iVert0, iVert1, iVert2 ); indices[iTri*3] = iVert0; indices[iTri*3+1] = iVert1; indices[iTri*3+2] = iVert2; } Vector tmpVerts[3]; for ( iTri = 0; iTri < nTriCount; ++iTri ) { float flAlphaTotal = 0.0f; for ( int iTriVert = 0; iTriVert < 3; ++iTriVert ) { pDispInfo->GetVert( indices[iTri*3+iTriVert], tmpVerts[iTriVert] ); flAlphaTotal += pDispInfo->GetAlpha( indices[iTri*3+iTriVert] ); } int nProp = g_SurfaceProperties[texinfo[pMapDisp->face.texinfo].texdata]; if ( flAlphaTotal > DISP_ALPHA_PROP_DELTA ) { int nProp2 = GetSurfaceProperties2( matID, "surfaceprop2" ); if ( nProp2 != -1 ) { nProp = nProp2; } } int nMaterialIndex = RemapWorldMaterial( nProp ); physcollision->PolysoupAddTriangle( pTerrainPhysics, tmpVerts[0], tmpVerts[1], tmpVerts[2], nMaterialIndex ); } } // convert the whole grid's polysoup to a collide and store in the collision list CPhysCollide *pCollide = physcollision->ConvertPolysoupToCollide( pTerrainPhysics ); if ( pCollide ) { collisionList.AddToTail( new CPhysCollisionEntryStaticMesh( pCollide, NULL ) ); } // now that we have the collide, we're done with the soup physcollision->PolysoupDestroy( pTerrainPhysics ); } }
//添加涉密词 void CWordNetDlg::OnBnClickedAdd() { // TODO: 在此添加控件通知处理程序代码 //弹出添加涉密词对话框 CEditDInfoDlg dlg; INT_PTR nResponse = dlg.DoModal(); if (nResponse == IDOK) { // TODO: 在此放置处理何时用 // “确定”来关闭对话框的代码 //获取添加的涉密词,并添入数据库 try{ UpdateData(TRUE); //获取涉密词,并判断是否为空 CString m_name=dlg.GetSenseWord(); if(m_name.IsEmpty()) { MessageBox(_T("涉密词不能为空!"),_T("编辑涉密词"),MB_ICONERROR); return; } //插入数据库,并更新显示 ADOConn m_AdoConn; m_AdoConn.OnInitADOConn(); _bstr_t sql; sql="select* from dict"; _RecordsetPtr m_pRecordset; m_pRecordset=m_AdoConn.GetRecordSet(sql); try{ //判断是否已经存在,若存在,则不插入,否则插入 while(m_AdoConn.m_pRecordset->adoEOF==0) { CString strName=(LPCTSTR)(_bstr_t)m_pRecordset->GetCollect(_T("name")); if(strName.Trim()==m_name.Trim()){ MessageBox(_T("涉密词已存在!"),_T("编辑涉密词"),MB_ICONWARNING); m_AdoConn.ExitConnect(); return; } m_pRecordset->MoveNext(); } //插入 m_pRecordset->AddNew(); m_pRecordset->put_Collect(_variant_t(_T("name")),_variant_t(m_name)); m_pRecordset->Update(); m_AdoConn.ExitConnect(); } catch(...) { AfxMessageBox(_T("操作失败")); return; } AfxMessageBox(_T("添加成功")); m_grid.DeleteAllItems();//删除ListContrl控件中的数据 AddToGrid(); }catch(...) { MessageBox(_T("添加涉密词失败!"),_T("编辑涉密词"),MB_ICONERROR); } } else if (nResponse == IDCANCEL) { // TODO: 在此放置处理何时用 // “取消”来关闭对话框的代码 } }