KiCad PCB EDA Suite
DXF_plotter.cpp File Reference

Kicad: specialized plotter for DXF files format. More...

#include <eda_base_frame.h>
#include <fill_type.h>
#include <plotters_specific.h>
#include <macros.h>
#include <kicad_string.h>
#include <convert_basic_shapes_to_polygon.h>
#include <render_settings.h>
#include <trigo.h>

Go to the source code of this file.

Functions

static const char * getDXFLineType (PLOT_DASH_TYPE aType)
 
static wxString getDXFColorName (const COLOR4D &aColor)
 
bool containsNonAsciiChars (const wxString &string)
 Check if a given string contains non-ASCII characters. More...
 

Variables

static const double DXF_OBLIQUE_ANGLE = 15
 Oblique angle for DXF native text (I don't remember if 15 degrees is the ISO value... More...
 
struct {
   const char *   name
 
   int   color
 
dxf_layer [NBCOLORS]
 

Detailed Description

Kicad: specialized plotter for DXF files format.

Definition in file DXF_plotter.cpp.

Function Documentation

◆ containsNonAsciiChars()

bool containsNonAsciiChars ( const wxString &  string)

Check if a given string contains non-ASCII characters.

@fixme The performance of this code is really poor, but in this case it can be acceptable because the plot operation is not called very often.

Parameters
stringString to check.
Returns
true if it contains some non-ASCII character, false if all characters are inside ASCII range (<=255).

Definition at line 825 of file DXF_plotter.cpp.

826 {
827  for( unsigned i = 0; i < string.length(); i++ )
828  {
829  wchar_t ch = string[i];
830  if( ch > 255 )
831  return true;
832  }
833  return false;
834 }

Referenced by DXF_PLOTTER::Text().

◆ getDXFColorName()

static wxString getDXFColorName ( const COLOR4D aColor)
static

Definition at line 118 of file DXF_plotter.cpp.

119 {
120  EDA_COLOR_T color = COLOR4D::FindNearestLegacyColor( int( aColor.r * 255 ),
121  int( aColor.g * 255 ),
122  int( aColor.b * 255 ) );
123  wxString cname( dxf_layer[color].name );
124  return cname;
125 }
int color
Definition: DXF_plotter.cpp:60
double g
Green component.
Definition: color4d.h:364
double b
Blue component.
Definition: color4d.h:365
static const struct @8 dxf_layer[NBCOLORS]
EDA_COLOR_T
Legacy color enumeration.
Definition: color4d.h:41
const char * name
Definition: DXF_plotter.cpp:59
double r
Red component.
Definition: color4d.h:363

References KIGFX::COLOR4D::b, color, dxf_layer, KIGFX::COLOR4D::g, name, and KIGFX::COLOR4D::r.

Referenced by DXF_PLOTTER::Arc(), DXF_PLOTTER::Circle(), DXF_PLOTTER::PenTo(), and DXF_PLOTTER::Text().

◆ getDXFLineType()

static const char* getDXFLineType ( PLOT_DASH_TYPE  aType)
static

Definition at line 96 of file DXF_plotter.cpp.

97 {
98  switch( aType )
99  {
102  return "CONTINUOUS";
104  return "DASHED";
105  case PLOT_DASH_TYPE::DOT:
106  return "DOTTED";
108  return "DASHDOT";
109  default:
110  wxFAIL_MSG( "Unhandled PLOT_DASH_TYPE" );
111  return "CONTINUOUS";
112  }
113 }

References DASH, DASHDOT, DEFAULT, DOT, and SOLID.

Referenced by DXF_PLOTTER::PenTo().

Variable Documentation

◆ color

int color

Definition at line 60 of file DXF_plotter.cpp.

Referenced by LABEL_MANAGER::Add(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), PANEL_SETUP_NETCLASSES::addNet(), ROUTER_PREVIEW_ITEM::assignColor(), KIGFX::CAIRO_GAL_BASE::blitCursor(), KIGFX::OPENGL_GAL::blitCursor(), PCB_ONE_LAYER_SELECTOR::buildList(), SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList(), DIALOG_COLOR_PICKER::buttColorClick(), DIALOG_COLOR_PICKER::createHSVBitmap(), DIALOG_COLOR_PICKER::createRGBBitmap(), PANEL_SETUP_BOARD_STACKUP::createRowData(), PANEL_COLOR_SETTINGS::createSwatch(), GRID_CELL_COLOR_RENDERER::Draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawCircle(), PNS_LOG_VIEWER_FRAME::drawLoggedItems(), ELAYER::ELAYER(), EDA_MSG_PANEL::erase(), JSON_SETTINGS::fromLegacyColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), BRDITEMS_PLOTTER::getColor(), getColor(), GetColorFromInt(), PANEL_SETUP_BOARD_STACKUP::getColorIconItem(), KIGFX::GAL::getCursorColor(), getDXFColorName(), BOARD_ADAPTER::GetLayerColor(), KIGFX::SCH_PAINTER::getRenderColor(), NET_GRID_TABLE::GetValueAsCustom(), GERBVIEW_FRAME::GetVisibleElementColor(), SCH_LEGACY_PLUGIN::loadWire(), COLOR_SWATCH::MakeBitmap(), EDA_3D_VIEWER_SETTINGS::MigrateFromLegacy(), PANEL_SETUP_BOARD_STACKUP::onColorSelected(), ZONE_CREATE_HELPER::OnFirstPoint(), PANEL_3D_COLORS::OnLoadColorsFromBoardStackup(), APPEARANCE_CONTROLS::onNetclassContextMenu(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::onPaintPolyPanel(), KIGFX::VIEW::UPDATE_COLOR_VISITOR::operator()(), SCH_SEXPR_PARSER::parseFill(), SCH_SEXPR_PARSER::parseJunction(), SCH_SEXPR_PARSER::parseStroke(), AR_MATRIX::PlacePad(), LIB_TEXT::Plot(), SCH_BUS_ENTRY_BASE::Plot(), SCH_JUNCTION::Plot(), LIB_FIELD::Plot(), SCH_FIELD::Plot(), SCH_LINE::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotDimension(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF(), BRDITEMS_PLOTTER::PlotPcbText(), PlotStandardLayer(), LIB_PIN::PlotSymbol(), SCH_JUNCTION::Print(), SCH_NO_CONNECT::Print(), SCH_BUS_ENTRY_BASE::Print(), LIB_BEZIER::print(), LIB_CIRCLE::print(), LIB_RECTANGLE::print(), LIB_POLYLINE::print(), LIB_ARC::print(), LIB_TEXT::print(), LIB_PIN::print(), SCH_FIELD::Print(), SCH_LINE::Print(), SCH_TEXT::Print(), GERBER_DRAW_ITEM::Print(), LIB_FIELD::print(), SCH_GLOBALLABEL::Print(), SCH_HIERLABEL::Print(), LIB_PIN::printPinElectricalTypeName(), LIB_PIN::printPinSymbol(), DS_DRAW_ITEM_LINE::PrintWsItem(), DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem(), DS_DRAW_ITEM_RECT::PrintWsItem(), processFace(), processShell(), NET_GRID_TABLE::Rebuild(), APPEARANCE_CONTROLS::rebuildNets(), APPEARANCE_CONTROLS::rebuildObjects(), GERBER_LAYER_WIDGET::ReFill(), GERBER_LAYER_WIDGET::ReFillRender(), RENDER_3D_RAYTRACE::renderFinalColor(), PANEL_EESCHEMA_COLOR_SETTINGS::saveCurrentTheme(), CONSOLE_LOG::SetColor(), DXF_PLOTTER::SetColor(), PSLIKE_PLOTTER::SetColor(), SVG_PLOTTER::SetColor(), EDA_MSG_PANEL::showItem(), DXF_PLOTTER::StartPlot(), APPEARANCE_CONTROLS::syncColorsAndVisibility(), PANEL_SETUP_BOARD_STACKUP::synchronizeWithBoard(), APPEARANCE_CONTROLS::syncObjectSettings(), AR_MATRIX::traceArc(), AR_MATRIX::traceCircle(), AR_MATRIX::traceFilledCircle(), AR_MATRIX::TraceFilledRectangle(), AR_MATRIX::TraceSegmentPcb(), PANEL_SETUP_BOARD_STACKUP::transferDataFromUIToStackup(), PANEL_3D_RAYTRACING_OPTIONS::TransferDataFromWindow(), PCB_TEXT::TransformTextShapeWithClearanceToPolygon(), EDA_TEXT::TransformToSegmentList(), KIGFX::VIEW::UpdateAllLayersColor(), DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample(), KIGFX::VIEW::updateItemColor(), and RATSNEST_VIEW_ITEM::ViewDraw().

◆ dxf_layer

const { ... } dxf_layer[NBCOLORS]

◆ DXF_OBLIQUE_ANGLE

const double DXF_OBLIQUE_ANGLE = 15
static

Oblique angle for DXF native text (I don't remember if 15 degrees is the ISO value...

it looks nice anyway)

Definition at line 41 of file DXF_plotter.cpp.

Referenced by DXF_PLOTTER::StartPlot(), and DXF_PLOTTER::Text().

◆ name

const char* name

Definition at line 59 of file DXF_plotter.cpp.

Referenced by NETCLASSES::Add(), DXF_IMPORT_PLUGIN::addBlock(), GERBER_JOBFILE_WRITER::addJSONFilesAttributes(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), DXF_IMPORT_PLUGIN::addLayer(), DXF_IMPORT_PLUGIN::addLinetype(), PROPERTY_MANAGER::AddProperty(), DIALOG_SIGNAL_LIST::addSignalToPlotFrame(), SCH_SEXPR_PLUGIN_CACHE::AddSymbol(), SCH_LEGACY_PLUGIN_CACHE::AddSymbol(), DXF_IMPORT_PLUGIN::addTextStyle(), SIM_PLOT_PANEL::addTrace(), AskLoadBoardFileName(), PGM_BASE::AskUserForPreferredEditor(), PNS_TEST_DEBUG_DECORATOR::BeginGroup(), BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS(), BOOST_AUTO_TEST_CASE(), CONNECTION_GRAPH::buildConnectionGraph(), SYMBOL_LIBS::CacheName(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_VIEWER_FRAME::ClickOnLibList(), createBoard(), DRC_ENGINE::createImplicitRule(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), PANEL_PCBNEW_COLOR_SETTINGS::createSwatches(), PANEL_EESCHEMA_COLOR_SETTINGS::createSwatches(), PANEL_COLOR_SETTINGS::createThemeList(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), KIGFX::PCB_PAINTER::draw(), KIWAY::dso_search_path(), WIDGET_HOTKEY_LIST::editItem(), ERC_SETTINGS::ERC_SETTINGS(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckNoConnects(), FindStream(), FOOTPRINT_FILTER::ITERATOR::FootprintFilterMatch(), FootprintWithPads(), formatConstraint(), LIB_TABLE::FormatOptions(), GERBER_JOBFILE_READER::formatStringFromJSON(), DSN::SPECCTRA_DB::FromBOARD(), FOOTPRINT_INFO_GENERATOR::GenerateHtml(), PCB_EXPR_BUILTIN_FUNCTIONS::Get(), ACTION_PLUGINS::GetAction(), DIALOG_BUS_MANAGER::getAliasDisplayText(), HOTKEY_STORE::GetAppName(), LIB_PIN::GetBoundingBox(), DS_DATA_ITEM::GetClassName(), SCH_PIN::GetDefaultNetName(), PROJECT_TEMPLATE::GetDestinationFiles(), GERBER_FILE_IMAGE_LIST::GetDisplayName(), getDXFColorName(), GetFootprintLibraries(), X3DPARSER::getGroupingNodes(), FOOTPRINT_INFO_GENERATOR::GetHtmlFieldRow(), mpWindow::GetLayerByName(), GBR_LAYER_BOX_SELECTOR::getLayerName(), SCH_PIN::GetShownName(), DRC_ENGINE::GetTestProvider(), TOOL_MANAGER::GetTool(), SYMBOL_LIBRARY_MANAGER::GetUniqueLibraryName(), FOOTPRINT_WIZARD_LIST::GetWizard(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), IncrementLabelMember(), DIALOG_FOOTPRINT_WIZARD_LIST::initLists(), DIALOG_BOM::installGeneratorsList(), mpWindow::IsLayerVisible(), KiROUND(), SCH_EDIT_FRAME::KiwayMailIn(), X3DPARSER::Load(), GPCB_FPL_CACHE::Load(), LEGACY_NETLIST_READER::loadComponent(), EAGLE_PLUGIN::loadElements(), BOARD_DESIGN_SETTINGS::LoadFromFile(), CADSTAR_SCH_ARCHIVE_LOADER::loadHierarchicalSheetPins(), DRC_ENGINE::loadImplicitRules(), SCH_LEGACY_PLUGIN::loadJunction(), DIALOG_SPICE_MODEL::loadLibrary(), SCH_EAGLE_PLUGIN::loadLibrary(), SCH_LEGACY_PLUGIN::loadNoConnect(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), SCH_LEGACY_PLUGIN_CACHE::loadPin(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), SCH_EDIT_FRAME::LoadSheetFromFile(), SCH_LEGACY_PLUGIN::loadSymbol(), SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname(), SIM_PLOT_FRAME::loadWorkbook(), DS_DATA_MODEL::MakeFullFileName(), DSN::SPECCTRA_DB::makePADSTACK(), DSN::SPECCTRA_DB::makeVia(), PCB_CALCULATOR_SETTINGS::MigrateFromLegacy(), mpFX::mpFX(), mpFXY::mpFXY(), mpFY::mpFY(), mpProfile::mpProfile(), mpScaleXBase::mpScaleXBase(), mpScaleY::mpScaleY(), mpText::mpText(), NET_SETTINGS::NET_SETTINGS(), DIALOG_BOM::OnAddGenerator(), DIALOG_BUS_MANAGER::OnAddSignal(), PCB_CALCULATOR_FRAME::OnEditRegulator(), PROJECT_TREE_PANE::onExpand(), APP_SINGLE_TOP::OnInit(), APP_TEST::OnInit(), APPEARANCE_CONTROLS::onLayerPresetChanged(), APPEARANCE_CONTROLS::OnNetGridMouseEvent(), PGM_SINGLE_TOP::OnPgmInit(), PCB_CALCULATOR_FRAME::OnRegulatorSelection(), PCB_CALCULATOR_FRAME::OnRemoveRegulator(), APP_SINGLE_TOP::OnRun(), APP_TEST::OnRun(), APP_KICAD::OnRun(), DIALOG_PAGES_SETTINGS::OnWksFileSelection(), ERULES::parse(), CADSTAR_SCH_ARCHIVE_PARSER::SHEETS::Parse(), PCB_PARSER::parseBoardStackup(), ALTIUM_PCB::ParseClasses6Data(), SCH_ALTIUM_PLUGIN::ParseComponent(), KICAD_NETLIST_PARSER::parseComponent(), PCB_PARSER::parseFOOTPRINT_unchecked(), PCB_PARSER::parseLayer(), PCB_PARSER::parseLayers(), KICAD_NETLIST_PARSER::parseNet(), PCB_PARSER::parseNETINFO_ITEM(), LIB_TABLE::ParseOptions(), SCH_ALTIUM_PLUGIN::ParsePort(), SCH_SEXPR_PARSER::parseProperty(), PCB_CALCULATOR_DATAFILE_PARSER::ParseRegulatorDescr(), SCH_SEXPR_PARSER::parseSchField(), SCH_SEXPR_PARSER::parseSchSheetPin(), SCH_SEXPR_PARSER::ParseSymbol(), PCB_CALCULATOR_SETTINGS::PCB_CALCULATOR_SETTINGS(), LIB_PIN::PlotPinTexts(), LIB_PIN::printPinTexts(), KI_TEST::COMBINED_UTILITY::printUsage(), FABMASTER::processCustomPads(), X3DSHAPE::Read(), X3DTRANSFORM::Read(), SGSHAPE::ReadCache(), SCENEGRAPH::ReadCache(), SGFACESET::ReadCache(), S3D::ReadCache(), FOOTPRINT_LIST_IMPL::ReadCacheFromFile(), TRANSLINE_IDENT::ReadConfig(), GERBER_JOBFILE_READER::ReadGerberJobFile(), S3D::ReadTag(), APPEARANCE_CONTROLS::rebuildNets(), SYMBOL_VIEWER_FRAME::ReCreateLibList(), FOOTPRINT_WIZARD_FRAME::ReCreatePageList(), FOOTPRINT_WIZARD_FRAME::ReCreateParameterList(), SYMBOL_VIEWER_FRAME::ReCreateSymbolList(), PROJECT_TREE_PANE::ReCreateTreePrj(), PROJECT_TREE_ITEM::Rename(), PNS::LINE_PLACER::rhWalkOnly(), SYMBOL_LIB_TABLE::SaveSymbol(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SYMBOL_EDIT_FRAME::saveSymbolAs(), SYMBOL_EDIT_FRAME::SelectLibraryFromList(), ABOUT_APP_INFO::SetAppName(), PROJECT_TREE_ITEM::SetFileName(), KIWAY_HOLDER::SetKiway(), mpWindow::SetLayerVisible(), DIALOG_LIB_NEW_SYMBOL::SetName(), mpLayer::SetName(), GERBER_DRAW_ITEM::ShowGBRShape(), COMMON_CONTROL::ShowHelp(), PNS::WALKAROUND::singleStep(), DXF_PLOTTER::StartPlot(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), PANEL_SETUP_LAYERS::testLayerNames(), ERC_TESTER::TestMultUnitPinConflicts(), PANEL_TEXT_VARIABLES::TransferDataFromWindow(), DIALOG_SELECT_3DMODEL::TransferDataFromWindow(), DIALOG_CONFIGURE_PATHS::TransferDataFromWindow(), DIALOG_FP_PLUGIN_OPTIONS::TransferDataFromWindow(), SETTINGS_MANAGER::unloadProjectFile(), BUS_UNFOLD_MENU::update(), SIM_PLOT_FRAME::updatePlot(), TRANSLINE_IDENT::WriteConfig(), and DIALOG_BOM::~DIALOG_BOM().