KiCad PCB EDA Suite
DXF_plotter.cpp File Reference

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

#include <plotters/plotter_dxf.h>
#include <macros.h>
#include <string_utils.h>
#include <convert_basic_shapes_to_polygon.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... it looks nice anyway) 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.

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

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

Referenced by DXF_PLOTTER::Text().

◆ getDXFColorName()

static wxString getDXFColorName ( const COLOR4D aColor)
static

Definition at line 120 of file DXF_plotter.cpp.

121{
122 EDA_COLOR_T color = COLOR4D::FindNearestLegacyColor( int( aColor.r * 255 ),
123 int( aColor.g * 255 ),
124 int( aColor.b * 255 ) );
125 wxString cname( dxf_layer[color].name );
126 return cname;
127}
int color
Definition: DXF_plotter.cpp:57
static const struct @8 dxf_layer[NBCOLORS]
const char * name
Definition: DXF_plotter.cpp:56
double r
Red component.
Definition: color4d.h:384
double g
Green component.
Definition: color4d.h:385
double b
Blue component.
Definition: color4d.h:386
EDA_COLOR_T
Legacy color enumeration.
Definition: color4d.h:42

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

99{
100 switch( aType )
101 {
104 return "CONTINUOUS";
106 return "DASHED";
108 return "DOTTED";
110 return "DASHDOT";
111 default:
112 wxFAIL_MSG( "Unhandled PLOT_DASH_TYPE" );
113 return "CONTINUOUS";
114 }
115}

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

Referenced by DXF_PLOTTER::PenTo().

Variable Documentation

◆ color

int color

Definition at line 57 of file DXF_plotter.cpp.

Referenced by LABEL_MANAGER::Add(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), ROUTER_PREVIEW_ITEM::assignColor(), KIGFX::OPENGL_GAL::blitCursor(), KIGFX::CAIRO_GAL_BASE::blitCursor(), PCB_ONE_LAYER_SELECTOR::buildList(), SELECT_COPPER_LAYERS_PAIR_DIALOG::buildList(), DIALOG_COLOR_PICKER::buttColorClick(), GERBER_LAYER_WIDGET::CollectCurrentColorSettings(), DIALOG_COLOR_PICKER::createHSVBitmap(), DIALOG_COLOR_PICKER::createRGBBitmap(), PANEL_COLOR_SETTINGS::createSwatch(), KIGFX::DS_PAINTER::draw(), KIGFX::SCH_PAINTER::draw(), KIGFX::PCB_PAINTER::draw(), KIGFX::GERBVIEW_PAINTER::draw(), GRID_CELL_COLOR_RENDERER::Draw(), KIGFX::PREVIEW::DRAW_CONTEXT::DrawCircle(), PNS_LOG_VIEWER_FRAME::drawLoggedItems(), ELAYER::ELAYER(), EDA_MSG_PANEL::erase(), EXPORTER_PCB_VRML::EXPORTER_PCB_VRML(), JSON_SETTINGS::fromLegacyColor(), KIGFX::DS_RENDER_SETTINGS::GetColor(), KIGFX::PCB_RENDER_SETTINGS::GetColor(), getColor(), BRDITEMS_PLOTTER::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(), GRSetBrush(), GRSetColorPen(), BOARD_ADAPTER::InitSettings(), PCB_EDIT_FRAME::LoadProjectSettings(), SCH_LEGACY_PLUGIN::loadWire(), COLOR_SWATCH::MakeBitmap(), EDA_3D_VIEWER_SETTINGS::MigrateFromLegacy(), NET_SETTINGS::NET_SETTINGS(), PANEL_SETUP_BOARD_STACKUP::onColorSelected(), PGPROPERTY_COLORENUM::OnCustomPaint(), DIALOG_LIB_SHAPE_PROPERTIES::onFill(), ZONE_CREATE_HELPER::OnFirstPoint(), APPEARANCE_CONTROLS::onNetclassContextMenu(), DIALOG_PAD_PRIMITIVE_POLY_PROPS::onPaintPolyPanel(), KIGFX::VIEW::UPDATE_COLOR_VISITOR::operator()(), PCB_PARSER::parseBoardStackup(), SCH_SEXPR_PARSER::parseEDA_TEXT(), SCH_SEXPR_PARSER::parseFill(), SCH_SEXPR_PARSER::parseJunction(), STROKE_PARAMS_PARSER::ParseStroke(), AR_MATRIX::PlacePad(), SCH_BUS_ENTRY_BASE::Plot(), SCH_FIELD::Plot(), SCH_JUNCTION::Plot(), SCH_LABEL_BASE::Plot(), SCH_LINE::Plot(), SCH_TEXT::Plot(), SCH_TEXTBOX::Plot(), LIB_FIELD::Plot(), LIB_SHAPE::Plot(), LIB_TEXT::Plot(), LIB_TEXTBOX::Plot(), LIB_SYMBOL::Plot(), BRDITEMS_PLOTTER::PlotDimension(), BRDITEMS_PLOTTER::PlotFootprintTextItem(), LIB_SYMBOL::PlotLibFields(), DIALOG_PLOT_SCHEMATIC::plotOneSheetDXF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPDF(), DIALOG_PLOT_SCHEMATIC::plotOneSheetPS(), DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG(), BRDITEMS_PLOTTER::PlotPcbText(), LIB_PIN::PlotPinTexts(), PlotStandardLayer(), LIB_PIN::PlotSymbol(), SCH_BUS_ENTRY_BASE::Print(), SCH_FIELD::Print(), SCH_JUNCTION::Print(), SCH_LINE::Print(), SCH_NO_CONNECT::Print(), SCH_SHAPE::Print(), LIB_FIELD::print(), LIB_PIN::print(), LIB_SHAPE::print(), LIB_TEXT::print(), LIB_TEXTBOX::print(), SCH_LABEL_BASE::Print(), SCH_TEXT::Print(), SCH_TEXTBOX::Print(), GERBER_DRAW_ITEM::Print(), SCH_SHAPE::PrintBackground(), LIB_PIN::printPinElectricalTypeName(), LIB_PIN::printPinSymbol(), DS_DRAW_ITEM_LINE::PrintWsItem(), DS_DRAW_ITEM_POLYPOLYGONS::PrintWsItem(), DS_DRAW_ITEM_RECT::PrintWsItem(), DS_DRAW_ITEM_TEXT::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(), PCB_EDIT_FRAME::SaveProjectSettings(), CONSOLE_LOG::SetColor(), DXF_PLOTTER::SetColor(), PSLIKE_PLOTTER::SetColor(), SVG_PLOTTER::SetColor(), EDA_MSG_PANEL::showItem(), DXF_PLOTTER::StartPlot(), APPEARANCE_CONTROLS::syncColorsAndVisibility(), APPEARANCE_CONTROLS::syncObjectSettings(), AR_MATRIX::traceArc(), AR_MATRIX::traceCircle(), AR_MATRIX::traceFilledCircle(), AR_MATRIX::TraceFilledRectangle(), DIALOG_WIRE_BUS_PROPERTIES::TransferDataFromWindow(), PANEL_SETUP_NETCLASSES::TransferDataFromWindow(), DIALOG_LIB_SHAPE_PROPERTIES::TransferDataToWindow(), DIALOG_WIRE_BUS_PROPERTIES::TransferDataToWindow(), KIGFX::VIEW::UpdateAllLayersColor(), DIALOG_PAGES_SETTINGS::UpdateDrawingSheetExample(), KIGFX::VIEW::updateItemColor(), and RATSNEST_VIEW_ITEM::ViewDraw().

◆ 

const struct { ... } 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 38 of file DXF_plotter.cpp.

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

◆ name

const char* name

Definition at line 56 of file DXF_plotter.cpp.

Referenced by add_category(), DXF_IMPORT_PLUGIN::addBlock(), GERBER_JOBFILE_WRITER::addJSONDesignRules(), GERBER_JOBFILE_WRITER::addJSONFilesAttributes(), GERBER_JOBFILE_WRITER::addJSONMaterialStackup(), DXF_IMPORT_PLUGIN::addLayer(), SYMBOL_TREE_MODEL_ADAPTER::AddLibraries(), DXF_IMPORT_PLUGIN::addLinetype(), PROPERTY_MANAGER::AddProperty(), DIALOG_MANAGE_REPOSITORIES::addRepository(), DIALOG_SIGNAL_LIST::addSignalToPlotFrame(), SCH_LIB_PLUGIN_CACHE::AddSymbol(), DXF_IMPORT_PLUGIN::addTextStyle(), SIM_PLOT_PANEL::addTrace(), PNS_LOG_VIEWER_OVERLAY::AnnotatedPoint(), AskLoadBoardFileName(), PGM_BASE::AskUserForPreferredEditor(), PNS_TEST_DEBUG_DECORATOR::BeginGroup(), BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS(), BOOST_AUTO_TEST_CASE(), CONNECTION_GRAPH::buildConnectionGraph(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildFilterLists(), DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetclassesGrid(), SYMBOL_LIBS::CacheName(), FOOTPRINT_VIEWER_FRAME::ClickOnFootprintList(), FOOTPRINT_VIEWER_FRAME::ClickOnLibList(), CONNECTION_GRAPH::collectAllDriverValues(), createBoard(), DRC_ENGINE::createImplicitRule(), SYMBOL_EDIT_FRAME::CreateNewSymbol(), PANEL_EESCHEMA_COLOR_SETTINGS::createSwatches(), PANEL_PCBNEW_COLOR_SETTINGS::createSwatches(), PANEL_COLOR_SETTINGS::createThemeList(), SIM_MODEL_NGSPICE::DEFINE_ENUM_CLASS_WITH_ITERATOR(), DIALOG_ASSIGN_NETCLASS::DIALOG_ASSIGN_NETCLASS(), DIALOG_LIB_NEW_SYMBOL::DIALOG_LIB_NEW_SYMBOL(), SYMBOL_EDITOR_EDIT_TOOL::DoDelete(), KIGFX::PCB_PAINTER::draw(), KIWAY::dso_search_path(), WIDGET_HOTKEY_LIST::editItem(), SCH_DATABASE_PLUGIN::EnumerateSymbolLib(), ERC_SETTINGS::ERC_SETTINGS(), CONNECTION_GRAPH::ercCheckLabels(), CONNECTION_GRAPH::ercCheckNoConnects(), NL_3D_VIEWER_PLUGIN_IMPL::exportCommandsAndImages(), NL_SCHEMATIC_PLUGIN_IMPL::exportCommandsAndImages(), NL_PCBNEW_PLUGIN_IMPL::exportCommandsAndImages(), ALTIUM_COMPOUND_FILE::FindStream(), FONT_CHOICE::FONT_CHOICE(), FOOTPRINT_FILTER::ITERATOR::FootprintFilterMatch(), FootprintWithPads(), LIB_TABLE::FormatOptions(), GERBER_JOBFILE_READER::formatStringFromJSON(), DSN::SPECCTRA_DB::FromBOARD(), FOOTPRINT_INFO_GENERATOR::GenerateHtml(), SIM_MODEL::GenerateParamValuePair(), PCB_EXPR_BUILTIN_FUNCTIONS::Get(), ACTION_PLUGINS::GetAction(), 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(), getLabelName(), mpWindow::GetLayerByName(), GBR_LAYER_BOX_SELECTOR::getLayerName(), SCH_PIN::GetShownName(), BOARD_DESIGN_SETTINGS::GetSmallestClearanceValue(), DIALOG_SIM_MODEL< T >::getSymbolPinString(), GetTeardropTargetCanonicalName(), DRC_ENGINE::GetTestProvider(), TOOL_MANAGER::GetTool(), SYMBOL_LIBRARY_MANAGER::GetUniqueLibraryName(), FOOTPRINT_WIZARD_LIST::GetWizard(), BOARD_EDITOR_CONTROL::ImportSpecctraSession(), IncrementLabelMember(), FIELDS_GRID_TABLE< T >::initGrid(), DIALOG_FOOTPRINT_WIZARD_LIST::initLists(), DIALOG_BOM::installGeneratorsList(), mpWindow::IsLayerVisible(), SPICE_GENERATOR::ItemParams(), KiROUND(), GPCB_FPL_CACHE::Load(), X3DPARSER::Load(), EAGLE_PLUGIN::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_SIM_MODEL< T >::loadLibrary(), SCH_EAGLE_PLUGIN::loadLibrary(), SCH_LEGACY_PLUGIN::loadNoConnect(), SCH_LEGACY_PLUGIN_CACHE::LoadPart(), SCH_LEGACY_PLUGIN_CACHE::loadPin(), PCB_EDIT_FRAME::LoadProjectSettings(), CADSTAR_SCH_ARCHIVE_LOADER::loadSheetAndChildSheets(), SCH_EDIT_FRAME::LoadSheetFromFile(), SCH_LEGACY_PLUGIN::loadSymbol(), SYMBOL_LIB_TABLE::LoadSymbolWithOptionalNickname(), SIM_PLOT_FRAME::loadWorkbook(), DSN::SPECCTRA_DB::makePADSTACK(), DSN::SPECCTRA_DB::makeVia(), PCB_CALCULATOR_SETTINGS::MigrateFromLegacy(), SPICE_GENERATOR::ModelLine(), mpFX::mpFX(), mpFXY::mpFXY(), mpFY::mpFY(), mpProfile::mpProfile(), mpScaleXBase::mpScaleXBase(), mpScaleY::mpScaleY(), mpText::mpText(), NET_SETTINGS::NET_SETTINGS(), PNS_TEST_DEBUG_DECORATOR::NewStage(), DIALOG_BOM::OnAddGenerator(), PANEL_SETUP_BUSES::OnAliasesGridCellChanging(), PCM_FP_LIB_TRAVERSER::OnDir(), PANEL_REGULATOR::OnEditRegulator(), PROJECT_TREE_PANE::onExpand(), PCM_SYM_LIB_TRAVERSER::OnFile(), APP_SINGLE_TOP::OnInit(), APP_TEST::OnInit(), APPEARANCE_CONTROLS::onLayerPresetChanged(), PANEL_SETUP_BUSES::OnMemberGridCellChanging(), APPEARANCE_CONTROLS::onNetclassContextMenu(), APPEARANCE_CONTROLS::OnNetGridMouseEvent(), PGM_SINGLE_TOP::OnPgmInit(), PANEL_REGULATOR::OnRegulatorSelection(), PANEL_REGULATOR::OnRemoveRegulator(), APP_SINGLE_TOP::OnRun(), APP_KICAD::OnRun(), APP_TEST::OnRun(), PANEL_SETUP_RULES::onScintillaCharAdded(), EDA_3D_VIEWER_FRAME::onViewportChanged(), APPEARANCE_CONTROLS::onViewportChanged(), DIALOG_PAGES_SETTINGS::OnWksFileSelection(), ERULES::parse(), CADSTAR_SCH_ARCHIVE_PARSER::SHEETS::Parse(), PCB_PARSER::parseBoardStackup(), ALTIUM_PCB::ParseClasses6Data(), KICAD_NETLIST_PARSER::parseComponent(), SCH_ALTIUM_PLUGIN::ParseComponent(), PCB_PARSER::parseFOOTPRINT_unchecked(), PCB_PARSER::parseLayer(), PCB_PARSER::parseLayers(), KICAD_NETLIST_PARSER::parseNet(), PCB_PARSER::parseNETINFO_ITEM(), LIB_TABLE::ParseOptions(), SCH_SEXPR_PARSER::parseProperty(), PCB_CALCULATOR_DATAFILE_PARSER::ParseRegulatorDescr(), SCH_SEXPR_PARSER::parseSchematicSymbol(), SCH_SEXPR_PARSER::parseSchField(), SCH_SEXPR_PARSER::parseSchSheetPin(), SCH_SEXPR_PARSER::ParseSymbol(), PCB_CALCULATOR_SETTINGS::PCB_CALCULATOR_SETTINGS(), PlotInteractiveLayer(), LIB_PIN::PlotPinTexts(), LIB_PIN::printPinTexts(), KI_TEST::COMBINED_UTILITY::printUsage(), FABMASTER::processCustomPads(), CONNECTION_GRAPH::processSubGraphs(), X3DSHAPE::Read(), X3DTRANSFORM::Read(), S3D::ReadCache(), SCENEGRAPH::ReadCache(), SGFACESET::ReadCache(), SGSHAPE::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(), PROJECT_TREE_PANE::ReCreateTreePrj(), PROJECT_TREE_ITEM::Rename(), DS_DATA_MODEL::ResolvePath(), PNS::LINE_PLACER::rhWalkOnly(), PCB_EDIT_FRAME::SaveProjectSettings(), SYMBOL_LIB_TABLE::SaveSymbol(), SCH_SEXPR_PLUGIN_CACHE::SaveSymbol(), SCH_BASE_FRAME::SelectLibraryFromList(), ABOUT_APP_INFO::SetAppName(), PROJECT_TREE_ITEM::SetFileName(), KIWAY_HOLDER::SetKiway(), mpWindow::SetLayerVisible(), DIALOG_LIB_NEW_SYMBOL::SetName(), mpLayer::SetName(), PANEL_PACKAGES_VIEW::setPackageDetails(), GERBER_DRAW_ITEM::ShowGBRShape(), COMMON_CONTROL::ShowHelp(), DXF_PLOTTER::StartPlot(), FP_TREE_SYNCHRONIZING_ADAPTER::Sync(), SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Sync(), PANEL_SETUP_LAYERS::testLayerNames(), ERC_TESTER::TestMultUnitPinConflicts(), DIALOG_SELECT_3DMODEL::TransferDataFromWindow(), DIALOG_CONFIGURE_PATHS::TransferDataFromWindow(), PANEL_TEXT_VARIABLES::TransferDataFromWindow(), DIALOG_FP_PLUGIN_OPTIONS::TransferDataFromWindow(), PANEL_SETUP_NETCLASSES::TransferDataToWindow(), SETTINGS_MANAGER::unloadProjectFile(), BUS_UNFOLD_MENU::update(), SIM_PLOT_FRAME::updatePlot(), TRANSLINE_IDENT::WriteConfig(), and DIALOG_BOM::~DIALOG_BOM().