From 5f9af295f8f526f6c76ebfab222e0c147cb53817 Mon Sep 17 00:00:00 2001 From: JackLee <809262979@qq.com> Date: Mon, 30 Mar 2026 17:57:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=80=E4=BA=9B=E5=B0=8Fbu?= =?UTF-8?q?g?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/cpp/NativeEGLOCCT/V3d/Axis/Axis.cpp | 10 ++++++---- entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCa/V3dCa.cpp | 1 + .../main/cpp/NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.cpp | 2 +- .../src/main/cpp/NativeEGLOCCT/V3d/V3dView/V3dView.cpp | 7 +++++-- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/entry/src/main/cpp/NativeEGLOCCT/V3d/Axis/Axis.cpp b/entry/src/main/cpp/NativeEGLOCCT/V3d/Axis/Axis.cpp index 204fb1d0..5e3263a8 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/V3d/Axis/Axis.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/Axis/Axis.cpp @@ -5,6 +5,7 @@ // please include "napi/native_api.h". #include "Axis.h" +#include "Aspect_TypeOfTriedronPosition.hxx" #include "Graphic3d_NameOfMaterial.hxx" #include "Prs3d_DatumMode.hxx" #include "Quantity_NameOfColor.hxx" @@ -17,7 +18,7 @@ namespace NativeOpenCAX { Axis::Axis() : axiPlacement(nullptr), axiTrihedron(nullptr), axiViewCube(nullptr) {} Axis::~Axis() {} -bool Axis::InitAxis(Handle(AIS_InteractiveContext) & context) { +bool Axis::InitAxis(Handle(AIS_InteractiveContext) & ctx) { try { //坐标显示文本 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->SetSize(theSize); axiTrihedron->SetTransformPersistence(new Graphic3d_TransformPers(Graphic3d_TMF_ZoomPers, anOrg)); + axiTrihedron->Attributes()->DatumAspect()->SetTextAspect(ctx->DefaultDrawer()->TextAspect()); axiTrihedron->Attributes()->SetZLayer(Graphic3d_ZLayerId_Topmost); - context->Display(axiTrihedron, true); + ctx->Display(axiTrihedron, true); HILOG_INFO(NATIVE_TAG, "InitLocalAxis Done"); return true; } 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_Yneg, TCollection_AsciiString(frontCube)); axiViewCube->SetBoxSideLabel(V3d_Zneg, TCollection_AsciiString(bottomCube)); - axiViewCube->SetDrawAxes(false); + axiViewCube->SetDrawAxes(true); axiViewCube->SetSize(100, true); axiViewCube->SetTransparency(0.0); axiViewCube->SetFixedAnimationLoop(true); @@ -88,7 +90,7 @@ bool Axis::InitAxisCube(Handle(AIS_InteractiveContext) & context) { axiViewCube->SetFontHeight(30); axiViewCube->SetMaterial(Graphic3d_MaterialAspect(Graphic3d_NOM_ALUMINIUM)); axiViewCube->SetTransformPersistence( - new Graphic3d_TransformPers(Graphic3d_TMF_TriedronPers, Aspect_TOTP_RIGHT_UPPER, NCollection_Vec2(125, 125))); + new Graphic3d_TransformPers(Graphic3d_TMF_TriedronPers, Aspect_TOTP_LEFT_UPPER, NCollection_Vec2(125, 125))); context->Display(axiViewCube, true); HILOG_INFO(NATIVE_TAG, "Init Axi View Cube Done"); return true; diff --git a/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCa/V3dCa.cpp b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCa/V3dCa.cpp index b95d9dbe..88e00624 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCa/V3dCa.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCa/V3dCa.cpp @@ -20,6 +20,7 @@ bool V3dCa::InitV3dCa(Handle(V3d_View)& view) { // 将角度转换为弧度并计算对应的缩放因子 camera->SetFOVy(45.0); camera->SetZRange(1, 10.0); + camera->SetScale(1.0); view->SetCamera(camera); HILOG_ERROR(NATIVE_TAG,"Camera Scale:%{public}f",camera->Scale()); HILOG_INFO(NATIVE_TAG, "InitCamera Done"); diff --git a/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.cpp b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.cpp index 9fc3e39e..9148117d 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.cpp @@ -67,7 +67,7 @@ void V3dDrawer::InitV3dPlaneAspectOpts() { } void V3dDrawer::InitV3dArrowAspectOpts() { - + } void V3dDrawer::InitV3dDatumAspectOpts() { diff --git a/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dView/V3dView.cpp b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dView/V3dView.cpp index 4233ae2f..1b134bbf 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dView/V3dView.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dView/V3dView.cpp @@ -36,8 +36,8 @@ void V3dView::InitViewOption() { view->ChangeRenderingParams().IsShadowEnabled = Standard_False; view->ChangeRenderingParams().IsReflectionEnabled = Standard_False; //抗锯齿开启后字体无法显示 -// view->ChangeRenderingParams().IsAntialiasingEnabled = Standard_True; -// view->ChangeRenderingParams().Resolution = 2; + //view->ChangeRenderingParams().IsAntialiasingEnabled = Standard_True; + //view->ChangeRenderingParams().Resolution = 2; // 设置背景渐变 view->SetBgGradientColors(Quantity_Color(Quantity_NOC_GRAY), Quantity_Color(Quantity_NOC_BLACK), Aspect_GFM_VER, // 垂直渐变 @@ -52,6 +52,9 @@ void V3dView::InitViewOption() { view->SetBackgroundColor(Quantity_NOC_GRAY90); //左下角默认坐标系 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); }