57 std::unique_ptr<KIGFX::GAL_DISPLAY_OPTIONS> aGalOptions ) :
75 m_view->SetMirror(
false,
false );
91 m_hoverBox = std::make_unique<HIGHLIGHT_BOX_ITEM>();
95 m_gal->SetCursorEnabled(
false );
99 SetMinSize( wxSize( -1, 100 ) );
108 SetEvtHandlerEnabled(
true );
142 m_gal->SetWorldUnitLength( aWorldUnitLength );
143 m_gal->ComputeWorldScreenMatrix();
197 const std::optional<KIID> focusKiid =
222 if( !eda || eda->
m_Uuid != *focusKiid )
225 const BOX2I bb = item->ViewBBox();
249 const std::size_t idx =
static_cast<std::size_t
>( aCategory );
260 if( cat != aCategory )
263 m_view->SetVisible( item, aVisible );
280 const std::size_t idx =
static_cast<std::size_t
>( cat );
290 const std::size_t idx =
static_cast<std::size_t
>( aCategory );
321 std::set<KIID> hiddenItems;
326 hiddenItems.insert(
path.back() );
335 const bool hidden = eda && hiddenItems.count( eda->
m_Uuid ) > 0;
352 m_view->SetLayerVisible( aLayer, aVisible );
397 BOX2I ib = item->ViewBBox();
421 const wxSize client = GetClientSize();
423 if( client.x <= 0 || client.y <= 0 )
444 m_view->SetViewport( viewport );
453 if( !bb || bb->GetWidth() <= 0 || bb->GetHeight() <= 0 )
491 if( !aBox || !aBox->shown || aBox->bbox.GetWidth() <= 0 || aBox->bbox.GetHeight() <= 0 )
497 m_overlay->Rectangle( aBox->bbox.GetOrigin(), aBox->bbox.GetEnd() );
529 for(
auto sIt = list.rbegin(); sIt != list.rend(); ++sIt )
546 std::optional<KIID_PATH> picked;
549 picked = shape->changeId;
605 std::optional<KIID_PATH> hovered;
619 if( shape && hovered )
647 switch( aEvent.GetKeyCode() )
650 if(
m_scene.documentBBox.GetWidth() ||
m_scene.documentBBox.GetHeight() )
680 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
static constexpr GAL_TYPE GAL_FALLBACK
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
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.
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...
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_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