Some minor fixes to prepare the new zone filling algo (no filled polygon thickness)

This commit is contained in:
jean-pierre charras 2019-06-02 11:51:47 +02:00
parent 072fc4f8cb
commit b7f4113f96
5 changed files with 58 additions and 5 deletions

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018-2019 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -65,6 +65,18 @@ static const wxChar EnableSvgImport[] = wxT( "EnableSvgImport" );
*/
static const wxChar RealtimeConnectivity[] = wxT( "RealtimeConnectivity" );
/**
* Allow legacy canvas to be shown in GTK3. Legacy canvas is generally pretty
* broken, but this avoids code in an ifdef where it could become broken
* on other platforms
*/
static const wxChar AllowLegacyCanvasInGtk3[] = wxT( "AllowLegacyCanvasInGtk3" );
/**
* Draw zones in pcbnew with the stroked outline.
*/
static const wxChar ForceThickZones[] = wxT( "ForceThickZones" );
} // namespace KEYS
@ -143,7 +155,9 @@ ADVANCED_CFG::ADVANCED_CFG()
// Init defaults - this is done in case the config doesn't exist,
// then the values will remain as set here.
m_enableSvgImport = false;
m_allowLegacyCanvasInGtk3 = false;
m_realTimeConnectivity = true;
m_forceThickOutlinesInZones = true;
loadFromConfigFile();
}
@ -180,12 +194,30 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back(
new PARAM_CFG_BOOL( true, AC_KEYS::EnableSvgImport, &m_enableSvgImport, false ) );
configParams.push_back( new PARAM_CFG_BOOL(
true, AC_KEYS::AllowLegacyCanvasInGtk3, &m_allowLegacyCanvasInGtk3, false ) );
configParams.push_back(
new PARAM_CFG_BOOL( true, AC_KEYS::RealtimeConnectivity, &m_realTimeConnectivity, false ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ForceThickZones,
&m_forceThickOutlinesInZones, true ) );
wxConfigLoadSetups( &aCfg, configParams );
dumpCfg( configParams );
}
bool ADVANCED_CFG::AllowLegacyCanvas() const
{
// default is to allow
bool allow = true;
// on GTK3, check the config
#ifdef __WXGTK3__
allow = m_allowLegacyCanvasInGtk3;
#endif
return allow;
}

View File

@ -1512,7 +1512,7 @@ int SHAPE_POLY_SET::TotalVertices() const
SHAPE_POLY_SET::POLYGON SHAPE_POLY_SET::ChamferPolygon( unsigned int aDistance, int aIndex )
{
return chamferFilletPolygon( CORNER_MODE::CHAMFERED, aDistance, aIndex );
return chamferFilletPolygon( CORNER_MODE::CHAMFERED, aDistance, aIndex, 0 );
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2014 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License

View File

@ -1,7 +1,7 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -78,6 +78,27 @@ public:
*/
bool m_realTimeConnectivity;
/**
* Force filled polygons with outlines in zone -- To be removed after testing
* default = true (legacy mode)
*/
bool m_forceThickOutlinesInZones;
/**
* Helper to determine if legacy canvas is allowed (according to platform
* and config)
* @return true if legacy canvas should be shown
*/
bool AllowLegacyCanvas() const;
private:
/*
* These settings are private, as there is extra logic provide by helper
* functions above.
*/
bool m_allowLegacyCanvasInGtk3;
private:
ADVANCED_CFG();

View File

@ -1187,7 +1187,7 @@ class SHAPE_POLY_SET : public SHAPE
* @return POLYGON - the chamfered/filleted version of the polygon.
*/
POLYGON chamferFilletPolygon( CORNER_MODE aMode, unsigned int aDistance,
int aIndex, int aErrorMax = -1 );
int aIndex, int aErrorMax );
///> Returns true if the polygon set has any holes that touch share a vertex.
bool hasTouchingHoles( const POLYGON& aPoly ) const;