예제 #1
0
const GraphTreeNodePtr& GraphTreeModel::insert(const scene::INodePtr& node)
{
	// Create a new GraphTreeNode
	GraphTreeNodePtr gtNode(new GraphTreeNode(node));

	// Insert this iterator below a possible parent iterator
	wxDataViewItem parentIter = findParentIter(node);

	wxutil::TreeModel::Row row = parentIter ? _model->AddItem(parentIter) : _model->AddItem();
	gtNode->getIter() = row.getItem();

	// Fill in the values
	row[_columns.node] = wxVariant(static_cast<void*>(node.get()));
	row[_columns.name] = node->name();

	row.SendItemAdded();

	// Insert this iterator into the node map to facilitate lookups
	std::pair<NodeMap::iterator, bool> result = _nodemap.insert(
		NodeMap::value_type(scene::INodeWeakPtr(node), gtNode)
	);

	// Return the GraphTreeNode reference
	return result.first->second;
}
예제 #2
0
const GraphTreeNodePtr& GraphTreeModel::insert(const scene::INodePtr& node)
{
	// Create a new GraphTreeNode
	GraphTreeNodePtr gtNode(new GraphTreeNode(node));

	// Insert this iterator below a possible parent iterator
	Gtk::TreeModel::iterator parentIter = findParentIter(node);

	gtNode->getIter() = parentIter ? _model->append(parentIter->children()) : _model->append();

	// Fill in the values
	Gtk::TreeModel::Row row = *gtNode->getIter();

	row[_columns.node] = node.get();
	row[_columns.name] = node->name();

	// Insert this iterator into the node map to facilitate lookups
	std::pair<NodeMap::iterator, bool> result = _nodemap.insert(
		NodeMap::value_type(scene::INodeWeakPtr(node), gtNode)
	);

	// Return the GraphTreeNode reference
	return result.first->second;
}