21#ifndef KICAD_DIFF_SCENE_H
22#define KICAD_DIFF_SCENE_H
101 using PolygonList = std::vector<std::vector<std::vector<VECTOR2I>>>;
202 if( aGeometry.
Empty() )
350 const LSET& aVisibleLayers );
434 const std::array<bool, CATEGORY_COUNT>& aCategoryVisible );
constexpr EDA_IU_SCALE schIUScale
constexpr EDA_IU_SCALE pcbIUScale
A color representation with 4 components: red, green, blue, alpha.
LSET is a set of PCB_LAYER_IDs.
Represent a set of closed polygons.
CHANGE_KIND
Coarse classification of a single item-level change between two documents.
constexpr std::size_t CATEGORY_COUNT
wxString ChangeDisplayLabel(const ITEM_CHANGE &aChange)
User-facing item label used consistently by scene tooltips and change tree entries.
DIFF_SCENE BuildScene(const DOCUMENT_DIFF &aDiff, const DIFF_COLOR_THEME &aTheme)
Build a DIFF_SCENE from a DOCUMENT_DIFF, populating the shape lists and computing the union bbox.
DOCUMENT_POLYGON MakeBBoxOutline(const BOX2I &aBBox, const KIGFX::COLOR4D &aColor, int aLineWidth)
Build a DOCUMENT_POLYGON outlining a bounding box.
LSET GeometryLayerSet(const DOCUMENT_GEOMETRY &aGeometry)
Return the union of every non-empty layer set carried by the geometry.
void CollectChangeBBoxes(const DOCUMENT_DIFF &aDiff, std::map< KIID_PATH, BOX2I > &aOut)
Walk a DOCUMENT_DIFF and populate a (KIID_PATH → BOX2I) map with each changed item's bbox,...
const EDA_IU_SCALE & IuScaleForDocKind(DOC_KIND aKind)
Internal-unit scale a document kind's coordinates are expressed in.
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 IterateDocumentGeometry(const DOCUMENT_GEOMETRY &aGeometry, GEOMETRY_SINK &aSink)
Walk a DOCUMENT_GEOMETRY in the canonical render order shared by the GAL and plotter renderers: every...
void AppendGeometry(DOCUMENT_GEOMETRY &aDst, DOCUMENT_GEOMETRY &&aSrc)
Move all primitives from aSrc into aDst.
DOC_KIND
Document type a diff/merge entry point should route to, derived from a file path's extension.
void ExpandBBoxToGeometry(DIFF_SCENE &aScene)
Grow the scene's documentBBox to also include the extent of any background geometry.
bool IsRoutingNetChange(const ITEM_CHANGE &aChange)
Presentation predicate for PCB routing changes that should be displayed as one net-level entry/shape.
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.
SHAPE_POLY_SET PolySetFromPolygonList(const SCENE_SHAPE::PolygonList &aPolygons)
Build a SHAPE_POLY_SET from a SCENE_SHAPE::PolygonList.
std::optional< BOX2I > BBoxFromGeometry(const DOCUMENT_GEOMETRY &aGeometry)
Compute the tight bounding box of a DOCUMENT_GEOMETRY, inflating each primitive by half its stroke so...
CATEGORY CategoryFor(CHANGE_KIND aKind)
Map a CHANGE_KIND to the visual category it belongs to.
DOCUMENT_GEOMETRY FilterGeometryByVisibleLayers(const DOCUMENT_GEOMETRY &aGeometry, const LSET &aVisibleLayers)
Copy geometry primitives whose layer set intersects aVisibleLayers.
KIGFX::COLOR4D reference
Default color for source-document context geometry.
KIGFX::COLOR4D comparison
KIGFX::COLOR4D foreground
KIGFX::COLOR4D background
std::vector< SCENE_SHAPE > modifiedShapes
DOCUMENT_GEOMETRY referenceGeometry
Background geometry from the two source documents.
std::vector< SCENE_SHAPE > conflictShapes
std::vector< SCENE_SHAPE > addedShapes
DOCUMENT_GEOMETRY comparisonGeometry
DOC_KIND docKind
Source document type.
std::vector< SCENE_SHAPE > removedShapes
Filled or stroked circle.
The full set of changes between two parsed documents of one type.
Aggregate of background geometry extracted from one source document.
std::vector< DOCUMENT_SEGMENT > segments
std::vector< DOCUMENT_POLYGON > polygons
std::vector< DOCUMENT_CIRCLE > circles
Closed polygon outline from a source document.
std::vector< VECTOR2I > outline
Stroked line segment from one of the source documents.
Sink for the shared DOCUMENT_GEOMETRY walk.
virtual void StrokePolygon(const DOCUMENT_POLYGON &aPoly)=0
virtual void DrawCircle(const DOCUMENT_CIRCLE &aCircle)=0
virtual void DrawSegment(const DOCUMENT_SEGMENT &aSegment)=0
virtual void FillPolygon(const DOCUMENT_POLYGON &aPoly)=0
virtual ~GEOMETRY_SINK()=default
One change record on a single item.
Shared rendering model consumed by both the GAL renderer (interactive widget) and the plotter rendere...
std::vector< std::vector< std::vector< VECTOR2I > > > PolygonList
KIID_PATH changeId
Stable identifier of the ITEM_CHANGE that produced this shape.
SHAPE_CIRCLE circle(c.m_circle_center, c.m_circle_radius)
VECTOR2< int32_t > VECTOR2I