57 std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> aGalOptions ) :
58 EDA_DRAW_PANEL_GAL( aParent, aId, wxDefaultPosition, wxDefaultSize, *aGalOptions, aBackend ),
68 m_view->SetLayerTarget( i, target );
80 m_view->SetMirror(
false,
false );
96 m_hoverBox = std::make_unique<HIGHLIGHT_BOX_ITEM>();
100 m_gal->SetCursorEnabled(
false );
104 SetMinSize( wxSize( -1, 100 ) );
114 SetEvtHandlerEnabled(
true );
148 m_gal->SetWorldUnitLength( aWorldUnitLength );
149 m_gal->ComputeWorldScreenMatrix();
203 const std::optional<KIID> focusKiid =
228 if( !eda ||
getItemId( *eda ) != *focusKiid )
231 const BOX2I bb = item->ViewBBox();
255 const std::size_t idx =
static_cast<std::size_t
>( aCategory );
266 if( cat != aCategory )
269 m_view->SetVisible( item, aVisible );
286 const std::size_t idx =
static_cast<std::size_t
>( cat );
296 const std::size_t idx =
static_cast<std::size_t
>( aCategory );
327 std::set<KIID> hiddenItems;
332 hiddenItems.insert(
path.back() );
341 const bool hidden = eda && hiddenItems.count(
getItemId( *eda ) ) > 0;
364 m_view->SetLayerVisible( aLayer, aVisible );
409 BOX2I ib = item->ViewBBox();
433 const wxSize client = GetClientSize();
435 if( client.x <= 0 || client.y <= 0 )
456 m_view->SetViewport( viewport );
465 if( !bb || bb->GetWidth() <= 0 || bb->GetHeight() <= 0 )
503 if( !aBox || !aBox->shown || aBox->bbox.GetWidth() <= 0 || aBox->bbox.GetHeight() <= 0 )
509 m_overlay->Rectangle( aBox->bbox.GetOrigin(), aBox->bbox.GetEnd() );
541 for(
auto sIt = list.rbegin(); sIt != list.rend(); ++sIt )
558 std::optional<KIID_PATH> picked;
561 picked = shape->changeId;
631 if(
m_leftPanning && aEvent.Dragging() && aEvent.LeftIsDown() )
633 VECTOR2D pos( aEvent.GetX(), aEvent.GetY() );
642 std::optional<KIID_PATH> hovered;
656 if( shape && hovered )
685 switch( aEvent.GetKeyCode() )
688 if(
m_scene.documentBBox.GetWidth() ||
m_scene.documentBBox.GetHeight() )
718 default: aEvent.Skip();
return;
constexpr BOX2I KiROUND(const BOX2D &aBoxD)
constexpr BOX2< Vec > & Inflate(coord_type dx, coord_type dy)
Inflates the rectangle horizontally by dx and vertically by dy.
constexpr size_type GetWidth() const
constexpr BOX2< Vec > & Merge(const BOX2< Vec > &aRect)
Modify the position and size of the rectangle in order to contain aRect.
constexpr ecoord_type GetArea() const
Return the area of the rectangle.
constexpr size_type GetHeight() const
constexpr coord_type GetLeft() const
constexpr bool Contains(const Vec &aPoint) const
constexpr coord_type GetTop() const
std::unique_ptr< KIGFX::PAINTER > m_painter
Contains information about how to draw items using GAL.
void StopDrawing()
Prevent the GAL canvas from further drawing until it is recreated or StartDrawing() is called.
KIGFX::GAL * m_gal
Interface for drawing objects on a 2D-surface.
EDA_DRAW_PANEL_GAL(wxWindow *aParentWindow, wxWindowID aWindowId, const wxPoint &aPosition, const wxSize &aSize, KIGFX::GAL_DISPLAY_OPTIONS &aOptions, GAL_TYPE aGalType=GAL_TYPE_OPENGL)
Create a drawing panel that is contained inside aParentWindow.
static bool IsAccelerated(GAL_TYPE aCanvasType)
True for a canvas drawn on the GPU, which keeps cached layers between frames.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
KIGFX::VIEW * m_view
Stores view settings (scale, center, etc.) and items to be drawn.
KIGFX::WX_VIEW_CONTROLS * m_viewControls
Control for VIEW (moving, zooming, etc.)
void StartDrawing()
Begin drawing if it was stopped previously.
GAL_TYPE m_backend
Currently used GAL.
A base class for most all the KiCad significant classes used in schematics and boards.
A color representation with 4 components: red, green, blue, alpha.
An abstract base class for deriving all objects that can be added to a VIEW.
virtual const BOX2I ViewBBox() const =0
Return the bounding box of the item covering all its layers.
Hold a (potentially large) number of VIEW_ITEMs and renders them on a graphics device provided by the...
static constexpr int VIEW_MAX_LAYERS
Maximum number of layers that may be shown.
An implementation of class VIEW_CONTROLS for wxWidgets library.
LSET is a set of PCB_LAYER_IDs.
@ LAYER_GP_OVERLAY
General purpose overlay.
PCB_LAYER_ID
A quick note on layer IDs:
KIGFX::COLOR4D ThemeColorFor(const DIFF_COLOR_THEME &aTheme, CATEGORY aCategory)
Map a CATEGORY to its color in a DIFF_COLOR_THEME.
std::optional< BOX2I > HighlightedBBox(const DIFF_SCENE &aScene, const KIID_PATH &aChangeId, const std::array< bool, CATEGORY_COUNT > &aCategoryVisible)
Union bbox of every visible SCENE_SHAPE whose changeId matches aChangeId.
void RenderSceneToOverlay(KIGFX::VIEW_OVERLAY &aOverlay, const DIFF_SCENE &aScene, const std::array< bool, CATEGORY_COUNT > &aVisible, const std::optional< KIID_PATH > &aHighlight, const std::set< KIID_PATH > &aHidden)
Push a DIFF_SCENE's shapes onto a VIEW_OVERLAY as filled, semi-transparent rectangles,...
CATEGORY
Visual category each ITEM_CHANGE belongs to in the scene.
const std::vector< SCENE_SHAPE > & ShapesFor(const DIFF_SCENE &aScene, CATEGORY aCategory)
Read-only access to a DIFF_SCENE's shape list for a given category.
constexpr std::array< CATEGORY, 4 > PAINT_ORDER
Paint order.
DOCUMENT_GEOMETRY FilterGeometryByVisibleLayers(const DOCUMENT_GEOMETRY &aGeometry, const LSET &aVisibleLayers)
Copy geometry primitives whose layer set intersects aVisibleLayers.
The Cairo implementation of the graphics abstraction layer.
@ REPAINT
Item needs to be redrawn.
@ TARGET_NONCACHED
Auxiliary rendering target (noncached)
@ TARGET_CACHED
Main rendering target (cached)
@ TARGET_OVERLAY
Items that may change while the view stays the same (noncached)
Diff colors with defaults for light backgrounds.
Shared rendering model consumed by both the GAL renderer (interactive widget) and the plotter rendere...
KIID_PATH changeId
Stable identifier of the ITEM_CHANGE that produced this shape.
VECTOR2< int32_t > VECTOR2I
VECTOR2< double > VECTOR2D
WX_VIEW_CONTROLS class definition.
#define ZOOM_MIN_LIMIT_DIFF
#define ZOOM_MAX_LIMIT_DIFF