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 (COLOR4D aColor)
 
bool containsNonAsciiChars (const wxString &string)
 Checks 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)

Checks 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 854 of file DXF_plotter.cpp.

855 {
856  for( unsigned i = 0; i < string.length(); i++ )
857  {
858  wchar_t ch = string[i];
859  if( ch > 255 )
860  return true;
861  }
862  return false;
863 }

Referenced by DXF_PLOTTER::Text().

◆ getDXFColorName()

static wxString getDXFColorName ( 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:375
double b
Blue component.
Definition: color4d.h:376
static const struct @8 dxf_layer[NBCOLORS]
EDA_COLOR_T
Legacy color enumeration.
Definition: color4d.h:42
const char * name
Definition: DXF_plotter.cpp:59
double r
Red component.
Definition: color4d.h:374

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 GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), PANEL_SETUP_NETCLASSES::addNet(), EDA_DRAW_FRAME::AppendMsgPanel(), 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(), ELAYER::ELAYER(), EDA_MSG_PANEL::erase(), export_vrml_pcbtext(), JSON_SETTINGS::fromLegacyColor(), SIM_PLOT_PANEL::generateColor(), 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(), APPEARANCE_CONTROLS::onNetclassContextMenu(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::onPaintPolyPanel(), KIGFX::VIEW::updateItemsColor::operator()(), SCH_SEXPR_PARSER::parseFill(), SCH_SEXPR_PARSER::parseJunction(), SCH_SEXPR_PARSER::parseStroke(), AR_MATRIX::PlacePad(), LIB_TEXT::Plot(), SCH_JUNCTION::Plot(), SCH_BUS_ENTRY_BASE::Plot(), LIB_FIELD::Plot(), SCH_FIELD::Plot(), SCH_LINE::Plot(), SCH_TEXT::Plot(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotPcbText(), PlotStandardLayer(), LIB_PIN::PlotSymbol(), LIB_POLYLINE::print(), LIB_RECTANGLE::print(), LIB_TEXT::print(), LIB_ARC::print(), SCH_JUNCTION::Print(), LIB_FIELD::print(), SCH_NO_CONNECT::Print(), SCH_BUS_ENTRY_BASE::Print(), LIB_BEZIER::print(), LIB_CIRCLE::print(), SCH_FIELD::Print(), SCH_LINE::Print(), GERBER_DRAW_ITEM::Print(), SCH_TEXT::Print(), SCH_GLOBALLABEL::Print(), SCH_SHEET::Print(), SCH_HIERLABEL::Print(), LIB_PIN::printPinElectricalTypeName(), LIB_PIN::printPinSymbol(), WS_DRAW_ITEM_LINE::PrintWsItem(), WS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem(), WS_DRAW_ITEM_RECT::PrintWsItem(), processFace(), processShell(), NET_GRID_TABLE::Rebuild(), APPEARANCE_CONTROLS::rebuildNets(), APPEARANCE_CONTROLS::rebuildObjects(), GERBER_LAYER_WIDGET::ReFill(), GERBER_LAYER_WIDGET::ReFillRender(), C3D_RENDER_RAYTRACING::rt_final_color(), 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(), EDA_3D_VIEWER::SynchroniseColoursWithBoard(), 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(), DIALOG_3D_VIEW_OPTIONS::TransferDataFromWindow(), PCB_TEXT::TransformShapeWithClearanceToPolygonSet(), EDA_TEXT::TransformTextShapeToSegmentList(), KIGFX::VIEW::UpdateAllLayersColor(), KIGFX::VIEW::updateItemColor(), and KIGFX::RATSNEST_VIEWITEM::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(), GERBER_JOBFILE_WRITER::addJSONFilesAttributes(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), DXF_IMPORT_PLUGIN::addLayer(), PROPERTY_MANAGER::AddProperty(), DIALOG_SIGNAL_LIST::addSignalToPlotFrame(), SCH_SEXPR_PLUGIN_CACHE::AddSymbol(), SCH_LEGACY_PLUGIN_CACHE::AddSymbol(), AskLoadBoardFileName(), PGM_BASE::AskUserForPreferredEditor(), BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS(), BOOST_AUTO_TEST_CASE(), CONNECTION_GRAPH::buildConnectionGraph(), PART_LIBS::CacheName(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_VIEWER_FRAME::ClickOnLibList(), createBoard(), DRC_ENGINE::createImplicitRule(), LIB_EDIT_FRAME::CreateNewPart(), PANEL_PCBNEW_COLOR_SETTINGS::createSwatches(), PANEL_EESCHEMA_COLOR_SETTINGS::createSwatches(), PANEL_COLOR_SETTINGS::createThemeList(), 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(), 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(), WS_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(), DRC_ENGINE::GetTestProvider(), TOOL_MANAGER::GetTool(), LIB_MANAGER::GetUniqueLibraryName(), FOOTPRINT_WIZARD_LIST::GetWizard(), PCB_EDITOR_CONTROL::ImportSpecctraSession(), IncrementLabelMember(), DIALOG_FOOTPRINT_WIZARD_LIST::initLists(), mpWindow::IsLayerVisible(), KiROUND(), SCH_EDIT_FRAME::KiwayMailIn(), X3DPARSER::Load(), GPCB_FPL_CACHE::Load(), SCH_LEGACY_PLUGIN::loadComponent(), 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(), SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname(), SIM_PLOT_FRAME::loadWorkbook(), WS_DATA_MODEL::MakeFullFileName(), DSN::SPECCTRA_DB::makePADSTACK(), DSN::SPECCTRA_DB::makeVia(), PCB_CALCULATOR_SETTINGS::MigrateFromLegacy(), ModuleWithPads(), 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(), TREE_PROJECT_FRAME::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(), BOM_CFG_PARSER::parseGenerator(), PCB_PARSER::parseLayer(), PCB_PARSER::parseLayers(), PCB_PARSER::parseMODULE_unchecked(), KICAD_NETLIST_PARSER::parseNet(), PCB_PARSER::parseNETINFO_ITEM(), LIB_TABLE::ParseOptions(), 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(), KI_TEST::COMBINED_UTILITY::printUsage(), X3DSHAPE::Read(), X3DTRANSFORM::Read(), SGSHAPE::ReadCache(), S3D::ReadCache(), SGFACESET::ReadCache(), SCENEGRAPH::ReadCache(), FOOTPRINT_LIST_IMPL::ReadCacheFromFile(), TRANSLINE_IDENT::ReadConfig(), GERBER_JOBFILE_READER::ReadGerberJobFile(), S3D::ReadTag(), APPEARANCE_CONTROLS::rebuildNets(), LIB_VIEW_FRAME::ReCreateListLib(), FOOTPRINT_WIZARD_FRAME::ReCreatePageList(), FOOTPRINT_WIZARD_FRAME::ReCreateParameterList(), TREE_PROJECT_FRAME::ReCreateTreePrj(), TREEPROJECT_ITEM::Rename(), LIB_EDIT_FRAME::savePartAs(), SYMBOL_LIB_TABLE::SaveSymbol(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), LIB_EDIT_FRAME::SelectLibraryFromList(), ABOUT_APP_INFO::SetAppName(), TREEPROJECT_ITEM::SetFileName(), KIWAY_HOLDER::SetKiway(), mpWindow::SetLayerVisible(), DIALOG_LIB_NEW_COMPONENT::SetName(), mpLayer::SetName(), GERBER_DRAW_ITEM::ShowGBRShape(), COMMON_CONTROL::ShowHelp(), PNS::WALKAROUND::singleStep(), DXF_PLOTTER::StartPlot(), swigAddBuiltin(), swigAddModule(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), PANEL_SETUP_LAYERS::testLayerNames(), ERC_TESTER::TestMultUnitPinConflicts(), PANEL_TEXT_VARIABLES::TransferDataFromWindow(), DIALOG_CONFIGURE_PATHS::TransferDataFromWindow(), DLG_SELECT_3DMODEL::TransferDataFromWindow(), DIALOG_FP_PLUGIN_OPTIONS::TransferDataFromWindow(), SETTINGS_MANAGER::unloadProjectFile(), BUS_UNFOLD_MENU::update(), SIM_PLOT_FRAME::updatePlot(), and TRANSLINE_IDENT::WriteConfig().