Repository navigation
Expand file tree
/
Copy pathUtility.cpp
More file actions
85 lines (71 loc) · 2.98 KB
/
Copy pathUtility.cpp
File metadata and controls
85 lines (71 loc) · 2.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//-----------------------------------------------------------------------------
//----- Copyright deersoft 2015 - 2017 www.deersoft.de
//-----------------------------------------------------------------------------
#include "Prefix/StdAfx.h"
#include "Utility.h"
#include <string>
using VectorworksMVR::Filing::IFolderIdentifierPtr;
using VectorworksMVR::Filing::IID_FolderIdentifier;
using namespace VectorworksMVR;
bool MvrUtil::isContainerType(ESceneObjType typ)
{
bool res = (
typ == ESceneObjType::Fixture
|| typ == ESceneObjType::FocusPoint
|| typ == ESceneObjType::Group
|| typ == ESceneObjType::Layer
|| typ == ESceneObjType::Projector
|| typ == ESceneObjType::SceneObj
|| typ == ESceneObjType::Truss
|| typ == ESceneObjType::VideoScreen
|| typ == ESceneObjType::Support);
ASSERTN(kEveryone, res);
return res;
}
/*static*/ void GdtfUtil::ConvertMatrix(const VectorworksMVR::STransformMatrix & smatrix, VWTransformMatrix & vwmatrix)
/*
Converts a STransformMatrix to a VWTransformMatrix.
*/
{
vwmatrix.fMatrix.mat[0][0] = smatrix.ux; vwmatrix.fMatrix.mat[0][1] = smatrix.uy; vwmatrix.fMatrix.mat[0][2] = smatrix.uz;
vwmatrix.fMatrix.mat[1][0] = smatrix.vx; vwmatrix.fMatrix.mat[1][1] = smatrix.vy; vwmatrix.fMatrix.mat[1][2] = smatrix.vz;
vwmatrix.fMatrix.mat[2][0] = smatrix.wx; vwmatrix.fMatrix.mat[2][1] = smatrix.wy; vwmatrix.fMatrix.mat[2][2] = smatrix.wz;
vwmatrix.fMatrix.mat[3][0] = smatrix.ox; vwmatrix.fMatrix.mat[3][1] = smatrix.oy; vwmatrix.fMatrix.mat[3][2] = smatrix.oz;
}
/*static*/ void GdtfUtil::ConvertMatrix(const VWTransformMatrix & vwmatrix, VectorworksMVR::STransformMatrix & smatrix)
/*
Converts a VWTransformMatrix to a STransformMatrix.
*/
{
smatrix.ux = vwmatrix.fMatrix.mat[0][0]; smatrix.uy = vwmatrix.fMatrix.mat[0][1]; smatrix.uz = vwmatrix.fMatrix.mat[0][2];
smatrix.vx = vwmatrix.fMatrix.mat[1][0]; smatrix.vy = vwmatrix.fMatrix.mat[1][1]; smatrix.vz = vwmatrix.fMatrix.mat[1][2];
smatrix.wx = vwmatrix.fMatrix.mat[2][0]; smatrix.wy = vwmatrix.fMatrix.mat[2][1]; smatrix.wz = vwmatrix.fMatrix.mat[2][2];
smatrix.ox = vwmatrix.fMatrix.mat[3][0]; smatrix.oy = vwmatrix.fMatrix.mat[3][1]; smatrix.oz = vwmatrix.fMatrix.mat[3][2];
}
/*static*/ void GdtfUtil::ConvertVector3(const VWPoint3D & vector, VectorworksMVR::SVector3 & svector)
/*
Converts a VWPoint3D to a SVector3.
*/
{
svector.x = vector.x;
svector.y = vector.y;
svector.z = vector.z;
}
TXString SystemUtil::ExtractFolderFromPath(TXString& path)
/*
Deletes the folder part from the incoming string so that only the fileNam remains and returns it.
*/
{
TXString folder = "";
//-----------------------------------------------------------------------------
ptrdiff_t pos = path.Find(kSeperator);
while (pos > 0 )
{
// Copy string
for (ptrdiff_t i = 0; i <= pos; i++) { folder += path.GetAt(i); }
// Delete and find next
path.Delete(0, pos + 1);
pos = path.Find(kSeperator);
}
return folder;
}