Добавил:
Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
6
Добавлен:
01.05.2014
Размер:
2.46 Кб
Скачать
// Laba4View.cpp : implementation of the CLaba4View class
//

#include "stdafx.h"
#include "Laba4.h"

#include "Laba4Doc.h"
#include "Laba4View.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#endif


// CLaba4View

IMPLEMENT_DYNCREATE(CLaba4View, CView)

BEGIN_MESSAGE_MAP(CLaba4View, CView)
END_MESSAGE_MAP()

// CLaba4View construction/destruction

CLaba4View::CLaba4View()
{
	// TODO: add construction code here

}

CLaba4View::~CLaba4View()
{
}

BOOL CLaba4View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

// CLaba4View drawing

void CLaba4View::OnDraw(CDC* pDC)
{
	CRect Rect; 
	CWnd* pWnd;
	int CentrX, CentrY;
	float i, j;
	cVector3D VectTmp;

	CLaba4Doc* pDoc = GetDocument();
	ASSERT_VALID(pDoc);
	if (!pDoc)
		return;

	pWnd=pDC->GetWindow();
	pWnd->GetClientRect(&Rect);
	CentrX=(Rect.right + Rect.left)/2;
	CentrY=(Rect.bottom + Rect.top)/2;

	pDC->MoveTo(CentrX, 10);
	pDC->LineTo(CentrX, Rect.bottom-10);
	pDC->MoveTo(10, CentrY);
	pDC->LineTo(Rect.right-10, CentrY);
	if(theApp.InitF == 2)
	{
		for(i=0; i<=1; i+=(float)0.05)
		{
			for(j=0; j<=1; j+=(float)0.001)
			{
				theApp.Pover.GetPoint((float)i, (float)j, VectTmp);
				pDC->SetPixel((int)(VectTmp.X+CentrX), (int)(CentrY-VectTmp.Y), RGB(100, 100, 100));
				theApp.Pover.GetPoint((float)j, (float)i, VectTmp);
				if(i==0 || i==1)
					pDC->SetPixel((int)(VectTmp.X+CentrX), (int)(CentrY-VectTmp.Y), RGB(210, 194, 135));
				else
					pDC->SetPixel((int)(VectTmp.X+CentrX), (int)(CentrY-VectTmp.Y), RGB(100, 100, 100));
			}
		}
		for(j=0; j<=1; j+=(float)0.001)
		{
			theApp.Pover.GetPoint((float)1, (float)j, VectTmp);
			pDC->SetPixel((int)(VectTmp.X+CentrX), (int)(CentrY-VectTmp.Y), RGB(100, 100, 100));
			theApp.Pover.GetPoint((float)j, (float)1, VectTmp);
			pDC->SetPixel((int)(VectTmp.X+CentrX), (int)(CentrY-VectTmp.Y), RGB(210, 194, 135));
		}
	}
}


// CLaba4View diagnostics

#ifdef _DEBUG
void CLaba4View::AssertValid() const
{
	CView::AssertValid();
}

void CLaba4View::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CLaba4Doc* CLaba4View::GetDocument() const // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CLaba4Doc)));
	return (CLaba4Doc*)m_pDocument;
}
#endif //_DEBUG


// CLaba4View message handlers
Соседние файлы в папке Laba4