lib3mf 2.5 :
- aggiornamento versione - utilizzate le nostre librerie esterne libzip e zlib e non quelle incluse in lib3mf.
This commit is contained in:
@@ -29,11 +29,15 @@ Abstract: This is a stub class definition of CMeshObject
|
||||
*/
|
||||
#include "lib3mf_meshobject.hpp"
|
||||
#include "lib3mf_interfaceexception.hpp"
|
||||
#include "lib3mf_triangleset.hpp"
|
||||
|
||||
#include "lib3mf_beamlattice.hpp"
|
||||
#include "lib3mf_volumedata.hpp"
|
||||
// Include custom headers here.
|
||||
|
||||
#include "Common/MeshInformation/NMR_MeshInformation_Properties.h"
|
||||
#include "Model/Classes/NMR_ModelVolumeData.h"
|
||||
#include "Model/Classes/NMR_ModelResource.h"
|
||||
#include <cmath>
|
||||
|
||||
using namespace Lib3MF::Impl;
|
||||
@@ -379,6 +383,11 @@ bool CMeshObject::IsComponentsObject()
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMeshObject::IsLevelSetObject()
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
bool CMeshObject::IsValid()
|
||||
{
|
||||
return meshObject()->isValid();
|
||||
@@ -388,3 +397,72 @@ IBeamLattice* CMeshObject::BeamLattice()
|
||||
{
|
||||
return new CBeamLattice(meshObject(), meshObject()->getBeamLatticeAttributes());
|
||||
}
|
||||
|
||||
IVolumeData * CMeshObject::GetVolumeData()
|
||||
{
|
||||
auto volumeData = meshObject()->getVolumeData();
|
||||
if (!volumeData)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
return new CVolumeData(std::dynamic_pointer_cast<NMR::CModelResource>(meshObject()->getVolumeData()));
|
||||
}
|
||||
|
||||
void CMeshObject::SetVolumeData(IVolumeData* pTheVolumeData)
|
||||
{
|
||||
NMR::CModel * pModel = meshObject()->getModel();
|
||||
if (pModel == nullptr)
|
||||
throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDOBJECT);
|
||||
|
||||
NMR::PModelResource pResource = pModel->findResource(pTheVolumeData->GetResourceID());
|
||||
|
||||
if (pResource == nullptr)
|
||||
throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDOBJECT, "Referenced VolumeData Resource with ID " + std::to_string(pTheVolumeData->GetModelResourceID()) + " not found");
|
||||
|
||||
NMR::PModelVolumeData pVolumeData = std::dynamic_pointer_cast<NMR::CModelVolumeData>(pResource);
|
||||
|
||||
if (pVolumeData == nullptr)
|
||||
throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDOBJECT, "Referenced Resource is not of type VolumeData");
|
||||
|
||||
meshObject()->setVolumeData(pVolumeData);
|
||||
}
|
||||
|
||||
ITriangleSet* CMeshObject::AddTriangleSet(const std::string& sIdentifier, const std::string& sName)
|
||||
{
|
||||
return new CTriangleSet(meshObject()->addTriangleSet(sIdentifier, sName), meshObject());
|
||||
}
|
||||
|
||||
bool CMeshObject::HasTriangleSet(const std::string& sIdentifier)
|
||||
{
|
||||
auto pTriangleSet = meshObject()->findTriangleSet(sIdentifier);
|
||||
return (pTriangleSet.get() != nullptr);
|
||||
}
|
||||
|
||||
ITriangleSet* CMeshObject::FindTriangleSet(const std::string& sIdentifier)
|
||||
{
|
||||
auto pMeshObject = meshObject();
|
||||
auto pTriangleSet = pMeshObject->findTriangleSet(sIdentifier);
|
||||
if (pTriangleSet.get() == nullptr)
|
||||
throw ELib3MFInterfaceException(LIB3MF_ERROR_COULDNOTFINDTRIANGLESET);
|
||||
|
||||
return new CTriangleSet(pTriangleSet, pMeshObject);
|
||||
|
||||
}
|
||||
|
||||
Lib3MF_uint32 CMeshObject::GetTriangleSetCount()
|
||||
{
|
||||
return meshObject()->getTriangleSetCount();
|
||||
}
|
||||
|
||||
ITriangleSet* CMeshObject::GetTriangleSet(const Lib3MF_uint32 nIndex)
|
||||
{
|
||||
auto pMeshObject = meshObject();
|
||||
auto nTriangleSetCount = pMeshObject->getTriangleSetCount();
|
||||
if (nIndex >= nTriangleSetCount)
|
||||
throw ELib3MFInterfaceException(LIB3MF_ERROR_INVALIDTRIANGLESETINDEX);
|
||||
|
||||
auto pTriangleSet = meshObject()->getTriangleSet (nIndex);
|
||||
|
||||
return new CTriangleSet(pTriangleSet, pMeshObject);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user