修改远程git

This commit is contained in:
JackLee 2026-04-20 05:09:23 +08:00
parent d2e81404bc
commit 2379b94633
61 changed files with 404 additions and 331 deletions

View File

@ -52,16 +52,16 @@ add_library(opencax SHARED
NativeEGLOCCT/OCCTMgr/Render.h
NativeEGLOCCT/OCCTMgr/RenderThread.h
NativeEGLOCCT/NativeMgr.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/V3dCamera/V3dCamera.h
NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.h
NativeEGLOCCT/V3d/V3dTri/V3dTri.h
NativeEGLOCCT/V3d/V3dTri/V3dWCSTri.h
NativeEGLOCCT/V3d/V3dTri/V3dTriCube.h
NativeEGLOCCT/Visualization/OGD/V3dOGD.h
NativeEGLOCCT/Visualization/Viewer/V3dViewer.h
NativeEGLOCCT/Visualization/Context/V3dCtx.h
NativeEGLOCCT/Visualization/View/V3dView.h
NativeEGLOCCT/Visualization/Win/V3dWin.h
NativeEGLOCCT/Visualization/Camera/V3dCamera.h
NativeEGLOCCT/Visualization/Drawer/V3dDrawer.h
NativeEGLOCCT/Visualization/Tri/V3dTri.h
NativeEGLOCCT/Visualization/Tri/V3dWCSTri.h
NativeEGLOCCT/Visualization/Tri/V3dTriCube.h
# Cpp Src
NativeEGLOCCT/EGLMgr/EGLCore.cpp
@ -70,17 +70,17 @@ add_library(opencax SHARED
NativeEGLOCCT/OCCTMgr/Render.cpp
NativeEGLOCCT/OCCTMgr/RenderThread.cpp
NativeEGLOCCT/NativeMgr.cpp
NativeEGLOCCT/V3d/V3dOGD/V3dOGD.cpp
NativeEGLOCCT/V3d/V3dViewer/V3dViewer.cpp
NativeEGLOCCT/V3d/V3dCtx/V3dCtx.cpp
NativeEGLOCCT/V3d/V3dView/V3dView.cpp
NativeEGLOCCT/V3d/V3dCamera/V3dCamera.cpp
NativeEGLOCCT/V3d/V3dWin/V3dWin.cpp
NativeEGLOCCT/V3d/V3dDrawer/V3dDrawer.cpp
NativeEGLOCCT/V3d/V3dTri/V3dTri.cpp
NativeEGLOCCT/V3d/V3dTri/V3dWCSTri.cpp
NativeEGLOCCT/V3d/V3dTri/V3dTriCube.cpp
)
NativeEGLOCCT/Visualization/OGD/V3dOGD.cpp
NativeEGLOCCT/Visualization/Viewer/V3dViewer.cpp
NativeEGLOCCT/Visualization/Context/V3dCtx.cpp
NativeEGLOCCT/Visualization/View/V3dView.cpp
NativeEGLOCCT/Visualization/Camera/V3dCamera.cpp
NativeEGLOCCT/Visualization/Win/V3dWin.cpp
NativeEGLOCCT/Visualization/Drawer/V3dDrawer.cpp
NativeEGLOCCT/Visualization/Tri/V3dTri.cpp
NativeEGLOCCT/Visualization/Tri/V3dWCSTri.cpp
NativeEGLOCCT/Visualization/Tri/V3dTriCube.cpp
NativeEGLOCCT/ViewController/V3dViewController.h NativeEGLOCCT/ViewController/V3dViewController.cpp)
#

View File

@ -21,7 +21,8 @@ v3dOgd(new V3dOGD),
v3dView(new V3dView),
v3dDrawer(new V3dDrawer),
v3dViewer(new V3dViewer),
v3dWin(new V3dWin)
v3dWin(new V3dWin),
v3dViewContr(new V3dViewController)
{
width = w;
height = h;

View File

@ -14,14 +14,15 @@
#include <BRepBndLib.hxx>
#include <BRepBuilderAPI_Transform.hxx>
#include "../V3d/V3dTri/V3dTri.h"
#include "../V3d/V3dTri/V3dTriCube.h"
#include "../V3d/V3dCamera/V3dCamera.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"
#include "../Visualization/Tri/V3dTri.h"
#include "../Visualization/Tri/V3dTriCube.h"
#include "../Visualization/Camera/V3dCamera.h"
#include "../Visualization/Context/V3dCtx.h"
#include "../Visualization/OGD/V3dOGD.h"
#include "../Visualization/Win/V3dWin.h"
#include "../Visualization/View/V3dView.h"
#include "../Visualization/Viewer/V3dViewer.h"
#include "../ViewController/V3dViewController.h"
//TextLabel_Dev
#include <AIS_TextLabel.hxx>
namespace NativeOpenCAX {
@ -56,6 +57,7 @@ private:
V3dView* v3dView;
V3dViewer* v3dViewer;
V3dWin* v3dWin;
V3dViewController* v3dViewContr;
std::vector<Handle(AIS_Shape)> shapes_;
};
} // namespace NativeRender

View File

@ -0,0 +1,18 @@
//
// Created on 2026/4/19.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".
#include "V3dViewController.h"
namespace NativeOpenCAX {
V3dViewController::V3dViewController()
{
}
V3dViewController::~V3dViewController(){
}
}

View File

@ -0,0 +1,20 @@
//
// Created on 2026/4/19.
//
// 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_V3DVIEWCONTROLLER_H
#define OPENCAX_V3DVIEWCONTROLLER_H
#include "AIS_ViewController.hxx"
namespace NativeOpenCAX {
class V3dViewController {
public:
V3dViewController();
~V3dViewController();
private:
Handle(AIS_ViewController) viewController;
};
}
#endif //OPENCAX_V3DVIEWCONTROLLER_H

View File

@ -12,7 +12,7 @@
#include <AIS_InteractiveContext.hxx>
#include "../V3dDrawer/V3dDrawer.h"
#include "../Drawer/V3dDrawer.h"
namespace NativeOpenCAX{

View File

@ -7,7 +7,7 @@
#ifndef OPENCAX_VIEW_H
#define OPENCAX_VIEW_H
#include "../V3dCtx/V3dCtx.h"
#include "../Context/V3dCtx.h"
#include "NativeEGLOCCT/common.h"
#include <V3d_View.hxx>
#include <Aspect_NeutralWindow.hxx>

View File

@ -3,12 +3,10 @@ import { hilog } from '@kit.PerformanceAnalysisKit';
import { window, display, AppStorageV2, ColorMetrics } from '@kit.ArkUI';
import { IBestInit } from "@ibestservices/ibest-ui-v2"
import {ExtractDir,CheckExistDir,HilogSadboxFontDirFile} from "../pages/ExtractDir/ExtractDir"
import {MainWindowStageInfo,InitGlobalDisplayWindowInfo,mwInfo, mwsInfo}from '../pages/DispWinInfo/DispWinInfo'
import {MainWindowStageInfo,InitGlobalDisplayWindowInfo,mwInfo}from '../pages/DispWinInfo/DispWinInfo'
const DOMAIN = 0x0000;
export default class EntryAbility extends UIAbility {
private mainWindow: window.Window | undefined;
private subWindow: window.Window | undefined = undefined;
onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
//InitFont->Copy Res/resfile/font to sandbox
@ -64,12 +62,12 @@ export default class EntryAbility extends UIAbility {
console.error(`Failed to obtain the main window. Code: ${err.code}, message: ${err.message}`);
return;
}
this.mainWindow = data;
mwInfo.id = this.mainWindow.getWindowProperties().id;
mwInfo.mainWin = data;
mwInfo.id =data.getWindowProperties().id;
//moveWindowTo
this.mainWindow.moveWindowTo(50, 50)
data.moveWindowTo(50, 50)
//resize mainWindow Size
this.mainWindow.resize(mwInfo.width, mwInfo.height, (err) => {
data.resize(mwInfo.width, mwInfo.height, (err) => {
if (err.code) {
console.error(`Failed to resize the window. Code: ${err.code}, message: ${err.message}`);
return;
@ -78,7 +76,7 @@ export default class EntryAbility extends UIAbility {
});
// windowSizeChangeListener to Change mainWindowWidth&&mainWindowHeight in AppStorage
this.mainWindow.on('windowSizeChange', (ChangeData) => {
data.on('windowSizeChange', (ChangeData) => {
// if Size Change save to AppStorage
mwInfo.width = ChangeData.width;
mwInfo.height = ChangeData.height;
@ -87,8 +85,8 @@ export default class EntryAbility extends UIAbility {
});
let color: string = '#00000000';
try {
this.mainWindow.setWindowBackgroundColor(color);
this.mainWindow.setWindowShadowEnabled(true);
data.setWindowBackgroundColor(color);
data.setWindowShadowEnabled(true);
} catch (exception) {
console.error(`Failed to set the background color. Cause code: ${exception.code}, message: ${exception.message}`);
};
@ -97,8 +95,8 @@ export default class EntryAbility extends UIAbility {
onWindowStageDestroy(): void {
AppStorageV2.remove<MainWindowStageInfo>(MainWindowStageInfo);
if (this.mainWindow) {
this.mainWindow = undefined;
if (mwInfo.mainWin) {
mwInfo.mainWin = undefined;
}
// Main window is destroyed, release UI related resources
hilog.info(DOMAIN, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');

View File

@ -1,5 +1,5 @@
import { hilog } from '@kit.PerformanceAnalysisKit';
import { Execute } from '../EventSubWin/ExCom';
import { Execute } from '../EventHub/EventBase';
import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface";
import { TitleModel } from "../LayoutInterface/Interface/ModelInterface";
import { TitleTabData } from '../LayoutInterface/Layout/TitleTabData';

View File

@ -1,5 +1,5 @@
import { mwInfo } from '../DispWinInfo/DispWinInfo'
import { Execute } from "../EventSubWin/ExCom";
import { Execute } from "../EventHub/EventBase";
import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface";
import {SwitchView} from "../LayoutInterface/Layout/SwitchView"

View File

@ -1,6 +1,6 @@
import { TitleGroup } from "../LayoutInterface/Interface/GroupInterface";
import { TitleButton } from "../LayoutInterface/Interface/ButtonInterface";
import { Execute } from "../EventSubWin/ExCom";
import { Execute } from "../EventHub/EventBase";
import { mwInfo } from '../DispWinInfo/DispWinInfo'
import { BaseMenuData } from "../LayoutInterface/Interface/MenuInterface";

View File

@ -1,7 +1,7 @@
import { AppStorageV2, display,window} from '@kit.ArkUI';
import { AppStorageV2, display,window ,UIContext} from '@kit.ArkUI';
//该文档主要储存屏幕信息,主窗口信息,窗口管理信息
//底部有全局信息变量,已导出,其他page只需要import该文件即可调用let变量
@ObservedV2
export class MainDisplayInfo {
@Trace public id: number;
@ -18,23 +18,24 @@ export class MainDisplayInfo {
@ObservedV2
export class MainWindowInfo {
@Trace public id: number;
@Trace public mainWin: window.Window|undefined;
@Trace public width: number;
@Trace public height: number;
constructor(_id?:number,_width?: number, _height?: number) {
constructor(_id?:number,_mainWin?:window.Window,_width?: number, _height?: number) {
this.id = _width ?? 0;
this.mainWin=_mainWin ?? undefined;
this.width = _height ?? 0;
this.height=_id?? 0;
this.height=_id ?? 0;
}
}
@ObservedV2
export class MainWindowStageInfo {
@Trace public winStage: window.WindowStage| undefined;
@Trace public winStage?: window.WindowStage;
constructor(_ws?: window.WindowStage) {
this.winStage = _ws ?? undefined;
this.winStage = _ws;
}
}
@ -45,8 +46,10 @@ export async function InitGlobalDisplayWindowInfo(windowStage: window.WindowStag
mainDisplayInfo.id = display.getDefaultDisplaySync().id;
mainDisplayInfo.width = display.getDefaultDisplaySync().width;
mainDisplayInfo.height = display.getDefaultDisplaySync().height;
mainWindowInfo.width = mainDisplayInfo.width-100;
mainWindowInfo.height = mainDisplayInfo.height-200;
mainWindowStage.winStage = windowStage;
console.error(`Display Size:`,mainDisplayInfo.width,mainDisplayInfo.height);
console.error(`MainWindow Size:`,mainWindowInfo.width,mainWindowInfo.height);

View File

@ -0,0 +1,41 @@
import { TitleButton } from '../LayoutInterface/Interface/ButtonInterface';
import { EventType } from '../LayoutInterface/Interface/BaseTypeInterface'
import {EventExecute} from './EventExecute'
import {EventPage} from './EventPage'
//执行事件
export function Execute(event:TitleButton){
if(event.btnEvent.type==EventType.EVENT){
EventExecute(event);
}else{
EventPage(event);
}
}
//随机ID
export function RndId(): string {
// 获取当前时间戳(毫秒)
const now = Date.now();
// 取时间戳的最后几位例如4位作为基础部分
const timePart = parseInt(now.toString().slice(-4));
// 生成剩余的4位随机数
const randomPart = Math.floor(Math.random() * 10000);
// 组合两部分并取模和偏移以确保在8位数范围内
// 例如: timePart (0-9999) + randomPart (0-9999) -> sum (0-19998)
// 需要将其映射到 [10000000, 99999999]
// 结果在 [0, 89999999]
const combined = (timePart * 10000 + randomPart) % 90000000;
// 调整范围到 [10000000, 99999999]
return (combined + 10000000).toString();
}
//当前时间
export function CurrentTime():string {
let now = new Date();
// 格式化时间字符串
let year = now.getFullYear().toString();
let month = (now.getMonth() + 1).toString().padStart(2, '0'); // padStart 确保月份是两位数
let date = now.getDate().toString().padStart(2, '0');
let hours = now.getHours().toString().padStart(2, '0');
let minutes = now.getMinutes().toString().padStart(2, '0');
let seconds = now.getSeconds().toString().padStart(2, '0');
return`${year}-${month}-${date} ${hours}:${minutes}:${seconds}`;
}

View File

@ -0,0 +1,31 @@
import { TitleButton } from '../LayoutInterface/Interface/ButtonInterface';
import { CreateXCompNode } from './XCompMgr';
import NativeOpenCAX from 'libopencax.so';
//事件类型:纯指令
export function EventExecute(event:TitleButton){
//事件处理
if(event?.btnEvent.command=='Execute_LoadModel'){
NativeOpenCAX.loadModel("/data/storage/el2/base/haps/entry/files/example/2027.stp");
}
if(event?.btnEvent.command=='Create_New'){
CreateXCompNode("");
}
//视图切换
if(event?.btnEvent.command=='CMD_VIEW_FRONT'){
NativeOpenCAX.switchView("CMD_VIEW_FRONT");
}else if(event?.btnEvent.command=='CMD_VIEW_TOP'){
NativeOpenCAX.switchView("CMD_VIEW_TOP");
}else if(event?.btnEvent.command=='CMD_VIEW_LEFT_SIDE'){
NativeOpenCAX.switchView("CMD_VIEW_LEFT_SIDE");
}else if(event?.btnEvent.command=='CMD_VIEW_RIGHT_SIDE'){
NativeOpenCAX.switchView("CMD_VIEW_RIGHT_SIDE");
}else if(event?.btnEvent.command=='CMD_VIEW_BOTTOM'){
NativeOpenCAX.switchView("CMD_VIEW_BOTTOM");
}else if(event?.btnEvent.command=='CMD_VIEW_REAR'){
NativeOpenCAX.switchView("CMD_VIEW_REAR");
}else if(event?.btnEvent.command=='CMD_VIEW_ISO'){
NativeOpenCAX.switchView("CMD_VIEW_ISO");
}else if(event?.btnEvent.command=='CMD_VIEW_DIM'){
NativeOpenCAX.switchView("CMD_VIEW_DIM");
}
}

View File

@ -0,0 +1,38 @@
import { mwInfo } from '../DispWinInfo/DispWinInfo';
import { CloseSubWindow, CreateAndShowSubWindow, SubWinInfo } from '../SubWindow/SWBase';
import { TitleButton } from '../LayoutInterface/Interface/ButtonInterface';
//事件类型:页面
export function EventPage(event:TitleButton){
//打开文件
if(event?.btnEvent.command=='Execute_OpenFile') {
const winInfo: SubWinInfo = new SubWinInfo(event.btnName, event.btnEvent.page, mwInfo.width * 0.5, mwInfo.height * 0.3);
CreateAndShowSubWindow(winInfo);
}
//窗体打开
if(event?.btnEvent.command=='Execute_CreateSubWindow'){
const winInfo:SubWinInfo=new SubWinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.3,mwInfo.height*0.9);
CreateAndShowSubWindow(winInfo);
}else if(event?.btnEvent.command=='Execute_ExitSubWindow'){
CloseSubWindow();
} else if(event?.btnEvent.command=='Execute_CreateSubWindow_Options'){
const winInfo:SubWinInfo=new SubWinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.6,mwInfo.height*0.9);
CreateAndShowSubWindow(winInfo);
} else if(event?.btnEvent.command=='Execute_NewFileWindow'){
const winInfo:SubWinInfo=new SubWinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.4,mwInfo.height*0.4);
CreateAndShowSubWindow(winInfo);
}else if(event?.btnEvent.command=='Execute_SaveAsFileWindow'){
const winInfo:SubWinInfo=new SubWinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.4,mwInfo.height*0.4);
CreateAndShowSubWindow(winInfo);
}else if(event?.btnEvent.command=='Execute_ImportFileWindow'){
const winInfo:SubWinInfo=new SubWinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.4,mwInfo.height*0.4);
CreateAndShowSubWindow(winInfo);
}else if(event?.btnEvent.command=='Execute_ExportFileWindow'){
const winInfo:SubWinInfo=new SubWinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.4,mwInfo.height*0.4);
CreateAndShowSubWindow(winInfo);
} else if(event?.btnEvent.command=='Open_NewModel'){
const winInfo:SubWinInfo=new SubWinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.6,mwInfo.height*0.9);
CreateAndShowSubWindow(winInfo);
} else if(event?.btnEvent.command=='Execute_ExitSubWindow_Options'){
CloseSubWindow();
}
}

View File

@ -0,0 +1,67 @@
import { AppStorageV2, NodeContent } from "@kit.ArkUI";
import {RndId} from './EventBase'
import NativeOpenCAX from 'libopencax.so';
@ObservedV2
export class XCompInfo{
@Trace nId?:string;
@Trace xId?:string;
@Trace name?:string;
@Trace icon?:string;
@Trace node?:NodeContent;
constructor(_nId?:string,_xId?: string, _name?: string,_icon?:string,_node?:NodeContent) {
this.nId = _nId ?? undefined;
this.xId = _xId ?? undefined;
this.name=_name?? undefined;
this.icon=_icon?? undefined;
this.node=_node?? undefined;
}
}
@ObservedV2
export class XCompInfos{
@Trace infos?:Array<XCompInfo>;
constructor(_infos?:Array<XCompInfo>) {
this.infos = _infos ?? undefined;
}
}
export let xcInfos:XCompInfos = AppStorageV2.connect<XCompInfos>(XCompInfos, () => new XCompInfos)!;
export let ctInfo: XCompInfo = AppStorageV2.connect<XCompInfo>(XCompInfo, () => new XCompInfo)!;
//初始化全局XComp管理
export function InitXCompNode(){
//数组为0表示初始化,Native侧这初始化主上下文,否则Native侧初始化共享上下文
const xcIs:XCompInfos = AppStorageV2.connect<XCompInfos>(XCompInfos, () => new XCompInfos)!;
xcIs.infos=new Array<XCompInfo>;
}
//创建XComp组件
export function CreateXCompNode(name:string){
const xcIs:XCompInfos = AppStorageV2.connect<XCompInfos>(XCompInfos, () => new XCompInfos)!;
let xInfo:XCompInfo=new XCompInfo;
let initType:boolean=true;
xInfo.nId='n_'+RndId();
xInfo.xId='x_'+RndId();
xInfo.name=name+xInfo.xId;
xInfo.node=new NodeContent();
if((xcIs.infos as Array<XCompInfo>).length>0)
{
initType=true;
}else{
initType=false;
}
NativeOpenCAX.InitNativeNode(xInfo.nId,xInfo.xId,initType,xInfo.node);
(xcIs.infos as Array<XCompInfo>).push(xInfo);
console.log(`ArkUI Node ID: ${xInfo.nId}`);
console.log(`ArkUI XComp ID: ${xInfo.xId}`);
}
//获取当前XComp组件
export function CurrentXCompIndex(id:number):XCompInfo{
const xcIs:XCompInfos = AppStorageV2.connect<XCompInfos>(XCompInfos, () => new XCompInfos)!;
return ctInfo=(xcIs.infos as Array<XCompInfo>)[id];
}

View File

@ -1,152 +0,0 @@
import { TitleButton } from '../LayoutInterface/Interface/ButtonInterface';
import { CloseSubWindow, CreateAndShowSubWindow, WinInfo} from './SWBase';
import NativeOpenCAX from 'libopencax.so';
import { mwInfo } from '../DispWinInfo/DispWinInfo'
import { AppStorageV2, NodeContent} from '@kit.ArkUI';
import { ModelViewTab } from '../ModelViewTab';
import {EventType} from '../LayoutInterface/Interface/BaseTypeInterface'
@ObservedV2
export class XCompInfo{
@Trace nId?:string;
@Trace xId?:string;
@Trace name?:string;
@Trace icon?:string;
@Trace node?:NodeContent;
constructor(_nId?:string,_xId?: string, _name?: string,_icon?:string,_node?:NodeContent) {
this.nId = _nId ?? undefined;
this.xId = _xId ?? undefined;
this.name=_name?? undefined;
this.icon=_icon?? undefined;
this.node=_node?? undefined;
}
}
@ObservedV2
export class XCompInfos{
@Trace infos?:Array<XCompInfo>;
constructor(_infos?:Array<XCompInfo>) {
this.infos = _infos ?? undefined;
}
}
export let xcInfos:XCompInfos = AppStorageV2.connect<XCompInfos>(XCompInfos, () => new XCompInfos)!;
export let ctInfo: XCompInfo = AppStorageV2.connect<XCompInfo>(XCompInfo, () => new XCompInfo)!;
export function XNRandomId(): string {
// 获取当前时间戳(毫秒)
const now = Date.now();
// 取时间戳的最后几位例如4位作为基础部分
const timePart = parseInt(now.toString().slice(-4));
// 生成剩余的4位随机数
const randomPart = Math.floor(Math.random() * 10000);
// 组合两部分并取模和偏移以确保在8位数范围内
// 例如: timePart (0-9999) + randomPart (0-9999) -> sum (0-19998)
// 需要将其映射到 [10000000, 99999999]
// 结果在 [0, 89999999]
const combined = (timePart * 10000 + randomPart) % 90000000;
// 调整范围到 [10000000, 99999999]
return (combined + 10000000).toString();
}
//初始化全局XComp管理
export function InitXCompNode(){
//数组为0表示初始化,Native侧这初始化主上下文,否则Native侧初始化共享上下文
const xcIs:XCompInfos = AppStorageV2.connect<XCompInfos>(XCompInfos, () => new XCompInfos)!;
xcIs.infos=new Array<XCompInfo>;
}
//创建XComp组件
export function CreateXCompNode(name:string){
const xcIs:XCompInfos = AppStorageV2.connect<XCompInfos>(XCompInfos, () => new XCompInfos)!;
let xInfo:XCompInfo=new XCompInfo;
xInfo.nId='n_'+XNRandomId();
xInfo.xId='x_'+XNRandomId();
xInfo.name=name+xInfo.xId;
xInfo.node=new NodeContent();
if((xcIs.infos as Array<XCompInfo>).length>0)
{
NativeOpenCAX.InitNativeNode(xInfo.nId,xInfo.xId,true,xInfo.node);
}else{
NativeOpenCAX.InitNativeNode(xInfo.nId,xInfo.xId,false,xInfo.node);
}
(xcIs.infos as Array<XCompInfo>).push(xInfo);
console.log(`ArkUI Node ID: ${xInfo.nId}`);
console.log(`ArkUI XComp ID: ${xInfo.xId}`);
}
//获取当前XComp组件
export function CurrentXCompIndex(id:number):XCompInfo{
const xcIs:XCompInfos = AppStorageV2.connect<XCompInfos>(XCompInfos, () => new XCompInfos)!;
return ctInfo=(xcIs.infos as Array<XCompInfo>)[id];
}
//执行事件
export function Execute(event:TitleButton){
if(event.btnEvent.type==EventType.EVENT){
ExecuteCommand(event);
}else{
ExecutePage(event);
}
}
//事件类型:页面
export function ExecutePage(event:TitleButton){
//打开文件
if(event?.btnEvent.command=='Execute_OpenFile') {
const winInfo: WinInfo = new WinInfo(event.btnName, event.btnEvent.page, mwInfo.width * 0.5, mwInfo.height * 0.3);
CreateAndShowSubWindow(winInfo);
}
//窗体打开
if(event?.btnEvent.command=='Execute_CreateSubWindow'){
const winInfo:WinInfo=new WinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.3,mwInfo.height*0.9);
CreateAndShowSubWindow(winInfo);
}else if(event?.btnEvent.command=='Execute_ExitSubWindow'){
CloseSubWindow();
} else if(event?.btnEvent.command=='Execute_CreateSubWindow_Options'){
const winInfo:WinInfo=new WinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.6,mwInfo.height*0.9);
CreateAndShowSubWindow(winInfo);
} else if(event?.btnEvent.command=='Execute_NewFileWindow'){
const winInfo:WinInfo=new WinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.4,mwInfo.height*0.4);
CreateAndShowSubWindow(winInfo);
}else if(event?.btnEvent.command=='Execute_SaveAsFileWindow'){
const winInfo:WinInfo=new WinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.4,mwInfo.height*0.4);
CreateAndShowSubWindow(winInfo);
}else if(event?.btnEvent.command=='Execute_ImportFileWindow'){
const winInfo:WinInfo=new WinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.4,mwInfo.height*0.4);
CreateAndShowSubWindow(winInfo);
}else if(event?.btnEvent.command=='Execute_ExportFileWindow'){
const winInfo:WinInfo=new WinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.4,mwInfo.height*0.4);
CreateAndShowSubWindow(winInfo);
} else if(event?.btnEvent.command=='Open_NewModel'){
const winInfo:WinInfo=new WinInfo(event.btnName,event.btnEvent.page,mwInfo.width*0.6,mwInfo.height*0.9);
CreateAndShowSubWindow(winInfo);
} else if(event?.btnEvent.command=='Execute_ExitSubWindow_Options'){
CloseSubWindow();
}
}
//事件类型:纯指令
export function ExecuteCommand(event:TitleButton){
//事件处理
if(event?.btnEvent.command=='Execute_LoadModel'){
NativeOpenCAX.loadModel("/data/storage/el2/base/haps/entry/files/example/2027.stp");
}
if(event?.btnEvent.command=='Create_New'){
CreateXCompNode("");
}
//视图切换
if(event?.btnEvent.command=='CMD_VIEW_FRONT'){
NativeOpenCAX.switchView("CMD_VIEW_FRONT");
}else if(event?.btnEvent.command=='CMD_VIEW_TOP'){
NativeOpenCAX.switchView("CMD_VIEW_TOP");
}else if(event?.btnEvent.command=='CMD_VIEW_LEFT_SIDE'){
NativeOpenCAX.switchView("CMD_VIEW_LEFT_SIDE");
}else if(event?.btnEvent.command=='CMD_VIEW_RIGHT_SIDE'){
NativeOpenCAX.switchView("CMD_VIEW_RIGHT_SIDE");
}else if(event?.btnEvent.command=='CMD_VIEW_BOTTOM'){
NativeOpenCAX.switchView("CMD_VIEW_BOTTOM");
}else if(event?.btnEvent.command=='CMD_VIEW_REAR'){
NativeOpenCAX.switchView("CMD_VIEW_REAR");
}else if(event?.btnEvent.command=='CMD_VIEW_ISO'){
NativeOpenCAX.switchView("CMD_VIEW_ISO");
}else if(event?.btnEvent.command=='CMD_VIEW_DIM'){
NativeOpenCAX.switchView("CMD_VIEW_DIM");
}
}

View File

@ -1,71 +0,0 @@
import { BusinessError } from '@kit.BasicServicesKit';
import { window} from '@kit.ArkUI';
import { mwInfo, mwsInfo } from '../DispWinInfo/DispWinInfo'
let subWindow: window.Window | undefined = undefined;
export class WinInfo{
name:string|undefined=undefined;
page:string|undefined=undefined;
width:number=0;
height:number=0;
constructor(name?: string, page?: string,width?: number,height?: number) {
this.name = name??undefined;
this.page = page ?? undefined;
this.width = width ?? 0;
this.height = height ?? 0;
}
}
export async function CreateAndShowSubWindow(winInfo:WinInfo) {
try {
if(mwsInfo.winStage==null){
console.error('Failed to create the subwindow. Cause: windowStage is null');
return;
}
let options: window.SubWindowOptions = {
title: winInfo.name as string,
decorEnabled: true,
isModal: false,
maximizeSupported: false,
outlineEnabled:true,
};
console.info('SubWindow Size:',winInfo.width,winInfo.height)
await mwsInfo.winStage.createSubWindowWithOptions('subWindow', options).then((data) => {
subWindow = data;
//子窗口创建成功后,设置子窗口的位置、大小及相关属性等。
subWindow.moveWindowTo(200, 200)
//子窗口重置大小
console.info("页面路径:", winInfo.page);
subWindow.resize(winInfo.width,winInfo.height);
subWindow.setUIContent(winInfo.page, (err: BusinessError) => {
if (err.code) {
console.error("加载页面失败:", err);
return;
}
})
// 显示窗口
subWindow.showWindow((err) => {
if (err.code) {
console.error("显示窗口失败:", err);
}
});
subWindow.setResizeByDragEnabled(false);
})
} catch (error) {
console.error('Failed to create or show sub window:', (error as BusinessError).message);
}
}
export function CloseSubWindow() {
if (subWindow) {
try {
subWindow.destroy();
subWindow = undefined;
console.info('Sub window closed.');
} catch (error) {
console.error('Failed to close sub window:', (error as BusinessError).message);
}
}
}

View File

@ -20,7 +20,7 @@ export let DevModel:TitleModel= {
{btnModel:[ModelType.BASE],btnName:'新建建模实例',btnNamed:'',btnIcon:'base_new_file',btnTips:'新建建模实例',btnEvent:{uid:'',command:'Create_New',page:'',type:EventType.EVENT,args:[]}},
[
{btnModel:[ModelType.BASE],btnName:'加载模型',btnNamed:'',btnIcon:'base_new_file',btnTips:'加载模型',btnEvent:{uid:'',command:'Execute_LoadModel',type:EventType.EVENT,args:[]}},
{btnModel:[ModelType.BASE],btnName:'选择加载模型',btnNamed:'',btnIcon:'base_new_file',btnTips:'选择加载模型',btnEvent:{uid:'',command:'Execute_OpenFile',page:'pages/EventSubWin/File/SWOpenFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'选择加载模型',btnNamed:'',btnIcon:'base_new_file',btnTips:'选择加载模型',btnEvent:{uid:'',command:'Execute_OpenFile',page:'pages/SubWindow/File/SWOpenFile',type:EventType.PAGE,args:[]}},
],
[
{btnModel:[ModelType.BASE],btnName:'正等轴测图',btnNamed:'',btnIcon:'base_new_file',btnTips:'正等轴测图',btnEvent:{uid:'',command:'CMD_VIEW_ISO',page:'',type:EventType.EVENT,args:[]}},
@ -33,14 +33,14 @@ export let DevModel:TitleModel= {
{btnModel:[ModelType.BASE],btnName:'仰视图',btnNamed:'',btnIcon:'base_new_file',btnTips:'仰视图',btnEvent:{uid:'',command:'CMD_VIEW_BOTTOM',page:'',type:EventType.EVENT,args:[]}},
],
[
{btnModel:[ModelType.BASE],btnName:'创建文件',btnNamed:'',btnIcon:'base_new_file',btnTips:'创建文件',btnEvent:{uid:'',command:'Execute_NewFileWindow',page:'pages/EventSubWin/File/SWNewFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'另存为',btnNamed:'',btnIcon:'base_new_file',btnTips:'另存为',btnEvent:{uid:'',command:'Execute_SaveAsFileWindow',page:'pages/EventSubWin/File/SWSaveAsFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'导入文件',btnNamed:'',btnIcon:'base_new_file',btnTips:'导入文件',btnEvent:{uid:'',command:'Execute_ImportFileWindow',page:'pages/EventSubWin/File/SWImportFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'导出文件',btnNamed:'',btnIcon:'base_new_file',btnTips:'导出文件',btnEvent:{uid:'',command:'Execute_ExportFileWindow',page:'pages/EventSubWin/File/SWExportFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'创建子窗体',btnNamed:'',btnIcon:'base_new_file',btnTips:'创建子窗体',btnEvent:{uid:'',command:'Execute_CreateSubWindow',page:'pages/EventSubWin/SWExtrude',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'关闭子窗体',btnNamed:'',btnIcon:'base_new_file',btnTips:'关闭子窗体',btnEvent:{uid:'',command:'Execute_ExitSubWindow',page:'pages/EventSubWin/SWExtrude',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'首选项',btnNamed:'',btnIcon:'base_new_file',btnTips:'首选项',btnEvent:{uid:'',command:'Execute_CreateSubWindow_Options',page:'pages/EventSubWin/Options',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'关闭',btnNamed:'',btnIcon:'base_new_file',btnTips:'关闭',btnEvent:{uid:'',command:'Execute_ExitSubWindow_Options',page:'pages/EventSubWin/Options',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'创建文件',btnNamed:'',btnIcon:'base_new_file',btnTips:'创建文件',btnEvent:{uid:'',command:'Execute_NewFileWindow',page:'pages/SubWindow/File/SWNewFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'另存为',btnNamed:'',btnIcon:'base_new_file',btnTips:'另存为',btnEvent:{uid:'',command:'Execute_SaveAsFileWindow',page:'pages/SubWindow/File/SWSaveAsFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'导入文件',btnNamed:'',btnIcon:'base_new_file',btnTips:'导入文件',btnEvent:{uid:'',command:'Execute_ImportFileWindow',page:'pages/SubWindow/File/SWImportFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'导出文件',btnNamed:'',btnIcon:'base_new_file',btnTips:'导出文件',btnEvent:{uid:'',command:'Execute_ExportFileWindow',page:'pages/SubWindow/File/SWExportFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'创建子窗体',btnNamed:'',btnIcon:'base_new_file',btnTips:'创建子窗体',btnEvent:{uid:'',command:'Execute_CreateSubWindow',page:'pages/SubWindow/SWExtrude',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'关闭子窗体',btnNamed:'',btnIcon:'base_new_file',btnTips:'关闭子窗体',btnEvent:{uid:'',command:'Execute_ExitSubWindow',page:'pages/SubWindow/SWExtrude',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'首选项',btnNamed:'',btnIcon:'base_new_file',btnTips:'首选项',btnEvent:{uid:'',command:'Execute_CreateSubWindow_Options',page:'pages/SubWindow/Options',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'关闭',btnNamed:'',btnIcon:'base_new_file',btnTips:'关闭',btnEvent:{uid:'',command:'Execute_ExitSubWindow_Options',page:'pages/SubWindow/Options',type:EventType.PAGE,args:[]}},
]
],grpMenu:GroupActionMenu}] as Array<TitleGroup>

View File

@ -10,17 +10,17 @@ export let TitleDefaultBars:Array<TitleModel>=
{cmName:'主页',cmPage:'',cmTips:'',cmEvents:
[[[{ grpName:'文件', grpBtn:
[
{btnModel:[ModelType.BASE],btnName:'新建',btnNamed:'',btnIcon:'base_new_file',btnTips:'新建',btnEvent:{uid:'',command:'Execute_NewFileWindow',page:'pages/EventSubWin/File/SWNewFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'打开',btnNamed:'',btnIcon:'base_open_file',btnTips:'打开',btnEvent:{uid:'',command:'Execute_OpenFile',page:'pages/EventSubWin/File/SWOpenFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'新建',btnNamed:'',btnIcon:'base_new_file',btnTips:'新建',btnEvent:{uid:'',command:'Execute_NewFileWindow',page:'pages/SubWindow/File/SWNewFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'打开',btnNamed:'',btnIcon:'base_open_file',btnTips:'打开',btnEvent:{uid:'',command:'Execute_OpenFile',page:'pages/SubWindow/File/SWOpenFile',type:EventType.PAGE,args:[]}},
[
{btnModel:[ModelType.BASE],btnName:'保存',btnNamed:'',btnIcon:'base_save_file',btnTips:'保存',btnEvent:{uid:'',command:'CMD_VIEW_ISO',page:'',type:EventType.EVENT,args:[]}},
{btnModel:[ModelType.BASE],btnName:'另存为',btnNamed:'',btnIcon:'base_saveas_file',btnTips:'另存为',btnEvent:{uid:'',command:'Execute_SaveAsFileWindow',page:'pages/EventSubWin/File/SWSaveAsFile',type:EventType.EVENT,args:[]}},
{btnModel:[ModelType.BASE],btnName:'另存为',btnNamed:'',btnIcon:'base_saveas_file',btnTips:'另存为',btnEvent:{uid:'',command:'Execute_SaveAsFileWindow',page:'pages/SubWindow/File/SWSaveAsFile',type:EventType.EVENT,args:[]}},
{btnModel:[ModelType.BASE],btnName:'保存全部',btnNamed:'',btnIcon:'base_saveall_file',btnTips:'保存全部',btnEvent:{uid:'',command:'CMD_VIEW_ISO',page:'',type:EventType.EVENT,args:[]}},
] as Array<TitleButton>,
{btnModel:[ModelType.BASE],btnName:'关闭',btnNamed:'',btnIcon:'base_close_file',btnTips:'关闭',btnEvent:{uid:'',command:'CMD_VIEW_ISO',page:'',type:EventType.EVENT,args:[]}},
{btnModel:[ModelType.BASE],btnName:'导入',btnNamed:'',btnIcon:'base_import_file',btnTips:'导入',btnEvent:{uid:'',command:'Execute_ImportFileWindow',page:'pages/EventSubWin/File/SWImportFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'导出',btnNamed:'',btnIcon:'base_export_file',btnTips:'导出',btnEvent:{uid:'',command:'Execute_ExportFileWindow',page:'pages/EventSubWin/File/SWExportFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'选项',btnNamed:'',btnIcon:'base_properties',btnTips:'选项',btnEvent:{uid:'',command:'Execute_CreateSubWindow_Options',page:'pages/EventSubWin/Options',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'导入',btnNamed:'',btnIcon:'base_import_file',btnTips:'导入',btnEvent:{uid:'',command:'Execute_ImportFileWindow',page:'pages/SubWindow/File/SWImportFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'导出',btnNamed:'',btnIcon:'base_export_file',btnTips:'导出',btnEvent:{uid:'',command:'Execute_ExportFileWindow',page:'pages/SubWindow/File/SWExportFile',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'选项',btnNamed:'',btnIcon:'base_properties',btnTips:'选项',btnEvent:{uid:'',command:'Execute_CreateSubWindow_Options',page:'pages/SubWindow/Options',type:EventType.PAGE,args:[]}},
{btnModel:[ModelType.BASE],btnName:'帮助',btnNamed:'',btnIcon:'base_help_file',btnTips:'帮助',btnEvent:{uid:'',command:'CMD_VIEW_ISO',page:'',type:EventType.EVENT,args:[]}},
], grpMenu:GroupActionMenu }] as Array<TitleGroup>]]},
MatrixModel,

View File

@ -1,7 +1,7 @@
import { hilog } from '@kit.PerformanceAnalysisKit';
import { mwInfo } from './DispWinInfo/DispWinInfo'
import { AppStorageV2 } from '@kit.ArkUI';
import {InitXCompNode,XCompInfos,XCompInfo,CurrentXCompIndex} from './EventSubWin/ExCom'
import {InitXCompNode,XCompInfos,XCompInfo,CurrentXCompIndex} from './EventHub/XCompMgr'
@ComponentV2

View File

@ -2,23 +2,11 @@ import { common } from '@kit.AbilityKit';
import { picker } from '@kit.CoreFileKit';
import type { BusinessError } from '@kit.BasicServicesKit';
import { TextComboBox } from "../../CustomController/ComboBox";
import {XNRandomId} from '../ExCom'
import { CreateModelType,DocUnitsType } from './FileStr';
import { mwInfo } from '../../DispWinInfo/DispWinInfo'
import { mwInfo,mwsInfo } from '../../DispWinInfo/DispWinInfo'
import {CurrentTime,RndId} from '../../EventHub/EventBase'
import { window } from '@kit.ArkUI';
function CurrentTime():string {
let now = new Date();
// 格式化时间字符串
let year = now.getFullYear().toString();
let month = (now.getMonth() + 1).toString().padStart(2, '0'); // padStart 确保月份是两位数
let date = now.getDate().toString().padStart(2, '0');
let hours = now.getHours().toString().padStart(2, '0');
let minutes = now.getMinutes().toString().padStart(2, '0');
let seconds = now.getSeconds().toString().padStart(2, '0');
return`${year}-${month}-${date} ${hours}:${minutes}:${seconds}`;
}
@Entry
@ComponentV2
export struct SWNewFile {
@ -29,9 +17,36 @@ export struct SWNewFile {
@Local scaleBtn:number=0.05;
//文本宽度统一缩放系数
@Local scalingText:number=0.04;
@Local subWin: window.Window | undefined = undefined;
aboutToAppear(): void {
this.docCreateTime=CurrentTime();
}
async initSubWindow(){
this.subWin= await mwsInfo.winStage?.createSubWindow('dirPicker');
this.subWin?.loadContent('pages/SubWindow/File/SWNewFile');
}
async selectDir(): Promise<string>{
let selectDirStr='';
let context =this.getUIContext().getHostContext() as common.Context;
if(this.subWin){
this.subWin.destroyWindow();
}
await this.initSubWindow();
try {
let documentSelectOptions = new picker.DocumentSelectOptions();
let documentPicker = new picker.DocumentViewPicker(context,this.subWin as window.Window);
documentSelectOptions.selectMode=picker.DocumentSelectMode.FOLDER;
documentPicker.select(documentSelectOptions,(err: BusinessError,documentSelectResult: Array<string>) => {
selectDirStr =documentSelectResult.toString();
})
} catch (error) {
const err: BusinessError = error as BusinessError;
console.error(`DocumentViewPicker failed with err: ${err.code}, ${err.message}`);
}
return selectDirStr;
}
build() {
Column({space:5}) {
Row({space:5}){
@ -54,21 +69,8 @@ export struct SWNewFile {
.fontColor($r('sys.color.font_emphasize'))
.fontWeight(FontWeight.Medium)
.fontSize($r('sys.float.Body_L'))
.onClick(() => {
let context = getContext(this) as common.Context;
try {
let documentSelectOptions = new picker.DocumentSelectOptions();
let documentPicker = new picker.DocumentViewPicker(context);
documentPicker.select(documentSelectOptions,(err: BusinessError,documentSelectResult: Array<string>) => {
this.dir =documentSelectResult.toString();
if (documentSelectResult.length === 0) {
return;
}
})
} catch (error) {
const err: BusinessError = error as BusinessError;
console.error(`DocumentViewPicker failed with err: ${err.code}, ${err.message}`);
}
.onClick(async () => {
this.dir= await this.selectDir();
})
}.height('10%')
Row({space:5}){
@ -81,7 +83,7 @@ export struct SWNewFile {
.fontWeight(FontWeight.Medium)
.fontSize($r('sys.float.Body_L'))
.onClick(() => {
this.fileName='OpenCAX_'+XNRandomId();
this.fileName='OpenCAX_'+RndId();
})
}.height('10%')
Row({space:5}){

View File

@ -0,0 +1,75 @@
import { BusinessError } from '@kit.BasicServicesKit';
import { window } from '@kit.ArkUI';
import { mwsInfo } from '../DispWinInfo/DispWinInfo'
//窗体信息
export class SubWinInfo{
name?:string;
page?:string;
subWin?:window.Window;
subOpt?:window.SubWindowOptions;
subPointX?:number=200;
subPointY?:number=200;
width?:number=0;
height?:number=0;
constructor(name?: string, page?: string,width?: number,height?: number) {
this.name = name;
this.page = page;
this.width = width;
this.height = height;
}
}
//窗体保存容器
let subWins:Map<string,SubWinInfo>=new Map<string,SubWinInfo>;
export async function CreateAndShowSubWindow(subWinInfo:SubWinInfo) {
try {
if(mwsInfo.winStage==null){
console.error('Failed to create the subwindow. Cause: windowStage is null');
return;
}
let options: window.SubWindowOptions = {
title: subWinInfo.name as string,
decorEnabled: true,
isModal: false,
maximizeSupported: false,
outlineEnabled:true,
};
console.info('SubWindow Size:',subWinInfo.width,subWinInfo.height)
await mwsInfo.winStage.createSubWindowWithOptions(subWinInfo.name as string, options).then((data) => {
console.info("页面路径:", subWinInfo.page);
subWinInfo.subWin = data;
//子窗口显示位置
data.moveWindowTo(subWinInfo.subPointX, subWinInfo.subPointY)
//子窗口重置大小
data.resize(subWinInfo.width,subWinInfo.height);
data.setUIContent(subWinInfo.page, (err: BusinessError) => {
if (err.code) {
console.error("加载页面失败:", err);
return;
}
})
// 显示窗口
data.showWindow((err) => {
if (err.code) {
console.error("显示窗口失败:", err);
}
});
data.setResizeByDragEnabled(false);
})
subWins[subWinInfo.name as string]=subWinInfo;
} catch (error) {
console.error('Failed to create or show sub window:', (error as BusinessError).message);
}
}
export function CloseSubWindow() {
try {
console.info('Sub window closed.');
} catch (error) {
console.error('Failed to close sub window:', (error as BusinessError).message);
}
}

View File

@ -1,13 +1,13 @@
{
"src": [
"pages/Index",
"pages/EventSubWin/SWLine",
"pages/EventSubWin/SWExtrude",
"pages/EventSubWin/Options",
"pages/EventSubWin/File/SWNewFile",
"pages/EventSubWin/File/SWSaveAsFile",
"pages/EventSubWin/File/SWImportFile",
"pages/EventSubWin/File/SWExportFile",
"pages/EventSubWin/File/SWOpenFile"
"pages/SubWindow/SWLine",
"pages/SubWindow/SWExtrude",
"pages/SubWindow/Options",
"pages/SubWindow/File/SWNewFile",
"pages/SubWindow/File/SWSaveAsFile",
"pages/SubWindow/File/SWImportFile",
"pages/SubWindow/File/SWExportFile",
"pages/SubWindow/File/SWOpenFile"
]
}