specctra_export: add support for dsn outline

This commit is contained in:
dickelbeck 2008-02-22 17:34:11 +00:00
parent 923ece9c9c
commit 7559e1347c
5 changed files with 134 additions and 37 deletions

View File

@ -5,18 +5,26 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Feb-22 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew
specctra_export.cpp: added DSN 'outline' support from EDGE_MODULEs.
lines and circles, not arcs.
factored out EDGE_MODULE::ShowShape() from EDGE_MODULE::Show().
2008-Feb-21 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema
added : full text conversion between text, label, global label and hierarchical label
some problems fixed:
- annotation incorrectly cleared.
- reference not copied in component copy.
- incorrect redo when changing the chip name in component edition
bugs not fixed:
- incorrect annotation in complex hierarchy with multi parts per package (duplicates created).
added : full text conversion between text, label, global label and hierarchical label
some problems fixed:
- annotation incorrectly cleared.
- reference not copied in component copy.
- incorrect redo when changing the chip name in component edition
bugs not fixed:
- incorrect annotation in complex hierarchy with multi parts per package (duplicates created).
2008-Feb-20 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
@ -24,8 +32,8 @@ email address.
+eeschema
Fixed bug in getpart.cpp:
eeschema crashed when aborting a new component place command
Global Symbols now have their shapes
Bad global label shape fixed when reading a schematic file
Global Symbols now have their shapes
Bad global label shape fixed when reading a schematic file
2008-Feb-20 UPDATE Dick Hollenbeck <dick@softplc.com>

View File

@ -540,18 +540,13 @@ bool EDGE_MODULE::HitTest( const wxPoint& ref_pos )
#if defined(DEBUG)
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void EDGE_MODULE::Show( int nestLevel, std::ostream& os )
const char* EDGE_MODULE::ShowShape( int aShape )
{
const char* cp;
switch( m_Shape )
switch( aShape )
{
case S_SEGMENT: cp = "line"; break;
case S_RECT: cp = "rect"; break;
@ -565,6 +560,21 @@ void EDGE_MODULE::Show( int nestLevel, std::ostream& os )
default: cp = "??EDGE??"; break;
}
return cp;
}
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
void EDGE_MODULE::Show( int nestLevel, std::ostream& os )
{
const char* cp = ShowShape( m_Shape );
// for now, make it look like XML:
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() <<
" type=\"" << cp << "\">";

View File

@ -13,13 +13,13 @@ public:
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
int m_Shape; // voir "enum Track_Shapes"
wxPoint m_Start0; // coord relatives a l'ancre du point de depart(Orient 0)
wxPoint m_End0; // coord relatives a l'ancre du point de fin (Orient 0)
int m_Angle; // pour les arcs de cercle: longueur de l'arc en 0,1 degres
int m_PolyCount; // For polygons: number of points (> 2)
int* m_PolyList; // For polygons: coord list (1 point = 2 coord)
// Coord are relative to Origin, orient 0
@ -29,7 +29,7 @@ public:
EDGE_MODULE( EDGE_MODULE* edge );
~EDGE_MODULE();
/**
* Function GetPosition
* returns the position of this object.
@ -39,8 +39,8 @@ public:
{
return m_Start;
}
/* supprime du chainage la structure Struct */
void UnLink();
@ -51,9 +51,9 @@ public:
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
*/
bool Save( FILE* aFile ) const;
int ReadDescr( char* Line, FILE* File, int* LineNum = NULL );
// Mise a jour des coordon<6F>s pour l'affichage
@ -71,10 +71,10 @@ public:
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_DrawFrame in which to print status information.
*/
*/
void Display_Infos( WinEDA_DrawFrame* frame );
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
@ -82,7 +82,7 @@ public:
* @return bool - true if a hit, else false
*/
bool HitTest( const wxPoint& refPos );
/**
* Function GetClass
* returns the class name.
@ -98,10 +98,18 @@ public:
/**
* Function Show
* is used to output the object tree, currently for debugging only.
* @param nestLevel An aid to prettier tree indenting, and is the level
* @param nestLevel An aid to prettier tree indenting, and is the level
* of nesting of this object within the overall tree.
* @param os The ostream& to output to.
*/
virtual void Show( int nestLevel, std::ostream& os );
/**
* Function ShowShape
* converts the enum Track_Shapes integer value to a C string.
*/
static const char* ShowShape( int aShape );
#endif
};

View File

@ -693,6 +693,11 @@ public:
layer_id = aLayerId;
}
void SetAperture( double aWidth )
{
aperture_width = aWidth;
}
void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IOError )
{
const char* newline = nestLevel ? "\n" : "";
@ -1883,6 +1888,11 @@ class SHAPE : public WINDOW
WINDOWS windows;
public:
/**
* Constructor SHAPE
* alternatively takes a DSN_T aType of T_outline
*/
SHAPE( ELEM* aParent, DSN_T aType = T_shape ) :
WINDOW( aParent, aType )
{

View File

@ -545,21 +545,21 @@ typedef std::map<wxString, int, wxString_less_than> PINMAP;
IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
{
PINMAP pinmap;
TYPE_COLLECTOR pads;
TYPE_COLLECTOR moduleItems;
wxString padName;
// get all the MODULE's pads.
pads.Collect( aModule, scanPADs );
moduleItems.Collect( aModule, scanPADs );
IMAGE* image = new IMAGE(0);
image->image_id = CONV_TO_UTF8( aModule->m_LibRef );
// from the pads, and make an IMAGE using collated padstacks.
for( int p=0; p<pads.GetCount(); ++p )
for( int p=0; p<moduleItems.GetCount(); ++p )
{
D_PAD* pad = (D_PAD*) pads[p];
D_PAD* pad = (D_PAD*) moduleItems[p];
// see if this pad is a through hole with no copper on its perimeter
if( isKeepout( pad ) )
@ -636,6 +636,67 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
}
}
static const KICAD_T scanEDGEs[] = { TYPEEDGEMODULE, EOT };
// get all the MODULE's EDGE_MODULEs and convert those to DSN outlines.
moduleItems.Collect( aModule, scanEDGEs );
for( int i=0; i<moduleItems.GetCount(); ++i )
{
EDGE_MODULE* graphic = (EDGE_MODULE*) moduleItems[i];
SHAPE* outline;
PATH* path;
switch( graphic->m_Shape )
{
case S_SEGMENT:
outline = new SHAPE( image, T_outline );
image->Append( outline );
path = new PATH( outline );
outline->SetShape( path );
path->SetAperture( scale( graphic->m_Width ) );
path->SetLayerId( "signal" );
path->AppendPoint( mapPt( graphic->m_Start0 ) );
path->AppendPoint( mapPt( graphic->m_End0 ) );
break;
case S_CIRCLE:
{
// this is best done by 4 QARC's but freerouter does not yet support QARCs.
// for now, support by using line segments.
outline = new SHAPE( image, T_outline );
image->Append( outline );
path = new PATH( outline );
outline->SetShape( path );
path->SetAperture( scale( graphic->m_Width ) );
path->SetLayerId( "signal" );
double radius = hypot( scale( graphic->m_Start.x - graphic->m_End.x ),
scale( graphic->m_Start.y - graphic->m_End.y ) );
POINT offset = mapPt( graphic->m_Start0 );
// better if evenly divisible into 360
const int DEGREE_INTERVAL = 18; // 18 means 20 line segments
for( double radians = 0.0; radians < 2*M_PI; radians += DEGREE_INTERVAL * M_PI / 180.0 )
{
POINT point( radius*cos( radians ), radius*sin( radians ) );
point += offset;
path->AppendPoint( point );
}
}
break;
case S_RECT:
case S_ARC:
default:
D( printf("makeIMAGE(): unsupported shape %s\n", EDGE_MODULE::ShowShape(graphic->m_Shape) );)
continue;
}
}
return image;
}