diff --git a/entry/src/main/cpp/CMakeLists.txt b/entry/src/main/cpp/CMakeLists.txt index 7b31db1d..e6fd2174 100644 --- a/entry/src/main/cpp/CMakeLists.txt +++ b/entry/src/main/cpp/CMakeLists.txt @@ -38,34 +38,34 @@ endforeach() # 添加源文件 add_library(opencax SHARED + napi_init.cpp # Header NativeEGLOCCT/EGLCore.h NativeEGLOCCT/NativeRender.h NativeEGLOCCT/NativeRenderThread.h NativeEGLOCCT/NativeManager.h - NativeEGLOCCT/Axis/Axis.h - NativeEGLOCCT/OGD/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 + NativeEGLOCCT/V3d/Axis/Axis.h + NativeEGLOCCT/V3d/V3dOGD/V3dOGD.h + NativeEGLOCCT/V3d/V3dViewer/V3dViewer.h + NativeEGLOCCT/V3d/V3dCtx/V3dCtx.h + NativeEGLOCCT/V3d/V3dView/V3dView.h + NativeEGLOCCT/V3d/V3dWin/V3dWin.h + NativeEGLOCCT/V3d/V3dCa/V3dCa.h + NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.h # Cpp Src NativeEGLOCCT/EGLCore.cpp NativeEGLOCCT/NativeRender.cpp NativeEGLOCCT/NativeRenderThread.cpp NativeEGLOCCT/NativeManager.cpp - NativeEGLOCCT/OGD/OpenGLGraphicDriver.cpp - NativeEGLOCCT/TextStyle/TextStyle.cpp - NativeEGLOCCT/Viewer/Viewer.cpp - NativeEGLOCCT/Context/Context.cpp - NativeEGLOCCT/View/View.cpp - NativeEGLOCCT/Camera/Camera.cpp - NativeEGLOCCT/Axis/Axis.cpp - NativeEGLOCCT/window/window.cpp - napi_init.cpp - ) + NativeEGLOCCT/V3d/V3dOGD/V3dOGD.cpp + NativeEGLOCCT/V3d/V3dViewer/V3dViewer.cpp + NativeEGLOCCT/V3d/V3dCtx/V3dCtx.cpp + NativeEGLOCCT/V3d/V3dView/V3dView.cpp + NativeEGLOCCT/V3d/V3dCa/V3dCa.cpp + NativeEGLOCCT/V3d/Axis/Axis.cpp + NativeEGLOCCT/V3d/V3dWin/V3dWin.cpp + NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.cpp + ) # 查找系统库 find_library(EGL-lib EGL) diff --git a/entry/src/main/cpp/NativeEGLOCCT/Context/Context.cpp b/entry/src/main/cpp/NativeEGLOCCT/Context/Context.cpp deleted file mode 100644 index 2c090225..00000000 --- a/entry/src/main/cpp/NativeEGLOCCT/Context/Context.cpp +++ /dev/null @@ -1,31 +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 "Context.h" - -#ifndef NATIVE_TAG -#define NATIVE_TAG "CONTEXT" -#endif - -namespace NativeOpenCAX { - -Context::Context() : context(nullptr) {} -Context::~Context() {} -bool Context::InitContext(Handle(V3d_Viewer)& viewer,Handle(Prs3d_TextAspect) _textAspect) { - try { - context = new AIS_InteractiveContext(viewer); - context->SetDisplayMode(AIS_Shaded, true); // 默认使用着色模式 - //Handle(Prs3d_Drawer) theDrawer=context->DefaultDrawer(); - //theDrawer->SetTextAspect(_textAspect); - HILOG_INFO(NATIVE_TAG, "InitCtx Done"); - return true; - } catch (std::exception &e) { - HILOG_INFO(NATIVE_TAG, "InitCtx Fail:%{public}d", e.what()); - return false; - } -} - -} \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/NativeRender.cpp b/entry/src/main/cpp/NativeEGLOCCT/NativeRender.cpp index 77ced906..1e81a746 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/NativeRender.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/NativeRender.cpp @@ -10,69 +10,80 @@ static std::mutex renderMutex; namespace NativeOpenCAX { -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) { +NativeRender::NativeRender(int w, int h): +width(0), +height(0), +mAxis(new Axis), +nAxis(new Axis), +v3dcr(new V3dCa), +v3dctx(new V3dCtx), +v3dogd(new V3dOGD), +v3dview(new V3dView), +v3ddrawer(new V3dDrawer), +v3dviewer(new V3dViewer), +v3dwin(new V3dWin) +{ width = w; height = h; - } NativeRender::~NativeRender() { shapes_.clear(); } bool NativeRender::init(EGLCore &_eglCore) { eglCore = _eglCore; - if (!ogd->InitOpenGlGraphicDriver(eglCore)) { + //初始化OpenGL + if (!v3dogd->InitV3dOGD(eglCore)) { HILOG_ERROR(NATIVE_TAG, "Init GraphicDriver Fail!"); return false; } - if (!ts->InitTextStyle()) { - HILOG_ERROR(NATIVE_TAG, "Init TextSyle Fail!"); - return false; - } - if (!vr->InitViewer(ogd->graphicDriver)) { + //初始化视口管理 + if (!v3dviewer->InitV3dViewer(v3dogd->graphicDriver)) { HILOG_ERROR(NATIVE_TAG, "Init Viewer Fail!"); return false; } - if (!ctx->InitContext(vr->viewer,ts->GetFontStyle(STYLE_AXIS))) { + //初始化OCCT内部上下文 + if (!v3dctx->InitV3dCtx(v3dviewer->viewer)) { HILOG_ERROR(NATIVE_TAG, "Init Ctx Fail!"); return false; + }else{ + //初始化OCCT上下文的Drawer(全局属性设置) + v3ddrawer->InitV3dAllAspect(v3dctx->ctx); } - if (!win->InitWindow(width, height)) { + //初始化绑定Window + if (!v3dwin->InitV3dWin(width, height)) { HILOG_ERROR(NATIVE_TAG, "Init Window Fail!"); return false; } - if (!vw->InitView(vr->viewer)) { + //初始化视图 + if (!v3dview->InitV3dView(v3dviewer->viewer,v3dwin->win)) { HILOG_ERROR(NATIVE_TAG, "Init View Fail!"); return false; } else { - vw->SetViewOption(ts->GetFontStyle(STYLE_AXIS)); - vw->SetText(ts->GetFontStyle(STYLE_AXIS)); - vw->SetWin(win->window); + v3dview->InitViewOption(); } - if (!cr->InitCamera(vw->view)) { + if (!v3dcr->InitV3dCa(v3dview->view)) { HILOG_ERROR(NATIVE_TAG, "Init Camera Fail!"); return false; } - if (!mAxis->InitAxis(ctx->context)) { + if (!mAxis->InitAxis(v3dctx->ctx)) { HILOG_ERROR(NATIVE_TAG, "Init AXIS Fail!"); return false; } - if (!mAxis->InitAxisCube(ctx->context,ts->GetFontStyle(STYLE_FACE))) { + if (!mAxis->InitAxisCube(v3dctx->ctx)) { HILOG_ERROR(NATIVE_TAG, "Init AXIS Cuba Fail!"); return false; } //InitDevText(); - vw->ResetView(); + v3dview->ResetView(); return true; } bool NativeRender::loadModel(const std::string &filePath) { // 清除现有模型 for (auto &shape : shapes_) { - ctx->context->Remove(shape, false); + v3dctx->ctx->Remove(shape, false); } shapes_.clear(); @@ -150,13 +161,13 @@ bool NativeRender::loadModel(const std::string &filePath) { drawer->SetFaceBoundaryDraw(true); drawer->SetWireAspect(aLineAspect); drawer->SetShadingAspect(shadingAspect); - ctx->context->Display(aisShape, true); + v3dctx->ctx->Display(aisShape, true); // ctx->context->SetDisplayMode(AIS_WireFrame, Standard_False); shapes_.push_back(aisShape); } } - vw->view->ZFitAll(); - vw->ResetView(); + v3dview->view->ZFitAll(); + v3dview->ResetView(); OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "LoadModel", "Successfully loaded STEP file with %{public}d shapes", numShapes); return true; @@ -169,38 +180,36 @@ void NativeRender::setTranslation(float tx, float ty) { } void NativeRender::render() { - if (vw->view.IsNull()) { + if (v3dview->view.IsNull()) { OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "Render", "View Is Null"); return; } - vw->MustBeResized(); - vw->Redraw(); + v3dview->MustBeResized(); + v3dview->Redraw(); } void NativeRender::resize(int w, int h) { HILOG_ERROR(NATIVE_TAG, "InPut Size:%{public}d,%{public}d", w, h); - win->Resize(w, h); + v3dwin->Resize(w, h); } -void NativeRender::setRotation(float xAngle, float yAngle) { cr->SetRotation(xAngle, yAngle); } +void NativeRender::setRotation(float xAngle, float yAngle) { v3dcr->SetRotation(xAngle, yAngle); } void NativeRender::setZoomLevel(float zoom) { 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() { vw->ResetView(); } +void NativeRender::setClearColor(float r, float g, float b, float a) { v3dview->SetClearColor(r, g, b, a); } +void NativeRender::resetView() { v3dview->ResetView(); } void NativeRender::SwitchView(std::string str) { - vw->SwitchView(str); - + v3dview->SwitchView(str); } void NativeRender::InitDevText(){ Handle(AIS_TextLabel) aTextLabel = new AIS_TextLabel(); const char16_t chinese_array[] = u"新时代社会主义中国接班人"; aTextLabel->SetText(chinese_array); - aTextLabel->Attributes()->SetTextAspect(ts->GetFontStyle(STYLE_AXIS)); gp_Pnt position(0-(width/3), 0-(height/3), 0.0); // 例如,在原点 aTextLabel->SetPosition(position); - ctx->context->Display(aTextLabel, Standard_True); + v3dctx->ctx->Display(aTextLabel, Standard_True); HILOG_ERROR(NATIVE_TAG, "aTextLabel字体名字:%{public}s", aTextLabel->FontName().ToCString()); HILOG_ERROR(NATIVE_TAG, "aTextLabel字体名字:%{public}s", aTextLabel->Attributes()->TextAspect()->Aspect()->Font().ToCString()); } diff --git a/entry/src/main/cpp/NativeEGLOCCT/NativeRender.h b/entry/src/main/cpp/NativeEGLOCCT/NativeRender.h index aee12f09..abd18376 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/NativeRender.h +++ b/entry/src/main/cpp/NativeEGLOCCT/NativeRender.h @@ -5,7 +5,7 @@ #include #include "AIS_Shape.hxx" -#include "NativeEGLOCCT/Window/Window.h" + #include "common.h" #include "EGLCore.h" #include @@ -15,23 +15,15 @@ #include #include -#include "Axis/Axis.h" -#include "Camera/Camera.h" -#include "Context/Context.h" -#include "OGD/OpenGLGraphicDriver.h" -#include "TextStyle/TextStyle.h" -#include "View/View.h" -#include "Viewer/Viewer.h" -#include "Viewer/Viewer.h" - -#include -#include -#include - -#include +#include "V3d/Axis/Axis.h" +#include "V3d/V3dCa/V3dCa.h" +#include "V3d/V3dCtx/V3dCtx.h" +#include "V3d/V3dOGD/V3dOGD.h" +#include "V3d/V3dWin/V3dWin.h" +#include "V3d/V3dView/V3dView.h" +#include "V3d/V3dViewer/V3dViewer.h" +//TextLabel_Dev #include -#include - namespace NativeOpenCAX { class NativeRender { @@ -58,13 +50,13 @@ private: EGLCore eglCore; Axis* mAxis; Axis* nAxis; - Camera* cr; - Context* ctx; - OpenGlGraphicDriver* ogd; - TextStyle* ts; - View* vw; - Viewer* vr; - Window* win; + V3dCa* v3dcr; + V3dCtx* v3dctx; + V3dOGD* v3dogd; + V3dDrawer* v3ddrawer; + V3dView* v3dview; + V3dViewer* v3dviewer; + V3dWin* v3dwin; std::vector shapes_; }; } // namespace NativeRender diff --git a/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.cpp b/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.cpp deleted file mode 100644 index e064ace1..00000000 --- a/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.cpp +++ /dev/null @@ -1,105 +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 "TextStyle.h" -#include "Font_FontAspect.hxx" - -#ifndef NATIVE_TAG -#define NATIVE_TAG "TEXTSTYLE" -#endif - -//该类型主要用于全局字体,样式设置.包含字体.大小.颜色.渲染方式 - -namespace NativeOpenCAX { - -TextStyle::TextStyle() : -currentFontType(FONT_STYLE_TYPE::STYLE_AXIS), -fontStyle(std::map()) -{ - -} -TextStyle::~TextStyle() {} - -bool TextStyle::InitTextStyle() { - try { - InitAxisText(); - InitCubeText(); - HILOG_INFO(NATIVE_TAG, "InitTextSyle Done"); - return true; - } catch (std::exception &e) { - HILOG_INFO(NATIVE_TAG, "InitTextSyle Fail:%{public}d", e.what()); - return false; - } -} -void TextStyle::InitAxisText(){ - FONT_STYLE_TYPE styleType=FONT_STYLE_TYPE::STYLE_AXIS; - Handle(Prs3d_TextAspect) axisText= new Prs3d_TextAspect(); - axisText = new Prs3d_TextAspect(); - axisText->SetHeight(50); - axisText->SetFont("HarmonyOS Sans"); - axisText->Aspect()->SetFont("HarmonyOS Sans"); - axisText->Aspect()->SetColor(Quantity_NOC_GRAY95); - axisText->Aspect()->SetColorSubTitle(Quantity_NOC_BLACK); - axisText->Aspect()->SetDisplayType(Aspect_TODT_SHADOW); - axisText->Aspect()->SetTextFontAspect(Font_FA_Bold); - axisText->Aspect()->SetTextZoomable(false); - axisText->SetHorizontalJustification(Graphic3d_HTA_LEFT); - axisText->SetVerticalJustification(Graphic3d_VTA_BOTTOM); - fontStyle[styleType]=axisText; -} -void TextStyle::InitCubeText(){ - FONT_STYLE_TYPE styleType=FONT_STYLE_TYPE::STYLE_FACE; - Handle(Prs3d_TextAspect) cubeText= new Prs3d_TextAspect(); - cubeText = new Prs3d_TextAspect(); - cubeText->SetHeight(2000); - cubeText->SetFont("HarmonyOS Sans"); - cubeText->Aspect()->SetFont("HarmonyOS Sans"); - cubeText->Aspect()->SetColor(Quantity_NOC_GRAY95); - cubeText->Aspect()->SetColorSubTitle(Quantity_NOC_BLACK); - cubeText->Aspect()->SetDisplayType(Aspect_TODT_SHADOW); - cubeText->Aspect()->SetTextFontAspect(Font_FA_Bold); - cubeText->Aspect()->SetTextZoomable(true); - cubeText->SetHorizontalJustification(Graphic3d_HTA_LEFT); - cubeText->SetVerticalJustification(Graphic3d_VTA_BOTTOM); - fontStyle[styleType]=cubeText; -} -Handle(Prs3d_TextAspect) TextStyle::GetFontStyle(FONT_STYLE_TYPE type){ - return fontStyle[type]; -} -void TextStyle::SetPrs3dFont(const char* theFont){ - fontStyle[currentFontType]->SetFont(theFont); -} -void TextStyle::SetPrs3dHeight(int textSize){ - fontStyle[currentFontType]->SetHeight(textSize); -} -void TextStyle::SetPrs3dColor(Quantity_Color &theColor){ - fontStyle[currentFontType]->SetColor(theColor); -} -void TextStyle::SetPrs3dHTA(Graphic3d_HorizontalTextAlignment theJustification){ - fontStyle[currentFontType]->SetHorizontalJustification(theJustification); -} -void TextStyle::SetPrs3dVTA(Graphic3d_VerticalTextAlignment theJustification){ - fontStyle[currentFontType]->SetVerticalJustification(theJustification); -} -void TextStyle::SetPrs3dAspectText3d(Handle(Graphic3d_AspectText3d) theAspect){ - fontStyle[currentFontType]->SetAspect(theAspect); -} -void TextStyle::SetGrs3dSetColor(const Quantity_Color &theColor){ - fontStyle[currentFontType]->Aspect()->SetColor(theColor); -} -void TextStyle::SetGrs3dSetColorRGBA(const Quantity_ColorRGBA &theColor){ - fontStyle[currentFontType]->Aspect()->SetColor(theColor); -} -void TextStyle::SetGrs3dSetTextFont(Handle(TCollection_HAsciiString) theFont){ - fontStyle[currentFontType]->Aspect()->SetTextFont(theFont); -} -void TextStyle::SetGrs3dSetZoomable(bool theFlag){ - fontStyle[currentFontType]->Aspect()->SetTextZoomable(theFlag); -} -void TextStyle::SetGrs3dDisplayType(Font_FontAspect theFontAspect){ - fontStyle[currentFontType]->Aspect()->SetTextFontAspect(theFontAspect); -} -} \ 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 deleted file mode 100644 index 5a2f5bae..00000000 --- a/entry/src/main/cpp/NativeEGLOCCT/TextStyle/TextStyle.h +++ /dev/null @@ -1,52 +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_TEXTSTYLE_H -#define OPENCAX_TEXTSTYLE_H - -#include -#include "NativeEGLOCCT/common.h" -#include -#include -//字体样式类型.主要用于区别该样式用于何处 -enum FONT_STYLE_TYPE{ - STYLE_AXIS, - STYLE_FACE, -}; -struct TextStyleOpts{ - -}; -namespace NativeOpenCAX{ -class TextStyle{ -public: - TextStyle(); - ~TextStyle(); - bool InitTextStyle(); - Handle(Prs3d_TextAspect) GetFontStyle(FONT_STYLE_TYPE); - //Prs3d - void SetPrs3dFont(const char* theFont); - void SetPrs3dHeight(int textSize); - void SetPrs3dColor(Quantity_Color &theColor); - void SetPrs3dHTA(Graphic3d_HorizontalTextAlignment theJustification); - void SetPrs3dVTA(Graphic3d_VerticalTextAlignment theJustification); - void SetPrs3dAspectText3d(Handle(Graphic3d_AspectText3d) theAspect); - //Grs3d - void SetGrs3dSetColor(const Quantity_Color &theColor); - void SetGrs3dSetColorRGBA(const Quantity_ColorRGBA &theColor); - void SetGrs3dSetTextFont(Handle(TCollection_HAsciiString) theFont); - void SetGrs3dSetZoomable(bool theFlag); - void SetGrs3dDisplayType(Font_FontAspect theFontAspect); -private: - void InitAxisText(); - void InitCubeText(); -public: - //一个字体管理样式对象管理.主要负责对字体样式的归一化集中管理 - FONT_STYLE_TYPE currentFontType; - std::map fontStyle; -}; -} - -#endif //OPENCAX_TEXTSTYLE_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.cpp b/entry/src/main/cpp/NativeEGLOCCT/V3d/Axis/Axis.cpp similarity index 93% rename from entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.cpp rename to entry/src/main/cpp/NativeEGLOCCT/V3d/Axis/Axis.cpp index 417de55f..204fb1d0 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/Axis/Axis.cpp @@ -63,7 +63,7 @@ bool Axis::InitAxis(Handle(AIS_InteractiveContext) & context) { return false; } } -bool Axis::InitAxisCube(Handle(AIS_InteractiveContext) & context,Handle(Prs3d_TextAspect) _textStyle) { +bool Axis::InitAxisCube(Handle(AIS_InteractiveContext) & context) { try { //立方体面显示文本 const char16_t rightCube[] = u"右视图"; @@ -86,11 +86,7 @@ bool Axis::InitAxisCube(Handle(AIS_InteractiveContext) & context,Handle(Prs3d_Te axiViewCube->SetFixedAnimationLoop(true); axiViewCube->SetTextColor(Quantity_Color(Quantity_NOC_YELLOW2)); axiViewCube->SetFontHeight(30); - axiViewCube->SetFont("HarmonyOS Sans"); axiViewCube->SetMaterial(Graphic3d_MaterialAspect(Graphic3d_NOM_ALUMINIUM)); - axiViewCube->BoxEdgeStyle()->Aspect()->SetTextFont(_textStyle->Aspect()->TextFont()); - axiViewCube->BoxCornerStyle()->Aspect()->SetTextFont(_textStyle->Aspect()->TextFont()); - axiViewCube->BoxSideStyle()->Aspect()->SetTextFont(_textStyle->Aspect()->TextFont()); axiViewCube->SetTransformPersistence( new Graphic3d_TransformPers(Graphic3d_TMF_TriedronPers, Aspect_TOTP_RIGHT_UPPER, NCollection_Vec2(125, 125))); context->Display(axiViewCube, true); diff --git a/entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.h b/entry/src/main/cpp/NativeEGLOCCT/V3d/Axis/Axis.h similarity index 92% rename from entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.h rename to entry/src/main/cpp/NativeEGLOCCT/V3d/Axis/Axis.h index 20e67ee1..1dc28ebf 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Axis/Axis.h +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/Axis/Axis.h @@ -20,7 +20,7 @@ public: Axis(); ~Axis(); bool InitAxis(Handle(AIS_InteractiveContext)& context); - bool InitAxisCube(Handle(AIS_InteractiveContext) & context,Handle(Prs3d_TextAspect) _textStyle); + bool InitAxisCube(Handle(AIS_InteractiveContext) & context); void SetRotationX(float x); void SetRotationY(float y); void SetRotationZ(float z); diff --git a/entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.cpp b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCa/V3dCa.cpp similarity index 92% rename from entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.cpp rename to entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCa/V3dCa.cpp index 82f51e3f..b95d9dbe 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCa/V3dCa.cpp @@ -4,7 +4,7 @@ // Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, // please include "napi/native_api.h". -#include "Camera.h" +#include "V3dCa.h" #ifndef NATIVE_TAG #define NATIVE_TAG "CAMERA" @@ -12,9 +12,9 @@ namespace NativeOpenCAX { -Camera::Camera() : camera(nullptr) {} -Camera::~Camera() {} -bool Camera::InitCamera(Handle(V3d_View)& view) { +V3dCa::V3dCa() : camera(nullptr) {} +V3dCa::~V3dCa() {} +bool V3dCa::InitV3dCa(Handle(V3d_View)& view) { try { camera = new Graphic3d_Camera; // 将角度转换为弧度并计算对应的缩放因子 @@ -29,7 +29,7 @@ bool Camera::InitCamera(Handle(V3d_View)& view) { return false; } } -void Camera::SetRotation(float xAngle, float yAngle) { +void V3dCa::SetRotation(float xAngle, float yAngle) { gp_Pnt currentEye = camera->Eye(); gp_Pnt currentCenter = camera->Center(); gp_Dir currentUp = camera->Up(); diff --git a/entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.h b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCa/V3dCa.h similarity index 85% rename from entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.h rename to entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCa/V3dCa.h index a1298771..2a0c28f1 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Camera/Camera.h +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCa/V3dCa.h @@ -12,11 +12,11 @@ #include namespace NativeOpenCAX { -class Camera{ +class V3dCa{ public: - Camera(); - ~Camera(); - bool InitCamera(Handle(V3d_View)& view); + V3dCa(); + ~V3dCa(); + bool InitV3dCa(Handle(V3d_View)& view); void SetRotation(float xAngle, float yAngle); public: Handle(Graphic3d_Camera) camera; diff --git a/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCtx/V3dCtx.cpp b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCtx/V3dCtx.cpp new file mode 100644 index 00000000..d24412d5 --- /dev/null +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCtx/V3dCtx.cpp @@ -0,0 +1,34 @@ +// +// 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 "V3dCtx.h" + +#ifndef NATIVE_TAG +#define NATIVE_TAG "CTX" +#endif + +namespace NativeOpenCAX { + +V3dCtx::V3dCtx(): +ctx(nullptr) +{ + +} +V3dCtx::~V3dCtx() { + +} +bool V3dCtx::InitV3dCtx(Handle(V3d_Viewer)& viewer) { + ctx = new AIS_InteractiveContext(viewer); + if(!ctx.IsNull()){ + HILOG_INFO(NATIVE_TAG, "InitCtx Done"); + return true; + }else{ + HILOG_INFO(NATIVE_TAG, "InitCtx Faile"); + return false; + } +} + +} \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/Context/Context.h b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCtx/V3dCtx.h similarity index 69% rename from entry/src/main/cpp/NativeEGLOCCT/Context/Context.h rename to entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCtx/V3dCtx.h index bb7f2cb2..eaeb01cd 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Context/Context.h +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dCtx/V3dCtx.h @@ -8,18 +8,21 @@ #define OPENCAX_CONTEXT_H #include "NativeEGLOCCT/common.h" -#include #include +#include + + +#include "../V3dDrawer/V3dDrawer.h" namespace NativeOpenCAX{ -class Context{ +class V3dCtx{ public: - Context(); - ~Context(); - bool InitContext(Handle(V3d_Viewer)& viewer,Handle(Prs3d_TextAspect) _textAspect); + V3dCtx(); + ~V3dCtx(); + bool InitV3dCtx(Handle(V3d_Viewer)& viewer); public: - Handle(AIS_InteractiveContext) context; + Handle(AIS_InteractiveContext) ctx; }; } diff --git a/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.cpp b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.cpp new file mode 100644 index 00000000..9fc3e39e --- /dev/null +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.cpp @@ -0,0 +1,78 @@ +// +// 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". +#ifndef NATIVE_TAG +#define NATIVE_TAG "V3DDRAWER" +#endif +#include "V3dDrawer.h" +namespace NativeOpenCAX { + +V3dDrawer::V3dDrawer() : +drawer(nullptr), +v3d_IsoAspect(nullptr), +v3d_LineAspect(nullptr), +v3d_TextAspect(nullptr), +v3d_ShadingAspect(nullptr), +v3d_PlaneAspect(nullptr), +v3d_ArrowAspect(nullptr), +v3d_DatumAspect(nullptr), +v3d_DimAspect(nullptr) +{ + +} +V3dDrawer::~V3dDrawer() {} +bool V3dDrawer::InitV3dAllAspect(Handle(AIS_InteractiveContext)& ctx) { + try { + drawer=ctx->DefaultDrawer(); + v3d_IsoAspect=drawer->UIsoAspect(); + v3d_LineAspect=drawer->LineAspect(); + v3d_TextAspect=drawer->TextAspect(); + v3d_ShadingAspect=drawer->ShadingAspect(); + v3d_PlaneAspect=drawer->PlaneAspect(); + v3d_ArrowAspect=drawer->ArrowAspect(); + v3d_DatumAspect=drawer->DatumAspect(); + v3d_DimAspect=drawer->DimensionAspect(); + InitV3dIsoAspectOpts(); + InitV3dLineAspectOpts(); + InitV3dTextAspectOpts(); + InitV3dShadingAspectOpts(); + InitV3dPlaneAspectOpts(); + InitV3dArrowAspectOpts(); + InitV3dDatumAspectOpts(); + InitV3dDimAspectOpts(); + HILOG_INFO(NATIVE_TAG, "InitV3dDrawer Done"); + return true; + } catch (std::exception &e) { + HILOG_INFO(NATIVE_TAG, "InitV3dDrawer Fail:%{public}d", e.what()); + return false; + } +} + +void V3dDrawer::InitV3dIsoAspectOpts() { + v3d_IsoAspect->SetWidth(1.0); +} +void V3dDrawer::InitV3dLineAspectOpts() { + v3d_LineAspect->SetWidth(1.0); +} +void V3dDrawer::InitV3dTextAspectOpts() { + v3d_TextAspect->SetFont("HarmonyOS Sans"); + v3d_TextAspect->SetHeight(35); +} +void V3dDrawer::InitV3dShadingAspectOpts() { + +} +void V3dDrawer::InitV3dPlaneAspectOpts() { + +} +void V3dDrawer::InitV3dArrowAspectOpts() { + +} +void V3dDrawer::InitV3dDatumAspectOpts() { + +} +void V3dDrawer::InitV3dDimAspectOpts() { + +} +} \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.h b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.h new file mode 100644 index 00000000..f95391b4 --- /dev/null +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.h @@ -0,0 +1,66 @@ +// +// 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". + +#ifndef OPENCAX_V3DDRAWER_H +#define OPENCAX_V3DDRAWER_H + +#include "AIS_InteractiveContext.hxx" +#include "NativeEGLOCCT/common.h" +#include "PrsMgr_PresentationManager.hxx" +#include +#include +#include +#include +#include +#include +#include +#include +#include + +namespace NativeOpenCAX{ + +class V3dDrawer { +public: + V3dDrawer(); + ~V3dDrawer(); +bool InitV3dAllAspect(Handle(AIS_InteractiveContext)& ctx); +private: + void InitV3dIsoAspectOpts(); + void InitV3dLineAspectOpts(); + void InitV3dTextAspectOpts(); + void InitV3dShadingAspectOpts(); + void InitV3dPlaneAspectOpts(); + void InitV3dArrowAspectOpts(); + void InitV3dDatumAspectOpts(); + void InitV3dDimAspectOpts(); +public: + Handle(Prs3d_Drawer) drawer; + //曲面上等参线:颜色、线型(实线、虚线等)、线宽。 + Handle(Prs3d_IsoAspect) v3d_IsoAspect; + //直线和线段的基本外观。这包括模型的边缘线、轴线、构造线 + //颜色、线型、线宽。 + Handle(Prs3d_LineAspect) v3d_LineAspect; + //定义文本的外观。例如,在模型旁边添加的标签、注释或尺寸数值等 + //文本颜色、字体名称、字体大小、文本样式(粗体、斜体等)、文本方向 + Handle(Prs3d_TextAspect) v3d_TextAspect; + //用于定义实体模型表面在着色模式下的外观。它决定了物体的填充颜色和材质特性 + //前后表面颜色、材料属性(如环境光、漫反射、镜面反射系数)、线框/着色模式 + Handle(Prs3d_ShadingAspect) v3d_ShadingAspect; + //用于定义平面的外观。例如,在可视化中表示一个无限大的平面对象或坐标系中的参考平面 + //平面边界线的样式(LineAspect)、平面填充的样式(InteriorStyle,如网格、阴影等)、颜色 + Handle(Prs3d_PlaneAspect) v3d_PlaneAspect; + //用于定义箭头的外观。例如,向量的方向指示、坐标轴的箭头、尺寸标注的引出线箭头等 + //箭头的样式(实心三角形、空心、线条等)、颜色、大小。 + Handle(Prs3d_ArrowAspect) v3d_ArrowAspect; + //用于定义基准(Datum)的外观。在 CAD/CAM 和工程图纸中,基准是用于测量和定位的参考元素,如基准点、基准线、基准面。这个 Aspect 专门用来设置这些特殊参考元素的显示样式 + //通常包含定义基准符号、线条、文本等组合元素的样式。 + Handle(Prs3d_DatumAspect) v3d_DatumAspect; + //用于定义尺寸标注(Dimension)的外观。如上一个问题所述,它控制着尺寸线、延伸线、箭头、文本等尺寸标注所有组成部分的视觉表现。 + //尺寸线颜色/样式、文本颜色/字体、箭头样式、公差显示格式等。 + Handle(Prs3d_DimensionAspect) v3d_DimAspect; +}; +} +#endif //OPENCAX_V3DDRAWER_H diff --git a/entry/src/main/cpp/NativeEGLOCCT/OGD/OpenGLGraphicDriver.cpp b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dOGD/V3dOGD.cpp similarity index 79% rename from entry/src/main/cpp/NativeEGLOCCT/OGD/OpenGLGraphicDriver.cpp rename to entry/src/main/cpp/NativeEGLOCCT/V3d/V3dOGD/V3dOGD.cpp index ce045bd5..bb3aeb77 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/OGD/OpenGLGraphicDriver.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dOGD/V3dOGD.cpp @@ -4,7 +4,7 @@ // Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, // please include "napi/native_api.h". -#include "OpenGLGraphicDriver.h" +#include "V3dOGD.h" #ifndef NATIVE_TAG #define NATIVE_TAG "GRAPHIC_DRIVER" @@ -12,9 +12,9 @@ namespace NativeOpenCAX { -OpenGlGraphicDriver::OpenGlGraphicDriver() : graphicDriver(nullptr), displayConnection(nullptr) {} -OpenGlGraphicDriver::~OpenGlGraphicDriver() {} -bool OpenGlGraphicDriver::InitOpenGlGraphicDriver(EGLCore& eglCore) { +V3dOGD::V3dOGD() : graphicDriver(nullptr), displayConnection(nullptr) {} +V3dOGD::~V3dOGD() {} +bool V3dOGD::InitV3dOGD(EGLCore& eglCore) { try { displayConnection = new Aspect_DisplayConnection(); diff --git a/entry/src/main/cpp/NativeEGLOCCT/OGD/OpenGLGraphicDriver.h b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dOGD/V3dOGD.h similarity index 81% rename from entry/src/main/cpp/NativeEGLOCCT/OGD/OpenGLGraphicDriver.h rename to entry/src/main/cpp/NativeEGLOCCT/V3d/V3dOGD/V3dOGD.h index 72bdf599..d3679e1a 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/OGD/OpenGLGraphicDriver.h +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dOGD/V3dOGD.h @@ -14,11 +14,11 @@ #include namespace NativeOpenCAX{ -class OpenGlGraphicDriver{ +class V3dOGD{ public: - OpenGlGraphicDriver(); - ~OpenGlGraphicDriver(); - bool InitOpenGlGraphicDriver(EGLCore& eglCore); + V3dOGD(); + ~V3dOGD(); + bool InitV3dOGD(EGLCore& eglCore); public: Handle(OpenGl_GraphicDriver) graphicDriver; Handle(Aspect_DisplayConnection) displayConnection; diff --git a/entry/src/main/cpp/NativeEGLOCCT/View/View.cpp b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dView/V3dView.cpp similarity index 73% rename from entry/src/main/cpp/NativeEGLOCCT/View/View.cpp rename to entry/src/main/cpp/NativeEGLOCCT/V3d/V3dView/V3dView.cpp index e9340c7a..4233ae2f 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/View/View.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dView/V3dView.cpp @@ -4,7 +4,7 @@ // Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, // please include "napi/native_api.h". -#include "View.h" +#include "V3dView.h" #include "Quantity_NameOfColor.hxx" #include "V3d_TypeOfAxe.hxx" #include "V3d_TypeOfVisualization.hxx" @@ -15,12 +15,13 @@ namespace NativeOpenCAX { -View::View() : view(nullptr) {} -View::~View() {} +V3dView::V3dView() : view(nullptr) {} +V3dView::~V3dView() {} -bool View::InitView(Handle(V3d_Viewer) & viewer) { +bool V3dView::InitV3dView(Handle(V3d_Viewer) & viewer,Handle(Aspect_NeutralWindow)& win) { try { view = viewer->CreateView(); + view->SetWindow(win, (Aspect_RenderingContext)eglGetCurrentContext()); HILOG_INFO(NATIVE_TAG, "InitView Done"); return true; } catch (std::exception &e) { @@ -28,7 +29,7 @@ bool View::InitView(Handle(V3d_Viewer) & viewer) { return false; } } -void View::SetViewOption(Handle(Prs3d_TextAspect) _textStyle) { +void V3dView::InitViewOption() { // 设置渲染参数 view->SetImmediateUpdate(false); view->ChangeRenderingParams().Method = Graphic3d_RM_RASTERIZATION; @@ -51,39 +52,28 @@ void View::SetViewOption(Handle(Prs3d_TextAspect) _textStyle) { view->SetBackgroundColor(Quantity_NOC_GRAY90); //左下角默认坐标系 view->TriedronDisplay(Aspect_TOTP_LEFT_LOWER, Quantity_NOC_ANTIQUEWHITE, 0.3, V3d_ZBUFFER); - -// view->Trihedron(false)->LabelAspect(V3d_Y)->SetAspect(_textStyle->Aspect()); -// view->Trihedron(false)->LabelAspect(V3d_X)->SetAspect(_textStyle->Aspect()); -// view->Trihedron(false)->LabelAspect(V3d_Z)->SetAspect(_textStyle->Aspect()); view->SetBackgroundColor(Quantity_NOC_GRAY90); } -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) { +void V3dView::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 V3dView::MustBeResized() { view->MustBeResized(); } -void View::Redraw() { +void V3dView::Redraw() { view->Redraw(); } -void View::ResetView() { +void V3dView::ResetView() { if (!view.IsNull()) { view->SetProj(V3d_XposYnegZpos); view->FitAll(0.05, false); } } -void View::SwitchView(std::string nView) { +void V3dView::SwitchView(std::string nView) { V3d_TypeOfOrientation tV3d; if (nView == "CMD_VIEW_FRONT") { tV3d = V3d_Yneg; diff --git a/entry/src/main/cpp/NativeEGLOCCT/View/View.h b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dView/V3dView.h similarity index 69% rename from entry/src/main/cpp/NativeEGLOCCT/View/View.h rename to entry/src/main/cpp/NativeEGLOCCT/V3d/V3dView/V3dView.h index 62f1a709..1ec9618d 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/View/View.h +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dView/V3dView.h @@ -7,7 +7,7 @@ #ifndef OPENCAX_VIEW_H #define OPENCAX_VIEW_H -#include "NativeEGLOCCT/Context/Context.h" +#include "../V3dCtx/V3dCtx.h" #include "NativeEGLOCCT/common.h" #include #include @@ -16,14 +16,12 @@ namespace NativeOpenCAX{ -class View{ +class V3dView{ public: - View(); - ~View(); - bool InitView(Handle(V3d_Viewer)& viewer); - void SetViewOption(Handle(Prs3d_TextAspect) _textStyle); - void SetWin(Handle(Aspect_NeutralWindow)& win); - void SetText(Handle(Prs3d_TextAspect) text); + V3dView(); + ~V3dView(); + bool InitV3dView(Handle(V3d_Viewer)& viewer,Handle(Aspect_NeutralWindow)& win); + void InitViewOption(); void SetClearColor(float r, float g, float b, float a); void MustBeResized(); void Redraw(); diff --git a/entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.cpp b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dViewer/V3dViewer.cpp similarity index 80% rename from entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.cpp rename to entry/src/main/cpp/NativeEGLOCCT/V3d/V3dViewer/V3dViewer.cpp index 916b8715..21f22e3e 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dViewer/V3dViewer.cpp @@ -4,7 +4,7 @@ // Node APIs are not fully supported. To solve the compilation error of the interface cannot be found, // please include "napi/native_api.h". -#include "Viewer.h" +#include "V3dViewer.h" #ifndef NATIVE_TAG #define NATIVE_TAG "VIEWER" @@ -13,10 +13,10 @@ #include namespace NativeOpenCAX { -Viewer::Viewer() : viewer(nullptr) {} -Viewer::~Viewer() {} +V3dViewer::V3dViewer() : viewer(nullptr) {} +V3dViewer::~V3dViewer() {} -bool Viewer::InitViewer(Handle(OpenGl_GraphicDriver)& graphicDriver) { +bool V3dViewer::InitV3dViewer(Handle(OpenGl_GraphicDriver)& graphicDriver) { try { viewer = new V3d_Viewer(graphicDriver); viewer->SetDefaultBackgroundColor(Quantity_NOC_BLACK); @@ -29,5 +29,4 @@ bool Viewer::InitViewer(Handle(OpenGl_GraphicDriver)& graphicDriver) { return false; } } - } \ No newline at end of file diff --git a/entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.h b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dViewer/V3dViewer.h similarity index 72% rename from entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.h rename to entry/src/main/cpp/NativeEGLOCCT/V3d/V3dViewer/V3dViewer.h index 1c06683b..bc624d03 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Viewer/Viewer.h +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dViewer/V3dViewer.h @@ -8,16 +8,17 @@ #define OPENCAX_VIEWER_H #include "NativeEGLOCCT/common.h" +#include "PrsMgr_PresentationManager.hxx" #include #include namespace NativeOpenCAX{ -class Viewer{ +class V3dViewer{ public: - Viewer(); - ~Viewer(); - bool InitViewer(Handle(OpenGl_GraphicDriver)& graphicDriver); + V3dViewer(); + ~V3dViewer(); + bool InitV3dViewer(Handle(OpenGl_GraphicDriver)& graphicDriver); public: Handle(V3d_Viewer) viewer; }; diff --git a/entry/src/main/cpp/NativeEGLOCCT/Window/Window.cpp b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dWin/V3dWin.cpp similarity index 60% rename from entry/src/main/cpp/NativeEGLOCCT/Window/Window.cpp rename to entry/src/main/cpp/NativeEGLOCCT/V3d/V3dWin/V3dWin.cpp index 71cee5f9..47ed7bfd 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Window/Window.cpp +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dWin/V3dWin.cpp @@ -4,31 +4,31 @@ // 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" +#include "V3dWin.h" #ifndef NATIVE_TAG #define NATIVE_TAG "WINDOW" #endif namespace NativeOpenCAX { -Window::Window():window(nullptr){ +V3dWin::V3dWin():win(nullptr){ } -Window::~Window(){ +V3dWin::~V3dWin(){ } -bool Window::InitWindow(int& width, int& height){ - if(window.IsNull()){ - window = new Aspect_NeutralWindow(); - window->SetSize(width, height); +bool V3dWin::InitV3dWin(int& width, int& height){ + if(win.IsNull()){ + win = new Aspect_NeutralWindow(); + win->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(); +void V3dWin::Resize(int w, int h) { + win->SetSize(w, h); + win->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/V3d/V3dWin/V3dWin.h similarity index 71% rename from entry/src/main/cpp/NativeEGLOCCT/Window/Window.h rename to entry/src/main/cpp/NativeEGLOCCT/V3d/V3dWin/V3dWin.h index de377404..2da37626 100644 --- a/entry/src/main/cpp/NativeEGLOCCT/Window/Window.h +++ b/entry/src/main/cpp/NativeEGLOCCT/V3d/V3dWin/V3dWin.h @@ -8,19 +8,18 @@ #define OPENCAX_WINDOW_H #include "NativeEGLOCCT/common.h" -#include #include namespace NativeOpenCAX { -class Window { +class V3dWin { public: - Window(); - ~Window(); - bool InitWindow(int& width,int& height); + V3dWin(); + ~V3dWin(); + bool InitV3dWin(int& width,int& height); void Resize(int w, int h); public: - Handle(Aspect_NeutralWindow) window; + Handle(Aspect_NeutralWindow) win; }; }