修复一些小bug

This commit is contained in:
JackLee 2026-03-30 17:57:50 +08:00
parent b42620f109
commit 5f9af295f8
4 changed files with 13 additions and 7 deletions

View File

@ -5,6 +5,7 @@
// please include "napi/native_api.h". // please include "napi/native_api.h".
#include "Axis.h" #include "Axis.h"
#include "Aspect_TypeOfTriedronPosition.hxx"
#include "Graphic3d_NameOfMaterial.hxx" #include "Graphic3d_NameOfMaterial.hxx"
#include "Prs3d_DatumMode.hxx" #include "Prs3d_DatumMode.hxx"
#include "Quantity_NameOfColor.hxx" #include "Quantity_NameOfColor.hxx"
@ -17,7 +18,7 @@ namespace NativeOpenCAX {
Axis::Axis() : axiPlacement(nullptr), axiTrihedron(nullptr), axiViewCube(nullptr) {} Axis::Axis() : axiPlacement(nullptr), axiTrihedron(nullptr), axiViewCube(nullptr) {}
Axis::~Axis() {} Axis::~Axis() {}
bool Axis::InitAxis(Handle(AIS_InteractiveContext) & context) { bool Axis::InitAxis(Handle(AIS_InteractiveContext) & ctx) {
try { try {
//坐标显示文本 //坐标显示文本
const char16_t x_Axis[] = u"X"; const char16_t x_Axis[] = u"X";
@ -54,8 +55,9 @@ bool Axis::InitAxis(Handle(AIS_InteractiveContext) & context) {
axiTrihedron->SetLabel(Prs3d_DP_ZAxis, z_Axis); axiTrihedron->SetLabel(Prs3d_DP_ZAxis, z_Axis);
axiTrihedron->SetSize(theSize); axiTrihedron->SetSize(theSize);
axiTrihedron->SetTransformPersistence(new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, anOrg)); axiTrihedron->SetTransformPersistence(new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, anOrg));
axiTrihedron->Attributes()->DatumAspect()->SetTextAspect(ctx->DefaultDrawer()->TextAspect());
axiTrihedron->Attributes()->SetZLayer(Graphic3d_ZLayerId_Topmost); axiTrihedron->Attributes()->SetZLayer(Graphic3d_ZLayerId_Topmost);
context->Display(axiTrihedron, true); ctx->Display(axiTrihedron, true);
HILOG_INFO(NATIVE_TAG, "InitLocalAxis Done"); HILOG_INFO(NATIVE_TAG, "InitLocalAxis Done");
return true; return true;
} catch (std::exception &e) { } catch (std::exception &e) {
@ -80,7 +82,7 @@ bool Axis::InitAxisCube(Handle(AIS_InteractiveContext) & context) {
axiViewCube->SetBoxSideLabel(V3d_Xneg, TCollection_AsciiString(leftCube)); axiViewCube->SetBoxSideLabel(V3d_Xneg, TCollection_AsciiString(leftCube));
axiViewCube->SetBoxSideLabel(V3d_Yneg, TCollection_AsciiString(frontCube)); axiViewCube->SetBoxSideLabel(V3d_Yneg, TCollection_AsciiString(frontCube));
axiViewCube->SetBoxSideLabel(V3d_Zneg, TCollection_AsciiString(bottomCube)); axiViewCube->SetBoxSideLabel(V3d_Zneg, TCollection_AsciiString(bottomCube));
axiViewCube->SetDrawAxes(false); axiViewCube->SetDrawAxes(true);
axiViewCube->SetSize(100, true); axiViewCube->SetSize(100, true);
axiViewCube->SetTransparency(0.0); axiViewCube->SetTransparency(0.0);
axiViewCube->SetFixedAnimationLoop(true); axiViewCube->SetFixedAnimationLoop(true);
@ -88,7 +90,7 @@ bool Axis::InitAxisCube(Handle(AIS_InteractiveContext) & context) {
axiViewCube->SetFontHeight(30); axiViewCube->SetFontHeight(30);
axiViewCube->SetMaterial(Graphic3d_MaterialAspect(Graphic3d_NOM_ALUMINIUM)); axiViewCube->SetMaterial(Graphic3d_MaterialAspect(Graphic3d_NOM_ALUMINIUM));
axiViewCube->SetTransformPersistence( axiViewCube->SetTransformPersistence(
new Graphic3d_TransformPers(Graphic3d_TMF_TriedronPers, Aspect_TOTP_RIGHT_UPPER, NCollection_Vec2<int>(125, 125))); new Graphic3d_TransformPers(Graphic3d_TMF_TriedronPers, Aspect_TOTP_LEFT_UPPER, NCollection_Vec2<int>(125, 125)));
context->Display(axiViewCube, true); context->Display(axiViewCube, true);
HILOG_INFO(NATIVE_TAG, "Init Axi View Cube Done"); HILOG_INFO(NATIVE_TAG, "Init Axi View Cube Done");
return true; return true;

View File

@ -20,6 +20,7 @@ bool V3dCa::InitV3dCa(Handle(V3d_View)& view) {
// 将角度转换为弧度并计算对应的缩放因子 // 将角度转换为弧度并计算对应的缩放因子
camera->SetFOVy(45.0); camera->SetFOVy(45.0);
camera->SetZRange(1, 10.0); camera->SetZRange(1, 10.0);
camera->SetScale(1.0);
view->SetCamera(camera); view->SetCamera(camera);
HILOG_ERROR(NATIVE_TAG,"Camera Scale:%{public}f",camera->Scale()); HILOG_ERROR(NATIVE_TAG,"Camera Scale:%{public}f",camera->Scale());
HILOG_INFO(NATIVE_TAG, "InitCamera Done"); HILOG_INFO(NATIVE_TAG, "InitCamera Done");

View File

@ -52,6 +52,9 @@ void V3dView::InitViewOption() {
view->SetBackgroundColor(Quantity_NOC_GRAY90); view->SetBackgroundColor(Quantity_NOC_GRAY90);
//左下角默认坐标系 //左下角默认坐标系
view->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_ANTIQUEWHITE, 0.3, V3d_ZBUFFER); view->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_ANTIQUEWHITE, 0.3, V3d_ZBUFFER);
view->Trihedron(false)->LabelAspect(V3d_Y)->SetHeight(50);
view->Trihedron(false)->LabelAspect(V3d_X)->SetHeight(50);
view->Trihedron(false)->LabelAspect(V3d_Z)->SetHeight(50);
view->SetBackgroundColor(Quantity_NOC_GRAY90); view->SetBackgroundColor(Quantity_NOC_GRAY90);
} }