Wiki

Clone wiki

FlatCAM / Canvas

Graphics display system in FlatCAM

Description

This page documents the development of a high-performance plotting system, mainly allowing for very complex geometric constructs while maintaining a responsive GUI, with almost instantaneous zoom and pan.

Approach

The canvas is based on MatPlotLib, a highly capable plotting library for Python. It's performance degrades with the number of objects being plotted. The approach to improving the performance is Bitmap Caching. Bitmaps for the rendered project are kept in memory and updated in the background and manipulation of the display is done mostly on the bitmaps instead of the raw data.

Basic Concepts

Units

The image below shows the relationship between "user units" and "pixels":

project_resolution.png

The resolution can be obtained by calling PlotCanvas.get_resolution().

Data Structures and Signals

This diagram (work in progress) summarizes the data structures, signals and callbacks involved in the canvas:

structure.png

Updated