📄 cgeview.cpp
字号:
CPen* pen = new CPen(PS_SOLID ,2, RGB(0,255,0));
CPen* old = pDC->SelectObject(pen);
pDC->MoveTo(xp,yp-pDoc->VPos);
pDC->LineTo(xp+1,yp-pDoc->VPos+1);
pDC->SelectObject(old);
delete pen;
pDoc->FillKey=false;
}
}
}
}
else
{
if(yp2>i*pDoc->basline+pDoc->m_viewY0+1)
{
pDoc->FillKey=true;
xp=xp2;
yp=yp2;
}
else
{
if(yp2<i*pDoc->basline+pDoc->m_viewY0+1)
{
if(pDoc->FillKey==true)
{
if(pDoc->fullScreen==false)
{
pDC->FloodFill(xp-1,yp-pDoc->VPos-1,m_LineCr);
}
else
{
pDC->FloodFill(xp-2,yp,m_LineCr);
}
CPen* pen = new CPen(PS_SOLID ,2, RGB(0,255,0));
CPen* old = pDC->SelectObject(pen);
pDC->MoveTo(xp,yp-pDoc->VPos);
pDC->LineTo(xp+1,yp-pDoc->VPos+1);
pDC->SelectObject(old);
delete pen;
pDoc->FillKey=false;
}
}
}
}
xp1=xp2;
yp1=yp2;
}
}
}
pDC->DeleteDC();
}
/* LL
void CCgeView::OnFillUp()
{
if(up==false)
{
checkdown = false;
checkup = true;
up = true;
}
else
{
checkup = !checkup;
m_fillKey = !m_fillKey;
up = true;
}
Invalidate();
}*/
/* LL
void CCgeView::OnFillDown()
{
if(up==true)
{
checkup=false;
checkdown=true;
m_fillKey=true;
up=false;
}
else
{
checkdown=!checkdown;
m_fillKey=!m_fillKey;
up=false;
}
Invalidate();
}*/
void CCgeView::OnCutHead() //从头截
{
if(head==false)
{
head=true;
}
else
{
m_cutKey=!m_cutKey;
head=true;
}
CCgeDoc *pDoc = GetDocument();
int xp,yp;
POSITION m_position;
CMyLine* pLine;
int temp=0;
CClientDC* pDC = new CClientDC(this);
pDoc->InterCeptKey=true;
if(head)
{
if(!pDoc->m_CMyLineList.IsEmpty())
{
m_position = pDoc->m_CMyLineList.GetHeadPosition();
int i;
for(i=0;i<pDoc->Num_Line;i++)
{
if(abs(BPoint.y-i*pDoc->basline-pDoc->m_viewY0+GetScrollPos(SB_VERT))<(pDoc->basline/2))
{
break;
}
}
//m415
if(i+pDoc->m_N0 > pDoc->Num_Line )
{
OnEditReset();
return;
}
//m415
CString str_i;
str_i.Format("%d",i+pDoc->m_N0);
str_i="截取第"+str_i+"通道?";
if(AfxMessageBox(str_i,MB_OKCANCEL,0)==IDOK)
{
for(int k=0;k<i*pDoc->Num_Pointes;k++)
{
pLine = (CMyLine* )pDoc->m_CMyLineList.GetNext(m_position);
}
pLine = (CMyLine* )pDoc->m_CMyLineList.GetNext(m_position);
for(int j=0;j<pDoc->Num_Pointes;j++)
{
pLine = (CMyLine* )pDoc->m_CMyLineList.GetAt(m_position);
xp = j * pDoc->m_stepX + pDoc->m_viewX0-pDoc->HPos;
yp= 0;
CMyLine* pMyLine = new CMyLine(yp);
pDoc->m_CMyLineList.SetAt(m_position,pMyLine);
pLine = (CMyLine* )pDoc->m_CMyLineList.GetNext(m_position);
if(xp>BPoint.x+GetScrollPos(SB_HORZ))//GetScrollPos(SB_HORI))
{
break;//get the value of temp and break from for
}
}
}
pDoc->UpdateAllViews(NULL); //立刻画线
}
pDC->DeleteDC();
m_dtlBKey=false;
pDoc->SetModifiedFlag();
}
}
void CCgeView::OnUpdateCutHead(CCmdUI* pCmdUI)
{
if(m_dtlBKey&&!m_dtlEKey)
{
pCmdUI->Enable(true);
}
else
{
pCmdUI->Enable(false);
}
}
void CCgeView::OnCutScale()
{
if(head)
{
m_cutKey=true;
head=false;
}
else
{
m_cutKey=!m_cutKey;
head = false;
}
CCgeDoc *pDoc = GetDocument();
int xp,yp;
POSITION m_position;
CMyLine* pLine;
int temp=0;
CClientDC* pDC = new CClientDC(this);
pDoc->InterCeptKey=true;
if(!head)
{
if(!pDoc->m_CMyLineList.IsEmpty())
{
m_position = pDoc->m_CMyLineList.GetHeadPosition();
int i;
for(i=0;i<pDoc->Num_Line;i++)
{
if(abs(BPoint.y-i*pDoc->basline-pDoc->m_viewY0+GetScrollPos (SB_VERT))<(pDoc->basline/2))
{
break;
}
}
//m415
if(i+pDoc->m_N0 > pDoc->Num_Line )
{
OnEditReset();
return;
}
//m415
CString str_i;
str_i.Format("%d",i+pDoc->m_N0);
str_i="截取第"+str_i+"通道?";
if(AfxMessageBox(str_i,MB_OKCANCEL,0)==IDOK)
{
for(int k=0;k<i*pDoc->Num_Pointes;k++)
{
pLine = (CMyLine* )pDoc->m_CMyLineList.GetNext(m_position);
}
pLine = (CMyLine* )pDoc->m_CMyLineList.GetNext(m_position);
{
pLine = (CMyLine* )pDoc->m_CMyLineList.GetNext(m_position);
for(int j=0;j<pDoc->Num_Pointes;j++)
{
pLine = (CMyLine* )pDoc->m_CMyLineList.GetAt(m_position);
xp = j * pDoc->m_stepX + pDoc->m_viewX0- GetScrollPos (SB_HORZ);
if(xp>BPoint.x)
{
yp=0;
CMyLine *pMyLine = new CMyLine(yp);
pDoc->m_CMyLineList.SetAt(m_position,pMyLine);
}
pLine = (CMyLine* )pDoc->m_CMyLineList.GetNext(m_position);
if(xp>EPoint.x)
{
break;//get the value of temp and break from for
}
}
}
}
pDoc->UpdateAllViews(NULL); //立刻画线
}
pDC->DeleteDC();
m_dtlBKey=false;
m_dtlEKey=false;
pDoc->SetModifiedFlag();
}
}
void CCgeView::OnUpdateCutScale(CCmdUI* pCmdUI)
{
if(m_dtlBKey&&m_dtlEKey)
pCmdUI->Enable(true);
else
{
pCmdUI->Enable(false);
}
}
void CCgeView::cut(bool head)
{
CCgeDoc *pDoc = GetDocument();
int xp,yp;
POSITION m_position;
CMyLine* pLine;
int temp=0;
CClientDC* pDC = new CClientDC(this);
pDoc->InterCeptKey=true;
if(head)
{
if(!pDoc->m_CMyLineList.IsEmpty())
{
m_position = pDoc->m_CMyLineList.GetHeadPosition();
for(int i=0;i<pDoc->Num_Line;i++)
{
pLine = (CMyLine* )pDoc->m_CMyLineList.GetNext(m_position);
for(int j=0;j<pDoc->Num_Pointes;j++)
{
pLine = (CMyLine* )pDoc->m_CMyLineList.GetAt(m_position);
xp = j * pDoc->m_stepX + pDoc->m_viewX0;
//xp=j*pDoc->m_stepX
//yp = pLine->y * pDoc->m_stepY + i * pDoc->basline + pDoc->m_viewY0;
yp=0;
CMyLine *pMyLine = new CMyLine(yp);
pDoc->m_CMyLineList.SetAt(m_position,pMyLine);
pLine = (CMyLine* )pDoc->m_CMyLineList.GetNext(m_position);
if(xp>BPoint.x)
{
break;//get the value of temp and break from for
}
}
}
}
pDoc->UpdateAllViews(NULL); //立刻画线
}
pDC->DeleteDC();
}
static char szFilter[] = "Accounting Files (*.dat)|*.dat|All Files (*.*)|*.*||";
//static char lpstrCustomFilter[255]={"Previous Filter\0*.dat\0"};
static char lpstrCustomFilter[255]={"CGE_seg2 Filter(*.dat)\0*.dat\0"};
#define MAX_PATH 260
void CCgeView::m_Viewparfile()
{
FilePath dlg(
false,
_T(".dat"), //default filename extension
m_path[0], //initial filename in edit box
// functionality flags
// OFN_ALLOWMULTISELECT| //allow multiple files to be selected
OFN_CREATEPROMPT | // if File Save As, prompts user if they want to create non-existant file
OFN_OVERWRITEPROMPT | // if File Save As--prompts user to ask if they want to overwrite an existing file
OFN_ENABLESIZING | // if Windows NT 5.0 or Win 98, causes box to be resizable by user
//OFN_EXTENSIONDIFFERENT| // allows user to enter a filename with a different extension from the default
// OFN_FILEMUSTEXIST // file must exist
// OFN_NOLONGNAMES | // causes dialog to use short filenames (8.3)
// OFN_PATHMUSTEXIST | // user can only type valid paths and filenames
// OFN_NOVALIDATE | // the returned filname can have invalid characters
// appearence flags
OFN_HIDEREADONLY | // hides read-only check box
// OFN_NONETWORKBUTTON | // hides Network button
//OFN_READONLY | // initially check Read Only check box
// OFN_SHOWHELP | // Help button appears--when clicked the hook procedure gets a CDN_HELP message
// custom template flags
OFN_ENABLETEMPLATE | // you will be supplying your own custom dialog box template
0,
szFilter, //file filter
//AfxGetApp()->m_pMainWnd);
//this); // parent window
GetParentFrame());
// set an initial directory
char lpszInitDir[MAX_PATH];
_getcwd(lpszInitDir,MAX_PATH);
dlg.m_ofn.lpstrInitialDir=lpszInitDir;
//set the dialog's title
//char lpszTitle[]={"地震仪格式文件"};//{"Save As File"};
char lpszTitle[]={"保存SEG2文件"};//{"Save As File"};
dlg.m_ofn.lpstrTitle=lpszTitle;
// retain the customer's last file filter selection
dlg.m_ofn.lpstrCustomFilter=lpstrCustomFilter;
dlg.m_ofn.nMaxCustFilter=255;
// if OFN_ENABLETEMPLATE is set, define the custom dialog template here
dlg.m_ofn.lpTemplateName=MAKEINTRESOURCE(IDD_DIALOGBAR_NEWFILE);
//file = m_path[0] = file;//path;
dlg.m_StrCheckspace = m_path[1];
dlg.m_StrSourse = m_path[2];
dlg.m_StrPo = m_path[3];
dlg.m_StrOffset = m_path[4];
dlg.m_StrLine = m_path[5];
dlg.m_StrDate = m_path[6];
// open file dialog and get file name(s)
if (dlg.DoModal()==IDOK)
{
// get filter number selected (index into filter list that user selected)
int nFilterIndex=dlg.m_ofn.nFilterIndex;
// get file name
CString path=dlg.GetPathName(); //ex: c:\temp\temp.tmp
CString file=dlg.GetFileName(); //ex: temp.tmp
CString title=dlg.GetFileTitle(); //ex: temp
CString ext=dlg.GetFileExt(); //ex: tmp
CCgeDoc* pDoc = (CCgeDoc* )GetDocument();
ASSERT_VALID(pDoc);
//CString m_path[10];
if(!pDoc->olddataKey) //m510
{
m_path[8] = file;
CTime tNow;
tNow = CTime::GetCurrentTime();
m_path[6] = tNow.Format("%Y/%m/%d");
m_path[7] = tNow.Format("%H:%M");
}else
{
m_path[6] = dlg.m_StrDate;
}
m_path[0] = file;//path;
m_path[1] = dlg.m_StrCheckspace;
m_path[2] = dlg.m_StrSourse;
m_path[3] = dlg.m_StrPo;
m_path[4] = dlg.m_StrOffset;
m_path[5] = dlg.m_StrLine;
//m_path[6] = dlg.m_StrDate;
pDoc->Seg2Write(m_path); //写SEG2文件
//保存最近的参数
CFile Sg2_w("my228.txt",CFile::modeCreate | CFile::modeWrite);
for(int i=0;i<11;i++)
{
Sg2_w.Write(pDoc->s[i],20);
}
for(i=0;i<10;i++)
{
Sg2_w.Write(m_path[i],20);
}
Sg2_w.Close();
//bool b = pDoc->IsModified() ;
//BOOL bReadOnly = dlg.GetReadOnlyPref();
// if OFN_ALLOWMULTISELECT is set, loop to get all file names
for (POSITION pos=dlg.GetStartPosition();pos;)
{
CString pathx=dlg.GetNextPathName(pos);
}
}
//GetParentFrame()->m_hvbil = 9;
//CDocument::OnFileSaveAs();
}
void CCgeView::OnParfile()
{
m_Viewparfile();
CCgeDoc* pDoc = GetDocument();
pDoc->olddataKey = true;//写完后
}
void CCgeView::OnSelchangeCombo1() //单道放大,获得单放道号
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -