47 void addBBoxAsPolygon(
const BOX2I& aBBox,
const KIGFX::COLOR4D& aColor,
bool aFilled,
DOCUMENT_GEOMETRY& aOut )
50 poly.filled = aFilled;
52 if( !poly.outline.empty() )
53 aOut.polygons.push_back( std::move( poly ) );
57 void extractScreen(
const SCHEMATIC* aSchematic,
const SCH_SHEET_PATH& aPath,
const SCH_SCREEN& aScreen,
58 const KIGFX::COLOR4D& aColor,
const std::map<KIID, KIGFX::COLOR4D>& aOverrides,
63 auto colorFor = [&](
const SCH_ITEM* aItem ) -> KIGFX::COLOR4D
65 auto it = aOverrides.find( aItem->m_Uuid );
66 return it != aOverrides.end() ? it->second : aColor;
69 for(
const SCH_ITEM* item : aScreen.
Items() )
74 if( aOnlyOverrides && !aOverrides.count( item->m_Uuid ) )
77 const KIGFX::COLOR4D color = colorFor( item );
79 switch( item->Type() )
83 const SCH_LINE& line =
static_cast<const SCH_LINE&
>( *item );
90 aOut.segments.push_back( seg );
96 const SCH_JUNCTION& junc =
static_cast<const SCH_JUNCTION&
>( *item );
104 aOut.circles.push_back( c );
124 const bool overridden = aOverrides.count( item->m_Uuid ) > 0;
125 addBBoxAsPolygon( item->GetBoundingBox(), color, overridden, aOut );
138 const std::map<KIID, KIGFX::COLOR4D>& aOverrides,
bool aOnlyOverrides )
142 std::set<const SCH_SCREEN*> visited;
146 const SCH_SCREEN* screen = sheet.LastScreen();
148 if( !screen || !visited.insert( screen ).second )
151 extractScreen( &aSchematic, sheet, *screen, aColor, aOverrides, aOnlyOverrides, out );
165 if( item.GetUnit() > 0 && aUnit > 0 && item.GetUnit() != aUnit )
168 if( item.GetBodyStyle() > 0 && aBodyStyle > 0 && item.GetBodyStyle() != aBodyStyle )
171 addBBoxAsPolygon( item.GetBoundingBox(), aColor,
false, out );
175 addBBoxAsPolygon( aSymbol.
GetUnitBoundingBox( aUnit, aBodyStyle ), aColor,
false, out );
RAII guard that temporarily swaps SCHEMATIC::CurrentSheet to a given path for the duration of a scope...
A color representation with 4 components: red, green, blue, alpha.
Define a library symbol object.
const BOX2I GetUnitBoundingBox(int aUnit, int aBodyStyle, bool aIgnoreHiddenFields=true, bool aIgnoreLabelsOnInvisiblePins=true) const
Get the bounding box for the symbol.
LIB_ITEMS_CONTAINER & GetDrawItems()
Return a reference to the draw item list.
Holds all the data relating to one schematic.
SCH_SHEET_LIST Hierarchy() const
Return the full schematic flattened hierarchical sheet list.
Base class for any item which can be embedded within the SCHEMATIC container class,...
VECTOR2I GetPosition() const override
VECTOR2I GetEndPoint() const
VECTOR2I GetStartPoint() const
EE_RTREE & Items()
Get the full RTree, usually for iterating.
Handle access to a stack of flattened SCH_SHEET objects by way of a path for creating a flattened sch...
DOCUMENT_POLYGON MakeBBoxOutline(const BOX2I &aBBox, const KIGFX::COLOR4D &aColor, int aLineWidth)
Build a DOCUMENT_POLYGON outlining a bounding box.
DOCUMENT_GEOMETRY ExtractSymbolGeometry(const LIB_SYMBOL &aSymbol, const KIGFX::COLOR4D &aColor, int aUnit, int aBodyStyle)
Extract coarse drawable context from a library symbol for visual symbol diffs.
DOCUMENT_GEOMETRY ExtractSchematicGeometry(const SCHEMATIC &aSchematic, const KIGFX::COLOR4D &aColor, const std::map< KIID, KIGFX::COLOR4D > &aOverrides, bool aOnlyOverrides)
Extract a coarse outline of a SCHEMATIC into a DOCUMENT_GEOMETRY for use as background context in DIF...
Definition of the SCH_SHEET_PATH and SCH_SHEET_LIST classes for Eeschema.
Filled or stroked circle.
Aggregate of background geometry extracted from one source document.
Closed polygon outline from a source document.
Stroked line segment from one of the source documents.