hhoopstestmodel.cpp

来自「使用HOOPS库开发的一个教学演示工具。」· C++ 代码 · 共 117 行

CPP
117
字号
// HhoopstestModel.cpp : implementation of the HhoopstestModel class//#include "StdAfx.h"#include <afxtempl.h>#include <string.h>#include <stdio.h>#include <stdlib.h>#include <ctype.h>#include "hc.h"#include "HStream.h"#include "HOpcodeShell.h"#include "HUtility.h"#include "HhoopstestModel.h"#include "HTools.h"#include "hoopstest.h"#include ".\hhoopstestmodel.h"
HhoopstestModel::HhoopstestModel(){	m_bSolidModel = false;	SetBRepGeometry(false);}HhoopstestModel::~HhoopstestModel(){	// Model cleanup : delete all the entities from the 	// partition associated with this model	DeleteAllEntities();}// Delete all the entities in the current model from the // modeller and associated HOOPS geometryvoid HhoopstestModel::DeleteAllEntities(){}// our application-specific read functionHFileInputResult HhoopstestModel::Read(const char * FileName) {   	CWaitCursor show_hourglass_cursor_through_this_function;	unsigned int i;	HFileInputResult success = InputOK;	// get the file extension	char extension[120]; 	HUtility::FindFileNameExtension(FileName, extension);	// read the file into the model object's model segment    HC_Open_Segment_By_Key(m_ModelKey);			HC_Open_Segment("main");			{				// No special read - let the base class handle				m_bSolidModel = false;				success = HBaseModel::Read(FileName);			} 		HC_Close_Segment();    HC_Close_Segment();    return success;}// our application-specific write functionbool HhoopstestModel::Write(const char * FileName, HBaseView * view, 									int version, int width, int height) {   	CWaitCursor show_hourglass_cursor_through_this_function;	unsigned int i;	bool success = true; 	// get the file extension	char extension[120]; 	HUtility::FindFileNameExtension(FileName, extension);	{		if(!HBaseModel::Write(FileName, view, width, height))			success = false;	}     return success;}// Override the base class function to add setting of user value // on the segment. This helps in HNet, when we emit this segment // the peers understand our rendermode setting better.void HhoopstestModel::SetBRepGeometry(bool brep){	if (brep)	{		HC_KEY key = GetModelKey();		HC_Open_Segment_By_Key(key);			HC_Set_User_Value(1L);		HC_Close_Segment();	}	HBaseModel::SetBRepGeometry(brep);}

⌨️ 快捷键说明

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