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
ffd3a713
Commit
ffd3a713
authored
Jan 04, 2008
by
CHARRAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
more about zones. current No DRC for outlines
parent
945c14d4
Changes
17
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
1837 additions
and
451 deletions
+1837
-451
Add_Zone_Cutout.xpm
bitmaps/Add_Zone_Cutout.xpm
+6
-6
change_log.txt
change_log.txt
+8
-0
wxPcbStruct.h
include/wxPcbStruct.h
+25
-0
kicad.mo
internat/fr/kicad.mo
+0
-0
kicad.po
internat/fr/kicad.po
+324
-275
class_board.h
pcbnew/class_board.h
+117
-0
class_zone.cpp
pcbnew/class_zone.cpp
+81
-58
class_zone.h
pcbnew/class_zone.h
+4
-3
dialog_zones_by_polygon.cpp
pcbnew/dialog_zones_by_polygon.cpp
+1
-1
edit.cpp
pcbnew/edit.cpp
+6
-18
makefile.include
pcbnew/makefile.include
+2
-0
onrightclick.cpp
pcbnew/onrightclick.cpp
+2
-2
zone_filling_algorithm.cpp
pcbnew/zone_filling_algorithm.cpp
+18
-20
zones_by_polygon.cpp
pcbnew/zones_by_polygon.cpp
+250
-65
zones_test_and_combine_areas.cpp
pcbnew/zones_test_and_combine_areas.cpp
+975
-0
PolyLine.cpp
polygon/PolyLine.cpp
+13
-0
PolyLine.h
polygon/PolyLine.h
+5
-3
No files found.
bitmaps/Add_Zone_Cutout.xpm
View file @
ffd3a713
...
...
@@ -11,12 +11,12 @@ const char * add_zone_cutout[] = {
" ..............",
".... ........",
"... ++++ .......",
".. +
+ .....",
". +
+ ...",
". +
+ ..",
". +
+ ..",
". +
+ .",
".. +
+ ..",
".. +
+++++
+ .....",
". +
+ +
+ ...",
". +
+ +
+ ..",
". +
+ +
+ ..",
". +
+ +
+ .",
".. +
++++++++
+ ..",
"... +++++++ ... ",
".... .... ",
"............ ",
...
...
change_log.txt
View file @
ffd3a713
...
...
@@ -4,6 +4,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-jan-04 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
More about zones:
Outlines can be edited. Outlines are merged if needeed.
Current No DRC for outlines
2008-jan-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+all
...
...
include/wxPcbStruct.h
View file @
ffd3a713
...
...
@@ -529,6 +529,24 @@ public:
*/
int
Fill_All_Zones
(
wxDC
*
DC
,
bool
verbose
=
TRUE
);
/**
* Function Add_Zone_Cutout
* Add a cutout zone to a given zone outline
* @param DC = current Device Context
* @param zone_container = parent zone outline
*/
void
Add_Zone_Cutout
(
wxDC
*
DC
,
ZONE_CONTAINER
*
zone_container
);
/**
* Function Add_Similar_Zone
* Add a zone to a given zone outline.
* if the zones are overlappeing they will be merged
* @param DC = current Device Context
* @param zone_container = parent zone outline
*/
void
Add_Similar_Zone
(
wxDC
*
DC
,
ZONE_CONTAINER
*
zone_container
);
/**
* Function Edit_Zone_Params
* Edit params (layer, clearance, ...) for a zone outline
...
...
@@ -548,6 +566,13 @@ public:
*/
void
End_Move_Zone_Corner
(
wxDC
*
DC
,
ZONE_CONTAINER
*
zone_container
);
/**
* Function End_Move_Zone_Corner
* Remove the currently selected corner in a zone outline
* the .m_CornerSelection is used as corner selection
*/
void
Remove_Zone_Corner
(
wxDC
*
DC
,
ZONE_CONTAINER
*
zone_container
);
// Target handling
MIREPCB
*
Create_Mire
(
wxDC
*
DC
);
void
Delete_Mire
(
MIREPCB
*
MirePcb
,
wxDC
*
DC
);
...
...
internat/fr/kicad.mo
View file @
ffd3a713
No preview for this file type
internat/fr/kicad.po
View file @
ffd3a713
This diff is collapsed.
Click to expand it.
pcbnew/class_board.h
View file @
ffd3a713
...
...
@@ -224,6 +224,123 @@ public:
void
Show
(
int
nestLevel
,
std
::
ostream
&
os
);
#endif
/* Functions used in test, merge and cut outlines */
/**
* Function AddArea
* add empty copper area to net
* @return pointer to the new area
*/
ZONE_CONTAINER
*
AddArea
(
int
netcode
,
int
layer
,
int
x
,
int
y
,
int
hatch
);
/**
* remove copper area from net
* @param area = area to remove
* @return 0
*/
int
RemoveArea
(
ZONE_CONTAINER
*
area_to_remove
);
/**
* Function InsertArea
* add empty copper area to net, inserting after m_ZoneDescriptorList[iarea]
* @return pointer to the new area
*/
ZONE_CONTAINER
*
InsertArea
(
int
netcode
,
int
iarea
,
int
layer
,
int
x
,
int
y
,
int
hatch
);
/**
Function CompleteArea
* complete copper area contour by adding a line from last to first corner
* if there is only 1 or 2 corners, remove (delete) the area
* @param area_to_complete = area to complete or remove
* @param style = style of last corner
* @return 1 if Ok, 0 if area removed
*/
int
CompleteArea
(
ZONE_CONTAINER
*
area_to_complete
,
int
style
);
/**
* Function TestAreaPolygon
* Test an area for self-intersection.
*
* @param CurrArea = copper area to test
* @return :
* -1 if arcs intersect other sides
* 0 if no intersecting sides
* 1 if intersecting sides, but no intersecting arcs
* Also sets utility2 flag of area with return value
*/
int
TestAreaPolygon
(
ZONE_CONTAINER
*
CurrArea
);
/**
* Function ClipAreaPolygon
* Process an area that has been modified, by clipping its polygon against itself.
* This may change the number and order of copper areas in the net.
* @param bMessageBoxInt == TRUE, shows message when clipping occurs.
* @param bMessageBoxArc == TRUE, shows message when clipping can't be done due to arcs.
* @return:
* -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides
* 1 if intersecting sides
* Also sets areas->utility1 flags if areas are modified
*/
int
ClipAreaPolygon
(
ZONE_CONTAINER
*
CurrArea
,
bool
bMessageBoxArc
,
bool
bMessageBoxInt
,
bool
bRetainArcs
=
TRUE
);
/**
* Process an area that has been modified, by clipping its polygon against
* itself and the polygons for any other areas on the same net.
* This may change the number and order of copper areas in the net.
* @param modified_area = area to test
* @param bMessageBox : if TRUE, shows message boxes when clipping occurs.
* @return :
* -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides
* 1 if intersecting sides, polygon clipped
*/
int
AreaPolygonModified
(
ZONE_CONTAINER
*
modified_area
,
bool
bMessageBoxArc
,
bool
bMessageBoxInt
);
/**
* Function CombineAllAreasInNet
* Checks all copper areas in net for intersections, combining them if found
* @param aNetCode = net to consider
* @param bMessageBox : if true display warning message box
* @param bUseUtility : if true, don't check areas if both utility flags are 0
* Sets utility flag = 1 for any areas modified
* If an area has self-intersecting arcs, doesn't try to combine it
*/
int
CombineAllAreasInNet
(
int
aNetCode
,
bool
bMessageBox
,
bool
bUseUtility
);
/**
* Function TestAreaIntersections
* Check for intersection of a given copper area with other areas in same net
* @param area_to_test = area to compare to all other areas in the same net
*/
bool
TestAreaIntersections
(
ZONE_CONTAINER
*
area_to_test
);
/**
* Function TestAreaIntersection
* Test for intersection of 2 copper areas
* area_to_test must be after area_ref in m_ZoneDescriptorList
* @param area_ref = area reference
* @param area_to_test = area to compare for intersection calculations
* @return : 0 if no intersection
* 1 if intersection
* 2 if arcs intersect
*/
int
TestAreaIntersection
(
ZONE_CONTAINER
*
area_ref
,
ZONE_CONTAINER
*
area_to_test
);
/**
* Function CombineAreas
* If possible, combine 2 copper areas
* area_ref must be BEFORE area_to_combine
* area_to_combine will be deleted, if areas are combined
* @return : 0 if no intersection
* 1 if intersection
* 2 if arcs intersect
*/
int
CombineAreas
(
ZONE_CONTAINER
*
area_ref
,
ZONE_CONTAINER
*
area_to_combine
);
};
#endif // #ifndef CLASS_BOARD_H
pcbnew/class_zone.cpp
View file @
ffd3a713
...
...
@@ -8,15 +8,40 @@
#include "gr_basic.h"
#include "common.h"
#include "PolyLine.h"
#include "pcbnew.h"
/**********************/
/* Class EDGE_ZONE */
/**********************/
/* Constructor */
EDGE_ZONE
::
EDGE_ZONE
(
BOARD_ITEM
*
parent
)
:
DRAWSEGMENT
(
parent
,
TYPEEDGEZONE
)
{
m_Width
=
2
;
// a minimum for visibility, while dragging
}
/* Destructor */
EDGE_ZONE
::
~
EDGE_ZONE
()
{
}
/****************************************/
bool
EDGE_ZONE
::
Save
(
FILE
*
aFile
)
const
/****************************************/
{
return
true
;
}
/************************/
/* class ZONE_CONTAINER */
/************************/
ZONE_CONTAINER
::
ZONE_CONTAINER
(
BOARD
*
parent
)
:
BOARD_ITEM
(
parent
,
TYPEZONE_CONTAINER
)
,
CPolyLine
(
NULL
)
{
m_NetCode
=
-
1
;
// Net number for fast comparisons
...
...
@@ -24,38 +49,36 @@ ZONE_CONTAINER::ZONE_CONTAINER( BOARD* parent ) :
m_ZoneClearance
=
200
;
// a reasonnable clerance value
m_GridFillValue
=
50
;
// a reasonnable grid used for filling
m_PadOption
=
THERMAL_PAD
;
}
utility
=
0
;
// flags used in polygon calculations
utility2
=
0
;
// flags used in polygon calculations
m_Poly
=
new
CPolyLine
(
NULL
);
// Outlines
ZONE_CONTAINER
::~
ZONE_CONTAINER
()
{
}
/**********************/
/* Class EDGE_ZONE */
/**********************/
/* Constructor */
EDGE_ZONE
::
EDGE_ZONE
(
BOARD_ITEM
*
parent
)
:
DRAWSEGMENT
(
parent
,
TYPEEDGEZONE
)
ZONE_CONTAINER
::~
ZONE_CONTAINER
()
{
m_Width
=
2
;
// a minimum for visibility, while dragging
delete
m_Poly
;
m_Poly
=
NULL
;
}
/* Destructor */
EDGE_ZONE
::
~
EDGE_ZONE
()
/*******************************************/
void
ZONE_CONTAINER
::
SetNet
(
int
anet_code
)
/*******************************************/
{
m_NetCode
=
anet_code
;
if
(
m_Parent
)
{
EQUIPOT
*
net
=
((
BOARD
*
)
m_Parent
)
->
FindNet
(
g_HightLigth_NetCode
);
if
(
net
)
m_Netname
=
net
->
m_Netname
;
else
m_Netname
.
Empty
();
}
else
m_Netname
.
Empty
();
}
/****************************************/
bool
EDGE_ZONE
::
Save
(
FILE
*
aFile
)
const
/****************************************/
{
return
true
;
}
/********************************************/
bool
ZONE_CONTAINER
::
Save
(
FILE
*
aFile
)
const
...
...
@@ -66,7 +89,7 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
unsigned
item_pos
;
int
ret
;
unsigned
corners_count
=
corner
.
size
();
unsigned
corners_count
=
m_Poly
->
corner
.
size
();
int
outline_hatch
;
fprintf
(
aFile
,
"$CZONE_OUTLINE
\n
"
);
...
...
@@ -79,16 +102,16 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
ret
=
fprintf
(
aFile
,
"ZLayer %d
\n
"
,
m_Layer
);
if
(
ret
<
1
)
return
false
;
// Save the ouline aux info
switch
(
m_
HatchStyle
)
switch
(
m_
Poly
->
GetHatchStyle
()
)
{
default
:
case
NO_HATCH
:
case
CPolyLine
:
:
NO_HATCH
:
outline_hatch
=
'N'
;
break
;
case
DIAGONAL_EDGE
:
case
CPolyLine
:
:
DIAGONAL_EDGE
:
outline_hatch
=
'E'
;
break
;
case
DIAGONAL_FULL
:
case
CPolyLine
:
:
DIAGONAL_FULL
:
outline_hatch
=
'F'
;
break
;
}
...
...
@@ -99,8 +122,8 @@ bool ZONE_CONTAINER::Save( FILE* aFile ) const
for
(
item_pos
=
0
;
item_pos
<
corners_count
;
item_pos
++
)
{
ret
=
fprintf
(
aFile
,
"ZCorner %d %d %d
\n
"
,
corner
[
item_pos
].
x
,
corner
[
item_pos
].
y
,
corner
[
item_pos
].
end_contour
);
m_Poly
->
corner
[
item_pos
].
x
,
m_Poly
->
corner
[
item_pos
].
y
,
m_Poly
->
corner
[
item_pos
].
end_contour
);
if
(
ret
<
3
)
return
false
;
}
fprintf
(
aFile
,
"$endCZONE_OUTLINE
\n
"
);
...
...
@@ -122,7 +145,7 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum )
char
netname_buffer
[
1024
];
int
ret
;
int
n_corner_item
=
0
;
int
outline_hatch
=
NO_HATCH
;
int
outline_hatch
=
CPolyLine
::
NO_HATCH
;
bool
error
=
false
,
has_corner
=
false
;
netname_buffer
[
0
]
=
0
;
...
...
@@ -137,13 +160,13 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum )
else
{
if
(
!
has_corner
)
Start
(
m_Layer
,
0
,
0
,
m_Poly
->
Start
(
m_Layer
,
0
,
0
,
x
,
y
,
outline_hatch
);
else
AppendCorner
(
x
,
y
);
m_Poly
->
AppendCorner
(
x
,
y
);
has_corner
=
true
;
if
(
flag
)
Close
();
if
(
flag
)
m_Poly
->
Close
();
}
}
if
(
strnicmp
(
Line
,
"ZInfo"
,
5
)
==
0
)
// general info found
...
...
@@ -182,15 +205,15 @@ int ZONE_CONTAINER::ReadDescr( FILE* aFile, int* aLineNum )
{
case
'n'
:
case
'N'
:
outline_hatch
=
NO_HATCH
;
outline_hatch
=
CPolyLine
::
NO_HATCH
;
break
;
case
'e'
:
case
'E'
:
outline_hatch
=
DIAGONAL_EDGE
;
outline_hatch
=
CPolyLine
::
DIAGONAL_EDGE
;
break
;
case
'f'
:
case
'F'
:
outline_hatch
=
DIAGONAL_FULL
;
outline_hatch
=
CPolyLine
::
DIAGONAL_FULL
;
break
;
}
}
...
...
@@ -245,32 +268,32 @@ void ZONE_CONTAINER::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off
// draw the lines
int
i_start_contour
=
0
;
for
(
unsigned
ic
=
0
;
ic
<
corner
.
size
();
ic
++
)
for
(
unsigned
ic
=
0
;
ic
<
m_Poly
->
corner
.
size
();
ic
++
)
{
int
xi
=
corner
[
ic
].
x
+
offset
.
x
;
int
yi
=
corner
[
ic
].
y
+
offset
.
y
;
int
xi
=
m_Poly
->
corner
[
ic
].
x
+
offset
.
x
;
int
yi
=
m_Poly
->
corner
[
ic
].
y
+
offset
.
y
;
int
xf
,
yf
;
if
(
corner
[
ic
].
end_contour
==
FALSE
&&
ic
<
corner
.
size
()
-
1
)
if
(
m_Poly
->
corner
[
ic
].
end_contour
==
FALSE
&&
ic
<
m_Poly
->
corner
.
size
()
-
1
)
{
xf
=
corner
[
ic
+
1
].
x
+
offset
.
x
;
yf
=
corner
[
ic
+
1
].
y
+
offset
.
y
;
xf
=
m_Poly
->
corner
[
ic
+
1
].
x
+
offset
.
x
;
yf
=
m_Poly
->
corner
[
ic
+
1
].
y
+
offset
.
y
;
}
else
{
xf
=
corner
[
i_start_contour
].
x
+
offset
.
x
;
yf
=
corner
[
i_start_contour
].
y
+
offset
.
y
;
xf
=
m_Poly
->
corner
[
i_start_contour
].
x
+
offset
.
x
;
yf
=
m_Poly
->
corner
[
i_start_contour
].
y
+
offset
.
y
;
i_start_contour
=
ic
+
1
;
}
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
xi
,
yi
,
xf
,
yf
,
0
,
color
);
}
// draw hatches
for
(
unsigned
ic
=
0
;
ic
<
m_HatchLines
.
size
();
ic
++
)
for
(
unsigned
ic
=
0
;
ic
<
m_
Poly
->
m_
HatchLines
.
size
();
ic
++
)
{
int
xi
=
m_HatchLines
[
ic
].
xi
+
offset
.
x
;
int
yi
=
m_HatchLines
[
ic
].
yi
+
offset
.
y
;
int
xf
=
m_HatchLines
[
ic
].
xf
+
offset
.
x
;
int
yf
=
m_HatchLines
[
ic
].
yf
+
offset
.
y
;
int
xi
=
m_
Poly
->
m_
HatchLines
[
ic
].
xi
+
offset
.
x
;
int
yi
=
m_
Poly
->
m_
HatchLines
[
ic
].
yi
+
offset
.
y
;
int
xf
=
m_
Poly
->
m_
HatchLines
[
ic
].
xf
+
offset
.
x
;
int
yf
=
m_
Poly
->
m_
HatchLines
[
ic
].
yf
+
offset
.
y
;
GRLine
(
&
panel
->
m_ClipBox
,
DC
,
xi
,
yi
,
xf
,
yf
,
0
,
color
);
}
...
...
@@ -307,7 +330,7 @@ int ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
#define MIN_DIST_IN_PIXELS 5
int
dist
;
unsigned
item_pos
,
lim
;
lim
=
corner
.
size
();
lim
=
m_Poly
->
corner
.
size
();
// Min distance to hit = MIN_DIST_IN_PIXELS pixels :
WinEDA_BasePcbFrame
*
frame
=
((
BOARD
*
)
GetParent
())
->
m_PcbFrame
;
...
...
@@ -315,7 +338,7 @@ int ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
for
(
item_pos
=
0
;
item_pos
<
lim
;
item_pos
++
)
{
dist
=
abs
(
corner
[
item_pos
].
x
-
refPos
.
x
)
+
abs
(
corner
[
item_pos
].
y
-
refPos
.
y
);
dist
=
abs
(
m_Poly
->
corner
[
item_pos
].
x
-
refPos
.
x
)
+
abs
(
m_Poly
->
corner
[
item_pos
].
y
-
refPos
.
y
);
if
(
dist
<=
min_dist
)
return
item_pos
;
}
...
...
@@ -335,7 +358,7 @@ int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
#define MIN_DIST_IN_PIXELS 5
int
dist
;
unsigned
item_pos
,
lim
;
lim
=
corner
.
size
();
lim
=
m_Poly
->
corner
.
size
();
// Min distance to hit = MIN_DIST_IN_PIXELS pixels :
WinEDA_BasePcbFrame
*
frame
=
((
BOARD
*
)
GetParent
())
->
m_PcbFrame
;
...
...
@@ -351,7 +374,7 @@ int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
* the last segment of the current outline starts at current corner, and ends
* at the first corner of the outline
*/
if
(
corner
[
item_pos
].
end_contour
||
end_segm
>=
lim
)
if
(
m_Poly
->
corner
[
item_pos
].
end_contour
||
end_segm
>=
lim
)
{
unsigned
tmp
=
first_corner_pos
;
first_corner_pos
=
end_segm
;
// first_corner_pos is now the beginning of the next outline
...
...
@@ -361,10 +384,10 @@ int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
/* test the dist between segment and ref point */
dist
=
(
int
)
GetPointToLineSegmentDistance
(
refPos
.
x
,
refPos
.
y
,
corner
[
item_pos
].
x
,
corner
[
item_pos
].
y
,
corner
[
end_segm
].
x
,
corner
[
end_segm
].
y
);
m_Poly
->
corner
[
item_pos
].
x
,
m_Poly
->
corner
[
item_pos
].
y
,
m_Poly
->
corner
[
end_segm
].
x
,
m_Poly
->
corner
[
end_segm
].
y
);
if
(
dist
<=
min_dist
)
return
item_pos
;
}
...
...
@@ -407,10 +430,10 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame )
Affiche_1_Parametre
(
frame
,
text_pos
,
_
(
"Layer"
),
msg
,
BROWN
);
text_pos
+=
8
;
msg
.
Printf
(
wxT
(
"%d"
),
corner
.
size
()
);
msg
.
Printf
(
wxT
(
"%d"
),
m_Poly
->
corner
.
size
()
);
Affiche_1_Parametre
(
frame
,
text_pos
,
_
(
"Corners"
),
msg
,
BLUE
);
text_pos
+=
8
;
msg
.
Printf
(
wxT
(
"%d"
),
m_HatchLines
.
size
()
);
msg
.
Printf
(
wxT
(
"%d"
),
m_
Poly
->
m_
HatchLines
.
size
()
);
Affiche_1_Parametre
(
frame
,
text_pos
,
_
(
"Hatch lines"
),
msg
,
BLUE
);
}
pcbnew/class_zone.h
View file @
ffd3a713
...
...
@@ -15,7 +15,7 @@
* others polygons inside this main polygon are holes.
*/
class
ZONE_CONTAINER
:
public
BOARD_ITEM
,
public
CPolyLine
class
ZONE_CONTAINER
:
public
BOARD_ITEM
{
public
:
enum
m_PadInZone
{
// How pads are covered by copper in zone
...
...
@@ -24,10 +24,12 @@ public:
PAD_IN_ZONE
// pads are covered by copper
};
wxString
m_Netname
;
// Net Name
CPolyLine
*
m_Poly
;
// outlines
int
m_CornerSelection
;
// For corner moving, corner index to drag, or -1 if no selection
int
m_ZoneClearance
;
// clearance value
int
m_GridFillValue
;
// Grid used for filling
m_PadInZone
m_PadOption
;
// see m_PadInZone
int
utility
,
utility2
;
// flags used in polygon calculations
private
:
int
m_NetCode
;
// Net number for fast comparisons
...
...
@@ -55,7 +57,7 @@ public:
const
wxPoint
&
offset
,
int
draw_mode
);
int
GetNet
(
void
)
{
return
m_NetCode
;
}
void
SetNet
(
int
anet_code
)
{
m_NetCode
=
anet_code
;
}
void
SetNet
(
int
anet_code
)
;
/**
* Function HitTest
* tests if the given wxPoint is within the bounds of this object.
...
...
@@ -90,7 +92,6 @@ public:
* @return error level (0 = no error)
*/
int
Fill_Zone
(
WinEDA_PcbFrame
*
frame
,
wxDC
*
DC
,
bool
verbose
=
TRUE
);
};
/*******************/
...
...
pcbnew/dialog_zones_by_polygon.cpp
View file @
ffd3a713
...
...
@@ -281,7 +281,7 @@ void WinEDA_ZoneFrame::CreateControls()
}
if
(
m_Zone_Container
)
s_Zone_Hatching
=
m_Zone_Container
->
GetHatch
();
s_Zone_Hatching
=
m_Zone_Container
->
m_Poly
->
GetHatchStyle
();
switch
(
s_Zone_Hatching
)
{
case
CPolyLine
:
:
NO_HATCH
:
...
...
pcbnew/edit.cpp
View file @
ffd3a713
...
...
@@ -450,11 +450,13 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
case
ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE
:
wxMessageBox
(
wxT
(
"ToDo"
));
DrawPanel
->
MouseToCursorSchema
();
Add_Similar_Zone
(
&
dc
,
(
ZONE_CONTAINER
*
)
GetCurItem
()
);
break
;
case
ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE
:
wxMessageBox
(
wxT
(
"ToDo"
));
DrawPanel
->
MouseToCursorSchema
();
Add_Zone_Cutout
(
&
dc
,
(
ZONE_CONTAINER
*
)
GetCurItem
()
);
break
;
case
ID_POPUP_PCB_DELETE_ZONE_CONTAINER
:
...
...
@@ -469,23 +471,9 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
}
case
ID_POPUP_PCB_DELETE_ZONE_CORNER
:
{
DrawPanel
->
MouseToCursorSchema
();
ZONE_CONTAINER
*
zone_cont
=
(
ZONE_CONTAINER
*
)
GetCurItem
();
zone_cont
->
Draw
(
DrawPanel
,
&
dc
,
wxPoint
(
0
,
0
),
GR_XOR
);
if
(
zone_cont
->
GetNumCorners
()
<=
3
)
{
Delete_Zone
(
&
dc
,
NULL
,
zone_cont
->
m_TimeStamp
);
m_Pcb
->
Delete
(
zone_cont
);
}
else
{
zone_cont
->
DeleteCorner
(
zone_cont
->
m_CornerSelection
);
zone_cont
->
Draw
(
DrawPanel
,
&
dc
,
wxPoint
(
0
,
0
),
GR_XOR
);
}
Remove_Zone_Corner
(
&
dc
,
(
ZONE_CONTAINER
*
)
GetCurItem
()
);
SetCurItem
(
NULL
);
break
;
}
case
ID_POPUP_PCB_MOVE_ZONE_CORNER
:
{
...
...
@@ -505,7 +493,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
* and start move the new corner
*/
zone_cont
->
Draw
(
DrawPanel
,
&
dc
,
wxPoint
(
0
,
0
),
GR_XOR
);
zone_cont
->
InsertCorner
(
zone_cont
->
m_CornerSelection
,
pos
.
x
,
pos
.
y
);
zone_cont
->
m_Poly
->
InsertCorner
(
zone_cont
->
m_CornerSelection
,
pos
.
x
,
pos
.
y
);
zone_cont
->
m_CornerSelection
++
;
zone_cont
->
Draw
(
DrawPanel
,
&
dc
,
wxPoint
(
0
,
0
),
GR_XOR
);
Start_Move_Zone_Corner
(
&
dc
,
zone_cont
,
zone_cont
->
m_CornerSelection
,
true
);
...
...
pcbnew/makefile.include
View file @
ffd3a713
...
...
@@ -10,8 +10,10 @@ LIBVIEWER3D = ../3d-viewer/3d-viewer.a
ZONE_FILES
=
zones_by_polygon.o
#ZONE_FILES = zones.o
OBJECTS
=
$(TARGET)
.o classpcb.o
\
$(ZONE_FILES)
\
zones_test_and_combine_areas.o
\
zone_filling_algorithm.o
\
lay2plot.o
\
modedit_undo_redo.o
\
...
...
pcbnew/onrightclick.cpp
View file @
ffd3a713
...
...
@@ -658,10 +658,10 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
aPopMenu
->
AppendSeparator
();
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE
,
_
(
"Add Similar Zone"
),
fill
_zone_xpm
);
_
(
"Add Similar Zone"
),
add
_zone_xpm
);
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE
,
_
(
"Add Cutout
Zone
"
),
add_zone_cutout
);
_
(
"Add Cutout
Area
"
),
add_zone_cutout
);
aPopMenu
->
AppendSeparator
();
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_FILL_ZONE
,
...
...
pcbnew/zone_filling_algorithm.cpp
View file @
ffd3a713
...
...
@@ -112,20 +112,20 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose )
// trace the zone edges into the routing matrix
int
i_start_contour
=
0
;
for
(
unsigned
ic
=
0
;
ic
<
corner
.
size
();
ic
++
)
for
(
unsigned
ic
=
0
;
ic
<
m_Poly
->
corner
.
size
();
ic
++
)
{
int
xi
=
corner
[
ic
].
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
;
int
yi
=
corner
[
ic
].
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
;
int
xi
=
m_Poly
->
corner
[
ic
].
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
;
int
yi
=
m_Poly
->
corner
[
ic
].
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
;
int
xf
,
yf
;
if
(
corner
[
ic
].
end_contour
==
FALSE
&&
ic
<
corner
.
size
()
-
1
)
if
(
m_Poly
->
corner
[
ic
].
end_contour
==
FALSE
&&
ic
<
m_Poly
->
corner
.
size
()
-
1
)
{
xf
=
corner
[
ic
+
1
].
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
;
yf
=
corner
[
ic
+
1
].
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
;
xf
=
m_Poly
->
corner
[
ic
+
1
].
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
;
yf
=
m_Poly
->
corner
[
ic
+
1
].
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
;
}
else
{
xf
=
corner
[
i_start_contour
].
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
;
yf
=
corner
[
i_start_contour
].
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
;
xf
=
m_Poly
->
corner
[
i_start_contour
].
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
;
yf
=
m_Poly
->
corner
[
i_start_contour
].
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
;
i_start_contour
=
ic
+
1
;
}
TraceLignePcb
(
xi
,
yi
,
xf
,
yf
,
-
1
,
HOLE
|
CELL_is_EDGE
,
WRITE_CELL
);
...
...
@@ -136,9 +136,8 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose )
int
cells_count
=
0
;
for
(
ii
=
0
,
pad
=
frame
->
m_Pcb
->
m_Pads
;
ii
<
frame
->
m_Pcb
->
m_NbPads
;
ii
++
,
pad
++
)
{
int
icont
=
0
;
wxPoint
pos
;
if
(
TestPointInsideContour
(
icont
,
(
*
pad
)
->
m_Pos
.
x
,
(
*
pad
)
->
m_Pos
.
y
)
)
if
(
m_Poly
->
TestPointInside
(
(
*
pad
)
->
m_Pos
.
x
,
(
*
pad
)
->
m_Pos
.
y
)
)
{
ZoneStartFill
.
x
=
(
(
*
pad
)
->
m_Pos
.
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
+
(
g_GridRoutingSize
/
2
)
)
/
g_GridRoutingSize
;
...
...
@@ -196,20 +195,20 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose )
/* Recreate zone limits on the routing matrix
* (could be deleted by PlaceCells()) : */
i_start_contour
=
0
;
for
(
unsigned
ic
=
0
;
ic
<
corner
.
size
();
ic
++
)
for
(
unsigned
ic
=
0
;
ic
<
m_Poly
->
corner
.
size
();
ic
++
)
{
int
xi
=
corner
[
ic
].
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
;
int
yi
=
corner
[
ic
].
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
;
int
xi
=
m_Poly
->
corner
[
ic
].
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
;
int
yi
=
m_Poly
->
corner
[
ic
].
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
;
int
xf
,
yf
;
if
(
corner
[
ic
].
end_contour
==
FALSE
&&
ic
<
corner
.
size
()
-
1
)
if
(
m_Poly
->
corner
[
ic
].
end_contour
==
FALSE
&&
ic
<
m_Poly
->
corner
.
size
()
-
1
)
{
xf
=
corner
[
ic
+
1
].
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
;
yf
=
corner
[
ic
+
1
].
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
;
xf
=
m_Poly
->
corner
[
ic
+
1
].
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
;
yf
=
m_Poly
->
corner
[
ic
+
1
].
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
;
}
else
{
xf
=
corner
[
i_start_contour
].
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
;
yf
=
corner
[
i_start_contour
].
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
;
xf
=
m_Poly
->
corner
[
i_start_contour
].
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
;
yf
=
m_Poly
->
corner
[
i_start_contour
].
y
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
y
;
i_start_contour
=
ic
+
1
;
}
TraceLignePcb
(
xi
,
yi
,
xf
,
yf
,
-
1
,
HOLE
|
CELL_is_EDGE
,
WRITE_CELL
);
...
...
@@ -219,9 +218,8 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose )
* (could be deleted by PlaceCells()) : */
for
(
ii
=
0
,
pad
=
frame
->
m_Pcb
->
m_Pads
;
ii
<
frame
->
m_Pcb
->
m_NbPads
;
ii
++
,
pad
++
)
{
int
icont
=
0
;
wxPoint
pos
;
if
(
TestPointInsideContour
(
icont
,
(
*
pad
)
->
m_Pos
.
x
,
(
*
pad
)
->
m_Pos
.
y
)
)
if
(
m_Poly
->
TestPointInside
(
(
*
pad
)
->
m_Pos
.
x
,
(
*
pad
)
->
m_Pos
.
y
)
)
{
ZoneStartFill
.
x
=
(
(
*
pad
)
->
m_Pos
.
x
-
Pcb
->
m_BoundaryBox
.
m_Pos
.
x
+
(
g_GridRoutingSize
/
2
)
)
/
g_GridRoutingSize
;
...
...
pcbnew/zones_by_polygon.cpp
View file @
ffd3a713
This diff is collapsed.
Click to expand it.
pcbnew/zones_test_and_combine_areas.cpp
0 → 100644
View file @
ffd3a713
This diff is collapsed.
Click to expand it.
polygon/PolyLine.cpp
View file @
ffd3a713
...
...
@@ -748,6 +748,19 @@ void CPolyLine::RemoveContour( int icont )
Draw
();
}
void
CPolyLine
::
RemoveAllContours
(
void
)
/**
* function RemoveAllContours
* removes all corners from the lists.
* Others params are not chnaged
*/
{
corner
.
clear
(
);
side_style
.
clear
(
);
}
/** Function InsertCorner
* insert a new corner between two existing corners
* @param ic = index for the insertion point: the corner is inserted AFTER ic
...
...
polygon/PolyLine.h
View file @
ffd3a713
...
...
@@ -81,6 +81,7 @@ public:
void
MoveCorner
(
int
ic
,
int
x
,
int
y
);
void
Close
(
int
style
=
STRAIGHT
,
BOOL
bDraw
=
TRUE
);
void
RemoveContour
(
int
icont
);
void
RemoveAllContours
(
void
);
// drawing functions
void
HighlightSide
(
int
is
);
...
...
@@ -107,6 +108,7 @@ public:
// access functions
int
GetLayer
()
{
return
m_layer
;}
int
GetNumCorners
();
int
GetNumSides
();
int
GetClosed
();
...
...
@@ -125,7 +127,7 @@ public:
id
GetId
();
int
GetSelBoxSize
();
CDisplayList
*
GetDisplayList
(){
return
m_dlist
;
};
int
GetHatch
(){
return
m_HatchStyle
;
}
int
GetHatch
Style
(){
return
m_HatchStyle
;
}
void
SetHatch
(
int
hatch
){
Undraw
();
m_HatchStyle
=
hatch
;
Draw
();
};
void
SetX
(
int
ic
,
int
x
);
void
SetY
(
int
ic
,
int
y
);
...
...
@@ -159,14 +161,14 @@ private:
int
m_Width
;
// line width
int
m_sel_box
;
// corner selection box width/2
int
utility
;
p
rotected
:
p
ublic
:
std
::
vector
<
CPolyPt
>
corner
;
// array of points for corners
std
::
vector
<
int
>
side_style
;
// array of styles for sides
private
:
std
::
vector
<
dl_element
*>
dl_side
;
// graphic elements
std
::
vector
<
dl_element
*>
dl_side_sel
;
std
::
vector
<
dl_element
*>
dl_corner_sel
;
p
rotected
:
p
ublic
:
int
m_HatchStyle
;
// hatch style, see enum above
std
::
vector
<
CSegment
>
m_HatchLines
;
// hatch lines
private
:
...
...
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