Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 17 additions & 3 deletions src/GDTFManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2906,12 +2906,14 @@ GdtfGeometryDisplay::GdtfGeometryDisplay(GdtfGeometry* parent)
:GdtfGeometry(parent)
{
fTexture = "";
fAspectRatio = "";
}

GdtfGeometryDisplay::GdtfGeometryDisplay(const TXString& name, GdtfModelPtr refToModel,const VWTransformMatrix& ma, GdtfGeometry* parent)
:GdtfGeometry(name,refToModel,ma, parent)
{
fTexture = "";
fTexture = "";
fAspectRatio = "";
}

GdtfGeometryDisplay::~GdtfGeometryDisplay()
Expand All @@ -2928,12 +2930,23 @@ void GdtfGeometryDisplay::SetTexture(const TXString& texture)
fTexture = texture;
}

const TXString& GdtfGeometryDisplay::GetAspectRatio() const
{
return fAspectRatio;
}

void GdtfGeometryDisplay::SetAspectRatio( const TXString& aspectRatio )
{
fAspectRatio = aspectRatio;
}

void GdtfGeometryDisplay::OnPrintToFile(IXMLFileNodePtr pNode)
{
//------------------------------------------------------------------------------------
// Call the parent
GdtfGeometry::OnPrintToFile(pNode);
pNode->SetNodeAttributeValue(XML_GDTF_DisplayTexture, fTexture);
pNode->SetNodeAttributeValue( XML_GDTF_DisplayTexture, fTexture);
pNode->SetNodeAttributeValue( XML_GDTF_DisplayAspectRatio, fAspectRatio );
}

void GdtfGeometryDisplay::OnReadFromNode(const IXMLFileNodePtr& pNode)
Expand All @@ -2942,7 +2955,8 @@ void GdtfGeometryDisplay::OnReadFromNode(const IXMLFileNodePtr& pNode)
// Call the parent
GdtfGeometry::OnReadFromNode(pNode);

pNode->GetNodeAttributeValue(XML_GDTF_DisplayTexture, fTexture);
pNode->GetNodeAttributeValue( XML_GDTF_DisplayTexture, fTexture);
pNode->GetNodeAttributeValue( XML_GDTF_DisplayAspectRatio, fAspectRatio );
}

void GdtfGeometryDisplay::OnErrorCheck(const IXMLFileNodePtr& pNode)
Expand Down
4 changes: 4 additions & 0 deletions src/GDTFManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -951,10 +951,14 @@ namespace SceneData
~GdtfGeometryDisplay();
private:
TXString fTexture;
TXString fAspectRatio;

public:
virtual EGdtfObjectType GetObjectType();
const TXString& GetTexture();
void SetTexture(const TXString& texture);
const TXString& GetAspectRatio() const;
void SetAspectRatio( const TXString& aspectRatio );
protected:
virtual TXString GetNodeName();
virtual void OnPrintToFile(IXMLFileNodePtr pNode);
Expand Down
26 changes: 26 additions & 0 deletions src/Implementation/CGdtfGeometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -983,6 +983,32 @@ VectorworksMVR::VCOMError VectorworksMVR::CGdtfGeometryImpl::SetTexture(MvrStrin
return kVCOMError_NoError;
}

MvrString VectorworksMVR::CGdtfGeometryImpl::GetAspectRatio()
{
if(!fGeometry) return "";

if( fGeometryType != EGdtfObjectType::eGdtfGeometryDisplay) return "";

SceneData::GdtfGeometryDisplayPtr display = static_cast<SceneData::GdtfGeometryDisplayPtr>(fGeometry);
if(!display) return "";

return display->GetAspectRatio().GetCharPtr();
}

VectorworksMVR::VCOMError VectorworksMVR::CGdtfGeometryImpl::SetAspectRatio(MvrString aspectRatio)
{
if (!fGeometry) return kVCOMError_NotInitialized;

if( fGeometryType != EGdtfObjectType::eGdtfGeometryDisplay) return kVCOMError_WrongGeometryType;

SceneData::GdtfGeometryDisplayPtr display = static_cast<SceneData::GdtfGeometryDisplayPtr>(fGeometry);
if(!display) return kVCOMError_Failed;

display->SetAspectRatio(aspectRatio);
return kVCOMError_NoError;
}


VectorworksMVR::VCOMError VectorworksMVR::CGdtfGeometryImpl::GetCountLinkedDmxChannel(size_t& count, IGdtfDmxMode * forMode)
{
// Get Count
Expand Down
2 changes: 2 additions & 0 deletions src/Implementation/CGdtfGeometry.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@ namespace VectorworksMVR
// Display
virtual MvrString VCOM_CALLTYPE GetTexture();
virtual VCOMError VCOM_CALLTYPE SetTexture(MvrString texture);
virtual MvrString VCOM_CALLTYPE GetAspectRatio();
virtual VCOMError VCOM_CALLTYPE SetAspectRatio(MvrString aspectRatio);

// Helpers
virtual VCOMError VCOM_CALLTYPE GetCountLinkedDmxChannel(size_t& count, IGdtfDmxMode * forMode);
Expand Down
2 changes: 2 additions & 0 deletions src/Include/IMediaRessourceVectorInterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -861,6 +861,8 @@ namespace VectorworksMVR
// Display
virtual MvrString VCOM_CALLTYPE GetTexture() = 0;
virtual VCOMError VCOM_CALLTYPE SetTexture(MvrString texture) = 0;
virtual MvrString VCOM_CALLTYPE GetAspectRatio() = 0;
virtual VCOMError VCOM_CALLTYPE SetAspectRatio(MvrString aspectRatio) = 0;

// GDTF 1.2
// Lamp
Expand Down
1 change: 1 addition & 0 deletions src/Prefix/CommonPrefix.h
Original file line number Diff line number Diff line change
Expand Up @@ -452,6 +452,7 @@ const Sint32 kGDTF_CurrentMinorVersion = 2;

#define XML_GDTF_DisplayNodeName "Display"
#define XML_GDTF_DisplayTexture "Texture"
#define XML_GDTF_DisplayAspectRatio "AspectRatio"

#define XML_GDTF_LaserProtocolNodeName "Protocol"
#define XML_GDTF_LaserProtocolName "Name"
Expand Down
21 changes: 17 additions & 4 deletions unittest/EmptyGeometryUnitTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,18 +13,28 @@ using namespace VectorworksMVR::GdtfDefines;
#define __checkVCOM(x) this->checkVCOM(x, #x)
#define __checkVCOM_NotSet(x) this->checkVCOM_NotSet(x, #x)

GdtfEmptyModelTest::GdtfEmptyModelTest(const std::string& currentDir) : GdtfUnitTest(currentDir)
GdtfEmptyModelTest::GdtfEmptyModelTest(const std::string& currentDir)
{
}

GdtfEmptyModelTest::~GdtfEmptyModelTest()
{
}

bool GdtfEmptyModelTest::ExecuteTest()
{
std::cout << "= GdtfEmptyModelTest =" << std::endl;

std::string GdtfEmptyModelTest::GetUnitTestName()
{
return std::string("GdtfEmptyModel");
VectorworksMVR::IGdtfFixturePtr fixture( IID_IGdtfFixture );
fixture->OpenForWrite( "EmptyGeometryUnitTest", "MVR Group", MvrUUID(1,1,1,1) );

WriteFile(fixture);

fixture->Close();

ReadFile(fixture);

return true;
}

void GdtfEmptyModelTest::WriteFile(VectorworksMVR::IGdtfFixturePtr& fixture)
Expand Down Expand Up @@ -54,6 +64,7 @@ void GdtfEmptyModelTest::WriteFile(VectorworksMVR::IGdtfFixturePtr& fixture)
IGdtfGeometryPtr geometry4;
__checkVCOM(geometry1->CreateGeometry(EGdtfObjectType::eGdtfGeometryDisplay, "Geometry4", filledModel, STransformMatrix(), &geometry4));
__checkVCOM(geometry4->SetTexture("Texture.png"));
__checkVCOM(geometry4->SetAspectRatio("16:9"));

// Magnet
IGdtfGeometryPtr geometry5;
Expand Down Expand Up @@ -200,6 +211,8 @@ void GdtfEmptyModelTest::ReadFile(VectorworksMVR::IGdtfFixturePtr& fixture)

checkifEqual("Check Texture", geometry4->GetTexture(), "Texture.png");

checkifEqual("Check Aspect Ratio", geometry4->GetAspectRatio(), "16:9");

// Magnet
IGdtfGeometryPtr geoMagnet;
__checkVCOM(geometry1->GetInternalGeometryAt(3, &geoMagnet));
Expand Down
8 changes: 4 additions & 4 deletions unittest/EmptyGeometryUnitTest.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
#include "GdtfUnittestHandler.h"


class GdtfEmptyModelTest : public GdtfUnitTest
class GdtfEmptyModelTest : public Unittest
{
public:
GdtfEmptyModelTest(const std::string& currentDir);
virtual ~GdtfEmptyModelTest();
protected:
std::string virtual GetUnitTestName() override;
bool virtual ExecuteTest();

private:
void virtual WriteFile(VectorworksMVR::IGdtfFixturePtr& fixtureDuringRead) override;
void virtual ReadFile(VectorworksMVR::IGdtfFixturePtr& fixtureDuringWrite) override;
void WriteFile(VectorworksMVR::IGdtfFixturePtr& fixtureDuringRead);
void ReadFile(VectorworksMVR::IGdtfFixturePtr& fixtureDuringWrite);

};
1 change: 1 addition & 0 deletions unittest/Unittest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ void Unittest::checkifEqual(const std::string& check, const std::string& aspecte

fFailedTests.push_back(test);

std::cout << "Failed Test: " << test.fMessage << std::endl;
};

bool Unittest::checkVCOM(VectorworksMVR::VCOMError error, const std::string& check)
Expand Down
1 change: 1 addition & 0 deletions unittest/Utility.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ bool UnitTestUtil::GetFolderAppDataLocal(std::string& outPath)
if(!result) return false;
std::wstring ws(buffer);
outPath = std::string(ws.begin(), ws.end());
std::cout << "AppData Local Folder: " << outPath << std::endl;

#elif _LINUX
// LINUX_IMPLEMENTATION - done
Expand Down