2013-05-10 19:22:29 +00:00
|
|
|
/*
|
|
|
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2012 Lorenzo Marcantonio, <l.marcantonio@logossrl.com>
|
2015-04-27 19:27:59 +00:00
|
|
|
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
2023-02-14 14:49:20 +00:00
|
|
|
* Copyright (C) 1992-2023 KiCad Developers, see AUTHORS.txt for contributors.
|
2013-05-10 19:22:29 +00:00
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, you may find one here:
|
|
|
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
|
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
|
|
* or you may write to the Free Software Foundation, Inc.,
|
|
|
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
|
|
*/
|
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
/**
|
|
|
|
* @file pcbnew/pcbplot.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef PLOTCONTROLLER_H_
|
|
|
|
#define PLOTCONTROLLER_H_
|
|
|
|
|
|
|
|
#include <pcb_plot_params.h>
|
2021-07-29 09:47:43 +00:00
|
|
|
#include <layer_ids.h>
|
2012-08-29 16:59:50 +00:00
|
|
|
|
|
|
|
class PLOTTER;
|
|
|
|
class BOARD;
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
|
2013-05-10 19:22:29 +00:00
|
|
|
/**
|
2012-08-29 16:59:50 +00:00
|
|
|
* Batch plotter state object. Keeps the plot options and handles multiple
|
2021-07-19 23:56:05 +00:00
|
|
|
* plot requests. Useful in Python scripts.
|
2012-08-29 16:59:50 +00:00
|
|
|
*/
|
|
|
|
class PLOT_CONTROLLER
|
|
|
|
{
|
|
|
|
public:
|
2013-05-10 19:22:29 +00:00
|
|
|
/** Batch plotter constructor, nothing interesting here */
|
2012-08-29 16:59:50 +00:00
|
|
|
PLOT_CONTROLLER( BOARD *aBoard );
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
/**
|
|
|
|
* Ensure that the last plot is closed.
|
2015-04-27 18:02:27 +00:00
|
|
|
*/
|
2012-08-29 16:59:50 +00:00
|
|
|
~PLOT_CONTROLLER();
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2015-04-27 18:02:27 +00:00
|
|
|
/**
|
|
|
|
* Accessor to the plot parameters and options
|
|
|
|
*/
|
|
|
|
PCB_PLOT_PARAMS& GetPlotOptions() { return m_plotOptions; }
|
|
|
|
|
2021-07-21 23:14:56 +00:00
|
|
|
void SetLayer( int aLayer ) { m_plotLayer = aLayer; }
|
|
|
|
int GetLayer() { return m_plotLayer; }
|
2015-04-27 18:02:27 +00:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
2021-07-19 23:56:05 +00:00
|
|
|
* @return true if a plotter is initialized and can be used.
|
2015-04-27 18:02:27 +00:00
|
|
|
*/
|
2021-07-19 23:56:05 +00:00
|
|
|
bool IsPlotOpen() const { return m_plotter != nullptr; }
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
/**
|
|
|
|
* Close the current plot, nothing happens if it isn't open.
|
2015-04-27 18:02:27 +00:00
|
|
|
*/
|
2012-08-29 16:59:50 +00:00
|
|
|
void ClosePlot();
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
/** Open a new plotfile; works as a factory for plotter objects/
|
|
|
|
*
|
2015-04-27 18:02:27 +00:00
|
|
|
* @param aSuffix is a string added to the base filename (derived from
|
2021-07-19 23:56:05 +00:00
|
|
|
* the board filename) to identify the plot file.
|
|
|
|
* @param aFormat is the plot file format identifier.
|
2022-04-09 14:38:47 +00:00
|
|
|
* @param aSheetName is the text to be displayed in the title block that replaces ${SHEETNAME}
|
|
|
|
* @param aSheetPath is the text to be displayed in the title block that replaces ${SHEETPATH}
|
2013-05-10 19:22:29 +00:00
|
|
|
*/
|
2022-04-09 14:38:47 +00:00
|
|
|
bool OpenPlotfile( const wxString& aSuffix, PLOT_FORMAT aFormat,
|
|
|
|
const wxString& aSheetName = wxEmptyString,
|
|
|
|
const wxString& aSheetPath = wxEmptyString );
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2021-07-19 23:56:05 +00:00
|
|
|
/**
|
|
|
|
* Plot a single layer on the current plotfile m_plotLayer is the layer to plot.
|
2015-04-27 18:02:27 +00:00
|
|
|
*/
|
|
|
|
bool PlotLayer();
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2023-02-14 14:49:20 +00:00
|
|
|
/**
|
|
|
|
* Plot a sequence of board layer IDs in the given order.
|
|
|
|
*
|
|
|
|
* @param aLayerSequence is the sequence of layer IDs to plot.
|
|
|
|
*
|
|
|
|
* @return true if the layers plotted correctly othewise false.
|
|
|
|
*/
|
|
|
|
bool PlotLayers( const LSEQ& aLayerSequence );
|
|
|
|
|
2015-10-26 17:51:41 +00:00
|
|
|
/**
|
|
|
|
* @return the current plot full filename, set by OpenPlotfile
|
|
|
|
*/
|
|
|
|
const wxString GetPlotFileName() { return m_plotFile.GetFullPath(); }
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return the current plot full filename, set by OpenPlotfile
|
|
|
|
*/
|
|
|
|
const wxString GetPlotDirName() { return m_plotFile.GetPathWithSep(); }
|
|
|
|
|
|
|
|
/**
|
2021-07-19 23:56:05 +00:00
|
|
|
* Choose color or bland and white plot mode.
|
|
|
|
*
|
|
|
|
* @param aColorMode set to true to activate the plot color mode or false for black and white.
|
2015-10-26 17:51:41 +00:00
|
|
|
*/
|
2021-07-19 23:56:05 +00:00
|
|
|
void SetColorMode( bool aColorMode );
|
2015-10-26 17:51:41 +00:00
|
|
|
|
|
|
|
/**
|
2021-07-19 23:56:05 +00:00
|
|
|
* @return true if the current plot color mode is color or false if the current plot color
|
|
|
|
* mode is black and white.
|
2015-10-26 17:51:41 +00:00
|
|
|
*/
|
2013-04-18 21:21:26 +00:00
|
|
|
bool GetColorMode();
|
2012-08-29 16:59:50 +00:00
|
|
|
|
2023-02-14 14:49:20 +00:00
|
|
|
PLOTTER* GetPlotter() { return m_plotter; }
|
|
|
|
|
2012-08-29 16:59:50 +00:00
|
|
|
private:
|
2021-07-21 23:14:56 +00:00
|
|
|
int m_plotLayer;
|
2015-04-27 18:02:27 +00:00
|
|
|
PCB_PLOT_PARAMS m_plotOptions;
|
2013-05-10 19:22:29 +00:00
|
|
|
|
2021-07-21 23:14:56 +00:00
|
|
|
/// This is the plotter object; it starts NULL and become instantiated when a plotfile is
|
|
|
|
// requested
|
|
|
|
PLOTTER* m_plotter;
|
2015-10-26 17:51:41 +00:00
|
|
|
|
2021-07-21 23:14:56 +00:00
|
|
|
BOARD* m_board;
|
|
|
|
wxFileName m_plotFile;
|
2012-08-29 16:59:50 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|