📄 editmark.cpp
字号:
// ----------------------------------- 编辑矢量符号 -------------------------------------
void EditMark(void)
{ int code,flag,ix,iy,num,typee[20],filll[20],nn[20],**xx,**yy;
int type,fill,n,x[20],y[20];
int i,j,nt,code0,pensize;
float dd,d,d1,d2,d3,d4,d5,d6,d7,d8,d9,d10,d11,d12,d13,d14,d15;
float x1,y1,x2,y2,x01,y01,x02,y02,wx[21],wy[21];
float xt[101],yt[101];
float t; // 小窗口与编辑窗口之比例
char cc[10][7];
int dx,dy;
long start_time,end_time;
FILE *fp;
float w1,w2;
MSG msg;
int sf_edit,b_mark_number;
WriteBmpFile(".\\mid\\bk_gd$$.$11",0,0,MapWidth,MapHeight);
sf_edit=-1;
b_mark_number=Mark_number;
Mark_number=0;
pensize=Pensize;
Pensize=1;
xx=new int*[20];
yy=new int*[20];
for(i=0;i<20;i++)
{ xx[i]=new int[20];
yy[i]=new int[20];
}
for(i=0;i<20;i++)
for(j=0;j<20;j++)
{ xx[i][j]=0;
yy[i][j]=0;
}
d=10;dd=d/2.0;
d1=20;d2=13;d3=52;d4=20;d5=70;d6=20;d7=4;d8=12;d9=26;d10=50;d11=50;d12=20;d13=6;
d14=60;d15=80; // 最好与 x01---x02 y01---y02 的长和宽成比例
x1=(AUex-(d1+40*d+d2+42+d3))/2.0;y1=(AUey-(d10+30*d+d11))/2.0;
x1=(int)x1;y1=(int)y1;
x2=x1+d1+40*d+d2+42+d3;y2=y1+d10+30*d+d11;
x01=x1+d1;y01=y1+d10;
x02=x01+40*d;y02=y01+30*d;
wx[1]=x02+d4;wy[1]=y1+d6;wx[2]=wx[1]+d5;wy[2]=wy[1]+d9;
wx[3]=wx[1];wy[3]=wy[2]+d7;wx[4]=wx[2];wy[4]=wy[3]+d9;
wx[5]=wx[1];wy[5]=wy[4]+d7;wx[6]=wx[4];wy[6]=wy[5]+d9;
wx[7]=wx[1];wy[7]=wy[6]+d7;wx[8]=wx[6];wy[8]=wy[7]+d9;
wx[9]=wx[1];wy[9]=wy[8]+d7;wx[10]=wx[8];wy[10]=wy[9]+d9;
wx[11]=wx[1];wy[11]=wy[10]+d7;wx[12]=wx[10];wy[12]=wy[11]+d9;
wx[13]=wx[1];wy[13]=wy[12]+d7;wx[14]=wx[12];wy[14]=wy[13]+d9;
wx[15]=wx[1];wy[15]=wy[14]+d7;wx[16]=wx[14];wy[16]=wy[15]+d9;
wx[17]=wx[1];wy[17]=wy[16]+d7;wx[18]=wx[16];wy[18]=wy[17]+d9;
wx[19]=x02+d2;wy[19]=wy[18]+d8;wx[20]=wx[19]+d15;wy[20]=wy[19]+d14;
t=d15/(x02-x01); // 小窗口与编辑窗口之比例
strcpy(cc[1],"取 消");
strcpy(cc[2],"确 认");
strcpy(cc[3],"编 码");
strcpy(cc[4],"旋 转");
strcpy(cc[5],"不填充");
strcpy(cc[6],"原 点");
strcpy(cc[7],"折 线");
strcpy(cc[8],"回 退");
strcpy(cc[9],"编 辑");
Base->Uuey=AUey;
Draw_rect(Base,MapClientDC,x1,y1,x2,y2,1);
Draw_rect(Base,MapMemoryDC,x1,y1,x2,y2,1);
Base->Setfcolor(MapClientDC,27);
Base->w_fillrectangle(MapClientDC,x01,y01,x02,y02);
Base->Setfcolor(MapMemoryDC,27);
Base->w_fillrectangle(MapMemoryDC,x01,y01,x02,y02);
Base->Setfcolor(MapClientDC,0);
Base->Setfcolor(MapMemoryDC,0);
for(i=1;i<=81;i++)
{ Base->w_line(MapClientDC,x01+(i-1)*dd,y01,x01+(i-1)*dd,y02);
Base->w_line(MapMemoryDC,x01+(i-1)*dd,y01,x01+(i-1)*dd,y02);
if( (i/2)*2 == i)
{ Base->w_line(MapClientDC,x01+(i-1)*dd,y01,x01+(i-1)*dd,y01-8.0);
Base->w_line(MapClientDC,x01+(i-1)*dd,y02,x01+(i-1)*dd,y02+8.0);
Base->w_line(MapMemoryDC,x01+(i-1)*dd,y01,x01+(i-1)*dd,y01-8.0);
Base->w_line(MapMemoryDC,x01+(i-1)*dd,y02,x01+(i-1)*dd,y02+8.0);
}
}
for(i=1;i<=61;i++)
{ Base->w_line(MapClientDC,x01,y01+(i-1)*dd,x02+1,y01+(i-1)*dd);
Base->w_line(MapMemoryDC,x01,y01+(i-1)*dd,x02+1,y01+(i-1)*dd);
if( (i/2)*2 == i)
{ Base->w_line(MapClientDC,x01,y01+(i-1)*dd,x01-8.0,y01+(i-1)*dd);
Base->w_line(MapClientDC,x02,y01+(i-1)*dd,x02+8.0,y01+(i-1)*dd);
Base->w_line(MapMemoryDC,x01,y01+(i-1)*dd,x01-8.0,y01+(i-1)*dd);
Base->w_line(MapMemoryDC,x02,y01+(i-1)*dd,x02+8.0,y01+(i-1)*dd);
}
}
Base->Setfcolor(MapClientDC,10);
Base->Setfcolor(MapMemoryDC,10);
Base->w_line(MapClientDC,x01+1,y01+(16-1)*d,x02,y01+(16-1)*d);
Base->w_line(MapMemoryDC,x01+1,y01+(16-1)*d,x02,y01+(16-1)*d);
Base->w_line(MapClientDC,x01+(21-1)*d,y01,x01+(21-1)*d,y02);
Base->w_line(MapMemoryDC,x01+(21-1)*d,y01,x01+(21-1)*d,y02);
for(i=1;i<=9;i++)
{ Draw_Key(Base,MapClientDC,wx[2*i-1],wy[2*i-1],wx[2*i],wy[2*i],7,10,8);
Base->Setfcolor(MapClientDC,0);
Base->w_rectangle(MapClientDC,wx[2*i-1],wy[2*i-1],wx[2*i],wy[2*i]);
Draw_Key(Base,MapMemoryDC,wx[2*i-1],wy[2*i-1],wx[2*i],wy[2*i],7,10,8);
Base->Setfcolor(MapMemoryDC,0);
Base->w_rectangle(MapMemoryDC,wx[2*i-1],wy[2*i-1],wx[2*i],wy[2*i]);
Base->Draw_dzhz16(MapClientDC,wx[2*i-1]+12.0,wy[2*i]-5.0,cc[i],0);
Base->Draw_dzhz16(MapMemoryDC,wx[2*i-1]+12.0,wy[2*i]-5.0,cc[i],0);
}
Base->Setfcolor(MapClientDC,8);
Base->w_fillrectangle(MapClientDC,wx[19],wy[19],wx[20],wy[20]);
Base->Setfcolor(MapClientDC,0);
Base->w_rectangle(MapClientDC,wx[19],wy[19],wx[20],wy[20]);
Base->Setfcolor(MapMemoryDC,8);
Base->w_fillrectangle(MapMemoryDC,wx[19],wy[19],wx[20],wy[20]);
Base->Setfcolor(MapMemoryDC,0);
Base->w_rectangle(MapMemoryDC,wx[19],wy[19],wx[20],wy[20]);
Base->Setfcolor(MapClientDC,0);
Base->w_rectangle(MapClientDC,x02+d12,wy[20]+d13,x02+d12+ 71 ,wy[20]+d13+ 20 );
Base->Setfcolor(MapMemoryDC,0);
Base->w_rectangle(MapMemoryDC,x02+d12,wy[20]+d13,x02+d12+ 71 ,wy[20]+d13+ 20 );
code=-1;flag=0;ix=x01+(21-1)*d;iy=y01+(16-1)*d;
num=1; // 首先编辑第一个图元
for(i=0;i<20;i++)
{ typee[i]=1;filll[i]=0;nn[i]=0;
}
type=typee[0];fill=filll[0];
Base->Setfcolor(MapClientDC,13); // 画原点
Base->w_fillrectangle(MapClientDC,(float)(ix-2),(float)(iy-2),
(float)(ix+2),(float)(iy+2));
for(;;)
{ if(PeekMessage(&msg,NULL,0,0,PM_REMOVE)) // 从消息队列中获取消息
{ if(msg.hwnd!=hWnd0)
{ DispatchMessage(&msg);
goto M18;
}
switch(msg.message)
{ case WM_LBUTTONDOWN:
if(msg.hwnd!=hWnd0)
{ DispatchMessage(&msg);
goto M10;
}
w1=LOWORD(msg.lParam);w2=AUey-HIWORD(msg.lParam);
j=-1;
for(i=1;i<=9;i++)
{ if(w1>=wx[2*i-1]&&w1<=wx[2*i] && w2>=wy[2*i-1]&&w2<=wy[2*i])
{ j=i;break;
}
}
if(j==-1) goto M10;
Draw_Key(Base,MapClientDC,wx[2*j-1],wy[2*j-1],wx[2*j],wy[2*j],10,7,-8);
Base->Setfcolor(MapClientDC,0);
Base->w_rectangle(MapClientDC,wx[2*j-1],wy[2*j-1],wx[2*j],wy[2*j]);
for(;;)
{ if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{ switch(msg.message)
{ case WM_LBUTTONUP:
if(msg.hwnd!=hWnd0)
{ Draw_Key(Base,MapClientDC,wx[2*j-1],wy[2*j-1],wx[2*j],wy[2*j],7,10,-8);
Base->Setfcolor(MapClientDC,0);
Base->w_rectangle(MapClientDC,wx[2*j-1],wy[2*j-1],wx[2*j],wy[2*j]);
goto M10;
}
w1=LOWORD(msg.lParam);w2=AUey-HIWORD(msg.lParam);
Draw_Key(Base,MapClientDC,wx[2*j-1],wy[2*j-1],wx[2*j],wy[2*j],7,10,-8);
Base->Setfcolor(MapClientDC,0);
Base->w_rectangle(MapClientDC,wx[2*j-1],wy[2*j-1],wx[2*j],wy[2*j]);
code0=-1;
for(i=1;i<=9;i++)
{ if(w1>=wx[2*i-1]&&w1<=wx[2*i] && w2>=wy[2*i-1]&&w2<=wy[2*i])
{ code0=i;break;
}
}
if(code0!=j) goto M10;
if(code0==1) goto M300;
if(code0==2)
{ if(code!=-1)
{ sf_edit=0;
goto M200;
}
MessageBox("请输入编码 !","Mouse Event",MB_OK);
start_time=GetTickCount();
for(;;)
{ end_time=GetTickCount();
if(end_time-start_time>=60) break;
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{ switch(msg.message)
{ default:
DispatchMessage(&msg);
break;
}
}
}
if(num>=2)
Show_Mark(MapClientDC,flag,num-1,typee,filll,nn,xx,yy,
0.0,0.0,1.0,0.0, 17, 1);
Base->Setfcolor(MapClientDC,13); // 画原点
Base->w_fillrectangle(MapClientDC,(float)(ix-2),(float)(iy-2),
(float)(ix+2),(float)(iy+2));
}
if(code0==3)
{ itoa(code,Textcode,10);
i=Dialog_Input_Code();
if(i==0)
{ code=atoi(Textcode);
Base->Setfcolor(MapClientDC,1);
Base->Setfcolor(MapMemoryDC,1);
Base->w_fillrectangle(MapClientDC,x02+d12+1,wy[20]+d13+1,
x02+d12+ 71 -1,wy[20]+d13+ 20 -1);
Base->w_fillrectangle(MapMemoryDC,x02+d12+1,wy[20]+d13+1,
x02+d12+ 71 -1,wy[20]+d13+ 20 -1);
Base->Draw_slhz(MapClientDC,x02+d12 + 5 ,wy[20]+d13+ 17 ,
Textcode,0.09,0.0,0,-1,16);
Base->Draw_slhz(MapMemoryDC,x02+d12 + 5 ,wy[20]+d13+ 17 ,
Textcode,0.09,0.0,0,-1,16);
}
start_time=GetTickCount();
for(;;)
{ end_time=GetTickCount();
if(end_time-start_time>=60) break;
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{ switch(msg.message)
{ default:
DispatchMessage(&msg);
break;
}
}
}
if(num>=2)
Show_Mark(MapClientDC,flag,num-1,typee,filll,nn,xx,yy,
0.0,0.0,1.0,0.0, 17, 1);
Base->Setfcolor(MapClientDC,13); // 画原点
Base->w_fillrectangle(MapClientDC,(float)(ix-2),(float)(iy-2),
(float)(ix+2),(float)(iy+2));
}
if(code0==7)
{ itoa(type,Textcode,10);
i=Dialog_Input_Code();
if(i==0)
{ type=atoi(Textcode);
if(type==1) strcpy(cc[7],"折 线");
if(type==2) strcpy(cc[7],"曲 线");
if(type==3) strcpy(cc[7],"圆 弧");
if(type==4) strcpy(cc[7],"多边形");
if(type==5) strcpy(cc[7]," 圆 ");
if(type==6) strcpy(cc[7],"椭 圆");
if(type==7) strcpy(cc[7],"月 圆");
Draw_Key(Base,MapClientDC,wx[2*7-1],wy[2*7-1],wx[2*7],wy[2*7],7,10,8);
Base->Setfcolor(MapClientDC,0);
Base->w_rectangle(MapClientDC,wx[2*7-1],wy[2*7-1],wx[2*7],wy[2*7]);
Draw_Key(Base,MapMemoryDC,wx[2*7-1],wy[2*7-1],wx[2*7],wy[2*7],7,10,8);
Base->Setfcolor(MapMemoryDC,0);
Base->w_rectangle(MapMemoryDC,wx[2*7-1],wy[2*7-1],wx[2*7],wy[2*7]);
Base->Draw_dzhz16(MapClientDC,wx[2*7-1]+12.0,wy[2*7]-5.0,cc[7],0);
Base->Draw_dzhz16(MapMemoryDC,wx[2*7-1]+12.0,wy[2*7]-5.0,cc[7],0);
}
start_time=GetTickCount();
for(;;)
{ end_time=GetTickCount();
if(end_time-start_time>=60) break;
if(PeekMessage(&msg,NULL,0,0,PM_REMOVE))
{ switch(msg.message)
{ default:
DispatchMessage(&msg);
break;
}
}
}
if(num>=2)
Show_Mark(MapClientDC,flag,num-1,typee,filll,nn,xx,yy,
0.0,0.0,1.0,0.0, 17, 1);
Base->Setfcolor(MapClientDC,13); // 画原点
Base->w_fillrectangle(MapClientDC,(float)(ix-2),(float)(iy-2),
(float)(ix+2),(float)(iy+2));
}
if(code0==5)
{ itoa(fill,Textcode,10);
i=Dialog_Input_Code();
if(i==0)
{ fill=atoi(Textcode);
if(fill==1) strcpy(cc[5],"填 充");
if(fill==0) strcpy(cc[5],"不填充");
Draw_Key(Base,MapClientDC,wx[2*5-1],wy[2*5-1],wx[2*5],wy[2*5],7,10,8);
Base->Setfcolor(MapClientDC,0);
Base->w_rectangle(MapClientDC,wx[2*5-1],wy[2*5-1],wx[2*5],wy[2*5]);
Draw_Key(Base,MapMemoryDC,wx[2*5-1],wy[2*5-1],wx[2*5],wy[2*5],7,10,8);
Base->Setfcolor(MapMemoryDC,0);
Base->w_rectangle(MapMemoryDC,wx[2*5-1],wy[2*5-1],wx[2*5],wy[2*5]);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -