修复一些小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".
#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<int>(125, 125)));
new Graphic3d_TransformPers(Graphic3d_TMF_TriedronPers, Aspect_TOTP_LEFT_UPPER, NCollection_Vec2<int>(125, 125)));
context->Display(axiViewCube, true);
HILOG_INFO(NATIVE_TAG, "Init Axi View Cube Done");
return true;

View File

@ -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");

View File

@ -67,7 +67,7 @@ void V3dDrawer::InitV3dPlaneAspectOpts() {
}
void V3dDrawer::InitV3dArrowAspectOpts() {
}
void V3dDrawer::InitV3dDatumAspectOpts() {

View File

@ -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);
}