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

📄 htest6view.cpp

📁 hoops_acis_mfc框架
💻 CPP
字号:
// Htest6View.cpp : implementation of the Htest6View class
// 

// Standard includes
#include "StdAfx.h"
#include "Resource.h"
#include <assert.h>
#include <math.h>
#include "hc.h"

#include "Htest6View.h"
#include "Htest6Model.h"
#include "Htest6SelectionSet.h"

#include "ha_bridge.h"

#include "HSharedKey.h"


Htest6View::Htest6View(HBaseModel *model,
    const char * 		alias,	
    const char *		driver_type,
    const char *		instance_name,
    void *				window_handle,
    void *				colormap) : HBaseView(model, alias, driver_type, instance_name, window_handle, colormap)

{
}

Htest6View::~Htest6View()
{
}


// app-specific init function
void Htest6View::Init()
{
	// call base's init function first to get the default HOOPS hierarchy for the view
	HBaseView::Init();

	// create our app-specific Selection object and initialize
	m_pSelection = new Htest6SelectionSet(this);
    m_pSelection->Init();

	// TODO: Add your initialization here
}

void Htest6View::DeleteSelectionList( bool emit_message )
{
	int				i, numSolidSelections, numHoopsSelections;
	char			type[4096];
	Htest6SelectionSet* selection = (Htest6SelectionSet *)GetSelection();;
	ENTITY*			current = 0;
	numHoopsSelections = selection->GetSize();
	numSolidSelections = selection->GetSolidListSize();
	if (numHoopsSelections == 0)
		return;

	// loop through the list of selected HOOPS primitives, filtering
	// out the ones associated with solid model entities, and deleting
	// the non-solid model primitives directly using Delete_By_Key
	// The primitives associated with solid model entities need to be
	// deleted using the HOOPS/GM deletion functions so that the HOOPS<->GM 
	// mapping tables will remain in sync
	for (i = numHoopsSelections; i > 0; i--)
	{
		HC_KEY key = selection->GetAt(i-1);

		// if it's a HOOPS primitive that is not associated with a solid model entity,
		// deselect and delete it
		current = HA_Compute_Entity_Pointer(key, BODY_TYPE);
		if (current == 0)
		{
			selection->DeSelect(key, false);
			HC_Delete_By_Key(key);
		}
	}

	// loop through the list of selected solid model entities,
	// delete the HOOPS geometry associated with each
	// and then delete the entity
	for (i = numSolidSelections; i > 0; i--)
	{
		current = (ENTITY*)selection->GetAtSolidEntity(i-1);
		if (current)
		{
			selection->DeSelectEntity(current);
			((Htest6Model*)GetModel())->DeleteAcisEntity(current);
		}
	}

	if( emit_message )
		EmitDeleteSelectionListMessage();

	// Reset the selection set lists since we've deleted all the entities that
	// were in them  (we can't DeSelect the entities because they no longer exist)
	selection->Reset();

    SetGeometryChanged();
	Update();
}


⌨️ 快捷键说明

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