ForCAX/entry/src/main/cpp/NativeEGLOCCT/Visualization/Tri/V3dTriCube.cpp
JackLee 45176b5d7e 1-调整部分UI组件
2-调整背景颜色为有限度透明

提醒:OpenCAX由于商标已经被注册,所以本软件即日起改名NXEA
2026-04-28 21:57:30 +08:00

51 lines
1.7 KiB
C++

//
// Created on 2026/3/30.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".
#include "V3dTriCube.h"
#include "Graphic3d_TransModeFlags.hxx"
#ifndef NATIVE_TAG
#define NATIVE_TAG "V3DTRICUBE"
#endif
namespace NativeNXEA {
V3dTriCube::V3dTriCube():
triCube(nullptr)
{
}
V3dTriCube::~V3dTriCube(){
}
bool V3dTriCube::InitV3dTriCube(Handle(AIS_InteractiveContext)& ctx){
try {
// 视图立方体
triCube = new AIS_ViewCube();
triPers=new Graphic3d_TransformPers(
Graphic3d_TMF_TriedronPers, // 随缩放保持大小
Aspect_TOTP_LEFT_UPPER, // 固定在左下角
NCollection_Vec2<int>(150, 150) // 离左下角偏移 10 像素
);
triCube->SetTransformPersistence(triPers);
triCube->SetBoxSideLabel(V3d_Xpos, TCollection_AsciiString(rightCube.c_str()));
triCube->SetBoxSideLabel(V3d_Ypos, TCollection_AsciiString(backCube.c_str()));
triCube->SetBoxSideLabel(V3d_Zpos, TCollection_AsciiString(topCube.c_str()));
triCube->SetBoxSideLabel(V3d_Xneg, TCollection_AsciiString(leftCube.c_str()));
triCube->SetBoxSideLabel(V3d_Yneg, TCollection_AsciiString(frontCube.c_str()));
triCube->SetBoxSideLabel(V3d_Zneg, TCollection_AsciiString(bottomCube.c_str()));
triCube->SetSize(100, true);
triCube->SetFontHeight(30);
triCube->SetZLayer(Graphic3d_ZLayerId_TopOSD);
ctx->Display(triCube, true);
HILOG_INFO(NATIVE_TAG, "Init V3dTriCube Done");
return true;
} catch (std::exception &e) {
HILOG_INFO(NATIVE_TAG, "Init V3dTriCube Fail:%s", e.what());
return false;
}
}
}