Merged the new Interactive Push and Shove router.
Do not pay attention to add/remove files - it seems there may be a bug in git-bzr-ng plugin. I have checked them, they stayed exactly the same as before.
This commit is contained in:
commit
46020e20de
|
@ -203,6 +203,7 @@ set( COMMON_SRCS
|
|||
wildcards_and_files_ext.cpp
|
||||
worksheet.cpp
|
||||
wxwineda.cpp
|
||||
wxunittext.cpp
|
||||
xnode.cpp
|
||||
zoom.cpp
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -67,7 +67,6 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
|
|||
|
||||
m_viewControls = new KIGFX::WX_VIEW_CONTROLS( m_view, this );
|
||||
|
||||
Connect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this );
|
||||
Connect( wxEVT_SIZE, wxSizeEventHandler( EDA_DRAW_PANEL_GAL::onSize ), NULL, this );
|
||||
|
||||
/* Generic events for the Tool Dispatcher */
|
||||
|
@ -125,7 +124,7 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
|
|||
|
||||
m_view->UpdateItems();
|
||||
m_gal->BeginDrawing();
|
||||
m_gal->ClearScreen();
|
||||
m_gal->ClearScreen( m_painter->GetSettings()->GetBackgroundColor() );
|
||||
|
||||
if( m_view->IsDirty() )
|
||||
{
|
||||
|
@ -184,10 +183,21 @@ void EDA_DRAW_PANEL_GAL::Refresh( bool eraseBackground, const wxRect* rect )
|
|||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::StartDrawing()
|
||||
{
|
||||
m_pendingRefresh = false;
|
||||
Connect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this );
|
||||
|
||||
wxPaintEvent redrawEvent;
|
||||
wxPostEvent( this, redrawEvent );
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL_GAL::StopDrawing()
|
||||
{
|
||||
Disconnect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this );
|
||||
m_pendingRefresh = true;
|
||||
m_refreshTimer.Stop();
|
||||
Disconnect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -198,8 +208,7 @@ void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
|
|||
return;
|
||||
|
||||
// Prevent refreshing canvas during backend switch
|
||||
m_pendingRefresh = true;
|
||||
m_refreshTimer.Stop();
|
||||
StopDrawing();
|
||||
|
||||
delete m_gal;
|
||||
|
||||
|
@ -219,7 +228,6 @@ void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
|
|||
|
||||
wxSize size = GetClientSize();
|
||||
m_gal->ResizeScreen( size.GetX(), size.GetY() );
|
||||
m_gal->SetBackgroundColor( KIGFX::COLOR4D( 0.0, 0.0, 0.0, 1.0 ) );
|
||||
|
||||
if( m_painter )
|
||||
m_painter->SetGAL( m_gal );
|
||||
|
@ -228,7 +236,6 @@ void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
|
|||
m_view->SetGAL( m_gal );
|
||||
|
||||
m_currentGal = aGalType;
|
||||
m_pendingRefresh = false;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -315,10 +315,10 @@ void CAIRO_GAL::Flush()
|
|||
}
|
||||
|
||||
|
||||
void CAIRO_GAL::ClearScreen()
|
||||
void CAIRO_GAL::ClearScreen( const COLOR4D& aColor )
|
||||
{
|
||||
cairo_set_source_rgb( currentContext,
|
||||
backgroundColor.r, backgroundColor.g, backgroundColor.b );
|
||||
backgroundColor = aColor;
|
||||
cairo_set_source_rgb( currentContext, aColor.r, aColor.g, aColor.b );
|
||||
cairo_rectangle( currentContext, 0.0, 0.0, screenSize.x, screenSize.y );
|
||||
cairo_fill( currentContext );
|
||||
}
|
||||
|
@ -973,7 +973,7 @@ void CAIRO_GAL::initSurface()
|
|||
cairo_set_antialias( context, CAIRO_ANTIALIAS_SUBPIXEL );
|
||||
|
||||
// Clear the screen
|
||||
ClearScreen();
|
||||
ClearScreen( backgroundColor );
|
||||
|
||||
// Compute the world <-> screen transformations
|
||||
ComputeWorldScreenMatrix();
|
||||
|
|
|
@ -589,10 +589,10 @@ void OPENGL_GAL::Flush()
|
|||
}
|
||||
|
||||
|
||||
void OPENGL_GAL::ClearScreen()
|
||||
void OPENGL_GAL::ClearScreen( const COLOR4D& aColor )
|
||||
{
|
||||
// Clear screen
|
||||
glClearColor( backgroundColor.r, backgroundColor.g, backgroundColor.b, backgroundColor.a );
|
||||
glClearColor( aColor.r, aColor.g, aColor.b, aColor.a );
|
||||
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
|
||||
}
|
||||
|
||||
|
|
|
@ -23,11 +23,13 @@
|
|||
*/
|
||||
|
||||
#include <math/vector2d.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
#include <geometry/shape_circle.h>
|
||||
#include <geometry/shape_rect.h>
|
||||
#include <geometry/shape_segment.h>
|
||||
|
||||
typedef VECTOR2I::extended_type ecoord;
|
||||
|
||||
|
@ -45,7 +47,7 @@ static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_CIRCLE& aB, int
|
|||
return false;
|
||||
|
||||
if( aNeedMTV )
|
||||
aMTV = delta.Resize( sqrt( abs( min_dist_sq - dist_sq ) ) + 1 );
|
||||
aMTV = delta.Resize( min_dist - sqrt( dist_sq ) + 3 ); // fixme: apparent rounding error
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -57,12 +59,8 @@ static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_CIRCLE& aB, int a
|
|||
const VECTOR2I c = aB.GetCenter();
|
||||
const VECTOR2I p0 = aA.GetPosition();
|
||||
const VECTOR2I size = aA.GetSize();
|
||||
const ecoord r = aB.GetRadius();
|
||||
const ecoord min_dist = aClearance + r;
|
||||
const ecoord min_dist_sq = min_dist * min_dist;
|
||||
|
||||
if( aA.BBox( 0 ).Contains( c ) )
|
||||
return true;
|
||||
const int r = aB.GetRadius();
|
||||
const int min_dist = aClearance + r;
|
||||
|
||||
const VECTOR2I vts[] =
|
||||
{
|
||||
|
@ -73,33 +71,35 @@ static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_CIRCLE& aB, int a
|
|||
VECTOR2I( p0.x, p0.y )
|
||||
};
|
||||
|
||||
ecoord nearest_seg_dist_sq = VECTOR2I::ECOORD_MAX;
|
||||
int nearest_seg_dist = INT_MAX;
|
||||
VECTOR2I nearest;
|
||||
|
||||
bool inside = c.x >= p0.x && c.x <= ( p0.x + size.x )
|
||||
&& c.y >= p0.y && c.y <= ( p0.y + size.y );
|
||||
|
||||
if( !inside )
|
||||
{
|
||||
|
||||
if( !aNeedMTV && inside )
|
||||
return true;
|
||||
|
||||
for( int i = 0; i < 4; i++ )
|
||||
{
|
||||
const SEG seg( vts[i], vts[i + 1] );
|
||||
ecoord dist_sq = seg.SquaredDistance( c );
|
||||
|
||||
if( dist_sq < min_dist_sq )
|
||||
{
|
||||
if( !aNeedMTV )
|
||||
VECTOR2I pn = seg.NearestPoint( c );
|
||||
|
||||
int d = ( pn - c ).EuclideanNorm();
|
||||
|
||||
if( ( d < min_dist ) && !aNeedMTV )
|
||||
return true;
|
||||
else
|
||||
|
||||
if( d < nearest_seg_dist )
|
||||
{
|
||||
nearest = seg.NearestPoint( c );
|
||||
nearest_seg_dist_sq = dist_sq;
|
||||
}
|
||||
}
|
||||
nearest = pn;
|
||||
nearest_seg_dist = d;
|
||||
}
|
||||
}
|
||||
|
||||
if( nearest_seg_dist_sq >= min_dist_sq && !inside )
|
||||
if( nearest_seg_dist >= min_dist && !inside )
|
||||
return false;
|
||||
|
||||
VECTOR2I delta = c - nearest;
|
||||
|
@ -107,25 +107,77 @@ static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_CIRCLE& aB, int a
|
|||
if( !aNeedMTV )
|
||||
return true;
|
||||
|
||||
|
||||
if( inside )
|
||||
aMTV = -delta.Resize( sqrt( abs( r * r + nearest_seg_dist_sq ) + 1 ) );
|
||||
aMTV = -delta.Resize( abs( min_dist + 1 + nearest_seg_dist ) + 1 );
|
||||
else
|
||||
aMTV = delta.Resize( sqrt( abs( r * r - nearest_seg_dist_sq ) + 1 ) );
|
||||
aMTV = delta.Resize( abs( min_dist + 1 - nearest_seg_dist ) + 1 );
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
static VECTOR2I pushoutForce( const SHAPE_CIRCLE& aA, const SEG& aB, int aClearance )
|
||||
{
|
||||
VECTOR2I nearest = aB.NearestPoint( aA.GetCenter() );
|
||||
VECTOR2I f (0, 0);
|
||||
|
||||
int dist = ( nearest - aA.GetCenter() ).EuclideanNorm();
|
||||
int min_dist = aClearance + aA.GetRadius();
|
||||
|
||||
if( dist < min_dist )
|
||||
f = ( aA.GetCenter() - nearest ).Resize ( min_dist - dist + 10 );
|
||||
|
||||
return f;
|
||||
}
|
||||
|
||||
|
||||
static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_LINE_CHAIN& aB, int aClearance,
|
||||
bool aNeedMTV, VECTOR2I& aMTV )
|
||||
{
|
||||
bool found = false;
|
||||
VECTOR2I::extended_type clSq = (VECTOR2I::extended_type) aClearance * aClearance;
|
||||
|
||||
|
||||
for( int s = 0; s < aB.SegmentCount(); s++ )
|
||||
{
|
||||
|
||||
if( aA.Collide( aB.CSegment( s ), aClearance ) )
|
||||
return true;
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
if( !aNeedMTV || !found )
|
||||
return found;
|
||||
|
||||
SHAPE_CIRCLE cmoved( aA );
|
||||
VECTOR2I f_total( 0, 0 );
|
||||
|
||||
for( int s = 0; s < aB.SegmentCount(); s++ )
|
||||
{
|
||||
VECTOR2I f = pushoutForce( cmoved, aB.CSegment( s ), aClearance );
|
||||
cmoved.SetCenter( cmoved.GetCenter() + f );
|
||||
f_total += f;
|
||||
}
|
||||
|
||||
aMTV = f_total;
|
||||
return found;
|
||||
}
|
||||
|
||||
|
||||
static inline bool Collide( const SHAPE_CIRCLE& aA, const SHAPE_SEGMENT& aSeg, int aClearance,
|
||||
bool aNeedMTV, VECTOR2I& aMTV )
|
||||
{
|
||||
bool col = aA.Collide( aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2);
|
||||
|
||||
if( col && aNeedMTV )
|
||||
{
|
||||
aMTV = pushoutForce( aA, aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2);
|
||||
}
|
||||
return col;
|
||||
}
|
||||
|
||||
|
||||
|
@ -155,8 +207,39 @@ static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_LINE_CHAIN& aB, in
|
|||
}
|
||||
|
||||
|
||||
bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance,
|
||||
static inline bool Collide( const SHAPE_RECT& aA, const SHAPE_SEGMENT& aSeg, int aClearance,
|
||||
bool aNeedMTV, VECTOR2I& aMTV )
|
||||
{
|
||||
return aA.Collide( aSeg.GetSeg(), aClearance + aSeg.GetWidth() / 2 );
|
||||
}
|
||||
|
||||
|
||||
static inline bool Collide( const SHAPE_SEGMENT& aA, const SHAPE_SEGMENT& aB, int aClearance,
|
||||
bool aNeedMTV, VECTOR2I& aMTV )
|
||||
{
|
||||
return aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2 );
|
||||
}
|
||||
|
||||
|
||||
static inline bool Collide( const SHAPE_LINE_CHAIN& aA, const SHAPE_SEGMENT& aB, int aClearance,
|
||||
bool aNeedMTV, VECTOR2I& aMTV )
|
||||
{
|
||||
if( aA.Collide( aB.GetSeg(), aClearance + aB.GetWidth() / 2 ) )
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
template<class ShapeAType, class ShapeBType> bool
|
||||
CollCase( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
|
||||
{
|
||||
return Collide (*static_cast<const ShapeAType*>( aA ),
|
||||
*static_cast<const ShapeBType*>( aB ),
|
||||
aClearance, aNeedMTV, aMTV);
|
||||
}
|
||||
|
||||
bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance, bool aNeedMTV, VECTOR2I& aMTV )
|
||||
{
|
||||
switch( aA->Type() )
|
||||
{
|
||||
|
@ -164,63 +247,81 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance,
|
|||
switch( aB->Type() )
|
||||
{
|
||||
case SH_CIRCLE:
|
||||
return Collide( *static_cast<const SHAPE_RECT*>( aA ),
|
||||
*static_cast<const SHAPE_CIRCLE*>( aB ), aClearance, aNeedMTV, aMTV );
|
||||
return CollCase<SHAPE_RECT, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
case SH_LINE_CHAIN:
|
||||
return Collide( *static_cast<const SHAPE_RECT*>( aA ),
|
||||
*static_cast<const SHAPE_LINE_CHAIN*>( aB ), aClearance, aNeedMTV, aMTV );
|
||||
return CollCase<SHAPE_RECT, SHAPE_LINE_CHAIN>( aA, aB, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
case SH_SEGMENT:
|
||||
return CollCase<SHAPE_RECT, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SH_CIRCLE:
|
||||
switch( aB->Type() )
|
||||
{
|
||||
case SH_RECT:
|
||||
return Collide( *static_cast<const SHAPE_RECT*>( aB ),
|
||||
*static_cast<const SHAPE_CIRCLE*>( aA ), aClearance, aNeedMTV, aMTV );
|
||||
return CollCase<SHAPE_RECT, SHAPE_CIRCLE>( aB, aA, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
case SH_CIRCLE:
|
||||
return Collide( *static_cast<const SHAPE_CIRCLE*>( aA ),
|
||||
*static_cast<const SHAPE_CIRCLE*>( aB ), aClearance, aNeedMTV, aMTV );
|
||||
return CollCase<SHAPE_CIRCLE, SHAPE_CIRCLE>( aA, aB, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
case SH_LINE_CHAIN:
|
||||
return Collide( *static_cast<const SHAPE_CIRCLE*>( aA ),
|
||||
*static_cast<const SHAPE_LINE_CHAIN *>( aB ), aClearance, aNeedMTV, aMTV );
|
||||
return CollCase<SHAPE_CIRCLE, SHAPE_LINE_CHAIN>( aA, aB, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
case SH_SEGMENT:
|
||||
return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SH_LINE_CHAIN:
|
||||
switch( aB->Type() )
|
||||
{
|
||||
case SH_RECT:
|
||||
return Collide( *static_cast<const SHAPE_RECT*>( aB ),
|
||||
*static_cast<const SHAPE_LINE_CHAIN*>( aA ), aClearance, aNeedMTV, aMTV );
|
||||
return CollCase<SHAPE_RECT, SHAPE_LINE_CHAIN>( aB, aA, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
case SH_CIRCLE:
|
||||
return Collide( *static_cast<const SHAPE_CIRCLE*>( aB ),
|
||||
*static_cast<const SHAPE_LINE_CHAIN*>( aA ), aClearance, aNeedMTV, aMTV );
|
||||
return CollCase<SHAPE_CIRCLE, SHAPE_LINE_CHAIN>( aB, aA, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
case SH_LINE_CHAIN:
|
||||
return Collide( *static_cast<const SHAPE_LINE_CHAIN*>( aA ),
|
||||
*static_cast<const SHAPE_LINE_CHAIN*>( aB ), aClearance, aNeedMTV, aMTV );
|
||||
return CollCase<SHAPE_LINE_CHAIN, SHAPE_LINE_CHAIN>( aA, aB, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case SH_SEGMENT:
|
||||
return CollCase<SHAPE_LINE_CHAIN, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
assert( 0 ); // unsupported_collision
|
||||
case SH_SEGMENT:
|
||||
switch( aB->Type() )
|
||||
{
|
||||
case SH_RECT:
|
||||
return CollCase<SHAPE_RECT, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
case SH_CIRCLE:
|
||||
return CollCase<SHAPE_CIRCLE, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
case SH_LINE_CHAIN:
|
||||
return CollCase<SHAPE_LINE_CHAIN, SHAPE_SEGMENT>( aB, aA, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
case SH_SEGMENT:
|
||||
return CollCase<SHAPE_SEGMENT, SHAPE_SEGMENT>( aA, aB, aClearance, aNeedMTV, aMTV );
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
bool unsupported_collision = true;
|
||||
|
||||
assert( unsupported_collision == false );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -135,6 +135,9 @@ int SHAPE_LINE_CHAIN::Distance( const VECTOR2I& aP ) const
|
|||
{
|
||||
int d = INT_MAX;
|
||||
|
||||
if( IsClosed() && PointInside( aP ) )
|
||||
return 0;
|
||||
|
||||
for( int s = 0; s < SegmentCount(); s++ )
|
||||
d = std::min( d, CSegment( s ).Distance( aP ) );
|
||||
|
||||
|
@ -187,6 +190,16 @@ int SHAPE_LINE_CHAIN::Find( const VECTOR2I& aP ) const
|
|||
}
|
||||
|
||||
|
||||
int SHAPE_LINE_CHAIN::FindSegment( const VECTOR2I& aP ) const
|
||||
{
|
||||
for( int s = 0; s < SegmentCount(); s++ )
|
||||
if( CSegment( s ).Distance( aP ) <= 1 )
|
||||
return s;
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
const SHAPE_LINE_CHAIN SHAPE_LINE_CHAIN::Slice( int aStartIndex, int aEndIndex ) const
|
||||
{
|
||||
SHAPE_LINE_CHAIN rv;
|
||||
|
@ -261,6 +274,9 @@ int SHAPE_LINE_CHAIN::Intersect( const SHAPE_LINE_CHAIN& aChain, INTERSECTIONS&
|
|||
|
||||
if( a.Collinear( b ) )
|
||||
{
|
||||
is.our = a;
|
||||
is.their = b;
|
||||
|
||||
if( a.Contains( b.A ) ) { is.p = b.A; aIp.push_back( is ); }
|
||||
if( a.Contains( b.B ) ) { is.p = b.B; aIp.push_back( is ); }
|
||||
if( b.Contains( a.A ) ) { is.p = a.A; aIp.push_back( is ); }
|
||||
|
@ -282,44 +298,6 @@ int SHAPE_LINE_CHAIN::Intersect( const SHAPE_LINE_CHAIN& aChain, INTERSECTIONS&
|
|||
}
|
||||
|
||||
return aIp.size();
|
||||
|
||||
for( int s1 = 0; s1 < SegmentCount(); s1++ )
|
||||
{
|
||||
for( int s2 = 0; s2 < aChain.SegmentCount(); s2++ )
|
||||
{
|
||||
const SEG& a = CSegment( s1 );
|
||||
const SEG& b = aChain.CSegment( s2 );
|
||||
OPT_VECTOR2I p = a.Intersect( b );
|
||||
INTERSECTION is;
|
||||
|
||||
if( p )
|
||||
{
|
||||
is.p = *p;
|
||||
is.our = a;
|
||||
is.their = b;
|
||||
aIp.push_back( is );
|
||||
}
|
||||
else if( a.Collinear( b ) )
|
||||
{
|
||||
if( a.A != b.A && a.A != b.B && b.Contains( a.A ) )
|
||||
{
|
||||
is.p = a.A;
|
||||
is.our = a;
|
||||
is.their = b;
|
||||
aIp.push_back( is );
|
||||
}
|
||||
else if( a.B != b.A && a.B != b.B && b.Contains( a.B ) )
|
||||
{
|
||||
is.p = a.B;
|
||||
is.our = a;
|
||||
is.their = b;
|
||||
aIp.push_back( is );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return aIp.size();
|
||||
}
|
||||
|
||||
|
||||
|
@ -372,10 +350,13 @@ bool SHAPE_LINE_CHAIN::PointInside( const VECTOR2I& aP ) const
|
|||
|
||||
bool SHAPE_LINE_CHAIN::PointOnEdge( const VECTOR2I& aP ) const
|
||||
{
|
||||
if( SegmentCount() < 1 )
|
||||
if( !PointCount() )
|
||||
return false;
|
||||
|
||||
else if( PointCount() == 1 )
|
||||
return m_points[0] == aP;
|
||||
|
||||
for( int i = 1; i < SegmentCount(); i++ )
|
||||
for( int i = 0; i < SegmentCount(); i++ )
|
||||
{
|
||||
const SEG s = CSegment( i );
|
||||
|
||||
|
@ -534,3 +515,30 @@ const std::string SHAPE_LINE_CHAIN::Format() const
|
|||
|
||||
return ss.str();
|
||||
}
|
||||
|
||||
|
||||
bool SHAPE_LINE_CHAIN::CompareGeometry ( const SHAPE_LINE_CHAIN & aOther ) const
|
||||
{
|
||||
SHAPE_LINE_CHAIN a(*this), b(aOther);
|
||||
a.Simplify();
|
||||
b.Simplify();
|
||||
|
||||
if(a.m_points.size() != b.m_points.size())
|
||||
return false;
|
||||
|
||||
for(int i = 0; i < a.PointCount(); i++)
|
||||
if(a.CPoint(i) != b.CPoint(i))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool SHAPE_LINE_CHAIN::Intersects( const SHAPE_LINE_CHAIN& aChain ) const
|
||||
{
|
||||
INTERSECTIONS dummy;
|
||||
return Intersect(aChain, dummy) != 0;
|
||||
}
|
||||
|
||||
SHAPE* SHAPE_LINE_CHAIN::Clone() const
|
||||
{
|
||||
return new SHAPE_LINE_CHAIN( *this );
|
||||
}
|
||||
|
|
|
@ -50,6 +50,7 @@ void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction )
|
|||
// action name without specifying at least toolName is not valid
|
||||
assert( aAction->GetName().find( '.', 0 ) != std::string::npos );
|
||||
|
||||
// TOOL_ACTIONs must have unique names & ids
|
||||
assert( m_actionNameIndex.find( aAction->m_name ) == m_actionNameIndex.end() );
|
||||
assert( m_actionIdIndex.find( aAction->m_id ) == m_actionIdIndex.end() );
|
||||
|
||||
|
@ -60,6 +61,8 @@ void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction )
|
|||
|
||||
if( aAction->HasHotKey() )
|
||||
m_actionHotKeys[aAction->m_currentHotKey].push_back( aAction );
|
||||
|
||||
aAction->setActionMgr( this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -69,6 +72,7 @@ void ACTION_MANAGER::UnregisterAction( TOOL_ACTION* aAction )
|
|||
m_actionIdIndex.erase( aAction->m_id );
|
||||
|
||||
// Indicate that the ACTION_MANAGER no longer care about the object
|
||||
aAction->setActionMgr( NULL );
|
||||
aAction->setId( -1 );
|
||||
|
||||
if( aAction->HasHotKey() )
|
||||
|
|
|
@ -26,44 +26,55 @@
|
|||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_interactive.h>
|
||||
#include <tool/context_menu.h>
|
||||
#include <boost/bind.hpp>
|
||||
#include <cassert>
|
||||
|
||||
CONTEXT_MENU::CONTEXT_MENU() :
|
||||
m_titleSet( false ), m_selected( -1 ), m_handler( this ), m_tool( NULL )
|
||||
m_titleSet( false ), m_selected( -1 ), m_tool( NULL )
|
||||
{
|
||||
m_menu.Connect( wxEVT_MENU_HIGHLIGHT, wxEventHandler( CMEventHandler::onEvent ),
|
||||
NULL, &m_handler );
|
||||
m_menu.Connect( wxEVT_COMMAND_MENU_SELECTED, wxEventHandler( CMEventHandler::onEvent ),
|
||||
NULL, &m_handler );
|
||||
setCustomEventHandler( boost::bind( &CONTEXT_MENU::handleCustomEvent, this, _1 ) );
|
||||
|
||||
// Workaround for the case when mouse cursor never reaches menu (it hangs up tools using menu)
|
||||
wxMenuEvent menuEvent( wxEVT_MENU_HIGHLIGHT, -1, &m_menu );
|
||||
m_menu.AddPendingEvent( menuEvent );
|
||||
setupEvents();
|
||||
}
|
||||
|
||||
|
||||
CONTEXT_MENU::CONTEXT_MENU( const CONTEXT_MENU& aMenu ) :
|
||||
m_titleSet( aMenu.m_titleSet ), m_selected( -1 ), m_handler( this ), m_tool( aMenu.m_tool )
|
||||
m_titleSet( aMenu.m_titleSet ), m_selected( -1 ), m_tool( aMenu.m_tool ),
|
||||
m_toolActions( aMenu.m_toolActions ), m_customHandler( aMenu.m_customHandler )
|
||||
{
|
||||
m_menu.Connect( wxEVT_MENU_HIGHLIGHT, wxEventHandler( CMEventHandler::onEvent ),
|
||||
NULL, &m_handler );
|
||||
m_menu.Connect( wxEVT_COMMAND_MENU_SELECTED, wxEventHandler( CMEventHandler::onEvent ),
|
||||
NULL, &m_handler );
|
||||
|
||||
// Workaround for the case when mouse cursor never reaches menu (it hangs up tools using menu)
|
||||
wxMenuEvent menuEvent( wxEVT_MENU_HIGHLIGHT, -1, &m_menu );
|
||||
m_menu.AddPendingEvent( menuEvent );
|
||||
|
||||
// Copy all the menu entries
|
||||
for( unsigned i = 0; i < aMenu.m_menu.GetMenuItemCount(); ++i )
|
||||
for( unsigned i = 0; i < aMenu.GetMenuItemCount(); ++i )
|
||||
{
|
||||
wxMenuItem* item = aMenu.m_menu.FindItemByPosition( i );
|
||||
m_menu.Append( new wxMenuItem( &m_menu, item->GetId(), item->GetItemLabel(),
|
||||
wxEmptyString, wxITEM_NORMAL ) );
|
||||
wxMenuItem* item = aMenu.FindItemByPosition( i );
|
||||
|
||||
if( item->IsSubMenu() )
|
||||
{
|
||||
#ifdef DEBUG
|
||||
// Submenus of a CONTEXT_MENU are supposed to be CONTEXT_MENUs as well
|
||||
assert( dynamic_cast<CONTEXT_MENU*>( item->GetSubMenu() ) );
|
||||
#endif
|
||||
|
||||
CONTEXT_MENU* menu = new CONTEXT_MENU( static_cast<const CONTEXT_MENU&>( *item->GetSubMenu() ) );
|
||||
AppendSubMenu( menu, item->GetItemLabel(), wxEmptyString );
|
||||
}
|
||||
else
|
||||
{
|
||||
wxMenuItem* newItem = new wxMenuItem( this, item->GetId(), item->GetItemLabel(),
|
||||
wxEmptyString, item->GetKind() );
|
||||
|
||||
Append( newItem );
|
||||
copyItem( item, newItem );
|
||||
}
|
||||
}
|
||||
|
||||
// Copy tool actions that are available to choose from context menu
|
||||
m_toolActions = aMenu.m_toolActions;
|
||||
setupEvents();
|
||||
}
|
||||
|
||||
|
||||
void CONTEXT_MENU::setupEvents()
|
||||
{
|
||||
Connect( wxEVT_MENU_HIGHLIGHT, wxEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this );
|
||||
Connect( wxEVT_COMMAND_MENU_SELECTED, wxEventHandler( CONTEXT_MENU::onMenuEvent ), NULL, this );
|
||||
}
|
||||
|
||||
|
||||
|
@ -71,15 +82,16 @@ void CONTEXT_MENU::SetTitle( const wxString& aTitle )
|
|||
{
|
||||
// TODO handle an empty string (remove title and separator)
|
||||
|
||||
// Unfortunately wxMenu::SetTitle() does nothing..
|
||||
// Unfortunately wxMenu::SetTitle() does nothing.. (at least wxGTK)
|
||||
|
||||
if( m_titleSet )
|
||||
{
|
||||
m_menu.FindItemByPosition( 0 )->SetItemLabel( aTitle );
|
||||
FindItemByPosition( 0 )->SetItemLabel( aTitle );
|
||||
}
|
||||
else
|
||||
{
|
||||
m_menu.InsertSeparator( 0 );
|
||||
m_menu.Insert( 0, new wxMenuItem( &m_menu, -1, aTitle, wxEmptyString, wxITEM_NORMAL ) );
|
||||
InsertSeparator( 0 );
|
||||
Insert( 0, new wxMenuItem( this, -1, aTitle, wxEmptyString, wxITEM_NORMAL ) );
|
||||
m_titleSet = true;
|
||||
}
|
||||
}
|
||||
|
@ -89,11 +101,11 @@ void CONTEXT_MENU::Add( const wxString& aLabel, int aId )
|
|||
{
|
||||
#ifdef DEBUG
|
||||
|
||||
if( m_menu.FindItem( aId ) != NULL )
|
||||
if( FindItem( aId ) != NULL )
|
||||
wxLogWarning( wxT( "Adding more than one menu entry with the same ID may result in"
|
||||
"undefined behaviour" ) );
|
||||
#endif
|
||||
m_menu.Append( new wxMenuItem( &m_menu, aId, aLabel, wxEmptyString, wxITEM_NORMAL ) );
|
||||
Append( new wxMenuItem( this, aId, aLabel, wxEmptyString, wxITEM_NORMAL ) );
|
||||
}
|
||||
|
||||
|
||||
|
@ -101,17 +113,29 @@ void CONTEXT_MENU::Add( const TOOL_ACTION& aAction )
|
|||
{
|
||||
/// ID numbers for tool actions need to have a value higher than m_actionId
|
||||
int id = m_actionId + aAction.GetId();
|
||||
wxString menuEntry;
|
||||
|
||||
wxMenuItem* item = new wxMenuItem( this, id,
|
||||
wxString( aAction.GetMenuItem().c_str(), wxConvUTF8 ),
|
||||
wxString( aAction.GetDescription().c_str(), wxConvUTF8 ), wxITEM_NORMAL );
|
||||
|
||||
if( aAction.HasHotKey() )
|
||||
menuEntry = wxString( ( aAction.GetMenuItem() + '\t' +
|
||||
getHotKeyDescription( aAction ) ).c_str(), wxConvUTF8 );
|
||||
else
|
||||
menuEntry = wxString( aAction.GetMenuItem().c_str(), wxConvUTF8 );
|
||||
{
|
||||
int key = aAction.GetHotKey() & ~MD_MODIFIER_MASK;
|
||||
int mod = aAction.GetHotKey() & MD_MODIFIER_MASK;
|
||||
int flags = wxACCEL_NORMAL;
|
||||
|
||||
m_menu.Append( new wxMenuItem( &m_menu, id, menuEntry,
|
||||
wxString( aAction.GetDescription().c_str(), wxConvUTF8 ), wxITEM_NORMAL ) );
|
||||
switch( mod )
|
||||
{
|
||||
case MD_ALT: flags = wxACCEL_ALT; break;
|
||||
case MD_CTRL: flags = wxACCEL_CTRL; break;
|
||||
case MD_SHIFT: flags = wxACCEL_SHIFT; break;
|
||||
}
|
||||
|
||||
wxAcceleratorEntry accel( flags, key, id, item );
|
||||
item->SetAccel( &accel );
|
||||
}
|
||||
|
||||
Append( item );
|
||||
m_toolActions[id] = &aAction;
|
||||
}
|
||||
|
||||
|
@ -121,38 +145,17 @@ void CONTEXT_MENU::Clear()
|
|||
m_titleSet = false;
|
||||
|
||||
// Remove all the entries from context menu
|
||||
for( unsigned i = 0; i < m_menu.GetMenuItemCount(); ++i )
|
||||
m_menu.Destroy( m_menu.FindItemByPosition( 0 ) );
|
||||
for( unsigned i = 0; i < GetMenuItemCount(); ++i )
|
||||
Destroy( FindItemByPosition( 0 ) );
|
||||
|
||||
m_toolActions.clear();
|
||||
}
|
||||
|
||||
|
||||
std::string CONTEXT_MENU::getHotKeyDescription( const TOOL_ACTION& aAction ) const
|
||||
void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent )
|
||||
{
|
||||
int hotkey = aAction.GetHotKey();
|
||||
OPT_TOOL_EVENT evt;
|
||||
|
||||
std::string description = "";
|
||||
|
||||
if( hotkey & MD_ALT )
|
||||
description += "ALT+";
|
||||
|
||||
if( hotkey & MD_CTRL )
|
||||
description += "CTRL+";
|
||||
|
||||
if( hotkey & MD_SHIFT )
|
||||
description += "SHIFT+";
|
||||
|
||||
// TODO dispatch keys such as Fx, TAB, PG_UP/DN, HOME, END, etc.
|
||||
description += char( hotkey & ~MD_MODIFIER_MASK );
|
||||
|
||||
return description;
|
||||
}
|
||||
|
||||
|
||||
void CONTEXT_MENU::CMEventHandler::onEvent( wxEvent& aEvent )
|
||||
{
|
||||
TOOL_EVENT evt;
|
||||
wxEventType type = aEvent.GetEventType();
|
||||
|
||||
// When the currently chosen item in the menu is changed, an update event is issued.
|
||||
|
@ -165,21 +168,42 @@ void CONTEXT_MENU::CMEventHandler::onEvent( wxEvent& aEvent )
|
|||
else if( type == wxEVT_COMMAND_MENU_SELECTED )
|
||||
{
|
||||
// Store the selected position
|
||||
m_menu->m_selected = aEvent.GetId();
|
||||
m_selected = aEvent.GetId();
|
||||
|
||||
// Check if there is a TOOL_ACTION for the given ID
|
||||
if( m_menu->m_toolActions.count( aEvent.GetId() ) == 1 )
|
||||
if( m_toolActions.count( aEvent.GetId() ) == 1 )
|
||||
{
|
||||
evt = m_menu->m_toolActions[aEvent.GetId()]->MakeEvent();
|
||||
evt = m_toolActions[aEvent.GetId()]->MakeEvent();
|
||||
}
|
||||
else
|
||||
{
|
||||
evt = m_customHandler( aEvent );
|
||||
|
||||
// Handling non-action menu entries (e.g. items in clarification list)
|
||||
if( !evt )
|
||||
evt = TOOL_EVENT( TC_COMMAND, TA_CONTEXT_MENU_CHOICE, aEvent.GetId() );
|
||||
}
|
||||
}
|
||||
|
||||
assert( m_tool ); // without tool & tool manager we cannot handle events
|
||||
|
||||
// forward the action/update event to the TOOL_MANAGER
|
||||
if( m_menu->m_tool )
|
||||
m_menu->m_tool->GetManager()->ProcessEvent( evt );
|
||||
if( evt && m_tool )
|
||||
m_tool->GetManager()->ProcessEvent( *evt );
|
||||
}
|
||||
|
||||
|
||||
void CONTEXT_MENU::copyItem( const wxMenuItem* aSource, wxMenuItem* aDest ) const
|
||||
{
|
||||
assert( !aSource->IsSubMenu() ); // it does not transfer submenus
|
||||
|
||||
aDest->SetKind( aSource->GetKind() );
|
||||
aDest->SetHelp( aSource->GetHelp() );
|
||||
aDest->Enable( aSource->IsEnabled() );
|
||||
|
||||
if( aSource->IsCheckable() )
|
||||
aDest->Check( aSource->IsChecked() );
|
||||
|
||||
if( aSource->GetKind() == wxITEM_NORMAL )
|
||||
aDest->SetBitmap( aSource->GetBitmap() );
|
||||
}
|
||||
|
|
|
@ -240,6 +240,13 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
|
|||
evt = TOOL_EVENT( TC_MOUSE, TA_MOUSE_MOTION, mods );
|
||||
evt->SetMousePosition( pos );
|
||||
}
|
||||
|
||||
#ifdef __APPLE__
|
||||
// TODO That's a big ugly workaround, somehow DRAWPANEL_GAL loses focus
|
||||
// after second LMB click and currently I have no means to do better debugging
|
||||
if( type == wxEVT_LEFT_UP )
|
||||
m_editFrame->GetGalCanvas()->SetFocus();
|
||||
#endif /* __APPLE__ */
|
||||
}
|
||||
|
||||
// Keyboard handling
|
||||
|
|
|
@ -103,14 +103,6 @@ TOOL_MANAGER::TOOL_MANAGER() :
|
|||
|
||||
|
||||
TOOL_MANAGER::~TOOL_MANAGER()
|
||||
{
|
||||
DeleteAll();
|
||||
|
||||
delete m_actionMgr;
|
||||
}
|
||||
|
||||
|
||||
void TOOL_MANAGER::DeleteAll()
|
||||
{
|
||||
std::map<TOOL_BASE*, TOOL_STATE*>::iterator it, it_end;
|
||||
|
||||
|
@ -122,6 +114,7 @@ void TOOL_MANAGER::DeleteAll()
|
|||
}
|
||||
|
||||
m_toolState.clear();
|
||||
delete m_actionMgr;
|
||||
}
|
||||
|
||||
|
||||
|
@ -308,8 +301,6 @@ int TOOL_MANAGER::GetPriority( int aToolId ) const
|
|||
for( std::deque<int>::const_iterator it = m_activeTools.begin(),
|
||||
itEnd = m_activeTools.end(); it != itEnd; ++it )
|
||||
{
|
||||
std::cout << FindTool( *it )->GetName() << std::endl;
|
||||
|
||||
if( *it == aToolId )
|
||||
return priority;
|
||||
|
||||
|
@ -497,7 +488,7 @@ bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
|
|||
st->contextMenuTrigger = CMENU_OFF;
|
||||
|
||||
boost::scoped_ptr<CONTEXT_MENU> menu( new CONTEXT_MENU( *st->contextMenu ) );
|
||||
GetEditFrame()->PopupMenu( menu->GetMenu() );
|
||||
GetEditFrame()->PopupMenu( menu.get() );
|
||||
|
||||
// If nothing was chosen from the context menu, we must notify the tool as well
|
||||
if( menu->GetSelected() < 0 )
|
||||
|
@ -513,7 +504,6 @@ bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
|
|||
if( m_view->IsDirty() )
|
||||
{
|
||||
PCB_EDIT_FRAME* f = static_cast<PCB_EDIT_FRAME*>( GetEditFrame() );
|
||||
if( f->IsGalCanvasActive() )
|
||||
f->GetGalCanvas()->Refresh(); // fixme: ugly hack, provide a method in TOOL_DISPATCHER.
|
||||
}
|
||||
|
||||
|
|
|
@ -1019,3 +1019,38 @@ void VIEW::UpdateItems()
|
|||
|
||||
m_needsUpdate.clear();
|
||||
}
|
||||
|
||||
struct VIEW::extentsVisitor {
|
||||
BOX2I extents;
|
||||
bool first;
|
||||
|
||||
extentsVisitor()
|
||||
{
|
||||
first = true;
|
||||
}
|
||||
|
||||
bool operator()( VIEW_ITEM* aItem )
|
||||
{
|
||||
if(first)
|
||||
extents = aItem->ViewBBox();
|
||||
else
|
||||
extents.Merge ( aItem->ViewBBox() );
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
const BOX2I VIEW::CalculateExtents()
|
||||
{
|
||||
|
||||
extentsVisitor v;
|
||||
BOX2I fullScene;
|
||||
fullScene.SetMaximum();
|
||||
|
||||
|
||||
BOOST_FOREACH( VIEW_LAYER* l, m_orderedLayers )
|
||||
{
|
||||
l->items->Query( fullScene, v );
|
||||
}
|
||||
|
||||
return v.extents;
|
||||
}
|
||||
|
|
|
@ -160,12 +160,12 @@ void WX_VIEW_CONTROLS::onWheel( wxMouseEvent& aEvent )
|
|||
// Set scaling speed depending on scroll wheel event interval
|
||||
if( timeDiff < 500 && timeDiff > 0 )
|
||||
{
|
||||
zoomScale = ( aEvent.GetWheelRotation() > 0.0 ) ? 2.05 - timeDiff / 500 :
|
||||
zoomScale = ( aEvent.GetWheelRotation() > 0 ) ? 2.05 - timeDiff / 500 :
|
||||
1.0 / ( 2.05 - timeDiff / 500 );
|
||||
}
|
||||
else
|
||||
{
|
||||
zoomScale = ( aEvent.GetWheelRotation() > 0.0 ) ? 1.05 : 0.95;
|
||||
zoomScale = ( aEvent.GetWheelRotation() > 0 ) ? 1.05 : 0.95;
|
||||
}
|
||||
|
||||
VECTOR2D anchor = m_view->ToWorld( VECTOR2D( aEvent.GetX(), aEvent.GetY() ) );
|
||||
|
@ -217,6 +217,11 @@ void WX_VIEW_CONTROLS::onTimer( wxTimerEvent& aEvent )
|
|||
{
|
||||
case AUTO_PANNING:
|
||||
{
|
||||
#if wxCHECK_VERSION( 3, 0, 0 )
|
||||
if( !m_parentPanel->HasFocus() )
|
||||
break;
|
||||
#endif
|
||||
|
||||
double borderSize = std::min( m_autoPanMargin * m_view->GetScreenPixelSize().x,
|
||||
m_autoPanMargin * m_view->GetScreenPixelSize().y );
|
||||
|
||||
|
|
|
@ -0,0 +1,199 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* Author: Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "wxunittext.h"
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/textctrl.h>
|
||||
#include <limits>
|
||||
#include <base_units.h>
|
||||
#if wxCHECK_VERSION( 2, 9, 0 )
|
||||
#include <wx/valnum.h>
|
||||
#endif
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
WX_UNIT_TEXT::WX_UNIT_TEXT( wxWindow* aParent, const wxString& aLabel, double aValue, double aStep ) :
|
||||
wxPanel( aParent, wxID_ANY ),
|
||||
m_step( aStep )
|
||||
{
|
||||
// Use the currently selected units
|
||||
m_units = g_UserUnit;
|
||||
|
||||
wxBoxSizer* sizer;
|
||||
sizer = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
// Helper label
|
||||
m_inputLabel = new wxStaticText( this, wxID_ANY, aLabel,
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
wxSize size = m_inputLabel->GetMinSize();
|
||||
size.SetWidth( 150 );
|
||||
m_inputLabel->SetMinSize( size );
|
||||
sizer->Add( m_inputLabel, 1, wxALIGN_CENTER_VERTICAL | wxALL | wxEXPAND, 5 );
|
||||
|
||||
// Main input control
|
||||
m_inputValue = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize,
|
||||
wxTE_PROCESS_ENTER );
|
||||
|
||||
SetValue( aValue );
|
||||
sizer->Add( m_inputValue, 0, wxALIGN_CENTER_VERTICAL | wxALL );
|
||||
|
||||
#if wxCHECK_VERSION( 2, 9, 0 ) // Sorry guys, I am tired of dealing with 2.8 compatibility
|
||||
wxFloatingPointValidator<double> validator( 4, NULL, wxNUM_VAL_NO_TRAILING_ZEROES );
|
||||
validator.SetRange( 0.0, std::numeric_limits<double>::max() );
|
||||
m_inputValue->SetValidator( validator );
|
||||
|
||||
// Spin buttons for modifying values using the mouse
|
||||
m_spinButton = new wxSpinButton( this, wxID_ANY );
|
||||
m_spinButton->SetRange( std::numeric_limits<int>::min(), std::numeric_limits<int>::max() );
|
||||
|
||||
m_spinButton->SetCanFocus( false );
|
||||
sizer->Add( m_spinButton, 0, wxALIGN_CENTER_VERTICAL | wxALL );
|
||||
|
||||
Connect( wxEVT_SPIN_UP, wxSpinEventHandler( WX_UNIT_TEXT::onSpinUpEvent ), NULL, this );
|
||||
Connect( wxEVT_SPIN_DOWN, wxSpinEventHandler( WX_UNIT_TEXT::onSpinDownEvent ), NULL, this );
|
||||
#endif
|
||||
|
||||
sizer->AddSpacer( 5 );
|
||||
|
||||
// Create units label
|
||||
m_unitLabel = new wxStaticText( this, wxID_ANY, GetUnitsLabel( g_UserUnit ),
|
||||
wxDefaultPosition, wxDefaultSize, 0 );
|
||||
sizer->Add( m_unitLabel, 0, wxALIGN_CENTER_VERTICAL | wxALL );
|
||||
|
||||
SetSizer( sizer );
|
||||
Layout();
|
||||
}
|
||||
|
||||
|
||||
WX_UNIT_TEXT::~WX_UNIT_TEXT()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void WX_UNIT_TEXT::SetUnits( EDA_UNITS_T aUnits, bool aConvert )
|
||||
{
|
||||
assert( !aConvert ); // TODO conversion does not work yet
|
||||
|
||||
m_unitLabel->SetLabel( GetUnitsLabel( g_UserUnit ) );
|
||||
}
|
||||
|
||||
|
||||
void WX_UNIT_TEXT::SetValue( double aValue )
|
||||
{
|
||||
if( aValue >= 0.0 )
|
||||
{
|
||||
m_inputValue->SetValue( wxString( Double2Str( aValue ).c_str(), wxConvUTF8 ) );
|
||||
m_inputValue->MarkDirty();
|
||||
}
|
||||
else
|
||||
{
|
||||
m_inputValue->SetValue( DEFAULT_VALUE );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*boost::optional<double> WX_UNIT_TEXT::GetValue( EDA_UNITS_T aUnit ) const
|
||||
{
|
||||
if( aUnit == m_units )
|
||||
return GetValue(); // no conversion needed
|
||||
|
||||
switch( m_units )
|
||||
{
|
||||
case MILLIMETRES:
|
||||
switch( aUnit )
|
||||
{
|
||||
case INCHES:
|
||||
iu = Mils2iu( GetValue() * 1000.0 );
|
||||
break;
|
||||
|
||||
case UNSCALED_UNITS:
|
||||
iu = GetValue();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case INCHES:
|
||||
switch( aUnit )
|
||||
{
|
||||
case MILLIMETRES:
|
||||
return Mils2mm( GetValue() * 1000.0 );
|
||||
break;
|
||||
|
||||
case UNSCALED_UNITS:
|
||||
return Mils2iu( GetValue() * 1000.0 );
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case UNSCALED_UNITS:
|
||||
switch( aUnit )
|
||||
{
|
||||
case MILLIMETRES:
|
||||
return Iu2Mils( GetValue() ) / 1000.0;
|
||||
break;
|
||||
|
||||
// case INCHES:
|
||||
// return
|
||||
// break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
assert( false ); // seems that there are some conversions missing
|
||||
|
||||
return 0.0;
|
||||
}*/
|
||||
|
||||
|
||||
boost::optional<double> WX_UNIT_TEXT::GetValue() const
|
||||
{
|
||||
wxString text = m_inputValue->GetValue();
|
||||
double value;
|
||||
|
||||
if( text == DEFAULT_VALUE )
|
||||
return boost::optional<double>( -1.0 );
|
||||
|
||||
if( !text.ToDouble( &value ) )
|
||||
return boost::optional<double>();
|
||||
|
||||
return boost::optional<double>( value );
|
||||
}
|
||||
|
||||
|
||||
void WX_UNIT_TEXT::onSpinUpEvent( wxSpinEvent& aEvent )
|
||||
{
|
||||
SetValue( *GetValue() + m_step );
|
||||
}
|
||||
|
||||
|
||||
void WX_UNIT_TEXT::onSpinDownEvent( wxSpinEvent& aEvent )
|
||||
{
|
||||
double newValue = *GetValue() - m_step;
|
||||
|
||||
if( newValue >= 0.0 )
|
||||
SetValue( newValue );
|
||||
}
|
||||
|
||||
|
||||
const wxString WX_UNIT_TEXT::DEFAULT_VALUE = _( "default ");
|
|
@ -1,12 +1,12 @@
|
|||
(kicad_pcb (version 3) (host pcbnew "(2013-01-12 BZR 3902)-testing")
|
||||
(kicad_pcb (version 3) (host pcbnew "(2014-05-16 BZR 4868)-product")
|
||||
|
||||
(general
|
||||
(links 20)
|
||||
(no_connects 0)
|
||||
(area 119.824499 89.789 168.465501 133.477)
|
||||
(area 118.759514 89.3318 168.465501 133.6802)
|
||||
(thickness 1.6002)
|
||||
(drawings 4)
|
||||
(tracks 62)
|
||||
(tracks 63)
|
||||
(zones 0)
|
||||
(modules 15)
|
||||
(nets 10)
|
||||
|
@ -16,33 +16,38 @@
|
|||
(layers
|
||||
(15 Dessus signal)
|
||||
(0 Dessous signal)
|
||||
(16 Dessous.Adhes user)
|
||||
(17 Dessus.Adhes user)
|
||||
(18 Dessous.Pate user)
|
||||
(19 Dessus.Pate user)
|
||||
(20 Dessous.SilkS user)
|
||||
(21 Dessus.SilkS user)
|
||||
(22 Dessous.Masque user)
|
||||
(23 Dessus.Masque user)
|
||||
(24 Dessin.User user)
|
||||
(16 B.Adhes user)
|
||||
(17 F.Adhes user)
|
||||
(18 B.Paste user)
|
||||
(19 F.Paste user)
|
||||
(20 B.SilkS user)
|
||||
(21 F.SilkS user)
|
||||
(22 B.Mask user)
|
||||
(23 F.Mask user)
|
||||
(24 Dwgs.User user)
|
||||
(25 Cmts.User user)
|
||||
(26 Eco1.User user)
|
||||
(27 Eco2.User user)
|
||||
(28 Contours.Ci user)
|
||||
(28 Edge.Cuts user)
|
||||
)
|
||||
|
||||
(setup
|
||||
(last_trace_width 0.8636)
|
||||
(user_trace_width 1)
|
||||
(user_trace_width 2)
|
||||
(user_trace_width 3)
|
||||
(trace_clearance 0.508)
|
||||
(zone_clearance 0.635)
|
||||
(zone_45_only no)
|
||||
(trace_min 0.254)
|
||||
(trace_min 0.154)
|
||||
(segment_width 0.381)
|
||||
(edge_width 0.381)
|
||||
(via_size 1.905)
|
||||
(via_drill 0.635)
|
||||
(via_min_size 0.889)
|
||||
(via_min_drill 0.508)
|
||||
(user_via 2 1)
|
||||
(user_via 3 2)
|
||||
(uvia_size 0.508)
|
||||
(uvia_drill 0.127)
|
||||
(uvias_allowed no)
|
||||
|
@ -62,7 +67,7 @@
|
|||
(layerselection 3178497)
|
||||
(usegerberextensions true)
|
||||
(excludeedgelayer true)
|
||||
(linewidth 60)
|
||||
(linewidth 0.150000)
|
||||
(plotframeref false)
|
||||
(viasonmask false)
|
||||
(mode 1)
|
||||
|
@ -104,7 +109,6 @@
|
|||
(via_drill 0.635)
|
||||
(uvia_dia 0.508)
|
||||
(uvia_drill 0.127)
|
||||
(add_net "")
|
||||
(add_net GND)
|
||||
(add_net N-000001)
|
||||
(add_net N-000002)
|
||||
|
@ -120,21 +124,17 @@
|
|||
(at 131.445 99.06 90)
|
||||
(descr "Condensateur polarise")
|
||||
(tags CP)
|
||||
(fp_text reference C1 (at 0 2.54 90) (layer Dessus.SilkS)
|
||||
(fp_text reference C1 (at 0 2.54 90) (layer F.SilkS)
|
||||
(effects (font (size 1.27 1.27) (thickness 0.254)))
|
||||
)
|
||||
(fp_text value 10uF (at 0 -2.54 90) (layer Dessus.SilkS)
|
||||
(fp_text value 10uF (at 0 -2.54 90) (layer F.SilkS)
|
||||
(effects (font (size 1.27 1.27) (thickness 0.254)))
|
||||
)
|
||||
(fp_circle (center 0 0) (end 4.826 -2.794) (layer Dessus.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole rect (at -2.54 0 90) (size 1.778 1.778) (drill 1.016)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 7 N-000006)
|
||||
)
|
||||
(pad 2 thru_hole circle (at 2.54 0 90) (size 1.778 1.778) (drill 1.016)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 1 GND)
|
||||
)
|
||||
(fp_circle (center 0 0) (end 4.826 -2.794) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole rect (at -2.54 0 90) (size 1.778 1.778) (drill 1.016) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 7 N-000006))
|
||||
(pad 2 thru_hole circle (at 2.54 0 90) (size 1.778 1.778) (drill 1.016) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 GND))
|
||||
(model discret/c_vert_c2v10.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
|
@ -147,28 +147,24 @@
|
|||
(descr "Resitance 3 pas")
|
||||
(tags R)
|
||||
(autoplace_cost180 10)
|
||||
(fp_text reference R1 (at 0 0 270) (layer Dessus.SilkS)
|
||||
(fp_text reference R1 (at 0 0 270) (layer F.SilkS)
|
||||
(effects (font (size 1.397 1.27) (thickness 0.2032)))
|
||||
)
|
||||
(fp_text value 1.5K (at 0 0 270) (layer Dessus.SilkS) hide
|
||||
(fp_text value 1.5K (at 0 0 270) (layer F.SilkS) hide
|
||||
(effects (font (size 1.397 1.27) (thickness 0.2032)))
|
||||
)
|
||||
(fp_line (start -3.81 0) (end -3.302 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.81 0) (end 3.302 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 0) (end 3.302 -1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 -1.016) (end -3.302 -1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -1.016) (end -3.302 1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 1.016) (end 3.302 1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 1.016) (end 3.302 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -0.508) (end -2.794 -1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole circle (at -3.81 0 270) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 5 N-000004)
|
||||
)
|
||||
(pad 2 thru_hole circle (at 3.81 0 270) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 9 N-000008)
|
||||
)
|
||||
(fp_line (start -3.81 0) (end -3.302 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.81 0) (end 3.302 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 0) (end 3.302 -1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 -1.016) (end -3.302 -1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -1.016) (end -3.302 1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 1.016) (end 3.302 1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 1.016) (end 3.302 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -0.508) (end -2.794 -1.016) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole circle (at -3.81 0 270) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 5 N-000004))
|
||||
(pad 2 thru_hole circle (at 3.81 0 270) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 9 N-000008))
|
||||
(model discret/resistor.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.3 0.3 0.3))
|
||||
|
@ -181,28 +177,24 @@
|
|||
(descr "Resitance 3 pas")
|
||||
(tags R)
|
||||
(autoplace_cost180 10)
|
||||
(fp_text reference R3 (at 0 0 270) (layer Dessus.SilkS)
|
||||
(fp_text reference R3 (at 0 0 270) (layer F.SilkS)
|
||||
(effects (font (size 1.397 1.27) (thickness 0.2032)))
|
||||
)
|
||||
(fp_text value 100K (at 0 0 270) (layer Dessus.SilkS) hide
|
||||
(fp_text value 100K (at 0 0 270) (layer F.SilkS) hide
|
||||
(effects (font (size 1.397 1.27) (thickness 0.2032)))
|
||||
)
|
||||
(fp_line (start -3.81 0) (end -3.302 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.81 0) (end 3.302 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 0) (end 3.302 -1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 -1.016) (end -3.302 -1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -1.016) (end -3.302 1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 1.016) (end 3.302 1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 1.016) (end 3.302 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -0.508) (end -2.794 -1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole circle (at -3.81 0 270) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 4 N-000003)
|
||||
)
|
||||
(pad 2 thru_hole circle (at 3.81 0 270) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 1 GND)
|
||||
)
|
||||
(fp_line (start -3.81 0) (end -3.302 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.81 0) (end 3.302 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 0) (end 3.302 -1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 -1.016) (end -3.302 -1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -1.016) (end -3.302 1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 1.016) (end 3.302 1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 1.016) (end 3.302 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -0.508) (end -2.794 -1.016) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole circle (at -3.81 0 270) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 4 N-000003))
|
||||
(pad 2 thru_hole circle (at 3.81 0 270) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 GND))
|
||||
(model discret/resistor.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.3 0.3 0.3))
|
||||
|
@ -215,28 +207,24 @@
|
|||
(descr "Resitance 3 pas")
|
||||
(tags R)
|
||||
(autoplace_cost180 10)
|
||||
(fp_text reference R4 (at 0 0 270) (layer Dessus.SilkS)
|
||||
(fp_text reference R4 (at 0 0 270) (layer F.SilkS)
|
||||
(effects (font (size 1.397 1.27) (thickness 0.2032)))
|
||||
)
|
||||
(fp_text value 47K (at 0 0 270) (layer Dessus.SilkS) hide
|
||||
(fp_text value 47K (at 0 0 270) (layer F.SilkS) hide
|
||||
(effects (font (size 1.397 1.27) (thickness 0.2032)))
|
||||
)
|
||||
(fp_line (start -3.81 0) (end -3.302 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.81 0) (end 3.302 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 0) (end 3.302 -1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 -1.016) (end -3.302 -1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -1.016) (end -3.302 1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 1.016) (end 3.302 1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 1.016) (end 3.302 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -0.508) (end -2.794 -1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole circle (at -3.81 0 270) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 8 N-000007)
|
||||
)
|
||||
(pad 2 thru_hole circle (at 3.81 0 270) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 1 GND)
|
||||
)
|
||||
(fp_line (start -3.81 0) (end -3.302 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.81 0) (end 3.302 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 0) (end 3.302 -1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 -1.016) (end -3.302 -1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -1.016) (end -3.302 1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 1.016) (end 3.302 1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 1.016) (end 3.302 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -0.508) (end -2.794 -1.016) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole circle (at -3.81 0 270) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 8 N-000007))
|
||||
(pad 2 thru_hole circle (at 3.81 0 270) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 GND))
|
||||
(model discret/resistor.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.3 0.3 0.3))
|
||||
|
@ -249,28 +237,24 @@
|
|||
(descr "Resitance 3 pas")
|
||||
(tags R)
|
||||
(autoplace_cost180 10)
|
||||
(fp_text reference R2 (at 0 0 90) (layer Dessus.SilkS)
|
||||
(fp_text reference R2 (at 0 0 90) (layer F.SilkS)
|
||||
(effects (font (size 1.397 1.27) (thickness 0.2032)))
|
||||
)
|
||||
(fp_text value 1.5K (at 0 0 90) (layer Dessus.SilkS) hide
|
||||
(fp_text value 1.5K (at 0 0 90) (layer F.SilkS) hide
|
||||
(effects (font (size 1.397 1.27) (thickness 0.2032)))
|
||||
)
|
||||
(fp_line (start -3.81 0) (end -3.302 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.81 0) (end 3.302 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 0) (end 3.302 -1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 -1.016) (end -3.302 -1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -1.016) (end -3.302 1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 1.016) (end 3.302 1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 1.016) (end 3.302 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -0.508) (end -2.794 -1.016) (layer Dessus.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole circle (at -3.81 0 90) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 6 N-000005)
|
||||
)
|
||||
(pad 2 thru_hole circle (at 3.81 0 90) (size 1.397 1.397) (drill 0.8128)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 1 GND)
|
||||
)
|
||||
(fp_line (start -3.81 0) (end -3.302 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.81 0) (end 3.302 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 0) (end 3.302 -1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 -1.016) (end -3.302 -1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -1.016) (end -3.302 1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 1.016) (end 3.302 1.016) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 3.302 1.016) (end 3.302 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -3.302 -0.508) (end -2.794 -1.016) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole circle (at -3.81 0 90) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 6 N-000005))
|
||||
(pad 2 thru_hole circle (at 3.81 0 90) (size 1.397 1.397) (drill 0.8128) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 GND))
|
||||
(model discret/resistor.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.3 0.3 0.3))
|
||||
|
@ -282,95 +266,83 @@
|
|||
(at 123.19 93.98)
|
||||
(descr "module 1 pin (ou trou mecanique de percage)")
|
||||
(tags DEV)
|
||||
(fp_text reference 1PIN (at 0 -3.048) (layer Dessus.SilkS)
|
||||
(fp_text reference 1PIN (at 0 -3.048) (layer F.SilkS)
|
||||
(effects (font (size 1.016 1.016) (thickness 0.254)))
|
||||
)
|
||||
(fp_text value P*** (at 0 2.794) (layer Dessus.SilkS) hide
|
||||
(fp_text value P*** (at 0 2.794) (layer F.SilkS) hide
|
||||
(effects (font (size 1.016 1.016) (thickness 0.254)))
|
||||
)
|
||||
(fp_circle (center 0 0) (end 0 -2.286) (layer Dessus.SilkS) (width 0.381))
|
||||
(pad 1 thru_hole circle (at 0 0) (size 4.064 4.064) (drill 3.048)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
)
|
||||
(fp_circle (center 0 0) (end 0 -2.286) (layer F.SilkS) (width 0.381))
|
||||
(pad 1 thru_hole circle (at 0 0) (size 4.064 4.064) (drill 3.048) (layers *.Cu *.Mask F.SilkS))
|
||||
)
|
||||
|
||||
(module 1pin (layer Dessus) (tedit 200000) (tstamp 454CC090)
|
||||
(at 165.1 93.98)
|
||||
(descr "module 1 pin (ou trou mecanique de percage)")
|
||||
(tags DEV)
|
||||
(fp_text reference 1PIN (at 0 -3.048) (layer Dessus.SilkS)
|
||||
(fp_text reference 1PIN (at 0 -3.048) (layer F.SilkS)
|
||||
(effects (font (size 1.016 1.016) (thickness 0.254)))
|
||||
)
|
||||
(fp_text value GND (at 0 2.794) (layer Dessus.SilkS) hide
|
||||
(fp_text value GND (at 0 2.794) (layer F.SilkS) hide
|
||||
(effects (font (size 1.016 1.016) (thickness 0.254)))
|
||||
)
|
||||
(fp_circle (center 0 0) (end 0 -2.286) (layer Dessus.SilkS) (width 0.381))
|
||||
(pad 1 thru_hole circle (at 0 0) (size 4.064 4.064) (drill 3.048)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
)
|
||||
(fp_circle (center 0 0) (end 0 -2.286) (layer F.SilkS) (width 0.381))
|
||||
(pad 1 thru_hole circle (at 0 0) (size 4.064 4.064) (drill 3.048) (layers *.Cu *.Mask F.SilkS))
|
||||
)
|
||||
|
||||
(module 1pin (layer Dessus) (tedit 200000) (tstamp 454CC096)
|
||||
(at 165.1 129.54)
|
||||
(descr "module 1 pin (ou trou mecanique de percage)")
|
||||
(tags DEV)
|
||||
(fp_text reference 1PIN (at 0 -3.048) (layer Dessus.SilkS)
|
||||
(fp_text reference 1PIN (at 0 -3.048) (layer F.SilkS)
|
||||
(effects (font (size 1.016 1.016) (thickness 0.254)))
|
||||
)
|
||||
(fp_text value P*** (at 0 2.794) (layer Dessus.SilkS) hide
|
||||
(fp_text value P*** (at 0 2.794) (layer F.SilkS) hide
|
||||
(effects (font (size 1.016 1.016) (thickness 0.254)))
|
||||
)
|
||||
(fp_circle (center 0 0) (end 0 -2.286) (layer Dessus.SilkS) (width 0.381))
|
||||
(pad 1 thru_hole circle (at 0 0) (size 4.064 4.064) (drill 3.048)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
)
|
||||
(fp_circle (center 0 0) (end 0 -2.286) (layer F.SilkS) (width 0.381))
|
||||
(pad 1 thru_hole circle (at 0 0) (size 4.064 4.064) (drill 3.048) (layers *.Cu *.Mask F.SilkS))
|
||||
)
|
||||
|
||||
(module 1pin (layer Dessus) (tedit 200000) (tstamp 454CC09B)
|
||||
(at 123.19 129.54)
|
||||
(descr "module 1 pin (ou trou mecanique de percage)")
|
||||
(tags DEV)
|
||||
(fp_text reference 1PIN (at 0 -3.048) (layer Dessus.SilkS)
|
||||
(fp_text reference 1PIN (at 0 -3.048) (layer F.SilkS)
|
||||
(effects (font (size 1.016 1.016) (thickness 0.254)))
|
||||
)
|
||||
(fp_text value P*** (at 0 2.794) (layer Dessus.SilkS) hide
|
||||
(fp_text value P*** (at 0 2.794) (layer F.SilkS) hide
|
||||
(effects (font (size 1.016 1.016) (thickness 0.254)))
|
||||
)
|
||||
(fp_circle (center 0 0) (end 0 -2.286) (layer Dessus.SilkS) (width 0.381))
|
||||
(pad 1 thru_hole circle (at 0 0) (size 4.064 4.064) (drill 3.048)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
)
|
||||
(fp_circle (center 0 0) (end 0 -2.286) (layer F.SilkS) (width 0.381))
|
||||
(pad 1 thru_hole circle (at 0 0) (size 4.064 4.064) (drill 3.048) (layers *.Cu *.Mask F.SilkS))
|
||||
)
|
||||
|
||||
(module CP8 (layer Dessus) (tedit 200000) (tstamp 4549F3BE)
|
||||
(at 131.445 118.745 270)
|
||||
(descr "Condensateur polarise")
|
||||
(tags CP)
|
||||
(fp_text reference C2 (at 1.27 1.27 270) (layer Dessus.SilkS)
|
||||
(effects (font (size 1.524 1.524) (thickness 0.3048)))
|
||||
(fp_text reference C2 (at 1.27 1.27 270) (layer F.SilkS)
|
||||
(effects (font (thickness 0.3048)))
|
||||
)
|
||||
(fp_text value 680nF (at 1.27 -1.27 270) (layer Dessus.SilkS)
|
||||
(effects (font (size 1.524 1.524) (thickness 0.3048)))
|
||||
)
|
||||
(fp_line (start -10.16 0) (end -8.89 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -7.62 1.27) (end -8.89 1.27) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -8.89 1.27) (end -8.89 -1.27) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -8.89 -1.27) (end -7.62 -1.27) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -7.62 2.54) (end -7.62 -2.54) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -7.62 -2.54) (end 8.89 -2.54) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 8.89 -2.54) (end 8.89 2.54) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 8.89 2.54) (end -7.62 2.54) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start 8.89 0) (end 10.16 0) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -5.08 -2.54) (end -5.08 2.54) (layer Dessus.SilkS) (width 0.3048))
|
||||
(fp_line (start -6.35 2.54) (end -6.35 -2.54) (layer Dessus.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole rect (at -10.16 0 270) (size 1.778 1.778) (drill 0.8128)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 4 N-000003)
|
||||
)
|
||||
(pad 2 thru_hole circle (at 10.16 0 270) (size 1.778 1.778) (drill 0.8128)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 9 N-000008)
|
||||
(fp_text value 680nF (at 1.27 -1.27 270) (layer F.SilkS)
|
||||
(effects (font (thickness 0.3048)))
|
||||
)
|
||||
(fp_line (start -10.16 0) (end -8.89 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -7.62 1.27) (end -8.89 1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -8.89 1.27) (end -8.89 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -8.89 -1.27) (end -7.62 -1.27) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -7.62 2.54) (end -7.62 -2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -7.62 -2.54) (end 8.89 -2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 8.89 -2.54) (end 8.89 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 8.89 2.54) (end -7.62 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start 8.89 0) (end 10.16 0) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -5.08 -2.54) (end -5.08 2.54) (layer F.SilkS) (width 0.3048))
|
||||
(fp_line (start -6.35 2.54) (end -6.35 -2.54) (layer F.SilkS) (width 0.3048))
|
||||
(pad 1 thru_hole rect (at -10.16 0 270) (size 1.778 1.778) (drill 0.8128) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 4 N-000003))
|
||||
(pad 2 thru_hole circle (at 10.16 0 270) (size 1.778 1.778) (drill 0.8128) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 9 N-000008))
|
||||
(model discret/c_pol.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 0.8 0.8 0.8))
|
||||
|
@ -379,53 +351,33 @@
|
|||
)
|
||||
|
||||
(module ECC-83-2 (layer Dessus) (tedit 46F8A1CF) (tstamp 454A08DD)
|
||||
(at 149.225 109.22)
|
||||
(fp_text reference U1 (at 0 -11.43) (layer Dessus.SilkS)
|
||||
(effects (font (size 1.524 1.524) (thickness 0.3048)))
|
||||
(at 193.675 101.4984)
|
||||
(fp_text reference U1 (at 0 -11.43) (layer F.SilkS)
|
||||
(effects (font (thickness 0.3048)))
|
||||
)
|
||||
(fp_text value ECC83 (at 0 11.43) (layer Dessus.SilkS)
|
||||
(effects (font (size 1.524 1.524) (thickness 0.3048)))
|
||||
)
|
||||
(fp_circle (center 0 0) (end 10.16 1.27) (layer Dessus.SilkS) (width 0.381))
|
||||
(pad 1 thru_hole oval (at 3.4544 4.75488 306) (size 2.032 3.048) (drill oval 1.016 2.032)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 5 N-000004)
|
||||
)
|
||||
(pad 2 thru_hole oval (at 5.60832 1.8288 342) (size 2.032 3.048) (drill oval 1.016 2.032)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 8 N-000007)
|
||||
)
|
||||
(pad 3 thru_hole oval (at 5.60832 -1.8288 18) (size 2.032 3.048) (drill oval 1.016 2.032)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 6 N-000005)
|
||||
)
|
||||
(pad 4 thru_hole oval (at 3.4544 -4.75488 54) (size 2.032 3.048) (drill oval 1.016 2.032)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 2 N-000001)
|
||||
)
|
||||
(pad 5 thru_hole oval (at 0 -5.8928 90) (size 2.032 3.048) (drill oval 1.016 2.032)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 2 N-000001)
|
||||
)
|
||||
(pad 6 thru_hole oval (at -3.4544 -4.75488 306) (size 2.032 3.048) (drill oval 1.016 2.032)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 7 N-000006)
|
||||
)
|
||||
(pad 7 thru_hole oval (at -5.60832 -1.8288 342) (size 2.032 3.048) (drill oval 1.016 2.032)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 5 N-000004)
|
||||
)
|
||||
(pad 8 thru_hole oval (at -5.60832 1.78816 18) (size 2.032 3.048) (drill oval 1.016 2.032)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 9 N-000008)
|
||||
)
|
||||
(pad 9 thru_hole oval (at -3.4544 4.75488 54) (size 2.032 3.048) (drill oval 1.016 2.032)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 3 N-000002)
|
||||
)
|
||||
(pad 10 thru_hole circle (at 0 0) (size 4.50088 4.50088) (drill 3.0988)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(fp_text value ECC83 (at 0 11.43) (layer F.SilkS)
|
||||
(effects (font (thickness 0.3048)))
|
||||
)
|
||||
(fp_circle (center 0 0) (end 10.16 1.27) (layer F.SilkS) (width 0.381))
|
||||
(pad 1 thru_hole oval (at 3.4544 4.75488 306) (size 2.032 3.048) (drill oval 1.016 2.032) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 5 N-000004))
|
||||
(pad 2 thru_hole oval (at 5.60832 1.8288 342) (size 2.032 3.048) (drill oval 1.016 2.032) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 8 N-000007))
|
||||
(pad 3 thru_hole oval (at 5.60832 -1.8288 18) (size 2.032 3.048) (drill oval 1.016 2.032) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 6 N-000005))
|
||||
(pad 4 thru_hole oval (at 3.4544 -4.75488 54) (size 2.032 3.048) (drill oval 1.016 2.032) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 2 N-000001))
|
||||
(pad 5 thru_hole oval (at 0 -5.8928 90) (size 2.032 3.048) (drill oval 1.016 2.032) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 2 N-000001))
|
||||
(pad 6 thru_hole oval (at -3.4544 -4.75488 306) (size 2.032 3.048) (drill oval 1.016 2.032) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 7 N-000006))
|
||||
(pad 7 thru_hole oval (at -5.60832 -1.8288 342) (size 2.032 3.048) (drill oval 1.016 2.032) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 5 N-000004))
|
||||
(pad 8 thru_hole oval (at -5.60832 1.78816 18) (size 2.032 3.048) (drill oval 1.016 2.032) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 9 N-000008))
|
||||
(pad 9 thru_hole oval (at -3.4544 4.75488 54) (size 2.032 3.048) (drill oval 1.016 2.032) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 3 N-000002))
|
||||
(pad 10 thru_hole circle (at 0 0) (size 4.50088 4.50088) (drill 3.0988) (layers *.Cu *.Mask F.SilkS))
|
||||
(model valves/ecc83.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
|
@ -437,24 +389,20 @@
|
|||
(at 149.225 128.905 180)
|
||||
(descr "Connecteurs 2 pins")
|
||||
(tags "CONN DEV")
|
||||
(fp_text reference P4 (at 0 -1.905 180) (layer Dessus.SilkS)
|
||||
(fp_text reference P4 (at 0 -1.905 180) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.1524)))
|
||||
)
|
||||
(fp_text value CONN_2 (at 0 -1.905 180) (layer Dessus.SilkS) hide
|
||||
(fp_text value CONN_2 (at 0 -1.905 180) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.1524)))
|
||||
)
|
||||
(fp_line (start -2.54 1.27) (end -2.54 -1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.54 -1.27) (end 2.54 -1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 -1.27) (end 2.54 1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 1.27) (end -2.54 1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(pad 1 thru_hole rect (at -1.27 0 180) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 2 N-000001)
|
||||
)
|
||||
(pad 2 thru_hole circle (at 1.27 0 180) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 3 N-000002)
|
||||
)
|
||||
(fp_line (start -2.54 1.27) (end -2.54 -1.27) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.54 -1.27) (end 2.54 -1.27) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 -1.27) (end 2.54 1.27) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 1.27) (end -2.54 1.27) (layer F.SilkS) (width 0.1524))
|
||||
(pad 1 thru_hole rect (at -1.27 0 180) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 2 N-000001))
|
||||
(pad 2 thru_hole circle (at 1.27 0 180) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 3 N-000002))
|
||||
(model pin_array/pins_array_2x1.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
|
@ -466,24 +414,20 @@
|
|||
(at 123.19 109.855 90)
|
||||
(descr "Connecteurs 2 pins")
|
||||
(tags "CONN DEV")
|
||||
(fp_text reference P2 (at 0 -1.905 90) (layer Dessus.SilkS)
|
||||
(fp_text reference P2 (at 0 -1.905 90) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.1524)))
|
||||
)
|
||||
(fp_text value OUT (at 0 -1.905 90) (layer Dessus.SilkS) hide
|
||||
(fp_text value OUT (at 0 -1.905 90) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.1524)))
|
||||
)
|
||||
(fp_line (start -2.54 1.27) (end -2.54 -1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.54 -1.27) (end 2.54 -1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 -1.27) (end 2.54 1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 1.27) (end -2.54 1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(pad 1 thru_hole rect (at -1.27 0 90) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 4 N-000003)
|
||||
)
|
||||
(pad 2 thru_hole circle (at 1.27 0 90) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 1 GND)
|
||||
)
|
||||
(fp_line (start -2.54 1.27) (end -2.54 -1.27) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.54 -1.27) (end 2.54 -1.27) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 -1.27) (end 2.54 1.27) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 1.27) (end -2.54 1.27) (layer F.SilkS) (width 0.1524))
|
||||
(pad 1 thru_hole rect (at -1.27 0 90) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 4 N-000003))
|
||||
(pad 2 thru_hole circle (at 1.27 0 90) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 GND))
|
||||
(model pin_array/pins_array_2x1.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
|
@ -495,24 +439,20 @@
|
|||
(at 165.1 111.76 270)
|
||||
(descr "Connecteurs 2 pins")
|
||||
(tags "CONN DEV")
|
||||
(fp_text reference P1 (at 0 -1.905 270) (layer Dessus.SilkS)
|
||||
(fp_text reference P1 (at 0 -1.905 270) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.1524)))
|
||||
)
|
||||
(fp_text value IN (at 0 -1.905 270) (layer Dessus.SilkS) hide
|
||||
(fp_text value IN (at 0 -1.905 270) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.1524)))
|
||||
)
|
||||
(fp_line (start -2.54 1.27) (end -2.54 -1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.54 -1.27) (end 2.54 -1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 -1.27) (end 2.54 1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 1.27) (end -2.54 1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(pad 1 thru_hole rect (at -1.27 0 270) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 1 GND)
|
||||
)
|
||||
(pad 2 thru_hole circle (at 1.27 0 270) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 8 N-000007)
|
||||
)
|
||||
(fp_line (start -2.54 1.27) (end -2.54 -1.27) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.54 -1.27) (end 2.54 -1.27) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 -1.27) (end 2.54 1.27) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 1.27) (end -2.54 1.27) (layer F.SilkS) (width 0.1524))
|
||||
(pad 1 thru_hole rect (at -1.27 0 270) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 GND))
|
||||
(pad 2 thru_hole circle (at 1.27 0 270) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 8 N-000007))
|
||||
(model pin_array/pins_array_2x1.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
|
@ -524,24 +464,20 @@
|
|||
(at 123.19 101.6 90)
|
||||
(descr "Connecteurs 2 pins")
|
||||
(tags "CONN DEV")
|
||||
(fp_text reference P3 (at 0 -1.905 90) (layer Dessus.SilkS)
|
||||
(fp_text reference P3 (at 0 -1.905 90) (layer F.SilkS)
|
||||
(effects (font (size 0.762 0.762) (thickness 0.1524)))
|
||||
)
|
||||
(fp_text value POWER (at 0 -1.905 90) (layer Dessus.SilkS) hide
|
||||
(fp_text value POWER (at 0 -1.905 90) (layer F.SilkS) hide
|
||||
(effects (font (size 0.762 0.762) (thickness 0.1524)))
|
||||
)
|
||||
(fp_line (start -2.54 1.27) (end -2.54 -1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.54 -1.27) (end 2.54 -1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 -1.27) (end 2.54 1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 1.27) (end -2.54 1.27) (layer Dessus.SilkS) (width 0.1524))
|
||||
(pad 1 thru_hole rect (at -1.27 0 90) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 7 N-000006)
|
||||
)
|
||||
(pad 2 thru_hole circle (at 1.27 0 90) (size 1.524 1.524) (drill 1.016)
|
||||
(layers *.Cu *.Mask Dessus.SilkS)
|
||||
(net 1 GND)
|
||||
)
|
||||
(fp_line (start -2.54 1.27) (end -2.54 -1.27) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start -2.54 -1.27) (end 2.54 -1.27) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 -1.27) (end 2.54 1.27) (layer F.SilkS) (width 0.1524))
|
||||
(fp_line (start 2.54 1.27) (end -2.54 1.27) (layer F.SilkS) (width 0.1524))
|
||||
(pad 1 thru_hole rect (at -1.27 0 90) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 7 N-000006))
|
||||
(pad 2 thru_hole circle (at 1.27 0 90) (size 1.524 1.524) (drill 1.016) (layers *.Cu *.Mask F.SilkS)
|
||||
(net 1 GND))
|
||||
(model pin_array/pins_array_2x1.wrl
|
||||
(at (xyz 0 0 0))
|
||||
(scale (xyz 1 1 1))
|
||||
|
@ -549,73 +485,74 @@
|
|||
)
|
||||
)
|
||||
|
||||
(gr_line (start 168.275 132.715) (end 120.015 132.715) (angle 90) (layer Contours.Ci) (width 0.381))
|
||||
(gr_line (start 168.275 90.805) (end 120.015 90.805) (angle 90) (layer Contours.Ci) (width 0.381))
|
||||
(gr_line (start 168.275 90.805) (end 168.275 132.715) (angle 90) (layer Contours.Ci) (width 0.381))
|
||||
(gr_line (start 120.015 90.805) (end 120.015 132.715) (angle 90) (layer Contours.Ci) (width 0.381))
|
||||
(gr_line (start 168.275 132.715) (end 120.015 132.715) (angle 90) (layer Edge.Cuts) (width 0.381))
|
||||
(gr_line (start 168.275 90.805) (end 120.015 90.805) (angle 90) (layer Edge.Cuts) (width 0.381))
|
||||
(gr_line (start 168.275 90.805) (end 168.275 132.715) (angle 90) (layer Edge.Cuts) (width 0.381))
|
||||
(gr_line (start 120.015 90.805) (end 120.015 132.715) (angle 90) (layer Edge.Cuts) (width 0.381))
|
||||
|
||||
(segment (start 165.1 110.49) (end 167.005 110.49) (width 0.8636) (layer Dessous) (net 1) (status 800))
|
||||
(segment (start 121.285 108.585) (end 121.285 118.745) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 121.285 100.33) (end 121.285 108.585) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 123.19 100.33) (end 127 96.52) (width 0.8636) (layer Dessous) (net 1) (status 800))
|
||||
(segment (start 127 96.52) (end 131.445 96.52) (width 0.8636) (layer Dessous) (net 1) (status 400))
|
||||
(segment (start 131.445 96.52) (end 161.925 96.52) (width 0.8636) (layer Dessous) (net 1) (status 800))
|
||||
(segment (start 161.925 96.52) (end 165.1 99.695) (width 0.8636) (layer Dessous) (net 1) (status 400))
|
||||
(segment (start 167.005 110.49) (end 167.005 122.174) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 123.19 100.33) (end 121.285 100.33) (width 0.8636) (layer Dessous) (net 1) (status 800))
|
||||
(segment (start 121.285 108.585) (end 123.19 108.585) (width 0.8636) (layer Dessous) (net 1) (status 400))
|
||||
(segment (start 165.354 123.825) (end 167.005 122.174) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 165.1 123.825) (end 165.354 123.825) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 167.005 101.6) (end 165.1 99.695) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 167.005 101.6) (end 167.005 110.49) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 121.285 119.38) (end 121.285 118.745) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 124.46 122.555) (end 121.285 119.38) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 150.495 128.905) (end 150.495 116.332) (width 0.8636) (layer Dessous) (net 2) (status 800))
|
||||
(segment (start 152.6794 104.46512) (end 152.6794 110.8456) (width 0.8636) (layer Dessous) (net 2) (status 800))
|
||||
(segment (start 151.54148 103.3272) (end 152.6794 104.46512) (width 0.8636) (layer Dessous) (net 2) (status 400))
|
||||
(segment (start 149.225 103.3272) (end 151.54148 103.3272) (width 0.8636) (layer Dessous) (net 2))
|
||||
(segment (start 149.86 113.665) (end 149.86 115.697) (width 0.8636) (layer Dessous) (net 2))
|
||||
(segment (start 149.86 115.697) (end 150.495 116.332) (width 0.8636) (layer Dessous) (net 2))
|
||||
(segment (start 121.285 119.38) (end 121.285 118.745) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 167.005 101.6) (end 167.005 110.49) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 167.005 101.6) (end 165.1 99.695) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 165.1 123.825) (end 165.354 123.825) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 165.354 123.825) (end 167.005 122.174) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 121.285 108.585) (end 123.19 108.585) (width 0.8636) (layer Dessous) (net 1) (status 400))
|
||||
(segment (start 123.19 100.33) (end 121.285 100.33) (width 0.8636) (layer Dessous) (net 1) (status 800))
|
||||
(segment (start 167.005 110.49) (end 167.005 122.174) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 161.925 96.52) (end 165.1 99.695) (width 0.8636) (layer Dessous) (net 1) (status 400))
|
||||
(segment (start 131.445 96.52) (end 161.925 96.52) (width 0.8636) (layer Dessous) (net 1) (status 800))
|
||||
(segment (start 127 96.52) (end 131.445 96.52) (width 0.8636) (layer Dessous) (net 1) (status 400))
|
||||
(segment (start 123.19 100.33) (end 127 96.52) (width 0.8636) (layer Dessous) (net 1) (status 800))
|
||||
(segment (start 121.285 100.33) (end 121.285 108.585) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 121.285 108.585) (end 121.285 118.745) (width 0.8636) (layer Dessous) (net 1))
|
||||
(segment (start 165.1 110.49) (end 167.005 110.49) (width 0.8636) (layer Dessous) (net 1) (status 800))
|
||||
(segment (start 152.6794 110.8456) (end 149.86 113.665) (width 0.8636) (layer Dessous) (net 2))
|
||||
(segment (start 147.955 116.15928) (end 145.7706 113.97488) (width 0.8636) (layer Dessous) (net 3) (status 400))
|
||||
(segment (start 149.86 115.697) (end 150.495 116.332) (width 0.8636) (layer Dessous) (net 2))
|
||||
(segment (start 149.86 113.665) (end 149.86 115.697) (width 0.8636) (layer Dessous) (net 2))
|
||||
(segment (start 149.225 103.3272) (end 151.54148 103.3272) (width 0.8636) (layer Dessous) (net 2))
|
||||
(segment (start 151.54148 103.3272) (end 152.6794 104.46512) (width 0.8636) (layer Dessous) (net 2) (status 400))
|
||||
(segment (start 152.6794 104.46512) (end 152.6794 110.8456) (width 0.8636) (layer Dessous) (net 2) (status 800))
|
||||
(segment (start 150.495 128.905) (end 150.495 116.332) (width 0.8636) (layer Dessous) (net 2) (status 800))
|
||||
(segment (start 147.955 128.905) (end 147.955 116.15928) (width 0.8636) (layer Dessous) (net 3) (status 800))
|
||||
(segment (start 128.905 111.125) (end 123.19 111.125) (width 0.8636) (layer Dessous) (net 4) (status 400))
|
||||
(segment (start 131.445 108.585) (end 128.905 111.125) (width 0.8636) (layer Dessous) (net 4) (status 800))
|
||||
(segment (start 123.825 114.935) (end 123.19 114.3) (width 0.8636) (layer Dessous) (net 4))
|
||||
(segment (start 123.19 114.3) (end 123.19 111.125) (width 0.8636) (layer Dessous) (net 4))
|
||||
(segment (start 147.955 116.15928) (end 145.7706 113.97488) (width 0.8636) (layer Dessous) (net 3) (status 400))
|
||||
(segment (start 124.46 114.935) (end 123.825 114.935) (width 0.8636) (layer Dessous) (net 4))
|
||||
(segment (start 140.97 123.825) (end 139.065 125.73) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 139.065 125.73) (end 130.175 125.73) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 130.175 125.73) (end 128.905 127) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 143.61668 107.3912) (end 142.1638 107.3912) (width 0.8636) (layer Dessous) (net 5) (status 800))
|
||||
(segment (start 140.97 108.585) (end 140.97 121.285) (width 0.8636) (layer Dessous) (net 5) (status 400))
|
||||
(segment (start 142.1638 107.3912) (end 140.97 108.585) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 140.97 121.285) (end 140.97 123.825) (width 0.8636) (layer Dessous) (net 5) (status 800))
|
||||
(segment (start 154.94 116.23548) (end 152.6794 113.97488) (width 0.8636) (layer Dessous) (net 5) (status 400))
|
||||
(segment (start 154.94 130.175) (end 154.94 116.23548) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 128.905 127) (end 128.905 130.175) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 128.905 130.175) (end 130.175 131.445) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 130.175 131.445) (end 153.67 131.445) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 123.19 114.3) (end 123.19 111.125) (width 0.8636) (layer Dessous) (net 4))
|
||||
(segment (start 123.825 114.935) (end 123.19 114.3) (width 0.8636) (layer Dessous) (net 4))
|
||||
(segment (start 131.445 108.585) (end 128.905 111.125) (width 0.8636) (layer Dessous) (net 4) (status 800))
|
||||
(segment (start 128.905 111.125) (end 123.19 111.125) (width 0.8636) (layer Dessous) (net 4) (status 400))
|
||||
(segment (start 153.67 131.445) (end 154.94 130.175) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 165.0238 107.3912) (end 165.1 107.315) (width 0.8636) (layer Dessous) (net 6) (status 400))
|
||||
(segment (start 130.175 131.445) (end 153.67 131.445) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 128.905 130.175) (end 130.175 131.445) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 128.905 127) (end 128.905 130.175) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 154.94 130.175) (end 154.94 116.23548) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 154.94 116.23548) (end 152.6794 113.97488) (width 0.8636) (layer Dessous) (net 5) (status 400))
|
||||
(segment (start 140.97 121.285) (end 140.97 123.825) (width 0.8636) (layer Dessous) (net 5) (status 800))
|
||||
(segment (start 142.1638 107.3912) (end 140.97 108.585) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 140.97 108.585) (end 140.97 121.285) (width 0.8636) (layer Dessous) (net 5) (status 400))
|
||||
(segment (start 143.61668 107.3912) (end 142.1638 107.3912) (width 0.8636) (layer Dessous) (net 5) (status 800))
|
||||
(segment (start 130.175 125.73) (end 128.905 127) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 139.065 125.73) (end 130.175 125.73) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 140.97 123.825) (end 139.065 125.73) (width 0.8636) (layer Dessous) (net 5))
|
||||
(segment (start 154.83332 107.3912) (end 165.0238 107.3912) (width 0.8636) (layer Dessous) (net 6) (status 800))
|
||||
(segment (start 124.46 102.87) (end 125.73 101.6) (width 0.8636) (layer Dessous) (net 7))
|
||||
(segment (start 131.445 101.6) (end 142.90548 101.6) (width 0.8636) (layer Dessous) (net 7) (status 800))
|
||||
(segment (start 142.90548 101.6) (end 145.7706 104.46512) (width 0.8636) (layer Dessous) (net 7) (status 400))
|
||||
(segment (start 123.19 102.87) (end 124.46 102.87) (width 0.8636) (layer Dessous) (net 7) (status 800))
|
||||
(segment (start 165.0238 107.3912) (end 165.1 107.315) (width 0.8636) (layer Dessous) (net 6) (status 400))
|
||||
(segment (start 190.2206 96.74352) (end 181.84622 96.74352) (width 0.8636) (layer Dessous) (net 7))
|
||||
(segment (start 125.73 101.6) (end 131.445 101.6) (width 0.8636) (layer Dessous) (net 7) (status 400))
|
||||
(segment (start 154.83332 111.0488) (end 159.9438 111.0488) (width 0.8636) (layer Dessous) (net 8) (status 800))
|
||||
(segment (start 165.1 113.03) (end 165.1 116.205) (width 0.8636) (layer Dessous) (net 8) (status C00))
|
||||
(segment (start 159.9438 111.0488) (end 161.925 113.03) (width 0.8636) (layer Dessous) (net 8))
|
||||
(segment (start 123.19 102.87) (end 124.46 102.87) (width 0.8636) (layer Dessous) (net 7) (status 800))
|
||||
(segment (start 142.90548 101.6) (end 145.7706 104.46512) (width 0.8636) (layer Dessous) (net 7) (status 400))
|
||||
(segment (start 131.445 101.6) (end 142.90548 101.6) (width 0.8636) (layer Dessous) (net 7) (status 800))
|
||||
(segment (start 124.46 102.87) (end 125.73 101.6) (width 0.8636) (layer Dessous) (net 7))
|
||||
(segment (start 161.925 113.03) (end 165.1 113.03) (width 0.8636) (layer Dessous) (net 8) (status 400))
|
||||
(segment (start 131.445 128.905) (end 140.97 128.905) (width 0.8636) (layer Dessous) (net 9) (status C00))
|
||||
(segment (start 143.61668 111.00816) (end 143.61668 111.65332) (width 0.8636) (layer Dessous) (net 9) (status 800))
|
||||
(segment (start 143.51 127.635) (end 143.51 116.84) (width 0.8636) (layer Dessous) (net 9))
|
||||
(segment (start 142.24 128.905) (end 143.51 127.635) (width 0.8636) (layer Dessous) (net 9))
|
||||
(segment (start 140.97 128.905) (end 142.24 128.905) (width 0.8636) (layer Dessous) (net 9) (status 800))
|
||||
(segment (start 143.61668 111.65332) (end 142.875 112.395) (width 0.8636) (layer Dessous) (net 9))
|
||||
(segment (start 142.875 112.395) (end 142.875 116.205) (width 0.8636) (layer Dessous) (net 9))
|
||||
(segment (start 159.9438 111.0488) (end 161.925 113.03) (width 0.8636) (layer Dessous) (net 8))
|
||||
(segment (start 165.1 113.03) (end 165.1 116.205) (width 0.8636) (layer Dessous) (net 8) (status C00))
|
||||
(segment (start 154.83332 111.0488) (end 159.9438 111.0488) (width 0.8636) (layer Dessous) (net 8) (status 800))
|
||||
(segment (start 142.875 116.205) (end 143.51 116.84) (width 0.8636) (layer Dessous) (net 9))
|
||||
(segment (start 142.875 112.395) (end 142.875 116.205) (width 0.8636) (layer Dessous) (net 9))
|
||||
(segment (start 143.61668 111.65332) (end 142.875 112.395) (width 0.8636) (layer Dessous) (net 9))
|
||||
(segment (start 140.97 128.905) (end 142.24 128.905) (width 0.8636) (layer Dessous) (net 9) (status 800))
|
||||
(segment (start 142.24 128.905) (end 143.51 127.635) (width 0.8636) (layer Dessous) (net 9))
|
||||
(segment (start 143.51 127.635) (end 143.51 116.84) (width 0.8636) (layer Dessous) (net 9))
|
||||
(segment (start 143.61668 111.00816) (end 143.61668 111.65332) (width 0.8636) (layer Dessous) (net 9) (status 800))
|
||||
(segment (start 131.445 128.905) (end 140.97 128.905) (width 0.8636) (layer Dessous) (net 9) (status C00))
|
||||
|
||||
(zone (net 1) (net_name GND) (layer Dessous) (tstamp 4EED96A1) (hatch edge 0.508)
|
||||
(connect_pads (clearance 0.635))
|
||||
|
|
|
@ -8,8 +8,44 @@
|
|||
#include <pcbstruct.h> // NB_COLORS
|
||||
#include <class_pad.h>
|
||||
#include <class_track.h>
|
||||
#include <class_netclass.h>
|
||||
#include <config_params.h>
|
||||
|
||||
/**
|
||||
* Struct VIA_DIMENSION
|
||||
* is a small helper container to handle a stock of specific vias each with
|
||||
* unique diameter and drill sizes in the BOARD class.
|
||||
*/
|
||||
struct VIA_DIMENSION
|
||||
{
|
||||
int m_Diameter; // <= 0 means use Netclass via diameter
|
||||
int m_Drill; // <= 0 means use Netclass via drill
|
||||
|
||||
VIA_DIMENSION()
|
||||
{
|
||||
m_Diameter = 0;
|
||||
m_Drill = 0;
|
||||
}
|
||||
|
||||
VIA_DIMENSION( int aDiameter, int aDrill )
|
||||
{
|
||||
m_Diameter = aDiameter;
|
||||
m_Drill = aDrill;
|
||||
}
|
||||
|
||||
bool operator==( const VIA_DIMENSION& aOther ) const
|
||||
{
|
||||
return ( m_Diameter == aOther.m_Diameter ) && ( m_Drill == aOther.m_Drill );
|
||||
}
|
||||
|
||||
bool operator<( const VIA_DIMENSION& aOther ) const
|
||||
{
|
||||
if( m_Diameter != aOther.m_Diameter )
|
||||
return m_Diameter < aOther.m_Diameter;
|
||||
|
||||
return m_Drill < aOther.m_Drill;
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Class BOARD_DESIGN_SETTINGS
|
||||
|
@ -18,6 +54,17 @@
|
|||
class BOARD_DESIGN_SETTINGS
|
||||
{
|
||||
public:
|
||||
// The first value is the current netclass via size
|
||||
/// Vias size and drill list
|
||||
std::vector<VIA_DIMENSION> m_ViasDimensionsList;
|
||||
|
||||
// The first value is the current netclass track width
|
||||
/// Track width list
|
||||
std::vector<int> m_TrackWidthList;
|
||||
|
||||
/// List of current netclasses. There is always the default netclass.
|
||||
NETCLASSES m_NetClasses;
|
||||
|
||||
bool m_MicroViasAllowed; ///< true to allow micro vias
|
||||
bool m_BlindBuriedViaAllowed; ///< true to allow blind/buried vias
|
||||
VIATYPE_T m_CurrentViaType; ///< via type (VIA_BLIND_BURIED, VIA_THROUGH VIA_MICROVIA)
|
||||
|
@ -52,15 +99,216 @@ public:
|
|||
|
||||
D_PAD m_Pad_Master;
|
||||
|
||||
public:
|
||||
BOARD_DESIGN_SETTINGS();
|
||||
|
||||
/**
|
||||
* Function GetDefault
|
||||
* @return the default netclass.
|
||||
*/
|
||||
inline NETCLASS* GetDefault() const
|
||||
{
|
||||
return m_NetClasses.GetDefault();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetCurrentNetClassName
|
||||
* @return the current net class name.
|
||||
*/
|
||||
const wxString& GetCurrentNetClassName() const
|
||||
{
|
||||
return m_currentNetClassName;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetCurrentNetClass
|
||||
* Must be called after a netclass selection (or after a netclass parameter change
|
||||
* Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar
|
||||
* and some others parameters (netclass name ....)
|
||||
* @param aNetClassName = the new netclass name
|
||||
* @return true if lists of tracks and vias sizes are modified
|
||||
*/
|
||||
bool SetCurrentNetClass( const wxString& aNetClassName );
|
||||
|
||||
/**
|
||||
* Function GetBiggestClearanceValue
|
||||
* @return the biggest clearance value found in NetClasses list
|
||||
*/
|
||||
int GetBiggestClearanceValue();
|
||||
|
||||
/**
|
||||
* Function GetSmallestClearanceValue
|
||||
* @return the smallest clearance value found in NetClasses list
|
||||
*/
|
||||
int GetSmallestClearanceValue();
|
||||
|
||||
/**
|
||||
* Function GetCurrentMicroViaSize
|
||||
* @return the current micro via size,
|
||||
* that is the current netclass value
|
||||
*/
|
||||
int GetCurrentMicroViaSize();
|
||||
|
||||
/**
|
||||
* Function GetCurrentMicroViaDrill
|
||||
* @return the current micro via drill,
|
||||
* that is the current netclass value
|
||||
*/
|
||||
int GetCurrentMicroViaDrill();
|
||||
|
||||
/**
|
||||
* Function GetTrackWidthIndex
|
||||
* @return the current track width list index.
|
||||
*/
|
||||
unsigned GetTrackWidthIndex() const { return m_trackWidthIndex; }
|
||||
|
||||
/**
|
||||
* Function SetTrackWidthIndex
|
||||
* sets the current track width list index to \a aIndex.
|
||||
*
|
||||
* @param aIndex is the track width list index.
|
||||
*/
|
||||
void SetTrackWidthIndex( unsigned aIndex );
|
||||
|
||||
/**
|
||||
* Function GetCurrentTrackWidth
|
||||
* @return the current track width, according to the selected options
|
||||
* ( using the default netclass value or a preset/custom value )
|
||||
* the default netclass is always in m_TrackWidthList[0]
|
||||
*/
|
||||
int GetCurrentTrackWidth() const
|
||||
{
|
||||
return m_useCustomTrackVia ? m_customTrackWidth : m_TrackWidthList[m_trackWidthIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetCustomTrackWidth
|
||||
* Sets custom width for track (i.e. not available in netclasses or preset list). To have
|
||||
* it returned with GetCurrentTrackWidth() you need to enable custom track & via sizes
|
||||
* (UseCustomTrackViaSize()).
|
||||
* @param aWidth is the new track width.
|
||||
*/
|
||||
void SetCustomTrackWidth( int aWidth )
|
||||
{
|
||||
m_customTrackWidth = aWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetCustomTrackWidth
|
||||
* @return Current custom width for a track.
|
||||
*/
|
||||
int GetCustomTrackWidth() const
|
||||
{
|
||||
return m_customTrackWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetViaSizeIndex
|
||||
* @return the current via size list index.
|
||||
*/
|
||||
unsigned GetViaSizeIndex() const { return m_viaSizeIndex; }
|
||||
|
||||
/**
|
||||
* Function SetViaSizeIndex
|
||||
* sets the current via size list index to \a aIndex.
|
||||
*
|
||||
* @param aIndex is the via size list index.
|
||||
*/
|
||||
void SetViaSizeIndex( unsigned aIndex );
|
||||
|
||||
/**
|
||||
* Function GetCurrentViaSize
|
||||
* @return the current via size, according to the selected options
|
||||
* ( using the default netclass value or a preset/custom value )
|
||||
* the default netclass is always in m_TrackWidthList[0]
|
||||
*/
|
||||
int GetCurrentViaSize() const
|
||||
{
|
||||
if( m_useCustomTrackVia )
|
||||
return m_customViaSize.m_Diameter;
|
||||
else
|
||||
return m_ViasDimensionsList[m_viaSizeIndex].m_Diameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetCustomViaSize
|
||||
* Sets custom size for via diameter (i.e. not available in netclasses or preset list). To have
|
||||
* it returned with GetCurrentViaSize() you need to enable custom track & via sizes
|
||||
* (UseCustomTrackViaSize()).
|
||||
* @param aSize is the new drill diameter.
|
||||
*/
|
||||
void SetCustomViaSize( int aSize )
|
||||
{
|
||||
m_customViaSize.m_Diameter = aSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetCustomViaSize
|
||||
* @return Current custom size for the via diameter.
|
||||
*/
|
||||
int GetCustomViaSize() const
|
||||
{
|
||||
return m_customViaSize.m_Diameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetCurrentViaDrill
|
||||
* @return the current via size, according to the selected options
|
||||
* ( using the default netclass value or a preset/custom value )
|
||||
* the default netclass is always in m_TrackWidthList[0]
|
||||
*/
|
||||
int GetCurrentViaDrill() const;
|
||||
|
||||
/**
|
||||
* Function SetCustomViaDrill
|
||||
* Sets custom size for via drill (i.e. not available in netclasses or preset list). To have
|
||||
* it returned with GetCurrentViaDrill() you need to enable custom track & via sizes
|
||||
* (UseCustomTrackViaSize()).
|
||||
* @param aDrill is the new drill size.
|
||||
*/
|
||||
void SetCustomViaDrill( int aDrill )
|
||||
{
|
||||
m_customViaSize.m_Drill = aDrill;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetCustomViaDrill
|
||||
* @return Current custom size for the via drill.
|
||||
*/
|
||||
int GetCustomViaDrill() const
|
||||
{
|
||||
return m_customViaSize.m_Drill;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function UseCustomTrackViaSize
|
||||
* Enables/disables custom track/via size settings. If enabled, values set with
|
||||
* SetCustomTrackWidth()/SetCustomViaSize()/SetCustomViaDrill() are used for newly created
|
||||
* tracks and vias.
|
||||
* @param aEnabled decides if custom settings should be used for new tracks/vias.
|
||||
*/
|
||||
void UseCustomTrackViaSize( bool aEnabled )
|
||||
{
|
||||
m_useCustomTrackVia = aEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function UseCustomTrackViaSize
|
||||
* @return True if custom sizes of tracks & vias are enabled, false otherwise.
|
||||
*/
|
||||
bool UseCustomTrackViaSize() const
|
||||
{
|
||||
return m_useCustomTrackVia;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetVisibleLayers
|
||||
* returns a bit-mask of all the layers that are visible
|
||||
* @return int - the visible layers in bit-mapped form.
|
||||
*/
|
||||
LAYER_MSK GetVisibleLayers() const;
|
||||
LAYER_MSK GetVisibleLayers() const
|
||||
{
|
||||
return m_visibleLayers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetVisibleAlls
|
||||
|
@ -74,7 +322,10 @@ public:
|
|||
* changes the bit-mask of visible layers
|
||||
* @param aMask = The new bit-mask of visible layers
|
||||
*/
|
||||
void SetVisibleLayers( LAYER_MSK aMask );
|
||||
void SetVisibleLayers( LAYER_MSK aMask )
|
||||
{
|
||||
m_visibleLayers = aMask & m_enabledLayers & FULL_LAYERS;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function IsLayerVisible
|
||||
|
@ -85,7 +336,7 @@ public:
|
|||
bool IsLayerVisible( LAYER_NUM aLayer ) const
|
||||
{
|
||||
// If a layer is disabled, it is automatically invisible
|
||||
return m_VisibleLayers & m_EnabledLayers & GetLayerMask( aLayer );
|
||||
return m_visibleLayers & m_enabledLayers & GetLayerMask( aLayer );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -103,7 +354,7 @@ public:
|
|||
*/
|
||||
int GetVisibleElements() const
|
||||
{
|
||||
return m_VisibleElements;
|
||||
return m_visibleElements;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -113,7 +364,7 @@ public:
|
|||
*/
|
||||
void SetVisibleElements( int aMask )
|
||||
{
|
||||
m_VisibleElements = aMask;
|
||||
m_visibleElements = aMask;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,7 +379,7 @@ public:
|
|||
{
|
||||
assert( aElementCategory >= 0 && aElementCategory < END_PCB_VISIBLE_LIST );
|
||||
|
||||
return ( m_VisibleElements & ( 1 << aElementCategory ) );
|
||||
return ( m_visibleElements & ( 1 << aElementCategory ) );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -147,7 +398,7 @@ public:
|
|||
*/
|
||||
inline LAYER_MSK GetEnabledLayers() const
|
||||
{
|
||||
return m_EnabledLayers;
|
||||
return m_enabledLayers;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -165,7 +416,7 @@ public:
|
|||
*/
|
||||
bool IsLayerEnabled( LAYER_NUM aLayer ) const
|
||||
{
|
||||
return m_EnabledLayers & GetLayerMask( aLayer );
|
||||
return m_enabledLayers & GetLayerMask( aLayer );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -174,7 +425,7 @@ public:
|
|||
*/
|
||||
int GetCopperLayerCount() const
|
||||
{
|
||||
return m_CopperLayerCount;
|
||||
return m_copperLayerCount;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -196,11 +447,35 @@ public:
|
|||
void SetBoardThickness( int aThickness ) { m_boardThickness = aThickness; }
|
||||
|
||||
private:
|
||||
int m_CopperLayerCount; ///< Number of copper layers for this design
|
||||
LAYER_MSK m_EnabledLayers; ///< Bit-mask for layer enabling
|
||||
LAYER_MSK m_VisibleLayers; ///< Bit-mask for layer visibility
|
||||
int m_VisibleElements; ///< Bit-mask for element category visibility
|
||||
/// Index for #m_ViasDimensionsList to select the current via size.
|
||||
/// 0 is the index selection of the default value Netclass
|
||||
unsigned m_viaSizeIndex;
|
||||
|
||||
// Index for m_TrackWidthList to select the value.
|
||||
/// 0 is the index selection of the default value Netclass
|
||||
unsigned m_trackWidthIndex;
|
||||
|
||||
///> Use custom values for track/via sizes (not specified in net class nor in the size lists).
|
||||
bool m_useCustomTrackVia;
|
||||
|
||||
///> Custom track width (used after UseCustomTrackViaSize( true ) was called).
|
||||
int m_customTrackWidth;
|
||||
|
||||
///> Custom via size (used after UseCustomTrackViaSize( true ) was called).
|
||||
VIA_DIMENSION m_customViaSize;
|
||||
|
||||
int m_copperLayerCount; ///< Number of copper layers for this design
|
||||
LAYER_MSK m_enabledLayers; ///< Bit-mask for layer enabling
|
||||
LAYER_MSK m_visibleLayers; ///< Bit-mask for layer visibility
|
||||
int m_visibleElements; ///< Bit-mask for element category visibility
|
||||
int m_boardThickness; ///< Board thickness for 3D viewer
|
||||
|
||||
/// Current net class name used to display netclass info.
|
||||
/// This is also the last used netclass after starting a track.
|
||||
wxString m_currentNetClassName;
|
||||
|
||||
void formatNetClass( NETCLASS* aNetClass, OUTPUTFORMATTER* aFormatter, int aNestLevel,
|
||||
int aControlBits ) const throw( IO_ERROR );
|
||||
};
|
||||
|
||||
#endif // BOARD_DESIGN_SETTINGS_H_
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
|
@ -111,9 +111,16 @@ public:
|
|||
m_eventDispatcher = aEventDispatcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function StartDrawing()
|
||||
* Begins drawing if it was stopped previously.
|
||||
*/
|
||||
void StartDrawing();
|
||||
|
||||
/**
|
||||
* Function StopDrawing()
|
||||
* Prevents the GAL canvas from further drawing till it is recreated.
|
||||
* Prevents the GAL canvas from further drawing till it is recreated
|
||||
* or StartDrawing() is called.
|
||||
*/
|
||||
void StopDrawing();
|
||||
|
||||
|
|
|
@ -135,7 +135,7 @@ public:
|
|||
virtual void Flush();
|
||||
|
||||
/// @copydoc GAL::ClearScreen()
|
||||
virtual void ClearScreen();
|
||||
virtual void ClearScreen( const COLOR4D& aColor );
|
||||
|
||||
// -----------------
|
||||
// Attribute setting
|
||||
|
@ -333,6 +333,7 @@ private:
|
|||
unsigned int* bitmapBufferBackup; ///< Backup storage of the cairo image
|
||||
int stride; ///< Stride value for Cairo
|
||||
bool isInitialized; ///< Are Cairo image & surface ready to use
|
||||
COLOR4D backgroundColor; ///< Background color
|
||||
|
||||
// Methods
|
||||
void storePath(); ///< Store the actual path
|
||||
|
|
|
@ -168,8 +168,11 @@ public:
|
|||
/// @brief Force all remaining objects to be drawn.
|
||||
virtual void Flush() = 0;
|
||||
|
||||
/// @brief Clear the screen.
|
||||
virtual void ClearScreen() = 0;
|
||||
/**
|
||||
* @brief Clear the screen.
|
||||
* @param aColor is the color used for clearing.
|
||||
*/
|
||||
virtual void ClearScreen( const COLOR4D& aColor ) = 0;
|
||||
|
||||
// -----------------
|
||||
// Attribute setting
|
||||
|
@ -225,16 +228,6 @@ public:
|
|||
return strokeColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the background color.
|
||||
*
|
||||
* @param aColor is the color for background filling.
|
||||
*/
|
||||
inline virtual void SetBackgroundColor( const COLOR4D& aColor )
|
||||
{
|
||||
backgroundColor = aColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the line width.
|
||||
*
|
||||
|
@ -849,7 +842,6 @@ protected:
|
|||
bool isFillEnabled; ///< Is filling of graphic objects enabled ?
|
||||
bool isStrokeEnabled; ///< Are the outlines stroked ?
|
||||
|
||||
COLOR4D backgroundColor; ///< The background color
|
||||
COLOR4D fillColor; ///< The fill color
|
||||
COLOR4D strokeColor; ///< The color of the outlines
|
||||
|
||||
|
|
|
@ -143,7 +143,7 @@ public:
|
|||
virtual void Flush();
|
||||
|
||||
/// @copydoc GAL::ClearScreen()
|
||||
virtual void ClearScreen();
|
||||
virtual void ClearScreen( const COLOR4D& aColor );
|
||||
|
||||
// --------------
|
||||
// Transformation
|
||||
|
|
|
@ -46,17 +46,14 @@ public:
|
|||
* to an object the segment belongs to (e.g. a line chain) or references to locally stored
|
||||
* points (m_a, m_b).
|
||||
*/
|
||||
VECTOR2I& A;
|
||||
VECTOR2I& B;
|
||||
VECTOR2I A;
|
||||
VECTOR2I B;
|
||||
|
||||
/** Default constructor
|
||||
* Creates an empty (0, 0) segment, locally-referenced
|
||||
*/
|
||||
SEG() : A( m_a ), B( m_b )
|
||||
SEG()
|
||||
{
|
||||
A = m_a;
|
||||
B = m_b;
|
||||
m_is_local = true;
|
||||
m_index = -1;
|
||||
}
|
||||
|
||||
|
@ -64,13 +61,10 @@ public:
|
|||
* Constructor
|
||||
* Creates a segment between (aX1, aY1) and (aX2, aY2), locally referenced
|
||||
*/
|
||||
SEG( int aX1, int aY1, int aX2, int aY2 ) : A( m_a ), B( m_b )
|
||||
SEG( int aX1, int aY1, int aX2, int aY2 ) :
|
||||
A ( VECTOR2I( aX1, aY1 ) ),
|
||||
B ( VECTOR2I( aX2, aY2 ) )
|
||||
{
|
||||
m_a = VECTOR2I( aX1, aY1 );
|
||||
m_b = VECTOR2I( aX2, aY2 );
|
||||
A = m_a;
|
||||
B = m_b;
|
||||
m_is_local = true;
|
||||
m_index = -1;
|
||||
}
|
||||
|
||||
|
@ -78,11 +72,8 @@ public:
|
|||
* Constructor
|
||||
* Creates a segment between (aA) and (aB), locally referenced
|
||||
*/
|
||||
SEG( const VECTOR2I& aA, const VECTOR2I& aB ) : A( m_a ), B( m_b ), m_a( aA ), m_b( aB )
|
||||
SEG( const VECTOR2I& aA, const VECTOR2I& aB ) : A( aA ), B( aB )
|
||||
{
|
||||
A = m_a;
|
||||
B = m_b;
|
||||
m_is_local = true;
|
||||
m_index = -1;
|
||||
}
|
||||
|
||||
|
@ -93,43 +84,23 @@ public:
|
|||
* @param aB reference to the end point in the parent shape
|
||||
* @param aIndex index of the segment within the parent shape
|
||||
*/
|
||||
SEG ( VECTOR2I& aA, VECTOR2I& aB, int aIndex ) : A( aA ), B( aB )
|
||||
SEG ( const VECTOR2I& aA, const VECTOR2I& aB, int aIndex ) : A( aA ), B( aB )
|
||||
{
|
||||
m_is_local = false;
|
||||
m_index = aIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Copy constructor
|
||||
*/
|
||||
SEG ( const SEG& aSeg ) : A( m_a ), B( m_b )
|
||||
SEG ( const SEG& aSeg ) : A( aSeg.A ), B( aSeg.B ), m_index ( aSeg.m_index )
|
||||
{
|
||||
if( aSeg.m_is_local )
|
||||
{
|
||||
m_a = aSeg.m_a;
|
||||
m_b = aSeg.m_b;
|
||||
A = m_a;
|
||||
B = m_b;
|
||||
m_is_local = true;
|
||||
m_index = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
A = aSeg.A;
|
||||
B = aSeg.B;
|
||||
m_index = aSeg.m_index;
|
||||
m_is_local = false;
|
||||
}
|
||||
}
|
||||
|
||||
SEG& operator=( const SEG& aSeg )
|
||||
{
|
||||
A = aSeg.A;
|
||||
B = aSeg.B;
|
||||
m_a = aSeg.m_a;
|
||||
m_b = aSeg.m_b;
|
||||
m_index = aSeg.m_index;
|
||||
m_is_local = aSeg.m_is_local;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
@ -244,14 +215,14 @@ public:
|
|||
*/
|
||||
bool Collinear( const SEG& aSeg ) const
|
||||
{
|
||||
ecoord qa = A.y - B.y;
|
||||
ecoord qb = B.x - A.x;
|
||||
ecoord qc = -qa * A.x - qb * A.y;
|
||||
ecoord qa1 = A.y - B.y;
|
||||
ecoord qb1 = B.x - A.x;
|
||||
ecoord qc1 = -qa1 * A.x - qb1 * A.y;
|
||||
ecoord qa2 = aSeg.A.y - aSeg.B.y;
|
||||
ecoord qb2 = aSeg.B.x - aSeg.A.x;
|
||||
ecoord qc2 = -qa2 * aSeg.A.x - qb2 * aSeg.A.y;
|
||||
|
||||
ecoord d1 = std::abs( aSeg.A.x * qa + aSeg.A.y * qb + qc );
|
||||
ecoord d2 = std::abs( aSeg.B.x * qa + aSeg.B.y * qb + qc );
|
||||
|
||||
return ( d1 <= 1 && d2 <= 1 );
|
||||
return ( qa1 == qa2 ) && ( qb1 == qb2 ) && ( qc1 == qc2 );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -289,14 +260,8 @@ public:
|
|||
private:
|
||||
bool ccw( const VECTOR2I& aA, const VECTOR2I& aB, const VECTOR2I &aC ) const;
|
||||
|
||||
///> locally stored start/end coordinates (used when m_is_local == true)
|
||||
VECTOR2I m_a, m_b;
|
||||
|
||||
///> index withing the parent shape (used when m_is_local == false)
|
||||
int m_index;
|
||||
|
||||
///> locality flag
|
||||
bool m_is_local;
|
||||
};
|
||||
|
||||
|
||||
|
@ -344,8 +309,7 @@ inline const VECTOR2I SEG::NearestPoint( const VECTOR2I& aP ) const
|
|||
|
||||
inline std::ostream& operator<<( std::ostream& aStream, const SEG& aSeg )
|
||||
{
|
||||
if( aSeg.m_is_local )
|
||||
aStream << "[ local " << aSeg.A << " - " << aSeg.B << " ]";
|
||||
aStream << "[ " << aSeg.A << " - " << aSeg.B << " ]";
|
||||
|
||||
return aStream;
|
||||
}
|
||||
|
|
|
@ -38,9 +38,20 @@ public:
|
|||
SHAPE( SH_CIRCLE ), m_radius( aRadius ), m_center( aCenter )
|
||||
{}
|
||||
|
||||
SHAPE_CIRCLE ( const SHAPE_CIRCLE& aOther ) :
|
||||
SHAPE( SH_CIRCLE ),
|
||||
m_radius( aOther.m_radius ),
|
||||
m_center( aOther.m_center )
|
||||
{};
|
||||
|
||||
~SHAPE_CIRCLE()
|
||||
{}
|
||||
|
||||
SHAPE* Clone() const
|
||||
{
|
||||
return new SHAPE_CIRCLE( *this );
|
||||
}
|
||||
|
||||
const BOX2I BBox( int aClearance = 0 ) const
|
||||
{
|
||||
const VECTOR2I rc( m_radius + aClearance, m_radius + aClearance );
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
template <class T>
|
||||
static const SHAPE* shapeFunctor( T aItem )
|
||||
{
|
||||
return aItem->GetShape();
|
||||
return aItem->Shape();
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
template <class T>
|
||||
const SHAPE* defaultShapeFunctor( const T aItem )
|
||||
{
|
||||
return aItem->GetShape();
|
||||
return aItem->Shape();
|
||||
}
|
||||
|
||||
template <class T, const SHAPE* (ShapeFunctor) (const T) = defaultShapeFunctor<T> >
|
||||
|
|
|
@ -116,6 +116,8 @@ public:
|
|||
~SHAPE_LINE_CHAIN()
|
||||
{}
|
||||
|
||||
SHAPE* Clone() const;
|
||||
|
||||
/**
|
||||
* Function Clear()
|
||||
* Removes all points from the line chain.
|
||||
|
@ -366,6 +368,11 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
void Insert( int aVertex, const VECTOR2I& aP )
|
||||
{
|
||||
m_points.insert( m_points.begin() + aVertex, aP );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Replace()
|
||||
*
|
||||
|
@ -417,6 +424,15 @@ public:
|
|||
*/
|
||||
int Find( const VECTOR2I& aP ) const;
|
||||
|
||||
/**
|
||||
* Function FindSegment()
|
||||
*
|
||||
* Searches for segment containing point aP.
|
||||
* @param aP the point to be looked for
|
||||
* @return index of the correspoinding segment in the line chain or negative when not found.
|
||||
*/
|
||||
int FindSegment( const VECTOR2I& aP ) const;
|
||||
|
||||
/**
|
||||
* Function Slice()
|
||||
*
|
||||
|
@ -429,7 +445,7 @@ public:
|
|||
|
||||
struct compareOriginDistance
|
||||
{
|
||||
compareOriginDistance( VECTOR2I& aOrigin ):
|
||||
compareOriginDistance( const VECTOR2I& aOrigin ):
|
||||
m_origin( aOrigin )
|
||||
{}
|
||||
|
||||
|
@ -441,6 +457,8 @@ public:
|
|||
VECTOR2I m_origin;
|
||||
};
|
||||
|
||||
bool Intersects( const SHAPE_LINE_CHAIN& aChain ) const;
|
||||
|
||||
/**
|
||||
* Function Intersect()
|
||||
*
|
||||
|
@ -533,6 +551,8 @@ public:
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CompareGeometry( const SHAPE_LINE_CHAIN & aOther ) const;
|
||||
|
||||
private:
|
||||
/// array of vertices
|
||||
std::vector<VECTOR2I> m_points;
|
||||
|
|
|
@ -57,6 +57,18 @@ public:
|
|||
SHAPE( SH_RECT ), m_p0( aP0 ), m_w( aW ), m_h( aH )
|
||||
{}
|
||||
|
||||
SHAPE_RECT ( const SHAPE_RECT& aOther ) :
|
||||
SHAPE( SH_RECT ),
|
||||
m_p0( aOther.m_p0 ),
|
||||
m_w( aOther.m_w ),
|
||||
m_h( aOther.m_h )
|
||||
{};
|
||||
|
||||
SHAPE* Clone() const
|
||||
{
|
||||
return new SHAPE_RECT( *this );
|
||||
}
|
||||
|
||||
/// @copydoc SHAPE::BBox()
|
||||
const BOX2I BBox( int aClearance = 0 ) const
|
||||
{
|
||||
|
|
|
@ -0,0 +1,90 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef __SHAPE_SEGMENT_H
|
||||
#define __SHAPE_SEGMENT_H
|
||||
|
||||
#include <geometry/shape.h>
|
||||
#include <geometry/seg.h>
|
||||
|
||||
class SHAPE_SEGMENT : public SHAPE {
|
||||
|
||||
public:
|
||||
SHAPE_SEGMENT():
|
||||
SHAPE( SH_SEGMENT ), m_width( 0 ) {};
|
||||
|
||||
SHAPE_SEGMENT( const VECTOR2I& aA, const VECTOR2I& aB, int aWidth = 0 ):
|
||||
SHAPE( SH_SEGMENT ), m_seg( aA, aB ), m_width( aWidth ) {};
|
||||
|
||||
SHAPE_SEGMENT( const SEG& aSeg, int aWidth = 0 ):
|
||||
SHAPE( SH_SEGMENT ), m_seg( aSeg ), m_width( aWidth ) {};
|
||||
|
||||
~SHAPE_SEGMENT() {};
|
||||
|
||||
SHAPE* Clone() const
|
||||
{
|
||||
return new SHAPE_SEGMENT( m_seg, m_width );
|
||||
}
|
||||
|
||||
const BOX2I BBox( int aClearance = 0 ) const
|
||||
{
|
||||
return BOX2I( m_seg.A, m_seg.B - m_seg.A ).Inflate( aClearance + m_width / 2 );
|
||||
}
|
||||
|
||||
bool Collide( const SEG& aSeg, int aClearance = 0 ) const
|
||||
{
|
||||
return m_seg.Distance( aSeg ) <= m_width / 2 + aClearance;
|
||||
}
|
||||
|
||||
bool Collide( const VECTOR2I& aP, int aClearance = 0 ) const
|
||||
{
|
||||
return m_seg.Distance( aP ) <= m_width / 2 + aClearance;
|
||||
}
|
||||
|
||||
void SetSeg ( const SEG& aSeg )
|
||||
{
|
||||
m_seg = aSeg;
|
||||
}
|
||||
|
||||
const SEG& GetSeg () const
|
||||
{
|
||||
return m_seg;
|
||||
}
|
||||
|
||||
void SetWidth ( int aWidth )
|
||||
{
|
||||
m_width = aWidth;
|
||||
}
|
||||
|
||||
int GetWidth() const
|
||||
{
|
||||
return m_width;
|
||||
}
|
||||
|
||||
private:
|
||||
SEG m_seg;
|
||||
int m_width;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -40,6 +40,11 @@ T rescale( T aNumerator, T aValue, T aDenominator )
|
|||
return aNumerator * aValue / aDenominator;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
int sign( T val )
|
||||
{
|
||||
return ( T( 0 ) < val) - ( val < T( 0 ) );
|
||||
}
|
||||
|
||||
// explicit specializations for integer types, taking care of overflow.
|
||||
template <>
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#ifndef VECTOR2D_H_
|
||||
#define VECTOR2D_H_
|
||||
|
||||
#include <cmath>
|
||||
#include <climits>
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
@ -376,7 +377,7 @@ VECTOR2<T> VECTOR2<T>::Resize( T aNewLength ) const
|
|||
|
||||
return VECTOR2<T> (
|
||||
( x < 0 ? -1 : 1 ) * sqrt( rescale( l_sq_new, (extended_type) x * x, l_sq_current ) ),
|
||||
( y < 0 ? -1 : 1 ) * sqrt( rescale( l_sq_new, (extended_type) y * y, l_sq_current ) ) );
|
||||
( y < 0 ? -1 : 1 ) * sqrt( rescale( l_sq_new, (extended_type) y * y, l_sq_current ) ) ) * sign( aNewLength );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -177,6 +177,36 @@ public:
|
|||
return m_worksheetLineWidth;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function TranslateColor
|
||||
* Returns the color responding to the one of EDA_COLOR_T enum values.
|
||||
* @param EDA_COLOR_T color equivalent.
|
||||
*/
|
||||
const COLOR4D& TranslateColor( EDA_COLOR_T aColor )
|
||||
{
|
||||
return m_legacyColorMap[aColor];
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetBackgroundColor
|
||||
* Returns current background color settings.
|
||||
* @return Background color.
|
||||
*/
|
||||
const COLOR4D& GetBackgroundColor() const
|
||||
{
|
||||
return m_backgroundColor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetBackgroundColor
|
||||
* Sets new color for background.
|
||||
* @param aColor is the new background color.
|
||||
*/
|
||||
void SetBackgroundColor( const COLOR4D& aColor )
|
||||
{
|
||||
m_backgroundColor = aColor;
|
||||
}
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Function update
|
||||
|
@ -203,6 +233,8 @@ protected:
|
|||
float m_outlineWidth; ///< Line width used when drawing outlines
|
||||
float m_worksheetLineWidth; ///< Line width used when drawing worksheet
|
||||
|
||||
COLOR4D m_backgroundColor; ///< The background color
|
||||
|
||||
/// Map of colors that were usually used for display
|
||||
std::map<EDA_COLOR_T, COLOR4D> m_legacyColorMap;
|
||||
};
|
||||
|
|
|
@ -28,6 +28,7 @@
|
|||
#include <wx/menu.h>
|
||||
#include <tool/tool_action.h>
|
||||
#include <map>
|
||||
#include <boost/function.hpp>
|
||||
|
||||
class TOOL_INTERACTIVE;
|
||||
|
||||
|
@ -37,7 +38,7 @@ class TOOL_INTERACTIVE;
|
|||
* Defines the structure of a context (usually right-click) popup menu
|
||||
* for a given tool.
|
||||
*/
|
||||
class CONTEXT_MENU
|
||||
class CONTEXT_MENU : public wxMenu
|
||||
{
|
||||
public:
|
||||
///> Default constructor
|
||||
|
@ -71,6 +72,7 @@ public:
|
|||
*/
|
||||
void Add( const TOOL_ACTION& aAction );
|
||||
|
||||
|
||||
/**
|
||||
* Function Clear()
|
||||
* Removes all the entries from the menu (as well as its title). It leaves the menu in the
|
||||
|
@ -89,32 +91,29 @@ public:
|
|||
return m_selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetMenu()
|
||||
* Returns the instance of wxMenu object used to display the menu.
|
||||
*/
|
||||
wxMenu* GetMenu() const
|
||||
protected:
|
||||
void setCustomEventHandler( boost::function<OPT_TOOL_EVENT(const wxEvent&)> aHandler )
|
||||
{
|
||||
return const_cast<wxMenu*>( &m_menu );
|
||||
m_customHandler = aHandler;
|
||||
}
|
||||
|
||||
virtual OPT_TOOL_EVENT handleCustomEvent(const wxEvent& aEvent )
|
||||
{
|
||||
return OPT_TOOL_EVENT();
|
||||
}
|
||||
|
||||
private:
|
||||
///> Class CMEventHandler takes care of handling menu events. After reception of particular
|
||||
///> events, it translates them to TOOL_EVENTs that may control tools.
|
||||
class CMEventHandler : public wxEvtHandler
|
||||
{
|
||||
public:
|
||||
///> Default constructor
|
||||
///> aMenu is the CONTEXT_MENU instance for which it handles events.
|
||||
CMEventHandler( CONTEXT_MENU* aMenu ) : m_menu( aMenu ) {};
|
||||
/**
|
||||
* Function copyItem
|
||||
* Copies all properties of a menu entry to another.
|
||||
*/
|
||||
void copyItem( const wxMenuItem* aSource, wxMenuItem* aDest ) const;
|
||||
|
||||
///> Handler for menu events.
|
||||
void onEvent( wxEvent& aEvent );
|
||||
///> Initializes handlers for events.
|
||||
void setupEvents();
|
||||
|
||||
private:
|
||||
///> CONTEXT_MENU instance for which it handles events.
|
||||
CONTEXT_MENU* m_menu;
|
||||
};
|
||||
///> Event handler.
|
||||
void onMenuEvent( wxEvent& aEvent );
|
||||
|
||||
friend class TOOL_INTERACTIVE;
|
||||
|
||||
|
@ -128,25 +127,14 @@ private:
|
|||
m_tool = aTool;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function getHotKeyDescription()
|
||||
* Returns a hot key in the string format accepted by wxMenu.
|
||||
* @param aAction is the action with hot key to be translated..
|
||||
* @return Hot key in the string format compatible with wxMenu.
|
||||
*/
|
||||
std::string getHotKeyDescription( const TOOL_ACTION& aAction ) const;
|
||||
|
||||
///> Flag indicating that the menu title was set up.
|
||||
bool m_titleSet;
|
||||
|
||||
///> Instance of wxMenu used for display of the context menu.
|
||||
wxMenu m_menu;
|
||||
|
||||
///> Stores the id number of selected item.
|
||||
int m_selected;
|
||||
|
||||
///> Instance of menu event handler.
|
||||
CMEventHandler m_handler;
|
||||
//CMEventHandler m_handler;
|
||||
|
||||
///> Creator of the menu
|
||||
TOOL_INTERACTIVE* m_tool;
|
||||
|
@ -156,6 +144,9 @@ private:
|
|||
|
||||
/// Associates tool actions with menu item IDs. Non-owning.
|
||||
std::map<int, const TOOL_ACTION*> m_toolActions;
|
||||
|
||||
/// Custom events handler, allows to translate wxEvents to TOOL_EVENTs.
|
||||
boost::function<OPT_TOOL_EVENT(const wxEvent& aEvent)> m_customHandler;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -52,12 +52,12 @@ public:
|
|||
m_currentHotKey( aDefaultHotKey ), m_menuItem( aMenuItem ),
|
||||
m_menuDescription( aMenuDesc ), m_id( -1 )
|
||||
{
|
||||
TOOL_MANAGER::Instance().RegisterAction( this );
|
||||
TOOL_MANAGER::GetActionList().push_back( this );
|
||||
}
|
||||
|
||||
~TOOL_ACTION()
|
||||
{
|
||||
TOOL_MANAGER::Instance().UnregisterAction( this );
|
||||
TOOL_MANAGER::GetActionList().remove( this );
|
||||
}
|
||||
|
||||
bool operator==( const TOOL_ACTION& aRhs ) const
|
||||
|
@ -195,6 +195,12 @@ private:
|
|||
m_id = aId;
|
||||
}
|
||||
|
||||
/// Assigns ACTION_MANAGER object that handles the TOOL_ACTION.
|
||||
void setActionMgr( ACTION_MANAGER* aManager )
|
||||
{
|
||||
m_actionMgr = aManager;
|
||||
}
|
||||
|
||||
/// Name of the action (convention is: app.[tool.]action.name)
|
||||
std::string m_name;
|
||||
|
||||
|
@ -219,6 +225,9 @@ private:
|
|||
/// Unique ID for fast matching. Assigned by ACTION_MANAGER.
|
||||
int m_id;
|
||||
|
||||
/// Action manager that handles this TOOL_ACTION.
|
||||
ACTION_MANAGER* m_actionMgr;
|
||||
|
||||
/// Origin of the action
|
||||
// const TOOL_BASE* m_origin;
|
||||
|
||||
|
|
|
@ -48,20 +48,10 @@ class wxWindow;
|
|||
class TOOL_MANAGER
|
||||
{
|
||||
public:
|
||||
static TOOL_MANAGER& Instance()
|
||||
{
|
||||
static TOOL_MANAGER manager;
|
||||
|
||||
return manager;
|
||||
}
|
||||
TOOL_MANAGER();
|
||||
|
||||
~TOOL_MANAGER();
|
||||
|
||||
/**
|
||||
* Deletes all the tools that were registered in the TOOL_MANAGER.
|
||||
*/
|
||||
void DeleteAll();
|
||||
|
||||
/**
|
||||
* Generates an unique ID from for a tool with given name.
|
||||
*/
|
||||
|
@ -251,9 +241,20 @@ public:
|
|||
m_passEvent = true;
|
||||
}
|
||||
|
||||
private:
|
||||
TOOL_MANAGER();
|
||||
/**
|
||||
* Returns list of TOOL_ACTIONs. TOOL_ACTIONs add themselves to the list upon their
|
||||
* creation.
|
||||
* @return List of TOOL_ACTIONs.
|
||||
*/
|
||||
static std::list<TOOL_ACTION*>& GetActionList()
|
||||
{
|
||||
// TODO I am afraid this approach won't work when we reach multitab version of kicad.
|
||||
static std::list<TOOL_ACTION*> actionList;
|
||||
|
||||
return actionList;
|
||||
}
|
||||
|
||||
private:
|
||||
struct TOOL_STATE;
|
||||
typedef std::pair<TOOL_EVENT_LIST, TOOL_STATE_FUNC> TRANSITION;
|
||||
|
||||
|
|
|
@ -507,6 +507,8 @@ public:
|
|||
*/
|
||||
void UpdateItems();
|
||||
|
||||
const BOX2I CalculateExtents() ;
|
||||
|
||||
static const int VIEW_MAX_LAYERS = 128; ///< maximum number of layers that may be shown
|
||||
|
||||
private:
|
||||
|
@ -534,6 +536,8 @@ private:
|
|||
struct unlinkItem;
|
||||
struct updateItemsColor;
|
||||
struct changeItemsDepth;
|
||||
struct extentsVisitor;
|
||||
|
||||
|
||||
///* Redraws contents within rect aRect
|
||||
void redrawRect( const BOX2I& aRect );
|
||||
|
|
|
@ -90,7 +90,7 @@ protected:
|
|||
/// main window.
|
||||
wxAuiToolBar* m_auxiliaryToolBar;
|
||||
|
||||
TOOL_MANAGER& m_toolManager;
|
||||
TOOL_MANAGER* m_toolManager;
|
||||
TOOL_DISPATCHER* m_toolDispatcher;
|
||||
|
||||
void updateGridSelectBox();
|
||||
|
|
|
@ -248,6 +248,7 @@ public:
|
|||
void OnUpdateZoneDisplayStyle( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateSelectTrackWidth( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateSelectAutoTrackWidth( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateSelectCustomTrackWidth( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateAutoPlaceModulesMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateAutoPlaceTracksMode( wxUpdateUIEvent& aEvent );
|
||||
void OnUpdateMuWaveToolbar( wxUpdateUIEvent& aEvent );
|
||||
|
|
|
@ -0,0 +1,144 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* Author: Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, you may find one here:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#ifndef WXUNITTEXT_H_
|
||||
#define WXUNITTEXT_H_
|
||||
|
||||
#include <common.h>
|
||||
#include <wx/spinbutt.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template <class T>
|
||||
class optional;
|
||||
}
|
||||
class wxTextCtrl;
|
||||
class wxSpinButton;
|
||||
class wxStaticText;
|
||||
|
||||
class WX_UNIT_TEXT : public wxPanel
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* Constructor.
|
||||
* @param aParent is the parent window.
|
||||
* @param aLabel is the label displayed next to the text input control.
|
||||
* @param aValue is the initial value for the control.
|
||||
* @param aStep is the step size when using spin buttons.
|
||||
*/
|
||||
WX_UNIT_TEXT( wxWindow* aParent, const wxString& aLabel = _( "Size:" ),
|
||||
double aValue = 0.0, double aStep = 0.1 );
|
||||
|
||||
virtual ~WX_UNIT_TEXT();
|
||||
|
||||
/**
|
||||
* Function SetUnits
|
||||
* Changes the units used by the control.
|
||||
* @param aUnits is the new unit to be used.
|
||||
* @param aConvert decides if the current value should be converted to the value in new units
|
||||
* or should it stay the same.
|
||||
*/
|
||||
void SetUnits( EDA_UNITS_T aUnits, bool aConvert = false );
|
||||
|
||||
/**
|
||||
* Function SetValue
|
||||
* Sets new value for the control.
|
||||
* @param aValue is the new value.
|
||||
*/
|
||||
virtual void SetValue( double aValue );
|
||||
|
||||
/**
|
||||
* Function GetValue
|
||||
* Returns the current value using specified units (if currently used units are different, then
|
||||
* they are converted first).
|
||||
* @param aUnits is the wanted unit.
|
||||
*/
|
||||
//virtual double GetValue( EDA_UNITS_T aUnits ) const;
|
||||
|
||||
/**
|
||||
* Function GetValue
|
||||
* Returns the current value in currently used units.
|
||||
*/
|
||||
virtual boost::optional<double> GetValue() const;
|
||||
|
||||
/**
|
||||
* Function GetUnits
|
||||
* Returns currently used units.
|
||||
*/
|
||||
EDA_UNITS_T GetUnits() const
|
||||
{
|
||||
return m_units;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetStep
|
||||
* Sets the difference introduced by a single spin button click.
|
||||
* @param aStep is new step size.
|
||||
*/
|
||||
void SetStep( double aStep )
|
||||
{
|
||||
assert( aStep > 0.0 );
|
||||
|
||||
m_step = aStep;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetStep
|
||||
* Returns the difference introduced by a single spin button click.
|
||||
*/
|
||||
double GetStep() const
|
||||
{
|
||||
return m_step;
|
||||
}
|
||||
|
||||
protected:
|
||||
///> Spin up button click event handler.
|
||||
void onSpinUpEvent( wxSpinEvent& aEvent );
|
||||
|
||||
///> Spin down button click event handler.
|
||||
void onSpinDownEvent( wxSpinEvent& aEvent );
|
||||
|
||||
///> Label for the input (e.g. "Size:")
|
||||
wxStaticText* m_inputLabel;
|
||||
|
||||
///> Text input control.
|
||||
wxTextCtrl* m_inputValue;
|
||||
|
||||
///> Spin buttons for changing the value using mouse.
|
||||
wxSpinButton* m_spinButton;
|
||||
|
||||
///> Label showing currently used units.
|
||||
wxStaticText* m_unitLabel;
|
||||
|
||||
///> Currently used units.
|
||||
EDA_UNITS_T m_units;
|
||||
|
||||
///> Step size (added/subtracted difference if spin buttons are used).
|
||||
double m_step;
|
||||
|
||||
///> Default value (or non-specified)
|
||||
static const wxString DEFAULT_VALUE;
|
||||
};
|
||||
|
||||
#endif /* WXUNITTEXT_H_ */
|
|
@ -97,6 +97,8 @@ set( PCBNEW_DIALOGS
|
|||
dialogs/dialog_netlist_fbp.cpp
|
||||
dialogs/dialog_pcb_text_properties.cpp
|
||||
dialogs/dialog_pcb_text_properties_base.cpp
|
||||
dialogs/dialog_pns_settings.cpp
|
||||
dialogs/dialog_pns_settings_base.cpp
|
||||
dialogs/dialog_non_copper_zones_properties_base.cpp
|
||||
dialogs/dialog_pad_properties.cpp
|
||||
dialogs/dialog_pad_properties_base.cpp
|
||||
|
@ -115,6 +117,8 @@ set( PCBNEW_DIALOGS
|
|||
dialogs/dialog_set_grid.cpp
|
||||
dialogs/dialog_set_grid_base.cpp
|
||||
dialogs/dialog_target_properties_base.cpp
|
||||
dialogs/dialog_track_via_size.cpp
|
||||
dialogs/dialog_track_via_size_base.cpp
|
||||
footprint_wizard.cpp
|
||||
footprint_wizard_frame.cpp
|
||||
dialogs/dialog_footprint_wizard_list_base.cpp
|
||||
|
|
|
@ -201,7 +201,7 @@ void PlaceCells( BOARD* aPcb, int net_code, int flag )
|
|||
LAYER_MSK layerMask;
|
||||
|
||||
// use the default NETCLASS?
|
||||
NETCLASS* nc = aPcb->m_NetClasses.GetDefault();
|
||||
NETCLASS* nc = aPcb->GetDesignSettings().GetDefault();
|
||||
|
||||
int trackWidth = nc->GetTrackWidth();
|
||||
int clearance = nc->GetClearance();
|
||||
|
|
|
@ -280,7 +280,7 @@ int PCB_EDIT_FRAME::Solve( wxDC* DC, int aLayersCount )
|
|||
|
||||
m_canvas->SetAbortRequest( false );
|
||||
|
||||
s_Clearance = GetBoard()->m_NetClasses.GetDefault()->GetClearance();
|
||||
s_Clearance = GetBoard()->GetDesignSettings().GetDefault()->GetClearance();
|
||||
|
||||
// Prepare the undo command info
|
||||
s_ItemsListPicker.ClearListAndDeleteItems(); // Should not be necessary, but...
|
||||
|
@ -428,7 +428,7 @@ static int Autoroute_One_Track( PCB_EDIT_FRAME* pcbframe,
|
|||
|
||||
result = NOSUCCESS;
|
||||
|
||||
marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentTrackWidth() / 2 );
|
||||
marge = s_Clearance + ( pcbframe->GetDesignSettings().GetCurrentTrackWidth() / 2 );
|
||||
|
||||
/* clear direction flags */
|
||||
i = RoutingMatrix.m_Nrows * RoutingMatrix.m_Ncols * sizeof(DIR_CELL);
|
||||
|
@ -1174,7 +1174,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
|
|||
( RoutingMatrix.m_GridRouting * col )));
|
||||
g_CurrentTrackSegment->SetEnd( g_CurrentTrackSegment->GetStart() );
|
||||
|
||||
g_CurrentTrackSegment->SetWidth( pcb->GetCurrentViaSize() );
|
||||
g_CurrentTrackSegment->SetWidth( pcb->GetDesignSettings().GetCurrentViaSize() );
|
||||
newVia->SetViaType( pcb->GetDesignSettings().m_CurrentViaType );
|
||||
|
||||
g_CurrentTrackSegment->SetNetCode( current_net_code );
|
||||
|
@ -1233,7 +1233,7 @@ static void OrCell_Trace( BOARD* pcb, int col, int row,
|
|||
}
|
||||
}
|
||||
|
||||
g_CurrentTrackSegment->SetWidth( pcb->GetCurrentTrackWidth() );
|
||||
g_CurrentTrackSegment->SetWidth( pcb->GetDesignSettings().GetCurrentTrackWidth() );
|
||||
|
||||
if( g_CurrentTrackSegment->GetStart() != g_CurrentTrackSegment->GetEnd() )
|
||||
{
|
||||
|
@ -1275,8 +1275,8 @@ static void AddNewTrace( PCB_EDIT_FRAME* pcbframe, wxDC* DC )
|
|||
EDA_DRAW_PANEL* panel = pcbframe->GetCanvas();
|
||||
PCB_SCREEN* screen = pcbframe->GetScreen();
|
||||
|
||||
marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentTrackWidth() / 2 );
|
||||
via_marge = s_Clearance + ( pcbframe->GetBoard()->GetCurrentViaSize() / 2 );
|
||||
marge = s_Clearance + ( pcbframe->GetDesignSettings().GetCurrentTrackWidth() / 2 );
|
||||
via_marge = s_Clearance + ( pcbframe->GetDesignSettings().GetCurrentViaSize() / 2 );
|
||||
|
||||
dx1 = g_CurrentTrackSegment->GetEnd().x - g_CurrentTrackSegment->GetStart().x;
|
||||
dy1 = g_CurrentTrackSegment->GetEnd().y - g_CurrentTrackSegment->GetStart().y;
|
||||
|
|
|
@ -133,10 +133,10 @@ END_EVENT_TABLE()
|
|||
PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrameType,
|
||||
const wxString& aTitle, const wxPoint& aPos, const wxSize& aSize,
|
||||
long aStyle, const wxString & aFrameName ) :
|
||||
EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName ),
|
||||
m_toolManager( TOOL_MANAGER::Instance() )
|
||||
EDA_DRAW_FRAME( aKiway, aParent, aFrameType, aTitle, aPos, aSize, aStyle, aFrameName )
|
||||
{
|
||||
m_Pcb = NULL;
|
||||
m_toolManager = NULL;
|
||||
m_toolDispatcher = NULL;
|
||||
|
||||
m_DisplayPadFill = true; // How to draw pads
|
||||
|
@ -159,6 +159,9 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
|
|||
this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||
EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO ) );
|
||||
|
||||
// GAL should not be active yet
|
||||
GetGalCanvas()->StopDrawing();
|
||||
|
||||
// Hide by default, it has to be explicitly shown
|
||||
GetGalCanvas()->Hide();
|
||||
|
||||
|
@ -832,7 +835,7 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
|
|||
}
|
||||
|
||||
// Some more required layers settings
|
||||
view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIAS_VISIBLE ) );
|
||||
view->SetRequired( ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( VIA_THROUGH_VISIBLE ) );
|
||||
view->SetRequired( ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
||||
view->SetRequired( NETNAMES_GAL_LAYER( PADS_NETNAMES_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ) );
|
||||
|
||||
|
|
|
@ -637,7 +637,7 @@ void PCB_EDIT_FRAME::GetBoardFromUndoList( wxCommandEvent& aEvent )
|
|||
|
||||
// Inform tools that undo command was issued
|
||||
TOOL_EVENT event( TC_MESSAGE, TA_UNDO_REDO, AS_GLOBAL );
|
||||
m_toolManager.ProcessEvent( event );
|
||||
m_toolManager->ProcessEvent( event );
|
||||
|
||||
/* Get the old list */
|
||||
PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromUndoList();
|
||||
|
@ -660,7 +660,7 @@ void PCB_EDIT_FRAME::GetBoardFromRedoList( wxCommandEvent& aEvent )
|
|||
|
||||
// Inform tools that redo command was issued
|
||||
TOOL_EVENT event( TC_MESSAGE, TA_UNDO_REDO, AS_GLOBAL );
|
||||
m_toolManager.ProcessEvent( event );
|
||||
m_toolManager->ProcessEvent( event );
|
||||
|
||||
/* Get the old list */
|
||||
PICKED_ITEMS_LIST* List = GetScreen()->PopCommandFromRedoList();
|
||||
|
|
|
@ -66,8 +66,7 @@ wxPoint BOARD_ITEM::ZeroOffset( 0, 0 );
|
|||
BOARD::BOARD() :
|
||||
BOARD_ITEM( (BOARD_ITEM*) NULL, PCB_T ),
|
||||
m_NetInfo( this ),
|
||||
m_paper( PAGE_INFO::A4 ),
|
||||
m_NetClasses( this )
|
||||
m_paper( PAGE_INFO::A4 )
|
||||
{
|
||||
// we have not loaded a board yet, assume latest until then.
|
||||
m_fileFormatVersionAtLoad = LEGACY_BOARD_FILE_VERSION;
|
||||
|
@ -92,19 +91,18 @@ BOARD::BOARD() :
|
|||
m_Layer[layer].m_Type = LT_UNDEFINED;
|
||||
}
|
||||
|
||||
m_NetClasses.GetDefault()->SetDescription( _( "This is the default net class." ) );
|
||||
NETCLASS* defaultClass = m_designSettings.GetDefault();
|
||||
defaultClass->SetDescription( _( "This is the default net class." ) );
|
||||
|
||||
m_viaSizeIndex = 0;
|
||||
m_trackWidthIndex = 0;
|
||||
|
||||
/* Dick 5-Feb-2012: this seems unnecessary. I don't believe the comment
|
||||
near line 70 of class_netclass.cpp. I stepped through with debugger.
|
||||
Perhaps something else is at work, it is not a constructor race.
|
||||
// Initialize default values in default netclass.
|
||||
*/
|
||||
m_NetClasses.GetDefault()->SetParams();
|
||||
defaultClass->SetParams( m_designSettings );
|
||||
m_designSettings.SetCurrentNetClass( defaultClass->GetName() );
|
||||
|
||||
SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() );
|
||||
// Set sensible initial values for custom track width & via size
|
||||
m_designSettings.UseCustomTrackViaSize( false );
|
||||
m_designSettings.SetCustomTrackWidth( m_designSettings.GetCurrentTrackWidth() );
|
||||
m_designSettings.SetCustomViaSize( m_designSettings.GetCurrentViaSize() );
|
||||
m_designSettings.SetCustomViaDrill( m_designSettings.GetCurrentViaDrill() );
|
||||
|
||||
// Initialize ratsnest
|
||||
m_ratsnest = new RN_DATA( this );
|
||||
|
@ -313,100 +311,6 @@ void BOARD::PopHighLight()
|
|||
}
|
||||
|
||||
|
||||
bool BOARD::SetCurrentNetClass( const wxString& aNetClassName )
|
||||
{
|
||||
NETCLASS* netClass = m_NetClasses.Find( aNetClassName );
|
||||
bool lists_sizes_modified = false;
|
||||
|
||||
// if not found (should not happen) use the default
|
||||
if( netClass == NULL )
|
||||
netClass = m_NetClasses.GetDefault();
|
||||
|
||||
m_currentNetClassName = netClass->GetName();
|
||||
|
||||
// Initialize others values:
|
||||
if( m_ViasDimensionsList.size() == 0 )
|
||||
{
|
||||
VIA_DIMENSION viadim;
|
||||
lists_sizes_modified = true;
|
||||
m_ViasDimensionsList.push_back( viadim );
|
||||
}
|
||||
|
||||
if( m_TrackWidthList.size() == 0 )
|
||||
{
|
||||
lists_sizes_modified = true;
|
||||
m_TrackWidthList.push_back( 0 );
|
||||
}
|
||||
|
||||
/* note the m_ViasDimensionsList[0] and m_TrackWidthList[0] values
|
||||
* are always the Netclass values
|
||||
*/
|
||||
if( m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() )
|
||||
lists_sizes_modified = true;
|
||||
|
||||
m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter();
|
||||
|
||||
if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
|
||||
lists_sizes_modified = true;
|
||||
|
||||
m_TrackWidthList[0] = netClass->GetTrackWidth();
|
||||
|
||||
if( m_viaSizeIndex >= m_ViasDimensionsList.size() )
|
||||
m_viaSizeIndex = m_ViasDimensionsList.size();
|
||||
|
||||
if( m_trackWidthIndex >= m_TrackWidthList.size() )
|
||||
m_trackWidthIndex = m_TrackWidthList.size();
|
||||
|
||||
return lists_sizes_modified;
|
||||
}
|
||||
|
||||
|
||||
int BOARD::GetBiggestClearanceValue()
|
||||
{
|
||||
int clearance = m_NetClasses.GetDefault()->GetClearance();
|
||||
|
||||
//Read list of Net Classes
|
||||
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
|
||||
{
|
||||
NETCLASS* netclass = nc->second;
|
||||
clearance = std::max( clearance, netclass->GetClearance() );
|
||||
}
|
||||
|
||||
return clearance;
|
||||
}
|
||||
|
||||
|
||||
int BOARD::GetSmallestClearanceValue()
|
||||
{
|
||||
int clearance = m_NetClasses.GetDefault()->GetClearance();
|
||||
|
||||
//Read list of Net Classes
|
||||
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
|
||||
{
|
||||
NETCLASS* netclass = nc->second;
|
||||
clearance = std::min( clearance, netclass->GetClearance() );
|
||||
}
|
||||
|
||||
return clearance;
|
||||
}
|
||||
|
||||
|
||||
int BOARD::GetCurrentMicroViaSize()
|
||||
{
|
||||
NETCLASS* netclass = m_NetClasses.Find( m_currentNetClassName );
|
||||
|
||||
return netclass->GetuViaDiameter();
|
||||
}
|
||||
|
||||
|
||||
int BOARD::GetCurrentMicroViaDrill()
|
||||
{
|
||||
NETCLASS* netclass = m_NetClasses.Find( m_currentNetClassName );
|
||||
|
||||
return netclass->GetuViaDrill();
|
||||
}
|
||||
|
||||
|
||||
bool BOARD::SetLayer( LAYER_NUM aIndex, const LAYER& aLayer )
|
||||
{
|
||||
if( aIndex < NB_COPPER_LAYERS )
|
||||
|
@ -2194,24 +2098,6 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
|
|||
}
|
||||
|
||||
|
||||
void BOARD::SetViaSizeIndex( unsigned aIndex )
|
||||
{
|
||||
if( aIndex >= m_ViasDimensionsList.size() )
|
||||
m_viaSizeIndex = m_ViasDimensionsList.size();
|
||||
else
|
||||
m_viaSizeIndex = aIndex;
|
||||
}
|
||||
|
||||
|
||||
void BOARD::SetTrackWidthIndex( unsigned aIndex )
|
||||
{
|
||||
if( aIndex >= m_TrackWidthList.size() )
|
||||
m_trackWidthIndex = m_TrackWidthList.size();
|
||||
else
|
||||
m_trackWidthIndex = aIndex;
|
||||
}
|
||||
|
||||
|
||||
ZONE_CONTAINER* BOARD::AddArea( PICKED_ITEMS_LIST* aNewZonesList, int aNetcode,
|
||||
LAYER_NUM aLayer, wxPoint aStartPointPosition, int aHatch )
|
||||
{
|
||||
|
|
|
@ -111,8 +111,6 @@ public:
|
|||
/** The type of the layer */
|
||||
LAYER_T m_Type;
|
||||
|
||||
// int m_Color;
|
||||
|
||||
/**
|
||||
* Function ShowType
|
||||
* converts a LAYER_T enum to a const char*
|
||||
|
@ -136,52 +134,15 @@ private:
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* Struct VIA_DIMENSION
|
||||
* is a small helper container to handle a stock of specific vias each with
|
||||
* unique diameter and drill sizes in the BOARD class.
|
||||
*/
|
||||
struct VIA_DIMENSION
|
||||
{
|
||||
int m_Diameter; // <= 0 means use Netclass via diameter
|
||||
int m_Drill; // <= 0 means use Netclass via drill
|
||||
|
||||
VIA_DIMENSION()
|
||||
{
|
||||
m_Diameter = 0;
|
||||
m_Drill = 0;
|
||||
}
|
||||
|
||||
VIA_DIMENSION( int aDiameter, int aDrill )
|
||||
{
|
||||
m_Diameter = aDiameter;
|
||||
m_Drill = aDrill;
|
||||
}
|
||||
|
||||
bool operator == ( const VIA_DIMENSION& other ) const
|
||||
{
|
||||
return (m_Diameter == other.m_Diameter) && (m_Drill == other.m_Drill);
|
||||
}
|
||||
|
||||
bool operator < ( const VIA_DIMENSION& other ) const
|
||||
{
|
||||
if( m_Diameter != other.m_Diameter )
|
||||
return m_Diameter < other.m_Diameter;
|
||||
|
||||
return m_Drill < other.m_Drill;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// Helper class to handle high light nets
|
||||
class HIGH_LIGHT_INFO
|
||||
{
|
||||
friend class BOARD;
|
||||
|
||||
protected:
|
||||
int m_netCode; // net selected for highlight (-1 when no net selected )
|
||||
bool m_highLightOn; // highlight active
|
||||
|
||||
protected:
|
||||
void Clear()
|
||||
{
|
||||
m_netCode = -1;
|
||||
|
@ -247,17 +208,6 @@ private:
|
|||
/// Number of unconnected nets in the current rats nest.
|
||||
int m_unconnectedNetCount;
|
||||
|
||||
/// Current net class name used to display netclass info.
|
||||
/// This is also the last used netclass after starting a track.
|
||||
wxString m_currentNetClassName;
|
||||
|
||||
/// Index for #m_ViasDimensionsList to select the current via size.
|
||||
/// 0 is the index selection of the default value Netclass
|
||||
unsigned m_viaSizeIndex;
|
||||
|
||||
// Index for m_TrackWidthList to select the value.
|
||||
unsigned m_trackWidthIndex;
|
||||
|
||||
/**
|
||||
* Function chainMarkedSegments
|
||||
* is used by MarkTrace() to set the BUSY flag of connected segments of the trace
|
||||
|
@ -269,10 +219,6 @@ private:
|
|||
*/
|
||||
void chainMarkedSegments( wxPoint aPosition, LAYER_MSK aLayerMask, TRACK_PTRS* aList );
|
||||
|
||||
void formatNetClass( NETCLASS* aNetClass, OUTPUTFORMATTER* aFormatter, int aNestLevel,
|
||||
int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
public:
|
||||
|
||||
void SetFileName( const wxString& aFileName ) { m_fileName = aFileName; }
|
||||
|
@ -296,22 +242,6 @@ public:
|
|||
/// zone contour currently in progress
|
||||
ZONE_CONTAINER* m_CurrentZoneContour;
|
||||
|
||||
/// List of current netclasses. There is always the default netclass.
|
||||
NETCLASSES m_NetClasses;
|
||||
|
||||
// handling of vias and tracks size:
|
||||
// the first value is always the value of the current NetClass
|
||||
// The others values are extra values
|
||||
|
||||
// The first value is the current netclass via size // TODO verify
|
||||
/// Vias size and drill list
|
||||
std::vector<VIA_DIMENSION> m_ViasDimensionsList;
|
||||
|
||||
// The first value is the current netclass track width // TODO verify
|
||||
/// Track width list
|
||||
std::vector<int> m_TrackWidthList;
|
||||
|
||||
|
||||
BOARD();
|
||||
~BOARD();
|
||||
|
||||
|
@ -639,7 +569,10 @@ public:
|
|||
* Function SetDesignSettings
|
||||
* @param aDesignSettings the new BOARD_DESIGN_SETTINGS to use
|
||||
*/
|
||||
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings ) { m_designSettings = aDesignSettings; }
|
||||
void SetDesignSettings( const BOARD_DESIGN_SETTINGS& aDesignSettings )
|
||||
{
|
||||
m_designSettings = aDesignSettings;
|
||||
}
|
||||
|
||||
const PAGE_INFO& GetPageSettings() const { return m_paper; }
|
||||
void SetPageSettings( const PAGE_INFO& aPageSettings ) { m_paper = aPageSettings; }
|
||||
|
@ -685,6 +618,19 @@ public:
|
|||
CPOLYGONS_LIST& aHoles,
|
||||
wxString* aErrorText = NULL );
|
||||
|
||||
/**
|
||||
* Function ConvertBrdLayerToPolygonalContours
|
||||
* Build a set of polygons which are the outlines of copper items
|
||||
* (pads, tracks, vias, texts, zones)
|
||||
* Holes in vias or pads are ignored
|
||||
* Usefull to export the shape of copper layers to dxf polygons
|
||||
* or 3D viewer
|
||||
* the polygons are not merged.
|
||||
* @param aLayer = A copper layer, like LAYER_N_BACK, etc.
|
||||
* @param aOutlines The CPOLYGONS_LIST to fill in with items outline.
|
||||
*/
|
||||
void ConvertBrdLayerToPolygonalContours( LAYER_NUM aLayer, CPOLYGONS_LIST& aOutlines );
|
||||
|
||||
/**
|
||||
* Function GetLayerName
|
||||
* returns the name of a layer given by aLayer. Copper layers may
|
||||
|
@ -770,7 +716,6 @@ public:
|
|||
return m_FullRatsnest.size();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function GetNodesCount
|
||||
* @return the number of pads members of nets (i.e. with netcode > 0)
|
||||
|
@ -799,20 +744,6 @@ public:
|
|||
*/
|
||||
void SetUnconnectedNetCount( unsigned aCount ) { m_unconnectedNetCount = aCount; }
|
||||
|
||||
/**
|
||||
* Function SetCurrentNetClassName
|
||||
* sets the current net class name to \a aName.
|
||||
*
|
||||
* @param aName is a reference to a wxString object containing the current net class name.
|
||||
*/
|
||||
void SetCurrentNetClassName( const wxString& aName ) { m_currentNetClassName = aName; }
|
||||
|
||||
/**
|
||||
* Function GetCurrentNetClassName
|
||||
* @return the current net class name.
|
||||
*/
|
||||
const wxString& GetCurrentNetClassName() const { return m_currentNetClassName; }
|
||||
|
||||
/**
|
||||
* Function GetPadCount
|
||||
* @return the number of pads in board
|
||||
|
@ -1021,11 +952,6 @@ public:
|
|||
*/
|
||||
int SortedNetnamesList( wxArrayString& aNames, bool aSortbyPadsCount );
|
||||
|
||||
/**************************************/
|
||||
/**
|
||||
* Function relative to NetClasses: **/
|
||||
/**************************************/
|
||||
|
||||
/**
|
||||
* Function SynchronizeNetsAndNetClasses
|
||||
* copies NETCLASS info to each NET, based on NET membership in a NETCLASS.
|
||||
|
@ -1035,104 +961,6 @@ public:
|
|||
*/
|
||||
void SynchronizeNetsAndNetClasses();
|
||||
|
||||
/**
|
||||
* Function SetCurrentNetClass
|
||||
* Must be called after a netclass selection (or after a netclass parameter change
|
||||
* Initialize vias and tracks values displayed in comb boxes of the auxiliary toolbar
|
||||
* and some others parameters (netclass name ....)
|
||||
* @param aNetClassName = the new netclass name
|
||||
* @return true if lists of tracks and vias sizes are modified
|
||||
*/
|
||||
bool SetCurrentNetClass( const wxString& aNetClassName );
|
||||
|
||||
/**
|
||||
* Function GetBiggestClearanceValue
|
||||
* @return the biggest clearance value found in NetClasses list
|
||||
*/
|
||||
int GetBiggestClearanceValue();
|
||||
|
||||
/**
|
||||
* Function GetSmallestClearanceValue
|
||||
* @return the smallest clearance value found in NetClasses list
|
||||
*/
|
||||
int GetSmallestClearanceValue();
|
||||
|
||||
/**
|
||||
* Function GetTrackWidthIndex
|
||||
* @return the current track width list index.
|
||||
*/
|
||||
unsigned GetTrackWidthIndex() const { return m_trackWidthIndex; }
|
||||
|
||||
/**
|
||||
* Function SetTrackWidthIndex
|
||||
* sets the current track width list index to \a aIndex.
|
||||
*
|
||||
* @param aIndex is the track width list index.
|
||||
*/
|
||||
void SetTrackWidthIndex( unsigned aIndex );
|
||||
|
||||
/**
|
||||
* Function GetCurrentTrackWidth
|
||||
* @return the current track width, according to the selected options
|
||||
* ( using the default netclass value or a preset value )
|
||||
* the default netclass is always in m_TrackWidthList[0]
|
||||
*/
|
||||
int GetCurrentTrackWidth() const
|
||||
{
|
||||
return m_TrackWidthList[m_trackWidthIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetViaSizeIndex
|
||||
* @return the current via size list index.
|
||||
*/
|
||||
unsigned GetViaSizeIndex() const { return m_viaSizeIndex; }
|
||||
|
||||
/**
|
||||
* Function SetViaSizeIndex
|
||||
* sets the current via size list index to \a aIndex.
|
||||
*
|
||||
* @param aIndex is the via size list index.
|
||||
*/
|
||||
void SetViaSizeIndex( unsigned aIndex );
|
||||
|
||||
/**
|
||||
* Function GetCurrentViaSize
|
||||
* @return the current via size, according to the selected options
|
||||
* ( using the default netclass value or a preset value )
|
||||
* the default netclass is always in m_TrackWidthList[0]
|
||||
*/
|
||||
int GetCurrentViaSize()
|
||||
{
|
||||
return m_ViasDimensionsList[m_viaSizeIndex].m_Diameter;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetCurrentViaDrill
|
||||
* @return the current via size, according to the selected options
|
||||
* ( using the default netclass value or a preset value )
|
||||
* the default netclass is always in m_TrackWidthList[0]
|
||||
*/
|
||||
int GetCurrentViaDrill()
|
||||
{
|
||||
return m_ViasDimensionsList[m_viaSizeIndex].m_Drill > 0 ?
|
||||
m_ViasDimensionsList[m_viaSizeIndex].m_Drill : -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetCurrentMicroViaSize
|
||||
* @return the current micro via size,
|
||||
* that is the current netclass value
|
||||
*/
|
||||
int GetCurrentMicroViaSize();
|
||||
|
||||
/**
|
||||
* Function GetCurrentMicroViaDrill
|
||||
* @return the current micro via drill,
|
||||
* that is the current netclass value
|
||||
*/
|
||||
int GetCurrentMicroViaDrill();
|
||||
|
||||
/***************************************************************************/
|
||||
|
||||
wxString GetClass() const
|
||||
|
|
|
@ -144,7 +144,7 @@ NETCLASS* BOARD_CONNECTED_ITEM::GetNetClass() const
|
|||
if( netclass )
|
||||
return netclass;
|
||||
else
|
||||
return board->m_NetClasses.GetDefault();
|
||||
return board->GetDesignSettings().GetDefault();
|
||||
}
|
||||
|
||||
|
||||
|
@ -158,7 +158,7 @@ wxString BOARD_CONNECTED_ITEM::GetNetClassName() const
|
|||
else
|
||||
{
|
||||
BOARD* board = GetBoard();
|
||||
name = board->m_NetClasses.GetDefault()->GetName();
|
||||
name = NETCLASS::Default;
|
||||
}
|
||||
|
||||
return name;
|
||||
|
|
|
@ -54,13 +54,13 @@
|
|||
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
|
||||
m_Pad_Master( NULL )
|
||||
{
|
||||
m_EnabledLayers = ALL_LAYERS; // All layers enabled at first.
|
||||
m_enabledLayers = ALL_LAYERS; // All layers enabled at first.
|
||||
// SetCopperLayerCount() will adjust this.
|
||||
|
||||
SetVisibleLayers( FULL_LAYERS );
|
||||
|
||||
// set all but hidden text as visible.
|
||||
m_VisibleElements = ~( 1 << MOD_TEXT_INVISIBLE );
|
||||
m_visibleElements = ~( 1 << MOD_TEXT_INVISIBLE );
|
||||
|
||||
SetCopperLayerCount( 2 ); // Default design is a double sided board
|
||||
|
||||
|
@ -81,7 +81,7 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
|
|||
m_PcbTextSize = wxSize( DEFAULT_TEXT_PCB_SIZE,
|
||||
DEFAULT_TEXT_PCB_SIZE ); // current Pcb (not module) Text size
|
||||
|
||||
m_TrackMinWidth = DMils2iu( 100 ); // track min value for width ((min copper size value
|
||||
m_TrackMinWidth = DMils2iu( 100 ); // track min value for width (min copper size value)
|
||||
m_ViasMinSize = DMils2iu( 350 ); // vias (not micro vias) min diameter
|
||||
m_ViasMinDrill = DMils2iu( 200 ); // vias (not micro vias) min drill diameter
|
||||
m_MicroViasMinSize = DMils2iu( 200 ); // micro vias (not vias) min diameter
|
||||
|
@ -102,6 +102,9 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
|
|||
|
||||
// Layer thickness for 3D viewer
|
||||
m_boardThickness = Millimeter2iu( DEFAULT_BOARD_THICKNESS_MM );
|
||||
|
||||
m_viaSizeIndex = 0;
|
||||
m_trackWidthIndex = 0;
|
||||
}
|
||||
|
||||
// Add parameters to save in project config.
|
||||
|
@ -171,32 +174,144 @@ void BOARD_DESIGN_SETTINGS::AppendConfigs( PARAM_CFG_ARRAY* aResult )
|
|||
}
|
||||
|
||||
|
||||
// see pcbstruct.h
|
||||
LAYER_MSK BOARD_DESIGN_SETTINGS::GetVisibleLayers() const
|
||||
bool BOARD_DESIGN_SETTINGS::SetCurrentNetClass( const wxString& aNetClassName )
|
||||
{
|
||||
return m_VisibleLayers;
|
||||
NETCLASS* netClass = m_NetClasses.Find( aNetClassName );
|
||||
bool lists_sizes_modified = false;
|
||||
|
||||
// if not found (should not happen) use the default
|
||||
if( netClass == NULL )
|
||||
netClass = m_NetClasses.GetDefault();
|
||||
|
||||
m_currentNetClassName = netClass->GetName();
|
||||
|
||||
// Initialize others values:
|
||||
if( m_ViasDimensionsList.size() == 0 )
|
||||
{
|
||||
VIA_DIMENSION viadim;
|
||||
lists_sizes_modified = true;
|
||||
m_ViasDimensionsList.push_back( viadim );
|
||||
}
|
||||
|
||||
if( m_TrackWidthList.size() == 0 )
|
||||
{
|
||||
lists_sizes_modified = true;
|
||||
m_TrackWidthList.push_back( 0 );
|
||||
}
|
||||
|
||||
/* note the m_ViasDimensionsList[0] and m_TrackWidthList[0] values
|
||||
* are always the Netclass values
|
||||
*/
|
||||
if( m_ViasDimensionsList[0].m_Diameter != netClass->GetViaDiameter() )
|
||||
lists_sizes_modified = true;
|
||||
|
||||
m_ViasDimensionsList[0].m_Diameter = netClass->GetViaDiameter();
|
||||
|
||||
if( m_TrackWidthList[0] != netClass->GetTrackWidth() )
|
||||
lists_sizes_modified = true;
|
||||
|
||||
m_TrackWidthList[0] = netClass->GetTrackWidth();
|
||||
|
||||
if( GetViaSizeIndex() >= m_ViasDimensionsList.size() )
|
||||
SetViaSizeIndex( m_ViasDimensionsList.size() );
|
||||
|
||||
if( GetTrackWidthIndex() >= m_TrackWidthList.size() )
|
||||
SetTrackWidthIndex( m_TrackWidthList.size() );
|
||||
|
||||
return lists_sizes_modified;
|
||||
}
|
||||
|
||||
|
||||
int BOARD_DESIGN_SETTINGS::GetBiggestClearanceValue()
|
||||
{
|
||||
int clearance = m_NetClasses.GetDefault()->GetClearance();
|
||||
|
||||
//Read list of Net Classes
|
||||
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
|
||||
{
|
||||
NETCLASS* netclass = nc->second;
|
||||
clearance = std::max( clearance, netclass->GetClearance() );
|
||||
}
|
||||
|
||||
return clearance;
|
||||
}
|
||||
|
||||
|
||||
int BOARD_DESIGN_SETTINGS::GetSmallestClearanceValue()
|
||||
{
|
||||
int clearance = m_NetClasses.GetDefault()->GetClearance();
|
||||
|
||||
//Read list of Net Classes
|
||||
for( NETCLASSES::const_iterator nc = m_NetClasses.begin(); nc != m_NetClasses.end(); nc++ )
|
||||
{
|
||||
NETCLASS* netclass = nc->second;
|
||||
clearance = std::min( clearance, netclass->GetClearance() );
|
||||
}
|
||||
|
||||
return clearance;
|
||||
}
|
||||
|
||||
|
||||
int BOARD_DESIGN_SETTINGS::GetCurrentMicroViaSize()
|
||||
{
|
||||
NETCLASS* netclass = m_NetClasses.Find( m_currentNetClassName );
|
||||
|
||||
return netclass->GetuViaDiameter();
|
||||
}
|
||||
|
||||
|
||||
int BOARD_DESIGN_SETTINGS::GetCurrentMicroViaDrill()
|
||||
{
|
||||
NETCLASS* netclass = m_NetClasses.Find( m_currentNetClassName );
|
||||
|
||||
return netclass->GetuViaDrill();
|
||||
}
|
||||
|
||||
|
||||
void BOARD_DESIGN_SETTINGS::SetViaSizeIndex( unsigned aIndex )
|
||||
{
|
||||
if( aIndex >= m_ViasDimensionsList.size() )
|
||||
m_viaSizeIndex = m_ViasDimensionsList.size();
|
||||
else
|
||||
m_viaSizeIndex = aIndex;
|
||||
}
|
||||
|
||||
|
||||
int BOARD_DESIGN_SETTINGS::GetCurrentViaDrill() const
|
||||
{
|
||||
int drill;
|
||||
|
||||
if( m_useCustomTrackVia )
|
||||
drill = m_customViaSize.m_Drill;
|
||||
else
|
||||
drill = m_ViasDimensionsList[m_viaSizeIndex].m_Drill;
|
||||
|
||||
return drill > 0 ? drill : -1;
|
||||
}
|
||||
|
||||
|
||||
void BOARD_DESIGN_SETTINGS::SetTrackWidthIndex( unsigned aIndex )
|
||||
{
|
||||
if( aIndex >= m_TrackWidthList.size() )
|
||||
m_trackWidthIndex = m_TrackWidthList.size();
|
||||
else
|
||||
m_trackWidthIndex = aIndex;
|
||||
}
|
||||
|
||||
|
||||
void BOARD_DESIGN_SETTINGS::SetVisibleAlls()
|
||||
{
|
||||
SetVisibleLayers( FULL_LAYERS );
|
||||
m_VisibleElements = -1;
|
||||
}
|
||||
|
||||
|
||||
void BOARD_DESIGN_SETTINGS::SetVisibleLayers( LAYER_MSK aMask )
|
||||
{
|
||||
m_VisibleLayers = aMask & m_EnabledLayers & FULL_LAYERS;
|
||||
m_visibleElements = -1;
|
||||
}
|
||||
|
||||
|
||||
void BOARD_DESIGN_SETTINGS::SetLayerVisibility( LAYER_NUM aLayer, bool aNewState )
|
||||
{
|
||||
if( aNewState && IsLayerEnabled( aLayer ) )
|
||||
m_VisibleLayers |= GetLayerMask( aLayer );
|
||||
m_visibleLayers |= GetLayerMask( aLayer );
|
||||
else
|
||||
m_VisibleLayers &= ~GetLayerMask( aLayer );
|
||||
m_visibleLayers &= ~GetLayerMask( aLayer );
|
||||
}
|
||||
|
||||
|
||||
|
@ -206,9 +321,9 @@ void BOARD_DESIGN_SETTINGS::SetElementVisibility( int aElementCategory, bool aNe
|
|||
return;
|
||||
|
||||
if( aNewState )
|
||||
m_VisibleElements |= 1 << aElementCategory;
|
||||
m_visibleElements |= 1 << aElementCategory;
|
||||
else
|
||||
m_VisibleElements &= ~( 1 << aElementCategory );
|
||||
m_visibleElements &= ~( 1 << aElementCategory );
|
||||
}
|
||||
|
||||
|
||||
|
@ -216,17 +331,17 @@ void BOARD_DESIGN_SETTINGS::SetCopperLayerCount( int aNewLayerCount )
|
|||
{
|
||||
// if( aNewLayerCount < 2 ) aNewLayerCount = 2;
|
||||
|
||||
m_CopperLayerCount = aNewLayerCount;
|
||||
m_copperLayerCount = aNewLayerCount;
|
||||
|
||||
// ensure consistency with the m_EnabledLayers member
|
||||
m_EnabledLayers &= ~ALL_CU_LAYERS;
|
||||
m_EnabledLayers |= LAYER_BACK;
|
||||
m_enabledLayers &= ~ALL_CU_LAYERS;
|
||||
m_enabledLayers |= LAYER_BACK;
|
||||
|
||||
if( m_CopperLayerCount > 1 )
|
||||
m_EnabledLayers |= LAYER_FRONT;
|
||||
if( m_copperLayerCount > 1 )
|
||||
m_enabledLayers |= LAYER_FRONT;
|
||||
|
||||
for( LAYER_NUM ii = LAYER_N_2; ii < aNewLayerCount - 1; ++ii )
|
||||
m_EnabledLayers |= GetLayerMask( ii );
|
||||
m_enabledLayers |= GetLayerMask( ii );
|
||||
}
|
||||
|
||||
|
||||
|
@ -235,13 +350,13 @@ void BOARD_DESIGN_SETTINGS::SetEnabledLayers( LAYER_MSK aMask )
|
|||
// Back and front layers are always enabled.
|
||||
aMask |= LAYER_BACK | LAYER_FRONT;
|
||||
|
||||
m_EnabledLayers = aMask;
|
||||
m_enabledLayers = aMask;
|
||||
|
||||
// A disabled layer cannot be visible
|
||||
m_VisibleLayers &= aMask;
|
||||
m_visibleLayers &= aMask;
|
||||
|
||||
// update m_CopperLayerCount to ensure its consistency with m_EnabledLayers
|
||||
m_CopperLayerCount = LayerMaskCountSet( aMask & ALL_CU_LAYERS);
|
||||
m_copperLayerCount = LayerMaskCountSet( aMask & ALL_CU_LAYERS);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -447,7 +447,7 @@ const EDA_RECT MODULE::GetBoundingBox() const
|
|||
// Add the Clearance shape size: (shape around the pads when the
|
||||
// clearance is shown. Not optimized, but the draw cost is small
|
||||
// (perhaps smaller than optimization).
|
||||
int biggest_clearance = GetBoard()->GetBiggestClearanceValue();
|
||||
int biggest_clearance = GetBoard()->GetDesignSettings().GetBiggestClearanceValue();
|
||||
area.Inflate( biggest_clearance );
|
||||
|
||||
return area;
|
||||
|
|
|
@ -39,59 +39,43 @@
|
|||
const wxChar NETCLASS::Default[] = wxT( "Default" );
|
||||
|
||||
// Initial values for netclass initialization
|
||||
int NETCLASS::DEFAULT_CLEARANCE = DMils2iu( 100 ); // track to track and track to pads clearance
|
||||
int NETCLASS::DEFAULT_VIA_DRILL = DMils2iu( 250 ); // default via drill
|
||||
int NETCLASS::DEFAULT_UVIA_DRILL = DMils2iu( 50 ); // micro via drill
|
||||
const int NETCLASS::DEFAULT_CLEARANCE = DMils2iu( 100 ); // track to track and track to pads clearance
|
||||
const int NETCLASS::DEFAULT_VIA_DRILL = DMils2iu( 250 ); // default via drill
|
||||
const int NETCLASS::DEFAULT_UVIA_DRILL = DMils2iu( 50 ); // micro via drill
|
||||
|
||||
|
||||
NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters ) :
|
||||
m_Parent( aParent ),
|
||||
NETCLASS::NETCLASS( const wxString& aName ) :
|
||||
m_Name( aName )
|
||||
{
|
||||
// use initialParameters if not NULL, else set the initial
|
||||
// parameters from boardDesignSettings (try to change this)
|
||||
SetParams( initialParameters );
|
||||
}
|
||||
|
||||
|
||||
void NETCLASS::SetParams( const NETCLASS* defaults )
|
||||
{
|
||||
if( defaults )
|
||||
{
|
||||
SetClearance( defaults->GetClearance() );
|
||||
SetTrackWidth( defaults->GetTrackWidth() );
|
||||
SetViaDiameter( defaults->GetViaDiameter() );
|
||||
SetViaDrill( defaults->GetViaDrill() );
|
||||
SetuViaDiameter( defaults->GetuViaDiameter() );
|
||||
SetuViaDrill( defaults->GetuViaDrill() );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
/* Dick 5-Feb-2012: I do not believe this comment to be true with current code.
|
||||
It is certainly not a constructor race. Normally items are initialized
|
||||
within a class according to the order of their appearance.
|
||||
|
||||
// Note:
|
||||
// We use m_Parent->GetDesignSettings() to get some default values
|
||||
// But when this function is called when instantiating a BOARD class,
|
||||
// by the NETCLASSES constructor that calls NETCLASS constructor,
|
||||
// the BOARD constructor (see BOARD::BOARD) is not yet run,
|
||||
// and BOARD::m_designSettings contains not yet initialized values.
|
||||
// So inside the BOARD constructor itself, you SHOULD recall SetParams
|
||||
*/
|
||||
|
||||
const BOARD_DESIGN_SETTINGS& g = m_Parent->GetDesignSettings();
|
||||
|
||||
SetTrackWidth( g.m_TrackMinWidth );
|
||||
SetViaDiameter( g.m_ViasMinSize );
|
||||
SetuViaDiameter( g.m_MicroViasMinSize );
|
||||
|
||||
// Use default values for next parameters:
|
||||
// Default settings
|
||||
SetClearance( DEFAULT_CLEARANCE );
|
||||
SetViaDrill( DEFAULT_VIA_DRILL );
|
||||
SetuViaDrill( DEFAULT_UVIA_DRILL );
|
||||
}
|
||||
|
||||
|
||||
void NETCLASS::SetParams( const NETCLASS& aDefaults )
|
||||
{
|
||||
SetClearance( aDefaults.GetClearance() );
|
||||
SetTrackWidth( aDefaults.GetTrackWidth() );
|
||||
SetViaDiameter( aDefaults.GetViaDiameter() );
|
||||
SetViaDrill( aDefaults.GetViaDrill() );
|
||||
SetuViaDiameter( aDefaults.GetuViaDiameter() );
|
||||
SetuViaDrill( aDefaults.GetuViaDrill() );
|
||||
}
|
||||
|
||||
|
||||
void NETCLASS::SetParams( const BOARD_DESIGN_SETTINGS& aSettings )
|
||||
{
|
||||
SetTrackWidth( aSettings.m_TrackMinWidth );
|
||||
SetViaDiameter( aSettings.m_ViasMinSize );
|
||||
SetuViaDiameter( aSettings.m_MicroViasMinSize );
|
||||
|
||||
// TODO: BOARD_DESIGN_SETTINGS may provide the following parameters - should it?
|
||||
// Use default values for next parameters:
|
||||
SetClearance( DEFAULT_CLEARANCE );
|
||||
SetViaDrill( DEFAULT_VIA_DRILL );
|
||||
SetuViaDrill( DEFAULT_UVIA_DRILL );
|
||||
}
|
||||
|
||||
|
||||
|
@ -100,9 +84,8 @@ NETCLASS::~NETCLASS()
|
|||
}
|
||||
|
||||
|
||||
NETCLASSES::NETCLASSES( BOARD* aParent ) :
|
||||
m_Parent( aParent ),
|
||||
m_Default( aParent, NETCLASS::Default )
|
||||
NETCLASSES::NETCLASSES() :
|
||||
m_Default( NETCLASS::Default )
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -198,7 +181,7 @@ NETCLASS* NETCLASSES::Find( const wxString& aName ) const
|
|||
|
||||
void BOARD::SynchronizeNetsAndNetClasses()
|
||||
{
|
||||
// D(printf("start\n");) // simple performance/timing indicator.
|
||||
NETCLASSES& netClasses = m_designSettings.m_NetClasses;
|
||||
|
||||
// set all NETs to the default NETCLASS, then later override some
|
||||
// as we go through the NETCLASSes.
|
||||
|
@ -206,13 +189,13 @@ void BOARD::SynchronizeNetsAndNetClasses()
|
|||
for( NETINFO_LIST::iterator net( m_NetInfo.begin() ), netEnd( m_NetInfo.end() );
|
||||
net != netEnd; ++net )
|
||||
{
|
||||
net->SetClass( m_NetClasses.GetDefault() );
|
||||
net->SetClass( netClasses.GetDefault() );
|
||||
}
|
||||
|
||||
// Add netclass name and pointer to nets. If a net is in more than one netclass,
|
||||
// set the net's name and pointer to only the first netclass. Subsequent
|
||||
// and therefore bogus netclass memberships will be deleted in logic below this loop.
|
||||
for( NETCLASSES::iterator clazz=m_NetClasses.begin(); clazz!=m_NetClasses.end(); ++clazz )
|
||||
for( NETCLASSES::iterator clazz = netClasses.begin(); clazz != netClasses.end(); ++clazz )
|
||||
{
|
||||
NETCLASS* netclass = clazz->second;
|
||||
|
||||
|
@ -237,14 +220,14 @@ void BOARD::SynchronizeNetsAndNetClasses()
|
|||
// contain netnames that do not exist, by deleting all netnames from
|
||||
// every netclass and re-adding them.
|
||||
|
||||
for( NETCLASSES::iterator clazz=m_NetClasses.begin(); clazz!=m_NetClasses.end(); ++clazz )
|
||||
for( NETCLASSES::iterator clazz = netClasses.begin(); clazz != netClasses.end(); ++clazz )
|
||||
{
|
||||
NETCLASS* netclass = clazz->second;
|
||||
|
||||
netclass->Clear();
|
||||
}
|
||||
|
||||
m_NetClasses.GetDefault()->Clear();
|
||||
netClasses.GetDefault()->Clear();
|
||||
|
||||
for( NETINFO_LIST::iterator net( m_NetInfo.begin() ), netEnd( m_NetInfo.end() );
|
||||
net != netEnd; ++net )
|
||||
|
@ -253,14 +236,12 @@ void BOARD::SynchronizeNetsAndNetClasses()
|
|||
|
||||
// because of the std:map<> this should be fast, and because of
|
||||
// prior logic, netclass should not be NULL.
|
||||
NETCLASS* netclass = m_NetClasses.Find( classname );
|
||||
NETCLASS* netclass = netClasses.Find( classname );
|
||||
|
||||
wxASSERT( netclass );
|
||||
|
||||
netclass->Add( net->GetNetname() );
|
||||
}
|
||||
|
||||
// D(printf("stop\n");)
|
||||
}
|
||||
|
||||
|
||||
|
@ -286,36 +267,6 @@ void NETCLASS::Show( int nestLevel, std::ostream& os ) const
|
|||
#endif
|
||||
|
||||
|
||||
int NETCLASS::GetTrackMinWidth() const
|
||||
{
|
||||
return m_Parent->GetDesignSettings().m_TrackMinWidth;
|
||||
}
|
||||
|
||||
|
||||
int NETCLASS::GetViaMinDiameter() const
|
||||
{
|
||||
return m_Parent->GetDesignSettings().m_ViasMinSize;
|
||||
}
|
||||
|
||||
|
||||
int NETCLASS::GetViaMinDrill() const
|
||||
{
|
||||
return m_Parent->GetDesignSettings().m_ViasMinDrill;
|
||||
}
|
||||
|
||||
|
||||
int NETCLASS::GetuViaMinDiameter() const
|
||||
{
|
||||
return m_Parent->GetDesignSettings().m_MicroViasMinSize;
|
||||
}
|
||||
|
||||
|
||||
int NETCLASS::GetuViaMinDrill() const
|
||||
{
|
||||
return m_Parent->GetDesignSettings().m_MicroViasMinDrill;
|
||||
}
|
||||
|
||||
|
||||
void NETCLASS::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
|
@ -333,14 +284,7 @@ void NETCLASS::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
|
|||
aFormatter->Print( aNestLevel+1, "(uvia_drill %s)\n", FMT_IU( GetuViaDrill() ).c_str() );
|
||||
|
||||
for( NETCLASS::const_iterator it = begin(); it != end(); ++it )
|
||||
{
|
||||
NETINFO_ITEM* netinfo = m_Parent->FindNet( *it );
|
||||
|
||||
if( netinfo && netinfo->GetNodesCount() > 0 )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, "(add_net %s)\n", aFormatter->Quotew( *it ).c_str() );
|
||||
}
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n\n" );
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
|
||||
class LINE_READER;
|
||||
class BOARD;
|
||||
class BOARD_DESIGN_SETTINGS;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -53,13 +54,11 @@ class NETCLASS
|
|||
{
|
||||
private:
|
||||
// Default values used to init a NETCLASS
|
||||
static int DEFAULT_CLEARANCE;
|
||||
static int DEFAULT_VIA_DRILL;
|
||||
static int DEFAULT_UVIA_DRILL;
|
||||
static const int DEFAULT_CLEARANCE;
|
||||
static const int DEFAULT_VIA_DRILL;
|
||||
static const int DEFAULT_UVIA_DRILL;
|
||||
|
||||
protected:
|
||||
|
||||
BOARD* m_Parent;
|
||||
wxString m_Name; ///< Name of the net class
|
||||
wxString m_Description; ///< what this NETCLASS is for.
|
||||
|
||||
|
@ -85,12 +84,9 @@ public:
|
|||
/**
|
||||
* Constructor
|
||||
* stuffs a NETCLASS instance with aParent, aName, and optionally the initialParameters
|
||||
* @param aParent = the parent board
|
||||
* @param aName = the name of this new netclass
|
||||
* @param initialParameters is a NETCLASS to copy parameters from, or if
|
||||
* NULL tells me to copy default settings from BOARD::m_designSettings.
|
||||
*/
|
||||
NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters = NULL );
|
||||
NETCLASS( const wxString& aName );
|
||||
|
||||
~NETCLASS();
|
||||
|
||||
|
@ -115,7 +111,6 @@ public:
|
|||
return m_Members.size();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Clear
|
||||
* empties the collection of members.
|
||||
|
@ -125,7 +120,6 @@ public:
|
|||
m_Members.clear();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function AddMember
|
||||
* adds \a aNetname to this NETCLASS if it is not already in this NETCLASS.
|
||||
|
@ -169,34 +163,35 @@ public:
|
|||
void SetClearance( int aClearance ) { m_Clearance = aClearance; }
|
||||
|
||||
int GetTrackWidth() const { return m_TrackWidth; }
|
||||
int GetTrackMinWidth() const;
|
||||
void SetTrackWidth( int aWidth ) { m_TrackWidth = aWidth; }
|
||||
|
||||
int GetViaDiameter() const { return m_ViaDia; }
|
||||
int GetViaMinDiameter() const;
|
||||
void SetViaDiameter( int aDia ) { m_ViaDia = aDia; }
|
||||
|
||||
int GetViaDrill() const { return m_ViaDrill; }
|
||||
int GetViaMinDrill() const;
|
||||
void SetViaDrill( int aSize ) { m_ViaDrill = aSize; }
|
||||
|
||||
int GetuViaDiameter() const { return m_uViaDia; }
|
||||
int GetuViaMinDiameter() const;
|
||||
void SetuViaDiameter( int aSize ) { m_uViaDia = aSize; }
|
||||
|
||||
int GetuViaDrill() const { return m_uViaDrill; }
|
||||
int GetuViaMinDrill() const;
|
||||
void SetuViaDrill( int aSize ) { m_uViaDrill = aSize; }
|
||||
|
||||
|
||||
/**
|
||||
* Function SetParams
|
||||
* will set all the parameters by copying them from \a defaults.
|
||||
* Parameters are the values like m_ViaSize, etc, but do not include m_Description.
|
||||
* @param defaults is another NETCLASS to copy from. If NULL, then copy
|
||||
* from global preferences instead.
|
||||
* @param aDefaults is another NETCLASS object to copy from.
|
||||
*/
|
||||
void SetParams( const NETCLASS* defaults = NULL );
|
||||
void SetParams( const NETCLASS& aDefaults );
|
||||
|
||||
/**
|
||||
* Function SetParams
|
||||
* will set all the parameters by copying them from board design settings.
|
||||
* @param aSettings is a BOARD_DESIGN_SETTINGS object to copy from. Clearance, via drill and
|
||||
* microvia drill values are taken from the defaults.
|
||||
*/
|
||||
void SetParams( const BOARD_DESIGN_SETTINGS& aSettings );
|
||||
|
||||
/**
|
||||
* Function Format
|
||||
|
@ -225,8 +220,6 @@ public:
|
|||
class NETCLASSES
|
||||
{
|
||||
private:
|
||||
BOARD* m_Parent;
|
||||
|
||||
typedef std::map<wxString, NETCLASS*> NETCLASSMAP;
|
||||
|
||||
/// all the NETCLASSes except the default one.
|
||||
|
@ -236,7 +229,7 @@ private:
|
|||
NETCLASS m_Default;
|
||||
|
||||
public:
|
||||
NETCLASSES( BOARD* aParent = NULL );
|
||||
NETCLASSES();
|
||||
~NETCLASSES();
|
||||
|
||||
/**
|
||||
|
@ -253,7 +246,6 @@ public:
|
|||
const_iterator begin() const { return m_NetClasses.begin(); }
|
||||
const_iterator end() const { return m_NetClasses.end(); }
|
||||
|
||||
|
||||
/**
|
||||
* Function GetCount
|
||||
* @return the number of netclasses, excluding the default one.
|
||||
|
@ -263,6 +255,10 @@ public:
|
|||
return m_NetClasses.size();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetDefault
|
||||
* @return the default net class.
|
||||
*/
|
||||
NETCLASS* GetDefault() const
|
||||
{
|
||||
return (NETCLASS*) &m_Default;
|
||||
|
|
|
@ -190,15 +190,15 @@ void DIALOG_DESIGN_RULES::PrintCurrentSettings()
|
|||
m_MessagesList->AppendToPage( _( "<b>Current general settings:</b><br>" ) );
|
||||
|
||||
// Display min values:
|
||||
value = StringFromValue( g_UserUnit, m_BrdSettings.m_TrackMinWidth, true );
|
||||
value = StringFromValue( g_UserUnit, m_BrdSettings->m_TrackMinWidth, true );
|
||||
msg.Printf( _( "Minimum value for tracks width: <b>%s</b><br>\n" ), GetChars( value ) );
|
||||
m_MessagesList->AppendToPage( msg );
|
||||
|
||||
value = StringFromValue( g_UserUnit, m_BrdSettings.m_ViasMinSize, true );
|
||||
value = StringFromValue( g_UserUnit, m_BrdSettings->m_ViasMinSize, true );
|
||||
msg.Printf( _( "Minimum value for vias diameter: <b>%s</b><br>\n" ), GetChars( value ) );
|
||||
m_MessagesList->AppendToPage( msg );
|
||||
|
||||
value = StringFromValue( g_UserUnit, m_BrdSettings.m_MicroViasMinSize, true );
|
||||
value = StringFromValue( g_UserUnit, m_BrdSettings->m_MicroViasMinSize, true );
|
||||
msg.Printf( _( "Minimum value for microvias diameter: <b>%s</b><br>\n" ), GetChars( value ) );
|
||||
m_MessagesList->AppendToPage( msg );
|
||||
}
|
||||
|
@ -212,7 +212,7 @@ void DIALOG_DESIGN_RULES::InitDialogRules()
|
|||
SetReturnCode( 0 );
|
||||
|
||||
m_Pcb = m_Parent->GetBoard();
|
||||
m_BrdSettings = m_Pcb->GetDesignSettings();
|
||||
m_BrdSettings = &m_Pcb->GetDesignSettings();
|
||||
|
||||
// Initialize the Rules List
|
||||
InitRulesList();
|
||||
|
@ -220,13 +220,8 @@ void DIALOG_DESIGN_RULES::InitDialogRules()
|
|||
// copy all NETs into m_AllNets by adding them as NETCUPs.
|
||||
|
||||
// @todo go fix m_Pcb->SynchronizeNetsAndNetClasses() so that the netcode==0 is not present in the BOARD::m_NetClasses
|
||||
|
||||
|
||||
NETCLASS* netclass;
|
||||
|
||||
NETCLASSES& netclasses = m_Pcb->m_NetClasses;
|
||||
|
||||
netclass = netclasses.GetDefault();
|
||||
NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
|
||||
NETCLASS* netclass = netclasses.GetDefault();
|
||||
|
||||
// Initialize list of nets for Default Net Class
|
||||
for( NETCLASS::const_iterator name = netclass->begin(); name != netclass->end(); ++name )
|
||||
|
@ -262,23 +257,23 @@ void DIALOG_DESIGN_RULES::InitGlobalRules()
|
|||
AddUnitSymbol( *m_MicroViaMinDrillTitle );
|
||||
AddUnitSymbol( *m_TrackMinWidthTitle );
|
||||
|
||||
PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings.m_ViasMinSize );
|
||||
PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings.m_ViasMinDrill );
|
||||
PutValueInLocalUnits( *m_SetViasMinSizeCtrl, m_BrdSettings->m_ViasMinSize );
|
||||
PutValueInLocalUnits( *m_SetViasMinDrillCtrl, m_BrdSettings->m_ViasMinDrill );
|
||||
|
||||
if( m_BrdSettings.m_BlindBuriedViaAllowed )
|
||||
if( m_BrdSettings->m_BlindBuriedViaAllowed )
|
||||
m_OptViaType->SetSelection( 1 );
|
||||
|
||||
m_AllowMicroViaCtrl->SetSelection( m_BrdSettings.m_MicroViasAllowed ? 1 : 0 );
|
||||
PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, m_BrdSettings.m_MicroViasMinSize );
|
||||
PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, m_BrdSettings.m_MicroViasMinDrill );
|
||||
PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings.m_TrackMinWidth );
|
||||
m_AllowMicroViaCtrl->SetSelection( m_BrdSettings->m_MicroViasAllowed ? 1 : 0 );
|
||||
PutValueInLocalUnits( *m_SetMicroViasMinSizeCtrl, m_BrdSettings->m_MicroViasMinSize );
|
||||
PutValueInLocalUnits( *m_SetMicroViasMinDrillCtrl, m_BrdSettings->m_MicroViasMinDrill );
|
||||
PutValueInLocalUnits( *m_SetTrackMinWidthCtrl, m_BrdSettings->m_TrackMinWidth );
|
||||
|
||||
// Initialize Vias and Tracks sizes lists.
|
||||
// note we display only extra values, never the current netclass value.
|
||||
// (the first value in history list)
|
||||
m_TracksWidthList = m_Parent->GetBoard()->m_TrackWidthList;
|
||||
m_TracksWidthList = m_BrdSettings->m_TrackWidthList;
|
||||
m_TracksWidthList.erase( m_TracksWidthList.begin() ); // remove the netclass value
|
||||
m_ViasDimensionsList = m_Parent->GetBoard()->m_ViasDimensionsList;
|
||||
m_ViasDimensionsList = m_BrdSettings->m_ViasDimensionsList;
|
||||
m_ViasDimensionsList.erase( m_ViasDimensionsList.begin() ); // remove the netclass value
|
||||
InitDimensionsLists();
|
||||
}
|
||||
|
@ -484,7 +479,7 @@ static void class2gridRow( wxGrid* grid, int row, NETCLASS* nc )
|
|||
*/
|
||||
void DIALOG_DESIGN_RULES::InitRulesList()
|
||||
{
|
||||
NETCLASSES& netclasses = m_Pcb->m_NetClasses;
|
||||
NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
|
||||
|
||||
// the +1 is for the Default NETCLASS.
|
||||
if( netclasses.GetCount() + 1 > (unsigned) m_grid->GetNumberRows() )
|
||||
|
@ -524,7 +519,7 @@ static void gridRow2class( wxGrid* grid, int row, NETCLASS* nc )
|
|||
*/
|
||||
void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
|
||||
{
|
||||
NETCLASSES& netclasses = m_Pcb->m_NetClasses;
|
||||
NETCLASSES& netclasses = m_BrdSettings->m_NetClasses;
|
||||
|
||||
// Remove all netclasses from board. We'll copy new list after
|
||||
netclasses.Clear();
|
||||
|
@ -535,9 +530,9 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
|
|||
// Copy other NetClasses :
|
||||
for( int row = 1; row < m_grid->GetNumberRows(); ++row )
|
||||
{
|
||||
NETCLASS* nc = new NETCLASS( m_Pcb, m_grid->GetRowLabelValue( row ) );
|
||||
NETCLASS* nc = new NETCLASS( m_grid->GetRowLabelValue( row ) );
|
||||
|
||||
if( !m_Pcb->m_NetClasses.Add( nc ) )
|
||||
if( !m_BrdSettings->m_NetClasses.Add( nc ) )
|
||||
{
|
||||
// this netclass cannot be added because an other netclass with the same name exists
|
||||
// Should not occur because OnAddNetclassClick() tests for existing NetClass names
|
||||
|
@ -568,20 +563,20 @@ void DIALOG_DESIGN_RULES::CopyRulesListToBoard()
|
|||
void DIALOG_DESIGN_RULES::CopyGlobalRulesToBoard()
|
||||
/*************************************************/
|
||||
{
|
||||
m_BrdSettings.m_BlindBuriedViaAllowed = m_OptViaType->GetSelection() > 0;
|
||||
m_BrdSettings->m_BlindBuriedViaAllowed = m_OptViaType->GetSelection() > 0;
|
||||
|
||||
// Update vias minimum values for DRC
|
||||
m_BrdSettings.m_ViasMinSize = ValueFromTextCtrl( *m_SetViasMinSizeCtrl );
|
||||
m_BrdSettings.m_ViasMinDrill = ValueFromTextCtrl( *m_SetViasMinDrillCtrl );
|
||||
m_BrdSettings->m_ViasMinSize = ValueFromTextCtrl( *m_SetViasMinSizeCtrl );
|
||||
m_BrdSettings->m_ViasMinDrill = ValueFromTextCtrl( *m_SetViasMinDrillCtrl );
|
||||
|
||||
m_BrdSettings.m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1;
|
||||
m_BrdSettings->m_MicroViasAllowed = m_AllowMicroViaCtrl->GetSelection() == 1;
|
||||
|
||||
// Update microvias minimum values for DRC
|
||||
m_BrdSettings.m_MicroViasMinSize = ValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl );
|
||||
m_BrdSettings.m_MicroViasMinDrill = ValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl );
|
||||
m_BrdSettings->m_MicroViasMinSize = ValueFromTextCtrl( *m_SetMicroViasMinSizeCtrl );
|
||||
m_BrdSettings->m_MicroViasMinDrill = ValueFromTextCtrl( *m_SetMicroViasMinDrillCtrl );
|
||||
|
||||
// Update tracks minimum values for DRC
|
||||
m_BrdSettings.m_TrackMinWidth = ValueFromTextCtrl( *m_SetTrackMinWidthCtrl );
|
||||
m_BrdSettings->m_TrackMinWidth = ValueFromTextCtrl( *m_SetTrackMinWidthCtrl );
|
||||
}
|
||||
|
||||
|
||||
|
@ -634,12 +629,12 @@ void DIALOG_DESIGN_RULES::CopyDimensionsListsToBoard()
|
|||
// Sort new list by by increasing value
|
||||
sort( m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
|
||||
|
||||
std::vector <int>* tlist = &m_Parent->GetBoard()->m_TrackWidthList;
|
||||
std::vector<int>* tlist = &m_BrdSettings->m_TrackWidthList;
|
||||
tlist->erase( tlist->begin() + 1, tlist->end() ); // Remove old "custom" sizes
|
||||
tlist->insert( tlist->end(), m_TracksWidthList.begin(), m_TracksWidthList.end() ); //Add new "custom" sizes
|
||||
|
||||
// Reinitialize m_ViaSizeList
|
||||
std::vector <VIA_DIMENSION>* vialist = &m_Parent->GetBoard()->m_ViasDimensionsList;
|
||||
std::vector<VIA_DIMENSION>* vialist = &m_BrdSettings->m_ViasDimensionsList;
|
||||
vialist->erase( vialist->begin() + 1, vialist->end() );
|
||||
vialist->insert( vialist->end(), m_ViasDimensionsList.begin(), m_ViasDimensionsList.end() );
|
||||
}
|
||||
|
@ -671,11 +666,9 @@ void DIALOG_DESIGN_RULES::OnOkButtonClick( wxCommandEvent& event )
|
|||
CopyGlobalRulesToBoard();
|
||||
CopyDimensionsListsToBoard();
|
||||
|
||||
m_Pcb->SetDesignSettings( m_BrdSettings );
|
||||
|
||||
EndModal( wxID_OK );
|
||||
|
||||
m_Pcb->SetCurrentNetClass( NETCLASS::Default );
|
||||
m_BrdSettings->SetCurrentNetClass( NETCLASS::Default );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ private:
|
|||
|
||||
PCB_EDIT_FRAME* m_Parent;
|
||||
BOARD* m_Pcb;
|
||||
BOARD_DESIGN_SETTINGS m_BrdSettings;
|
||||
BOARD_DESIGN_SETTINGS* m_BrdSettings;
|
||||
|
||||
static int s_LastTabSelection; ///< which tab user had open last
|
||||
|
||||
|
|
|
@ -46,21 +46,22 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
|
|||
|
||||
// Display current setup for tracks and vias
|
||||
BOARD* board = m_Parent->GetBoard();
|
||||
NETCLASSES& netclasses = board->m_NetClasses;
|
||||
NETINFO_ITEM* net = board->FindNet( m_Netcode );
|
||||
BOARD_DESIGN_SETTINGS& dsnSettings = board->GetDesignSettings();
|
||||
NETCLASSES& netclasses = dsnSettings.m_NetClasses;
|
||||
NETCLASS* netclass = netclasses.GetDefault();
|
||||
NETINFO_ITEM* net = board->FindNet( m_Netcode );
|
||||
|
||||
if( net )
|
||||
{
|
||||
m_CurrentNetName->SetLabel( net->GetNetname() );
|
||||
m_CurrentNetclassName->SetLabel( board->GetCurrentNetClassName() );
|
||||
netclass = netclasses.Find( board->GetCurrentNetClassName() );
|
||||
m_CurrentNetclassName->SetLabel( dsnSettings.GetCurrentNetClassName() );
|
||||
netclass = netclasses.Find( dsnSettings.GetCurrentNetClassName() );
|
||||
}
|
||||
|
||||
/* Disable the option "copy current to net" if we have only default netclass values
|
||||
* i.e. when m_TrackWidthSelector and m_ViaSizeSelector are set to 0
|
||||
*/
|
||||
if( !board->GetTrackWidthIndex() && !board->GetViaSizeIndex() )
|
||||
if( !dsnSettings.GetTrackWidthIndex() && !dsnSettings.GetViaSizeIndex() )
|
||||
{
|
||||
m_Net2CurrValueButton->Enable( false );
|
||||
m_OptionID = ID_NETCLASS_VALUES_TO_CURRENT_NET;
|
||||
|
@ -77,9 +78,9 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
|
|||
msg = StringFromValue( g_UserUnit, value, true );
|
||||
m_gridDisplayCurrentSettings->SetCellValue( 0, 0, msg );
|
||||
|
||||
if( board->GetTrackWidthIndex() )
|
||||
if( dsnSettings.GetTrackWidthIndex() )
|
||||
{
|
||||
value = board->GetCurrentTrackWidth();
|
||||
value = dsnSettings.GetCurrentTrackWidth();
|
||||
msg = StringFromValue( g_UserUnit, value, true );
|
||||
}
|
||||
else
|
||||
|
@ -91,9 +92,9 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
|
|||
msg = StringFromValue( g_UserUnit, value, true );
|
||||
m_gridDisplayCurrentSettings->SetCellValue( 0, 1, msg );
|
||||
|
||||
if( board->GetViaSizeIndex() )
|
||||
if( dsnSettings.GetViaSizeIndex() )
|
||||
{
|
||||
value = board->GetCurrentViaSize();
|
||||
value = dsnSettings.GetCurrentViaSize();
|
||||
msg = StringFromValue( g_UserUnit, value, true );
|
||||
}
|
||||
else
|
||||
|
@ -103,7 +104,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
|
|||
value = netclass->GetViaDrill(); // Display via drill
|
||||
msg = StringFromValue( g_UserUnit, value, true );
|
||||
m_gridDisplayCurrentSettings->SetCellValue( 0, 2, msg );
|
||||
value = board->GetCurrentViaDrill();
|
||||
value = dsnSettings.GetCurrentViaDrill();
|
||||
if( value >= 0 )
|
||||
msg = StringFromValue( g_UserUnit, value, true );
|
||||
else
|
||||
|
|
|
@ -71,7 +71,7 @@ void DIALOG_PLOT::Init_Dialog()
|
|||
// The reasonable width correction value must be in a range of
|
||||
// [-(MinTrackWidth-1), +(MinClearanceValue-1)] decimils.
|
||||
m_widthAdjustMinValue = -( m_board->GetDesignSettings().m_TrackMinWidth - 1 );
|
||||
m_widthAdjustMaxValue = m_board->GetSmallestClearanceValue() - 1;
|
||||
m_widthAdjustMaxValue = m_board->GetDesignSettings().GetSmallestClearanceValue() - 1;
|
||||
|
||||
switch( m_plotOpts.GetFormat() )
|
||||
{
|
||||
|
|
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* Author: Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Push and Shove router settings dialog.
|
||||
*/
|
||||
|
||||
#include "dialog_pns_settings.h"
|
||||
#include <router/pns_routing_settings.h>
|
||||
|
||||
DIALOG_PNS_SETTINGS::DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ) :
|
||||
DIALOG_PNS_SETTINGS_BASE( aParent ), m_settings( aSettings )
|
||||
{
|
||||
// "Figure out what's best" is not available yet
|
||||
m_mode->Enable( RM_Smart, false );
|
||||
|
||||
// Load widgets' values from settings
|
||||
m_mode->SetSelection( m_settings.Mode() );
|
||||
m_shoveVias->SetValue( m_settings.ShoveVias() );
|
||||
m_backPressure->SetValue( m_settings.JumpOverObstacles() );
|
||||
m_removeLoops->SetValue( m_settings.RemoveLoops() );
|
||||
m_suggestEnding->SetValue( m_settings.SuggestFinish() );
|
||||
m_autoNeckdown->SetValue( m_settings.SmartPads() );
|
||||
m_effort->SetValue( m_settings.OptimizerEffort() );
|
||||
m_smoothDragged->SetValue( m_settings.SmoothDraggedSegments() );
|
||||
m_violateDrc->SetValue( m_settings.CanViolateDRC() );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PNS_SETTINGS::OnClose( wxCloseEvent& aEvent )
|
||||
{
|
||||
// Do nothing, it is result of ESC pressing
|
||||
EndModal( 0 );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PNS_SETTINGS::OnOkClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
// Save widgets' values to settings
|
||||
m_settings.SetMode( (PNS_MODE) m_mode->GetSelection() );
|
||||
m_settings.SetShoveVias( m_shoveVias->GetValue() );
|
||||
m_settings.SetJumpOverObstacles( m_backPressure->GetValue() );
|
||||
m_settings.SetRemoveLoops( m_removeLoops->GetValue() );
|
||||
m_settings.SetSuggestFinish ( m_suggestEnding->GetValue() );
|
||||
m_settings.SetSmartPads( m_autoNeckdown->GetValue() );
|
||||
m_settings.SetOptimizerEffort( (PNS_OPTIMIZATION_EFFORT) m_effort->GetValue() );
|
||||
m_settings.SetSmoothDraggedSegments( m_smoothDragged->GetValue() );
|
||||
m_settings.SetCanViolateDRC( m_violateDrc->GetValue() );
|
||||
|
||||
EndModal( 1 );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_PNS_SETTINGS::OnCancelClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
// Do nothing
|
||||
EndModal( 0 );
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* Author: Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Push and Shove router settings dialog.
|
||||
*/
|
||||
|
||||
#ifndef __dialog_pns_settings__
|
||||
#define __dialog_pns_settings__
|
||||
|
||||
#include "dialog_pns_settings_base.h"
|
||||
|
||||
class PNS_ROUTING_SETTINGS;
|
||||
|
||||
class DIALOG_PNS_SETTINGS : public DIALOG_PNS_SETTINGS_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_PNS_SETTINGS( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings );
|
||||
|
||||
virtual void OnClose( wxCloseEvent& aEvent );
|
||||
virtual void OnOkClick( wxCommandEvent& aEvent );
|
||||
virtual void OnCancelClick( wxCommandEvent& aEvent );
|
||||
|
||||
private:
|
||||
PNS_ROUTING_SETTINGS& m_settings;
|
||||
};
|
||||
|
||||
#endif // __dialog_pns_settings__
|
|
@ -0,0 +1,127 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 30 2013)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_pns_settings_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_PNS_SETTINGS_BASE::DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bMainSizer;
|
||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
wxString m_modeChoices[] = { _("Highlight collisions"), _("Shove"), _("Walk around"), _("Figure out what's best") };
|
||||
int m_modeNChoices = sizeof( m_modeChoices ) / sizeof( wxString );
|
||||
m_mode = new wxRadioBox( this, wxID_ANY, _("Mode"), wxDefaultPosition, wxDefaultSize, m_modeNChoices, m_modeChoices, 1, wxRA_SPECIFY_COLS );
|
||||
m_mode->SetSelection( 1 );
|
||||
bMainSizer->Add( m_mode, 0, wxALL, 5 );
|
||||
|
||||
wxStaticBoxSizer* bOptions;
|
||||
bOptions = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
|
||||
|
||||
m_shoveVias = new wxCheckBox( this, wxID_ANY, _("Shove vias"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bOptions->Add( m_shoveVias, 0, wxALL, 5 );
|
||||
|
||||
m_backPressure = new wxCheckBox( this, wxID_ANY, _("Jump over obstacles"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bOptions->Add( m_backPressure, 0, wxALL, 5 );
|
||||
|
||||
m_removeLoops = new wxCheckBox( this, wxID_ANY, _("Remove redundant tracks"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bOptions->Add( m_removeLoops, 0, wxALL, 5 );
|
||||
|
||||
m_autoNeckdown = new wxCheckBox( this, wxID_ANY, _("Automatic neckdown"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bOptions->Add( m_autoNeckdown, 0, wxALL, 5 );
|
||||
|
||||
m_smoothDragged = new wxCheckBox( this, wxID_ANY, _("Smooth dragged segments"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bOptions->Add( m_smoothDragged, 0, wxALL, 5 );
|
||||
|
||||
m_violateDrc = new wxCheckBox( this, wxID_ANY, _("Allow DRC violations"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bOptions->Add( m_violateDrc, 0, wxALL, 5 );
|
||||
|
||||
m_suggestEnding = new wxCheckBox( this, wxID_ANY, _("Suggest track finish"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_suggestEnding->Enable( false );
|
||||
|
||||
bOptions->Add( m_suggestEnding, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bEffort;
|
||||
bEffort = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_effortLabel = new wxStaticText( this, wxID_ANY, _("Optimizer effort"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_effortLabel->Wrap( -1 );
|
||||
bEffort->Add( m_effortLabel, 1, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
|
||||
|
||||
|
||||
bEffort->Add( 0, 0, 0, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSlider;
|
||||
bSlider = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_effort = new wxSlider( this, wxID_ANY, 1, 0, 2, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_BOTTOM|wxSL_HORIZONTAL|wxSL_TOP );
|
||||
bSlider->Add( m_effort, 1, wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bSliderLabels;
|
||||
bSliderLabels = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_lowLabel = new wxStaticText( this, wxID_ANY, _("low"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_lowLabel->Wrap( -1 );
|
||||
m_lowLabel->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) );
|
||||
|
||||
bSliderLabels->Add( m_lowLabel, 0, 0, 5 );
|
||||
|
||||
|
||||
bSliderLabels->Add( 0, 0, 1, wxEXPAND, 5 );
|
||||
|
||||
m_highLabel = new wxStaticText( this, wxID_ANY, _("high"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_highLabel->Wrap( -1 );
|
||||
m_highLabel->SetFont( wxFont( 8, 70, 90, 90, false, wxEmptyString ) );
|
||||
|
||||
bSliderLabels->Add( m_highLabel, 0, 0, 5 );
|
||||
|
||||
|
||||
bSlider->Add( bSliderLabels, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bEffort->Add( bSlider, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bOptions->Add( bEffort, 1, wxALL|wxEXPAND, 5 );
|
||||
|
||||
wxBoxSizer* bButtons;
|
||||
bButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_ok = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_ok->SetDefault();
|
||||
bButtons->Add( m_ok, 1, wxALL, 5 );
|
||||
|
||||
m_cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bButtons->Add( m_cancel, 1, wxALL, 5 );
|
||||
|
||||
|
||||
bOptions->Add( bButtons, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
bMainSizer->Add( bOptions, 1, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bMainSizer );
|
||||
this->Layout();
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_SETTINGS_BASE::OnClose ) );
|
||||
m_ok->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnOkClick ), NULL, this );
|
||||
m_cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnCancelClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_PNS_SETTINGS_BASE::~DIALOG_PNS_SETTINGS_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_PNS_SETTINGS_BASE::OnClose ) );
|
||||
m_ok->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnOkClick ), NULL, this );
|
||||
m_cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PNS_SETTINGS_BASE::OnCancelClick ), NULL, this );
|
||||
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,67 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 30 2013)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_PNS_SETTINGS_BASE_H__
|
||||
#define __DIALOG_PNS_SETTINGS_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/radiobox.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/checkbox.h>
|
||||
#include <wx/stattext.h>
|
||||
#include <wx/slider.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/statbox.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_PNS_SETTINGS_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_PNS_SETTINGS_BASE : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
wxRadioBox* m_mode;
|
||||
wxCheckBox* m_shoveVias;
|
||||
wxCheckBox* m_backPressure;
|
||||
wxCheckBox* m_removeLoops;
|
||||
wxCheckBox* m_autoNeckdown;
|
||||
wxCheckBox* m_smoothDragged;
|
||||
wxCheckBox* m_violateDrc;
|
||||
wxCheckBox* m_suggestEnding;
|
||||
wxStaticText* m_effortLabel;
|
||||
wxSlider* m_effort;
|
||||
wxStaticText* m_lowLabel;
|
||||
wxStaticText* m_highLabel;
|
||||
wxButton* m_ok;
|
||||
wxButton* m_cancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void OnClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_PNS_SETTINGS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Interactive Router settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 289,504 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~DIALOG_PNS_SETTINGS_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_PNS_SETTINGS_BASE_H__
|
|
@ -0,0 +1,91 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* Author: Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Push and Shove router track width and via size dialog.
|
||||
*/
|
||||
|
||||
#include "dialog_track_via_size.h"
|
||||
#include <router/pns_routing_settings.h>
|
||||
#include <base_units.h>
|
||||
#include <confirm.h>
|
||||
|
||||
DIALOG_TRACK_VIA_SIZE::DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings ) :
|
||||
DIALOG_TRACK_VIA_SIZE_BASE( aParent ),
|
||||
m_settings( aSettings )
|
||||
{
|
||||
// Load router settings to dialog fields
|
||||
m_trackWidth->SetValue( To_User_Unit( m_trackWidth->GetUnits(), m_settings.GetTrackWidth() ) );
|
||||
m_viaDiameter->SetValue( To_User_Unit( m_viaDiameter->GetUnits(), m_settings.GetViaDiameter() ) );
|
||||
m_viaDrill->SetValue( To_User_Unit( m_viaDrill->GetUnits(), m_settings.GetViaDrill() ) );
|
||||
|
||||
m_trackWidth->SetFocus();
|
||||
|
||||
// Pressing ENTER when any of the text input fields is active applies changes
|
||||
#if wxCHECK_VERSION( 3, 0, 0 )
|
||||
Connect( wxEVT_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE::onOkClick ), NULL, this );
|
||||
#else
|
||||
Connect( wxEVT_COMMAND_TEXT_ENTER, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE::onOkClick ), NULL, this );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
bool DIALOG_TRACK_VIA_SIZE::check()
|
||||
{
|
||||
// Wrong input
|
||||
if( !m_trackWidth->GetValue() || !m_viaDiameter->GetValue() || !m_viaDrill->GetValue() )
|
||||
return false;
|
||||
|
||||
// Via drill should be smaller than via diameter
|
||||
if( *m_viaDrill->GetValue() >= m_viaDiameter->GetValue() )
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_TRACK_VIA_SIZE::onClose( wxCloseEvent& aEvent )
|
||||
{
|
||||
EndModal( 0 );
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_TRACK_VIA_SIZE::onOkClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
if( check() )
|
||||
{
|
||||
// Store dialog values to the router settings
|
||||
m_settings.SetTrackWidth( From_User_Unit( m_trackWidth->GetUnits(), *m_trackWidth->GetValue() ) );
|
||||
m_settings.SetViaDiameter( From_User_Unit( m_viaDiameter->GetUnits(), *m_viaDiameter->GetValue() ) );
|
||||
m_settings.SetViaDrill( From_User_Unit( m_viaDrill->GetUnits(), *m_viaDrill->GetValue() ) );
|
||||
EndModal( 1 );
|
||||
}
|
||||
else
|
||||
{
|
||||
DisplayError( GetParent(), _( "Settings are incorrect" ) );
|
||||
m_trackWidth->SetFocus();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_TRACK_VIA_SIZE::onCancelClick( wxCommandEvent& aEvent )
|
||||
{
|
||||
EndModal( 0 );
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2014 CERN
|
||||
* Author: Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Push and Shove router track width and via size dialog.
|
||||
*/
|
||||
|
||||
#ifndef __dialog_track_via_size__
|
||||
#define __dialog_track_via_size__
|
||||
|
||||
#include "dialog_track_via_size_base.h"
|
||||
|
||||
class PNS_ROUTING_SETTINGS;
|
||||
|
||||
/** Implementing DIALOG_TRACK_VIA_SIZE_BASE */
|
||||
class DIALOG_TRACK_VIA_SIZE : public DIALOG_TRACK_VIA_SIZE_BASE
|
||||
{
|
||||
public:
|
||||
/** Constructor */
|
||||
DIALOG_TRACK_VIA_SIZE( wxWindow* aParent, PNS_ROUTING_SETTINGS& aSettings );
|
||||
|
||||
protected:
|
||||
// Routings settings that are modified by the dialog.
|
||||
PNS_ROUTING_SETTINGS& m_settings;
|
||||
|
||||
///> Checks if values given in the dialog are sensible.
|
||||
bool check();
|
||||
|
||||
// Handlers for DIALOG_TRACK_VIA_SIZE_BASE events.
|
||||
void onClose( wxCloseEvent& aEvent );
|
||||
void onOkClick( wxCommandEvent& aEvent );
|
||||
void onCancelClick( wxCommandEvent& aEvent );
|
||||
};
|
||||
|
||||
#endif // __dialog_track_via_size__
|
|
@ -0,0 +1,59 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 30 2013)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "dialog_track_via_size_base.h"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
DIALOG_TRACK_VIA_SIZE_BASE::DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
||||
{
|
||||
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||
|
||||
wxBoxSizer* bSizes;
|
||||
bSizes = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_trackWidth = new WX_UNIT_TEXT( this, _("Track width:") );
|
||||
bSizes->Add( m_trackWidth, 0, wxALL, 5 );
|
||||
|
||||
m_viaDiameter = new WX_UNIT_TEXT( this, _("Via diameter:") );
|
||||
bSizes->Add( m_viaDiameter, 0, wxALL, 5 );
|
||||
|
||||
m_viaDrill = new WX_UNIT_TEXT( this, _("Via drill:") );
|
||||
bSizes->Add( m_viaDrill, 0, wxALL, 5 );
|
||||
|
||||
wxBoxSizer* bButtons;
|
||||
bButtons = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
m_ok = new wxButton( this, wxID_OK, _("OK"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bButtons->Add( m_ok, 1, wxALL, 5 );
|
||||
|
||||
m_cancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bButtons->Add( m_cancel, 1, wxALL, 5 );
|
||||
|
||||
|
||||
bSizes->Add( bButtons, 0, wxEXPAND, 5 );
|
||||
|
||||
|
||||
this->SetSizer( bSizes );
|
||||
this->Layout();
|
||||
|
||||
this->Centre( wxBOTH );
|
||||
|
||||
// Connect Events
|
||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onClose ) );
|
||||
m_ok->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this );
|
||||
m_cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this );
|
||||
}
|
||||
|
||||
DIALOG_TRACK_VIA_SIZE_BASE::~DIALOG_TRACK_VIA_SIZE_BASE()
|
||||
{
|
||||
// Disconnect Events
|
||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onClose ) );
|
||||
m_ok->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onOkClick ), NULL, this );
|
||||
m_cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_TRACK_VIA_SIZE_BASE::onCancelClick ), NULL, this );
|
||||
|
||||
}
|
|
@ -0,0 +1,539 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<wxFormBuilder_Project>
|
||||
<FileVersion major="1" minor="11" />
|
||||
<object class="Project" expanded="1">
|
||||
<property name="class_decoration"></property>
|
||||
<property name="code_generation">C++</property>
|
||||
<property name="disconnect_events">1</property>
|
||||
<property name="disconnect_mode">source_name</property>
|
||||
<property name="disconnect_php_events">0</property>
|
||||
<property name="disconnect_python_events">0</property>
|
||||
<property name="embedded_files_path">res</property>
|
||||
<property name="encoding">UTF-8</property>
|
||||
<property name="event_generation">connect</property>
|
||||
<property name="file">dialog_track_via_size_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">DIALOG_TRACK_VIA_SIZE_BASE</property>
|
||||
<property name="namespace"></property>
|
||||
<property name="path">.</property>
|
||||
<property name="precompiled_header"></property>
|
||||
<property name="relative_path">1</property>
|
||||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="use_enum">0</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Dialog" expanded="1">
|
||||
<property name="aui_managed">0</property>
|
||||
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||
<property name="bg"></property>
|
||||
<property name="center">wxBOTH</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="event_handler">impl_virtual</property>
|
||||
<property name="extra_style"></property>
|
||||
<property name="fg"></property>
|
||||
<property name="font"></property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">DIALOG_TRACK_VIA_SIZE_BASE</property>
|
||||
<property name="pos"></property>
|
||||
<property name="size">388,164</property>
|
||||
<property name="style">wxDEFAULT_DIALOG_STYLE</property>
|
||||
<property name="subclass"></property>
|
||||
<property name="title">Track width and via size</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnActivate"></event>
|
||||
<event name="OnActivateApp"></event>
|
||||
<event name="OnAuiFindManager"></event>
|
||||
<event name="OnAuiPaneButton"></event>
|
||||
<event name="OnAuiPaneClose"></event>
|
||||
<event name="OnAuiPaneMaximize"></event>
|
||||
<event name="OnAuiPaneRestore"></event>
|
||||
<event name="OnAuiRender"></event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnClose">onClose</event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnHibernate"></event>
|
||||
<event name="OnIconize"></event>
|
||||
<event name="OnIdle"></event>
|
||||
<event name="OnInitDialog"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bSizes</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="CustomControl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="class">WX_UNIT_TEXT</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="construction">m_trackWidth = new WX_UNIT_TEXT( this, _("Track width:") );</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="declaration">WX_UNIT_TEXT* m_trackWidth;</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="include">#include <wxunittext.h></property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_trackWidth</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="settings"></property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="CustomControl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="class">WX_UNIT_TEXT</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="construction">m_viaDiameter = new WX_UNIT_TEXT( this, _("Via diameter:") );</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="declaration">WX_UNIT_TEXT* m_viaDiameter;</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="include">#include <wxunittext.h></property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_viaDiameter</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="settings"></property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="CustomControl" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="class">WX_UNIT_TEXT</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="construction">m_viaDrill = new WX_UNIT_TEXT( this, _("Via drill:") );</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="declaration">WX_UNIT_TEXT* m_viaDrill;</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="include">#include <wxunittext.h></property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_viaDrill</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="settings"></property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxBoxSizer" expanded="1">
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">bButtons</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_OK</property>
|
||||
<property name="label">OK</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_ok</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">onOkClick</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxButton" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default">0</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_CANCEL</property>
|
||||
<property name="label">Cancel</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_cancel</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip"></property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
<event name="OnButtonClick">onCancelClick</event>
|
||||
<event name="OnChar"></event>
|
||||
<event name="OnEnterWindow"></event>
|
||||
<event name="OnEraseBackground"></event>
|
||||
<event name="OnKeyDown"></event>
|
||||
<event name="OnKeyUp"></event>
|
||||
<event name="OnKillFocus"></event>
|
||||
<event name="OnLeaveWindow"></event>
|
||||
<event name="OnLeftDClick"></event>
|
||||
<event name="OnLeftDown"></event>
|
||||
<event name="OnLeftUp"></event>
|
||||
<event name="OnMiddleDClick"></event>
|
||||
<event name="OnMiddleDown"></event>
|
||||
<event name="OnMiddleUp"></event>
|
||||
<event name="OnMotion"></event>
|
||||
<event name="OnMouseEvents"></event>
|
||||
<event name="OnMouseWheel"></event>
|
||||
<event name="OnPaint"></event>
|
||||
<event name="OnRightDClick"></event>
|
||||
<event name="OnRightDown"></event>
|
||||
<event name="OnRightUp"></event>
|
||||
<event name="OnSetFocus"></event>
|
||||
<event name="OnSize"></event>
|
||||
<event name="OnUpdateUI"></event>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</wxFormBuilder_Project>
|
|
@ -0,0 +1,54 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Apr 30 2013)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __DIALOG_TRACK_VIA_SIZE_BASE_H__
|
||||
#define __DIALOG_TRACK_VIA_SIZE_BASE_H__
|
||||
|
||||
#include <wx/artprov.h>
|
||||
#include <wx/xrc/xmlres.h>
|
||||
#include <wx/intl.h>
|
||||
#include <wxunittext.h>
|
||||
#include <wx/gdicmn.h>
|
||||
#include <wx/font.h>
|
||||
#include <wx/colour.h>
|
||||
#include <wx/settings.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/button.h>
|
||||
#include <wx/sizer.h>
|
||||
#include <wx/dialog.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
/// Class DIALOG_TRACK_VIA_SIZE_BASE
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
class DIALOG_TRACK_VIA_SIZE_BASE : public wxDialog
|
||||
{
|
||||
private:
|
||||
|
||||
protected:
|
||||
WX_UNIT_TEXT* m_trackWidth;
|
||||
WX_UNIT_TEXT* m_viaDiameter;
|
||||
WX_UNIT_TEXT* m_viaDrill;
|
||||
wxButton* m_ok;
|
||||
wxButton* m_cancel;
|
||||
|
||||
// Virtual event handlers, overide them in your derived class
|
||||
virtual void onClose( wxCloseEvent& event ) { event.Skip(); }
|
||||
virtual void onOkClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
virtual void onCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||
|
||||
|
||||
public:
|
||||
|
||||
DIALOG_TRACK_VIA_SIZE_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Track width and via size"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 388,164 ), long style = wxDEFAULT_DIALOG_STYLE );
|
||||
~DIALOG_TRACK_VIA_SIZE_BASE();
|
||||
|
||||
};
|
||||
|
||||
#endif //__DIALOG_TRACK_VIA_SIZE_BASE_H__
|
|
@ -403,7 +403,7 @@ bool DRC::testNetClasses()
|
|||
{
|
||||
bool ret = true;
|
||||
|
||||
NETCLASSES& netclasses = m_pcb->m_NetClasses;
|
||||
NETCLASSES& netclasses = m_pcb->GetDesignSettings().m_NetClasses;
|
||||
|
||||
wxString msg; // construct this only once here, not in a loop, since somewhat expensive.
|
||||
|
||||
|
|
|
@ -154,6 +154,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
|||
wxPoint shape_pos;
|
||||
|
||||
NETCLASS* netclass = aRefSeg->GetNetClass();
|
||||
BOARD_DESIGN_SETTINGS& dsnSettings = m_pcb->GetDesignSettings();
|
||||
|
||||
/* In order to make some calculations more easier or faster,
|
||||
* pads and tracks coordinates will be made relative to the reference segment origin
|
||||
|
@ -173,7 +174,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
|||
// test if the via size is smaller than minimum
|
||||
if( refvia->GetViaType() == VIA_MICROVIA )
|
||||
{
|
||||
if( refvia->GetWidth() < netclass->GetuViaMinDiameter() )
|
||||
if( refvia->GetWidth() < dsnSettings.m_MicroViasMinSize )
|
||||
{
|
||||
m_currentMarker = fillMarker( refvia, NULL,
|
||||
DRCE_TOO_SMALL_MICROVIA, m_currentMarker );
|
||||
|
@ -182,7 +183,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
|||
}
|
||||
else
|
||||
{
|
||||
if( refvia->GetWidth() < netclass->GetViaMinDiameter() )
|
||||
if( refvia->GetWidth() < dsnSettings.m_ViasMinSize )
|
||||
{
|
||||
m_currentMarker = fillMarker( refvia, NULL,
|
||||
DRCE_TOO_SMALL_VIA, m_currentMarker );
|
||||
|
@ -231,7 +232,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
|
|||
}
|
||||
else // This is a track segment
|
||||
{
|
||||
if( aRefSeg->GetWidth() < netclass->GetTrackMinWidth() )
|
||||
if( aRefSeg->GetWidth() < dsnSettings.m_TrackMinWidth )
|
||||
{
|
||||
m_currentMarker = fillMarker( aRefSeg, NULL,
|
||||
DRCE_TOO_SMALL_TRACK_WIDTH, m_currentMarker );
|
||||
|
|
|
@ -1146,7 +1146,7 @@ BOARD* EAGLE_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe, const
|
|||
|
||||
if( m_rules->mdWireWire )
|
||||
{
|
||||
NETCLASS* defaultNetclass = m_board->m_NetClasses.GetDefault();
|
||||
NETCLASS* defaultNetclass = designSettings.GetDefault();
|
||||
int clearance = KiROUND( m_rules->mdWireWire );
|
||||
|
||||
if( clearance < defaultNetclass->GetClearance() )
|
||||
|
|
|
@ -1391,15 +1391,15 @@ void PCB_EDIT_FRAME::OnSelectTool( wxCommandEvent& aEvent )
|
|||
// Cancel the current tool
|
||||
// TODO while sending a lot of cancel events works for sure, it is not the most
|
||||
// elegant way to cancel a tool, this should be probably done another way
|
||||
while( m_toolManager.GetCurrentTool()->GetName() != "pcbnew.InteractiveSelection" &&
|
||||
while( m_toolManager->GetCurrentTool()->GetName() != "pcbnew.InteractiveSelection" &&
|
||||
trials++ < MAX_TRIALS )
|
||||
{
|
||||
TOOL_EVENT cancel( TC_ANY, TA_CANCEL_TOOL );
|
||||
m_toolManager.ProcessEvent( cancel );
|
||||
m_toolManager->ProcessEvent( cancel );
|
||||
}
|
||||
|
||||
if( !actionName.empty() )
|
||||
m_toolManager.RunAction( actionName );
|
||||
m_toolManager->RunAction( actionName );
|
||||
}
|
||||
}
|
||||
else
|
||||
|
|
|
@ -43,7 +43,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
|||
if( net )
|
||||
new_width = net->GetTrackWidth();
|
||||
else
|
||||
new_width = GetBoard()->GetCurrentTrackWidth();
|
||||
new_width = GetDesignSettings().GetCurrentTrackWidth();
|
||||
|
||||
if( aTrackItem->Type() == PCB_VIA_T )
|
||||
{
|
||||
|
@ -58,8 +58,8 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
|||
}
|
||||
else
|
||||
{
|
||||
new_width = GetBoard()->GetCurrentViaSize();
|
||||
new_drill = GetBoard()->GetCurrentViaDrill();
|
||||
new_width = GetDesignSettings().GetCurrentViaSize();
|
||||
new_drill = GetDesignSettings().GetCurrentViaDrill();
|
||||
}
|
||||
|
||||
if( via->GetViaType() == VIA_MICROVIA )
|
||||
|
@ -67,7 +67,7 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
|||
if( net )
|
||||
new_width = net->GetMicroViaSize();
|
||||
else
|
||||
new_width = GetBoard()->GetCurrentMicroViaSize();
|
||||
new_width = GetDesignSettings().GetCurrentMicroViaSize();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -98,7 +98,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
|||
VIA* via = new VIA( GetBoard() );
|
||||
via->SetFlags( IS_NEW );
|
||||
via->SetViaType( GetDesignSettings().m_CurrentViaType );
|
||||
via->SetWidth( GetBoard()->GetCurrentViaSize());
|
||||
via->SetWidth( GetDesignSettings().GetCurrentViaSize());
|
||||
via->SetNetCode( GetBoard()->GetHighLightNetCode() );
|
||||
via->SetEnd( g_CurrentTrackSegment->GetEnd() );
|
||||
via->SetStart( g_CurrentTrackSegment->GetEnd() );
|
||||
|
@ -106,7 +106,7 @@ bool PCB_EDIT_FRAME::Other_Layer_Route( TRACK* aTrack, wxDC* DC )
|
|||
// Usual via is from copper to component.
|
||||
// layer pair is LAYER_N_BACK and LAYER_N_FRONT.
|
||||
via->SetLayerPair( LAYER_N_BACK, LAYER_N_FRONT );
|
||||
via->SetDrill( GetBoard()->GetCurrentViaDrill() );
|
||||
via->SetDrill( GetDesignSettings().GetCurrentViaDrill() );
|
||||
|
||||
LAYER_NUM first_layer = GetActiveLayer();
|
||||
LAYER_NUM last_layer;
|
||||
|
|
|
@ -167,12 +167,12 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
|
|||
|
||||
// Display info about track Net class, and init track and vias sizes:
|
||||
g_CurrentTrackSegment->SetNetCode( GetBoard()->GetHighLightNetCode() );
|
||||
GetBoard()->SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
|
||||
GetDesignSettings().SetCurrentNetClass( g_CurrentTrackSegment->GetNetClassName() );
|
||||
|
||||
g_CurrentTrackSegment->SetLayer( GetScreen()->m_Active_Layer );
|
||||
g_CurrentTrackSegment->SetWidth( GetBoard()->GetCurrentTrackWidth() );
|
||||
g_CurrentTrackSegment->SetWidth( GetDesignSettings().GetCurrentTrackWidth() );
|
||||
|
||||
if( GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth )
|
||||
if( GetDesignSettings().m_UseConnectedTrackWidth )
|
||||
{
|
||||
if( TrackOnStartPoint && TrackOnStartPoint->Type() == PCB_TRACE_T )
|
||||
g_CurrentTrackSegment->SetWidth( TrackOnStartPoint->GetWidth());
|
||||
|
@ -282,8 +282,8 @@ TRACK* PCB_EDIT_FRAME::Begin_Route( TRACK* aTrack, wxDC* aDC )
|
|||
|
||||
newTrack->SetLayer( GetScreen()->m_Active_Layer );
|
||||
|
||||
if( !GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth )
|
||||
newTrack->SetWidth( GetBoard()->GetCurrentTrackWidth() );
|
||||
if( !GetDesignSettings().m_UseConnectedTrackWidth )
|
||||
newTrack->SetWidth( GetDesignSettings().GetCurrentTrackWidth() );
|
||||
|
||||
DBG( g_CurrentTrackList.VerifyListIntegrity(); );
|
||||
|
||||
|
@ -691,7 +691,7 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
|||
DisplayOpt.ShowTrackClearanceMode = SHOW_CLEARANCE_ALWAYS;
|
||||
|
||||
// Values to Via circle
|
||||
int boardViaRadius = frame->GetBoard()->GetCurrentViaSize()/2;
|
||||
int boardViaRadius = frame->GetDesignSettings().GetCurrentViaSize()/2;
|
||||
int viaRadiusWithClearence = boardViaRadius+netclass->GetClearance();
|
||||
EDA_RECT* panelClipBox=aPanel->GetClipBox();
|
||||
|
||||
|
@ -718,8 +718,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
|||
// Set track parameters, that can be modified while creating the track
|
||||
g_CurrentTrackSegment->SetLayer( screen->m_Active_Layer );
|
||||
|
||||
if( !frame->GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth )
|
||||
g_CurrentTrackSegment->SetWidth( frame->GetBoard()->GetCurrentTrackWidth() );
|
||||
if( !frame->GetDesignSettings().m_UseConnectedTrackWidth )
|
||||
g_CurrentTrackSegment->SetWidth( frame->GetDesignSettings().GetCurrentTrackWidth() );
|
||||
|
||||
if( g_TwoSegmentTrackBuild )
|
||||
{
|
||||
|
@ -729,8 +729,8 @@ void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPo
|
|||
{
|
||||
previous_track->SetLayer( screen->m_Active_Layer );
|
||||
|
||||
if( !frame->GetBoard()->GetDesignSettings().m_UseConnectedTrackWidth )
|
||||
previous_track->SetWidth( frame->GetBoard()->GetCurrentTrackWidth() );
|
||||
if( !frame->GetDesignSettings().m_UseConnectedTrackWidth )
|
||||
previous_track->SetWidth( frame->GetDesignSettings().GetCurrentTrackWidth() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,8 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
|
|||
|
||||
case ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES:
|
||||
GetDesignSettings().m_UseConnectedTrackWidth = false;
|
||||
GetBoard()->SetTrackWidthIndex( 0 );
|
||||
GetBoard()->SetViaSizeIndex( 0 );
|
||||
GetDesignSettings().SetTrackWidthIndex( 0 );
|
||||
GetDesignSettings().SetViaSizeIndex( 0 );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_SELECT_AUTO_WIDTH:
|
||||
|
@ -69,7 +69,7 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
|
|||
m_canvas->MoveCursorToCrossHair();
|
||||
GetDesignSettings().m_UseConnectedTrackWidth = false;
|
||||
ii = id - ID_POPUP_PCB_SELECT_WIDTH1;
|
||||
GetBoard()->SetTrackWidthIndex( ii );
|
||||
GetDesignSettings().SetTrackWidthIndex( ii );
|
||||
break;
|
||||
|
||||
case ID_POPUP_PCB_SELECT_VIASIZE1: // this is the default Netclass selection
|
||||
|
@ -91,17 +91,17 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
|
|||
// select the new current value for via size (via diameter)
|
||||
m_canvas->MoveCursorToCrossHair();
|
||||
ii = id - ID_POPUP_PCB_SELECT_VIASIZE1;
|
||||
GetBoard()->SetViaSizeIndex( ii );
|
||||
GetDesignSettings().SetViaSizeIndex( ii );
|
||||
break;
|
||||
|
||||
case ID_AUX_TOOLBAR_PCB_TRACK_WIDTH:
|
||||
ii = m_SelTrackWidthBox->GetCurrentSelection();
|
||||
GetBoard()->SetTrackWidthIndex( ii );
|
||||
GetDesignSettings().SetTrackWidthIndex( ii );
|
||||
break;
|
||||
|
||||
case ID_AUX_TOOLBAR_PCB_VIA_SIZE:
|
||||
ii = m_SelViaSizeBox->GetCurrentSelection();
|
||||
GetBoard()->SetViaSizeIndex( ii );
|
||||
GetDesignSettings().SetViaSizeIndex( ii );
|
||||
break;
|
||||
|
||||
default:
|
||||
|
|
|
@ -356,7 +356,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
}
|
||||
else
|
||||
{
|
||||
GetBoard()->m_NetClasses.Clear();
|
||||
GetDesignSettings().m_NetClasses.Clear();
|
||||
}
|
||||
|
||||
BOARD* loadedBoard = 0; // it will be set to non-NULL if loaded OK
|
||||
|
@ -485,7 +485,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
|
|||
#endif
|
||||
|
||||
// Update info shown by the horizontal toolbars
|
||||
GetBoard()->SetCurrentNetClass( NETCLASS::Default );
|
||||
GetDesignSettings().SetCurrentNetClass( NETCLASS::Default );
|
||||
ReFillLayerWidget();
|
||||
ReCreateLayerBox();
|
||||
|
||||
|
@ -678,7 +678,7 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
|
|||
|
||||
// Select default Netclass before writing file.
|
||||
// Useful to save default values in headers
|
||||
GetBoard()->SetCurrentNetClass( GetBoard()->m_NetClasses.GetDefault()->GetName() );
|
||||
GetDesignSettings().SetCurrentNetClass( NETCLASS::Default );
|
||||
|
||||
try
|
||||
{
|
||||
|
|
|
@ -199,10 +199,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
|||
if( GetCanvas()->IsMouseCaptured() )
|
||||
GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false );
|
||||
|
||||
if( GetBoard()->GetTrackWidthIndex() < GetBoard()->m_TrackWidthList.size() - 1 )
|
||||
GetBoard()->SetTrackWidthIndex( GetBoard()->GetTrackWidthIndex() + 1 );
|
||||
if( GetDesignSettings().GetTrackWidthIndex() < GetDesignSettings().m_TrackWidthList.size() - 1 )
|
||||
GetDesignSettings().SetTrackWidthIndex( GetDesignSettings().GetTrackWidthIndex() + 1 );
|
||||
else
|
||||
GetBoard()->SetTrackWidthIndex( 0 );
|
||||
GetDesignSettings().SetTrackWidthIndex( 0 );
|
||||
|
||||
if( GetCanvas()->IsMouseCaptured() )
|
||||
GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false );
|
||||
|
@ -213,10 +213,10 @@ void PCB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotkeyCode, const wxPoint& aPosit
|
|||
if( GetCanvas()->IsMouseCaptured() )
|
||||
GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false );
|
||||
|
||||
if( GetBoard()->GetTrackWidthIndex() <= 0 )
|
||||
GetBoard()->SetTrackWidthIndex( GetBoard()->m_TrackWidthList.size() -1 );
|
||||
if( GetDesignSettings().GetTrackWidthIndex() <= 0 )
|
||||
GetDesignSettings().SetTrackWidthIndex( GetDesignSettings().m_TrackWidthList.size() -1 );
|
||||
else
|
||||
GetBoard()->SetTrackWidthIndex( GetBoard()->GetTrackWidthIndex() - 1 );
|
||||
GetDesignSettings().SetTrackWidthIndex( GetDesignSettings().GetTrackWidthIndex() - 1 );
|
||||
|
||||
if( GetCanvas()->IsMouseCaptured() )
|
||||
GetCanvas()->CallMouseCapture( aDC, wxDefaultPosition, false );
|
||||
|
|
|
@ -60,6 +60,17 @@
|
|||
*/
|
||||
static const wxString traceFootprintLibrary( wxT( "KicadFootprintLib" ) );
|
||||
|
||||
///> Removes empty nets (i.e. with node count equal zero) from net classes
|
||||
void filterNetClass( const BOARD& aBoard, NETCLASS& aNetClass )
|
||||
{
|
||||
for( NETCLASS::const_iterator it = aNetClass.begin(); it != aNetClass.end(); ++it )
|
||||
{
|
||||
NETINFO_ITEM* netinfo = aBoard.FindNet( *it );
|
||||
|
||||
if( netinfo && netinfo->GetNodesCount() <= 0 ) // hopefully there are no nets with negative
|
||||
aNetClass.Remove( it ); // node count, but you never know..
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Class FP_CACHE_ITEM
|
||||
|
@ -483,6 +494,8 @@ void PCB_IO::formatLayer( const BOARD_ITEM* aItem ) const
|
|||
void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
const BOARD_DESIGN_SETTINGS& dsnSettings = aBoard->GetDesignSettings();
|
||||
|
||||
m_out->Print( 0, "\n" );
|
||||
|
||||
m_out->Print( aNestLevel, "(general\n" );
|
||||
|
@ -496,7 +509,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
|
|||
FMTIU( aBoard->GetBoundingBox().GetRight() ).c_str(),
|
||||
FMTIU( aBoard->GetBoundingBox().GetBottom() ).c_str() );
|
||||
m_out->Print( aNestLevel+1, "(thickness %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().GetBoardThickness() ).c_str() );
|
||||
FMTIU( dsnSettings.GetBoardThickness() ).c_str() );
|
||||
|
||||
m_out->Print( aNestLevel+1, "(drawings %d)\n", aBoard->m_Drawings.GetCount() );
|
||||
m_out->Print( aNestLevel+1, "(tracks %d)\n", aBoard->GetNumSegmTrack() );
|
||||
|
@ -551,15 +564,15 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
|
|||
|
||||
// Save current default track width, for compatibility with older Pcbnew version;
|
||||
m_out->Print( aNestLevel+1, "(last_trace_width %s)\n",
|
||||
FMTIU( aBoard->GetCurrentTrackWidth() ).c_str() );
|
||||
FMTIU( dsnSettings.GetCurrentTrackWidth() ).c_str() );
|
||||
|
||||
// Save custom tracks width list (the first is not saved here: this is the netclass value
|
||||
for( unsigned ii = 1; ii < aBoard->m_TrackWidthList.size(); ii++ )
|
||||
for( unsigned ii = 1; ii < dsnSettings.m_TrackWidthList.size(); ii++ )
|
||||
m_out->Print( aNestLevel+1, "(user_trace_width %s)\n",
|
||||
FMTIU( aBoard->m_TrackWidthList[ii] ).c_str() );
|
||||
FMTIU( dsnSettings.m_TrackWidthList[ii] ).c_str() );
|
||||
|
||||
m_out->Print( aNestLevel+1, "(trace_clearance %s)\n",
|
||||
FMTIU( aBoard->m_NetClasses.GetDefault()->GetClearance() ).c_str() );
|
||||
FMTIU( dsnSettings.GetDefault()->GetClearance() ).c_str() );
|
||||
|
||||
// ZONE_SETTINGS
|
||||
m_out->Print( aNestLevel+1, "(zone_clearance %s)\n",
|
||||
|
@ -568,78 +581,79 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
|
|||
aBoard->GetZoneSettings().m_Zone_45_Only ? "yes" : "no" );
|
||||
|
||||
m_out->Print( aNestLevel+1, "(trace_min %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_TrackMinWidth ).c_str() );
|
||||
FMTIU( dsnSettings.m_TrackMinWidth ).c_str() );
|
||||
|
||||
m_out->Print( aNestLevel+1, "(segment_width %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_DrawSegmentWidth ).c_str() );
|
||||
FMTIU( dsnSettings.m_DrawSegmentWidth ).c_str() );
|
||||
m_out->Print( aNestLevel+1, "(edge_width %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_EdgeSegmentWidth ).c_str() );
|
||||
FMTIU( dsnSettings.m_EdgeSegmentWidth ).c_str() );
|
||||
|
||||
// Save current default via size, for compatibility with older Pcbnew version;
|
||||
m_out->Print( aNestLevel+1, "(via_size %s)\n",
|
||||
FMTIU( aBoard->m_NetClasses.GetDefault()->GetViaDiameter() ).c_str() );
|
||||
FMTIU( dsnSettings.GetDefault()->GetViaDiameter() ).c_str() );
|
||||
m_out->Print( aNestLevel+1, "(via_drill %s)\n",
|
||||
FMTIU( aBoard->m_NetClasses.GetDefault()->GetViaDrill() ).c_str() );
|
||||
FMTIU( dsnSettings.GetDefault()->GetViaDrill() ).c_str() );
|
||||
m_out->Print( aNestLevel+1, "(via_min_size %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_ViasMinSize ).c_str() );
|
||||
FMTIU( dsnSettings.m_ViasMinSize ).c_str() );
|
||||
m_out->Print( aNestLevel+1, "(via_min_drill %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_ViasMinDrill ).c_str() );
|
||||
FMTIU( dsnSettings.m_ViasMinDrill ).c_str() );
|
||||
|
||||
// Save custom vias diameters list (the first is not saved here: this is
|
||||
// the netclass value
|
||||
for( unsigned ii = 1; ii < aBoard->m_ViasDimensionsList.size(); ii++ )
|
||||
for( unsigned ii = 1; ii < dsnSettings.m_ViasDimensionsList.size(); ii++ )
|
||||
m_out->Print( aNestLevel+1, "(user_via %s %s)\n",
|
||||
FMTIU( aBoard->m_ViasDimensionsList[ii].m_Diameter ).c_str(),
|
||||
FMTIU( aBoard->m_ViasDimensionsList[ii].m_Drill ).c_str() );
|
||||
FMTIU( dsnSettings.m_ViasDimensionsList[ii].m_Diameter ).c_str(),
|
||||
FMTIU( dsnSettings.m_ViasDimensionsList[ii].m_Drill ).c_str() );
|
||||
|
||||
// for old versions compatibility:
|
||||
if( aBoard->GetDesignSettings().m_BlindBuriedViaAllowed )
|
||||
if( dsnSettings.m_BlindBuriedViaAllowed )
|
||||
m_out->Print( aNestLevel+1, "(blind_buried_vias_allowed yes)\n" );
|
||||
|
||||
m_out->Print( aNestLevel+1, "(uvia_size %s)\n",
|
||||
FMTIU( aBoard->m_NetClasses.GetDefault()->GetuViaDiameter() ).c_str() );
|
||||
FMTIU( dsnSettings.GetDefault()->GetuViaDiameter() ).c_str() );
|
||||
m_out->Print( aNestLevel+1, "(uvia_drill %s)\n",
|
||||
FMTIU( aBoard->m_NetClasses.GetDefault()->GetuViaDrill() ).c_str() );
|
||||
FMTIU( dsnSettings.GetDefault()->GetuViaDrill() ).c_str() );
|
||||
m_out->Print( aNestLevel+1, "(uvias_allowed %s)\n",
|
||||
( aBoard->GetDesignSettings().m_MicroViasAllowed ) ? "yes" : "no" );
|
||||
( dsnSettings.m_MicroViasAllowed ) ? "yes" : "no" );
|
||||
m_out->Print( aNestLevel+1, "(uvia_min_size %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_MicroViasMinSize ).c_str() );
|
||||
FMTIU( dsnSettings.m_MicroViasMinSize ).c_str() );
|
||||
m_out->Print( aNestLevel+1, "(uvia_min_drill %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_MicroViasMinDrill ).c_str() );
|
||||
FMTIU( dsnSettings.m_MicroViasMinDrill ).c_str() );
|
||||
|
||||
m_out->Print( aNestLevel+1, "(pcb_text_width %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_PcbTextWidth ).c_str() );
|
||||
FMTIU( dsnSettings.m_PcbTextWidth ).c_str() );
|
||||
m_out->Print( aNestLevel+1, "(pcb_text_size %s %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_PcbTextSize.x ).c_str(),
|
||||
FMTIU( aBoard->GetDesignSettings().m_PcbTextSize.y ).c_str() );
|
||||
FMTIU( dsnSettings.m_PcbTextSize.x ).c_str(),
|
||||
FMTIU( dsnSettings.m_PcbTextSize.y ).c_str() );
|
||||
|
||||
m_out->Print( aNestLevel+1, "(mod_edge_width %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_ModuleSegmentWidth ).c_str() );
|
||||
FMTIU( dsnSettings.m_ModuleSegmentWidth ).c_str() );
|
||||
m_out->Print( aNestLevel+1, "(mod_text_size %s %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_ModuleTextSize.x ).c_str(),
|
||||
FMTIU( aBoard->GetDesignSettings().m_ModuleTextSize.y ).c_str() );
|
||||
FMTIU( dsnSettings.m_ModuleTextSize.x ).c_str(),
|
||||
FMTIU( dsnSettings.m_ModuleTextSize.y ).c_str() );
|
||||
m_out->Print( aNestLevel+1, "(mod_text_width %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_ModuleTextWidth ).c_str() );
|
||||
FMTIU( dsnSettings.m_ModuleTextWidth ).c_str() );
|
||||
|
||||
m_out->Print( aNestLevel+1, "(pad_size %s %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_Pad_Master.GetSize().x ).c_str(),
|
||||
FMTIU( aBoard->GetDesignSettings().m_Pad_Master.GetSize().y ).c_str() );
|
||||
FMTIU( dsnSettings.m_Pad_Master.GetSize().x ).c_str(),
|
||||
FMTIU( dsnSettings.m_Pad_Master.GetSize().y ).c_str() );
|
||||
m_out->Print( aNestLevel+1, "(pad_drill %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_Pad_Master.GetDrillSize().x ).c_str() );
|
||||
FMTIU( dsnSettings.m_Pad_Master.GetDrillSize().x ).c_str() );
|
||||
|
||||
m_out->Print( aNestLevel+1, "(pad_to_mask_clearance %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_SolderMaskMargin ).c_str() );
|
||||
FMTIU( dsnSettings.m_SolderMaskMargin ).c_str() );
|
||||
|
||||
if( aBoard->GetDesignSettings().m_SolderMaskMinWidth )
|
||||
if( dsnSettings.m_SolderMaskMinWidth )
|
||||
m_out->Print( aNestLevel+1, "(solder_mask_min_width %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_SolderMaskMinWidth ).c_str() );
|
||||
FMTIU( dsnSettings.m_SolderMaskMinWidth ).c_str() );
|
||||
|
||||
if( aBoard->GetDesignSettings().m_SolderPasteMargin != 0 )
|
||||
if( dsnSettings.m_SolderPasteMargin != 0 )
|
||||
m_out->Print( aNestLevel+1, "(pad_to_paste_clearance %s)\n",
|
||||
FMTIU( aBoard->GetDesignSettings().m_SolderPasteMargin ).c_str() );
|
||||
FMTIU( dsnSettings.m_SolderPasteMargin ).c_str() );
|
||||
|
||||
if( aBoard->GetDesignSettings().m_SolderPasteMarginRatio != 0 )
|
||||
if( dsnSettings.m_SolderPasteMarginRatio != 0 )
|
||||
m_out->Print( aNestLevel+1, "(pad_to_paste_clearance_ratio %s)\n",
|
||||
Double2Str( aBoard->GetDesignSettings().m_SolderPasteMarginRatio ).c_str() );
|
||||
Double2Str( dsnSettings.m_SolderPasteMarginRatio ).c_str() );
|
||||
|
||||
m_out->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n",
|
||||
FMTIU( aBoard->GetAuxOrigin().x ).c_str(),
|
||||
|
@ -651,7 +665,7 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
|
|||
FMTIU( aBoard->GetGridOrigin().y ).c_str() );
|
||||
|
||||
m_out->Print( aNestLevel+1, "(visible_elements %X)\n",
|
||||
aBoard->GetDesignSettings().GetVisibleElements() );
|
||||
dsnSettings.GetVisibleElements() );
|
||||
|
||||
aBoard->GetPlotOptions().Format( m_out, aNestLevel+1 );
|
||||
|
||||
|
@ -669,15 +683,18 @@ void PCB_IO::format( BOARD* aBoard, int aNestLevel ) const
|
|||
m_out->Print( 0, "\n" );
|
||||
|
||||
// Save the default net class first.
|
||||
aBoard->m_NetClasses.GetDefault()->Format( m_out, aNestLevel, m_ctl );
|
||||
NETCLASS defaultNC = *dsnSettings.GetDefault();
|
||||
filterNetClass( *aBoard, defaultNC ); // Remove empty nets (from a copy of a netclass)
|
||||
defaultNC.Format( m_out, aNestLevel, m_ctl );
|
||||
|
||||
// Save the rest of the net classes alphabetically.
|
||||
for( NETCLASSES::const_iterator it = aBoard->m_NetClasses.begin();
|
||||
it != aBoard->m_NetClasses.end();
|
||||
for( NETCLASSES::const_iterator it = dsnSettings.m_NetClasses.begin();
|
||||
it != dsnSettings.m_NetClasses.end();
|
||||
++it )
|
||||
{
|
||||
NETCLASS* netclass = it->second;
|
||||
netclass->Format( m_out, aNestLevel, m_ctl );
|
||||
NETCLASS netclass = *it->second;
|
||||
filterNetClass( *aBoard, netclass ); // Remove empty nets (from a copy of a netclass)
|
||||
netclass.Format( m_out, aNestLevel, m_ctl );
|
||||
}
|
||||
|
||||
// Save the modules.
|
||||
|
|
|
@ -632,7 +632,9 @@ void LEGACY_PLUGIN::loadSHEET()
|
|||
|
||||
void LEGACY_PLUGIN::loadSETUP()
|
||||
{
|
||||
NETCLASS* netclass_default = m_board->m_NetClasses.GetDefault();
|
||||
NETCLASS* netclass_default = m_board->GetDesignSettings().GetDefault();
|
||||
// TODO Orson: is it really necessary to first operate on a copy and then apply it?
|
||||
// would not it be better to use reference here and apply all the changes instantly?
|
||||
BOARD_DESIGN_SETTINGS bds = m_board->GetDesignSettings();
|
||||
ZONE_SETTINGS zs = m_board->GetZoneSettings();
|
||||
char* line;
|
||||
|
@ -692,7 +694,7 @@ void LEGACY_PLUGIN::loadSETUP()
|
|||
else if( TESTLINE( "TrackWidthList" ) )
|
||||
{
|
||||
BIU tmp = biuParse( line + SZ( "TrackWidthList" ) );
|
||||
m_board->m_TrackWidthList.push_back( tmp );
|
||||
bds.m_TrackWidthList.push_back( tmp );
|
||||
}
|
||||
|
||||
else if( TESTLINE( "TrackClearence" ) )
|
||||
|
@ -754,7 +756,8 @@ void LEGACY_PLUGIN::loadSETUP()
|
|||
if( data ) // DRILL may not be present ?
|
||||
drill = biuParse( data );
|
||||
|
||||
m_board->m_ViasDimensionsList.push_back( VIA_DIMENSION( diameter, drill ) );
|
||||
bds.m_ViasDimensionsList.push_back( VIA_DIMENSION( diameter,
|
||||
drill ) );
|
||||
}
|
||||
|
||||
else if( TESTLINE( "ViaDrill" ) )
|
||||
|
@ -894,7 +897,7 @@ void LEGACY_PLUGIN::loadSETUP()
|
|||
// at all, the global defaults should go into a preferences
|
||||
// file instead so they are there to start new board
|
||||
// projects.
|
||||
m_board->m_NetClasses.GetDefault()->SetParams();
|
||||
m_board->GetDesignSettings().GetDefault()->SetParams( m_board->GetDesignSettings() );
|
||||
|
||||
return; // preferred exit
|
||||
}
|
||||
|
@ -907,23 +910,24 @@ void LEGACY_PLUGIN::loadSETUP()
|
|||
* Sort lists by by increasing value and remove duplicates
|
||||
* (the first value is not tested, because it is the netclass value
|
||||
*/
|
||||
sort( m_board->m_ViasDimensionsList.begin() + 1, m_board->m_ViasDimensionsList.end() );
|
||||
sort( m_board->m_TrackWidthList.begin() + 1, m_board->m_TrackWidthList.end() );
|
||||
BOARD_DESIGN_SETTINGS& designSettings = m_board->GetDesignSettings();
|
||||
sort( designSettings.m_ViasDimensionsList.begin() + 1, designSettings.m_ViasDimensionsList.end() );
|
||||
sort( designSettings.m_TrackWidthList.begin() + 1, designSettings.m_TrackWidthList.end() );
|
||||
|
||||
for( unsigned ii = 1; ii < m_board->m_ViasDimensionsList.size() - 1; ii++ )
|
||||
for( unsigned ii = 1; ii < designSettings.m_ViasDimensionsList.size() - 1; ii++ )
|
||||
{
|
||||
if( m_board->m_ViasDimensionsList[ii] == m_board->m_ViasDimensionsList[ii + 1] )
|
||||
if( designSettings.m_ViasDimensionsList[ii] == designSettings.m_ViasDimensionsList[ii + 1] )
|
||||
{
|
||||
m_board->m_ViasDimensionsList.erase( m_board->m_ViasDimensionsList.begin() + ii );
|
||||
designSettings.m_ViasDimensionsList.erase( designSettings.m_ViasDimensionsList.begin() + ii );
|
||||
ii--;
|
||||
}
|
||||
}
|
||||
|
||||
for( unsigned ii = 1; ii < m_board->m_TrackWidthList.size() - 1; ii++ )
|
||||
for( unsigned ii = 1; ii < designSettings.m_TrackWidthList.size() - 1; ii++ )
|
||||
{
|
||||
if( m_board->m_TrackWidthList[ii] == m_board->m_TrackWidthList[ii + 1] )
|
||||
if( designSettings.m_TrackWidthList[ii] == designSettings.m_TrackWidthList[ii + 1] )
|
||||
{
|
||||
m_board->m_TrackWidthList.erase( m_board->m_TrackWidthList.begin() + ii );
|
||||
designSettings.m_TrackWidthList.erase( designSettings.m_TrackWidthList.begin() + ii );
|
||||
ii--;
|
||||
}
|
||||
}
|
||||
|
@ -2109,7 +2113,7 @@ void LEGACY_PLUGIN::loadNETCLASS()
|
|||
// yet since that would bypass duplicate netclass name checking within the BOARD.
|
||||
// store it temporarily in an auto_ptr until successfully inserted into the BOARD
|
||||
// just before returning.
|
||||
auto_ptr<NETCLASS> nc( new NETCLASS( m_board, wxEmptyString ) );
|
||||
auto_ptr<NETCLASS> nc( new NETCLASS( wxEmptyString ) );
|
||||
|
||||
while( ( line = READLINE( m_reader ) ) != NULL )
|
||||
{
|
||||
|
@ -2171,7 +2175,7 @@ void LEGACY_PLUGIN::loadNETCLASS()
|
|||
|
||||
else if( TESTLINE( "$EndNCLASS" ) )
|
||||
{
|
||||
if( m_board->m_NetClasses.Add( nc.get() ) )
|
||||
if( m_board->GetDesignSettings().m_NetClasses.Add( nc.get() ) )
|
||||
{
|
||||
nc.release();
|
||||
}
|
||||
|
@ -2980,8 +2984,8 @@ void LEGACY_PLUGIN::saveSHEET( const BOARD* aBoard ) const
|
|||
|
||||
void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const
|
||||
{
|
||||
NETCLASS* netclass_default = aBoard->m_NetClasses.GetDefault();
|
||||
const BOARD_DESIGN_SETTINGS& bds = aBoard->GetDesignSettings();
|
||||
NETCLASS* netclass_default = bds.GetDefault();
|
||||
|
||||
fprintf( m_fp, "$SETUP\n" );
|
||||
|
||||
|
@ -3005,11 +3009,12 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const
|
|||
}
|
||||
|
||||
// Save current default track width, for compatibility with older Pcbnew version;
|
||||
fprintf( m_fp, "TrackWidth %s\n", fmtBIU( aBoard->GetCurrentTrackWidth() ).c_str() );
|
||||
fprintf( m_fp, "TrackWidth %s\n",
|
||||
fmtBIU( aBoard->GetDesignSettings().GetCurrentTrackWidth() ).c_str() );
|
||||
|
||||
// Save custom tracks width list (the first is not saved here: this is the netclass value
|
||||
for( unsigned ii = 1; ii < aBoard->m_TrackWidthList.size(); ii++ )
|
||||
fprintf( m_fp, "TrackWidthList %s\n", fmtBIU( aBoard->m_TrackWidthList[ii] ).c_str() );
|
||||
for( unsigned ii = 1; ii < aBoard->GetDesignSettings().m_TrackWidthList.size(); ii++ )
|
||||
fprintf( m_fp, "TrackWidthList %s\n", fmtBIU( aBoard->GetDesignSettings().m_TrackWidthList[ii] ).c_str() );
|
||||
|
||||
fprintf( m_fp, "TrackClearence %s\n", fmtBIU( netclass_default->GetClearance() ).c_str() );
|
||||
|
||||
|
@ -3030,10 +3035,10 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const
|
|||
|
||||
// Save custom vias diameters list (the first is not saved here: this is
|
||||
// the netclass value
|
||||
for( unsigned ii = 1; ii < aBoard->m_ViasDimensionsList.size(); ii++ )
|
||||
for( unsigned ii = 1; ii < aBoard->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
|
||||
fprintf( m_fp, "ViaSizeList %s %s\n",
|
||||
fmtBIU( aBoard->m_ViasDimensionsList[ii].m_Diameter ).c_str(),
|
||||
fmtBIU( aBoard->m_ViasDimensionsList[ii].m_Drill ).c_str() );
|
||||
fmtBIU( aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Diameter ).c_str(),
|
||||
fmtBIU( aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Drill ).c_str() );
|
||||
|
||||
// for old versions compatibility:
|
||||
fprintf( m_fp, "MicroViaSize %s\n", fmtBIU( netclass_default->GetuViaDiameter() ).c_str() );
|
||||
|
@ -3093,7 +3098,7 @@ void LEGACY_PLUGIN::saveBOARD_ITEMS( const BOARD* aBoard ) const
|
|||
}
|
||||
|
||||
// Saved nets do not include netclass names, so save netclasses after nets.
|
||||
saveNETCLASSES( &aBoard->m_NetClasses );
|
||||
saveNETCLASSES( &aBoard->GetDesignSettings().m_NetClasses );
|
||||
|
||||
// save the modules
|
||||
for( MODULE* m = aBoard->m_Modules; m; m = (MODULE*) m->Next() )
|
||||
|
@ -3114,7 +3119,7 @@ void LEGACY_PLUGIN::saveBOARD_ITEMS( const BOARD* aBoard ) const
|
|||
savePCB_TARGET( (PCB_TARGET*) gr );
|
||||
break;
|
||||
case PCB_DIMENSION_T:
|
||||
saveDIMENTION( (DIMENSION*) gr );
|
||||
saveDIMENSION( (DIMENSION*) gr );
|
||||
break;
|
||||
default:
|
||||
THROW_IO_ERROR( wxString::Format( UNKNOWN_GRAPHIC_FORMAT, gr->Type() ) );
|
||||
|
@ -3758,7 +3763,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
|
|||
}
|
||||
|
||||
|
||||
void LEGACY_PLUGIN::saveDIMENTION( const DIMENSION* me ) const
|
||||
void LEGACY_PLUGIN::saveDIMENSION( const DIMENSION* me ) const
|
||||
{
|
||||
// note: COTATION was the previous name of DIMENSION
|
||||
// this old keyword is used here for compatibility
|
||||
|
|
|
@ -261,7 +261,7 @@ protected:
|
|||
void savePCB_TEXT( const TEXTE_PCB* aText ) const;
|
||||
void savePCB_TARGET( const PCB_TARGET* aTarget ) const;
|
||||
void savePCB_LINE( const DRAWSEGMENT* aStroke ) const;
|
||||
void saveDIMENTION( const DIMENSION* aDimension ) const;
|
||||
void saveDIMENSION( const DIMENSION* aDimension ) const;
|
||||
void saveTRACK( const TRACK* aTrack ) const;
|
||||
|
||||
/**
|
||||
|
|
|
@ -315,7 +315,7 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
|
|||
AddMenuItem( viewMenu, ID_ZOOM_OUT, text, HELP_ZOOM_OUT, KiBitmap( zoom_out_xpm ) );
|
||||
|
||||
text = AddHotkeyName( _( "&Fit on Screen" ), g_Pcbnew_Editor_Hokeys_Descr,
|
||||
HK_ZOOM_AUTO );
|
||||
HK_ZOOM_AUTO, IS_ACCELERATOR );
|
||||
AddMenuItem( viewMenu, ID_ZOOM_PAGE, text, HELP_ZOOM_FIT,
|
||||
KiBitmap( zoom_fit_in_page_xpm ) );
|
||||
|
||||
|
|
|
@ -215,7 +215,7 @@ MODULE* PCB_EDIT_FRAME::Genere_Self( wxDC* DC )
|
|||
}
|
||||
|
||||
// Calculate the elements.
|
||||
Mself.m_Width = GetBoard()->GetCurrentTrackWidth();
|
||||
Mself.m_Width = GetDesignSettings().GetCurrentTrackWidth();
|
||||
|
||||
std::vector <wxPoint> buffer;
|
||||
ll = BuildCornersList_S_Shape( buffer, Mself.m_Start, Mself.m_End, Mself.lng, Mself.m_Width );
|
||||
|
@ -561,7 +561,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveBasicShape( const wxString& name, int pad_c
|
|||
|
||||
module->Pads().PushFront( pad );
|
||||
|
||||
int tw = GetBoard()->GetCurrentTrackWidth();
|
||||
int tw = GetDesignSettings().GetCurrentTrackWidth();
|
||||
pad->SetSize( wxSize( tw, tw ) );
|
||||
|
||||
pad->SetPosition( module->GetPosition() );
|
||||
|
@ -588,7 +588,7 @@ MODULE* PCB_EDIT_FRAME::Create_MuWaveComponent( int shape_type )
|
|||
int angle = 0;
|
||||
|
||||
// Enter the size of the gap or stub
|
||||
int gap_size = GetBoard()->GetCurrentTrackWidth();
|
||||
int gap_size = GetDesignSettings().GetCurrentTrackWidth();
|
||||
|
||||
switch( shape_type )
|
||||
{
|
||||
|
@ -1104,7 +1104,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* aModule )
|
|||
gap_size = ValueFromString( g_UserUnit, msg );
|
||||
|
||||
// Updating sizes of pads forming the gap.
|
||||
int tw = GetBoard()->GetCurrentTrackWidth();
|
||||
int tw = GetDesignSettings().GetCurrentTrackWidth();
|
||||
pad->SetSize( wxSize( tw, tw ) );
|
||||
|
||||
pad->SetY0( 0 );
|
||||
|
@ -1118,7 +1118,7 @@ void PCB_EDIT_FRAME::Edit_Gap( wxDC* DC, MODULE* aModule )
|
|||
|
||||
pad->SetPosition( padpos );
|
||||
|
||||
tw = GetBoard()->GetCurrentTrackWidth();
|
||||
tw = GetDesignSettings().GetCurrentTrackWidth();
|
||||
next_pad->SetSize( wxSize( tw, tw ) );
|
||||
|
||||
next_pad->SetY0( 0 );
|
||||
|
|
|
@ -161,7 +161,7 @@ void PCB_EDIT_FRAME::OnLeftClick( wxDC* aDC, const wxPoint& aPosition )
|
|||
case PCB_TRACE_T:
|
||||
case PCB_VIA_T:
|
||||
case PCB_PAD_T:
|
||||
GetBoard()->SetCurrentNetClass(
|
||||
GetDesignSettings().SetCurrentNetClass(
|
||||
((BOARD_CONNECTED_ITEM*)DrawStruct)->GetNetClassName() );
|
||||
updateTraceWidthSelectBox();
|
||||
updateViaSizeSelectBox();
|
||||
|
|
|
@ -464,7 +464,7 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
|
|||
wxPoint cursorPosition = GetCrossHairPosition();
|
||||
wxString msg;
|
||||
|
||||
GetBoard()->SetCurrentNetClass( Track->GetNetClassName() );
|
||||
GetDesignSettings().SetCurrentNetClass( Track->GetNetClassName() );
|
||||
updateTraceWidthSelectBox();
|
||||
updateViaSizeSelectBox();
|
||||
|
||||
|
@ -532,7 +532,7 @@ void PCB_EDIT_FRAME::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
|
|||
AddMenuItem( PopMenu, ID_POPUP_PCB_SELECT_CU_LAYER_AND_PLACE_THROUGH_VIA,
|
||||
msg, KiBitmap( select_w_layer_xpm ) );
|
||||
|
||||
if( GetBoard()->GetDesignSettings().m_BlindBuriedViaAllowed )
|
||||
if( GetDesignSettings().m_BlindBuriedViaAllowed )
|
||||
{
|
||||
msg = AddHotkeyName( _( "Place Blind/Buried Via" ),
|
||||
g_Board_Editor_Hokeys_Descr, HK_ADD_BLIND_BURIED_VIA );
|
||||
|
@ -834,9 +834,9 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
|
|||
if( flags ) // Currently in edit, no others commands possible
|
||||
return;
|
||||
|
||||
if( GetBoard()->GetCurrentNetClassName() != Pad->GetNetClassName() )
|
||||
if( GetDesignSettings().GetCurrentNetClassName() != Pad->GetNetClassName() )
|
||||
{
|
||||
GetBoard()->SetCurrentNetClass( Pad->GetNetClassName() );
|
||||
GetDesignSettings().SetCurrentNetClass( Pad->GetNetClassName() );
|
||||
updateTraceWidthSelectBox();
|
||||
updateViaSizeSelectBox();
|
||||
}
|
||||
|
@ -957,17 +957,17 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard )
|
|||
if( aBoard->GetDesignSettings().m_UseConnectedTrackWidth )
|
||||
trackwidth_menu->Check( ID_POPUP_PCB_SELECT_AUTO_WIDTH, true );
|
||||
|
||||
if( aBoard->GetViaSizeIndex() != 0
|
||||
|| aBoard->GetTrackWidthIndex() != 0
|
||||
if( aBoard->GetDesignSettings().GetViaSizeIndex() != 0
|
||||
|| aBoard->GetDesignSettings().GetTrackWidthIndex() != 0
|
||||
|| aBoard->GetDesignSettings().m_UseConnectedTrackWidth )
|
||||
trackwidth_menu->Append( ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
|
||||
_( "Use Netclass Values" ),
|
||||
_( "Use track and via sizes from their Netclass values" ),
|
||||
true );
|
||||
|
||||
for( unsigned ii = 0; ii < aBoard->m_TrackWidthList.size(); ii++ )
|
||||
for( unsigned ii = 0; ii < aBoard->GetDesignSettings().m_TrackWidthList.size(); ii++ )
|
||||
{
|
||||
value = StringFromValue( g_UserUnit, aBoard->m_TrackWidthList[ii], true );
|
||||
value = StringFromValue( g_UserUnit, aBoard->GetDesignSettings().m_TrackWidthList[ii], true );
|
||||
msg.Printf( _( "Track %s" ), GetChars( value ) );
|
||||
|
||||
if( ii == 0 )
|
||||
|
@ -978,15 +978,16 @@ static wxMenu* Append_Track_Width_List( BOARD* aBoard )
|
|||
|
||||
trackwidth_menu->AppendSeparator();
|
||||
|
||||
for( unsigned ii = 0; ii < aBoard->m_ViasDimensionsList.size(); ii++ )
|
||||
for( unsigned ii = 0; ii < aBoard->GetDesignSettings().m_ViasDimensionsList.size(); ii++ )
|
||||
{
|
||||
value = StringFromValue( g_UserUnit, aBoard->m_ViasDimensionsList[ii].m_Diameter,
|
||||
value = StringFromValue( g_UserUnit,
|
||||
aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Diameter,
|
||||
true );
|
||||
wxString drill = StringFromValue( g_UserUnit,
|
||||
aBoard->m_ViasDimensionsList[ii].m_Drill,
|
||||
aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Drill,
|
||||
true );
|
||||
|
||||
if( aBoard->m_ViasDimensionsList[ii].m_Drill <= 0 )
|
||||
if( aBoard->GetDesignSettings().m_ViasDimensionsList[ii].m_Drill <= 0 )
|
||||
{
|
||||
msg.Printf( _( "Via %s" ), GetChars( value ) );
|
||||
}
|
||||
|
|
|
@ -43,6 +43,8 @@ using namespace KIGFX;
|
|||
|
||||
PCB_RENDER_SETTINGS::PCB_RENDER_SETTINGS()
|
||||
{
|
||||
m_backgroundColor = COLOR4D( 0.0, 0.0, 0.0, 1.0 );
|
||||
|
||||
// By default everything should be displayed as filled
|
||||
for( unsigned int i = 0; i < END_PCB_VISIBLE_LIST; ++i )
|
||||
{
|
||||
|
|
|
@ -808,7 +808,9 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
|
|||
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as setup." ) );
|
||||
|
||||
T token;
|
||||
NETCLASS* defaultNetclass = m_board->m_NetClasses.GetDefault();
|
||||
NETCLASS* defaultNetClass = m_board->GetDesignSettings().GetDefault();
|
||||
// TODO Orson: is it really necessary to first operate on a copy and then apply it?
|
||||
// would not it be better to use reference here and apply all the changes instantly?
|
||||
BOARD_DESIGN_SETTINGS designSettings = m_board->GetDesignSettings();
|
||||
ZONE_SETTINGS zoneSettings = m_board->GetZoneSettings();
|
||||
|
||||
|
@ -827,12 +829,12 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
|
|||
break;
|
||||
|
||||
case T_user_trace_width:
|
||||
m_board->m_TrackWidthList.push_back( parseBoardUnits( T_user_trace_width ) );
|
||||
designSettings.m_TrackWidthList.push_back( parseBoardUnits( T_user_trace_width ) );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_trace_clearance:
|
||||
defaultNetclass->SetClearance( parseBoardUnits( T_trace_clearance ) );
|
||||
defaultNetClass->SetClearance( parseBoardUnits( T_trace_clearance ) );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
|
@ -862,12 +864,12 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
|
|||
break;
|
||||
|
||||
case T_via_size:
|
||||
defaultNetclass->SetViaDiameter( parseBoardUnits( T_via_size ) );
|
||||
defaultNetClass->SetViaDiameter( parseBoardUnits( T_via_size ) );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_via_drill:
|
||||
defaultNetclass->SetViaDrill( parseBoardUnits( T_via_drill ) );
|
||||
defaultNetClass->SetViaDrill( parseBoardUnits( T_via_drill ) );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
|
@ -885,18 +887,18 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
|
|||
{
|
||||
int viaSize = parseBoardUnits( "user via size" );
|
||||
int viaDrill = parseBoardUnits( "user via drill" );
|
||||
m_board->m_ViasDimensionsList.push_back( VIA_DIMENSION( viaSize, viaDrill ) );
|
||||
designSettings.m_ViasDimensionsList.push_back( VIA_DIMENSION( viaSize, viaDrill ) );
|
||||
NeedRIGHT();
|
||||
}
|
||||
break;
|
||||
|
||||
case T_uvia_size:
|
||||
defaultNetclass->SetuViaDiameter( parseBoardUnits( T_uvia_size ) );
|
||||
defaultNetClass->SetuViaDiameter( parseBoardUnits( T_uvia_size ) );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
case T_uvia_drill:
|
||||
defaultNetclass->SetuViaDrill( parseBoardUnits( T_uvia_drill ) );
|
||||
defaultNetClass->SetuViaDrill( parseBoardUnits( T_uvia_drill ) );
|
||||
NeedRIGHT();
|
||||
break;
|
||||
|
||||
|
@ -1046,7 +1048,7 @@ void PCB_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
|
|||
// at all, the global defaults should go into a preferences
|
||||
// file instead so they are there to start new board
|
||||
// projects.
|
||||
m_board->m_NetClasses.GetDefault()->SetParams();
|
||||
defaultNetClass->SetParams( m_board->GetDesignSettings() );
|
||||
}
|
||||
|
||||
|
||||
|
@ -1080,7 +1082,7 @@ void PCB_PARSER::parseNETCLASS() throw( IO_ERROR, PARSE_ERROR )
|
|||
|
||||
T token;
|
||||
|
||||
std::auto_ptr<NETCLASS> nc( new NETCLASS( m_board, wxEmptyString ) );
|
||||
std::auto_ptr<NETCLASS> nc( new NETCLASS( wxEmptyString ) );
|
||||
|
||||
// Read netclass name (can be a name or just a number like track width)
|
||||
NeedSYMBOLorNUMBER();
|
||||
|
@ -1133,7 +1135,7 @@ void PCB_PARSER::parseNETCLASS() throw( IO_ERROR, PARSE_ERROR )
|
|||
NeedRIGHT();
|
||||
}
|
||||
|
||||
if( m_board->m_NetClasses.Add( nc.get() ) )
|
||||
if( m_board->GetDesignSettings().m_NetClasses.Add( nc.get() ) )
|
||||
{
|
||||
nc.release();
|
||||
}
|
||||
|
|
|
@ -275,6 +275,8 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
|
|||
EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
|
||||
PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth )
|
||||
EVT_UPDATE_UI( ID_POPUP_PCB_SELECT_AUTO_WIDTH, PCB_EDIT_FRAME::OnUpdateSelectAutoTrackWidth )
|
||||
EVT_UPDATE_UI( ID_POPUP_PCB_SELECT_CUSTOM_WIDTH,
|
||||
PCB_EDIT_FRAME::OnUpdateSelectCustomTrackWidth )
|
||||
EVT_UPDATE_UI( ID_AUX_TOOLBAR_PCB_VIA_SIZE, PCB_EDIT_FRAME::OnUpdateSelectViaSize )
|
||||
EVT_UPDATE_UI( ID_TOOLBARH_PCB_MODE_MODULE, PCB_EDIT_FRAME::OnUpdateAutoPlaceModulesMode )
|
||||
EVT_UPDATE_UI( ID_TOOLBARH_PCB_MODE_TRACKS, PCB_EDIT_FRAME::OnUpdateAutoPlaceTracksMode )
|
||||
|
@ -493,9 +495,9 @@ void PCB_EDIT_FRAME::SetBoard( BOARD* aBoard )
|
|||
ViewReloadBoard( aBoard );
|
||||
|
||||
// update the tool manager with the new board and its view.
|
||||
m_toolManager.SetEnvironment( aBoard, GetGalCanvas()->GetView(),
|
||||
m_toolManager->SetEnvironment( aBoard, GetGalCanvas()->GetView(),
|
||||
GetGalCanvas()->GetViewControls(), this );
|
||||
m_toolManager.ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -544,6 +546,7 @@ void PCB_EDIT_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
|
|||
|
||||
view->Add( worksheet );
|
||||
view->Add( aBoard->GetRatsnestViewItem() );
|
||||
aBoard->GetRatsnest()->Recalculate();
|
||||
|
||||
// Limit panning to the size of worksheet frame
|
||||
GetGalCanvas()->GetViewControls()->SetPanBoundary( aBoard->GetWorksheetViewItem()->ViewBBox() );
|
||||
|
@ -588,7 +591,6 @@ void PCB_EDIT_FRAME::OnQuit( wxCommandEvent& event )
|
|||
void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||
{
|
||||
m_canvas->SetAbortRequest( true );
|
||||
GetGalCanvas()->StopDrawing();
|
||||
|
||||
if( GetScreen()->IsModify() )
|
||||
{
|
||||
|
@ -612,6 +614,8 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
|||
}
|
||||
}
|
||||
|
||||
GetGalCanvas()->StopDrawing();
|
||||
|
||||
// Delete the auto save file if it exists.
|
||||
wxFileName fn = GetBoard()->GetFileName();
|
||||
|
||||
|
@ -672,13 +676,13 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
|
|||
if( aEnable )
|
||||
{
|
||||
ViewReloadBoard( m_Pcb );
|
||||
GetGalCanvas()->GetView()->RecacheAllItems();
|
||||
|
||||
// Update potential changes in the ratsnest
|
||||
m_Pcb->GetRatsnest()->Recalculate();
|
||||
|
||||
m_toolManager.SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
|
||||
m_toolManager->SetEnvironment( m_Pcb, GetGalCanvas()->GetView(),
|
||||
GetGalCanvas()->GetViewControls(), this );
|
||||
m_toolManager.ResetTools( TOOL_BASE::GAL_SWITCH );
|
||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
||||
|
||||
GetGalCanvas()->StartDrawing();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -170,6 +170,7 @@ enum pcbnew_ids
|
|||
ID_AUX_TOOLBAR_PCB_SELECT_AUTO_WIDTH,
|
||||
ID_POPUP_PCB_SELECT_WIDTH_START_RANGE,
|
||||
ID_POPUP_PCB_SELECT_WIDTH,
|
||||
ID_POPUP_PCB_SELECT_CUSTOM_WIDTH,
|
||||
ID_POPUP_PCB_SELECT_AUTO_WIDTH,
|
||||
ID_POPUP_PCB_SELECT_USE_NETCLASS_VALUES,
|
||||
ID_POPUP_PCB_SELECT_WIDTH1,
|
||||
|
|
|
@ -60,6 +60,7 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, GAL* aGal ) const
|
|||
aGal->SetLineWidth( 1.0 );
|
||||
RENDER_SETTINGS* rs = m_view->GetPainter()->GetSettings();
|
||||
COLOR4D color = rs->GetColor( NULL, ITEM_GAL_LAYER( RATSNEST_VISIBLE ) );
|
||||
int highlightedNet = rs->GetHighlightNetCode();
|
||||
|
||||
for( int i = 1; i < m_data->GetNetCount(); ++i )
|
||||
{
|
||||
|
@ -89,7 +90,8 @@ void RATSNEST_VIEWITEM::ViewDraw( int aLayer, GAL* aGal ) const
|
|||
}
|
||||
|
||||
// Draw the "static" ratsnest
|
||||
aGal->SetStrokeColor( color ); // using the default ratsnest color
|
||||
if( i != highlightedNet )
|
||||
aGal->SetStrokeColor( color ); // using the default ratsnest color for not highlighted
|
||||
|
||||
const std::vector<RN_EDGE_PTR>* edges = net.GetUnconnected();
|
||||
if( edges == NULL )
|
||||
|
|
|
@ -10,41 +10,26 @@ include_directories(
|
|||
)
|
||||
|
||||
set( PCBNEW_PNS_SRCS
|
||||
direction.h
|
||||
pns_via.h
|
||||
pns_routing_settings.h
|
||||
pns_shove.cpp
|
||||
pns_line.cpp
|
||||
pns_utils.h
|
||||
pns_layerset.h
|
||||
trace.h
|
||||
pns_line.h
|
||||
pns_walkaround.cpp
|
||||
pns_node.h
|
||||
pns_line_placer.cpp
|
||||
pns_utils.cpp
|
||||
pns_solid.h
|
||||
time_limit.cpp
|
||||
|
||||
pns_algo_base.cpp
|
||||
pns_dragger.cpp
|
||||
pns_item.cpp
|
||||
pns_via.cpp
|
||||
pns_node.cpp
|
||||
pns_solid.cpp
|
||||
pns_line_placer.h
|
||||
pns_optimizer.h
|
||||
pns_walkaround.h
|
||||
pns_shove.h
|
||||
pns_router.h
|
||||
pns_router.cpp
|
||||
pns_index.h
|
||||
pns_item.h
|
||||
pns_optimizer.cpp
|
||||
pns_joint.h
|
||||
pns_segment.h
|
||||
pns_itemset.h
|
||||
pns_itemset.cpp
|
||||
router_tool.cpp
|
||||
router_tool.h
|
||||
pns_line.cpp
|
||||
pns_line_placer.cpp
|
||||
pns_logger.cpp
|
||||
pns_node.cpp
|
||||
pns_optimizer.cpp
|
||||
pns_router.cpp
|
||||
pns_routing_settings.cpp
|
||||
pns_shove.cpp
|
||||
pns_solid.cpp
|
||||
pns_utils.cpp
|
||||
pns_via.cpp
|
||||
pns_walkaround.cpp
|
||||
router_preview_item.cpp
|
||||
router_preview_item.h
|
||||
router_tool.cpp
|
||||
)
|
||||
|
||||
add_library( pnsrouter STATIC ${PCBNEW_PNS_SRCS} )
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -180,6 +180,11 @@ public:
|
|||
return ( m_dir % 2 ) == 1;
|
||||
}
|
||||
|
||||
bool IsDefined() const
|
||||
{
|
||||
return m_dir != UNDEFINED;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function BuildInitialTrace()
|
||||
*
|
||||
|
@ -232,7 +237,7 @@ public:
|
|||
pl.Append( aP1 );
|
||||
pl.Simplify();
|
||||
return pl;
|
||||
};
|
||||
}
|
||||
|
||||
bool operator==( const DIRECTION_45& aOther ) const
|
||||
{
|
||||
|
@ -244,32 +249,73 @@ public:
|
|||
return aOther.m_dir != m_dir;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Right()
|
||||
*
|
||||
* Returns the direction on the right side of this (i.e. turns right
|
||||
* by 45 deg)
|
||||
*/
|
||||
const DIRECTION_45 Right() const
|
||||
{
|
||||
DIRECTION_45 r;
|
||||
|
||||
r.m_dir = (Directions) (m_dir + 1);
|
||||
|
||||
if( r.m_dir == NW )
|
||||
r.m_dir = N;
|
||||
if ( m_dir != UNDEFINED )
|
||||
r.m_dir = static_cast<Directions>( ( m_dir + 1 ) % 8 );
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
template <typename T>
|
||||
int sign( T val ) const
|
||||
/**
|
||||
* Function Left()
|
||||
*
|
||||
* Returns the direction on the left side of this (i.e. turns left
|
||||
* by 45 deg)
|
||||
*/
|
||||
const DIRECTION_45 Left() const
|
||||
{
|
||||
return (T( 0 ) < val) - ( val < T( 0 ) );
|
||||
DIRECTION_45 l;
|
||||
|
||||
if ( m_dir == UNDEFINED )
|
||||
return l;
|
||||
|
||||
if( m_dir == N )
|
||||
l.m_dir = NW;
|
||||
else
|
||||
l.m_dir = static_cast<Directions>( m_dir - 1 );
|
||||
|
||||
return l;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function ToVector()
|
||||
*
|
||||
* Returns a unit vector corresponding to our direction.
|
||||
*/
|
||||
const VECTOR2I ToVector() const
|
||||
{
|
||||
switch( m_dir )
|
||||
{
|
||||
case N: return VECTOR2I( 0, 1 );
|
||||
case S: return VECTOR2I( 0, -1 );
|
||||
case E: return VECTOR2I( 1, 0 );
|
||||
case W: return VECTOR2I( -1, 0 );
|
||||
case NE: return VECTOR2I( 1, 1 );
|
||||
case NW: return VECTOR2I( -1, 1 );
|
||||
case SE: return VECTOR2I( 1, -1 );
|
||||
case SW: return VECTOR2I( -1, -1 );
|
||||
|
||||
default:
|
||||
return VECTOR2I( 0, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Function construct()
|
||||
* Calculates the direction from a vector. If the vector's angle is not a multiple of 45
|
||||
* degrees, the direction is rounded to the nearest octant.
|
||||
* @param aVec our vector
|
||||
*/
|
||||
* @param aVec our vector */
|
||||
void construct( const VECTOR2I& aVec )
|
||||
{
|
||||
m_dir = UNDEFINED;
|
||||
|
@ -322,7 +368,8 @@ private:
|
|||
}
|
||||
}
|
||||
|
||||
Directions m_dir; ///> our actual direction
|
||||
///> our actual direction
|
||||
Directions m_dir;
|
||||
};
|
||||
|
||||
#endif // __DIRECTION_H
|
||||
|
|
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "pns_algo_base.h"
|
||||
#include "pns_router.h"
|
||||
|
||||
PNS_ROUTING_SETTINGS& PNS_ALGO_BASE::Settings() const
|
||||
{
|
||||
return m_router->Settings();
|
||||
}
|
||||
|
||||
PNS_LOGGER *PNS_ALGO_BASE::Logger()
|
||||
{
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __PNS_ALGO_BASE_H
|
||||
#define __PNS_ALGO_BASE_H
|
||||
|
||||
#include "pns_routing_settings.h"
|
||||
|
||||
class PNS_ROUTER;
|
||||
class PNS_LOGGER;
|
||||
|
||||
/**
|
||||
* Class PNS_ALGO_BASE
|
||||
*
|
||||
* Base class for all P&S algorithms (shoving, walkaround, line placement, dragging, etc.)
|
||||
* Holds a bunch of objects commonly used by all algorithms (P&S settings, parent router instance, logging)
|
||||
**/
|
||||
|
||||
class PNS_ALGO_BASE
|
||||
{
|
||||
public:
|
||||
PNS_ALGO_BASE( PNS_ROUTER *aRouter ) :
|
||||
m_router ( aRouter )
|
||||
{}
|
||||
|
||||
virtual ~PNS_ALGO_BASE() {}
|
||||
|
||||
///> Returns the instance of our router
|
||||
PNS_ROUTER* Router() const
|
||||
{
|
||||
return m_router;
|
||||
}
|
||||
|
||||
///> Returns current router settings
|
||||
PNS_ROUTING_SETTINGS& Settings() const;
|
||||
|
||||
///> Returns the logger object, allowing to dump geometry to a file.
|
||||
virtual PNS_LOGGER* Logger();
|
||||
|
||||
private:
|
||||
PNS_ROUTER* m_router;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -0,0 +1,319 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "pns_dragger.h"
|
||||
#include "pns_shove.h"
|
||||
#include "pns_router.h"
|
||||
|
||||
PNS_DRAGGER::PNS_DRAGGER( PNS_ROUTER* aRouter ) :
|
||||
PNS_ALGO_BASE ( aRouter )
|
||||
{
|
||||
m_world = NULL;
|
||||
m_shove = NULL;
|
||||
}
|
||||
|
||||
|
||||
PNS_DRAGGER::~PNS_DRAGGER()
|
||||
{
|
||||
if( m_shove )
|
||||
delete m_shove;
|
||||
}
|
||||
|
||||
|
||||
void PNS_DRAGGER::SetWorld ( PNS_NODE* aWorld )
|
||||
{
|
||||
m_world = aWorld;
|
||||
}
|
||||
|
||||
|
||||
bool PNS_DRAGGER::startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg )
|
||||
{
|
||||
int w2 = aSeg->Width() / 2;
|
||||
|
||||
m_draggedLine = m_world->AssembleLine ( aSeg, &m_draggedSegmentIndex );
|
||||
m_shove->SetInitialLine( m_draggedLine );
|
||||
m_lastValidDraggedLine = *m_draggedLine;
|
||||
m_lastValidDraggedLine.ClearSegmentLinks();
|
||||
|
||||
if( ( aP - aSeg->Seg().A ).EuclideanNorm() <= w2 )
|
||||
m_mode = CORNER;
|
||||
else if( ( aP - aSeg->Seg().B ).EuclideanNorm() <= w2 )
|
||||
{
|
||||
m_draggedSegmentIndex ++;
|
||||
m_mode = CORNER;
|
||||
} else
|
||||
m_mode = SEGMENT;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool PNS_DRAGGER::startDragVia( const VECTOR2D& aP, PNS_VIA* aVia )
|
||||
{
|
||||
m_draggedVia = aVia;
|
||||
m_initialVia = aVia;
|
||||
m_mode = VIA;
|
||||
|
||||
VECTOR2I p0( aVia->Pos() );
|
||||
PNS_JOINT *jt = m_world->FindJoint( p0, aVia->Layers().Start(), aVia->Net() );
|
||||
|
||||
BOOST_FOREACH(PNS_ITEM *item, jt->LinkList() )
|
||||
{
|
||||
if( item->OfKind( PNS_ITEM::SEGMENT ) )
|
||||
{
|
||||
int segIndex;
|
||||
PNS_SEGMENT* seg = (PNS_SEGMENT*) item;
|
||||
std::auto_ptr<PNS_LINE> l( m_world->AssembleLine( seg, &segIndex ) );
|
||||
|
||||
if( segIndex != 0 )
|
||||
l->Reverse();
|
||||
|
||||
m_origViaConnections.push_back( *l );
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool PNS_DRAGGER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
|
||||
{
|
||||
m_shove = new PNS_SHOVE( m_world, Router() );
|
||||
m_lastNode = NULL;
|
||||
m_draggedItems.Clear();
|
||||
m_currentMode = Settings().Mode();
|
||||
|
||||
TRACE( 2, "StartDragging: item %p [kind %d]", aStartItem % aStartItem->Kind() );
|
||||
|
||||
switch( aStartItem->Kind() )
|
||||
{
|
||||
case PNS_ITEM::SEGMENT:
|
||||
return startDragSegment ( aP, static_cast<PNS_SEGMENT *>( aStartItem ) );
|
||||
|
||||
case PNS_ITEM::VIA:
|
||||
return startDragVia ( aP, static_cast<PNS_VIA *> (aStartItem) );
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool PNS_DRAGGER::dragMarkObstacles( const VECTOR2I& aP )
|
||||
{
|
||||
if( m_lastNode )
|
||||
{
|
||||
delete m_lastNode;
|
||||
m_lastNode = NULL;
|
||||
}
|
||||
|
||||
switch( m_mode )
|
||||
{
|
||||
case SEGMENT:
|
||||
case CORNER:
|
||||
{
|
||||
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine->Width() / 4 : 0;
|
||||
PNS_LINE tmp( *m_draggedLine );
|
||||
|
||||
if( m_mode == SEGMENT )
|
||||
tmp.DragSegment ( aP, m_draggedSegmentIndex, thresh );
|
||||
else
|
||||
tmp.DragCorner ( aP, m_draggedSegmentIndex, thresh );
|
||||
|
||||
m_lastNode = m_shove->CurrentNode()->Branch();
|
||||
|
||||
m_lastValidDraggedLine = tmp;
|
||||
m_lastValidDraggedLine.ClearSegmentLinks();
|
||||
m_lastValidDraggedLine.Unmark();
|
||||
|
||||
m_lastNode->Add ( &m_lastValidDraggedLine );
|
||||
m_draggedItems = PNS_ITEMSET ( &m_lastValidDraggedLine );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case VIA: // fixme...
|
||||
{
|
||||
m_lastNode = m_shove->CurrentNode()->Branch();
|
||||
dumbDragVia ( m_initialVia, m_lastNode, aP );
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if( Settings().CanViolateDRC() )
|
||||
m_dragStatus = true;
|
||||
else
|
||||
m_dragStatus = !m_world->CheckColliding( m_draggedItems );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
void PNS_DRAGGER::dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& aP )
|
||||
{
|
||||
// fixme: this is awful.
|
||||
m_draggedVia = aVia->Clone();
|
||||
m_draggedVia->SetPos( aP );
|
||||
m_draggedItems.Clear();
|
||||
m_draggedItems.Add( m_draggedVia );
|
||||
|
||||
m_lastNode->Remove( aVia );
|
||||
m_lastNode->Add( m_draggedVia );
|
||||
|
||||
BOOST_FOREACH( PNS_LINE &l, m_origViaConnections )
|
||||
{
|
||||
PNS_LINE origLine (l);
|
||||
PNS_LINE* draggedLine = l.Clone();
|
||||
|
||||
draggedLine->DragCorner( aP, 0 );
|
||||
draggedLine->ClearSegmentLinks();
|
||||
|
||||
m_draggedItems.AddOwned( draggedLine );
|
||||
|
||||
m_lastNode->Remove( &origLine );
|
||||
m_lastNode->Add( draggedLine );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool PNS_DRAGGER::dragShove( const VECTOR2I& aP )
|
||||
{
|
||||
bool ok = false;
|
||||
|
||||
if( m_lastNode )
|
||||
{
|
||||
delete m_lastNode;
|
||||
m_lastNode = NULL;
|
||||
}
|
||||
|
||||
switch( m_mode )
|
||||
{
|
||||
case SEGMENT:
|
||||
case CORNER:
|
||||
{
|
||||
int thresh = Settings().SmoothDraggedSegments() ? m_draggedLine->Width() / 4 : 0;
|
||||
PNS_LINE tmp( *m_draggedLine );
|
||||
|
||||
if( m_mode == SEGMENT )
|
||||
tmp.DragSegment( aP, m_draggedSegmentIndex, thresh );
|
||||
else
|
||||
tmp.DragCorner( aP, m_draggedSegmentIndex, thresh );
|
||||
|
||||
PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveLines( tmp );
|
||||
|
||||
if( st == PNS_SHOVE::SH_OK )
|
||||
ok = true;
|
||||
else if( st == PNS_SHOVE::SH_HEAD_MODIFIED )
|
||||
{
|
||||
tmp = m_shove->NewHead();
|
||||
ok = true;
|
||||
}
|
||||
|
||||
m_lastNode = m_shove->CurrentNode()->Branch();
|
||||
|
||||
if( ok )
|
||||
m_lastValidDraggedLine = tmp;
|
||||
|
||||
m_lastValidDraggedLine.ClearSegmentLinks();
|
||||
m_lastValidDraggedLine.Unmark();
|
||||
m_lastNode->Add( &m_lastValidDraggedLine );
|
||||
m_draggedItems = PNS_ITEMSET( &m_lastValidDraggedLine );
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
case VIA:
|
||||
{
|
||||
PNS_VIA *newVia;
|
||||
PNS_SHOVE::SHOVE_STATUS st = m_shove->ShoveDraggingVia( m_draggedVia, aP, &newVia );
|
||||
|
||||
if( st == PNS_SHOVE::SH_OK || st == PNS_SHOVE::SH_HEAD_MODIFIED )
|
||||
ok = true;
|
||||
|
||||
m_lastNode = m_shove->CurrentNode()->Branch();
|
||||
|
||||
if( ok )
|
||||
{
|
||||
m_draggedVia = newVia;
|
||||
m_draggedItems.Clear();
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
m_dragStatus = ok;
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
|
||||
bool PNS_DRAGGER::FixRoute()
|
||||
{
|
||||
if( m_dragStatus )
|
||||
{
|
||||
Router()->CommitRouting( CurrentNode() );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool PNS_DRAGGER::Drag( const VECTOR2I& aP )
|
||||
{
|
||||
switch( m_currentMode )
|
||||
{
|
||||
case RM_MarkObstacles:
|
||||
return dragMarkObstacles( aP );
|
||||
|
||||
case RM_Shove:
|
||||
case RM_Walkaround:
|
||||
case RM_Smart:
|
||||
return dragShove( aP );
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
PNS_NODE *PNS_DRAGGER::CurrentNode() const
|
||||
{
|
||||
return m_lastNode;
|
||||
}
|
||||
|
||||
|
||||
const PNS_ITEMSET PNS_DRAGGER::Traces()
|
||||
{
|
||||
return m_draggedItems;
|
||||
}
|
||||
|
||||
|
||||
PNS_LOGGER* PNS_DRAGGER::Logger()
|
||||
{
|
||||
if( m_shove )
|
||||
return m_shove->Logger();
|
||||
|
||||
return NULL;
|
||||
}
|
|
@ -0,0 +1,130 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the
|
||||
* Free Software Foundation, either version 3 of the License, or (at your
|
||||
* option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __PNS_DRAGGER_H
|
||||
#define __PNS_DRAGGER_H
|
||||
|
||||
#include <math/vector2d.h>
|
||||
|
||||
#include "pns_node.h"
|
||||
#include "pns_via.h"
|
||||
#include "pns_line.h"
|
||||
#include "pns_algo_base.h"
|
||||
#include "pns_itemset.h"
|
||||
|
||||
class PNS_ROUTER;
|
||||
class PNS_SHOVE;
|
||||
class PNS_OPTIMIZER;
|
||||
class PNS_ROUTER_BASE;
|
||||
|
||||
/**
|
||||
* Class PNS_DRAGGER
|
||||
*
|
||||
* Via, segment and corner dragging algorithm.
|
||||
*/
|
||||
class PNS_DRAGGER : public PNS_ALGO_BASE
|
||||
{
|
||||
public:
|
||||
PNS_DRAGGER( PNS_ROUTER* aRouter );
|
||||
~PNS_DRAGGER();
|
||||
|
||||
/**
|
||||
* Function SetWorld()
|
||||
*
|
||||
* Sets the board to work on.
|
||||
*/
|
||||
void SetWorld( PNS_NODE* aWorld );
|
||||
|
||||
/**
|
||||
* Function Start()
|
||||
*
|
||||
* Starts routing a single track at point aP, taking item aStartItem as anchor
|
||||
* (unless NULL). Returns true if a dragging operation has started.
|
||||
*/
|
||||
bool Start( const VECTOR2I& aP, PNS_ITEM* aStartItem );
|
||||
|
||||
/**
|
||||
* Function Drag()
|
||||
*
|
||||
* Drags the current segment/corner/via to the point aP.
|
||||
* @return true, if dragging finished with success.
|
||||
*/
|
||||
bool Drag( const VECTOR2I& aP );
|
||||
|
||||
/**
|
||||
* Function FixRoute()
|
||||
*
|
||||
* Checks if the result of current dragging operation is correct
|
||||
* and eventually commits it to the world.
|
||||
* @return true, if dragging finished with success.
|
||||
*/
|
||||
bool FixRoute();
|
||||
|
||||
/**
|
||||
* Function CurrentNode()
|
||||
*
|
||||
* Returns the most recent world state, including all
|
||||
* items changed due to dragging operation.
|
||||
*/
|
||||
PNS_NODE* CurrentNode() const;
|
||||
|
||||
/**
|
||||
* Function Traces()
|
||||
*
|
||||
* Returns the set of dragged items.
|
||||
*/
|
||||
const PNS_ITEMSET Traces();
|
||||
|
||||
/// @copydoc PNS_ALGO_BASE::Logger()
|
||||
virtual PNS_LOGGER* Logger();
|
||||
|
||||
private:
|
||||
typedef std::pair<PNS_LINE *, PNS_LINE *> LinePair;
|
||||
typedef std::vector<LinePair> LinePairVec;
|
||||
|
||||
enum DragMode {
|
||||
CORNER = 0,
|
||||
SEGMENT,
|
||||
VIA
|
||||
};
|
||||
|
||||
bool dragMarkObstacles( const VECTOR2I& aP );
|
||||
bool dragShove(const VECTOR2I& aP );
|
||||
bool startDragSegment( const VECTOR2D& aP, PNS_SEGMENT* aSeg );
|
||||
bool startDragVia( const VECTOR2D& aP, PNS_VIA* aVia );
|
||||
void dumbDragVia( PNS_VIA* aVia, PNS_NODE* aNode, const VECTOR2I& aP );
|
||||
|
||||
PNS_NODE* m_world;
|
||||
PNS_NODE* m_lastNode;
|
||||
DragMode m_mode;
|
||||
PNS_LINE* m_draggedLine;
|
||||
PNS_VIA* m_draggedVia;
|
||||
PNS_LINE m_lastValidDraggedLine;
|
||||
PNS_SHOVE* m_shove;
|
||||
int m_draggedSegmentIndex;
|
||||
bool m_dragStatus;
|
||||
PNS_MODE m_currentMode;
|
||||
std::vector<PNS_LINE> m_origViaConnections;
|
||||
std::vector<PNS_LINE> m_draggedViaConnections;
|
||||
PNS_VIA* m_initialVia;
|
||||
PNS_ITEMSET m_draggedItems;
|
||||
};
|
||||
|
||||
#endif
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -15,12 +15,15 @@
|
|||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __PNS_INDEX_H
|
||||
#define __PNS_INDEX_H
|
||||
|
||||
#include <layers_id_colors_and_visibility.h>
|
||||
#include <map>
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/range/adaptor/map.hpp>
|
||||
|
||||
|
@ -33,44 +36,106 @@
|
|||
* Class PNS_INDEX
|
||||
*
|
||||
* Custom spatial index, holding our board items and allowing for very fast searches. Items
|
||||
* are assigned to separate R-Tree subundices depending on their type and spanned layers, reducing
|
||||
* are assigned to separate R-Tree subindices depending on their type and spanned layers, reducing
|
||||
* overlap and improving search time.
|
||||
**/
|
||||
|
||||
class PNS_INDEX
|
||||
{
|
||||
public:
|
||||
typedef std::list<PNS_ITEM*> NetItemsList;
|
||||
typedef SHAPE_INDEX<PNS_ITEM*> ItemShapeIndex;
|
||||
typedef boost::unordered_set<PNS_ITEM*> ItemSet;
|
||||
typedef std::list<PNS_ITEM*> NET_ITEMS_LIST;
|
||||
typedef SHAPE_INDEX<PNS_ITEM*> ITEM_SHAPE_INDEX;
|
||||
typedef boost::unordered_set<PNS_ITEM*> ITEM_SET;
|
||||
|
||||
PNS_INDEX();
|
||||
~PNS_INDEX();
|
||||
|
||||
/**
|
||||
* Function Add()
|
||||
*
|
||||
* Adds item to the spatial index.
|
||||
*/
|
||||
void Add( PNS_ITEM* aItem );
|
||||
|
||||
/**
|
||||
* Function Remove()
|
||||
*
|
||||
* Removes an item from the spatial index.
|
||||
*/
|
||||
void Remove( PNS_ITEM* aItem );
|
||||
|
||||
/**
|
||||
* Function Add()
|
||||
*
|
||||
* Replaces one item with another.
|
||||
*/
|
||||
void Replace( PNS_ITEM* aOldItem, PNS_ITEM* aNewItem );
|
||||
|
||||
/**
|
||||
* Function Query()
|
||||
*
|
||||
* Searches items in the index that are in proximity of aItem.
|
||||
* For each item, function object aVisitor is called. Only items on
|
||||
* overlapping layers are considered.
|
||||
*
|
||||
* @param aItem item to search against
|
||||
* @param aMinDistance proximity distance (wrs to the item's shape)
|
||||
* @param aVisitor function object called on each found item. Return
|
||||
false from the visitor to stop searching.
|
||||
* @return number of items found.
|
||||
*/
|
||||
template<class Visitor>
|
||||
int Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& v );
|
||||
int Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& aVisitor );
|
||||
|
||||
/**
|
||||
* Function Query()
|
||||
*
|
||||
* Searches items in the index that are in proximity of aShape.
|
||||
* For each item, function object aVisitor is called. Treats all
|
||||
* layers as colliding.
|
||||
*
|
||||
* @param aShape shape to search against
|
||||
* @param aMinDistance proximity distance (wrs to the item's shape)
|
||||
* @param aVisitor function object called on each found item. Return
|
||||
false from the visitor to stop searching.
|
||||
* @return number of items found.
|
||||
*/
|
||||
template<class Visitor>
|
||||
int Query( const SHAPE* aShape, int aMinDistance, Visitor& v );
|
||||
int Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor );
|
||||
|
||||
/**
|
||||
* Function Clear()
|
||||
*
|
||||
* Removes all items from the index.
|
||||
*/
|
||||
void Clear();
|
||||
|
||||
NetItemsList* GetItemsForNet( int aNet );
|
||||
|
||||
ItemSet::iterator begin() { return m_allItems.begin(); }
|
||||
ItemSet::iterator end() { return m_allItems.end(); }
|
||||
/**
|
||||
* Function GetItemsForNet()
|
||||
*
|
||||
* Returns list of all items in a given net.
|
||||
*/
|
||||
NET_ITEMS_LIST* GetItemsForNet( int aNet );
|
||||
|
||||
/**
|
||||
* Function Contains()
|
||||
*
|
||||
* Returns true if item aItem exists in the index.
|
||||
*/
|
||||
bool Contains( PNS_ITEM* aItem ) const
|
||||
{
|
||||
return m_allItems.find( aItem ) != m_allItems.end();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Size()
|
||||
*
|
||||
* Returns number of items stored in the index.
|
||||
*/
|
||||
int Size() const { return m_allItems.size(); }
|
||||
|
||||
ITEM_SET::iterator begin() { return m_allItems.begin(); }
|
||||
ITEM_SET::iterator end() { return m_allItems.end(); }
|
||||
|
||||
private:
|
||||
static const int MaxSubIndices = 64;
|
||||
static const int SI_Multilayer = 2;
|
||||
|
@ -81,29 +146,28 @@ private:
|
|||
static const int SI_PadsBottom = 1;
|
||||
|
||||
template <class Visitor>
|
||||
int querySingle( int index, const SHAPE* aShape, int aMinDistance, Visitor& v );
|
||||
int querySingle( int index, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor );
|
||||
|
||||
ItemShapeIndex* getSubindex( const PNS_ITEM* aItem );
|
||||
ITEM_SHAPE_INDEX* getSubindex( const PNS_ITEM* aItem );
|
||||
|
||||
ItemShapeIndex* m_subIndices[MaxSubIndices];
|
||||
std::map<int, NetItemsList> m_netMap;
|
||||
ItemSet m_allItems;
|
||||
ITEM_SHAPE_INDEX* m_subIndices[MaxSubIndices];
|
||||
std::map<int, NET_ITEMS_LIST> m_netMap;
|
||||
ITEM_SET m_allItems;
|
||||
};
|
||||
|
||||
|
||||
PNS_INDEX::PNS_INDEX()
|
||||
{
|
||||
memset( m_subIndices, 0, sizeof( m_subIndices ) );
|
||||
}
|
||||
|
||||
|
||||
PNS_INDEX::ItemShapeIndex* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
|
||||
PNS_INDEX::ITEM_SHAPE_INDEX* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
|
||||
{
|
||||
int idx_n = -1;
|
||||
|
||||
const PNS_LAYERSET l = aItem->GetLayers();
|
||||
const PNS_LAYERSET l = aItem->Layers();
|
||||
|
||||
switch( aItem->GetKind() )
|
||||
switch( aItem->Kind() )
|
||||
{
|
||||
case PNS_ITEM::VIA:
|
||||
idx_n = SI_Multilayer;
|
||||
|
@ -113,9 +177,9 @@ PNS_INDEX::ItemShapeIndex* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
|
|||
{
|
||||
if( l.IsMultilayer() )
|
||||
idx_n = SI_Multilayer;
|
||||
else if( l.Start() == 0 ) // fixme: use kicad layer codes
|
||||
else if( l.Start() == LAYER_N_BACK) // fixme: use kicad layer codes
|
||||
idx_n = SI_PadsTop;
|
||||
else if( l.Start() == 15 )
|
||||
else if( l.Start() == LAYER_N_FRONT )
|
||||
idx_n = SI_PadsBottom;
|
||||
|
||||
break;
|
||||
|
@ -133,7 +197,7 @@ PNS_INDEX::ItemShapeIndex* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
|
|||
assert( idx_n >= 0 && idx_n < MaxSubIndices );
|
||||
|
||||
if( !m_subIndices[idx_n] )
|
||||
m_subIndices[idx_n] = new ItemShapeIndex;
|
||||
m_subIndices[idx_n] = new ITEM_SHAPE_INDEX;
|
||||
|
||||
return m_subIndices[idx_n];
|
||||
}
|
||||
|
@ -141,11 +205,11 @@ PNS_INDEX::ItemShapeIndex* PNS_INDEX::getSubindex( const PNS_ITEM* aItem )
|
|||
|
||||
void PNS_INDEX::Add( PNS_ITEM* aItem )
|
||||
{
|
||||
ItemShapeIndex* idx = getSubindex( aItem );
|
||||
ITEM_SHAPE_INDEX* idx = getSubindex( aItem );
|
||||
|
||||
idx->Add( aItem );
|
||||
m_allItems.insert( aItem );
|
||||
int net = aItem->GetNet();
|
||||
int net = aItem->Net();
|
||||
|
||||
if( net >= 0 )
|
||||
{
|
||||
|
@ -156,12 +220,12 @@ void PNS_INDEX::Add( PNS_ITEM* aItem )
|
|||
|
||||
void PNS_INDEX::Remove( PNS_ITEM* aItem )
|
||||
{
|
||||
ItemShapeIndex* idx = getSubindex( aItem );
|
||||
ITEM_SHAPE_INDEX* idx = getSubindex( aItem );
|
||||
|
||||
idx->Remove( aItem );
|
||||
m_allItems.erase( aItem );
|
||||
|
||||
int net = aItem->GetNet();
|
||||
int net = aItem->Net();
|
||||
|
||||
if( net >= 0 && m_netMap.find( net ) != m_netMap.end() )
|
||||
m_netMap[net].remove( aItem );
|
||||
|
@ -176,43 +240,43 @@ void PNS_INDEX::Replace( PNS_ITEM* aOldItem, PNS_ITEM* aNewItem )
|
|||
|
||||
|
||||
template<class Visitor>
|
||||
int PNS_INDEX::querySingle( int index, const SHAPE* aShape, int aMinDistance, Visitor& v )
|
||||
int PNS_INDEX::querySingle( int index, const SHAPE* aShape, int aMinDistance, Visitor& aVisitor )
|
||||
{
|
||||
if( !m_subIndices[index] )
|
||||
return 0;
|
||||
|
||||
return m_subIndices[index]->Query( aShape, aMinDistance, v, false );
|
||||
return m_subIndices[index]->Query( aShape, aMinDistance, aVisitor, false );
|
||||
}
|
||||
|
||||
|
||||
template<class Visitor>
|
||||
int PNS_INDEX::Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& v )
|
||||
int PNS_INDEX::Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& aVisitor )
|
||||
{
|
||||
const SHAPE* shape = aItem->GetShape();
|
||||
const SHAPE* shape = aItem->Shape();
|
||||
int total = 0;
|
||||
|
||||
total += querySingle( SI_Multilayer, shape, aMinDistance, v );
|
||||
total += querySingle( SI_Multilayer, shape, aMinDistance, aVisitor );
|
||||
|
||||
const PNS_LAYERSET layers = aItem->GetLayers();
|
||||
const PNS_LAYERSET layers = aItem->Layers();
|
||||
|
||||
if( layers.IsMultilayer() )
|
||||
{
|
||||
total += querySingle( SI_PadsTop, shape, aMinDistance, v );
|
||||
total += querySingle( SI_PadsBottom, shape, aMinDistance, v );
|
||||
total += querySingle( SI_PadsTop, shape, aMinDistance, aVisitor );
|
||||
total += querySingle( SI_PadsBottom, shape, aMinDistance, aVisitor );
|
||||
|
||||
for( int i = layers.Start(); i <= layers.End(); ++i )
|
||||
total += querySingle( SI_Traces + 2 * i + SI_SegStraight, shape, aMinDistance, v );
|
||||
total += querySingle( SI_Traces + 2 * i + SI_SegStraight, shape, aMinDistance, aVisitor );
|
||||
}
|
||||
else
|
||||
{
|
||||
int l = layers.Start();
|
||||
|
||||
if( l == 0 )
|
||||
total += querySingle( SI_PadsTop, shape, aMinDistance, v );
|
||||
else if( l == 15 )
|
||||
total += querySingle( SI_PadsBottom, shape, aMinDistance, v );
|
||||
if( l == LAYER_N_BACK )
|
||||
total += querySingle( SI_PadsTop, shape, aMinDistance, aVisitor );
|
||||
else if( l == LAYER_N_FRONT )
|
||||
total += querySingle( SI_PadsBottom, shape, aMinDistance, aVisitor );
|
||||
|
||||
total += querySingle( SI_Traces + 2 * l + SI_SegStraight, shape, aMinDistance, v );
|
||||
total += querySingle( SI_Traces + 2 * l + SI_SegStraight, shape, aMinDistance, aVisitor );
|
||||
}
|
||||
|
||||
return total;
|
||||
|
@ -220,12 +284,12 @@ int PNS_INDEX::Query( const PNS_ITEM* aItem, int aMinDistance, Visitor& v )
|
|||
|
||||
|
||||
template<class Visitor>
|
||||
int PNS_INDEX::Query( const SHAPE* aShape, int aMinDistance, Visitor& v )
|
||||
int PNS_INDEX::Query( const SHAPE* aShape, int aMinDistance, Visitor& aVisitor )
|
||||
{
|
||||
int total = 0;
|
||||
|
||||
for( int i = 0; i < MaxSubIndices; i++ )
|
||||
total += querySingle( i, aShape, aMinDistance, v );
|
||||
total += querySingle( i, aShape, aMinDistance, aVisitor );
|
||||
|
||||
return total;
|
||||
}
|
||||
|
@ -235,7 +299,7 @@ void PNS_INDEX::Clear()
|
|||
{
|
||||
for( int i = 0; i < MaxSubIndices; ++i )
|
||||
{
|
||||
ItemShapeIndex* idx = m_subIndices[i];
|
||||
ITEM_SHAPE_INDEX* idx = m_subIndices[i];
|
||||
|
||||
if( idx )
|
||||
delete idx;
|
||||
|
@ -251,7 +315,7 @@ PNS_INDEX::~PNS_INDEX()
|
|||
}
|
||||
|
||||
|
||||
PNS_INDEX::NetItemsList* PNS_INDEX::GetItemsForNet( int aNet )
|
||||
PNS_INDEX::NET_ITEMS_LIST* PNS_INDEX::GetItemsForNet( int aNet )
|
||||
{
|
||||
if( m_netMap.find( aNet ) == m_netMap.end() )
|
||||
return NULL;
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -15,7 +15,7 @@
|
|||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include "pns_item.h"
|
||||
|
@ -32,7 +32,7 @@ bool PNS_ITEM::collideSimple( const PNS_ITEM* aOther, int aClearance, bool aNeed
|
|||
if( !m_layers.Overlaps( aOther->m_layers ) )
|
||||
return false;
|
||||
|
||||
return GetShape()->Collide( aOther->GetShape(), aClearance );
|
||||
return Shape()->Collide( aOther->Shape(), aClearance );
|
||||
|
||||
// fixme: MTV
|
||||
}
|
||||
|
@ -50,15 +50,14 @@ bool PNS_ITEM::Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
|
|||
const PNS_LINE* line = static_cast<const PNS_LINE*>( aOther );
|
||||
|
||||
if( line->EndsWithVia() )
|
||||
return collideSimple( &line->GetVia(), aClearance - line->GetWidth() / 2, aNeedMTV,
|
||||
aMTV );
|
||||
return collideSimple( &line->Via(), aClearance - line->Width() / 2, aNeedMTV, aMTV );
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
const std::string PNS_ITEM::GetKindStr() const
|
||||
const std::string PNS_ITEM::KindStr() const
|
||||
{
|
||||
switch( m_kind )
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -15,7 +15,7 @@
|
|||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __PNS_ITEM_H
|
||||
|
@ -26,18 +26,25 @@
|
|||
#include <geometry/shape.h>
|
||||
#include <geometry/shape_line_chain.h>
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
#include "pns_layerset.h"
|
||||
|
||||
class BOARD_CONNECTED_ITEM;
|
||||
class PNS_NODE;
|
||||
|
||||
enum LineMarker {
|
||||
MK_HEAD = ( 1 << 0 ),
|
||||
MK_VIOLATION = ( 1 << 3 ),
|
||||
MK_LOCKED = ( 1 << 4 )
|
||||
};
|
||||
|
||||
/**
|
||||
* Class PNS_ITEM
|
||||
*
|
||||
* Base class for PNS router board items. Implements the shared properties of all PCB items -
|
||||
* net, spanned layers, geometric shape & refererence to owning model.
|
||||
*/
|
||||
|
||||
class PNS_ITEM
|
||||
{
|
||||
public:
|
||||
|
@ -60,8 +67,9 @@ public:
|
|||
m_movable = true;
|
||||
m_kind = aKind;
|
||||
m_parent = NULL;
|
||||
m_world = NULL;
|
||||
m_owner = NULL;
|
||||
m_marker = 0;
|
||||
m_rank = -1;
|
||||
}
|
||||
|
||||
PNS_ITEM( const PNS_ITEM& aOther )
|
||||
|
@ -70,61 +78,202 @@ public:
|
|||
m_net = aOther.m_net;
|
||||
m_movable = aOther.m_movable;
|
||||
m_kind = aOther.m_kind;
|
||||
m_world = aOther.m_world;
|
||||
m_parent = aOther.m_parent;
|
||||
m_owner = NULL;
|
||||
m_marker = aOther.m_marker;
|
||||
m_rank = aOther.m_rank;
|
||||
}
|
||||
|
||||
virtual ~PNS_ITEM();
|
||||
|
||||
/**
|
||||
* Function Clone()
|
||||
*
|
||||
* Returns a deep copy of the item
|
||||
*/
|
||||
virtual PNS_ITEM* Clone() const = 0;
|
||||
|
||||
///> Returns a convex polygon "hull" of a the item, that is used as the walkaround
|
||||
/// path.
|
||||
/// aClearance defines how far from the body of the item the hull should be,
|
||||
/// aWalkaroundThickness is the width of the line that walks around this hull.
|
||||
/*
|
||||
* Function Hull()
|
||||
*
|
||||
* Returns a convex polygon "hull" of a the item, that is used as the walk-around
|
||||
* path.
|
||||
* @param aClearance defines how far from the body of the item the hull should be,
|
||||
* @param aWalkaroundThickness is the width of the line that walks around this hull.
|
||||
*/
|
||||
virtual const SHAPE_LINE_CHAIN Hull( int aClearance = 0, int aWalkaroundThickness = 0 ) const
|
||||
{
|
||||
return SHAPE_LINE_CHAIN();
|
||||
};
|
||||
}
|
||||
|
||||
PnsKind GetKind() const { return m_kind; }
|
||||
bool OfKind( int aKind ) const { return (aKind & m_kind) != 0; }
|
||||
/**
|
||||
* Function Kind()
|
||||
*
|
||||
* Returns the type (kind) of the item
|
||||
*/
|
||||
PnsKind Kind() const
|
||||
{
|
||||
return m_kind;
|
||||
}
|
||||
|
||||
const std::string GetKindStr() const;
|
||||
/**
|
||||
* Function OfKind()
|
||||
*
|
||||
* Returns true if the item's type matches the mask aKindMask.
|
||||
*/
|
||||
bool OfKind( int aKindMask ) const
|
||||
{
|
||||
return ( aKindMask & m_kind ) != 0;
|
||||
}
|
||||
|
||||
///> Gets/Sets the corresponding parent object in the host application's model (pcbnew)
|
||||
void SetParent( BOARD_CONNECTED_ITEM* aParent ) { m_parent = aParent; }
|
||||
BOARD_CONNECTED_ITEM* GetParent() const { return m_parent; }
|
||||
/**
|
||||
* Function KindStr()
|
||||
*
|
||||
* Returns the kind of the item, as string
|
||||
*/
|
||||
const std::string KindStr() const;
|
||||
|
||||
///> Net accessors
|
||||
int GetNet() const { return m_net; }
|
||||
void SetNet( int aNet ) { m_net = aNet; }
|
||||
/**
|
||||
* Function SetParent()
|
||||
*
|
||||
* Sets the corresponding parent object in the host application's model.
|
||||
*/
|
||||
void SetParent( BOARD_CONNECTED_ITEM* aParent )
|
||||
{
|
||||
m_parent = aParent;
|
||||
}
|
||||
|
||||
///> Layers accessors
|
||||
const PNS_LAYERSET& GetLayers() const { return m_layers; }
|
||||
void SetLayers( const PNS_LAYERSET& aLayers ) { m_layers = aLayers; }
|
||||
/**
|
||||
* Function Parent()
|
||||
*
|
||||
* Returns the corresponding parent object in the host application's model.
|
||||
*/
|
||||
BOARD_CONNECTED_ITEM* Parent() const
|
||||
{
|
||||
return m_parent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetNet()
|
||||
*
|
||||
* Sets the item's net to aNet
|
||||
*/
|
||||
void SetNet( int aNet )
|
||||
{
|
||||
m_net = aNet;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Net()
|
||||
*
|
||||
* Returns the item's net.
|
||||
*/
|
||||
int Net() const
|
||||
{
|
||||
return m_net;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetLayers()
|
||||
*
|
||||
* Sets the layers spanned by the item to aLayers.
|
||||
*/
|
||||
void SetLayers( const PNS_LAYERSET& aLayers )
|
||||
{
|
||||
m_layers = aLayers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SetLayer()
|
||||
*
|
||||
* Sets the layers spanned by the item to a single layer aLayer.
|
||||
*/
|
||||
void SetLayer( int aLayer )
|
||||
{
|
||||
m_layers = PNS_LAYERSET( aLayer, aLayer );
|
||||
}
|
||||
|
||||
///> Ownership management. An item can belong to a single PNS_NODE or stay unowned.
|
||||
void SetOwner( PNS_NODE* aOwner ) { m_owner = aOwner; }
|
||||
bool BelongsTo( PNS_NODE* aNode ) const { return m_owner == aNode; }
|
||||
PNS_NODE* GetOwner() const { return m_owner; }
|
||||
/**
|
||||
* Function Layers()
|
||||
*
|
||||
* Returns the contiguous set of layers spanned by the item.
|
||||
*/
|
||||
const PNS_LAYERSET& Layers() const
|
||||
{
|
||||
return m_layers;
|
||||
}
|
||||
|
||||
///> Sets the world that is used for collision resolution.
|
||||
void SetWorld( PNS_NODE* aWorld ) { m_world = aWorld; }
|
||||
PNS_NODE* GetWorld() const { return m_world; }
|
||||
/**
|
||||
* Function Layer()
|
||||
*
|
||||
* Returns the item's layer, for single-layered items only.
|
||||
*/
|
||||
virtual int Layer() const
|
||||
{
|
||||
return Layers().Start();
|
||||
}
|
||||
|
||||
///> Collision function. Checks if the item aOther is closer to us than
|
||||
/// aClearance and returns true if so. It can also calculate a minimum translation vector that
|
||||
/// resolves the collision if needed.
|
||||
/**
|
||||
* Function LayersOverlap()
|
||||
*
|
||||
* Returns true if the set of layers spanned by aOther overlaps our
|
||||
* layers.
|
||||
*/
|
||||
bool LayersOverlap( const PNS_ITEM* aOther ) const
|
||||
{
|
||||
return Layers().Overlaps( aOther->Layers() );
|
||||
}
|
||||
|
||||
/**
|
||||
* Functon SetOwner()
|
||||
*
|
||||
* Sets the node that owns this item. An item can belong to a single
|
||||
* PNS_NODE or stay unowned.
|
||||
*/
|
||||
void SetOwner( PNS_NODE* aOwner )
|
||||
{
|
||||
m_owner = aOwner;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function BelongsTo()
|
||||
*
|
||||
* Returns true if the item is owned by the node aNode.
|
||||
*/
|
||||
bool BelongsTo( PNS_NODE* aNode ) const
|
||||
{
|
||||
return m_owner == aNode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Owner()
|
||||
*
|
||||
* Returns the owner of this item, or NULL if there's none.
|
||||
*/
|
||||
PNS_NODE* Owner() const { return m_owner; }
|
||||
|
||||
/**
|
||||
* Function Collide()
|
||||
*
|
||||
* Checks for a collision (clearance violation) with between us and item aOther.
|
||||
* Collision checking takes all PCB stuff into accound (layers, nets, DRC rules).
|
||||
* Optionally returns a minimum translation vector for force propagation
|
||||
* algorithm.
|
||||
*
|
||||
* @param aOther item to check collision against
|
||||
* @param aClearance desired clearance
|
||||
* @param aNeedMTV when true, the minimum translation vector is calculated
|
||||
* @param aMTV the minimum translation vector
|
||||
* @param true, if a collision was found.
|
||||
*/
|
||||
virtual bool Collide( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
|
||||
VECTOR2I& aMTV ) const;
|
||||
|
||||
///> A shortcut without MTV calculation
|
||||
/**
|
||||
* Function Collide()
|
||||
*
|
||||
* A shortcut for PNS_ITEM::Colllide() without MTV stuff.
|
||||
*/
|
||||
bool Collide( const PNS_ITEM* aOther, int aClearance ) const
|
||||
{
|
||||
VECTOR2I dummy;
|
||||
|
@ -132,12 +281,52 @@ public:
|
|||
return Collide( aOther, aClearance, false, dummy );
|
||||
}
|
||||
|
||||
///> Returns the geometric shape of the item
|
||||
virtual const SHAPE* GetShape() const
|
||||
/**
|
||||
* Function Shape()
|
||||
*
|
||||
* Returns the geometrical shape of the item. Used
|
||||
* for collision detection & spatial indexing.
|
||||
*/
|
||||
virtual const SHAPE* Shape() const
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual void Mark(int aMarker)
|
||||
{
|
||||
m_marker = aMarker;
|
||||
}
|
||||
|
||||
virtual void Unmark ()
|
||||
{
|
||||
m_marker = 0;
|
||||
}
|
||||
|
||||
virtual int Marker() const
|
||||
{
|
||||
return m_marker;
|
||||
}
|
||||
|
||||
virtual void SetRank( int aRank )
|
||||
{
|
||||
m_rank = aRank;
|
||||
}
|
||||
|
||||
virtual int Rank() const
|
||||
{
|
||||
return m_rank;
|
||||
}
|
||||
|
||||
virtual VECTOR2I Anchor( int n ) const
|
||||
{
|
||||
return VECTOR2I ();
|
||||
}
|
||||
|
||||
virtual int AnchorCount() const
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
private:
|
||||
bool collideSimple( const PNS_ITEM* aOther, int aClearance, bool aNeedMTV,
|
||||
VECTOR2I& aMTV ) const;
|
||||
|
@ -146,12 +335,13 @@ protected:
|
|||
PnsKind m_kind;
|
||||
|
||||
BOARD_CONNECTED_ITEM* m_parent;
|
||||
PNS_NODE* m_world;
|
||||
PNS_NODE* m_owner;
|
||||
PNS_LAYERSET m_layers;
|
||||
|
||||
bool m_movable;
|
||||
int m_net;
|
||||
int m_marker;
|
||||
int m_rank;
|
||||
};
|
||||
|
||||
#endif // __PNS_ITEM_H
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -15,27 +15,41 @@
|
|||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
#include "pns_itemset.h"
|
||||
|
||||
|
||||
PNS_ITEMSET::PNS_ITEMSET()
|
||||
PNS_ITEMSET::PNS_ITEMSET( PNS_ITEM* aInitialItem )
|
||||
{
|
||||
if(aInitialItem)
|
||||
m_items.push_back(aInitialItem);
|
||||
}
|
||||
|
||||
|
||||
PNS_ITEMSET::~PNS_ITEMSET()
|
||||
{
|
||||
Clear();
|
||||
}
|
||||
|
||||
|
||||
void PNS_ITEMSET::Clear()
|
||||
{
|
||||
BOOST_FOREACH(PNS_ITEM* item, m_ownedItems)
|
||||
{
|
||||
delete item;
|
||||
}
|
||||
|
||||
m_items.clear();
|
||||
m_ownedItems.clear();
|
||||
}
|
||||
|
||||
|
||||
PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd )
|
||||
{
|
||||
ItemVector newItems;
|
||||
ITEM_VECTOR newItems;
|
||||
PNS_LAYERSET l;
|
||||
|
||||
if( aEnd < 0 )
|
||||
|
@ -45,37 +59,42 @@ PNS_ITEMSET& PNS_ITEMSET::FilterLayers( int aStart, int aEnd )
|
|||
|
||||
BOOST_FOREACH( PNS_ITEM* item, m_items )
|
||||
|
||||
if( item->GetLayers().Overlaps( l ) )
|
||||
if( item->Layers().Overlaps( l ) )
|
||||
newItems.push_back( item );
|
||||
|
||||
m_items = newItems;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
PNS_ITEMSET& PNS_ITEMSET::FilterKinds( int aKindMask )
|
||||
{
|
||||
ItemVector newItems;
|
||||
ITEM_VECTOR newItems;
|
||||
|
||||
BOOST_FOREACH( PNS_ITEM* item, m_items )
|
||||
|
||||
if( item->GetKind() & aKindMask )
|
||||
{
|
||||
if( item->OfKind ( aKindMask ) )
|
||||
newItems.push_back( item );
|
||||
}
|
||||
|
||||
m_items = newItems;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
||||
PNS_ITEMSET& PNS_ITEMSET::FilterNet( int aNet )
|
||||
{
|
||||
ItemVector newItems;
|
||||
ITEM_VECTOR newItems;
|
||||
|
||||
BOOST_FOREACH( PNS_ITEM* item, m_items )
|
||||
|
||||
if( item->GetNet() == aNet )
|
||||
{
|
||||
if( item->Net() == aNet )
|
||||
newItems.push_back( item );
|
||||
}
|
||||
|
||||
m_items = newItems;
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -15,7 +15,7 @@
|
|||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __PNS_ITEMSET_H
|
||||
|
@ -35,12 +35,28 @@
|
|||
class PNS_ITEMSET
|
||||
{
|
||||
public:
|
||||
typedef std::vector<PNS_ITEM*> ItemVector;
|
||||
typedef std::vector<PNS_ITEM*> ITEM_VECTOR;
|
||||
|
||||
PNS_ITEMSET( PNS_ITEM* aInitialItem = NULL );
|
||||
|
||||
PNS_ITEMSET( const PNS_ITEMSET& aOther )
|
||||
{
|
||||
m_items = aOther.m_items;
|
||||
m_ownedItems = ITEM_VECTOR();
|
||||
}
|
||||
|
||||
const PNS_ITEMSET& operator=( const PNS_ITEMSET& aOther )
|
||||
{
|
||||
m_items = aOther.m_items;
|
||||
m_ownedItems = ITEM_VECTOR();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
PNS_ITEMSET();
|
||||
~PNS_ITEMSET();
|
||||
|
||||
ItemVector& Items() { return m_items; }
|
||||
ITEM_VECTOR& Items() { return m_items; }
|
||||
const ITEM_VECTOR& CItems() const { return m_items; }
|
||||
|
||||
PNS_ITEMSET& FilterLayers( int aStart, int aEnd = -1 );
|
||||
PNS_ITEMSET& FilterKinds( int aKindMask );
|
||||
|
@ -48,15 +64,24 @@ public:
|
|||
|
||||
int Size() { return m_items.size(); }
|
||||
|
||||
void Add( PNS_ITEM* item )
|
||||
void Add( PNS_ITEM* aItem )
|
||||
{
|
||||
m_items.push_back( item );
|
||||
m_items.push_back( aItem );
|
||||
}
|
||||
|
||||
PNS_ITEM* Get( int index ) const { return m_items[index]; }
|
||||
|
||||
void Clear();
|
||||
|
||||
void AddOwned( PNS_ITEM *aItem )
|
||||
{
|
||||
m_items.push_back( aItem );
|
||||
m_ownedItems.push_back( aItem );
|
||||
}
|
||||
|
||||
private:
|
||||
ItemVector m_items;
|
||||
ITEM_VECTOR m_items;
|
||||
ITEM_VECTOR m_ownedItems;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -15,7 +15,7 @@
|
|||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __PNS_JOINT_H
|
||||
|
@ -40,11 +40,11 @@
|
|||
class PNS_JOINT : public PNS_ITEM
|
||||
{
|
||||
public:
|
||||
typedef std::vector<PNS_ITEM*> LinkedItems;
|
||||
typedef std::vector<PNS_ITEM*> LINKED_ITEMS;
|
||||
|
||||
///> Joints are hashed by their position, layers and net.
|
||||
/// Linked items are, obviously, not hashed
|
||||
struct HashTag
|
||||
struct HASH_TAG
|
||||
{
|
||||
VECTOR2I pos;
|
||||
int net;
|
||||
|
@ -53,8 +53,7 @@ public:
|
|||
PNS_JOINT() :
|
||||
PNS_ITEM( JOINT ) {}
|
||||
|
||||
PNS_JOINT( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers,
|
||||
int aNet = -1 ) :
|
||||
PNS_JOINT( const VECTOR2I& aPos, const PNS_LAYERSET& aLayers, int aNet = -1 ) :
|
||||
PNS_ITEM( JOINT )
|
||||
{
|
||||
m_tag.pos = aPos;
|
||||
|
@ -62,14 +61,14 @@ public:
|
|||
m_layers = aLayers;
|
||||
}
|
||||
|
||||
PNS_JOINT( const PNS_JOINT& b ) :
|
||||
PNS_JOINT( const PNS_JOINT& aB ) :
|
||||
PNS_ITEM( JOINT )
|
||||
{
|
||||
m_layers = b.m_layers;
|
||||
m_tag.pos = b.m_tag.pos;
|
||||
m_tag.net = b.m_tag.net;
|
||||
m_linkedItems = b.m_linkedItems;
|
||||
m_layers = b.m_layers;
|
||||
m_layers = aB.m_layers;
|
||||
m_tag.pos = aB.m_tag.pos;
|
||||
m_tag.net = aB.m_tag.net;
|
||||
m_linkedItems = aB.m_linkedItems;
|
||||
m_layers = aB.m_layers;
|
||||
}
|
||||
|
||||
PNS_ITEM* Clone ( ) const
|
||||
|
@ -85,22 +84,20 @@ public:
|
|||
if( m_linkedItems.size() != 2 )
|
||||
return false;
|
||||
|
||||
if( m_linkedItems[0]->GetKind() != SEGMENT ||
|
||||
m_linkedItems[1]->GetKind() != SEGMENT )
|
||||
if( m_linkedItems[0]->Kind() != SEGMENT || m_linkedItems[1]->Kind() != SEGMENT )
|
||||
return false;
|
||||
|
||||
PNS_SEGMENT* seg1 = static_cast<PNS_SEGMENT*>( m_linkedItems[0] );
|
||||
PNS_SEGMENT* seg2 = static_cast<PNS_SEGMENT*>( m_linkedItems[1] );
|
||||
|
||||
// joints between segments of different widths are not trivial.
|
||||
return seg1->GetWidth() == seg2->GetWidth();
|
||||
// joints between segments of different widths are not considered trivial.
|
||||
return seg1->Width() == seg2->Width();
|
||||
}
|
||||
|
||||
///> Links the joint to a given board item (when it's added to the PNS_NODE)
|
||||
void Link( PNS_ITEM* aItem )
|
||||
{
|
||||
LinkedItems::iterator f = std::find( m_linkedItems.begin(),
|
||||
m_linkedItems.end(), aItem );
|
||||
LINKED_ITEMS::iterator f = std::find( m_linkedItems.begin(), m_linkedItems.end(), aItem );
|
||||
|
||||
if( f != m_linkedItems.end() )
|
||||
return;
|
||||
|
@ -112,8 +109,7 @@ public:
|
|||
///> Returns true if the joint became dangling after unlinking.
|
||||
bool Unlink( PNS_ITEM* aItem )
|
||||
{
|
||||
LinkedItems::iterator f = std::find( m_linkedItems.begin(),
|
||||
m_linkedItems.end(), aItem );
|
||||
LINKED_ITEMS::iterator f = std::find( m_linkedItems.begin(), m_linkedItems.end(), aItem );
|
||||
|
||||
if( f != m_linkedItems.end() )
|
||||
m_linkedItems.erase( f );
|
||||
|
@ -131,21 +127,49 @@ public:
|
|||
return static_cast<PNS_SEGMENT*>( m_linkedItems[m_linkedItems[0] == aCurrent ? 1 : 0] );
|
||||
}
|
||||
|
||||
PNS_VIA* Via()
|
||||
{
|
||||
for( LINKED_ITEMS::iterator i = m_linkedItems.begin(); i != m_linkedItems.end(); ++i )
|
||||
{
|
||||
if( (*i)->Kind() == PNS_ITEM::VIA )
|
||||
return (PNS_VIA*)( *i );
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/// trivial accessors
|
||||
const HashTag& GetTag() const { return m_tag; }
|
||||
const VECTOR2I& GetPos() const { return m_tag.pos; }
|
||||
int GetNet() const { return m_tag.net; }
|
||||
LinkedItems& GetLinkList() { return m_linkedItems; };
|
||||
const HASH_TAG& Tag() const
|
||||
{
|
||||
return m_tag;
|
||||
}
|
||||
|
||||
const VECTOR2I& Pos() const
|
||||
{
|
||||
return m_tag.pos;
|
||||
}
|
||||
|
||||
int Net() const
|
||||
{
|
||||
return m_tag.net;
|
||||
}
|
||||
|
||||
LINKED_ITEMS& LinkList()
|
||||
{
|
||||
return m_linkedItems;
|
||||
}
|
||||
|
||||
///> Returns the number of linked items of types listed in aMask.
|
||||
int LinkCount( int aMask = -1 ) const
|
||||
{
|
||||
int n = 0;
|
||||
|
||||
for( LinkedItems::const_iterator i = m_linkedItems.begin();
|
||||
for( LINKED_ITEMS::const_iterator i = m_linkedItems.begin();
|
||||
i != m_linkedItems.end(); ++i )
|
||||
if( (*i)->GetKind() & aMask )
|
||||
{
|
||||
if( (*i)->Kind() & aMask )
|
||||
n++;
|
||||
}
|
||||
|
||||
return n;
|
||||
}
|
||||
|
@ -165,10 +189,12 @@ public:
|
|||
m_layers.Merge( aJoint.m_layers );
|
||||
|
||||
// fixme: duplicate links (?)
|
||||
for( LinkedItems::const_iterator i = aJoint.m_linkedItems.begin();
|
||||
for( LINKED_ITEMS::const_iterator i = aJoint.m_linkedItems.begin();
|
||||
i != aJoint.m_linkedItems.end(); ++i )
|
||||
{
|
||||
m_linkedItems.push_back( *i );
|
||||
}
|
||||
}
|
||||
|
||||
bool Overlaps( const PNS_JOINT& rhs ) const
|
||||
{
|
||||
|
@ -178,27 +204,27 @@ public:
|
|||
|
||||
private:
|
||||
///> hash tag for unordered_multimap
|
||||
HashTag m_tag;
|
||||
HASH_TAG m_tag;
|
||||
|
||||
///> list of items linked to this joint
|
||||
LinkedItems m_linkedItems;
|
||||
LINKED_ITEMS m_linkedItems;
|
||||
};
|
||||
|
||||
|
||||
// hash function & comparison operator for boost::unordered_map<>
|
||||
inline bool operator==( PNS_JOINT::HashTag const& p1,
|
||||
PNS_JOINT::HashTag const& p2 )
|
||||
inline bool operator==( PNS_JOINT::HASH_TAG const& aP1,
|
||||
PNS_JOINT::HASH_TAG const& aP2 )
|
||||
{
|
||||
return p1.pos == p2.pos && p1.net == p2.net;
|
||||
return aP1.pos == aP2.pos && aP1.net == aP2.net;
|
||||
}
|
||||
|
||||
|
||||
inline std::size_t hash_value( PNS_JOINT::HashTag const& p )
|
||||
inline std::size_t hash_value( PNS_JOINT::HASH_TAG const& aP )
|
||||
{
|
||||
std::size_t seed = 0;
|
||||
boost::hash_combine( seed, p.pos.x );
|
||||
boost::hash_combine( seed, p.pos.y );
|
||||
boost::hash_combine( seed, p.net );
|
||||
boost::hash_combine( seed, aP.pos.x );
|
||||
boost::hash_combine( seed, aP.pos.y );
|
||||
boost::hash_combine( seed, aP.net );
|
||||
|
||||
return seed;
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -15,7 +15,7 @@
|
|||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __PNS_LAYERSET_H
|
||||
|
@ -50,17 +50,17 @@ public:
|
|||
m_start = m_end = aLayer;
|
||||
}
|
||||
|
||||
PNS_LAYERSET( const PNS_LAYERSET& b ) :
|
||||
m_start( b.m_start ),
|
||||
m_end( b.m_end )
|
||||
PNS_LAYERSET( const PNS_LAYERSET& aB ) :
|
||||
m_start( aB.m_start ),
|
||||
m_end( aB.m_end )
|
||||
{}
|
||||
|
||||
~PNS_LAYERSET() {};
|
||||
|
||||
const PNS_LAYERSET& operator=( const PNS_LAYERSET& b )
|
||||
const PNS_LAYERSET& operator=( const PNS_LAYERSET& aB )
|
||||
{
|
||||
m_start = b.m_start;
|
||||
m_end = b.m_end;
|
||||
m_start = aB.m_start;
|
||||
m_end = aB.m_end;
|
||||
return *this;
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -15,7 +15,7 @@
|
|||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef __PNS_LINE_H
|
||||
|
@ -42,59 +42,39 @@ class PNS_VIA;
|
|||
* vias, pads, junctions between multiple traces or two traces different widths
|
||||
* and combinations of these). PNS_LINEs are NOT stored in the model (PNS_NODE).
|
||||
* Instead, they are assembled on-the-fly, based on a via/pad/segment that
|
||||
* belongs/begins them.
|
||||
* belongs to/starts/ends them.
|
||||
*
|
||||
* PNS_LINEs can be either loose (consisting of segments that do not belong to
|
||||
* any PNS_NODE) or owned (with segments taken from a PNS_NODE) - these are
|
||||
* returned by PNS_NODE::AssembleLine and friends.
|
||||
*
|
||||
* A PNS_LINE may have a PNS_VIA attached at its and - this is used by via
|
||||
* A PNS_LINE may have a PNS_VIA attached at its end (i.e. the last point) - this is used by via
|
||||
* dragging/force propagation stuff.
|
||||
*/
|
||||
|
||||
#define PNS_HULL_MARGIN 10
|
||||
|
||||
class PNS_LINE : public PNS_ITEM
|
||||
{
|
||||
public:
|
||||
typedef std::vector<PNS_SEGMENT*> LinkedSegments;
|
||||
|
||||
PNS_LINE() :
|
||||
PNS_ITEM( LINE )
|
||||
{
|
||||
m_segmentRefs = NULL;
|
||||
m_hasVia = false;
|
||||
m_affectedRangeStart = -1;
|
||||
};
|
||||
|
||||
PNS_LINE( int aLayer, int aWidth, const SHAPE_LINE_CHAIN& aLine ) :
|
||||
PNS_ITEM( LINE )
|
||||
{
|
||||
m_line = aLine;
|
||||
m_width = aWidth;
|
||||
m_segmentRefs = NULL;
|
||||
m_hasVia = false;
|
||||
m_affectedRangeStart = -1;
|
||||
SetLayer( aLayer );
|
||||
}
|
||||
|
||||
PNS_LINE( const PNS_LINE& aOther ) :
|
||||
PNS_ITEM( aOther ),
|
||||
m_line( aOther.m_line ),
|
||||
m_width( aOther.m_width )
|
||||
{
|
||||
m_net = aOther.m_net;
|
||||
m_movable = aOther.m_movable;
|
||||
m_world = aOther.m_world;
|
||||
m_layers = aOther.m_layers;
|
||||
m_segmentRefs = NULL;
|
||||
m_via = aOther.m_via;
|
||||
m_hasVia = aOther.m_hasVia;
|
||||
m_affectedRangeStart = -1;
|
||||
}
|
||||
typedef std::vector<PNS_SEGMENT*> SEGMENT_REFS;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* copies properties (net, layers from a base line), and replaces the shape
|
||||
* by aLine
|
||||
* Makes an empty line.
|
||||
*/
|
||||
PNS_LINE() : PNS_ITEM( LINE )
|
||||
{
|
||||
m_segmentRefs = NULL;
|
||||
m_hasVia = false;
|
||||
}
|
||||
|
||||
PNS_LINE( const PNS_LINE& aOther ) ;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
* Copies properties (net, layers, etc.) from a base line and replaces the shape
|
||||
* by another
|
||||
**/
|
||||
PNS_LINE( const PNS_LINE& aBase, const SHAPE_LINE_CHAIN& aLine ) :
|
||||
PNS_ITEM( aBase ),
|
||||
|
@ -105,49 +85,101 @@ public:
|
|||
m_layers = aBase.m_layers;
|
||||
m_segmentRefs = NULL;
|
||||
m_hasVia = false;
|
||||
m_affectedRangeStart = -1;
|
||||
}
|
||||
|
||||
~PNS_LINE()
|
||||
{
|
||||
if( m_segmentRefs )
|
||||
delete m_segmentRefs;
|
||||
};
|
||||
~PNS_LINE();
|
||||
|
||||
/// @copydoc PNS_ITEM::Clone()
|
||||
virtual PNS_LINE* Clone() const;
|
||||
|
||||
///> clones the line without cloning the shape
|
||||
///> (just the properties - net, width, layers, etc.)
|
||||
PNS_LINE* CloneProperties() const;
|
||||
const PNS_LINE& operator=( const PNS_LINE& aOther );
|
||||
|
||||
int GetLayer() const { return GetLayers().Start(); }
|
||||
///> Assigns a shape to the line (a polyline/line chain)
|
||||
void SetShape( const SHAPE_LINE_CHAIN& aLine )
|
||||
{
|
||||
m_line = aLine;
|
||||
}
|
||||
|
||||
///> Geometry accessors
|
||||
void SetShape( const SHAPE_LINE_CHAIN& aLine ) { m_line = aLine; }
|
||||
const SHAPE* GetShape() const { return &m_line; }
|
||||
SHAPE_LINE_CHAIN& GetLine() { return m_line; }
|
||||
const SHAPE_LINE_CHAIN& GetCLine() const { return m_line; }
|
||||
///> Returns the shape of the line
|
||||
const SHAPE* Shape() const
|
||||
{
|
||||
return &m_line;
|
||||
}
|
||||
|
||||
///> Width accessors
|
||||
void SetWidth( int aWidth ) { m_width = aWidth; }
|
||||
int GetWidth() const { return m_width; }
|
||||
///> Modifiable accessor to the underlying shape
|
||||
SHAPE_LINE_CHAIN& Line()
|
||||
{
|
||||
return m_line;
|
||||
}
|
||||
|
||||
///> Links a segment from a PNS_NODE to this line, making it owned by the node
|
||||
///> Const accessor to the underlying shape
|
||||
const SHAPE_LINE_CHAIN& CLine() const
|
||||
{
|
||||
return m_line;
|
||||
}
|
||||
|
||||
///> Returns the number of segments in the line
|
||||
int SegmentCount() const
|
||||
{
|
||||
return m_line.SegmentCount();
|
||||
}
|
||||
|
||||
///> Returns the number of points in the line
|
||||
int PointCount() const
|
||||
{
|
||||
return m_line.PointCount();
|
||||
}
|
||||
|
||||
///> Returns the aIdx-th point of the line
|
||||
const VECTOR2I& CPoint( int aIdx ) const
|
||||
{
|
||||
return m_line.CPoint( aIdx );
|
||||
}
|
||||
|
||||
///> Returns the aIdx-th segment of the line
|
||||
const SEG CSegment( int aIdx ) const
|
||||
{
|
||||
return m_line.CSegment( aIdx );
|
||||
}
|
||||
|
||||
///> Sets line width
|
||||
void SetWidth( int aWidth )
|
||||
{
|
||||
m_width = aWidth;
|
||||
}
|
||||
|
||||
///> Returns line width
|
||||
int Width() const
|
||||
{
|
||||
return m_width;
|
||||
}
|
||||
|
||||
///> Returns true if the line is geometrically identical as line aOther
|
||||
bool CompareGeometry( const PNS_LINE& aOther );
|
||||
|
||||
///> Reverses the point/vertex order
|
||||
void Reverse();
|
||||
|
||||
|
||||
/* Linking functions */
|
||||
|
||||
///> Adds a reference to a segment registered in a PNS_NODE that is a part of this line.
|
||||
void LinkSegment( PNS_SEGMENT* aSeg )
|
||||
{
|
||||
if( !m_segmentRefs )
|
||||
m_segmentRefs = new std::vector<PNS_SEGMENT*> ();
|
||||
m_segmentRefs = new SEGMENT_REFS();
|
||||
|
||||
m_segmentRefs->push_back( aSeg );
|
||||
}
|
||||
|
||||
///> Returns a list of segments from the owning node that constitute this
|
||||
///> line (or NULL if the line is loose)
|
||||
LinkedSegments* GetLinkedSegments()
|
||||
///> Returns the list of segments from the owning node that constitute this
|
||||
///> line (or NULL if the line is not linked)
|
||||
SEGMENT_REFS* LinkedSegments()
|
||||
{
|
||||
return m_segmentRefs;
|
||||
}
|
||||
|
||||
///> Checks if the segment aSeg is a part of the line.
|
||||
bool ContainsSegment( PNS_SEGMENT* aSeg ) const
|
||||
{
|
||||
if( !m_segmentRefs )
|
||||
|
@ -157,13 +189,24 @@ public:
|
|||
aSeg ) != m_segmentRefs->end();
|
||||
}
|
||||
|
||||
///> Returns this line, but clipped to the nearest obstacle
|
||||
///> along, to avoid collision.
|
||||
///> Erases the linking information. Used to detach the line from the owning node.
|
||||
void ClearSegmentLinks();
|
||||
|
||||
///> Returns the number of segments that were assembled together to form this line.
|
||||
int LinkCount() const
|
||||
{
|
||||
if( !m_segmentRefs )
|
||||
return -1;
|
||||
|
||||
return m_segmentRefs->size();
|
||||
}
|
||||
|
||||
///> Clips the line to the nearest obstacle, traversing from the line's start vertex (0).
|
||||
///> Returns the clipped line.
|
||||
const PNS_LINE ClipToNearestObstacle( PNS_NODE* aNode ) const;
|
||||
|
||||
///> DEPRECATED optimization functions (moved to PNS_OPTIMIZER)
|
||||
bool MergeObtuseSegments();
|
||||
bool MergeSegments();
|
||||
///> Clips the line to a given range of vertices.
|
||||
void ClipVertexRange ( int aStart, int aEnd );
|
||||
|
||||
///> Returns the number of corners of angles specified by mask aAngles.
|
||||
int CountCorners( int aAngles );
|
||||
|
@ -174,23 +217,12 @@ public:
|
|||
///> aWalkaroundPath = path around the obstacle
|
||||
///> aPostPath = past from obstacle till the end
|
||||
///> aCW = whether to walk around in clockwise or counter-clockwise direction.
|
||||
void NewWalkaround( const SHAPE_LINE_CHAIN& aObstacle,
|
||||
SHAPE_LINE_CHAIN& aPrePath,
|
||||
SHAPE_LINE_CHAIN& aWalkaroundPath,
|
||||
SHAPE_LINE_CHAIN& aPostPath,
|
||||
bool Walkaround( SHAPE_LINE_CHAIN aObstacle,
|
||||
SHAPE_LINE_CHAIN& aPre,
|
||||
SHAPE_LINE_CHAIN& aWalk,
|
||||
SHAPE_LINE_CHAIN& aPost,
|
||||
bool aCw ) const;
|
||||
|
||||
void NewWalkaround( const SHAPE_LINE_CHAIN& aObstacle,
|
||||
SHAPE_LINE_CHAIN& aPath,
|
||||
bool aCw ) const;
|
||||
|
||||
|
||||
bool Walkaround( SHAPE_LINE_CHAIN obstacle,
|
||||
SHAPE_LINE_CHAIN& pre,
|
||||
SHAPE_LINE_CHAIN& walk,
|
||||
SHAPE_LINE_CHAIN& post,
|
||||
bool cw ) const;
|
||||
|
||||
void Walkaround( const SHAPE_LINE_CHAIN& aObstacle,
|
||||
SHAPE_LINE_CHAIN& aPath,
|
||||
bool aCw ) const;
|
||||
|
@ -202,62 +234,48 @@ public:
|
|||
|
||||
bool EndsWithVia() const { return m_hasVia; }
|
||||
|
||||
void AppendVia( const PNS_VIA& aVia )
|
||||
{
|
||||
m_hasVia = true;
|
||||
m_via = aVia;
|
||||
m_via.SetNet( m_net );
|
||||
}
|
||||
|
||||
void AppendVia( const PNS_VIA& aVia );
|
||||
void RemoveVia() { m_hasVia = false; }
|
||||
const PNS_VIA& GetVia() const { return m_via; }
|
||||
|
||||
void SetAffectedRange( int aStart, int aEnd )
|
||||
{
|
||||
m_affectedRangeStart = aStart;
|
||||
m_affectedRangeEnd = aEnd;
|
||||
}
|
||||
const PNS_VIA& Via() const { return m_via; }
|
||||
|
||||
void ClearAffectedRange()
|
||||
{
|
||||
m_affectedRangeStart = -1;
|
||||
}
|
||||
virtual void Mark( int aMarker );
|
||||
virtual void Unmark ();
|
||||
virtual int Marker() const;
|
||||
|
||||
bool GetAffectedRange( int& aStart, int& aEnd )
|
||||
{
|
||||
if( m_affectedRangeStart >= 0 )
|
||||
{
|
||||
aStart = m_affectedRangeStart;
|
||||
aEnd = m_affectedRangeEnd;
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
aStart = 0;
|
||||
aEnd = m_line.PointCount();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void DragSegment( const VECTOR2I& aP, int aIndex, int aSnappingThreshold = 0 );
|
||||
void DragCorner( const VECTOR2I& aP, int aIndex, int aSnappingThreshold = 0 );
|
||||
|
||||
void SetRank( int aRank );
|
||||
int Rank() const;
|
||||
|
||||
bool HasLoops() const;
|
||||
|
||||
private:
|
||||
bool onEdge( const SHAPE_LINE_CHAIN& obstacle, VECTOR2I p, int& ei, bool& is_vertex ) const;
|
||||
bool walkScan( const SHAPE_LINE_CHAIN& line, const SHAPE_LINE_CHAIN& obstacle,
|
||||
bool reverse, VECTOR2I& ip, int& index_o, int& index_l, bool& is_vertex ) const;
|
||||
VECTOR2I snapToNeighbourSegments( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I &aP,
|
||||
int aIndex, int aThreshold) const;
|
||||
|
||||
///> List of semgments in a PNS_NODE (PNS_ITEM::m_owner) that constitute this line.
|
||||
LinkedSegments* m_segmentRefs;
|
||||
VECTOR2I snapDraggedCorner( const SHAPE_LINE_CHAIN& aPath, const VECTOR2I &aP,
|
||||
int aIndex, int aThreshold ) const;
|
||||
|
||||
///> Shape of the line
|
||||
///> Copies m_segmentRefs from the line aParent.
|
||||
void copyLinks( const PNS_LINE* aParent ) ;
|
||||
|
||||
///> List of segments in the owning PNS_NODE (PNS_ITEM::m_owner) that constitute this line, or NULL
|
||||
///> if the line is not a part of any node.
|
||||
SEGMENT_REFS* m_segmentRefs;
|
||||
|
||||
///> The actual shape of the line
|
||||
SHAPE_LINE_CHAIN m_line;
|
||||
|
||||
///> our width
|
||||
int m_width;
|
||||
|
||||
///> Via at the end and a flag indicating if it's enabled.
|
||||
PNS_VIA m_via;
|
||||
///> If true, the line ends with a via
|
||||
bool m_hasVia;
|
||||
|
||||
int m_affectedRangeStart;
|
||||
int m_affectedRangeEnd;
|
||||
///> Via at the end point, if m_hasVia == true
|
||||
PNS_VIA m_via;
|
||||
};
|
||||
|
||||
#endif // __PNS_LINE_H
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* KiRouter - a push-and-(sometimes-)shove PCB router
|
||||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* Copyright (C) 2013-2014 CERN
|
||||
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
|
@ -15,12 +15,14 @@
|
|||
* General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along
|
||||
* with this program. If not, see <http://www.gnu.or/licenses/>.
|
||||
* with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
||||
#include <colors.h>
|
||||
|
||||
#include "trace.h"
|
||||
|
||||
#include "pns_node.h"
|
||||
|
@ -28,23 +30,21 @@
|
|||
#include "pns_walkaround.h"
|
||||
#include "pns_shove.h"
|
||||
#include "pns_utils.h"
|
||||
#include "pns_router.h"
|
||||
|
||||
#include <class_board_item.h>
|
||||
|
||||
using boost::optional;
|
||||
|
||||
const double PNS_LINE_PLACER::m_shoveLengthThreshold = 1.7;
|
||||
|
||||
PNS_LINE_PLACER::PNS_LINE_PLACER( PNS_NODE* aWorld )
|
||||
PNS_LINE_PLACER::PNS_LINE_PLACER( PNS_ROUTER* aRouter ) :
|
||||
PNS_ALGO_BASE ( aRouter )
|
||||
{
|
||||
m_initial_direction = DIRECTION_45( DIRECTION_45::N );
|
||||
m_follow_mouse = false;
|
||||
m_smoothing_step = 100000;
|
||||
m_smooth_mouse = false;
|
||||
m_initial_direction = DIRECTION_45::N;
|
||||
m_iteration = 0;
|
||||
m_world = aWorld;
|
||||
m_mode = RM_Smart;
|
||||
m_follow_mouse = true;
|
||||
m_world = NULL;
|
||||
m_shove = NULL;
|
||||
};
|
||||
m_currentNode = NULL;
|
||||
}
|
||||
|
||||
|
||||
PNS_LINE_PLACER::~PNS_LINE_PLACER()
|
||||
|
@ -54,18 +54,24 @@ PNS_LINE_PLACER::~PNS_LINE_PLACER()
|
|||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::ApplySettings( const PNS_ROUTING_SETTINGS& aSettings )
|
||||
void PNS_LINE_PLACER::setWorld ( PNS_NODE* aWorld )
|
||||
{
|
||||
m_follow_mouse = aSettings.m_followMouse;
|
||||
m_mode = aSettings.m_routingMode;
|
||||
m_walkaroundIterationLimit = aSettings.m_walkaroundIterationLimit;
|
||||
m_smartPads = aSettings.m_smartPads;
|
||||
m_world = aWorld;
|
||||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::StartPlacement( const VECTOR2I& aStart, int aNet,
|
||||
int aWidth, int aLayer )
|
||||
void PNS_LINE_PLACER::AddVia( bool aEnabled, int aDiameter, int aDrill )
|
||||
{
|
||||
m_viaDiameter = aDiameter;
|
||||
m_viaDrill = aDrill;
|
||||
m_placingVia = aEnabled;
|
||||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::startPlacement( const VECTOR2I& aStart, int aNet, int aWidth, int aLayer )
|
||||
{
|
||||
assert( m_world != NULL );
|
||||
|
||||
m_direction = m_initial_direction;
|
||||
TRACE( 1, "world %p, intitial-direction %s layer %d\n",
|
||||
m_world % m_direction.Format().c_str() % aLayer );
|
||||
|
@ -73,27 +79,37 @@ void PNS_LINE_PLACER::StartPlacement( const VECTOR2I& aStart, int aNet,
|
|||
m_tail.SetNet( aNet );
|
||||
m_head.SetWidth( aWidth );
|
||||
m_tail.SetWidth( aWidth );
|
||||
m_head.GetLine().Clear();
|
||||
m_tail.GetLine().Clear();
|
||||
m_head.Line().Clear();
|
||||
m_tail.Line().Clear();
|
||||
m_head.SetLayer( aLayer );
|
||||
m_tail.SetLayer( aLayer );
|
||||
m_iteration = 0;
|
||||
m_p_start = aStart;
|
||||
m_currentNode = m_world->Branch();
|
||||
m_head.SetWorld( m_currentNode );
|
||||
m_tail.SetWorld( m_currentNode );
|
||||
// if(m_shove)
|
||||
// delete m_shove;
|
||||
m_shove = new PNS_SHOVE( m_currentNode );
|
||||
|
||||
m_lastNode = NULL;
|
||||
m_currentNode = m_world;
|
||||
|
||||
m_currentMode = Settings().Mode();
|
||||
|
||||
if( m_shove )
|
||||
delete m_shove;
|
||||
|
||||
m_shove = NULL;
|
||||
|
||||
if( m_currentMode == RM_Shove || m_currentMode == RM_Smart )
|
||||
{
|
||||
m_shove = new PNS_SHOVE( m_world->Branch(), Router() );
|
||||
}
|
||||
|
||||
m_placingVia = false;
|
||||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::SetInitialDirection( const DIRECTION_45& aDirection )
|
||||
void PNS_LINE_PLACER::setInitialDirection( const DIRECTION_45& aDirection )
|
||||
{
|
||||
m_initial_direction = aDirection;
|
||||
|
||||
if( m_tail.GetCLine().SegmentCount() == 0 )
|
||||
if( m_tail.SegmentCount() == 0 )
|
||||
m_direction = aDirection;
|
||||
}
|
||||
|
||||
|
@ -101,8 +117,8 @@ void PNS_LINE_PLACER::SetInitialDirection( const DIRECTION_45& aDirection )
|
|||
bool PNS_LINE_PLACER::handleSelfIntersections()
|
||||
{
|
||||
SHAPE_LINE_CHAIN::INTERSECTIONS ips;
|
||||
SHAPE_LINE_CHAIN& head = m_head.GetLine();
|
||||
SHAPE_LINE_CHAIN& tail = m_tail.GetLine();
|
||||
SHAPE_LINE_CHAIN& head = m_head.Line();
|
||||
SHAPE_LINE_CHAIN& tail = m_tail.Line();
|
||||
|
||||
// if there is no tail, there is nothing to intersect with
|
||||
if( tail.PointCount() < 2 )
|
||||
|
@ -140,6 +156,7 @@ bool PNS_LINE_PLACER::handleSelfIntersections()
|
|||
m_direction = m_initial_direction;
|
||||
tail.Clear();
|
||||
head.Clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
|
@ -159,8 +176,11 @@ bool PNS_LINE_PLACER::handleSelfIntersections()
|
|||
|
||||
bool PNS_LINE_PLACER::handlePullback()
|
||||
{
|
||||
SHAPE_LINE_CHAIN& head = m_head.GetLine();
|
||||
SHAPE_LINE_CHAIN& tail = m_tail.GetLine();
|
||||
SHAPE_LINE_CHAIN& head = m_head.Line();
|
||||
SHAPE_LINE_CHAIN& tail = m_tail.Line();
|
||||
|
||||
if( head.PointCount() < 2 )
|
||||
return false;
|
||||
|
||||
int n = tail.PointCount();
|
||||
|
||||
|
@ -173,8 +193,8 @@ bool PNS_LINE_PLACER::handlePullback()
|
|||
return true;
|
||||
}
|
||||
|
||||
DIRECTION_45 first_head( head.Segment( 0 ) );
|
||||
DIRECTION_45 last_tail( tail.Segment( -1 ) );
|
||||
DIRECTION_45 first_head( head.CSegment( 0 ) );
|
||||
DIRECTION_45 last_tail( tail.CSegment( -1 ) );
|
||||
DIRECTION_45::AngleType angle = first_head.Angle( last_tail );
|
||||
|
||||
// case 1: we have a defined routing direction, and the currently computed
|
||||
|
@ -215,11 +235,14 @@ bool PNS_LINE_PLACER::handlePullback()
|
|||
|
||||
bool PNS_LINE_PLACER::reduceTail( const VECTOR2I& aEnd )
|
||||
{
|
||||
SHAPE_LINE_CHAIN& head = m_head.GetLine();
|
||||
SHAPE_LINE_CHAIN& tail = m_tail.GetLine();
|
||||
SHAPE_LINE_CHAIN& head = m_head.Line();
|
||||
SHAPE_LINE_CHAIN& tail = m_tail.Line();
|
||||
|
||||
int n = tail.SegmentCount();
|
||||
|
||||
if( head.SegmentCount() < 1 )
|
||||
return false;
|
||||
|
||||
// Don't attempt this for too short tails
|
||||
if( n < 2 )
|
||||
return false;
|
||||
|
@ -231,7 +254,7 @@ bool PNS_LINE_PLACER::reduceTail( const VECTOR2I& aEnd )
|
|||
VECTOR2I new_start;
|
||||
int reduce_index = -1;
|
||||
|
||||
DIRECTION_45 head_dir( head.Segment( 0 ) );
|
||||
DIRECTION_45 head_dir( head.CSegment( 0 ) );
|
||||
|
||||
for( int i = tail.SegmentCount() - 1; i >= 0; i-- )
|
||||
{
|
||||
|
@ -247,7 +270,7 @@ bool PNS_LINE_PLACER::reduceTail( const VECTOR2I& aEnd )
|
|||
if( m_currentNode->CheckColliding( &tmp, PNS_ITEM::ANY ) )
|
||||
break;
|
||||
|
||||
if( DIRECTION_45( replacement.Segment( 0 ) ) == dir )
|
||||
if( DIRECTION_45( replacement.CSegment( 0 ) ) == dir )
|
||||
{
|
||||
new_start = s.A;
|
||||
new_direction = dir;
|
||||
|
@ -274,10 +297,10 @@ bool PNS_LINE_PLACER::reduceTail( const VECTOR2I& aEnd )
|
|||
}
|
||||
|
||||
|
||||
bool PNS_LINE_PLACER::checkObtusity( const SEG& a, const SEG& b ) const
|
||||
bool PNS_LINE_PLACER::checkObtusity( const SEG& aA, const SEG& aB ) const
|
||||
{
|
||||
const DIRECTION_45 dir_a( a );
|
||||
const DIRECTION_45 dir_b( b );
|
||||
const DIRECTION_45 dir_a( aA );
|
||||
const DIRECTION_45 dir_b( aB );
|
||||
|
||||
return dir_a.IsObtuse( dir_b ) || dir_a == dir_b;
|
||||
}
|
||||
|
@ -285,8 +308,8 @@ bool PNS_LINE_PLACER::checkObtusity( const SEG& a, const SEG& b ) const
|
|||
|
||||
bool PNS_LINE_PLACER::mergeHead()
|
||||
{
|
||||
SHAPE_LINE_CHAIN& head = m_head.GetLine();
|
||||
SHAPE_LINE_CHAIN& tail = m_tail.GetLine();
|
||||
SHAPE_LINE_CHAIN& head = m_head.Line();
|
||||
SHAPE_LINE_CHAIN& tail = m_tail.Line();
|
||||
|
||||
const int ForbiddenAngles = DIRECTION_45::ANG_ACUTE |
|
||||
DIRECTION_45::ANG_HALF_FULL |
|
||||
|
@ -357,20 +380,22 @@ bool PNS_LINE_PLACER::handleViaPlacement( PNS_LINE& aHead )
|
|||
return true;
|
||||
|
||||
PNS_LAYERSET allLayers( 0, 15 );
|
||||
PNS_VIA v( aHead.GetCLine().CPoint( -1 ), allLayers, m_viaDiameter, aHead.GetNet() );
|
||||
PNS_VIA v( aHead.CPoint( -1 ), allLayers, m_viaDiameter, aHead.Net() );
|
||||
v.SetDrill( m_viaDrill );
|
||||
|
||||
VECTOR2I force;
|
||||
VECTOR2I lead = aHead.GetCLine().CPoint( -1 ) - aHead.GetCLine().CPoint( 0 );
|
||||
VECTOR2I lead = aHead.CPoint( -1 ) - aHead.CPoint( 0 );
|
||||
|
||||
if( v.PushoutForce( m_shove->GetCurrentNode(), lead, force, true, 20 ) )
|
||||
bool solidsOnly = ( m_currentMode != RM_Walkaround );
|
||||
|
||||
if( v.PushoutForce( m_currentNode, lead, force, solidsOnly, 40 ) )
|
||||
{
|
||||
SHAPE_LINE_CHAIN line = m_direction.BuildInitialTrace(
|
||||
aHead.GetCLine().CPoint( 0 ),
|
||||
aHead.GetCLine().CPoint( -1 ) + force );
|
||||
aHead.CPoint( 0 ),
|
||||
aHead.CPoint( -1 ) + force );
|
||||
aHead = PNS_LINE( aHead, line );
|
||||
|
||||
v.SetPos( v.GetPos() + force );
|
||||
v.SetPos( v.Pos() + force );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -378,109 +403,114 @@ bool PNS_LINE_PLACER::handleViaPlacement( PNS_LINE& aHead )
|
|||
}
|
||||
|
||||
|
||||
bool PNS_LINE_PLACER::routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead,
|
||||
bool aCwWalkaround )
|
||||
bool PNS_LINE_PLACER::rhWalkOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead )
|
||||
{
|
||||
// STAGE 1: route a simple two-segment trace between m_p_start and aP...
|
||||
SHAPE_LINE_CHAIN line = m_direction.BuildInitialTrace( m_p_start, aP );
|
||||
PNS_LINE initTrack( m_head, line ), walkFull;
|
||||
int effort = 0;
|
||||
bool viaOk = handleViaPlacement( initTrack );
|
||||
bool rv = true;
|
||||
|
||||
PNS_LINE initTrack( m_head, line );
|
||||
PNS_LINE walkFull, walkSolids;
|
||||
|
||||
if( m_mode == RM_Ignore )
|
||||
{
|
||||
aNewHead = initTrack;
|
||||
return true;
|
||||
}
|
||||
|
||||
handleViaPlacement( initTrack );
|
||||
|
||||
m_currentNode = m_shove->GetCurrentNode();
|
||||
|
||||
PNS_OPTIMIZER optimizer( m_currentNode );
|
||||
PNS_WALKAROUND walkaround( m_currentNode );
|
||||
PNS_WALKAROUND walkaround( m_currentNode, Router() );
|
||||
|
||||
walkaround.SetSolidsOnly( false );
|
||||
walkaround.SetIterationLimit( m_mode == RM_Walkaround ? 8 : 5 );
|
||||
// walkaround.SetApproachCursor(true, aP);
|
||||
walkaround.SetIterationLimit( Settings().WalkaroundIterationLimit() );
|
||||
|
||||
PNS_WALKAROUND::WalkaroundStatus wf = walkaround.Route( initTrack, walkFull );
|
||||
PNS_WALKAROUND::WALKAROUND_STATUS wf = walkaround.Route( initTrack, walkFull, false );
|
||||
|
||||
#if 0
|
||||
|
||||
if( m_mode == RM_Walkaround )
|
||||
switch( Settings().OptimizerEffort() )
|
||||
{
|
||||
// walkaround.
|
||||
// PNSDisplayDebugLine (walkFull.GetCLine(), 4);
|
||||
case OE_LOW:
|
||||
effort = 0;
|
||||
break;
|
||||
|
||||
case OE_MEDIUM:
|
||||
case OE_FULL:
|
||||
effort = PNS_OPTIMIZER::MERGE_SEGMENTS;
|
||||
break;
|
||||
}
|
||||
|
||||
if( Settings().SmartPads() )
|
||||
effort |= PNS_OPTIMIZER::SMART_PADS;
|
||||
|
||||
if( wf == PNS_WALKAROUND::STUCK )
|
||||
{
|
||||
aNewHead = m_head;
|
||||
aNewHead.SetShape( walkFull.GetCLine() );
|
||||
aNewHead = aNewHead.ClipToNearestObstacle( m_currentNode );
|
||||
return false;
|
||||
walkFull = walkFull.ClipToNearestObstacle( m_currentNode );
|
||||
rv = true;
|
||||
}
|
||||
|
||||
aNewHead = m_head;
|
||||
aNewHead.SetShape( walkFull.GetCLine() );
|
||||
|
||||
// printf("nh w %d l %d\n", aNewHead.GetWidth(), aNewHead.GetLayers().Start());
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
PNS_COST_ESTIMATOR cost_walk, cost_orig;
|
||||
|
||||
walkaround.SetApproachCursor( false, aP );
|
||||
walkaround.SetSolidsOnly( true );
|
||||
walkaround.SetIterationLimit( 10 );
|
||||
PNS_WALKAROUND::WalkaroundStatus stat_solids = walkaround.Route( initTrack, walkSolids );
|
||||
|
||||
optimizer.SetEffortLevel( PNS_OPTIMIZER::MERGE_SEGMENTS );
|
||||
optimizer.SetCollisionMask( PNS_ITEM::SOLID );
|
||||
optimizer.Optimize( &walkSolids );
|
||||
#if 0
|
||||
optimizer.SetCollisionMask( -1 );
|
||||
optimizer.Optimize( &walkFull );
|
||||
#endif
|
||||
cost_orig.Add( initTrack );
|
||||
cost_walk.Add( walkFull );
|
||||
|
||||
if( m_mode == RM_Smart || m_mode == RM_Shove )
|
||||
else if( m_placingVia && viaOk )
|
||||
{
|
||||
PNS_LINE l2;
|
||||
PNS_LAYERSET allLayers( 0, 15 );
|
||||
PNS_VIA v1( walkFull.CPoint( -1 ), allLayers, m_viaDiameter );
|
||||
walkFull.AppendVia( v1 );
|
||||
}
|
||||
|
||||
bool walk_better = cost_orig.IsBetter( cost_walk, 1.5, 10.0 );
|
||||
walk_better = false;
|
||||
PNS_OPTIMIZER::Optimize( &walkFull, effort, m_currentNode );
|
||||
|
||||
#if 0
|
||||
printf( "RtTrk width %d %d %d", initTrack.GetWidth(),
|
||||
walkFull.GetWidth(), walkSolids.GetWidth() );
|
||||
printf( "init-coll %d\n", m_currentNode->CheckColliding( &initTrack ) ? 1 : 0 );
|
||||
printf( "total cost: walk cor %.0f len %.0f orig cor %.0f len %.0f walk-better %d\n",
|
||||
cost_walk.GetCornerCost(), cost_walk.GetLengthCost(),
|
||||
cost_orig.GetCornerCost(), cost_orig.GetLengthCost(),
|
||||
walk_better );
|
||||
#endif
|
||||
if( m_currentNode->CheckColliding( &walkFull ) )
|
||||
{
|
||||
TRACEn(0, "strange, walk line colliding\n");
|
||||
}
|
||||
|
||||
if( m_mode == RM_Smart && wf == PNS_WALKAROUND::DONE && walk_better
|
||||
&& walkFull.GetCLine().CPoint( -1 ) == initTrack.GetCLine().CPoint( -1 ) )
|
||||
l2 = walkFull;
|
||||
else if( stat_solids == PNS_WALKAROUND::DONE )
|
||||
l2 = walkSolids;
|
||||
else
|
||||
l2 = initTrack.ClipToNearestObstacle( m_shove->GetCurrentNode() );
|
||||
m_head = walkFull;
|
||||
aNewHead = walkFull;
|
||||
|
||||
PNS_LINE l( m_tail );
|
||||
l.GetLine().Append( l2.GetCLine() );
|
||||
l.GetLine().Simplify();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
bool PNS_LINE_PLACER::rhMarkObstacles( const VECTOR2I& aP, PNS_LINE& aNewHead )
|
||||
{
|
||||
m_head.SetShape( m_direction.BuildInitialTrace( m_p_start, aP ) );
|
||||
|
||||
if( m_placingVia )
|
||||
{
|
||||
PNS_LAYERSET allLayers( 0, 15 );
|
||||
PNS_VIA v1( l.GetCLine().CPoint( -1 ), allLayers, m_viaDiameter );
|
||||
PNS_VIA v2( l2.GetCLine().CPoint( -1 ), allLayers, m_viaDiameter );
|
||||
PNS_VIA v1( m_head.CPoint( -1 ), allLayers, m_viaDiameter );
|
||||
m_head.AppendVia( v1 );
|
||||
}
|
||||
|
||||
aNewHead = m_head;
|
||||
|
||||
return m_currentNode->CheckColliding( &m_head );
|
||||
}
|
||||
|
||||
|
||||
bool PNS_LINE_PLACER::rhShoveOnly ( const VECTOR2I& aP, PNS_LINE& aNewHead )
|
||||
{
|
||||
SHAPE_LINE_CHAIN line = m_direction.BuildInitialTrace( m_p_start, aP );
|
||||
PNS_LINE initTrack( m_head, line );
|
||||
PNS_LINE walkSolids, l2;
|
||||
|
||||
handleViaPlacement( initTrack );
|
||||
|
||||
m_currentNode = m_shove->CurrentNode();
|
||||
PNS_OPTIMIZER optimizer( m_currentNode );
|
||||
|
||||
PNS_WALKAROUND walkaround( m_currentNode, Router() );
|
||||
|
||||
walkaround.SetSolidsOnly( true );
|
||||
walkaround.SetIterationLimit( 10 );
|
||||
PNS_WALKAROUND::WALKAROUND_STATUS stat_solids = walkaround.Route( initTrack, walkSolids );
|
||||
|
||||
optimizer.SetEffortLevel( PNS_OPTIMIZER::MERGE_SEGMENTS );
|
||||
optimizer.SetCollisionMask ( PNS_ITEM::SOLID );
|
||||
optimizer.Optimize( &walkSolids );
|
||||
|
||||
if( stat_solids == PNS_WALKAROUND::DONE )
|
||||
l2 = walkSolids;
|
||||
else
|
||||
l2 = initTrack.ClipToNearestObstacle( m_shove->CurrentNode() );
|
||||
|
||||
PNS_LINE l( m_tail );
|
||||
l.Line().Append( l2.CLine() );
|
||||
l.Line().Simplify();
|
||||
|
||||
if( m_placingVia )
|
||||
{
|
||||
PNS_LAYERSET allLayers( 0, 15 );
|
||||
PNS_VIA v1( l.CPoint( -1 ), allLayers, m_viaDiameter );
|
||||
PNS_VIA v2( l2.CPoint( -1 ), allLayers, m_viaDiameter );
|
||||
v1.SetDrill( m_viaDrill );
|
||||
v2.SetDrill( m_viaDrill );
|
||||
|
||||
|
@ -488,15 +518,25 @@ bool PNS_LINE_PLACER::routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead,
|
|||
l2.AppendVia( v2 );
|
||||
}
|
||||
|
||||
PNS_SHOVE::ShoveStatus status = m_shove->ShoveLines( &l );
|
||||
m_currentNode = m_shove->GetCurrentNode();
|
||||
l.Line().Simplify();
|
||||
|
||||
// in certain, uncommon cases there may be loops in the head+tail, In such case, we don't shove to avoid
|
||||
// screwing up the database.
|
||||
if( l.HasLoops() )
|
||||
{
|
||||
aNewHead = m_head;
|
||||
return false;
|
||||
}
|
||||
|
||||
PNS_SHOVE::SHOVE_STATUS status = m_shove->ShoveLines( l );
|
||||
|
||||
m_currentNode = m_shove->CurrentNode();
|
||||
|
||||
if( status == PNS_SHOVE::SH_OK )
|
||||
{
|
||||
optimizer.SetWorld( m_currentNode );
|
||||
optimizer.ClearCache();
|
||||
optimizer.SetEffortLevel( PNS_OPTIMIZER::MERGE_OBTUSE | PNS_OPTIMIZER::SMART_PADS );
|
||||
optimizer.SetCollisionMask( -1 );
|
||||
optimizer.SetCollisionMask( PNS_ITEM::ANY );
|
||||
optimizer.Optimize( &l2 );
|
||||
|
||||
aNewHead = l2;
|
||||
|
@ -510,11 +550,27 @@ bool PNS_LINE_PLACER::routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead,
|
|||
walkaround.SetIterationLimit( 10 );
|
||||
walkaround.SetApproachCursor( true, aP );
|
||||
walkaround.Route( initTrack, l2 );
|
||||
aNewHead = l2.ClipToNearestObstacle( m_shove->GetCurrentNode() );
|
||||
// aNewHead = l2;
|
||||
aNewHead = l2.ClipToNearestObstacle( m_shove->CurrentNode() );
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
bool PNS_LINE_PLACER::routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead )
|
||||
{
|
||||
switch( m_currentMode )
|
||||
{
|
||||
case RM_MarkObstacles:
|
||||
return rhMarkObstacles( aP, aNewHead );
|
||||
case RM_Walkaround:
|
||||
return rhWalkOnly ( aP, aNewHead );
|
||||
case RM_Shove:
|
||||
return rhShoveOnly ( aP, aNewHead );
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -523,12 +579,30 @@ bool PNS_LINE_PLACER::routeHead( const VECTOR2I& aP, PNS_LINE& aNewHead,
|
|||
|
||||
bool PNS_LINE_PLACER::optimizeTailHeadTransition()
|
||||
{
|
||||
SHAPE_LINE_CHAIN& head = m_head.GetLine();
|
||||
SHAPE_LINE_CHAIN& tail = m_tail.GetLine();
|
||||
PNS_LINE tmp = Trace();
|
||||
|
||||
const int TailLookbackSegments = 5;
|
||||
if( PNS_OPTIMIZER::Optimize( &tmp, PNS_OPTIMIZER::FANOUT_CLEANUP, m_currentNode ) )
|
||||
{
|
||||
if( tmp.SegmentCount() < 1 )
|
||||
return false;
|
||||
|
||||
int threshold = std::min( tail.PointCount(), TailLookbackSegments + 1 );
|
||||
m_head = tmp;
|
||||
m_p_start = tmp.CLine().CPoint( 0 );
|
||||
m_direction = DIRECTION_45( tmp.CSegment( 0 ) );
|
||||
m_tail.Line().Clear();
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
SHAPE_LINE_CHAIN& head = m_head.Line();
|
||||
SHAPE_LINE_CHAIN& tail = m_tail.Line();
|
||||
|
||||
int tailLookbackSegments = 3;
|
||||
|
||||
//if(m_currentMode() == RM_Walkaround)
|
||||
// tailLookbackSegments = 10000;
|
||||
|
||||
int threshold = std::min( tail.PointCount(), tailLookbackSegments + 1 );
|
||||
|
||||
if( tail.SegmentCount() < 3 )
|
||||
return false;
|
||||
|
@ -536,8 +610,9 @@ bool PNS_LINE_PLACER::optimizeTailHeadTransition()
|
|||
// assemble TailLookbackSegments tail segments with the current head
|
||||
SHAPE_LINE_CHAIN opt_line = tail.Slice( -threshold, -1 );
|
||||
|
||||
opt_line.Append( head );
|
||||
// opt_line.Simplify();
|
||||
int end = std::min(2, head.PointCount() - 1 );
|
||||
|
||||
opt_line.Append( head.Slice( 0, end ) );
|
||||
|
||||
PNS_LINE new_head( m_tail, opt_line );
|
||||
|
||||
|
@ -545,20 +620,18 @@ bool PNS_LINE_PLACER::optimizeTailHeadTransition()
|
|||
// If so, replace the (threshold) last tail points and the head with
|
||||
// the optimized line
|
||||
|
||||
// if(PNS_OPTIMIZER::Optimize(&new_head, PNS_OPTIMIZER::MERGE_SEGMENTS))
|
||||
|
||||
if( new_head.MergeSegments() )
|
||||
if( PNS_OPTIMIZER::Optimize( &new_head, PNS_OPTIMIZER::MERGE_OBTUSE, m_currentNode ) )
|
||||
{
|
||||
PNS_LINE tmp( m_tail, opt_line );
|
||||
|
||||
TRACE( 0, "Placer: optimize tail-head [%d]", threshold );
|
||||
|
||||
head.Clear();
|
||||
tail.Replace( -threshold, -1, new_head.GetCLine() );
|
||||
tail.Replace( -threshold, -1, new_head.CLine() );
|
||||
tail.Simplify();
|
||||
|
||||
m_p_start = new_head.GetCLine().CPoint( -1 );
|
||||
m_direction = DIRECTION_45( new_head.GetCLine().CSegment( -1 ) );
|
||||
m_p_start = new_head.CLine().CPoint( -1 );
|
||||
m_direction = DIRECTION_45( new_head.CSegment( -1 ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -576,26 +649,24 @@ void PNS_LINE_PLACER::routeStep( const VECTOR2I& aP )
|
|||
|
||||
PNS_LINE new_head;
|
||||
|
||||
m_follow_mouse = true;
|
||||
|
||||
TRACE( 2, "INIT-DIR: %s head: %d, tail: %d segs\n",
|
||||
m_initial_direction.Format().c_str() % m_head.GetCLine().SegmentCount() %
|
||||
m_tail.GetCLine().SegmentCount() );
|
||||
m_initial_direction.Format().c_str() % m_head.SegmentCount() %
|
||||
m_tail.SegmentCount() );
|
||||
|
||||
for( i = 0; i < n_iter; i++ )
|
||||
{
|
||||
if( !go_back && m_follow_mouse )
|
||||
if( !go_back && Settings().FollowMouse() )
|
||||
reduceTail( aP );
|
||||
|
||||
go_back = false;
|
||||
|
||||
if( !routeHead( aP, new_head, true ) )
|
||||
if( !routeHead( aP, new_head ) )
|
||||
fail = true;
|
||||
|
||||
if( !new_head.Is45Degree() )
|
||||
fail = true;
|
||||
|
||||
if( !m_follow_mouse )
|
||||
if( !Settings().FollowMouse() )
|
||||
return;
|
||||
|
||||
m_head = new_head;
|
||||
|
@ -623,41 +694,31 @@ void PNS_LINE_PLACER::routeStep( const VECTOR2I& aP )
|
|||
}
|
||||
|
||||
|
||||
bool PNS_LINE_PLACER::Route( const VECTOR2I& aP )
|
||||
bool PNS_LINE_PLACER::route( const VECTOR2I& aP )
|
||||
{
|
||||
if( m_smooth_mouse )
|
||||
{
|
||||
VECTOR2I p_cur = m_p_start;
|
||||
VECTOR2I step = (aP - m_p_start).Resize( m_smoothing_step );
|
||||
|
||||
do
|
||||
{
|
||||
if( (p_cur - aP).EuclideanNorm() <= m_smoothing_step )
|
||||
p_cur = aP;
|
||||
else
|
||||
p_cur += step;
|
||||
|
||||
routeStep( p_cur );
|
||||
} while( p_cur != aP );
|
||||
}
|
||||
else
|
||||
routeStep( aP );
|
||||
|
||||
return CurrentEnd() == aP;
|
||||
}
|
||||
|
||||
|
||||
const PNS_LINE PNS_LINE_PLACER::GetTrace() const
|
||||
const PNS_LINE PNS_LINE_PLACER::Trace() const
|
||||
{
|
||||
PNS_LINE tmp( m_head );
|
||||
|
||||
tmp.SetShape( m_tail.GetCLine() );
|
||||
tmp.GetLine().Append( m_head.GetCLine() );
|
||||
tmp.GetLine().Simplify();
|
||||
tmp.SetShape( m_tail.CLine() );
|
||||
tmp.Line().Append( m_head.CLine() );
|
||||
tmp.Line().Simplify();
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
const PNS_ITEMSET PNS_LINE_PLACER::Traces()
|
||||
{
|
||||
m_currentTrace = Trace();
|
||||
return PNS_ITEMSET( &m_currentTrace );
|
||||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::FlipPosture()
|
||||
{
|
||||
m_initial_direction = m_initial_direction.Right();
|
||||
|
@ -665,14 +726,307 @@ void PNS_LINE_PLACER::FlipPosture()
|
|||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::GetUpdatedItems( PNS_NODE::ItemVector& aRemoved,
|
||||
PNS_NODE::ItemVector& aAdded )
|
||||
PNS_NODE* PNS_LINE_PLACER::CurrentNode( bool aLoopsRemoved ) const
|
||||
{
|
||||
return m_shove->GetCurrentNode()->GetUpdatedItems( aRemoved, aAdded );
|
||||
if( aLoopsRemoved && m_lastNode )
|
||||
return m_lastNode;
|
||||
|
||||
return m_currentNode;
|
||||
}
|
||||
|
||||
|
||||
PNS_NODE* PNS_LINE_PLACER::GetCurrentNode() const
|
||||
void PNS_LINE_PLACER::splitAdjacentSegments( PNS_NODE* aNode, PNS_ITEM* aSeg, const VECTOR2I& aP )
|
||||
{
|
||||
return m_shove->GetCurrentNode();
|
||||
if( aSeg && aSeg->OfKind( PNS_ITEM::SEGMENT ) )
|
||||
{
|
||||
PNS_JOINT *jt = aNode->FindJoint( aP, aSeg );
|
||||
|
||||
if( jt && jt->LinkCount() >= 1 )
|
||||
return;
|
||||
|
||||
PNS_SEGMENT* s_old = static_cast<PNS_SEGMENT*>( aSeg );
|
||||
|
||||
PNS_SEGMENT* s_new[2];
|
||||
|
||||
s_new[0] = s_old->Clone();
|
||||
s_new[1] = s_old->Clone();
|
||||
|
||||
s_new[0]->SetEnds( s_old->Seg().A, aP );
|
||||
s_new[1]->SetEnds( aP, s_old->Seg().B );
|
||||
|
||||
aNode->Remove( s_old );
|
||||
aNode->Add( s_new[0], true );
|
||||
aNode->Add( s_new[1], true );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::SetLayer(int aLayer)
|
||||
{
|
||||
m_currentLayer = aLayer;
|
||||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::SetWidth(int aWidth)
|
||||
{
|
||||
m_currentWidth = aWidth;
|
||||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::Start( const VECTOR2I& aP, PNS_ITEM* aStartItem )
|
||||
{
|
||||
VECTOR2I p( aP );
|
||||
|
||||
static int unknowNetIdx = 0; // -10000;
|
||||
int net = -1;
|
||||
|
||||
m_lastNode = NULL;
|
||||
m_placingVia = false;
|
||||
m_startsOnVia = false;
|
||||
|
||||
bool splitSeg = false;
|
||||
|
||||
if( Router()->SnappingEnabled() )
|
||||
p = Router()->SnapToItem( aStartItem, aP, splitSeg );
|
||||
|
||||
if( !aStartItem || aStartItem->Net() < 0 )
|
||||
net = unknowNetIdx--;
|
||||
else
|
||||
net = aStartItem->Net();
|
||||
|
||||
m_currentStart = p;
|
||||
m_originalStart = p;
|
||||
m_currentEnd = p;
|
||||
m_currentNet = net;
|
||||
|
||||
PNS_NODE *rootNode = Router()->GetWorld()->Branch();
|
||||
|
||||
if( splitSeg )
|
||||
splitAdjacentSegments( rootNode, aStartItem, p );
|
||||
|
||||
setWorld ( rootNode );
|
||||
setInitialDirection( Settings().InitialDirection() );
|
||||
startPlacement( p, m_currentNet, m_currentWidth, m_currentLayer );
|
||||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::Move( const VECTOR2I& aP, PNS_ITEM* aEndItem )
|
||||
{
|
||||
PNS_LINE current;
|
||||
VECTOR2I p = aP;
|
||||
int eiDepth = -1;
|
||||
|
||||
if( aEndItem && aEndItem->Owner() )
|
||||
eiDepth = aEndItem->Owner()->Depth();
|
||||
|
||||
if( m_lastNode )
|
||||
{
|
||||
delete m_lastNode;
|
||||
m_lastNode = NULL;
|
||||
}
|
||||
|
||||
route( p );
|
||||
|
||||
current = Trace();
|
||||
|
||||
if( !current.PointCount() )
|
||||
m_currentEnd = m_p_start;
|
||||
else
|
||||
m_currentEnd = current.CLine().CPoint(-1);
|
||||
|
||||
PNS_NODE *latestNode = m_currentNode;
|
||||
m_lastNode = latestNode->Branch();
|
||||
|
||||
if( eiDepth >= 0 && aEndItem && latestNode->Depth() > eiDepth &&
|
||||
current.SegmentCount() && current.CPoint( -1 ) == aP )
|
||||
{
|
||||
splitAdjacentSegments( m_lastNode, aEndItem, current.CPoint( -1 ) );
|
||||
|
||||
if( Settings().RemoveLoops() )
|
||||
removeLoops( m_lastNode, ¤t );
|
||||
}
|
||||
|
||||
updateLeadingRatLine();
|
||||
}
|
||||
|
||||
|
||||
bool PNS_LINE_PLACER::FixRoute( const VECTOR2I& aP, PNS_ITEM* aEndItem )
|
||||
{
|
||||
bool realEnd = false;
|
||||
int lastV;
|
||||
|
||||
PNS_LINE pl = Trace();
|
||||
|
||||
if (m_currentMode == RM_MarkObstacles &&
|
||||
!Settings().CanViolateDRC() &&
|
||||
m_world->CheckColliding( &pl ) )
|
||||
return false;
|
||||
|
||||
const SHAPE_LINE_CHAIN& l = pl.CLine();
|
||||
|
||||
if( !l.SegmentCount() )
|
||||
return true;
|
||||
|
||||
VECTOR2I p_pre_last = l.CPoint( -1 );
|
||||
const VECTOR2I p_last = l.CPoint( -1 );
|
||||
DIRECTION_45 d_last( l.CSegment( -1 ) );
|
||||
|
||||
if( l.PointCount() > 2 )
|
||||
p_pre_last = l.CPoint( -2 );
|
||||
|
||||
if( aEndItem && m_currentNet >= 0 && m_currentNet == aEndItem->Net() )
|
||||
realEnd = true;
|
||||
|
||||
if( realEnd || m_placingVia )
|
||||
lastV = l.SegmentCount();
|
||||
else
|
||||
lastV = std::max( 1, l.SegmentCount() - 1 );
|
||||
|
||||
PNS_SEGMENT* lastSeg = NULL;
|
||||
|
||||
for( int i = 0; i < lastV; i++ )
|
||||
{
|
||||
const SEG& s = pl.CSegment( i );
|
||||
PNS_SEGMENT* seg = new PNS_SEGMENT( s, m_currentNet );
|
||||
seg->SetWidth( pl.Width() );
|
||||
seg->SetLayer( m_currentLayer );
|
||||
m_lastNode->Add( seg );
|
||||
lastSeg = seg;
|
||||
}
|
||||
|
||||
if( pl.EndsWithVia() )
|
||||
m_lastNode->Add( pl.Via().Clone() );
|
||||
|
||||
if( realEnd )
|
||||
simplifyNewLine ( m_lastNode, lastSeg );
|
||||
|
||||
Router()->CommitRouting ( m_lastNode );
|
||||
|
||||
m_lastNode = NULL;
|
||||
|
||||
if( !realEnd )
|
||||
{
|
||||
setInitialDirection( d_last );
|
||||
VECTOR2I p_start = m_placingVia ? p_last : p_pre_last;
|
||||
|
||||
if( m_placingVia )
|
||||
m_currentLayer = Router()->NextCopperLayer( true );
|
||||
|
||||
setWorld ( Router()->GetWorld()->Branch() );
|
||||
startPlacement( p_start, m_head.Net(), m_head.Width(), m_currentLayer );
|
||||
|
||||
m_startsOnVia = m_placingVia;
|
||||
m_placingVia = false;
|
||||
}
|
||||
|
||||
return realEnd;
|
||||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::removeLoops( PNS_NODE* aNode, PNS_LINE* aLatest )
|
||||
{
|
||||
if( !aLatest->SegmentCount() )
|
||||
return;
|
||||
|
||||
aNode->Add( aLatest, true );
|
||||
|
||||
for( int s = 0; s < aLatest->SegmentCount(); s++ )
|
||||
{
|
||||
PNS_SEGMENT *seg = ( *aLatest->LinkedSegments() )[s];
|
||||
PNS_LINE* ourLine = aNode->AssembleLine( seg );
|
||||
PNS_JOINT a, b;
|
||||
std::vector<PNS_LINE*> lines;
|
||||
|
||||
aNode->FindLineEnds( ourLine, a, b );
|
||||
|
||||
if( a == b )
|
||||
{
|
||||
aNode->FindLineEnds( aLatest, a, b);
|
||||
}
|
||||
|
||||
aNode->FindLinesBetweenJoints( a, b, lines );
|
||||
|
||||
int removedCount = 0;
|
||||
int total = 0;
|
||||
|
||||
BOOST_FOREACH( PNS_LINE* line, lines )
|
||||
{
|
||||
total++;
|
||||
|
||||
if( !( line->ContainsSegment( seg ) ) && line->SegmentCount() )
|
||||
{
|
||||
Router()->DisplayDebugLine ( line->CLine(), -1, 10000 );
|
||||
|
||||
for( int i = 0; i < line->PointCount(); i++ )
|
||||
Router()->DisplayDebugPoint( line->CPoint( i ), -1 );
|
||||
|
||||
aNode->Remove( line );
|
||||
removedCount ++;
|
||||
}
|
||||
}
|
||||
|
||||
TRACE( 0, "total segs removed: %d/%d\n", removedCount % total );
|
||||
|
||||
delete ourLine;
|
||||
}
|
||||
|
||||
aNode->Remove( aLatest );
|
||||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::simplifyNewLine( PNS_NODE* aNode, PNS_SEGMENT* aLatest )
|
||||
{
|
||||
PNS_LINE* l = aNode->AssembleLine( aLatest );
|
||||
SHAPE_LINE_CHAIN simplified ( l->CLine() );
|
||||
|
||||
simplified.Simplify();
|
||||
|
||||
if( simplified.PointCount() != l->PointCount() )
|
||||
{
|
||||
std::auto_ptr<PNS_LINE> lnew ( l->Clone() );
|
||||
aNode -> Remove(l);
|
||||
lnew->SetShape(simplified);
|
||||
aNode -> Add( lnew.get() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::UpdateSizes( const PNS_ROUTING_SETTINGS& aSettings )
|
||||
{
|
||||
int trackWidth = aSettings.GetTrackWidth();
|
||||
|
||||
m_head.SetWidth( trackWidth );
|
||||
m_tail.SetWidth( trackWidth );
|
||||
|
||||
m_viaDiameter = aSettings.GetViaDiameter();
|
||||
m_viaDrill = aSettings.GetViaDrill();
|
||||
}
|
||||
|
||||
|
||||
void PNS_LINE_PLACER::updateLeadingRatLine()
|
||||
{
|
||||
PNS_LINE current = Trace();
|
||||
|
||||
if( !current.PointCount() )
|
||||
return;
|
||||
|
||||
std::auto_ptr<PNS_NODE> tmpNode ( m_lastNode->Branch() );
|
||||
tmpNode->Add( ¤t );
|
||||
|
||||
PNS_JOINT *jt = tmpNode->FindJoint( current.CPoint( -1 ),
|
||||
current.Layers().Start(), current.Net() );
|
||||
|
||||
if( !jt )
|
||||
return;
|
||||
|
||||
int anchor;
|
||||
PNS_ITEM *it = tmpNode->NearestUnconnectedItem( jt, &anchor );
|
||||
|
||||
if( it )
|
||||
{
|
||||
SHAPE_LINE_CHAIN lc;
|
||||
lc.Append ( current.CPoint( -1 ) );
|
||||
lc.Append ( it->Anchor( anchor ) );
|
||||
Router()->DisplayDebugLine( lc, 5, 10000 );
|
||||
}
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue