Report unsupported DXF features on import.

Fixes https://gitlab.com/kicad/code/kicad/-/issues/15614
This commit is contained in:
Jeff Young 2023-09-25 16:20:40 +01:00
parent 88e34fd482
commit 902e5df2e8
3 changed files with 81 additions and 66 deletions

View File

@ -27,6 +27,7 @@
#include "graphics_import_plugin.h"
#include "graphics_importer_buffer.h"
#include "wx/translation.h"
#include <dl_creationadapter.h>
#include <dl_dxf.h>
@ -206,12 +207,8 @@ enum class DXF_IMPORT_UNITS
* This class import DXF ASCII files and convert basic entities to board entities.
* It depends on the dxflib library.
*/
#if 0 //defined(DEBUG)
// For dxf import debug:
#define ON_UNSUPPORTED( error_msg ) wxLogMessage( wxT( error_msg ) )
#else
#define ON_UNSUPPORTED( error_msg )
#endif
#define ON_UNSUPPORTED( error_msg ) reportMessage( wxString::Format( _( "%s is not supported." ), \
error_msg ) )
class DXF_IMPORT_PLUGIN : public GRAPHICS_IMPORT_PLUGIN, public DL_CreationAdapter
{
@ -456,76 +453,93 @@ private:
virtual void addKnot( const DL_KnotData& aData ) override;
// Not yet handled DXF entities:
virtual void addXLine( const DL_XLineData& ) override { ON_UNSUPPORTED( "addXLine" ); }
virtual void addRay( const DL_RayData& ) override { ON_UNSUPPORTED( "addRay" ); }
virtual void addXLine( const DL_XLineData& ) override
{
reportMsg( _( "DXF construction lines not currently supported." ) );
}
virtual void addRay( const DL_RayData& ) override
{
reportMsg( _( "DXF construction lines not currently supported." ) );
}
virtual void addArcAlignedText( const DL_ArcAlignedTextData& ) override
{ ON_UNSUPPORTED( "addArcAlignedText" ); }
virtual void addAttribute( const DL_AttributeData& ) override
{ ON_UNSUPPORTED( "addAttribute" ); }
virtual void addDimAlign( const DL_DimensionData&,
const DL_DimAlignedData& ) override { ON_UNSUPPORTED( "addDimAlign" ); }
virtual void addDimLinear( const DL_DimensionData&,
const DL_DimLinearData& ) override { ON_UNSUPPORTED( "addDimLinear" ); }
virtual void addDimRadial( const DL_DimensionData&,
const DL_DimRadialData& ) override { ON_UNSUPPORTED( "addDimRadial" ); }
virtual void addDimDiametric( const DL_DimensionData&,
const DL_DimDiametricData& ) override { ON_UNSUPPORTED( "addDimDiametric" ); }
virtual void addDimAngular( const DL_DimensionData&,
const DL_DimAngular2LData& ) override { ON_UNSUPPORTED( "addDimAngular" ); }
virtual void addDimAngular3P( const DL_DimensionData&,
const DL_DimAngular3PData& ) override { ON_UNSUPPORTED( "addDimAngular3P" ); }
virtual void addDimOrdinate( const DL_DimensionData&,
const DL_DimOrdinateData& ) override { ON_UNSUPPORTED( "addDimOrdinate" ); }
{
reportMsg( _( "DXF arc-aligned text not currently supported." ) );
}
virtual void addDimAlign( const DL_DimensionData&, const DL_DimAlignedData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addDimLinear( const DL_DimensionData&, const DL_DimLinearData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addDimRadial( const DL_DimensionData&, const DL_DimRadialData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addDimDiametric( const DL_DimensionData&, const DL_DimDiametricData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addDimAngular( const DL_DimensionData&, const DL_DimAngular2LData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addDimAngular3P( const DL_DimensionData&, const DL_DimAngular3PData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addDimOrdinate( const DL_DimensionData&, const DL_DimOrdinateData& ) override
{
reportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addLeader( const DL_LeaderData& ) override
{ ON_UNSUPPORTED( "addLeader" ); }
{
reportMsg( _( "DXF dimensions not currently supported." ) );
}
virtual void addLeaderVertex( const DL_LeaderVertexData& ) override { }
virtual void addLeaderVertex( const DL_LeaderVertexData& ) override
{ ON_UNSUPPORTED( "addLeaderVertex" ); }
virtual void addHatch( const DL_HatchData& ) override
{
reportMsg( _( "DXF hatches not currently supported." ) );
}
virtual void addHatchLoop( const DL_HatchLoopData& ) override { }
virtual void addHatchEdge( const DL_HatchEdgeData& ) override { }
virtual void addHatch( const DL_HatchData& ) override { ON_UNSUPPORTED( "addHatch" ); }
virtual void addTrace( const DL_TraceData& ) override
{
reportMsg( _( "DXF traces not currently supported." ) );
}
virtual void addTrace( const DL_TraceData& ) override { ON_UNSUPPORTED( "addTrace" ); }
virtual void add3dFace( const DL_3dFaceData& ) override { ON_UNSUPPORTED( "add3dFace" ); }
virtual void add3dFace( const DL_3dFaceData& ) override
{
reportMsg( _( "DXF 3dfaces not currently supported." ) );
}
virtual void addSolid( const DL_SolidData& ) override { ON_UNSUPPORTED( "addSolid" ); }
virtual void addSolid( const DL_SolidData& ) override
{
reportMsg( _( "DXF solids not currently supported." ) );
}
virtual void addImage( const DL_ImageData& ) override { ON_UNSUPPORTED( "addImage" ); }
virtual void addImage( const DL_ImageData& ) override
{
reportMsg( _( "DXF images not currently supported." ) );
}
virtual void linkImage( const DL_ImageDefData& ) override {}
virtual void addHatchLoop( const DL_HatchLoopData& ) override
{
ON_UNSUPPORTED( "addHatchLoop" );
}
virtual void addHatchEdge( const DL_HatchEdgeData& ) override
{
ON_UNSUPPORTED( "addHatchEdge" );
}
virtual void addXRecord( const std::string& ) override { ON_UNSUPPORTED( "addXRecord" ); }
virtual void addXRecordString( int, const std::string& ) override
{
ON_UNSUPPORTED( "addXRecordString" );
}
virtual void addXRecordReal( int, double ) override { ON_UNSUPPORTED( "addXRecordReal" ); }
virtual void addXRecordInt( int, int ) override { ON_UNSUPPORTED( "addXRecordInt" ); }
virtual void addXRecordBool( int, bool ) override { ON_UNSUPPORTED( "addXRecordBool" ); }
virtual void addXDataApp( const std::string& ) override { ON_UNSUPPORTED( "addXDataApp" ); }
virtual void addXDataString( int, const std::string& ) override
{
ON_UNSUPPORTED( "addXDataString" );
}
virtual void addXDataReal( int, double ) override { ON_UNSUPPORTED( "addXDataReal" ); }
virtual void addXDataInt( int, int ) override { ON_UNSUPPORTED( "addXDataInt" ); }
// Eat these silently
virtual void addAttribute( const DL_AttributeData& ) override { }
virtual void addXRecord( const std::string& ) override { }
virtual void addXRecordString( int, const std::string& ) override { }
virtual void addXRecordReal( int, double ) override { }
virtual void addXRecordInt( int, int ) override { }
virtual void addXRecordBool( int, bool ) override { }
virtual void addXDataApp( const std::string& ) override { }
virtual void addXDataString( int, const std::string& ) override { }
virtual void addXDataReal( int, double ) override { }
virtual void addXDataInt( int, int ) override { }
/**
* Convert a native Unicode string into a DXF encoded string.

View File

@ -27,6 +27,7 @@
#include <eda_item.h>
#include "graphics_importer.h"
#include "graphics_import_plugin.h"
#include <wx/log.h>
GRAPHICS_IMPORTER::GRAPHICS_IMPORTER()
{

View File

@ -627,7 +627,7 @@ bool DL_Dxf::processDXFGroup( DL_CreationInterface* creationInterface,
break;
case DL_ENTITY_HATCH:
// addHatch(creationInterface);
addHatch(creationInterface);
handleHatchData( creationInterface );
break;