From 818662eb96ee5ac286546912615eb4047863e50d Mon Sep 17 00:00:00 2001 From: JackLee <809262979@qq.com> Date: Mon, 23 Mar 2026 20:29:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B0=81=E8=A3=85Native=E4=BE=A7=E5=BE=97OCCT?= =?UTF-8?q?=E7=B1=BB=E5=92=8C=E5=AF=B9=E8=B1=A1.=20=E5=BD=92=E4=B8=80?= =?UTF-8?q?=E5=8C=96=E8=A7=86=E8=A7=92=E5=88=87=E6=8D=A2=E5=87=BD=E6=95=B0?= =?UTF-8?q?=E5=92=8C=E5=AE=9E=E7=8E=B0.=20=E4=BF=AE=E5=A4=8D=E6=9C=80?= =?UTF-8?q?=E5=A4=A7=E5=8C=96=E7=AA=97=E5=8F=A3=E6=B8=B2=E6=9F=93=E5=90=8C?= =?UTF-8?q?=E6=AD=A5=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98.=20=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=A8=A1=E5=9E=8B=E8=BE=B9=E7=95=8C=E7=BA=BF=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=20Next=20Version:=20=E5=A2=9E=E5=8A=A0=E7=BA=BF?= =?UTF-8?q?=E6=A1=86,=E9=9A=90=E8=97=8F=E7=BA=BF=E6=A1=86,=E7=AD=89?= =?UTF-8?q?=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/cpp/CMakeLists.txt | 12 +- .../src/main/cpp/NativeEGLOCCT/Axis/Axis.cpp | 91 ++++++++ entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.h | 57 +++++ .../main/cpp/NativeEGLOCCT/Axis/LocalAxis.cpp | 32 --- .../main/cpp/NativeEGLOCCT/Axis/LocalAxis.h | 15 -- .../main/cpp/NativeEGLOCCT/Axis/WorldAxis.cpp | 40 ---- .../main/cpp/NativeEGLOCCT/Axis/WorldAxis.h | 15 -- .../main/cpp/NativeEGLOCCT/Camera/Camera.cpp | 143 +++++------- .../main/cpp/NativeEGLOCCT/Camera/Camera.h | 27 +-- .../cpp/NativeEGLOCCT/Context/Context.cpp | 22 +- .../main/cpp/NativeEGLOCCT/Context/Context.h | 14 +- .../main/cpp/NativeEGLOCCT/NativeManager.cpp | 6 + .../main/cpp/NativeEGLOCCT/NativeRender.cpp | 216 ++++++------------ .../src/main/cpp/NativeEGLOCCT/NativeRender.h | 37 ++- .../cpp/NativeEGLOCCT/NativeRenderThread.cpp | 73 ++---- .../cpp/NativeEGLOCCT/NativeRenderThread.h | 12 +- .../OpenGLGraphicDriver.cpp | 35 +-- .../OpenGLGraphicDriver/OpenGLGraphicDriver.h | 17 +- .../src/main/cpp/NativeEGLOCCT/RenderStruct.h | 83 ------- .../cpp/NativeEGLOCCT/TextStyle/TextStyle.cpp | 38 +-- .../cpp/NativeEGLOCCT/TextStyle/TextStyle.h | 15 +- .../src/main/cpp/NativeEGLOCCT/View/View.cpp | 108 ++++++--- entry/src/main/cpp/NativeEGLOCCT/View/View.h | 33 ++- .../main/cpp/NativeEGLOCCT/Viewer/Viewer.cpp | 25 +- .../main/cpp/NativeEGLOCCT/Viewer/Viewer.h | 14 +- .../main/cpp/NativeEGLOCCT/Window/Window.cpp | 34 +++ .../main/cpp/NativeEGLOCCT/Window/Window.h | 27 +++ entry/src/main/cpp/NativeEGLOCCT/common.h | 1 + .../main/ets/entryability/EntryAbility.ets | 2 +- .../LayoutInterface/Layout/MatrixModel.ets | 8 + .../LayoutInterface/Layout/SwitchView.ets | 4 +- 31 files changed, 636 insertions(+), 620 deletions(-) create mode 100644 entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.cpp create mode 100644 entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.h delete mode 100644 entry/src/main/cpp/NativeEGLOCCT/Axis/LocalAxis.cpp delete mode 100644 entry/src/main/cpp/NativeEGLOCCT/Axis/LocalAxis.h delete mode 100644 entry/src/main/cpp/NativeEGLOCCT/Axis/WorldAxis.cpp delete mode 100644 entry/src/main/cpp/NativeEGLOCCT/Axis/WorldAxis.h delete mode 100644 entry/src/main/cpp/NativeEGLOCCT/RenderStruct.h create mode 100644 entry/src/main/cpp/NativeEGLOCCT/Window/Window.cpp create mode 100644 entry/src/main/cpp/NativeEGLOCCT/Window/Window.h diff --git a/entry/src/main/cpp/CMakeLists.txt b/entry/src/main/cpp/CMakeLists.txt index 1cfb2007..d199052e 100644 --- a/entry/src/main/cpp/CMakeLists.txt +++ b/entry/src/main/cpp/CMakeLists.txt @@ -32,29 +32,29 @@ add_library(opencax SHARED NativeEGLOCCT/NativeRender.h NativeEGLOCCT/NativeRenderThread.h NativeEGLOCCT/NativeManager.h - NativeEGLOCCT/RenderStruct.h - NativeEGLOCCT/Axis/worldAxis.h - NativeEGLOCCT/Axis/localAxis.h + NativeEGLOCCT/Axis/Axis.h NativeEGLOCCT/OpenGLGraphicDriver/OpenGLGraphicDriver.h NativeEGLOCCT/TextStyle/TextStyle.h NativeEGLOCCT/Viewer/Viewer.h NativeEGLOCCT/Context/Context.h NativeEGLOCCT/View/View.h + NativeEGLOCCT/window/window.h NativeEGLOCCT/Camera/Camera.h # Cpp Src NativeEGLOCCT/EGLCore.cpp NativeEGLOCCT/NativeRender.cpp NativeEGLOCCT/NativeRenderThread.cpp NativeEGLOCCT/NativeManager.cpp - NativeEGLOCCT/Axis/worldAxis.cpp - NativeEGLOCCT/Axis/localAxis.cpp NativeEGLOCCT/OpenGLGraphicDriver/OpenGLGraphicDriver.cpp NativeEGLOCCT/TextStyle/TextStyle.cpp NativeEGLOCCT/Viewer/Viewer.cpp NativeEGLOCCT/Context/Context.cpp NativeEGLOCCT/View/View.cpp NativeEGLOCCT/Camera/Camera.cpp - napi_init.cpp ) + NativeEGLOCCT/Axis/Axis.cpp + NativeEGLOCCT/window/window.cpp + napi_init.cpp + ) # 查找系统库 find_library(EGL-lib EGL) diff --git a/entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.cpp b/entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.cpp new file mode 100644 index 00000000..dbe76823 --- /dev/null +++ b/entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.cpp @@ -0,0 +1,91 @@ +// +// Created on 2026/3/23. +// +// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, +// please include "napi/native_api.h". + +#include "Axis.h" + +#ifndef NATIVE_TAG +#define NATIVE_TAG "AXIS" +#endif + +namespace NativeOpenCAX { +Axis::Axis() : axisPlacement(nullptr), axisTrihedron(nullptr) { } +Axis::~Axis() { + +} + +bool Axis::InitAxis(Handle(AIS_InteractiveContext)& context,AXIS_TYPE _axisType) { + axisType = _axisType; + switch (axisType) { + case WORLD_AXIS: + return InitWorldAxis(context); + break; + case LOCAL_AXIS: + return InitLocalAxis(context); + break; + } +} +bool Axis::InitWorldAxis(Handle(AIS_InteractiveContext)& context) { + try { + // 添加世界坐标系(左下角) + axisPlacement = new Geom_Axis2Placement(gp::XOY()); + axisTrihedron = new AIS_Trihedron(axisPlacement); + axisTrihedron->SetSize(100.0); // 小一点,作为指示器 + axisTrihedron->SetZLayer(Graphic3d_ZLayerId_TopOSD); + axisTrihedron->SetTransformPersistence(new Graphic3d_TransformPers(Graphic3d_TMF_2d, // 2D 模式 + Aspect_TOTP_LEFT_LOWER, // 左下角对齐 + Graphic3d_Vec2i(100, 100) // 偏移量(像素) + )); + axisTrihedron->SetDatumPartColor(Prs3d_DP_XAxis, Quantity_NOC_RED); + axisTrihedron->SetDatumPartColor(Prs3d_DP_YAxis, Quantity_NOC_GREEN); + axisTrihedron->SetDatumPartColor(Prs3d_DP_ZAxis, Quantity_NOC_BLUE); + context->Display(axisTrihedron, 0, 0, false); + HILOG_INFO(NATIVE_TAG, "InitWorldAxis Done"); + return true; + } catch (std::exception &e) { + HILOG_INFO(NATIVE_TAG, "InitWorldAxis Fail:%{public}d",e.what()); + return false; + } + +} +bool Axis::InitLocalAxis(Handle(AIS_InteractiveContext)& context) { + try { + // 创建场景中心参考坐标系 + axisPlacement = new Geom_Axis2Placement(gp::XOY()); + axisTrihedron = new AIS_Trihedron(axisPlacement); + axisTrihedron->SetSize(50.0); + axisTrihedron->SetDatumPartColor(Prs3d_DP_XAxis, Quantity_NOC_RED); + axisTrihedron->SetDatumPartColor(Prs3d_DP_YAxis, Quantity_NOC_GREEN); + axisTrihedron->SetDatumPartColor(Prs3d_DP_ZAxis, Quantity_NOC_BLUE); + context->Display(axisTrihedron, 0, 0, true); + HILOG_INFO(NATIVE_TAG, "InitLocalAxis Done"); + return true; + } catch (std::exception &e) { + HILOG_INFO(NATIVE_TAG, "InitLocalAxis Fail:%{public}d",e.what()); + return false; + } +} +void Axis::SetRotationX(float rx){ + rotationX=rx; +} +void Axis::SetRotationY(float ry){ + rotationX=ry; +} +void Axis::SetRotationZ(float rz){ + rotationX=rz; +} +void Axis::SetTranslationX(float tx){ + translationX=tx; +} +void Axis::SetTranslationY(float ty){ + translationX=ty; +} +void Axis::SetTranslationZ(float tz){ + translationX=tz; +} +void Axis::SetZoomLevel(float level){ + zoomLevel=level; +} +} \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.h b/entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.h new file mode 100644 index 00000000..e7587f0f --- /dev/null +++ b/entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.h @@ -0,0 +1,57 @@ +// +// Created on 2026/3/23. +// +// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, +// please include "napi/native_api.h". + +#ifndef OPENCAX_AXIS_H +#define OPENCAX_AXIS_H + +#include "NativeEGLOCCT/common.h" +#include +#include +#include + +namespace NativeOpenCAX { +enum AXIS_TYPE{ + WORLD_AXIS, + LOCAL_AXIS +}; +class Axis { +public: + Axis(); + ~Axis(); + bool InitAxis(Handle(AIS_InteractiveContext)& context,AXIS_TYPE _axisType); + void SetRotationX(float x); + void SetRotationY(float y); + void SetRotationZ(float z); + void SetTranslationX(float x); + void SetTranslationY(float y); + void SetTranslationZ(float z); + void SetZoomLevel(float level); +private: + bool InitWorldAxis(Handle(AIS_InteractiveContext)& context); + bool InitLocalAxis(Handle(AIS_InteractiveContext)& context); +private: + AXIS_TYPE axisType; + Handle(Geom_Axis2Placement) axisPlacement; + Handle(AIS_Trihedron) axisTrihedron; +private: + //旋转X轴 + float rotationX=0.0f; + //旋转Y轴 + float rotationY=0.0f; + //旋转Z轴 + float rotationZ=0.0f; + //缩放等级 + float zoomLevel=1.0f; + //翻转X轴 + float translationX=0.0f; + //翻转Y轴 + float translationY=0.0f; + //翻转Z轴 + float translationZ=0.0f; +}; +} + +#endif //OPENCAX_AXIS_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/Axis/LocalAxis.cpp b/entry/src/main/cpp/NativeEGLOCCT/Axis/LocalAxis.cpp deleted file mode 100644 index 8d1da562..00000000 --- a/entry/src/main/cpp/NativeEGLOCCT/Axis/LocalAxis.cpp +++ /dev/null @@ -1,32 +0,0 @@ -// -// Created on 2026/3/6. -// -// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, -// please include "napi/native_api.h". - -#include "LocalAxis.h" - -#ifndef NATIVE_TAG -#define NATIVE_TAG "InitLocalAxis" -#endif - -namespace NativeOpenCAX { -bool InitLocalAxis(RenderOption& opt) { - if (opt.localAxisPlacement.IsNull()) { - // 创建场景中心参考坐标系 - opt.localAxisPlacement = new Geom_Axis2Placement(gp::XOY()); - opt.localAxis = new AIS_Trihedron(opt.localAxisPlacement); - opt.localAxis->SetSize(50.0); - opt.localAxis->SetDatumPartColor(Prs3d_DP_XAxis,Quantity_NOC_RED); - opt.localAxis->SetDatumPartColor(Prs3d_DP_YAxis,Quantity_NOC_GREEN); - opt.localAxis->SetDatumPartColor(Prs3d_DP_ZAxis,Quantity_NOC_BLUE); - opt.context->Display(opt.localAxis, 0, 0, true); - HILOG_INFO(NATIVE_TAG,"InitLocalAxis Done"); - return true; - } - return false; -} -void ChangeLocalAxis() { - -} -} \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/Axis/LocalAxis.h b/entry/src/main/cpp/NativeEGLOCCT/Axis/LocalAxis.h deleted file mode 100644 index 5664ee77..00000000 --- a/entry/src/main/cpp/NativeEGLOCCT/Axis/LocalAxis.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Created on 2026/3/6. -// -// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, -// please include "napi/native_api.h". - -#ifndef OPENCAX_LOCALAXIS_H -#define OPENCAX_LOCALAXIS_H -#include "../RenderStruct.h" -namespace NativeOpenCAX { - bool InitLocalAxis(RenderOption& opt); - void ChangeLocalAxis(); -} - -#endif //OPENCAX_LOCALAXIS_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/Axis/WorldAxis.cpp b/entry/src/main/cpp/NativeEGLOCCT/Axis/WorldAxis.cpp deleted file mode 100644 index be6e371d..00000000 --- a/entry/src/main/cpp/NativeEGLOCCT/Axis/WorldAxis.cpp +++ /dev/null @@ -1,40 +0,0 @@ -// -// Created on 2026/3/6. -// -// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, -// please include "napi/native_api.h". - -#include "WorldAxis.h" - -#ifndef NATIVE_TAG -#define NATIVE_TAG "InitWorldAxis" -#endif - -namespace NativeOpenCAX { -bool InitWorldAxis(RenderOption& opt) { - if (opt.worldAxisPlacement.IsNull()) { - // 添加世界坐标系(左下角) - opt.worldAxisPlacement = new Geom_Axis2Placement(gp::XOY()); - opt.worldAxis = new AIS_Trihedron(opt.worldAxisPlacement); - opt.worldAxis->SetSize(100.0); // 小一点,作为指示器 - opt.worldAxis->SetZLayer(Graphic3d_ZLayerId_TopOSD); - opt.worldAxis->SetTransformPersistence( - new Graphic3d_TransformPers( - Graphic3d_TMF_2d, // 2D 模式 - Aspect_TOTP_LEFT_LOWER, // 左下角对齐 - Graphic3d_Vec2i(100, 100) // 偏移量(像素) - ) - ); - opt.worldAxis->SetDatumPartColor(Prs3d_DP_XAxis,Quantity_NOC_RED); - opt.worldAxis->SetDatumPartColor(Prs3d_DP_YAxis,Quantity_NOC_GREEN); - opt.worldAxis->SetDatumPartColor(Prs3d_DP_ZAxis,Quantity_NOC_BLUE); - opt.context->Display(opt.worldAxis, 0, 0, false); - HILOG_INFO(NATIVE_TAG,"InitWorldAxis Done"); - return true; - } - return false; -} -void ChangeWorldAxis() { - -} -} \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/Axis/WorldAxis.h b/entry/src/main/cpp/NativeEGLOCCT/Axis/WorldAxis.h deleted file mode 100644 index 089a3fe9..00000000 --- a/entry/src/main/cpp/NativeEGLOCCT/Axis/WorldAxis.h +++ /dev/null @@ -1,15 +0,0 @@ -// -// Created on 2026/3/6. -// -// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, -// please include "napi/native_api.h". - -#ifndef OPENCAX_WORLDAXIS_H -#define OPENCAX_WORLDAXIS_H -#include "../RenderStruct.h" -#include -namespace NativeOpenCAX { - bool InitWorldAxis(RenderOption& opt); - void ChangeWorldAxis(); -} -#endif //OPENCAX_WORLDAXIS_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.cpp b/entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.cpp index 4954ccaf..19709369 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.cpp @@ -7,101 +7,68 @@ #include "Camera.h" #ifndef NATIVE_TAG -#define NATIVE_TAG "InitCamera" +#define NATIVE_TAG "CAMERA" #endif namespace NativeOpenCAX { -bool InitCamera(RenderOption &opt) { - if (opt.camera.IsNull()) { - // 设置相机参数 - opt.camera = opt.view->Camera(); - opt.camera->SetFOVy(45.0); // 使用正确的FOV设置API - opt.camera->SetZRange(1.0, 1000.0); +Camera::Camera() : camera(nullptr) {} +Camera::~Camera() {} +bool Camera::InitCamera(Handle(V3d_View)& view) { + try { + camera = new Graphic3d_Camera; + camera->SetFOVy(30.0); + camera->SetZRange(1.0, 1000.0); + view->SetCamera(camera); HILOG_INFO(NATIVE_TAG, "InitCamera Done"); return true; + } catch (std::exception &e) { + HILOG_INFO(NATIVE_TAG, "InitCamera Fail:%{public}d", e.what()); + return false; } - return false; +} +void Camera::SetRotation(float xAngle, float yAngle) { + gp_Pnt currentEye = camera->Eye(); + gp_Pnt currentCenter = camera->Center(); + gp_Dir currentUp = camera->Up(); + + // 计算当前的视线方向和距离 + gp_Vec viewDir = currentCenter.XYZ() - currentEye.XYZ(); + double distance = viewDir.Magnitude(); + gp_Pnt rotationCenter = currentCenter; // 旋转中心设为当前目标点 + + // 创建旋转增量 + gp_Quaternion rotX, rotY; + // 从 gp_Ax1 中提取方向向量 (gp_Dir -> gp_Vec) + gp_Vec xRotationAxis = camera->Direction().XYZ().Crossed(currentUp.XYZ()); // 叉积得到X旋转轴 + if (xRotationAxis.Magnitude() > gp::Resolution()) { // 防止零向量导致的无效四元数 + rotX.SetVectorAndAngle(xRotationAxis, xAngle * M_PI / 180.0); + } else { + rotX.SetIdent(); // 如果叉积为零,则无旋转 + } + // 从 gp_Ax1 中提取方向向量 (gp_Dir -> gp_Vec) + gp_Vec yRotationAxis = currentUp.XYZ(); // Y旋转轴就是当前的Up方向 + if (yRotationAxis.Magnitude() > gp::Resolution()) { + rotY.SetVectorAndAngle(yRotationAxis, yAngle * M_PI / 180.0); + } else { + rotY.SetIdent(); // 如果Up向量无效,则无旋转 + } + // 组合旋转 + gp_Quaternion totalRotation = rotY * rotX; + + // 应用旋转到眼睛位置 + gp_Vec newViewDir = totalRotation * viewDir.Normalized(); + gp_Pnt newEye = rotationCenter.XYZ() - newViewDir.XYZ() * distance; + + // 计算新的 Up 方向 + gp_Dir newUp = totalRotation * currentUp; + + // 设置新相机参数 + camera->SetEye(newEye); + camera->SetCenter(rotationCenter); + camera->SetUp(newUp); + HILOG_ERROR(NATIVE_TAG,"Rotation"); } -// 主视图 (Front View) -void FrontView(RenderOption &opt) { - opt.view->SetProj(V3d_XposYposZneg); // 先设置坐标系,Y向上是常用选择 - opt.view->SetAt(0, 0, 0); // 设置目标点为中心 - opt.view->SetEye(0, 0, 1); - opt.view->FitAll(); - opt.view->Redraw(); -} -// 俯视图 (Top View) -void TopView(RenderOption &opt) { - opt.view->SetProj(V3d_XposYnegZpos); - opt.view->SetAt(0, 0, 0); - opt.view->SetEye(0, -1, 0); - opt.view->FitAll(); - opt.view->Redraw(); -} - -// 左视图 (Left View) -// 观察方向为 -X, Z轴向上 -void LeftSideView(RenderOption &opt) { - opt.view->SetProj(V3d_XnegYnegZpos); - opt.view->SetAt(0, 0, 0); - opt.view->SetEye(1, 0, 0); // 从 X 轴正方向向左看 - opt.view->FitAll(); - opt.view->Redraw(); -} - -// 右视图 (Right View) -// 观察方向为 +X, Z轴向上 -void RightSideView(RenderOption &opt) { - opt.view->SetProj(V3d_XposYnegZpos); - opt.view->SetAt(0, 0, 0); - opt.view->SetEye(-1, 0, 0); // 从 X 轴负方向向右看 - opt.view->FitAll(); - opt.view->Redraw(); -} - -// 仰视图 (Bottom View) -// 观察方向为 +Y, Z轴向上 -void BottomView(RenderOption &opt) { - opt.view->SetProj(V3d_XposYposZpos); - opt.view->SetAt(0, 0, 0); - opt.view->SetEye(0, 1, 0); - opt.view->FitAll(); - opt.view->Redraw(); -} - -// 后视图 (Back View) -// 观察方向为 +Z, Y轴向上 -void RearView(RenderOption &opt) { - opt.view->SetProj(V3d_XnegYposZpos); - opt.view->SetAt(0, 0, 0); - opt.view->SetEye(0, 0, -1); // 从 Z 轴负方向向前看 - opt.view->FitAll(); - opt.view->Redraw(); -} - -// 正等轴测图 (Isometric View) -void ISOView(RenderOption &opt) { - opt.view->SetProj(V3d_XposYposZpos); // 先重置一个标准方向作为参考 - opt.view->SetAt(0, 0, 0); // 观察目标点 - // 经典的等轴测视角,从 (1, 1, 1) 方向看过去 - double dist = 1000.0; // 距离,影响缩放 - opt.view->SetEye(dist, dist, dist); - // 为了美观,通常还需要将视角调整为框满模型 - opt.view->FitAll(); - opt.view->Redraw(); -} - -// 正二等轴测图 (Diametric View) -void DIMView(RenderOption &opt) { - opt.view->SetAt(0, 0, 0); - double dist = 1000.0; - opt.view->SetEye(-dist, -dist, dist * 0.5); - opt.view->FitAll(); - opt.view->Redraw(); -} - -void ChangeCarmera() {} -} \ No newline at end of file +} // namespace NativeOpenCAX diff --git a/entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.h b/entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.h index 2b5281fa..a1298771 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.h +++ b/entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.h @@ -6,21 +6,22 @@ #ifndef OPENCAX_CAMERA_H #define OPENCAX_CAMERA_H - -#include "../RenderStruct.h" - +#include "NativeEGLOCCT/common.h" +#include +#include +#include namespace NativeOpenCAX { -bool InitCamera(RenderOption &opt); -void ChangeCamera(); -void FrontView(RenderOption &opt); -void TopView(RenderOption &opt); -void LeftSideView(RenderOption &opt); -void RightSideView(RenderOption &opt); -void BottomView(RenderOption &opt); -void RearView(RenderOption &opt); -void ISOView(RenderOption &opt); -void DIMView(RenderOption &opt); +class Camera{ +public: + Camera(); + ~Camera(); + bool InitCamera(Handle(V3d_View)& view); + void SetRotation(float xAngle, float yAngle); +public: + Handle(Graphic3d_Camera) camera; +}; + } // namespace NativeOpenCAX #endif // OPENCAX_CAMERA_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/Context/Context.cpp b/entry/src/main/cpp/NativeEGLOCCT/Context/Context.cpp index bb8f950c..00eb45b9 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Context/Context.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/Context/Context.cpp @@ -7,21 +7,23 @@ #include "Context.h" #ifndef NATIVE_TAG -#define NATIVE_TAG "InitCtx" +#define NATIVE_TAG "CONTEXT" #endif namespace NativeOpenCAX { -bool InitCtx(RenderOption& opt) { - if (opt.context.IsNull()) { - opt.context = new AIS_InteractiveContext(opt.viewer); - opt.context->SetDisplayMode(AIS_Shaded, Standard_False); // 默认使用着色模式 - HILOG_INFO(NATIVE_TAG,"InitCtx Done"); +Context::Context() : context(nullptr) {} +Context::~Context() {} +bool Context::InitContext(Handle(V3d_Viewer)& viewer) { + try { + context = new AIS_InteractiveContext(viewer); + context->SetDisplayMode(AIS_Shaded, Standard_False); // 默认使用着色模式 + HILOG_INFO(NATIVE_TAG, "InitCtx Done"); return true; + } catch (std::exception &e) { + HILOG_INFO(NATIVE_TAG, "InitCtx Fail:%{public}d", e.what()); + return false; } - return false; -} -void ChangeCtx(){ - } + } \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/Context/Context.h b/entry/src/main/cpp/NativeEGLOCCT/Context/Context.h index 7a3a4eab..efc53270 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Context/Context.h +++ b/entry/src/main/cpp/NativeEGLOCCT/Context/Context.h @@ -7,12 +7,20 @@ #ifndef OPENCAX_CONTEXT_H #define OPENCAX_CONTEXT_H -#include "../RenderStruct.h" +#include "NativeEGLOCCT/common.h" +#include +#include namespace NativeOpenCAX{ -bool InitCtx(RenderOption& opt); -void ChangeCtx(); +class Context{ +public: + Context(); + ~Context(); + bool InitContext(Handle(V3d_Viewer)& viewer); +public: + Handle(AIS_InteractiveContext) context; +}; } #endif //OPENCAX_CONTEXT_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/NativeManager.cpp b/entry/src/main/cpp/NativeEGLOCCT/NativeManager.cpp index 47c87f7c..2f00e44c 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/NativeManager.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/NativeManager.cpp @@ -162,15 +162,21 @@ void NativeManager::OnSurfaceDestroyed(OH_NativeXComponent *component, void *win } } } +uint64_t width,height; void NativeManager::OnSurfaceChanged(OH_NativeXComponent *component, void *window) { OH_NativeXComponent_GetXComponentSize(component, window, &width_, &height_); int64_t id = 0; { + if(width==width_ && height==height_){ + return; + } std::lock_guard lock(mapMutex); if (renderThreadMap.find(id) != renderThreadMap.end()) { HILOG_ERROR(NATIVE_TAG,"uint32_t Size:%{public}dX%{public}d",width_,height_); renderThreadMap[id]->resizeWindow(width_, height_); + width=width_; + height=height_; } } } diff --git a/entry/src/main/cpp/NativeEGLOCCT/NativeRender.cpp b/entry/src/main/cpp/NativeEGLOCCT/NativeRender.cpp index 227a6ab4..7bbb7ae5 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/NativeRender.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/NativeRender.cpp @@ -1,4 +1,5 @@ #include "NativeRender.h" +#include "STEPControl_Reader.hxx" #ifndef NATIVE_TAG #define NATIVE_TAG "NativeRender" @@ -7,49 +8,67 @@ static std::mutex renderMutex; namespace NativeOpenCAX { -NativeRender::NativeRender() +NativeRender::NativeRender(int w, int h): + width(0), + height(0), + mAxis(new Axis), + nAxis(new Axis), + cr(new Camera), + ctx(new Context), + ogd(new OpenGlGraphicDriver), + ts(new TextStyle), + vw(new View), + vr(new Viewer), + win(new Window) { - + width=w; + height=h; } NativeRender::~NativeRender() { shapes_.clear(); } -bool NativeRender::init(int width, int height,EGLCore* eglCore) { - rendOption.eglCore=eglCore; - rendOption.width=width; - rendOption.height=height; - if(!InitGraphicDriver(rendOption)){ - HILOG_ERROR(NATIVE_TAG,"InitGraphicDriver Fail!"); +bool NativeRender::init(EGLCore& _eglCore) { + eglCore=_eglCore; + if(!ogd->InitOpenGlGraphicDriver(eglCore)){ + HILOG_ERROR(NATIVE_TAG,"Init GraphicDriver Fail!"); return false; } - if(!InitTextSyle(rendOption)){ - HILOG_ERROR(NATIVE_TAG,"InitTextSyle Fail!"); + if(!ts->InitTextStyle()){ + HILOG_ERROR(NATIVE_TAG,"Init TextSyle Fail!"); return false; } - if(!InitViewer(rendOption)){ - HILOG_ERROR(NATIVE_TAG,"InitViewer Fail!"); + if(!vr->InitViewer(ogd->graphicDriver)){ + HILOG_ERROR(NATIVE_TAG,"Init Viewer Fail!"); return false; } - if(!InitCtx(rendOption)){ - HILOG_ERROR(NATIVE_TAG,"InitCtx Fail!"); + if(!ctx->InitContext(vr->viewer)){ + HILOG_ERROR(NATIVE_TAG,"Init Ctx Fail!"); return false; } - if(!InitWorldAxis(rendOption)){ - HILOG_ERROR(NATIVE_TAG,"InitWorldAxis Fail!"); + if(!mAxis->InitAxis(ctx->context, AXIS_TYPE::WORLD_AXIS)){ + HILOG_ERROR(NATIVE_TAG,"Init WORLD_AXIS Fail!"); return false; } - if(!InitLocalAxis(rendOption)){ - HILOG_ERROR(NATIVE_TAG,"InitLocalAxis Fail!"); + if(!nAxis->InitAxis(ctx->context, AXIS_TYPE::LOCAL_AXIS)){ + HILOG_ERROR(NATIVE_TAG,"Init LOCAL_AXIS Fail!"); return false; } - if(!InitView(rendOption)){ - HILOG_ERROR(NATIVE_TAG,"InitView Fail!"); + if(!win->InitWindow(width,height)){ + HILOG_ERROR(NATIVE_TAG,"Init Window Fail!"); return false; } - if(!InitCamera(rendOption)){ - HILOG_ERROR(NATIVE_TAG,"InitCamera Fail!"); + if(!vw->InitView(vr->viewer)){ + HILOG_ERROR(NATIVE_TAG,"Init View Fail!"); + return false; + }else{ + vw->SetViewOption(); + vw->SetText(ts->text); + vw->SetWin(win->window); + } + if(!cr->InitCamera(vw->view)){ + HILOG_ERROR(NATIVE_TAG,"Init Camera Fail!"); return false; } return true; @@ -58,7 +77,7 @@ bool NativeRender::init(int width, int height,EGLCore* eglCore) { bool NativeRender::loadModel(const std::string& filePath) { // 清除现有模型 for (auto& shape : shapes_) { - rendOption.context->Remove(shape, Standard_False); + ctx->context->Remove(shape, Standard_False); } shapes_.clear(); @@ -97,7 +116,13 @@ bool NativeRender::loadModel(const std::string& filePath) { // 设置材质 Handle(Prs3d_Drawer) drawer = aisShape->Attributes(); Handle(Prs3d_ShadingAspect) shadingAspect = new Prs3d_ShadingAspect(); - + aisShape->SetDisplayMode(1); + Handle(Prs3d_LineAspect) aLineAspect = new Prs3d_LineAspect( + Quantity_NOC_BLACK, // 颜色,例如黑色 + Aspect_TOL_SOLID, // 线型 + 2.0 // 线宽 + ); + // 随机颜色 int colorIndex = i % 7; Quantity_Color color; @@ -111,152 +136,59 @@ bool NativeRender::loadModel(const std::string& filePath) { case 6: color = Quantity_NOC_ORANGE; break; default: color = Quantity_NOC_WHITE; } - shadingAspect->SetColor(color); shadingAspect->SetMaterial(Graphic3d_NOM_PLASTIC); + drawer->SetFaceBoundaryDraw(Standard_True); + drawer->SetWireAspect(aLineAspect); drawer->SetShadingAspect(shadingAspect); - rendOption.context->Display(aisShape, Standard_True); + ctx->context->Display(aisShape, Standard_True); shapes_.push_back(aisShape); } } - // 调整相机到合适位置 - rendOption.view->FitAll(0.5, Standard_True); - rendOption.view->ZFitAll(); + vw->view->FitAll(0.5, Standard_True); + vw->view->ZFitAll(); + vw->ResetView(); OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "LoadModel","Successfully loaded STEP file with %{public}d shapes",numShapes); return true; } //setTranslation -void NativeRender::setTranslation(float x, float y) { - axis.translationX = x; - axis.translationY = y; +void NativeRender::setTranslation(float tx, float ty) { + nAxis->SetTranslationX(tx); + nAxis->SetTranslationY(ty); } void NativeRender::render() { - if (rendOption.view.IsNull()) { + if (vw->view.IsNull()) { OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Render","View Is Null"); return; } - // 执行渲染 - rendOption.view->Redraw(); + vw->MustBeResized(); + vw->Redraw(); } -void NativeRender::resize(int width, int height) { - HILOG_ERROR(NATIVE_TAG,"Resize:(%{public}d,%{public}d)",width,height); - rendOption.width = width; - rendOption.height = height; - if (!rendOption.view.IsNull()) { - rendOption.window->SetSize(rendOption.width, rendOption.height); - rendOption.window->DoResize(); - rendOption.view->MustBeResized(); - rendOption.view->Redraw(); - Standard_Integer theWidth; - Standard_Integer theHeight; - rendOption.window->Size(theWidth,theHeight); - HILOG_ERROR(NATIVE_TAG,"Resize:(%{public}d,%{public}d)",theWidth,theHeight); - } +void NativeRender::resize(int w, int h) { + HILOG_ERROR(NATIVE_TAG,"InPut Size:%{public}d,%{public}d",w,h); + win->Resize(w,h); } void NativeRender::setRotation(float xAngle, float yAngle) { - //axis.rotationX = xAngle; - //axis.rotationY = yAngle; - if (rendOption.view.IsNull()) { - OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "addRotationDelta", "View Is Null"); - return; - } - - //Handle(Graphic3d_Camera) camera = rendOption.view->Camera(); - - // --- 方案一:直接对相机进行增量旋转 --- - // 这种方式模拟了“轨道”行为,绕着相机看向的目标点旋转。 - // 获取当前相机状态 - gp_Pnt currentEye = rendOption.camera->Eye(); - gp_Pnt currentCenter = rendOption.camera->Center(); - gp_Dir currentUp = rendOption.camera->Up(); - - // 计算当前的视线方向和距离 - gp_Vec viewDir = currentCenter.XYZ() - currentEye.XYZ(); - double distance = viewDir.Magnitude(); - gp_Pnt rotationCenter = currentCenter; // 旋转中心设为当前目标点 - - // 创建旋转增量 - gp_Quaternion rotX, rotY; - // 从 gp_Ax1 中提取方向向量 (gp_Dir -> gp_Vec) - gp_Vec xRotationAxis = rendOption.camera->Direction().XYZ().Crossed(currentUp.XYZ()); // 叉积得到X旋转轴 - if (xRotationAxis.Magnitude() > gp::Resolution()) { // 防止零向量导致的无效四元数 - rotX.SetVectorAndAngle(xRotationAxis, xAngle * M_PI / 180.0); - } else { - rotX.SetIdent(); // 如果叉积为零,则无旋转 - } - // 从 gp_Ax1 中提取方向向量 (gp_Dir -> gp_Vec) - gp_Vec yRotationAxis = currentUp.XYZ(); // Y旋转轴就是当前的Up方向 - if (yRotationAxis.Magnitude() > gp::Resolution()) { - rotY.SetVectorAndAngle(yRotationAxis, yAngle * M_PI / 180.0); - } else { - rotY.SetIdent(); // 如果Up向量无效,则无旋转 - } - // 组合旋转 - gp_Quaternion totalRotation = rotY * rotX; - - // 应用旋转到眼睛位置 - gp_Vec newViewDir = totalRotation * viewDir.Normalized(); - gp_Pnt newEye = rotationCenter.XYZ() - newViewDir.XYZ() * distance; - - // 计算新的 Up 方向 - gp_Dir newUp = totalRotation * currentUp; - - // 设置新相机参数 - rendOption.camera->SetEye(newEye); - rendOption.camera->SetCenter(rotationCenter); - rendOption.camera->SetUp(newUp); - HILOG_ERROR(NATIVE_TAG,"Rotation"); - //rendOption.view->Redraw(); + cr->SetRotation(xAngle, yAngle); } void NativeRender::setZoomLevel(float zoom) { - axis.zoomLevel = std::max(0.1f, std::min(zoom, 5.0f)); // 限制缩放范围 + nAxis->SetZoomLevel(std::max(0.1f, std::min(zoom, 5.0f))); // 限制缩放范围 +} +void NativeRender::setClearColor(float r, float g, float b, float a){ + vw->SetClearColor( r, g, b, a); } - void NativeRender::resetView() { - axis.rotationX = 0.0f; - axis.rotationY = 0.0f; - axis.zoomLevel = 1.0f; - - if (!rendOption.view.IsNull()) { - rendOption.view->SetProj(V3d_XposYnegZpos); - rendOption.view->FitAll(0.05, Standard_False); - } + vw->ResetView(); +} +void NativeRender::SwitchView(std::string view){ + vw->SwitchView(view); } -void NativeRender::setClearColor(float r, float g, float b, float a) { - rendOption.clearColor = Quantity_Color(r, g, b, Quantity_TOC_RGB); - if (!rendOption.view.IsNull()) { - rendOption.view->SetBackgroundColor(rendOption.clearColor); - } -} -void NativeRender::SetFrontView(){ - FrontView(rendOption); -} -void NativeRender::SetTopView(){ - TopView(rendOption); -} -void NativeRender::SetLeftSideView(){ - LeftSideView(rendOption); -} -void NativeRender::SetRightSideView(){ - RightSideView(rendOption); -} -void NativeRender::SetBottomView(){ - BottomView(rendOption); -} -void NativeRender::SetRearView(){ - RearView(rendOption); -} -void NativeRender::SetISOView(){ - ISOView(rendOption); -} -void NativeRender::SetDIMView(){ - DIMView(rendOption); -} + } // namespace NativeRenderer \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/NativeRender.h b/entry/src/main/cpp/NativeEGLOCCT/NativeRender.h index 016e30c2..b3499594 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/NativeRender.h +++ b/entry/src/main/cpp/NativeEGLOCCT/NativeRender.h @@ -4,28 +4,33 @@ #include #include +#include "AIS_Shape.hxx" +#include "NativeEGLOCCT/Window/Window.h" #include "common.h" #include "EGLCore.h" #include -#include "Context/Context.h" +#include +#include +#include +#include +#include + +#include "Axis/Axis.h" #include "Camera/Camera.h" -#include "Axis/WorldAxis.h" -#include "Axis/LocalAxis.h" +#include "Context/Context.h" #include "OpenGLGraphicDriver/OpenGLGraphicDriver.h" #include "TextStyle/TextStyle.h" #include "View/View.h" #include "Viewer/Viewer.h" -#include -#include -#include +#include "Viewer/Viewer.h" namespace NativeOpenCAX { class NativeRender { public: - NativeRender(); + NativeRender(int width, int height); ~NativeRender(); - bool init(int width, int height,EGLCore* eglCore); + bool init(EGLCore& eglCore); bool loadModel(const std::string& filePath); void render(); void resize(int width, int height); @@ -36,6 +41,7 @@ public: void setTranslation(float x, float y); void setCameraRotationMode(bool state); //视图 + void SwitchView(std::string); void SetFrontView(); void SetTopView(); void SetLeftSideView(); @@ -45,8 +51,19 @@ public: void SetISOView(); void SetDIMView(); private: - RenderOption rendOption; - AxisOption axis; + int width; + int height; + EGLCore eglCore; + Axis* mAxis; + Axis* nAxis; + Camera* cr; + Context* ctx; + OpenGlGraphicDriver* ogd; + TextStyle* ts; + View* vw; + Viewer* vr; + Window* win; + std::vector shapes_; }; } // namespace NativeRender diff --git a/entry/src/main/cpp/NativeEGLOCCT/NativeRenderThread.cpp b/entry/src/main/cpp/NativeEGLOCCT/NativeRenderThread.cpp index 755b907e..848fea0c 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/NativeRenderThread.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/NativeRenderThread.cpp @@ -12,6 +12,7 @@ NativeRenderThread::NativeRenderThread() windowHeight_(720) { eglCore_ = new EGLCore(); + renderer_= new NativeRender(windowWidth_,windowHeight_); } NativeRenderThread::~NativeRenderThread() { @@ -56,7 +57,7 @@ void NativeRenderThread::renderLoop() { OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "EGLCoreInit","Failed to initialize EGL"); } // 初始化OCCT渲染器 - if (!renderer_.init(windowWidth_, windowHeight_,eglCore_)) { + if (!renderer_->init(*eglCore_)) { OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "NativeRenderInit","Failed to initialize OCCT renderer"); eglCore_->destroy(); } @@ -79,48 +80,27 @@ void NativeRenderThread::renderLoop() { if (hasCommand) { switch (command.type) { case CMD_LOAD_MODEL: - renderer_.loadModel(command.param1); + renderer_->loadModel(command.param1); break; case CMD_SET_ROTATION: - renderer_.setRotation(command.param2, command.param3); + renderer_->setRotation(command.param2, command.param3); break; case CMD_SET_TRANSLATION: - renderer_.setTranslation(command.param2, command.param3); + renderer_->setTranslation(command.param2, command.param3); break; case CMD_RESET_VIEW: - renderer_.resetView(); + renderer_->resetView(); break; case CMD_SET_CLEAR_COLOR: - renderer_.setClearColor(command.param2, command.param3, command.param4, command.param5); + renderer_->setClearColor(command.param2, command.param3, command.param4, command.param5); break; case CMD_RESIZE: windowWidth_ = static_cast(command.param2); windowHeight_ = static_cast(command.param3); - renderer_.resize(windowWidth_, windowHeight_); + renderer_->resize(windowWidth_, windowHeight_); break; - case CMD_VIEW_FRONT: - renderer_.SetFrontView(); - break; - case CMD_VIEW_TOP: - renderer_.SetFrontView(); - break; - case CMD_VIEW_LEFT_SIDE: - renderer_.SetFrontView(); - break; - case CMD_VIEW_RIGHT_SIDE: - renderer_.SetFrontView(); - break; - case CMD_VIEW_BOTTOM: - renderer_.SetFrontView(); - break; - case CMD_VIEW_REAR: - renderer_.SetFrontView(); - break; - case CMD_VIEW_ISO: - renderer_.SetFrontView(); - break; - case CMD_VIEW_DIM: - renderer_.SetFrontView(); + case CMD_SWITCH_VIEW: + renderer_->SwitchView(command.param1); break; case CMD_EXIT: isRunning_ = false; @@ -132,7 +112,7 @@ void NativeRenderThread::renderLoop() { } // 渲染 eglCore_->makeCurrent(); - renderer_.render(); + renderer_->render(); eglCore_->swapBuffers(); // 调用渲染完成回调 Callback callback; @@ -146,7 +126,7 @@ void NativeRenderThread::renderLoop() { } // 控制帧率 - usleep(8333); // ~60 FPS + usleep(16667); // ~60 FPS } } @@ -183,32 +163,9 @@ void NativeRenderThread::resetView() { } void NativeRenderThread::swicthView(std::string strView) { std::lock_guard lock(commandMutex_); - CommandType cmdType; - if(strView=="CMD_VIEW_FRONT"){ - cmdType=CMD_VIEW_FRONT; - } - if(strView=="CMD_VIEW_TOP"){ - cmdType=CMD_VIEW_TOP; - } - if(strView=="CMD_VIEW_LEFT_SIDE"){ - cmdType=CMD_VIEW_LEFT_SIDE; - } - if(strView=="CMD_VIEW_RIGHT_SIDE"){ - cmdType=CMD_VIEW_RIGHT_SIDE; - } - if(strView=="CMD_VIEW_BOTTOM"){ - cmdType=CMD_VIEW_BOTTOM; - } - if(strView=="CMD_VIEW_REAR"){ - cmdType=CMD_VIEW_REAR; - } - if(strView=="CMD_VIEW_ISO"){ - cmdType=CMD_VIEW_ISO; - } - if(strView=="CMD_VIEW_DIM"){ - cmdType=CMD_VIEW_DIM; - } - commandQueue_.push(RenderCommand(cmdType)); + RenderCommand cmd(CMD_SWITCH_VIEW); + cmd.param1 = strView; + commandQueue_.push(RenderCommand(cmd)); commandCondition_.notify_one(); } void NativeRenderThread::setClearColor(float r, float g, float b, float a) { diff --git a/entry/src/main/cpp/NativeEGLOCCT/NativeRenderThread.h b/entry/src/main/cpp/NativeEGLOCCT/NativeRenderThread.h index 9fc60c04..c49879be 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/NativeRenderThread.h +++ b/entry/src/main/cpp/NativeEGLOCCT/NativeRenderThread.h @@ -39,7 +39,7 @@ private: OHNativeWindow* nativeWindow_; EGLCore* eglCore_; - NativeRender renderer_; + NativeRender* renderer_; std::mutex commandMutex_; std::condition_variable commandCondition_; @@ -51,15 +51,7 @@ private: CMD_RESET_VIEW, CMD_SET_CLEAR_COLOR, CMD_RESIZE, - //视图枚举 - CMD_VIEW_FRONT, - CMD_VIEW_TOP, - CMD_VIEW_LEFT_SIDE, - CMD_VIEW_RIGHT_SIDE, - CMD_VIEW_BOTTOM, - CMD_VIEW_REAR, - CMD_VIEW_ISO, - CMD_VIEW_DIM, + CMD_SWITCH_VIEW, CMD_EXIT }; diff --git a/entry/src/main/cpp/NativeEGLOCCT/OpenGLGraphicDriver/OpenGLGraphicDriver.cpp b/entry/src/main/cpp/NativeEGLOCCT/OpenGLGraphicDriver/OpenGLGraphicDriver.cpp index 8b1e9e9f..cae866c4 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/OpenGLGraphicDriver/OpenGLGraphicDriver.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/OpenGLGraphicDriver/OpenGLGraphicDriver.cpp @@ -7,24 +7,29 @@ #include "OpenGLGraphicDriver.h" #ifndef NATIVE_TAG -#define NATIVE_TAG "InitGraphicDriver" +#define NATIVE_TAG "GRAPHIC_DRIVER" #endif -namespace NativeOpenCAX{ +namespace NativeOpenCAX { -bool InitGraphicDriver(RenderOption &opt){ - if (opt.graphicDriver.IsNull()) { - opt.displayConnection=new Aspect_DisplayConnection(); - opt.graphicDriver = new OpenGl_GraphicDriver(opt.displayConnection,Standard_False); - opt.graphicDriver->ChangeOptions().buffersNoSwap = Standard_True; - opt.graphicDriver->InitEglContext(eglGetCurrentDisplay(), eglGetCurrentContext(), opt.eglCore->getConfig()); - HILOG_INFO(NATIVE_TAG,"InitGraphicDriver Done"); +OpenGlGraphicDriver::OpenGlGraphicDriver() : graphicDriver(nullptr), displayConnection(nullptr) {} +OpenGlGraphicDriver::~OpenGlGraphicDriver() {} +bool OpenGlGraphicDriver::InitOpenGlGraphicDriver(EGLCore& eglCore) { + + try { + displayConnection = new Aspect_DisplayConnection(); + graphicDriver = new OpenGl_GraphicDriver(displayConnection, Standard_False); + graphicDriver->ChangeOptions().buffersNoSwap = Standard_True; + graphicDriver->InitEglContext(eglGetCurrentDisplay(), eglGetCurrentContext(), eglCore.getConfig()); + HILOG_INFO(NATIVE_TAG, "InitGraphicDriver Done"); return true; + } catch (std::exception &e) { + HILOG_INFO(NATIVE_TAG, "InitGraphicDriver Fail:%{public}d", e.what()); + return false; + }catch (...) { + HILOG_ERROR(NATIVE_TAG, "InitGraphicDriver unknown exception occurred when creating Aspect_DisplayConnection."); + return false; } - return false; } -void ChangeGraphicDriver(){ - -} -} - \ No newline at end of file + +} // namespace NativeOpenCAX diff --git a/entry/src/main/cpp/NativeEGLOCCT/OpenGLGraphicDriver/OpenGLGraphicDriver.h b/entry/src/main/cpp/NativeEGLOCCT/OpenGLGraphicDriver/OpenGLGraphicDriver.h index a91c5911..72bdf599 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/OpenGLGraphicDriver/OpenGLGraphicDriver.h +++ b/entry/src/main/cpp/NativeEGLOCCT/OpenGLGraphicDriver/OpenGLGraphicDriver.h @@ -7,12 +7,23 @@ #ifndef OPENCAX_OPENGLGRAPHICDRIVER_H #define OPENCAX_OPENGLGRAPHICDRIVER_H -#include "../RenderStruct.h" +#include +#include "NativeEGLOCCT/EGLCore.h" +#include "NativeEGLOCCT/common.h" +#include +#include namespace NativeOpenCAX{ +class OpenGlGraphicDriver{ +public: + OpenGlGraphicDriver(); + ~OpenGlGraphicDriver(); + bool InitOpenGlGraphicDriver(EGLCore& eglCore); +public: + Handle(OpenGl_GraphicDriver) graphicDriver; + Handle(Aspect_DisplayConnection) displayConnection; +}; -bool InitGraphicDriver(RenderOption &opt); -void ChangeGraphicDriver(); } #endif //OPENCAX_OPENGLGRAPHICDRIVER_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/RenderStruct.h b/entry/src/main/cpp/NativeEGLOCCT/RenderStruct.h deleted file mode 100644 index b5a2066d..00000000 --- a/entry/src/main/cpp/NativeEGLOCCT/RenderStruct.h +++ /dev/null @@ -1,83 +0,0 @@ -// -// Created on 2026/3/6. -// -// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, -// please include "napi/native_api.h". - -#ifndef OPENCAX_REDCOMMON_H -#define OPENCAX_REDCOMMON_H - -#include "common.h" -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "EGLCore.h" - -#include - -namespace NativeOpenCAX { - -struct RenderOption{ - int width; - int height; - Quantity_Color clearColor; - EGLCore* eglCore; - Handle(OpenGl_GraphicDriver) graphicDriver; - Handle(Aspect_DisplayConnection) displayConnection; - Handle(Aspect_NeutralWindow) window; - Handle(V3d_Viewer) viewer; - Handle(V3d_View) view; - Handle(Graphic3d_Camera) camera; - Handle(AIS_InteractiveContext) context; - Handle(Prs3d_TextAspect) text; - Handle(Geom_Axis2Placement) worldAxisPlacement; - Handle(Geom_Axis2Placement) localAxisPlacement; - Handle(AIS_Trihedron) worldAxis; - Handle(AIS_Trihedron) localAxis; -}; -struct AxisOption{ - //旋转X轴 - float rotationX=0.0f; - //旋转Y轴 - float rotationY=0.0f; - //旋转Z轴 - float rotationZ=0.0f; - //缩放等级 - float zoomLevel=1.0f; - //翻转X轴 - float translationX=0.0f; - //翻转Y轴 - float translationY=0.0f; - //翻转Z轴 - float translationZ=0.0f; -}; -} -#endif //OPENCAX_REDCOMMON_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.cpp b/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.cpp index a8b94ad7..fe3b194a 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.cpp @@ -7,30 +7,32 @@ #include "TextStyle.h" #ifndef NATIVE_TAG -#define NATIVE_TAG "InitTextSyle" +#define NATIVE_TAG "TEXTSTYLE" #endif namespace NativeOpenCAX { -bool InitTextSyle(RenderOption& opt) { - if (opt.text.IsNull()) { - opt.text = new Prs3d_TextAspect(); - opt.text->SetFont(Font_NOF_ASCII_MONO); - opt.text->SetHeight(12); - opt.text->Aspect()->SetColor(Quantity_NOC_GRAY95); - opt.text->Aspect()->SetColorSubTitle(Quantity_NOC_BLACK); - opt.text->Aspect()->SetDisplayType(Aspect_TODT_SHADOW); - opt.text->Aspect()->SetTextFontAspect(Font_FA_Bold); - opt.text->Aspect()->SetTextZoomable(false); - opt.text->SetHorizontalJustification(Graphic3d_HTA_LEFT); - opt.text->SetVerticalJustification(Graphic3d_VTA_BOTTOM); - HILOG_INFO(NATIVE_TAG,"InitTextSyle Done"); +TextStyle::TextStyle() : text(nullptr) {} +TextStyle::~TextStyle() {} + +bool TextStyle::InitTextStyle() { + try { + text = new Prs3d_TextAspect(); + text->SetFont(Font_NOF_ASCII_MONO); + text->SetHeight(12); + text->Aspect()->SetColor(Quantity_NOC_GRAY95); + text->Aspect()->SetColorSubTitle(Quantity_NOC_BLACK); + text->Aspect()->SetDisplayType(Aspect_TODT_SHADOW); + text->Aspect()->SetTextFontAspect(Font_FA_Bold); + text->Aspect()->SetTextZoomable(false); + text->SetHorizontalJustification(Graphic3d_HTA_LEFT); + text->SetVerticalJustification(Graphic3d_VTA_BOTTOM); + HILOG_INFO(NATIVE_TAG, "InitTextSyle Done"); return true; + } catch (std::exception &e) { + HILOG_INFO(NATIVE_TAG, "InitTextSyle Fail:%{public}d", e.what()); + return false; } - return false; -} -void ChangeTextSyle(){ - } } \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.h b/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.h index 472daf65..9b7dae2f 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.h +++ b/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.h @@ -7,12 +7,19 @@ #ifndef OPENCAX_TEXTSTYLE_H #define OPENCAX_TEXTSTYLE_H -#include "../RenderStruct.h" +#include "NativeEGLOCCT/common.h" +#include "Font_NameOfFont.hxx" +#include namespace NativeOpenCAX{ - -bool InitTextSyle(RenderOption& opt); -void ChangeTextSyle(); +class TextStyle{ +public: + TextStyle(); + ~TextStyle(); + bool InitTextStyle(); +public: + Handle(Prs3d_TextAspect) text; +}; } #endif //OPENCAX_TEXTSTYLE_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/View/View.cpp b/entry/src/main/cpp/NativeEGLOCCT/View/View.cpp index 859dbf73..faedd4d0 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/View/View.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/View/View.cpp @@ -7,47 +7,87 @@ #include "View.h" #ifndef NATIVE_TAG -#define NATIVE_TAG "InitView" +#define NATIVE_TAG "VIEW" #endif namespace NativeOpenCAX { -bool InitView(RenderOption& opt) { +View::View() : view(nullptr) {} +View::~View() {} - if (opt.window.IsNull()) { - opt.window = new Aspect_NeutralWindow(); - opt.window->SetSize(opt.width, opt.height); - opt.view = opt.viewer->CreateView(); - // 设置渲染参数 - opt.view->SetImmediateUpdate(false); - // view_->ChangeRenderingParams().ToShowStats = true; - // view_->ChangeRenderingParams().Resolution = (unsigned int )(96.0 * displayPixelRatio() + 0.5); - opt.view->ChangeRenderingParams().Method = Graphic3d_RM_RASTERIZATION; - opt.view->ChangeRenderingParams().IsShadowEnabled = Standard_False; - opt.view->ChangeRenderingParams().IsReflectionEnabled = Standard_False; - opt.view->ChangeRenderingParams().IsAntialiasingEnabled = Standard_True; - opt.view->ChangeRenderingParams().Resolution = 2; - opt.view->ChangeRenderingParams().StatsTextAspect = opt.text->Aspect(); - opt.view->ChangeRenderingParams().StatsTextHeight = opt.text->Height(); - // 设置背景渐变 - opt.view->SetBgGradientColors(Quantity_Color(Quantity_NOC_GRAY), Quantity_Color(Quantity_NOC_BLACK), - Aspect_GFM_VER, // 垂直渐变 - Standard_False); - // 设置默认相机位置 - opt.view->SetProj(V3d_XposYnegZpos); - // 可选:显示坐标轴 - opt.view->ZBufferTriedronSetup(); - // 调整相机视角 - opt.view->Camera()->SetProjectionType(Graphic3d_Camera::Projection_Perspective); - opt.view->SetBackgroundColor(Quantity_NOC_GRAY90); - opt.view->MustBeResized(); - opt.view->SetWindow(opt.window,(Aspect_RenderingContext )eglGetCurrentContext()); - opt.view->RedrawImmediate(); - HILOG_INFO(NATIVE_TAG,"InitView Done"); +bool View::InitView(Handle(V3d_Viewer) & viewer) { + try { + view = viewer->CreateView(); + HILOG_INFO(NATIVE_TAG, "InitView Done"); return true; + } catch (std::exception &e) { + HILOG_INFO(NATIVE_TAG, "InitView Fail:%{public}d", e.what()); + return false; } - return false; +} +void View::SetViewOption() { + // 设置渲染参数 + view->SetImmediateUpdate(false); + view->ChangeRenderingParams().Method = Graphic3d_RM_RASTERIZATION; + view->ChangeRenderingParams().IsShadowEnabled = Standard_False; + view->ChangeRenderingParams().IsReflectionEnabled = Standard_False; + view->ChangeRenderingParams().IsAntialiasingEnabled = Standard_True; + view->ChangeRenderingParams().Resolution = 2; + + // 设置背景渐变 + view->SetBgGradientColors(Quantity_Color(Quantity_NOC_GRAY), Quantity_Color(Quantity_NOC_BLACK), + Aspect_GFM_VER, // 垂直渐变 + Standard_False); + // 设置默认相机位置 + view->SetProj(V3d_XposYnegZpos); + // 可选:显示坐标轴 + view->ZBufferTriedronSetup(); + // 调整相机视角 + view->Camera()->SetProjectionType(Graphic3d_Camera::Projection_Perspective); + view->SetBackgroundColor(Quantity_NOC_GRAY90); } -void ChangeView() {} +void View::SetText(Handle(Prs3d_TextAspect) & text) { + view->ChangeRenderingParams().StatsTextAspect = text->Aspect(); + view->ChangeRenderingParams().StatsTextHeight = text->Height(); +} +void View::SetWin(Handle(Aspect_NeutralWindow) & win) { + view->SetWindow(win, (Aspect_RenderingContext)eglGetCurrentContext()); +} +void View::SetClearColor(float r, float g, float b, float a) { + clearColor = Quantity_Color(r, g, b, Quantity_TOC_RGB); + if (!view.IsNull()) { + view->SetBackgroundColor(clearColor); + } +} +void View::MustBeResized() { view->MustBeResized(); } +void View::Redraw() { view->Redraw(); } +void View::ResetView() { + if (!view.IsNull()) { + view->SetProj(V3d_XposYnegZpos); + view->FitAll(0.05, Standard_False); + } +} + +void View::SwitchView(std::string nView) { + V3d_TypeOfOrientation tV3d; + if (nView == "CMD_VIEW_FRONT") { + tV3d = V3d_Yneg; + } else if (nView == "CMD_VIEW_TOP") { + tV3d = V3d_Zpos; + } else if (nView == "CMD_VIEW_LEFT_SIDE") { + tV3d = V3d_Xneg; + } else if (nView == "CMD_VIEW_RIGHT_SIDE") { + tV3d = V3d_Xpos; + } else if (nView == "CMD_VIEW_BOTTOM") { + tV3d = V3d_Zneg; + } else if (nView == "CMD_VIEW_REAR") { + tV3d = V3d_Ypos; + } else if (nView == "CMD_VIEW_ISO") { + tV3d = V3d_XposYnegZpos; + } else if (nView == "CMD_VIEW_DIM") { + tV3d = V3d_XposYposZpos; + } + view->SetProj(tV3d); +} } \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/View/View.h b/entry/src/main/cpp/NativeEGLOCCT/View/View.h index eb8d3514..7f99f17a 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/View/View.h +++ b/entry/src/main/cpp/NativeEGLOCCT/View/View.h @@ -7,12 +7,37 @@ #ifndef OPENCAX_VIEW_H #define OPENCAX_VIEW_H -#include "../RenderStruct.h" - +#include "NativeEGLOCCT/common.h" +#include +#include namespace NativeOpenCAX{ -bool InitView(RenderOption& opt); -void ChangeView(); +class View{ +public: + View(); + ~View(); + bool InitView(Handle(V3d_Viewer)& viewer); + void SetViewOption(); + void SetWin(Handle(Aspect_NeutralWindow)& win); + void SetText(Handle(Prs3d_TextAspect)& text); + void SetClearColor(float r, float g, float b, float a); + void MustBeResized(); + void Redraw(); + void ResetView(); + void SwitchView(std::string view); +// void FrontView(); +// void TopView(); +// void LeftSideView(); +// void RightSideView(); +// void BottomView(); +// void RearView(); +// void ISOView(); +// void DIMView(); +public: + Handle(V3d_View) view; + Quantity_Color clearColor; +}; + } #endif //OPENCAX_VIEW_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.cpp b/entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.cpp index 9d7da4dc..358d5d8b 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.cpp @@ -7,22 +7,25 @@ #include "Viewer.h" #ifndef NATIVE_TAG -#define NATIVE_TAG "InitViewer" +#define NATIVE_TAG "VIEWER" #endif namespace NativeOpenCAX { -bool InitViewer(RenderOption &opt) { - // 创建V3d_Viewer - if (opt.viewer.IsNull()) { - opt.viewer = new V3d_Viewer(opt.graphicDriver); - opt.viewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK); - opt.viewer->SetDefaultLights(); - opt.viewer->SetLightOn(); - HILOG_INFO(NATIVE_TAG,"InitViewer Done"); +Viewer::Viewer() : viewer(nullptr) {} +Viewer::~Viewer() {} +bool Viewer::InitViewer(Handle(OpenGl_GraphicDriver)& graphicDriver) { + try { + viewer = new V3d_Viewer(graphicDriver); + viewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK); + viewer->SetDefaultLights(); + viewer->SetLightOn(); + HILOG_INFO(NATIVE_TAG, "InitViewer Done"); return true; + } catch (std::exception &e) { + HILOG_INFO(NATIVE_TAG, "InitViewer Fail:%{public}d", e.what()); + return false; } - return false; } -void ChangeViewer() {} + } \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.h b/entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.h index 931623b2..1c06683b 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.h +++ b/entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.h @@ -7,12 +7,20 @@ #ifndef OPENCAX_VIEWER_H #define OPENCAX_VIEWER_H -#include "../RenderStruct.h" +#include "NativeEGLOCCT/common.h" +#include +#include namespace NativeOpenCAX{ -bool InitViewer(RenderOption& opt); -void ChangeViewer(); +class Viewer{ +public: + Viewer(); + ~Viewer(); + bool InitViewer(Handle(OpenGl_GraphicDriver)& graphicDriver); +public: + Handle(V3d_Viewer) viewer; +}; } #endif //OPENCAX_VIEWER_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/Window/Window.cpp b/entry/src/main/cpp/NativeEGLOCCT/Window/Window.cpp new file mode 100644 index 00000000..d0eafb2f --- /dev/null +++ b/entry/src/main/cpp/NativeEGLOCCT/Window/Window.cpp @@ -0,0 +1,34 @@ +// +// Created on 2026/3/23. +// +// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, +// please include "napi/native_api.h". + +#include "Window.h" +#ifndef NATIVE_TAG +#define NATIVE_TAG "WINDOW" +#endif +namespace NativeOpenCAX { + +Window::Window():window(nullptr){ + +} +Window::~Window(){ + +} +bool Window::InitWindow(Standard_Integer& width, Standard_Integer& height){ + if(window.IsNull()){ + window = new Aspect_NeutralWindow(); + window->SetSize(width, height); + HILOG_INFO(NATIVE_TAG, "Init Window Done"); + return true; + } + HILOG_INFO(NATIVE_TAG, "Init Window Done"); + return false; +} +void Window::Resize(int w, int h) { + window->SetSize(w, h); + window->DoResize(); + HILOG_ERROR(NATIVE_TAG,"Resize:(%{public}d,%{public}d)",w,h); +} +} \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/Window/Window.h b/entry/src/main/cpp/NativeEGLOCCT/Window/Window.h new file mode 100644 index 00000000..355cb346 --- /dev/null +++ b/entry/src/main/cpp/NativeEGLOCCT/Window/Window.h @@ -0,0 +1,27 @@ +// +// Created on 2026/3/23. +// +// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, +// please include "napi/native_api.h". + +#ifndef OPENCAX_WINDOW_H +#define OPENCAX_WINDOW_H + +#include "NativeEGLOCCT/common.h" +#include +#include + +namespace NativeOpenCAX { + +class Window { +public: + Window(); + ~Window(); + bool InitWindow(Standard_Integer& width,Standard_Integer& height); + void Resize(int w, int h); +public: + Handle(Aspect_NeutralWindow) window; +}; +} + +#endif //OPENCAX_WINDOW_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/common.h b/entry/src/main/cpp/NativeEGLOCCT/common.h index 55076ed2..409933dd 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/common.h +++ b/entry/src/main/cpp/NativeEGLOCCT/common.h @@ -23,6 +23,7 @@ #include #include "hilog/log.h" #include +#include /** LOG_APP 日志级别 LOG_ERROR 错误级别 diff --git a/entry/src/main/ets/entryability/EntryAbility.ets b/entry/src/main/ets/entryability/EntryAbility.ets index 54d737ef..b1a48578 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ets +++ b/entry/src/main/ets/entryability/EntryAbility.ets @@ -66,7 +66,7 @@ export default class EntryAbility extends UIAbility { // if Size Change save to AppStorage mainWinInfo.mainWindowWidth=ListenerData.width; mainWinInfo.mainWindowHeight=ListenerData.height; - console.info('Succeeded in enabling the listener for window size changes. Data: ' + JSON.stringify(data)); + console.info('Succeeded in enabling the listener for window size changes. Data:'+ListenerData.width,ListenerData.height); }); }); diff --git a/entry/src/main/ets/pages/LayoutInterface/Layout/MatrixModel.ets b/entry/src/main/ets/pages/LayoutInterface/Layout/MatrixModel.ets index 0fa49de2..981a34f6 100644 --- a/entry/src/main/ets/pages/LayoutInterface/Layout/MatrixModel.ets +++ b/entry/src/main/ets/pages/LayoutInterface/Layout/MatrixModel.ets @@ -18,6 +18,14 @@ export let DevModel:TitleModel= { cmName:"开发模式",cmPage:"",cmTips:"",cmEvents:[ [[{grpName:'工具矩阵',grpBtn:[ {eModel:[ModelType.BASE],eName:"加载模型",eNamed:"",ePage:'',eIcon:"base_new_file",eTips:"",eEvent:"Execute_LoadModel"}, + {eModel:[ModelType.BASE],eName:"正等轴测图",eNamed:"",ePage:'',eIcon:"base_new_file",eTips:"",eEvent:"CMD_VIEW_ISO"}, + {eModel:[ModelType.BASE],eName:"正二等轴测图",eNamed:"",ePage:'',eIcon:"base_new_file",eTips:"",eEvent:"CMD_VIEW_DIM"}, + {eModel:[ModelType.BASE],eName:"前视图",eNamed:"",ePage:'',eIcon:"base_new_file",eTips:"",eEvent:"CMD_VIEW_FRONT"}, + {eModel:[ModelType.BASE],eName:"后视图",eNamed:"",ePage:'',eIcon:"base_new_file",eTips:"",eEvent:"CMD_VIEW_REAR"}, + {eModel:[ModelType.BASE],eName:"左视图",eNamed:"",ePage:'',eIcon:"base_new_file",eTips:"",eEvent:"CMD_VIEW_LEFT_SIDE"}, + {eModel:[ModelType.BASE],eName:"右视图",eNamed:"",ePage:'',eIcon:"base_new_file",eTips:"",eEvent:"CMD_VIEW_RIGHT_SIDE"}, + {eModel:[ModelType.BASE],eName:"俯视图",eNamed:"",ePage:'',eIcon:"base_new_file",eTips:"",eEvent:"CMD_VIEW_TOP"}, + {eModel:[ModelType.BASE],eName:"仰视图",eNamed:"",ePage:'',eIcon:"base_new_file",eTips:"",eEvent:"CMD_VIEW_BOTTOM"}, [ {eModel:[ModelType.BASE],eName:"创建子窗体",eNamed:"",ePage:'pages/EventSubWindow/SWExtrude',eIcon:"base_new_file",eTips:"",eEvent:"Execute_CreateSubWindow"}, {eModel:[ModelType.BASE],eName:"关闭子窗体",eNamed:"",ePage:'pages/EventSubWindow/SWExtrude',eIcon:"base_new_file",eTips:"",eEvent:"Execute_ExitSubWindow"}, diff --git a/entry/src/main/ets/pages/LayoutInterface/Layout/SwitchView.ets b/entry/src/main/ets/pages/LayoutInterface/Layout/SwitchView.ets index c67f9326..50813b9a 100644 --- a/entry/src/main/ets/pages/LayoutInterface/Layout/SwitchView.ets +++ b/entry/src/main/ets/pages/LayoutInterface/Layout/SwitchView.ets @@ -3,9 +3,9 @@ import { ModelType } from "./ModelType"; //视图选择布局数据 export let SwitchView:Array=[ - {eModel:[ModelType.BASE],eName:"正二轴测图",eNamed:"",ePage:'',eIcon:"base_view_tfr_tri",eTips:"正二轴测图",eEvent:"CMD_VIEW_DIM"}, - {eModel:[ModelType.BASE],eName:"俯视图",eNamed:"",ePage:'',eIcon:"base_view_top",eTips:"俯视图",eEvent:"CMD_VIEW_TOP"}, {eModel:[ModelType.BASE],eName:"正等测图",eNamed:"",ePage:'',eIcon:"base_view_tfr_iso",eTips:"正等测图",eEvent:"CMD_VIEW_ISO"}, + {eModel:[ModelType.BASE],eName:"俯视图",eNamed:"",ePage:'',eIcon:"base_view_top",eTips:"俯视图",eEvent:"CMD_VIEW_TOP"}, + {eModel:[ModelType.BASE],eName:"正二轴测图",eNamed:"",ePage:'',eIcon:"base_view_tfr_tri",eTips:"正二轴测图",eEvent:"CMD_VIEW_DIM"}, {eModel:[ModelType.BASE],eName:"左视图",eNamed:"",ePage:'',eIcon:"base_view_left",eTips:"左视图",eEvent:"CMD_VIEW_LEFT_SIDE"}, {eModel:[ModelType.BASE],eName:"前视图",eNamed:"",ePage:'',eIcon:"base_view_front",eTips:"前视图",eEvent:"CMD_VIEW_FRONT"},