bool PLOT_CONTROLLER::OpenPlotfile( const wxString &aSuffix, PlotFormat aFormat, const wxString &aSheetDesc ) { LOCALE_IO toggle; /* Save the current format: sadly some plot routines depends on this but the main reason is that the StartPlot method uses it to dispatch the plotter creation */ m_plotOpts.SetFormat( aFormat ); // Ensure that the previous plot is closed ClosePlot(); // Now compute the full filename for the output and start the plot // (after ensuring the output directory is OK) wxString outputDirName = m_plotOpts.GetOutputDirectory() ; wxFileName outputDir = wxFileName::DirName( outputDirName ); wxString boardFilename = m_board->GetFileName(); if( EnsureOutputDirectory( &outputDir, boardFilename ) ) { wxFileName fn( boardFilename ); BuildPlotFileName( &fn, outputDirName, aSuffix, GetDefaultPlotExtension( aFormat ) ); m_plotter = StartPlotBoard( m_board, &m_plotOpts, fn.GetFullPath(), aSheetDesc ); } return( m_plotter != NULL ); }
bool PLOT_CONTROLLER::OpenPlotfile( const wxString &aSuffix, PlotFormat aFormat, const wxString &aSheetDesc ) { LOCALE_IO toggle; /* Save the current format: sadly some plot routines depends on this but the main reason is that the StartPlot method uses it to dispatch the plotter creation */ GetPlotOptions().SetFormat( aFormat ); // Ensure that the previous plot is closed ClosePlot(); // Now compute the full filename for the output and start the plot // (after ensuring the output directory is OK) wxString outputDirName = GetPlotOptions().GetOutputDirectory() ; wxFileName outputDir = wxFileName::DirName( outputDirName ); wxString boardFilename = m_board->GetFileName(); if( EnsureFileDirectoryExists( &outputDir, boardFilename ) ) { // outputDir contains now the full path of plot files m_plotFile = boardFilename; m_plotFile.SetPath( outputDir.GetPath() ); wxString fileExt = GetDefaultPlotExtension( aFormat ); // Gerber format can use specific file ext, depending on layers // (now not a good practice, because the official file ext is .gbr) if( GetPlotOptions().GetFormat() == PLOT_FORMAT_GERBER && GetPlotOptions().GetUseGerberProtelExtensions() ) fileExt = GetGerberProtelExtension( GetLayer() ); // Build plot filenames from the board name and layer names: BuildPlotFileName( &m_plotFile, outputDir.GetPath(), aSuffix, fileExt ); m_plotter = StartPlotBoard( m_board, &GetPlotOptions(), ToLAYER_ID( GetLayer() ), m_plotFile.GetFullPath(), aSheetDesc ); } return( m_plotter != NULL ); }
PLOT_CONTROLLER::~PLOT_CONTROLLER() { ClosePlot(); }