-
Notifications
You must be signed in to change notification settings - Fork 276
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e8a9f03
commit 6c07101
Showing
13 changed files
with
671 additions
and
126 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
/**************************************************************************** | ||
** Copyright (c) 2024, Fougue Ltd. <https://www.fougue.pro> | ||
** All rights reserved. | ||
** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt | ||
****************************************************************************/ | ||
|
||
#include "script_geom.h" | ||
|
||
#include <gp_Pnt.hxx> | ||
#include <gp_Vec.hxx> | ||
|
||
namespace Mayo { | ||
|
||
ScriptGeomAx3::ScriptGeomAx3(const gp_Ax3& ax3) | ||
: m_ax3(ax3) | ||
{ | ||
} | ||
|
||
QVariant ScriptGeomAx3::location() const | ||
{ | ||
return ScriptGeom::toScriptValue(m_ax3.Location()); | ||
} | ||
|
||
QVariant ScriptGeomAx3::mainDirection() const | ||
{ | ||
return ScriptGeom::toScriptValue(m_ax3.Direction()); | ||
} | ||
|
||
QVariant ScriptGeomAx3::xDirection() const | ||
{ | ||
return ScriptGeom::toScriptValue(m_ax3.XDirection()); | ||
} | ||
|
||
QVariant ScriptGeomAx3::yDirection() const | ||
{ | ||
return ScriptGeom::toScriptValue(m_ax3.YDirection()); | ||
} | ||
|
||
namespace ScriptGeom { | ||
|
||
static QVariant xyz_toScriptValue(const gp_XYZ& coords) | ||
{ | ||
QVariantMap value; | ||
value.insert("x", coords.X()); | ||
value.insert("y", coords.Y()); | ||
value.insert("z", coords.Z()); | ||
return value; | ||
} | ||
|
||
QVariant toScriptValue(const gp_Pnt& pnt) | ||
{ | ||
return xyz_toScriptValue(pnt.XYZ()); | ||
} | ||
|
||
QVariant toScriptValue(const gp_Vec& vec) | ||
{ | ||
return xyz_toScriptValue(vec.XYZ()); | ||
} | ||
|
||
QVariant toScriptValue(const gp_Dir& dir) | ||
{ | ||
return xyz_toScriptValue(dir.XYZ()); | ||
} | ||
|
||
QVariant toScriptValue(const gp_Ax3& ax3) | ||
{ | ||
return QVariant::fromValue(ScriptGeomAx3(ax3)); | ||
} | ||
|
||
} // namespace ScriptGeom | ||
|
||
} // namespace Mayo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/**************************************************************************** | ||
** Copyright (c) 2024, Fougue Ltd. <https://www.fougue.pro> | ||
** All rights reserved. | ||
** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt | ||
****************************************************************************/ | ||
|
||
#include <QtCore/QObject> | ||
#include <QtCore/QVariant> | ||
#include <gp_Ax3.hxx> | ||
|
||
namespace Mayo { | ||
|
||
class ScriptGeomAx3 { | ||
Q_GADGET | ||
Q_PROPERTY(QVariant location READ location) | ||
Q_PROPERTY(QVariant mainDirection READ mainDirection) | ||
Q_PROPERTY(QVariant xDirection READ xDirection) | ||
Q_PROPERTY(QVariant yDirection READ yDirection) | ||
public: | ||
ScriptGeomAx3() = default; | ||
ScriptGeomAx3(const gp_Ax3& ax3); | ||
|
||
QVariant location() const; | ||
QVariant mainDirection() const; | ||
QVariant xDirection() const; | ||
QVariant yDirection() const; | ||
|
||
private: | ||
gp_Ax3 m_ax3; | ||
}; | ||
|
||
namespace ScriptGeom { | ||
|
||
QVariant toScriptValue(const gp_Pnt& pnt); | ||
QVariant toScriptValue(const gp_Vec& vec); | ||
QVariant toScriptValue(const gp_Dir& dir); | ||
QVariant toScriptValue(const gp_Ax3& ax3); | ||
|
||
} // namespace ScriptGeom | ||
} // namespace Mayo | ||
|
||
Q_DECLARE_METATYPE(Mayo::ScriptGeomAx3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.