How fougue/mayo works
Project Type & Purpose
• Mayo is a cross‑platform desktop application (Windows, Linux, macOS) plus a command‑line utility for viewing and converting 3D CAD files.
• Written in modern C++ using Qt for UI, OpenCascade for CAD kernel, and various 3rd‑party libraries (fmt, GSL, fast_float, magic_enum, etc.).
File Structure Analysis
– Top‑level CMakeLists.txt, README and LICENSE define build and documentation.
– “src” subdivides into:
• app: main GUI application, window management, commands, dialogs, widgets.
• gui: view controllers, document wrappers, event handling.
• cli: command‑line interface entry point and export commands.
• base: core engine – document model, I/O registration, task management, settings, messaging.
• graphics: wrappers around OpenCascade’s rendering, scene/driver management.
• io_*: one directory per file format plugin (STEP, IGES, STL, OBJ, glTF, PLY, DXF, etc.).
• measure: measurement tools for geometry.
• qtbackend & qtcommon: glue between core engine and Qt (settings storage, translators, threading, string conversion).
• 3rdparty: bundled external libs (fmt, fast_float, GSL, etc.).
– tests folder contains unit tests spanning app, base, measure.
Key README Insights
– Emphasis on two front‑ends (GUI + CLI) over a shared core.
– Plugin‑style I/O system supporting import/export of many CAD formats.
– Architectural cues: modularity, extensibility, MVC‑style separation, command pattern.
a. Components
1. Front‑ends:
• GUI Application (src/app + src/gui + Qt backend)
• CLI Application (src/cli)
2. Core Engine (src/base):
• Document Manager, Task Manager, Settings, Messaging, I/O System Registry
3. I/O Plugins (src/io_*): one module per file format, registered with I/O System
4. Graphics Engine (src/graphics + OpenCascade): scene graph, object drivers, view controllers
5. Measurement Tools (src/measure)
6. Qt Integration Layer (src/qtbackend, src/qtcommon)
7. 3rd‑Party Libraries (fmt, GSL, fast_float, magic_enum, OpenCascade, Qt)
8. Build & CI: CMake, scripts, GitHub Actions
b. Relationships & Data Flows
• GUI ↔ Core: UI drives document creation, invokes commands, listens to engine events
• CLI → Core: issues batch export commands via I/O System
• Core ↔ I/O Plugins: Core hands over file read/write requests to registered plugins
• Core ↔ Graphics Engine: Core updates scene, issues render/update calls
• Measurement ↔ Core/Graphics: measurement tools query geometry from Core, overlay results in Graphics
• Qt Integration: GUI & Core communicate over Qt signals/slots; settings persisted via Qt backend
• 3rd‑Party: All layers depend on Qt and OpenCascade; core may use fmt/GSL/fast_float
c. Architectural Patterns
• Layered Architecture – Front‑ends, Core, Plugins, External libs
• Plugin Pattern – I/O modules dynamically registered
• MVC/MVP – GUI widgets (view) separate from app_context & document (model)
• Command Pattern – user actions mapped to commands_api
• Observer/Event Bus – messaging and Qt signals/slots for decoupling
d. Technologies & Frameworks
• Build: CMake, custom scripts, GitHub Actions pipelines
• UI: Qt Widgets, .ui forms, qrc resources, i18n via Qt Linguist
• CAD kernel: OpenCascade (BREP, mesh, XDE)
• Logging & formatting: fmt
• Utility libraries: GSL, fast_float, magic_enum