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
2455a6cc
Commit
2455a6cc
authored
Jun 02, 2012
by
Marco Mattila
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Do some ZONE_CONTAINED encapsulation.
parent
57acee0d
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
79 additions
and
41 deletions
+79
-41
3d_draw.cpp
3d-viewer/3d_draw.cpp
+14
-11
class_zone.h
pcbnew/class_zone.h
+38
-10
edit.cpp
pcbnew/edit.cpp
+1
-1
kicad_plugin.cpp
pcbnew/kicad_plugin.cpp
+1
-1
legacy_plugin.cpp
pcbnew/legacy_plugin.cpp
+4
-2
onrightclick.cpp
pcbnew/onrightclick.cpp
+1
-1
plot_rtn.cpp
pcbnew/plot_rtn.cpp
+3
-2
zones_by_polygon_fill_functions.cpp
pcbnew/zones_by_polygon_fill_functions.cpp
+1
-1
zones_convert_brd_items_to_polygons_with_Boost.cpp
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
+9
-6
zones_polygons_test_connections.cpp
pcbnew/zones_polygons_test_connections.cpp
+7
-6
No files found.
3d-viewer/3d_draw.cpp
View file @
2455a6cc
...
...
@@ -258,7 +258,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
if
(
curr_zone
->
m_FillMode
==
0
)
{
// solid polygons only are used to fill areas
if
(
curr_zone
->
m_FilledPolysList
.
size
()
>
3
)
if
(
curr_zone
->
GetFilledPolysList
()
.
size
()
>
3
)
{
Draw3D_SolidPolygonsInZones
(
curr_zone
);
}
...
...
@@ -286,14 +286,16 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
{
ZONE_CONTAINER
*
zone
=
pcb
->
GetArea
(
ii
);
if
(
zone
->
m_FilledPolysList
.
size
()
==
0
)
std
::
vector
<
CPolyPt
>
polysList
=
zone
->
GetFilledPolysList
();
if
(
polysList
.
size
()
==
0
)
continue
;
if
(
zone
->
m_ZoneMinThickness
<=
1
)
continue
;
int
imax
=
zone
->
m_FilledP
olysList
.
size
()
-
1
;
CPolyPt
*
firstcorner
=
&
zone
->
m_FilledP
olysList
[
0
];
int
imax
=
p
olysList
.
size
()
-
1
;
CPolyPt
*
firstcorner
=
&
p
olysList
[
0
];
CPolyPt
*
begincorner
=
firstcorner
;
SEGZONE
dummysegment
(
pcb
);
dummysegment
.
SetLayer
(
zone
->
GetLayer
()
);
...
...
@@ -301,7 +303,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
for
(
int
ic
=
1
;
ic
<=
imax
;
ic
++
)
{
CPolyPt
*
endcorner
=
&
zone
->
m_FilledP
olysList
[
ic
];
CPolyPt
*
endcorner
=
&
p
olysList
[
ic
];
if
(
begincorner
->
utility
==
0
)
{
...
...
@@ -330,7 +332,7 @@ GLuint EDA_3D_CANVAS::CreateDrawGL_List()
ic
++
;
if
(
ic
<
imax
-
1
)
begincorner
=
firstcorner
=
&
zone
->
m_FilledP
olysList
[
ic
];
begincorner
=
firstcorner
=
&
p
olysList
[
ic
];
}
else
{
...
...
@@ -440,7 +442,8 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
// Draw solid areas contained in this zone
int
StartContour
=
1
;
for
(
unsigned
ii
=
0
;
ii
<
aZone
->
m_FilledPolysList
.
size
();
ii
++
)
std
::
vector
<
CPolyPt
>
polysList
=
aZone
->
GetFilledPolysList
();
for
(
unsigned
ii
=
0
;
ii
<
polysList
.
size
();
ii
++
)
{
if
(
StartContour
==
1
)
{
...
...
@@ -449,11 +452,11 @@ void EDA_3D_CANVAS::Draw3D_SolidPolygonsInZones( ZONE_CONTAINER* aZone )
StartContour
=
0
;
}
v_data
[
0
]
=
aZone
->
m_FilledP
olysList
[
ii
].
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
v_data
[
1
]
=
-
aZone
->
m_FilledP
olysList
[
ii
].
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
gluTessVertex
(
tess
,
v_data
,
&
aZone
->
m_FilledP
olysList
[
ii
]
);
v_data
[
0
]
=
p
olysList
[
ii
].
x
*
g_Parm_3D_Visu
.
m_BoardScale
;
v_data
[
1
]
=
-
p
olysList
[
ii
].
y
*
g_Parm_3D_Visu
.
m_BoardScale
;
gluTessVertex
(
tess
,
v_data
,
&
p
olysList
[
ii
]
);
if
(
aZone
->
m_FilledP
olysList
[
ii
].
end_contour
==
1
)
if
(
p
olysList
[
ii
].
end_contour
==
1
)
{
gluTessEndContour
(
tess
);
gluTessEndPolygon
(
tess
);
...
...
pcbnew/class_zone.h
View file @
2455a6cc
...
...
@@ -457,6 +457,34 @@ public:
*/
bool
IsSame
(
const
ZONE_CONTAINER
&
aZoneToCompare
);
/**
* Function ClearFilledPolysList
* clears the list of filled polygons.
*/
void
ClearFilledPolysList
()
{
m_FilledPolysList
.
clear
();
}
/**
* Function GetFilledPolysList
* returns a reference to the list of filled polygons.
* @return Reference to the list of filled polygons.
*/
const
std
::
vector
<
CPolyPt
>&
GetFilledPolysList
()
const
{
return
m_FilledPolysList
;
}
/**
* Function AddFilledPolysList
* sets the list of filled polygons.
*/
void
AddFilledPolysList
(
std
::
vector
<
CPolyPt
>&
aPolysList
)
{
m_FilledPolysList
=
aPolysList
;
}
/**
* Function GetSmoothedPoly
* returns a pointer to the corner-smoothed version of
...
...
@@ -522,16 +550,6 @@ public:
// true when a zone was filled, false after deleting the filled areas
bool
m_IsFilled
;
/* set of filled polygons used to draw a zone as a filled area.
* from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
* (they are* all in one piece) In very simple cases m_FilledPolysList is same
* as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is
* a polygon equivalent to m_Poly, without holes but with extra outline segment
* connecting "holes" with external main outline. In complex cases an outline
* described by m_Poly can have many filled areas
*/
std
::
vector
<
CPolyPt
>
m_FilledPolysList
;
/* set of segments used to fill area, when fill zone by segment is used.
* ( m_FillMode == 1 )
* in this case segments have m_ZoneMinThickness width
...
...
@@ -549,6 +567,16 @@ private:
// if priorities are equal, a DRC error is set
unsigned
m_priority
;
ZoneConnection
m_PadConnection
;
/* set of filled polygons used to draw a zone as a filled area.
* from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole
* (they are* all in one piece) In very simple cases m_FilledPolysList is same
* as m_Poly. In less simple cases (when m_Poly has holes) m_FilledPolysList is
* a polygon equivalent to m_Poly, without holes but with extra outline segment
* connecting "holes" with external main outline. In complex cases an outline
* described by m_Poly can have many filled areas
*/
std
::
vector
<
CPolyPt
>
m_FilledPolysList
;
};
...
...
pcbnew/edit.cpp
View file @
2455a6cc
...
...
@@ -579,7 +579,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
// Remove filled areas in zone
ZONE_CONTAINER
*
zone_container
=
GetBoard
()
->
GetArea
(
ii
);
zone_container
->
m_FilledPolysList
.
clear
();
zone_container
->
ClearFilledPolysList
();
}
SetCurItem
(
NULL
);
// CurItem might be deleted by this command, clear the pointer
...
...
pcbnew/kicad_plugin.cpp
View file @
2455a6cc
...
...
@@ -970,7 +970,7 @@ void PCB_IO::format( ZONE_CONTAINER* aZone, OUTPUTFORMATTER* aFormatter, int aNe
}
// Save the PolysList
const
std
::
vector
<
CPolyPt
>&
fv
=
aZone
->
m_FilledPolysList
;
const
std
::
vector
<
CPolyPt
>&
fv
=
aZone
->
GetFilledPolysList
()
;
if
(
fv
.
size
()
)
{
...
...
pcbnew/legacy_plugin.cpp
View file @
2455a6cc
...
...
@@ -2258,6 +2258,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
else
if
(
TESTLINE
(
"$POLYSCORNERS"
)
)
{
// Read the PolysList (polygons used for fill areas in the zone)
std
::
vector
<
CPolyPt
>
polysList
;
while
(
READLINE
(
m_reader
)
)
{
...
...
@@ -2273,8 +2274,9 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
bool
end_contour
=
intParse
(
data
,
&
data
);
// end_countour was a bool when file saved, so '0' or '1' here
int
utility
=
intParse
(
data
);
zc
->
m_FilledP
olysList
.
push_back
(
CPolyPt
(
x
,
y
,
end_contour
,
utility
)
);
p
olysList
.
push_back
(
CPolyPt
(
x
,
y
,
end_contour
,
utility
)
);
}
zc
->
AddFilledPolysList
(
polysList
);
}
else
if
(
TESTLINE
(
"$FILLSEGMENTS"
)
)
...
...
@@ -3569,7 +3571,7 @@ void LEGACY_PLUGIN::saveZONE_CONTAINER( const ZONE_CONTAINER* me ) const
}
// Save the PolysList
const
CPOLY_PTS
&
fv
=
me
->
m_FilledPolysList
;
const
CPOLY_PTS
&
fv
=
me
->
GetFilledPolysList
()
;
if
(
fv
.
size
()
)
{
fprintf
(
m_fp
,
"$POLYSCORNERS
\n
"
);
...
...
pcbnew/onrightclick.cpp
View file @
2455a6cc
...
...
@@ -631,7 +631,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu*
AddMenuItem
(
zones_menu
,
ID_POPUP_PCB_FILL_ZONE
,
_
(
"Fill Zone"
),
KiBitmap
(
fill_zone_xpm
)
);
if
(
edge_zone
->
m_FilledPolysList
.
size
()
>
0
)
if
(
edge_zone
->
GetFilledPolysList
()
.
size
()
>
0
)
{
AddMenuItem
(
zones_menu
,
ID_POPUP_PCB_REMOVE_FILLED_AREAS_IN_CURRENT_ZONE
,
_
(
"Remove Filled Areas in Zone"
),
KiBitmap
(
zone_unfill_xpm
)
);
...
...
pcbnew/plot_rtn.cpp
View file @
2455a6cc
...
...
@@ -523,7 +523,8 @@ void PlotTextePcb( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, TEXTE_PC
*/
void
PlotFilledAreas
(
PLOTTER
*
aPlotter
,
const
PCB_PLOT_PARAMS
&
aPlotOpts
,
ZONE_CONTAINER
*
aZone
,
EDA_DRAW_MODE_T
trace_mode
)
{
unsigned
imax
=
aZone
->
m_FilledPolysList
.
size
();
std
::
vector
<
CPolyPt
>
polysList
=
aZone
->
GetFilledPolysList
();
unsigned
imax
=
polysList
.
size
();
if
(
imax
==
0
)
// Nothing to draw
return
;
...
...
@@ -540,7 +541,7 @@ void PlotFilledAreas( PLOTTER* aPlotter, const PCB_PLOT_PARAMS& aPlotOpts, ZONE_
*/
for
(
unsigned
ic
=
0
;
ic
<
imax
;
ic
++
)
{
CPolyPt
*
corner
=
&
aZone
->
m_FilledP
olysList
[
ic
];
CPolyPt
*
corner
=
&
p
olysList
[
ic
];
cornerList
.
push_back
(
wxPoint
(
corner
->
x
,
corner
->
y
)
);
if
(
corner
->
end_contour
)
// Plot the current filled area outline
...
...
pcbnew/zones_by_polygon_fill_functions.cpp
View file @
2455a6cc
...
...
@@ -105,7 +105,7 @@ int PCB_EDIT_FRAME::Fill_Zone( ZONE_CONTAINER* aZone )
wxBusyCursor
dummy
;
// Shows an hourglass cursor (removed by its destructor)
aZone
->
m_FilledPolysList
.
clear
();
aZone
->
ClearFilledPolysList
();
aZone
->
UnFill
();
aZone
->
BuildFilledPolysListData
(
GetBoard
()
);
...
...
pcbnew/zones_convert_brd_items_to_polygons_with_Boost.cpp
View file @
2455a6cc
...
...
@@ -471,6 +471,7 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
KPolygonSet
&
aKPolyList
)
{
int
count
=
0
;
std
::
vector
<
CPolyPt
>
polysList
;
for
(
unsigned
ii
=
0
;
ii
<
aKPolyList
.
size
();
ii
++
)
{
...
...
@@ -487,14 +488,15 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
// Flag this corner if starting a hole connection segment:
// This is used by draw functions to draw only useful segments (and not extra segments)
// corner.utility = (aBoolengine->GetPolygonPointEdgeType() == KB_FALSE_EDGE) ? 1 : 0;
aZone
->
m_FilledP
olysList
.
push_back
(
corner
);
p
olysList
.
push_back
(
corner
);
count
++
;
}
corner
.
end_contour
=
true
;
aZone
->
m_FilledP
olysList
.
pop_back
();
aZone
->
m_FilledP
olysList
.
push_back
(
corner
);
p
olysList
.
pop_back
();
p
olysList
.
push_back
(
corner
);
}
aZone
->
AddFilledPolysList
(
polysList
);
return
count
;
}
...
...
@@ -503,7 +505,8 @@ int CopyPolygonsFromKPolygonListToFilledPolysList( ZONE_CONTAINER* aZone,
int
CopyPolygonsFromFilledPolysListTotKPolygonList
(
ZONE_CONTAINER
*
aZone
,
KPolygonSet
&
aKPolyList
)
{
unsigned
corners_count
=
aZone
->
m_FilledPolysList
.
size
();
std
::
vector
<
CPolyPt
>
polysList
=
aZone
->
GetFilledPolysList
();
unsigned
corners_count
=
polysList
.
size
();
int
count
=
0
;
unsigned
ic
=
0
;
...
...
@@ -511,7 +514,7 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone,
for
(
unsigned
ii
=
0
;
ii
<
corners_count
;
ii
++
)
{
CPolyPt
*
corner
=
&
aZone
->
m_FilledP
olysList
[
ic
];
CPolyPt
*
corner
=
&
p
olysList
[
ic
];
if
(
corner
->
end_contour
)
polycount
++
;
...
...
@@ -527,7 +530,7 @@ int CopyPolygonsFromFilledPolysListTotKPolygonList( ZONE_CONTAINER* aZone,
{
for
(
;
ic
<
corners_count
;
ic
++
)
{
CPolyPt
*
corner
=
&
aZone
->
m_FilledP
olysList
[
ic
];
CPolyPt
*
corner
=
&
p
olysList
[
ic
];
cornerslist
.
push_back
(
KPolyPoint
(
corner
->
x
,
corner
->
y
)
);
count
++
;
...
...
pcbnew/zones_polygons_test_connections.cpp
View file @
2455a6cc
...
...
@@ -28,7 +28,7 @@ void Merge_SubNets_Connected_By_CopperAreas( BOARD* aPcb, int aNetcode );
bool
sort_areas
(
const
ZONE_CONTAINER
*
ref
,
const
ZONE_CONTAINER
*
tst
)
{
if
(
ref
->
GetNet
()
==
tst
->
GetNet
()
)
return
ref
->
m_FilledPolysList
.
size
()
<
tst
->
m_FilledPolysList
.
size
();
return
ref
->
GetFilledPolysList
().
size
()
<
tst
->
GetFilledPolysList
()
.
size
();
else
return
ref
->
GetNet
()
<
tst
->
GetNet
();
}
...
...
@@ -71,7 +71,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
continue
;
if
(
(
aNetcode
>=
0
)
&&
(
aNetcode
!=
curr_zone
->
GetNet
()
)
)
continue
;
if
(
curr_zone
->
m_FilledPolysList
.
size
()
==
0
)
if
(
curr_zone
->
GetFilledPolysList
()
.
size
()
==
0
)
continue
;
zones_candidates
.
push_back
(
curr_zone
);
}
...
...
@@ -120,10 +120,11 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
// test if a candidate is inside a filled area of this zone
unsigned
indexstart
=
0
,
indexend
;
for
(
indexend
=
0
;
indexend
<
curr_zone
->
m_FilledPolysList
.
size
();
indexend
++
)
std
::
vector
<
CPolyPt
>
polysList
=
curr_zone
->
GetFilledPolysList
();
for
(
indexend
=
0
;
indexend
<
polysList
.
size
();
indexend
++
)
{
// end of a filled sub-area found
if
(
curr_zone
->
m_FilledP
olysList
[
indexend
].
end_contour
)
if
(
p
olysList
[
indexend
].
end_contour
)
{
subnet
++
;
EDA_RECT
bbox
=
curr_zone
->
CalculateSubAreaBoundaryBox
(
indexstart
,
indexend
);
...
...
@@ -162,7 +163,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
if
(
bbox
.
Contains
(
pos1
)
)
{
if
(
TestPointInsidePolygon
(
curr_zone
->
m_FilledP
olysList
,
indexstart
,
if
(
TestPointInsidePolygon
(
p
olysList
,
indexstart
,
indexend
,
pos1
.
x
,
pos1
.
y
)
)
connected
=
true
;
}
...
...
@@ -170,7 +171,7 @@ void BOARD::Test_Connections_To_Copper_Areas( int aNetcode )
{
if
(
bbox
.
Contains
(
pos2
)
)
{
if
(
TestPointInsidePolygon
(
curr_zone
->
m_FilledP
olysList
,
if
(
TestPointInsidePolygon
(
p
olysList
,
indexstart
,
indexend
,
pos2
.
x
,
pos2
.
y
)
)
connected
=
true
;
...
...
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