• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ CNMRException函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中CNMRException函数的典型用法代码示例。如果您正苦于以下问题:C++ CNMRException函数的具体用法?C++ CNMRException怎么用?C++ CNMRException使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了CNMRException函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: CNMRException

	_Ret_notnull_ MESHBEAM * CMesh::addBeam(_In_ MESHNODE * pNode1, _In_ MESHNODE * pNode2,
		_In_ nfDouble * pRadius1, _In_ nfDouble * pRadius2,
		_In_ nfInt32 * peCapMode1, _In_ nfInt32 * peCapMode2)
	{
		if ((!pNode1) || (!pNode2) || (!pRadius1) || (!pRadius2) || (!peCapMode1) || (!peCapMode2))
			throw CNMRException(NMR_ERROR_INVALIDPARAM);

		if (pNode1 == pNode2)
			throw CNMRException(NMR_ERROR_DUPLICATENODE);

		MESHBEAM * pBeam;
		nfUint32 nBeamCount = getBeamCount();

		if (nBeamCount > NMR_MESH_MAXBEAMCOUNT)
			throw CNMRException(NMR_ERROR_TOOMANYBEAMS);

		nfUint32 nNewIndex;

		pBeam = m_BeamLattice.m_Beams.allocData(nNewIndex);
		pBeam->m_nodeindices[0] = pNode1->m_index;
		pBeam->m_nodeindices[1] = pNode2->m_index;
		pBeam->m_index = nNewIndex;
		pBeam->m_radius[0] = *pRadius1;
		pBeam->m_radius[1] = *pRadius2;

		pBeam->m_capMode[0] = *peCapMode1;
		pBeam->m_capMode[1] = *peCapMode2;

		return pBeam;
	}
开发者ID:3MFConsortium,项目名称:lib3mf,代码行数:30,代码来源:NMR_Mesh.cpp


示例2: __NMRASSERT

	void CModelReaderNode100_Tex2DGroup::OnAttribute(_In_z_ const nfWChar * pAttributeName, _In_z_ const nfWChar * pAttributeValue)
	{
		__NMRASSERT(pAttributeName);
		__NMRASSERT(pAttributeValue);

		if (wcscmp(pAttributeName, XML_3MF_ATTRIBUTE_TEX2DGROUP_ID) == 0) {
			if (m_nID != 0)
				throw CNMRException(NMR_ERROR_DUPLICATERESOURCEID);

			// Convert to integer and make a input and range check!
			m_nID = fnWStringToUint32(pAttributeValue);
		}
		else if (wcscmp(pAttributeName, XML_3MF_ATTRIBUTE_TEX2DGROUP_TEXTUREID) == 0) {
			if (m_nTextureID != 0)
				throw CNMRException(NMR_ERROR_DUPLICATERESOURCEID);

			// Convert to integer and make a input and range check!
			ModelResourceID nID = fnWStringToUint32(pAttributeValue);
			if (nID == 0)
				m_pWarnings->addException(CNMRException(NMR_ERROR_INVALIDMODELRESOURCE), mrwInvalidMandatoryValue);

			m_nTextureID = nID;
		}
		else
			m_pWarnings->addException(CNMRException(NMR_ERROR_NAMESPACE_INVALID_ATTRIBUTE), mrwInvalidOptionalValue);
	}
开发者ID:nTopology,项目名称:lib3mf,代码行数:26,代码来源:NMR_ModelReaderNode100_Tex2DGroup.cpp


示例3: CNMRException

	LIB3MFMETHODIMP CCOMModelBuildItem::SetObjectTransform(_In_ MODELTRANSFORM * pmTransform)
	{
		try {
			if (!pmTransform)
				throw CNMRException(NMR_ERROR_INVALIDPOINTER);

			if (!m_pModelBuildItem.get())
				throw CNMRException(NMR_ERROR_INVALIDBUILDITEM);

			NMATRIX3 mMatrix = fnMATRIX3_identity ();
			int i, j;

			for (i = 0; i < 3; i++) {
				for (j = 0; j < 4; j++) {
					mMatrix.m_fields[i][j] = pmTransform->m_fFields[i][j];
				}
			}

			m_pModelBuildItem->setTransform(mMatrix);

			return handleSuccess();
		}
		catch (CNMRException & Exception) {
			return handleNMRException(&Exception);
		}
		catch (...) {
			return handleGenericException();
		}
	}
开发者ID:jaimemachado,项目名称:lib3mf,代码行数:29,代码来源:NMR_COMInterface_ModelBuildItem.cpp


示例4: CNMRException

	void CModelWriter_3MF_Native::writePackageToStream(_In_ PExportStream pStream)
	{
		if (pStream.get() == nullptr)
			throw CNMRException(NMR_ERROR_INVALIDPARAM);
		if (m_pModel == nullptr)
			throw CNMRException(NMR_ERROR_NOMODELTOWRITE);

		// Write Model Stream
		POpcPackageWriter pPackageWriter = std::make_shared<COpcPackageWriter>(pStream);
		POpcPackagePart pModelPart = pPackageWriter->addPart(PACKAGE_3D_MODEL_URI);
		PXmlWriter_Native pXMLWriter = std::make_shared<CXmlWriter_Native>(pModelPart->getExportStream());
		writeModelStream(pXMLWriter.get(), m_pModel);

		// add Root relationships
		pPackageWriter->addRootRelationship(generateRelationShipID(), PACKAGE_START_PART_RELATIONSHIP_TYPE, pModelPart.get());

		// add Textures
		addTextureParts(m_pModel, pPackageWriter, pModelPart);

		// add Content Types
		pPackageWriter->addContentType(PACKAGE_3D_RELS_EXTENSION, PACKAGE_3D_RELS_CONTENT_TYPE);
		pPackageWriter->addContentType(PACKAGE_3D_MODEL_EXTENSION, PACKAGE_3D_MODEL_CONTENT_TYPE);
		pPackageWriter->addContentType(PACKAGE_3D_TEXTURE_EXTENSION, PACKAGE_TEXTURE_CONTENT_TYPE);
		pPackageWriter->addContentType(PACKAGE_3D_PNG_EXTENSION, PACKAGE_PNG_CONTENT_TYPE);
		pPackageWriter->addContentType(PACKAGE_3D_JPEG_EXTENSION, PACKAGE_JPG_CONTENT_TYPE);
		pPackageWriter->addContentType(PACKAGE_3D_JPG_EXTENSION, PACKAGE_JPG_CONTENT_TYPE);
	}
开发者ID:dqgoldin,项目名称:lib3mf,代码行数:27,代码来源:NMR_ModelWriter_3MF_Native.cpp


示例5: CNMRException

	LIB3MFMETHODIMP CCOMModelWriter::WriteToFileUTF8(_In_z_ LPCSTR pwszFilename)
	{

		try {
			if (pwszFilename == nullptr)
				throw CNMRException(NMR_ERROR_INVALIDPOINTER);
			if (m_pModelWriter.get() == nullptr)
				throw CNMRException(NMR_ERROR_RESOURCENOTFOUND);

			// Convert to UTF16
			std::string sUTF8FileName(pwszFilename);
			std::wstring sUTF16FileName = fnUTF8toUTF16(sUTF8FileName);

			PExportStream pStream = fnCreateExportStreamInstance(sUTF16FileName.c_str());
			m_pModelWriter->exportToStream(pStream);

			return handleSuccess();
		}
		catch (CNMRException_Windows & WinException) {
			return handleNMRException(&WinException);
		}
		catch (CNMRException & Exception) {
			return handleNMRException(&Exception);
		}
		catch (...) {
			return handleGenericException();
		}
	}
开发者ID:dqgoldin,项目名称:lib3mf,代码行数:28,代码来源:NMR_COMInterface_ModelWriter.cpp


示例6: CXmlWriter

	CXmlWriter_COM::CXmlWriter_COM(_In_ PExportStream pExportStream)
		: CXmlWriter(pExportStream)
	{
		HRESULT hResult;
		if (pExportStream.get() == nullptr)
			throw CNMRException(NMR_ERROR_INVALIDPARAM);

		// Create XML Writer
		hResult = CreateXmlWriter(__uuidof(IXmlWriter), (void**)&m_pXMLWriter, nullptr);
		if (hResult != S_OK)
			throw CNMRException_Windows(NMR_ERROR_COULDNOTCREATEXMLWRITER, hResult);

		// Cast to COM Streams
		CExportStream_COM * pCOMExportStream = dynamic_cast<CExportStream_COM *> (pExportStream.get());
		if (pCOMExportStream == nullptr)
			throw CNMRException(NMR_ERROR_INVALIDSTREAMTYPE);
		m_pCOMStream = pCOMExportStream->getCOMStream();

		// Set XML Writer Output
		hResult = m_pXMLWriter->SetOutput(m_pCOMStream);
		if (hResult != S_OK)
		  throw CNMRException_Windows(NMR_ERROR_COULDNOTSETXMLOUTPUT, hResult);

		// Set XML Writer Property
		hResult = m_pXMLWriter->SetProperty(XmlWriterProperty_Indent, true);
		if (hResult != S_OK)
			throw CNMRException_Windows(NMR_ERROR_COULDNOTSETXMLPROPERTY, hResult);
	}
开发者ID:ChiefGyk,项目名称:lib3mf,代码行数:28,代码来源:NMR_XmlWriter_COM.cpp


示例7: CNMRException

	LIB3MFMETHODIMP CCOMModelTexture2D::WriteToCallback(_In_ void * pWriteCallback, _In_opt_ void * pUserData)
	{
		try {
			if (pWriteCallback == nullptr)
				throw CNMRException(NMR_ERROR_INVALIDPOINTER);

			CModelTexture2DResource * pTextureResource = getTexture2D();
			__NMRASSERT(pTextureResource);

			PImportStream pTextureAttachment = pTextureResource->getTextureStream();
			ExportStream_WriteCallbackType pTypedWriteCallback = (ExportStream_WriteCallbackType)pWriteCallback;

			if (pTextureAttachment.get() != nullptr) {
				PExportStream pExportStream = std::make_shared<CExportStream_Callback>(pTypedWriteCallback, nullptr, pUserData);
				pExportStream->copyFrom(pTextureAttachment.get(), pTextureAttachment->retrieveSize(), MODELTEXTURE2D_BUFFERSIZE);
			}
			else {
				throw CNMRException(NMR_ERROR_NOTEXTURESTREAM);
			}

			return handleSuccess();
		}
		catch (CNMRException & Exception) {
			return handleNMRException(&Exception);
		}
		catch (...) {
			return handleGenericException();
		}

	}
开发者ID:3MFConsortium,项目名称:lib3mf,代码行数:30,代码来源:NMR_COMInterface_ModelTexture2D.cpp


示例8: CNMRException

	LIB3MFMETHODIMP CCOMModelTexture2D::WriteToBuffer(_Out_ BYTE * pBuffer, _In_ ULONG64 cbBufferSize)
	{
		try {
			if (pBuffer == nullptr)
				throw CNMRException(NMR_ERROR_INVALIDPOINTER);

			CModelTexture2DResource * pTextureResource = getTexture2D();
			__NMRASSERT(pTextureResource);

			PImportStream pTextureStream = pTextureResource->getTextureStream();

			if (pTextureStream.get() != nullptr) {
				nfUint64 cbStreamSize = pTextureStream->retrieveSize();
				if (cbStreamSize > cbBufferSize)
					throw CNMRException(NMR_ERROR_INSUFFICIENTBUFFERSIZE);
					
				pTextureStream->seekPosition(0, true);
				pTextureStream->readBuffer(pBuffer, cbStreamSize, true);
			}
			else {
				throw CNMRException(NMR_ERROR_NOTEXTURESTREAM);
			}

			return handleSuccess();
		}
		catch (CNMRException & Exception) {
			return handleNMRException(&Exception);
		}
		catch (...) {
			return handleGenericException();
		}

	}
开发者ID:jaimemachado,项目名称:lib3mf,代码行数:33,代码来源:NMR_COMInterface_ModelTexture2D.cpp


示例9: CNMRException

	COpcPackageRelationshipReader::COpcPackageRelationshipReader(_In_ PImportStream pImportStream)
	{
		if (pImportStream.get() == nullptr)
			throw CNMRException(NMR_ERROR_INVALIDPARAM);

		PXmlReader pXMLReader = fnCreateXMLReaderInstance(pImportStream);

		eXmlReaderNodeType NodeType;
		// Read all XML Root Nodes
		while (!pXMLReader->IsEOF()) {
			if (!pXMLReader->Read(NodeType))
				break;

			// Get Node Name
			LPCWSTR pwszLocalName = nullptr;
			pXMLReader->GetLocalName(&pwszLocalName, nullptr);
			if (!pwszLocalName)
				throw CNMRException(NMR_ERROR_COULDNOTGETLOCALXMLNAME);

			// Compare with Model Node Name
			if (wcscmp(pwszLocalName, OPC_RELS_RELATIONSHIP_CONTAINER) == 0) {
				parseRootNode(pXMLReader.get());
			}
		}
	}
开发者ID:ChiefGyk,项目名称:lib3mf,代码行数:25,代码来源:NMR_OpcPackageRelationshipReader.cpp


示例10: CNMRException

	void CMeshBuilder::addToMesh(_In_ CMesh * pMesh, _In_ nfBool bIgnoreInvalidFaces)
	{
		nfUint32 nIdx, j;
		if (!pMesh)
			throw CNMRException(NMR_ERROR_INVALIDPARAM);

		std::vector<MESHNODE *> pNodes;

		nfUint32 nNodeCount = m_Nodes.getCount();
		nfUint32 nFaceCount = m_Faces.getCount();
		pNodes.resize(nNodeCount);

		for (nIdx = 0; nIdx < nNodeCount; nIdx++) {
			NVEC3 * pPosition = m_Nodes.getData(nIdx);
			pNodes[nIdx] = pMesh->addNode(*pPosition);
		}

		for (nIdx = 0; nIdx < nFaceCount; nIdx++) {
			NVEC3I * pFaceVec = m_Faces.getData(nIdx);		
			MESHNODE * pNewNodes[3];

			for (j = 0; j < 3; j++) {
				pNewNodes[j] = pNodes[pFaceVec->m_fields[j]];
			}

			if ((pNewNodes[0] == pNewNodes[1]) || (pNewNodes[0] == pNewNodes[2]) || (pNewNodes[1] == pNewNodes[2])) {
				if (!bIgnoreInvalidFaces)
					throw CNMRException(NMR_ERROR_DUPLICATENODE);

			}
			else {
				pMesh->addFace(pNewNodes[0], pNewNodes[1], pNewNodes[2]);
			}
		}
	}
开发者ID:3MFConsortium,项目名称:lib3mf,代码行数:35,代码来源:NMR_MeshBuilder.cpp


示例11: CNMRException

	void CVectorTree::setUnits(_In_ nfFloat fUnits)
	{
		if ((fUnits < NMR_VECTOR_MINUNITS) || (fUnits > NMR_VECTOR_MAXUNITS))
			throw CNMRException(NMR_ERROR_INVALIDUNITS);
		if (m_entries.size() > 0)
			throw CNMRException(NMR_ERROR_COULDNOTSETUNITS);

		m_fUnits = fUnits;
	}
开发者ID:ChiefGyk,项目名称:lib3mf,代码行数:9,代码来源:NMR_VectorTree.cpp


示例12: __NMRASSERT

	void CModelReaderNode::parseContent(_In_ CXmlReader * pXMLReader)
	{
		__NMRASSERT(pXMLReader);

		if (m_sName == L"")
			throw CNMRException(NMR_ERROR_NODENAMEISEMPTY);

		if (m_bParsedContent)
			throw CNMRException(NMR_ERROR_ALREADYPARSEDXMLNODE);
		m_bParsedContent = true;

		if (m_bIsEmptyElement)
			return;

		while (!pXMLReader->IsEOF()) {
			LPCWSTR pwszQualifiedName = nullptr;
			LPCWSTR pwszText = nullptr;
			UINT nCount = 0;

			eXmlReaderNodeType NodeType;
			pXMLReader->Read(NodeType);

			switch (NodeType) {
			case XMLREADERNODETYPE_STARTELEMENT:
				pXMLReader->GetQualifiedName(&pwszQualifiedName, &nCount);
				if (!pwszQualifiedName)
					throw CNMRException(NMR_ERROR_COULDNOTGETQUALIFIEDXMLNAME);

				if (nCount > 0)
					OnChildElement(pwszQualifiedName, pXMLReader);
				break;

			case XMLREADERNODETYPE_TEXT:
				pXMLReader->GetValue(&pwszText, &nCount);
				if (!pwszText)
					throw CNMRException(NMR_ERROR_COULDNOTGETXMLTEXT);

				if (nCount > 0)
					OnText(pwszText, pXMLReader);
				break;

			case XMLREADERNODETYPE_ENDELEMENT:
				pXMLReader->GetQualifiedName(&pwszQualifiedName, &nCount);
				if (!pwszQualifiedName)
					throw CNMRException(NMR_ERROR_COULDNOTGETQUALIFIEDXMLNAME);

				if (wcscmp(pwszQualifiedName, m_sName.c_str()) == 0) {
					OnEndElement (pXMLReader);
					return;
				}
				break;

			case XMLREADERNODETYPE_UNKNOWN:
				break;
			}
		}
	}
开发者ID:Revware,项目名称:lib3mf,代码行数:57,代码来源:NMR_ModelReaderNode.cpp


示例13: CNMRException

	void CModelReaderNode093_Color::parseColor()
	{
		m_cColor = 0;

		try {
			if (m_sColorString.length() > 0) {
				nfWChar bFirstChar = m_sColorString[0];
				if (bFirstChar == L'#') {
					if (fnWStringToSRGBColor(m_sColorString.c_str(), m_cColor)) {
						return;
					}
				}

				if (bFirstChar == L's') {
					std::wstring sSubStr = m_sColorString.substr(0, 5);
					if (sSubStr == L"scRGB") {
						// parse scRGB String
						throw CNMRException(NMR_ERROR_NOTIMPLEMENTED);
					}
				}

				if (bFirstChar == L't') {
					std::wstring sSubStr = m_sColorString.substr(0, 4);
					if (sSubStr == L"tex(") {
						// parse Texture String

						if (m_sColorString.length() > 4) {
							std::wstring sTexID = m_sColorString.substr(4, m_sColorString.length() - sSubStr.length() - 1);
							nfInt32 nValue = fnWStringToInt32(sTexID.c_str());
							if ((nValue < 0) || (nValue >= XML_3MF_MAXRESOURCEINDEX))
								throw CNMRException(NMR_ERROR_INVALIDTEXTUREREFERENCE);

							m_nTextureID = nValue + 1;

						}
						else {
							throw CNMRException(NMR_ERROR_INVALIDTEXTUREREFERENCE);
						}
					}
				}

				if (bFirstChar == L'C') {
					std::wstring sSubStr4 = m_sColorString.substr(0, 4);
					if (sSubStr4 == L"CMYK") {
						throw CNMRException(NMR_ERROR_NOTSUPPORTINGLEGACYCMYK);
					}
				}

			}

			throw CNMRException(NMR_ERROR_INVALIDVALUEINCOLORSTRING);
		}
		catch (CNMRException & Exception) {
			m_pWarnings->addException(Exception, mrwMissingMandatoryValue);
		}

	}
开发者ID:jaimemachado,项目名称:lib3mf,代码行数:57,代码来源:NMR_ModelReaderNode093_Color.cpp


示例14: CNMRException

	COpcPackageReader::COpcPackageReader(_In_ PImportStream pImportStream)
	{
		if (pImportStream.get() == nullptr)
			throw CNMRException(NMR_ERROR_INVALIDPARAM);

		m_ZIPError.str = nullptr;
		m_ZIPError.sys_err = 0;
		m_ZIPError.zip_err = 0;
		m_ZIParchive = nullptr;
		m_ZIPsource = nullptr;

		try {
			// determine stream size
			nfUint64 nStreamSize = pImportStream->retrieveSize();
			pImportStream->seekPosition(0, true);

			if (nStreamSize == 0)
				throw CNMRException(NMR_ERROR_COULDNOTGETSTREAMPOSITION);

			// read ZIP into memory
			m_Buffer.resize ((size_t) nStreamSize);
			pImportStream->readBuffer(&m_Buffer[0], nStreamSize, true);

			// create ZIP objects
			zip_error_init(&m_ZIPError);
			m_ZIPsource = zip_source_buffer_create(&m_Buffer[0], (size_t) nStreamSize, 0, &m_ZIPError);
			if (m_ZIPsource == nullptr)
				throw CNMRException(NMR_ERROR_COULDNOTREADZIPFILE);

			m_ZIParchive = zip_open_from_source(m_ZIPsource, ZIP_RDONLY | ZIP_CHECKCONS, &m_ZIPError);
			if (m_ZIParchive == nullptr)
				throw CNMRException(NMR_ERROR_COULDNOTREADZIPFILE);

			// Get ZIP Content
			nfInt64 nEntryCount = zip_get_num_entries(m_ZIParchive, ZIP_FL_UNCHANGED);
			if (nEntryCount < 0)
				throw CNMRException(NMR_ERROR_COULDNOTREADZIPFILE);

			// List Entries
			nfInt64 nIndex;
			for (nIndex = 0; nIndex < nEntryCount; nIndex++) {
				const char * pszName = zip_get_name(m_ZIParchive, (nfUint64) nIndex, ZIP_FL_ENC_GUESS);
				std::string sUTF8Name(pszName);
				std::wstring sUTF16Name = fnUTF8toUTF16(sUTF8Name);
				m_ZIPEntries.insert(std::make_pair(sUTF16Name, nIndex));
			}

			readContentTypes();
			readRootRelationships();

		}
		catch (...)
		{
			releaseZIP();
			throw;
		}
	}
开发者ID:ChiefGyk,项目名称:lib3mf,代码行数:57,代码来源:NMR_OpcPackageReader.cpp


示例15: CNMRException

	// Build Handling
	void CModel::addBuildItem(_In_ PModelBuildItem pBuildItem)
	{
		if (!pBuildItem.get())
			throw CNMRException(NMR_ERROR_INVALIDPARAM);
		if (m_BuildItems.size() >= XML_3MF_MAXBUILDITEMCOUNT)
			throw CNMRException(NMR_ERROR_INVALIDBUILDITEMCOUNT);

		m_BuildItems.push_back(pBuildItem);
	}
开发者ID:ChiefGyk,项目名称:lib3mf,代码行数:10,代码来源:NMR_Model.cpp


示例16: CNMRException

	COpcPackagePart::COpcPackagePart(_In_ std::string sURI, _In_ PImportStream pImportStream)
	{
		if (pImportStream.get() == nullptr)
			throw CNMRException(NMR_ERROR_INVALIDPARAM);
		if (sURI.length() == 0)
			throw CNMRException(NMR_ERROR_INVALIDOPCPARTURI);

		m_sURI = sURI;
		m_pImportStream = pImportStream;
	}
开发者ID:3MFConsortium,项目名称:lib3mf,代码行数:10,代码来源:NMR_OpcPackagePart.cpp


示例17: CNMRException

	LIB3MFMETHODIMP CCOMModelComponentsObject::AddComponent(_In_ ILib3MFModelObjectResource * pObject, _In_opt_ MODELTRANSFORM * pmTransform, _Outptr_ ILib3MFModelComponent ** ppComponent)
	{

		try {
			if (!pObject)
				throw CNMRException (NMR_ERROR_INVALIDPOINTER);

			CModelComponentsObject * pComponentsObject = getComponentsObject();
			CModel * pModel = pComponentsObject->getModel();
			__NMRASSERT(pModel);

			// Get Resource ID
			ModelResourceID nObjectID;
			HRESULT hResult = pObject->GetResourceID(&nObjectID);
			if (hResult != LIB3MF_OK)
				return hResult;

			// Find class instance
			CModelObject * pObject = pModel->findObject(nObjectID);
			if (pObject == nullptr)
				throw CNMRException(NMR_ERROR_RESOURCENOTFOUND);

			// Convert Transform, if given
			NMATRIX3 mMatrix = fnMATRIX3_identity();
			if (pmTransform) {
				int i, j;

				for (i = 0; i < 3; i++) {
					for (j = 0; j < 4; j++) {
						mMatrix.m_fields[i][j] = pmTransform->m_fFields[i][j];
					}
				}
			}

			// Create Model component
			PModelComponent pNewComponent = std::make_shared<CModelComponent>(pObject, mMatrix);
			pComponentsObject->addComponent(pNewComponent);

			// Create Component COM Wrapper
			if (ppComponent) {
				CCOMObject<CCOMModelComponent> * pResult = new CCOMObject<CCOMModelComponent>();
				pResult->AddRef();
				pResult->setComponent(pNewComponent);
				*ppComponent = pResult;
			}

			return handleSuccess();
		}
		catch (CNMRException & Exception) {
			return handleNMRException(&Exception);
		}
		catch (...) {
			return handleGenericException();
		}
	}
开发者ID:ChiefGyk,项目名称:lib3mf,代码行数:55,代码来源:NMR_COMInterface_ModelComponentsObject.cpp


示例18: CNMRException

	void CModelWriter_3MF_Native::writePackageToStream(_In_ PExportStream pStream)
	{
		if (pStream.get() == nullptr)
			throw CNMRException(NMR_ERROR_INVALIDPARAM);
		if (m_pModel == nullptr)
			throw CNMRException(NMR_ERROR_NOMODELTOWRITE);

		// Write Model Stream
		POpcPackageWriter pPackageWriter = std::make_shared<COpcPackageWriter>(pStream);
		POpcPackagePart pModelPart = pPackageWriter->addPart(PACKAGE_3D_MODEL_URI);
		PXmlWriter_Native pXMLWriter = std::make_shared<CXmlWriter_Native>(pModelPart->getExportStream());
		writeModelStream(pXMLWriter.get(), m_pModel);

		// add Root relationships
		pPackageWriter->addRootRelationship(generateRelationShipID(), PACKAGE_START_PART_RELATIONSHIP_TYPE, pModelPart.get());

		PModelAttachment pPackageThumbnail = m_pModel->getPackageThumbnail();
		if (pPackageThumbnail.get() != nullptr)
		{
			// create Package Thumbnail Part
			POpcPackagePart pThumbnailPart = pPackageWriter->addPart(pPackageThumbnail->getPathURI());
			PExportStream pExportStream = pThumbnailPart->getExportStream();
			// Copy data
			PImportStream pPackageThumbnailStream = pPackageThumbnail->getStream();
			pPackageThumbnailStream->seekPosition(0, true);
			pExportStream->copyFrom(pPackageThumbnailStream.get(), pPackageThumbnailStream->retrieveSize(), MODELWRITER_NATIVE_BUFFERSIZE);
			// add root relationship
			pPackageWriter->addRootRelationship(generateRelationShipID(), pPackageThumbnail->getRelationShipType(), pThumbnailPart.get());
		}

		// add slicestacks that reference other files
		addSlicerefAttachments(m_pModel);
		
		// add Attachments
		addAttachments(m_pModel, pPackageWriter, pModelPart);

		// add Content Types
		pPackageWriter->addContentType(PACKAGE_3D_RELS_EXTENSION, PACKAGE_3D_RELS_CONTENT_TYPE);
		pPackageWriter->addContentType(PACKAGE_3D_MODEL_EXTENSION, PACKAGE_3D_MODEL_CONTENT_TYPE);
		pPackageWriter->addContentType(PACKAGE_3D_TEXTURE_EXTENSION, PACKAGE_TEXTURE_CONTENT_TYPE);
		pPackageWriter->addContentType(PACKAGE_3D_PNG_EXTENSION, PACKAGE_PNG_CONTENT_TYPE);
		pPackageWriter->addContentType(PACKAGE_3D_JPEG_EXTENSION, PACKAGE_JPG_CONTENT_TYPE);
		pPackageWriter->addContentType(PACKAGE_3D_JPG_EXTENSION, PACKAGE_JPG_CONTENT_TYPE);

		std::map<std::wstring, std::wstring> CustomContentTypes = m_pModel->getCustomContentTypes();
		std::map<std::wstring, std::wstring>::iterator iContentTypeIterator;

		for (iContentTypeIterator = CustomContentTypes.begin(); iContentTypeIterator != CustomContentTypes.end(); iContentTypeIterator++) {
			if (!m_pModel->contentTypeIsDefault(iContentTypeIterator->first)) {
				pPackageWriter->addContentType(iContentTypeIterator->first, iContentTypeIterator->second);
			}
		}

			
	}
开发者ID:nTopology,项目名称:lib3mf,代码行数:55,代码来源:NMR_ModelWriter_3MF_Native.cpp


示例19: CNMRException

	_Ret_notnull_ CModelMeshObject * CCOMModelMeshObject::getMeshObject()
	{
		if (m_pResource.get() == nullptr)
			throw CNMRException(NMR_ERROR_INVALIDMESH);

		CModelMeshObject * pMeshObject = dynamic_cast<CModelMeshObject *> (m_pResource.get());
		if (pMeshObject == nullptr)
			throw CNMRException(NMR_ERROR_INVALIDMESH);

		return pMeshObject;
	}
开发者ID:ChiefGyk,项目名称:lib3mf,代码行数:11,代码来源:NMR_COMInterface_ModelMeshObject.cpp


示例20: CNMRException

	void CModelReaderNode093_Triangle::retrieveIndices(_Out_ nfInt32 & nIndex1, _Out_ nfInt32 & nIndex2, _Out_ nfInt32 & nIndex3, nfInt32 nNodeCount)
	{
		if ((m_nIndex1 < 0) || (m_nIndex2 < 0) || (m_nIndex3 < 0))
			throw CNMRException(NMR_ERROR_INVALIDMODELNODEINDEX);

		if ((m_nIndex1 >= nNodeCount) || (m_nIndex2 >= nNodeCount) || (m_nIndex3 >= nNodeCount))
			throw CNMRException(NMR_ERROR_INVALIDMODELNODEINDEX);

		nIndex1 = m_nIndex1;
		nIndex2 = m_nIndex2;
		nIndex3 = m_nIndex3;
	}
开发者ID:ChiefGyk,项目名称:lib3mf,代码行数:12,代码来源:NMR_ModelReaderNode093_Triangle.cpp



注:本文中的CNMRException函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ CNST_LIMB函数代码示例发布时间:2022-05-30
下一篇:
C++ CMoptLookup函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap