Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
6f7209aa
Commit
6f7209aa
authored
Aug 06, 2007
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start of new search stuff, beautification
parent
abd187e3
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
836 additions
and
452 deletions
+836
-452
change_log.txt
change_log.txt
+6
-0
base_struct.cpp
common/base_struct.cpp
+37
-1
base_struct.h
include/base_struct.h
+101
-0
pcbstruct.h
include/pcbstruct.h
+10
-0
class_board.cpp
pcbnew/class_board.cpp
+58
-0
class_edge_mod.cpp
pcbnew/class_edge_mod.cpp
+381
-338
class_edge_mod.h
pcbnew/class_edge_mod.h
+48
-36
class_module.cpp
pcbnew/class_module.cpp
+65
-11
class_module.h
pcbnew/class_module.h
+18
-0
class_pad.h
pcbnew/class_pad.h
+75
-64
class_text_mod.cpp
pcbnew/class_text_mod.cpp
+20
-0
class_text_mod.h
pcbnew/class_text_mod.h
+12
-0
locate.cpp
pcbnew/locate.cpp
+5
-2
No files found.
change_log.txt
View file @
6f7209aa
...
@@ -5,6 +5,12 @@ Please add newer entries at the top, list the date and your name with
...
@@ -5,6 +5,12 @@ Please add newer entries at the top, list the date and your name with
email address.
email address.
2007-Aug-06 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew & common
Started sketching out a new search architecture. To learn more:
look for "INSPECTOR" text in base_struct.h.
2007-Aug-05 UPDATE Dick Hollenbeck <dick@softplc.com>
2007-Aug-05 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
================================================================================
...
...
common/base_struct.cpp
View file @
6f7209aa
...
@@ -224,10 +224,46 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
...
@@ -224,10 +224,46 @@ void EDA_BaseStruct::Show( int nestLevel, std::ostream& os )
std
::
ostream
&
EDA_BaseStruct
::
NestedSpace
(
int
nestLevel
,
std
::
ostream
&
os
)
std
::
ostream
&
EDA_BaseStruct
::
NestedSpace
(
int
nestLevel
,
std
::
ostream
&
os
)
{
{
for
(
int
i
=
0
;
i
<
nestLevel
;
++
i
)
for
(
int
i
=
0
;
i
<
nestLevel
;
++
i
)
os
<<
' '
;
// number of spaces here controls indent per nest level
os
<<
" "
;
// number of spaces here controls indent per nest level
return
os
;
return
os
;
}
}
// see base_struct.h
SEARCH_RESULT
EDA_BaseStruct
::
IterateForward
(
EDA_BaseStruct
*
listStart
,
INSPECTOR
*
inspector
,
void
*
testData
,
const
KICAD_T
scanTypes
[]
)
{
EDA_BaseStruct
*
p
=
listStart
;
for
(
;
p
;
p
=
p
->
Pnext
)
{
if
(
SEARCH_QUIT
==
p
->
Traverse
(
inspector
,
testData
,
scanTypes
)
)
return
SEARCH_QUIT
;
}
return
SEARCH_CONTINUE
;
}
// see base_struct.h
SEARCH_RESULT
EDA_BaseStruct
::
Traverse
(
INSPECTOR
*
inspector
,
void
*
testData
,
const
KICAD_T
scanTypes
[]
)
{
KICAD_T
stype
;
for
(
const
KICAD_T
*
p
=
scanTypes
;
(
stype
=*
p
)
!=
EOT
;
++
p
)
{
// If caller wants to inspect my type
if
(
stype
==
m_StructType
)
{
if
(
SEARCH_QUIT
==
inspector
->
Inspect
(
this
,
testData
)
)
return
SEARCH_QUIT
;
break
;
}
}
return
SEARCH_CONTINUE
;
}
#endif
#endif
...
...
include/base_struct.h
View file @
6f7209aa
...
@@ -13,6 +13,9 @@
...
@@ -13,6 +13,9 @@
/* Id for class identification, at run time */
/* Id for class identification, at run time */
enum
DrawStructureType
{
enum
DrawStructureType
{
EOT
=
0
,
// search types array terminator (End Of Types)
TYPE_NOT_INIT
=
0
,
TYPE_NOT_INIT
=
0
,
TYPEPCB
,
TYPEPCB
,
...
@@ -70,6 +73,49 @@ enum DrawStructureType {
...
@@ -70,6 +73,49 @@ enum DrawStructureType {
};
};
#if defined(DEBUG) // new searching technique incubator
enum
SEARCH_RESULT
{
SEARCH_QUIT
,
SEARCH_CONTINUE
};
typedef
DrawStructureType
KICAD_T
;
// shorter name
class
EDA_BaseStruct
;
/**
* Class INSPECTOR
* is an abstract class that is used to inspect and possibly collect the
* (search) results of Iterating over a list or tree of KICAD_T objects.
* Extend from this class and implment the Inspect function and provide for
* a way for the extension to collect the results of the search/scan data and
* provide them to the caller.
*/
class
INSPECTOR
{
public
:
virtual
~
INSPECTOR
()
{}
/**
* Function Inspect
* is the function type that can be passed to the Iterate function,
* used primarily for searching, but not exclusively.
* @param testData is arbitrary data needed by the inspector to determine
* if the EDA_BaseStruct under test meets its match criteria.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
SEARCH_RESULT
virtual
Inspect
(
EDA_BaseStruct
*
testItem
,
void
*
testData
)
=
0
;
// derived classes add more functions for collecting and subsequent
// retrieval here.
};
#endif
/********************************************************************/
/********************************************************************/
/* Classes de base: servent a deriver les classes reellement utiles */
/* Classes de base: servent a deriver les classes reellement utiles */
/********************************************************************/
/********************************************************************/
...
@@ -138,6 +184,7 @@ public:
...
@@ -138,6 +184,7 @@ public:
* @param os The ostream& to output to.
* @param os The ostream& to output to.
*/
*/
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
/**
/**
* Function NestedSpace
* Function NestedSpace
...
@@ -147,6 +194,60 @@ public:
...
@@ -147,6 +194,60 @@ public:
* @return std::ostream& - for continuation.
* @return std::ostream& - for continuation.
**/
**/
static
std
::
ostream
&
NestedSpace
(
int
nestLevel
,
std
::
ostream
&
os
);
static
std
::
ostream
&
NestedSpace
(
int
nestLevel
,
std
::
ostream
&
os
);
/**
* Function IterateForward
* walks through the object tree calling the testFunc on each object
* type requested in structTypes.
*
* @param listStart The first in a list of EDA_BaseStructs to iterate over.
* @param inspector Is an INSPECTOR to call on each object that is of one of
* the requested itemTypes.
* @param testData Is an aid to testFunc, and should be sufficient to
* allow it to fully determine if an item meets the match criteria, but it
* may also be used to collect output.
* @param scanTypes Is a char array of KICAD_T that is EOT
* terminated, and provides both the order and interest level of of
* the types of objects to be iterated over.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
static
SEARCH_RESULT
IterateForward
(
EDA_BaseStruct
*
listStart
,
INSPECTOR
*
inspector
,
void
*
testData
,
const
KICAD_T
scanTypes
[]
);
/**
* Function Traverse
* should be re-implemented for each derrived class in order to handle
* all the types given by its member data. Implementations should call
* inspector->Inspect() on types in scanTypes[], and may use IterateForward()
* to do so on lists of such data.
* @param inspector An INSPECTOR instance to use in the inspection.
* @param testData Arbitrary data used by the inspector.
* @param scanTypes Which KICAD_T types are of interest and the order
* is significant too, terminated by EOT.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
virtual
SEARCH_RESULT
Traverse
(
INSPECTOR
*
inspector
,
void
*
testData
,
const
KICAD_T
scanTypes
[]
);
/**
* Function ListHas
* scans the given array and detects if the given type t is present.
* @param list An array of KICAD_T, terminated with EOT.
* @param t A KICAD_T to check for.
* @return bool - true if present, else false.
*/
static
bool
ListHas
(
const
KICAD_T
list
[],
KICAD_T
t
)
{
for
(
const
KICAD_T
*
p
=
list
;
*
p
!=
EOT
;
++
p
)
if
(
*
p
==
t
)
return
true
;
return
false
;
}
#endif
#endif
};
};
...
...
include/pcbstruct.h
View file @
6f7209aa
...
@@ -242,6 +242,16 @@ public:
...
@@ -242,6 +242,16 @@ public:
* @param os The ostream& to output to.
* @param os The ostream& to output to.
*/
*/
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
/**
* Function FindModuleOrPad
* searches for either a module or a pad, giving precedence to pads.
* @param refPos The wxPoint to hit-test.
* @return EDA_BaseStruct* - if a direct hit, else NULL.
*/
EDA_BaseStruct
*
FindModuleOrPad
(
const
wxPoint
&
refPos
);
#endif
#endif
};
};
...
...
pcbnew/class_board.cpp
View file @
6f7209aa
...
@@ -286,4 +286,62 @@ void BOARD::Show( int nestLevel, std::ostream& os )
...
@@ -286,4 +286,62 @@ void BOARD::Show( int nestLevel, std::ostream& os )
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
ReturnClassName
().
mb_str
()
<<
">
\n
"
;
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
ReturnClassName
().
mb_str
()
<<
">
\n
"
;
}
}
class
ModuleOrPad
:
public
INSPECTOR
{
public
:
EDA_BaseStruct
*
found
;
ModuleOrPad
()
:
found
(
0
)
{
}
SEARCH_RESULT
Inspect
(
EDA_BaseStruct
*
testItem
,
void
*
testData
)
{
const
wxPoint
*
refPos
=
(
const
wxPoint
*
)
testData
;
if
(
testItem
->
m_StructType
==
TYPEMODULE
)
{
/* not finished
if( testItem->HitTest( &refPos ) )
{
found = testItem;
return SEARCH_QUIT;
}
*/
}
else
if
(
testItem
->
m_StructType
==
TYPEPAD
)
{
/* not finished
if( testItem->HitTest( &refPos ) )
{
found = testItem;
return SEARCH_QUIT;
}
*/
}
return
SEARCH_CONTINUE
;
}
};
// see pcbstruct.h
EDA_BaseStruct
*
BOARD
::
FindModuleOrPad
(
const
wxPoint
&
refPos
)
{
ModuleOrPad
inspector
;
static
const
KICAD_T
scanTypes
[]
=
{
TYPEMODULE
,
TYPEPAD
,
EOT
};
if
(
SEARCH_QUIT
==
IterateForward
(
m_Modules
,
&
inspector
,
(
void
*
)
&
refPos
,
scanTypes
)
)
return
inspector
.
found
;
return
NULL
;
}
#endif
#endif
pcbnew/class_edge_mod.cpp
View file @
6f7209aa
/****************************************************/
/****************************************************/
/* class_module.cpp : fonctions de la classe MODULE */
/* class_module.cpp : fonctions de la classe MODULE */
/****************************************************/
/****************************************************/
#include "fctsys.h"
#include "fctsys.h"
#include "gr_basic.h"
#include "gr_basic.h"
...
@@ -22,54 +22,59 @@
...
@@ -22,54 +22,59 @@
#include "protos.h"
#include "protos.h"
#define MAX_WIDTH 10000
// Epaisseur (en 1/10000 ") max raisonnable des traits, textes...
#define MAX_WIDTH 10000
// Epaisseur (en 1/10000 ") max raisonnable des traits, textes...
/******************************************/
/******************************************/
/* class EDGE_MODULE ( contour de module ) */
/* class EDGE_MODULE ( contour de module ) */
/******************************************/
/******************************************/
EDGE_MODULE
::
EDGE_MODULE
(
MODULE
*
parent
)
:
EDA_BaseLineStruct
(
parent
,
TYPEEDGEMODULE
)
EDGE_MODULE
::
EDGE_MODULE
(
MODULE
*
parent
)
:
EDA_BaseLineStruct
(
parent
,
TYPEEDGEMODULE
)
{
{
m_Shape
=
S_SEGMENT
;
m_Shape
=
S_SEGMENT
;
m_Angle
=
0
;
m_Angle
=
0
;
m_Width
=
120
;
m_Width
=
120
;
m_PolyCount
=
0
;
// For polygons : number of points (> 2)
m_PolyCount
=
0
;
// For polygons : number of points (> 2)
m_PolyList
=
NULL
;
// For polygons: coord list (1 point = 2 coord)
m_PolyList
=
NULL
;
// For polygons: coord list (1 point = 2 coord)
}
}
EDGE_MODULE
::~
EDGE_MODULE
()
EDGE_MODULE
::~
EDGE_MODULE
()
{
{
if
(
m_PolyList
)
free
(
m_PolyList
);
if
(
m_PolyList
)
m_PolyList
=
NULL
;
free
(
m_PolyList
);
m_PolyCount
=
0
;
m_PolyList
=
NULL
;
m_PolyCount
=
0
;
}
}
/********************************************/
/********************************************/
void
EDGE_MODULE
::
Copy
(
EDGE_MODULE
*
source
)
// copy structure
void
EDGE_MODULE
::
Copy
(
EDGE_MODULE
*
source
)
// copy structure
/********************************************/
/********************************************/
{
{
if
(
source
==
NULL
)
return
;
if
(
source
==
NULL
)
return
;
m_Start
=
source
->
m_Start
;
m_End
=
source
->
m_End
;
m_Start
=
source
->
m_Start
;
m_Shape
=
source
->
m_Shape
;
m_End
=
source
->
m_End
;
m_Start0
=
source
->
m_Start0
;
// coord relatives a l'ancre du point de depart(Orient 0)
m_Shape
=
source
->
m_Shape
;
m_End0
=
source
->
m_End0
;
// coord relatives a l'ancre du point de fin (Orient 0)
m_Start0
=
source
->
m_Start0
;
// coord relatives a l'ancre du point de depart(Orient 0)
m_Angle
=
source
->
m_Angle
;
// pour les arcs de cercle: longueur de l'arc en 0,1 degres
m_End0
=
source
->
m_End0
;
// coord relatives a l'ancre du point de fin (Orient 0)
m_Layer
=
source
->
m_Layer
;
m_Angle
=
source
->
m_Angle
;
// pour les arcs de cercle: longueur de l'arc en 0,1 degres
m_Width
=
source
->
m_Width
;
m_Layer
=
source
->
m_Layer
;
if
(
m_PolyList
)
free
(
m_PolyList
);
m_Width
=
source
->
m_Width
;
m_PolyCount
=
0
;
if
(
m_PolyList
)
m_PolyList
=
NULL
;
free
(
m_PolyList
);
if
(
source
->
m_PolyCount
&&
source
->
m_PolyList
)
m_PolyCount
=
0
;
{
m_PolyList
=
NULL
;
int
size
;
if
(
source
->
m_PolyCount
&&
source
->
m_PolyList
)
m_PolyCount
=
source
->
m_PolyCount
;
// For polygons : number of points
{
size
=
m_PolyCount
*
2
*
sizeof
(
int
);
// For polygons: 1 point = 2 coord
int
size
;
m_PolyList
=
(
int
*
)
MyMalloc
(
size
);
m_PolyCount
=
source
->
m_PolyCount
;
// For polygons : number of points
memcpy
(
m_PolyList
,
source
->
m_PolyList
,
size
);
size
=
m_PolyCount
*
2
*
sizeof
(
int
);
// For polygons: 1 point = 2 coord
}
m_PolyList
=
(
int
*
)
MyMalloc
(
size
);
memcpy
(
m_PolyList
,
source
->
m_PolyList
,
size
);
}
}
}
...
@@ -77,333 +82,371 @@ void EDGE_MODULE:: Copy(EDGE_MODULE * source) // copy structure
...
@@ -77,333 +82,371 @@ void EDGE_MODULE:: Copy(EDGE_MODULE * source) // copy structure
void
EDGE_MODULE
::
UnLink
(
void
)
void
EDGE_MODULE
::
UnLink
(
void
)
/********************************/
/********************************/
{
{
/* Modification du chainage arriere */
/* Modification du chainage arriere */
if
(
Pback
)
if
(
Pback
)
{
{
if
(
Pback
->
m_StructType
!=
TYPEMODULE
)
if
(
Pback
->
m_StructType
!=
TYPEMODULE
)
{
{
Pback
->
Pnext
=
Pnext
;
Pback
->
Pnext
=
Pnext
;
}
}
else
/* Le chainage arriere pointe sur la structure "Pere" */
else
/* Le chainage arriere pointe sur la structure "Pere" */
{
{
(
(
MODULE
*
)
Pback
)
->
m_Drawings
=
Pnext
;
((
MODULE
*
)
Pback
)
->
m_Drawings
=
Pnext
;
}
}
}
}
/* Modification du chainage avant */
/* Modification du chainage avant */
if
(
Pnext
)
if
(
Pnext
)
Pnext
->
Pback
=
Pback
;
Pnext
->
Pback
=
Pback
;
Pnext
=
Pback
=
NULL
;
Pnext
=
Pback
=
NULL
;
}
}
/***********************************/
/***********************************/
void
EDGE_MODULE
::
SetDrawCoord
(
void
)
void
EDGE_MODULE
::
SetDrawCoord
(
void
)
/***********************************/
/***********************************/
{
{
MODULE
*
Module
=
(
MODULE
*
)
m_Parent
;
MODULE
*
Module
=
(
MODULE
*
)
m_Parent
;
m_Start
=
m_Start0
;
m_End
=
m_End0
;
m_Start
=
m_Start0
;
m_End
=
m_End0
;
if
(
Module
)
{
if
(
Module
)
RotatePoint
(
&
m_Start
.
x
,
&
m_Start
.
y
,
Module
->
m_Orient
);
{
RotatePoint
(
&
m_End
.
x
,
&
m_End
.
y
,
Module
->
m_Orient
);
RotatePoint
(
&
m_Start
.
x
,
&
m_Start
.
y
,
Module
->
m_Orient
);
m_Start
.
x
+=
Module
->
m_Pos
.
x
;
RotatePoint
(
&
m_End
.
x
,
&
m_End
.
y
,
Module
->
m_Orient
);
m_Start
.
y
+=
Module
->
m_Pos
.
y
;
m_Start
.
x
+=
Module
->
m_Pos
.
x
;
m_End
.
x
+=
Module
->
m_Pos
.
x
;
m_Start
.
y
+=
Module
->
m_Pos
.
y
;
m_End
.
y
+=
Module
->
m_Pos
.
y
;
m_End
.
x
+=
Module
->
m_Pos
.
x
;
}
m_End
.
y
+=
Module
->
m_Pos
.
y
;
}
}
}
/********************************************************************************/
/********************************************************************************/
void
EDGE_MODULE
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
void
EDGE_MODULE
::
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
)
const
wxPoint
&
offset
,
int
draw_mode
)
/********************************************************************************/
/********************************************************************************/
/* Affichage d'un segment contour de module :
/* Affichage d'un segment contour de module :
Entree : ox, oy = offset de trace
*
Entree : ox, oy = offset de trace
draw_mode = mode de trace ( GR_OR, GR_XOR, GR_AND)
*
draw_mode = mode de trace ( GR_OR, GR_XOR, GR_AND)
Les contours sont de differents type:
*
Les contours sont de differents type:
- Segment
*
- Segment
- Cercles
*
- Cercles
- Arcs
*
- Arcs
*/
*/
{
{
int
ux0
,
uy0
,
dx
,
dy
,
rayon
,
StAngle
,
EndAngle
;
int
ux0
,
uy0
,
dx
,
dy
,
rayon
,
StAngle
,
EndAngle
;
int
color
,
type_trace
;
int
color
,
type_trace
;
int
zoom
;
int
zoom
;
int
typeaff
;
int
typeaff
;
PCB_SCREEN
*
screen
;
PCB_SCREEN
*
screen
;
WinEDA_BasePcbFrame
*
frame
;
WinEDA_BasePcbFrame
*
frame
;
MODULE
*
Module
=
NULL
;
MODULE
*
Module
=
NULL
;
if
(
m_Parent
&&
(
m_Parent
->
m_StructType
==
TYPEMODULE
)
)
if
(
m_Parent
&&
(
m_Parent
->
m_StructType
==
TYPEMODULE
)
)
Module
=
(
MODULE
*
)
m_Parent
;
Module
=
(
MODULE
*
)
m_Parent
;
color
=
g_DesignSettings
.
m_LayerColor
[
m_Layer
];
color
=
g_DesignSettings
.
m_LayerColor
[
m_Layer
];
if
(
(
color
&
ITEM_NOT_SHOW
)
!=
0
)
return
;
if
(
(
color
&
ITEM_NOT_SHOW
)
!=
0
)
return
;
if
(
panel
)
screen
=
(
PCB_SCREEN
*
)
panel
->
m_Parent
->
m_CurrentScreen
;
else
screen
=
(
PCB_SCREEN
*
)
ActiveScreen
;
if
(
panel
)
screen
=
(
PCB_SCREEN
*
)
panel
->
m_Parent
->
m_CurrentScreen
;
frame
=
(
WinEDA_BasePcbFrame
*
)
panel
->
m_Parent
;
else
screen
=
(
PCB_SCREEN
*
)
ActiveScreen
;
zoom
=
screen
->
GetZoom
();
frame
=
(
WinEDA_BasePcbFrame
*
)
panel
->
m_Parent
;
type_trace
=
m_Shape
;
ux0
=
m_Start
.
x
-
offset
.
x
;
uy0
=
m_Start
.
y
-
offset
.
y
;
zoom
=
screen
->
GetZoom
();
dx
=
m_End
.
x
-
offset
.
x
;
dy
=
m_End
.
y
-
offset
.
y
;
type_trace
=
m_Shape
;
ux0
=
m_Start
.
x
-
offset
.
x
;
uy0
=
m_Start
.
y
-
offset
.
y
;
GRSetDrawMode
(
DC
,
draw_mode
);
dx
=
m_End
.
x
-
offset
.
x
;
typeaff
=
frame
->
m_DisplayModEdge
;
dy
=
m_End
.
y
-
offset
.
y
;
if
(
m_Layer
<=
CMP_N
)
{
GRSetDrawMode
(
DC
,
draw_mode
);
typeaff
=
frame
->
m_DisplayPcbTrackFill
;
typeaff
=
frame
->
m_DisplayModEdge
;
if
(
!
typeaff
)
typeaff
=
SKETCH
;
if
(
m_Layer
<=
CMP_N
)
}
{
if
(
(
m_Width
/
zoom
)
<
L_MIN_DESSIN
)
typeaff
=
FILAIRE
;
typeaff
=
frame
->
m_DisplayPcbTrackFill
;
if
(
!
typeaff
)
switch
(
type_trace
)
typeaff
=
SKETCH
;
{
}
case
S_SEGMENT
:
if
(
(
m_Width
/
zoom
)
<
L_MIN_DESSIN
)
if
(
typeaff
==
FILAIRE
)
typeaff
=
FILAIRE
;
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
dx
,
dy
,
0
,
color
);
else
if
(
typeaff
==
FILLED
)
switch
(
type_trace
)
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
dx
,
dy
,
m_Width
,
color
)
;
{
else
// SKETCH Mode
case
S_SEGMENT
:
GRCSegm
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
dx
,
dy
,
m_Width
,
color
)
;
if
(
typeaff
==
FILAIRE
)
break
;
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
dx
,
dy
,
0
,
color
);
else
if
(
typeaff
==
FILLED
)
case
S_CIRCLE
:
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
dx
,
dy
,
m_Width
,
color
);
rayon
=
(
int
)
hypot
((
double
)(
dx
-
ux0
),(
double
)(
dy
-
uy0
)
);
else
if
(
typeaff
==
FILAIRE
)
// SKETCH Mode
{
GRCSegm
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
dx
,
dy
,
m_Width
,
color
);
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
rayon
,
color
)
;
break
;
}
else
case
S_CIRCLE
:
{
rayon
=
(
int
)
hypot
(
(
double
)
(
dx
-
ux0
),
(
double
)
(
dy
-
uy0
)
);
if
(
typeaff
==
FILLED
)
if
(
typeaff
==
FILAIRE
)
{
{
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
rayon
,
m_Width
,
color
);
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
rayon
,
color
);
}
}
else
// SKETCH Mode
else
{
{
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
rayon
+
(
m_Width
/
2
),
color
)
;
if
(
typeaff
==
FILLED
)
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
rayon
-
(
m_Width
/
2
),
color
)
;
{
}
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
rayon
,
m_Width
,
color
);
}
}
break
;
else
// SKETCH Mode
{
case
S_ARC
:
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
rayon
+
(
m_Width
/
2
),
color
);
rayon
=
(
int
)
hypot
((
double
)(
dx
-
ux0
),(
double
)(
dy
-
uy0
)
);
GRCircle
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
rayon
-
(
m_Width
/
2
),
color
);
StAngle
=
(
int
)
ArcTangente
(
dy
-
uy0
,
dx
-
ux0
);
}
EndAngle
=
StAngle
+
m_Angle
;
}
if
(
StAngle
>
EndAngle
)
EXCHG
(
StAngle
,
EndAngle
);
break
;
if
(
typeaff
==
FILAIRE
)
{
case
S_ARC
:
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
StAngle
,
EndAngle
,
rayon
,
color
)
;
rayon
=
(
int
)
hypot
(
(
double
)
(
dx
-
ux0
),
(
double
)
(
dy
-
uy0
)
);
}
StAngle
=
(
int
)
ArcTangente
(
dy
-
uy0
,
dx
-
ux0
);
else
if
(
typeaff
==
FILLED
)
EndAngle
=
StAngle
+
m_Angle
;
{
if
(
StAngle
>
EndAngle
)
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
StAngle
,
EndAngle
,
rayon
,
EXCHG
(
StAngle
,
EndAngle
);
m_Width
,
color
);
if
(
typeaff
==
FILAIRE
)
}
{
else
// SKETCH Mode
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
StAngle
,
EndAngle
,
rayon
,
color
);
{
}
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
StAngle
,
EndAngle
,
else
if
(
typeaff
==
FILLED
)
rayon
+
(
m_Width
/
2
),
color
)
;
{
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
StAngle
,
EndAngle
,
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
StAngle
,
EndAngle
,
rayon
,
rayon
-
(
m_Width
/
2
),
color
)
;
m_Width
,
color
);
}
}
break
;
else
// SKETCH Mode
{
case
S_POLYGON
:
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
StAngle
,
EndAngle
,
{
rayon
+
(
m_Width
/
2
),
color
);
// We must compute true coordinates from m_PolyList
GRArc
(
&
panel
->
m_ClipBox
,
DC
,
ux0
,
uy0
,
StAngle
,
EndAngle
,
// which are relative to module position, orientation 0
rayon
-
(
m_Width
/
2
),
color
);
int
ii
,
*
source
,
*
ptr
,
*
ptr_base
;
}
ptr
=
ptr_base
=
(
int
*
)
MyMalloc
(
2
*
m_PolyCount
*
sizeof
(
int
)
);
break
;
source
=
m_PolyList
;
for
(
ii
=
0
;
ii
<
m_PolyCount
;
ii
++
)
case
S_POLYGON
:
{
{
int
x
,
y
;
// We must compute true coordinates from m_PolyList
x
=
*
source
;
source
++
;
y
=
*
source
;
source
++
;
// which are relative to module position, orientation 0
if
(
Module
)
int
ii
,
*
source
,
*
ptr
,
*
ptr_base
;
{
ptr
=
ptr_base
=
(
int
*
)
MyMalloc
(
2
*
m_PolyCount
*
sizeof
(
int
)
);
RotatePoint
(
&
x
,
&
y
,
Module
->
m_Orient
);
source
=
m_PolyList
;
x
+=
Module
->
m_Pos
.
x
;
for
(
ii
=
0
;
ii
<
m_PolyCount
;
ii
++
)
y
+=
Module
->
m_Pos
.
y
;
{
}
int
x
,
y
;
x
+=
m_Start0
.
x
-
offset
.
x
;
x
=
*
source
;
source
++
;
y
=
*
source
;
source
++
;
y
+=
m_Start0
.
y
-
offset
.
y
;
if
(
Module
)
*
ptr
=
x
;
ptr
++
;
*
ptr
=
y
;
ptr
++
;
{
}
RotatePoint
(
&
x
,
&
y
,
Module
->
m_Orient
);
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
m_PolyCount
,
ptr_base
,
x
+=
Module
->
m_Pos
.
x
;
TRUE
,
m_Width
,
color
,
color
);
y
+=
Module
->
m_Pos
.
y
;
free
(
ptr_base
);
}
break
;
x
+=
m_Start0
.
x
-
offset
.
x
;
}
y
+=
m_Start0
.
y
-
offset
.
y
;
}
*
ptr
=
x
;
ptr
++
;
*
ptr
=
y
;
ptr
++
;
}
GRPoly
(
&
panel
->
m_ClipBox
,
DC
,
m_PolyCount
,
ptr_base
,
TRUE
,
m_Width
,
color
,
color
);
free
(
ptr_base
);
break
;
}
}
}
}
/*****************************************/
/*****************************************/
int
EDGE_MODULE
::
WriteDescr
(
FILE
*
File
)
int
EDGE_MODULE
::
WriteDescr
(
FILE
*
File
)
/*****************************************/
/*****************************************/
/* Write one EDGE_MODULE description
/* Write one EDGE_MODULE description
File must be opened.
*
File must be opened.
*/
*/
{
{
int
NbLigne
=
0
,
ii
,
*
ptr
;
int
NbLigne
=
0
,
ii
,
*
ptr
;
switch
(
m_Shape
)
switch
(
m_Shape
)
{
{
case
S_SEGMENT
:
case
S_SEGMENT
:
fprintf
(
File
,
"DS %d %d %d %d %d %d
\n
"
,
fprintf
(
File
,
"DS %d %d %d %d %d %d
\n
"
,
m_Start0
.
x
,
m_Start0
.
y
,
m_Start0
.
x
,
m_Start0
.
y
,
m_End0
.
x
,
m_End0
.
y
,
m_End0
.
x
,
m_End0
.
y
,
m_Width
,
m_Layer
);
m_Width
,
m_Layer
);
NbLigne
++
;
NbLigne
++
;
break
;
break
;
case
S_CIRCLE
:
case
S_CIRCLE
:
fprintf
(
File
,
"DC %d %d %d %d %d %d
\n
"
,
fprintf
(
File
,
"DC %d %d %d %d %d %d
\n
"
,
m_Start0
.
x
,
m_Start0
.
y
,
m_Start0
.
x
,
m_Start0
.
y
,
m_End0
.
x
,
m_End0
.
y
,
m_End0
.
x
,
m_End0
.
y
,
m_Width
,
m_Layer
);
m_Width
,
m_Layer
);
NbLigne
++
;
NbLigne
++
;
break
;
break
;
case
S_ARC
:
case
S_ARC
:
fprintf
(
File
,
"DA %d %d %d %d %d %d %d
\n
"
,
fprintf
(
File
,
"DA %d %d %d %d %d %d %d
\n
"
,
m_Start0
.
x
,
m_Start0
.
y
,
m_Start0
.
x
,
m_Start0
.
y
,
m_End0
.
x
,
m_End0
.
y
,
m_End0
.
x
,
m_End0
.
y
,
m_Angle
,
m_Angle
,
m_Width
,
m_Layer
);
m_Width
,
m_Layer
);
NbLigne
++
;
NbLigne
++
;
break
;
break
;
case
S_POLYGON
:
case
S_POLYGON
:
fprintf
(
File
,
"DP %d %d %d %d %d %d %d
\n
"
,
fprintf
(
File
,
"DP %d %d %d %d %d %d %d
\n
"
,
m_Start0
.
x
,
m_Start0
.
y
,
m_Start0
.
x
,
m_Start0
.
y
,
m_End0
.
x
,
m_End0
.
y
,
m_End0
.
x
,
m_End0
.
y
,
m_PolyCount
,
m_PolyCount
,
m_Width
,
m_Layer
);
m_Width
,
m_Layer
);
NbLigne
++
;
NbLigne
++
;
for
(
ii
=
0
,
ptr
=
m_PolyList
;
ii
<
m_PolyCount
;
ii
++
)
for
(
ii
=
0
,
ptr
=
m_PolyList
;
ii
<
m_PolyCount
;
ii
++
)
{
{
fprintf
(
File
,
"Dl %d %d
\n
"
,
fprintf
(
File
,
"Dl %d %d
\n
"
,
*
ptr
,
*
(
ptr
+
1
));
*
ptr
,
*
(
ptr
+
1
)
);
NbLigne
++
;
ptr
+=
2
;
NbLigne
++
;
ptr
+=
2
;
}
}
break
;
break
;
default
:
DisplayError
(
NULL
,
wxT
(
"Type Edge Module inconnu"
)
);
default
:
break
;
DisplayError
(
NULL
,
wxT
(
"Type Edge Module inconnu"
)
);
}
break
;
}
return
(
NbLigne
);
return
NbLigne
;
}
}
/****************************************************************/
/****************************************************************/
int
EDGE_MODULE
::
ReadDescr
(
char
*
Line
,
FILE
*
File
,
int
EDGE_MODULE
::
ReadDescr
(
char
*
Line
,
FILE
*
File
,
int
*
LineNum
)
int
*
LineNum
)
/***************************************************************/
/***************************************************************/
/* Read a description line like:
/* Read a description line like:
DS 2600 0 2600 -600 120 21
*
DS 2600 0 2600 -600 120 21
this description line is in Line
*
this description line is in Line
EDGE_MODULE type can be:
*
EDGE_MODULE type can be:
- Circle,
*
- Circle,
- Segment (line)
*
- Segment (line)
- Arc
*
- Arc
- Polygon
*
- Polygon
*
*/
*/
{
{
int
ii
,
*
ptr
;
int
ii
,
*
ptr
;
int
error
=
0
;
int
error
=
0
;
char
Buf
[
1024
];
char
Buf
[
1024
];
switch
(
Line
[
1
]
)
switch
(
Line
[
1
]
)
{
{
case
'S'
:
case
'S'
:
m_Shape
=
S_SEGMENT
;
m_Shape
=
S_SEGMENT
;
break
;
break
;
case
'C'
:
m_Shape
=
S_CIRCLE
;
case
'C'
:
break
;
m_Shape
=
S_CIRCLE
;
case
'A'
:
break
;
m_Shape
=
S_ARC
;
break
;
case
'A'
:
case
'P'
:
m_Shape
=
S_ARC
;
m_Shape
=
S_POLYGON
;
break
;
break
;
default
:
case
'P'
:
wxString
msg
;
m_Shape
=
S_POLYGON
;
msg
.
Printf
(
wxT
(
"Unknown EDGE_MODULE type <%s>"
)
,
Line
);
break
;
DisplayError
(
NULL
,
msg
);
error
=
1
;
default
:
break
;
wxString
msg
;
}
msg
.
Printf
(
wxT
(
"Unknown EDGE_MODULE type <%s>"
),
Line
);
DisplayError
(
NULL
,
msg
);
switch
(
m_Shape
)
error
=
1
;
{
break
;
case
S_ARC
:
}
sscanf
(
Line
+
3
,
"%d %d %d %d %d %d %d"
,
&
m_Start0
.
x
,
&
m_Start0
.
y
,
switch
(
m_Shape
)
&
m_End0
.
x
,
&
m_End0
.
y
,
{
&
m_Angle
,
&
m_Width
,
&
m_Layer
);
case
S_ARC
:
break
;
sscanf
(
Line
+
3
,
"%d %d %d %d %d %d %d"
,
&
m_Start0
.
x
,
&
m_Start0
.
y
,
case
S_SEGMENT
:
&
m_End0
.
x
,
&
m_End0
.
y
,
case
S_CIRCLE
:
&
m_Angle
,
&
m_Width
,
&
m_Layer
);
sscanf
(
Line
+
3
,
"%d %d %d %d %d %d"
,
break
;
&
m_Start0
.
x
,
&
m_Start0
.
y
,
&
m_End0
.
x
,
&
m_End0
.
y
,
case
S_SEGMENT
:
&
m_Width
,
&
m_Layer
);
case
S_CIRCLE
:
break
;
sscanf
(
Line
+
3
,
"%d %d %d %d %d %d"
,
&
m_Start0
.
x
,
&
m_Start0
.
y
,
case
S_POLYGON
:
&
m_End0
.
x
,
&
m_End0
.
y
,
sscanf
(
Line
+
3
,
"%d %d %d %d %d %d %d"
,
&
m_Width
,
&
m_Layer
);
&
m_Start0
.
x
,
&
m_Start0
.
y
,
break
;
&
m_End0
.
x
,
&
m_End0
.
y
,
&
m_PolyCount
,
&
m_Width
,
&
m_Layer
);
case
S_POLYGON
:
(
*
LineNum
)
++
;
sscanf
(
Line
+
3
,
"%d %d %d %d %d %d %d"
,
m_PolyList
=
(
int
*
)
MyZMalloc
(
2
*
m_PolyCount
*
sizeof
(
int
)
);
&
m_Start0
.
x
,
&
m_Start0
.
y
,
for
(
ii
=
0
,
ptr
=
m_PolyList
;
ii
<
m_PolyCount
;
ii
++
)
&
m_End0
.
x
,
&
m_End0
.
y
,
{
&
m_PolyCount
,
&
m_Width
,
&
m_Layer
);
if
(
GetLine
(
File
,
Buf
,
LineNum
,
sizeof
(
Buf
)
-
1
)
!=
NULL
)
(
*
LineNum
)
++
;
{
m_PolyList
=
(
int
*
)
MyZMalloc
(
2
*
m_PolyCount
*
sizeof
(
int
)
);
if
(
strncmp
(
Buf
,
"Dl"
,
2
)
!=
0
)
{
error
=
1
;
break
;}
for
(
ii
=
0
,
ptr
=
m_PolyList
;
ii
<
m_PolyCount
;
ii
++
)
sscanf
(
Buf
+
3
,
"%d %d
\n
"
,
ptr
,
ptr
+
1
);
{
(
*
LineNum
)
++
;
ptr
+=
2
;
if
(
GetLine
(
File
,
Buf
,
LineNum
,
sizeof
(
Buf
)
-
1
)
!=
NULL
)
}
{
else
{
if
(
strncmp
(
Buf
,
"Dl"
,
2
)
!=
0
)
error
=
1
;
break
;
{
}
error
=
1
;
break
;
}
}
break
;
sscanf
(
Buf
+
3
,
"%d %d
\n
"
,
ptr
,
ptr
+
1
);
(
*
LineNum
)
++
;
ptr
+=
2
;
default
:
}
sscanf
(
Line
+
3
,
"%d %d %d %d %d %d"
,
else
&
m_Start0
.
x
,
&
m_Start0
.
y
,
{
&
m_End0
.
x
,
&
m_End0
.
y
,
error
=
1
;
break
;
&
m_Width
,
&
m_Layer
);
}
break
;
}
}
break
;
// Controle d'epaisseur raisonnable:
if
(
m_Width
<=
1
)
m_Width
=
1
;
default
:
if
(
m_Width
>
MAX_WIDTH
)
m_Width
=
MAX_WIDTH
;
sscanf
(
Line
+
3
,
"%d %d %d %d %d %d"
,
&
m_Start0
.
x
,
&
m_Start0
.
y
,
return
error
;
&
m_End0
.
x
,
&
m_End0
.
y
,
&
m_Width
,
&
m_Layer
);
break
;
}
// Controle d'epaisseur raisonnable:
if
(
m_Width
<=
1
)
m_Width
=
1
;
if
(
m_Width
>
MAX_WIDTH
)
m_Width
=
MAX_WIDTH
;
return
error
;
}
#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
)
{
// for now, make it look like XML:
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
ReturnClassName
().
mb_str
()
<<
"/>
\n
"
;
}
}
#endif
pcbnew/class_edge_mod.h
View file @
6f7209aa
/**************************************************************/
/**************************************************************/
/* class_edge_module.h : description des contours d'un module */
/* class_edge_module.h : description des contours d'un module */
/**************************************************************/
/**************************************************************/
class
Pcb3D_GLCanvas
;
class
Pcb3D_GLCanvas
;
/* description des contours (empreintes ) et TYPES des CONTOURS : */
/* description des contours (empreintes ) et TYPES des CONTOURS : */
class
EDGE_MODULE
:
public
EDA_BaseLineStruct
class
EDGE_MODULE
:
public
EDA_BaseLineStruct
{
{
public
:
public
:
int
m_Shape
;
// voir "enum Track_Shapes"
int
m_Shape
;
// voir "enum Track_Shapes"
wxPoint
m_Start0
;
// coord relatives a l'ancre du point de depart(Orient 0)
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)
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_Angle
;
// pour les arcs de cercle: longueur de l'arc en 0,1 degres
int
*
m_PolyList
;
// For polygons: coord list (1 point = 2 coord)
// Coord are relative to Origine, orient 0
int
m_PolyCount
;
// For polygons : number of points (> 2)
int
*
m_PolyList
;
// For polygons: coord list (1 point = 2 coord)
public
:
// Coord are relative to Origin, orient 0
EDGE_MODULE
(
MODULE
*
parent
);
EDGE_MODULE
(
EDGE_MODULE
*
edge
);
public
:
~
EDGE_MODULE
();
EDGE_MODULE
(
MODULE
*
parent
);
EDGE_MODULE
(
EDGE_MODULE
*
edge
);
/* supprime du chainage la structure Struct */
~
EDGE_MODULE
();
void
UnLink
(
void
);
/* supprime du chainage la structure Struct */
void
Copy
(
EDGE_MODULE
*
source
);
// copy structure
void
UnLink
(
void
);
/* Readind and writing data on files */
void
Copy
(
EDGE_MODULE
*
source
);
// copy structure
int
WriteDescr
(
FILE
*
File
);
int
ReadDescr
(
char
*
Line
,
FILE
*
File
,
int
*
LineNum
=
NULL
);
/* Reading and writing data on files */
int
WriteDescr
(
FILE
*
File
);
// Mise a jour des coordonées pour l'affichage
int
ReadDescr
(
char
*
Line
,
FILE
*
File
,
int
*
LineNum
=
NULL
);
void
SetDrawCoord
(
void
);
// Mise a jour des coordon�s pour l'affichage
/* drawing functions */
void
SetDrawCoord
(
void
);
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
);
/* drawing functions */
void
Draw3D
(
Pcb3D_GLCanvas
*
glcanvas
);
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
);
void
Draw3D
(
Pcb3D_GLCanvas
*
glcanvas
);
#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.
*/
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
};
pcbnew/class_module.cpp
View file @
6f7209aa
...
@@ -208,7 +208,9 @@ void MODULE::Copy( MODULE* Module )
...
@@ -208,7 +208,9 @@ void MODULE::Copy( MODULE* Module )
/* Copy des elements complementaires Drawings 3D */
/* Copy des elements complementaires Drawings 3D */
m_3D_Drawings
->
Copy
(
Module
->
m_3D_Drawings
);
m_3D_Drawings
->
Copy
(
Module
->
m_3D_Drawings
);
Struct3D_Master
*
Struct3D
,
*
NewStruct3D
,
*
CurrStruct3D
;
Struct3D_Master
*
Struct3D
,
*
NewStruct3D
,
*
CurrStruct3D
;
Struct3D
=
(
Struct3D_Master
*
)
Module
->
m_3D_Drawings
->
Pnext
;
Struct3D
=
(
Struct3D_Master
*
)
Module
->
m_3D_Drawings
->
Pnext
;
CurrStruct3D
=
m_3D_Drawings
;
CurrStruct3D
=
m_3D_Drawings
;
for
(
;
Struct3D
!=
NULL
;
Struct3D
=
(
Struct3D_Master
*
)
Struct3D
->
Pnext
)
for
(
;
Struct3D
!=
NULL
;
Struct3D
=
(
Struct3D_Master
*
)
Struct3D
->
Pnext
)
...
@@ -370,6 +372,7 @@ int MODULE::WriteDescr( FILE* File )
...
@@ -370,6 +372,7 @@ int MODULE::WriteDescr( FILE* File )
StringStat
[
0
]
=
'F'
;
StringStat
[
0
]
=
'F'
;
else
else
StringStat
[
0
]
=
'~'
;
StringStat
[
0
]
=
'~'
;
if
(
m_ModuleStatus
&
MODULE_is_PLACED
)
if
(
m_ModuleStatus
&
MODULE_is_PLACED
)
StringStat
[
1
]
=
'P'
;
StringStat
[
1
]
=
'P'
;
else
else
...
@@ -649,9 +652,9 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
...
@@ -649,9 +652,9 @@ int MODULE::ReadDescr( FILE* File, int* LineNum )
Read_3D_Descr
(
File
,
LineNum
);
Read_3D_Descr
(
File
,
LineNum
);
}
}
if
(
strlen
(
Line
)
<
4
)
if
(
strlen
(
Line
)
<
4
)
continue
;
continue
;
PtLine
=
Line
+
3
;
PtLine
=
Line
+
3
;
/* Pointe 1er code utile de la ligne */
/* Pointe 1er code utile de la ligne */
...
@@ -811,13 +814,16 @@ void MODULE::SetPosition( const wxPoint& newpos )
...
@@ -811,13 +814,16 @@ void MODULE::SetPosition( const wxPoint& newpos )
int
deltaY
=
newpos
.
y
-
m_Pos
.
y
;
int
deltaY
=
newpos
.
y
-
m_Pos
.
y
;
/* deplacement de l'ancre */
/* deplacement de l'ancre */
m_Pos
.
x
+=
deltaX
;
m_Pos
.
y
+=
deltaY
;
m_Pos
.
x
+=
deltaX
;
m_Pos
.
y
+=
deltaY
;
/* deplacement de la reference */
/* deplacement de la reference */
m_Reference
->
m_Pos
.
x
+=
deltaX
;
m_Reference
->
m_Pos
.
y
+=
deltaY
;
m_Reference
->
m_Pos
.
x
+=
deltaX
;
m_Reference
->
m_Pos
.
y
+=
deltaY
;
/* deplacement de la Valeur */
/* deplacement de la Valeur */
m_Value
->
m_Pos
.
x
+=
deltaX
;
m_Value
->
m_Pos
.
y
+=
deltaY
;
m_Value
->
m_Pos
.
x
+=
deltaX
;
m_Value
->
m_Pos
.
y
+=
deltaY
;
/* deplacement des pastilles */
/* deplacement des pastilles */
D_PAD
*
pad
=
m_Pads
;
D_PAD
*
pad
=
m_Pads
;
...
@@ -1153,22 +1159,70 @@ void MODULE::Show( int nestLevel, std::ostream& os )
...
@@ -1153,22 +1159,70 @@ void MODULE::Show( int nestLevel, std::ostream& os )
// for now, make it look like XML, expand on this later.
// for now, make it look like XML, expand on this later.
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
ReturnClassName
().
mb_str
()
<<
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
ReturnClassName
().
mb_str
()
<<
" ref=
\"
"
<<
m_Reference
->
m_Text
.
mb_str
()
<<
// " ref=\"" << m_Reference->m_Text.mb_str() <<
// "\" value=\"" << m_Value->m_Text.mb_str() << '"' <<
">
\n
"
;
"
\"
value=
\"
"
<<
m_Value
->
m_Text
.
mb_str
()
<<
EDA_BaseStruct
*
p
;
"
\"
>
\n
"
;
p
=
m_Reference
;
for
(
;
p
;
p
=
p
->
Pnext
)
p
->
Show
(
nestLevel
+
1
,
os
);
EDA_BaseStruct
*
p
=
m_Drawings
;
p
=
m_Value
;
for
(
;
p
;
p
=
p
->
Pnext
)
for
(
;
p
;
p
=
p
->
Pnext
)
p
->
Show
(
nestLevel
+
1
,
os
);
p
->
Show
(
nestLevel
+
1
,
os
);
EDA_BaseStruct
*
kid
=
m_Son
;
p
=
m_Drawings
;
for
(
;
kid
;
kid
=
kid
->
Pnext
)
for
(
;
p
;
p
=
p
->
Pnext
)
p
->
Show
(
nestLevel
+
1
,
os
);
p
=
m_Son
;
for
(
;
p
;
p
=
p
->
Pnext
)
{
{
kid
->
Show
(
nestLevel
+
1
,
os
);
p
->
Show
(
nestLevel
+
1
,
os
);
}
}
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
ReturnClassName
().
mb_str
()
<<
">
\n
"
;
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
ReturnClassName
().
mb_str
()
<<
">
\n
"
;
}
}
// see class_module.h
SEARCH_RESULT
MODULE
::
Traverse
(
INSPECTOR
*
inspector
,
void
*
testData
,
const
KICAD_T
scanTypes
[]
)
{
KICAD_T
stype
;
for
(
const
KICAD_T
*
p
=
scanTypes
;
(
stype
=*
p
)
!=
EOT
;
++
p
)
{
// If caller wants to inspect my type
if
(
stype
==
m_StructType
)
{
if
(
SEARCH_QUIT
==
inspector
->
Inspect
(
this
,
testData
)
)
return
SEARCH_QUIT
;
}
else
if
(
stype
==
TYPEEDGEMODULE
)
{
// iterate over m_Drawings
if
(
SEARCH_QUIT
==
IterateForward
(
m_Drawings
,
inspector
,
testData
,
scanTypes
)
)
return
SEARCH_QUIT
;
}
else
if
(
stype
==
TYPETEXTEMODULE
)
{
// iterate over m_Reference
if
(
SEARCH_QUIT
==
IterateForward
(
m_Reference
,
inspector
,
testData
,
scanTypes
)
)
return
SEARCH_QUIT
;
// iterate over m_Value
if
(
SEARCH_QUIT
==
IterateForward
(
m_Value
,
inspector
,
testData
,
scanTypes
)
)
return
SEARCH_QUIT
;
}
}
return
SEARCH_CONTINUE
;
}
#endif
#endif
pcbnew/class_module.h
View file @
6f7209aa
...
@@ -142,6 +142,24 @@ public:
...
@@ -142,6 +142,24 @@ public:
* @param os The ostream& to output to.
* @param os The ostream& to output to.
*/
*/
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
/**
* Function Traverse
* should be re-implemented for each derrived class in order to handle
* all the types given by its member data. Implementations should call
* inspector->Inspect() on types in scanTypes[], and may use IterateForward()
* to do so on lists of such data.
* @param inspector An INSPECTOR instance to use in the inspection.
* @param testData Arbitrary data used by the inspector.
* @param scanTypes Which KICAD_T types are of interest and the order
* is significant too, terminated by EOT.
* @return SEARCH_RESULT - SEARCH_QUIT if the Iterator is to stop the scan,
* else SCAN_CONTINUE;
*/
virtual
SEARCH_RESULT
Traverse
(
INSPECTOR
*
inspector
,
void
*
testData
,
const
KICAD_T
scanTypes
[]
);
#endif
#endif
};
};
pcbnew/class_pad.h
View file @
6f7209aa
/**********************************/
/**********************************/
/* class_pad.h : Pads description */
/* class_pad.h : Pads description */
/**********************************/
/**********************************/
class
Pcb3D_GLCanvas
;
class
Pcb3D_GLCanvas
;
/* forme des pastilles : (parametre .forme) */
/* forme des pastilles : (parametre .forme) */
#define CIRCLE 1
#define CIRCLE
1
#define RECT 2
#define RECT
2
#define OVALE 3
#define OVALE
3
#define TRAPEZE
4
// trapeze: traversante ou surfacique
#define TRAPEZE
4
// trapeze: traversante ou surfacique
#define SPECIAL_PAD 5
// description libre
#define SPECIAL_PAD 5
// description libre
/* Attributs des PADS */
/* Attributs des PADS */
#define STANDARD
0
// pad classique
#define STANDARD
0
// pad classique
#define SMD
1
// surfacique, generation d'un masque d'empatement
#define SMD
1
// surfacique, generation d'un masque d'empatement
#define CONN
2
// surfacique, peut etre dore
#define CONN
2
// surfacique, peut etre dore
#define P_HOLE
3
// trou simple, utile sur pad stack
#define P_HOLE
3
// trou simple, utile sur pad stack
#define MECA
4
// PAD "mecanique" (fixation, zone cuivre...)
#define MECA
4
// PAD "mecanique" (fixation, zone cuivre...)
#define PAD_STACK
0x80
// bit 7 de .attrib (flag)
#define PAD_STACK
0x80
// bit 7 de .attrib (flag)
/* Definition type Structure d'un pad */
/* Definition type Structure d'un pad */
class
D_PAD
:
public
EDA_BaseStruct
class
D_PAD
:
public
EDA_BaseStruct
{
{
public
:
public
:
union
{
union
unsigned
long
m_NumPadName
;
{
char
m_Padname
[
4
]
;
/* nom (numero) de la pastille (assimilable a un long)*/
unsigned
long
m_NumPadName
;
};
char
m_Padname
[
4
];
/* nom (numero) de la pastille (assimilable a un long)*/
wxString
m_Netname
;
/* Net Name */
};
int
m_Masque_Layer
;
// (Bit a Bit :1= cuivre, 15= cmp,
// 2..14 = interne
wxString
m_Netname
;
/* Net Name */
// 16 .. 31 = couches non cuivre
int
m_PadShape
;
// forme CERCLE, RECT, OVALE, TRAPEZE ou libre
int
m_Masque_Layer
;
// (Bit a Bit :1= cuivre, 15= cmp,
int
m_DrillShape
;
// forme CERCLE, OVAL
// 2..14 = interne
wxPoint
m_Pos
;
// Position de reference du pad
// 16 .. 31 = couches non cuivre
wxSize
m_Drill
;
// Drill diam (drill shape = CIRCLE) or drill size(shape = OVAL)
// for drill shape = CIRCLE, drill diam = m_Drill.x
int
m_PadShape
;
// forme CERCLE, RECT, OVALE, TRAPEZE ou libre
wxSize
m_Offset
;
// Offset de la forme (pastilles excentrees)
int
m_DrillShape
;
// forme CERCLE, OVAL
wxSize
m_Size
;
// Dimensions X et Y ( si orient 0 x = axe X
// y = axe Y
wxPoint
m_Pos
;
// Position de reference du pad
wxSize
m_DeltaSize
;
// delta sur formes rectangle -> trapezes
wxPoint
m_Pos0
;
// Coord relatives a l'ancre du pad en orientation 0
wxSize
m_Drill
;
// Drill diam (drill shape = CIRCLE) or drill size(shape = OVAL)
int
m_Rayon
;
// rayon du cercle exinscrit du pad
// for drill shape = CIRCLE, drill diam = m_Drill.x
int
m_Attribut
;
// NORMAL, SMD, CONN, Bit 7 = STACK
int
m_Orient
;
// en 1/10 degres
wxSize
m_Offset
;
// Offset de la forme (pastilles excentrees)
wxSize
m_Size
;
// Dimensions X et Y ( si orient 0 x = axe X
// y = axe Y
wxSize
m_DeltaSize
;
// delta sur formes rectangle -> trapezes
wxPoint
m_Pos0
;
// Coord relatives a l'ancre du pad en orientation 0
int
m_Rayon
;
// rayon du cercle exinscrit du pad
int
m_Attribut
;
// NORMAL, SMD, CONN, Bit 7 = STACK
int
m_Orient
;
// en 1/10 degres
int
m_NetCode
;
/* Numero de net pour comparaisons rapides */
int
m_NetCode
;
/* Numero de net pour comparaisons rapides */
int
m_logical_connexion
;
// variable utilisee lors du calcul du chevelu:
int
m_logical_connexion
;
// variable utilisee lors du calcul du chevelu:
// contient de numero de block pour une connexion type ratsnet
// contient de numero de block pour une connexion type ratsnet
int
m_physical_connexion
;
// variable utilisee lors du calcul de la connexité:
// contient de numero de block pour une connexion type piste
int
m_physical_connexion
;
// variable utilisee lors du calcul de la connexit�
// contient de numero de block pour une connexion type piste
public
:
public
:
D_PAD
(
MODULE
*
parent
);
D_PAD
(
MODULE
*
parent
);
D_PAD
(
D_PAD
*
pad
);
D_PAD
(
D_PAD
*
pad
);
~
D_PAD
(
void
);
~
D_PAD
(
void
);
void
Copy
(
D_PAD
*
source
);
void
Copy
(
D_PAD
*
source
);
D_PAD
*
Next
(
void
)
{
return
(
D_PAD
*
)
Pnext
;
}
/* supprime du chainage la structure Struct */
D_PAD
*
Next
(
void
)
{
return
(
D_PAD
*
)
Pnext
;
}
void
UnLink
(
void
);
/* Readind and writing data on files */
/* supprime du chainage la structure Struct */
int
ReadDescr
(
FILE
*
File
,
int
*
LineNum
=
NULL
);
void
UnLink
(
void
);
int
WriteDescr
(
FILE
*
File
);
/* drawing function
s */
/* Readind and writing data on file
s */
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
);
int
ReadDescr
(
FILE
*
File
,
int
*
LineNum
=
NULL
);
void
Draw3D
(
Pcb3D_GLCanvas
*
glcanvas
);
int
WriteDescr
(
FILE
*
File
);
// autres
/* drawing functions */
void
SetPadName
(
const
wxString
&
name
);
// Change pade name
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
);
wxString
ReturnStringPadName
(
void
);
// Return pad name as string in a wxString
void
Draw3D
(
Pcb3D_GLCanvas
*
glcanvas
);
void
ReturnStringPadName
(
wxString
&
text
);
// Return pad name as string in a buffer
void
ComputeRayon
(
void
);
// met a jour m_Rayon, rayon du cercle exinscrit
// autres
const
wxPoint
ReturnShapePos
(
void
);
// retourne la position
void
SetPadName
(
const
wxString
&
name
);
// Change pade name
// de la forme (pastilles excentrees)
wxString
ReturnStringPadName
(
void
);
// Return pad name as string in a wxString
void
Display_Infos
(
WinEDA_BasePcbFrame
*
frame
);
void
ReturnStringPadName
(
wxString
&
text
);
// Return pad name as string in a buffer
void
ComputeRayon
(
void
);
// met a jour m_Rayon, rayon du cercle exinscrit
const
wxPoint
ReturnShapePos
(
void
);
// retourne la position
// de la forme (pastilles excentrees)
void
Display_Infos
(
WinEDA_BasePcbFrame
*
frame
);
};
};
typedef
class
D_PAD
*
LISTE_PAD
;
typedef
class
D_PAD
*
LISTE_PAD
;
pcbnew/class_text_mod.cpp
View file @
6f7209aa
...
@@ -294,3 +294,23 @@ int TEXTE_MODULE::GetDrawRotation( void )
...
@@ -294,3 +294,23 @@ int TEXTE_MODULE::GetDrawRotation( void )
return
rotation
;
return
rotation
;
}
}
#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
TEXTE_MODULE
::
Show
(
int
nestLevel
,
std
::
ostream
&
os
)
{
// for now, make it look like XML, expand on this later.
NestedSpace
(
nestLevel
,
os
)
<<
'<'
<<
ReturnClassName
().
mb_str
()
<<
">
\n
"
;
NestedSpace
(
nestLevel
+
1
,
os
)
<<
m_Text
.
mb_str
()
<<
'\n'
;
NestedSpace
(
nestLevel
,
os
)
<<
"</"
<<
ReturnClassName
().
mb_str
()
<<
">
\n
"
;
}
#endif
pcbnew/class_text_mod.h
View file @
6f7209aa
...
@@ -58,4 +58,16 @@ public:
...
@@ -58,4 +58,16 @@ public:
* @return bool - true if a hit, else false
* @return bool - true if a hit, else false
*/
*/
bool
HitTest
(
const
wxPoint
&
posref
);
bool
HitTest
(
const
wxPoint
&
posref
);
#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.
*/
virtual
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
};
};
pcbnew/locate.cpp
View file @
6f7209aa
...
@@ -935,6 +935,7 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
...
@@ -935,6 +935,7 @@ TRACK* Locate_Piste_Connectee( TRACK* PtRefSegm, TRACK* pt_base,
{
{
if
(
(
PtSegmN
==
NULL
)
&&
(
PtSegmB
==
NULL
)
)
if
(
(
PtSegmN
==
NULL
)
&&
(
PtSegmB
==
NULL
)
)
break
;
break
;
if
(
PtSegmN
)
if
(
PtSegmN
)
{
{
if
(
PtSegmN
->
GetState
(
BUSY
|
DELETED
)
)
if
(
PtSegmN
->
GetState
(
BUSY
|
DELETED
)
)
...
@@ -1054,6 +1055,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa
...
@@ -1054,6 +1055,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa
continue
;
continue
;
if
(
(
g_DesignSettings
.
m_LayerColor
[
Track
->
m_Layer
]
&
ITEM_NOT_SHOW
)
)
if
(
(
g_DesignSettings
.
m_LayerColor
[
Track
->
m_Layer
]
&
ITEM_NOT_SHOW
)
)
continue
;
continue
;
/* calcul des coordonnees du segment teste */
/* calcul des coordonnees du segment teste */
l_piste
=
Track
->
m_Width
>>
1
;
/* l_piste = demi largeur piste */
l_piste
=
Track
->
m_Width
>>
1
;
/* l_piste = demi largeur piste */
ux0
=
Track
->
m_Start
.
x
;
uy0
=
Track
->
m_Start
.
y
;
/* coord de depart */
ux0
=
Track
->
m_Start
.
x
;
uy0
=
Track
->
m_Start
.
y
;
/* coord de depart */
...
@@ -1074,7 +1076,8 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa
...
@@ -1074,7 +1076,8 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa
if
(
MasqueLayer
!=
-
1
)
if
(
MasqueLayer
!=
-
1
)
if
(
(
g_TabOneLayerMask
[
Track
->
m_Layer
]
&
MasqueLayer
)
==
0
)
if
(
(
g_TabOneLayerMask
[
Track
->
m_Layer
]
&
MasqueLayer
)
==
0
)
continue
;
/* Segments sur couches differentes */
continue
;
/* Segments sur couches differentes */
if
(
distance
(
l_piste
)
)
if
(
distance
(
l_piste
)
)
return
Track
;
return
Track
;
}
}
...
@@ -1100,7 +1103,6 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa
...
@@ -1100,7 +1103,6 @@ TRACK* Locate_Pistes( TRACK* start_adresse, const wxPoint& ref_pos, int MasqueLa
*
*
* La recherche commence a l'adresse start_adresse
* La recherche commence a l'adresse start_adresse
*/
*/
TRACK
*
Locate_Zone
(
TRACK
*
start_adresse
,
int
layer
,
int
typeloc
)
TRACK
*
Locate_Zone
(
TRACK
*
start_adresse
,
int
layer
,
int
typeloc
)
{
{
wxPoint
ref_pos
=
RefPos
(
typeloc
);
wxPoint
ref_pos
=
RefPos
(
typeloc
);
...
@@ -1287,6 +1289,7 @@ int distance( int seuil )
...
@@ -1287,6 +1289,7 @@ int distance( int seuil )
angle
=
(
int
)
(
atan2
(
(
float
)
segY
,
(
float
)
segX
)
*
1800
/
M_PI
);
angle
=
(
int
)
(
atan2
(
(
float
)
segY
,
(
float
)
segX
)
*
1800
/
M_PI
);
cXrot
=
pointX
;
cYrot
=
pointY
;
cXrot
=
pointX
;
cYrot
=
pointY
;
RotatePoint
(
&
cXrot
,
&
cYrot
,
angle
);
/* Rotation du point a tester */
RotatePoint
(
&
cXrot
,
&
cYrot
,
angle
);
/* Rotation du point a tester */
RotatePoint
(
&
segX
,
&
segY
,
angle
);
/* Rotation du segment */
RotatePoint
(
&
segX
,
&
segY
,
angle
);
/* Rotation du segment */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment