⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 designdoc.cpp

📁 本文以数字图像处理、压缩技术和MATLAB应用为基础
💻 CPP
📖 第 1 页 / 共 3 页
字号:
						glNormal3d( -0.5*abs(top-bottom)/normalizey, height/normalizey, 0.0);
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(bottom , 0.8*HEIGHT , right );
					glEnd();
					glBegin(GL_TRIANGLES);
						glNormal3d(0.0, 0.0, 1.0);
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glNormal3d(0.0, 0.0, -1.0);
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
					glEnd();
					break;
				case LEFT:
					normalizex = sqrt(height*height + (0.5*abs(right-left))*(0.5*abs(right-left)) );
					glBegin(GL_QUADS);
						glNormal3d(0.0, 0.0, 1.0);
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
					glEnd();
					glBegin(GL_QUADS);
						glNormal3d(0.0 , height/normalizex, -0.5*abs(right-left) / normalizex);
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(bottom , 0.8*HEIGHT , left );
					glEnd();
					glBegin(GL_TRIANGLES);
						glNormal3d(1.0, 0.0, 0.0);
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glNormal3d(-1.0, 0.0, 0.0);
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glVertex3d(bottom , 0.8*HEIGHT , left );
					glEnd();
					break;
				case RIGHT:
					normalizex = sqrt(height*height + (0.5*abs(right-left))*(0.5*abs(right-left)) );
					glBegin(GL_QUADS);
						glNormal3d(0.0, 0.0, -1.0);
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
					glEnd();
					glBegin(GL_QUADS);
						glNormal3d(0.0 , height/normalizex, 0.5*abs(right-left)/normalizex);
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(bottom , 0.8*HEIGHT , right );
					glEnd();
					glBegin(GL_TRIANGLES);
						glNormal3d(1.0, 0.0, 0.0);
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glNormal3d(-1.0, 0.0, 0.0);
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , 0.8*HEIGHT , right );
					glEnd();
					break;
				case LEFTUP:
					normalizex = sqrt(height*height + (0.5*abs(right-left))*(0.5*abs(right-left)) );
					normalizey = sqrt(height*height + (0.5*abs(top-bottom))*(0.5*abs(top-bottom)) );

					glBegin(GL_TRIANGLES);
						glNormal3d(0.0, 0.0, 1.0);
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glNormal3d(-1.0, 0.0, 0.0);
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glVertex3d(bottom , 0.8*HEIGHT , left );

						glNormal3d(0.0 , height/normalizex, -0.5*abs(right-left) / normalizex);
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(top , 0.8*HEIGHT , left );

						glNormal3d( 0.5*abs(top-bottom)/normalizey, height/normalizey, 0.0);
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , 0.8*HEIGHT , right );
					glEnd();
					break;
				case LEFTDOWN:
					normalizex = sqrt(height*height + (0.5*abs(right-left))*(0.5*abs(right-left)) );
					normalizey = sqrt(height*height + (0.5*abs(top-bottom))*(0.5*abs(top-bottom)) );
					
					glBegin(GL_TRIANGLES);
						glNormal3d(1.0, 0.0, 0.0);
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glNormal3d(0.0, 0.0, 1.0);
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(top , (0.8*HEIGHT + height) , right );

						glNormal3d(0.0 , height/normalizex, -0.5*abs(right-left) / normalizex);
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(bottom , 0.8*HEIGHT , left );
					
						glNormal3d( -0.5*abs(top-bottom)/normalizey, height/normalizey, 0.0);
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(bottom , 0.8*HEIGHT , right );
					glEnd();
					break;
				case RIGHTUP:
					normalizex = sqrt(height*height + (0.5*abs(right-left))*(0.5*abs(right-left)) );
					normalizey = sqrt(height*height + (0.5*abs(top-bottom))*(0.5*abs(top-bottom)) );

					glBegin(GL_TRIANGLES);
						glNormal3d(0.0, 0.0, -1.0);
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(top , 0.8*HEIGHT , left );
						glNormal3d(-1.0, 0.0, 0.0);
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , 0.8*HEIGHT , right );

						glNormal3d( 0.5*abs(top-bottom)/normalizey, height/normalizey, 0.0);
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , 0.8*HEIGHT , right );

						glNormal3d(0.0 , height/normalizex, 0.5*abs(right-left)/normalizex);
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(bottom , 0.8*HEIGHT , right );
					glEnd();
					break;
				case RIGHTDOWN:
					normalizex = sqrt(height*height + (0.5*abs(right-left))*(0.5*abs(right-left)) );
					normalizey = sqrt(height*height + (0.5*abs(top-bottom))*(0.5*abs(top-bottom)) );

					glBegin(GL_TRIANGLES);
						glNormal3d(1.0, 0.0, 0.0);
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glNormal3d(0.0, 0.0, -1.0);
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(top , (0.8*HEIGHT + height) , left );

						glNormal3d( -0.5*abs(top-bottom)/normalizey, height/normalizey, 0.0);
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(bottom , 0.8*HEIGHT , right );

						glNormal3d(0.0 , height/normalizex, 0.5*abs(right-left)/normalizex);
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(top , 0.8*HEIGHT , right );
					glEnd();
					break;
				case HIGHLEFTUP:
					normalizex = sqrt(height*height + (0.5*abs(right-left))*(0.5*abs(right-left)) );
					normalizey = sqrt(height*height + (0.5*abs(top-bottom))*(0.5*abs(top-bottom)) );
					glBegin(GL_QUADS);
						glNormal3d(-1.0, 0.0, 0.0);
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glNormal3d(0.0, 0.0, 1.0);
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
					glEnd();
					glBegin(GL_TRIANGLES);
						glNormal3d(0.0, 0.0, -1.0);
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(top , 0.8*HEIGHT , left );
						glNormal3d(1.0, 0.0, 0.0);
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glNormal3d( 0.5*abs(top-bottom)/normalizey, height/normalizey, 0.0);
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(top , 0.8*HEIGHT , left );
						glNormal3d(0.0 , height/normalizex, -0.5*abs(right-left) / normalizex);
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glVertex3d(top , 0.8*HEIGHT , left );
					glEnd();
					break;
				case HIGHLEFTDOWN:
					normalizex = sqrt(height*height + (0.5*abs(right-left))*(0.5*abs(right-left)) );
					normalizey = sqrt(height*height + (0.5*abs(top-bottom))*(0.5*abs(top-bottom)) );
					glBegin(GL_QUADS);
						glNormal3d(0.0, 0.0, 1.0);
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );

						glNormal3d(1.0, 0.0, 0.0);
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
					glEnd();
					glBegin(GL_TRIANGLES);
						glNormal3d(-1.0, 0.0, 0.0);
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glNormal3d(0.0, 0.0, -1.0);
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glNormal3d(0.0 , height/normalizex, -0.5*abs(right-left) / normalizex);
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glNormal3d( -0.5*abs(top-bottom)/normalizey, height/normalizey, 0.0);
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , 0.8*HEIGHT , left );
					glEnd();
					break;
				case HIGHRIGHTUP:
					normalizex = sqrt(height*height + (0.5*abs(right-left))*(0.5*abs(right-left)) );
					normalizey = sqrt(height*height + (0.5*abs(top-bottom))*(0.5*abs(top-bottom)) );					glBegin(GL_QUADS);
						glNormal3d(-1.0, 0.0, 0.0);
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glNormal3d(0.0, 0.0, -1.0);
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
					glEnd();
					glBegin(GL_TRIANGLES);
						glNormal3d(0.0, 0.0, 1.0);
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glNormal3d(1.0, 0.0, 0.0);
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glNormal3d( 0.5*abs(top-bottom)/normalizey, height/normalizey, 0.0);
						glVertex3d(bottom , (0.8*HEIGHT + height) , right );
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(top , 0.8*HEIGHT , right );
						glNormal3d(0.0 , height/normalizex, 0.5*abs(right-left)/normalizex);
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(top , 0.8*HEIGHT , right );
					glEnd();
					break;
				case HIGHRIGHTDOWN:
					normalizex = sqrt(height*height + (0.5*abs(right-left))*(0.5*abs(right-left)) );
//					normalizey = max(height, 0.5*abs(top-bottom) );
					normalizey = sqrt(height*height + (0.5*abs(top-bottom))*(0.5*abs(top-bottom)) );					glBegin(GL_QUADS);
						glNormal3d(1.0, 0.0, 0.0);
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glNormal3d(0.0, 0.0, -1.0);
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(top , 0.8*HEIGHT , left );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
					glEnd();
					glBegin(GL_TRIANGLES);
						glNormal3d(-1.0, 0.0, 0.0);
						glVertex3d(bottom , 0.8*HEIGHT , left );
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glNormal3d(0.0, 0.0, 1.0);
						glVertex3d(top , 0.8*HEIGHT , right );
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glNormal3d( -0.5*abs(top-bottom)/normalizey, height/normalizey, 0.0);
						glVertex3d(top , (0.8*HEIGHT + height) , right );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , 0.8*HEIGHT , right );
						glNormal3d(0.0 , height/normalizex, 0.5*abs(right-left)/normalizex);
						glVertex3d(bottom , (0.8*HEIGHT + height) , left );
						glVertex3d(top , (0.8*HEIGHT + height) , left );
						glVertex3d(bottom , 0.8*HEIGHT , right );
					glEnd();
					break;
				}
			}
		}
////////Locate the base
		glColor4f(0.0f, 0.7f, 0.0f, 0.5f);
		glBegin(GL_QUADS);
			glNormal3d(  0.0,  1.0,  0.0);
			glVertex3d(  64,  0.0, 0.0);
			glVertex3d(  64,  0.0, 64);
			glVertex3d(  0.0,  0.0, 64);
			glVertex3d(  0.0,  0.0, 0.0);
		glEnd();

	glPopMatrix();

}

void CDesignDoc::AddElem(CElement *pElement)
{
	m_ElemArray.Add(pElement);
	SetModifiedFlag();
}

CElement *CDesignDoc::GetElem(int Index)
{
	if (Index < 0 || Index > m_ElemArray.GetUpperBound())
		return 0;
	return (CElement *)m_ElemArray.GetAt(Index);
}

int CDesignDoc::GetNumElem()
{
	return m_ElemArray.GetSize();
}

void CDesignDoc::OnEditUndo() 
{
	// TODO: Add your command handler code here
	int Index = m_ElemArray.GetUpperBound();
	if (Index > -1)
	{
		delete m_ElemArray.GetAt(Index);
		m_ElemArray.RemoveAt(Index);
	}
	UpdateAllViews(0);
	SetModifiedFlag();
}

void CDesignDoc::OnUpdateEditUndo(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->Enable(m_ElemArray.GetSize());
}

void CDesignDoc::OnViewTransparent() 
{
	// TODO: Add your command handler code here
	m_Transparent = !m_Transparent;
	UpdateAllViews(NULL, 0);
}

void CDesignDoc::OnUpdateViewTransparent(CCmdUI* pCmdUI) 
{
	// TODO: Add your command update UI handler code here
	pCmdUI->SetCheck(m_Transparent);
}

void CDesignDoc::OnElementRoom() 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -