📄 mapshow.cpp
字号:
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "MapShow.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TTMapShow *TMapShow;
//---------------------------------------------------------------------------
__fastcall TTMapShow::TTMapShow(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TTMapShow::FormResize(TObject *Sender)
{
ScrollBox->Top=0;
ScrollBox->Left=0;
TRect Rect;
Rect=this->GetClientRect();
int cx,cy;
cx=Rect.Width()>100?Rect.Width():100;
cy=Rect.Height()>100?Rect.Height():100;
ScrollBox->Width=cx;
ScrollBox->Height=cy;
/*
Cancel->Top=cy-35;
Cancel->Left=cx-85;
Min->Top=cy-35;
Min->Left=Cancel->Left-85;
Max->Top=cy-35;
Max->Left=Min->Left-85;
Move->Top=cy-35;
Move->Left=Max->Left-85;
Rotate->Top=cy-35;
Rotate->Left=Move->Left-85;
Show->Top=cy-35;
Show->Left=Rotate->Left-85;
*/
double aspect=(double)(cx)/(cy);
glLoadIdentity();
glViewport(5,5,cx,cy);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(45,aspect, 0.1, 1000.0);
glMatrixMode(GL_MODELVIEW);
glLoadIdentity();
glShadeModel(GL_SMOOTH);
ReDraw();
}
//---------------------------------------------------------------------------
void __fastcall TTMapShow::FormCreate(TObject *Sender)
{
Screen->Cursors[YI_DONG]=LoadCursorFromFile("YiDong.cur");
Screen->Cursors[FANG_DA]=LoadCursorFromFile("FangDa.cur");
Screen->Cursors[SUO_XIAO]=LoadCursorFromFile("SuoXiao.cur");
Screen->Cursors[SUO_FANG]=LoadCursorFromFile("SuoFang.cur");
Screen->Cursors[XUAN_ZHUAN]=LoadCursorFromFile("XuanZhuan.cur");
ScrollBox->Cursor=TCursor(XUAN_ZHUAN);
ShowWell=false;
Flag=XUAN_ZHUAN;
X_Angle=0.0;
Y_Angle=0.0;
X_x=0;
Y_y=0;
Depth=-2.0;
PIXELFORMATDESCRIPTOR pfd =
{
sizeof(PIXELFORMATDESCRIPTOR), 1 ,PFD_DRAW_TO_WINDOW |
PFD_DOUBLEBUFFER | PFD_SUPPORT_OPENGL, PFD_TYPE_RGBA, 24, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0 ,0, 32, 0, 0, PFD_MAIN_PLANE, 0, 0, 0,0
};
m_hDC=GetDC(ScrollBox->Handle);
int pixelFormat = ChoosePixelFormat(m_hDC, &pfd);//返回最匹配的像素格式
::SetPixelFormat(m_hDC,pixelFormat,&pfd);
m_hRC =::wglCreateContext(m_hDC); //创建RC
wglMakeCurrent(m_hDC,m_hRC);
}
//---------------------------------------------------------------------------
void __fastcall TTMapShow::MoveClick(TObject *Sender)
{
Flag=YI_DONG;
ScrollBox->Cursor=TCursor(YI_DONG);
}
//---------------------------------------------------------------------------
void __fastcall TTMapShow::MaxClick(TObject *Sender)
{
Depth*=1.5;
ReDraw();
}
//---------------------------------------------------------------------------
void __fastcall TTMapShow::MinClick(TObject *Sender)
{
Depth/=1.5;
ReDraw();
}
//---------------------------------------------------------------------------
void __fastcall TTMapShow::RotateClick(TObject *Sender)
{
Flag=XUAN_ZHUAN;
ScrollBox->Cursor=TCursor(XUAN_ZHUAN);
}
//---------------------------------------------------------------------------
void __fastcall TTMapShow::ShowClick(TObject *Sender)
{
if(ShowWell)
{
ShowWell=false;
}
else
{
ShowWell=true;
}
YouJing->Checked=ShowWell;
ReDraw();
}
//---------------------------------------------------------------------------
void TTMapShow::ReDraw()
{
//TODO: Add your source code here
}
void __fastcall TTMapShow::CancelClick(TObject *Sender)
{
ModalResult = mrCancel;
}
//---------------------------------------------------------------------------
void __fastcall TTMapShow::Suo_FangClick(TObject *Sender)
{
Flag=SUO_FANG;
ScrollBox->Cursor=TCursor(SUO_FANG);
}
//---------------------------------------------------------------------------
#include "ResultGraphic.h"
void __fastcall TTMapShow::GrphicOptiClick(TObject *Sender)
{
TTResultGraphic *Dlg;
Dlg=(TTResultGraphic*) new TTResultGraphic(this);
Dlg->Selected=Selected;
Dlg->Modal=true;
Dlg->ShowModal();
delete Dlg;
}
//---------------------------------------------------------------------------
#include "SinglePipe.h"
void __fastcall TTMapShow::SglPipeClick(TObject *Sender)
{
TTSinglePipe *Dlg=(TTSinglePipe*) new TTSinglePipe(this);
Dlg->Selected=Selected;
Dlg->ShowModal();
delete Dlg;
}
//---------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -