MCPcopy Create free account
hub / github.com/KiCad/kicad-source-mirror / PlotDrawingSheet

Function PlotDrawingSheet

common/plotters/common_plot_functions.cpp:51–209  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

49
50
51void PlotDrawingSheet( PLOTTER* plotter, const PROJECT* aProject, const TITLE_BLOCK& aTitleBlock,
52 const PAGE_INFO& aPageInfo, const std::map<wxString, wxString>* aProperties,
53 const wxString& aSheetNumber, int aSheetCount, const wxString& aSheetName,
54 const wxString& aSheetPath, const wxString& aFilename, COLOR4D aColor, bool aIsFirstPage,
55 const wxString& aVariantName, const wxString& aVariantDesc )
56{
57 /* Note: Page sizes values are given in mils
58 */
59 double iusPerMil = plotter->GetIUsPerDecimil() * 10.0;
60 COLOR4D plotColor = plotter->GetColorMode() ? aColor : COLOR4D::BLACK;
61 RENDER_SETTINGS* settings = plotter->RenderSettings();
62 int defaultPenWidth = settings->GetDefaultPenWidth();
63
64 if( plotColor == COLOR4D::UNSPECIFIED )
65 plotColor = COLOR4D( RED );
66
67 DS_DRAW_ITEM_LIST drawList( unityScale );
68
69 // Print only a short filename, if aFilename is the full filename
70 wxFileName fn( aFilename );
71
72 // Prepare plot parameters
73 drawList.SetDefaultPenSize( defaultPenWidth );
74 drawList.SetPlotterMilsToIUfactor( iusPerMil );
75 drawList.SetPageNumber( aSheetNumber );
76 drawList.SetSheetCount( aSheetCount );
77 drawList.SetFileName( fn.GetFullPath() );
78 drawList.SetSheetName( aSheetName );
79 drawList.SetSheetPath( aSheetPath );
80 drawList.SetSheetLayer( settings->GetLayerName() );
81 drawList.SetProject( aProject );
82 drawList.SetIsFirstPage( aIsFirstPage );
83 drawList.SetProperties( aProperties );
84 drawList.SetVariantName( aVariantName );
85 drawList.SetVariantDesc( aVariantDesc );
86
87 drawList.BuildDrawItemsList( aPageInfo, aTitleBlock );
88
89 try
90 {
91 // Draw bitmaps first
92 for( DS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )
93 {
94 if( item->Type() == WSG_BITMAP_T )
95 {
96 DS_DRAW_ITEM_BITMAP* drawItem = (DS_DRAW_ITEM_BITMAP*) item;
97 DS_DATA_ITEM_BITMAP* bitmap = (DS_DATA_ITEM_BITMAP*) drawItem->GetPeer();
98
99 if( bitmap->m_ImageBitmap == nullptr )
100 continue;
101
102 bitmap->m_ImageBitmap->PlotImage( plotter, drawItem->GetPosition(), plotColor,
103 defaultPenWidth );
104 }
105 }
106
107 // Draw other items
108 for( DS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; item = drawList.GetNext() )

Callers 6

plotOneSheetPDFMethod · 0.85
plotOneSheetPSMethod · 0.85
plotOneSheetSVGMethod · 0.85
plotOneSheetDXFMethod · 0.85
StartPlotBoardFunction · 0.85
setupPlotterNewPDFPageFunction · 0.85

Calls 15

wxStringSplitFunction · 0.85
GetIUsPerDecimilMethod · 0.80
RenderSettingsMethod · 0.80
GetDefaultPenWidthMethod · 0.80
SetDefaultPenSizeMethod · 0.80
SetSheetLayerMethod · 0.80
BuildDrawItemsListMethod · 0.80
GetPeerMethod · 0.80
FinishToMethod · 0.80
LineToMethod · 0.80
GetTextColorMethod · 0.80

Tested by

no test coverage detected