visionview.cpp
来自「FIRA 3对3 机器人足球PC端控制程序。」· C++ 代码 · 共 2,092 行 · 第 1/5 页
CPP
2,092 行
}
pZoomBuffer += 4;
}
}
else
pZoomBuffer += 4*ZOOM_SIZE;
}
}
// --------------------------------------------------------
// Param : none
// Return : none
// Remark : 矫府倔 器飘 檬扁拳
// --------------------------------------------------------
void CVisionView::OnCom1()
{
// TODO: Add your control notification handler code here
m_pComm.DestroyComm();
UpdateData(TRUE);
m_pComm.DestroyComm();
m_pComm.SetComPort(1,19200,8,0,0);
m_pComm.CreateCommInfo();
m_pComm.OpenComPort();
UpdateData(FALSE);
}
// --------------------------------------------------------
// Param : none
// Return : none
// Remark : 矫府倔 器飘 檬扁拳
// --------------------------------------------------------
void CVisionView::OnCom2()
{
// TODO: Add your control notification handler code here
m_pComm.DestroyComm();
UpdateData(TRUE);
m_pComm.DestroyComm();
m_pComm.SetComPort(2,19200,8,0,0);
m_pComm.CreateCommInfo();
m_pComm.OpenComPort();
UpdateData(FALSE);
}
// --------------------------------------------------------
// Param : none
// Return : none
// Remark : 权评狼 榜措 困摹 (哭率, 坷弗率) 沥窍扁
// --------------------------------------------------------
void CVisionView::OnLeftHome()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
bFlagIsOurHomeLeft = TRUE;
UpdateData(FALSE);
}
void CVisionView::OnRightHome()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
bFlagIsOurHomeLeft = FALSE;
UpdateData(FALSE);
}
// --------------------------------------------------------
// Param : none
// Return : none
// Remark : 惑炔喊 傈贱 急琶窍扁
// --------------------------------------------------------
void CVisionView::OnKickOff()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nGame = 0;
MODE=m_nGame;
//MODE = 0;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnPenalityKick()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nGame = 1;
MODE=m_nGame;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnFreeKick()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nGame = 2;
MODE=m_nGame;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnFreeBall()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nGame = 3;
MODE=m_nGame;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnGoalieKick()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nGame = 4;
MODE=m_nGame;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnDefense()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nGame = 5;
MODE=m_nGame;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnKickOff2()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nSetting = 0;
MODE1=m_nSetting;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnPenalityKick2()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nSetting = 1;
MODE1=m_nSetting;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnFreeKick2()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nSetting = 2;
MODE1=m_nSetting;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnFreeBall21()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nSetting = 3;
MODE1=m_nSetting;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnFreeBall22()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nSetting = 4;
MODE1=m_nSetting;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnFreeBall23()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nSetting = 5;
MODE1=m_nSetting;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnFreeBall24()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nSetting = 6;
MODE1=m_nSetting;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnGoalieKick2()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nSetting = 7;
MODE1=m_nSetting;
UpdateData(FALSE);
}
// --------------------------------------------------------
void CVisionView::OnDefense2()
{
// TODO: Add your control notification handler code here
UpdateData(TRUE);
m_nSetting = 8;
MODE1=m_nSetting;
UpdateData(FALSE);
}
// --------------------------------------------------------
// Param : rx, ry 捞傈 橇饭烙狼 拱眉 困摹
// size 飘发欧 扩档快 农扁
// *offx, *offy 飘发欧 扩档快狼 哭率, 困 困摹
// Return : none
// Remark : 飘发欧 扩档快狼 谅惑窜 困摹甫 捞傈 拱眉 困摹甫
// 吝缴栏肺 犁汲沥茄促. 版拌俊 吧摹霸 登搁 弊 版拌
// 俊 搓霸 困摹矫挪促.
// --------------------------------------------------------
void CVisionView::DetermineOffsetXY(short rx, short ry, short size, long *offx, long *offy)
{
short halfsize; // 飘贰欧 扩档快 例馆 农扁(x, y 傍烹荤侩)
halfsize = size/2;
//榜虐欺啊 版扁厘 观, 捞甫抛搁 榜措啊 乐绰 率俊 乐绰 版快甫 积阿秦焊磊. 捞 版快 弧府
//唱客具 窍骨肺 版扁厘 观鳖瘤 飘发欧 扩档快甫 犬措且 鞘夸啊 乐促.
/*if(rx < halfsize && ry < halfsize + rectBoundary.top){
*offx = 0;
*offy = rectBoundary.top;
}
else if(rx > (DispSizeX-1-halfsize) && ry < (halfsize+rectBoundary.top)){
*offx = DispSizeX-1-size;
*offy = rectBoundary.top;
}
else if(rx < halfsize && ry > (rectBoundary.bottom-1-halfsize)){
*offx = 0;
*offy = rectBoundary.bottom-1-size;
}
else if(rx > (DispSizeX-1-halfsize) && ry > (rectBoundary.bottom-1-halfsize)){
*offx = DispSizeX-1-size;
*offy = rectBoundary.bottom-1-size;
}
else if(rx < halfsize){
*offx = 0;
*offy = ry-halfsize;
}
else if(rx > (DispSizeX-1-halfsize) ){
*offx = DispSizeX-1-size;
*offy = ry-halfsize;
}
else if(ry < rectBoundary.top+halfsize){
*offx = rx-halfsize;
*offy = rectBoundary.top;
}
else if(ry > (rectBoundary.bottom-1-halfsize)){
*offx = rx-halfsize;
*offy = rectBoundary.bottom-1-size;
}
*/
// 飘贰欧 扩档快啊 版拌甫 哈绢朝 惑炔捞搁 版拌鳖瘤父 困摹肺 棱绰促.
if(rx < halfsize && ry < halfsize + rectBoundary.top){
*offx = 0;
*offy = rectBoundary.top;
}
else if(rx > (DispSizeX-1-halfsize) && ry < (halfsize+rectBoundary.top)){
*offx = DispSizeX-1-size;
*offy = rectBoundary.top;
}
else if(rx < halfsize && ry > (rectBoundary.bottom-1-halfsize)){
*offx = 0;
*offy = rectBoundary.bottom-1-size;
}
else if(rx > (DispSizeX-1-halfsize) && ry > (rectBoundary.bottom-1-halfsize)){
*offx = DispSizeX-1-size;
*offy = rectBoundary.bottom-1-size;
}
else if(rx < halfsize){
*offx = 0;
*offy = ry-halfsize;
}
else if(rx > (DispSizeX-1-halfsize) ){
*offx = DispSizeX-1-size;
*offy = ry-halfsize;
}
else if(ry < rectBoundary.top+halfsize){
*offx = rx-halfsize;
*offy = rectBoundary.top;
}
else if(ry > (rectBoundary.bottom-1-halfsize)){
*offx = rx-halfsize;
*offy = rectBoundary.bottom-1-size;
}
// 捞傈 拱眉困摹甫 吝缴栏肺 窍咯 飘贰欧 扩档快 困摹甫 棱绰促.
else {
*offx = rx-halfsize;
*offy = ry-halfsize;
}
// 瘤陛篮 鞘荐啊 酒丛.
// line捞 汗荤凳.
if( iteration % 2 == 0 ) { // 娄荐锅掳捞搁,
if( *offy % 2 == 1) // *offy甫 娄荐line俊 嘎勉
*offy -= 1;
}
else { // 圈荐锅掳捞搁,
if( *offy % 2 == 0) // *offy甫 圈荐line俊 嘎勉
*offy += 1;
}
}
/////////////////////////////////////////////////
// Choi.W.H 2000.02.21
void CVisionView::LabelingWholeImage(short object)
{
LabelingPartialImage(0, 0, DispSizeX, DispSizeY, object);
}
// Choi.W.H 2000.02.21
// //////////////////////////////////////////////
/*void CVisionView::LabelingWholeImage(long ImageSizeX, long ImageSizeY)
{
if(bFlagEven)
index_vram = BUF_OFFSET_1*(clientRect.top-1) + (clientRect.left-1);
else
index_vram = BUF_OFFSET_1*(clientRect.top) + (clientRect.left-1);
NoError = TRUE;
for(i=0;i<NUM_COLORS;i++){
indexES[i]=0;
NumberOfLabel[i]=0;
}
for(i=0;i<NUM_COLORS;i++)
for(j=0;j<MAX_NUM_ESET;j++)
ES[i][j][0] = 0; // Initialization of # of labels in j-th ES of i-th color
for(i=0;i<NUM_COLORS;i++)
for(j=0;j<MAX_NUM_LABEL;j++)
whichES[i][j] = 0;
for(i=0;i<rectBoundary.top;i++){ // 0 <= i < rectBoundary.top
index_vram += BUF_OFFSET_1;
for(j=0;j<ImageSizeX;j++) {
label[i][j] = NONE_COLOR;
ColorOfLabel[i][j] = NONE_COLOR;
}
}
for(i=(short)rectBoundary.top;i<=rectBoundary.bottom;i++) { // rectBoundary.top <= i <= rectBoundary.bottom
if(i%2 == 1) {
index_vram += BUF_OFFSET_1;
for(j=0;j<ImageSizeX;j++) {
label[i][j] = label[i-1][j];
ColorOfLabel[i][j] = ColorOfLabel[i-1][j];
}
continue;
}
index_vram++; // j == 0;
label[i][0] = NONE_COLOR;
ColorOfLabel[i][0] = NONE_COLOR;
for(j=1;j<
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?