├── .github ├── CI_OVERVIEW.md └── workflows │ ├── ci_linux_arch.yml │ ├── ci_linux_fedora.yml │ ├── ci_linux_ubuntu.yml │ ├── ci_linux_ubuntu_armv7.yml │ ├── ci_macos.yml │ ├── ci_macos_conda.yml │ └── ci_windows.yml ├── .gitignore ├── CMakeLists.txt ├── LICENSE.txt ├── README.md ├── cmake └── OpenCascadeWin.cmake ├── doc ├── 3rdparty_licenses.md ├── screencast_1.gif ├── screencast_cli.gif ├── screenshot_1.png ├── screenshot_2.png ├── screenshot_3.png ├── screenshot_4.png ├── screenshot_5.png ├── screenshot_6.png ├── screenshot_mayoconv_linux.png ├── screenshot_ubuntu_1.png ├── screenshot_ubuntu_2.png ├── screenshot_ubuntu_3.png ├── screenshot_ubuntu_4.png ├── screenshot_ubuntu_5.png ├── screenshot_ubuntu_main.png ├── src_modules.odg ├── src_modules.png ├── win_cmake_01.png ├── win_cmake_02.png ├── win_cmake_03.png ├── win_cmake_04.png ├── win_cmake_05.png ├── win_cmake_06.png └── win_msvc_mp.png ├── i18n ├── i18n.pro ├── mayo.qrc ├── mayo_en.qm ├── mayo_en.ts ├── mayo_fr.qm ├── mayo_fr.ts ├── mayo_zh.qm ├── mayo_zh.ts ├── messages.cpp ├── qt5base.qrc ├── qt5base_en.qm ├── qt5base_fr.qm ├── qt5base_zh.qm ├── qt6base.qrc ├── qt6base_en.qm ├── qt6base_fr.qm └── qt6base_zh.qm ├── images ├── appicon.icns ├── appicon.ico ├── appicon.rc ├── appicon.svg ├── appicon_128.png ├── appicon_16.png ├── appicon_24.png ├── appicon_256.png ├── appicon_32.png ├── appicon_64.png ├── credits.txt ├── graphics │ └── opencascade_hatch_1.png ├── mayo.qrc ├── themes │ ├── classic │ │ ├── add-file.svg │ │ ├── back-square.svg │ │ ├── back.svg │ │ ├── camera.svg │ │ ├── clip-plane.svg │ │ ├── cross.svg │ │ ├── edit.svg │ │ ├── expand.svg │ │ ├── export.svg │ │ ├── file.svg │ │ ├── gear.svg │ │ ├── grid.svg │ │ ├── import.svg │ │ ├── indicator-down-disabled_8.png │ │ ├── indicator-down_8.png │ │ ├── item-mesh.svg │ │ ├── item-xde.svg │ │ ├── left-sidebar.svg │ │ ├── link.svg │ │ ├── measure.svg │ │ ├── multiple.svg │ │ ├── next.svg │ │ ├── open-files.svg │ │ ├── reload.svg │ │ ├── stop.svg │ │ ├── turn-ccw.svg │ │ ├── turn-cw.svg │ │ ├── view-back.svg │ │ ├── view-bottom.svg │ │ ├── view-front.svg │ │ ├── view-iso.svg │ │ ├── view-left.svg │ │ ├── view-right.svg │ │ ├── view-top.svg │ │ ├── xde-assembly.svg │ │ ├── xde-simple-shape.svg │ │ ├── zoom-in.svg │ │ └── zoom-out.svg │ └── dark │ │ ├── back-square.svg │ │ ├── back.svg │ │ ├── camera.svg │ │ ├── clip-plane.svg │ │ ├── cross.svg │ │ ├── edit.svg │ │ ├── expand.svg │ │ ├── export.svg │ │ ├── file.svg │ │ ├── gear.svg │ │ ├── grid.svg │ │ ├── import.svg │ │ ├── indicator-down-disabled_8.png │ │ ├── indicator-down_8.png │ │ ├── item-mesh.svg │ │ ├── item-xde.svg │ │ ├── left-sidebar.svg │ │ ├── link.svg │ │ ├── measure.svg │ │ ├── multiple.svg │ │ ├── next.svg │ │ ├── reload.svg │ │ ├── stop.svg │ │ ├── turn-ccw.svg │ │ ├── turn-cw.svg │ │ ├── view-back.svg │ │ ├── view-bottom.svg │ │ ├── view-front.svg │ │ ├── view-iso.svg │ │ ├── view-left.svg │ │ ├── view-right.svg │ │ ├── view-top.svg │ │ ├── xde-assembly.svg │ │ ├── xde-simple-shape.svg │ │ ├── zoom-in.svg │ │ └── zoom-out.svg ├── widget_pseudo_fold.png └── xde_reference_16.png ├── scripts ├── bump-version.rb ├── gen-cmake-opencascade-vars.bat ├── release-i18n.bat └── update-i18n.bat ├── src ├── 3rdparty │ ├── commit_fast_float.txt │ ├── commit_fmt.txt │ ├── commit_gsl.txt │ ├── commit_kdbindings.txt │ ├── commit_magic_enum.txt │ ├── fast_float │ │ ├── ascii_number.h │ │ ├── decimal_to_binary.h │ │ ├── fast_float.h │ │ ├── fast_table.h │ │ ├── float_common.h │ │ ├── parse_number.h │ │ └── simple_decimal_conversion.h │ ├── fmt │ │ ├── args.h │ │ ├── base.h │ │ ├── chrono.h │ │ ├── color.h │ │ ├── compile.h │ │ ├── core.h │ │ ├── format-inl.h │ │ ├── format.h │ │ ├── os.h │ │ ├── ostream.h │ │ ├── printf.h │ │ ├── ranges.h │ │ ├── src │ │ │ ├── fmt.cc │ │ │ ├── format.cc │ │ │ └── os.cc │ │ ├── std.h │ │ └── xchar.h │ ├── gsl │ │ ├── algorithm │ │ ├── assert │ │ ├── byte │ │ ├── gsl │ │ ├── gsl_algorithm │ │ ├── gsl_assert │ │ ├── gsl_byte │ │ ├── gsl_narrow │ │ ├── gsl_util │ │ ├── narrow │ │ ├── pointers │ │ ├── span │ │ ├── span_ext │ │ ├── string_span │ │ └── util │ ├── kdbindings │ │ ├── genindex_array.h │ │ ├── signal.h │ │ └── utils.h │ └── magic_enum │ │ └── magic_enum.hpp ├── app │ ├── app_context.cpp │ ├── app_context.h │ ├── app_module.cpp │ ├── app_module.h │ ├── app_module_properties.cpp │ ├── app_module_properties.h │ ├── app_ui_state.cpp │ ├── app_ui_state.h │ ├── button_flat.cpp │ ├── button_flat.h │ ├── command_system_information.cpp │ ├── command_system_information_occopengl.cpp │ ├── command_system_information_occopengl.h │ ├── commands_api.cpp │ ├── commands_api.h │ ├── commands_display.cpp │ ├── commands_display.h │ ├── commands_file.cpp │ ├── commands_file.h │ ├── commands_help.cpp │ ├── commands_help.h │ ├── commands_tools.cpp │ ├── commands_tools.h │ ├── commands_window.cpp │ ├── commands_window.h │ ├── dialog_about.cpp │ ├── dialog_about.h │ ├── dialog_about.ui │ ├── dialog_inspect_xde.cpp │ ├── dialog_inspect_xde.h │ ├── dialog_inspect_xde.ui │ ├── dialog_options.cpp │ ├── dialog_options.h │ ├── dialog_options.ui │ ├── dialog_save_image_view.cpp │ ├── dialog_save_image_view.h │ ├── dialog_save_image_view.ui │ ├── dialog_task_manager.cpp │ ├── dialog_task_manager.h │ ├── dialog_task_manager.ui │ ├── document_files_watcher.cpp │ ├── document_files_watcher.h │ ├── document_property_group.cpp │ ├── document_property_group.h │ ├── document_tree_node_properties_providers.cpp │ ├── document_tree_node_properties_providers.h │ ├── grid_helper.cpp │ ├── grid_helper.h │ ├── gui_document_list_model.cpp │ ├── gui_document_list_model.h │ ├── item_view_buttons.cpp │ ├── item_view_buttons.h │ ├── iwidget_main_page.h │ ├── library_info.h │ ├── list_helper.cpp │ ├── list_helper.h │ ├── main.cpp │ ├── mainwindow.cpp │ ├── mainwindow.h │ ├── mainwindow.ui │ ├── occt_window.cpp │ ├── occt_window.h │ ├── property_editor_factory.cpp │ ├── property_editor_factory.h │ ├── property_item_delegate.cpp │ ├── property_item_delegate.h │ ├── proxy_styled_item_delegate.cpp │ ├── proxy_styled_item_delegate.h │ ├── qmeta_property.h │ ├── qmeta_tdf_label.h │ ├── qstring_utils.cpp │ ├── qstring_utils.h │ ├── qtgui_utils.cpp │ ├── qtgui_utils.h │ ├── qtwidgets_utils.cpp │ ├── qtwidgets_utils.h │ ├── recent_files.cpp │ ├── recent_files.h │ ├── theme.cpp │ ├── theme.h │ ├── view3d_navigation_style.h │ ├── widget_clip_planes.cpp │ ├── widget_clip_planes.h │ ├── widget_clip_planes.ui │ ├── widget_explode_assembly.cpp │ ├── widget_explode_assembly.h │ ├── widget_explode_assembly.ui │ ├── widget_file_system.cpp │ ├── widget_file_system.h │ ├── widget_grid.cpp │ ├── widget_grid.h │ ├── widget_grid.ui │ ├── widget_gui_document.cpp │ ├── widget_gui_document.h │ ├── widget_home_files.cpp │ ├── widget_home_files.h │ ├── widget_main_control.cpp │ ├── widget_main_control.h │ ├── widget_main_control.ui │ ├── widget_main_home.cpp │ ├── widget_main_home.h │ ├── widget_main_home.ui │ ├── widget_measure.cpp │ ├── widget_measure.h │ ├── widget_measure.ui │ ├── widget_message_indicator.cpp │ ├── widget_message_indicator.h │ ├── widget_model_tree.cpp │ ├── widget_model_tree.h │ ├── widget_model_tree.ui │ ├── widget_model_tree_builder.cpp │ ├── widget_model_tree_builder.h │ ├── widget_model_tree_builder_mesh.cpp │ ├── widget_model_tree_builder_mesh.h │ ├── widget_model_tree_builder_xde.cpp │ ├── widget_model_tree_builder_xde.h │ ├── widget_occ_view.cpp │ ├── widget_occ_view.h │ ├── widget_occ_view_controller.cpp │ ├── widget_occ_view_controller.h │ ├── widget_occ_view_impl.cpp │ ├── widget_properties_editor.cpp │ ├── widget_properties_editor.h │ ├── widget_properties_editor.ui │ └── windows │ │ ├── win_taskbar_global_progress.cpp │ │ └── win_taskbar_global_progress.h ├── base │ ├── application.cpp │ ├── application.h │ ├── application_item.cpp │ ├── application_item.h │ ├── application_item_selection_model.cpp │ ├── application_item_selection_model.h │ ├── application_ptr.h │ ├── bnd_utils.cpp │ ├── bnd_utils.h │ ├── brep_utils.cpp │ ├── brep_utils.h │ ├── caf_utils.cpp │ ├── caf_utils.h │ ├── cpp_utils.h │ ├── document.cpp │ ├── document.h │ ├── document_ptr.h │ ├── document_tree_node.cpp │ ├── document_tree_node.h │ ├── document_tree_node_properties_provider.cpp │ ├── document_tree_node_properties_provider.h │ ├── enumeration.cpp │ ├── enumeration.h │ ├── enumeration_fromenum.h │ ├── filepath.h │ ├── filepath_conv.h │ ├── geom_utils.cpp │ ├── geom_utils.h │ ├── global.h │ ├── io_format.cpp │ ├── io_format.h │ ├── io_parameters_provider.h │ ├── io_reader.cpp │ ├── io_reader.h │ ├── io_single_format_factory.h │ ├── io_system.cpp │ ├── io_system.h │ ├── io_writer.cpp │ ├── io_writer.h │ ├── label_data.cpp │ ├── label_data.h │ ├── libtree.h │ ├── math_utils.cpp │ ├── math_utils.h │ ├── mesh_access.cpp │ ├── mesh_access.h │ ├── mesh_utils.cpp │ ├── mesh_utils.h │ ├── messenger.cpp │ ├── messenger.h │ ├── messenger_client.cpp │ ├── messenger_client.h │ ├── meta_enum.h │ ├── occ_brep_mesh_parameters.h │ ├── occ_handle.h │ ├── occ_progress_indicator.cpp │ ├── occ_progress_indicator.h │ ├── occ_static_variables_rollback.cpp │ ├── occ_static_variables_rollback.h │ ├── occt_enums.cpp │ ├── occt_enums.h │ ├── point_cloud_data.cpp │ ├── point_cloud_data.h │ ├── property.cpp │ ├── property.h │ ├── property_builtins.cpp │ ├── property_builtins.h │ ├── property_enumeration.cpp │ ├── property_enumeration.h │ ├── property_value_conversion.cpp │ ├── property_value_conversion.h │ ├── quantity.cpp │ ├── quantity.h │ ├── settings.cpp │ ├── settings.h │ ├── settings_index.h │ ├── signal.cpp │ ├── signal.h │ ├── span.h │ ├── string_conv.cpp │ ├── string_conv.h │ ├── task_common.h │ ├── task_manager.cpp │ ├── task_manager.h │ ├── task_progress.cpp │ ├── task_progress.h │ ├── text_id.cpp │ ├── text_id.h │ ├── tkernel_utils.cpp │ ├── tkernel_utils.h │ ├── triangulation_annex_data.cpp │ ├── triangulation_annex_data.h │ ├── typed_scalar.h │ ├── unit.cpp │ ├── unit.h │ ├── unit_system.cpp │ ├── unit_system.h │ ├── xcaf.cpp │ └── xcaf.h ├── cli │ ├── cli_export.cpp │ ├── cli_export.h │ ├── console.cpp │ ├── console.h │ └── main.cpp ├── graphics │ ├── ais_text.cpp │ ├── ais_text.h │ ├── graphics_create_driver.cpp │ ├── graphics_create_virtual_window.cpp │ ├── graphics_mesh_data_source.cpp │ ├── graphics_mesh_data_source.h │ ├── graphics_mesh_object_driver.cpp │ ├── graphics_mesh_object_driver.h │ ├── graphics_object_driver.cpp │ ├── graphics_object_driver.h │ ├── graphics_object_ptr.h │ ├── graphics_owner_ptr.h │ ├── graphics_point_cloud_object_driver.cpp │ ├── graphics_point_cloud_object_driver.h │ ├── graphics_scene.cpp │ ├── graphics_scene.h │ ├── graphics_shape_object_driver.cpp │ ├── graphics_shape_object_driver.h │ ├── graphics_texture2d.h │ ├── graphics_utils.cpp │ ├── graphics_utils.h │ └── graphics_view_ptr.h ├── gui │ ├── gui_application.cpp │ ├── gui_application.h │ ├── gui_document.cpp │ ├── gui_document.h │ ├── gui_vkey_mouse.h │ ├── v3d_view_camera_animation.cpp │ ├── v3d_view_camera_animation.h │ ├── v3d_view_controller.cpp │ └── v3d_view_controller.h ├── io_assimp │ ├── io_assimp.cpp │ ├── io_assimp.h │ ├── io_assimp_reader.cpp │ └── io_assimp_reader.h ├── io_dxf │ ├── aci_table.h │ ├── dxf.cpp │ ├── dxf.h │ ├── freecad.h │ ├── io_dxf.cpp │ └── io_dxf.h ├── io_gmio │ ├── io_gmio.cpp │ ├── io_gmio.h │ ├── io_gmio_amf_writer.cpp │ └── io_gmio_amf_writer.h ├── io_image │ ├── io_image.cpp │ └── io_image.h ├── io_occ │ ├── io_occ.cpp │ ├── io_occ.h │ ├── io_occ_base_mesh.cpp │ ├── io_occ_base_mesh.h │ ├── io_occ_brep.cpp │ ├── io_occ_brep.h │ ├── io_occ_caf.cpp │ ├── io_occ_caf.h │ ├── io_occ_common.cpp │ ├── io_occ_common.h │ ├── io_occ_gltf_reader.cpp │ ├── io_occ_gltf_reader.h │ ├── io_occ_gltf_writer.cpp │ ├── io_occ_gltf_writer.h │ ├── io_occ_iges.cpp │ ├── io_occ_iges.h │ ├── io_occ_obj_reader.cpp │ ├── io_occ_obj_reader.h │ ├── io_occ_obj_writer.cpp │ ├── io_occ_obj_writer.h │ ├── io_occ_step.cpp │ ├── io_occ_step.h │ ├── io_occ_stl.cpp │ ├── io_occ_stl.h │ ├── io_occ_vrml_reader.cpp │ ├── io_occ_vrml_reader.h │ ├── io_occ_vrml_writer.cpp │ └── io_occ_vrml_writer.h ├── io_off │ ├── io_off_reader.cpp │ ├── io_off_reader.h │ ├── io_off_writer.cpp │ └── io_off_writer.h ├── io_ply │ ├── commit_miniply.txt │ ├── io_ply_reader.cpp │ ├── io_ply_reader.h │ ├── io_ply_writer.cpp │ ├── io_ply_writer.h │ ├── miniply.cpp │ └── miniply.h ├── mayo_config.h.cmake ├── mayo_version.h.cmake ├── measure │ ├── measure_display.cpp │ ├── measure_display.h │ ├── measure_tool.cpp │ ├── measure_tool.h │ ├── measure_tool_brep.cpp │ ├── measure_tool_brep.h │ └── measure_type.h ├── qtbackend │ ├── qsettings_storage.cpp │ ├── qsettings_storage.h │ ├── qt_animation_backend.cpp │ ├── qt_animation_backend.h │ ├── qt_app_translator.cpp │ ├── qt_app_translator.h │ ├── qt_signal_thread_helper.cpp │ └── qt_signal_thread_helper.h └── qtcommon │ ├── filepath_conv.h │ ├── log_message_handler.cpp │ ├── log_message_handler.h │ ├── qstring_conv.cpp │ ├── qstring_conv.h │ ├── qtcore_hfuncs.h │ ├── qtcore_utils.cpp │ └── qtcore_utils.h └── tests ├── inputs ├── #258_cube.off ├── #332_file.stp ├── cube.bin ├── cube.brep ├── cube.gltf ├── cube.iges ├── cube.mtl ├── cube.obj ├── cube.off ├── cube.ply ├── cube.step ├── cube.stla ├── cube.stlb ├── cube.wrl ├── face_trsf_scale_almost_1.stl └── mayo_bezier_curve.brep ├── qttest_utils.h ├── runtests.cpp ├── test_app.cpp ├── test_app.h ├── test_base.cpp ├── test_base.h ├── test_measure.cpp └── test_measure.h /.github/CI_OVERVIEW.md: -------------------------------------------------------------------------------- 1 | 2 | OS | Status 3 | ---------|--------------------------------------------------- 4 | Linux | [![Linux Arch x64](https://github.com/fougue/mayo/actions/workflows/ci_linux_arch.yml/badge.svg)](https://github.com/fougue/mayo/actions/workflows/ci_linux_arch.yml)
[![Linux Fedora x64](https://github.com/fougue/mayo/actions/workflows/ci_linux_fedora.yml/badge.svg)](https://github.com/fougue/mayo/actions/workflows/ci_linux_fedora.yml)
[![Linux Ubuntu armv7](https://github.com/fougue/mayo/actions/workflows/ci_linux_ubuntu_armv7.yml/badge.svg)](https://github.com/fougue/mayo/actions/workflows/ci_linux_ubuntu_armv7.yml)
[![Linux Ubuntu x64/arm64](https://github.com/fougue/mayo/actions/workflows/ci_linux_ubuntu.yml/badge.svg)](https://github.com/fougue/mayo/actions/workflows/ci_linux_ubuntu.yml) 5 | macOS | [![macOS arm64](https://github.com/fougue/mayo/actions/workflows/ci_macos.yml/badge.svg)](https://github.com/fougue/mayo/actions/workflows/ci_macos.yml)
[![macOS-conda arm64](https://github.com/fougue/mayo/actions/workflows/ci_macos_conda.yml/badge.svg)](https://github.com/fougue/mayo/actions/workflows/ci_macos_conda.yml) 6 | Windows | [![Windows x64](https://github.com/fougue/mayo/actions/workflows/ci_windows.yml/badge.svg)](https://github.com/fougue/mayo/actions/workflows/ci_windows.yml) 7 | -------------------------------------------------------------------------------- /.github/workflows/ci_linux_arch.yml: -------------------------------------------------------------------------------- 1 | name: Linux Arch x64 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build-archlinux: 7 | runs-on: ubuntu-latest 8 | name: build-archlinux-qt5 9 | 10 | steps: 11 | - name: Checkout 12 | uses: actions/checkout@v2 13 | with: 14 | path: 'mayo' 15 | 16 | - name: Setup Podman 17 | run: | 18 | sudo apt update 19 | sudo apt-get -y install podman 20 | podman pull docker.io/library/archlinux:latest 21 | 22 | - name: Create container and run build+tests 23 | run: | 24 | { 25 | echo 'FROM archlinux:latest' 26 | echo 'RUN pacman -Syu --noconfirm' 27 | echo 'RUN pacman -Sy --noconfirm make cmake git gcc' 28 | echo 'RUN pacman -Sy --noconfirm qt5-base qt5-svg xcb-util-cursor' 29 | echo 'RUN pacman -Sy --noconfirm opencascade libxi' 30 | echo 'RUN pacman -Sy --noconfirm assimp' 31 | echo 'COPY mayo mayo' 32 | echo 'RUN mkdir /mayo/build' 33 | echo 'WORKDIR /mayo/build' 34 | echo 'RUN cmake .. -DMayo_BuildTests=ON -DMayo_BuildPluginAssimp=ON' 35 | echo 'RUN cmake --build . --parallel --config Release' 36 | } > podmanfile 37 | podman build --tag archlinux-ci -f ./podmanfile 38 | -------------------------------------------------------------------------------- /.github/workflows/ci_linux_fedora.yml: -------------------------------------------------------------------------------- 1 | name: Linux Fedora x64 2 | 3 | on: [push] 4 | 5 | jobs: 6 | build-fedora: 7 | runs-on: ubuntu-latest 8 | name: build-fedora40-qt5 9 | 10 | steps: 11 | - name: Checkout 12 | uses: actions/checkout@v2 13 | with: 14 | path: 'mayo' 15 | 16 | - name: Setup Podman 17 | run: | 18 | sudo apt update 19 | sudo apt-get -y install podman 20 | podman pull fedora:40 21 | 22 | - name: Create container and run build+tests 23 | run: | 24 | { 25 | echo 'FROM fedora:40' 26 | echo 'RUN dnf -y update' 27 | echo 'RUN dnf -y install xorg-x11-server-Xvfb' 28 | echo 'RUN dnf -y install make cmake git gcc-c++' 29 | echo 'RUN dnf -y install qt5-qtbase qt5-qtsvg xcb-util-cursor' 30 | echo 'RUN dnf -y install opencascade-devel' 31 | echo 'RUN dnf -y install assimp assimp-devel' 32 | echo 'RUN dnf clean all' 33 | echo 'COPY mayo mayo' 34 | echo 'WORKDIR /mayo' 35 | echo 'RUN mkdir build' 36 | echo 'WORKDIR /mayo/build' 37 | echo 'RUN cmake .. -DMayo_BuildTests=ON -DMayo_BuildPluginAssimp=ON' 38 | echo 'RUN cmake --build . --parallel --config Release' 39 | #echo 'RUN Xvfb $DISPLAY -screen 0 1280x1024x24 &' 40 | #echo 'RUN sleep 5s' 41 | #echo 'RUN ./mayo --runtests' 42 | } > podmanfile 43 | podman build --tag fedora40-ci -f ./podmanfile 44 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | build-* 2 | *.user 3 | *.user.* 4 | custom.pri 5 | env.pri 6 | cmake/CustomSteps.cmake 7 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | BSD 2-Clause License 2 | 3 | Copyright (c) 2016, Fougue Ltd. 4 | All rights reserved. 5 | 6 | Redistribution and use in source and binary forms, with or without 7 | modification, are permitted provided that the following conditions 8 | are met: 9 | 10 | 1. Redistributions of source code must retain the above copyright 11 | notice, this list of conditions and the following disclaimer. 12 | 13 | 2. Redistributions in binary form must reproduce the above 14 | copyright notice, this list of conditions and the following 15 | disclaimer in the documentation and/or other materials provided 16 | with the distribution. 17 | 18 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 19 | "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 20 | LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 21 | A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 22 | OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 23 | SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 24 | LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 25 | DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 26 | THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 27 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /doc/screencast_1.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screencast_1.gif -------------------------------------------------------------------------------- /doc/screencast_cli.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screencast_cli.gif -------------------------------------------------------------------------------- /doc/screenshot_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_1.png -------------------------------------------------------------------------------- /doc/screenshot_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_2.png -------------------------------------------------------------------------------- /doc/screenshot_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_3.png -------------------------------------------------------------------------------- /doc/screenshot_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_4.png -------------------------------------------------------------------------------- /doc/screenshot_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_5.png -------------------------------------------------------------------------------- /doc/screenshot_6.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_6.png -------------------------------------------------------------------------------- /doc/screenshot_mayoconv_linux.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_mayoconv_linux.png -------------------------------------------------------------------------------- /doc/screenshot_ubuntu_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_ubuntu_1.png -------------------------------------------------------------------------------- /doc/screenshot_ubuntu_2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_ubuntu_2.png -------------------------------------------------------------------------------- /doc/screenshot_ubuntu_3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_ubuntu_3.png -------------------------------------------------------------------------------- /doc/screenshot_ubuntu_4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_ubuntu_4.png -------------------------------------------------------------------------------- /doc/screenshot_ubuntu_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_ubuntu_5.png -------------------------------------------------------------------------------- /doc/screenshot_ubuntu_main.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/screenshot_ubuntu_main.png -------------------------------------------------------------------------------- /doc/src_modules.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/src_modules.odg -------------------------------------------------------------------------------- /doc/src_modules.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/src_modules.png -------------------------------------------------------------------------------- /doc/win_cmake_01.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/win_cmake_01.png -------------------------------------------------------------------------------- /doc/win_cmake_02.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/win_cmake_02.png -------------------------------------------------------------------------------- /doc/win_cmake_03.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/win_cmake_03.png -------------------------------------------------------------------------------- /doc/win_cmake_04.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/win_cmake_04.png -------------------------------------------------------------------------------- /doc/win_cmake_05.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/win_cmake_05.png -------------------------------------------------------------------------------- /doc/win_cmake_06.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/win_cmake_06.png -------------------------------------------------------------------------------- /doc/win_msvc_mp.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/doc/win_msvc_mp.png -------------------------------------------------------------------------------- /i18n/i18n.pro: -------------------------------------------------------------------------------- 1 | HEADERS += \ 2 | $$files(../src/app/*.h) \ 3 | $$files(../src/app/windows/*.h) \ 4 | $$files(../src/base/*.h) \ 5 | $$files(../src/cli/*.h) \ 6 | $$files(../src/graphics/*.h) \ 7 | $$files(../src/gui/*.h) \ 8 | $$files(../src/io_assimp/*.h) \ 9 | $$files(../src/io_dxf/*.h) \ 10 | $$files(../src/io_gmio/*.h) \ 11 | $$files(../src/io_image/*.h) \ 12 | $$files(../src/io_occ/*.h) \ 13 | $$files(../src/io_off/*.h) \ 14 | $$files(../src/io_ply/*.h) \ 15 | $$files(../src/measure/*.h) \ 16 | 17 | 18 | SOURCES += \ 19 | $$files(../src/app/*.cpp) \ 20 | $$files(../src/app/windows/*.cpp) \ 21 | $$files(../src/base/*.cpp) \ 22 | $$files(../src/cli/*.cpp) \ 23 | $$files(../src/graphics/*.cpp) \ 24 | $$files(../src/gui/*.cpp) \ 25 | $$files(../src/io_assimp/*.cpp) \ 26 | $$files(../src/io_dxf/*.cpp) \ 27 | $$files(../src/io_gmio/*.cpp) \ 28 | $$files(../src/io_image/*.cpp) \ 29 | $$files(../src/io_occ/*.cpp) \ 30 | $$files(../src/io_off/*.cpp) \ 31 | $$files(../src/measure/*.cpp) \ 32 | \ 33 | messages.cpp \ 34 | 35 | FORMS += $$files(../src/app/*.ui) 36 | 37 | TRANSLATIONS += \ 38 | mayo_en.ts \ 39 | mayo_fr.ts \ 40 | mayo_zh.ts \ 41 | -------------------------------------------------------------------------------- /i18n/mayo.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | mayo_en.qm 4 | mayo_fr.qm 5 | mayo_zh.qm 6 | 7 | 8 | -------------------------------------------------------------------------------- /i18n/mayo_en.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/i18n/mayo_en.qm -------------------------------------------------------------------------------- /i18n/mayo_fr.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/i18n/mayo_fr.qm -------------------------------------------------------------------------------- /i18n/mayo_zh.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/i18n/mayo_zh.qm -------------------------------------------------------------------------------- /i18n/qt5base.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | qt5base_en.qm 4 | qt5base_fr.qm 5 | qt5base_zh.qm 6 | 7 | 8 | -------------------------------------------------------------------------------- /i18n/qt5base_en.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/i18n/qt5base_en.qm -------------------------------------------------------------------------------- /i18n/qt5base_fr.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/i18n/qt5base_fr.qm -------------------------------------------------------------------------------- /i18n/qt5base_zh.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/i18n/qt5base_zh.qm -------------------------------------------------------------------------------- /i18n/qt6base.qrc: -------------------------------------------------------------------------------- 1 | 2 | 3 | qt6base_en.qm 4 | qt6base_fr.qm 5 | qt6base_zh.qm 6 | 7 | 8 | -------------------------------------------------------------------------------- /i18n/qt6base_en.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/i18n/qt6base_en.qm -------------------------------------------------------------------------------- /i18n/qt6base_fr.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/i18n/qt6base_fr.qm -------------------------------------------------------------------------------- /i18n/qt6base_zh.qm: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/i18n/qt6base_zh.qm -------------------------------------------------------------------------------- /images/appicon.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/appicon.icns -------------------------------------------------------------------------------- /images/appicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/appicon.ico -------------------------------------------------------------------------------- /images/appicon.rc: -------------------------------------------------------------------------------- 1 | IDI_ICON1 ICON DISCARDABLE "appicon.ico" -------------------------------------------------------------------------------- /images/appicon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /images/appicon_128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/appicon_128.png -------------------------------------------------------------------------------- /images/appicon_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/appicon_16.png -------------------------------------------------------------------------------- /images/appicon_24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/appicon_24.png -------------------------------------------------------------------------------- /images/appicon_256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/appicon_256.png -------------------------------------------------------------------------------- /images/appicon_32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/appicon_32.png -------------------------------------------------------------------------------- /images/appicon_64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/appicon_64.png -------------------------------------------------------------------------------- /images/graphics/opencascade_hatch_1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/graphics/opencascade_hatch_1.png -------------------------------------------------------------------------------- /images/themes/classic/add-file.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/themes/classic/back-square.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /images/themes/classic/back.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /images/themes/classic/cross.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /images/themes/classic/edit.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /images/themes/classic/expand.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 9 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /images/themes/classic/grid.svg: -------------------------------------------------------------------------------- 1 | frame-grid -------------------------------------------------------------------------------- /images/themes/classic/indicator-down-disabled_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/themes/classic/indicator-down-disabled_8.png -------------------------------------------------------------------------------- /images/themes/classic/indicator-down_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/themes/classic/indicator-down_8.png -------------------------------------------------------------------------------- /images/themes/classic/item-mesh.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /images/themes/classic/left-sidebar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /images/themes/classic/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /images/themes/classic/measure.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/themes/classic/next.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /images/themes/classic/open-files.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/themes/classic/reload.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /images/themes/classic/stop.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /images/themes/classic/turn-ccw.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/themes/classic/turn-cw.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/themes/dark/back-square.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /images/themes/dark/back.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /images/themes/dark/camera.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 12 | 13 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /images/themes/dark/cross.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /images/themes/dark/edit.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /images/themes/dark/expand.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 9 | 11 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /images/themes/dark/export.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /images/themes/dark/file.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /images/themes/dark/grid.svg: -------------------------------------------------------------------------------- 1 | frame-grid -------------------------------------------------------------------------------- /images/themes/dark/import.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 9 | 10 | 11 | 12 | 13 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | -------------------------------------------------------------------------------- /images/themes/dark/indicator-down-disabled_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/themes/dark/indicator-down-disabled_8.png -------------------------------------------------------------------------------- /images/themes/dark/indicator-down_8.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/themes/dark/indicator-down_8.png -------------------------------------------------------------------------------- /images/themes/dark/item-mesh.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /images/themes/dark/item-xde.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 9 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /images/themes/dark/left-sidebar.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /images/themes/dark/link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | -------------------------------------------------------------------------------- /images/themes/dark/measure.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/themes/dark/next.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /images/themes/dark/reload.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | -------------------------------------------------------------------------------- /images/themes/dark/stop.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /images/themes/dark/turn-ccw.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/themes/dark/turn-cw.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /images/themes/dark/zoom-in.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /images/themes/dark/zoom-out.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 5 | 6 | 7 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /images/widget_pseudo_fold.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/widget_pseudo_fold.png -------------------------------------------------------------------------------- /images/xde_reference_16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/images/xde_reference_16.png -------------------------------------------------------------------------------- /scripts/bump-version.rb: -------------------------------------------------------------------------------- 1 | ## 2 | ## Copyright (c) 2021, Fougue Ltd. 3 | ## All rights reserved. 4 | ## See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ## 6 | 7 | #!/usr/bin/ruby 8 | 9 | if ARGV.empty? 10 | puts "Error: no version argument" 11 | return 12 | end 13 | 14 | version_array = ARGV.first.split('.') 15 | if version_array.size != 3 16 | puts "Error: wrong version format(maj.min.patch)" 17 | return 18 | end 19 | 20 | major = version_array[0] 21 | minor = version_array[1] 22 | patch = version_array[2] 23 | puts "Major: #{major}" 24 | puts "Minor: #{minor}" 25 | puts "Patch: #{patch}" 26 | scripts_dir_name = File.expand_path(File.dirname(__FILE__)) 27 | 28 | # ../README.md 29 | path_README_md = "#{scripts_dir_name}/../README.md" 30 | README_md = File.open(path_README_md, "r").read 31 | README_md.sub!(/(img.shields.io\/badge\/version-v)\d+\.\d+.\d+/, "\\1#{major}.#{minor}.#{patch}") 32 | README_md.sub!(/(Mayo_VersionMinor\s+)\d+/, "\\1#{minor}") 33 | README_md.sub!(/(Mayo_VersionPatch\s+)\d+/, "\\1#{patch}") 34 | File.open(path_README_md, "w").write(README_md) 35 | puts "Bumped #{path_README_md}" 36 | 37 | # ../CMakeLists.txt 38 | path_CMakeLists_txt = "#{scripts_dir_name}/../CMakeLists.txt" 39 | CMakeLists_txt = File.open(path_CMakeLists_txt, "r").read 40 | CMakeLists_txt.sub!(/(Mayo_VersionMajor\s+)\d+/, "\\1#{major}") 41 | CMakeLists_txt.sub!(/(Mayo_VersionMinor\s+)\d+/, "\\1#{minor}") 42 | CMakeLists_txt.sub!(/(Mayo_VersionPatch\s+)\d+/, "\\1#{patch}") 43 | File.open(path_CMakeLists_txt, "w").write(CMakeLists_txt) 44 | puts "Bumped #{path_CMakeLists_txt}" 45 | -------------------------------------------------------------------------------- /scripts/release-i18n.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set DIR_SCRIPTS=%~dp0 4 | lrelease-pro %DIR_SCRIPTS%\..\i18n\i18n.pro 5 | -------------------------------------------------------------------------------- /scripts/update-i18n.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | set DIR_SCRIPTS=%~dp0 4 | lupdate -tr-function-alias ^ 5 | QT_TRANSLATE_NOOP+=MAYO_TEXT_ID,^ 6 | Q_DECLARE_TR_FUNCTIONS+=MAYO_DECLARE_TEXT_ID_FUNCTIONS,^ 7 | tr+=textId,^ 8 | tr+=textIdTr^ 9 | %DIR_SCRIPTS%\..\i18n\i18n.pro 10 | 11 | rem lupdate -no-obsolete 12 | -------------------------------------------------------------------------------- /src/3rdparty/commit_fast_float.txt: -------------------------------------------------------------------------------- 1 | 6c97156f6de7a40119a2f1a4913a457e69d34b12 2 | -------------------------------------------------------------------------------- /src/3rdparty/commit_fmt.txt: -------------------------------------------------------------------------------- 1 | 18a325f370ffd5ec1eda0087d2efc3dc9b3faf56 2 | -------------------------------------------------------------------------------- /src/3rdparty/commit_gsl.txt: -------------------------------------------------------------------------------- 1 | ef0ffefe525a6219ff245d19a832ce06f3fd3504 2 | -------------------------------------------------------------------------------- /src/3rdparty/commit_kdbindings.txt: -------------------------------------------------------------------------------- 1 | 055b3fa320e98516555e68f36d8529e24ee9d60e 2 | Branch main -------------------------------------------------------------------------------- /src/3rdparty/commit_magic_enum.txt: -------------------------------------------------------------------------------- 1 | ec11ae0c285773e691a1e8372e4984189a6bed1e 2 | -------------------------------------------------------------------------------- /src/3rdparty/fmt/core.h: -------------------------------------------------------------------------------- 1 | // This file is only provided for compatibility and may be removed in future 2 | // versions. Use fmt/base.h if you don't need fmt::format and fmt/format.h 3 | // otherwise. 4 | 5 | #include "format.h" 6 | -------------------------------------------------------------------------------- /src/3rdparty/fmt/src/format.cc: -------------------------------------------------------------------------------- 1 | // Formatting library for C++ 2 | // 3 | // Copyright (c) 2012 - 2016, Victor Zverovich 4 | // All rights reserved. 5 | // 6 | // For the license information refer to format.h. 7 | 8 | #include "fmt/format-inl.h" 9 | 10 | FMT_BEGIN_NAMESPACE 11 | namespace detail { 12 | 13 | template FMT_API auto dragonbox::to_decimal(float x) noexcept 14 | -> dragonbox::decimal_fp; 15 | template FMT_API auto dragonbox::to_decimal(double x) noexcept 16 | -> dragonbox::decimal_fp; 17 | 18 | #ifndef FMT_STATIC_THOUSANDS_SEPARATOR 19 | template FMT_API locale_ref::locale_ref(const std::locale& loc); 20 | template FMT_API auto locale_ref::get() const -> std::locale; 21 | #endif 22 | 23 | // Explicit instantiations for char. 24 | 25 | template FMT_API auto thousands_sep_impl(locale_ref) 26 | -> thousands_sep_result; 27 | template FMT_API auto decimal_point_impl(locale_ref) -> char; 28 | 29 | template FMT_API void buffer::append(const char*, const char*); 30 | 31 | template FMT_API void vformat_to(buffer&, string_view, 32 | typename vformat_args<>::type, locale_ref); 33 | 34 | // Explicit instantiations for wchar_t. 35 | 36 | template FMT_API auto thousands_sep_impl(locale_ref) 37 | -> thousands_sep_result; 38 | template FMT_API auto decimal_point_impl(locale_ref) -> wchar_t; 39 | 40 | template FMT_API void buffer::append(const wchar_t*, const wchar_t*); 41 | 42 | } // namespace detail 43 | FMT_END_NAMESPACE 44 | -------------------------------------------------------------------------------- /src/3rdparty/gsl/gsl: -------------------------------------------------------------------------------- 1 | /////////////////////////////////////////////////////////////////////////////// 2 | // 3 | // Copyright (c) 2015 Microsoft Corporation. All rights reserved. 4 | // 5 | // This code is licensed under the MIT License (MIT). 6 | // 7 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 8 | // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 9 | // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 10 | // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 11 | // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 12 | // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 13 | // THE SOFTWARE. 14 | // 15 | /////////////////////////////////////////////////////////////////////////////// 16 | 17 | #ifndef GSL_GSL_H 18 | #define GSL_GSL_H 19 | 20 | #include // copy 21 | #include // Ensures/Expects 22 | #include // byte 23 | #include // owner, not_null 24 | #include // span 25 | #include // zstring, string_span, zstring_builder... 26 | #include // finally()/narrow_cast()... 27 | 28 | #ifdef __cpp_exceptions 29 | #include // narrow() 30 | #endif 31 | 32 | #endif // GSL_GSL_H 33 | -------------------------------------------------------------------------------- /src/3rdparty/gsl/gsl_algorithm: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma message("This header will soon be removed. Use instead of ") 3 | #include 4 | -------------------------------------------------------------------------------- /src/3rdparty/gsl/gsl_assert: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma message("This header will soon be removed. Use instead of ") 3 | #include 4 | -------------------------------------------------------------------------------- /src/3rdparty/gsl/gsl_byte: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma message("This header will soon be removed. Use instead of ") 3 | #include 4 | -------------------------------------------------------------------------------- /src/3rdparty/gsl/gsl_narrow: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma message("This header will soon be removed. Use instead of ") 3 | #include 4 | -------------------------------------------------------------------------------- /src/3rdparty/gsl/gsl_util: -------------------------------------------------------------------------------- 1 | #pragma once 2 | #pragma message("This header will soon be removed. Use instead of ") 3 | #include 4 | -------------------------------------------------------------------------------- /src/app/app_context.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "commands_api.h" 10 | 11 | namespace Mayo { 12 | 13 | class MainWindow; 14 | class WidgetGuiDocument; 15 | 16 | // Provides implementation of IAppContext based on MainWindow 17 | class AppContext : public IAppContext { 18 | public: 19 | AppContext(MainWindow* wnd); 20 | 21 | GuiApplication* guiApp() const override; 22 | TaskManager* taskMgr() const override; 23 | V3dViewController* v3dViewController(const GuiDocument* guiDoc) const override; 24 | 25 | QWidget* widgetMain() const override; 26 | QWidget* widgetPage(Page page) const override; 27 | Page currentPage() const override; 28 | void setCurrentPage(Page page) override; 29 | QWidget* pageDocuments_widgetLeftSideBar() const override; 30 | 31 | int findDocumentIndex(Document::Identifier docId) const override; 32 | Document::Identifier findDocumentFromIndex(int index) const override; 33 | 34 | Document::Identifier currentDocument() const override; 35 | void setCurrentDocument(Document::Identifier docId) override; 36 | 37 | void updateControlsEnabledStatus() override; 38 | 39 | private: 40 | WidgetGuiDocument* widgetGuiDocument(int idx) const; 41 | WidgetGuiDocument* findWidgetGuiDocument(std::function fn) const; 42 | 43 | void onCurrentDocumentIndexChanged(int docIndex); 44 | 45 | MainWindow* m_wnd = nullptr; 46 | }; 47 | 48 | } // namespace Mayo 49 | -------------------------------------------------------------------------------- /src/app/app_ui_state.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/property_builtins.h" 10 | #include "../base/span.h" 11 | 12 | #include 13 | 14 | namespace Mayo { 15 | 16 | // Stores the UI state of the main application widgets 17 | struct AppUiState { 18 | std::vector mainWindowGeometry; // Provided by QWidget::saveGeometry() 19 | bool pageDocuments_isLeftSideBarVisible = true; 20 | double pageDocuments_widgetLeftSideBarWidthFactor = 0.25; 21 | 22 | // Serialization functions 23 | static std::vector toBlob(const AppUiState& state); 24 | static AppUiState fromBlob(Span blob, bool* ok = nullptr); 25 | }; 26 | using PropertyAppUiState = GenericProperty; 27 | 28 | } // namespace Mayo 29 | -------------------------------------------------------------------------------- /src/app/command_system_information_occopengl.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | // Auxiliary file to avoid OpenGL macros collisions between Qt and OpenCascade headers. 10 | 11 | #include 12 | #include 13 | #include 14 | 15 | namespace Mayo::Internal { 16 | 17 | using InfoValue = std::variant; 18 | std::map getOccOpenGlInfos(); 19 | 20 | } // namespace Mayo::Internal 21 | -------------------------------------------------------------------------------- /src/app/commands_help.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "commands_help.h" 8 | 9 | #include "app_module.h" 10 | #include "dialog_about.h" 11 | #include "library_info.h" 12 | #include "qtwidgets_utils.h" 13 | #include "../qtcommon/qstring_conv.h" 14 | 15 | #include 16 | #include 17 | #include 18 | #include 19 | 20 | namespace Mayo { 21 | 22 | CommandReportBug::CommandReportBug(IAppContext* context) 23 | : Command(context) 24 | { 25 | auto action = new QAction(this); 26 | action->setText(Command::tr("Report Bug")); 27 | this->setAction(action); 28 | } 29 | 30 | void CommandReportBug::execute() 31 | { 32 | QDesktopServices::openUrl(QUrl(QStringLiteral("https://github.com/fougue/mayo/issues"))); 33 | } 34 | 35 | CommandAbout::CommandAbout(IAppContext* context) 36 | : Command(context) 37 | { 38 | auto action = new QAction(this); 39 | action->setText(Command::tr("About %1").arg(QCoreApplication::applicationName())); 40 | this->setAction(action); 41 | } 42 | 43 | void CommandAbout::execute() 44 | { 45 | auto dlg = new DialogAbout(this->widgetMain()); 46 | for (const LibraryInfo& libInfo : AppModule::get()->libraryInfoArray()) 47 | dlg->addLibraryInfo(libInfo.name, libInfo.version); 48 | 49 | QtWidgetsUtils::asyncDialogExec(dlg); 50 | } 51 | 52 | } // namespace Mayo 53 | -------------------------------------------------------------------------------- /src/app/commands_help.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "commands_api.h" 10 | 11 | namespace Mayo { 12 | 13 | class CommandReportBug : public Command { 14 | public: 15 | CommandReportBug(IAppContext* context); 16 | void execute() override; 17 | 18 | static constexpr std::string_view Name = "report-bug"; 19 | }; 20 | 21 | class CommandSystemInformation : public Command { 22 | public: 23 | CommandSystemInformation(IAppContext* context); 24 | void execute() override; 25 | 26 | static QString data(); 27 | static constexpr std::string_view Name = "system-info"; 28 | }; 29 | 30 | class CommandAbout : public Command { 31 | public: 32 | CommandAbout(IAppContext* context); 33 | void execute() override; 34 | 35 | static constexpr std::string_view Name = "about"; 36 | }; 37 | 38 | } // namespace Mayo 39 | -------------------------------------------------------------------------------- /src/app/commands_tools.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "commands_api.h" 10 | 11 | namespace Mayo { 12 | 13 | class CommandSaveViewImage : public Command { 14 | public: 15 | CommandSaveViewImage(IAppContext* context); 16 | void execute() override; 17 | bool getEnabledStatus() const override; 18 | 19 | static constexpr std::string_view Name = "save-view-image"; 20 | }; 21 | 22 | class CommandInspectXde : public Command { 23 | public: 24 | CommandInspectXde(IAppContext* context); 25 | void execute() override; 26 | bool getEnabledStatus() const override; 27 | 28 | static constexpr std::string_view Name = "inspect-xde"; 29 | }; 30 | 31 | class CommandEditOptions : public Command { 32 | public: 33 | CommandEditOptions(IAppContext* context); 34 | void execute() override; 35 | 36 | static constexpr std::string_view Name = "edit-options"; 37 | }; 38 | 39 | } // namespace Mayo 40 | -------------------------------------------------------------------------------- /src/app/dialog_about.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | 12 | namespace Mayo { 13 | 14 | class DialogAbout : public QDialog { 15 | Q_OBJECT 16 | public: 17 | DialogAbout(QWidget* parent = nullptr); 18 | ~DialogAbout(); 19 | 20 | void addLibraryInfo(std::string_view libName, std::string_view libVersion); 21 | 22 | private: 23 | class Ui_DialogAbout* m_ui = nullptr; 24 | }; 25 | 26 | } // namespace Mayo 27 | -------------------------------------------------------------------------------- /src/app/dialog_inspect_xde.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/occ_handle.h" 10 | #include 11 | #include 12 | class QTreeWidgetItem; 13 | 14 | namespace Mayo { 15 | 16 | class DialogInspectXde : public QDialog { 17 | Q_OBJECT 18 | public: 19 | DialogInspectXde(QWidget* parent = nullptr); 20 | ~DialogInspectXde(); 21 | 22 | void load(const OccHandle& doc); 23 | 24 | private: 25 | void onLabelTreeWidgetItemClicked(QTreeWidgetItem* item, int column); 26 | 27 | class Ui_DialogInspectXde* m_ui = nullptr; 28 | OccHandle m_doc; 29 | }; 30 | 31 | } // namespace Mayo 32 | -------------------------------------------------------------------------------- /src/app/dialog_save_image_view.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/occ_handle.h" 10 | #include 11 | #include 12 | 13 | class Image_PixMap; 14 | 15 | namespace Mayo { 16 | 17 | class DialogSaveImageView : public QDialog { 18 | Q_OBJECT 19 | public: 20 | DialogSaveImageView(const OccHandle& view, QWidget* parent = nullptr); 21 | ~DialogSaveImageView(); 22 | 23 | private: 24 | void saveFile(); 25 | void clipboardCopy(); 26 | void preview(); 27 | 28 | bool createImageView(Image_PixMap* img) const; 29 | 30 | class Ui_DialogSaveImageView* m_ui = nullptr; 31 | OccHandle m_view; 32 | }; 33 | 34 | } // namespace Mayo 35 | -------------------------------------------------------------------------------- /src/app/dialog_task_manager.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/task_common.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace Mayo { 15 | 16 | class TaskManager; 17 | 18 | class DialogTaskManager : public QDialog { 19 | Q_OBJECT 20 | public: 21 | DialogTaskManager(TaskManager* taskMgr, QWidget* parent = nullptr); 22 | ~DialogTaskManager(); 23 | 24 | private: 25 | class TaskWidget; 26 | TaskWidget* taskWidget(TaskId taskId); 27 | 28 | void onTaskStarted(TaskId taskId); 29 | void onTaskEnded(TaskId taskId); 30 | void onTaskProgress(TaskId taskId, int percent); 31 | void onTaskProgressStep(TaskId taskId, std::string_view name); 32 | void interruptTask(); 33 | 34 | class Ui_DialogTaskManager* m_ui = nullptr; 35 | TaskManager* m_taskMgr = nullptr; 36 | std::unordered_map m_taskIdToWidget; 37 | bool m_isRunning = false; 38 | unsigned m_taskCount = 0; 39 | }; 40 | 41 | } // namespace Mayo 42 | -------------------------------------------------------------------------------- /src/app/document_property_group.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/property_builtins.h" 10 | #include "../base/document.h" 11 | 12 | namespace Mayo { 13 | 14 | // Provides relevant properties for a Document object 15 | // TODO Connect to Document "changed" signals to update the properties 16 | class DocumentPropertyGroup : public PropertyGroup { 17 | MAYO_DECLARE_TEXT_ID_FUNCTIONS(Mayo::DocumentPropertyGroup) 18 | public: 19 | DocumentPropertyGroup(const DocumentPtr& doc); 20 | 21 | PropertyFilePath filePath{ this, textId("filepath") }; 22 | PropertyString strFileSize{ this, textId("fileSize") }; 23 | PropertyString strCreatedDateTime{ this, textId("createdDateTime") }; 24 | PropertyString strModifiedDateTime{ this, textId("modifiedDateTime") }; 25 | PropertyString strOwner{ this, textId("owner") }; 26 | PropertyInt entityCount{ this, textId("entityCount") }; 27 | }; 28 | 29 | } // namespace Mayo 30 | -------------------------------------------------------------------------------- /src/app/document_tree_node_properties_providers.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/document_tree_node_properties_provider.h" 10 | #include "../base/property_builtins.h" 11 | 12 | #include 13 | 14 | namespace Mayo { 15 | 16 | // Provides relevant properties for tree node pointing to XCAF data 17 | class XCaf_DocumentTreeNodePropertiesProvider : public DocumentTreeNodePropertiesProvider { 18 | public: 19 | bool supports(const DocumentTreeNode& treeNode) const override; 20 | std::unique_ptr properties(const DocumentTreeNode& treeNode) const override; 21 | 22 | private: 23 | class Properties; 24 | }; 25 | 26 | // Provides relevant properties for tree node pointing to mesh data 27 | class Mesh_DocumentTreeNodePropertiesProvider : public DocumentTreeNodePropertiesProvider { 28 | public: 29 | bool supports(const DocumentTreeNode& treeNode) const override; 30 | std::unique_ptr properties(const DocumentTreeNode& treeNode) const override; 31 | 32 | private: 33 | class Properties; 34 | }; 35 | 36 | class PointCloud_DocumentTreeNodePropertiesProvider : public DocumentTreeNodePropertiesProvider { 37 | public: 38 | bool supports(const DocumentTreeNode& treeNode) const override; 39 | std::unique_ptr properties(const DocumentTreeNode& treeNode) const override; 40 | 41 | private: 42 | class Properties; 43 | }; 44 | 45 | } // namespace Mayo 46 | -------------------------------------------------------------------------------- /src/app/gui_document_list_model.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/document_ptr.h" 10 | #include 11 | #include 12 | 13 | namespace Mayo { 14 | 15 | class GuiApplication; 16 | class GuiDocument; 17 | 18 | // Provides a Qt item model of the documents owned by a GuiApplication object 19 | // Contents is automatically updated in reaction of Application and GuiApplication signals 20 | class GuiDocumentListModel : public QAbstractListModel { 21 | public: 22 | GuiDocumentListModel(const GuiApplication* guiApp, QObject* parent = nullptr); 23 | 24 | QVariant data(const QModelIndex& index, int role) const override; 25 | int rowCount(const QModelIndex& parent = QModelIndex()) const override; 26 | 27 | private: 28 | void appendGuiDocument(const GuiDocument* guiDoc); 29 | void removeGuiDocument(const GuiDocument* guiDoc); 30 | void onDocumentNameChanged(const DocumentPtr& doc, const std::string& name); 31 | 32 | std::vector m_vecGuiDocument; 33 | }; 34 | 35 | } // namespace Mayo 36 | -------------------------------------------------------------------------------- /src/app/iwidget_main_page.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | namespace Mayo { 12 | 13 | class CommandContainer; 14 | 15 | // Provides an interface for main pages within the Mayo application 16 | // At its core, Mayo UI is basically a stack of widgets 17 | // Such widgets are called "main pages" or just "pages" and only a single one is active at a time 18 | class IWidgetMainPage : public QWidget { 19 | Q_OBJECT 20 | public: 21 | // Builds UI objects(eg this might calls setupUi() on Qt-generated widgets) 22 | IWidgetMainPage(QWidget* parent = nullptr) 23 | : QWidget(parent) 24 | {} 25 | 26 | // Completes initialization of the page(eg by linking some buttons to existing commands) 27 | virtual void initialize(const CommandContainer* cmdContainer) = 0; 28 | 29 | // Update the activation("enabled" status) of the controls(ie any widget) belonging to this page 30 | virtual void updatePageControlsActivation() = 0; 31 | 32 | signals: 33 | // Signal emitted when a "global" or "complete" activation at the whole application level is 34 | // required by this page 35 | // This might, for example, be consecutive to event internal to this page 36 | void updateGlobalControlsActivationRequired(); 37 | }; 38 | 39 | } // namespace Mayo 40 | -------------------------------------------------------------------------------- /src/app/library_info.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | namespace Mayo { 12 | 13 | // Provides information about a 3rd-party library used by the application 14 | struct LibraryInfo { 15 | // Precise name of the library 16 | std::string name; 17 | // Version string, can be codenamed and/or semantic 18 | std::string version; 19 | // Addition details about the version, such as compilation flags 20 | std::string versionDetails; 21 | }; 22 | 23 | } // namespace Mayo 24 | -------------------------------------------------------------------------------- /src/app/property_editor_factory.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/unit_system.h" 10 | 11 | #include 12 | class QWidget; 13 | 14 | namespace Mayo { 15 | 16 | class BasePropertyQuantity; 17 | class Property; 18 | 19 | // Provides widgets for editing Property objects within views and delegates 20 | class IPropertyEditorFactory { 21 | public: 22 | virtual ~IPropertyEditorFactory() = default; 23 | 24 | virtual QWidget* createEditor(Property* property, QWidget* parentWidget) const = 0; 25 | virtual void syncEditorWithProperty(QWidget* editor) const = 0; 26 | 27 | // Helpers 28 | static UnitSystem::TranslateResult unitTranslate(const BasePropertyQuantity* property); 29 | static QPixmap colorSquarePixmap(const QColor& c, int sideLen = 16); 30 | }; 31 | 32 | class DefaultPropertyEditorFactory : public IPropertyEditorFactory { 33 | public: 34 | QWidget* createEditor(Property* property, QWidget* parentWidget) const override; 35 | void syncEditorWithProperty(QWidget* editor) const override; 36 | }; 37 | 38 | } // namespace Mayo 39 | -------------------------------------------------------------------------------- /src/app/qmeta_property.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/property.h" 10 | #include 11 | Q_DECLARE_METATYPE(Mayo::Property*) 12 | Q_DECLARE_METATYPE(const Mayo::Property*) 13 | -------------------------------------------------------------------------------- /src/app/qmeta_tdf_label.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | Q_DECLARE_METATYPE(TDF_Label) 12 | -------------------------------------------------------------------------------- /src/app/qstring_utils.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/global.h" 10 | #include "../base/unit_system.h" 11 | #include 12 | #include 13 | #include 14 | #include 15 | class Quantity_Color; 16 | class gp_Pnt; 17 | class gp_Dir; 18 | class gp_Trsf; 19 | 20 | namespace Mayo { 21 | 22 | class QStringUtils { 23 | Q_DECLARE_TR_FUNCTIONS(Mayo::QStringUtils) 24 | public: 25 | struct TextOptions { 26 | QLocale locale; 27 | UnitSystem::Schema unitSchema; 28 | int unitDecimals; 29 | }; 30 | 31 | // TODO add overload for 'int' type 32 | static QString text(double value, const TextOptions& opt); 33 | static QString text(const gp_Pnt& pos, const TextOptions& opt); 34 | static QString text(const gp_Dir& pos, const TextOptions& opt); 35 | static QString text(const gp_Trsf& trsf, const TextOptions& opt); 36 | static QString text(const Quantity_Color& color, const QString& format = "RGB(%1, %2 %3)"); 37 | 38 | static QString bytesText(uint64_t sizeBytes, const QLocale& locale = QLocale()); 39 | 40 | static QString yesNoText(bool on); 41 | static QString yesNoText(CheckState state); 42 | 43 | static void append(QString* dst, const QString& str, const QLocale& locale = QLocale()); 44 | }; 45 | 46 | } // namespace Mayo 47 | -------------------------------------------------------------------------------- /src/app/recent_files.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/filepath.h" 10 | #include "../base/property_builtins.h" 11 | 12 | #include 13 | 14 | #include 15 | 16 | namespace Mayo { 17 | 18 | class GuiDocument; 19 | 20 | struct Thumbnail { 21 | QByteArray imageData; // PNG 22 | int64_t imageCacheKey = -1; 23 | }; 24 | 25 | // Provides information about a "recently" opened file 26 | struct RecentFile { 27 | FilePath filepath; 28 | Thumbnail thumbnail; 29 | int64_t thumbnailTimestamp = 0; 30 | bool isThumbnailOutOfSync() const; 31 | static int64_t timestampLastModified(const FilePath& fp); 32 | }; 33 | 34 | // Alias for "array of RecentFile objects" 35 | using RecentFiles = std::vector; 36 | 37 | // Alias for Property type owning an array of RecentFile objects 38 | // This is useful to store recent files into application settings 39 | using PropertyRecentFiles = GenericProperty; 40 | 41 | bool operator==(const RecentFile& lhs, const RecentFile& rhs); 42 | 43 | } // namespace Mayo 44 | -------------------------------------------------------------------------------- /src/app/view3d_navigation_style.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | namespace Mayo { 10 | 11 | enum class View3dNavigationStyle { 12 | Mayo, Catia, SolidWorks, Unigraphics, ProEngineer 13 | }; 14 | 15 | } // namespace Mayo 16 | -------------------------------------------------------------------------------- /src/app/widget_explode_assembly.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "widget_explode_assembly.h" 8 | #include "ui_widget_explode_assembly.h" 9 | #include "../gui/gui_document.h" 10 | 11 | #include 12 | 13 | namespace Mayo { 14 | 15 | WidgetExplodeAssembly::WidgetExplodeAssembly(GuiDocument* guiDoc, QWidget* parent) 16 | : QWidget(parent), 17 | m_ui(new Ui_WidgetExplodeAssembly), 18 | m_guiDoc(guiDoc) 19 | { 20 | m_ui->setupUi(this); 21 | 22 | QObject::connect(m_ui->slider_Factor, &QSlider::valueChanged, this, [=](int pct) { 23 | QSignalBlocker sigBlock(m_ui->edit_Factor); 24 | m_ui->edit_Factor->setValue(pct); 25 | m_guiDoc->setExplodingFactor(pct / 100.); 26 | }); 27 | QObject::connect(m_ui->edit_Factor, qOverload(&QSpinBox::valueChanged), this, [=](int pct) { 28 | QSignalBlocker sigBlock(m_ui->slider_Factor); 29 | m_ui->slider_Factor->setValue(pct); 30 | m_guiDoc->setExplodingFactor(pct / 100.); 31 | }); 32 | } 33 | 34 | WidgetExplodeAssembly::~WidgetExplodeAssembly() 35 | { 36 | delete m_ui; 37 | } 38 | 39 | } // namespace Mayo 40 | -------------------------------------------------------------------------------- /src/app/widget_explode_assembly.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | namespace Mayo { 12 | 13 | class GuiDocument; 14 | 15 | // Widget panel dedicated to exploding of assemblies within a GuiDocument object 16 | class WidgetExplodeAssembly : public QWidget { 17 | Q_OBJECT 18 | public: 19 | WidgetExplodeAssembly(GuiDocument* guiDoc, QWidget* parent = nullptr); 20 | ~WidgetExplodeAssembly(); 21 | 22 | private: 23 | class Ui_WidgetExplodeAssembly* m_ui= nullptr; 24 | GuiDocument* m_guiDoc = nullptr; 25 | }; 26 | 27 | } // namespace Mayo 28 | -------------------------------------------------------------------------------- /src/app/widget_explode_assembly.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Mayo::WidgetExplodeAssembly 4 | 5 | 6 | 7 | 0 8 | 0 9 | 160 10 | 30 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 4 19 | 20 | 21 | 4 22 | 23 | 24 | 4 25 | 26 | 27 | 4 28 | 29 | 30 | 31 | 32 | 100 33 | 34 | 35 | Qt::Horizontal 36 | 37 | 38 | 39 | 40 | 41 | 42 | % 43 | 44 | 45 | 100 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /src/app/widget_file_system.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include 12 | class QTreeWidget; 13 | class QTreeWidgetItem; 14 | 15 | namespace Mayo { 16 | 17 | class WidgetFileSystem : public QWidget { 18 | Q_OBJECT 19 | public: 20 | WidgetFileSystem(QWidget* parent = nullptr); 21 | 22 | QFileInfo currentLocation() const; 23 | void setLocation(const QFileInfo& fiLoc); 24 | 25 | signals: 26 | void locationActivated(const QFileInfo& loc); 27 | 28 | private: 29 | void onTreeItemActivated(QTreeWidgetItem* item, int column); 30 | void setCurrentFolder(const QDir& dir); 31 | void selectFileInCurrentFolder(const QString& fileName); 32 | 33 | QTreeWidget* m_treeWidget = nullptr; 34 | QFileInfo m_location; 35 | QFileIconProvider m_fileIconProvider; 36 | }; 37 | 38 | } // namespace Mayo 39 | -------------------------------------------------------------------------------- /src/app/widget_grid.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../graphics/graphics_view_ptr.h" 10 | 11 | #include 12 | class gp_Ax2; 13 | 14 | namespace Mayo { 15 | 16 | // Widget panel dedicated to management of the grid in 3D view 17 | class WidgetGrid : public QWidget { 18 | Q_OBJECT 19 | public: 20 | WidgetGrid(GraphicsViewPtr viewPtr, QWidget* parent = nullptr); 21 | ~WidgetGrid(); 22 | 23 | signals: 24 | void sizeAdjustmentRequested(); 25 | 26 | private: 27 | enum class GridColorType { Base, Tenth }; 28 | 29 | static Aspect_GridType toGridType(int comboBoxItemIndex); 30 | static Aspect_GridDrawMode toGridDrawMode(int comboBoxItemIndex); 31 | static const gp_Ax2& toPlaneAxis(int comboBoxItemIndex); 32 | 33 | void activateGrid(bool on); 34 | void applyGridParams(); 35 | void applyGridGraphicsParams(); 36 | void chooseGridColor(GridColorType colorType); 37 | void enableGridColorTenth(bool on); 38 | 39 | class Ui_WidgetGrid* m_ui = nullptr; 40 | GraphicsViewPtr m_viewPtr; 41 | Quantity_Color m_gridColorTenth; 42 | }; 43 | 44 | } // namespace Mayo 45 | -------------------------------------------------------------------------------- /src/app/widget_home_files.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "grid_helper.h" 10 | #include "list_helper.h" 11 | #include 12 | 13 | namespace Mayo { 14 | 15 | class WidgetHomeFiles : public QWidget { 16 | Q_OBJECT 17 | public: 18 | WidgetHomeFiles(QWidget* parent = nullptr); 19 | 20 | signals: 21 | void newDocumentRequested(); 22 | void openDocumentsRequested(); 23 | void recentFileOpenRequested(const QFileInfo& fp); 24 | 25 | protected: 26 | void resizeEvent(QResizeEvent* event) override; 27 | void showEvent(QShowEvent* event) override; 28 | 29 | private: 30 | GridHelper::View* m_gridView; 31 | GridHelper::ProxyModel m_gridModel; 32 | ListHelper::ItemDelegate* m_gridDelegate; 33 | }; 34 | 35 | } // namespace Mayo 36 | -------------------------------------------------------------------------------- /src/app/widget_main_home.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "widget_main_home.h" 8 | #include "ui_widget_main_home.h" 9 | 10 | #include "../qtcommon/filepath_conv.h" 11 | #include "commands_file.h" 12 | 13 | namespace Mayo { 14 | 15 | WidgetMainHome::WidgetMainHome(QWidget* parent) 16 | : IWidgetMainPage(parent), 17 | m_ui(new Ui::WidgetMainHome) 18 | { 19 | m_ui->setupUi(this); 20 | } 21 | 22 | WidgetMainHome::~WidgetMainHome() 23 | { 24 | delete m_ui; 25 | } 26 | 27 | void WidgetMainHome::initialize(const CommandContainer* cmdContainer) 28 | { 29 | assert(cmdContainer != nullptr); 30 | IAppContext* appContext = cmdContainer->appContext(); 31 | 32 | QObject::connect( 33 | m_ui->widget_HomeFiles, &WidgetHomeFiles::newDocumentRequested, 34 | cmdContainer->findCommand(CommandNewDocument::Name), &Command::execute 35 | ); 36 | QObject::connect( 37 | m_ui->widget_HomeFiles, &WidgetHomeFiles::openDocumentsRequested, 38 | cmdContainer->findCommand(CommandOpenDocuments::Name), &Command::execute 39 | ); 40 | QObject::connect( 41 | m_ui->widget_HomeFiles, &WidgetHomeFiles::recentFileOpenRequested, 42 | this, [=](const QFileInfo& fp) { FileCommandTools::openDocument(appContext, filepathFrom(fp)); } 43 | ); 44 | } 45 | 46 | void WidgetMainHome::updatePageControlsActivation() 47 | { 48 | } 49 | 50 | } // namespace Mayo 51 | -------------------------------------------------------------------------------- /src/app/widget_main_home.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "iwidget_main_page.h" 10 | 11 | namespace Mayo { 12 | 13 | // Provides the home page of the application 14 | // Gives access to recent files as a 2D grid 15 | class WidgetMainHome : public IWidgetMainPage { 16 | Q_OBJECT 17 | public: 18 | WidgetMainHome(QWidget* parent = nullptr); 19 | ~WidgetMainHome(); 20 | 21 | void initialize(const CommandContainer* cmdContainer) override; 22 | void updatePageControlsActivation() override; 23 | 24 | private: 25 | class Ui_WidgetMainHome* m_ui = nullptr; 26 | }; 27 | 28 | } // namespace Mayo 29 | -------------------------------------------------------------------------------- /src/app/widget_model_tree.ui: -------------------------------------------------------------------------------- 1 | 2 | 3 | Mayo::WidgetModelTree 4 | 5 | 6 | 7 | 0 8 | 0 9 | 247 10 | 472 11 | 12 | 13 | 14 | Form 15 | 16 | 17 | 18 | 0 19 | 20 | 21 | 0 22 | 23 | 24 | 0 25 | 26 | 27 | 0 28 | 29 | 30 | 31 | 32 | QAbstractItemView::ExtendedSelection 33 | 34 | 35 | Qt::ElideNone 36 | 37 | 38 | false 39 | 40 | 41 | 42 | 1 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | Mayo::Internal::TreeWidget 52 | QTreeWidget 53 |
widget_model_tree.h
54 |
55 |
56 | 57 | 58 |
59 | -------------------------------------------------------------------------------- /src/app/widget_model_tree_builder_mesh.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "widget_model_tree_builder_mesh.h" 8 | #include "../base/caf_utils.h" 9 | #include "../graphics/graphics_mesh_object_driver.h" 10 | #include "theme.h" 11 | #include "widget_model_tree.h" 12 | 13 | #include 14 | 15 | namespace Mayo { 16 | 17 | bool WidgetModelTreeBuilder_Mesh::supportsDocumentTreeNode(const DocumentTreeNode& node) const 18 | { 19 | return GraphicsMeshObjectDriver::meshSupportStatus(node.label()) == GraphicsObjectDriver::Support::Complete; 20 | } 21 | 22 | QTreeWidgetItem* WidgetModelTreeBuilder_Mesh::createTreeItem(const DocumentTreeNode& node) 23 | { 24 | Expects(this->supportsDocumentTreeNode(node)); 25 | 26 | auto treeItem = WidgetModelTreeBuilder::createTreeItem(node); 27 | treeItem->setIcon(0, mayoTheme()->icon(Theme::Icon::ItemMesh)); 28 | return treeItem; 29 | } 30 | 31 | std::unique_ptr WidgetModelTreeBuilder_Mesh::clone() const 32 | { 33 | return std::make_unique(); 34 | } 35 | 36 | } // namespace Mayo 37 | -------------------------------------------------------------------------------- /src/app/widget_model_tree_builder_mesh.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "widget_model_tree_builder.h" 10 | 11 | namespace Mayo { 12 | 13 | class WidgetModelTreeBuilder_Mesh : public WidgetModelTreeBuilder { 14 | public: 15 | bool supportsDocumentTreeNode(const DocumentTreeNode& node) const override; 16 | QTreeWidgetItem* createTreeItem(const DocumentTreeNode& node) override; 17 | std::unique_ptr clone() const override; 18 | }; 19 | 20 | } // namespace Mayo 21 | -------------------------------------------------------------------------------- /src/app/widget_properties_editor.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "property_item_delegate.h" 10 | #include "../base/property.h" 11 | #include "../base/span.h" 12 | #include "../base/unit.h" 13 | 14 | #include 15 | 16 | namespace Mayo { 17 | 18 | class WidgetPropertiesEditor : public QWidget { 19 | public: 20 | WidgetPropertiesEditor(QWidget* parent = nullptr); 21 | ~WidgetPropertiesEditor(); 22 | 23 | struct Group; 24 | Group* addGroup(const QString& name); 25 | void setGroupName(Group* group, const QString& name); 26 | 27 | void editProperties(PropertyGroup* propGroup, Group* grp = nullptr); 28 | void editProperty(Property* prop, Group* grp = nullptr); 29 | void clear(); 30 | 31 | void setPropertyEnabled(const Property* prop, bool on); 32 | void setPropertySelectable(const Property* prop, bool on); 33 | 34 | void addLineSpacer(int height); 35 | void addLineWidget(QWidget* widget, int height = -1); 36 | Span lineWidgets() const; 37 | 38 | double rowHeightFactor() const; 39 | void setRowHeightFactor(double v); 40 | 41 | using UnitTranslation = PropertyItemDelegate::UnitTranslation; 42 | bool overridePropertyUnitTranslation(const BasePropertyQuantity* prop, UnitTranslation unitTr); 43 | 44 | private: 45 | class Private; 46 | Private* const d = nullptr; 47 | }; 48 | 49 | } // namespace Mayo 50 | -------------------------------------------------------------------------------- /src/app/windows/win_taskbar_global_progress.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | // Module : GUI 10 | 11 | #include "../../base/task_common.h" 12 | 13 | #include 14 | #include 15 | class QWindow; 16 | class QWinTaskbarButton; 17 | 18 | namespace Mayo { 19 | 20 | class TaskManager; 21 | 22 | class WinTaskbarGlobalProgress : public QObject { 23 | Q_OBJECT 24 | public: 25 | WinTaskbarGlobalProgress(TaskManager* taskMgr, QObject* parent = nullptr); 26 | 27 | void setWindow(QWindow* window); 28 | 29 | private: 30 | void onTaskProgress(TaskId taskId, int percent); 31 | void onTaskEnded(TaskId taskId); 32 | void updateTaskbar(); 33 | 34 | std::unordered_map m_mapTaskIdProgress; 35 | QWinTaskbarButton* m_taskbarBtn = nullptr; 36 | int m_globalPct = 0; 37 | }; 38 | 39 | } // namespace Mayo 40 | -------------------------------------------------------------------------------- /src/base/application_item.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "application_item.h" 8 | 9 | namespace Mayo { 10 | 11 | ApplicationItem::ApplicationItem(const DocumentPtr& doc) 12 | : m_doc(doc), 13 | m_docTreeNode(DocumentTreeNode::null()) 14 | { } 15 | 16 | ApplicationItem::ApplicationItem(const DocumentTreeNode& node) 17 | : m_docTreeNode(node) 18 | { } 19 | 20 | bool ApplicationItem::isValid() const 21 | { 22 | return this->isDocument() || this->isDocumentTreeNode(); 23 | } 24 | 25 | bool ApplicationItem::isDocument() const 26 | { 27 | return !m_doc.IsNull(); 28 | } 29 | 30 | bool ApplicationItem::isDocumentTreeNode() const 31 | { 32 | return m_docTreeNode.isValid(); 33 | } 34 | 35 | DocumentPtr ApplicationItem::document() const 36 | { 37 | if (this->isDocument()) 38 | return m_doc; 39 | else if (this->isDocumentTreeNode()) 40 | return m_docTreeNode.document(); 41 | 42 | return DocumentPtr(); 43 | } 44 | 45 | const DocumentTreeNode& ApplicationItem::documentTreeNode() const 46 | { 47 | return this->isDocumentTreeNode() ? m_docTreeNode : DocumentTreeNode::null(); 48 | } 49 | 50 | bool ApplicationItem::operator==(const ApplicationItem& other) const 51 | { 52 | return m_doc == other.m_doc 53 | && m_docTreeNode.document() == other.m_docTreeNode.document() 54 | && m_docTreeNode.id() == other.m_docTreeNode.id(); 55 | } 56 | 57 | } // namespace Mayo 58 | -------------------------------------------------------------------------------- /src/base/application_item.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "document.h" 10 | #include "document_tree_node.h" 11 | 12 | namespace Mayo { 13 | 14 | // Provides a common item that could be either a Document or some model tree node within a Document 15 | class ApplicationItem { 16 | public: 17 | ApplicationItem() = default; 18 | ApplicationItem(const DocumentPtr& doc); 19 | ApplicationItem(const DocumentTreeNode& node); 20 | 21 | bool isValid() const; 22 | bool isDocument() const; 23 | bool isDocumentTreeNode() const; 24 | 25 | DocumentPtr document() const; 26 | const DocumentTreeNode& documentTreeNode() const; 27 | 28 | bool operator==(const ApplicationItem& other) const; 29 | 30 | private: 31 | DocumentPtr m_doc; 32 | DocumentTreeNode m_docTreeNode; 33 | }; 34 | 35 | } // namespace Mayo 36 | -------------------------------------------------------------------------------- /src/base/application_item_selection_model.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "application_item.h" 10 | #include "signal.h" 11 | #include "span.h" 12 | 13 | namespace Mayo { 14 | 15 | // Keeps track of the items selected in an Application object 16 | class ApplicationItemSelectionModel { 17 | public: 18 | Span selectedItems() const; 19 | 20 | bool isSelected(const ApplicationItem& item); 21 | 22 | void add(const ApplicationItem& item); 23 | void add(Span vecItem); 24 | void remove(const ApplicationItem& item); 25 | void remove(Span vecItem); 26 | // void toggle(const ApplicationItem& item); 27 | // void toggle(Span item); 28 | 29 | void clear(); 30 | 31 | Signal, Span> signalChanged; 32 | 33 | private: 34 | std::vector m_vecSelectedItem; 35 | }; 36 | 37 | } // namespace Mayo 38 | -------------------------------------------------------------------------------- /src/base/application_ptr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "occ_handle.h" 10 | #include 11 | 12 | namespace Mayo { 13 | 14 | class Application; 15 | DEFINE_STANDARD_HANDLE(Application, XCAFApp_Application) 16 | using ApplicationPtr = OccHandle; 17 | 18 | } // namespace Mayo 19 | -------------------------------------------------------------------------------- /src/base/document_ptr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "occ_handle.h" 10 | #include 11 | 12 | namespace Mayo { 13 | 14 | class Document; 15 | DEFINE_STANDARD_HANDLE(Document, TDocStd_Document) 16 | using DocumentPtr = OccHandle; 17 | 18 | } // namespace Mayo 19 | -------------------------------------------------------------------------------- /src/base/document_tree_node.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "document_tree_node.h" 8 | #include "document.h" 9 | 10 | namespace Mayo { 11 | 12 | DocumentTreeNode::DocumentTreeNode(const DocumentPtr& docPtr, TreeNodeId nodeId) 13 | : m_document(docPtr), m_id(nodeId) 14 | { } 15 | 16 | bool DocumentTreeNode::isValid() const 17 | { 18 | return !m_document.IsNull() && m_id != 0; 19 | } 20 | 21 | const DocumentTreeNode& DocumentTreeNode::null() 22 | { 23 | static const DocumentTreeNode node = {}; 24 | return node; 25 | } 26 | 27 | TDF_Label DocumentTreeNode::label() const 28 | { 29 | if (this->isValid()) 30 | return m_document->modelTree().nodeData(m_id); 31 | else 32 | return TDF_Label(); 33 | } 34 | 35 | bool DocumentTreeNode::isEntity() const 36 | { 37 | return this->isValid() ? m_document->isEntity(m_id) : false; 38 | } 39 | 40 | bool DocumentTreeNode::isLeaf() const 41 | { 42 | if (this->isValid()) 43 | return m_document->modelTree().nodeIsLeaf(m_id); 44 | else 45 | return false; 46 | } 47 | 48 | bool DocumentTreeNode::operator==(const DocumentTreeNode& other) const 49 | { 50 | if (!this->isValid() || !other.isValid()) 51 | return false; 52 | 53 | return m_document->identifier() == other.document()->identifier() 54 | && m_id == other.id(); 55 | } 56 | 57 | } // namespace Mayo 58 | -------------------------------------------------------------------------------- /src/base/document_tree_node.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "document_ptr.h" 10 | #include "libtree.h" 11 | 12 | namespace Mayo { 13 | 14 | // Provides a convenient item for model tree nodes within a Document object 15 | class DocumentTreeNode { 16 | public: 17 | DocumentTreeNode() = default; 18 | DocumentTreeNode(const DocumentPtr& docPtr, TreeNodeId nodeId); 19 | 20 | bool isValid() const; 21 | static const DocumentTreeNode& null(); 22 | 23 | TDF_Label label() const; 24 | bool isEntity() const; 25 | bool isLeaf() const; 26 | 27 | const DocumentPtr& document() const { return m_document; } 28 | TreeNodeId id() const { return m_id; } 29 | 30 | bool operator==(const DocumentTreeNode& other) const; 31 | 32 | private: 33 | DocumentPtr m_document; // TODO Document* or Document::identifier instead ? 34 | TreeNodeId m_id = 0; 35 | }; 36 | 37 | } // namespace Mayo 38 | -------------------------------------------------------------------------------- /src/base/document_tree_node_properties_provider.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "document_tree_node_properties_provider.h" 8 | 9 | namespace Mayo { 10 | 11 | } // namespace Mayo 12 | -------------------------------------------------------------------------------- /src/base/document_tree_node_properties_provider.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "property.h" 10 | #include 11 | 12 | namespace Mayo { 13 | 14 | class DocumentTreeNode; 15 | class PropertyGroupSignals; 16 | 17 | class DocumentTreeNodePropertiesProvider { 18 | public: 19 | virtual ~DocumentTreeNodePropertiesProvider() = default; 20 | virtual bool supports(const DocumentTreeNode& treeNode) const = 0; 21 | virtual std::unique_ptr properties(const DocumentTreeNode& treeNode) const = 0; 22 | }; 23 | 24 | } // namespace Mayo 25 | -------------------------------------------------------------------------------- /src/base/enumeration_fromenum.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "enumeration.h" 10 | #include "meta_enum.h" 11 | 12 | // -- 13 | // -- Implementation of template function Enumeration::fromType() 14 | // -- 15 | 16 | namespace Mayo { 17 | 18 | template 19 | struct EnumNames { 20 | static inline const std::string_view trContext = ""; 21 | static inline const std::string_view junkPrefix = ""; 22 | }; 23 | 24 | template 25 | Enumeration Enumeration::fromType() 26 | { 27 | const bool hasJunkPrefix = !EnumNames::junkPrefix.empty(); 28 | Enumeration enumObject; 29 | for (const EnumType value : MetaEnum::values()) { 30 | std::string_view key = 31 | hasJunkPrefix ? 32 | MetaEnum::nameWithoutPrefix(value, EnumNames::junkPrefix) : 33 | MetaEnum::name(value); 34 | const TextId keyTextId = { EnumNames::trContext, key }; 35 | enumObject.addItem(int(value), keyTextId); 36 | } 37 | 38 | return enumObject; 39 | } 40 | 41 | } // namespace Mayo 42 | -------------------------------------------------------------------------------- /src/base/geom_utils.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include 12 | class Adaptor3d_Curve; 13 | class gp_Trsf; 14 | 15 | namespace Mayo::GeomUtils { 16 | 17 | double normalizedU(const Adaptor3d_Curve& curve, double u); 18 | 19 | gp_Pnt d0(const Adaptor3d_Curve& curve, double u); 20 | gp_Vec d1(const Adaptor3d_Curve& curve, double u); 21 | std::pair d0d1(const Adaptor3d_Curve& curve, double u); 22 | 23 | // Detects if transformation matrix 'trsf' contains scaling 24 | bool hasScaling(const gp_Trsf& trsf); 25 | 26 | } // namespace Mayo::GeomUtils 27 | -------------------------------------------------------------------------------- /src/base/global.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #if defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) 10 | # define MAYO_OS_WINDOWS 11 | #elif defined(__APPLE__) 12 | # define MAYO_OS_MAC 13 | #elif defined(__linux__) || defined(__linux) 14 | # define MAYO_OS_LINUX 15 | #elif defined(__ANDROID__) || defined(ANDROID) 16 | # define MAYO_OS_ANDROID 17 | # define MAYO_OS_LINUX 18 | #elif defined(__WEBOS__) 19 | # define MAYO_OS_WEBOS 20 | # define MAYO_OS_LINUX 21 | #elif defined(__EMSCRIPTEN__) 22 | # define MAYO_OS_WASM 23 | #endif 24 | 25 | #if !defined(MAYO_OS_WINDOWS) 26 | # define MAYO_OS_UNIX 27 | #endif 28 | 29 | // Avoid "unused parameter" warnings 30 | #define MAYO_UNUSED(x) (void)x; 31 | 32 | namespace Mayo { 33 | 34 | enum class CheckState { Off, Partially, On }; 35 | 36 | } // namespace Mayo 37 | -------------------------------------------------------------------------------- /src/base/io_format.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "span.h" 10 | #include 11 | 12 | namespace Mayo::IO { 13 | 14 | // Predefined I/O formats 15 | enum Format { 16 | Format_Unknown, 17 | Format_Image, 18 | Format_3DS, 19 | Format_3MF, 20 | Format_AMF, 21 | Format_COLLADA, 22 | Format_DXF, 23 | Format_FBX, 24 | Format_GLTF, 25 | Format_IGES, 26 | Format_OBJ, 27 | Format_OCCBREP, 28 | Format_OFF, 29 | Format_PLY, 30 | Format_STEP, 31 | Format_STL, 32 | Format_VRML, 33 | Format_X3D, 34 | Format_DirectX, 35 | Format_Blender 36 | }; 37 | 38 | // Returns identifier(unique short name) corresponding to 'format' 39 | std::string_view formatIdentifier(Format format); 40 | 41 | // Returns name(eg ISO designation) corresponding to 'format' 42 | std::string_view formatName(Format format); 43 | 44 | // Returns array of applicable file suffixes(extensions) corresponding to 'format' 45 | Span formatFileSuffixes(Format format); 46 | 47 | // Does 'format' provide BRep model ? 48 | bool formatProvidesBRep(Format format); 49 | 50 | // Does 'format' provide mesh model ? 51 | bool formatProvidesMesh(Format format); 52 | 53 | } // namespace Mayo::IO 54 | -------------------------------------------------------------------------------- /src/base/io_parameters_provider.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "io_format.h" 10 | 11 | namespace Mayo { class PropertyGroup; } 12 | 13 | namespace Mayo::IO { 14 | 15 | // Abstract mechanism to provide reader/writer parameters for a format 16 | class ParametersProvider { 17 | public: 18 | virtual const PropertyGroup* findReaderParameters(Format format) const = 0; 19 | virtual const PropertyGroup* findWriterParameters(Format format) const = 0; 20 | }; 21 | 22 | } // namespace Mayo::IO 23 | -------------------------------------------------------------------------------- /src/base/io_reader.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "io_reader.h" 8 | 9 | namespace Mayo::IO { 10 | 11 | } // namespace Mayo::IO 12 | -------------------------------------------------------------------------------- /src/base/io_writer.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "io_writer.h" 8 | 9 | namespace Mayo::IO { 10 | 11 | } // namespace Mayo::IO 12 | -------------------------------------------------------------------------------- /src/base/label_data.cpp: -------------------------------------------------------------------------------- 1 | #include "label_data.h" 2 | 3 | #include "caf_utils.h" 4 | #include "brep_utils.h" 5 | #include "triangulation_annex_data.h" 6 | #include "point_cloud_data.h" 7 | #include "xcaf.h" 8 | 9 | namespace Mayo { 10 | 11 | LabelDataFlags findLabelDataFlags(const TDF_Label& label) 12 | { 13 | LabelDataFlags flags = LabelData_None; 14 | 15 | if (CafUtils::hasAttribute(label)) 16 | flags |= LabelData_HasTriangulationAnnexData; 17 | 18 | if (XCaf::isShape(label)) { 19 | flags |= LabelData_HasShape; 20 | const TopoDS_Shape shape = XCaf::shape(label); 21 | if (shape.ShapeType() == TopAbs_FACE) { 22 | flags |= LabelData_ShapeIsFace; 23 | if (BRepUtils::isGeometric(TopoDS::Face(shape))) 24 | flags |= LabelData_ShapeIsGeometricFace; 25 | } 26 | } 27 | 28 | if (CafUtils::hasAttribute(label)) 29 | flags |= LabelData_HasPointCloudData; 30 | 31 | return flags; 32 | } 33 | 34 | } // namespace Mayo 35 | -------------------------------------------------------------------------------- /src/base/label_data.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | class TDF_Label; 10 | 11 | namespace Mayo { 12 | 13 | enum LabelData { 14 | LabelData_None = 0x00000, 15 | LabelData_HasShape = 0x00001, // Label has BRep shape attribute(see XCAFDoc_ShapeTool) 16 | LabelData_ShapeIsFace = 0x00002, // Associated BRep shape is a face(see TopoDS_Face) 17 | LabelData_ShapeIsGeometricFace = 0x00004, // BRep face is geometric(it's associated to a surface) 18 | LabelData_HasTriangulationAnnexData = 0x00080, // Label has TriangulationAnnexData attribute 19 | LabelData_HasPointCloudData = 0x00100, // Label has PointCloudData attribute 20 | LabelData_Custom1 = 0x01000, 21 | LabelData_Custom2 = 0x02000, 22 | LabelData_Custom3 = 0x03000, 23 | LabelData_Custom4 = 0x04000, 24 | LabelData_Custom5 = 0x08000 25 | }; 26 | using LabelDataFlags = unsigned; 27 | 28 | LabelDataFlags findLabelDataFlags(const TDF_Label& label); 29 | 30 | } // namespace Mayo 31 | -------------------------------------------------------------------------------- /src/base/mesh_access.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | // Base 10 | #include "occ_handle.h" 11 | class DocumentTreeNode; 12 | 13 | // OpenCascade 14 | #include 15 | #include 16 | class Poly_Triangulation; 17 | class TopLoc_Location; 18 | 19 | // CppStd 20 | #include 21 | #include 22 | 23 | namespace Mayo { 24 | 25 | // Provides an interface to access mesh geometry 26 | class IMeshAccess { 27 | public: 28 | virtual std::optional nodeColor(int i) const = 0; 29 | virtual const TopLoc_Location& location() const = 0; 30 | virtual const OccHandle& triangulation() const = 0; 31 | }; 32 | 33 | // Iterates over meshes from `treeNode` and call `fnCallback` for each item. 34 | void IMeshAccess_visitMeshes( 35 | const DocumentTreeNode& treeNode, 36 | std::function fnCallback 37 | ); 38 | 39 | } // namespace Mayo 40 | -------------------------------------------------------------------------------- /src/base/messenger_client.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "messenger_client.h" 8 | #include "messenger.h" 9 | 10 | namespace Mayo { 11 | 12 | MessengerClient::MessengerClient() 13 | : m_messenger(&Messenger::null()) 14 | { 15 | } 16 | 17 | void MessengerClient::setMessenger(Messenger* messenger) 18 | { 19 | if (messenger) 20 | m_messenger = messenger; 21 | else 22 | m_messenger = &Messenger::null(); 23 | } 24 | 25 | } // namespace Mayo 26 | -------------------------------------------------------------------------------- /src/base/messenger_client.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | namespace Mayo { 10 | 11 | class Messenger; 12 | 13 | // Provides a link to a Messenger object 14 | // The object returned by MessengerClient::messenger() is guaranteed to be non-nullptr 15 | class MessengerClient { 16 | public: 17 | MessengerClient(); 18 | 19 | Messenger* messenger() const { return m_messenger; } 20 | void setMessenger(Messenger* messenger); 21 | 22 | private: 23 | Messenger* m_messenger = nullptr; 24 | }; 25 | 26 | } // namespace Mayo 27 | -------------------------------------------------------------------------------- /src/base/meta_enum.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Mayo { 14 | 15 | // Provides meta-data helper functions about enumerated types 16 | // Currently it wraps magic_enum 3rdparty library 17 | class MetaEnum { 18 | public: 19 | template 20 | static std::string_view name(EnumType enumValue) { 21 | return magic_enum::enum_name(enumValue); 22 | } 23 | 24 | template 25 | static int count() { 26 | return magic_enum::enum_count(); 27 | } 28 | 29 | template 30 | static std::string_view nameWithoutPrefix(EnumType enumValue, std::string_view strPrefix) { 31 | std::string_view strEnumValueName = MetaEnum::name(enumValue); 32 | if (strEnumValueName.find(strPrefix) == 0) 33 | return strEnumValueName.substr(strPrefix.size()); 34 | else 35 | return strEnumValueName; 36 | } 37 | 38 | // Returns std::array with pairs(value, name), sorted by enum value 39 | template 40 | static auto entries() { 41 | return magic_enum::enum_entries(); 42 | } 43 | 44 | template 45 | static auto values() { 46 | return magic_enum::enum_values(); 47 | } 48 | }; 49 | 50 | } // namespace Mayo 51 | -------------------------------------------------------------------------------- /src/base/occ_brep_mesh_parameters.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | #if OCC_VERSION_HEX >= 0x070400 11 | # include 12 | #else 13 | # include 14 | #endif 15 | 16 | namespace Mayo { 17 | 18 | // Portable alias over parameters for OpenCascade's built-in BRep mesher 19 | #if OCC_VERSION_HEX >= 0x070400 20 | using OccBRepMeshParameters = IMeshTools_Parameters; 21 | #else 22 | using OccBRepMeshParameters = BRepMesh_FastDiscret::Parameters; 23 | #endif 24 | 25 | } // namespace Mayo 26 | -------------------------------------------------------------------------------- /src/base/occ_handle.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include // For std::forward() 12 | 13 | namespace Mayo { 14 | 15 | // Template alias for OpenCascade handle 16 | template using OccHandle = opencascade::handle; 17 | 18 | // Constructs an object of type 'T' wrapped in an OpenCascade handle 19 | // Note: Standard_Transient must be a base class of 'T' 20 | template 21 | OccHandle makeOccHandle(Args&&... args) 22 | { 23 | return new T(std::forward(args)...); 24 | } 25 | 26 | } // namespace Mayo 27 | 28 | #if OCC_VERSION_HEX < 0x070800 29 | namespace std { 30 | 31 | // Specialization of C++11 std::hash<> functor for opencascade::handle<> objects 32 | template struct hash> { 33 | inline std::size_t operator()(const opencascade::handle& hnd) const { 34 | return hash{}(hnd.get()); 35 | } 36 | }; 37 | 38 | } // namespace std 39 | #endif 40 | -------------------------------------------------------------------------------- /src/base/occ_progress_indicator.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "tkernel_utils.h" 10 | #include 11 | 12 | namespace Mayo { 13 | 14 | class TaskProgress; 15 | 16 | // Provides implementation of OpenCascade-based progress indicator around Mayo::TaskProgress 17 | class OccProgressIndicator : public Message_ProgressIndicator { 18 | public: 19 | OccProgressIndicator(TaskProgress* progress); 20 | 21 | bool UserBreak() override; 22 | 23 | #if OCC_VERSION_HEX >= OCC_VERSION_CHECK(7, 5, 0) 24 | void Show (const Message_ProgressScope& theScope, const bool isForce) override; 25 | #else 26 | bool Show(const bool force) override; 27 | #endif 28 | 29 | private: 30 | TaskProgress* m_progress = nullptr; 31 | const char* m_lastStepName = nullptr; 32 | int m_lastProgress = -1; 33 | }; 34 | 35 | } // namespace Mayo 36 | -------------------------------------------------------------------------------- /src/base/occt_enums.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "property_enumeration.h" 10 | #include 11 | #include 12 | 13 | namespace Mayo { 14 | 15 | class OcctEnums { 16 | public: 17 | static const Enumeration& Graphic3d_NameOfMaterial(); 18 | static const Enumeration& Aspect_HatchStyle(); 19 | }; 20 | 21 | } // namespace Mayo 22 | -------------------------------------------------------------------------------- /src/base/point_cloud_data.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "occ_handle.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace Mayo { 15 | 16 | // Pre-declarations 17 | class PointCloudData; 18 | DEFINE_STANDARD_HANDLE(PointCloudData, TDF_Attribute) 19 | using PointCloudDataPtr = OccHandle; 20 | 21 | // Provides a label attribute to store point cloud data 22 | class PointCloudData : public TDF_Attribute { 23 | public: 24 | static const Standard_GUID& GetID(); 25 | static PointCloudDataPtr Set(const TDF_Label& label); 26 | static PointCloudDataPtr Set(const TDF_Label& label, const OccHandle& points); 27 | 28 | const OccHandle& points() const { return m_points; } 29 | 30 | // -- from TDF_Attribute 31 | const Standard_GUID& ID() const override; 32 | void Restore(const OccHandle& attribute) override; 33 | OccHandle NewEmpty() const override; 34 | void Paste(const OccHandle& into, const OccHandle& table) const override; 35 | Standard_OStream& Dump(Standard_OStream& ostr) const override; 36 | 37 | DEFINE_STANDARD_RTTI_INLINE(PointCloudData, TDF_Attribute) 38 | 39 | private: 40 | OccHandle m_points; 41 | }; 42 | 43 | } // namespace Mayo 44 | -------------------------------------------------------------------------------- /src/base/property_builtins.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "property_builtins.h" 8 | 9 | #include "tkernel_utils.h" 10 | 11 | namespace Mayo { 12 | 13 | BasePropertyQuantity::BasePropertyQuantity(PropertyGroup* grp, const TextId& name) 14 | : Property(grp, name) 15 | { 16 | } 17 | 18 | template<> const char PropertyBool::TypeName[] = "Mayo::PropertyBool"; 19 | template<> const char GenericProperty::TypeName[] = "Mayo::PropertyInt"; 20 | template<> const char GenericProperty::TypeName[] = "Mayo::PropertyDouble"; 21 | template<> const char PropertyString::TypeName[] = "Mayo::PropertyString"; 22 | template<> const char GenericProperty::TypeName[] = "Mayo::PropertyCheckState"; 23 | template<> const char PropertyOccPnt::TypeName[] = "Mayo::PropertyOccPnt"; 24 | template<> const char PropertyOccVec::TypeName[] = "Mayo::PropertyOccVec"; 25 | template<> const char PropertyOccTrsf::TypeName[] = "Mayo::PropertyOccTrsf"; 26 | template<> const char GenericProperty::TypeName[] = "Mayo::PropertyOccColor"; 27 | template<> const char GenericProperty::TypeName[] = "Mayo::PropertyFilePath"; 28 | 29 | } // namespace Mayo 30 | -------------------------------------------------------------------------------- /src/base/quantity.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "quantity.h" 8 | 9 | namespace Mayo { 10 | 11 | } // namespace Mayo 12 | -------------------------------------------------------------------------------- /src/base/settings_index.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/typed_scalar.h" 10 | 11 | namespace Mayo { 12 | 13 | // Settings GroupIndex 14 | struct Settings_GroupTag {}; 15 | using Settings_GroupIndex = TypedScalar; 16 | 17 | 18 | // Settings SectionIndex 19 | struct Settings_SectionTag {}; 20 | class Settings_SectionIndex : public TypedScalar { 21 | public: 22 | Settings_SectionIndex() = default; 23 | explicit Settings_SectionIndex(Settings_GroupIndex group, ScalarType section) 24 | : TypedScalar(section), 25 | m_group(group) 26 | {} 27 | 28 | Settings_GroupIndex group() const { return m_group; } 29 | 30 | private: 31 | Settings_GroupIndex m_group; 32 | }; 33 | 34 | 35 | // Settings SettingIndex 36 | struct Settings_SettingTag {}; 37 | class Settings_SettingIndex : public TypedScalar { 38 | public: 39 | Settings_SettingIndex() = default; 40 | explicit Settings_SettingIndex(Settings_SectionIndex section, ScalarType setting) 41 | : TypedScalar(setting), 42 | m_section(section) 43 | {} 44 | 45 | Settings_GroupIndex group() const { return m_section.group(); } 46 | Settings_SectionIndex section() const { return m_section; } 47 | 48 | private: 49 | Settings_SectionIndex m_section; 50 | }; 51 | 52 | } // namespace Mayo 53 | -------------------------------------------------------------------------------- /src/base/signal.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "signal.h" 8 | 9 | namespace Mayo { 10 | 11 | std::unique_ptr globalHelper; 12 | 13 | void setGlobalSignalThreadHelper(std::unique_ptr helper) 14 | { 15 | globalHelper = std::move(helper); 16 | } 17 | 18 | ISignalThreadHelper* getGlobalSignalThreadHelper() 19 | { 20 | return globalHelper.get(); 21 | } 22 | 23 | } // namespace Mayo 24 | -------------------------------------------------------------------------------- /src/base/span.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace Mayo { 14 | 15 | template using Span = gsl::span; 16 | 17 | // Returns the index of 'item' contained in 'span' 18 | template 19 | constexpr int Span_itemIndex(Span span, typename Span::const_reference item) 20 | { 21 | assert(!span.empty()); 22 | auto index = &item - &span.front(); 23 | assert(index >= 0); 24 | assert(index <= INT_MAX); 25 | assert(&span[static_cast::size_type>(index)] == &item); 26 | return static_cast(index); 27 | } 28 | 29 | template 30 | constexpr int Span_itemIndex(const Container& cont, typename Container::const_reference item) 31 | { 32 | return Span_itemIndex(Span(cont), item); 33 | } 34 | 35 | } // namespace Mayo 36 | -------------------------------------------------------------------------------- /src/base/task_common.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | namespace Mayo { 12 | 13 | // Task identifier type 14 | using TaskId = uint64_t; 15 | 16 | // Reserved value for null tasks 17 | constexpr TaskId TaskId_null = UINT64_MAX; 18 | 19 | // Syntactic sugar for task auto-deletion flag(see TaskManager::run/exec()) 20 | enum class TaskAutoDestroy { On, Off }; 21 | 22 | } // namespace Mayo 23 | -------------------------------------------------------------------------------- /src/base/text_id.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "text_id.h" 8 | 9 | #include 10 | 11 | namespace Mayo { 12 | 13 | namespace { 14 | 15 | std::vector& getTranslatorFunctions() 16 | { 17 | static std::vector vec; 18 | return vec; 19 | } 20 | 21 | } // namespace 22 | 23 | std::string_view TextId::tr(int n) const 24 | { 25 | return TextId::translate(*this, n); 26 | } 27 | 28 | bool TextId::isEmpty() const 29 | { 30 | return this->key.empty(); 31 | } 32 | 33 | void TextId::addTranslatorFunction(TranslatorFunctionPtr fn) 34 | { 35 | if (fn) 36 | getTranslatorFunctions().push_back(fn); 37 | } 38 | 39 | std::string_view TextId::translate(const TextId& textId, int n) 40 | { 41 | for (auto it = getTranslatorFunctions().rbegin(); it != getTranslatorFunctions().rend(); ++it) { 42 | TranslatorFunctionPtr fn = *it; 43 | std::string_view msg = fn(textId, n); 44 | if (!msg.empty()) 45 | return msg; 46 | } 47 | 48 | return textId.key; 49 | } 50 | 51 | 52 | } // namespace Mayo 53 | -------------------------------------------------------------------------------- /src/base/typed_scalar.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | namespace Mayo { 12 | 13 | template 14 | class TypedScalar { 15 | public: 16 | using ScalarType = Scalar; 17 | static_assert(std::is_scalar::value, "Type T is not scalar"); 18 | 19 | TypedScalar() = default; 20 | explicit TypedScalar(Scalar scalar) : m_scalar(scalar) {} 21 | 22 | Scalar get() const { return m_scalar; } 23 | 24 | bool operator==(const TypedScalar& other) const { 25 | return m_scalar == other.m_scalar; 26 | } 27 | 28 | bool operator!=(const TypedScalar& other) const { 29 | return m_scalar != other.m_scalar; 30 | } 31 | 32 | private: 33 | Scalar m_scalar; 34 | }; 35 | 36 | } // namespace Mayo 37 | -------------------------------------------------------------------------------- /src/cli/cli_export.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/application_ptr.h" 10 | #include "../base/filepath.h" 11 | #include "../base/span.h" 12 | 13 | #include 14 | 15 | namespace Mayo { 16 | 17 | // Contains arguments for the cli_asyncExportDocuments() function 18 | struct CliExportArgs { 19 | bool progressReport = true; 20 | Span filesToOpen; 21 | Span filesToExport; 22 | }; 23 | 24 | // Asynchronously exports input file(s) listed in 'args' 25 | // Calls 'fnContinuation' at the end of execution 26 | void cli_asyncExportDocuments( 27 | const ApplicationPtr& app, 28 | const CliExportArgs& args, 29 | std::function fnContinuation 30 | ); 31 | 32 | } // namespace Mayo 33 | -------------------------------------------------------------------------------- /src/cli/console.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | namespace Mayo { 12 | 13 | // Color for console/terminal output(limited palette) 14 | enum class ConsoleColor { 15 | Default, Black, White, Red, Blue, Green, Yellow, Cyan, Magenta 16 | }; 17 | 18 | // Note: excerpted from OpenCascade's Message_PrinterOStream::SetConsoleTextColor() 19 | // This function appeared with v7.5.0 20 | void consoleSetTextColor(ConsoleColor color); 21 | 22 | // Note: excerpted from p-ranav/indicators/cursor_movement.hpp 23 | void consoleCursorMoveUp(int lines); 24 | 25 | // Note: excerpted from p-ranav/indicators/cursor_control.hpp 26 | void consoleCursorShow(bool on); 27 | 28 | // Note: excerpted from p-ranav/indicators/terminal_size.hpp 29 | std::pair consoleSize(); 30 | int consoleWidth(); 31 | 32 | // Sends "Enter" to the console 33 | // Useful to release the command prompt on the parent console when using AttachConsole() 34 | void consoleSendEnterKey(); 35 | 36 | } // namespace Mayo 37 | -------------------------------------------------------------------------------- /src/graphics/graphics_create_driver.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | // -- 8 | // NOTE 9 | // This file isolates inclusion of which is problematic on X11/Linux 10 | // #defines constants like "None" which causes name clash with GuiDocument::ViewTrihedronMode::None 11 | // -- 12 | 13 | #include "../base/occ_handle.h" 14 | 15 | #include 16 | #include 17 | #include 18 | 19 | namespace Mayo { 20 | 21 | using FunctionCreateGraphicsDriver = std::function()>; 22 | 23 | static FunctionCreateGraphicsDriver& getFunctionCreateGraphicsDriver() 24 | { 25 | static FunctionCreateGraphicsDriver fn = []{ 26 | return makeOccHandle(new Aspect_DisplayConnection); 27 | }; 28 | return fn; 29 | } 30 | 31 | void setFunctionCreateGraphicsDriver(FunctionCreateGraphicsDriver fn) 32 | { 33 | getFunctionCreateGraphicsDriver() = std::move(fn); 34 | } 35 | 36 | OccHandle graphicsCreateDriver() 37 | { 38 | const auto& fn = getFunctionCreateGraphicsDriver(); 39 | if (fn) 40 | return fn(); 41 | 42 | return {}; 43 | } 44 | 45 | } // namespace Mayo 46 | -------------------------------------------------------------------------------- /src/graphics/graphics_object_ptr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/occ_handle.h" 10 | #include 11 | 12 | namespace Mayo { 13 | 14 | using GraphicsObjectPtr = OccHandle; 15 | using GraphicsObjectSelectionMode = int; 16 | 17 | } // namespace Mayo 18 | -------------------------------------------------------------------------------- /src/graphics/graphics_owner_ptr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/occ_handle.h" 10 | #include 11 | 12 | namespace Mayo { 13 | 14 | using GraphicsOwnerPtr = OccHandle; 15 | 16 | } // namespace Mayo 17 | -------------------------------------------------------------------------------- /src/graphics/graphics_point_cloud_object_driver.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "graphics_object_driver.h" 10 | 11 | namespace Mayo { 12 | 13 | // Pre-declarations 14 | class GraphicsPointCloudObjectDriver; 15 | DEFINE_STANDARD_HANDLE(GraphicsPointCloudObjectDriver, GraphicsObjectDriver) 16 | using GraphicsPointCloudObjectDriverPtr = OccHandle; 17 | 18 | // Provides creation and configuration of graphics objects for point clouds 19 | class GraphicsPointCloudObjectDriver : public GraphicsObjectDriver { 20 | public: 21 | GraphicsPointCloudObjectDriver(); 22 | 23 | Support supportStatus(const TDF_Label& label) const override; 24 | GraphicsObjectPtr createObject(const TDF_Label& label) const override; 25 | void applyDisplayMode(GraphicsObjectPtr object, Enumeration::Value mode) const override; 26 | Enumeration::Value currentDisplayMode(const GraphicsObjectPtr& object) const override; 27 | std::unique_ptr properties(Span spanObject) const override; 28 | 29 | static Support pointCloudSupportStatus(const TDF_Label& label); 30 | 31 | DEFINE_STANDARD_RTTI_INLINE(GraphicsPointCloudObjectDriver, GraphicsObjectDriver) 32 | }; 33 | 34 | } // namespace Mayo 35 | -------------------------------------------------------------------------------- /src/graphics/graphics_shape_object_driver.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "graphics_object_driver.h" 10 | 11 | namespace Mayo { 12 | 13 | class GraphicsShapeObjectDriver; 14 | DEFINE_STANDARD_HANDLE(GraphicsShapeObjectDriver, GraphicsObjectDriver) 15 | using GraphicsShapeObjectDriverPtr = OccHandle; 16 | 17 | // Provides creation and configuration of graphics objects for BRep shapes 18 | class GraphicsShapeObjectDriver : public GraphicsObjectDriver { 19 | public: 20 | GraphicsShapeObjectDriver(); 21 | 22 | Support supportStatus(const TDF_Label& label) const override; 23 | GraphicsObjectPtr createObject(const TDF_Label& label) const override; 24 | void applyDisplayMode(GraphicsObjectPtr object, Enumeration::Value mode) const override; 25 | Enumeration::Value currentDisplayMode(const GraphicsObjectPtr& object) const override; 26 | std::unique_ptr properties(Span spanObject) const override; 27 | 28 | static Support shapeSupportStatus(const TDF_Label& label); 29 | 30 | enum DisplayMode { 31 | DisplayMode_Wireframe, 32 | DisplayMode_HiddenLineRemoval, 33 | DisplayMode_Shaded, 34 | DisplayMode_ShadedWithFaceBoundary 35 | }; 36 | 37 | DEFINE_STANDARD_RTTI_INLINE(GraphicsShapeObjectDriver, GraphicsObjectDriver) 38 | }; 39 | 40 | } // namespace Mayo 41 | -------------------------------------------------------------------------------- /src/graphics/graphics_texture2d.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | #if OCC_VERSION_HEX >= 0x070700 11 | # include 12 | #else 13 | # include 14 | #endif 15 | 16 | namespace Mayo { 17 | 18 | #if OCC_VERSION_HEX >= 0x070700 19 | using GraphicsTexture2D = Graphic3d_Texture2D; 20 | #else 21 | using GraphicsTexture2D = Graphic3d_Texture2Dmanual; 22 | #endif 23 | 24 | } // namespace Mayo 25 | -------------------------------------------------------------------------------- /src/graphics/graphics_view_ptr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "graphics_scene.h" 10 | 11 | #include 12 | 13 | namespace Mayo { 14 | 15 | // Helper class providing a V3d view associated with the owner GraphicsScene object 16 | // The redraw() member function actually calls GraphicsScene::redraw() which under the hood sends 17 | // a "redraw requested" signal 18 | class GraphicsViewPtr { 19 | public: 20 | GraphicsViewPtr(GraphicsScene* scene, const OccHandle& view) 21 | : m_scene(scene), 22 | m_view(view) 23 | {} 24 | 25 | const OccHandle& v3dView() const { 26 | return m_view; 27 | } 28 | 29 | GraphicsScene* scene() const { 30 | return m_scene; 31 | } 32 | 33 | void redraw() { 34 | m_scene->redraw(m_view); 35 | } 36 | 37 | const OccHandle& operator->() const { return m_view; } 38 | 39 | private: 40 | GraphicsScene* m_scene = nullptr; 41 | OccHandle m_view; 42 | }; 43 | 44 | } // namespace Mayo 45 | -------------------------------------------------------------------------------- /src/gui/gui_vkey_mouse.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include 8 | 9 | #if OCC_VERSION_HEX >= 0x070400 10 | # include 11 | #else 12 | // Excerpted from OpenCascade/inc/Aspect_VKeyFlags.hxx 13 | // This header was introduced with OpenCascade v7.4.0 14 | 15 | //! Mouse buttons, for combining with Aspect_VKey and Aspect_VKeyFlags. 16 | typedef unsigned int Aspect_VKeyMouse; 17 | 18 | //! Mouse button bitmask 19 | enum 20 | { 21 | Aspect_VKeyMouse_NONE = 0, //!< no buttons 22 | 23 | Aspect_VKeyMouse_LeftButton = 1 << 13, //!< mouse left button 24 | Aspect_VKeyMouse_MiddleButton = 1 << 14, //!< mouse middle button (scroll) 25 | Aspect_VKeyMouse_RightButton = 1 << 15, //!< mouse right button 26 | 27 | Aspect_VKeyMouse_MainButtons = Aspect_VKeyMouse_LeftButton | Aspect_VKeyMouse_MiddleButton | Aspect_VKeyMouse_RightButton 28 | }; 29 | #endif 30 | 31 | constexpr unsigned int Aspect_VKeyMouse_UNKNOWN = 1 << 24; 32 | -------------------------------------------------------------------------------- /src/io_assimp/io_assimp.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "../base/io_reader.h" 8 | #include "../base/property.h" 9 | #include 10 | 11 | #include 12 | 13 | namespace Mayo::IO { 14 | 15 | // Provides factory for Assimp-based Reader objects 16 | class AssimpFactoryReader : public FactoryReader { 17 | public: 18 | Span formats() const override; 19 | std::unique_ptr create(Format format) const override; 20 | std::unique_ptr createProperties(Format format, PropertyGroup* parentGroup) const override; 21 | 22 | static std::unique_ptr create() { 23 | #ifdef MAYO_HAVE_ASSIMP 24 | return std::make_unique(); 25 | #else 26 | return {}; 27 | #endif 28 | } 29 | }; 30 | 31 | struct AssimpLib { 32 | static std::string_view strName() { return "Assimp"; } 33 | #ifdef MAYO_HAVE_ASSIMP 34 | static std::string_view strVersion(); 35 | static std::string_view strVersionDetails(); 36 | #else 37 | static std::string_view strVersion() { return ""; } 38 | static std::string_view strVersionDetails() { return ""; } 39 | #endif 40 | }; 41 | 42 | } // namespace Mayo::IO 43 | -------------------------------------------------------------------------------- /src/io_gmio/io_gmio.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "io_gmio.h" 8 | 9 | #include "io_gmio_amf_writer.h" 10 | 11 | #include 12 | 13 | namespace Mayo::IO { 14 | 15 | Span GmioFactoryWriter::formats() const 16 | { 17 | static const Format array[] = { Format_AMF }; 18 | return array; 19 | } 20 | 21 | std::unique_ptr GmioFactoryWriter::create(Format format) const 22 | { 23 | if (format == Format_AMF) 24 | return std::make_unique(); 25 | 26 | return {}; 27 | } 28 | 29 | std::unique_ptr 30 | GmioFactoryWriter::createProperties(Format format, PropertyGroup* parentGroup) const 31 | { 32 | if (format == Format_AMF) 33 | return GmioAmfWriter::createProperties(parentGroup); 34 | 35 | return {}; 36 | } 37 | 38 | std::string_view GmioLib::strVersion() 39 | { 40 | return GMIO_VERSION_STR; 41 | } 42 | 43 | } // namespace Mayo::IO 44 | -------------------------------------------------------------------------------- /src/io_gmio/io_gmio.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/io_writer.h" 10 | #include "../base/property.h" 11 | #include 12 | 13 | #include 14 | 15 | namespace Mayo::IO { 16 | 17 | // Provides factory for gmio-based Writer objects 18 | class GmioFactoryWriter : public FactoryWriter { 19 | public: 20 | Span formats() const override; 21 | std::unique_ptr create(Format format) const override; 22 | std::unique_ptr createProperties(Format format, PropertyGroup* parentGroup) const override; 23 | 24 | static std::unique_ptr create() { 25 | #ifdef MAYO_HAVE_GMIO 26 | return std::make_unique(); 27 | #else 28 | return {}; 29 | #endif 30 | } 31 | }; 32 | 33 | struct GmioLib { 34 | static std::string_view strName() { return "gmio"; } 35 | #ifdef MAYO_HAVE_GMIO 36 | static std::string_view strVersion(); 37 | static std::string_view strVersionDetails() { return "(build)"; } 38 | #else 39 | static std::string_view strVersion() { return ""; } 40 | static std::string_view strVersionDetails() { return ""; } 41 | #endif 42 | }; 43 | 44 | } // namespace Mayo::IO 45 | -------------------------------------------------------------------------------- /src/io_occ/io_occ.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/io_reader.h" 10 | #include "../base/io_writer.h" 11 | #include "../base/property.h" 12 | 13 | namespace Mayo::IO { 14 | 15 | // Provides factory for OpenCascade-based Reader objects 16 | class OccFactoryReader : public FactoryReader { 17 | public: 18 | Span formats() const override; 19 | std::unique_ptr create(Format format) const override; 20 | std::unique_ptr createProperties(Format format, PropertyGroup* parentGroup) const override; 21 | }; 22 | 23 | // Provides factory for OpenCascade-based Writer objects 24 | class OccFactoryWriter : public FactoryWriter { 25 | public: 26 | Span formats() const override; 27 | std::unique_ptr create(Format format) const override; 28 | std::unique_ptr createProperties(Format format, PropertyGroup* parentGroup) const override; 29 | }; 30 | 31 | } // namespace Mayo::IO 32 | -------------------------------------------------------------------------------- /src/io_occ/io_occ_brep.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/io_reader.h" 10 | #include "../base/io_writer.h" 11 | #include 12 | 13 | namespace Mayo::IO { 14 | 15 | // Reader for OpenCascade BRep file format 16 | class OccBRepReader : public Reader { 17 | public: 18 | bool readFile(const FilePath& filepath, TaskProgress* progress) override; 19 | TDF_LabelSequence transfer(DocumentPtr doc, TaskProgress* progress) override; 20 | void applyProperties(const PropertyGroup*) override {} 21 | 22 | private: 23 | TopoDS_Shape m_shape; 24 | FilePath m_baseFilename; 25 | }; 26 | 27 | // Writer for OpenCascade BRep file format 28 | class OccBRepWriter : public Writer { 29 | public: 30 | bool transfer(Span appItems, TaskProgress* progress) override; 31 | bool writeFile(const FilePath& filepath, TaskProgress* progress) override; 32 | void applyProperties(const PropertyGroup*) override {} 33 | 34 | private: 35 | TopoDS_Shape m_shape; 36 | }; 37 | 38 | } // namespace Mayo::IO 39 | -------------------------------------------------------------------------------- /src/io_occ/io_occ_common.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "io_occ_common.h" 8 | #include "../base/meta_enum.h" 9 | #include "../base/text_id.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace Mayo::IO { 15 | 16 | const char* OccCommon::toCafString(OccCommon::LengthUnit unit) 17 | { 18 | switch (unit) { 19 | case LengthUnit::Undefined: return "??"; 20 | case LengthUnit::Micrometer: return "UM"; 21 | case LengthUnit::Millimeter: return "MM"; 22 | case LengthUnit::Centimeter: return "CM"; 23 | case LengthUnit::Meter: return "M"; 24 | case LengthUnit::Kilometer: return "KM"; 25 | case LengthUnit::Inch: return "INCH"; 26 | case LengthUnit::Foot: return "FT"; 27 | case LengthUnit::Mile: return "MI"; 28 | } 29 | throw std::invalid_argument(fmt::format("{} isn't supported", MetaEnum::name(unit))); 30 | } 31 | 32 | } // namespace Mayo::IO 33 | -------------------------------------------------------------------------------- /src/io_occ/io_occ_common.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/property_enumeration.h" 10 | #include "../base/tkernel_utils.h" 11 | 12 | #if OCC_VERSION_HEX >= OCC_VERSION_CHECK(7, 4, 0) 13 | # include 14 | #endif 15 | 16 | namespace Mayo::IO { 17 | 18 | class OccCommon { 19 | MAYO_DECLARE_TEXT_ID_FUNCTIONS(Mayo::IO::OccCommon) 20 | public: 21 | enum class LengthUnit { 22 | Undefined = -1, 23 | Micrometer, 24 | Millimeter, 25 | Centimeter, 26 | Meter, 27 | Kilometer, 28 | Inch, 29 | Foot, 30 | Mile 31 | }; 32 | 33 | static const char* toCafString(LengthUnit unit); 34 | }; 35 | 36 | } // namespace Mayo::IO 37 | 38 | 39 | namespace Mayo { 40 | 41 | template<> struct EnumNames { 42 | inline static std::string_view trContext = IO::OccCommon::textIdContext(); 43 | inline static std::string_view junkPrefix = ""; 44 | }; 45 | 46 | #if OCC_VERSION_HEX >= OCC_VERSION_CHECK(7, 4, 0) 47 | template<> struct EnumNames { 48 | inline static std::string_view trContext = IO::OccCommon::textIdContext(); 49 | inline static std::string_view junkPrefix = "RWMesh_CoordinateSystem_"; 50 | }; 51 | #endif 52 | 53 | } // namespace Mayo 54 | -------------------------------------------------------------------------------- /src/io_occ/io_occ_gltf_reader.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "io_occ_base_mesh.h" 10 | #include 11 | 12 | namespace Mayo::IO { 13 | 14 | // OpenCascade-based reader for glTF format 15 | // Requires OpenCascade >= v7.4.0 16 | class OccGltfReader : public OccBaseMeshReader { 17 | public: 18 | OccGltfReader(); 19 | 20 | static std::unique_ptr createProperties(PropertyGroup* parentGroup); 21 | void applyProperties(const PropertyGroup* params) override; 22 | 23 | // Parameters 24 | 25 | struct Parameters : public OccBaseMeshReader::Parameters { 26 | bool skipEmptyNodes = true; 27 | bool useMeshNameAsFallback = true; 28 | }; 29 | OccGltfReader::Parameters& parameters() override { return m_params; } 30 | const OccGltfReader::Parameters& constParameters() const override { return m_params; } 31 | 32 | protected: 33 | void applyParameters() override; 34 | 35 | private: 36 | class Properties; 37 | Parameters m_params; 38 | RWGltf_CafReader m_reader; 39 | }; 40 | 41 | } // namespace Mayo::IO 42 | -------------------------------------------------------------------------------- /src/io_occ/io_occ_obj_reader.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "io_occ_base_mesh.h" 10 | #include 11 | 12 | namespace Mayo::IO { 13 | 14 | // OpenCascade-based reader for Wavefront OBJ format 15 | // Requires OpenCascade >= v7.4.0 16 | class OccObjReader : public OccBaseMeshReader { 17 | public: 18 | OccObjReader(); 19 | 20 | static std::unique_ptr createProperties(PropertyGroup* parentGroup); 21 | void applyProperties(const PropertyGroup* params) override; 22 | 23 | // Parameters 24 | 25 | struct Parameters : public OccBaseMeshReader::Parameters { 26 | bool singlePrecisionVertexCoords = false; 27 | }; 28 | OccObjReader::Parameters& parameters() override { return m_params; } 29 | const OccObjReader::Parameters& constParameters() const override { return m_params; } 30 | 31 | protected: 32 | void applyParameters() override; 33 | 34 | private: 35 | class Properties; 36 | Parameters m_params; 37 | RWObj_CafReader m_reader; 38 | }; 39 | 40 | } // namespace Mayo::IO 41 | -------------------------------------------------------------------------------- /src/io_occ/io_occ_obj_writer.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/document_ptr.h" 10 | #include "../base/io_writer.h" 11 | 12 | #include 13 | #include 14 | 15 | namespace Mayo::IO { 16 | 17 | // OpenCascade-based writer for OBJ format 18 | // Requires OpenCascade >= v7.6.0 19 | class OccObjWriter : public Writer { 20 | public: 21 | bool transfer(Span spanAppItem, TaskProgress* progress) override; 22 | bool writeFile(const FilePath& filepath, TaskProgress* progress) override; 23 | 24 | static std::unique_ptr createProperties(PropertyGroup* parentGroup); 25 | void applyProperties(const PropertyGroup* params) override; 26 | 27 | // Parameters 28 | 29 | struct Parameters { 30 | RWMesh_CoordinateSystem inputCoordinateSystem = RWMesh_CoordinateSystem_Undefined; 31 | RWMesh_CoordinateSystem outputCoordinateSystem = RWMesh_CoordinateSystem_glTF; 32 | }; 33 | Parameters& parameters() { return m_params; } 34 | const Parameters& constParameters() const { return m_params; } 35 | 36 | private: 37 | class Properties; 38 | Parameters m_params; 39 | DocumentPtr m_document; 40 | TDF_LabelSequence m_seqRootLabel; 41 | }; 42 | 43 | } // namespace Mayo::IO 44 | 45 | -------------------------------------------------------------------------------- /src/io_occ/io_occ_vrml_reader.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "io_occ_vrml_reader.h" 8 | 9 | namespace Mayo::IO { 10 | 11 | OccVrmlReader::OccVrmlReader() 12 | : OccBaseMeshReader(m_reader) 13 | { 14 | // Fixes weird "mirroring" of the loaded model 15 | m_reader.SetFileLengthUnit(1.); 16 | #if 0 17 | double scaleFactor = 1.; 18 | if (!XCAFDoc_DocumentTool::GetLengthUnit(doc, scaleFactor)) 19 | scaleFactor = UnitsMethods::GetCasCadeLengthUnit(); 20 | m_reader.SetSystemLengthUnit(scaleFactor); 21 | #endif 22 | } 23 | 24 | std::unique_ptr OccVrmlReader::createProperties(PropertyGroup* parentGroup) 25 | { 26 | return std::make_unique(parentGroup); 27 | } 28 | 29 | } // namespace Mayo::IO 30 | -------------------------------------------------------------------------------- /src/io_occ/io_occ_vrml_reader.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "io_occ_base_mesh.h" 10 | #include 11 | 12 | namespace Mayo::IO { 13 | 14 | // OpenCascade-based reader for VRML file format 15 | // Requires OpenCascade >= v7.7.0 16 | class OccVrmlReader : public OccBaseMeshReader { 17 | public: 18 | OccVrmlReader(); 19 | 20 | static std::unique_ptr createProperties(PropertyGroup* parentGroup); 21 | 22 | OccBaseMeshReader::Parameters& parameters() override { return m_params; } 23 | const OccBaseMeshReader::Parameters& constParameters() const override { return m_params; } 24 | 25 | private: 26 | VrmlAPI_CafReader m_reader; 27 | OccBaseMeshReader::Parameters m_params; 28 | }; 29 | 30 | } // namespace Mayo::IO 31 | -------------------------------------------------------------------------------- /src/io_occ/io_occ_vrml_writer.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/io_writer.h" 10 | #include 11 | #include 12 | #include 13 | 14 | namespace Mayo::IO { 15 | 16 | // Opencascade-based writer for VRML(v2.0 UTF8) file format 17 | class OccVrmlWriter : public Writer { 18 | public: 19 | bool transfer(Span appItems, TaskProgress* progress) override; 20 | bool writeFile(const FilePath& filepath, TaskProgress* progress) override; 21 | 22 | static std::unique_ptr createProperties(PropertyGroup* parentGroup); 23 | void applyProperties(const PropertyGroup* params) override; 24 | 25 | // Parameters 26 | 27 | struct Parameters { 28 | VrmlAPI_RepresentationOfShape shapeRepresentation = VrmlAPI_BothRepresentation; 29 | }; 30 | Parameters& parameters() { return m_params; } 31 | const Parameters& constParameters() const { return m_params; } 32 | 33 | private: 34 | class Properties; 35 | Parameters m_params; 36 | std::unique_ptr m_scene; 37 | VrmlAPI_RepresentationOfShape m_shapeRepresentation = VrmlAPI_BothRepresentation; 38 | }; 39 | 40 | } // namespace Mayo::IO 41 | -------------------------------------------------------------------------------- /src/io_off/io_off_reader.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/io_reader.h" 10 | #include "../base/io_single_format_factory.h" 11 | 12 | #include 13 | #include 14 | #include 15 | 16 | namespace Mayo::IO { 17 | 18 | // Reader for OFF file format 19 | class OffReader : public Reader { 20 | public: 21 | bool readFile(const FilePath& filepath, TaskProgress* progress) override; 22 | TDF_LabelSequence transfer(DocumentPtr doc, TaskProgress* progress) override; 23 | void applyProperties(const PropertyGroup*) override {} 24 | 25 | static std::unique_ptr createProperties(PropertyGroup*) { return {}; } 26 | 27 | private: 28 | TDF_Label transferMesh(DocumentPtr doc, TaskProgress* progress); 29 | TDF_Label transferPointCloud(DocumentPtr doc, TaskProgress* progress); 30 | 31 | struct Vertex { 32 | gp_Pnt coords; 33 | std::uint32_t color; 34 | bool hasColor = false; 35 | }; 36 | 37 | struct Facet { 38 | int startIndexInArray; 39 | int vertexCount; 40 | }; 41 | 42 | FilePath m_baseFilename; 43 | std::vector m_vecVertex; 44 | std::vector m_vecAllFacetIndex; 45 | std::vector m_vecFacet; 46 | }; 47 | 48 | // Provides factory to create OffReader objects 49 | class OffFactoryReader : public SingleFormatFactoryReader {}; 50 | 51 | } // namespace Mayo::IO 52 | -------------------------------------------------------------------------------- /src/io_off/io_off_writer.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2023, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/document_tree_node.h" 10 | #include "../base/io_writer.h" 11 | #include "../base/io_single_format_factory.h" 12 | 13 | #include 14 | 15 | namespace Mayo::IO { 16 | 17 | // Writer for OFF file format 18 | class OffWriter : public Writer { 19 | public: 20 | bool transfer(Span appItems, TaskProgress* progress) override; 21 | bool writeFile(const FilePath& filepath, TaskProgress* progress) override; 22 | void applyProperties(const PropertyGroup* group) override; 23 | 24 | static std::unique_ptr createProperties(PropertyGroup*) { return {}; } 25 | 26 | private: 27 | std::vector m_vecTreeNode; 28 | }; 29 | 30 | // Provides factory to create OffWriter objects 31 | class OffFactoryWriter : public SingleFormatFactoryWriter {}; 32 | 33 | } // namespace Mayo::IO { 34 | -------------------------------------------------------------------------------- /src/io_ply/commit_miniply.txt: -------------------------------------------------------------------------------- 1 | 1a235c70390fadf789695c9ccbf285ae712416b3 2 | -------------------------------------------------------------------------------- /src/io_ply/io_ply_reader.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/io_reader.h" 10 | #include "../base/io_single_format_factory.h" 11 | 12 | #include 13 | 14 | namespace Mayo::IO { 15 | 16 | // Reader for PLY file format based on miniply library 17 | class PlyReader : public Reader { 18 | public: 19 | bool readFile(const FilePath& filepath, TaskProgress* progress) override; 20 | TDF_LabelSequence transfer(DocumentPtr doc, TaskProgress* progress) override; 21 | void applyProperties(const PropertyGroup*) override {} 22 | 23 | static std::unique_ptr createProperties(PropertyGroup*) { return {}; } 24 | 25 | private: 26 | TDF_Label transferMesh(DocumentPtr doc, TaskProgress* progress); 27 | TDF_Label transferPointCloud(DocumentPtr doc, TaskProgress* progress); 28 | 29 | FilePath m_baseFilename; 30 | uint32_t m_nodeCount = 0; 31 | std::vector m_vecNodeCoord; 32 | std::vector m_vecIndex; 33 | std::vector m_vecNormalCoord; 34 | std::vector m_vecColorComponent; 35 | }; 36 | 37 | // Provides factory to create PlyReader objects 38 | class PlyFactoryReader : public SingleFormatFactoryReader {}; 39 | 40 | } // namespace Mayo::IO 41 | -------------------------------------------------------------------------------- /src/mayo_config.h.cmake: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #cmakedefine MAYO_WITH_TESTS 10 | #cmakedefine MAYO_HAVE_ASSIMP 11 | #cmakedefine MAYO_HAVE_ASSIMP_aiGetVersionPatch 12 | #cmakedefine MAYO_HAVE_GMIO 13 | 14 | #ifdef HAVE_RAPIDJSON 15 | # define OPENCASCADE_HAVE_RAPIDJSON 16 | #endif 17 | -------------------------------------------------------------------------------- /src/mayo_version.h.cmake: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | namespace Mayo { 10 | 11 | const char strVersion[] = "@Mayo_Version@"; 12 | const char strVersionCommitId[] = "@Mayo_VersionCommit@"; 13 | const unsigned versionRevisionNumber = @Mayo_VersionRevNum@; 14 | const unsigned versionMajor = @Mayo_VersionMajor@; 15 | const unsigned versionMinor = @Mayo_VersionMinor@; 16 | const unsigned versionPatch = @Mayo_VersionPatch@; 17 | 18 | } // namespace Mayo 19 | -------------------------------------------------------------------------------- /src/measure/measure_type.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | namespace Mayo { 10 | 11 | enum class MeasureType { 12 | None, 13 | VertexPosition, 14 | CircleCenter, 15 | CircleDiameter, 16 | MinDistance, 17 | CenterDistance, 18 | Angle, 19 | Length, 20 | Area, 21 | BoundingBox 22 | }; 23 | 24 | } // namespace Mayo 25 | -------------------------------------------------------------------------------- /src/qtbackend/qsettings_storage.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/settings.h" 10 | 11 | #include 12 | 13 | namespace Mayo { 14 | 15 | // Provides QSettings backend for application settings storage 16 | class QSettingsStorage : public Settings::Storage { 17 | public: 18 | QSettingsStorage() = default; 19 | QSettingsStorage(const QString& fileName, QSettings::Format format); 20 | 21 | bool contains(std::string_view key) const override; 22 | Settings::Variant value(std::string_view key) const override; 23 | void setValue(std::string_view key, const Settings::Variant& value) override; 24 | void sync() override; 25 | 26 | const QSettings& get() const { return m_storage; } 27 | 28 | private: 29 | QSettings m_storage; 30 | }; 31 | 32 | } // namespace Mayo 33 | -------------------------------------------------------------------------------- /src/qtbackend/qt_animation_backend.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "qt_animation_backend.h" 8 | 9 | #include "../base/unit_system.h" 10 | 11 | namespace Mayo { 12 | 13 | QtAnimationBackend::QtAnimationBackend(QEasingCurve::Type easingType) 14 | : m_easingCurve(easingType) 15 | { 16 | } 17 | 18 | void QtAnimationBackend::setDuration(QuantityTime t) 19 | { 20 | m_impl.m_duration_ms = UnitSystem::milliseconds(t); 21 | } 22 | 23 | bool QtAnimationBackend::isRunning() const 24 | { 25 | return m_impl.state() == QAbstractAnimation::Running; 26 | } 27 | 28 | void QtAnimationBackend::start() 29 | { 30 | m_impl.start(QAbstractAnimation::KeepWhenStopped); 31 | } 32 | 33 | void QtAnimationBackend::stop() 34 | { 35 | m_impl.stop(); 36 | } 37 | 38 | double QtAnimationBackend::valueForProgress(double p) const 39 | { 40 | return m_easingCurve.valueForProgress(p); 41 | } 42 | 43 | void QtAnimationBackend::setTimerCallback(std::function fn) 44 | { 45 | m_impl.m_callback = std::move(fn); 46 | } 47 | 48 | int QtAnimationBackend::AnimationImpl::duration() const 49 | { 50 | return static_cast(m_duration_ms); 51 | } 52 | 53 | void QtAnimationBackend::AnimationImpl::updateCurrentTime(int currentTime) 54 | { 55 | m_callback(currentTime * Quantity_Millisecond); 56 | } 57 | 58 | } // namespace Mayo 59 | -------------------------------------------------------------------------------- /src/qtbackend/qt_animation_backend.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../gui/v3d_view_camera_animation.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace Mayo { 15 | 16 | // Provides implementation of IAnimationBackend based on QAbstractAnimation 17 | class QtAnimationBackend : public IAnimationBackend { 18 | public: 19 | QtAnimationBackend(QEasingCurve::Type easingType = QEasingCurve::Linear); 20 | 21 | void setDuration(QuantityTime t) override; 22 | 23 | bool isRunning() const override; 24 | 25 | void start() override; 26 | void stop() override; 27 | 28 | double valueForProgress(double p) const override; 29 | 30 | void setTimerCallback(std::function fn) override; 31 | 32 | private: 33 | class AnimationImpl : public QAbstractAnimation { 34 | public: 35 | double m_duration_ms = 1000.; 36 | std::function m_callback; 37 | 38 | int duration() const override; 39 | 40 | protected: 41 | void updateCurrentTime(int currentTime) override; 42 | }; 43 | 44 | AnimationImpl m_impl; 45 | QEasingCurve m_easingCurve; 46 | }; 47 | 48 | } // namespace Mayo 49 | -------------------------------------------------------------------------------- /src/qtbackend/qt_app_translator.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "qt_app_translator.h" 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | namespace Mayo { 15 | 16 | // Function called by the Application i18n system, see Application::addTranslator() 17 | std::string_view qtAppTranslate(const TextId& text, int n) 18 | { 19 | const QString qstr = QCoreApplication::translate(text.trContext.data(), text.key.data(), nullptr, n); 20 | auto qstrHash = qHash(qstr); 21 | static std::unordered_map mapStr; 22 | static QReadWriteLock mapStrLock; 23 | { 24 | QReadLocker locker(&mapStrLock); 25 | auto it = mapStr.find(qstrHash); 26 | if (it != mapStr.cend()) 27 | return it->second; 28 | } 29 | 30 | QWriteLocker locker(&mapStrLock); 31 | auto [it, ok] = mapStr.insert({ qstrHash, qstr.toStdString() }); 32 | return ok ? it->second : std::string_view{}; 33 | } 34 | 35 | } // namespace Mayo 36 | -------------------------------------------------------------------------------- /src/qtbackend/qt_app_translator.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/text_id.h" 10 | 11 | #include 12 | 13 | namespace Mayo { 14 | 15 | // Function called by the Application i18n system, see Application::addTranslator() 16 | std::string_view qtAppTranslate(const TextId& text, int n); 17 | 18 | } // namespace Mayo 19 | -------------------------------------------------------------------------------- /src/qtbackend/qt_signal_thread_helper.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "qt_signal_thread_helper.h" 8 | 9 | #include 10 | 11 | namespace Mayo { 12 | 13 | std::any QtSignalThreadHelper::getCurrentThreadContext() 14 | { 15 | // Note: thread_local implies "static" 16 | // See https://en.cppreference.com/w/cpp/language/storage_duration 17 | thread_local QObject obj; 18 | return &obj; 19 | } 20 | 21 | void QtSignalThreadHelper::execInThread(const std::any& context, const std::function& fn) 22 | { 23 | auto qobject = std::any_cast(context); 24 | #if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0) 25 | QTimer::singleShot(0, qobject, fn); 26 | #else 27 | QMetaObject::invokeMethod(qobject, fn, Qt::ConnectionType::QueuedConnection); 28 | #endif 29 | } 30 | 31 | } // namespace Mayo 32 | -------------------------------------------------------------------------------- /src/qtbackend/qt_signal_thread_helper.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/signal.h" 10 | 11 | namespace Mayo { 12 | 13 | // Provides handling of signal/slot thread mismatch with the help of Qt 14 | // There will be a single QObject created per thread, so it can be used to enqueue slot functions 15 | class QtSignalThreadHelper : public ISignalThreadHelper { 16 | public: 17 | std::any getCurrentThreadContext() override; 18 | void execInThread(const std::any& context, const std::function& fn) override; 19 | }; 20 | 21 | } // namespace Mayo 22 | -------------------------------------------------------------------------------- /src/qtcommon/filepath_conv.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/filepath_conv.h" 10 | 11 | #include 12 | #include 13 | 14 | namespace Mayo { 15 | 16 | // Returns a FilePath object constructed from input 17 | inline FilePath filepathFrom(const QByteArray& bytes) { return filepathFrom(std::string_view{ bytes.constData() }); } 18 | inline FilePath filepathFrom(const QString& str) { return reinterpret_cast(str.utf16()); } 19 | inline FilePath filepathFrom(const QFileInfo& fi) { return filepathFrom(fi.filePath()); } 20 | 21 | // FilePath -> QByteArray 22 | template<> struct FilePathConv { 23 | static auto to(const FilePath& fp) { return QByteArray::fromStdString(fp.u8string()); } 24 | }; 25 | 26 | // FilePath -> QString 27 | template<> struct FilePathConv { 28 | static auto to(const FilePath& fp) { return QString::fromStdString(fp.u8string()); } 29 | }; 30 | 31 | // FilePath -> QFileInfo 32 | template<> struct FilePathConv { 33 | static auto to(const FilePath& fp) { return QFileInfo(FilePathConv::to(fp)); } 34 | }; 35 | 36 | } // namespace Mayo 37 | -------------------------------------------------------------------------------- /src/qtcommon/log_message_handler.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include "../base/filepath.h" 10 | 11 | #include 12 | #include 13 | 14 | #include 15 | 16 | namespace Mayo { 17 | 18 | // Provides customization of Qt message handler 19 | class LogMessageHandler { 20 | public: 21 | static LogMessageHandler& instance(); 22 | 23 | void enableDebugLogs(bool on); 24 | void setOutputFilePath(const FilePath& fp); 25 | 26 | std::ostream& outputStream(QtMsgType type); 27 | 28 | // Function called for Qt message handling 29 | static void qtHandler(QtMsgType type, const QMessageLogContext& context, const QString& msg); 30 | 31 | private: 32 | LogMessageHandler() = default; 33 | 34 | FilePath m_outputFilePath; 35 | std::ofstream m_outputFile; 36 | bool m_enableDebugLogs = true; 37 | }; 38 | } // namespace Mayo 39 | -------------------------------------------------------------------------------- /src/qtcommon/qstring_conv.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "../base/global.h" 8 | #ifdef MAYO_OS_WINDOWS 9 | # include 10 | #endif 11 | 12 | #include "qstring_conv.h" 13 | 14 | namespace Mayo { 15 | 16 | std::string consoleToPrintable(const QString& str) 17 | { 18 | #ifdef MAYO_OS_WINDOWS 19 | const auto codepage = GetConsoleOutputCP(); 20 | const wchar_t* source = reinterpret_cast(str.utf16()); 21 | const int dstSize = WideCharToMultiByte(codepage, 0, source, -1, nullptr, 0, nullptr, nullptr); 22 | std::string dst; 23 | dst.resize(dstSize + 1); 24 | WideCharToMultiByte(codepage, 0, source, -1, dst.data(), dstSize, nullptr, nullptr); 25 | dst.back() = '\0'; 26 | return dst; 27 | #else 28 | return str.toStdString(); // utf8 29 | #endif 30 | } 31 | 32 | std::string consoleToPrintable(std::string_view str) 33 | { 34 | #ifdef MAYO_OS_WINDOWS 35 | return consoleToPrintable(to_QString(str)); 36 | #else 37 | return std::string(str); // utf8 38 | #endif 39 | } 40 | 41 | } // namespace Mayo 42 | -------------------------------------------------------------------------------- /src/qtcommon/qtcore_hfuncs.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | #include 12 | 13 | namespace boost { 14 | 15 | // Implementation of Boost's hash function for QByteArray 16 | inline std::size_t hash_value(const QByteArray& key) { 17 | return qHash(key); 18 | } 19 | 20 | // Implementation of Boost's hash function for QString 21 | inline std::size_t hash_value(const QString& key) { 22 | return qHash(key); 23 | } 24 | 25 | } // namespace boost 26 | 27 | #if QT_VERSION < QT_VERSION_CHECK(5, 14, 0) 28 | namespace std { 29 | 30 | // Specialization of C++11 std::hash<> functor for QByteArray 31 | template<> struct hash { 32 | inline std::size_t operator()(const QByteArray& key) const { 33 | return qHash(key); 34 | } 35 | }; 36 | 37 | // Specialization of C++11 std::hash<> functor for QString 38 | template<> struct hash { 39 | inline std::size_t operator()(const QString& key) const { 40 | return qHash(key); 41 | } 42 | }; 43 | 44 | } // namespace std 45 | #endif 46 | -------------------------------------------------------------------------------- /src/qtcommon/qtcore_utils.cpp: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2024, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #include "qtcore_utils.h" 8 | 9 | #include 10 | 11 | namespace Mayo::QtCoreUtils { 12 | 13 | std::vector toStdByteArray(const QByteArray& bytes) 14 | { 15 | std::vector stdBytes; 16 | stdBytes.resize(bytes.size()); 17 | std::copy(bytes.cbegin(), bytes.cend(), stdBytes.begin()); 18 | return stdBytes; 19 | } 20 | 21 | Qt::CheckState toQtCheckState(Mayo::CheckState state) 22 | { 23 | switch (state) { 24 | case CheckState::Off: return Qt::Unchecked; 25 | case CheckState::Partially: return Qt::PartiallyChecked; 26 | case CheckState::On: return Qt::Checked; 27 | } 28 | 29 | return Qt::Unchecked; 30 | } 31 | 32 | Mayo::CheckState toCheckState(Qt::CheckState state) 33 | { 34 | switch (state) { 35 | case Qt::Unchecked: return CheckState::Off; 36 | case Qt::PartiallyChecked: return CheckState::Partially; 37 | case Qt::Checked: return CheckState::On; 38 | } 39 | 40 | return CheckState::Off; 41 | } 42 | 43 | } // namespace Mayo::QtCoreUtils 44 | -------------------------------------------------------------------------------- /tests/inputs/#258_cube.off: -------------------------------------------------------------------------------- 1 | OFF 24 12 0 2 | 0 0 0 0.603827 0.603827 0.603827 3 | 0 0 10 0.603827 0.603827 0.603827 4 | 0 10 0 0.603827 0.603827 0.603827 5 | 0 10 10 0.603827 0.603827 0.603827 6 | 10 0 0 0.603827 0.603827 0.603827 7 | 10 0 10 0.603827 0.603827 0.603827 8 | 10 10 0 0.603827 0.603827 0.603827 9 | 10 10 10 0.603827 0.603827 0.603827 10 | 0 0 0 0.603827 0.603827 0.603827 11 | 10 0 0 0.603827 0.603827 0.603827 12 | 0 0 10 0.603827 0.603827 0.603827 13 | 10 0 10 0.603827 0.603827 0.603827 14 | 0 10 0 0.603827 0.603827 0.603827 15 | 10 10 0 0.603827 0.603827 0.603827 16 | 0 10 10 0.603827 0.603827 0.603827 17 | 10 10 10 0.603827 0.603827 0.603827 18 | 0 0 0 0.603827 0.603827 0.603827 19 | 0 10 0 0.603827 0.603827 0.603827 20 | 10 0 0 0.603827 0.603827 0.603827 21 | 10 10 0 0.603827 0.603827 0.603827 22 | 0 0 10 0.603827 0.603827 0.603827 23 | 0 10 10 0.603827 0.603827 0.603827 24 | 10 0 10 0.603827 0.603827 0.603827 25 | 10 10 10 0.603827 0.603827 0.603827 26 | 3 1 0 2 27 | 3 1 2 3 28 | 3 5 4 6 29 | 3 5 6 7 30 | 3 11 9 8 31 | 3 11 8 10 32 | 3 15 13 12 33 | 3 15 12 14 34 | 3 19 17 16 35 | 3 19 16 18 36 | 3 23 21 20 37 | 3 23 20 22 38 | -------------------------------------------------------------------------------- /tests/inputs/cube.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/tests/inputs/cube.bin -------------------------------------------------------------------------------- /tests/inputs/cube.mtl: -------------------------------------------------------------------------------- 1 | # FreeCAD v0.18 build16131 (Git) Arch module 2 | # http://www.freecadweb.org 3 | newmtl color_cccccc 4 | Kd 0.800000011920929 0.800000011920929 0.800000011920929 5 | d 0 6 | # Material Count: 1 -------------------------------------------------------------------------------- /tests/inputs/cube.obj: -------------------------------------------------------------------------------- 1 | # FreeCAD v0.18 build16131 (Git) Arch module 2 | # http://www.freecadweb.org 3 | mtllib cube.mtl 4 | o Part__Feature 5 | usemtl color_cccccc 6 | v 0.0 0.0 0.0 7 | v 0.0 0.0 10.0 8 | v 0.0 10.0 0.0 9 | v 0.0 10.0 10.0 10 | v 10.0 0.0 10.0 11 | v 10.0 0.0 0.0 12 | v 10.0 10.0 0.0 13 | v 10.0 10.0 10.0 14 | f 1 2 3 15 | f 3 2 4 16 | f 5 6 7 17 | f 5 7 8 18 | f 6 5 1 19 | f 1 5 2 20 | f 8 7 3 21 | f 8 3 4 22 | f 3 7 1 23 | f 1 7 6 24 | f 8 4 2 25 | f 8 2 5 26 | -------------------------------------------------------------------------------- /tests/inputs/cube.off: -------------------------------------------------------------------------------- 1 | OFF 2 | 24 12 0 3 | 0 0 0 0.603827 0.603827 0.603827 4 | 0 0 10 0.603827 0.603827 0.603827 5 | 0 10 0 0.603827 0.603827 0.603827 6 | 0 10 10 0.603827 0.603827 0.603827 7 | 10 0 0 0.603827 0.603827 0.603827 8 | 10 0 10 0.603827 0.603827 0.603827 9 | 10 10 0 0.603827 0.603827 0.603827 10 | 10 10 10 0.603827 0.603827 0.603827 11 | 0 0 0 0.603827 0.603827 0.603827 12 | 10 0 0 0.603827 0.603827 0.603827 13 | 0 0 10 0.603827 0.603827 0.603827 14 | 10 0 10 0.603827 0.603827 0.603827 15 | 0 10 0 0.603827 0.603827 0.603827 16 | 10 10 0 0.603827 0.603827 0.603827 17 | 0 10 10 0.603827 0.603827 0.603827 18 | 10 10 10 0.603827 0.603827 0.603827 19 | 0 0 0 0.603827 0.603827 0.603827 20 | 0 10 0 0.603827 0.603827 0.603827 21 | 10 0 0 0.603827 0.603827 0.603827 22 | 10 10 0 0.603827 0.603827 0.603827 23 | 0 0 10 0.603827 0.603827 0.603827 24 | 0 10 10 0.603827 0.603827 0.603827 25 | 10 0 10 0.603827 0.603827 0.603827 26 | 10 10 10 0.603827 0.603827 0.603827 27 | 3 1 0 2 28 | 3 1 2 3 29 | 3 5 4 6 30 | 3 5 6 7 31 | 3 11 9 8 32 | 3 11 8 10 33 | 3 15 13 12 34 | 3 15 12 14 35 | 3 19 17 16 36 | 3 19 16 18 37 | 3 23 21 20 38 | 3 23 20 22 39 | -------------------------------------------------------------------------------- /tests/inputs/cube.ply: -------------------------------------------------------------------------------- 1 | ply 2 | format binary_little_endian 1.0 3 | comment Created by FreeCAD 4 | element vertex 8 5 | property float32 x 6 | property float32 y 7 | property float32 z 8 | element face 12 9 | property list uchar int vertex_index 10 | end_header 11 | A A A A A A A A A A A A -------------------------------------------------------------------------------- /tests/inputs/cube.stlb: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/tests/inputs/cube.stlb -------------------------------------------------------------------------------- /tests/inputs/face_trsf_scale_almost_1.stl: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fougue/mayo/fffa83cd0f40b0227b6c02da851a46b6bb4f5e98/tests/inputs/face_trsf_scale_almost_1.stl -------------------------------------------------------------------------------- /tests/qttest_utils.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2025, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | 11 | // MAYO_QVERIFY_THROWS_EXCEPTION() is a helper macro to facilitate Qt5/Qt6 portability as 12 | // Qt5 QVERIFY_EXCEPTION_THROWN() was deprecated since Qt6.3.0 13 | #if QT_VERSION < QT_VERSION_CHECK(6, 3, 0) 14 | # define MAYO_QVERIFY_THROWS_EXCEPTION(exceptionType, ...) QVERIFY_EXCEPTION_THROWN(__VA_ARGS__, exceptionType) 15 | #else 16 | # define MAYO_QVERIFY_THROWS_EXCEPTION(exceptionType, ...) QVERIFY_THROWS_EXCEPTION(exceptionType, __VA_ARGS__) 17 | #endif 18 | -------------------------------------------------------------------------------- /tests/test_app.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2021, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #include 10 | #include 11 | 12 | namespace Mayo { 13 | 14 | class TestApp : public QObject { 15 | Q_OBJECT 16 | private slots: 17 | void DocumentFilesWatcher_test(); 18 | 19 | void FilePathConv_test(); 20 | 21 | void QStringUtils_append_test(); 22 | void QStringUtils_append_test_data(); 23 | void QStringUtils_text_test(); 24 | void QStringUtils_text_test_data(); 25 | 26 | void RecentFiles_test(); 27 | void RecentFiles_QPixmap_test(); 28 | 29 | void AppUiState_test(); 30 | 31 | void StringConv_test(); 32 | 33 | void QtGuiUtils_test(); 34 | }; 35 | 36 | } // namespace Mayo 37 | -------------------------------------------------------------------------------- /tests/test_measure.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************** 2 | ** Copyright (c) 2022, Fougue Ltd. 3 | ** All rights reserved. 4 | ** See license at https://github.com/fougue/mayo/blob/master/LICENSE.txt 5 | ****************************************************************************/ 6 | 7 | #pragma once 8 | 9 | #if defined(_MSC_VER) && !defined(_USE_MATH_DEFINES) 10 | # define _USE_MATH_DEFINES // Fix M_E, M_PI, ... macro redefinitions with qmath.h 11 | #endif 12 | #include 13 | #include 14 | 15 | namespace Mayo { 16 | 17 | class TestMeasure : public QObject { 18 | Q_OBJECT 19 | private slots: 20 | void BRepVertexPosition_test(); 21 | 22 | void BRepCircle_Regular_test(); 23 | void BRepCircle_Ellipse_test(); 24 | void BRepCircle_PseudoCircle_test(); 25 | void BRepCircle_PolygonEdge_test(); 26 | 27 | void BRepMinDistance_TwoPoints_test(); 28 | void BRepMinDistance_TwoBoxes_test(); 29 | void BRepMinDistance_TwoConfusedFaces_test(); 30 | 31 | void BRepAngle_TwoLinesIntersect_test(); 32 | void BRepAngle_TwoLinesParallelError_test(); 33 | 34 | void BRepLength_PolygonEdge_test(); 35 | 36 | void BRepArea_TriangulationFace_test(); 37 | 38 | void BRepBoundingBox_Sphere_test(); 39 | void BRepBoundingBox_NullShape_test(); 40 | }; 41 | 42 | } // namespace Mayo 43 | --------------------------------------------------------------------------------