fix minor issues, and change ZONE_CONTAINER::GetDefaultHatchPitchMils() to ZONE_CONTAINER::GetDefaultHatchPitch()

as using mil in a value has no meaning now in pcbnew
This commit is contained in:
jean-pierre charras 2017-07-01 15:16:51 +02:00
parent 917bda1c64
commit c311e63f0d
7 changed files with 70 additions and 49 deletions

View File

@ -1,9 +1,9 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2017 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
@ -41,6 +41,7 @@
#include <msgpanel.h>
#include <bitmaps.h>
#include <convert_to_biu.h>
#include <class_board.h>
#include <class_zone.h>
@ -946,7 +947,7 @@ bool sortEndsByDescendingX( const VECTOR2I& ref, const VECTOR2I& tst )
return tst.x < ref.x;
}
// Implementation copied from old CPolyLine
void ZONE_CONTAINER::Hatch()
{
UnHatch();
@ -1109,6 +1110,12 @@ void ZONE_CONTAINER::Hatch()
}
int ZONE_CONTAINER::GetDefaultHatchPitch()
{
return Mils2iu( 20 );
}
BITMAP_DEF ZONE_CONTAINER::GetMenuImage() const
{
return add_zone_xpm;

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2017 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
@ -673,11 +673,9 @@ public:
/**
* Function GetDefaultHatchPitchMils
* @return int - the default hatch pitch in mils.
*
* \todo This value is hardcoded, but it should be user configurable.
* @return int - the default hatch pitch in internal units.
*/
static int GetDefaultHatchPitchMils() { return 20; }
static int GetDefaultHatchPitch();
/**
* Function SetHatch

View File

@ -119,7 +119,7 @@ void ZONE_SETTINGS::ExportSetting( ZONE_CONTAINER& aTarget, bool aFullExport ) c
// call SetHatch last, because hatch lines will be rebuilt,
// using new parameters values
aTarget.SetHatch( m_Zone_HatchingStyle, Mils2iu( aTarget.GetDefaultHatchPitchMils() ), true );
aTarget.SetHatch( m_Zone_HatchingStyle, aTarget.GetDefaultHatchPitch(), true );
}

View File

@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012-2016 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2012-2017 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
@ -628,7 +628,7 @@ void EAGLE_PLUGIN::loadPlain( wxXmlNode* aGraphics )
zone->AppendCorner( wxPoint( kicad_x( r.x1 ), kicad_y( r.y2 ) ), outlineIdx );
// this is not my fault:
zone->SetHatch( outline_hatch, Mils2iu( zone->GetDefaultHatchPitchMils() ), true );
zone->SetHatch( outline_hatch, zone->GetDefaultHatchPitch(), true );
}
m_xpath->pop();
@ -1837,8 +1837,10 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
}
// if spacing is set the zone should be hatched
// However, use the default hatch step, p.spacing value has no meaning for Kicad
// TODO: see if this parameter is related to a grid fill option.
if( p.spacing )
zone->SetHatch( ZONE_CONTAINER::DIAGONAL_EDGE, *p.spacing, true );
zone->SetHatch( ZONE_CONTAINER::DIAGONAL_EDGE, zone->GetDefaultHatchPitch(), true );
// clearances, etc.
zone->SetArcSegmentCount( 32 ); // @todo: should be a constructor default?
@ -1850,7 +1852,8 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
if( p.isolate )
{
zone->SetZoneClearance( kicad( *p.isolate ) );
} else {
} else
{
zone->SetZoneClearance( 0 );
}
@ -1912,41 +1915,50 @@ PCB_LAYER_ID EAGLE_PLUGIN::kicad_layer( int aEagleLayer ) const
// translate non-copper eagle layer to pcbnew layer
switch( aEagleLayer )
{
// Eagle says "Dimension" layer, but it's for board perimeter
case EAGLE_LAYER::DIMENSION: kiLayer = Edge_Cuts; break;
case EAGLE_LAYER::TPLACE: kiLayer = F_SilkS; break;
case EAGLE_LAYER::BPLACE: kiLayer = B_SilkS; break;
case EAGLE_LAYER::TNAMES: kiLayer = F_SilkS; break;
case EAGLE_LAYER::BNAMES: kiLayer = B_SilkS; break;
case EAGLE_LAYER::TVALUES: kiLayer = F_SilkS; break;
case EAGLE_LAYER::BVALUES: kiLayer = B_SilkS; break;
case EAGLE_LAYER::TSTOP: kiLayer = F_Mask; break;
case EAGLE_LAYER::BSTOP: kiLayer = B_Mask; break;
case EAGLE_LAYER::TCREAM: kiLayer = F_Paste; break;
case EAGLE_LAYER::BCREAM: kiLayer = B_Paste; break;
case EAGLE_LAYER::TFINISH: kiLayer = F_Mask; break;
case EAGLE_LAYER::BFINISH: kiLayer = B_Mask; break;
case EAGLE_LAYER::TGLUE: kiLayer = F_Adhes; break;
case EAGLE_LAYER::BGLUE: kiLayer = B_Adhes; break;
case EAGLE_LAYER::DOCUMENT: kiLayer = Cmts_User; break;
case EAGLE_LAYER::REFERENCELC: kiLayer = Cmts_User; break;
case EAGLE_LAYER::REFERENCELS: kiLayer = Cmts_User; break;
// Eagle says "Dimension" layer, but it's for board perimeter
case EAGLE_LAYER::DIMENSION: kiLayer = Edge_Cuts; break;
case EAGLE_LAYER::TPLACE: kiLayer = F_SilkS; break;
case EAGLE_LAYER::BPLACE: kiLayer = B_SilkS; break;
case EAGLE_LAYER::TNAMES: kiLayer = F_SilkS; break;
case EAGLE_LAYER::BNAMES: kiLayer = B_SilkS; break;
case EAGLE_LAYER::TVALUES: kiLayer = F_SilkS; break;
case EAGLE_LAYER::BVALUES: kiLayer = B_SilkS; break;
case EAGLE_LAYER::TSTOP: kiLayer = F_Mask; break;
case EAGLE_LAYER::BSTOP: kiLayer = B_Mask; break;
case EAGLE_LAYER::TCREAM: kiLayer = F_Paste; break;
case EAGLE_LAYER::BCREAM: kiLayer = B_Paste; break;
case EAGLE_LAYER::TFINISH: kiLayer = F_Mask; break;
case EAGLE_LAYER::BFINISH: kiLayer = B_Mask; break;
case EAGLE_LAYER::TGLUE: kiLayer = F_Adhes; break;
case EAGLE_LAYER::BGLUE: kiLayer = B_Adhes; break;
case EAGLE_LAYER::DOCUMENT: kiLayer = Cmts_User; break;
case EAGLE_LAYER::REFERENCELC: kiLayer = Cmts_User; break;
case EAGLE_LAYER::REFERENCELS: kiLayer = Cmts_User; break;
// Packages show the future chip pins on SMD parts using layer 51.
// This is an area slightly smaller than the PAD/SMD copper area.
// Carry those visual aids into the MODULE on the fabrication layer,
// not silkscreen. This is perhaps not perfect, but there is not a lot
// of other suitable paired layers
case EAGLE_LAYER::TDOCU: kiLayer = F_Fab; break;
case EAGLE_LAYER::BDOCU: kiLayer = B_Fab; break;
case EAGLE_LAYER::TDOCU: kiLayer = F_Fab; break;
case EAGLE_LAYER::BDOCU: kiLayer = B_Fab; break;
// thes layers are defined as user layers. put them on ECO layers
case EAGLE_LAYER::USERLAYER1: kiLayer = Eco1_User; break;
case EAGLE_LAYER::USERLAYER2: kiLayer = Eco2_User; break;
case EAGLE_LAYER::USERLAYER1: kiLayer = Eco1_User; break;
case EAGLE_LAYER::USERLAYER2: kiLayer = Eco2_User; break;
case EAGLE_LAYER::UNROUTED:
case EAGLE_LAYER::TKEEPOUT:
case EAGLE_LAYER::BKEEPOUT:
case EAGLE_LAYER::TTEST:
case EAGLE_LAYER::BTEST:
case EAGLE_LAYER::MILLING:
case EAGLE_LAYER::HOLES:
default:
// some layers do not map to KiCad
wxASSERT_MSG( false, wxString::Format( "Unsupported Eagle layer %d", aEagleLayer ) );
kiLayer = UNDEFINED_LAYER; break;
wxLogMessage( wxString::Format( "Unsupported Eagle layer %d. Use drawings layer",
aEagleLayer ) );
kiLayer = Dwgs_User; break;
}
}

View File

@ -2730,7 +2730,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
// Hatch here, after outlines corners are read
// Set hatch here, after outlines corners are read
zc->SetHatch( outline_hatch, Mils2iu( ZONE_CONTAINER::GetDefaultHatchPitchMils() ),
zc->SetHatch( outline_hatch, ZONE_CONTAINER::GetDefaultHatchPitch(),
true );
m_board->Add( zc.release() );

View File

@ -189,7 +189,7 @@ void PCB_POLYGON::AddToBoard()
zone->SetPriority( m_priority );
zone->SetHatch( outline_hatch, Mils2iu( zone->GetDefaultHatchPitchMils() ), true );
zone->SetHatch( outline_hatch, zone->GetDefaultHatchPitch(), true );
if ( m_objType == wxT( 'K' ) )
{

View File

@ -1350,22 +1350,24 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT()
NeedLEFT();
token = NextTok();
if( token != T_start )
// the start keyword actually gives the arc center
// Allows also T_center for future change
if( token != T_start && token != T_center )
Expecting( T_start );
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetStart( pt );
segment->SetCenter( pt );
NeedRIGHT();
NeedLEFT();
token = NextTok();
if( token != T_end )
if( token != T_end ) // the end keyword actually gives the starting point of the arc
Expecting( T_end );
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetEnd( pt );
segment->SetArcStart( pt );
NeedRIGHT();
break;
@ -1379,7 +1381,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT()
pt.x = parseBoardUnits( "X coordinate" );
pt.y = parseBoardUnits( "Y coordinate" );
segment->SetStart( pt );
segment->SetCenter( pt );
NeedRIGHT();
NeedLEFT();
@ -2085,7 +2087,9 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
NeedLEFT();
token = NextTok();
if( token != T_start )
// the start keyword actually gives the arc center
// Allows also T_center for future change
if( token != T_start && token != T_center )
Expecting( T_start );
pt.x = parseBoardUnits( "X coordinate" );
@ -2095,7 +2099,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE()
NeedLEFT();
token = NextTok();
if( token != T_end )
if( token != T_end ) // end keyword actually gives the starting point of the arc
Expecting( T_end );
pt.x = parseBoardUnits( "X coordinate" );
@ -2645,7 +2649,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER()
ZONE_CONTAINER::HATCH_STYLE hatchStyle = ZONE_CONTAINER::NO_HATCH;
int hatchPitch = Mils2iu( ZONE_CONTAINER::GetDefaultHatchPitchMils() );
int hatchPitch = ZONE_CONTAINER::GetDefaultHatchPitch();
wxPoint pt;
T token;
int tmp;