📄 measure.c
字号:
if ( point_info[i].point.x >= orireg.left &&
point_info[i].point.y >= orireg.top &&
point_info[i].relat[j].relat_point.x >= orireg.left &&
point_info[i].relat[j].relat_point.y >= orireg.top )
{
DrawLine( hGC, GPC_BLACK,
point_info[i].point.x - orireg.left + map_x - 2,
point_info[i].point.y - orireg.top + map_y - 2,
point_info[i].point.x - orireg.left + map_x + 2,
point_info[i].point.y - orireg.top + map_y + 2,
GPC_SOLID_LINE, GPC_REPLACE_STYLE );
DrawLine( hGC, GPC_BLACK,
point_info[i].point.x - orireg.left + map_x + 2,
point_info[i].point.y - orireg.top + map_y - 2,
point_info[i].point.x - orireg.left + map_x - 2,
point_info[i].point.y - orireg.top + map_y + 2,
GPC_SOLID_LINE, GPC_REPLACE_STYLE );
//重新画线
DrawLine( hGC, GPC_BLACK,
point_info[i].point.x - orireg.left + map_x,
point_info[i].point.y - orireg.top + map_y,
point_info[i].relat[j].relat_point.x - orireg.left + map_x,
point_info[i].relat[j].relat_point.y - orireg.top + map_y,
GPC_SOLID_LINE, GPC_REPLACE_STYLE );
}
}
}
}
SetWindowText( bt_hide, "底图", NULL );
}
else // 底图显示模式
{
SysDspCutBMP( hGC, map_x, map_y, hbmp, &orireg, 1 );
// DisplayBMP( hGC, map_x, map_y, hbmp );
//重新画点
for ( i = 0; i < point_num; i++ )
{
for ( j = 0; j < RELAT_POINT_NUM_MAX; j++ )
{
if ( point_info[i].relat[j].relat_flag == BEUSED )
{
if ( point_info[i].point.x >= orireg.left &&
point_info[i].point.y >= orireg.top &&
point_info[i].relat[j].relat_point.x >= orireg.left &&
point_info[i].relat[j].relat_point.y >= orireg.top )
{
DrawLine( hGC, GPC_BLACK,
point_info[i].point.x - orireg.left + map_x - 2,
point_info[i].point.y - orireg.top + map_y - 2,
point_info[i].point.x - orireg.left + map_x + 2,
point_info[i].point.y - orireg.top + map_y + 2,
GPC_SOLID_LINE, GPC_REPLACE_STYLE );
DrawLine( hGC, GPC_BLACK,
point_info[i].point.x - orireg.left + map_x + 2,
point_info[i].point.y - orireg.top + map_y - 2,
point_info[i].point.x - orireg.left + map_x - 2,
point_info[i].point.y - orireg.top + map_y + 2,
GPC_SOLID_LINE, GPC_REPLACE_STYLE );
DrawLine( hGC, GPC_BLACK,
point_info[i].point.x - orireg.left + map_x,
point_info[i].point.y - orireg.top + map_y,
point_info[i].relat[j].relat_point.x - orireg.left + map_x,
point_info[i].relat[j].relat_point.y - orireg.top + map_y,
GPC_SOLID_LINE, GPC_REPLACE_STYLE );
}
}
}
}
SetWindowText( bt_hide, "隐藏", NULL );
}
}
// else if( msg.lparam == map_area )
// {
// if( state == STATE_RECORD_PROPERTY )
// PropertyPopupWin();
// }
break;
case ASIX_PEN:
if( zoom_state == ZOOM_IN )
{
// 选择区域放大
for ( i = 0; i < 4; i++ )
if( msg.lparam == area[i] )
break;
// reginfo.left = orireg.left + regs[i].left;
// reginfo.top = orireg.top + regs[i].top;
// reginfo.right = orireg.left + regs[i].right;
// reginfo.bottom = orireg.top + regs[i].bottom;
reginfo.left = orireg.left + regs[i].left - map_x;
reginfo.top = orireg.top + regs[i].top - map_y;
reginfo.right = orireg.left + regs[i].right - map_x;
reginfo.bottom = orireg.top + regs[i].bottom - map_y;
if ( reginfo.left < 0 )
{
reginfo.left = 0;
reginfo.right = 78;
}
if ( reginfo.right > MAP_RIGHT )
{
reginfo.right = MAP_RIGHT;
reginfo.left = MAP_RIGHT - 78;
}
if ( reginfo.top < 0 )
{
reginfo.top = 0;
reginfo.bottom = 75;
}
if ( reginfo.bottom > MAP_BOTTOM )
{
reginfo.bottom = MAP_BOTTOM;
reginfo.top = MAP_BOTTOM - 75;
}
ClearRec( hGC, GPC_WHITE, map_x, map_y, 156, 150, GPC_REPLACE_STYLE );
SysDspCutBMP( hGC, map_x, map_y, hbmp, ®info, 2 );
//放大所有的点
for ( i = 0; i < point_num; i++ )
{
for ( j = 0; j < RELAT_POINT_NUM_MAX; j++ )
{
if ( point_info[i].relat[j].relat_flag == BEUSED )
{
DrawLine( hGC, GPC_DARKGREY,
( point_info[i].point.x - reginfo.left ) * 2 + map_x,
( point_info[i].point.y - reginfo.top ) * 2 + map_y,
( point_info[i].relat[j].relat_point.x - reginfo.left ) * 2 + map_x,
( point_info[i].relat[j].relat_point.y - reginfo.top ) * 2 + map_y,
GPC_SOLID_LINE, GPC_REPLACE_STYLE );
DrawLine( hGC, GPC_BLACK,
point_info[i].point.x - orireg.left + map_x + 2,
point_info[i].point.y - orireg.top + map_y - 2,
point_info[i].point.x - orireg.left + map_x - 2,
point_info[i].point.y - orireg.top + map_y + 2,
GPC_SOLID_LINE, GPC_REPLACE_STYLE );
DrawLine( hGC, GPC_DARKGREY,
( point_info[i].point.x - reginfo.left ) * 2 + map_x + 1,
( point_info[i].point.y - reginfo.top ) * 2 + map_y,
( point_info[i].relat[j].relat_point.x - reginfo.left ) * 2 + map_x + 1,
( point_info[i].relat[j].relat_point.y - reginfo.top ) * 2 + map_y,
GPC_SOLID_LINE, GPC_REPLACE_STYLE );
}
}
}
}
if ( state == STATE_MOVING )
GetPos( msg, &xpos, &ypos );
//看是否点击了测量的点,如果是,则要么连线,要么取消线,或者等待下次的点击
for ( i = 0; i < point_num; i++ )//查找是否点击测量的点
{
if( msg.lparam == point_area[i] )
{
DrawCircle( hGC, GPC_BLACK,
point_info[i].point.x + map_x - orireg.left,
point_info[i].point.y + map_y - orireg.top,
2, GPC_XOR_STYLE);
//点击中后,闪一下
/* DrawLine( hGC, GPC_BLACK,
point_info[i].point.x + map_x - orireg.left - 2,
point_info[i].point.y + map_y - orireg.top - 2,
point_info[i].point.x + map_x - orireg.left + 2,
point_info[i].point.y + map_y - orireg.top + 2,
GPC_SOLID_LINE, GPC_XOR_STYLE );
DrawLine( hGC, GPC_BLACK,
point_info[i].point.x + map_x - orireg.left + 2,
point_info[i].point.y + map_y - orireg.top - 2,
point_info[i].point.x + map_x - orireg.left - 2,
point_info[i].point.y + map_y - orireg.top + 2,
GPC_SOLID_LINE, GPC_XOR_STYLE );
DrawLine( hGC, GPC_BLACK,
point_info[i].point.x + map_x - orireg.left - 2,
point_info[i].point.y + map_y - orireg.top - 2,
point_info[i].point.x + map_x - orireg.left + 2,
point_info[i].point.y + map_y - orireg.top + 2,
GPC_SOLID_LINE, GPC_XOR_STYLE );
DrawLine( hGC, GPC_BLACK,
point_info[i].point.x + map_x - orireg.left + 2,
point_info[i].point.y + map_y - orireg.top - 2,
point_info[i].point.x + map_x - orireg.left - 2,
point_info[i].point.y + map_y - orireg.top + 2,
GPC_SOLID_LINE, GPC_XOR_STYLE );
*/ break;
}
}
if ( i == POINT_NUM_MAX )//没有点击测量的点
break;
if ( relat_flag == 0 )//在此之前未点中测量的点
{
relat_point.x = point_info[i].point.x;
relat_point.y = point_info[i].point.y;
relat_flag = i + 1;//该点在point_info数组中保存的位置为relat_flag - 1
}
else//在此之前已经点击了一个测量的点
{
//判断是否点了同一点,如果是,则跳出
if ( relat_point.x == point_info[i].point.x &&
relat_point.y == point_info[i].point.y )
{
// DrawCircle( hGC, GPC_BLACK,
// point_info[i].point.x + map_x - orireg.left,
// point_info[i].point.y + map_y - orireg.top,
// 2, GPC_XOR_STYLE);
break;
}
//检查这两点之间有没有关联
for ( j = 0; j < RELAT_POINT_NUM_MAX; j++ )
{
if ( point_info[i].relat[j].relat_flag == BEUSED )
{
if ( point_info[i].relat[j].relat_point.x == relat_point.x
&& point_info[i].relat[j].relat_point.y == relat_point.y )
break;
}
}
if ( j < RELAT_POINT_NUM_MAX )//这两个点已经相关联,则取消关联
{
point_info[i].relat[j].relat_flag = NOTUSED;
for ( j = 0; j < RELAT_POINT_NUM_MAX; j++ )
{
if( point_info[relat_flag - 1].relat[j].relat_flag == BEUSED )
{
if ( point_info[relat_flag - 1].relat[j].relat_point.x == point_info[i].point.x
&& point_info[relat_flag - 1].relat[j].relat_point.y == point_info[i].point.y )
{
point_info[relat_flag - 1].relat[j].relat_flag = NOTUSED;
break;
}
}
}
//两点之间连线,消除作为标记的圆
DrawLine( hGC, GPC_DARKGREY,
( relat_point.x + map_x - orireg.left ),
( relat_point.y + map_y - orireg.top ),
( point_info[i].point.x + map_x - orireg.left ),
( point_info[i].point.y + map_y - orireg.top ),
GPC_SOLID_LINE, GPC_XOR_STYLE );
DrawCircle( hGC, GPC_BLACK,
point_info[i].point.x + map_x - orireg.left,
point_info[i].point.y + map_y - orireg.top,
2, GPC_XOR_STYLE);
DrawCircle( hGC, GPC_BLACK,
relat_point.x + map_x - orireg.left,
relat_point.y + map_y - orireg.top,
2, GPC_XOR_STYLE);
relat_flag = 0;
}
else
{
// 如果与这两点相关联的点数都没有没有到达最大值,则先保存该两点的关联点信息,然后连线
for ( j = 0; j < RELAT_POINT_NUM_MAX; j++ )
{
if ( point_info[i].relat[j].relat_flag == NOTUSED )//这个没有被使用
break;
}
if ( j < RELAT_POINT_NUM_MAX )//还能够保存与这点相关联的点
{
point_info[i].cur_pos = j;
for ( j = 0; j < RELAT_POINT_NUM_MAX; j++ )
{
if ( point_info[relat_flag - 1].relat[j].relat_flag == NOTUSED )//这个没有被使用
break;
}
if ( j < RELAT_POINT_NUM_MAX )//还能够保存与这点相关联的点
point_info[relat_flag - 1].cur_pos = j;
{
point_info[i].relat[point_info[i].cur_pos].relat_point.x = relat_point.x;
point_info[i].relat[point_info[i].cur_pos].relat_point.y = relat_point.y;
point_info[i].relat[point_info[i].cur_pos].relat_serial = relat_flag - 1;
point_info[i].relat[point_info[i].cur_pos].relat_flag = BEUSED;
// point_info[i].cur_pos++;
point_info[relat_flag - 1].relat[point_info[relat_flag - 1].cur_pos].relat_point.x
= point_info[i].point.x;
point_info[relat_flag - 1].relat[point_info[relat_flag - 1].cur_pos].relat_point.y
= point_info[i].point.y;
point_info[relat_flag - 1].relat[point_info[relat_flag - 1].cur_pos].relat_serial = i;
point_info[relat_flag - 1].relat[point_info[relat_flag - 1].cur_pos].relat_flag = BEUSED;
// point_info[relat_flag - 1].cur_pos++;
//两点之间连线
DrawLine( hGC, GPC_DARKGREY, ( relat_point.x - orireg.left + map_x ),
( relat_point.y - orireg.top + map_y ),
( point_info[i].point.x - orireg.left + map_x ),
( point_info[i].point.y - orireg.top + map_y ),
GPC_SOLID_LINE, GPC_XOR_STYLE );
DrawCircle( hGC, GPC_BLACK,
point_info[i].point.x + map_x - orireg.left,
point_info[i].point.y + map_y - orireg.top,
2, GPC_XOR_STYLE);
DrawCircle( hGC, GPC_BLACK,
relat_point.x + map_x - orireg.left,
relat_point.y + map_y - orireg.top,
2, GPC_XOR_STYLE);
relat_flag = 0;
}
}
}
}
break;
case ASIX_INPUT_STATUS:
if ( state == STATE_MOVING )//平移
{
if ( msg.wparam == PPSM_INPUT_PEN_UP )
{
if ( zoom_state == ZOOM_IN )
{
for ( i = 0; i < 4; i++ )
{
if( msg.lparam == area[i] )
{
break;
}
}
reginfo.left = orireg.left + regs[i].left + xpos - 39;
reginfo.top = orireg.top + regs[i].top + ypos - 38;
reginfo.right = reginfo.left + 78;
reginfo.bottom = reginfo.top + 75;
if ( reginfo.left < 0 )
{
reginfo.left = 0;
reginfo.right = 78;
}
if ( reginfo.right > MAP_RIGHT )
{
reginfo.right = MAP_RIGHT;
reginfo.left = MAP_RIGHT - 78;
}
if ( reginfo.top < 0 )
{
reginfo.top = 0;
reginfo.bottom = 75;
}
if ( reginfo.bottom > MAP_BOTTOM )
{
reginfo.bottom = MAP_BOTTOM;
reginfo.top = MAP_BOTTOM - 75;
}
}
orireg.left = orireg.left + xpos - 78;
orireg.top = orireg.top + ypos - 75;
orireg.right = orireg.left + 156;
orireg.bottom = orireg.top + 150;
if ( orireg.left < 0 )
{
orireg.left = 0;
orireg.right = 156;
}
if ( orireg.right > MAP_RIGHT )
{
orireg.right = MAP_RIGHT;
orireg.left = MAP_RIGHT - 156;
}
if ( orireg.top < 0 )
{
orireg.top = 0;
orireg.bottom = 150;
}
if ( orireg.bottom > MAP_BOTTOM )
{
orireg.bottom = MAP_BOTTOM;
orireg.top = MAP_BOTTOM - 150;
}
if ( zoom_state == ZOOM_IN )
SysDspCutBMP( hGC, map_x,map_y, hbmp, ®info, 2 );
else
SysDspCutBMP( hGC, map_x, map_y, hbmp, &orireg, 1 );
//重新画点
for ( i = 0; i < point_num; i++ )
{
for ( j = 0; j < RELAT_POINT_NUM_MAX; j++ )
{
if ( point_info[i].relat[j].relat_flag == BEUSED )
{
if ( point_info[i].point.x >= orireg.left &&
point_info[i].point.y >= orireg.top &&
point_info[i].relat[j].relat_point.x >= orireg.left &&
point_info[i].relat[j].relat_point.y >= orireg.top )
{
DrawLine( hGC, GPC_BLACK,
point_info[i].point.x - orireg.left + map_x - 2,
point_info[i].point.y - orireg.top + map_y - 2,
point_info[i].point.x - orireg.left + map_x + 2,
point_info[i].point.y - orireg.top + map_y + 2,
GPC_SOLID_LINE, GPC_REPLACE_STYLE );
DrawLine( hGC, GPC_BLACK,
point_info[i].point.x - orireg.left + map_x + 2,
point_info[i].point.y - orireg.top + map_y - 2,
point_info[i].point.x - orireg.left + map_x - 2,
point_info[i].point.y - orireg.top + map_y + 2,
GPC_SOLID_LINE, GPC_REPLACE_STYLE );
DrawLine( hGC, GPC_DARKGREY,
point_info[i].point.x - orireg.left + map_x,
point_info[i].point.y - ori
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -