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 ) );
113 SetEvtHandlerEnabled(
true );
147 m_gal->SetWorldUnitLength( aWorldUnitLength );
148 m_gal->ComputeWorldScreenMatrix();
202 const std::optional<KIID> focusKiid =
227 if( !eda || eda->
m_Uuid != *focusKiid )
230 const BOX2I bb = item->ViewBBox();
254 const std::size_t idx =
static_cast<std::size_t
>( aCategory );
265 if( cat != aCategory )
268 m_view->SetVisible( item, aVisible );
285 const std::size_t idx =
static_cast<std::size_t
>( cat );
295 const std::size_t idx =
static_cast<std::size_t
>( aCategory );
326 std::set<KIID> hiddenItems;
331 hiddenItems.insert(
path.back() );
340 const bool hidden = eda && hiddenItems.count( eda->
m_Uuid ) > 0;
357 m_view->SetLayerVisible( aLayer, aVisible );
402 BOX2I ib = item->ViewBBox();
426 const wxSize client = GetClientSize();
428 if( client.x <= 0 || client.y <= 0 )
449 m_view->SetViewport( viewport );
458 if( !bb || bb->GetWidth() <= 0 || bb->GetHeight() <= 0 )
496 if( !aBox || !aBox->shown || aBox->bbox.GetWidth() <= 0 || aBox->bbox.GetHeight() <= 0 )
502 m_overlay->Rectangle( aBox->bbox.GetOrigin(), aBox->bbox.GetEnd() );
534 for(
auto sIt = list.rbegin(); sIt != list.rend(); ++sIt )
551 std::optional<KIID_PATH> picked;
554 picked = shape->changeId;
610 std::optional<KIID_PATH> hovered;
624 if( shape && hovered )
652 switch( aEvent.GetKeyCode() )
655 if(
m_scene.documentBBox.GetWidth() ||
m_scene.documentBBox.GetHeight() )
685 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.
virtual void Refresh(bool aEraseBackground=true, const wxRect *aRect=nullptr) override
@ GAL_TYPE_OPENGL
OpenGL implementation.
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)
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