imengine - CAD Engine

ImEDA의 핵심 CAD 엔진 - 문서 모델, 렌더링, 기하학 연산의 기반

개요

imengine은 ImEDA의 CAD 엔진으로, 회로도(SCH), PCB 보드, 전자부품 심볼(EPD), 풋프린트(FP) 등 모든 CAD 문서의 데이터 모델, 렌더링, 편집 로직을 담당합니다.

규모: 37개 이상의 서브시스템, 1,000개 이상의 헤더 파일로 구성된 대규모 엔진입니다. 네임스페이스 codename7 아래에서 동작하며, imapp과는 DLL 인터페이스 및 Lua를 통해 통신합니다.

계층 아키텍처

imengine은 4개의 주요 레이어로 구성됩니다. 상위 레이어는 하위 레이어에 의존합니다.

Document Model
SCH PCB EPD FP
Geometry Base
c_geo_item, Circle, Arc, Segment, Polygon, Text, Group
View & Rendering
c_view, c_gal, OpenGL Backend, Painter, View Layers
Math / Core
Vectors, Matrices, Thread Pool, String Utils, Color

주요 서브시스템

서브시스템설명주요 클래스상세
Document Model4가지 문서 타입의 데이터 모델 및 직렬화c_schematic, c_board, c_footprintDocument Model
Schematic회로도 엔진 - 심볼, 와이어, 넷, 계층 구조c_sch, c_sch_sheet, c_lib_symbolSchematic
PCBPCB 보드 엔진 - 레이어, 트랙, 패드, 존c_board, c_pcb_track, c_zonePCB
Geometry기하학 기본 도형 및 연산c_geo_item, c_geo_text, c_segGeometry
GALGraphics Abstraction Layer - OpenGL 렌더링c_gal, c_opengl_gal, c_vertex_managerGAL Rendering
View뷰 관리 - 줌, 패닝, 레이어 가시성c_view, c_view_item, c_painterView System
LuaLua 스크립팅 바인딩 (sol2 기반)c_lua, sol2 usertypeLua Interface
File I/OS-expression 기반 파일 입출력imsexpr, c_outputformatterFile I/O
Math수학 연산, 벡터, 행렬, 유틸리티c_vector2d, c_matrix3x3, c_color4dMath & Core

설계 패턴

계층 구조 (Hierarchy)

모든 CAD 요소는 c_view_itemc_geo_item → 문서별 아이템 클래스로 이어지는 계층 구조를 따릅니다. 공통 렌더링, 선택, 직렬화 로직을 재사용합니다.

Undo/Redo

c_unified_commit 기반의 스트림 직렬화 방식으로 Undo/Redo를 구현합니다. 모든 변경사항은 commit 단위로 기록됩니다.

c_unified_commit(frame, frame->GetStreamUndoManager(),
                 frame->GetStreamSerializer());

Painter 분리

데이터 모델과 렌더링 로직을 완전히 분리합니다. c_painter 계열 클래스가 c_gal을 사용하여 각 아이템을 그립니다. 문서 타입별 전용 Painter가 존재합니다.

Lua 바인딩

sol2 라이브러리를 통해 엔진의 주요 클래스와 함수를 Lua에 노출합니다. Drawing tool, 검증 스크립트, 자동화 등에 활용됩니다. usertype 호출은 geo.Type.new(...) 형식을 사용합니다.

네임스페이스 및 빌드

항목
네임스페이스codename7
언어 표준C++20
플랫폼Windows / Linux / macOS
빌드 병렬도-j8
문자열std::string (UTF-8 전용, std::wstring 금지)
JSONnlohmann/json.hpp