Move zone fracture display mode to AdvancedCfg, and add triangulation.

Fixes https://gitlab.com/kicad/code/kicad/issues/8762
This commit is contained in:
Jeff Young 2021-07-26 18:56:11 +01:00
parent 89b1fdabe9
commit e62969d007
29 changed files with 426 additions and 60 deletions

View File

@ -435,6 +435,7 @@ set( BMAPS_MID
show_zone
show_zone_disable
show_zone_outline_only
show_zone_triangulation
show_all_layers
show_no_layers
show_no_copper_layers

Binary file not shown.

Before

Width:  |  Height:  |  Size: 299 B

After

Width:  |  Height:  |  Size: 318 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 309 B

After

Width:  |  Height:  |  Size: 329 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 596 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 607 B

View File

@ -13,7 +13,7 @@
viewBox="0 0 24 24"
version="1.1"
sodipodi:docname="show_zone_outline_only.svg"
inkscape:version="1.0.1 (c497b03c, 2020-09-10)">
inkscape:version="1.0.2 (e86c8708, 2021-01-15)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
@ -23,18 +23,19 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="715"
inkscape:window-width="1440"
inkscape:window-height="800"
id="namedview42"
showgrid="true"
inkscape:zoom="19.385992"
inkscape:zoom="44.542905"
inkscape:cx="9.9710284"
inkscape:cy="11.030906"
inkscape:window-x="0"
inkscape:window-y="23"
inkscape:window-maximized="1"
inkscape:current-layer="Слой_1"
inkscape:document-rotation="0">
inkscape:document-rotation="0"
inkscape:snap-global="false">
<inkscape:grid
type="xygrid"
id="grid240579"
@ -122,4 +123,11 @@
id="polygon838"
style="display:inline;fill:none;stroke:#42B8EB;stroke-opacity:1"
d="M 8.5 2.5 L 8.5 12.5 L 2.5 12.5 L 2.5 21.5 L 21.5 21.5 L 21.5 14.5 L 19.828125 14.5 A 4.5 4.5 0 0 1 17 15.5 A 4.5 4.5 0 0 1 12.5 11 A 4.5 4.5 0 0 1 17 6.5 A 4.5 4.5 0 0 1 19.828125 7.5 L 21.5 7.5 L 21.5 2.5 L 8.5 2.5 z " />
<rect
style="fill:#ffffff;stroke:#42b8eb;stroke-width:0.5;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
id="rect1484"
width="4"
height="0.5"
x="8.5"
y="10.208146" />
</svg>

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,141 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="Слой_1"
data-name="Слой 1"
viewBox="0 0 24 24"
version="1.1"
sodipodi:docname="show_zone_triangulation.svg"
inkscape:version="1.0.2 (e86c8708, 2021-01-15)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1440"
inkscape:window-height="800"
id="namedview42"
showgrid="true"
inkscape:zoom="29.390539"
inkscape:cx="9.9710284"
inkscape:cy="11.030906"
inkscape:window-x="0"
inkscape:window-y="23"
inkscape:window-maximized="1"
inkscape:current-layer="Слой_1"
inkscape:document-rotation="0"
inkscape:snap-global="false">
<inkscape:grid
type="xygrid"
id="grid240579"
spacingx="0.5"
spacingy="0.5"
color="#b8b8ff"
opacity="0.1254902"
empspacing="2" />
</sodipodi:namedview>
<metadata
id="metadata43">
<rdf:RDF>
<cc:Work
rdf:about="">
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>show_zone_disable копия</dc:title>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
id="defs11">
<style
id="style3">.cls-1{fill:none;stroke:#42B8EB;stroke-miterlimit:10;}.cls-2{fill:#8f8f8f;}.cls-3{fill:#595959;}.cls-4{fill:url(#Безымянный_градиент_19);}.cls-5{fill:url(#Безымянный_градиент_19-2);}.cls-6{fill:#DED3DD;}.cls-7{fill:#f2647e;}.cls-8{fill:#545454;}</style>
<linearGradient
id="Безымянный_градиент_19"
x1="8.3372"
y1="15.5299"
x2="8.3372"
y2="12.9228"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
stop-color="#ececec"
id="stop5" />
<stop
offset="1"
stop-color="#c6c6c5"
id="stop7" />
</linearGradient>
<linearGradient
id="Безымянный_градиент_19-2"
x1="9.5617"
y1="15.5299"
x2="9.5617"
y2="12.9228"
xlink:href="#Безымянный_градиент_19" />
</defs>
<title
id="title13">show_zone_disable копия</title>
<circle
style="display:inline;fill:#DED3DD;fill-opacity:1;stroke:none;stroke-width:1.00157;stroke-linecap:round;stroke-linejoin:round"
id="path867"
cx="17"
cy="11"
r="2"
sodipodi:insensitive="true" />
<rect
style="display:inline;fill:#DED3DD;fill-opacity:1;stroke:none;stroke-width:1.00157;stroke-linecap:round;stroke-linejoin:round"
id="rect869"
width="5"
height="2"
x="17"
y="10"
sodipodi:insensitive="true" />
<path
id="polygon838"
style="display:inline;fill:none;stroke:#42B8EB;stroke-opacity:1"
d="M 8.5 2.5 L 8.5 12.5 L 2.5 12.5 L 2.5 21.5 L 21.5 21.5 L 21.5 14.5 L 19.828125 14.5 A 4.5 4.5 0 0 1 17 15.5 A 4.5 4.5 0 0 1 12.5 11 A 4.5 4.5 0 0 1 17 6.5 A 4.5 4.5 0 0 1 19.828125 7.5 L 21.5 7.5 L 21.5 2.5 L 8.5 2.5 z " />
<path
style="fill:none;stroke:#42b8eb;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 21.163272,7.4513774 16.944228,2.4497679"
id="path2125"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#42b8eb;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 21.503518,14.562509 2.3817188,21.43547 2.517817,21.401445"
id="path2127"
sodipodi:nodetypes="ccc" />
<path
style="fill:none;stroke:#42b8eb;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 17.216425,2.5178167 2.5858661,21.367421 2.517817,21.401445"
id="path2129"
sodipodi:nodetypes="ccc" />
</svg>

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -13,7 +13,7 @@
viewBox="0 0 24 24"
version="1.1"
sodipodi:docname="show_zone_outline_only.svg"
inkscape:version="1.0.1 (c497b03c, 2020-09-10)">
inkscape:version="1.0.2 (e86c8708, 2021-01-15)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
@ -23,18 +23,19 @@
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="715"
inkscape:window-width="1440"
inkscape:window-height="800"
id="namedview42"
showgrid="true"
inkscape:zoom="19.385992"
inkscape:cx="9.9710284"
inkscape:cy="11.030906"
inkscape:zoom="29.388028"
inkscape:cx="10.074196"
inkscape:cy="12.372081"
inkscape:window-x="0"
inkscape:window-y="23"
inkscape:window-maximized="1"
inkscape:current-layer="Слой_1"
inkscape:document-rotation="0">
inkscape:document-rotation="0"
inkscape:snap-global="false">
<inkscape:grid
type="xygrid"
id="grid240579"
@ -54,7 +55,7 @@
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>add_arc</dc:title>
<dc:title>show_zone_disable копия</dc:title>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
@ -122,4 +123,12 @@
id="polygon838"
style="display:inline;fill:none;stroke:#1a81c4;stroke-opacity:1"
d="M 8.5 2.5 L 8.5 12.5 L 2.5 12.5 L 2.5 21.5 L 21.5 21.5 L 21.5 14.5 L 19.828125 14.5 A 4.5 4.5 0 0 1 17 15.5 A 4.5 4.5 0 0 1 12.5 11 A 4.5 4.5 0 0 1 17 6.5 A 4.5 4.5 0 0 1 19.828125 7.5 L 21.5 7.5 L 21.5 2.5 L 8.5 2.5 z " />
<rect
style="fill:#ffffff;stroke:#1a81c4;stroke-width:0.755906;stroke-miterlimit:4;stroke-dasharray:none"
id="rect865"
width="3.333333"
height="0.25833744"
x="8.7988548"
y="10.398369"
ry="0" />
</svg>

Before

Width:  |  Height:  |  Size: 4.3 KiB

After

Width:  |  Height:  |  Size: 4.5 KiB

View File

@ -0,0 +1,139 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
id="Слой_1"
data-name="Слой 1"
viewBox="0 0 24 24"
version="1.1"
sodipodi:docname="show_zone_triangulation.svg"
inkscape:version="1.0.2 (e86c8708, 2021-01-15)">
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1440"
inkscape:window-height="800"
id="namedview42"
showgrid="true"
inkscape:zoom="29.390539"
inkscape:cx="9.9710284"
inkscape:cy="11.030906"
inkscape:window-x="60"
inkscape:window-y="23"
inkscape:window-maximized="0"
inkscape:current-layer="Слой_1"
inkscape:document-rotation="0"
inkscape:snap-global="false">
<inkscape:grid
type="xygrid"
id="grid240579"
spacingx="0.5"
spacingy="0.5"
color="#b8b8ff"
opacity="0.1254902"
empspacing="2" />
</sodipodi:namedview>
<metadata
id="metadata43">
<rdf:RDF>
<cc:Work
rdf:about="">
<cc:license
rdf:resource="http://creativecommons.org/licenses/by-sa/4.0/" />
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title>show_zone_disable копия</dc:title>
</cc:Work>
<cc:License
rdf:about="http://creativecommons.org/licenses/by-sa/4.0/">
<cc:permits
rdf:resource="http://creativecommons.org/ns#Reproduction" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#Distribution" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Notice" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#Attribution" />
<cc:permits
rdf:resource="http://creativecommons.org/ns#DerivativeWorks" />
<cc:requires
rdf:resource="http://creativecommons.org/ns#ShareAlike" />
</cc:License>
</rdf:RDF>
</metadata>
<defs
id="defs11">
<style
id="style3">.cls-1{fill:none;stroke:#42B8EB;stroke-miterlimit:10;}.cls-2{fill:#8f8f8f;}.cls-3{fill:#595959;}.cls-4{fill:url(#Безымянный_градиент_19);}.cls-5{fill:url(#Безымянный_градиент_19-2);}.cls-6{fill:#DED3DD;}.cls-7{fill:#f2647e;}.cls-8{fill:#545454;}</style>
<linearGradient
id="Безымянный_градиент_19"
x1="8.3372"
y1="15.5299"
x2="8.3372"
y2="12.9228"
gradientUnits="userSpaceOnUse">
<stop
offset="0"
stop-color="#ececec"
id="stop5" />
<stop
offset="1"
stop-color="#c6c6c5"
id="stop7" />
</linearGradient>
<linearGradient
id="Безымянный_градиент_19-2"
x1="9.5617"
y1="15.5299"
x2="9.5617"
y2="12.9228"
xlink:href="#Безымянный_градиент_19" />
</defs>
<title
id="title13">show_zone_disable копия</title>
<circle
style="display:inline;fill:#545454;fill-opacity:1;stroke:none;stroke-width:1.00157;stroke-linecap:round;stroke-linejoin:round"
id="path867"
cx="17"
cy="11"
r="2" />
<rect
style="display:inline;fill:#545454;fill-opacity:1;stroke:none;stroke-width:1.00157;stroke-linecap:round;stroke-linejoin:round"
id="rect869"
width="5"
height="2"
x="17"
y="10" />
<path
id="polygon838"
style="display:inline;fill:none;stroke:#1a81c4;stroke-opacity:1"
d="M 8.5 2.5 L 8.5 12.5 L 2.5 12.5 L 2.5 21.5 L 21.5 21.5 L 21.5 14.5 L 19.828125 14.5 A 4.5 4.5 0 0 1 17 15.5 A 4.5 4.5 0 0 1 12.5 11 A 4.5 4.5 0 0 1 17 6.5 A 4.5 4.5 0 0 1 19.828125 7.5 L 21.5 7.5 L 21.5 2.5 L 8.5 2.5 z " />
<path
style="fill:none;stroke:#1a81c4;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 21.163272,7.4513774 16.944228,2.4497679"
id="path2125"
sodipodi:nodetypes="cc" />
<path
style="fill:none;stroke:#1a81c4;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 21.503518,14.562509 2.3817188,21.43547 2.517817,21.401445"
id="path2127"
sodipodi:nodetypes="ccc" />
<path
style="fill:none;stroke:#1a81c4;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
d="M 17.216425,2.5178167 2.5858661,21.367421 2.517817,21.401445"
id="path2129"
sodipodi:nodetypes="ccc" />
</svg>

After

Width:  |  Height:  |  Size: 4.9 KiB

View File

@ -140,6 +140,12 @@ static const wxChar MaxTrackLengthToKeep[] = wxT( "MaxTrackLengthToKeep" );
*/
static const wxChar StrokeTriangulation[] = wxT( "StrokeTriangulation" );
/**
* When true, a third zone-display-mode is included which strokes the filled areas and fracture
* boundaries.
*/
static const wxChar ExtraZoneDisplayModes[] = wxT( "ExtraZoneDisplayModes" );
/**
* Absolute minimum pen width to send to the plotter. PDF seems happy enough with 0.0212mm
* (which equates to 1px @ 1200dpi).
@ -252,6 +258,7 @@ ADVANCED_CFG::ADVANCED_CFG()
m_DrawArcCenterMaxAngle = 50.0;
m_MaxTangentAngleDeviation = 1.0;
m_MaxTrackLengthToKeep = 0.0001;
m_ExtraZoneDisplayModes = false;
m_DrawTriangulationOutlines = false;
m_ExtraClearance = 0.0001;
@ -349,6 +356,9 @@ void ADVANCED_CFG::loadSettings( wxConfigBase& aCfg )
configParams.push_back( new PARAM_CFG_DOUBLE( true, AC_KEYS::MaxTrackLengthToKeep,
&m_MaxTrackLengthToKeep, 0.0005, 0.0, 1.0 ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::ExtraZoneDisplayModes,
&m_ExtraZoneDisplayModes, false ) );
configParams.push_back( new PARAM_CFG_BOOL( true, AC_KEYS::StrokeTriangulation,
&m_DrawTriangulationOutlines, false ) );

View File

@ -425,7 +425,7 @@ void CAIRO_GAL_BASE::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D&
}
void CAIRO_GAL_BASE::DrawPolygon( const SHAPE_POLY_SET& aPolySet )
void CAIRO_GAL_BASE::DrawPolygon( const SHAPE_POLY_SET& aPolySet, bool aStrokeTriangulation )
{
for( int i = 0; i < aPolySet.OutlineCount(); ++i )
drawPoly( aPolySet.COutline( i ) );

View File

@ -1068,7 +1068,8 @@ void OPENGL_GAL::DrawPolygon( const VECTOR2D aPointList[], int aListSize )
}
void OPENGL_GAL::drawTriangulatedPolyset( const SHAPE_POLY_SET& aPolySet )
void OPENGL_GAL::drawTriangulatedPolyset( const SHAPE_POLY_SET& aPolySet,
bool aStrokeTriangulation )
{
m_currentManager->Shader( SHADER_NONE );
m_currentManager->Color( m_fillColor.r, m_fillColor.g, m_fillColor.b, m_fillColor.a );
@ -1104,12 +1105,17 @@ void OPENGL_GAL::drawTriangulatedPolyset( const SHAPE_POLY_SET& aPolySet )
}
if( ADVANCED_CFG::GetCfg().m_DrawTriangulationOutlines )
{
aStrokeTriangulation = true;
SetStrokeColor( COLOR4D( 0.0, 1.0, 0.2, 1.0 ) );
}
if( aStrokeTriangulation )
{
COLOR4D oldStrokeColor = m_strokeColor;
double oldLayerDepth = m_layerDepth;
SetLayerDepth( m_layerDepth - 1 );
SetStrokeColor( COLOR4D( 0.0, 1.0, 0.2, 1.0 ) );
for( unsigned int j = 0; j < aPolySet.TriangulatedPolyCount(); ++j )
{
@ -1131,11 +1137,11 @@ void OPENGL_GAL::drawTriangulatedPolyset( const SHAPE_POLY_SET& aPolySet )
}
void OPENGL_GAL::DrawPolygon( const SHAPE_POLY_SET& aPolySet )
void OPENGL_GAL::DrawPolygon( const SHAPE_POLY_SET& aPolySet, bool aStrokeTriangulation )
{
if( aPolySet.IsTriangulationUpToDate() )
{
drawTriangulatedPolyset( aPolySet );
drawTriangulatedPolyset( aPolySet, aStrokeTriangulation );
return;
}

View File

@ -27,7 +27,7 @@
#include <tool/action_manager.h>
#include <tool/tool_event.h>
#include <tool/tool_action.h>
#include <advanced_config.h>
class PSEUDO_ACTION : public TOOL_ACTION
{
@ -115,6 +115,15 @@ void HOTKEY_STORE::Init( std::vector<TOOL_MANAGER*> aToolManagerList, bool aIncl
if( entry.second->GetLabel().IsEmpty() )
continue;
if( !ADVANCED_CFG::GetCfg().m_ExtraZoneDisplayModes )
{
if( entry.second->GetName() == "pcbnew.Control.zoneDisplayOutlines"
|| entry.second->GetName() == "pcbnew.Control.zoneDisplayTesselation" )
{
continue;
}
}
HOTKEY& hotkey = masterMap[ entry.first ];
hotkey.m_Actions.push_back( entry.second );
hotkey.m_EditKeycode = entry.second->GetHotKey();

View File

@ -172,7 +172,7 @@ PROJECT_LOCAL_SETTINGS::PROJECT_LOCAL_SETTINGS( PROJECT* aProject, const wxStrin
m_params.emplace_back( new PARAM_ENUM<ZONE_DISPLAY_MODE>( "board.zone_display_mode",
&m_ZoneDisplayMode,
ZONE_DISPLAY_MODE::SHOW_FILLED, ZONE_DISPLAY_MODE::SHOW_FILLED,
ZONE_DISPLAY_MODE::SHOW_FILLED_OUTLINE ) );
ZONE_DISPLAY_MODE::SHOW_TRIANGULATION ) );
m_params.emplace_back( new PARAM_LAMBDA<nlohmann::json>( "project.files",
[&]() -> nlohmann::json

View File

@ -133,6 +133,12 @@ public:
*/
bool m_DrawTriangulationOutlines;
/**
* When true, adds zone-diaplay-modes for stroking the zone fracture boundaries and the zone
* triangulation.
*/
bool m_ExtraZoneDisplayModes;
/**
* Sets an absolute minimum pen width for plotting. Some formats (PDF, for example) don't
* like ultra-thin lines. Units are mm.

View File

@ -452,6 +452,7 @@ const std::vector<BITMAP_INFO> g_BitmapInfo = {
{ BITMAPS::show_zone, wxT( "show_zone_24.png" ), 24, wxT( "light" ) },
{ BITMAPS::show_zone_disable, wxT( "show_zone_disable_24.png" ), 24, wxT( "light" ) },
{ BITMAPS::show_zone_outline_only, wxT( "show_zone_outline_only_24.png" ), 24, wxT( "light" ) },
{ BITMAPS::show_zone_triangulation, wxT( "show_zone_triangulation_24.png" ), 24, wxT( "light" ) },
{ BITMAPS::show_all_layers, wxT( "show_all_layers_24.png" ), 24, wxT( "light" ) },
{ BITMAPS::show_no_layers, wxT( "show_no_layers_24.png" ), 24, wxT( "light" ) },
{ BITMAPS::show_no_copper_layers, wxT( "show_no_copper_layers_24.png" ), 24, wxT( "light" ) },
@ -813,6 +814,7 @@ const std::vector<BITMAP_INFO> g_BitmapInfo = {
{ BITMAPS::show_zone, wxT( "show_zone_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::show_zone_disable, wxT( "show_zone_disable_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::show_zone_outline_only, wxT( "show_zone_outline_only_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::show_zone_triangulation, wxT( "show_zone_triangulation_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::show_all_layers, wxT( "show_all_layers_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::show_no_layers, wxT( "show_no_layers_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::show_no_copper_layers, wxT( "show_no_copper_layers_dark_24.png" ), 24, wxT( "dark" ) },

View File

@ -491,6 +491,7 @@ enum class BITMAPS : unsigned int
show_zone,
show_zone_disable,
show_zone_outline_only,
show_zone_triangulation,
showtrack,
sim_add_signal,
sim_probe,

View File

@ -104,7 +104,7 @@ public:
drawPoly( aPointList, aListSize );
}
void DrawPolygon( const SHAPE_POLY_SET& aPolySet ) override;
void DrawPolygon( const SHAPE_POLY_SET& aPolySet, bool aStrokeTriangulation = false ) override;
void DrawPolygon( const SHAPE_LINE_CHAIN& aPolySet ) override;
/// @copydoc GAL::DrawCurve()

View File

@ -170,7 +170,7 @@ public:
*/
virtual void DrawPolygon( const std::deque<VECTOR2D>& aPointList ) {};
virtual void DrawPolygon( const VECTOR2D aPointList[], int aListSize ) {};
virtual void DrawPolygon( const SHAPE_POLY_SET& aPolySet ) {};
virtual void DrawPolygon( const SHAPE_POLY_SET& aPolySet, bool aStrokeTriangulation = false ) {};
virtual void DrawPolygon( const SHAPE_LINE_CHAIN& aPolySet ) {};
/**

View File

@ -141,7 +141,7 @@ public:
/// @copydoc GAL::DrawPolygon()
void DrawPolygon( const std::deque<VECTOR2D>& aPointList ) override;
void DrawPolygon( const VECTOR2D aPointList[], int aListSize ) override;
void DrawPolygon( const SHAPE_POLY_SET& aPolySet ) override;
void DrawPolygon( const SHAPE_POLY_SET& aPolySet, bool aStrokeTriangulation = false ) override;
void DrawPolygon( const SHAPE_LINE_CHAIN& aPolySet ) override;
/// @copydoc GAL::DrawCurve()
@ -425,8 +425,11 @@ private:
/**
* Draw a set of polygons with a cached triangulation. Way faster than drawPolygon.
*
* @param aStrokeTriangulation indicates the triangulation should be stroked rather than
* filled. Used for debugging.
*/
void drawTriangulatedPolyset( const SHAPE_POLY_SET& aPoly );
void drawTriangulatedPolyset( const SHAPE_POLY_SET& aPoly, bool aStrokeTriangulation );
/**

View File

@ -98,9 +98,13 @@ enum class HIGH_CONTRAST_MODE
///< Determine how zones should be displayed.
enum class ZONE_DISPLAY_MODE
{
SHOW_FILLED, ///< Filled polygons are shown
SHOW_ZONE_OUTLINE, ///< Only the zone outline is shown
SHOW_FILLED_OUTLINE ///< Outlines of filled polygons are shown
SHOW_FILLED,
SHOW_ZONE_OUTLINE,
// Debug modes
SHOW_FRACTURE_BORDERS,
SHOW_TRIANGULATION
};
///< Determine how net color overrides should be applied.

View File

@ -260,9 +260,14 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
drawingModeSubMenu->SetTitle( _( "&Drawing Mode" ) );
drawingModeSubMenu->SetIcon( BITMAPS::add_zone );
drawingModeSubMenu->Add( PCB_ACTIONS::zoneDisplayEnable, ACTION_MENU::CHECK );
drawingModeSubMenu->Add( PCB_ACTIONS::zoneDisplayDisable, ACTION_MENU::CHECK );
drawingModeSubMenu->Add( PCB_ACTIONS::zoneDisplayOutlines, ACTION_MENU::CHECK );
drawingModeSubMenu->Add( PCB_ACTIONS::zoneDisplayFilled, ACTION_MENU::CHECK );
drawingModeSubMenu->Add( PCB_ACTIONS::zoneDisplayOutline, ACTION_MENU::CHECK );
if( ADVANCED_CFG::GetCfg().m_ExtraZoneDisplayModes )
{
drawingModeSubMenu->Add( PCB_ACTIONS::zoneDisplayFractured, ACTION_MENU::CHECK );
drawingModeSubMenu->Add( PCB_ACTIONS::zoneDisplayTriangulated, ACTION_MENU::CHECK );
}
drawingModeSubMenu->AppendSeparator();
drawingModeSubMenu->Add( PCB_ACTIONS::padDisplayMode, ACTION_MENU::CHECK );

View File

@ -561,12 +561,14 @@ void PCB_EDIT_FRAME::setupUIConditions()
&& GetDisplayOptions().m_ZoneOpacity > 0.0;
};
mgr->SetConditions( PCB_ACTIONS::zoneDisplayEnable,
mgr->SetConditions( PCB_ACTIONS::zoneDisplayFilled,
ENABLE( enableZoneControlConition ).Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_FILLED ) ) );
mgr->SetConditions( PCB_ACTIONS::zoneDisplayDisable,
mgr->SetConditions( PCB_ACTIONS::zoneDisplayOutline,
ENABLE( enableZoneControlConition ).Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_ZONE_OUTLINE ) ) );
mgr->SetConditions( PCB_ACTIONS::zoneDisplayOutlines,
ENABLE( enableZoneControlConition ).Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_FILLED_OUTLINE ) ) );
mgr->SetConditions( PCB_ACTIONS::zoneDisplayFractured,
ENABLE( enableZoneControlConition ).Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_FRACTURE_BORDERS ) ) );
mgr->SetConditions( PCB_ACTIONS::zoneDisplayTriangulated,
ENABLE( enableZoneControlConition ).Check( cond.ZoneDisplayMode( ZONE_DISPLAY_MODE::SHOW_TRIANGULATION ) ) );
auto enableBoardSetupCondition =
[this] ( const SELECTION& )

View File

@ -1737,7 +1737,8 @@ void PCB_PAINTER::draw( const ZONE* aZone, int aLayer )
// Draw the filling
if( displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED
|| displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED_OUTLINE )
|| displayMode == ZONE_DISPLAY_MODE::SHOW_FRACTURE_BORDERS
|| displayMode == ZONE_DISPLAY_MODE::SHOW_TRIANGULATION )
{
const SHAPE_POLY_SET& polySet = aZone->GetFilledPolysList( layer );
@ -1759,13 +1760,13 @@ void PCB_PAINTER::draw( const ZONE* aZone, int aLayer )
m_gal->SetIsFill( true );
m_gal->SetIsStroke( outline_thickness > 0 );
}
else if( displayMode == ZONE_DISPLAY_MODE::SHOW_FILLED_OUTLINE )
else
{
m_gal->SetIsFill( false );
m_gal->SetIsStroke( true );
}
m_gal->DrawPolygon( polySet );
m_gal->DrawPolygon( polySet, displayMode == ZONE_DISPLAY_MODE::SHOW_TRIANGULATION );
}
}

View File

@ -181,7 +181,7 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_params.emplace_back( new PARAM_ENUM<ZONE_DISPLAY_MODE>( "pcb_display.zone_mode",
&m_Display.m_ZoneDisplayMode, ZONE_DISPLAY_MODE::SHOW_FILLED,
ZONE_DISPLAY_MODE::SHOW_FILLED_OUTLINE, ZONE_DISPLAY_MODE::SHOW_FILLED ) );
ZONE_DISPLAY_MODE::SHOW_TRIANGULATION, ZONE_DISPLAY_MODE::SHOW_FILLED ) );
m_params.emplace_back( new PARAM<int>( "pcb_display.origin_mode",
reinterpret_cast<int*>( &m_Display.m_DisplayOrigin ),

View File

@ -26,6 +26,7 @@
#include <memory>
#include <advanced_config.h>
#include <bitmaps.h>
#include <board.h>
#include <board_design_settings.h>
@ -353,9 +354,14 @@ void PCB_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( PCB_ACTIONS::toggleNetHighlight, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayEnable, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayDisable, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayOutlines, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayFilled, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayOutline, ACTION_TOOLBAR::TOGGLE );
if( ADVANCED_CFG::GetCfg().m_ExtraZoneDisplayModes )
{
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayFractured, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( PCB_ACTIONS::zoneDisplayTriangulated, ACTION_TOOLBAR::TOGGLE );
}
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( PCB_ACTIONS::padDisplayMode, ACTION_TOOLBAR::TOGGLE );

View File

@ -829,26 +829,31 @@ TOOL_ACTION PCB_ACTIONS::zoomFootprintAutomatically( "pcbnew.Control.zoomFootpri
_( "Automatically zoom to fit" ), _( "Zoom to fit when changing footprint" ),
BITMAPS::zoom_auto_fit_in_page );
TOOL_ACTION PCB_ACTIONS::zoneDisplayEnable( "pcbnew.Control.zoneDisplayEnable",
TOOL_ACTION PCB_ACTIONS::zoneDisplayFilled( "pcbnew.Control.zoneDisplayEnable",
AS_GLOBAL, 0, "",
_( "Fill Zones" ), _( "Show filled areas of zones" ),
_( "Draw Zone Fills" ), _( "Show filled areas of zones" ),
BITMAPS::show_zone );
TOOL_ACTION PCB_ACTIONS::zoneDisplayDisable( "pcbnew.Control.zoneDisplayDisable",
TOOL_ACTION PCB_ACTIONS::zoneDisplayOutline( "pcbnew.Control.zoneDisplayDisable",
AS_GLOBAL, 0, "",
_( "Wireframe Zones" ), _( "Show only zone boundaries" ),
_( "Draw Zone Outlines" ), _( "Show only zone boundaries" ),
BITMAPS::show_zone_disable );
TOOL_ACTION PCB_ACTIONS::zoneDisplayOutlines( "pcbnew.Control.zoneDisplayOutlines",
TOOL_ACTION PCB_ACTIONS::zoneDisplayFractured( "pcbnew.Control.zoneDisplayOutlines",
AS_GLOBAL, 0, "",
_( "Sketch Zones" ), _( "Show solid areas of zones in outline mode" ),
_( "Draw Zone Fill Fracture Borders" ), "",
BITMAPS::show_zone_outline_only );
TOOL_ACTION PCB_ACTIONS::zoneDisplayTriangulated( "pcbnew.Control.zoneDisplayTesselation",
AS_GLOBAL, 0, "",
_( "Draw Zone Fill Triangulation" ), "",
BITMAPS::show_zone_triangulation );
TOOL_ACTION PCB_ACTIONS::zoneDisplayToggle( "pcbnew.Control.zoneDisplayToggle",
AS_GLOBAL,
'A', "",
_( "Toggle Zone Display" ),
_( "Cycle between showing filled zones, wireframed zones and sketched zones" ),
_( "Cycle between showing zone fills and just their outlines" ),
BITMAPS::show_zone );

View File

@ -243,9 +243,10 @@ public:
static TOOL_ACTION trackDisplayMode;
static TOOL_ACTION padDisplayMode;
static TOOL_ACTION viaDisplayMode;
static TOOL_ACTION zoneDisplayEnable;
static TOOL_ACTION zoneDisplayDisable;
static TOOL_ACTION zoneDisplayOutlines;
static TOOL_ACTION zoneDisplayFilled;
static TOOL_ACTION zoneDisplayOutline;
static TOOL_ACTION zoneDisplayFractured;
static TOOL_ACTION zoneDisplayTriangulated;
static TOOL_ACTION zoneDisplayToggle;
static TOOL_ACTION showPadNumbers;
static TOOL_ACTION zoomFootprintAutomatically;

View File

@ -190,22 +190,28 @@ int PCB_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
auto opts = displayOptions();
// Apply new display options to the GAL canvas
if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayEnable ) )
if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayFilled ) )
{
opts.m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_FILLED;
}
else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayDisable ) )
else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutline ) )
{
opts.m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_ZONE_OUTLINE;
}
else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayOutlines ) )
else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayFractured ) )
{
opts.m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_FILLED_OUTLINE;
opts.m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_FRACTURE_BORDERS;
}
else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayTriangulated ) )
{
opts.m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_TRIANGULATION;
}
else if( aEvent.IsAction( &PCB_ACTIONS::zoneDisplayToggle ) )
{
int nextMode = ( static_cast<int>( opts.m_ZoneDisplayMode ) + 1 ) % 3;
opts.m_ZoneDisplayMode = static_cast<ZONE_DISPLAY_MODE>( nextMode );
if( opts.m_ZoneDisplayMode == ZONE_DISPLAY_MODE::SHOW_FILLED )
opts.m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_ZONE_OUTLINE;
else
opts.m_ZoneDisplayMode = ZONE_DISPLAY_MODE::SHOW_FILLED;
}
else
{
@ -1176,9 +1182,10 @@ void PCB_CONTROL::setTransitions()
Go( &PCB_CONTROL::ToggleRatsnest, PCB_ACTIONS::showRatsnest.MakeEvent() );
Go( &PCB_CONTROL::ToggleRatsnest, PCB_ACTIONS::ratsnestLineMode.MakeEvent() );
Go( &PCB_CONTROL::ViaDisplayMode, PCB_ACTIONS::viaDisplayMode.MakeEvent() );
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayEnable.MakeEvent() );
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayDisable.MakeEvent() );
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutlines.MakeEvent() );
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayFilled.MakeEvent() );
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayOutline.MakeEvent() );
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayFractured.MakeEvent() );
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayTriangulated.MakeEvent() );
Go( &PCB_CONTROL::ZoneDisplayMode, PCB_ACTIONS::zoneDisplayToggle.MakeEvent() );
Go( &PCB_CONTROL::HighContrastMode, ACTIONS::highContrastMode.MakeEvent() );
Go( &PCB_CONTROL::HighContrastModeCycle, ACTIONS::highContrastModeCycle.MakeEvent() );