diff --git a/.gitignore b/.gitignore
index ab6c5476d1a6018f3e4e74e932e0749f5bf9c10c..a14c4af3451a16d496bb3680567381e92d7c4537 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,8 @@
+# vs
/.vs
/.vscode
/out
/build
-Version.aps
# AMCAX Kernel
/AMCAX/
@@ -10,3 +10,5 @@ Version.aps
# Visual Studio CMake
CMakeUserPresets.json
+# Projects
+Version.aps
\ No newline at end of file
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9784102a4e7bfc374db3d993cfc9cb81c8733edd..cab64eca912fd43db115877d8129d507e0eab3eb 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,9 +4,9 @@ set(CMAKE_CXX_STANDARD 17)
configure_file(./Resources/Version.rc.in ./Resources/Version.rc)
-if (MSVC)
+if(MSVC)
add_compile_options(/utf-8)
- add_compile_options(/bigobj)
+ add_compile_options(/bigobj)
endif()
if(DEFINED CMAKE_PREFIX_PATH)
@@ -19,16 +19,19 @@ else()
message("CMAKE_PREFIX_PATH not defined, set to default: ${CMAKE_PREFIX_PATH}")
endif()
-#Turn on automoc/autouic, must have
-set(CMAKE_AUTOMOC ON)
+# Turn on automoc/autouic, must have
+set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
-
-#find depended qt libraries
-find_package(Qt5 COMPONENTS Widgets Core Gui OpenGL REQUIRED)
+set(SARIBBON_USE_FRAMELESS_LIB ON)
-if(DEFINED CMAKE_BUILD_TYPE)
+# find depended qt libraries
+find_package(Qt5 COMPONENTS Widgets Core Gui OpenGL sql REQUIRED)
+
+include_directories(${Qt5Gui_PRIVATE_INCLUDE_DIRS})
+
+if(DEFINED CMAKE_BUILD_TYPE)
message("CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
elseif(DEFINED ENV{CMAKE_BUILD_TYPE})
set(CMAKE_BUILD_TYPE $ENV{CMAKE_BUILD_TYPE})
@@ -38,22 +41,37 @@ else()
message("CMAKE_BUILD_TYPE set to default: ${CMAKE_BUILD_TYPE}")
endif()
-if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
+if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/AMCAX/lib/cmake")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/third_party/FreeGLUT/x64-Debug/lib/cmake")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
- set(AMCAX_DLL_PATH "AMCAX/bin/Debug")
- set(FREEGLUT_DLL_PATH "third_party/FreeGLUT/x64-Debug/bin")
+
+ set(AMCAX_DLL_PATH "AMCAX/bin/Debug/")
+ set(FREEGLUT_DLL_PATH "third_party/FreeGLUT/x64-Debug/bin/")
+
+ # SARibbon
+ SET(SARIBBONBAR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/SARibbon/lib/SARibbonBard.lib")
+ SET(QWKCORE_DLL "third_party/SARibbon/bin/QWKCored.dll")
+ SET(QWKWidgets_DLL "third_party/SARibbon/bin/QWKWidgetsd.dll")
+ SET(SARIBBONBAR_DLL "third_party/SARibbon/bin/SARibbonBard.dll")
else()
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/AMCAX/lib/cmake")
list(APPEND CMAKE_PREFIX_PATH "${CMAKE_SOURCE_DIR}/third_party/FreeGLUT/x64-Release/lib/cmake")
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH})
- set(AMCAX_DLL_PATH "AMCAX/bin/Release")
- set(FREEGLUT_DLL_PATH "third_party/FreeGLUT/x64-Release/bin")
+
+ set(AMCAX_DLL_PATH "AMCAX/bin/Release/")
+ set(FREEGLUT_DLL_PATH "third_party/FreeGLUT/x64-Release/bin/")
+
+ # SARibbon
+ SET(SARIBBONBAR "${CMAKE_CURRENT_SOURCE_DIR}/third_party/SARibbon/lib/SARibbonBar.lib")
+ SET(QWKCORE_DLL "third_party/SARibbon/bin/QWKCore.dll")
+ SET(QWKWidgets_DLL "third_party/SARibbon/bin/QWKWidgets.dll")
+ SET(SARIBBONBAR_DLL "third_party/SARibbon/bin/SARibbonBar.dll")
endif()
-message("CMAKE_PREFIX_PATH is now : ${CMAKE_PREFIX_PATH}")
-#find depended libraries
+include_directories("third_party/SARibbon/include/SARibbonBar")
+
+# find depended libraries
find_package(AMCAXCommon REQUIRED)
find_package(AMCAXPart REQUIRED)
find_package(AMCAXStep REQUIRED)
@@ -62,66 +80,25 @@ find_package(AMCAXTMSpline REQUIRED)
find_package(AMCAXOCCTIO REQUIRED)
find_package(FreeGLUT REQUIRED)
-
-
+# find_package(SARibbonBar REQUIRED)
qt5_add_resources(QRC_FILES Resources/Resource.qrc)
-
-FILE(GLOB Command_File "Src/Command/*.cpp" "Src/Command/*.h")
-
-FILE(GLOB Core_FILE "Src/Core/*.cpp" "Src/Core/*.h")
-
-FILE(GLOB Object_FILE "Src/Object/*.cpp" "Src/Object/*.h")
-
-FILE(GLOB ObjectDraw_FILE "Src/ObjectDraw/*.cpp" "Src/ObjectDraw/*.h")
-
-FILE(GLOB Operate_FILE "Src/Operation/*.cpp" "Src/Operation/*.h")
-
-FILE(GLOB Windows_FILE "Src/Windows/*.cpp" "Src/Windows/*.h")
-
-FILE(GLOB QGLViewer_FILE "Src/Windows/QGLViewer/*.cpp" "Src/Windows/QGLViewer/*.h")
-
-FILE(GLOB Record_FILE "Src/Record/*.h" "Src/Record/*.cpp")
-
-FILE(GLOB Utils_FILE "Src/Utils/*.h" "Src/Utils/*.cpp")
-
+FILE(GLOB_RECURSE SOURCE_FILE "Src/*.cpp" "Src/*.h")
FILE(GLOB WIN32_RESOURCE_FILE "Resources/Version.rc")
add_compile_definitions(NOMINMAX)
add_compile_definitions(_USE_MATH_DEFINES)
+add_executable(${PROJECT_NAME})
+
+target_sources(${PROJECT_NAME} PRIVATE ${QRC_FILES} ${SOURCE_FILE} ${WIN32_RESOURCE_FILE})
-add_executable(${PROJECT_NAME}
- ${QRC_FILES}
- ${Command_FILE}
- ${Core_FILE}
- ${Object_FILE}
- ${ObjectDraw_FILE}
- ${Operate_FILE}
- ${Windows_FILE}
- ${QGLViewer_FILE}
- ${Record_FILE}
- ${Utils_FILE}
- "Src/Main.cpp")
-
-source_group(Command FILES ${Command_FILE})
-source_group(Core FILES ${Core_FILE})
-source_group(Object FILES ${Object_FILE})
-source_group(ObjectDraw FILES ${ObjectDraw_FILE})
-source_group(Operate FILES ${Operate_FILE})
-source_group(Widgets FILES ${Windows_FILE})
-source_group(QGLViewer FILES ${QGLViewer_FILE})
-source_group(Record FILES ${Record_FILE})
-source_group(Utils FILES ${Utils_FILE})
-
-target_sources(${PROJECT_NAME} PRIVATE ${WIN32_RESOURCE_FILE})
-
-
-target_link_libraries(${PROJECT_NAME}
- Qt5::Widgets
- Qt5::Core
- Qt5::Gui
+target_link_libraries(${PROJECT_NAME}
+ Qt5::Widgets
+ Qt5::Core
+ Qt5::Gui
Qt5::OpenGL
+ Qt5::Sql
opengl32
glu32
AMCAXCommon
@@ -130,12 +107,14 @@ target_link_libraries(${PROJECT_NAME}
AMCAXSubD
AMCAXTMSpline
FreeGLUT::freeglut
+ ${SARIBBONBAR}
)
message("CMAKE_CURRENT_BINARY_DIR = ${CMAKE_CURRENT_BINARY_DIR}")
-execute_process( COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR})
+execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_CURRENT_BINARY_DIR})
-file(COPY ${AMCAX_DLL_PATH}/ ${FREEGLUT_DLL_PATH}/
- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
+file(COPY ${AMCAX_DLL_PATH} ${FREEGLUT_DLL_PATH} ${QWKCORE_DLL}
+ ${QWKWidgets_DLL} ${SARIBBONBAR_DLL}
+ DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
)
\ No newline at end of file
diff --git a/README.md b/README.md
index 9c4cb061c9111c9b85ee0527b012e3f5367d66aa..c506dfabde48f5627ab8722d00e850125e6e4611 100644
--- a/README.md
+++ b/README.md
@@ -1,8 +1,8 @@
# AMCAX-Daemon Introduction
-[![en-us](https://img.shields.io/badge/en-us-yellow.svg)](https://github.com/amcax-kernel/amcax-daemon/blob/main/README.md)
-[![中文-简体](https://img.shields.io/badge/%E4%B8%AD%E6%96%87-%E7%AE%80%E4%BD%93-red.svg)](https://github.com/amcax-kernel/amcax-daemon/blob/main/README.zh_cn.md)
-**Version 1.0.2**
+[![en-us](https://img.shields.io/badge/en-us-yellow.svg)](./README.md)
+
+**Version 1.0.3**
AMCAX-Daemon showcases some basic functions that AMCAX geometry kernel supports. There are more functions that can be supported by the kernel but currently not used by Daemon.
@@ -33,19 +33,7 @@ Please be informed that this project **does not** come with an AMCAX geometry ke
Refer to figures below to locate the operation areas of AMCAX-Daemon
-
-
-
-
-
Figure 1 Base Tab
-
-
-
-
-
-
-
Figure 2 BRep Tab
-
+![Refer to figures below to locate the operation areas of AMCAX-Daemon](./doc/pic/screenshot/screenshot.png)
### Create / Delete / Move Geometry Objects
@@ -67,10 +55,12 @@ Refer to figures below to locate the operation areas of AMCAX-Daemon
### Persistent Geometry Objects
-You may either select some objects and save them as file using `Export Selected` function, or save all the objects in your working space using `Save` function.
-You can choose to either save the objects `*.abr` file, which is an AMCAX proprietary format; or save the objects as standard STEP file.
-You can later load the objects from saved file into your working space.
-All the related functions are availabe under the `File` menu.
+![File Menu](./doc/pic/screenshot/screenshot-file.png)
+
+- **Save**: Save the object in `*.amcax` format, which is AMCAX's proprietary format and supports TMSpline, SubD, BRep.
+- **Save As**: Save the object in the format`*.amcax`, `*.stp` `*step`.
+- **Save Selected**: You can choose to save the object in the format `*.amcax`, `*.stp` `*step`.
+- All of the above related features are located under the `File` menu.
### Auxillary Functions
@@ -82,8 +72,6 @@ All the related functions are availabe under the `File` menu.
- Undo/Redo
- Currently only support undo/redo create/delete operation. New features are coming soon.
-
## How to Build
@@ -95,10 +83,9 @@ All the related functions are availabe under the `File` menu.
- Extension: Qt VS Tool (Qt Versions Configured)
- QT 5.15.2
- - Add qmake path (eg. D:\Qt\5.15.2\msvc2019_64\bin) in to PATH environment variable.
-
-- [AMCAX Kernal](https://amcax.net/) 3.6.0
+ - Add qmake path (eg. D:\Qt\5.15.2\msvc2019_64\bin) in to `PATH` environment variable.
+- [AMCAX Kernal](https://amcax.net/) 3.6.1
### Steps
@@ -149,7 +136,6 @@ The code structure for AMCAX daemon looks like below.
Figure 3 Code Structure
-
It's built upon AMCAX Kernel SDK and OpenGL. From bottom to top:
- [`Operation`](./Src/Operation) folder includes helper classes that can call kernel SDK to create the underlying geometry objects, [`ObjectDraw`](./Src/ObjectDraw) folder includes classes that are used to draw a target object using OpenGL;
diff --git a/README.zh_cn.md b/README.zh_cn.md
index 7d6363446d61bc22ac27479bedb519fc56f1ecc1..cf6710cd212c456abbcd133b727888863d786796 100644
--- a/README.zh_cn.md
+++ b/README.zh_cn.md
@@ -1,14 +1,13 @@
# 九韶精灵 简介
-[![en-us](https://img.shields.io/badge/en-us-yellow.svg)](https://github.com/amcax-kernel/amcax-daemon/blob/main/README.md)
-[![中文-简体](https://img.shields.io/badge/%E4%B8%AD%E6%96%87-%E7%AE%80%E4%BD%93-red.svg)](https://github.com/amcax-kernel/amcax-daemon/blob/main/README.zh_cn.md)
+[![中文-简体](https://img.shields.io/badge/%E4%B8%AD%E6%96%87-%E7%AE%80%E4%BD%93-red.svg)](./README.zh_cn.md)
-**版本 1.0.2**
-
-九韶精灵展示了九韶几何内核支持的一些基本功能。 内核支持更多更丰富的功能,但目前九韶精灵中还暂未使用。 请注意,此项目并不包含AMCAX几何内核的使用许可证,您需要到[九韶官网](https://amcax.net/)自行申请许可证。
+**版本 1.0.3**
+九韶精灵展示了九韶几何内核支持的一些基本功能。 内核支持更多更丰富的功能,但目前九韶精灵中还暂未使用。 请注意,此项目并不包含 AMCAX 几何内核的使用许可证,您需要到[九韶官网](https://amcax.net/)自行申请许可证。
## 目录
+
- [如何使用](#如何使用)
- [用户界面](#用户界面)
- [创建 / 删除 / 移动几何对象](#创建-删除-移动几何对象)
@@ -31,37 +30,22 @@
### 用户界面
-请参考以下图片定位九韶精灵的各项操作区域
+- 九韶精灵的各项操作区域
-
-
-
-
-
图一:Base 选项卡
-
-
-
-
-
-
-
图二:BRep 选项卡
-
-
-
+![九韶精灵的各项操作区域](./doc/pic/screenshot/screenshot.png)
### 创建 / 删除 / 移动几何对象
- 要创建一个新的几何对象
- 激活 BRep 选项卡并选择对象类型,然后:
- - 对于面类型:按顺序点击渲染区域,指定多个点,完成后按 `回车`
+ 激活 **BRep** 选项卡并选择对象类型,然后:
+
+ - 对于面类型:按顺序点击渲染区域,指定多个点,完成后按 `回车`
- - 对于其他类型:将会出现一个对话框,在对话框中指定几何对象的参数并点击 `确认`
+ - 对于其他类型:将会出现一个对话框,在对话框中指定几何对象的参数并点击 `确认`
- 要删除对象,选择对象并按 `删除` 键。
-
- 要移动对象,选择对象,按住鼠标左键,移动到目标点,然后释放按钮
-
### 修改几何对象
@@ -69,9 +53,13 @@
### 持久化几何对象
-- 您可以选择一些对象,使用 `导出选中...`功能将它们保存为文件;也可使用 `保存` 功能来保存工作空间中的所有对象。
+![九韶精灵文件菜单](./doc/pic/screenshot/screenshot-file.png)
+
+- **保存**:将对象以 `*.amcax` 格式保存,这是 AMCAX 的专有格式,支持 TMSpline, SubD, BRep。
-- 可以选择将对象以 `*.abr` 格式保存,这是 AMCAX 的专有格式;也可以选择将对象以标准的STEP文件格式保存。您可以稍后将对象从文件加载到工作空间中。
+- **另存为**:将对象以 `*.amcax`,`*.stp` `*step` 格式保存。
+
+- **保存选中**:可以选择将对象以 `*.amcax`,`*.stp` `*step` 格式保存。
- 上述所有相关功能都位于`文件`菜单下。
@@ -79,43 +67,37 @@
- 改变视角
- - 旋转:按住右键并移动以调整
+ - 旋转:按住右键并移动以调整
- - 平移:按下左/右/上/下键调整
+ - 平移:按下左/右/上/下键调整
- 撤销/重做
-
- 目前仅支持撤销/重做创建/删除操作。新功能即将推出。
-
+
## 如何构建
### 前提条件
- CMake 3.27 +
-
- Visual Studio 2019
- - 扩展: Qt VS Tool (请配置Qt Versions)
-
+ - 扩展: Qt VS Tool (请配置 Qt Versions)
- QT 5.15.2
- - 添加 qmake 路径(例如:D:\Qt\5.15.2\msvc2019_64\bin)到 PATH 环境变量。
-
-- [九韶几何内核](https://amcax.net/) 3.6.0
-
+ - 添加 qmake 路径(例如:D:\Qt\5.15.2\msvc2019_64\bin)到 `PATH` 环境变量。
+- [九韶几何内核](https://amcax.net/) 3.6.1
### 步骤
- 设置环境变量
- **CMAKE\_PREFIX\_PATH=%YOUR\_QT\_INSTALL\_DIR%\\msvc2019%YOUR\_CPU\_ARCH%\\lib\\cmake**
+ **CMAKE_PREFIX_PATH=%YOUR_QT_INSTALL_DIR%\\msvc2019%YOUR_CPU_ARCH%\\lib\\cmake**
- 例如:
+ 例如:
- `d:\\qt\\5.15.2\\msvc2019\_64\\lib\\cmake\\`
+ `d:\\qt\\5.15.2\\msvc2019\_64\\lib\\cmake\\`
- 添加九韶几何内核库
- 解压库并将其放在此项目根文件夹的相应位置。文件夹结构应如下所示:
+ 解压库并将其放在此项目根文件夹的相应位置。文件夹结构应如下所示:
```text
Amcax-Daemon
@@ -131,13 +113,9 @@
```
- 打开 "Visual Studio 2019" 并选择 `continue without code`,导航到 `File` -> `Open` -> `CMake...` 然后打开此项目的 `CMakeLists.txt` 文件。
-
- 构建
-
- 将 AMCAX/bin 中的文件夹(`Debug` & `Release`)复制到项目的输出文件夹中。
-
-- 运行 AmcaxDaemon.exe
-
+- 运行 AmcaxDaemon.exe
## 教程
@@ -152,21 +130,19 @@ AMCAX daemon 的代码结构如下。
图三: 代码结构
-
-
它基于 AMCAX Kernel SDK 和 OpenGL。从底层到上层:
-- [`Operation`](./Src/Operation/)文件夹中是一些辅助类,它们直接调用内核SDK的API来创建几何对象,[`ObjectDraw`](./Src/ObjectDraw/)目录下是利用OpenGL绘制目标对象的类;
+- [`Operation`](./Src/Operation/)文件夹中是一些辅助类,它们直接调用内核 SDK 的 API 来创建几何对象,[`ObjectDraw`](./Src/ObjectDraw/)目录下是利用 OpenGL 绘制目标对象的类;
- [`Object`](./Src/Object/)目录中提供了内核集合对象的包装类,这些包装类使用`Operation`和`ObjectDraw`目录中相应的类来支持对几何对象的操作和图形展示。
-- [`Core`](./Src/Core/)目录中包含了一个`DataManager`,用于管理所有创建好的几何对象,以及`UnRedoHandler`用于支持“撤销/重做”,而`ACAMFile`中则实现了几何对象的持久化。
+- [`Core`](./Src/Core/)目录中包含了一个`DataManager`,用于管理所有创建好的几何对象,以及`UndoManager`用于支持“撤销/重做”,而`ACAMFile`中则实现了几何对象的持久化。
- [`Windows`](./Src/Windows/)目录包含与用户交互相关的类,目前利用 libqglviewer 进行相机/投影相关的坐标轴变换。
-
+
### 创建几何对象
-使用AMCAX内核创建对象非常简单:
+使用 AMCAX 内核创建对象非常简单:
```cpp
std::vector point_list;
@@ -186,7 +162,7 @@ AMCAX daemon 的代码结构如下。
### 修改几何对象
-可以在MultOperate_BoolFuse类中找到如何融合多个几何对象。代码非常简单:
+可以在 MultOperate_BoolFuse 类中找到如何融合多个几何对象。代码非常简单:
```cpp
std::vector shapeVector;
@@ -202,7 +178,7 @@ AMCAX daemon 的代码结构如下。
### Persistent Geometry Objects
-基本思路是使用AMCAD::TopoCompound和AMCAD::TopoBuilder将您想要持久化的对象组合起来,然后将它们保存到abr文件中。代码片段如下:
+基本思路是使用 AMCAD::TopoCompound 和 AMCAD::TopoBuilder 将您想要持久化的对象组合起来,然后将它们保存到 abr 文件中。代码片段如下:
```cpp
std::string fileName = "foo.abr";
@@ -227,20 +203,18 @@ AMCAX daemon 的代码结构如下。
## 已知问题
- 目前仅仅支持撤销/重做对几何对象的创建和删除操作,其他操作暂不支持。因此,如果您创建了一个对象,移动之,然后删除该对象。当您试图撤销删除操作时,您会发现被删除的几何对象虽然会重新出现,但不会在移动后的位置。
-- 不能混用Debug/Release的内核库。因此,如果您获取到的是Release版本的内核库,目前暂时只能编译运行Release版本的九韶精灵,但您可以使用最新的CMakeSettings配置,以达到调试九韶精灵本身的代码的目的。
-- 入STEP文件时,需要手动缩放视口大小使得STEP文件表示的对象合理显示。
+- 不能混用 Debug/Release 的内核库。因此,如果您获取到的是 Release 版本的内核库,目前暂时只能编译运行 Release 版本的九韶精灵,但您可以使用最新的 CMakeSettings 配置,以达到调试九韶精灵本身的代码的目的。
+- 入 STEP 文件时,需要手动缩放视口大小使得 STEP 文件表示的对象合理显示。
## 许可证
-AMCAX-Daemon采用双重许可制度:开源软件开发按照GNU Affero通用公共许可证v3.0(AGPLv3.0)自由使用,而商业应用可以申请商业许可。
+AMCAX-Daemon 采用双重许可制度:开源软件开发按照 GNU Affero 通用公共许可证 v3.0(AGPLv3.0)自由使用,而商业应用可以申请商业许可。
## 联系我们
欢迎提供反馈和贡献!
-您可以在这里创建Git问题,或者加入我们的[中文社区](https://bbs.amcax.net/)以进一步参与这个项目。
-
+您可以在这里创建 Git 问题,或者加入我们的[中文社区](https://bbs.amcax.net/)以进一步参与这个项目。
---
-**Copyright © 2023 Hefei Jiushao Intelligent Technology Co., Ltd. All rights reserved.**
-
+**Copyright © 2024 Hefei Jiushao Intelligent Technology Co., Ltd. All rights reserved.**
diff --git a/Resources/Resource.qrc b/Resources/Resource.qrc
index 84906ddef3d8934bc73cd8ad55d4d03bb74688b5..a25f391555cbfd8188ff704006676309f652eefe 100644
--- a/Resources/Resource.qrc
+++ b/Resources/Resource.qrc
@@ -1,55 +1,80 @@
- images/SelectEdge.png
- images/SelectFace.png
- images/SelectObject.png
- images/SelectVert.png
- images/Cube.png
- images/Cylinder.png
- images/copy.png
- images/Plane.png
- images/UCSphere.png
- images/ExtrudeFace.png
- images/SingalMeshFace.png
- images/Cone.png
- images/Combine.png
- images/SetCenter.png
- images/WorkPlane.png
- images/Torus.png
- images/Chamfer.png
- images/fillet.png
- images/Circular.png
- images/BoolCommon.png
- images/BoolCut.png
- images/BoolFuse.png
- images/Prism.png
- images/Polygon.png
images/logo.ico
- images/SubdiveCC.png
- images/SubdiveLoop.png
- images/MeshTriangulation.png
- images/DeleteObject.png
- images/Mirror.png
- images/EmbedFace.png
- images/DeleteFace.png
- images/Separate.png
- images/Weld.png
- images/SplitEdgeOnly.png
- images/SplitLoop.png
- images/SplitFace.png
- images/CollapseEdge.png
- images/SwapEdge.png
- images/BridgeEdge.png
- images/ExtrudeEdgeHorizontal.png
- images/ExtrudeEdgeVertical.png
- images/Thicken.png
- images/FillHole.png
- images/ReverseNormal.png
- images/QuadSphere.png
- images/Crease.png
- images/RCrease.png
- images/Repair.png
- images/Uniform.png
- images/SplitFace1.png
+
+
+ icon/redo.svg
+ icon/save.svg
+ icon/undo.svg
+ icon/exit.svg
+ icon/open.svg
+ icon/export-selected.svg
+ icon/copy-object.svg
+ icon/create_component.svg
+ icon/delete.svg
+ icon/face-select.svg
+ icon/fit-screen.svg
+ icon/line-select.svg
+ icon/mirror.svg
+ icon/move.svg
+ icon/object-select.svg
+ icon/render.svg
+ icon/rotate.svg
+ icon/scale.svg
+ icon/smooth.svg
+ icon/vertex-select.svg
+ icon/wireframe.svg
+ icon/workplane.svg
+ icon/about.svg
+ icon/save-small.svg
+ icon/new.svg
+ icon/save-as.svg
+ icon/open-recent.svg
+
+
+ TMSpline/add-crease-edge.svg
+ TMSpline/brige-edge.svg
+ TMSpline/chamfer.svg
+ TMSpline/circular-arc.svg
+ TMSpline/combine-vertex.svg
+ TMSpline/cone.svg
+ TMSpline/cube.svg
+ TMSpline/cut-face.svg
+ TMSpline/cylinder.svg
+ TMSpline/delete-face.svg
+ TMSpline/embed-face.svg
+ TMSpline/extrude-edge-h.svg
+ TMSpline/extrude-edge-v.svg
+ TMSpline/extrude-face.svg
+ TMSpline/fill-hole.svg
+ TMSpline/make-uniform.svg
+ TMSpline/plane.svg
+ TMSpline/quad-sphere.svg
+ TMSpline/remove-crease-edge.svg
+ TMSpline/repair.svg
+ TMSpline/reverse-normal.svg
+ TMSpline/separate.svg
+ TMSpline/single-face.svg
+ TMSpline/sphere.svg
+ TMSpline/split-face.svg
+ TMSpline/split-face-cross.svg
+ TMSpline/split-loop.svg
+ TMSpline/swap-edge.svg
+ TMSpline/thicken.svg
+ TMSpline/torus.svg
+ TMSpline/weld.svg
+ TMSpline/subd-catmull-clark.svg
+ TMSpline/subd-loop.svg
+ TMSpline/triangulated-mesh.svg
+ TMSpline/polygon.svg
+ TMSpline/prism.svg
+ TMSpline/fillet.svg
+ TMSpline/union.svg
+ TMSpline/union-1.svg
+ TMSpline/union-2.svg
+ TMSpline/curvature.svg
+ TMSpline/curvature-comb.svg
+ TMSpline/zebra.svg
+ TMSpline/copy-face.svg
diff --git a/Resources/TMSpline/add-crease-edge.svg b/Resources/TMSpline/add-crease-edge.svg
new file mode 100644
index 0000000000000000000000000000000000000000..14cd5562104d3228c8e9f11e1b84a892c12d5ca8
--- /dev/null
+++ b/Resources/TMSpline/add-crease-edge.svg
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/brige-edge.svg b/Resources/TMSpline/brige-edge.svg
new file mode 100644
index 0000000000000000000000000000000000000000..acdab5d0d1bc3f8063481f0cfc74884c2f76f243
--- /dev/null
+++ b/Resources/TMSpline/brige-edge.svg
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/chamfer.svg b/Resources/TMSpline/chamfer.svg
new file mode 100644
index 0000000000000000000000000000000000000000..9588750d07c733f0e55b93018305d145698f89ef
--- /dev/null
+++ b/Resources/TMSpline/chamfer.svg
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/circular-arc.svg b/Resources/TMSpline/circular-arc.svg
new file mode 100644
index 0000000000000000000000000000000000000000..a857a7a1bd24b22a88ab60e5ea1c1f08b53dccb7
--- /dev/null
+++ b/Resources/TMSpline/circular-arc.svg
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/combine-vertex.svg b/Resources/TMSpline/combine-vertex.svg
new file mode 100644
index 0000000000000000000000000000000000000000..65b5a2866290849cc5ca8ff5e17ffb7eb1c9c2fc
--- /dev/null
+++ b/Resources/TMSpline/combine-vertex.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/cone.svg b/Resources/TMSpline/cone.svg
new file mode 100644
index 0000000000000000000000000000000000000000..175677ea684811fe22e66495dd758f06d48e6542
--- /dev/null
+++ b/Resources/TMSpline/cone.svg
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/copy-face.svg b/Resources/TMSpline/copy-face.svg
new file mode 100644
index 0000000000000000000000000000000000000000..880615f6aaec12bef2ba31ca83b9b3044d937cfc
--- /dev/null
+++ b/Resources/TMSpline/copy-face.svg
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/cube.svg b/Resources/TMSpline/cube.svg
new file mode 100644
index 0000000000000000000000000000000000000000..1c66d863ccf31779c6b0d740b32bf9bd37bf0c81
--- /dev/null
+++ b/Resources/TMSpline/cube.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/curvature-comb.svg b/Resources/TMSpline/curvature-comb.svg
new file mode 100644
index 0000000000000000000000000000000000000000..85c692243b48f82a77227ef5868b8d6aaffaeeb7
--- /dev/null
+++ b/Resources/TMSpline/curvature-comb.svg
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Resources/TMSpline/curvature.svg b/Resources/TMSpline/curvature.svg
new file mode 100644
index 0000000000000000000000000000000000000000..93f3ad48640bd2a43f916e00726b81c3b0e9268a
--- /dev/null
+++ b/Resources/TMSpline/curvature.svg
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/cut-face.svg b/Resources/TMSpline/cut-face.svg
new file mode 100644
index 0000000000000000000000000000000000000000..548dab5bb3eff5c2e84babe9dc19c67ae60e0c18
--- /dev/null
+++ b/Resources/TMSpline/cut-face.svg
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/cylinder.svg b/Resources/TMSpline/cylinder.svg
new file mode 100644
index 0000000000000000000000000000000000000000..6e8c170f2f75c0af9f3dec64d976916678682d86
--- /dev/null
+++ b/Resources/TMSpline/cylinder.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/delete-face.svg b/Resources/TMSpline/delete-face.svg
new file mode 100644
index 0000000000000000000000000000000000000000..35c6d17cb91b37fe8d861ae397315204dd539d11
--- /dev/null
+++ b/Resources/TMSpline/delete-face.svg
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/embed-face.svg b/Resources/TMSpline/embed-face.svg
new file mode 100644
index 0000000000000000000000000000000000000000..3cb765d8de156f88add9ac66c255ef32eb0c7c67
--- /dev/null
+++ b/Resources/TMSpline/embed-face.svg
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/extrude-edge-h.svg b/Resources/TMSpline/extrude-edge-h.svg
new file mode 100644
index 0000000000000000000000000000000000000000..13be2c0ce7c25a55d00e7f08b2d281211b28cde4
--- /dev/null
+++ b/Resources/TMSpline/extrude-edge-h.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/extrude-edge-v.svg b/Resources/TMSpline/extrude-edge-v.svg
new file mode 100644
index 0000000000000000000000000000000000000000..e5a0275d5e0f6e35232d22ade31402e1ba9bb4a9
--- /dev/null
+++ b/Resources/TMSpline/extrude-edge-v.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/extrude-face.svg b/Resources/TMSpline/extrude-face.svg
new file mode 100644
index 0000000000000000000000000000000000000000..e7f848c5802ad889341055a990c46bfe375244a9
--- /dev/null
+++ b/Resources/TMSpline/extrude-face.svg
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/fill-hole.svg b/Resources/TMSpline/fill-hole.svg
new file mode 100644
index 0000000000000000000000000000000000000000..9af2e4b30a05b02659dae4d715bf58f16e69e580
--- /dev/null
+++ b/Resources/TMSpline/fill-hole.svg
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/fillet.svg b/Resources/TMSpline/fillet.svg
new file mode 100644
index 0000000000000000000000000000000000000000..d614087eab729bd7ab1da6f95baa030580cff76a
--- /dev/null
+++ b/Resources/TMSpline/fillet.svg
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/make-uniform.svg b/Resources/TMSpline/make-uniform.svg
new file mode 100644
index 0000000000000000000000000000000000000000..3b3acd4b0c5e8e4b9a4949c1f5330d3f0caf3ea3
--- /dev/null
+++ b/Resources/TMSpline/make-uniform.svg
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/plane.svg b/Resources/TMSpline/plane.svg
new file mode 100644
index 0000000000000000000000000000000000000000..3fd26c6bbff3ac1e5c6c6e2b67f1bf47dd716e51
--- /dev/null
+++ b/Resources/TMSpline/plane.svg
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/polygon.svg b/Resources/TMSpline/polygon.svg
new file mode 100644
index 0000000000000000000000000000000000000000..8bb21e721e775f385021a9adac6df04a0173b76d
--- /dev/null
+++ b/Resources/TMSpline/polygon.svg
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/prism.svg b/Resources/TMSpline/prism.svg
new file mode 100644
index 0000000000000000000000000000000000000000..58b6e8bfb54a439a345f1ff87fb56479931f6634
--- /dev/null
+++ b/Resources/TMSpline/prism.svg
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/quad-sphere.svg b/Resources/TMSpline/quad-sphere.svg
new file mode 100644
index 0000000000000000000000000000000000000000..754ef999382a3a079a5d416d75982d29f673b57c
--- /dev/null
+++ b/Resources/TMSpline/quad-sphere.svg
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/remove-crease-edge.svg b/Resources/TMSpline/remove-crease-edge.svg
new file mode 100644
index 0000000000000000000000000000000000000000..8e089c248fbf235a0f09f06ee41bf23db087d50e
--- /dev/null
+++ b/Resources/TMSpline/remove-crease-edge.svg
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/repair.svg b/Resources/TMSpline/repair.svg
new file mode 100644
index 0000000000000000000000000000000000000000..e854a9c5cdd351633502393fff816770f0a316eb
--- /dev/null
+++ b/Resources/TMSpline/repair.svg
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/reverse-normal.svg b/Resources/TMSpline/reverse-normal.svg
new file mode 100644
index 0000000000000000000000000000000000000000..e12c6e8ca198a6500441e0689ae6e41e7559dd7d
--- /dev/null
+++ b/Resources/TMSpline/reverse-normal.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/separate.svg b/Resources/TMSpline/separate.svg
new file mode 100644
index 0000000000000000000000000000000000000000..1040647fbc0f26d6fb9c05e30b64b46987472e93
--- /dev/null
+++ b/Resources/TMSpline/separate.svg
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/single-face.svg b/Resources/TMSpline/single-face.svg
new file mode 100644
index 0000000000000000000000000000000000000000..19c8f8b329c186ada1380f1789525fa60ce60d0c
--- /dev/null
+++ b/Resources/TMSpline/single-face.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/sphere.svg b/Resources/TMSpline/sphere.svg
new file mode 100644
index 0000000000000000000000000000000000000000..14290b77803198b4b95155bff70531921c285f99
--- /dev/null
+++ b/Resources/TMSpline/sphere.svg
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/split-face-cross.svg b/Resources/TMSpline/split-face-cross.svg
new file mode 100644
index 0000000000000000000000000000000000000000..55708f798b22c8c8c2b3aa398ffeb8d636afd750
--- /dev/null
+++ b/Resources/TMSpline/split-face-cross.svg
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/split-face.svg b/Resources/TMSpline/split-face.svg
new file mode 100644
index 0000000000000000000000000000000000000000..c2087c8b05cf7dfab8b36eaf0044f6895672647c
--- /dev/null
+++ b/Resources/TMSpline/split-face.svg
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/split-loop.svg b/Resources/TMSpline/split-loop.svg
new file mode 100644
index 0000000000000000000000000000000000000000..d37972378f71026c03b17c4fc69169bee22f53da
--- /dev/null
+++ b/Resources/TMSpline/split-loop.svg
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/subd-catmull-clark.svg b/Resources/TMSpline/subd-catmull-clark.svg
new file mode 100644
index 0000000000000000000000000000000000000000..ca518bf41132b7a471ea2515fabbd831ba839983
--- /dev/null
+++ b/Resources/TMSpline/subd-catmull-clark.svg
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/Resources/TMSpline/subd-loop.svg b/Resources/TMSpline/subd-loop.svg
new file mode 100644
index 0000000000000000000000000000000000000000..883cac664cd3ed35237d59bb4eb0427e2be9a16c
--- /dev/null
+++ b/Resources/TMSpline/subd-loop.svg
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/Resources/TMSpline/swap-edge.svg b/Resources/TMSpline/swap-edge.svg
new file mode 100644
index 0000000000000000000000000000000000000000..63bdec4d67cb250172d3ee9523f7adcf3c7a4b79
--- /dev/null
+++ b/Resources/TMSpline/swap-edge.svg
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/thicken.svg b/Resources/TMSpline/thicken.svg
new file mode 100644
index 0000000000000000000000000000000000000000..2aa3efd3894f78cc455316cddba5722f760f9a12
--- /dev/null
+++ b/Resources/TMSpline/thicken.svg
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/torus.svg b/Resources/TMSpline/torus.svg
new file mode 100644
index 0000000000000000000000000000000000000000..8a5302ae7787bdf687ee406e6aa121782500dacc
--- /dev/null
+++ b/Resources/TMSpline/torus.svg
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/triangulated-mesh.svg b/Resources/TMSpline/triangulated-mesh.svg
new file mode 100644
index 0000000000000000000000000000000000000000..ae8dee8d6450f82d842817857bed88696d5f49f4
--- /dev/null
+++ b/Resources/TMSpline/triangulated-mesh.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/union-1.svg b/Resources/TMSpline/union-1.svg
new file mode 100644
index 0000000000000000000000000000000000000000..dfead6a350b2952b29ff00413cace2fd120ce75d
--- /dev/null
+++ b/Resources/TMSpline/union-1.svg
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/union-2.svg b/Resources/TMSpline/union-2.svg
new file mode 100644
index 0000000000000000000000000000000000000000..77f520d7497c91686791e5d74c3e6d3c58c87886
--- /dev/null
+++ b/Resources/TMSpline/union-2.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/union.svg b/Resources/TMSpline/union.svg
new file mode 100644
index 0000000000000000000000000000000000000000..8eb1d5015cc2f6cc9ec7feecb086248e352b1a62
--- /dev/null
+++ b/Resources/TMSpline/union.svg
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/weld.svg b/Resources/TMSpline/weld.svg
new file mode 100644
index 0000000000000000000000000000000000000000..f7960ff1e1522a5449e4c6e4ce8724deb6aee6ca
--- /dev/null
+++ b/Resources/TMSpline/weld.svg
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/TMSpline/zebra.svg b/Resources/TMSpline/zebra.svg
new file mode 100644
index 0000000000000000000000000000000000000000..aa7bec809fd7962ad47e299a0d1a8a9e3561c145
--- /dev/null
+++ b/Resources/TMSpline/zebra.svg
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/Resources/Version.rc b/Resources/Version.rc
new file mode 100644
index 0000000000000000000000000000000000000000..8f92c4574c7a4da2a2bdf1d29d3e116e6c9fd569
--- /dev/null
+++ b/Resources/Version.rc
@@ -0,0 +1 @@
+IDI_ICON1 ICON DISCARDABLE "images/logo.ico"
\ No newline at end of file
diff --git a/Resources/icon/about.svg b/Resources/icon/about.svg
new file mode 100644
index 0000000000000000000000000000000000000000..17e96b316da3455f12b3bed3cbc854332e69d87d
--- /dev/null
+++ b/Resources/icon/about.svg
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Resources/icon/copy-object.svg b/Resources/icon/copy-object.svg
new file mode 100644
index 0000000000000000000000000000000000000000..823b34b04aa2e21838712bc1fe96362ee44c5689
--- /dev/null
+++ b/Resources/icon/copy-object.svg
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/create_component.svg b/Resources/icon/create_component.svg
new file mode 100644
index 0000000000000000000000000000000000000000..93eb588ae9620e0b8d882d6c7c13a9659447e347
--- /dev/null
+++ b/Resources/icon/create_component.svg
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/delete.svg b/Resources/icon/delete.svg
new file mode 100644
index 0000000000000000000000000000000000000000..25b8ef5e2b970071b6c36cfc74bd7d04fbed1aeb
--- /dev/null
+++ b/Resources/icon/delete.svg
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/exit.svg b/Resources/icon/exit.svg
new file mode 100644
index 0000000000000000000000000000000000000000..5c311cdbd53de0d9e6a15b10421588ee3355ca54
--- /dev/null
+++ b/Resources/icon/exit.svg
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/export-selected.svg b/Resources/icon/export-selected.svg
new file mode 100644
index 0000000000000000000000000000000000000000..9485fc2ff5a25124339d72610f44b80026f66e39
--- /dev/null
+++ b/Resources/icon/export-selected.svg
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/face-select.svg b/Resources/icon/face-select.svg
new file mode 100644
index 0000000000000000000000000000000000000000..02b931c081a5ba5d4e1dafc12ed9d2dbd2ffa10a
--- /dev/null
+++ b/Resources/icon/face-select.svg
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/fit-screen.svg b/Resources/icon/fit-screen.svg
new file mode 100644
index 0000000000000000000000000000000000000000..095bf4cfa08acf16b8ad8612b0b43cfda7113822
--- /dev/null
+++ b/Resources/icon/fit-screen.svg
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Resources/icon/line-select.svg b/Resources/icon/line-select.svg
new file mode 100644
index 0000000000000000000000000000000000000000..dc57e557f54af52a840fd2356fcbfd90a3d4b01a
--- /dev/null
+++ b/Resources/icon/line-select.svg
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/mirror.svg b/Resources/icon/mirror.svg
new file mode 100644
index 0000000000000000000000000000000000000000..3191b52684cff2e51cd6c064bda8eaf00a86d338
--- /dev/null
+++ b/Resources/icon/mirror.svg
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/move.svg b/Resources/icon/move.svg
new file mode 100644
index 0000000000000000000000000000000000000000..7c0a7f9d5be154465a11b3915934b8ea25ea4d6c
--- /dev/null
+++ b/Resources/icon/move.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Resources/icon/new.svg b/Resources/icon/new.svg
new file mode 100644
index 0000000000000000000000000000000000000000..8f2ea1566a49423961e1cb8b6330d74ffc42dda7
--- /dev/null
+++ b/Resources/icon/new.svg
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/Resources/icon/object-select.svg b/Resources/icon/object-select.svg
new file mode 100644
index 0000000000000000000000000000000000000000..442f9a2afbe9c986a906e1300d99e407dadbc633
--- /dev/null
+++ b/Resources/icon/object-select.svg
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/open-recent.svg b/Resources/icon/open-recent.svg
new file mode 100644
index 0000000000000000000000000000000000000000..cc767ba350800127654390edc15672a139515643
--- /dev/null
+++ b/Resources/icon/open-recent.svg
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/open.svg b/Resources/icon/open.svg
new file mode 100644
index 0000000000000000000000000000000000000000..fc7b5a11d2238bc2787cc09bbd7f6fa8ae8bcf28
--- /dev/null
+++ b/Resources/icon/open.svg
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/redo.svg b/Resources/icon/redo.svg
new file mode 100644
index 0000000000000000000000000000000000000000..85770dd1f4b2efc24edc4edaacb40e5623482e56
--- /dev/null
+++ b/Resources/icon/redo.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Resources/icon/render.svg b/Resources/icon/render.svg
new file mode 100644
index 0000000000000000000000000000000000000000..c1d9e1237fe296711f09b87fe0a22b774ee2698d
--- /dev/null
+++ b/Resources/icon/render.svg
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/rotate.svg b/Resources/icon/rotate.svg
new file mode 100644
index 0000000000000000000000000000000000000000..a80774171d207f7b0ebd7e62c2cdc9148bb5caef
--- /dev/null
+++ b/Resources/icon/rotate.svg
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/save-as.svg b/Resources/icon/save-as.svg
new file mode 100644
index 0000000000000000000000000000000000000000..2526162197f4d231c9c92dd0d751afd0cfa4b0bb
--- /dev/null
+++ b/Resources/icon/save-as.svg
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
diff --git a/Resources/icon/save-small.svg b/Resources/icon/save-small.svg
new file mode 100644
index 0000000000000000000000000000000000000000..42c288cd42d79f6ae1e4c7e6f824309c06db79c9
--- /dev/null
+++ b/Resources/icon/save-small.svg
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Resources/icon/save.svg b/Resources/icon/save.svg
new file mode 100644
index 0000000000000000000000000000000000000000..d46547f57629e631938899778c5aa890a2ed8988
--- /dev/null
+++ b/Resources/icon/save.svg
@@ -0,0 +1,12 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/scale.svg b/Resources/icon/scale.svg
new file mode 100644
index 0000000000000000000000000000000000000000..c8a5dab0afa6043adf808dc565b5b26ed5b27096
--- /dev/null
+++ b/Resources/icon/scale.svg
@@ -0,0 +1,11 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/smooth.svg b/Resources/icon/smooth.svg
new file mode 100644
index 0000000000000000000000000000000000000000..d387eeefdb2d95d7fba9bd67dacd0bfa6ea098f6
--- /dev/null
+++ b/Resources/icon/smooth.svg
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/undo.svg b/Resources/icon/undo.svg
new file mode 100644
index 0000000000000000000000000000000000000000..ec795058c72afa0fdce5732ec4a628f76ca3f611
--- /dev/null
+++ b/Resources/icon/undo.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/Resources/icon/vertex-select.svg b/Resources/icon/vertex-select.svg
new file mode 100644
index 0000000000000000000000000000000000000000..4e9b293abc6f5e43a91134aed8037bb845736858
--- /dev/null
+++ b/Resources/icon/vertex-select.svg
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
diff --git a/Resources/icon/wireframe.svg b/Resources/icon/wireframe.svg
new file mode 100644
index 0000000000000000000000000000000000000000..d9f379cc1e8e3b86399ea489049732600e0826de
--- /dev/null
+++ b/Resources/icon/wireframe.svg
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Resources/icon/workplane.svg b/Resources/icon/workplane.svg
new file mode 100644
index 0000000000000000000000000000000000000000..92158fc5edbbd58ec5c08cd09bc0c8a16143dd04
--- /dev/null
+++ b/Resources/icon/workplane.svg
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/Resources/images/BoolFuse.png b/Resources/images/BoolFuse.png
deleted file mode 100644
index c1d10c5150cedfee7954ef4990686fa975033dfa..0000000000000000000000000000000000000000
Binary files a/Resources/images/BoolFuse.png and /dev/null differ
diff --git a/Resources/images/BridgeEdge.png b/Resources/images/BridgeEdge.png
deleted file mode 100644
index 1e9100cfe286537390476fcbc5a3c4eb183c82e7..0000000000000000000000000000000000000000
Binary files a/Resources/images/BridgeEdge.png and /dev/null differ
diff --git a/Resources/images/Chamfer.png b/Resources/images/Chamfer.png
deleted file mode 100644
index f6781af0123df29d90dcc140e88a9f5e547d3a8e..0000000000000000000000000000000000000000
Binary files a/Resources/images/Chamfer.png and /dev/null differ
diff --git a/Resources/images/Circular.png b/Resources/images/Circular.png
deleted file mode 100644
index 9ac6c5bf4edc8bd6f054be53052077ebf2dd9b75..0000000000000000000000000000000000000000
Binary files a/Resources/images/Circular.png and /dev/null differ
diff --git a/Resources/images/CollapseEdge.png b/Resources/images/CollapseEdge.png
deleted file mode 100644
index f370678788ed330a0fcbed36bf0b504da1a62084..0000000000000000000000000000000000000000
Binary files a/Resources/images/CollapseEdge.png and /dev/null differ
diff --git a/Resources/images/Combine.png b/Resources/images/Combine.png
deleted file mode 100644
index 19f51728765cc5f7e364f7c2ced0996f8bf5482b..0000000000000000000000000000000000000000
Binary files a/Resources/images/Combine.png and /dev/null differ
diff --git a/Resources/images/Cone.png b/Resources/images/Cone.png
deleted file mode 100644
index 0f68590ee4fe440a0cae4efcdaa9a7350acefd2b..0000000000000000000000000000000000000000
Binary files a/Resources/images/Cone.png and /dev/null differ
diff --git a/Resources/images/Crease.png b/Resources/images/Crease.png
deleted file mode 100644
index 18f2ef297f3fddb7121426b44dc7d9027ded3f10..0000000000000000000000000000000000000000
Binary files a/Resources/images/Crease.png and /dev/null differ
diff --git a/Resources/images/Cube.png b/Resources/images/Cube.png
deleted file mode 100644
index 42e5e1493dc572a6277b50b4b8576c4cc752421d..0000000000000000000000000000000000000000
Binary files a/Resources/images/Cube.png and /dev/null differ
diff --git a/Resources/images/Cylinder.png b/Resources/images/Cylinder.png
deleted file mode 100644
index af99cedfa6373f9c5ad86aa2f2f39af1853a7e63..0000000000000000000000000000000000000000
Binary files a/Resources/images/Cylinder.png and /dev/null differ
diff --git a/Resources/images/DeleteFace.png b/Resources/images/DeleteFace.png
deleted file mode 100644
index 8e3ed2c2548c7dd0fd8a42fbd518df1a63408814..0000000000000000000000000000000000000000
Binary files a/Resources/images/DeleteFace.png and /dev/null differ
diff --git a/Resources/images/DeleteObject.png b/Resources/images/DeleteObject.png
deleted file mode 100644
index e3646da4fdf40b255120dab3346dc9e4ff835fd5..0000000000000000000000000000000000000000
Binary files a/Resources/images/DeleteObject.png and /dev/null differ
diff --git a/Resources/images/EmbedFace.png b/Resources/images/EmbedFace.png
deleted file mode 100644
index 4c55b71cdeb24d885d58c4b15fdeffa0b3c4db53..0000000000000000000000000000000000000000
Binary files a/Resources/images/EmbedFace.png and /dev/null differ
diff --git a/Resources/images/ExtrudeEdgeHorizontal.png b/Resources/images/ExtrudeEdgeHorizontal.png
deleted file mode 100644
index 913b1d903f1af255eacfacb95c8d4cba6408e05e..0000000000000000000000000000000000000000
Binary files a/Resources/images/ExtrudeEdgeHorizontal.png and /dev/null differ
diff --git a/Resources/images/ExtrudeEdgeVertical.png b/Resources/images/ExtrudeEdgeVertical.png
deleted file mode 100644
index 6bfeacc51f16b36b5dc778f8aade8f98b603ce04..0000000000000000000000000000000000000000
Binary files a/Resources/images/ExtrudeEdgeVertical.png and /dev/null differ
diff --git a/Resources/images/ExtrudeFace.png b/Resources/images/ExtrudeFace.png
deleted file mode 100644
index c2446003659cbf546debe27f2aba97f6018ff14d..0000000000000000000000000000000000000000
Binary files a/Resources/images/ExtrudeFace.png and /dev/null differ
diff --git a/Resources/images/FillHole.png b/Resources/images/FillHole.png
deleted file mode 100644
index 935d43c2b8609acea95267373b819889a7aed52c..0000000000000000000000000000000000000000
Binary files a/Resources/images/FillHole.png and /dev/null differ
diff --git a/Resources/images/MeshTriangulation.png b/Resources/images/MeshTriangulation.png
deleted file mode 100644
index 718ec7696139946031420893049b3d105f689c8d..0000000000000000000000000000000000000000
Binary files a/Resources/images/MeshTriangulation.png and /dev/null differ
diff --git a/Resources/images/Mirror.png b/Resources/images/Mirror.png
deleted file mode 100644
index 78e2774e3b2023ecedfaf425fe9f90c7ffc0aa2b..0000000000000000000000000000000000000000
Binary files a/Resources/images/Mirror.png and /dev/null differ
diff --git a/Resources/images/Plane.png b/Resources/images/Plane.png
deleted file mode 100644
index 914b0bb9da89d3d0860b9593392e26ac02d950af..0000000000000000000000000000000000000000
Binary files a/Resources/images/Plane.png and /dev/null differ
diff --git a/Resources/images/Polygon.png b/Resources/images/Polygon.png
deleted file mode 100644
index 6a14349831d9b02caac562ac03662fbcfa6a683a..0000000000000000000000000000000000000000
Binary files a/Resources/images/Polygon.png and /dev/null differ
diff --git a/Resources/images/Prism.png b/Resources/images/Prism.png
deleted file mode 100644
index 9e273082fa8c52e715e8070ee50401ca6b75f997..0000000000000000000000000000000000000000
Binary files a/Resources/images/Prism.png and /dev/null differ
diff --git a/Resources/images/QuadSphere.png b/Resources/images/QuadSphere.png
deleted file mode 100644
index df59616b30da517f319a2ef2b96660c07c843704..0000000000000000000000000000000000000000
Binary files a/Resources/images/QuadSphere.png and /dev/null differ
diff --git a/Resources/images/RCrease.png b/Resources/images/RCrease.png
deleted file mode 100644
index 8d61a01245750bb288c602e15186f0975c596a96..0000000000000000000000000000000000000000
Binary files a/Resources/images/RCrease.png and /dev/null differ
diff --git a/Resources/images/Repair.png b/Resources/images/Repair.png
deleted file mode 100644
index ec3dd5f5019140dbbfb9409db8a241652b85e9f8..0000000000000000000000000000000000000000
Binary files a/Resources/images/Repair.png and /dev/null differ
diff --git a/Resources/images/ReverseNormal.png b/Resources/images/ReverseNormal.png
deleted file mode 100644
index 9305bb25d682b90183438a4be2b1a97623f04875..0000000000000000000000000000000000000000
Binary files a/Resources/images/ReverseNormal.png and /dev/null differ
diff --git a/Resources/images/SelectEdge.png b/Resources/images/SelectEdge.png
deleted file mode 100644
index a137a259f6f4cde953500a90f523726406ddad54..0000000000000000000000000000000000000000
Binary files a/Resources/images/SelectEdge.png and /dev/null differ
diff --git a/Resources/images/SelectFace.png b/Resources/images/SelectFace.png
deleted file mode 100644
index da86ace1c067bc08dcf7c87ffb0b04b1d1876f13..0000000000000000000000000000000000000000
Binary files a/Resources/images/SelectFace.png and /dev/null differ
diff --git a/Resources/images/SelectObject.png b/Resources/images/SelectObject.png
deleted file mode 100644
index 01f8674bb61fa20dc42a0ae8ce36957e3c7dd599..0000000000000000000000000000000000000000
Binary files a/Resources/images/SelectObject.png and /dev/null differ
diff --git a/Resources/images/SelectVert.png b/Resources/images/SelectVert.png
deleted file mode 100644
index 2ccae73a877bcc4956f5735fbc447285f0044a70..0000000000000000000000000000000000000000
Binary files a/Resources/images/SelectVert.png and /dev/null differ
diff --git a/Resources/images/Separate.png b/Resources/images/Separate.png
deleted file mode 100644
index 8b108086d7cc0f031ceca0f5b70085e6965ac3a6..0000000000000000000000000000000000000000
Binary files a/Resources/images/Separate.png and /dev/null differ
diff --git a/Resources/images/SetCenter.png b/Resources/images/SetCenter.png
deleted file mode 100644
index c58368cd63a8ca87a8c0c36386d97f31f61a0b65..0000000000000000000000000000000000000000
Binary files a/Resources/images/SetCenter.png and /dev/null differ
diff --git a/Resources/images/SingalMeshFace.png b/Resources/images/SingalMeshFace.png
deleted file mode 100644
index 08b3709558fae37d6ac57182ed76b512973bd5f9..0000000000000000000000000000000000000000
Binary files a/Resources/images/SingalMeshFace.png and /dev/null differ
diff --git a/Resources/images/SplitEdgeOnly.png b/Resources/images/SplitEdgeOnly.png
deleted file mode 100644
index bc1c24eaf23b95b3f00542449e74e39d7a8c9a5f..0000000000000000000000000000000000000000
Binary files a/Resources/images/SplitEdgeOnly.png and /dev/null differ
diff --git a/Resources/images/SplitFace.png b/Resources/images/SplitFace.png
deleted file mode 100644
index 51ecdc0e2bed9e3b6037ad9a1ac7abd4573abd83..0000000000000000000000000000000000000000
Binary files a/Resources/images/SplitFace.png and /dev/null differ
diff --git a/Resources/images/SplitFace1.png b/Resources/images/SplitFace1.png
deleted file mode 100644
index c837360b877b656b96d6061451f859d6ffe49f43..0000000000000000000000000000000000000000
Binary files a/Resources/images/SplitFace1.png and /dev/null differ
diff --git a/Resources/images/SplitLoop.png b/Resources/images/SplitLoop.png
deleted file mode 100644
index 8a2bc688c7fc31c05b9d0fb92e1e3564fb24e28a..0000000000000000000000000000000000000000
Binary files a/Resources/images/SplitLoop.png and /dev/null differ
diff --git a/Resources/images/SubdiveCC.png b/Resources/images/SubdiveCC.png
deleted file mode 100644
index 29a1d7ae68e133ca70815e5fbf5ba664a629480f..0000000000000000000000000000000000000000
Binary files a/Resources/images/SubdiveCC.png and /dev/null differ
diff --git a/Resources/images/SubdiveLoop.png b/Resources/images/SubdiveLoop.png
deleted file mode 100644
index 840fe7ce4612574d4f7000da3944042c0388b719..0000000000000000000000000000000000000000
Binary files a/Resources/images/SubdiveLoop.png and /dev/null differ
diff --git a/Resources/images/SwapEdge.png b/Resources/images/SwapEdge.png
deleted file mode 100644
index 08f925c86237386cdf06955cb3f8e2ffcb800138..0000000000000000000000000000000000000000
Binary files a/Resources/images/SwapEdge.png and /dev/null differ
diff --git a/Resources/images/Thicken.png b/Resources/images/Thicken.png
deleted file mode 100644
index add5299be52a122f2058cf799d93a7c5f6573430..0000000000000000000000000000000000000000
Binary files a/Resources/images/Thicken.png and /dev/null differ
diff --git a/Resources/images/Torus.png b/Resources/images/Torus.png
deleted file mode 100644
index bb28626a3148b25dd8096d6d696e2577596ebca4..0000000000000000000000000000000000000000
Binary files a/Resources/images/Torus.png and /dev/null differ
diff --git a/Resources/images/UCSphere.png b/Resources/images/UCSphere.png
deleted file mode 100644
index 972d7a9aab1c0774904a54df3c27ddb3fecdb139..0000000000000000000000000000000000000000
Binary files a/Resources/images/UCSphere.png and /dev/null differ
diff --git a/Resources/images/Uniform.png b/Resources/images/Uniform.png
deleted file mode 100644
index e9f784611a02493529d7d7e09da4357ff4f450fe..0000000000000000000000000000000000000000
Binary files a/Resources/images/Uniform.png and /dev/null differ
diff --git a/Resources/images/Weld.png b/Resources/images/Weld.png
deleted file mode 100644
index c81013e161a37519118a81484a5a1c8deaaab325..0000000000000000000000000000000000000000
Binary files a/Resources/images/Weld.png and /dev/null differ
diff --git a/Resources/images/WorkPlane.png b/Resources/images/WorkPlane.png
deleted file mode 100644
index ea00602cd4c5e6916dc727c39683158bfac7b326..0000000000000000000000000000000000000000
Binary files a/Resources/images/WorkPlane.png and /dev/null differ
diff --git a/Resources/images/boolCommon.png b/Resources/images/boolCommon.png
deleted file mode 100644
index b5a883a0e0ab2052dc152fd68d417903bfc252fe..0000000000000000000000000000000000000000
Binary files a/Resources/images/boolCommon.png and /dev/null differ
diff --git a/Resources/images/boolCut.png b/Resources/images/boolCut.png
deleted file mode 100644
index b53a7c4a88247a1bfd09973b893cbbdba97dbcc9..0000000000000000000000000000000000000000
Binary files a/Resources/images/boolCut.png and /dev/null differ
diff --git a/Resources/images/copy.png b/Resources/images/copy.png
deleted file mode 100644
index 32048eeb31b06ea6c5b7e721879cfb1ce45d819f..0000000000000000000000000000000000000000
Binary files a/Resources/images/copy.png and /dev/null differ
diff --git a/Resources/images/fillet.png b/Resources/images/fillet.png
deleted file mode 100644
index 98071f475ca659cccfa4fc555595c799aa6082a4..0000000000000000000000000000000000000000
Binary files a/Resources/images/fillet.png and /dev/null differ
diff --git a/Resources/images/new.png b/Resources/images/new.png
deleted file mode 100644
index 12131b01008a3ec29ec69f8b3f65c4b3c15b60d6..0000000000000000000000000000000000000000
Binary files a/Resources/images/new.png and /dev/null differ
diff --git a/Resources/images/open.png b/Resources/images/open.png
deleted file mode 100644
index 45fa2883a71fcb891f1ef7c0c217d71eeae284bc..0000000000000000000000000000000000000000
Binary files a/Resources/images/open.png and /dev/null differ
diff --git a/Resources/images/paste.png b/Resources/images/paste.png
deleted file mode 100644
index c14425cad1ff1b2c5628be5769c9e9e52b78635f..0000000000000000000000000000000000000000
Binary files a/Resources/images/paste.png and /dev/null differ
diff --git a/Resources/images/save.png b/Resources/images/save.png
deleted file mode 100644
index daba865fafd22fa18e7c0488eb699b79d3554170..0000000000000000000000000000000000000000
Binary files a/Resources/images/save.png and /dev/null differ
diff --git a/Src/Core/ACAMCore.cpp b/Src/Core/ACAMCore.cpp
index d08ddaba115726a6a0495674dfef5546256c591f..8bf06fa0523a6deed6c6fec6011ac2672da8a5ae 100644
--- a/Src/Core/ACAMCore.cpp
+++ b/Src/Core/ACAMCore.cpp
@@ -16,7 +16,6 @@
#include "ACAMCore.h"
#include "DataManager.h"
-#include "UndoRedoHandler.h"
#include
@@ -25,7 +24,7 @@
using namespace acamcad;
-AMCore::AMCore() : dataManager_(nullptr)
+AMCore::AMCore() : dataManager_(nullptr), listener_(nullptr)
{
init();
@@ -35,9 +34,9 @@ AMCore::AMCore() : dataManager_(nullptr)
void AMCore::init()
{
- addNewDataTypeFile(FILE_EXT_AMCAX_BREP, DataType::BREP_TYPE);
- addNewDataTypeFile(FILE_EXT_STEP, DataType::BREP_TYPE);
- addNewDataTypeFile(FILE_EXT_STP, DataType::BREP_TYPE);
+ //addNewDataTypeFile(FILE_EXT_AMCAX_BREP, DataType::BREP_TYPE);
+ //addNewDataTypeFile(FILE_EXT_STEP, DataType::BREP_TYPE);
+ //addNewDataTypeFile(FILE_EXT_STP, DataType::BREP_TYPE);
inlineSingleOperation();
inlineMultOperation();
@@ -486,6 +485,7 @@ void AMCore::OperateSelectedObject(const SelectModel& s_model, const SelectInfoW
{
if (obj->dataType() == DataType::MESH_TYPE) {
//AdapterObject* adapter = dynamic_cast(obj);
+ ///obj->mesh->mesh()->numPolygons();
dataManager_->RecordModifyBegin({ obj });
@@ -739,8 +739,16 @@ void AMCore::OperateSelectedObject_Subset(const SelectModel& s_model, std::vecto
if (s_id.empty())
return;
- BaseObject* obj = dataManager_->getObjectByPersistentID(object_list[0]);
+ AdapterObject* obj = dataManager_->getObjectByPersistentID(object_list[0]);
+ AdapterObject* copy_obj = obj->duplicateFaces(s_id);
+
+ if (copy_obj) {
+ copy_obj->updateDraw();
+ dataManager_->addObject(copy_obj);
+ dataManager_->RecordAddObject({ copy_obj });
+
+ }
}
}
@@ -912,88 +920,65 @@ void AMCore::Undo()
void AMCore::createSubdSphereObject(const MPoint3& center, double radius, size_t subtime)
{
+ if (subtime <= 0)
+ return;
+
//MSphere sphere(center, radius);
CreateOperate_QuadballTSpline cQuadball(center, radius, subtime);
+ createObject(&cQuadball, DataType::TSPLINEU_TYPE);
- //TSplineUObject* newObject = new TSplineUObject();
- //newObject->doOperate(&cQuadball);
-
- //dataManager_->addObject(newObject);
- //createBackupAdd(newObject);
- AdapterObject* object = new AdapterObject;
- object->setDataType(DataType::TSPLINEU_TYPE);
- cQuadball.operate(object);
- dataManager_->addObject(object);
- dataManager_->RecordAddObject({ object });
}
void AMCore::createCylinderObject(const MPoint3& b_center, const AMCAX::Vector3& axis, double radius, double height,
size_t rf_num, size_t vf_num, bool top, bool bottom)
{
+ if (vf_num <= 0 || rf_num <= 0)
+ return;
+
//AMCAX::Frame3 frame(b_center, AMCAX::Direction3(axis.Coord()));
//MCylinder cylinder(b_center, axis, radius, height);
CreateOperate_CylinderTSpline cCylinder(b_center, axis, radius, height, rf_num, vf_num, top, bottom);
+ createObject(&cCylinder, DataType::TSPLINEU_TYPE);
- AdapterObject* object = new AdapterObject;
- object->setDataType(DataType::TSPLINEU_TYPE);
-
- cCylinder.operate(object);
- dataManager_->addObject(object);
- dataManager_->RecordAddObject({ object });
-
- //TSplineUObject* newObject = new TSplineUObject();
- //newObject->doOperate(&cCylinder);
-
- //dataManager_->addObject(newObject);
- //createBackupAdd(newObject);
}
void AMCore::createConeObject(const MPoint3& b_center, const AMCAX::Vector3& axis, double radius, double height,
size_t rf_num, size_t vf_num, bool bottom)
{
+ if (rf_num <= 0 || vf_num <= 0)
+ return;
//MCone cone(b_center, axis, radius, height);
CreateOperate_ConeTSpline cCone(b_center, axis, radius, height, rf_num, vf_num, bottom);
-
- AdapterObject* object = new AdapterObject;
- object->setDataType(DataType::TSPLINEU_TYPE);
-
- cCone.operate(object);
-
- dataManager_->addObject(object);
- dataManager_->RecordAddObject({ object });
+ createObject(&cCone, DataType::TSPLINEU_TYPE);
}
void AMCore::creatTourObject(const MPoint3& center, double radius0, double radius1, size_t rf_num, size_t vf_num)
{
+ if (rf_num <= 0 || vf_num <= 0)
+ return;
+
//MTorus tours(center, radius0, radius1);
AMCAX::Coord3 coord(center.Coord());
CreateOperate_TorusTSpline cTorus(coord, AMCAX::Coord3(0.0, 0.0, 1.0), radius0, radius1, rf_num, vf_num);
+ createObject(&cTorus, DataType::TSPLINEU_TYPE);
- AdapterObject* object = new AdapterObject;
- object->setDataType(DataType::TSPLINEU_TYPE);
-
- cTorus.operate(object);
-
- dataManager_->addObject(object);
- dataManager_->RecordAddObject({ object });
}
void AMCore::createCircular(const MPoint3& center, double radius, double angle, size_t c_num)
{
- CreateOperate_CircularTSpline cCircular(center.Coord(), AMCAX::Coord3(0.0, 0.0, 1.0), radius, angle, c_num);
- AdapterObject* object = new AdapterObject;
- object->setDataType(DataType::TSPLINEU_TYPE);
+ if (c_num <= 0)
+ return;
- cCircular.operate(object);
- dataManager_->addObject(object);
- dataManager_->RecordAddObject({ object });
+ CreateOperate_CircularTSpline cCircular(center.Coord(), AMCAX::Coord3(0.0, 0.0, 1.0), radius, angle, c_num);
+ createObject(&cCircular, DataType::TSPLINEU_TYPE);
+
}
diff --git a/Src/Core/ACAMCore.h b/Src/Core/ACAMCore.h
index d1c6decf699848571671064630f8206ff9225a78..964634725bd211ca0739dfa37c6c731cb32b1243 100644
--- a/Src/Core/ACAMCore.h
+++ b/Src/Core/ACAMCore.h
@@ -20,15 +20,23 @@
#include "CoreDefine.h"
#include "../Object/ObjectDefine.h"
-#include "../Record/Record.h"
#include
+#define FILE_EXT_AMCAX "amcax"
+#define FILE_EXT_AMCAX_BREP "abr"
+#define FILE_EXT_AMCAX_TMS "tms"
+#define FILE_EXT_AMCAX_SUBD "obj"
+#define FILE_AMCAX_CONTROL "control.json"
+#define FILE_EXT_STEP "step"
+#define FILE_EXT_STP "stp"
+
namespace acamcad
{
- const QString FILE_EXT_AMCAX_BREP("abr");
- const QString FILE_EXT_STEP("step");
- const QString FILE_EXT_STP("stp");
+ //const QString FILE_EXT_AMCAX("amcax");
+ //const QString FILE_EXT_AMCAX_BREP("abr");
+ //const QString FILE_EXT_STEP("step");
+ //const QString FILE_EXT_STP("stp");
class DataManager;
//class BackupManager;
@@ -36,6 +44,13 @@ namespace acamcad
class MultOperate;
class UndoRedoHandler;
+ class AMCoreListener
+ {
+ public:
+ virtual void refresh_title(QString title) = 0;
+ virtual void refresh_file(QString title) = 0;
+ };
+
class AMCore : public QObject
{
Q_OBJECT
@@ -43,32 +58,43 @@ namespace acamcad
public:
AMCore();
+ void setListener(AMCoreListener* listener)
+ {
+ listener_ = listener;
+ }
+
+
void init();
~AMCore();
+
+ void loadObjectsFromFile(const QString& filename);
+
public slots:
void loadObjects();
void saveObjects();
- void saveObjects(const QString& filename);
+ bool saveObjects(const QString& filename);
void saveSelectedObjects();
+ bool newObjects();
+ void saveAsObjects();
private:
- void loadObjectsFromFile(const QString& filename);
+ bool loadObjectsFromFile1(const QString& filename);
private:
- void saveObjectsToFile(const QString& filename, std::vector::const_iterator& it_begin, std::vector::const_iterator& it_end);
+ bool saveObjectsToFile(const QString& filename, std::vector::const_iterator& it_begin, std::vector::const_iterator& it_end);
public:
//=============== BRep =======
- void createBRepObject(acamcad::MOperation* operate, const std::string& label);
+ void createObject(acamcad::MOperation* operate, acamcad::DataType type, const std::string& label="");
int getLastPersistentId();
- void createPlaneBRepObject(const AMCAX::Coord3& first, const AMCAX::Coord3& second, const std::string& label = "");
+ void createPlaneBRepObject(const AMCAX::Coord2& first, const AMCAX::Coord2& second, const std::string& label = "");
void createCubeBRepObject(const AMCAX::Coord3& first, const AMCAX::Coord3& second, const std::string& label = "");
- void createSphereBRepObject(const AMCAX::Coord3& center, double radius, double angle1, double angle2, double angle3, const std::string& label = "");
+ void createSphereBRepObject(const AMCAX::Coord3& center, double radius, double angle1, const std::string& label = "");
void createCylinderBRepObject(const AMCAX::Coord3& b_center, const AMCAX::Coord3& axis, double radius, double height, double angle, const std::string& label = "");
void createCylinderBRepObject(const AMCAX::Coord3& b_center, const AMCAX::Coord3& axis, const AMCAX::Coord3& xaxis, double radius, double height, double angle, const std::string& label = "");
void createConeBRepObject(const AMCAX::Coord3& b_center, const AMCAX::Coord3& axis, double radiusR, double radiusr, double height, double angle, const std::string& label = "");
@@ -88,12 +114,12 @@ namespace acamcad
void createWedgeBRepObject(const AMCAX::Coord3& center, const AMCAX::Coord3& axis, const double dx, const double dy, const double dz, const double xmin, const double zmin, const double xmax, const double zmax, const std::string& label = "");
//Mesh
- void createPlaneMeshObject(MPoint3& p0, MPoint3& p1, size_t u_num, size_t v_num);
- void createCubeMeshObject(const MPoint3& first, const MPoint3& second, size_t x_num = 2, size_t y_num = 2, size_t z_num = 2);
+ void createPlaneMeshObject(AMCAX::Coord2& p0, AMCAX::Coord2& p1, size_t u_num, size_t v_num);
+ void createCubeMeshObject(const AMCAX::Coord3& first, const AMCAX::Coord3& second, size_t x_num = 2, size_t y_num = 2, size_t z_num = 2);
//TSpline
- void createPlaneObject(MPoint3& p0, MPoint3& p1, size_t u_num, size_t v_num);
- void createCubeObject(const MPoint3& first, const MPoint3& second, size_t x_num, size_t y_num, size_t z_num);
+ void createPlaneObject(AMCAX::Coord2& p0, AMCAX::Coord2& p1, size_t u_num, size_t v_num);
+ void createCubeObject(const AMCAX::Coord3& first, const AMCAX::Coord3& second, size_t x_num, size_t y_num, size_t z_num);
void createUVSphereObject(const MPoint3& center, double radius, size_t rf_num, size_t vf_num);
void createSubdSphereObject(const MPoint3& center, double radius, size_t subtime);
void createCylinderObject(const MPoint3& b_center, const AMCAX::Vector3& axis, double radius, double height,
@@ -171,7 +197,7 @@ namespace acamcad
//void createBackupNormalOp(BaseObject* object);
public:
- void addNewDataTypeFile(const QString&, const DataType&);
+ //void addNewDataTypeFile(const QString&, const DataType&);
void setOperationDataType(OperationDataType type);
void setMeshOperationType(MeshOperationType type);
@@ -180,7 +206,7 @@ namespace acamcad
MeshOperationType getMeshOperationType() const { return mesh_op_type_; }
private:
- std::map file_allowed_type_; //允许的文件类型,string对应到type
+ //std::map file_allowed_type_; //允许的文件类型,string对应到type
OperationDataType op_datatype_; //only use it for some creat function
MeshOperationType mesh_op_type_;
@@ -198,12 +224,15 @@ namespace acamcad
void setDataManager(DataManager* dataManager);
DataManager* getDataManager() const;
+ QString file_;
+
//void setBackupManager(BackupManager* backManager);
//void setRecord(Record& record) { record_ = &record; }
private:
DataManager* dataManager_;
+ AMCoreListener* listener_;
//BackupManager* backupManager_;
//UndoRedoHandler* undoRedoHandler_;
};
diff --git a/Src/Core/ACAMCoreCreate.cpp b/Src/Core/ACAMCoreCreate.cpp
index 38d2feccdb5fd2455a6e0745121c7f028e587f76..87d0f9d0dfd2307e273f17ff9effcd618dcbb03e 100644
--- a/Src/Core/ACAMCoreCreate.cpp
+++ b/Src/Core/ACAMCoreCreate.cpp
@@ -19,7 +19,6 @@
#include "../Operation/OperationDefine.h"
#include
-#include "UndoRedoHandler.h"
#include "../Utils/MathUtils.h"
#define M_EPSILON 1.0e-8
@@ -98,7 +97,7 @@ namespace acamcad
bool arenum = (cR1 != FP_NAN) && (cR2 != FP_NAN) && (cH != FP_NAN) && (cA != FP_NAN);
arenum &= (cR1 != FP_INFINITE) && (cR2 != FP_INFINITE) && (cH != FP_INFINITE) && (cA != FP_INFINITE);
- bool arepositive = ((r2 > M_EPSILON && r2 > M_EPSILON) || // both positive, truncated cone
+ bool arepositive = ((r2 > M_EPSILON) || // both positive, truncated cone
(cR1 == FP_ZERO && r2 > M_EPSILON) || (cR2 == FP_ZERO && r1 > M_EPSILON)) && // regular cone
(h > M_EPSILON);
@@ -198,20 +197,26 @@ namespace acamcad
{
//=================================== BRep ===================================
- void AMCore::createBRepObject(MOperation* operate, const std::string& label)
+ void AMCore::createObject(MOperation* operate, acamcad::DataType type, const std::string& label)
{
AdapterObject* adapter_object = new AdapterObject;
- adapter_object->setDataType(acamcad::DataType::BREP_TYPE);
+ adapter_object->setDataType(type);
//adapter_object->bRep = std::make_unique(adapter_object);
//BRepObject* newObject = new BRepObject();
adapter_object->setLabel(label);
- operate->operate(adapter_object);
- //adapter_object->doOperate(operate);
+ if (operate->operate(adapter_object)) {
+ //adapter_object->doOperate(operate);
+
+ dataManager_->addObject(adapter_object);
+ dataManager_->RecordAddObject({ adapter_object });
+ //undoRedoHandler_->recordOperation(adapter_object, ActionType::AddObject);
+ }
+ else
+ {
+ delete adapter_object;
+ }
- dataManager_->addObject(adapter_object);
- dataManager_->RecordAddObject({ adapter_object });
- //undoRedoHandler_->recordOperation(adapter_object, ActionType::AddObject);
}
@@ -219,14 +224,14 @@ namespace acamcad
return dataManager_->getLastPersistentId();
}
- void AMCore::createPlaneBRepObject(const AMCAX::Coord3& first, const AMCAX::Coord3& second, const std::string& label)
+ void AMCore::createPlaneBRepObject(const AMCAX::Coord2& p0p, const AMCAX::Coord2& p1p, const std::string& label)
{
- AMCAX::Coord2 p0p(first.X(), first.Y());
- AMCAX::Coord2 p1p(second.X(), second.Y());
+ //AMCAX::Coord2 p0p(first.X(), first.Y());
+ //AMCAX::Coord2 p1p(second.X(), second.Y());
CreateOperate_Plane cPlane(p0p, p1p, 1, 1);
- createBRepObject(&cPlane, label);
+ createObject(&cPlane, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createCubeBRepObject(const AMCAX::Coord3& first, const AMCAX::Coord3& second, const std::string& label)
@@ -237,21 +242,20 @@ namespace acamcad
CreateOperate_Cube cCube(first, second, 1, 1, 1);
- createBRepObject(&cCube, label);
+ createObject(&cCube, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createSphereBRepObject(const AMCAX::Coord3& center, double radius,
- double angle1, double angle2, double angle3,
- const std::string& label)
+ double angle1, const std::string& label)
{
if (!CheckSphereParamOK(radius, angle1))
{
return; // angle2 and angle3 is currently not used. range unknown.
}
- CreateOperate_Sphere cSphere(center, radius, angle1, angle2, angle3);
+ CreateOperate_Sphere cSphere(center, radius, angle1);
- createBRepObject(&cSphere, label);
+ createObject(&cSphere, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createCylinderBRepObject(const AMCAX::Coord3& b_center, const AMCAX::Coord3& axis,
@@ -265,7 +269,7 @@ namespace acamcad
CreateOperate_Cylinder cCylinder(b_center, radius, height, axis, angle);
- createBRepObject(&cCylinder, label);
+ createObject(&cCylinder, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createCylinderBRepObject(const AMCAX::Coord3& b_center, const AMCAX::Coord3& axis, const AMCAX::Coord3& xaxis,
@@ -279,7 +283,7 @@ namespace acamcad
CreateOperate_Cylinder cCylinder(b_center, radius, height, axis, xaxis, angle);
- createBRepObject(&cCylinder, label);
+ createObject(&cCylinder, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createConeBRepObject(const AMCAX::Coord3& b_center, const AMCAX::Coord3& axis,
@@ -293,7 +297,7 @@ namespace acamcad
CreateOperate_Cone cTCone(b_center, axis, radiusR, radiusr, height, angle);
- createBRepObject(&cTCone, label);
+ createObject(&cTCone, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createConeBRepObject(const AMCAX::Coord3& b_center, const AMCAX::Coord3& axis, const AMCAX::Coord3& xaxis,
@@ -306,7 +310,7 @@ namespace acamcad
CreateOperate_Cone cTCone(b_center, axis, xaxis, radiusR, radiusr, height, angle);
- createBRepObject(&cTCone, label);
+ createObject(&cTCone, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createTorusBRepObject(const AMCAX::Coord3& center, const AMCAX::Coord3& axis,
@@ -320,7 +324,7 @@ namespace acamcad
}
CreateOperate_Torus cTorus(center, radius0, radius1, axis, angle);
- createBRepObject(&cTorus, label);
+ createObject(&cTorus, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createTorusBRepObject(const AMCAX::Coord3& center, const AMCAX::Coord3& axis, const AMCAX::Coord3& xaxis,
@@ -334,7 +338,7 @@ namespace acamcad
CreateOperate_Torus cTorus(center, radius0, radius1, axis, xaxis, angle);
- createBRepObject(&cTorus, label);
+ createObject(&cTorus, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createPolygonBRepObject(const std::vector& points, const std::string& label)
@@ -345,7 +349,7 @@ namespace acamcad
}
CreateOperate_Polygon cPolygon(points);
- createBRepObject(&cPolygon, label);
+ createObject(&cPolygon, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createPrismBRepObject(const std::vector& points, const AMCAX::Coord3d& prism_axis, const std::string& label)
@@ -356,7 +360,7 @@ namespace acamcad
}
CreateOperate_Prism cPrism(points, prism_axis);
- createBRepObject(&cPrism, label);
+ createObject(&cPrism, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createRoundedPolygonBRepObject(const std::vector& points, const std::string& label)
@@ -364,7 +368,7 @@ namespace acamcad
// TODO: CheckParamOk
CreateOperate_RoundedPolygon cRPolygon(points);
- createBRepObject(&cRPolygon, label);
+ createObject(&cRPolygon, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createRoundedPrismBRepObject(const std::vector& points, const AMCAX::Coord3& prism_axis, const std::string& label)
@@ -372,7 +376,7 @@ namespace acamcad
// TODO: CheckParamOk
CreateOperate_RoundedPrism cRPrism(points, prism_axis);
- createBRepObject(&cRPrism, label);
+ createObject(&cRPrism, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createWedgeBRepObject(const double dx, const double dy, const double dz, const double ltx,
@@ -380,7 +384,7 @@ namespace acamcad
{
CreateOperate_Wedge cWedge(dx, dy, dz, ltx);
- createBRepObject(&cWedge, label);
+ createObject(&cWedge, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createWedgeBRepObject(const AMCAX::Coord3& center,
@@ -389,7 +393,7 @@ namespace acamcad
{
CreateOperate_Wedge cWedge(center, dx, dy, dz, ltx);
- createBRepObject(&cWedge, label);
+ createObject(&cWedge, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createWedgeBRepObject(const AMCAX::Coord3& center, const AMCAX::Coord3& axis,
@@ -397,7 +401,7 @@ namespace acamcad
const std::string& label)
{
CreateOperate_Wedge cWedge(center, axis, dx, dy, dz, ltx);
- createBRepObject(&cWedge, label);
+ createObject(&cWedge, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createWedgeBRepObject(const double dx, const double dy, const double dz,
@@ -406,7 +410,7 @@ namespace acamcad
{
CreateOperate_Wedge cWedge(dx, dy, dz, xmin, zmin, xmax, zmax);
- createBRepObject(&cWedge, label);
+ createObject(&cWedge, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createWedgeBRepObject(const AMCAX::Coord3& center,
@@ -416,7 +420,7 @@ namespace acamcad
{
CreateOperate_Wedge cWedge(center, dx, dy, dz, xmin, zmin, xmax, zmax);
- createBRepObject(&cWedge, label);
+ createObject(&cWedge, acamcad::DataType::BREP_TYPE, label);
}
void AMCore::createWedgeBRepObject(const AMCAX::Coord3& center, const AMCAX::Coord3& axis,
@@ -425,104 +429,59 @@ namespace acamcad
{
CreateOperate_Wedge cWedge(center, axis, dx, dy, dz, xmin, zmin, xmax, zmax);
- createBRepObject(&cWedge, label);
+ createObject(&cWedge, acamcad::DataType::BREP_TYPE, label);
}
//Mesh
- void AMCore::createPlaneMeshObject(MPoint3& p0, MPoint3& p1, size_t u_num, size_t v_num)
+ void AMCore::createPlaneMeshObject(AMCAX::Coord2& p0p, AMCAX::Coord2& p1p, size_t u_num, size_t v_num)
{
+ if (u_num <= 0 || v_num <= 0)
+ return;
//MPlane plane;
- AMCAX::Coord2 p0p(p0.X(), p0.Y());
- AMCAX::Coord2 p1p(p1.X(), p1.Y());
+ //AMCAX::Coord2 p0p(p0.X(), p0.Y());
+ //AMCAX::Coord2 p1p(p1.X(), p1.Y());
CreateOperate_PlaneMesh cPlane(p0p, p1p, u_num, v_num);
-
- AdapterObject* adapter = new AdapterObject;
- adapter->setDataType(acamcad::DataType::MESH_TYPE);
-
- //adapter->doOperate(&cPlane);
-
- cPlane.operate(adapter);
-
-
- //MeshObject* newObject = new MeshObject();
- //newObject->doOperate(&cPlane);
-
- dataManager_->addObject(adapter);
- //createBackupAdd(newObject);
- //undoRedoHandler_->recordOperation(adapter, ActionType::AddObject);
- dataManager_->RecordAddObject({ adapter });
+ createObject(&cPlane, acamcad::DataType::MESH_TYPE);
}
- void AMCore::createCubeMeshObject(const MPoint3& first, const MPoint3& second,
+ void AMCore::createCubeMeshObject(const AMCAX::Coord3& c0, const AMCAX::Coord3& c1,
size_t x_num, size_t y_num, size_t z_num)
{
- AMCAX::Coord3 c0(first.X(), first.Y(), first.Z()), c1(second.X(), second.Y(), second.Z());
+ //AMCAX::Coord3 c0(first.X(), first.Y(), first.Z()), c1(second.X(), second.Y(), second.Z());
+ if (x_num <= 0 || y_num <= 0 || z_num <= 0)
+ return;
CreateOperate_CubeMesh cCube(c0, c1, x_num, y_num, z_num);
-
- AdapterObject* adapter = new AdapterObject;
- adapter->setDataType(acamcad::DataType::MESH_TYPE);
-
- cCube.operate(adapter);
-
-
- dataManager_->addObject(adapter);
- //dataManager_->addObject(adapter);
- //createBackupAdd(newObject);
- //undoRedoHandler_->recordOperation(adapter, ActionType::AddObject);
- dataManager_->RecordAddObject({ adapter });
+ createObject(&cCube, acamcad::DataType::MESH_TYPE);
}
- void AMCore::createPlaneObject(MPoint3& p0, MPoint3& p1, size_t u_num, size_t v_num)
+ void AMCore::createPlaneObject(AMCAX::Coord2& p0p, AMCAX::Coord2& p1p, size_t u_num, size_t v_num)
{
- //MPlane plane;
- AMCAX::Coord2 p0p(p0.X(), p0.Y());
- AMCAX::Coord2 p1p(p1.X(), p1.Y());
- CreateOperate_PlaneTSpline cPlane(p0p, p1p, u_num, v_num);
-
- AdapterObject* adapter = new AdapterObject;
- adapter->setDataType(acamcad::DataType::TSPLINEU_TYPE);
-
- cPlane.operate(adapter);
-
- dataManager_->addObject(adapter);
-
- dataManager_->RecordAddObject({ adapter });
+ if (u_num <= 0 || v_num <= 0)
+ return;
- //createBackupAdd(newObject);
+ CreateOperate_PlaneTSpline cPlane(p0p, p1p, u_num, v_num);
+ createObject(&cPlane, acamcad::DataType::TSPLINEU_TYPE);
}
- void AMCore::createCubeObject(const MPoint3& first, const MPoint3& second, size_t x_num, size_t y_num, size_t z_num)
+ void AMCore::createCubeObject(const AMCAX::Coord3& min_bb, const AMCAX::Coord3& max_bb, size_t x_num, size_t y_num, size_t z_num)
{
- AMCAX::Coord3 min_bb = first.Coord(),
- max_bb = second.Coord();
+ if (x_num <= 0 || y_num <= 0 || z_num <= 0)
+ return;
+ //AMCAX::Coord3 min_bb = first.Coord(),
+ // max_bb = second.Coord();
CreateOperate_CubeTSpline cCube(min_bb, max_bb, x_num, y_num, z_num);
-
-
- AdapterObject* adapter = new AdapterObject;
- adapter->setDataType(acamcad::DataType::TSPLINEU_TYPE);
-
- cCube.operate(adapter);
-
- dataManager_->addObject(adapter);
-
- dataManager_->RecordAddObject({ adapter });
+ createObject(&cCube, acamcad::DataType::TSPLINEU_TYPE);
}
void AMCore::createUVSphereObject(const MPoint3& center, double radius, size_t rf_num, size_t vf_num)
{
+ if (rf_num <= 0 || vf_num <= 0)
+ return;
//MSphere sphere(center, radius);
CreateOperate_SphereTSpline cSphere(center.Coord(), radius, rf_num, vf_num);
-
- AdapterObject* adapter = new AdapterObject;
- adapter->setDataType(acamcad::DataType::TSPLINEU_TYPE);
-
- cSphere.operate(adapter);
-
- dataManager_->addObject(adapter);
-
- dataManager_->RecordAddObject({ adapter });
+ createObject(&cSphere, acamcad::DataType::TSPLINEU_TYPE);
}
//===========================================================
diff --git a/Src/Core/ACAMCoreFile.cpp b/Src/Core/ACAMCoreFile.cpp
index 337fbff529b0403349575ae6c139907069c6853e..fa8465bea2f89bd705f60e6e9a12a2cf9361c1df 100644
--- a/Src/Core/ACAMCoreFile.cpp
+++ b/Src/Core/ACAMCoreFile.cpp
@@ -28,61 +28,156 @@
#include
#include
#include
-
+#include
+#include
+#include
+#include
#include "DataManager.h"
+#include
+#include
+#include
+#include
+
+namespace
+{
+ QString defaultDir = ".";
+}
+
namespace acamcad
{
- void AMCore::addNewDataTypeFile(const QString& str, const DataType& dt)
- {
- file_allowed_type_[str] = dt;
- }
+ //void AMCore::addNewDataTypeFile(const QString& str, const DataType& dt)
+ //{
+ // file_allowed_type_[str] = dt;
+ //}
void AMCore::loadObjects()
{
- static QString defaultDir = ".";
- QString filter = "AMCAX BRep files (" "*." + FILE_EXT_AMCAX_BREP + ")";
- QString stepFilter = "STEP files (" "*." + FILE_EXT_STP + " " "*." + FILE_EXT_STEP + ")";
- QString finalFilter = filter + ";;" + stepFilter;
+ ///QZipReader zipreader("");
+ //static QString defaultDir = ".";
+ QString filterAM = "AMCAX files (" "*." FILE_EXT_AMCAX ")";
+ QString filter = "AMCAX BRep files (" "*." FILE_EXT_AMCAX_BREP ")";
+ QString stepFilter = "STEP files (" "*." FILE_EXT_STP " " "*." FILE_EXT_STEP ")";
+ QString finalFilter = filterAM + ";;" + filter + ";;" + stepFilter;
QString fileName = QFileDialog::getOpenFileName(NULL, "", defaultDir, finalFilter);
+ loadObjectsFromFile(fileName);
+ }
+
+ void AMCore::loadObjectsFromFile(const QString& fileName)
+ {
if (!fileName.isEmpty())
{
- auto lpos = std::max(fileName.lastIndexOf("/"), fileName.lastIndexOf("\\"));
- defaultDir = fileName.left(lpos + 1);
- loadObjectsFromFile(fileName);
+ bool result = loadObjectsFromFile1(fileName);
+
+ if (result && file_.isEmpty())
+ {
+ file_ = fileName;
+
+ if (listener_)
+ listener_->refresh_title(file_);
+ }
+
+ if (listener_)
+ listener_->refresh_file(fileName);
}
}
void AMCore::saveObjects()
{
- static QString defaultDir = ".";
- QString filter = "AMCAX BRep files (" "*." + FILE_EXT_AMCAX_BREP + ")";
- QString stepFilter = "STEP files (" "*." + FILE_EXT_STP + " " "*." + FILE_EXT_STEP + ")";
- QString finalFilter = filter + ";;" + stepFilter;
+ //std::cout << "AMCore::saveObjects " << QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation).toStdString() << std::endl;
+ if (file_.isEmpty())
+ {
+ //static QString defaultDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
+ QString filterAM = "AMCAX files (" "*." FILE_EXT_AMCAX ")";
+ //QString filter = "AMCAX BRep files (" "*." FILE_EXT_AMCAX_BREP ")";
+ //QString stepFilter = "STEP files (" "*." FILE_EXT_STP " " "*." FILE_EXT_STEP ")";
+ QString finalFilter = filterAM;
+ QString fileName = QFileDialog::getSaveFileName(NULL, "", defaultDir, finalFilter);
+
+ if (saveObjects(fileName))
+ {
+ file_ = fileName;
+
+ if (listener_)
+ listener_->refresh_title(file_);
+ }
+
+ }
+ else
+ {
+ saveObjects(file_);
+ }
+
+
+ }
+
+ bool AMCore::newObjects()
+ {
+ //QString defaultDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
+ QString filterAM = "AMCAX files (" "*." FILE_EXT_AMCAX ")";
+ //QString filter = "AMCAX BRep files (" "*." FILE_EXT_AMCAX_BREP ")";
+ //QString stepFilter = "STEP files (" "*." FILE_EXT_STP " " "*." FILE_EXT_STEP ")";
+ QString finalFilter = filterAM;
+ QString fileName = QFileDialog::getSaveFileName(NULL, "", defaultDir, finalFilter);
+
+ if (saveObjects(fileName))
+ {
+ file_ = fileName;
+
+ if (listener_)
+ listener_->refresh_title(file_);
+
+ return true;
+ }
+ else
+ return false;
+ }
+
+
+ void AMCore::saveAsObjects()
+ {
+ ///QString defaultDir = QStandardPaths::writableLocation(QStandardPaths::DocumentsLocation);
+ QString filterAM = "AMCAX files (" "*." FILE_EXT_AMCAX ")";
+ //QString filter = "AMCAX BRep files (" "*." FILE_EXT_AMCAX_BREP ")";
+ QString stepFilter = "STEP files (" "*." FILE_EXT_STP " " "*." FILE_EXT_STEP ")";
+ QString finalFilter = filterAM + ";;" + stepFilter;
QString fileName = QFileDialog::getSaveFileName(NULL, "", defaultDir, finalFilter);
- saveObjects(fileName);
+ if (saveObjects(fileName))
+ {
+ file_ = fileName;
+
+ if (listener_)
+ listener_->refresh_title(file_);
+ }
+
}
- void AMCore::saveObjects(const QString& filename)
+ bool AMCore::saveObjects(const QString& filename)
{
if (!filename.isEmpty())
{
CObjectIter it_begin = dataManager_->objects_begin();
CObjectIter it_end = dataManager_->objects_end();
- saveObjectsToFile(filename, it_begin, it_end);
+
+
+ if (listener_)
+ listener_->refresh_file(filename);
+
+ return saveObjectsToFile(filename, it_begin, it_end);
}
}
void AMCore::saveSelectedObjects()
{
- static QString defaultDir = ".";
- QString filter = "AMCAX BRep files (" "*." + FILE_EXT_AMCAX_BREP + ")";
- QString stepFilter = "STEP files (" "*." + FILE_EXT_STP + " " "*." + FILE_EXT_STEP + ")";
- QString finalFilter = filter + ";;" + stepFilter;
+ //static QString defaultDir = ".";
+ QString filterAM = "AMCAX files (" "*." FILE_EXT_AMCAX ")";
+ //QString filter = "AMCAX BRep files (" "*." FILE_EXT_AMCAX_BREP ")";
+ QString stepFilter = "STEP files (" "*." FILE_EXT_STP " " "*." FILE_EXT_STEP ")";
+ QString finalFilter = filterAM + ";;" + stepFilter;
QString filename = QFileDialog::getSaveFileName(NULL, "", defaultDir, finalFilter);
if (!filename.isEmpty())
@@ -96,26 +191,28 @@ namespace acamcad
}
}
- void AMCore::loadObjectsFromFile(const QString& filename)
+ bool AMCore::loadObjectsFromFile1(const QString& filename)
{
+ auto lpos = std::max(filename.lastIndexOf("/"), filename.lastIndexOf("\\"));
+ defaultDir = filename.left(lpos + 1);
+
+
QFileInfo fi(filename);
QString filepath = fi.absoluteFilePath();
QFile file(filepath);
QString ext1 = fi.suffix();
if (fi.isDir() || !file.exists())
- return;
+ return false;
if (!file.open(QIODevice::ReadOnly))
- return;
+ return false;
std::vector vec;
-
-
- QTextStream in(&file);
- QString content = in.readAll();
- std::istringstream fin(content.toStdString(), std::istream::in);
if (auto lext1 = ext1.toLower(); lext1 == FILE_EXT_STP || lext1 == FILE_EXT_STEP)
{ //stp file
+ QTextStream in(&file);
+ QString content = in.readAll();
+ std::istringstream fin(content.toStdString(), std::istream::in);
AMCAX::STEP::StepReader stepReader(fin);
stepReader.Read();
AMCAX::STEP::StepDataList shapes = stepReader.GetShapes();
@@ -136,6 +233,9 @@ namespace acamcad
}
else if (ext1 == FILE_EXT_AMCAX_BREP) //abr file
{
+ QTextStream in(&file);
+ QString content = in.readAll();
+ std::istringstream fin(content.toStdString(), std::istream::in);
AMCAX::TopoShape shapeCmp;
AMCAX::ShapeTool::Read(shapeCmp, fin);
@@ -153,34 +253,99 @@ namespace acamcad
vec.push_back(adapter_object);
}
}
+ else if (ext1 == FILE_EXT_AMCAX)
+ {
+ file.close();
+ QZipReader zip(filename);
+
+ if (zip.isReadable())
+ {
+ {
+ QByteArray array = zip.fileData(FILE_AMCAX_CONTROL);
+
+ QJsonParseError jsonError;
+ QJsonDocument doc = QJsonDocument::fromJson(array, &jsonError);
+
+ if (jsonError.error != QJsonParseError::NoError && !doc.isNull())
+ {
+ return false;
+ }
+
+ if (doc["version"].toInt() != 1)
+ {
+ return false;
+ }
+
+ }
+
+ for (int i = 0; i < zip.fileInfoList().size(); i++)
+ {
+ QByteArray dt = zip.fileInfoList().at(i).filePath.toUtf8();
+ QString strtemp = QString::fromLocal8Bit(dt);
+
+ if (strtemp == FILE_AMCAX_CONTROL)
+ continue;
+
+ QByteArray array = zip.fileData(strtemp);
+
+ QFileInfo info(strtemp);
+
+ std::istringstream context(array.toStdString(), std::istream::in);
+
+ AdapterObject* adapter_object = new AdapterObject;
+ if (info.suffix() == FILE_EXT_AMCAX_BREP)
+ {
+ adapter_object->setDataType(acamcad::DataType::BREP_TYPE);
+ }
+ else if (info.suffix() == FILE_EXT_AMCAX_SUBD)
+ {
+ adapter_object->setDataType(acamcad::DataType::MESH_TYPE);
+ }
+ else if (info.suffix() == FILE_EXT_AMCAX_TMS)
+ {
+ adapter_object->setDataType(acamcad::DataType::TSPLINEU_TYPE);
+ }
+
+ if (adapter_object->readStream(context))
+ {
+ adapter_object->setVisible(true);
+ adapter_object->updateDraw();
+ vec.push_back(adapter_object);
+ dataManager_->addObject(adapter_object);
+ }
+ else
+ {
+ delete adapter_object;
+ }
+ }
+ dataManager_->RecordAddObject(vec);
+ return true;
+ }
+
+ }
dataManager_->RecordAddObject(vec);
+
+ return false;
}
- void AMCore::saveObjectsToFile(const QString& filename, std::vector::const_iterator& it_begin, std::vector::const_iterator& it_end)
+ bool AMCore::saveObjectsToFile(const QString& filename, std::vector::const_iterator& it_begin, std::vector::const_iterator& it_end)
{
- if (it_begin == it_end) {
- return;
- }
+ auto lpos = std::max(filename.lastIndexOf("/"), filename.lastIndexOf("\\"));
+ defaultDir = filename.left(lpos + 1);
DataType file_type;
QString ext = QFileInfo(filename).suffix();
QFileInfo f_info = QFileInfo(filename);
- if (file_allowed_type_.find(ext) != file_allowed_type_.end())
- {
- file_type = file_allowed_type_[ext];
- }
- else
- {
- file_type = DataType::CUSTOM_TYPE;
- return;
- }
-
if (auto lext = ext.toLower(); lext == FILE_EXT_STP || lext == FILE_EXT_STEP) // stp file
{
+ if (it_begin == it_end) {
+ return false;
+ }
+
std::ostringstream fout;
AMCAX::STEP::StepWriter stepWriter(fout);
stepWriter.Init();
@@ -200,29 +365,92 @@ namespace acamcad
file.close();
}
}
- else if (ext == FILE_EXT_AMCAX_BREP) // abr file
+ else if (ext == FILE_EXT_AMCAX) // cmcax file
{
- AMCAX::TopoCompound comp;
- AMCAX::TopoBuilder build;
- build.MakeCompound(comp);
+ QZipWriter write(filename);
+
+ if (!write.isWritable())
+ return false;
+ {
+ QJsonObject json;
+ json.insert("version", 1);
+
+ QJsonDocument doc;
+ doc.setObject(json);
+
+ write.addFile(QString(FILE_AMCAX_CONTROL), doc.toJson());
+
+ }
+
+ std::vector brep, obj, tms;
+
for (CObjectIter o_it = it_begin; o_it != it_end; o_it++)
{
- AdapterObject* brep_object = *o_it;
+ AdapterObject* object = *o_it;
+
+ switch (object->dataType())
+ {
+ case acamcad::DataType::BREP_TYPE:
+ brep.push_back(object);
+ break;
+ case acamcad::DataType::MESH_TYPE:
+ obj.push_back(object);
+ break;
+ case acamcad::DataType::TSPLINEU_TYPE:
+ tms.push_back(object);
+ break;
+ default:
+ break;
+ }
- if (brep_object->dataType() == acamcad::DataType::BREP_TYPE)
- build.Add(comp, brep_object->bRep->getShape());
}
- std::ostringstream fout;
- AMCAX::ShapeTool::Write(comp, fout);
- QFile file(filename);
- if (file.open(QIODevice::WriteOnly | QIODevice::Text))
+ for (int i = 0; i < brep.size(); i++)
{
- QTextStream out(&file);
- out << fout.str().c_str();
- file.close();
+ std::ostringstream fout;
+ AMCAX::ShapeTool::Write(brep[i]->bRep->getShape(), fout);
+ QByteArray arr;
+ arr.append(fout.str().c_str());
+ write.addFile(QString("B%1.%2").arg(i).arg(FILE_EXT_AMCAX_BREP), arr);
+ }
+
+
+ for (int i = 0; i < obj.size(); i++)
+ {
+ std::ostringstream fout;
+
+ if (AMCAX::SubD::PolyMeshIO::WriteMeshStreamOBJ(fout, obj[i]->mesh->getShape())) {
+ QByteArray arr;
+ arr.append(fout.str().c_str());
+
+ write.addFile(QString("M%1.%2").arg(i).arg(FILE_EXT_AMCAX_SUBD), arr);
+ }
+
+ }
+
+ for (int i = 0; i < tms.size(); i++)
+ {
+ std::ostringstream fout;
+ AMCAX::TMS::TMSplineIO io;
+
+ if (io.WriteTMSplineStream(fout, tms[i]->tSpline->getShape()))
+ {
+ QByteArray arr;
+ arr.append(fout.str().c_str());
+
+ write.addFile(QString("T%1.%2").arg(i).arg(FILE_EXT_AMCAX_TMS), arr);
+ }
+
}
+
+ write.close();
+
+ return true;
+
}
+
+
+ return false;
}
}
diff --git a/Src/Core/DataManager.cpp b/Src/Core/DataManager.cpp
index 6c66dc56ec9c5618890d76d9354643a705733190..efc26872cb0e5489c2bfa95e6e5adf1798b1e857 100644
--- a/Src/Core/DataManager.cpp
+++ b/Src/Core/DataManager.cpp
@@ -15,25 +15,18 @@
*/
#include "DataManager.h"
#include "../Object/BaseObject.h"
+#include "LocalDataManager.h"
using namespace acamcad;
DataManager::DataManager() : data_persistent_(0)
{
-
+ //local.initHistory();
}
DataManager::~DataManager()
{
- if (objects_.size() != 0)
- {
- for (ObjectIter o_it = objects_begin(); o_it != objects_end(); ++o_it)
- {
- BaseObject* obj = *o_it;
- delete obj;
- }
- }
- objects_.clear();
+ deleteAllObject();
}
@@ -152,6 +145,19 @@ void DataManager::deleteObject(AdapterObject* object)
}
}
+void DataManager::deleteAllObject()
+{
+ if (objects_.size() != 0)
+ {
+ for (ObjectIter o_it = objects_begin(); o_it != objects_end(); ++o_it)
+ {
+ BaseObject* obj = *o_it;
+ delete obj;
+ }
+ }
+ objects_.clear();
+}
+
void DataManager::restoreObject(AdapterObject* object)
{
object->setPersistentId(data_persistent_); data_persistent_++;
@@ -162,18 +168,20 @@ void DataManager::restoreObject(AdapterObject* object)
void DataManager::addObject_UndoManage(AdapterObject* object)
{
- AdapterObject* new_object = new AdapterObject(*object, true);
+ AdapterObject* new_object = object;
+
+ new_object->setVisible(true);
new_object->updateDraw();
objects_.push_back(new_object);
}
-void DataManager::deleteObject_UndoManage(AdapterObject* object)
+void DataManager::deleteObject_UndoManage(int persistentId)
{
for (ObjectIter o_it = objects_begin(); o_it != objects_end(); o_it++)
{
- if ((*o_it)->persistentId() == object->persistentId())
+ if ((*o_it)->persistentId() == persistentId)
{
AdapterObject* obj = *o_it;
delete obj;
diff --git a/Src/Core/DataManager.h b/Src/Core/DataManager.h
index 285404d5c9c88fb587a24c8076fc1ed506e7d396..058de8c018c0c9e9f7839739301165f7f727fca7 100644
--- a/Src/Core/DataManager.h
+++ b/Src/Core/DataManager.h
@@ -53,11 +53,12 @@ namespace acamcad
AdapterObject* copyObject(AdapterObject* object);
void deleteObject(AdapterObject* object);
+ void deleteAllObject();
void restoreObject(AdapterObject* object); //恢复一个被删除的单元,在备份的时候使用
//UndoManager
virtual void addObject_UndoManage(AdapterObject* object) override;
- virtual void deleteObject_UndoManage(AdapterObject* object) override;
+ virtual void deleteObject_UndoManage(int persistentId) override;
virtual void sortObject_UndoManage() override;
diff --git a/Src/Core/LocalDataManager.cpp b/Src/Core/LocalDataManager.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..fd3e810750040b98439a9b72cc46e3a4b98e56c3
--- /dev/null
+++ b/Src/Core/LocalDataManager.cpp
@@ -0,0 +1,242 @@
+#include "LocalDataManager.h"
+#include
+#include
+#include
+#include
+
+namespace acamcad
+{
+ LocalDataManager::LocalDataManager()
+ {
+ //initData();
+ initData(database_, "history.db");
+ }
+
+ LocalDataManager::~LocalDataManager()
+ {
+ QSqlQuery query;
+ query.exec("DELETE FROM model;");
+ database_.close();
+ }
+
+
+
+ bool LocalDataManager::initData(QSqlDatabase& database, QString db_name)
+ {
+
+ ///QSqlDatabase database;
+ QDir dir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
+ if (!dir.exists())
+ {
+ dir.mkdir(QStandardPaths::writableLocation(QStandardPaths::AppDataLocation));
+ }
+
+ if (QSqlDatabase::contains("qt_sql_default_connection"))
+ {
+ database_ = QSqlDatabase::database("qt_sql_default_connection");
+ }
+ else
+ {
+ // SQliteݿ
+ database_ = QSqlDatabase::addDatabase("QSQLITE");
+ // ݿļ
+ //QString file = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/MyDataBase.db";
+ QString file = QStandardPaths::writableLocation(QStandardPaths::AppDataLocation) + "/" + db_name;
+ //QStandardPaths::writableLocation(QStandardPaths::AppDataLocation);
+ //std::cout << "LocalDataManager::initHistory :" << file.toStdString() << std::endl;
+ database_.setDatabaseName(file);
+ std::cout << "database:" << file.toStdString() << std::endl;
+ }
+
+ if (!database_.open())
+ {
+ std::cout << "Error: Failed to connect database." << database_.lastError().nativeErrorCode().toStdString() << std::endl;
+ return false;
+ }
+
+
+
+ // do something
+ // ִsqlĶ
+ QSqlQuery sqlQuery;
+
+ // ִsql
+ if (!sqlQuery.exec("CREATE TABLE version (\
+ name TEXT NOT NULL primary key,\
+ ver INT NOT NULL)"))
+ {
+ std::cout << "Error: Fail to create table version. " << sqlQuery.lastError().nativeErrorCode().toStdString() << std::endl;
+ }
+
+
+ // ִsql
+ if (!sqlQuery.exec("CREATE TABLE model (\
+ step INT NOT NULL,\
+ persistentId INT NOT NULL,\
+ type INT NOT NULL,\
+ data TEXT NOT NULL)"))
+ {
+ std::cout << "Error: Fail to create table model. " << sqlQuery.lastError().nativeErrorCode().toStdString() << std::endl;
+ }
+ else
+ sqlQuery.exec("insert into version(name,ver) values('model',1)");
+
+ sqlQuery.exec("DELETE FROM model;");
+
+
+ if (!sqlQuery.exec("CREATE TABLE file_recent (\
+ file TEXT NOT NULL,\
+ time INTEGER NOT NULL)"))
+ {
+ std::cout << "Error: Fail to create table file_recent. " << sqlQuery.lastError().nativeErrorCode().toStdString() << std::endl;
+ }
+ else
+ sqlQuery.exec("insert into version(name,ver) values('file_recent',1)");
+
+ // ִsql
+ if (!sqlQuery.exec("CREATE TABLE position (\
+ id INT NOT NULL primary key,\
+ array BLOB NOT NULL)"))
+ {
+ std::cout << "Error: Fail to create table position. " << sqlQuery.lastError().nativeErrorCode().toStdString() << std::endl;
+ }
+ else
+ {
+ sqlQuery.exec("insert into version(name,ver) values('position',1)");
+ sqlQuery.exec("insert into position(id,array) values(1,'')");
+ }
+
+
+
+ //sqlQuery.exec("VACUUM;PRAGMA auto_vacuum = 2;PRAGMA page_size = 4096;");
+ return true;
+ }
+
+ void LocalDataManager::execStore(const std::vector& models)
+ {
+ //std::cout << "LocalDataManager::exe!" << std::endl;
+ //QString qsQuery;
+ QSqlQuery query(database_);
+
+ query.prepare("insert into model(step,persistentId,type,data) values(?,?,?,?)");
+
+ QVariantList steps, persistentIds, types, datas;
+
+ for (int i = 0; i < models.size(); i++)
+ {
+ auto& data = models[i];
+
+ steps << data.step;
+ persistentIds << data.persistentId;
+ types << data.type;
+ datas << data.data;
+ }
+
+ query.addBindValue(steps);
+ query.addBindValue(persistentIds);
+ query.addBindValue(types);
+ query.addBindValue(datas);
+
+ if (!query.execBatch())
+ {
+ std::cout << "LocalDataManager::exec " << query.lastError().databaseText().toStdString() << std::endl;
+ }
+
+ }
+
+ void LocalDataManager::execStore(const std::vector& models)
+ {
+ QVariantList files, times;
+ for (auto& iter : models)
+ {
+ files << iter.file;
+ times << iter.time;
+ }
+
+ QSqlQuery query(database_);
+ query.prepare("delete from file_recent where file = ?");
+ query.addBindValue(files);
+ query.execBatch();
+
+ query.prepare("insert into file_recent(file,time) values(?,?)");
+ query.addBindValue(files);
+ query.addBindValue(times);
+
+ if (!query.execBatch())
+ {
+ std::cout << "LocalDataManager::exec " << query.lastError().databaseText().toStdString() << std::endl;
+ }
+
+ if (query.exec("select file from file_recent order by time DESC limit 10 offset 20"))
+ {
+ QVariantList files1;
+ while (query.next())
+ {
+ files1 << query.value(0).toString();
+ }
+
+ if (!files1.isEmpty())
+ {
+ query.prepare("delete from file_recent where file = ?");
+ query.addBindValue(files1);
+
+ query.execBatch();
+ }
+
+ }
+
+
+ }
+
+ void LocalDataManager::execGet(std::vector& models)
+ {
+ QSqlQuery query(database_);
+ if (query.exec("select file from file_recent order by time DESC limit 20"))
+ {
+ while (query.next())
+ {
+ //DataModelRecent data(query.value(0).)
+ models.push_back({ query.value(0).toString(),0 });
+ }
+ }
+
+ }
+
+
+ void LocalDataManager::execStore(const DataModelPosition& position)
+ {
+
+ QSqlQuery sqlQuery;
+ sqlQuery.prepare("update position set array = ? where id = 1");
+
+ ///QVariant bFullScreen, x, y, w, h;
+ sqlQuery.addBindValue(QVariant::fromValue(position.array));
+
+ sqlQuery.exec();
+ //bFullScreen.setValue(position.bFullScreen);
+
+
+ }
+
+ void LocalDataManager::execGet(DataModelPosition& models)
+ {
+ QSqlQuery sqlQuery;
+
+ if (sqlQuery.exec("select array from position where id = 1"))
+ {
+ while (sqlQuery.next())
+ {
+ //QArrayData d(data);
+ models.array = sqlQuery.value(0).value();
+ }
+
+ }
+ }
+
+ //bool LocalDataManager::execGet(QSqlQuery& query)
+ //{
+ // //QSqlQuery query(database_);
+ // return query.exec();
+
+ //}
+}
\ No newline at end of file
diff --git a/Src/Core/UndoRedoHandler.h b/Src/Core/LocalDataManager.h
similarity index 31%
rename from Src/Core/UndoRedoHandler.h
rename to Src/Core/LocalDataManager.h
index 7a55149d6e652525140f75d177d9bb86f5e2f0c3..e08cc3f46dd2ca68ea754c98a974825e164828e8 100644
--- a/Src/Core/UndoRedoHandler.h
+++ b/Src/Core/LocalDataManager.h
@@ -1,78 +1,72 @@
/* ===================================================================
-* Copyright (C) 2023 Hefei Jiushao Intelligent Technology Co., Ltd.
+* Copyright (C) 2023 Hefei Jiushao Intelligent Technology Co., Ltd.
* All rights reserved.
*
-* This software is licensed under the GNU Affero General Public License
-* v3.0 (AGPLv3.0) or a commercial license. You may choose to use this
+* This software is licensed under the GNU Affero General Public License
+* v3.0 (AGPLv3.0) or a commercial license. You may choose to use this
* software under the terms of either license.
*
-* For more information about the AGPLv3.0 license, please visit:
+* For more information about the AGPLv3.0 license, please visit:
* https://www.gnu.org/licenses/agpl-3.0.html
-* For licensing inquiries or to obtain a commercial license, please
+* For licensing inquiries or to obtain a commercial license, please
* contact Hefei Jiushao Intelligent Technology Co., Ltd.
* ===================================================================
-* Author:
+* Author:
*/
-#include
+#pragma once
+
+#include
+#include
+#include
+#include
+#include
+#include
+#include
-#include
-#include
-#include
namespace acamcad
{
- enum class ActionType {
- AddObject,
- DeleteObject,
- OperateObject
- };
+ class LocalDataManager
+ {
+ public:
+ LocalDataManager();
+ ~LocalDataManager();
- class BaseObject;
- class DataManager;
+ struct DataModelHistory
+ {
+ int step;
+ int persistentId;
+ int type;
+ QString data;
+ };
- class ContextHolder {
- public:
- ContextHolder(int opId);
- ContextHolder(int opId, BaseObject* object, ActionType op_type);
- ~ContextHolder();
- public :
- int getOperationId() { return operationId_; }
- int getObjectPid() { return objectPid_; }
- const AMCAX::TopoShape& getBackShape() { return backshape_; }
- private:
- int operationId_;
- int objectPid_; // the persistentId of the object in datamanager; used to query whether the object still exists in data manager.
- AMCAX::TopoShape backshape_; // the backup shape data for the object;
- };
+ void execStore(const std::vector& models);
+ //bool execGet(QSqlQuery& query);
- typedef std::pair OperateContext;
- class UndoRedoHandler {
- public:
- UndoRedoHandler(DataManager* dataManager, int max_queue_size);
- ~UndoRedoHandler();
+ struct DataModelRecent
+ {
+ QString file;
+ long long time;
+ };
+
+ void execStore(const std::vector& models);
+ void execGet(std::vector& models);
- public:
- void increaseSequence(); //
- void recordOperation(BaseObject* object, ActionType opType, bool incSeq = true);
+ struct DataModelPosition
+ {
+ QByteArray array;
- void undo();
- void redo();
- bool canUndo();
- bool canRedo();
+ };
+ void execStore(const DataModelPosition& position);
+ void execGet(DataModelPosition& models);
- private:
- void revokeOp(const OperateContext& context);
- void applyOp(const OperateContext& context);
+ protected:
- private:
- std::deque undo_queue_;
- std::deque redo_queue_;
- void releaseQueueItem(OperateContext& context);
+ bool initData(QSqlDatabase& database, QString db_name);
- private:
- int max_queue_size_;
- int operation_seq_; //operations that share the same sequence
- DataManager* dataManager_;
+ protected:
+ QSqlDatabase database_;
+ ///QString db_name_;
};
}
\ No newline at end of file
diff --git a/Src/Core/UndoManage.cpp b/Src/Core/UndoManage.cpp
index c4de3d68f3569dcf4804574c5f8b140b66a2b3eb..44c3564916cf63ef90d77bef7e82797ea47184c1 100644
--- a/Src/Core/UndoManage.cpp
+++ b/Src/Core/UndoManage.cpp
@@ -1,9 +1,17 @@
#include "UndoManage.h"
#include
+#include "../Windows/RibbonViewer.h"
+#include
+#include
+#include
+
+#include
+#include
+#include
namespace acamcad
{
- UndoManager::UndoManager() :data_index_(0)
+ UndoManager::UndoManager() :LocalDataManager(), data_index_size_(0), data_size_(0)
{
}
@@ -44,77 +52,99 @@ namespace acamcad
return;
}
- for (auto& iter : oldData) {
- std::shared_ptr object = getObjectInData(iter);
- oldObjects_.push_back(std::move(object));
- }
+ addBegin(oldData);
}
void UndoManager::RecordModifyEnd(std::vector curData)
{
if (!curData.empty() && !oldObjects_.empty())
{
- Data data{ {} , oldObjects_ };
+ //Data data{ {} , oldObjects_ };
+
+ addEnd(curData);
+ nextStep(oldObjects_);
- for (auto& iter : curData) {
- std::shared_ptr object = std::make_shared(*iter, false);
- data.curObjects.push_back(std::move(object));
- }
- nextStep(data);
}
+
+
oldObjects_.clear();
}
- void UndoManager::nextStep(std::vector curData, std::vector oldData)
+ void UndoManager::addBegin(const std::vector& oldData)
{
- if (curData.empty() && oldData.empty())
- return;
+ for (auto& iter : oldData)
+ {
+ DataModelHistory data{ 2 * data_index_size_,iter->persistentId(),-1,"" };
+ //std::shared_ptr object = getObjectInData(iter);
+ oldObjects_.push_back(data);
+ }
+ }
- Data data;
- //std::vector> curVector, oldVector;
+ void UndoManager::addEnd(const std::vector& curData)
+ {
for (auto& iter : curData) {
- std::shared_ptr object = std::make_shared(*iter, false);
- data.curObjects.push_back(std::move(object));
- }
+ //std::shared_ptr object = std::make_shared(*iter, false);
+ //data.curObjects.push_back(std::move(object));
+ DataModelHistory data{ 2 * data_index_size_ + 1,iter->persistentId(),iter->dataType(),"" };
+ //std::shared_ptr object = getObjectInData(iter);
+ std::ostringstream fout;
- for (auto& iter : oldData) {
- std::shared_ptr object = getObjectInData(iter);
- data.oldObjects.push_back(std::move(object));
- }
+ iter->writeStream(fout);
- nextStep(data);
- //data_.push_back({ curVector,oldVector });
+ data.data = fout.str().c_str();
+
+ oldObjects_.push_back(data);
+ }
}
- void UndoManager::nextStep(const Data& data)
+
+ void UndoManager::nextStep(std::vector curData, std::vector oldData)
{
- if (data_index_ < data_.size()) {
+ if (curData.empty() && oldData.empty())
+ return;
- auto iter = data_.begin();
+ oldObjects_.clear();
- for (int i = 0; i < data_index_; i++) {
- iter++;
- }
+ addBegin(oldData);
+ addEnd(curData);
+
+ //std::vector data;
+ //std::vector> curVector, oldVector
- data_.erase(iter, data_.end());
+ nextStep(oldObjects_);
+ oldObjects_.clear();
+ //data_.push_back({ curVector,oldVector });
+ }
+ void UndoManager::nextStep(const std::vector& data)
+ {
+ if (data_index_size_ != data_size_)
+ {
+ QSqlQuery query;
+ query.prepare("delete from model where step >= ?");
+ query.addBindValue(data_index_size_ * 2);
+ query.exec();
}
- data_index_++;
+ execStore(data);
- data_.push_back(data);
+ data_size_ = ++data_index_size_;
+
+ //data_.push_back(data);
+ func_();
}
bool UndoManager::canUndo()
{
- return data_index_ > 0;
+ return data_index_size_ > 0;
}
+
bool UndoManager::canRedo()
{
- return data_index_ < data_.size();
+ return data_index_size_ < data_size_;
}
@@ -127,26 +157,59 @@ namespace acamcad
clearModify();
- --data_index_;
-
- //int index = 0;
- auto iter = data_.begin();
-
- for (int i = 0; i < data_index_; i++) {
- iter++;
- }
+ --data_index_size_;
- for (auto cur = iter->curObjects.begin(); cur != iter->curObjects.end(); cur++) {
- deleteObject_UndoManage(cur->get());
+ QSqlQuery query;
+ query.prepare("select persistentId from model where step = ?");
+ query.addBindValue(2 * data_index_size_ + 1);
+ if (query.exec())
+ {
+ while (query.next())
+ {
+ deleteObject_UndoManage(query.value(0).toInt());
+ }
}
- for (auto old = iter->oldObjects.begin(); old != iter->oldObjects.end(); old++)
+ query.prepare("select persistentId from model where step = ?");
+ query.addBindValue(2 * data_index_size_);
+ if (query.exec())
{
- addObject_UndoManage(old->get());
+ while (query.next())
+ {
+ QSqlQuery query2;
+ query2.prepare("select persistentId,type,data from model where persistentId = ? and step < ? and step % 2 = 1 order by step desc limit 1");
+ query2.addBindValue(query.value(0).toInt());
+ query2.addBindValue(2 * data_index_size_);
+
+ if (query2.exec() && query2.next())
+ {
+ AdapterObject* object = new AdapterObject;
+ object->setPersistentId(query2.value(0).toInt());
+
+ DataType type = (DataType)query2.value(1).toInt();
+ object->setDataType(type);
+ std::istringstream fin(query2.value(2).toString().toStdString());
+
+ if (object->readStream(fin))
+ {
+ addObject_UndoManage(object);
+ }
+ else
+ {
+ delete object;
+ }
+
+
+ }
+
+ ///deleteObject_UndoManage(query.value(0).toInt());
+ }
}
sortObject_UndoManage();
+ func_();
+
}
void UndoManager::Redo()
{
@@ -155,45 +218,96 @@ namespace acamcad
return;
}
clearModify();
- //int index = 0;
- auto iter = data_.begin();
- for (int i = 0; i < data_index_; i++) {
- iter++;
+ QSqlQuery query;
+ query.prepare("select persistentId from model where step = ?");
+ query.addBindValue(2 * data_index_size_);
+ if (query.exec())
+ {
+ while (query.next())
+ {
+ deleteObject_UndoManage(query.value(0).toInt());
+ }
}
- for (auto cur = iter->curObjects.begin(); cur != iter->curObjects.end(); cur++) {
- addObject_UndoManage(cur->get());
- }
- for (auto old = iter->oldObjects.begin(); old != iter->oldObjects.end(); old++)
+ query.prepare("select persistentId,type,data from model where step = ?");
+ query.addBindValue(2 * data_index_size_ + 1);
+ if (query.exec())
{
- deleteObject_UndoManage(old->get());
+ while (query.next())
+ {
+
+ AdapterObject* object = new AdapterObject;
+ object->setPersistentId(query.value(0).toInt());
+
+ DataType type = (DataType)query.value(1).toInt();
+ object->setDataType(type);
+
+ std::istringstream fin(query.value(2).toString().toStdString());
+
+ if (object->readStream(fin))
+ {
+ addObject_UndoManage(object);
+ }
+ else
+ {
+ delete object;
+ }
+
+ }
}
+ ++data_index_size_;
+
sortObject_UndoManage();
- ++data_index_;
+ func_();
}
- //void UndoManager::getObject()
- std::shared_ptr UndoManager::getObjectInData(AdapterObject* object)
+ void UndoManager::clearHistory()
{
- ///std::shared_ptr result;
-
- for (auto iter = data_.rbegin(); iter != data_.rend(); iter++)
+ if (data_index_size_ == 0 && data_size_ == 0)
{
- for (auto& iter1 : iter->curObjects)
- {
- if (iter1->persistentId() == object->persistentId())
- {
- return iter1;
- }
- }
+ return;
}
- std::shared_ptr result = std::make_shared(*object, false);
- return result;
+
+ data_index_size_ = data_size_ = 0;
+
+
+ QSqlQuery query;
+ query.prepare("delete from model where step >= ?");
+ query.addBindValue(data_index_size_ * 2);
+ query.exec();
+
+
+ func_();
+
}
+ void UndoManager::setFunc(std::function func)
+ {
+ func_ = func;
+ }
+
+ ////void UndoManager::getObject()
+ //std::shared_ptr UndoManager::getObjectInData(AdapterObject* object)
+ //{
+ // ///std::shared_ptr result;
+
+ // for (auto iter = data_.rbegin(); iter != data_.rend(); iter++)
+ // {
+ // for (auto& iter1 : iter->curObjects)
+ // {
+ // if (iter1->persistentId() == object->persistentId())
+ // {
+ // return iter1;
+ // }
+ // }
+ // }
+ // std::shared_ptr result = std::make_shared(*object, false);
+ // return result;
+ //}
+
}
\ No newline at end of file
diff --git a/Src/Core/UndoManage.h b/Src/Core/UndoManage.h
index 18adb30c01e40148d1143581e1c9c73a0bd80d2e..f0357124709248b9cc5b538376cca55064075364 100644
--- a/Src/Core/UndoManage.h
+++ b/Src/Core/UndoManage.h
@@ -19,15 +19,17 @@
#include
#include
-
#include "../Object/ObjectDefine.h"
+#include "LocalDataManager.h"
+
+//class RibbonViewer;
namespace acamcad
{
//class AdapterObject
- class UndoManager
+ class UndoManager :public LocalDataManager
{
public:
UndoManager();
@@ -55,32 +57,41 @@ namespace acamcad
void Undo();
void Redo();
+ void clearHistory();
+
+ void setFunc(std::function func);
+
protected:
+ void addBegin(const std::vector& oldData);
+ void addEnd(const std::vector& curData);
+
virtual void addObject_UndoManage(AdapterObject* object) = 0;
- virtual void deleteObject_UndoManage(AdapterObject* object) = 0;
+ virtual void deleteObject_UndoManage(int persistentId) = 0;
virtual void sortObject_UndoManage() = 0;
private:
- struct Data
- {
- ///DataType type;
- std::list> curObjects;
- std::list> oldObjects;
- };
+ //struct Data
+ //{
+ // ///DataType type;
+ // std::list> curObjects;
+ // std::list> oldObjects;
+ //};
void nextStep(std::vector curData, std::vector oldData);
- void nextStep(const Data& data);
+ void nextStep(const std::vector& data);
- std::shared_ptr getObjectInData(AdapterObject* object);
+ //std::shared_ptr getObjectInData(AdapterObject* object);
protected:
- std::list data_;
- int data_index_;
+ //std::list data_;
+ int data_index_size_;
+ int data_size_;
- std::list> oldObjects_;
+ std::vector oldObjects_;
+ std::function func_;
//std::vector> auto_olds;
//std::vector> auto_news;
diff --git a/Src/Core/UndoRedoHandler.cpp b/Src/Core/UndoRedoHandler.cpp
deleted file mode 100644
index 0143b756752f84ccc27d03bba7848371c68e9741..0000000000000000000000000000000000000000
--- a/Src/Core/UndoRedoHandler.cpp
+++ /dev/null
@@ -1,248 +0,0 @@
-/* ===================================================================
-* Copyright (C) 2023 Hefei Jiushao Intelligent Technology Co., Ltd.
-* All rights reserved.
-*
-* This software is licensed under the GNU Affero General Public License
-* v3.0 (AGPLv3.0) or a commercial license. You may choose to use this
-* software under the terms of either license.
-*
-* For more information about the AGPLv3.0 license, please visit:
-* https://www.gnu.org/licenses/agpl-3.0.html
-* For licensing inquiries or to obtain a commercial license, please
-* contact Hefei Jiushao Intelligent Technology Co., Ltd.
-* ===================================================================
-* Author:
-*/
-#include "UndoRedoHandler.h"
-#include "../Object/BRepObject.h"
-#include "DataManager.h"
-#include
-#include "../Object/ObjectType.h"
-#include
-
-namespace acamcad {
-
- ContextHolder::ContextHolder(int opId) : operationId_(opId), objectPid_(-1) {
- backshape_.Nullify();
- }
-
- ContextHolder::ContextHolder(int opId, BaseObject* object, ActionType actionType) : operationId_(opId), objectPid_(-1) {
- if (nullptr == object || object->dataType() != DataType::BREP_TYPE) {
- return;
- }
-
- objectPid_ = object->persistentId();
-
- AdapterObject* object_old = dynamic_cast(object);
-
- //BRepObject* object_old = dynamic_cast (object);
- backshape_ = AMCAX::CopyShape(object_old->bRep->getShape());
- }
-
- ContextHolder::~ContextHolder()
- {
- backshape_.Nullify();
- }
-
-
- UndoRedoHandler::UndoRedoHandler(DataManager* dataManager, int max_queue_size) : dataManager_(dataManager), max_queue_size_(max_queue_size), operation_seq_(0)
- {
- }
-
- UndoRedoHandler::~UndoRedoHandler() {
- while (!undo_queue_.empty()) {
- OperateContext item = undo_queue_.back();
- undo_queue_.pop_back();
- releaseQueueItem(item);
- }
-
- while (!redo_queue_.empty()) {
- OperateContext item = redo_queue_.back();
- redo_queue_.pop_back();
- releaseQueueItem(item);
- }
- }
-
- void UndoRedoHandler::increaseSequence()
- {
- operation_seq_++;
- }
-
- void UndoRedoHandler::recordOperation(BaseObject* object, ActionType actionType, bool incSeq)
- {
- if (incSeq) {
- operation_seq_++;
- }
-
- ContextHolder* holder = new ContextHolder(operation_seq_, object, actionType);
- OperateContext context = std::make_pair(actionType, holder);
- undo_queue_.push_back(context);
-
- if (undo_queue_.size() >= max_queue_size_) {
- OperateContext item = undo_queue_.back();
- undo_queue_.pop_front();
- releaseQueueItem(item);
- }
- }
-
- void UndoRedoHandler::revokeOp(const OperateContext& context)
- {
- ActionType op_type = context.first;
- ContextHolder* p_holder = context.second;
-
- if (p_holder == nullptr) {
- return;
- }
-
- if (op_type == ActionType::AddObject) { //revoke add, need to find the object in data manager and delete it.
- std::cout << "undo add object" << std::endl;
-
- BaseObject* obj = dataManager_->getObjectByPersistentID(p_holder->getObjectPid());
- if (obj == nullptr) {
- //Object gone, cannot revoke add operation;
- return;
- }
- //dataManager_->deleteObject(obj);
- }
- else if (op_type == ActionType::DeleteObject) { // revoke delete, need to restore the object from shape and add into data manager; and add another copy
- std::cout << "undo delete object" << std::endl;
-
- BaseObject* obj = dataManager_->getObjectByPersistentID(p_holder->getObjectPid());
- if (obj != nullptr) {
- return; //Object already exists, no need to revoke delete now.
- }
- //ONLY support bRep object now;
- AdapterObject* adapter_object = new AdapterObject;
- adapter_object->setDataType(acamcad::DataType::BREP_TYPE);
- //adapter_object->bRep = std::make_unique(adapter_object);
-
- //BRepObject* brep_obj = new BRepObject();
- adapter_object->bRep->applyBRep(p_holder->getBackShape());
- dataManager_->addObject(adapter_object);
- adapter_object->setPersistentId(p_holder->getObjectPid());
- adapter_object->bRep->updateDraw();
- }
- else { //revoke operate, need to find the backup data and the object in data manager, apply the old data to the object;
-
- }
- }
-
- void UndoRedoHandler::applyOp(const OperateContext& context)
- {
- ActionType actionType = context.first;
- ContextHolder* p_holder = context.second;
-
- if (p_holder == nullptr) {
- return;
- }
-
- if (actionType == ActionType::AddObject) { //redo add, need to restore the object from shape and add into data manager;
- std::cout << "redo add object" << std::endl;
- BaseObject* obj = dataManager_->getObjectByPersistentID(p_holder->getObjectPid());
- if (obj != nullptr) {
- return; //Object already exists, no need to revoke delete now.
- }
- //ONLY support bRep object now;
- AdapterObject* adapter_object = new AdapterObject;
- adapter_object->setDataType(acamcad::DataType::BREP_TYPE);
- //adapter_object->bRep = std::make_unique(adapter_object);
-
- ///BRepObject* brep_obj = new BRepObject();
- adapter_object->bRep->applyBRep(p_holder->getBackShape());
- dataManager_->addObject(adapter_object);
- adapter_object->setPersistentId(p_holder->getObjectPid());
- adapter_object->bRep->updateDraw();
- }
- else if (actionType == ActionType::DeleteObject) { //redo delete, need to find the object in data manager and delete it.
- std::cout << "redo delete object" << std::endl;
-
- BaseObject* obj = dataManager_->getObjectByPersistentID(p_holder->getObjectPid());
- if (obj == nullptr) {
- //Object gone, cannot revoke add operation;
- return;
- }
- //dataManager_->deleteObject(obj);
- }
-
- }
-
- void UndoRedoHandler::undo()
- {
- if (undo_queue_.empty()) {
- return;
- }
-
- bool hasNext = false;
- do {
- OperateContext context = undo_queue_.back();
- int currentSeq = (context.second)->getOperationId();
- revokeOp(context);
-
- undo_queue_.pop_back();
- redo_queue_.push_back(context);
- if (redo_queue_.size() >= max_queue_size_) {
-
- OperateContext item = redo_queue_.front();
- redo_queue_.pop_front();
- releaseQueueItem(item);
- }
-
- if (undo_queue_.empty()) {
- return;
- }
- OperateContext next_context = undo_queue_.back();
- int nextSeq = (next_context.second)->getOperationId();
- hasNext = (nextSeq == currentSeq);
- } while (hasNext);
-
- }
-
- void UndoRedoHandler::redo()
- {
-
- if (redo_queue_.empty()) {
- return;
- }
-
- bool hasNext = false;
- do {
- OperateContext context = redo_queue_.back();
- int currentSeq = (context.second)->getOperationId();
- applyOp(context);
-
- redo_queue_.pop_back();
- undo_queue_.push_back(context);
- if (undo_queue_.size() >= max_queue_size_) {
-
- OperateContext item = undo_queue_.front();
- undo_queue_.pop_front();
- releaseQueueItem(item);
- }
-
- if (redo_queue_.empty()) {
- return;
- }
- OperateContext next_context = redo_queue_.back();
- int nextSeq = (next_context.second)->getOperationId();
- hasNext = (nextSeq == currentSeq);
- } while (hasNext);
- }
-
- bool UndoRedoHandler::canUndo()
- {
- return (!undo_queue_.empty());
- }
-
- bool UndoRedoHandler::canRedo()
- {
- return (!redo_queue_.empty());
- }
-
- void UndoRedoHandler::releaseQueueItem(OperateContext& context)
- {
- if (context.second != nullptr) {
- delete context.second;
- context.second = nullptr;
- }
- }
-}
\ No newline at end of file
diff --git a/Src/Main.cpp b/Src/Main.cpp
index 621fa981f8491dab8a9af215f624884df6524686..b432e49cba597013010f77ed1bf9d5dd46153c5b 100644
--- a/Src/Main.cpp
+++ b/Src/Main.cpp
@@ -1,38 +1,53 @@
/* ===================================================================
-* Copyright (C) 2023 Hefei Jiushao Intelligent Technology Co., Ltd.
+* Copyright (C) 2023 Hefei Jiushao Intelligent Technology Co., Ltd.
* All rights reserved.
*
-* This software is licensed under the GNU Affero General Public License
-* v3.0 (AGPLv3.0) or a commercial license. You may choose to use this
+* This software is licensed under the GNU Affero General Public License
+* v3.0 (AGPLv3.0) or a commercial license. You may choose to use this
* software under the terms of either license.
*
-* For more information about the AGPLv3.0 license, please visit:
+* For more information about the AGPLv3.0 license, please visit:
* https://www.gnu.org/licenses/agpl-3.0.html
-* For licensing inquiries or to obtain a commercial license, please
+* For licensing inquiries or to obtain a commercial license, please
* contact Hefei Jiushao Intelligent Technology Co., Ltd.
* ===================================================================
-* Author:
+* Author:
*/
-#include "Windows/ACAMWindow.h"
#include
#include
#include
+#include "Windows/RibbonViewer.h"
+#include "SARibbonBar.h"
+#include
+#include
int main(int argc, char** argv) {
- QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
-// QGuiApplication::setHighDpiScaleFactorRoundingPolicy(Qt::HighDpiScaleFactorRoundingPolicy::Round);
- // Read command lines arguments.
+
+ // 仅仅允许一个进程
+ QSharedMemory singleton("AmcaxDaemon-SINGLETON");
+ if (!singleton.create(1)) {
+ return -1;
+ }
+
+
+ SARibbonBar::initHighDpi();
+
+
QApplication application(argc, argv);
+ QFont f = application.font();
+ f.setFamily(u8"微软雅黑");
+ application.setFont(f);
// Instantiate the viewer.
- ACAMWindow window;
-
- window.setWindowTitle("九韶精灵");
+ RibbonViewer window;
+ window.setRibbonTheme(SARibbonMainWindow::RibbonThemeOffice2016Blue);
+ //window.setWindowTitle("九韶精灵");
+ //ndow.initFile();
// Make the viewer window visible on screen.
- window.show();
+ //window.showFullScreen();
// Run main loop.
- return application.exec();
+ return (application.exec());
}
diff --git a/Src/Object/AdapterObject.cpp b/Src/Object/AdapterObject.cpp
index 61693e35d51a1182d7e9794d3c2c22610107c423..01eb6e3d3f3125c192f2187998238713caf3832a 100644
--- a/Src/Object/AdapterObject.cpp
+++ b/Src/Object/AdapterObject.cpp
@@ -8,6 +8,11 @@
#include
#include
#include
+#include
+#include
+#include
+#include
+#include
namespace acamcad
{
@@ -267,7 +272,7 @@ namespace acamcad
break;
case acamcad::DataType::MESH_TYPE:
{
- auto box = AMCAX::SubD::MeshTool::MeshBoundingBox(mesh->mesh());
+ auto box = AMCAX::SubD::MeshTool::MeshBoundingBox(mesh->getShape());
min = box.CornerMin().Coord();
max = box.CornerMax().Coord();
@@ -276,7 +281,7 @@ namespace acamcad
case acamcad::DataType::TSPLINEU_TYPE:
{
AMCAX::BoundingBox3 box;
- AMCAX::TMS::TMSplineTool::UpdateTMSplineBndBox(tSpline->getTSpline(), box);
+ AMCAX::TMS::TMSplineTool::UpdateTMSplineBndBox(tSpline->getShape(), box);
min = box.CornerMin().Coord();
max = box.CornerMax().Coord();
@@ -301,12 +306,12 @@ namespace acamcad
break;
case acamcad::DataType::MESH_TYPE:
{
- auto vs = AMCAX::SubD::MeshTool::FaceVertexIndexs(mesh->mesh(), face_id);
+ auto vs = AMCAX::SubD::MeshTool::FaceVertexIndexs(mesh->getShape(), face_id);
double x_min(0), y_min(0), z_min(0), x_max(0), y_max(0), z_max(0);
for (int i = 0; i < vs.size(); i++)
{
- auto& p = AMCAX::SubD::MeshTool::Position(mesh->mesh(), vs[i]);
+ auto& p = AMCAX::SubD::MeshTool::Position(mesh->getShape(), vs[i]);
if (i == 0)
{
@@ -336,12 +341,12 @@ namespace acamcad
break;
case acamcad::DataType::TSPLINEU_TYPE:
{
- auto ids = AMCAX::TMS::TMSplineTool::FaceVertexIndexs(tSpline->getTSpline(), face_id);
+ auto ids = AMCAX::TMS::TMSplineTool::FaceVertexIndexs(tSpline->getShape(), face_id);
double x_min(0), y_min(0), z_min(0), x_max(0), y_max(0), z_max(0);
for (int i = 0; i < ids.size(); i++)
{
- auto& p = AMCAX::TMS::TMSplineTool::ControlPosition(tSpline->getTSpline(), ids[i]);
+ auto& p = AMCAX::TMS::TMSplineTool::ControlPosition(tSpline->getShape(), ids[i]);
if (i == 0)
{
x_min = x_max = p.X();
@@ -385,9 +390,9 @@ namespace acamcad
case acamcad::DataType::MESH_TYPE:
{
int v0, v1;
- AMCAX::SubD::MeshTool::EdgeVertexIndexs(mesh->mesh(), edge_id, v0, v1);
- auto& p0 = AMCAX::SubD::MeshTool::Position(mesh->mesh(), v0),
- & p1 = AMCAX::SubD::MeshTool::Position(mesh->mesh(), v1);
+ AMCAX::SubD::MeshTool::EdgeVertexIndexs(mesh->getShape(), edge_id, v0, v1);
+ auto& p0 = AMCAX::SubD::MeshTool::Position(mesh->getShape(), v0),
+ & p1 = AMCAX::SubD::MeshTool::Position(mesh->getShape(), v1);
min.SetCoord(std::min(p0.X(), p1.X()), std::min(p0.Y(), p1.Y()), std::min(p0.Z(), p1.Z()));
max.SetCoord(std::max(p0.X(), p1.X()), std::max(p0.Y(), p1.Y()), std::max(p0.Z(), p1.Z()));
@@ -400,9 +405,9 @@ namespace acamcad
case acamcad::DataType::TSPLINEU_TYPE:
{
int v0, v1;
- AMCAX::TMS::TMSplineTool::EdgeVertexIndexs(tSpline->getTSpline(), edge_id, v0, v1);
- auto p0 = AMCAX::TMS::TMSplineTool::ControlPosition(tSpline->getTSpline(), v0),
- p1 = AMCAX::TMS::TMSplineTool::ControlPosition(tSpline->getTSpline(), v1);
+ AMCAX::TMS::TMSplineTool::EdgeVertexIndexs(tSpline->getShape(), edge_id, v0, v1);
+ auto p0 = AMCAX::TMS::TMSplineTool::ControlPosition(tSpline->getShape(), v0),
+ p1 = AMCAX::TMS::TMSplineTool::ControlPosition(tSpline->getShape(), v1);
min.SetCoord(std::min(p0.X(), p1.X()), std::min(p0.Y(), p1.Y()), std::min(p0.Z(), p1.Z()));
@@ -430,14 +435,14 @@ namespace acamcad
break;
case acamcad::DataType::MESH_TYPE:
{
- auto& p = AMCAX::SubD::MeshTool::Position(mesh->mesh(), vetex_id);
+ auto& p = AMCAX::SubD::MeshTool::Position(mesh->getShape(), vetex_id);
position = p.Coord();
}
break;
case acamcad::DataType::TSPLINEU_TYPE:
{
- auto& p = AMCAX::TMS::TMSplineTool::ControlPosition(tSpline->getTSpline(), vetex_id);
+ auto& p = AMCAX::TMS::TMSplineTool::ControlPosition(tSpline->getShape(), vetex_id);
position = p.Coord();
}
break;
@@ -500,5 +505,126 @@ namespace acamcad
tSpline->updateDraw();
}
+ bool AdapterObject::writeStream(std::ostringstream& out)
+ {
+ bool bResult = false;
+ switch (dataType())
+ {
+ case DataType::BREP_TYPE:
+ {
+ if (!bRep->getShape().IsNull())
+ {
+ bResult = true;
+ AMCAX::ShapeTool::Write(bRep->getShape(), out);
+ }
+ //data.data = fout.str().c_str();
+
+
+ }
+ break;
+ case DataType::MESH_TYPE:
+ {
+ bResult = AMCAX::SubD::PolyMeshIO::WriteMeshStreamOBJ(out, mesh->getShape());
+
+ }
+ break;
+ case DataType::TSPLINEU_TYPE:
+ {
+ AMCAX::TMS::TMSplineIO io;
+
+ bResult = io.WriteTMSplineStream(out, tSpline->getShape());
+ }
+ break;
+ default:
+ break;
+ }
+
+ return bResult;
+ }
+
+
+ bool AdapterObject::readStream(std::istringstream& in)
+ {
+ bool bResult = false;
+
+ switch (dataType())
+ {
+ case DataType::BREP_TYPE:
+ {
+ //std::istringstream fin(query2.value(2).toString().toStdString());
+ AMCAX::TopoShape shape;
+ AMCAX::ShapeTool::Read(shape, in);
+
+ if (shape.IsNull())
+ {
+ break;
+ }
+
+ bResult = true;
+
+ bRep->SetShape(shape);
+ }
+ break;
+ case DataType::MESH_TYPE:
+ {
+ mesh->assignShape();
+ //std::istringstream fin(query2.value(2).toString().toStdString());
+ bResult = AMCAX::SubD::PolyMeshIO::LoadMeshStreamOBJ(in, mesh->getShape());
+ }
+ break;
+ case DataType::TSPLINEU_TYPE:
+ {
+ tSpline->assignShape();
+
+ //std::istringstream fin(query2.value(2).toString().toStdString());
+
+ AMCAX::TMS::TMSplineIO io;
+ bResult = io.LoadTMSplineStream(in, tSpline->getShape());
+ }
+ break;
+ default:
+ break;
+ }
+
+ return bResult;
+ }
+
+ AdapterObject* AdapterObject::duplicateFaces(std::vector& vec)
+ {
+ std::sort(vec.begin(), vec.end(), std::greater());
+ vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
+
+ AdapterObject* object = nullptr;
+
+ switch (dataType())
+ {
+ case DataType::MESH_TYPE:
+ {
+ object = new AdapterObject;
+ object->setDataType(dataType());
+
+ object->mesh->setShape(AMCAX::SubD::MeshCopy::ExtractMeshFaces(mesh->getShape(),
+ vec));
+
+ }
+ break;
+ case DataType::TSPLINEU_TYPE:
+ {
+ object = new AdapterObject;
+ object->setDataType(dataType());
+
+ AMCAX::TMS::TMSplineCopy tool;
+
+ object->tSpline->setShape(tool.ExtractTMSplineFace(tSpline->getShape(),
+ vec));
+ }
+ break;
+ default:
+ break;
+ }
+
+ return object;
+ }
+
}
\ No newline at end of file
diff --git a/Src/Object/AdapterObject.h b/Src/Object/AdapterObject.h
index 622f124a9eb4b77639bf55f03d230c2592d9802f..07c3420bea1be71a09f2be8153a09f4346997422 100644
--- a/Src/Object/AdapterObject.h
+++ b/Src/Object/AdapterObject.h
@@ -18,6 +18,9 @@
#include "BaseObject.h"
#include
+#include
+#include
+#include
#include
#include
@@ -52,7 +55,6 @@ namespace acamcad
virtual void mesh_OPvert_Backup();
virtual void meshMove(const AMCAX::Coord3& v, double dis);
- //在有了原来的顶点之后,所有的缩放都是一样的,没有体,边,面,点的区别了。
void meshScaleSingle(const AMCAX::Coord3& center, const AMCAX::Coord3& axis, double scale);
void meshScalePlane(const AMCAX::Coord3& center, const AMCAX::Coord3& normal, double scale);
void meshRotation(const AMCAX::Coord3& center, const AMCAX::Coord3& axis, double angle);
@@ -73,6 +75,11 @@ namespace acamcad
virtual void updateDraw() override;
const virtual ObjectDraw* getDrawTool() const override;
+ bool writeStream(std::ostringstream& out);
+ bool readStream(std::istringstream& in);
+
+ AdapterObject* duplicateFaces(std::vector& vec);
+
public:
std::unique_ptr bRep;
std::unique_ptr mesh;
diff --git a/Src/Object/BRepObject.cpp b/Src/Object/BRepObject.cpp
index bb5c118e9c62893dee2c65c4876fb2aff2ec2ad4..98639b2a37ad3626dfb34d0415e645ca053f7644 100644
--- a/Src/Object/BRepObject.cpp
+++ b/Src/Object/BRepObject.cpp
@@ -219,10 +219,11 @@ namespace acamcad
AMCAX::Transformation3 tr;
tr.SetMirror(AMCAX::Frame3(P, v));
- AMCAX::TransformShape trans(brep_trans_back_, tr);
+ AMCAX::TransformShape trans(shape_, tr);
shape_ = trans.Shape();
-
+ updateShapeInfo();
+ draw_tool_->updatedrawState();
//BRepObject* brep_object_new = new BRepObject();
//brep_object_new->shape_ = trans.Shape();
//brep_object_new->updateDraw();
diff --git a/Src/Object/MeshObject.cpp b/Src/Object/MeshObject.cpp
index 27f36ebf34f39cb9289903e065a79f5f2bb3a311..6d983c51a40afee835d27ad2b46e510a87339cfc 100644
--- a/Src/Object/MeshObject.cpp
+++ b/Src/Object/MeshObject.cpp
@@ -1,12 +1,10 @@
#include "MeshObject.h"
#include
-//#include
+// #include
#include "../ObjectDraw/MeshObjectDraw.h"
#include "../Operation/MOperate.h"
-
-
#include
#include
#include
@@ -23,32 +21,33 @@
#include "../Utils/MathUtils.h"
-//#include
-//#include
+// #include
+// #include
-namespace acamcad {
+namespace acamcad
+{
- MeshObject::MeshObject(AdapterObject* parent) :
- AdapterObjectParent(parent), mesh_(nullptr)//, mesh_subdive_(nullptr)
+ MeshObject::MeshObject(AdapterObject *parent) : AdapterObjectParent(parent) //, mesh_(nullptr)//, mesh_subdive_(nullptr)
{
- ///setDataType(DataType::MESH_TYPE);
+ /// setDataType(DataType::MESH_TYPE);
draw_tool_ = std::make_unique(parent_);
}
- MeshObject::MeshObject(AdapterObject* parent, const MeshObject& object, bool isDraw) :
- AdapterObjectParent(parent), mesh_(nullptr)//, mesh_subdive_(nullptr)
+ MeshObject::MeshObject(AdapterObject *parent, const MeshObject &object, bool isDraw) : AdapterObjectParent(parent) //, mesh_(nullptr)//, mesh_subdive_(nullptr)
{
if (object.mesh_ != nullptr)
{
if (object.mesh_ != nullptr)
{
- //mesh_ = new polymesh::PolyMesh();
- mesh_ = AMCAX::SubD::MeshCopy::CopyMesh(object.mesh_);
+ // mesh_ = new polymesh::PolyMesh();
+ mesh_.reset(
+ AMCAX::SubD::MeshCopy::CopyMesh(object.getShape()));
}
}
- //setDataType(DataType::MESH_TYPE);
- if (isDraw) {
+ // setDataType(DataType::MESH_TYPE);
+ if (isDraw)
+ {
draw_tool_ = std::make_unique(parent_);
draw_tool_->updatedrawState();
}
@@ -56,131 +55,80 @@ namespace acamcad {
MeshObject::~MeshObject()
{
- if (mesh_ != nullptr)
- {
- mesh_->clear();
- delete mesh_;
- }
- }
-
- void MeshObject::SetMesh(polymesh::PolyMesh* mesh)
- {
- mesh_ = mesh;
+ // if (mesh_ != nullptr)
+ //{
+ // mesh_->clear();
+ // delete mesh_;
+ // }
}
- polymesh::PolyMesh* MeshObject::mesh()
+ void MeshObject::setShape(polymesh::PolyMesh *mesh)
{
- return mesh_;
+ mesh_.reset(mesh);
}
- const polymesh::PolyMesh* MeshObject::mesh() const
+ polymesh::PolyMesh *MeshObject::getShape()
{
- return mesh_;
+ return mesh_.get();
}
- bool MeshObject::loadMesh(QString _filename)
+ const polymesh::PolyMesh *MeshObject::getShape() const
{
- parent_->setFromFileName(_filename);
-
- // call the local function to update names
- parent_->setName(parent_->name());
-
- std::string filename = _filename.toStdString();
-
- // load file
- bool ok = polymesh::PolyMeshIO::LoadMesh(filename, mesh_);
- if (ok)
- {
- ///mesh_->updateMeshNormal();
-
- parent_->show();
- }
- else
- {
- std::cout << "Load File fall" << std::endl;
- }
-
- return ok;
- }
-
- bool MeshObject::saveMesh(QString _filename)
- {
- std::string filename = _filename.toStdString();
-
- bool ok = polymesh::PolyMeshIO::WriteMesh(filename, mesh_);
-
- if (!ok)
- {
- std::cout << "Save File fall" << std::endl;
- }
- return ok;
- }
-
- bool MeshObject::saveTSpline(QString _filename)
- {
- std::string filename = _filename.toStdString();
-
- bool ok = polymesh::PolyMeshIO::WriteToTMSpline(filename, mesh_);
-
- if (!ok)
- std::cout << "Save File TSpline failure!" << std::endl;
-
- return ok;
+ return mesh_.get();
}
//===========================================================
- void MeshObject::doOperate(MOperation* operate)
+ void MeshObject::doOperate(MOperation *operate)
{
operate->operate(parent_);
}
//===========================================================
- void MeshObject::assignMesh()
+ void MeshObject::assignShape()
{
if (mesh_ == nullptr)
- mesh_ = new polymesh::PolyMesh();
+ mesh_ = std::make_unique(); // new polymesh::PolyMesh();
}
//===========================================================
- bool MeshObject::combineObject(const MeshObject* mesh_object)
+ bool MeshObject::combineObject(const MeshObject *mesh_object)
{
if (mesh_ == nullptr)
return false;
if (mesh_object->mesh_ == nullptr)
return false;
- polymesh::MeshCopy::CombineMesh(mesh_, mesh_object->mesh_);
+ polymesh::MeshCopy::CombineMesh(getShape(), mesh_object->getShape());
return true;
}
- void MeshObject::duplicateFaces(MeshObject* mesh_object, std::vector& f_list)
- {
- std::sort(f_list.begin(), f_list.end(), std::greater());
- f_list.erase(std::unique(f_list.begin(), f_list.end()), f_list.end());
-
- if (mesh_object->mesh_ == nullptr)
- mesh_object->mesh_ = new polymesh::PolyMesh();
+ // void MeshObject::duplicateFaces(MeshObject* mesh_object, std::vector& f_list)
+ //{
+ // std::sort(f_list.begin(), f_list.end(), std::greater());
+ // f_list.erase(std::unique(f_list.begin(), f_list.end()), f_list.end());
- //polymesh::copyMeshFaces(mesh_, mesh_object->mesh_, f_list);
- mesh_object->mesh_ = polymesh::MeshCopy::ExtractMeshFaces(mesh_, f_list);
- }
+ // if (mesh_object->mesh_ == nullptr)
+ // mesh_object->mesh_ = std::make_unique();
+ // //polymesh::copyMeshFaces(mesh_, mesh_object->mesh_, f_list);
+ // mesh_object->mesh_.reset(polymesh::MeshCopy::ExtractMeshFaces(getShape(), f_list));
+ //}
- void MeshObject::mirrorMeshObject(const MVector3& center, const MVector3& normal)
+ void MeshObject::mirrorMeshObject(const MVector3 ¢er, const MVector3 &normal)
{
- //if (mesh_ == nullptr)
+ // if (mesh_ == nullptr)
// return nullptr;
- //AMCAX::SubD::PolyMesh* copy_mesh = AMCAX::SubD::MeshCopy::CopyMesh(mesh_);
+ // AMCAX::SubD::PolyMesh* copy_mesh = AMCAX::SubD::MeshCopy::CopyMesh(mesh_);
- //AdapterObject* adapter_object = new AdapterObject;
- //MeshObject* mesh_object_new = new MeshObject(adapter_object);
- //mesh_object_new->mesh_ = AMCAX::SubD::MeshCopy::CopyMesh(mesh_);
- ///mesh_object_new->mesh_ = polymesh::meshMioor(mesh_, center.point(), normal);
+ // AdapterObject* adapter_object = new AdapterObject;
+ // MeshObject* mesh_object_new = new MeshObject(adapter_object);
+ // mesh_object_new->mesh_ = AMCAX::SubD::MeshCopy::CopyMesh(mesh_);
+ /// mesh_object_new->mesh_ = polymesh::meshMioor(mesh_, center.point(), normal);
AMCAX::Point3 ct(center.X(), center.Y(), center.Z());
AMCAX::Frame3 ft(ct, AMCAX::Direction3(normal));
@@ -188,169 +136,173 @@ namespace acamcad {
AMCAX::Transformation3 trsfMove;
trsfMove.SetMirror(ft);
trsfF.SetTransformation(trsfMove);
- trsfF.TranformMesh(mesh_);
+ trsfF.TranformMesh(getShape());
-
- //return mesh_object_new;
+ // return mesh_object_new;
}
//===========================================================
void MeshObject::mesh_OPvert_Backup()
{
- //AMCAX::SubD::Mes
+ // AMCAX::SubD::Mes
scale_ = 1;
mesh_v_id_back_.resize(mesh_->numVertices());
- //mesh_v_position_back_.resize(mesh_->numVertices());
+ // mesh_v_position_back_.resize(mesh_->numVertices());
for (int i = 0; i < mesh_->numVertices(); i++)
{
mesh_v_id_back_[i] = i;
- //mesh_v_position_back_[i] = AMCAX::SubD::MeshTool::Position(mesh_, i);// mesh_->vert(i)->position();
+ // mesh_v_position_back_[i] = AMCAX::SubD::MeshTool::Position(mesh_, i);// mesh_->vert(i)->position();
}
}
- void MeshObject::mesh_OPvert_BackupVertes(const std::vector& vert_id)
+ void MeshObject::mesh_OPvert_BackupVertes(const std::vector &vert_id)
{
mesh_v_id_back_ = vert_id;
scale_ = 1;
- //mesh_v_position_back_.resize(vert_id.size());
- //for (int i = 0; i < vert_id.size(); i++)
+ // mesh_v_position_back_.resize(vert_id.size());
+ // for (int i = 0; i < vert_id.size(); i++)
//{
// mesh_v_position_back_[i] = AMCAX::SubD::MeshTool::Position(mesh_, i);//mesh_->vert(vert_id[i])->position();
- //}
+ // }
}
- void MeshObject::mesh_OPvert_BackupEdges(const std::vector& edge_id)
+ void MeshObject::mesh_OPvert_BackupEdges(const std::vector &edge_id)
{
scale_ = 1;
- std::vector vert_id; vert_id.clear(); vert_id.reserve(edge_id.size() * 2);
+ std::vector vert_id;
+ vert_id.clear();
+ vert_id.reserve(edge_id.size() * 2);
for (size_t i = 0; i < edge_id.size(); i++)
{
- //polymesh::MEdge* e = mesh_->edge(edge_id[i]);
- //vert_id.push_back(e->getVert(0)->index());
- //vert_id.push_back(e->getVert(1)->index());
+ // polymesh::MEdge* e = mesh_->edge(edge_id[i]);
+ // vert_id.push_back(e->getVert(0)->index());
+ // vert_id.push_back(e->getVert(1)->index());
int id0, id1;
- AMCAX::SubD::MeshTool::EdgeVertexIndexs(mesh_, edge_id[i], id0, id1);
+ AMCAX::SubD::MeshTool::EdgeVertexIndexs(getShape(), edge_id[i], id0, id1);
vert_id.push_back(id0);
vert_id.push_back(id1);
-
}
std::sort(vert_id.begin(), vert_id.end());
vert_id.erase(std::unique(vert_id.begin(), vert_id.end()), vert_id.end());
mesh_v_id_back_ = vert_id;
- //mesh_v_position_back_.resize(vert_id.size());
- //for (int i = 0; i < vert_id.size(); i++)
+ // mesh_v_position_back_.resize(vert_id.size());
+ // for (int i = 0; i < vert_id.size(); i++)
//{
// mesh_v_position_back_[i] = AMCAX::SubD::MeshTool::Position(mesh_, i);//mesh_->vert(vert_id[i])->position();
- //}
+ // }
}
- void MeshObject::mesh_OPvert_BackupFaces(const std::vector& face_id)
+ void MeshObject::mesh_OPvert_BackupFaces(const std::vector &face_id)
{
scale_ = 1;
- std::vector vert_id; vert_id.clear(); vert_id.reserve(face_id.size() * 4);
+ std::vector vert_id;
+ vert_id.clear();
+ vert_id.reserve(face_id.size() * 4);
for (size_t i = 0; i < face_id.size(); i++)
{
- auto ids = AMCAX::SubD::MeshTool::FaceVertexIndexs(mesh_, face_id[i]);
+ auto ids = AMCAX::SubD::MeshTool::FaceVertexIndexs(getShape(), face_id[i]);
- for (auto iter : ids) {
+ for (auto iter : ids)
+ {
vert_id.push_back(iter);
}
-
}
std::sort(vert_id.begin(), vert_id.end());
vert_id.erase(std::unique(vert_id.begin(), vert_id.end()), vert_id.end());
mesh_v_id_back_ = vert_id;
- //mesh_v_position_back_.resize(vert_id.size());
- //for (int i = 0; i < vert_id.size(); i++)
+ // mesh_v_position_back_.resize(vert_id.size());
+ // for (int i = 0; i < vert_id.size(); i++)
//{
// mesh_v_position_back_[i] = AMCAX::SubD::MeshTool::Position(mesh_, i);
- //}
+ // }
}
void MeshObject::mesh_Clear_OPvertBackup()
{
mesh_v_id_back_.clear();
- //mesh_v_position_back_.clear();
+ // mesh_v_position_back_.clear();
scale_ = 1;
- AMCAX::SubD::MeshTool::UpdateNormal(mesh_);
+ AMCAX::SubD::MeshTool::UpdateNormal(getShape());
}
- void MeshObject::meshScaleSingle(const MVector3& center, const MVector3& axis, double scale)
+ void MeshObject::meshScaleSingle(const MVector3 ¢er, const MVector3 &axis, double scale)
{
scale_ = scale / scale_;
- if (std::isnan(scale_)) {
+ if (std::isnan(scale_))
+ {
scale_ = 1;
return;
}
- ///std::cout << "meshScaleSingle center:(" << center.X() << "," << center.Y() << "," << center.Z() << ") scale:" << scale << std::endl;
+ /// std::cout << "meshScaleSingle center:(" << center.X() << "," << center.Y() << "," << center.Z() << ") scale:" << scale << std::endl;
AMCAX::Point3 point(center.X(), center.Y(), center.Z());
AMCAX::Direction3 dir(axis.X(), axis.Y(), axis.Z());
- //AMCAX::Axis3
+ // AMCAX::Axis3
AMCAX::Frame3 ct(point, dir);
- //AMCAX::Frame3 ft(ct, AMCAX::Direction3(normal));
+ // AMCAX::Frame3 ft(ct, AMCAX::Direction3(normal));
AMCAX::SubD::MeshTransform trsfF;
- //AMCAX::Transformation3 trfScale;
+ // AMCAX::Transformation3 trfScale;
AMCAX::GeneralTransformation3 trfScale;
- //trfRotation.SetRotation(AMCAX::Axis3(ct, AMCAX::Direction3(axis.X(), axis.Y(), axis.Z())), angle);
- //trfScale.SetScale(ct, scale);
- //trfScale.Set
+ // trfRotation.SetRotation(AMCAX::Axis3(ct, AMCAX::Direction3(axis.X(), axis.Y(), axis.Z())), angle);
+ // trfScale.SetScale(ct, scale);
+ // trfScale.Set
// trsfF.SetGTransformation(trfScale);
trfScale.SetAffinity(ct, scale_);
trsfF.SetGTransformation(trfScale);
- trsfF.TransformMeshVertices(mesh_, mesh_v_id_back_);
+ trsfF.TransformMeshVertices(getShape(), mesh_v_id_back_);
scale_ = scale;
}
- void MeshObject::meshScalePlane(const MVector3& center, const MVector3& normal, double scale)
+ void MeshObject::meshScalePlane(const MVector3 ¢er, const MVector3 &normal, double scale)
{
- ///std::cout << "meshScalePlane is error,scale:" << scale << std::endl;
+ /// std::cout << "meshScalePlane is error,scale:" << scale << std::endl;
scale_ = scale / scale_;
- if (std::isnan(scale_)) {
+ if (std::isnan(scale_))
+ {
scale_ = 1;
return;
}
AMCAX::Point3 point(center.X(), center.Y(), center.Z());
AMCAX::Direction3 dir(normal.X(), normal.Y(), normal.Z());
- //AMCAX::Axis3
+ // AMCAX::Axis3
AMCAX::Axis3 ct(point, dir);
- //AMCAX::Frame3 ft(ct, AMCAX::Direction3(normal));
+ // AMCAX::Frame3 ft(ct, AMCAX::Direction3(normal));
AMCAX::SubD::MeshTransform trsfF;
- //AMCAX::Transformation3 trfScale;
+ // AMCAX::Transformation3 trfScale;
AMCAX::GeneralTransformation3 trfScale;
- //trfRotation.SetRotation(AMCAX::Axis3(ct, AMCAX::Direction3(axis.X(), axis.Y(), axis.Z())), angle);
- //trfScale.SetScale(ct, scale);
- //trfScale.Set
+ // trfRotation.SetRotation(AMCAX::Axis3(ct, AMCAX::Direction3(axis.X(), axis.Y(), axis.Z())), angle);
+ // trfScale.SetScale(ct, scale);
+ // trfScale.Set
// trsfF.SetGTransformation(trfScale);
trfScale.SetAffinity(ct, scale_);
trsfF.SetGTransformation(trfScale);
- trsfF.TransformMeshVertices(mesh_, mesh_v_id_back_);
+ trsfF.TransformMeshVertices(getShape(), mesh_v_id_back_);
scale_ = scale;
}
- void MeshObject::meshRotation(const MVector3& center, const MVector3& axis, double angle)
+ void MeshObject::meshRotation(const MVector3 ¢er, const MVector3 &axis, double angle)
{
- //std::cout << "MeshObject::meshRotation angle:" << angle << std::endl;
+ // std::cout << "MeshObject::meshRotation angle:" << angle << std::endl;
AMCAX::Point3 ct(center.X(), center.Y(), center.Z());
- //AMCAX::Frame3 ft(ct, AMCAX::Direction3(normal));
+ // AMCAX::Frame3 ft(ct, AMCAX::Direction3(normal));
AMCAX::SubD::MeshTransform trsfF;
AMCAX::Transformation3 trfRotation;
trfRotation.SetRotation(AMCAX::Axis3(ct, AMCAX::Direction3(axis.X(), axis.Y(), axis.Z())), angle);
trsfF.SetTransformation(trfRotation);
- trsfF.TransformMeshVertices(mesh_, mesh_v_id_back_);
+ trsfF.TransformMeshVertices(getShape(), mesh_v_id_back_);
/*
@@ -363,7 +315,6 @@ namespace acamcad {
*/
-
}
void MeshObject::meshMoveUsingNormal(double dis)
@@ -371,65 +322,63 @@ namespace acamcad {
std::cout << "MeshObject::meshMoveUsingNormal" << std::endl;
}
- void MeshObject::meshMove(const MVector3& v, double dis)
+ void MeshObject::meshMove(const MVector3 &v, double dis)
{
AMCAX::Vector3 vh(v.Normalized() * dis);
AMCAX::Transformation3 trshMove;
- //AMCAX::Axis3 ax;
+ // AMCAX::Axis3 ax;
trshMove.SetTranslation(vh);
AMCAX::SubD::MeshTransform trsf;
trsf.SetTransformation(trshMove);
- trsf.TransformMeshVertices(mesh_, mesh_v_id_back_);
-
-
-
+ trsf.TransformMeshVertices(getShape(), mesh_v_id_back_);
}
// select vert edge face
- void MeshObject::selectVertWithFaceId(const MVector3& begin, const MVector3& end, int f_id, int& sv_id)
+ void MeshObject::selectVertWithFaceId(const MVector3 &begin, const MVector3 &end, int f_id, int &sv_id)
{
sv_id = -1;
- auto ids = AMCAX::SubD::MeshTool::FaceVertexIndexs(mesh_, f_id);
+ auto ids = AMCAX::SubD::MeshTool::FaceVertexIndexs(getShape(), f_id);
AMCAX::Coord3 coord;
double len_min;
for (int i = 0; i < ids.size(); i++)
{
- AMCAX::Point3 position = AMCAX::SubD::MeshTool::Position(mesh_, ids[i]);
+ AMCAX::Point3 position = AMCAX::SubD::MeshTool::Position(getShape(), ids[i]);
double len = MathUtils::distPointLineSquared(position.Coord(), begin.Coord(), end.Coord(), coord);
- if (len > 0.1) {
+ if (len > 0.1)
+ {
continue;
}
-
if (sv_id == -1 || len_min > len)
{
sv_id = ids[i];
len_min = len;
}
}
-
}
- void MeshObject::selectEdgeWithFaceId(const MVector3& begin, const MVector3& end, int f_id, int& se_id)
+ void MeshObject::selectEdgeWithFaceId(const MVector3 &begin, const MVector3 &end, int f_id, int &se_id)
{
se_id = -1;
- auto ids = AMCAX::SubD::MeshTool::FaceEdgeIndexs(mesh_, f_id);
+ auto ids = AMCAX::SubD::MeshTool::FaceEdgeIndexs(getShape(), f_id);
AMCAX::Coord3 coord0, coord1;
double len_min;
- for (int i = 0; i < ids.size(); i++) {
+ for (int i = 0; i < ids.size(); i++)
+ {
int id0, id1;
- AMCAX::SubD::MeshTool::EdgeVertexIndexs(mesh_, ids[i], id0, id1);
- AMCAX::Point3 p0 = AMCAX::SubD::MeshTool::Position(mesh_, id0),
- p1 = AMCAX::SubD::MeshTool::Position(mesh_, id1);
+ AMCAX::SubD::MeshTool::EdgeVertexIndexs(getShape(), ids[i], id0, id1);
+ AMCAX::Point3 p0 = AMCAX::SubD::MeshTool::Position(getShape(), id0),
+ p1 = AMCAX::SubD::MeshTool::Position(getShape(), id1);
double len = MathUtils::distLine_SLineSquared(p0.Coord(), p1.Coord(), begin.Coord(), end.Coord(), coord0, coord1);
- if (len > 0.1) {
+ if (len > 0.1)
+ {
continue;
}
@@ -438,66 +387,64 @@ namespace acamcad {
se_id = ids[i];
len_min = len;
}
-
}
-
}
- //===========================================================
+ ////===========================================================
- void MeshObject::backMesh(polymesh::PolyMesh*& bmesh)
- {
- if (mesh_ != nullptr)
- {
- if (bmesh == nullptr)
- bmesh = new polymesh::PolyMesh();
+ // void MeshObject::backMesh(polymesh::PolyMesh*& bmesh)
+ //{
+ // if (mesh_ != nullptr)
+ // {
+ // if (bmesh == nullptr)
+ // bmesh = new polymesh::PolyMesh();
- bmesh = AMCAX::SubD::MeshCopy::CopyMesh(mesh_);
+ // bmesh = AMCAX::SubD::MeshCopy::CopyMesh(getShape());
- //polymesh::CopyMesh(mesh_, bmesh);
- }
- else
- {
- bmesh = nullptr;
- }
- }
+ // //polymesh::CopyMesh(mesh_, bmesh);
+ // }
+ // else
+ // {
+ // bmesh = nullptr;
+ // }
+ //}
- void MeshObject::applyMesh(const polymesh::PolyMesh* amesh)
- {
- mesh_->clear();
- mesh_ = AMCAX::SubD::MeshCopy::CopyMesh(amesh);
- }
+ // void MeshObject::applyMesh(const polymesh::PolyMesh* amesh)
+ //{
+ // mesh_->clear();
+ // mesh_.reset(AMCAX::SubD::MeshCopy::CopyMesh(amesh));
+ // }
//===========================================================
void MeshObject::meshTriangulating()
{
- //polymesh::meshTriangles(mesh_);
- AMCAX::SubD::MeshTool::MeshTriangles(mesh_);
+ // polymesh::meshTriangles(mesh_);
+ AMCAX::SubD::MeshTool::MeshTriangles(getShape());
}
- void MeshObject::meshQuadrilateralizatuon()
- {
- //polymesh::meshQuadrilate(mesh_);
- std::cout << "MeshObject::meshQuadrilateralizatuon error" << std::endl;
- }
+ // void MeshObject::meshQuadrilateralizatuon()
+ //{
+ // //polymesh::meshQuadrilate(mesh_);
+ // std::cout << "MeshObject::meshQuadrilateralizatuon error" << std::endl;
+ // }
void MeshObject::subdivemeshCC(int sub_time)
{
- //polymesh::catmullclark_Subdive(mesh_, sub_time);
- AMCAX::SubD::MeshSubdiveHE::CatmullClarkSubdive(mesh_, sub_time);
+ // polymesh::catmullclark_Subdive(mesh_, sub_time);
+
+ AMCAX::SubD::MeshSubdiveHE::CatmullClarkSubdive(getShape(), sub_time);
draw_tool_->updatedrawState();
}
void MeshObject::subdivemeshLoop(int sub_time)
{
- //if (mesh_->isTriangleMesh()) error
+ // if (mesh_->isTriangleMesh()) error
- AMCAX::SubD::MeshSubdiveHE::LoopSubdive(mesh_, sub_time);
+ AMCAX::SubD::MeshSubdiveHE::LoopSubdive(getShape(), sub_time);
draw_tool_->updatedrawState();
- //polymesh::loop_Subdive(mesh_, sub_time);
-
+ // polymesh::loop_Subdive(mesh_, sub_time);
}
void MeshObject::updateDraw()
@@ -507,26 +454,25 @@ namespace acamcad {
//===========================================================
- void MeshObject::weldEdge(std::vector& e_list)
+ void MeshObject::weldEdge(std::vector &e_list)
{
- //polymesh::meshWeldEdges(mesh_, e_list);
- AMCAX::SubD::MeshWeld::MeshWeldEdges(mesh_, e_list);
+ // polymesh::meshWeldEdges(mesh_, e_list);
+ AMCAX::SubD::MeshWeld::MeshWeldEdges(getShape(), e_list);
}
-
-
//===========================================================
- QString MeshObject::getObjectinfo() {
+ QString MeshObject::getObjectinfo()
+ {
QString output;
output += "========================================================================\n";
output += parent_->getObjectinfo();
output += "Object Contains Poly Mesh : ";
- output += QString::number(mesh()->numVertices()) + " vertices, ";
- output += QString::number(mesh()->numEdges()) += " edges ";
- output += QString::number(mesh()->numPolygons()) += " faces.\n";
+ output += QString::number(getShape()->numVertices()) + " vertices, ";
+ output += QString::number(getShape()->numEdges()) += " edges ";
+ output += QString::number(getShape()->numPolygons()) += " faces.\n";
output += "========================================================================\n";
return output;
diff --git a/Src/Object/MeshObject.h b/Src/Object/MeshObject.h
index 6aedf0df8055b757dbcf311e2bf50b66235cb763..ea37951cb6f6265e7b78586fe90c4031e14aa25e 100644
--- a/Src/Object/MeshObject.h
+++ b/Src/Object/MeshObject.h
@@ -32,12 +32,12 @@ namespace acamcad {
virtual ~MeshObject();
public:
- void SetMesh(AMCAX::SubD::PolyMesh* mesh);
- polymesh::PolyMesh* mesh();
- const polymesh::PolyMesh* mesh() const;
+ void setShape(polymesh::PolyMesh* mesh);
+ polymesh::PolyMesh* getShape();
+ const polymesh::PolyMesh* getShape() const;
private:
- polymesh::PolyMesh* mesh_;
+ std::unique_ptr mesh_;
//polymesh::PolyMesh* mesh_subdive_;
std::vector mesh_v_id_back_;
@@ -45,12 +45,12 @@ namespace acamcad {
//std::vector mesh_normal_back_;
float scale_ = 1;
- public:
- /// Load a mesh from the given file
- bool loadMesh(QString filename);
- /// Save a mesh to the given file
- bool saveMesh(QString filename);
- bool saveTSpline(QString filename);
+ //public:
+ // /// Load a mesh from the given file
+ // bool loadMesh(QString filename);
+ // /// Save a mesh to the given file
+ // bool saveMesh(QString filename);
+ // bool saveTSpline(QString filename);
public:
const virtual ObjectDraw* getDrawTool() const { return draw_tool_.get(); }
@@ -62,16 +62,16 @@ namespace acamcad {
virtual void doOperate(MOperation* operate);
public:
- void assignMesh();
+ void assignShape();
- public:
- void backMesh(polymesh::PolyMesh*& bmesh);
- void applyMesh(const polymesh::PolyMesh* amesh);
+ //public:
+ // ///void backMesh(polymesh::PolyMesh*& bmesh);
+ // void applyMesh(const polymesh::PolyMesh* amesh);
public:
bool combineObject(const MeshObject* mesh_object);
- void duplicateFaces(MeshObject* mesh_object, std::vector& f_list);
+ //void duplicateFaces(MeshObject* mesh_object, std::vector& f_list);
void mirrorMeshObject(const MVector3& center, const MVector3& normal);
@@ -103,7 +103,7 @@ namespace acamcad {
public:
void meshTriangulating();
- void meshQuadrilateralizatuon();
+ //void meshQuadrilateralizatuon();
///void reverseMeshNormal();
diff --git a/Src/Object/TSplineObject.cpp b/Src/Object/TSplineObject.cpp
index 129426e58bf135aed23d095e6d87cfdfd49d2032..b49725442e19868ec6f15bf12382a6301af08a15 100644
--- a/Src/Object/TSplineObject.cpp
+++ b/Src/Object/TSplineObject.cpp
@@ -16,20 +16,20 @@ namespace acamcad
{
TSplineObject::TSplineObject(AdapterObject* parent) :AdapterObjectParent(parent),
- spline_(nullptr), scale_(1)
+ scale_(1)
{
//setDataType(DataType::TSPLINEU_TYPE);
draw_tool_ = std::make_unique(parent);
}
TSplineObject::TSplineObject(AdapterObject* parent, const TSplineObject& object, bool isDraw) :
- AdapterObjectParent(parent), spline_(nullptr), scale_(1)
+ AdapterObjectParent(parent), scale_(1)
//BaseObject(object), spline_(nullptr)
{
if (object.spline_ != nullptr)
{
//AMCAX::TMS::TMSplineCopy copy;
- spline_ = AMCAX::TMS::TMSplineCopy().CloneTMSpline(object.spline_);
+ spline_.reset(AMCAX::TMS::TMSplineCopy().CloneTMSpline(object.getShape()));
//tcopy.copyTspline(object.spline_, spline_);
}
if (isDraw) {
@@ -41,40 +41,35 @@ namespace acamcad
TSplineObject::~TSplineObject()
{
- if (spline_ != nullptr)
- {
- spline_->clear();
- delete spline_;
- }
}
- AMCAX::TMS::TMSpline* TSplineObject::getTSpline()
+ AMCAX::TMS::TMSpline* TSplineObject::getShape()
{
- return spline_;
+ return spline_.get();
}
- const AMCAX::TMS::TMSpline* TSplineObject::getTSpline() const
+ const AMCAX::TMS::TMSpline* TSplineObject::getShape() const
{
- return spline_;
+ return spline_.get();
}
- void TSplineObject::setTSpline(AMCAX::TMS::TMSpline* tsp)
+ void TSplineObject::setShape(AMCAX::TMS::TMSpline* tsp)
{
- if (spline_ != nullptr)
- {
- delete spline_;
- spline_ = nullptr;
+ //if (spline_ != nullptr)
+ //{
+ // delete spline_;
+ // spline_ = nullptr;
- draw_tool_->clear();
- }
+ // draw_tool_->clear();
+ //}
- spline_ = tsp;
+ spline_.reset(tsp);
}
- void TSplineObject::assignTSpline()
+ void TSplineObject::assignShape()
{
if (spline_ == nullptr)
- spline_ = new AMCAX::TMS::TMSpline();
+ spline_ = std::make_unique();
}
// select vert edge face
@@ -83,14 +78,14 @@ namespace acamcad
sv_id = -1;
//auto ids = AMCAX::SubD::MeshTool::FaceVertexIndexs(mesh_, f_id);
- auto ids = AMCAX::TMS::TMSplineTool::FaceVertexIndexs(spline_, f_id);
+ auto ids = AMCAX::TMS::TMSplineTool::FaceVertexIndexs(getShape(), f_id);
AMCAX::Coord3 coord;
double len_min;
for (int i = 0; i < ids.size(); i++)
{
- AMCAX::Point3 position = AMCAX::TMS::TMSplineTool::ControlPosition(spline_, ids[i]);
+ AMCAX::Point3 position = AMCAX::TMS::TMSplineTool::ControlPosition(getShape(), ids[i]);
double len = MathUtils::distPointLineSquared(position.Coord(), begin.Coord(), end.Coord(), coord);
if (len > 0.1) {
@@ -110,15 +105,15 @@ namespace acamcad
void TSplineObject::selectEdgeWithFaceId(const AMCAX::Vector3& begin, const AMCAX::Vector3& end, int f_id, int& se_id)
{
se_id = -1;
- auto ids = AMCAX::TMS::TMSplineTool::FaceEdgeIndexs(spline_, f_id);
+ auto ids = AMCAX::TMS::TMSplineTool::FaceEdgeIndexs(getShape(), f_id);
AMCAX::Coord3 coord0, coord1;
double len_min = 0;
for (int i = 0; i < ids.size(); i++) {
int id0, id1;
- AMCAX::TMS::TMSplineTool::EdgeVertexIndexs(spline_, ids[i], id0, id1);
- AMCAX::Point3 p0 = AMCAX::TMS::TMSplineTool::ControlPosition(spline_, id0),
- p1 = AMCAX::TMS::TMSplineTool::ControlPosition(spline_, id1);
+ AMCAX::TMS::TMSplineTool::EdgeVertexIndexs(getShape(), ids[i], id0, id1);
+ AMCAX::Point3 p0 = AMCAX::TMS::TMSplineTool::ControlPosition(getShape(), id0),
+ p1 = AMCAX::TMS::TMSplineTool::ControlPosition(getShape(), id1);
double len = MathUtils::distLine_SLineSquared(p0.Coord(), p1.Coord(), begin.Coord(), end.Coord(), coord0, coord1);
if (len > 0.1) {
@@ -155,57 +150,57 @@ namespace acamcad
//===========================================================================
- bool TSplineObject::loadSpline(const QString& _filename)
- {
- parent_->setFromFileName(_filename);
+ //bool TSplineObject::loadSpline(const QString& _filename)
+ //{
+ // parent_->setFromFileName(_filename);
- // call the local function to update names
- //parent_->setName(parent_->name());
+ // // call the local function to update names
+ // //parent_->setName(parent_->name());
- std::string filename = _filename.toStdString();
+ // std::string filename = _filename.toStdString();
- AMCAX::TMS::TMSplineIO io;
+ // AMCAX::TMS::TMSplineIO io;
- bool ok = io.LoadTMSpline(filename, spline_);
- if (ok)
- {
- updateDraw();
- parent_->show();
- }
- else
- {
- std::cout << "Load File fall" << std::endl;
- }
+ // bool ok = io.LoadTMSpline(filename, getShape());
+ // if (ok)
+ // {
+ // updateDraw();
+ // parent_->show();
+ // }
+ // else
+ // {
+ // std::cout << "Load File fall" << std::endl;
+ // }
- return ok;
- }
+ // return ok;
+ //}
- bool TSplineObject::saveSpline(const QString& _filename)
- {
- std::string filename = _filename.toStdString();
+ //bool TSplineObject::saveSpline(const QString& _filename)
+ //{
+ // std::string filename = _filename.toStdString();
- AMCAX::TMS::TMSplineIO io;
+ // AMCAX::TMS::TMSplineIO io;
- bool ok = io.WriteTMSpline(filename, spline_);
+ // bool ok = io.WriteTMSpline(filename, spline_);
- if (!ok)
- {
- std::cout << "Save File fall" << std::endl;
- }
- return ok;
- }
+ // if (!ok)
+ // {
+ // std::cout << "Save File fall" << std::endl;
+ // }
+ // return ok;
+ //}
- bool TSplineObject::saveSplineSTL(const QString& filename)
- {
- //TSplineObjectDraw* dt = dynamic_cast(draw_tool_);
- return draw_tool_->saveSTL(filename.toStdString());
- }
+ //bool TSplineObject::saveSplineSTL(const QString& filename)
+ //{
+ // //TSplineObjectDraw* dt = dynamic_cast(draw_tool_);
+ // return draw_tool_->saveSTL(filename.toStdString());
+ //}
- bool TSplineObject::saveSplineOBJ(const QString& filename)
- {
- //TSplineObjectDraw* dt = dynamic_cast(draw_tool_);
- return draw_tool_->saveOBJ(filename.toStdString());
- }
+ //bool TSplineObject::saveSplineOBJ(const QString& filename)
+ //{
+ // //TSplineObjectDraw* dt = dynamic_cast(draw_tool_);
+ // return draw_tool_->saveOBJ(filename.toStdString());
+ //}
//bool TSplineObject::saveSplineFrep(const QString& filename)
//{
@@ -227,7 +222,7 @@ namespace acamcad
draw_tool_->updatedrawState();
if (spline_)
- AMCAX::TMS::TMSplineTool::UpdateNormal(spline_);
+ AMCAX::TMS::TMSplineTool::UpdateNormal(getShape());
}
//===========================================================================
@@ -265,7 +260,7 @@ namespace acamcad
//for()
for (int i = 0; i < edge_id.size(); i++) {
int v0, v1;
- AMCAX::TMS::TMSplineTool::EdgeVertexIndexs(spline_, edge_id[i], v0, v1);
+ AMCAX::TMS::TMSplineTool::EdgeVertexIndexs(getShape(), edge_id[i], v0, v1);
mesh_v_id_back_.push_back(v0);
mesh_v_id_back_.push_back(v1);
@@ -287,7 +282,7 @@ namespace acamcad
//vert_id.erase(std::unique(vert_id.begin(), vert_id.end()), vert_id.end());
for (int i = 0; i < face_id.size(); i++) {
- std::vector vert_id = AMCAX::TMS::TMSplineTool::FaceVertexIndexs(spline_, face_id[i]);
+ std::vector vert_id = AMCAX::TMS::TMSplineTool::FaceVertexIndexs(getShape(), face_id[i]);
//mesh_v_id_back_.push_back( vert_id);
@@ -330,9 +325,9 @@ namespace acamcad
trfScale.SetAffinity(ct, scale_);
trf.SetGTransformation(trfScale);
- trf.TransformTMSplineVertices(spline_, mesh_v_id_back_);
+ trf.TransformTMSplineVertices(getShape(), mesh_v_id_back_);
scale_ = scale;
- trf.TransformReprocessing(spline_);
+ trf.TransformReprocessing(getShape());
}
void TSplineObject::meshScalePlane(const AMCAX::Vector3& center, const AMCAX::Vector3& normal, double scale)
@@ -357,9 +352,9 @@ namespace acamcad
trfScale.SetAffinity(ct, scale_);
trf.SetGTransformation(trfScale);
- trf.TransformTMSplineVertices(spline_, mesh_v_id_back_);
+ trf.TransformTMSplineVertices(getShape(), mesh_v_id_back_);
scale_ = scale;
- trf.TransformReprocessing(spline_);
+ trf.TransformReprocessing(getShape());
}
void TSplineObject::meshRotation(const AMCAX::Vector3& center, const AMCAX::Vector3& axis, double angle)
@@ -372,8 +367,8 @@ namespace acamcad
trsf.SetTransformation(trfRotation);
- trsf.TransformTMSplineVertices(spline_, mesh_v_id_back_);
- trsf.TransformReprocessing(spline_);
+ trsf.TransformTMSplineVertices(getShape(), mesh_v_id_back_);
+ trsf.TransformReprocessing(getShape());
}
void TSplineObject::meshMove(const AMCAX::Vector3& v, double dis)
@@ -385,9 +380,9 @@ namespace acamcad
AMCAX::TMS::TMSplineTransform trf;
trf.SetTransformation(trMove);
- trf.TransformTMSplineVertices(spline_, mesh_v_id_back_);
+ trf.TransformTMSplineVertices(getShape(), mesh_v_id_back_);
- trf.TransformReprocessing(spline_);
+ trf.TransformReprocessing(getShape());
}
const ObjectDraw* TSplineObject::getDrawTool() const
@@ -405,9 +400,9 @@ namespace acamcad
trfMirror.SetMirror(frame);
trf.SetTransformation(trfMirror);
- trf.TransformTMSpline(spline_);
+ trf.TransformTMSpline(getShape());
- trf.TransformReprocessing(spline_);
+ trf.TransformReprocessing(getShape());
}
//===========================================================
diff --git a/Src/Object/TSplineObject.h b/Src/Object/TSplineObject.h
index 69363caf051221d4bb4cecd7cce41cd7a402601e..aca19c71fb919c8efcfc684895edc7a1a0be8065 100644
--- a/Src/Object/TSplineObject.h
+++ b/Src/Object/TSplineObject.h
@@ -1,4 +1,4 @@
-#pragma once
+#pragma once
#include "BaseObject.h"
#include
@@ -31,13 +31,13 @@ namespace acamcad
virtual void updateDraw();
public:
- AMCAX::TMS::TMSpline* getTSpline();
- const AMCAX::TMS::TMSpline* getTSpline() const;
+ AMCAX::TMS::TMSpline* getShape();
+ const AMCAX::TMS::TMSpline* getShape() const;
/// This function is Very danger, only using in creat operation, I am trying other ways to replace it
- void setTSpline(AMCAX::TMS::TMSpline* tsp);
+ void setShape(AMCAX::TMS::TMSpline* tsp);
- void assignTSpline();
+ void assignShape();
// select vert edge face
void selectVertWithFaceId(const AMCAX::Vector3& begin, const AMCAX::Vector3& end, int f_id, int& sv_id);
@@ -47,34 +47,32 @@ namespace acamcad
//void backSpline(AMCAX::TMS::TMSpline*& back_spline);
//void applySpline(const AMCAX::TMS::TMSpline* apply_spline);
- public:
- /// Load a mesh from the given file
- bool loadSpline(const QString& filename);
- /// Save a mesh to the given file
- bool saveSpline(const QString& filename);
+ //public:
+ // /// Load a mesh from the given file
+ // bool loadSpline(const QString& filename);
+ // /// Save a mesh to the given file
+ // bool saveSpline(const QString& filename);
- bool saveSplineSTL(const QString& filename);
- bool saveSplineOBJ(const QString& filename);
+ // bool saveSplineSTL(const QString& filename);
+ // bool saveSplineOBJ(const QString& filename);
//bool saveSplineFrep(const QString& filename);
//std::set frepFixFaceIndex;
//std::set frepForceFaceIndex;
private:
- AMCAX::TMS::TMSpline* spline_;
+ std::unique_ptr spline_;
public:
- //存储原来点的位置
void mesh_OPvert_Backup();
void mesh_OPvert_BackupVertes(const std::vector& vert_id);
void mesh_OPvert_BackupEdges(const std::vector& edge_id);
void mesh_OPvert_BackupFaces(const std::vector& face_id);
void mesh_Clear_OPvertBackup();
- //在有了原来的顶点之后,所有的缩放都是一样的,没有体,边,面,点的区别了。
void meshScaleSingle(const AMCAX::Vector3& center, const AMCAX::Vector3& axis, double scale);
void meshScalePlane(const AMCAX::Vector3& center, const AMCAX::Vector3& normal, double scale);
- void meshRotation(const AMCAX::Vector3& center, const AMCAX::Vector3& axis, double angle); //rotation 没存储原来的位置
+ void meshRotation(const AMCAX::Vector3& center, const AMCAX::Vector3& axis, double angle);
///void meshMoveUsingNormal(double dis);
void meshMove(const AMCAX::Vector3& v, double dis);
diff --git a/Src/ObjectDraw/MeshObjectDraw.cpp b/Src/ObjectDraw/MeshObjectDraw.cpp
index a8a0889a4dc9ed3433af2ed4b5c79f8168e08e81..933df51fe32b3faa69b2b56ad5419066dc5ff777 100644
--- a/Src/ObjectDraw/MeshObjectDraw.cpp
+++ b/Src/ObjectDraw/MeshObjectDraw.cpp
@@ -29,7 +29,7 @@ void MeshObjectDraw::draw(const DrawModel& dmodel, bool is_show_point) const
if (!parent_->isVisible())
return;
- const polymesh::PolyMesh* mesh = parent_->mesh->mesh_;
+ const polymesh::PolyMesh* mesh = parent_->mesh->getShape();
if (mesh == nullptr) { return; }
if (mesh->numVertices() == 0) { return; }
@@ -118,7 +118,7 @@ void MeshObjectDraw::draw(const DrawModel& dmodel, bool is_show_point) const
void MeshObjectDraw::drawSelected(const SelectModel& s_model, int s_id) const
{
- polymesh::PolyMesh* mesh = parent_->mesh->mesh_;
+ polymesh::PolyMesh* mesh = parent_->mesh->getShape();
if (s_model == SelectModel::VERTEX_MODEL)
{
@@ -174,7 +174,7 @@ void MeshObjectDraw::drawWithObjectID() const
if (!parent_->isVisible())
return;
- const polymesh::PolyMesh* mesh = parent_->mesh->mesh_;
+ const polymesh::PolyMesh* mesh = parent_->mesh->getShape();
if (mesh == nullptr) { return; }
if (mesh->numVertices() == 0) { return; }
@@ -194,7 +194,7 @@ void MeshObjectDraw::drawWithObjectID() const
void MeshObjectDraw::drawWithFaceID() const
{
- polymesh::PolyMesh* mesh = parent_->mesh->mesh();
+ polymesh::PolyMesh* mesh = parent_->mesh->getShape();
//auto indexs = AMCAX::SubD::MeshTool::FaceVertexIndexs(mesh, i);
for (int i = 0; i < mesh->numPolygons(); i++) {
@@ -219,7 +219,7 @@ void MeshObjectDraw::drawWithFaceID() const
void MeshObjectDraw::drawWithEdgeID() const
{
- auto mesh = parent_->mesh->mesh();
+ auto mesh = parent_->mesh->getShape();
for (int i = 0; i < mesh->numEdges(); i++)
{
@@ -240,7 +240,7 @@ void MeshObjectDraw::drawWithEdgeID() const
void MeshObjectDraw::drawWithVertexID() const
{
- auto mesh = parent_->mesh->mesh();
+ auto mesh = parent_->mesh->getShape();
for (int i = 0; i < mesh->numVertices(); i++)
diff --git a/Src/ObjectDraw/TSplineObjectDraw.cpp b/Src/ObjectDraw/TSplineObjectDraw.cpp
index 9c70b70f480b22070b9d553a71db7bffec167754..dced0d0eb2117180ff801c2c34d2a0e5958c8954 100644
--- a/Src/ObjectDraw/TSplineObjectDraw.cpp
+++ b/Src/ObjectDraw/TSplineObjectDraw.cpp
@@ -42,7 +42,7 @@ namespace acamcad
void TSplineObjectDraw::draw(const DrawModel& dmodel, bool is_show_point) const
{
bool is_selected = parent_->isSelect();
- auto mesh = parent_->tSpline->getTSpline();
+ auto mesh = parent_->tSpline->getShape();
if (mesh == nullptr) { return; }
if (mesh->numVertices() == 0) { return; }
@@ -97,7 +97,7 @@ namespace acamcad
void TSplineObjectDraw::drawSelected(const SelectModel& s_model, int s_id) const
{
- auto mesh = parent_->tSpline->getTSpline();
+ auto mesh = parent_->tSpline->getShape();
if (s_model == SelectModel::VERTEX_MODEL)
{
@@ -212,7 +212,7 @@ namespace acamcad
if (!parent_->isVisible())
return;
- auto mesh = parent_->tSpline->getTSpline();
+ auto mesh = parent_->tSpline->getShape();
if (mesh == nullptr) { return; }
if (mesh->numVertices() == 0) { return; }
@@ -231,7 +231,7 @@ namespace acamcad
}
void TSplineObjectDraw::drawWithFaceID() const
{
- auto mesh = parent_->tSpline->getTSpline();
+ auto mesh = parent_->tSpline->getShape();
int size = mesh->numFaces();
for (int i = 0; i < size; i++) {
@@ -252,7 +252,7 @@ namespace acamcad
void TSplineObjectDraw::drawWithEdgeID() const
{
- auto mesh = parent_->tSpline->getTSpline();
+ auto mesh = parent_->tSpline->getShape();
for (int i = 0; i < mesh->numEdges(); i++)
{
@@ -274,7 +274,7 @@ namespace acamcad
void TSplineObjectDraw::drawWithVertexID() const
{
- auto mesh = parent_->tSpline->getTSpline();
+ auto mesh = parent_->tSpline->getShape();
for (int i = 0; i < mesh->numVertices(); i++)
{
@@ -556,7 +556,7 @@ namespace acamcad
if (!parent_->tSpline)
return;
- auto spl = parent_->tSpline->getTSpline();
+ auto spl = parent_->tSpline->getShape();
if (spl == nullptr)
{
@@ -736,10 +736,10 @@ namespace acamcad
void TSplineObjectDraw::initMesh(int subtime)
{
- if (tsp_mesh_ == nullptr && parent_->tSpline->getTSpline())
+ if (tsp_mesh_ == nullptr && parent_->tSpline->getShape())
{
- tsp_mesh_ = std::make_unique(parent_->tSpline->getTSpline(), subtime);
+ tsp_mesh_ = std::make_unique(parent_->tSpline->getShape(), subtime);
}
}
diff --git a/Src/Operation/CreateOperate_CircularTSpline.cpp b/Src/Operation/CreateOperate_CircularTSpline.cpp
index c5f6eaeb749164c92f8379189538a24ec1564197..415572893062c86d431a7d4ff4c4a345bc628714 100644
--- a/Src/Operation/CreateOperate_CircularTSpline.cpp
+++ b/Src/Operation/CreateOperate_CircularTSpline.cpp
@@ -21,9 +21,9 @@ namespace acamcad
AMCAX::TMS::TMSplineMakeCircular shape(frame, radius_, angle_, seg_);
- object->tSpline->setTSpline(shape.BuildSpline());
+ object->tSpline->setShape(shape.BuildSpline());
object->tSpline->updateDraw();
- return true;
+ return object->tSpline->getShape();
}
diff --git a/Src/Operation/CreateOperate_ConeTSpline.cpp b/Src/Operation/CreateOperate_ConeTSpline.cpp
index 78a1a332054c29547d6dfcda9c61cab0ee314bc2..ee6334bc90b4373ec35deeb9d08d1af72c51c716 100644
--- a/Src/Operation/CreateOperate_ConeTSpline.cpp
+++ b/Src/Operation/CreateOperate_ConeTSpline.cpp
@@ -19,10 +19,10 @@ namespace acamcad
AMCAX::TMS::TMSplineMakeCone cone(frame, radius_, height_, bottom_, rf_num_, vf_num_);
- object->tSpline->setTSpline(cone.BuildSpline());
+ object->tSpline->setShape(cone.BuildSpline());
object->tSpline->updateDraw();
- return true;
+ return object->tSpline->getShape();
}
}
\ No newline at end of file
diff --git a/Src/Operation/CreateOperate_CubeMesh.cpp b/Src/Operation/CreateOperate_CubeMesh.cpp
index b16f1512f08ea28ec1acdae5fb62eead1b70e003..1856b13e30ea908044f2799a98b0979cec8446d4 100644
--- a/Src/Operation/CreateOperate_CubeMesh.cpp
+++ b/Src/Operation/CreateOperate_CubeMesh.cpp
@@ -18,7 +18,7 @@ namespace acamcad
AMCAX::Point3 bb_max = AMCAX::Point3(bb_max_.X(), bb_max_.Y(), bb_max_.Z());
AMCAX::SubD::MeshMakeCube cube(bb_min, bb_max, segX_, segY_, segZ_);
- adapter->mesh->SetMesh(cube.BuildMesh());
+ adapter->mesh->setShape(cube.BuildMesh());
adapter->updateDraw();
return true;
diff --git a/Src/Operation/CreateOperate_CubeTSpline.cpp b/Src/Operation/CreateOperate_CubeTSpline.cpp
index 8f18de8742067fa11a0b9169ac17c95cc29f1662..3df26e209c8ee7b9bef3862f04337a4ad598922a 100644
--- a/Src/Operation/CreateOperate_CubeTSpline.cpp
+++ b/Src/Operation/CreateOperate_CubeTSpline.cpp
@@ -22,11 +22,11 @@ namespace acamcad
AMCAX::TMS::TMSplineMakeCube cube(bb_min, bb_max, segX_, segY_, segZ_);
- adapter->tSpline->setTSpline(cube.BuildSpline());
+ adapter->tSpline->setShape(cube.BuildSpline());
//adapter->mesh->SetMesh(cube.BuildMesh());
adapter->updateDraw();
- return true;
+ return adapter->tSpline->getShape();
//AMCAX::Point3 bb_min, bb_max_;
//brep_object->SetShape(*AMCAX::SubD::MeshMakeCube(bb_min, bb_max, segX_, segY_, segZ_).BuildMesh());
}
diff --git a/Src/Operation/CreateOperate_CylinderTSpline.cpp b/Src/Operation/CreateOperate_CylinderTSpline.cpp
index 7845c6a5901af91baf47ee9a3940cde86422b2b4..3d988d5a9dd49e133027a052a4aa97bc5d9502c2 100644
--- a/Src/Operation/CreateOperate_CylinderTSpline.cpp
+++ b/Src/Operation/CreateOperate_CylinderTSpline.cpp
@@ -17,11 +17,11 @@ namespace acamcad
AMCAX::TMS::TMSplineMakeCylinder shape(frame, radius_, height_, top_, bottom_, rf_num_, vf_num_);
- object->tSpline->setTSpline(shape.BuildSpline());
+ object->tSpline->setShape(shape.BuildSpline());
object->updateDraw();
- return true;
+ return object->tSpline->getShape();
}
diff --git a/Src/Operation/CreateOperate_PlaneMesh.cpp b/Src/Operation/CreateOperate_PlaneMesh.cpp
index c451feeafe5800ad08ad6fc6991758a7b858dc03..575249b0fcbaa656efa0a8cc1a3f3ed9adbf9ac1 100644
--- a/Src/Operation/CreateOperate_PlaneMesh.cpp
+++ b/Src/Operation/CreateOperate_PlaneMesh.cpp
@@ -37,7 +37,7 @@ namespace acamcad
AMCAX::SubD::MeshMakeRectangle mesh(p0, p1, segU_, segV_);
- adapter->mesh->SetMesh(mesh.BuildMesh());
+ adapter->mesh->setShape(mesh.BuildMesh());
//brep_object->bRep->getShape() = AMCAX::MakeFace(AMCAX::Plane(), xmin, xmax, ymin, ymax);
//brep_object->bRep->updateDraw();
diff --git a/Src/Operation/CreateOperate_PlaneTSpline.cpp b/Src/Operation/CreateOperate_PlaneTSpline.cpp
index bc3f3ac5ef745d64e1ced00de1eae1ee798d5c77..26d624318258e06a1775dc1764521100068422c4 100644
--- a/Src/Operation/CreateOperate_PlaneTSpline.cpp
+++ b/Src/Operation/CreateOperate_PlaneTSpline.cpp
@@ -38,13 +38,13 @@ namespace acamcad
//AMCAX::SubD::MeshMakeRectangle mesh(p0, p1, segU_, segV_);
- adapter->tSpline->setTSpline(mesh.BuildSpline());
+ adapter->tSpline->setShape(mesh.BuildSpline());
//brep_object->bRep->getShape() = AMCAX::MakeFace(AMCAX::Plane(), xmin, xmax, ymin, ymax);
//brep_object->bRep->updateDraw();
adapter->updateDraw();
- return true;
+ return adapter->tSpline->getShape();
}
}
\ No newline at end of file
diff --git a/Src/Operation/CreateOperate_QuadballTSpline.cpp b/Src/Operation/CreateOperate_QuadballTSpline.cpp
index 64bfad15d2de0a5c4932a5b8e20cbf7195c1be0c..3d4bcdedc93eab7618229e1eb8b3f511ccee4011 100644
--- a/Src/Operation/CreateOperate_QuadballTSpline.cpp
+++ b/Src/Operation/CreateOperate_QuadballTSpline.cpp
@@ -15,10 +15,10 @@ namespace acamcad
AMCAX::TMS::TMSplineMakeQuadball qb(center_, radius_, seg_);
- object->tSpline->setTSpline(qb.BuildSpline());
+ object->tSpline->setShape(qb.BuildSpline());
object->tSpline->updateDraw();
- return true;
+ return object->tSpline->getShape();
}
}
\ No newline at end of file
diff --git a/Src/Operation/CreateOperate_SingleFaceMesh.cpp b/Src/Operation/CreateOperate_SingleFaceMesh.cpp
index 55df5e6522a270b7d294e704d65f8f24c047be64..47e9f57a661de33bbade7c04b122483ef73d712b 100644
--- a/Src/Operation/CreateOperate_SingleFaceMesh.cpp
+++ b/Src/Operation/CreateOperate_SingleFaceMesh.cpp
@@ -10,7 +10,7 @@ namespace acamcad
bool CreateOperate_SingleFaceMesh::DoOperate(AdapterObject* object)
{
- object->mesh->assignMesh();
+ object->mesh->assignShape();
std::vector pList;
for (auto& iter : point_list_)
@@ -18,7 +18,7 @@ namespace acamcad
pList.push_back(MPoint3(iter));
}
- AMCAX::SubD::MeshInsertFace::AddSingleFace(object->mesh->mesh(), pList);
+ AMCAX::SubD::MeshInsertFace::AddSingleFace(object->mesh->getShape(), pList);
object->updateDraw();
diff --git a/Src/Operation/CreateOperate_SingleFaceTSpline.cpp b/Src/Operation/CreateOperate_SingleFaceTSpline.cpp
index 5dabd82ae4488e1842ae0d23f13078da0078dae1..f28c8c0da7e95f880df655321857d72dc0c80bc8 100644
--- a/Src/Operation/CreateOperate_SingleFaceTSpline.cpp
+++ b/Src/Operation/CreateOperate_SingleFaceTSpline.cpp
@@ -12,7 +12,7 @@ namespace acamcad
bool CreateOperate_SingleFaceTSpline::DoOperate(AdapterObject* object)
{
- object->tSpline->assignTSpline();
+ object->tSpline->assignShape();
std::vector pList;
for (auto& iter : point_list_)
@@ -20,7 +20,7 @@ namespace acamcad
pList.push_back(MPoint3(iter));
}
- bool result = AMCAX::TMS::TMSplineAddFace().AddSingleFace(object->tSpline->getTSpline(), pList);
+ bool result = AMCAX::TMS::TMSplineAddFace().AddSingleFace(object->tSpline->getShape(), pList);
//AMCAX::SubD::MeshInsertFace::AddSingleFace(object->mesh->mesh(), pList);
diff --git a/Src/Operation/CreateOperate_Sphere.cpp b/Src/Operation/CreateOperate_Sphere.cpp
index ea661e0f0fb06794e1ed9891a3b7de21dcd102ac..c61f09a54b19a7ad4b0ae312f00c6ba3395e6ec7 100644
--- a/Src/Operation/CreateOperate_Sphere.cpp
+++ b/Src/Operation/CreateOperate_Sphere.cpp
@@ -29,8 +29,8 @@ namespace acamcad
{
}
- CreateOperate_Sphere::CreateOperate_Sphere(const AMCAX::Coord3& center, double radius, double angle1, double angle2, double angle3) :
- center_(center), radius_(radius), segR_(), segV_(), angle1_(angle1), angle2_(angle2), angle3_(angle3)
+ CreateOperate_Sphere::CreateOperate_Sphere(const AMCAX::Coord3& center, double radius, double angle1) :
+ center_(center), radius_(radius), segR_(), segV_(), angle1_(angle1)//, angle2_(angle2), angle3_(angle3)
{
}
diff --git a/Src/Operation/CreateOperate_Sphere.h b/Src/Operation/CreateOperate_Sphere.h
index 79272e17b357156f36df4a43cd718b2e3f50eab5..de3190b4be63aa95337ff967c46094a9224c2edf 100644
--- a/Src/Operation/CreateOperate_Sphere.h
+++ b/Src/Operation/CreateOperate_Sphere.h
@@ -26,7 +26,7 @@ namespace acamcad
public:
CreateOperate_Sphere();
CreateOperate_Sphere(const AMCAX::Coord3& center, double radius, size_t rotation_seg, size_t vertical_seg);
- CreateOperate_Sphere(const AMCAX::Coord3& center, double radius, double angle1, double angle2, double angle3);
+ CreateOperate_Sphere(const AMCAX::Coord3& center, double radius, double angle1);
virtual ~CreateOperate_Sphere();
@@ -40,7 +40,7 @@ namespace acamcad
double radius_;
size_t segR_, segV_;
- double angle1_, angle2_, angle3_;
+ double angle1_;// , angle2_, angle3_;
};
}
diff --git a/Src/Operation/CreateOperate_SphereTSpline.cpp b/Src/Operation/CreateOperate_SphereTSpline.cpp
index e3385957346ef7419f732fc0d760e7ba7ef03e43..92d266f804af5bcde80f5adbb132ba430d9b14d3 100644
--- a/Src/Operation/CreateOperate_SphereTSpline.cpp
+++ b/Src/Operation/CreateOperate_SphereTSpline.cpp
@@ -29,17 +29,19 @@ namespace acamcad
{
//brep_object->bRep->getShape() = AMCAX::MakeSphere(AMCAX::Point3(center_[0], center_[1], center_[2]), radius_, angle1_);
//brep_object->updateDraw();
- AMCAX::TMS::TMSplineMakeSphere sphre(radius_, segR_, segV_);
+ AMCAX::Frame3 frame(AMCAX::Point3(center_), AMCAX::Direction3(0.0, 0.0, 1.0));
- adapter->tSpline->setTSpline(sphre.BuildSpline());
+ AMCAX::TMS::TMSplineMakeSphere sphre(frame, radius_, segR_, segV_);
- adapter->mesh_OPvert_Backup();
- adapter->meshMove(center_, AMCAX::Point3(center_).Distance(AMCAX::Point3(0.0, 0.0, 0.0)));
- adapter->mesh_Clear_OPvertBackup();
+ adapter->tSpline->setShape(sphre.BuildSpline());
+
+ //adapter->mesh_OPvert_Backup();
+ //adapter->meshMove(center_, AMCAX::Point3(center_).Distance(AMCAX::Point3(0.0, 0.0, 0.0)));
+ //adapter->mesh_Clear_OPvertBackup();
adapter->updateDraw();
- return true;
+ return adapter->tSpline->getShape();
}
diff --git a/Src/Operation/CreateOperate_TorusTSpline.cpp b/Src/Operation/CreateOperate_TorusTSpline.cpp
index eb5e6cfc15852cec09dc15b7b596f3e1835a6924..1d6c1786913b0aaa0345ebe04a3952c856c9d7ef 100644
--- a/Src/Operation/CreateOperate_TorusTSpline.cpp
+++ b/Src/Operation/CreateOperate_TorusTSpline.cpp
@@ -19,10 +19,10 @@ namespace acamcad
AMCAX::Frame3 frame(p, dir);
AMCAX::TMS::TMSplineMakeTorus torus(frame, radiusMajor_, radiusMinor_, segMajor_, segMinor_);
- object->tSpline->setTSpline(torus.BuildSpline());
+ object->tSpline->setShape(torus.BuildSpline());
object->tSpline->updateDraw();
- return true;
+ return object->tSpline->getShape();
}
}
\ No newline at end of file
diff --git a/Src/Operation/MOperate_getDirection.cpp b/Src/Operation/MOperate_getDirection.cpp
index fb045551fbc38a8a93b1c6788f3bf1dfaae845ff..084273feef23421a5ff9539065d93793258d2974 100644
--- a/Src/Operation/MOperate_getDirection.cpp
+++ b/Src/Operation/MOperate_getDirection.cpp
@@ -67,9 +67,9 @@ namespace acamcad
case acamcad::DataType::MESH_TYPE:
{
int id0, id1;
- AMCAX::SubD::MeshTool::EdgeVertexIndexs(adapter->mesh->mesh(), s_id, id0, id1);
- AMCAX::Point3 p0 = AMCAX::SubD::MeshTool::Position(adapter->mesh->mesh(), id0),
- p1 = AMCAX::SubD::MeshTool::Position(adapter->mesh->mesh(), id1);
+ AMCAX::SubD::MeshTool::EdgeVertexIndexs(adapter->mesh->getShape(), s_id, id0, id1);
+ AMCAX::Point3 p0 = AMCAX::SubD::MeshTool::Position(adapter->mesh->getShape(), id0),
+ p1 = AMCAX::SubD::MeshTool::Position(adapter->mesh->getShape(), id1);
direction_ = (p1.Coord() - p0.Coord()).Normalized();
}
@@ -101,7 +101,7 @@ namespace acamcad
break;
case acamcad::DataType::MESH_TYPE:
{
- direction_ = AMCAX::SubD::MeshTool::FaceNormal(adapter->mesh->mesh(), s_id).Coord().Normalized();
+ direction_ = AMCAX::SubD::MeshTool::FaceNormal(adapter->mesh->getShape(), s_id).Coord().Normalized();
}
break;
default:
diff --git a/Src/Operation/MultOperate_Combine.cpp b/Src/Operation/MultOperate_Combine.cpp
index 1986211150903ac65f60ac14a445438344b6cd62..28a8661c3f7e6032e0e702e436bdd33f2ad216ae 100644
--- a/Src/Operation/MultOperate_Combine.cpp
+++ b/Src/Operation/MultOperate_Combine.cpp
@@ -58,11 +58,11 @@ acamcad::BaseObject* acamcad::MultOperate_Combine::operate()
{
AdapterObject* adapter_object = new AdapterObject;
adapter_object->setDataType(acamcad::DataType::MESH_TYPE);
- adapter_object->mesh->assignMesh();
+ adapter_object->mesh->assignShape();
for (int i = 0; i < objectList_.size(); i++) {
AdapterObject* bobj = objectList_[i];
- AMCAX::SubD::MeshCopy::CombineMesh(adapter_object->mesh->mesh(), bobj->mesh->mesh());
+ AMCAX::SubD::MeshCopy::CombineMesh(adapter_object->mesh->getShape(), bobj->mesh->getShape());
}
adapter_object->updateDraw();
return adapter_object;
@@ -72,11 +72,11 @@ acamcad::BaseObject* acamcad::MultOperate_Combine::operate()
{
AdapterObject* adapter_object = new AdapterObject;
adapter_object->setDataType(acamcad::DataType::TSPLINEU_TYPE);
- adapter_object->tSpline->assignTSpline();
+ adapter_object->tSpline->assignShape();
for (int i = 0; i < objectList_.size(); i++) {
- AMCAX::TMS::TMSplineCopy().AppendToTMSpline(adapter_object->tSpline->getTSpline(),
- objectList_[i]->tSpline->getTSpline());
+ AMCAX::TMS::TMSplineCopy().AppendToTMSpline(adapter_object->tSpline->getShape(),
+ objectList_[i]->tSpline->getShape());
}
adapter_object->updateDraw();
return adapter_object;
diff --git a/Src/Operation/SGLOperate_Bridge.cpp b/Src/Operation/SGLOperate_Bridge.cpp
index 0c351aa2bfffd161d7193060213f5ebe46778b09..7283f2dd6bf8d454258e3056cc2953958dd3afcb 100644
--- a/Src/Operation/SGLOperate_Bridge.cpp
+++ b/Src/Operation/SGLOperate_Bridge.cpp
@@ -29,7 +29,7 @@ bool SGLOperate_Bridge::DoOperate(AdapterObject* adapter)
{
std::vector s_id_list = getSelectSubList(s_info_list_);
- result = AMCAX::SubD::MeshInsertFace::AddFaceByEdge(adapter->mesh->mesh(), s_id_list[0], s_id_list[1]);
+ result = AMCAX::SubD::MeshInsertFace::AddFaceByEdge(adapter->mesh->getShape(), s_id_list[0], s_id_list[1]);
}
break;
case DataType::TSPLINEU_TYPE:
@@ -38,10 +38,10 @@ bool SGLOperate_Bridge::DoOperate(AdapterObject* adapter)
AMCAX::TMS::TMSplineBridgeEdge tool;
- result = tool.CanBridgeEdge(adapter->tSpline->getTSpline(), s_id_list[0], s_id_list[1]);
+ result = tool.CanBridgeEdge(adapter->tSpline->getShape(), s_id_list[0], s_id_list[1]);
if (result) {
- tool.BridgeEdge(adapter->tSpline->getTSpline(), s_id_list[0], s_id_list[1]);
+ tool.BridgeEdge(adapter->tSpline->getShape(), s_id_list[0], s_id_list[1]);
adapter->updateDraw();
}
}
diff --git a/Src/Operation/SGLOperate_ChamferEdge.cpp b/Src/Operation/SGLOperate_ChamferEdge.cpp
index bf6c18b3604655945640152820888bdae99c3790..4ffc1a6d719f9485660a830cdc044c4e882074e6 100644
--- a/Src/Operation/SGLOperate_ChamferEdge.cpp
+++ b/Src/Operation/SGLOperate_ChamferEdge.cpp
@@ -59,10 +59,10 @@ bool acamcad::SGLOperate_ChamferEdge::DoOperate(AdapterObject* brep_object)
{
AMCAX::TMS::TMSplineSampleChamfer tool(0.1);
- result = tool.CanEdgesSampleChamfer(brep_object->tSpline->getTSpline(), s_id_list);
+ result = tool.CanEdgesSampleChamfer(brep_object->tSpline->getShape(), s_id_list);
if (result) {
- tool.SampleChamfer(brep_object->tSpline->getTSpline(), s_id_list);
+ tool.SampleChamfer(brep_object->tSpline->getShape(), s_id_list);
brep_object->updateDraw();
}
}
diff --git a/Src/Operation/SGLOperate_Crease.cpp b/Src/Operation/SGLOperate_Crease.cpp
index 8dc7584355dddd5cc4fe21a1f5b772cecbd34180..f901e2e79c2432ad542057f7b6c5b8a94b655916 100644
--- a/Src/Operation/SGLOperate_Crease.cpp
+++ b/Src/Operation/SGLOperate_Crease.cpp
@@ -17,7 +17,7 @@ namespace acamcad
std::vector s_id_list = getSelectSubList(s_info_list_);
- AMCAX::TMS::TMSplineCreaseTool::AddCreaseEdge(object->tSpline->getTSpline(), s_id_list);
+ AMCAX::TMS::TMSplineCreaseTool::AddCreaseEdge(object->tSpline->getShape(), s_id_list);
object->updateDraw();
diff --git a/Src/Operation/SGLOperate_CreaseRemove.cpp b/Src/Operation/SGLOperate_CreaseRemove.cpp
index 347968b5ab4f30c10e1dd238219572ee198fc58f..4393f9cd4e0f0c7d5fdf54f6076da24cd25ea648 100644
--- a/Src/Operation/SGLOperate_CreaseRemove.cpp
+++ b/Src/Operation/SGLOperate_CreaseRemove.cpp
@@ -16,7 +16,7 @@ namespace acamcad
std::vector s_id_list = getSelectSubList(s_info_list_);
- AMCAX::TMS::TMSplineCreaseTool::RemoveCreaseEdge(object->tSpline->getTSpline(), s_id_list);
+ AMCAX::TMS::TMSplineCreaseTool::RemoveCreaseEdge(object->tSpline->getShape(), s_id_list);
object->updateDraw();
diff --git a/Src/Operation/SGLOperate_DeleteElement.cpp b/Src/Operation/SGLOperate_DeleteElement.cpp
index 6c76ff22387e98c66f356cb3edc13e2707a7a878..c48852c7827198a012aa4b32b5b190be79eca548 100644
--- a/Src/Operation/SGLOperate_DeleteElement.cpp
+++ b/Src/Operation/SGLOperate_DeleteElement.cpp
@@ -29,7 +29,7 @@ bool SGLOperate_Delete::DoOperate(AdapterObject* adapter)
}
std::vector s_id_list = getSelectSubList(s_info_list_);
result = true;
- AMCAX::SubD::MeshReduce::DeleteFaces(adapter->mesh->mesh(), s_id_list);
+ AMCAX::SubD::MeshReduce::DeleteFaces(adapter->mesh->getShape(), s_id_list);
}
break;
case DataType::TSPLINEU_TYPE:
@@ -45,10 +45,10 @@ bool SGLOperate_Delete::DoOperate(AdapterObject* adapter)
AMCAX::TMS::TMSplineReduce reduce;
- result = reduce.CanRemoveVertices(adapter->tSpline->getTSpline(), s_id_list);
+ result = reduce.CanRemoveVertices(adapter->tSpline->getShape(), s_id_list);
if (result) {
- reduce.RemoveEdges(adapter->tSpline->getTSpline(), s_id_list);
+ reduce.RemoveEdges(adapter->tSpline->getShape(), s_id_list);
}
}
break;
@@ -60,10 +60,10 @@ bool SGLOperate_Delete::DoOperate(AdapterObject* adapter)
AMCAX::TMS::TMSplineReduce reduce;
- result = reduce.CanRemoveEdges(adapter->tSpline->getTSpline(), s_id_list);
+ result = reduce.CanRemoveEdges(adapter->tSpline->getShape(), s_id_list);
if (result) {
- reduce.RemoveEdges(adapter->tSpline->getTSpline(), s_id_list);
+ reduce.RemoveEdges(adapter->tSpline->getShape(), s_id_list);
}
}
break;
@@ -75,10 +75,10 @@ bool SGLOperate_Delete::DoOperate(AdapterObject* adapter)
AMCAX::TMS::TMSplineReduce reduce;
- result = reduce.CanDeleteFaces(adapter->tSpline->getTSpline(), s_id_list);
+ result = reduce.CanDeleteFaces(adapter->tSpline->getShape(), s_id_list);
if (result) {
- reduce.DeleteFaces(adapter->tSpline->getTSpline(), s_id_list);
+ reduce.DeleteFaces(adapter->tSpline->getShape(), s_id_list);
}
}
break;
diff --git a/Src/Operation/SGLOperate_EmbedFace.cpp b/Src/Operation/SGLOperate_EmbedFace.cpp
index 1d91c561b1530b185a290447168a9e09f828704d..27e20f48bda23092e06807241148654bf4d8fcb3 100644
--- a/Src/Operation/SGLOperate_EmbedFace.cpp
+++ b/Src/Operation/SGLOperate_EmbedFace.cpp
@@ -28,7 +28,7 @@ namespace acamcad
//result = true;
std::vector s_id_list = getSelectSubList(s_info_list_);
- result = AMCAX::SubD::MeshInsertFace::EmbedSingleFace(adapter->mesh->mesh(), s_id_list) != nullptr;
+ result = AMCAX::SubD::MeshInsertFace::EmbedSingleFace(adapter->mesh->getShape(), s_id_list) != nullptr;
adapter->updateDraw();
}
else if (selmodel_ == SelectModel::EDGE_MODEL)
@@ -40,7 +40,7 @@ namespace acamcad
//polymesh::MEdge* e1 = mesh_object->mesh()->edge(s_id_list[1]);
//polymesh::addFaceByEdge(mesh_object->mesh(), e0, e1);
- result = AMCAX::SubD::MeshInsertFace::AddFaceByEdge(adapter->mesh->mesh(), s_id_list[0], s_id_list[1]) != nullptr;
+ result = AMCAX::SubD::MeshInsertFace::AddFaceByEdge(adapter->mesh->getShape(), s_id_list[0], s_id_list[1]) != nullptr;
adapter->updateDraw();
@@ -61,7 +61,7 @@ namespace acamcad
for (int i = 0; i < s_id_list.size(); i++)
{
AMCAX::Point3 point =
- AMCAX::TMS::TMSplineTool::ControlPosition(adapter->tSpline->getTSpline(), s_id_list[i]);
+ AMCAX::TMS::TMSplineTool::ControlPosition(adapter->tSpline->getShape(), s_id_list[i]);
points.push_back(point);
}
@@ -69,10 +69,10 @@ namespace acamcad
AMCAX::TMS::TMSplineAddFace tool;
- result = tool.CanAddSingleFace(adapter->tSpline->getTSpline(), points);
+ result = tool.CanAddSingleFace(adapter->tSpline->getShape(), points);
if (result) {
- tool.AddSingleFace(adapter->tSpline->getTSpline(), points);
+ tool.AddSingleFace(adapter->tSpline->getShape(), points);
adapter->updateDraw();
}
@@ -93,10 +93,10 @@ namespace acamcad
AMCAX::TMS::TMSplineAddFace tool;
- result = tool.CanAddFaceByEdge(adapter->tSpline->getTSpline(), s_id_list[0], s_id_list[1]);
+ result = tool.CanAddFaceByEdge(adapter->tSpline->getShape(), s_id_list[0], s_id_list[1]);
if (result) {
- tool.AddFaceByEdge(adapter->tSpline->getTSpline(), s_id_list[0], s_id_list[1]);
+ tool.AddFaceByEdge(adapter->tSpline->getShape(), s_id_list[0], s_id_list[1]);
adapter->updateDraw();
}
}
diff --git a/Src/Operation/SGLOperate_ExtrudeEdge.cpp b/Src/Operation/SGLOperate_ExtrudeEdge.cpp
index d84dde42d02dbc0d8624634d6ae4d2fcc4d0f58f..212ac17c9705525310c00f9a609af4ce01582e25 100644
--- a/Src/Operation/SGLOperate_ExtrudeEdge.cpp
+++ b/Src/Operation/SGLOperate_ExtrudeEdge.cpp
@@ -32,15 +32,15 @@ bool acamcad::SGLOperate_ExtrudeEdgeH::DoOperate(AdapterObject* adapter)
for (int i = 0; i < s_id_list.size(); i++)
{
- std::vector faces = AMCAX::SubD::MeshTool::EdgeFaceIndexs(adapter->mesh->mesh(),
+ std::vector faces = AMCAX::SubD::MeshTool::EdgeFaceIndexs(adapter->mesh->getShape(),
s_id_list[i]);
- AMCAX::Vector3 nor = AMCAX::SubD::MeshTool::FaceNormal(adapter->mesh->mesh(), faces[0]);
+ AMCAX::Vector3 nor = AMCAX::SubD::MeshTool::FaceNormal(adapter->mesh->getShape(), faces[0]);
int p0, p1;
- AMCAX::SubD::MeshTool::EdgeVertexIndexs(adapter->mesh->mesh(), s_id_list[i], p0, p1);
- AMCAX::Point3 position0 = AMCAX::SubD::MeshTool::Position(adapter->mesh->mesh(), p0),
- position1 = AMCAX::SubD::MeshTool::Position(adapter->mesh->mesh(), p1);
+ AMCAX::SubD::MeshTool::EdgeVertexIndexs(adapter->mesh->getShape(), s_id_list[i], p0, p1);
+ AMCAX::Point3 position0 = AMCAX::SubD::MeshTool::Position(adapter->mesh->getShape(), p0),
+ position1 = AMCAX::SubD::MeshTool::Position(adapter->mesh->getShape(), p1);
AMCAX::Vector3 ve = AMCAX::Vector3(position1.Coord() - position0.Coord());
@@ -50,7 +50,7 @@ bool acamcad::SGLOperate_ExtrudeEdgeH::DoOperate(AdapterObject* adapter)
dire_.Normalize();
- result = AMCAX::SubD::MeshExtrude::ExtrudeEdge(adapter->mesh->mesh(),
+ result = AMCAX::SubD::MeshExtrude::ExtrudeEdge(adapter->mesh->getShape(),
s_id_list, s_id_list_new);
if (result)
@@ -68,19 +68,19 @@ bool acamcad::SGLOperate_ExtrudeEdgeH::DoOperate(AdapterObject* adapter)
{
for (int i = 0; i < s_id_list.size(); i++)
{
- std::vector faces = AMCAX::TMS::TMSplineTool::EdgeFaceIndexs(adapter->tSpline->getTSpline(),
+ std::vector faces = AMCAX::TMS::TMSplineTool::EdgeFaceIndexs(adapter->tSpline->getShape(),
s_id_list[i]);
//AMCAX::TMS::TMSplineTool::ControlFaceNormal(adapter->tSpline->getTSpline(), faces[0]);
- AMCAX::Vector3 nor = AMCAX::TMS::TMSplineTool::ControlFaceNormal(adapter->tSpline->getTSpline(), faces[0]);
+ AMCAX::Vector3 nor = AMCAX::TMS::TMSplineTool::ControlFaceNormal(adapter->tSpline->getShape(), faces[0]);
//EdgeFaceIndexs
int p0, p1;
- AMCAX::TMS::TMSplineTool::EdgeVertexIndexs(adapter->tSpline->getTSpline(), s_id_list[i], p0, p1);
- AMCAX::Point3 position0 = AMCAX::TMS::TMSplineTool::ControlPosition(adapter->tSpline->getTSpline(), p0),
- position1 = AMCAX::TMS::TMSplineTool::ControlPosition(adapter->tSpline->getTSpline(), p1);
+ AMCAX::TMS::TMSplineTool::EdgeVertexIndexs(adapter->tSpline->getShape(), s_id_list[i], p0, p1);
+ AMCAX::Point3 position0 = AMCAX::TMS::TMSplineTool::ControlPosition(adapter->tSpline->getShape(), p0),
+ position1 = AMCAX::TMS::TMSplineTool::ControlPosition(adapter->tSpline->getShape(), p1);
AMCAX::Vector3 ve = AMCAX::Vector3(position1.Coord() - position0.Coord());
@@ -91,11 +91,11 @@ bool acamcad::SGLOperate_ExtrudeEdgeH::DoOperate(AdapterObject* adapter)
AMCAX::TMS::TMSplineExtrude tool;
- result = tool.CanExtrudeEdges(adapter->tSpline->getTSpline(), s_id_list);
+ result = tool.CanExtrudeEdges(adapter->tSpline->getShape(), s_id_list);
if (result)
{
- tool.ExtrudeEdges(adapter->tSpline->getTSpline(), s_id_list, s_id_list_new);
+ tool.ExtrudeEdges(adapter->tSpline->getShape(), s_id_list, s_id_list_new);
s_info_list_.resize(s_id_list_new.size());
for (int i = 0; i < s_id_list_new.size(); i++)
@@ -145,17 +145,17 @@ bool acamcad::SGLOperate_ExtrudeEdgeV::DoOperate(AdapterObject* adapter)
{
for (int i = 0; i < s_id_list.size(); i++)
{
- std::vector faces = AMCAX::SubD::MeshTool::EdgeFaceIndexs(adapter->mesh->mesh(),
+ std::vector faces = AMCAX::SubD::MeshTool::EdgeFaceIndexs(adapter->mesh->getShape(),
s_id_list[i]);
- AMCAX::Vector3 nor = AMCAX::SubD::MeshTool::FaceNormal(adapter->mesh->mesh(), faces[0]);
+ AMCAX::Vector3 nor = AMCAX::SubD::MeshTool::FaceNormal(adapter->mesh->getShape(), faces[0]);
dire_ += nor.Coord();
}
dire_.Normalize();
- result = AMCAX::SubD::MeshExtrude::ExtrudeEdge(adapter->mesh->mesh(),
+ result = AMCAX::SubD::MeshExtrude::ExtrudeEdge(adapter->mesh->getShape(),
s_id_list, s_id_list_new);
@@ -175,12 +175,12 @@ bool acamcad::SGLOperate_ExtrudeEdgeV::DoOperate(AdapterObject* adapter)
for (int i = 0; i < s_id_list.size(); i++)
{
- std::vector faces = AMCAX::TMS::TMSplineTool::EdgeFaceIndexs(adapter->tSpline->getTSpline(),
+ std::vector faces = AMCAX::TMS::TMSplineTool::EdgeFaceIndexs(adapter->tSpline->getShape(),
s_id_list[i]);
//AMCAX::TMS::TMSplineTool::ControlFaceNormal(adapter->tSpline->getTSpline(), faces[0]);
- AMCAX::Vector3 nor = AMCAX::TMS::TMSplineTool::ControlFaceNormal(adapter->tSpline->getTSpline(), faces[0]);
+ AMCAX::Vector3 nor = AMCAX::TMS::TMSplineTool::ControlFaceNormal(adapter->tSpline->getShape(), faces[0]);
dire_ += nor.Coord();
}
@@ -188,11 +188,11 @@ bool acamcad::SGLOperate_ExtrudeEdgeV::DoOperate(AdapterObject* adapter)
dire_.Normalize();
AMCAX::TMS::TMSplineExtrude tool;
- result = tool.CanExtrudeEdges(adapter->tSpline->getTSpline(), s_id_list);
+ result = tool.CanExtrudeEdges(adapter->tSpline->getShape(), s_id_list);
if (result)
{
- tool.ExtrudeEdges(adapter->tSpline->getTSpline(), s_id_list, s_id_list_new);
+ tool.ExtrudeEdges(adapter->tSpline->getShape(), s_id_list, s_id_list_new);
s_info_list_.resize(s_id_list_new.size());
for (int i = 0; i < s_id_list_new.size(); i++)
diff --git a/Src/Operation/SGLOperate_ExtrudeFace.cpp b/Src/Operation/SGLOperate_ExtrudeFace.cpp
index c42465dc696642e8fa5288ec8e7a99d263c59a78..6d01d37d914bee3772799da84cf0b9b7539c4fcf 100644
--- a/Src/Operation/SGLOperate_ExtrudeFace.cpp
+++ b/Src/Operation/SGLOperate_ExtrudeFace.cpp
@@ -36,14 +36,14 @@ bool SGLOperate_ExtrudeFace::DoOperate(AdapterObject* object)
//std::vector faces = AMCAX::SubD::MeshTool::EdgeFaceIndexs(object->mesh->mesh(),
// s_id_list[i]);
- AMCAX::Vector3 nor = AMCAX::SubD::MeshTool::FaceNormal(object->mesh->mesh(), s_id_list[i]);
+ AMCAX::Vector3 nor = AMCAX::SubD::MeshTool::FaceNormal(object->mesh->getShape(), s_id_list[i]);
dire_ += nor.Coord();
}
dire_.Normalize();
- result = AMCAX::SubD::MeshExtrude::ExtrudeFace(object->mesh->mesh(),
+ result = AMCAX::SubD::MeshExtrude::ExtrudeFace(object->mesh->getShape(),
s_id_list, s_id_list_new);
@@ -68,7 +68,7 @@ bool SGLOperate_ExtrudeFace::DoOperate(AdapterObject* object)
//AMCAX::TMS::TMSplineTool::ControlFaceNormal(adapter->tSpline->getTSpline(), faces[0]);
- AMCAX::Vector3 nor = AMCAX::TMS::TMSplineTool::ControlFaceNormal(object->tSpline->getTSpline(), s_id_list[i]);
+ AMCAX::Vector3 nor = AMCAX::TMS::TMSplineTool::ControlFaceNormal(object->tSpline->getShape(), s_id_list[i]);
dire_ += nor.Coord();
}
@@ -76,11 +76,11 @@ bool SGLOperate_ExtrudeFace::DoOperate(AdapterObject* object)
dire_.Normalize();
AMCAX::TMS::TMSplineExtrude tool;
- result = tool.CanExtrudeFaces(object->tSpline->getTSpline(), s_id_list);
+ result = tool.CanExtrudeFaces(object->tSpline->getShape(), s_id_list);
if (result)
{
- tool.ExtrudeFaces(object->tSpline->getTSpline(), s_id_list, s_id_list_new);
+ tool.ExtrudeFaces(object->tSpline->getShape(), s_id_list, s_id_list_new);
s_info_list_.resize(s_id_list_new.size());
for (int i = 0; i < s_id_list_new.size(); i++)
diff --git a/Src/Operation/SGLOperate_FillHole.cpp b/Src/Operation/SGLOperate_FillHole.cpp
index e03114c3b1c106df6ba47061a3500d0ba2eb92d9..6425b547266821964905c3d682d0a6fb99c55681 100644
--- a/Src/Operation/SGLOperate_FillHole.cpp
+++ b/Src/Operation/SGLOperate_FillHole.cpp
@@ -25,11 +25,11 @@ namespace acamcad
break;
AMCAX::TMS::TMSplineFillHole tool;
- result = tool.CanFillSingleHole(adapter->tSpline->getTSpline(), ids[0]);
+ result = tool.CanFillSingleHole(adapter->tSpline->getShape(), ids[0]);
if (result)
{
- tool.FillSingleHole(adapter->tSpline->getTSpline(), ids[0]);
+ tool.FillSingleHole(adapter->tSpline->getShape(), ids[0]);
adapter->updateDraw();
}
@@ -37,7 +37,7 @@ namespace acamcad
break;
case acamcad::SelectModel::OBJECT_MODEL:
{
- result = AMCAX::TMS::TMSplineFillHole().FillAllHoles(adapter->tSpline->getTSpline());
+ result = AMCAX::TMS::TMSplineFillHole().FillAllHoles(adapter->tSpline->getShape());
adapter->updateDraw();
}
diff --git a/Src/Operation/SGLOperate_Repair.cpp b/Src/Operation/SGLOperate_Repair.cpp
index f502a042e0421d261f16897f9b4dfc546f06e0f8..46c7896b55d1b4bb2647506dd1b0440415cf1b95 100644
--- a/Src/Operation/SGLOperate_Repair.cpp
+++ b/Src/Operation/SGLOperate_Repair.cpp
@@ -15,7 +15,7 @@ namespace acamcad
adapter->dataType() != DataType::TSPLINEU_TYPE)
return false;
- return AMCAX::TMS::TMSplineRepair().RepairTSpline(adapter->tSpline->getTSpline());
+ return AMCAX::TMS::TMSplineRepair().RepairTSpline(adapter->tSpline->getShape());
}
}
diff --git a/Src/Operation/SGLOperate_ReverseNormal.cpp b/Src/Operation/SGLOperate_ReverseNormal.cpp
index 9bd2f4d1c325d2c2cffed5ac063181912fe5fed2..6ac612fa466a23f31b2cc82406e66368e94cd468 100644
--- a/Src/Operation/SGLOperate_ReverseNormal.cpp
+++ b/Src/Operation/SGLOperate_ReverseNormal.cpp
@@ -20,13 +20,13 @@ bool acamcad::SGLOperate_ReverseNormal::DoOperate(AdapterObject* adapter)
case DataType::MESH_TYPE:
{
result = true;
- AMCAX::SubD::MeshTool::ReverseMeshNormal(adapter->mesh->mesh());
+ AMCAX::SubD::MeshTool::ReverseMeshNormal(adapter->mesh->getShape());
}
break;
case DataType::TSPLINEU_TYPE:
{
result = true;
- AMCAX::TMS::TMSplineTool::ReverseTMSNormal(adapter->tSpline->getTSpline());
+ AMCAX::TMS::TMSplineTool::ReverseTMSNormal(adapter->tSpline->getShape());
}
break;
default:
diff --git a/Src/Operation/SGLOperate_Separate.cpp b/Src/Operation/SGLOperate_Separate.cpp
index 9c66507cdc6c919dcee7fd4d27818d9c12a09a9e..7ac0196828eff23cd030b78071fc7839b329dbd2 100644
--- a/Src/Operation/SGLOperate_Separate.cpp
+++ b/Src/Operation/SGLOperate_Separate.cpp
@@ -26,7 +26,7 @@ bool SGLOperate_Separate::DoOperate(AdapterObject* adapter)
std::vector s_id_list = getSelectSubList(s_info_list_);
//polymesh::meshSeparateEdges(mesh_object->mesh(), s_id_list);
- result = AMCAX::SubD::MeshSeparate::SeparateEdges(adapter->mesh->mesh(), s_id_list);
+ result = AMCAX::SubD::MeshSeparate::SeparateEdges(adapter->mesh->getShape(), s_id_list);
}
break;
case DataType::TSPLINEU_TYPE:
@@ -34,7 +34,7 @@ bool SGLOperate_Separate::DoOperate(AdapterObject* adapter)
std::vector s_id_list = getSelectSubList(s_info_list_);
//result = true;
- result = AMCAX::TMS::TMSplineSeparate().SeparateEdges(adapter->tSpline->getTSpline(), s_id_list);
+ result = AMCAX::TMS::TMSplineSeparate().SeparateEdges(adapter->tSpline->getShape(), s_id_list);
}
break;
diff --git a/Src/Operation/SGLOperate_SplitFace.cpp b/Src/Operation/SGLOperate_SplitFace.cpp
index 7db8c83de9f64c810747fc040ce4b02506f5d3a0..b660472ea5c9df1bc4f10c489acf886fee4671e4 100644
--- a/Src/Operation/SGLOperate_SplitFace.cpp
+++ b/Src/Operation/SGLOperate_SplitFace.cpp
@@ -17,10 +17,10 @@ namespace acamcad
AMCAX::TMS::TMSplineSplit tool;
- bool result = tool.CanSplitFacesCross(adapter->tSpline->getTSpline(), ids);
+ bool result = tool.CanSplitFacesCross(adapter->tSpline->getShape(), ids);
if (result) {
- tool.SplitFacesCross(adapter->tSpline->getTSpline(), ids);
+ tool.SplitFacesCross(adapter->tSpline->getShape(), ids);
adapter->updateDraw();
}
diff --git a/Src/Operation/SGLOperate_SplitFaceByEdge.cpp b/Src/Operation/SGLOperate_SplitFaceByEdge.cpp
index 4080dcb5bdab099723f9e6151bcc77f10e4a0e3d..f2be7886e2329123bde057cbcc768c10c1b80edd 100644
--- a/Src/Operation/SGLOperate_SplitFaceByEdge.cpp
+++ b/Src/Operation/SGLOperate_SplitFaceByEdge.cpp
@@ -50,7 +50,7 @@ bool acamcad::SGLOperate_SplitFaceByEdge::DoOperate(AdapterObject* adapter)
edge_t.push_back(AMCAX::Point3(re_points_[i]));
}
- result = AMCAX::SubD::MeshSplit::SplitFaceWithEdge(adapter->mesh->mesh(), edge_id, edge_t);
+ result = AMCAX::SubD::MeshSplit::SplitFaceWithEdge(adapter->mesh->getShape(), edge_id, edge_t);
}
break;
case DataType::TSPLINEU_TYPE:
@@ -63,10 +63,10 @@ bool acamcad::SGLOperate_SplitFaceByEdge::DoOperate(AdapterObject* adapter)
}
AMCAX::TMS::TMSplineSplit tool;
- result = tool.CanSplitFaceWithEdge(adapter->tSpline->getTSpline(), edge_id, edge_t);
+ result = tool.CanSplitFaceWithEdge(adapter->tSpline->getShape(), edge_id, edge_t);
if (result) {
- tool.SplitFaceWithEdge(adapter->tSpline->getTSpline(), edge_id, edge_t);
+ tool.SplitFaceWithEdge(adapter->tSpline->getShape(), edge_id, edge_t);
adapter->updateDraw();
}
diff --git a/Src/Operation/SGLOperate_SplitFaceVertex.cpp b/Src/Operation/SGLOperate_SplitFaceVertex.cpp
index 2b5c9f7b0b32ce6d34d9a0180152dd7676b75304..440519770fa09af4414375a10acf53a1c10aa336 100644
--- a/Src/Operation/SGLOperate_SplitFaceVertex.cpp
+++ b/Src/Operation/SGLOperate_SplitFaceVertex.cpp
@@ -34,7 +34,7 @@ namespace acamcad
{
std::vector edges = getSelectSubList(s_info_list_);
- result = AMCAX::SubD::MeshSplit::SplitFaceWithVertex(adapter->mesh->mesh(), edges);
+ result = AMCAX::SubD::MeshSplit::SplitFaceWithVertex(adapter->mesh->getShape(), edges);
}
break;
case DataType::TSPLINEU_TYPE:
@@ -43,10 +43,10 @@ namespace acamcad
AMCAX::TMS::TMSplineSplit tool;
- result = tool.CanSplitFaceWithVertex(adapter->tSpline->getTSpline(), edges);
+ result = tool.CanSplitFaceWithVertex(adapter->tSpline->getShape(), edges);
if (result) {
- tool.SplitFaceWithVertex(adapter->tSpline->getTSpline(), edges);
+ tool.SplitFaceWithVertex(adapter->tSpline->getShape(), edges);
adapter->updateDraw();
}
}
diff --git a/Src/Operation/SGLOperate_SplitLoop.cpp b/Src/Operation/SGLOperate_SplitLoop.cpp
index 4d084f02da0d8643ddca768879f96e3e6e9e8f0f..94bdda3cb908d86452b2f5ac89906d766b7cbc18 100644
--- a/Src/Operation/SGLOperate_SplitLoop.cpp
+++ b/Src/Operation/SGLOperate_SplitLoop.cpp
@@ -26,31 +26,31 @@ bool acamcad::SGLOperate_SplitLoop::DoOperate(AdapterObject* adapter)
case DataType::MESH_TYPE:
{
int p0, p1;
- AMCAX::SubD::MeshTool::EdgeVertexIndexs(adapter->mesh->mesh(), s_info_list_[0].object_subselect_id_, p0, p1);
+ AMCAX::SubD::MeshTool::EdgeVertexIndexs(adapter->mesh->getShape(), s_info_list_[0].object_subselect_id_, p0, p1);
- AMCAX::Point3 point0 = AMCAX::SubD::MeshTool::Position(adapter->mesh->mesh(), p0),
- point1 = AMCAX::SubD::MeshTool::Position(adapter->mesh->mesh(), p1),
+ AMCAX::Point3 point0 = AMCAX::SubD::MeshTool::Position(adapter->mesh->getShape(), p0),
+ point1 = AMCAX::SubD::MeshTool::Position(adapter->mesh->getShape(), p1),
pointT(re_points_[0]);
double t = point0.Distance(pointT) / point0.Distance(point1);
- result = AMCAX::SubD::MeshSplit::SplitLoop(adapter->mesh->mesh(), s_info_list_[0].object_subselect_id_, 1 - t);
+ result = AMCAX::SubD::MeshSplit::SplitLoop(adapter->mesh->getShape(), s_info_list_[0].object_subselect_id_, 1 - t);
}
break;
case DataType::TSPLINEU_TYPE:
{
int p0, p1;
- AMCAX::TMS::TMSplineTool::EdgeVertexIndexs(adapter->tSpline->getTSpline(), s_info_list_[0].object_subselect_id_,
+ AMCAX::TMS::TMSplineTool::EdgeVertexIndexs(adapter->tSpline->getShape(), s_info_list_[0].object_subselect_id_,
p0, p1);
- AMCAX::Point3 point0 = AMCAX::TMS::TMSplineTool::ControlPosition(adapter->tSpline->getTSpline(), p0),
- point1 = AMCAX::TMS::TMSplineTool::ControlPosition(adapter->tSpline->getTSpline(), p1),
+ AMCAX::Point3 point0 = AMCAX::TMS::TMSplineTool::ControlPosition(adapter->tSpline->getShape(), p0),
+ point1 = AMCAX::TMS::TMSplineTool::ControlPosition(adapter->tSpline->getShape(), p1),
pointT(re_points_[0]);
double t = point0.Distance(pointT) / point0.Distance(point1);
AMCAX::TMS::TMSplineSplit tool;
- result = tool.CanSplitFaceLoop(adapter->tSpline->getTSpline(), s_info_list_[0].object_subselect_id_, t);
+ result = tool.CanSplitFaceLoop(adapter->tSpline->getShape(), s_info_list_[0].object_subselect_id_, t);
if (result) {
- tool.SplitFaceLoop(adapter->tSpline->getTSpline(), s_info_list_[0].object_subselect_id_, t);
+ tool.SplitFaceLoop(adapter->tSpline->getShape(), s_info_list_[0].object_subselect_id_, t);
adapter->updateDraw();
}
//result = AMCAX::TMS::TMSplineSplit().SplitFaceLoop(adapter->tSpline->getTSpline(), 1 - t);
diff --git a/Src/Operation/SGLOperate_Thicken.cpp b/Src/Operation/SGLOperate_Thicken.cpp
index 13239d1a8f9efe3b0162c6f3d7e241a8b6387a9f..9aed0b5acf33d6f0abe93224d85b0e4e8142dc87 100644
--- a/Src/Operation/SGLOperate_Thicken.cpp
+++ b/Src/Operation/SGLOperate_Thicken.cpp
@@ -21,11 +21,11 @@ namespace acamcad
case DataType::MESH_TYPE:
//AMCAX::SubD::MeshTool::MeshTriangles(adapter->mesh->mesh());
//result = true;
- result = AMCAX::SubD::MeshOffset::ThickenMesh(adapter->mesh->mesh(), 0.2);
+ result = AMCAX::SubD::MeshOffset::ThickenMesh(adapter->mesh->getShape(), 0.2);
break;
case DataType::TSPLINEU_TYPE:
{
- result = AMCAX::TMS::TMSplineThicken().ThickenTMSplins(adapter->tSpline->getTSpline(), 0.2);
+ result = AMCAX::TMS::TMSplineThicken().ThickenTMSplins(adapter->tSpline->getShape(), 0.2);
}
break;
diff --git a/Src/Operation/SGLOperate_TriangulateMesh.cpp b/Src/Operation/SGLOperate_TriangulateMesh.cpp
index 3a6d70feb94ea0f14292512cc93cba7427cc4aab..82ea674bf0e25c152d1d12b6220da8c69ff3e79d 100644
--- a/Src/Operation/SGLOperate_TriangulateMesh.cpp
+++ b/Src/Operation/SGLOperate_TriangulateMesh.cpp
@@ -19,7 +19,7 @@ namespace acamcad
switch (adapter->dataType())
{
case DataType::MESH_TYPE:
- AMCAX::SubD::MeshTool::MeshTriangles(adapter->mesh->mesh());
+ AMCAX::SubD::MeshTool::MeshTriangles(adapter->mesh->getShape());
result = true;
break;
default:
diff --git a/Src/Operation/SGLOperate_Uniform.cpp b/Src/Operation/SGLOperate_Uniform.cpp
index 13baf1ecab1dc0d66239ce088abb9ae8ecad5a5a..de573dee5abf57b28881809c442d904ea3551cb7 100644
--- a/Src/Operation/SGLOperate_Uniform.cpp
+++ b/Src/Operation/SGLOperate_Uniform.cpp
@@ -17,7 +17,7 @@ namespace acamcad
AMCAX::TMS::TMSplineRepair repair;
- bool result = repair.UniformTSpline(object->tSpline->getTSpline());
+ bool result = repair.UniformTSpline(object->tSpline->getShape());
if (result)
{
diff --git a/Src/Operation/SGLOperate_WeldEdge.cpp b/Src/Operation/SGLOperate_WeldEdge.cpp
index c51b546735d94a2791a05961a15c846d743b4705..c432c6d3e53336aac5f93ef6fa299afcb37794a3 100644
--- a/Src/Operation/SGLOperate_WeldEdge.cpp
+++ b/Src/Operation/SGLOperate_WeldEdge.cpp
@@ -22,10 +22,10 @@ bool SGLOperate_WeldEdge::DoOperate(AdapterObject* adapter)
{
std::vector s_id_list = getSelectSubList(s_info_list_);
- result = AMCAX::SubD::MeshWeld::FilterVoidWeldEdges(adapter->mesh->mesh(), s_id_list);
+ result = AMCAX::SubD::MeshWeld::FilterVoidWeldEdges(adapter->mesh->getShape(), s_id_list);
if (result) {
- AMCAX::SubD::MeshWeld::MeshWeldEdges(adapter->mesh->mesh(), s_id_list);
+ AMCAX::SubD::MeshWeld::MeshWeldEdges(adapter->mesh->getShape(), s_id_list);
}
}
break;
@@ -34,10 +34,10 @@ bool SGLOperate_WeldEdge::DoOperate(AdapterObject* adapter)
std::vector s_id_list = getSelectSubList(s_info_list_);
AMCAX::TMS::TMSplineWeld tool;
- result = tool.FilterVoidWeldEdges(adapter->tSpline->getTSpline(), s_id_list);
+ result = tool.FilterVoidWeldEdges(adapter->tSpline->getShape(), s_id_list);
if (result) {
- tool.WeldEdges(adapter->tSpline->getTSpline(), s_id_list);
+ tool.WeldEdges(adapter->tSpline->getShape(), s_id_list);
adapter->updateDraw();
}
diff --git a/Src/Record/Record.cpp b/Src/Record/Record.cpp
deleted file mode 100644
index c53649ddfee66da8375ab7d5e12d2d0b1ba0e0e3..0000000000000000000000000000000000000000
--- a/Src/Record/Record.cpp
+++ /dev/null
@@ -1,174 +0,0 @@
-/* ===================================================================
-* Copyright (C) 2023 Hefei Jiushao Intelligent Technology Co., Ltd.
-* All rights reserved.
-*
-* This software is licensed under the GNU Affero General Public License
-* v3.0 (AGPLv3.0) or a commercial license. You may choose to use this
-* software under the terms of either license.
-*
-* For more information about the AGPLv3.0 license, please visit:
-* https://www.gnu.org/licenses/agpl-3.0.html
-* For licensing inquiries or to obtain a commercial license, please
-* contact Hefei Jiushao Intelligent Technology Co., Ltd.
-* ===================================================================
-* Author:
-*/
-#include "Record.h"
-
-#include
-#include
-#include
-#include
-#include
-
-namespace acamcad
-{
- Record::Step::Step(int stepNum, int object_id, std::string action, std::string lable) :stepNum(stepNum),object_id(object_id),action(action), lable(lable)
- {
- }
- Record::Record() {
-
- }
- Record::~Record() {
-
- }
-
- bool startsWith(const std::string& base, const std::string& sub)
- {
- return base.rfind(sub, 0) == 0;
- }
-
- std::vector parsexyz(const std::string base) {
- std::vector xyz;
- int nPos = 0;
- std::string str = base;
- nPos = str.find("(");
- str = str.substr(nPos + 1);
- nPos = str.find(")");
- str = str.substr(0,nPos);
- nPos = str.find(",");
- while (-1 != nPos)
- {
- std::string temp = str.substr(0,nPos);
- double d = 0;
- d = std::stold(temp);
- xyz.emplace_back(d);
- str = str.substr(nPos + 1);
- nPos = str.find(",");
- }
- xyz.emplace_back(std::stold(str));
- return xyz;
- }
-
- void Record::recordCylinder(const int object_id, const AMCAX::Coord3 & b_center, const AMCAX::Coord3 & axis, const AMCAX::Coord3 & xaxis,double radius, double height, double angle,const std::string& label) {
- if (object_id <= 0) return;
-
- steps.push_back(Record::Step(steps.size() + 1, object_id, BREP_PRIM_API_MAKE_CYLINDER, label));
- object_num++;
- }
- void Record::recordCone(const int object_id, const AMCAX::Coord3 & b_center, const AMCAX::Coord3 & axis, const AMCAX::Coord3 & xaxis,double radiusR, double radiusr, double height,double angle, const std::string& label) {
- if (object_id <= 0) return;
-
- steps.push_back(Record::Step(steps.size() + 1, object_id, BREP_PRIM_API_MAKE_CONE, label));
- object_num++;
- }
- void Record::recordCube(const int object_id, const AMCAX::Coord3 & first, const AMCAX::Coord3 & second, const std::string& label) {
- if (object_id <= 0) return;
-
- steps.push_back(Record::Step(steps.size() + 1 , object_id, BREP_PRIM_API_MAKE_CUBE, label));
- object_num++;
- }
- void Record::recordTorus(const int object_id, const AMCAX::Coord3 & center, const AMCAX::Coord3 & axis, const AMCAX::Coord3 & xaxis, double radius0, double radius1, double angle, const std::string& label) {
- if (object_id <= 0) return;
-
- steps.push_back(Record::Step(steps.size() + 1, object_id, BREP_PRIM_API_MAKE_TORUS, label));
- object_num++;
- }
- void Record::recordSphere(const int object_id, const AMCAX::Coord3 & center, double radius,double angle1, double angle2, double angle3,const std::string& label) {
- if (object_id <= 0) return;
-
- steps.push_back(Record::Step(steps.size() + 1, object_id, BREP_PRIM_API_MAKE_SPHERE, label));
- object_num++;
- }
- void Record::recordPlane(const int object_id, const AMCAX::Coord3 & first, const AMCAX::Coord3 & second, const std::string& label) {
- if (object_id <= 0) return;
-
- steps.push_back(Record::Step(steps.size() + 1, object_id, BREP_PRIM_API_MAKE_PLANE, label));
- object_num++;
-
- }
- void Record::recordPolygon(const int object_id, const std::vector& points, const std::string& label) {
- if (object_id <= 0) return;
-
- steps.push_back(Record::Step(steps.size() + 1, object_id, BREP_BUILDER_API_MAKE_POLYGON, label));
- }
- void Record::recordPrism(const int object_id, const std::vector& points, const AMCAX::Coord3& prism_axis, const std::string& label) {
- if (object_id <= 0) return;
-
- steps.push_back(Record::Step(steps.size() + 1, object_id, BREP_PRIM_API_MAKE_PRISM, label));
- object_num++;
- }
- int Record::getStepByObject(int id) {
- int object_id = id;
- int stepId = 0;
- for (int i = steps.size() - 1; i >= 0; i--)
- {
- if (steps[i].object_id == object_id)
- {
- stepId = steps[i].stepNum;
- break;
- }
- }
- return stepId;
- }
- void Record::recordMove(const int object_id, const AMCAX::Coord3d & vec){
- if (object_id <= 0) return;
-
- steps.push_back(Record::Step(steps.size() + 1, object_id, BREP_BUILDER_API_TRANSFORM, "move"));
- }
-
- void Record::recorRotation(const int object_id, const AMCAX::Coord3 & center, const AMCAX::Coord3 & axis,const double angle ) {
- if (object_id <= 0) return;
-
- steps.push_back(Record::Step(steps.size() + 1, object_id, BREP_BUILDER_API_ROTATION, "rotation"));
- }
-
- void Record::recordDelete(BaseObject* obj) {
- steps.push_back(Record::Step(steps.size() + 1, obj->id(), BREP_ALGO_API_DELETE, "delete"));
- }
- void Record::recordFuse(const int object_id, std::vector persistent_id_list) {
- if (object_id <= 0) return;
-
- std::vector stepList;
- for (int id : persistent_id_list)
- {
- stepList.emplace_back(getStepByObject(id));
- }
- steps.push_back(Record::Step(steps.size() + 1, object_id, BREP_ALGO_API_FUSE, "fuse"));
- object_num++;
- }
- void Record::recordCommon(const int object_id, std::vector persistent_id_list) {
- if (object_id <= 0) return;
-
- std::vector stepList;
- for (int id : persistent_id_list)
- {
- stepList.emplace_back(getStepByObject(id));
- }
-
- steps.push_back(Record::Step(steps.size() + 1, object_id, BREP_ALGO_API_COMMON, "common"));
- object_num++;
- }
- void Record::recordCut(const int object_id, std::vector persistent_id_list) {
- if (object_id <= 0) return;
-
- std::vector stepList;
- for (int id : persistent_id_list)
- {
- stepList.emplace_back(getStepByObject(id));
- }
-
- steps.push_back(Record::Step(steps.size() + 1, object_id, BREP_ALGO_API_CUT, "cut"));
- object_num++;
- }
-}
\ No newline at end of file
diff --git a/Src/Record/Record.h b/Src/Record/Record.h
deleted file mode 100644
index d9c587fbb315f9734ffec56ddf7163aaf73e7a49..0000000000000000000000000000000000000000
--- a/Src/Record/Record.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/* ===================================================================
-* Copyright (C) 2023 Hefei Jiushao Intelligent Technology Co., Ltd.
-* All rights reserved.
-*
-* This software is licensed under the GNU Affero General Public License
-* v3.0 (AGPLv3.0) or a commercial license. You may choose to use this
-* software under the terms of either license.
-*
-* For more information about the AGPLv3.0 license, please visit:
-* https://www.gnu.org/licenses/agpl-3.0.html
-* For licensing inquiries or to obtain a commercial license, please
-* contact Hefei Jiushao Intelligent Technology Co., Ltd.
-* ===================================================================
-* Author:
-*/
-#pragma once
-#include
-#include
-
-#include
-#include
-#include "../Object/BaseObject.h"
-#define BREP_PRIM_API_MAKE_PLANE "BRepPrimAPI_MakePlane"
-#define BREP_PRIM_API_MAKE_CUBE "BRepPrimAPI_MakeBox"
-#define BREP_PRIM_API_MAKE_SPHERE "BRepPrimAPI_MakeSphere"
-#define BREP_PRIM_API_MAKE_CYLINDER "BRepPrimAPI_MakeCylinder"
-#define BREP_PRIM_API_MAKE_CONE "BRepPrimAPI_MakeCone"
-#define BREP_PRIM_API_MAKE_TORUS "BRepPrimAPI_MakeTorus"
-#define BREP_PRIM_API_MAKE_PRISM "BRepPrimAPI_MakePrism"
-#define BREP_PRIM_API_MAKE_ROUNDEDPRISM "BRepPrimAPI_MakeRoundedPrism"
-#define BREP_PRIM_API_MAKE_WEDGE "BRepPrimAPI_MakeWedge"
-#define BREP_BUILDER_API_MAKE_EDGE "BRepBuilderAPI_MakeEdge"
-#define BREP_BUILDER_API_MAKE_WIRE "BRepBuilderAPI_MakeWire"
-#define BREP_BUILDER_API_MAKE_FACE "BRepBuilderAPI_MakeFace"
-#define BREP_BUILDER_API_MAKE_POLYGON "BRepBuilderAPI_MakePolygon"
-#define BREP_BUILDER_API_TRANSFORM "BRepBuilderAPI_Transform"
-#define BREP_BUILDER_API_ROTATION "BRepBuilderAPI_Rotation"
-#define BREP_ALGO_API_DELETE "BRepAlgoAPI_Delete"
-#define BREP_ALGO_API_FUSE "BRepAlgoAPI_Fuse"
-#define BREP_ALGO_API_COMMON "BRepAlgoAPI_Common"
-#define BREP_ALGO_API_CUT "BRepAlgoAPI_Cut"
-#define JSON_KEYWORD_ACTION "action"
-#define JSON_KEYWORD_STEP "step"
-#define JSON_KEYWORD_ID "id"
-#define JSON_KEYWORD_DESCRIPTION "description"
-#define JSON_KEYWORD_ARGS "args"
-#define JSON_KEYWORD_LABEL "lable"
-#define BREP_BUILDER_API_TRANSFORM_SHAPE_PREFIX_L "shape"
-#define BREP_BUILDER_API_TRANSFORM_SHAPE_PREFIX_U "Shape"
-#define BREP_BUILDER_API_TRANSFORM_SHAPES_PREFIX_L "shapes"
-#define BREP_BUILDER_API_TRANSFORM_SHAPES_PREFIX_U "Shapes"
-
-#define JSON_KEYWORD_SHAPE "shape"
-#define JSON_KEYWORD_VECTOR "vec"
-#define JSON_KEYWORD_VECTOR_X "vector_x"
-#define JSON_KEYWORD_VECTOR_Y "vector_y"
-#define JSON_KEYWORD_VECTOR_Z "vector_z"
-
-namespace acamcad
-{
-
- class Record
- {
- public:
- struct Step
- {
- int stepNum;
- int object_id;
- std::string action;
- std::string lable;
- Step(int stepNum, int object_id,std::string action, std::string lable);
- };
- private:
- std::vector steps;
- int object_num = 0;
- public:
- void recordCylinder(const int id, const AMCAX::Coord3 & b_center, const AMCAX::Coord3 & axis, const AMCAX::Coord3 & xaxis, double radius, double height, double angle, const std::string& label);
- void recordCone(const int id, const AMCAX::Coord3 & b_center, const AMCAX::Coord3 & axis, const AMCAX::Coord3 & xaxis, double radiusR, double radiusr, double height, double angle, const std::string& label);
- void recordCube(const int id, const AMCAX::Coord3 & first, const AMCAX::Coord3 & second, const std::string& label);
- void recordTorus(const int id, const AMCAX::Coord3 & center, const AMCAX::Coord3 & axis, const AMCAX::Coord3 & xaxis, double radius0, double radius1, double angle, const std::string& label);
- void recordSphere(const int id, const AMCAX::Coord3 & center, double radius,double angle1, double angle2, double angle3,const std::string& label);
- void recordPlane(const int id, const AMCAX::Coord3 & first, const AMCAX::Coord3 & second, const std::string& label);
- void recordPolygon(const int id, const std::vector& points, const std::string& label);
- void recordPrism(const int id, const std::vector& points, const AMCAX::Coord3& prism_axis, const std::string& label);
- int getStepByObject(int id);
- void recordMove(const int id, const AMCAX::Coord3d & vec);
- void recorRotation(const int object_id, const AMCAX::Coord3 & center, const AMCAX::Coord3 & axis, const double angle);
- void recordDelete(BaseObject* obj);
- void recordFuse(const int object_id, std::vector persistent_id_list);
- void recordCommon(const int object_id, std::vector persistent_id_list);
- void recordCut(const int object_id, std::vector persistent_id_list);
-
- public:
- Record();
- ~Record();
-
- };
-}
\ No newline at end of file
diff --git a/Src/Windows/ACAMWindow.cpp b/Src/Windows/ACAMWindow.cpp
deleted file mode 100644
index d0dbfc0d6375c5e93df03473f80642dbd5172e61..0000000000000000000000000000000000000000
--- a/Src/Windows/ACAMWindow.cpp
+++ /dev/null
@@ -1,580 +0,0 @@
-/* ===================================================================
-* Copyright (C) 2023 Hefei Jiushao Intelligent Technology Co., Ltd.
-* All rights reserved.
-*
-* This software is licensed under the GNU Affero General Public License
-* v3.0 (AGPLv3.0) or a commercial license. You may choose to use this
-* software under the terms of either license.
-*
-* For more information about the AGPLv3.0 license, please visit:
-* https://www.gnu.org/licenses/agpl-3.0.html
-* For licensing inquiries or to obtain a commercial license, please
-* contact Hefei Jiushao Intelligent Technology Co., Ltd.
-* ===================================================================
-* Author:
-*/
-#include "ACAMWindow.h"
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-
-#include "RenderViewer.h"
-#include "../Core/DataManager.h"
-#include "../Core/ACAMCore.h"
-#include "OperateToolbar.h"
-#include "../Core/UndoRedoHandler.h"
-
-using namespace acamcad;
-
-
-ACAMWindow::ACAMWindow(QWidget* parent)
- : QMainWindow(parent)
-{
- ui.setupUi(this);
-
- size_t icon_size = 36;
-
- this->setIconSize(QSize(icon_size, icon_size));
- this->setWindowIcon(QIcon(":images/images/logo.ico"));
-
- initCoreAndViewer();
-
- createAction();
- createMenus();
- createToolBars();
-
- OperateToolBar* tab_widget = new OperateToolBar(render_viewer_, this);
- connect(tab_widget, &OperateToolBar::currentChanged, this, &ACAMWindow::slotCurrentChanged);
-
- render_viewer_->selectCheckChanged();
-
- QVBoxLayout* layout_main = new QVBoxLayout;
-
- size_t bar_height = tab_widget->tabBar()->height();
-
- tab_widget->setMaximumHeight(icon_size + bar_height + 2);
-
- layout_main->addWidget(tab_widget, 0, Qt::AlignTop);
- layout_main->addWidget(render_viewer_, 10);
-
- this->centralWidget()->setLayout(layout_main);
-
- this->resize(1280, 750);
-
- slotCurrentChanged(1);
-
- //instance = this;
-
- //ShowMessge("Selet dd", acamcad::DataType::BREP_TYPE | acamcad::DataType::TSPLINEU_TYPE);
-
- ///statusBar()->showMessage("XXXXXXXXXXXXXXXXXXX!!!");
-
-}
-
-ACAMWindow::~ACAMWindow()
-{
- delete render_viewer_;
- delete dataManager_;
- //delete undoRedoHandler_;
- delete core_;
-}
-
-void ACAMWindow::initCoreAndViewer()
-{
- dataManager_ = new DataManager();
-
- //undoRedoHandler_ = new UndoRedoHandler(dataManager_, 50);
-
- core_ = new acamcad::AMCore();
- core_->setDataManager(dataManager_);
- //core_->setUndoRedoHandler(undoRedoHandler_);
-
- render_viewer_ = new acamcad::RenderViewer(this);
- render_viewer_->setDataManger(dataManager_);
- render_viewer_->setCore(core_);
-}
-
-void ACAMWindow::createAction()
-{
- // menu actions
- createAction_File();
- createAction_Edit();
- createAction_Help();
-
- // left side toolbar actions
- createAction_LeftTools();
-}
-
-void ACAMWindow::createAction_File()
-{
- openAction_ = new QAction(tr("Open"));
- openAction_->setStatusTip(tr("Open a file"));
- connect(openAction_, &QAction::triggered, core_, &AMCore::loadObjects);
-
- saveAction_ = new QAction(tr("Save"));
- saveAction_->setStatusTip(tr("Save to file"));
- connect(saveAction_, &QAction::triggered, core_, QOverload<>::of(&AMCore::saveObjects));
-
- exportAction_ = new QAction(tr("Export Selected"));
- exportAction_->setStatusTip(tr("Export selected models"));
- connect(exportAction_, &QAction::triggered, core_, &AMCore::saveSelectedObjects);
-
- // TODO:
- exitAction_ = new QAction(tr("Exit"));
- exitAction_->setStatusTip(tr("Exit the program"));
- connect(exitAction_, &QAction::triggered, this, &ACAMWindow::close);
- // check if unsaved...
-}
-
-void ACAMWindow::createAction_Edit()
-{
- undoAction_ = new QAction(tr("Undo"));
- undoAction_->setStatusTip(tr("Undo"));
- connect(undoAction_, &QAction::triggered, render_viewer_, &RenderViewer::slotUndo);
-
- redoAction_ = new QAction(tr("Redo"));
- redoAction_->setStatusTip(tr("Redo"));
- connect(redoAction_, &QAction::triggered, render_viewer_, &RenderViewer::slotRedo);
-
-
- //undoAction_->setEnabled(false);
-}
-
-void ACAMWindow::createAction_Help()
-{
- aboutAction_ = new QAction(tr("About"));
- aboutAction_->setStatusTip("About us");
- // TODO connect
-}
-
-
-void ACAMWindow::createAction_LeftTools()
-{
- chamferAction_ = new QAction("Chamfer Edges");
- chamferAction_->setStatusTip(tr("(Support Brep)select an edge to chamfer"));
- chamferAction_->setIcon(QIcon(":images/images/Chamfer.png"));
- connect(chamferAction_, &QAction::triggered, this, &ACAMWindow::slotChamfer);
-
- deleteFaceAction_ = new QAction("Delete Face");
- deleteFaceAction_->setStatusTip(tr("(Support Mesh)Delete a face from mesh, the define is face, Enter sure"));
- deleteFaceAction_->setIcon(QIcon(":images/images/DeleteFace.png"));
- connect(deleteFaceAction_, &QAction::triggered, this, &ACAMWindow::slotDeleteElement);
-
- embedAction_ = new QAction("Embed face");
- embedAction_->setStatusTip(
- tr("(Support Mesh)Embed a face to mesh, select connected boundary vert or connected boundary edge, enter sure"));
- embedAction_->setIcon(QIcon(":images/images/EmbedFace.png"));
- connect(embedAction_, &QAction::triggered, this, &ACAMWindow::slotEmbedFace);
-
-
- separateAction_ = new QAction("Separate");
- deleteFaceAction_->setStatusTip(tr("(Support Mesh)Sperate a face from mesh , select vertex or edge, Enter sure"));
- separateAction_->setIcon(QIcon(":images/images/Separate.png"));
- connect(separateAction_, &QAction::triggered, this, &ACAMWindow::slotSeparateEdge);
-
- weldAction_ = new QAction("Weld");
- deleteFaceAction_->setStatusTip(tr("(Support Mesh)Weld a edge to mesh , select edge, Enter sure"));
- weldAction_->setIcon(QIcon(":images/images/Weld.png"));
- connect(weldAction_, &QAction::triggered, this, &ACAMWindow::slotWeldEdge);
-
-
-
- splitLoopAction_ = new QAction("Split loop");
- splitLoopAction_->setStatusTip(tr("Split a mesh loop"));
- splitLoopAction_->setIcon(QIcon(":images/images/SplitLoop.png"));
- connect(splitLoopAction_, &QAction::triggered, this, &ACAMWindow::slotSplitLoop);
-
- //splitEdgeAction_ = new QAction("Split edge");
- //splitEdgeAction_->setStatusTip(tr("Split a edge"));
- //splitEdgeAction_->setIcon(QIcon(":images/images/SplitEdge.png"));
- //connect(splitEdgeAction_, &QAction::triggered, this, &ACAMWindow::slotSplitEdge);
- splitFaceAction_ = new QAction("split face");
- splitFaceAction_->setStatusTip(tr("split face cross"));
- splitFaceAction_->setIcon(QIcon(":images/images/SplitFace1.png"));
- connect(splitFaceAction_, &QAction::triggered, this, &ACAMWindow::slotSplitFace);
-
-
- splitFaceEdgeAction_ = new QAction("Split Face by Edge");
- splitFaceEdgeAction_->setStatusTip(tr("Split Face by select some edge"));
- splitFaceEdgeAction_->setIcon(QIcon(":images/images/SplitEdgeOnly.png"));
- connect(splitFaceEdgeAction_, &QAction::triggered, this, &ACAMWindow::slotSplitFaceByEdge);
-
-
- splitFaceVertAction_ = new QAction("Cut face");
- splitFaceVertAction_->setStatusTip(tr("Cat the face by select vert"));
- splitFaceVertAction_->setIcon(QIcon(":images/images/SplitFace.png"));
- connect(splitFaceVertAction_, &QAction::triggered, this, &ACAMWindow::slotSplitFaceByVert);
-
- //collapseEdgeAction_ = new QAction("combine Vert");
- //collapseEdgeAction_->setStatusTip(tr("Combine ywo Vertex"));
- //collapseEdgeAction_->setIcon(QIcon(":images/images/CollapseEdge.png"));
- //connect(collapseEdgeAction_, &QAction::triggered, this, &ACAMWindow::slotCollapseEdge);
-
- //swapEdgeAction_ = new QAction("Swap Edge");
- //swapEdgeAction_->setStatusTip(tr("Swap a mesh edge"));
- //swapEdgeAction_->setIcon(QIcon(":images/images/SwapEdge.png"));
- //connect(swapEdgeAction_, &QAction::triggered, this, &ACAMWindow::slotSwapMeshEdge);
-
-
- bridgeEdgeAction_ = new QAction("Bridge edge");
- bridgeEdgeAction_->setStatusTip(tr("Bridge to edge, select two not connected boudnary edge, enter sure"));
- bridgeEdgeAction_->setIcon(QIcon(":images/images/BridgeEdge.png"));
- connect(bridgeEdgeAction_, &QAction::triggered, this, &ACAMWindow::slotBridgeEdge);
-
- extrudeEdgeVAction_ = new QAction("Extrude edge Vertical");
- extrudeEdgeVAction_->setStatusTip(tr("Select some edge, use Ctrl+left to extrude edge, direction vartical face"));
- extrudeEdgeVAction_->setIcon(QIcon(":images/images/ExtrudeEdgeVertical.png"));
- connect(extrudeEdgeVAction_, &QAction::triggered, this, &ACAMWindow::slotExtrudeEdgeV);
-
- extrudeEdgeHAction_ = new QAction("Extrude edge Horizontal");
- extrudeEdgeHAction_->setStatusTip(tr("Select some edge, use Ctrl+left to extrude edge, direction horizontal face"));
- extrudeEdgeHAction_->setIcon(QIcon(":images/images/ExtrudeEdgeHorizontal.png"));
- connect(extrudeEdgeHAction_, &QAction::triggered, this, &ACAMWindow::slotExtrudeEdgeH);
-
- //chamferAction_->setVisible(false);
-
- thickenAction_ = new QAction("Thicken Mesh");
- thickenAction_->setStatusTip(tr("Thicken a mesh"));
- thickenAction_->setIcon(QIcon(":images/images/Thicken.png"));
- connect(thickenAction_, &QAction::triggered, this, &ACAMWindow::slotThicken);
-
- normalAction_ = new QAction("Reverse Mesh Normal");
- normalAction_->setStatusTip(tr("Reverse Mesh Normal"));
- normalAction_->setIcon(QIcon(":images/images/ReverseNormal.png"));
- connect(normalAction_, &QAction::triggered, this, &ACAMWindow::slotMeshReverse);
-
- fillHoleAction_ = new QAction("FillHole");
- fillHoleAction_->setStatusTip(tr("Try to FillHole"));
- fillHoleAction_->setIcon(QIcon(":images/images/FillHole.png"));
- connect(fillHoleAction_, &QAction::triggered, this, &ACAMWindow::slotFillHole);
-
- filletAction_ = new QAction("Fillet Edges");
- filletAction_->setStatusTip(tr("(Support Brep)select an edge to fillet"));
- filletAction_->setIcon(QIcon(":images/images/fillet.png"));
- connect(filletAction_, &QAction::triggered, this, &ACAMWindow::slotFillet);
-
- extrudAction_ = new QAction("Extrude Face");
- extrudAction_->setStatusTip(tr("(Support Brep)select a face to extrude(Support Mesh)"));
- extrudAction_->setIcon(QIcon(":images/images/ExtrudeFace.png"));
- connect(extrudAction_, &QAction::triggered, render_viewer_, &RenderViewer::slotBRepExtrude);
-
- extrudActionMesh_ = new QAction("Extrude Face Mesh");
- extrudActionMesh_->setStatusTip(tr("(Support Brep)select a face to extrude(Support Mesh)"));
- extrudActionMesh_->setIcon(QIcon(":images/images/ExtrudeFace.png"));
- connect(extrudActionMesh_, &QAction::triggered, this, &ACAMWindow::slotExtrudeFace);
-
- bool_fuseAction_ = new QAction("Fuse Object");
- bool_fuseAction_->setStatusTip(tr("(Support Brep)Fuse more than one Object to a one Object"));
- bool_fuseAction_->setIcon(QIcon(":images/images/BoolFuse.png"));
- connect(bool_fuseAction_, SIGNAL(triggered()), this, SLOT(slotBoolFuseObject()));
-
- bool_cutAction_ = new QAction("Cut Object");
- bool_cutAction_->setStatusTip(tr("(Support Brep)one object Cut other more than one Object"));
- bool_cutAction_->setIcon(QIcon(":images/images/BoolCut.png"));
- connect(bool_cutAction_, SIGNAL(triggered()), this, SLOT(slotBoolCutObject()));
-
- bool_CommonAction_ = new QAction("Common Object");
- bool_CommonAction_->setStatusTip(tr("(Support Brep)find more than one Object' common Object"));
- bool_CommonAction_->setIcon(QIcon(":images/images/BoolCommon.png"));
- connect(bool_CommonAction_, SIGNAL(triggered()), this, SLOT(slotBoolCommonObject()));
-
-
- duplicateAction_ = new QAction("duplicate");
-}
-
-
-
-//================================================================
-
-void ACAMWindow::createMenus()
-{
- fileMenu_ = menuBar()->addMenu(tr("&File"));
- fileMenu_->addAction(openAction_);
- fileMenu_->addAction(saveAction_);
- fileMenu_->addAction(exportAction_);
- fileMenu_->addSeparator();
- fileMenu_->addAction(exitAction_);
-
- editMenu_ = menuBar()->addMenu(tr("Edit"));
- editMenu_->addAction(undoAction_);
- editMenu_->addAction(redoAction_);
-
- helpMenu_ = menuBar()->addMenu(tr("Help"));
- helpMenu_->addAction(aboutAction_);
-}
-
-void ACAMWindow::createToolBars()
-{
- //=============================================================
- QToolBar* editToolBar_ = new QToolBar(this);
- editToolBar_->setObjectName(QString::fromUtf8("Edit"));
- this->addToolBar(Qt::LeftToolBarArea, editToolBar_);
-
-
-
- editToolBar_->addAction(deleteFaceAction_);
- list_actions_.push_back(deleteFaceAction_);
- editToolBar_->addAction(embedAction_);
- list_actions_.push_back(embedAction_);
- editToolBar_->addAction(separateAction_);
- list_actions_.push_back(separateAction_);
- editToolBar_->addAction(weldAction_);
- list_actions_.push_back(weldAction_);
-
- editToolBar_->addSeparator();
-
- //=====================================
- editToolBar_->addAction(splitLoopAction_);
- list_actions_.push_back(splitLoopAction_);
- editToolBar_->addAction(splitFaceAction_);
- list_actions_.push_back(splitFaceAction_);
- //editToolBar_->addAction(splitEdgeAction_);
- editToolBar_->addAction(splitFaceEdgeAction_);
- list_actions_.push_back(splitFaceEdgeAction_);
- editToolBar_->addAction(splitFaceVertAction_);
- list_actions_.push_back(splitFaceVertAction_);
- //editToolBar_->addAction(collapseEdgeAction_);
- //editToolBar_->addAction(swapEdgeAction_);
-
- editToolBar_->addAction(chamferAction_);
- list_actions_.push_back(chamferAction_);
- editToolBar_->addAction(filletAction_);
- list_actions_.push_back(filletAction_);
- editToolBar_->addAction(bridgeEdgeAction_);
- list_actions_.push_back(bridgeEdgeAction_);
- editToolBar_->addAction(extrudeEdgeVAction_);
- list_actions_.push_back(extrudeEdgeVAction_);
- editToolBar_->addAction(extrudeEdgeHAction_);
- list_actions_.push_back(extrudeEdgeHAction_);
- editToolBar_->addAction(extrudAction_);
- list_actions_.push_back(extrudAction_);
- editToolBar_->addAction(extrudActionMesh_);
- list_actions_.push_back(extrudActionMesh_);
-
- editToolBar_->addSeparator();
-
- editToolBar_->addAction(thickenAction_);
- list_actions_.push_back(thickenAction_);
- editToolBar_->addAction(normalAction_);
- list_actions_.push_back(normalAction_);
- editToolBar_->addAction(fillHoleAction_);
- list_actions_.push_back(fillHoleAction_);
-
-
- editToolBar_->addAction(bool_fuseAction_);
- list_actions_.push_back(bool_fuseAction_);
- editToolBar_->addAction(bool_cutAction_);
- list_actions_.push_back(bool_cutAction_);
- editToolBar_->addAction(bool_CommonAction_);
- list_actions_.push_back(bool_CommonAction_);
-}
-
-//================================================================
-#include
-#include