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
af445e70
Commit
af445e70
authored
Jan 31, 2008
by
CHARRAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove the old EDGEZONE class. Cleaning code in polyline.x
parent
b62a69fc
Changes
22
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
806 additions
and
917 deletions
+806
-917
change_log.txt
change_log.txt
+7
-0
base_struct.h
include/base_struct.h
+1
-1
pcbstruct.h
include/pcbstruct.h
+3
-0
wxPcbStruct.h
include/wxPcbStruct.h
+9
-10
class_board.cpp
pcbnew/class_board.cpp
+5
-7
class_board.h
pcbnew/class_board.h
+1
-1
class_board_item.cpp
pcbnew/class_board_item.cpp
+10
-7
class_edge_mod.cpp
pcbnew/class_edge_mod.cpp
+6
-64
class_zone.cpp
pcbnew/class_zone.cpp
+379
-345
class_zone.h
pcbnew/class_zone.h
+42
-66
drc.cpp
pcbnew/drc.cpp
+10
-8
drc_stuff.h
pcbnew/drc_stuff.h
+9
-7
edit.cpp
pcbnew/edit.cpp
+2
-2
initpcb.cpp
pcbnew/initpcb.cpp
+0
-3
onleftclick.cpp
pcbnew/onleftclick.cpp
+13
-4
onrightclick.cpp
pcbnew/onrightclick.cpp
+8
-10
tracepcb.cpp
pcbnew/tracepcb.cpp
+2
-10
zone_filling_algorithm.cpp
pcbnew/zone_filling_algorithm.cpp
+6
-1
zones_by_polygon.cpp
pcbnew/zones_by_polygon.cpp
+245
-336
zones_test_and_combine_areas.cpp
pcbnew/zones_test_and_combine_areas.cpp
+38
-17
PolyLine.cpp
polygon/PolyLine.cpp
+8
-14
PolyLine.h
polygon/PolyLine.h
+2
-4
No files found.
change_log.txt
View file @
af445e70
...
...
@@ -5,6 +5,13 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-Jan-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
remove the old EDGEZONE class.
A ZONE_CONTAINER class is used instead to handle the creation of a new zone outline
2008-Jan-29 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+pcbnew:
...
...
include/base_struct.h
View file @
af445e70
...
...
@@ -40,7 +40,7 @@ enum KICAD_T {
TYPEMIRE
,
TYPESCREEN
,
TYPEBLOCK
,
TYPE
EDGEZONE
,
TYPE
ZONE_UNUSED
,
TYPEZONE_EDGE_CORNER
,
TYPEZONE_CONTAINER
,
...
...
include/pcbstruct.h
View file @
af445e70
...
...
@@ -109,6 +109,9 @@
#define ECO2_LAYER (1 << ECO2_N)
#define EDGE_LAYER (1 << EDGE_N)
#define FIRST_NON_COPPER_LAYER ADHESIVE_N_CU
#define LAST_NON_COPPER_LAYER EDGE_N
// extra bits 0xE0000000
/* masques generaux : */
#define ALL_LAYERS 0x1FFFFFFF
...
...
include/wxPcbStruct.h
View file @
af445e70
...
...
@@ -35,7 +35,6 @@ class MODULE;
class
TRACK
;
class
SEGZONE
;
class
SEGVIA
;
class
EDGE_ZONE
;
class
D_PAD
;
class
TEXTE_MODULE
;
class
MIREPCB
;
...
...
@@ -268,13 +267,6 @@ public:
void
Block_Duplicate
(
wxDC
*
DC
);
/**
* Function DelLimitesZone
* deletes the limits of a zone.
* @param DC A wxDC to draw onto.
* @param Redraw If true, means redraw the pcb without the zone limits
*/
void
DelLimitesZone
(
wxDC
*
DC
,
bool
Redraw
);
// layerhandling:
// (See pcbnew/sel_layer.cpp for description of why null_layer parameter is provided)
...
...
@@ -487,14 +479,21 @@ public:
*/
void
Delete_Zone_Fill
(
wxDC
*
DC
,
SEGZONE
*
Track
,
long
aTimestamp
=
0
);
EDGE_ZONE
*
Del_LastSegmEdgeZone
(
wxDC
*
DC
);
/** Function Delete_LastCreatedCorner
* Used only while creating a new zone outline
* Remove and delete the current outline segment in progress
* @return 0 if no corner in list, or corner number
*/
int
Delete_LastCreatedCorner
(
wxDC
*
DC
);
/**
* Function Begin_Zone
* initiates a zone edge creation process,
* or terminates the current zone edge and creates a new zone edge stub
*/
EDGE_ZONE
*
Begin_Zone
(
wxDC
*
DC
);
int
Begin_Zone
(
wxDC
*
DC
);
/**
* Function End_Zone
...
...
pcbnew/class_board.cpp
View file @
af445e70
...
...
@@ -36,7 +36,7 @@ BOARD::BOARD( EDA_BaseStruct* parent, WinEDA_BasePcbFrame* frame ) :
m_Pads
=
NULL
;
// pointeur liste d'acces aux pads
m_Ratsnest
=
NULL
;
// pointeur liste rats
m_LocalRatsnest
=
NULL
;
// pointeur liste rats local
m_Current
LimitZone
=
NULL
;
// pointeur liste des EDEGE_ZONES
m_Current
ZoneContour
=
NULL
;
// This ZONE_CONTAINER handle the zone contour cuurently in progress
// de determination des contours de zone
}
...
...
@@ -61,9 +61,6 @@ BOARD::~BOARD()
m_Zone
->
DeleteStructList
();
m_Zone
=
0
;
m_CurrentLimitZone
->
DeleteStructList
();
m_CurrentLimitZone
=
0
;
MyFree
(
m_Pads
);
m_Pads
=
0
;
...
...
@@ -75,6 +72,9 @@ BOARD::~BOARD()
DeleteMARKERs
();
DeleteZONEOutlines
();
delete
m_CurrentZoneContour
;
m_CurrentZoneContour
=
NULL
;
}
...
...
@@ -588,9 +588,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
++
p
;
break
;
case
TYPEEDGEZONE
:
result
=
IterateForward
(
m_CurrentLimitZone
,
inspector
,
testData
,
p
);
++
p
;
case
TYPEZONE_UNUSED
:
// Unused type
break
;
default
:
// catch EOT or ANY OTHER type here and return.
...
...
pcbnew/class_board.h
View file @
af445e70
...
...
@@ -45,7 +45,7 @@ public:
CHEVELU
*
m_Ratsnest
;
// Rastnest list
CHEVELU
*
m_LocalRatsnest
;
// Rastnest list used while moving a footprint
EDGE_ZONE
*
m_CurrentLimitZone
;
/* zone contour currently in progress */
ZONE_CONTAINER
*
m_CurrentZoneContour
;
// zone contour currently in progress
BOARD
(
EDA_BaseStruct
*
StructFather
,
WinEDA_BasePcbFrame
*
frame
);
~
BOARD
();
...
...
pcbnew/class_board_item.cpp
View file @
af445e70
...
...
@@ -89,8 +89,9 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
break
;
case
TYPEEDGEMODULE
:
{
text
<<
_
(
"Graphic"
)
<<
wxT
(
" "
);
const
wxChar
*
cp
;
wxString
cp
;
switch
(
(
(
EDGE_MODULE
*
)
item
)
->
m_Shape
)
{
...
...
@@ -126,10 +127,12 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
cp
=
wxT
(
"??EDGE??"
);
break
;
}
text
<<
*
cp
<<
_
(
" of "
)
text
<<
cp
;
text
<<
wxT
(
" ("
)
<<
ReturnPcbLayerName
(
((
EDGE_MODULE
*
)
item
)
->
m_Layer
).
Trim
()
<<
wxT
(
")"
);
text
<<
_
(
" of "
)
<<
(
(
MODULE
*
)
GetParent
()
)
->
GetReference
();
break
;
}
case
TYPETRACK
:
// deleting tracks requires all the information we can get to
// disambiguate all the crap under the cursor!
...
...
@@ -239,8 +242,8 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
;
break
;
case
TYPE
EDGEZONE
:
text
<<
_
(
"Edge Zone"
)
<<
_
(
" on "
)
<<
ReturnPcbLayerName
(
item
->
GetLayer
()
).
Trim
();
// @todo: extend text
case
TYPE
ZONE_UNUSED
:
text
<<
wxT
(
"Unused"
);
break
;
default
:
...
...
@@ -318,8 +321,8 @@ const char** BOARD_ITEM::MenuIcon() const
xpm
=
add_mires_xpm
;
break
;
case
TYPE
EDGEZONE
:
xpm
=
show_mod_edge_xpm
;
// @todo: pcb edge xpm
case
TYPE
ZONE_UNUSED
:
xpm
=
0
;
// unused
break
;
default
:
...
...
pcbnew/class_edge_mod.cpp
View file @
af445e70
...
...
@@ -298,70 +298,9 @@ void EDGE_MODULE::Display_Infos( WinEDA_DrawFrame* frame )
}
#if 0 // replaced by Save()
/*****************************************/
int EDGE_MODULE::WriteDescr( FILE* File )
/*****************************************/
/* Write one EDGE_MODULE description
* File must be opened.
*/
{
int NbLigne = 0, ii, * ptr;
switch( m_Shape )
{
case S_SEGMENT:
fprintf( File, "DS %d %d %d %d %d %d\n",
m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y,
m_Width, m_Layer );
NbLigne++;
break;
case S_CIRCLE:
fprintf( File, "DC %d %d %d %d %d %d\n",
m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y,
m_Width, m_Layer );
NbLigne++;
break;
case S_ARC:
fprintf( File, "DA %d %d %d %d %d %d %d\n",
m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y,
m_Angle,
m_Width, m_Layer );
NbLigne++;
break;
case S_POLYGON:
fprintf( File, "DP %d %d %d %d %d %d %d\n",
m_Start0.x, m_Start0.y,
m_End0.x, m_End0.y,
m_PolyCount,
m_Width, m_Layer );
NbLigne++;
for( ii = 0, ptr = m_PolyList; ii < m_PolyCount; ii++ )
{
fprintf( File, "Dl %d %d\n",
*ptr, *(ptr + 1) );
NbLigne++; ptr += 2;
}
break;
default:
DisplayError( NULL, wxT( "Type Edge Module inconnu" ) );
break;
}
return NbLigne;
}
#endif
/*******************************************/
bool
EDGE_MODULE
::
Save
(
FILE
*
aFile
)
const
/*******************************************/
{
int
ret
=
-
1
;
...
...
@@ -514,12 +453,15 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
break
;
}
// C
ontrole d'epaisseur raisonnable
:
// C
heck for a reasonnable width
:
if
(
m_Width
<=
1
)
m_Width
=
1
;
if
(
m_Width
>
MAX_WIDTH
)
m_Width
=
MAX_WIDTH
;
// Check for a reasonnable layer:
if
(
(
m_Layer
<
FIRST_NON_COPPER_LAYER
)
||
(
m_Layer
>
LAST_NON_COPPER_LAYER
)
)
m_Layer
=
SILKSCREEN_N_CMP
;
return
error
;
}
...
...
pcbnew/class_zone.cpp
View file @
af445e70
This diff is collapsed.
Click to expand it.
pcbnew/class_zone.h
View file @
af445e70
...
...
@@ -73,6 +73,19 @@ public:
void
Draw
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
const
wxPoint
&
offset
,
int
draw_mode
);
/**
* Function DrawWhileCreateOutline
* Draws the zone outline when ir is created.
* The moving edges are in XOR graphic mode, old segment in draw_mode graphic mode (usually GR_OR)
* The closing edge has its owm shape
* @param panel = current Draw Panel
* @param DC = current Device Context
* @param draw_mode = draw mode: OR, XOR ..
*/
void
DrawWhileCreateOutline
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
int
draw_mode
=
GR_OR
);
int
GetNet
(
void
)
const
{
return
m_NetCode
;
...
...
@@ -158,73 +171,36 @@ public:
{
return
wxT
(
"ZONE_CONTAINER"
);
}
};
/*******************/
/* class EDGE_ZONE */
/*******************/
/* Classe used temporary to create a zone outline.
*
* TODO: remove this class and use only the ZONE_CONTAINER::m_Poly
* to create outlines
/** Acces to m_Poly parameters
*/
class
EDGE_ZONE
:
public
DRAWSEGMENT
{
private
:
int
m_NetCode
;
public
:
EDGE_ZONE
(
BOARD
*
StructFather
);
~
EDGE_ZONE
();
EDGE_ZONE
*
Next
()
int
GetNumCorners
(
void
)
{
return
(
EDGE_ZONE
*
)
Pnext
;
return
m_Poly
->
GetNumCorners
()
;
}
EDGE_ZONE
*
Back
(
)
void
RemoveAllContours
(
void
)
{
return
(
EDGE_ZONE
*
)
Pback
;
m_Poly
->
RemoveAllContours
()
;
}
int
GetNet
(
void
)
const
wxPoint
GetCornerPosition
(
int
aCornerIndex
)
{
return
m_NetCode
;
return
wxPoint
(
m_Poly
->
GetX
(
aCornerIndex
),
m_Poly
->
GetY
(
aCornerIndex
))
;
}
void
SetNet
(
int
anet_code
)
void
SetCornerPosition
(
int
aCornerIndex
,
wxPoint
new_pos
)
{
m_NetCode
=
anet_code
;
m_Poly
->
SetX
(
aCornerIndex
,
new_pos
.
x
);
m_Poly
->
SetY
(
aCornerIndex
,
new_pos
.
y
);
}
/**
* Function Display_Infos
* has knowledge about the frame and how and where to put status information
* about this object into the frame's message panel.
* Is virtual from EDA_BaseStruct.
* @param frame A WinEDA_BasePcbFrame in which to print status information.
*/
void
Display_Infos
(
WinEDA_DrawFrame
*
frame
);
/**
* Function Save
* 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
;
/**
* Function GetClass
* returns the class name.
* @return wxString
*/
wxString
GetClass
()
const
void
AppendCorner
(
wxPoint
position
)
{
return
wxT
(
"EDGE_ZONE"
);
m_Poly
->
AppendCorner
(
position
.
x
,
position
.
y
);
}
};
#endif // #ifndef CLASS_ZONE_H
pcbnew/drc.cpp
View file @
af445e70
...
...
@@ -157,22 +157,23 @@ int DRC::Drc( TRACK* aRefSegm, TRACK* aList )
}
/*********************************************/
int
DRC
::
Drc
(
const
EDGE_ZONE
*
aEdge
)
/*********************************************/
/*********************************************
*****************
/
int
DRC
::
Drc
(
ZONE_CONTAINER
*
aArea
,
int
CornerIndex
)
/*********************************************
****************
/
/**
* Function Drc
* tests the
current EDGE_ZONE segment
and returns the result and displays the error
* tests the
outline segment starting at CornerIndex
and returns the result and displays the error
* in the status panel only if one exists.
* Test Edge inside other areas
* Test Edge too close other areas
* @param aEdge The current segment to test.
* @param aEdge The areaparent which contains the corner.
* @param CornerIndex The starting point of the segment to test.
* @return int - BAD_DRC (1) if DRC error or OK_DRC (0) if OK
*/
{
updatePointers
();
if
(
!
doEdgeZoneDrc
(
a
Edge
)
)
if
(
!
doEdgeZoneDrc
(
a
Area
,
CornerIndex
)
)
{
wxASSERT
(
m_currentMarker
);
m_currentMarker
->
Display_Infos
(
m_mainWindow
);
...
...
@@ -461,9 +462,10 @@ MARKER* DRC::fillMarker( ZONE_CONTAINER * aArea, int aErrorCode, MARKER* fillMe
return
fillMe
;
}
MARKER
*
DRC
::
fillMarker
(
const
EDGE_ZONE
*
aEdge
,
const
wxPoint
&
aPos
,
int
aErrorCode
,
MARKER
*
fillMe
)
MARKER
*
DRC
::
fillMarker
(
const
ZONE_CONTAINER
*
aArea
,
const
wxPoint
&
aPos
,
int
aErrorCode
,
MARKER
*
fillMe
)
{
wxString
textA
=
a
Edge
->
MenuText
(
m_pcb
);
wxString
textA
=
a
Area
->
MenuText
(
m_pcb
);
wxPoint
posA
=
aPos
;
...
...
pcbnew/drc_stuff.h
View file @
af445e70
...
...
@@ -373,7 +373,7 @@ private:
* @param fillMe A MARKER* which is to be filled in, or NULL if one is to
* first be allocated, then filled.
*/
MARKER
*
fillMarker
(
const
EDGE_ZONE
*
aEdge
,
const
wxPoint
&
aPos
,
int
aErrorCode
,
MARKER
*
fillMe
);
MARKER
*
fillMarker
(
const
ZONE_CONTAINER
*
aArea
,
const
wxPoint
&
aPos
,
int
aErrorCode
,
MARKER
*
fillMe
);
//-----<categorical group tests>-----------------------------------------
...
...
@@ -413,14 +413,15 @@ private:
/**
* Function doEdgeZoneDrc
* tests
the current EDGE_ZONE segment
:
* tests
a segment in ZONE_CONTAINER * aArea
:
* Test Edge inside other areas
* Test Edge too close other areas
* @param aEdge The current segment to test.
* @param aArea The current area.
* @param aCornerIndex The first corner of the segment to test.
* @return bool - false if DRC error or true if OK
*/
bool
doEdgeZoneDrc
(
const
EDGE_ZONE
*
aEdge
);
bool
doEdgeZoneDrc
(
ZONE_CONTAINER
*
aArea
,
int
aCornerIndex
);
//-----<single tests>----------------------------------------------
...
...
@@ -496,14 +497,15 @@ public:
/**
* Function Drc
* tests the
current EDGE_ZONE segment
and returns the result and displays the error
* tests the
outline segment starting at CornerIndex
and returns the result and displays the error
* in the status panel only if one exists.
* Test Edge inside other areas
* Test Edge too close other areas
* @param aEdge The current segment to test.
* @param aEdge The areaparent which contains the corner.
* @param CornerIndex The starting point of the segment to test.
* @return int - BAD_DRC (1) if DRC error or OK_DRC (0) if OK
*/
int
Drc
(
const
EDGE_ZONE
*
aEdge
);
int
Drc
(
ZONE_CONTAINER
*
aArea
,
int
CornerIndex
);
/**
* Function DrcBlind
...
...
pcbnew/edit.cpp
View file @
af445e70
...
...
@@ -267,7 +267,6 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
SetToolID
(
id
,
wxCURSOR_PENCIL
,
_
(
"Add Zones"
)
);
if
(
!
DisplayOpt
.
DisplayZones
)
DisplayInfo
(
this
,
_
(
"Warning: Display Zone is OFF!!!"
)
);
DelLimitesZone
(
&
dc
,
TRUE
);
if
(
!
g_HightLigt_Status
&&
(
g_HightLigth_NetCode
>
0
)
)
Hight_Light
(
&
dc
);
break
;
...
...
@@ -821,7 +820,8 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel
->
MouseToCursorSchema
();
if
(
GetCurItem
()
&&
(
GetCurItem
()
->
m_Flags
&
IS_NEW
)
)
{
SetCurItem
(
Del_LastSegmEdgeZone
(
&
dc
)
);
if
(
Delete_LastCreatedCorner
(
&
dc
)
==
0
)
// No more segment in outline,
SetCurItem
(
NULL
);
}
break
;
...
...
pcbnew/initpcb.cpp
View file @
af445e70
...
...
@@ -145,8 +145,6 @@ bool WinEDA_BasePcbFrame::Clear_Pcb( bool query )
m_Pcb
->
m_Zone
=
NULL
;
m_Pcb
->
m_NbSegmZone
=
0
;
DelLimitesZone
(
NULL
,
FALSE
);
m_Pcb
->
DeleteMARKERs
();
m_Pcb
->
DeleteZONEOutlines
();
...
...
@@ -222,7 +220,6 @@ void WinEDA_PcbFrame::Erase_Zones( bool query )
m_Pcb
->
m_NbSegmZone
=
0
;
}
DelLimitesZone
(
NULL
,
FALSE
);
m_Pcb
->
DeleteZONEOutlines
();
GetScreen
()
->
SetModify
();
...
...
pcbnew/onleftclick.cpp
View file @
af445e70
...
...
@@ -39,6 +39,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
switch
(
DrawStruct
->
Type
()
)
{
case
TYPEZONE_CONTAINER
:
if
(
(
DrawStruct
->
m_Flags
&
IS_NEW
)
)
Begin_Zone
(
DC
);
else
End_Move_Zone_Corner_Or_Outlines
(
DC
,
(
ZONE_CONTAINER
*
)
DrawStruct
);
exit
=
true
;
break
;
...
...
@@ -220,13 +223,19 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case
ID_PCB_ZONES_BUTT
:
if
(
(
DrawStruct
==
NULL
)
||
(
DrawStruct
->
m_Flags
==
0
)
)
{
GetScreen
()
->
SetCurItem
(
DrawStruct
=
Begin_Zone
(
DC
)
);
if
(
Begin_Zone
(
DC
)
)
{
DrawStruct
=
m_Pcb
->
m_CurrentZoneContour
;
GetScreen
()
->
SetCurItem
(
DrawStruct
);
}
}
else
if
(
DrawStruct
&&
(
DrawStruct
->
Type
()
==
TYPE
EDGEZONE
)
&&
(
DrawStruct
->
Type
()
==
TYPE
ZONE_CONTAINER
)
&&
(
DrawStruct
->
m_Flags
&
IS_NEW
)
)
{
GetScreen
()
->
SetCurItem
(
DrawStruct
=
Begin_Zone
(
DC
)
);
Begin_Zone
(
DC
);
DrawStruct
=
m_Pcb
->
m_CurrentZoneContour
;
GetScreen
()
->
SetCurItem
(
DrawStruct
);
}
else
DisplayError
(
this
,
wxT
(
"Edit: zone internal error"
)
);
...
...
pcbnew/onrightclick.cpp
View file @
af445e70
...
...
@@ -277,20 +277,18 @@ bool WinEDA_PcbFrame::OnRightClick( const wxPoint& aMousePos, wxMenu* aPopMenu )
case
TYPEZONE
:
// Item used to fill a zone
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_DELETE_ZONE
,
_
(
"Delete Zone"
),
delete_xpm
);
_
(
"Delete Zone
Filling
"
),
delete_xpm
);
break
;
case
TYPE
EDGEZONE
:
// Graphic Item used to create a new zone outline
case
TYPE
ZONE_CONTAINER
:
// Item used to handle a zone area (outlines, holes ...)
if
(
flags
&
IS_NEW
)
{
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_STOP_CURRENT_EDGE_ZONE
,
_
(
"End edge zone"
),
apply_xpm
);
}
_
(
"Close Zone Outline"
),
apply_xpm
);
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_DELETE_ZONE_LAST_CREATED_CORNER
,
_
(
"Delete Current Edge"
),
delete_xpm
);
break
;
case
TYPEZONE_CONTAINER
:
// Item used to handle a zone area (outlines, holes ...)
_
(
"Delete Last Corner"
),
delete_xpm
);
}
else
createPopUpMenuForZones
(
(
ZONE_CONTAINER
*
)
item
,
aPopMenu
);
break
;
...
...
pcbnew/tracepcb.cpp
View file @
af445e70
...
...
@@ -176,18 +176,10 @@ void WinEDA_PcbFrame::Trace_Pcb( wxDC* DC, int mode )
if
(
g_HightLigt_Status
)
DrawHightLight
(
DC
,
g_HightLigth_NetCode
);
EDGE_ZONE
*
segment
;
for
(
segment
=
m_Pcb
->
m_CurrentLimitZone
;
segment
;
segment
=
segment
->
Next
()
)
{
if
(
segment
->
m_Flags
&
IS_MOVED
)
continue
;
Trace_DrawSegmentPcb
(
DrawPanel
,
DC
,
segment
,
mode
);
}
for
(
unsigned
ii
=
0
;
ii
<
m_Pcb
->
m_ZoneDescriptorList
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
{
ZONE_CONTAINER
*
edge_zone
=
m_Pcb
->
m_ZoneDescriptorList
[
ii
]
;
ZONE_CONTAINER
*
edge_zone
=
m_Pcb
->
GetArea
(
ii
)
;
edge_zone
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
mode
);
}
...
...
pcbnew/zone_filling_algorithm.cpp
View file @
af445e70
...
...
@@ -196,7 +196,12 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose )
if
(
cells_count
==
0
)
{
if
(
verbose
)
DisplayError
(
frame
,
_
(
"No pads or starting point found to fill this zone outline"
)
);
{
msg
=
_
(
"No pads or starting point found to fill this zone outline"
);
msg
<<
wxT
(
"
\n
"
);
msg
<<
MenuText
(
frame
->
m_Pcb
);
DisplayError
(
frame
,
msg
);
}
error_level
=
2
;
goto
end_of_zone_fill
;
}
...
...
pcbnew/zones_by_polygon.cpp
View file @
af445e70
This diff is collapsed.
Click to expand it.
pcbnew/zones_test_and_combine_areas.cpp
View file @
af445e70
...
...
@@ -65,8 +65,7 @@ ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, int layer, int x, int
else
m_ZoneDescriptorList
.
push_back
(
new_area
);
new_area
->
m_Poly
->
Start
(
layer
,
1
,
10
*
NM_PER_MIL
,
x
,
y
,
hatch
);
new_area
->
m_Poly
->
Start
(
layer
,
x
,
y
,
hatch
);
return
new_area
;
}
...
...
@@ -744,7 +743,7 @@ int BOARD::CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combi
if
(
i
==
0
)
{
area_ref
->
m_Poly
->
Start
(
area_ref
->
GetLayer
(
),
0
,
0
,
x
,
y
,
area_ref
->
m_Poly
->
GetHatchStyle
()
);
),
x
,
y
,
area_ref
->
m_Poly
->
GetHatchStyle
()
);
}
else
area_ref
->
m_Poly
->
AppendCorner
(
x
,
y
);
...
...
@@ -997,38 +996,60 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
/**
* Function doEdgeZoneDrc
* tests the current EDGE_ZONE segment and returns the result and displays the error
* in the status panel only if one exists.
* tests a segment in ZONE_CONTAINER * aArea:
* Test Edge inside other areas
* Test Edge too close other areas
* @param aEdge The current segment to test.
* @param aArea The current area.
* @param aCornerIndex The first corner of the segment to test.
* @return bool - false if DRC error or true if OK
*/
bool
DRC
::
doEdgeZoneDrc
(
const
EDGE_ZONE
*
aEdge
)
bool
DRC
::
doEdgeZoneDrc
(
ZONE_CONTAINER
*
aArea
,
int
aCornerIndex
)
{
wxString
str
;
wxPoint
start
=
aArea
->
GetCornerPosition
(
aCornerIndex
);
wxPoint
end
;
// Search the end point of the edge starting at aCornerIndex
if
(
aArea
->
m_Poly
->
corner
[
aCornerIndex
].
end_contour
==
FALSE
&&
aCornerIndex
<
(
aArea
->
GetNumCorners
()
-
1
)
)
{
end
=
aArea
->
GetCornerPosition
(
aCornerIndex
+
1
);
}
else
// aCornerIndex is the last corner of an outline.
// the corresponding end point of the segment is the first corner of the outline
{
int
ii
=
aCornerIndex
-
1
;
end
=
aArea
->
GetCornerPosition
(
ii
);
while
(
ii
>=
0
)
{
if
(
aArea
->
m_Poly
->
corner
[
ii
].
end_contour
)
break
;
end
=
aArea
->
GetCornerPosition
(
ii
);
ii
--
;
}
}
// iterate through all areas
for
(
int
ia2
=
0
;
ia2
<
m_pcb
->
GetAreaCount
();
ia2
++
)
{
ZONE_CONTAINER
*
Area_To_Test
=
m_pcb
->
GetArea
(
ia2
);
// test for same layer
if
(
Area_To_Test
->
GetLayer
()
!=
a
Edge
->
GetLayer
()
)
if
(
Area_To_Test
->
GetLayer
()
!=
a
Area
->
GetLayer
()
)
continue
;
// Test for same net
if
(
(
a
Edge
->
GetNet
()
==
Area_To_Test
->
GetNet
())
&&
(
aEdge
->
GetNet
()
>
0
)
)
if
(
(
a
Area
->
GetNet
()
==
Area_To_Test
->
GetNet
())
&&
(
aArea
->
GetNet
()
>
0
)
)
continue
;
// test for ending line inside Area_To_Test
int
x
=
aEdge
->
m_E
nd
.
x
;
int
y
=
aEdge
->
m_E
nd
.
y
;
int
x
=
e
nd
.
x
;
int
y
=
e
nd
.
y
;
if
(
Area_To_Test
->
m_Poly
->
TestPointInside
(
x
,
y
)
)
{
// COPPERAREA_COPPERAREA error: corner inside copper area
m_currentMarker
=
fillMarker
(
a
Edge
,
wxPoint
(
x
,
y
),
m_currentMarker
=
fillMarker
(
a
Area
,
wxPoint
(
x
,
y
),
COPPERAREA_INSIDE_COPPERAREA
,
m_currentMarker
);
return
false
;
...
...
@@ -1036,10 +1057,10 @@ bool DRC::doEdgeZoneDrc( const EDGE_ZONE* aEdge )
// now test spacing between areas
int
astyle
=
CPolyLine
::
STRAIGHT
;
int
ax1
=
aEdge
->
m_S
tart
.
x
;
int
ay1
=
aEdge
->
m_S
tart
.
y
;
int
ax2
=
aEdge
->
m_E
nd
.
x
;
int
ay2
=
aEdge
->
m_E
nd
.
y
;
int
ax1
=
s
tart
.
x
;
int
ay1
=
s
tart
.
y
;
int
ax2
=
e
nd
.
x
;
int
ay2
=
e
nd
.
y
;
for
(
int
icont2
=
0
;
icont2
<
Area_To_Test
->
m_Poly
->
GetNumContours
();
icont2
++
)
{
int
ic_start2
=
Area_To_Test
->
m_Poly
->
GetContourStart
(
icont2
);
...
...
@@ -1070,7 +1091,7 @@ bool DRC::doEdgeZoneDrc( const EDGE_ZONE* aEdge )
if
(
d
<
g_DesignSettings
.
m_ZoneClearence
)
{
// COPPERAREA_COPPERAREA error : edge intersect or too close
m_currentMarker
=
fillMarker
(
a
Edge
,
wxPoint
(
x
,
y
),
m_currentMarker
=
fillMarker
(
a
Area
,
wxPoint
(
x
,
y
),
COPPERAREA_CLOSE_TO_COPPERAREA
,
m_currentMarker
);
return
false
;
...
...
polygon/PolyLine.cpp
View file @
af445e70
...
...
@@ -22,7 +22,7 @@ using namespace std;
CPolyLine
::
CPolyLine
()
{
m_HatchStyle
=
0
;
m_
sel_box
=
0
;
m_
Width
=
0
;
utility
=
0
;
m_gpc_poly
=
new
gpc_polygon
;
m_gpc_poly
->
num_contours
=
0
;
...
...
@@ -72,7 +72,7 @@ int CPolyLine::NormalizeWithGpc( std::vector<CPolyLine*> * pa, bool bRetainArcs
int
x
=
to_int
(((
m_gpc_poly
->
contour
)[
ic
].
vertex
)[
i
].
x
);
int
y
=
to_int
(((
m_gpc_poly
->
contour
)[
ic
].
vertex
)[
i
].
y
);
if
(
i
==
0
)
Start
(
m_layer
,
m_Width
,
m_sel_box
,
x
,
y
,
m_HatchStyle
);
Start
(
m_layer
,
x
,
y
,
m_HatchStyle
);
else
AppendCorner
(
x
,
y
,
STRAIGHT
,
FALSE
);
}
...
...
@@ -89,7 +89,7 @@ int CPolyLine::NormalizeWithGpc( std::vector<CPolyLine*> * pa, bool bRetainArcs
int
x
=
to_int
(((
m_gpc_poly
->
contour
)[
ic
].
vertex
)[
i
].
x
);
int
y
=
to_int
(((
m_gpc_poly
->
contour
)[
ic
].
vertex
)[
i
].
y
);
if
(
i
==
0
)
poly
->
Start
(
m_layer
,
m_Width
,
m_sel_box
,
x
,
y
,
m_HatchStyle
);
poly
->
Start
(
m_layer
,
x
,
y
,
m_HatchStyle
);
else
poly
->
AppendCorner
(
x
,
y
,
STRAIGHT
,
FALSE
);
}
...
...
@@ -199,10 +199,7 @@ void CPolyLine::ClipPhpPolygon( int php_op, CPolyLine * poly )
do
{
vertex
*
v
=
p
->
getFirst
();
Start
(
m_layer
,
m_Width
,
m_sel_box
,
to_int
(
v
->
X
()
*
DENOM
),
to_int
(
v
->
Y
()
*
DENOM
),
m_HatchStyle
);
Start
(
m_layer
,
to_int
(
v
->
X
()
*
DENOM
),
to_int
(
v
->
Y
()
*
DENOM
),
m_HatchStyle
);
do
{
vertex
*
n
=
v
->
Next
();
...
...
@@ -606,12 +603,9 @@ int CPolyLine::RestoreArcs( std::vector<CArc> * arc_array, std::vector<CPolyLine
// id.i = index to area
// ptr = pointer to net
//
void
CPolyLine
::
Start
(
int
layer
,
int
w
,
int
sel_box
,
int
x
,
int
y
,
int
hatch
)
void
CPolyLine
::
Start
(
int
layer
,
int
x
,
int
y
,
int
hatch
)
{
m_layer
=
layer
;
m_Width
=
w
;
m_sel_box
=
sel_box
;
m_HatchStyle
=
hatch
;
CPolyPt
poly_pt
(
x
,
y
);
poly_pt
.
end_contour
=
FALSE
;
...
...
@@ -1002,7 +996,7 @@ void CPolyLine::Hatch()
int
layer
=
m_layer
;
// if( /*m_dlist && */GetClosed() )
if
(
GetClosed
()
)
// If not closed, the poly is beeing created and not finalised. Not not hatch
{
enum
{
MAXPTS
=
100
,
...
...
@@ -1082,7 +1076,7 @@ void CPolyLine::Hatch()
{
double
x
,
y
,
x2
,
y2
;
int
ok
;
if
(
corner
[
ic
].
end_contour
)
if
(
corner
[
ic
].
end_contour
||
(
ic
==
(
int
)(
corner
.
size
()
-
1
))
)
{
ok
=
FindLineSegmentIntersection
(
a
,
slope
,
corner
[
ic
].
x
,
corner
[
ic
].
y
,
...
...
@@ -1396,7 +1390,7 @@ CPolyLine * CPolyLine::MakePolylineForPad( int type, int x, int y, int w, int l,
}
if
(
type
==
PAD_ROUND
)
{
poly
->
Start
(
0
,
0
,
0
,
x
-
dx
,
y
,
0
);
poly
->
Start
(
0
,
x
-
dx
,
y
,
0
);
poly
->
AppendCorner
(
x
,
y
+
dy
,
ARC_CW
,
0
);
poly
->
AppendCorner
(
x
+
dx
,
y
,
ARC_CW
,
0
);
poly
->
AppendCorner
(
x
,
y
-
dy
,
ARC_CW
,
0
);
...
...
polygon/PolyLine.h
View file @
af445e70
...
...
@@ -69,8 +69,7 @@ public:
~
CPolyLine
();
// functions for modifying polyline
void
Start
(
int
layer
,
int
w
,
int
sel_box
,
int
x
,
int
y
,
int
hatch
);
void
Start
(
int
layer
,
int
x
,
int
y
,
int
hatch
);
void
AppendCorner
(
int
x
,
int
y
,
int
style
=
STRAIGHT
,
bool
bDraw
=
TRUE
);
void
InsertCorner
(
int
ic
,
int
x
,
int
y
);
void
DeleteCorner
(
int
ic
,
bool
bDraw
=
TRUE
);
...
...
@@ -138,8 +137,7 @@ public:
private
:
int
m_layer
;
// layer to draw on
int
m_Width
;
// line width
int
m_sel_box
;
// corner selection box width/2
int
m_Width
;
// lines width when drawing. Provided but not really used
int
utility
;
public
:
std
::
vector
<
CPolyPt
>
corner
;
// array of points for corners
...
...
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