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
f85ade75
Commit
f85ade75
authored
Jan 16, 2008
by
CHARRAS
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
see changelog
parent
ed0265cb
Changes
17
Show whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
655 additions
and
451 deletions
+655
-451
change_log.txt
change_log.txt
+9
-0
licence.h
cvpcb/licence.h
+0
-6
menucfg.cpp
cvpcb/menucfg.cpp
+55
-26
dialog_eeschema_config.cpp
eeschema/dialog_eeschema_config.cpp
+29
-22
id.h
include/id.h
+2
-2
wxPcbStruct.h
include/wxPcbStruct.h
+15
-5
dialog_gendrill.h
pcbnew/dialog_gendrill.h
+8
-7
dialog_setup_libs.cpp
pcbnew/dialog_setup_libs.cpp
+27
-22
edit.cpp
pcbnew/edit.cpp
+14
-1
gendrill.cpp
pcbnew/gendrill.cpp
+290
-262
onleftclick.cpp
pcbnew/onleftclick.cpp
+1
-1
onrightclick.cpp
pcbnew/onrightclick.cpp
+10
-2
zones_by_polygon.cpp
pcbnew/zones_by_polygon.cpp
+89
-39
zones_test_and_combine_areas.cpp
pcbnew/zones_test_and_combine_areas.cpp
+71
-24
PolyLine.cpp
polygon/PolyLine.cpp
+25
-23
defs-macros.h
polygon/defs-macros.h
+0
-2
php_polygon.cpp
polygon/php_polygon.cpp
+10
-7
No files found.
change_log.txt
View file @
f85ade75
...
@@ -3,6 +3,15 @@ Started 2007-June-11
...
@@ -3,6 +3,15 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
Please add newer entries at the top, list the date and your name with
email address.
email address.
2007-Dec-16 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
Move Zone outlines added
Zone outline DRC works (needs improvements)
some bugs solved, but polyline.cpp still needs work.
gendrill: code cleaning.
2007-Dec-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
2007-Dec-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
================================================================================
+pcbnew:
+pcbnew:
...
...
cvpcb/licence.h
deleted
100644 → 0
View file @
ed0265cb
#define MACHINE "PC"
#define NB_CLES 16
#define POSITION_LICENCE 50
#define POSITION_CLE 250
#define TAILLE_LICENCE 256
cvpcb/menucfg.cpp
View file @
f85ade75
...
@@ -228,25 +228,40 @@ wxString FullFileName, ShortLibName, mask;
...
@@ -228,25 +228,40 @@ wxString FullFileName, ShortLibName, mask;
Update
();
Update
();
mask
=
wxT
(
"*"
)
+
LibExtBuffer
;
mask
=
wxT
(
"*"
)
+
LibExtBuffer
;
FullFileName
=
EDA_FileSelector
(
_
(
"Libraries"
),
g_RealLibDirBuffer
,
/* Chemin par defaut */
wxEmptyString
,
/* nom fichier par defaut */
LibExtBuffer
,
/* extension par defaut */
mask
,
/* Masque d'affichage */
this
,
0
,
TRUE
/* ne chage pas de repertoire courant */
);
if
(
FullFileName
==
wxEmptyString
)
return
;
wxFileDialog
FilesDialog
(
this
,
_
(
"Library Files:"
),
g_RealLibDirBuffer
,
wxEmptyString
,
mask
,
wxFD_DEFAULT_STYLE
|
wxFD_MULTIPLE
);
FilesDialog
.
ShowModal
();
wxArrayString
Filenames
;
FilesDialog
.
GetFilenames
(
Filenames
);
if
(
Filenames
.
GetCount
()
==
0
)
return
;
for
(
unsigned
jj
=
0
;
jj
<
Filenames
.
GetCount
();
jj
++
)
{
FullFileName
=
Filenames
[
jj
];
ShortLibName
=
MakeReducedFileName
(
FullFileName
,
g_RealLibDirBuffer
,
LibExtBuffer
);
ShortLibName
=
MakeReducedFileName
(
FullFileName
,
g_RealLibDirBuffer
,
LibExtBuffer
);
g_LibName_List
.
Insert
(
ShortLibName
,
ii
);
//Add or insert new library name
if
(
g_LibName_List
.
Index
(
ShortLibName
)
==
wxNOT_FOUND
)
{
ListModIsModified
=
1
;
g_LibName_List
.
Insert
(
ShortLibName
,
ii
++
);
}
else
{
wxString
msg
;
msg
<<
wxT
(
"<"
)
<<
ShortLibName
<<
wxT
(
"> : "
)
<<
_
(
"Library already in use"
);
DisplayError
(
this
,
msg
);
}
}
g_UserLibDirBuffer
=
m_LibDirCtrl
->
GetValue
();
g_UserLibDirBuffer
=
m_LibDirCtrl
->
GetValue
();
SetRealLibraryPath
(
wxT
(
"modules"
)
);
SetRealLibraryPath
(
wxT
(
"modules"
)
);
listlib
();
listlib
();
ListModIsModified
=
1
;
m_Parent
->
BuildFootprintListBox
();
m_Parent
->
BuildFootprintListBox
();
...
@@ -282,23 +297,37 @@ wxString FullFileName, ShortLibName, mask;
...
@@ -282,23 +297,37 @@ wxString FullFileName, ShortLibName, mask;
Update
();
Update
();
mask
=
wxT
(
"*"
)
+
g_EquivExtBuffer
;
mask
=
wxT
(
"*"
)
+
g_EquivExtBuffer
;
FullFileName
=
EDA_FileSelector
(
_
(
"Equiv"
),
g_RealLibDirBuffer
,
/* Chemin par defaut */
wxEmptyString
,
/* nom fichier par defaut */
g_EquivExtBuffer
,
/* extension par defaut */
mask
,
/* Masque d'affichage */
this
,
0
,
TRUE
/* ne chage pas de repertoire courant */
);
if
(
FullFileName
==
wxEmptyString
)
return
;
wxFileDialog
FilesDialog
(
this
,
_
(
"Equiv Files:"
),
g_RealLibDirBuffer
,
wxEmptyString
,
mask
,
wxFD_DEFAULT_STYLE
|
wxFD_MULTIPLE
);
FilesDialog
.
ShowModal
();
wxArrayString
Filenames
;
FilesDialog
.
GetFilenames
(
Filenames
);
if
(
Filenames
.
GetCount
()
==
0
)
return
;
for
(
unsigned
jj
=
0
;
jj
<
Filenames
.
GetCount
();
jj
++
)
{
FullFileName
=
Filenames
[
jj
];
ShortLibName
=
MakeReducedFileName
(
FullFileName
,
g_RealLibDirBuffer
,
g_EquivExtBuffer
);
ShortLibName
=
MakeReducedFileName
(
FullFileName
,
g_RealLibDirBuffer
,
g_EquivExtBuffer
);
g_ListName_Equ
.
Insert
(
ShortLibName
,
ii
);
//Add or insert new equiv library name
if
(
g_ListName_Equ
.
Index
(
ShortLibName
)
==
wxNOT_FOUND
)
{
g_ListName_Equ
.
Insert
(
ShortLibName
,
ii
++
);
}
else
{
wxString
msg
;
msg
<<
wxT
(
"<"
)
<<
ShortLibName
<<
wxT
(
"> : "
)
<<
_
(
"Library already in use"
);
DisplayError
(
this
,
msg
);
}
}
/*
Mise a jour de l'affichage
*/
/*
Update display list
*/
g_UserLibDirBuffer
=
m_LibDirCtrl
->
GetValue
();
g_UserLibDirBuffer
=
m_LibDirCtrl
->
GetValue
();
SetRealLibraryPath
(
wxT
(
"modules"
)
);
SetRealLibraryPath
(
wxT
(
"modules"
)
);
listlib
();
listlib
();
...
...
eeschema/dialog_eeschema_config.cpp
View file @
f85ade75
...
@@ -364,20 +364,21 @@ wxString FullLibName,ShortLibName, Mask;
...
@@ -364,20 +364,21 @@ wxString FullLibName,ShortLibName, Mask;
}
}
Mask
=
wxT
(
"*"
)
+
g_LibExtBuffer
;
Mask
=
wxT
(
"*"
)
+
g_LibExtBuffer
;
FullLibName
=
EDA_FileSelector
(
_
(
"Library files:"
),
g_RealLibDirBuffer
,
/* Chemin par defaut */
wxEmptyString
,
/* nom fichier par defaut */
g_LibExtBuffer
,
/* extension par defaut */
Mask
,
/* Masque d'affichage */
this
,
wxFD_OPEN
,
TRUE
);
if
(
FullLibName
.
IsEmpty
()
)
return
;
ShortLibName
=
MakeReducedFileName
(
FullLibName
,
g_RealLibDirBuffer
,
g_LibExtBuffer
);
wxFileDialog
FilesDialog
(
this
,
_
(
"Library files:"
),
g_RealLibDirBuffer
,
wxEmptyString
,
Mask
,
wxFD_DEFAULT_STYLE
|
wxFD_MULTIPLE
);
FilesDialog
.
ShowModal
();
wxArrayString
Filenames
;
FilesDialog
.
GetFilenames
(
Filenames
);
for
(
unsigned
jj
=
0
;
jj
<
Filenames
.
GetCount
();
jj
++
)
{
FullLibName
=
Filenames
[
jj
];
ShortLibName
=
MakeReducedFileName
(
FullLibName
,
g_RealLibDirBuffer
,
g_LibExtBuffer
);
if
(
ShortLibName
.
IsEmpty
()
)
//Just in case...
continue
;
//Add or insert new library name
//Add or insert new library name
if
(
FindLibrary
(
ShortLibName
)
==
NULL
)
if
(
FindLibrary
(
ShortLibName
)
==
NULL
)
{
{
...
@@ -387,7 +388,13 @@ wxString FullLibName,ShortLibName, Mask;
...
@@ -387,7 +388,13 @@ wxString FullLibName,ShortLibName, Mask;
m_ListLibr
->
InsertItems
(
g_LibName_List
,
0
);
m_ListLibr
->
InsertItems
(
g_LibName_List
,
0
);
}
}
else
DisplayError
(
this
,
_
(
"Library already in use"
));
else
{
wxString
msg
;
msg
<<
wxT
(
"<"
)
<<
ShortLibName
<<
wxT
(
"> : "
)
<<
_
(
"Library already in use"
);
DisplayError
(
this
,
msg
);
}
}
}
}
...
...
include/id.h
View file @
f85ade75
...
@@ -561,8 +561,8 @@ enum main_id {
...
@@ -561,8 +561,8 @@ enum main_id {
ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE
,
ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE
,
ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE
,
ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE
,
ID_POPUP_PCB_DELETE_ZONE_CUTOUT
,
ID_POPUP_PCB_DELETE_ZONE_CUTOUT
,
ID_POPUP_
ZONE_UNUSED2
,
ID_POPUP_
PCB_MOVE_ZONE_OUTLINES
,
ID_POPUP_
ZONE_UNUSED3
,
ID_POPUP_
PCB_PLACE_ZONE_OUTLINES
,
ID_POPUP_ZONE_UNUSED4
,
ID_POPUP_ZONE_UNUSED4
,
ID_POPUP_PCB_DELETE_MARKER
,
ID_POPUP_PCB_DELETE_MARKER
,
...
...
include/wxPcbStruct.h
View file @
f85ade75
...
@@ -554,13 +554,15 @@ public:
...
@@ -554,13 +554,15 @@ public:
bool
IsNewCorner
);
bool
IsNewCorner
);
/**
/**
* Function End_Move_Zone_Corner
* Function End_Move_Zone_Corner_Or_Outlines
* Terminates a move corner in a zone outline
* Terminates a move corner in a zone outline, or a move zone outlines
* @param DC = current Device Context (can be NULL)
* @param zone_container: the given zone
*/
*/
void
End_Move_Zone_Corner
(
wxDC
*
DC
,
ZONE_CONTAINER
*
zone_container
);
void
End_Move_Zone_Corner
_Or_Outlines
(
wxDC
*
DC
,
ZONE_CONTAINER
*
zone_container
);
/**
/**
* Function End_Move_Zone_Corner
* Function End_Move_Zone_Corner
_Or_Outlines
* Remove the currently selected corner in a zone outline
* Remove the currently selected corner in a zone outline
* the .m_CornerSelection is used as corner selection
* the .m_CornerSelection is used as corner selection
*/
*/
...
@@ -577,6 +579,14 @@ public:
...
@@ -577,6 +579,14 @@ public:
*/
*/
void
Delete_Zone_Contour
(
wxDC
*
DC
,
ZONE_CONTAINER
*
zone_container
);
void
Delete_Zone_Contour
(
wxDC
*
DC
,
ZONE_CONTAINER
*
zone_container
);
/**
* Function Start_Move_Zone_Outlines
* Initialise parametres to move an existing zone outlines.
* @param DC = current Device Context (can be NULL)
* @param zone_container: the given zone to move
*/
void
Start_Move_Zone_Outlines
(
wxDC
*
DC
,
ZONE_CONTAINER
*
zone_container
);
// Target handling
// Target handling
MIREPCB
*
Create_Mire
(
wxDC
*
DC
);
MIREPCB
*
Create_Mire
(
wxDC
*
DC
);
void
Delete_Mire
(
MIREPCB
*
MirePcb
,
wxDC
*
DC
);
void
Delete_Mire
(
MIREPCB
*
MirePcb
,
wxDC
*
DC
);
...
...
pcbnew/dialog_gendrill.h
View file @
f85ade75
...
@@ -3,13 +3,13 @@
...
@@ -3,13 +3,13 @@
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 13/01/2008 17:26:
27
// Created: 13/01/2008 17:26:
dialog_gendrill
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 13/01/2008 17:26:
27
// Generated by DialogBlocks (unregistered), 13/01/2008 17:26:
dialog_gendrill
#ifndef _DIALOG_GENDRILL_H_
#ifndef _DIALOG_GENDRILL_H_
#define _DIALOG_GENDRILL_H_
#define _DIALOG_GENDRILL_H_
...
@@ -149,14 +149,15 @@ private:
...
@@ -149,14 +149,15 @@ private:
void
InitDisplayParams
(
void
);
void
InitDisplayParams
(
void
);
void
SetParams
(
void
);
void
SetParams
(
void
);
void
GenDrillFiles
(
wxCommandEvent
&
event
);
void
GenDrillFiles
(
wxCommandEvent
&
event
);
void
GenDrillMap
(
int
format
);
void
GenDrillMap
(
std
::
vector
<
DRILL_TOOL
>
&
buffer
,
int
format
);
void
UpdatePrecisionOptions
(
wxCommandEvent
&
event
);
void
UpdatePrecisionOptions
(
wxCommandEvent
&
event
);
void
UpdateConfig
();
void
UpdateConfig
();
int
Plot_Drill_PcbMap
(
DRILL_TOOL
*
buffer
,
int
format
);
int
Plot_Drill_PcbMap
(
std
::
vector
<
DRILL_TOOL
>
&
buffer
,
int
format
);
void
GenDrillReport
();
void
GenDrillReport
(
std
::
vector
<
DRILL_TOOL
>
&
buffer
);
int
Gen_Liste_Forets
(
DRILL_TOOL
*
buffer
,
bool
print_header
);
int
Gen_Liste_Forets
(
std
::
vector
<
DRILL_TOOL
>
&
buffer
,
bool
print_header
);
int
Create_Drill_File_EXCELLON
(
DRILL_TOOL
*
buffer
);
int
Create_Drill_File_EXCELLON
(
std
::
vector
<
DRILL_TOOL
>
&
buffer
);
void
Init_Drill
();
void
Init_Drill
();
int
Gen_Liste_Tools
(
std
::
vector
<
DRILL_TOOL
>
&
buffer
,
bool
print_header
);
};
};
#endif
#endif
...
...
pcbnew/dialog_setup_libs.cpp
View file @
f85ade75
...
@@ -364,18 +364,17 @@ wxString mask = wxT("*");
...
@@ -364,18 +364,17 @@ wxString mask = wxT("*");
mask
+=
LibExtBuffer
;
mask
+=
LibExtBuffer
;
g_RealLibDirBuffer
.
Replace
(
wxT
(
"
\\
"
),
wxT
(
"/"
));
g_RealLibDirBuffer
.
Replace
(
wxT
(
"
\\
"
),
wxT
(
"/"
));
fullfilename
=
EDA_FileSelector
(
_
(
"library files:"
),
wxFileDialog
FilesDialog
(
this
,
_
(
"Library Files:"
),
g_RealLibDirBuffer
,
g_RealLibDirBuffer
,
/* Chemin par defaut */
wxEmptyString
,
mask
,
wxEmptyString
,
/* nom fichier par defaut */
wxFD_DEFAULT_STYLE
|
wxFD_MULTIPLE
);
LibExtBuffer
,
/* extension par defaut */
mask
,
/* Masque d'affichage */
this
,
0
,
TRUE
);
if
(
fullfilename
.
IsEmpty
()
)
return
;
FilesDialog
.
ShowModal
();
wxArrayString
Filenames
;
FilesDialog
.
GetFilenames
(
Filenames
);
for
(
unsigned
jj
=
0
;
jj
<
Filenames
.
GetCount
();
jj
++
)
{
fullfilename
=
Filenames
[
jj
];
ShortLibName
=
ShortLibName
=
MakeReducedFileName
(
fullfilename
,
g_RealLibDirBuffer
,
LibExtBuffer
);
MakeReducedFileName
(
fullfilename
,
g_RealLibDirBuffer
,
LibExtBuffer
);
...
@@ -387,6 +386,12 @@ wxString mask = wxT("*");
...
@@ -387,6 +386,12 @@ wxString mask = wxT("*");
m_ListLibr
->
Clear
();
m_ListLibr
->
Clear
();
m_ListLibr
->
InsertItems
(
g_LibName_List
,
0
);
m_ListLibr
->
InsertItems
(
g_LibName_List
,
0
);
}
}
else
DisplayError
(
this
,
_
(
"Library exists! No Change"
));
else
{
wxString
msg
;
msg
<<
wxT
(
"<"
)
<<
ShortLibName
<<
wxT
(
"> : "
)
<<
_
(
"Library already in use"
);
DisplayError
(
this
,
msg
);
}
}
}
}
pcbnew/edit.cpp
View file @
f85ade75
...
@@ -69,8 +69,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -69,8 +69,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
case
ID_POPUP_PCB_DELETE_EDGE_ZONE
:
case
ID_POPUP_PCB_DELETE_EDGE_ZONE
:
case
ID_POPUP_PCB_FILL_ALL_ZONES
:
case
ID_POPUP_PCB_FILL_ALL_ZONES
:
case
ID_POPUP_PCB_PLACE_ZONE_CORNER
:
case
ID_POPUP_PCB_PLACE_ZONE_CORNER
:
case
ID_POPUP_PCB_PLACE_ZONE_OUTLINES
:
case
ID_POPUP_PCB_EDIT_ZONE_PARAMS
:
case
ID_POPUP_PCB_EDIT_ZONE_PARAMS
:
case
ID_POPUP_PCB_DELETE_ZONE
:
case
ID_POPUP_PCB_DELETE_ZONE
:
case
ID_POPUP_PCB_MOVE_ZONE_CORNER
:
case
ID_POPUP_PCB_MOVE_ZONE_OUTLINES
:
case
ID_POPUP_PCB_ADD_ZONE_CORNER
:
case
ID_POPUP_PCB_DELETE_TRACKSEG
:
case
ID_POPUP_PCB_DELETE_TRACKSEG
:
case
ID_POPUP_PCB_DELETE_TRACK
:
case
ID_POPUP_PCB_DELETE_TRACK
:
case
ID_POPUP_PCB_DELETE_TRACKNET
:
case
ID_POPUP_PCB_DELETE_TRACKNET
:
...
@@ -488,6 +492,14 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -488,6 +492,14 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
break
;
}
}
case
ID_POPUP_PCB_MOVE_ZONE_OUTLINES
:
{
DrawPanel
->
MouseToCursorSchema
();
ZONE_CONTAINER
*
zone_cont
=
(
ZONE_CONTAINER
*
)
GetCurItem
();
Start_Move_Zone_Outlines
(
&
dc
,
zone_cont
);
break
;
}
case
ID_POPUP_PCB_ADD_ZONE_CORNER
:
case
ID_POPUP_PCB_ADD_ZONE_CORNER
:
{
{
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
...
@@ -505,11 +517,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
...
@@ -505,11 +517,12 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break
;
break
;
}
}
case
ID_POPUP_PCB_PLACE_ZONE_OUTLINES
:
case
ID_POPUP_PCB_PLACE_ZONE_CORNER
:
case
ID_POPUP_PCB_PLACE_ZONE_CORNER
:
{
{
DrawPanel
->
MouseToCursorSchema
();
DrawPanel
->
MouseToCursorSchema
();
ZONE_CONTAINER
*
zone_cont
=
(
ZONE_CONTAINER
*
)
GetCurItem
();
ZONE_CONTAINER
*
zone_cont
=
(
ZONE_CONTAINER
*
)
GetCurItem
();
End_Move_Zone_Corner
(
&
dc
,
zone_cont
);
End_Move_Zone_Corner
_Or_Outlines
(
&
dc
,
zone_cont
);
break
;
break
;
}
}
...
...
pcbnew/gendrill.cpp
View file @
f85ade75
...
@@ -4,6 +4,10 @@
...
@@ -4,6 +4,10 @@
#include "fctsys.h"
#include "fctsys.h"
using
namespace
std
;
#include <vector>
#include "common.h"
#include "common.h"
#include "plot_common.h"
#include "plot_common.h"
#include "trigo.h"
#include "trigo.h"
...
@@ -29,9 +33,16 @@
...
@@ -29,9 +33,16 @@
class
DRILL_TOOL
class
DRILL_TOOL
{
{
public
:
public
:
int
m_Diameter
;
int
m_TotalCount
;
int
m_TotalCount
;
int
m_OvalCount
;
int
m_OvalCount
;
int
m_Diameter
;
public
:
DRILL_TOOL
(
int
diametre
)
{
m_TotalCount
=
0
;
m_OvalCount
=
0
;
m_Diameter
=
diametre
;
}
};
};
/* drill precision format */
/* drill precision format */
...
@@ -63,7 +74,6 @@ static void PlotOvalDrillSymbol( const wxPoint& position,
...
@@ -63,7 +74,6 @@ static void PlotOvalDrillSymbol( const wxPoint& position,
int
format
);
int
format
);
/* Local Variables : */
/* Local Variables : */
static
int
s_DrillToolsCount
;
/* Nombre de forets a utiliser */
static
float
conv_unit
;
/* coeff de conversion des unites drill / pcb */
static
float
conv_unit
;
/* coeff de conversion des unites drill / pcb */
static
int
s_Unit_Drill_is_Inch
=
TRUE
;
/* INCH,LZ (2:4) */
static
int
s_Unit_Drill_is_Inch
=
TRUE
;
/* INCH,LZ (2:4) */
static
int
s_Zeros_Format
=
DECIMAL_FORMAT
;
static
int
s_Zeros_Format
=
DECIMAL_FORMAT
;
...
@@ -74,6 +84,8 @@ static wxPoint File_Drill_Offset; /* Offset des coord de percage pour le f
...
@@ -74,6 +84,8 @@ static wxPoint File_Drill_Offset; /* Offset des coord de percage pour le f
static
bool
Minimal
=
false
;
static
bool
Minimal
=
false
;
static
bool
Mirror
=
true
;
static
bool
Mirror
=
true
;
static
std
::
vector
<
DRILL_TOOL
>
s_ToolListBuffer
;
// Keywords for read and write config
// Keywords for read and write config
#define ZerosFormatKey wxT( "DrillZerosFormat" )
#define ZerosFormatKey wxT( "DrillZerosFormat" )
#define LeftPrecisionKey wxT( "DrillLeftPrecisionOpt" )
#define LeftPrecisionKey wxT( "DrillLeftPrecisionOpt" )
...
@@ -85,14 +97,22 @@ static bool Mirror = true;
...
@@ -85,14 +97,22 @@ static bool Mirror = true;
#include "dialog_gendrill.cpp" // Dialog box for drill file generation
#include "dialog_gendrill.cpp" // Dialog box for drill file generation
/* Compare function used for sorting tools */
static
bool
CmpDrillDiameterTool
(
const
DRILL_TOOL
&
a
,
const
DRILL_TOOL
&
b
)
{
return
a
.
m_Diameter
<
b
.
m_Diameter
;
}
/**********************************************/
/**********************************************/
void
WinEDA_DrillFrame
::
InitDisplayParams
(
void
)
void
WinEDA_DrillFrame
::
InitDisplayParams
(
void
)
/**********************************************/
/**********************************************/
/* some param values initialisation before display dialog window
/* some param values initialisation before display dialog window
*/
*/
{
{
wxString
msg
;
wxString
msg
;
if
(
s_Zeros_Format
==
DECIMAL_FORMAT
)
if
(
s_Zeros_Format
==
DECIMAL_FORMAT
)
m_Choice_Precision
->
Enable
(
false
);
m_Choice_Precision
->
Enable
(
false
);
if
(
DrillOriginIsAuxAxis
)
if
(
DrillOriginIsAuxAxis
)
...
@@ -103,72 +123,82 @@ void WinEDA_DrillFrame::InitDisplayParams(void)
...
@@ -103,72 +123,82 @@ void WinEDA_DrillFrame::InitDisplayParams(void)
if
(
s_Zeros_Format
==
DECIMAL_FORMAT
)
if
(
s_Zeros_Format
==
DECIMAL_FORMAT
)
m_Choice_Precision
->
Enable
(
false
);
m_Choice_Precision
->
Enable
(
false
);
msg
=
ReturnStringFromValue
(
g_UnitMetric
,
g_DesignSettings
.
m_ViaDrill
,
m_Parent
->
m_InternalUnits
);
msg
=
ReturnStringFromValue
(
g_UnitMetric
,
g_DesignSettings
.
m_ViaDrill
,
m_Parent
->
m_InternalUnits
);
msg
+=
ReturnUnitSymbol
(
g_UnitMetric
);
msg
+=
ReturnUnitSymbol
(
g_UnitMetric
);
m_ViaDrillValue
->
SetLabel
(
msg
);
m_ViaDrillValue
->
SetLabel
(
msg
);
msg
=
ReturnStringFromValue
(
g_UnitMetric
,
g_DesignSettings
.
m_MicroViaDrill
,
m_Parent
->
m_InternalUnits
);
msg
=
ReturnStringFromValue
(
g_UnitMetric
,
g_DesignSettings
.
m_MicroViaDrill
,
m_Parent
->
m_InternalUnits
);
msg
+=
ReturnUnitSymbol
(
g_UnitMetric
);
msg
+=
ReturnUnitSymbol
(
g_UnitMetric
);
m_MicroViaDrillValue
->
SetLabel
(
msg
);
m_MicroViaDrillValue
->
SetLabel
(
msg
);
msg
.
Empty
();
msg
.
Empty
();
msg
<<
g_HPGL_Pen_Num
;
msg
<<
g_HPGL_Pen_Num
;
m_PenNum
->
SetValue
(
msg
);
m_PenNum
->
SetValue
(
msg
);
msg
.
Empty
();
msg
.
Empty
();
msg
<<
g_HPGL_Pen_Speed
;
msg
<<
g_HPGL_Pen_Speed
;
m_PenSpeed
->
SetValue
(
msg
);
m_PenSpeed
->
SetValue
(
msg
);
// See if we have some buried vias or/and microvias, and display microvias drill value if so
// See if we have some buried vias or/and microvias, and display microvias drill value if so
m_ThroughViasCount
=
0
;
m_ThroughViasCount
=
0
;
m_MicroViasCount
=
0
;
m_MicroViasCount
=
0
;
m_BlindOrBuriedViasCount
=
0
;
m_BlindOrBuriedViasCount
=
0
;
for
(
TRACK
*
track
=
m_Parent
->
m_Pcb
->
m_Track
;
track
!=
NULL
;
track
=
track
->
Next
()
)
for
(
TRACK
*
track
=
m_Parent
->
m_Pcb
->
m_Track
;
track
!=
NULL
;
track
=
track
->
Next
()
)
{
{
if
(
track
->
Type
()
!=
TYPEVIA
)
continue
;
if
(
track
->
Type
()
!=
TYPEVIA
)
if
(
track
->
Shape
()
==
VIA_THROUGH
)
continue
;
if
(
track
->
Shape
()
==
VIA_THROUGH
)
m_ThroughViasCount
++
;
m_ThroughViasCount
++
;
else
if
(
track
->
Shape
()
==
VIA_MICROVIA
)
else
if
(
track
->
Shape
()
==
VIA_MICROVIA
)
m_MicroViasCount
++
;
m_MicroViasCount
++
;
else
if
(
track
->
Shape
()
==
VIA_BLIND_BURIED
)
else
if
(
track
->
Shape
()
==
VIA_BLIND_BURIED
)
m_BlindOrBuriedViasCount
++
;
m_BlindOrBuriedViasCount
++
;
}
}
m_MicroViasDrillSizer
->
Enable
(
m_MicroViasCount
);
m_MicroViaDrillValue
->
Enable
(
m_MicroViasCount
);
m_MicroViasDrillSizer
->
Enable
(
m_MicroViasCount
);
m_MicroViaDrillValue
->
Enable
(
m_MicroViasCount
);
/* Display statistics */
/* Display statistics */
// Pads holes cound:
// Pads holes cound:
m_PadsHoleCount
=
0
;
m_PadsHoleCount
=
0
;
for
(
MODULE
*
module
=
m_Parent
->
m_Pcb
->
m_Modules
;
module
!=
NULL
;
module
=
module
->
Next
()
)
for
(
MODULE
*
module
=
m_Parent
->
m_Pcb
->
m_Modules
;
module
!=
NULL
;
module
=
module
->
Next
()
)
{
{
for
(
D_PAD
*
pad
=
module
->
m_Pads
;
pad
!=
NULL
;
pad
=
pad
->
Next
()
)
for
(
D_PAD
*
pad
=
module
->
m_Pads
;
pad
!=
NULL
;
pad
=
pad
->
Next
()
)
{
{
if
(
pad
->
m_DrillShape
==
PAD_CIRCLE
)
if
(
pad
->
m_DrillShape
==
PAD_CIRCLE
)
if
(
pad
->
m_Drill
.
x
!=
0
)
m_PadsHoleCount
++
;
if
(
pad
->
m_Drill
.
x
!=
0
)
m_PadsHoleCount
++
;
else
else
if
(
MIN
(
pad
->
m_Drill
.
x
,
pad
->
m_Drill
.
y
)
!=
0
)
m_PadsHoleCount
++
;
if
(
MIN
(
pad
->
m_Drill
.
x
,
pad
->
m_Drill
.
y
)
!=
0
)
m_PadsHoleCount
++
;
}
}
}
}
msg
=
m_PadsCountInfoMsg
->
GetLabel
();
msg
=
m_PadsCountInfoMsg
->
GetLabel
();
msg
<<
wxT
(
" "
)
<<
m_PadsHoleCount
;
msg
<<
wxT
(
" "
)
<<
m_PadsHoleCount
;
m_PadsCountInfoMsg
->
SetLabel
(
msg
);
m_PadsCountInfoMsg
->
SetLabel
(
msg
);
msg
=
m_ThroughViasInfoMsg
->
GetLabel
();
msg
=
m_ThroughViasInfoMsg
->
GetLabel
();
msg
<<
wxT
(
" "
)
<<
m_ThroughViasCount
;
msg
<<
wxT
(
" "
)
<<
m_ThroughViasCount
;
m_ThroughViasInfoMsg
->
SetLabel
(
msg
);
m_ThroughViasInfoMsg
->
SetLabel
(
msg
);
msg
=
m_MicroViasInfoMsg
->
GetLabel
();
msg
=
m_MicroViasInfoMsg
->
GetLabel
();
msg
<<
wxT
(
" "
)
<<
m_MicroViasCount
;
msg
<<
wxT
(
" "
)
<<
m_MicroViasCount
;
m_MicroViasInfoMsg
->
SetLabel
(
msg
);
m_MicroViasInfoMsg
->
SetLabel
(
msg
);
msg
=
m_BuriedViasInfoMsg
->
GetLabel
();
msg
=
m_BuriedViasInfoMsg
->
GetLabel
();
msg
<<
wxT
(
" "
)
<<
m_BlindOrBuriedViasCount
;
msg
<<
wxT
(
" "
)
<<
m_BlindOrBuriedViasCount
;
m_BuriedViasInfoMsg
->
SetLabel
(
msg
);
m_BuriedViasInfoMsg
->
SetLabel
(
msg
);
}
}
/**************************************/
/**************************************/
void
WinEDA_DrillFrame
::
SetParams
(
void
)
void
WinEDA_DrillFrame
::
SetParams
(
void
)
/**************************************/
/**************************************/
{
{
wxString
msg
;
wxString
msg
;
...
@@ -181,10 +211,12 @@ void WinEDA_DrillFrame::SetParams(void)
...
@@ -181,10 +211,12 @@ void WinEDA_DrillFrame::SetParams(void)
DrillOriginIsAuxAxis
=
m_Choice_Drill_Offset
->
GetSelection
();
DrillOriginIsAuxAxis
=
m_Choice_Drill_Offset
->
GetSelection
();
msg
=
m_PenSpeed
->
GetValue
();
msg
=
m_PenSpeed
->
GetValue
();
if
(
msg
.
ToLong
(
&
ltmp
)
)
g_HPGL_Pen_Speed
=
ltmp
;
if
(
msg
.
ToLong
(
&
ltmp
)
)
g_HPGL_Pen_Speed
=
ltmp
;
msg
=
m_PenNum
->
GetValue
();
msg
=
m_PenNum
->
GetValue
();
if
(
msg
.
ToLong
(
&
ltmp
)
)
g_HPGL_Pen_Num
=
ltmp
;
if
(
msg
.
ToLong
(
&
ltmp
)
)
g_HPGL_Pen_Num
=
ltmp
;
if
(
m_Choice_Drill_Offset
->
GetSelection
()
==
0
)
if
(
m_Choice_Drill_Offset
->
GetSelection
()
==
0
)
File_Drill_Offset
=
wxPoint
(
0
,
0
);
File_Drill_Offset
=
wxPoint
(
0
,
0
);
else
else
...
@@ -259,8 +291,9 @@ void WinEDA_DrillFrame::UpdateConfig()
...
@@ -259,8 +291,9 @@ void WinEDA_DrillFrame::UpdateConfig()
/*************************************************************/
/*************************************************************/
void
WinEDA_DrillFrame
::
GenDrillFiles
(
wxCommandEvent
&
event
)
void
WinEDA_DrillFrame
::
GenDrillFiles
(
wxCommandEvent
&
event
)
/*************************************************************/
/*************************************************************/
/* Calls the functions to create EXCELLOn drill files and/od drill map files
*/
/* Calls the functions to create EXCELLON drill files and/od drill map files
*/
{
{
wxString
FullFileName
,
Mask
(
wxT
(
"*"
)
),
Ext
(
wxT
(
".drl"
)
);
wxString
FullFileName
,
Mask
(
wxT
(
"*"
)
),
Ext
(
wxT
(
".drl"
)
);
int
ii
;
int
ii
;
...
@@ -303,19 +336,20 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event )
...
@@ -303,19 +336,20 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event )
/* Init : */
/* Init : */
Affiche_1_Parametre
(
m_Parent
,
0
,
_
(
"File"
),
FullFileName
,
BLUE
);
Affiche_1_Parametre
(
m_Parent
,
0
,
_
(
"File"
),
FullFileName
,
BLUE
);
setlocale
(
LC_NUMERIC
,
"C"
);
// Use the standard notation for float numbers
setlocale
(
LC_NUMERIC
,
"C"
);
// Use the standard notation for float numbers
Init_Drill
();
Init_Drill
();
ii
=
Gen_Liste_Forets
(
(
DRILL_TOOL
*
)
adr_lowmem
,
TRUE
);
ii
=
Gen_Liste_Tools
(
s_ToolListBuffer
,
TRUE
);
msg
.
Printf
(
wxT
(
"%d"
),
ii
);
msg
.
Printf
(
wxT
(
"%d"
),
ii
);
Affiche_1_Parametre
(
m_Parent
,
30
,
_
(
"Tools"
),
msg
,
BROWN
);
Affiche_1_Parametre
(
m_Parent
,
30
,
_
(
"Tools"
),
msg
,
BROWN
);
ii
=
Create_Drill_File_EXCELLON
(
(
DRILL_TOOL
*
)
adr_lowmem
);
ii
=
Create_Drill_File_EXCELLON
(
s_ToolListBuffer
);
msg
.
Printf
(
wxT
(
"%d"
),
ii
);
msg
.
Printf
(
wxT
(
"%d"
),
ii
);
Affiche_1_Parametre
(
m_Parent
,
45
,
_
(
"Drill"
),
msg
,
GREEN
);
Affiche_1_Parametre
(
m_Parent
,
45
,
_
(
"Drill"
),
msg
,
GREEN
);
Write_End_Of_File_Drill
();
Write_End_Of_File_Drill
();
setlocale
(
LC_NUMERIC
,
""
);
// Revert to locale float notation
setlocale
(
LC_NUMERIC
,
""
);
// Revert to locale float notation
}
}
switch
(
m_Choice_Drill_Map
->
GetSelection
()
)
switch
(
m_Choice_Drill_Map
->
GetSelection
()
)
...
@@ -324,16 +358,16 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event )
...
@@ -324,16 +358,16 @@ void WinEDA_DrillFrame::GenDrillFiles( wxCommandEvent& event )
break
;
break
;
case
1
:
case
1
:
GenDrillMap
(
PLOT_FORMAT_HPGL
);
GenDrillMap
(
s_ToolListBuffer
,
PLOT_FORMAT_HPGL
);
break
;
break
;
case
2
:
case
2
:
GenDrillMap
(
PLOT_FORMAT_POST
);
GenDrillMap
(
s_ToolListBuffer
,
PLOT_FORMAT_POST
);
break
;
break
;
}
}
if
(
m_Choice_Drill_Report
->
GetSelection
()
>
0
)
if
(
m_Choice_Drill_Report
->
GetSelection
()
>
0
)
GenDrillReport
();
GenDrillReport
(
s_ToolListBuffer
);
EndModal
(
0
);
EndModal
(
0
);
}
}
...
@@ -361,29 +395,28 @@ void WinEDA_DrillFrame::UpdatePrecisionOptions( wxCommandEvent& event )
...
@@ -361,29 +395,28 @@ void WinEDA_DrillFrame::UpdatePrecisionOptions( wxCommandEvent& event )
}
}
/***************************************************************/
/***************************************************************
*******************
/
int
WinEDA_DrillFrame
::
Create_Drill_File_EXCELLON
(
DRILL_TOOL
*
buffer
)
int
WinEDA_DrillFrame
::
Create_Drill_File_EXCELLON
(
std
::
vector
<
DRILL_TOOL
>&
buffer
)
/***************************************************************/
/***************************************************************
*******************
/
/* Create the drill file in EXCELLON format
/* Create the drill file in EXCELLON format
* Return hole count
* Return hole count
* buffer: Drill tools list
* buffer: Drill tools list
*/
*/
{
{
DRILL_TOOL
*
foret
;
TRACK
*
pt_piste
;
TRACK
*
pt_piste
;
D_PAD
*
pt_pad
;
D_PAD
*
pt_pad
;
MODULE
*
Module
;
MODULE
*
Module
;
int
ii
,
diam
,
nb_trous
;
int
diam
,
holes_count
;
int
x0
,
y0
,
xf
,
yf
,
xc
,
yc
;
int
x0
,
y0
,
xf
,
yf
,
xc
,
yc
;
float
xt
,
yt
;
float
xt
,
yt
;
char
line
[
1024
];
char
line
[
1024
];
/* Create the pad drill list : */
/* Create the pad drill list : */
nb_trous
=
0
;
holes_count
=
0
;
/* Read the hole file */
/* Read the hole file */
for
(
ii
=
0
,
foret
=
buffer
;
ii
<
s_DrillToolsCount
;
ii
++
,
foret
++
)
for
(
unsigned
ii
=
0
;
ii
<
buffer
.
size
();
ii
++
)
{
{
sprintf
(
line
,
"T%d
\n
"
,
ii
+
1
);
fputs
(
line
,
dest
);
sprintf
(
line
,
"T%d
\n
"
,
ii
+
1
);
fputs
(
line
,
dest
);
/* Read the via list */
/* Read the via list */
...
@@ -397,7 +430,7 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
...
@@ -397,7 +430,7 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
if
(
via_drill
==
0
)
if
(
via_drill
==
0
)
continue
;
continue
;
if
(
foret
->
m_Diameter
!=
via_drill
)
if
(
buffer
[
ii
].
m_Diameter
!=
via_drill
)
continue
;
continue
;
x0
=
pt_piste
->
m_Start
.
x
-
File_Drill_Offset
.
x
;
x0
=
pt_piste
->
m_Start
.
x
-
File_Drill_Offset
.
x
;
...
@@ -411,7 +444,6 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
...
@@ -411,7 +444,6 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
{
{
Gen_Line_EXCELLON
(
line
,
xt
,
yt
);
Gen_Line_EXCELLON
(
line
,
xt
,
yt
);
}
}
else
else
{
{
/* metric 3:3 */
/* metric 3:3 */
...
@@ -419,7 +451,7 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
...
@@ -419,7 +451,7 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
}
}
fputs
(
line
,
dest
);
fputs
(
line
,
dest
);
nb_trous
++
;
holes_count
++
;
}
}
}
}
...
@@ -436,7 +468,7 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
...
@@ -436,7 +468,7 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
diam
=
pt_pad
->
m_Drill
.
x
;
diam
=
pt_pad
->
m_Drill
.
x
;
if
(
diam
==
0
)
if
(
diam
==
0
)
continue
;
continue
;
if
(
diam
!=
foret
->
m_Diameter
)
if
(
diam
!=
buffer
[
ii
].
m_Diameter
)
continue
;
continue
;
/* Compute the hole coordinates: */
/* Compute the hole coordinates: */
...
@@ -453,9 +485,13 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
...
@@ -453,9 +485,13 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
Gen_Line_EXCELLON
(
line
,
xt
*
10
,
yt
*
10
);
Gen_Line_EXCELLON
(
line
,
xt
*
10
,
yt
*
10
);
fputs
(
line
,
dest
);
fputs
(
line
,
dest
);
nb_trous
++
;
holes_count
++
;
}
/* ens analyse one module */
}
}
// End analyse module list
/* ens analyse one module */
}
// End analyse module list
/* Read pad list and create Drill infos for oblong holes only: */
/* Read pad list and create Drill infos for oblong holes only: */
...
@@ -472,7 +508,7 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
...
@@ -472,7 +508,7 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
diam
=
MIN
(
pt_pad
->
m_Drill
.
x
,
pt_pad
->
m_Drill
.
y
);
diam
=
MIN
(
pt_pad
->
m_Drill
.
x
,
pt_pad
->
m_Drill
.
y
);
if
(
diam
==
0
)
if
(
diam
==
0
)
continue
;
continue
;
if
(
diam
!=
foret
->
m_Diameter
)
if
(
diam
!=
buffer
[
ii
].
m_Diameter
)
continue
;
continue
;
/* Compute the hole coordinates: */
/* Compute the hole coordinates: */
...
@@ -519,12 +555,16 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
...
@@ -519,12 +555,16 @@ int WinEDA_DrillFrame::Create_Drill_File_EXCELLON( DRILL_TOOL* buffer )
else
else
Gen_Line_EXCELLON
(
line
,
xt
*
10
,
yt
*
10
);
Gen_Line_EXCELLON
(
line
,
xt
*
10
,
yt
*
10
);
fputs
(
"G05
\n
"
,
dest
);
fputs
(
"G05
\n
"
,
dest
);
nb_trous
++
;
holes_count
++
;
}
/* End Analyse pad list for the module */
}
}
/* End analyse modules for the current tool */
/* End Analyse pad list for the module */
}
}
return
nb_trous
;
/* End analyse modules for the current tool */
}
return
holes_count
;
}
}
...
@@ -597,71 +637,60 @@ void Gen_Line_EXCELLON( char* line, float x, float y )
...
@@ -597,71 +637,60 @@ void Gen_Line_EXCELLON( char* line, float x, float y )
sprintf
(
line
,
"X%sY%s
\n
"
,
CONV_TO_UTF8
(
xs
),
CONV_TO_UTF8
(
ys
)
);
sprintf
(
line
,
"X%sY%s
\n
"
,
CONV_TO_UTF8
(
xs
),
CONV_TO_UTF8
(
ys
)
);
break
;
break
;
}
}
;
}
}
/***************************************************/
/***************************************************
**********************
/
DRILL_TOOL
*
GetOrAddForet
(
DRILL_TOOL
*
buffer
,
int
diameter
)
int
GetOrAddForet
(
std
::
vector
<
DRILL_TOOL
>&
buffer
,
int
diameter
)
/***************************************************/
/***************************************************
**********************
/
/* Search the drill tool for the diameter "diameter"
/* Search the drill tool for the diameter "diameter"
* Create a new one if not found
* Create a new one if not found
* return the index in buffer
*/
*/
{
{
int
ii
;
unsigned
ii
;
DRILL_TOOL
*
foret
;
if
(
diameter
==
0
)
if
(
diameter
==
0
)
return
NULL
;
return
-
1
;
/* Search for an existing tool: */
/* Search for an existing tool: */
for
(
ii
=
0
,
foret
=
buffer
;
ii
<
s_DrillToolsCount
;
ii
++
,
foret
++
)
for
(
ii
=
0
;
ii
<
buffer
.
size
();
ii
++
)
{
{
if
(
foret
->
m_Diameter
==
diameter
)
/* found */
if
(
buffer
[
ii
].
m_Diameter
==
diameter
)
/* found */
return
foret
;
return
ii
;
}
}
/* No tool found, we must create a new one */
/* No tool found, we must create a new one */
s_DrillToolsCount
++
;
DRILL_TOOL
new_tool
(
diameter
);
foret
->
m_TotalCount
=
0
;
buffer
.
push_back
(
new_tool
);
foret
->
m_OvalCount
=
0
;
return
buffer
.
size
()
-
1
;
foret
->
m_Diameter
=
diameter
;
return
foret
;
}
/* Sort function by drill value */
int
Sort_by_Drill_Value
(
void
*
foret1
,
void
*
foret2
)
{
return
(
(
DRILL_TOOL
*
)
foret1
)
->
m_Diameter
-
(
(
DRILL_TOOL
*
)
foret2
)
->
m_Diameter
;
}
}
/*******************************************************************************/
/*******************************************************************************
**************
/
int
WinEDA_DrillFrame
::
Gen_Liste_
Forets
(
DRILL_TOOL
*
buffer
,
bool
print_header
)
int
WinEDA_DrillFrame
::
Gen_Liste_
Tools
(
std
::
vector
<
DRILL_TOOL
>&
buffer
,
bool
print_header
)
/*******************************************************************************/
/*******************************************************************************
**************
/
/* Etablit la liste des
foret
s de percage, dans l'ordre croissant des
/* Etablit la liste des
drill_tool
s de percage, dans l'ordre croissant des
* diametres
* diametres
* Retourne:
* Retourne:
* Nombre de Forets
* Nombre de Forets
*
*
* Mise a jour: s_DrillToolsCount = nombre de forets differents
* Fills the list of tools buffer
* Genere une liste de s_DrillToolsCount structures DRILL_TOOL a partir de buffer
*/
*/
{
{
DRILL_TOOL
*
foret
;
D_PAD
*
pt_pad
;
D_PAD
*
pt_pad
;
MODULE
*
Module
;
MODULE
*
Module
;
int
ii
,
diam
;
unsigned
ii
;
int
diam
;
char
line
[
1024
];
char
line
[
1024
];
s_DrillToolsCount
=
0
;
foret
=
buffer
;
buffer
.
clear
()
;
/* Creates the via tools */
/* Creates the via tools
list
*/
TRACK
*
pt_piste
=
m_Parent
->
m_Pcb
->
m_Track
;
TRACK
*
pt_piste
=
m_Parent
->
m_Pcb
->
m_Track
;
for
(
;
pt_piste
!=
NULL
;
pt_piste
=
(
TRACK
*
)
pt_piste
->
Pnext
)
for
(
;
pt_piste
!=
NULL
;
pt_piste
=
(
TRACK
*
)
pt_piste
->
Pnext
)
{
{
if
(
pt_piste
->
Type
()
!=
TYPEVIA
)
if
(
pt_piste
->
Type
()
!=
TYPEVIA
)
...
@@ -669,16 +698,17 @@ int WinEDA_DrillFrame::Gen_Liste_Forets( DRILL_TOOL* buffer, bool print_header )
...
@@ -669,16 +698,17 @@ int WinEDA_DrillFrame::Gen_Liste_Forets( DRILL_TOOL* buffer, bool print_header )
int
via_drill
=
pt_piste
->
GetDrillValue
();
int
via_drill
=
pt_piste
->
GetDrillValue
();
if
(
via_drill
==
0
)
if
(
via_drill
==
0
)
continue
;
continue
;
foret
=
GetOrAddForet
(
buffer
,
via_drill
);
if
(
foret
)
ii
=
GetOrAddForet
(
buffer
,
via_drill
);
foret
->
m_TotalCount
++
;
if
(
ii
>=
0
)
buffer
[
ii
].
m_TotalCount
++
;
}
}
/* Create the pad tools : */
/* Create the pad tools : */
Module
=
m_Parent
->
m_Pcb
->
m_Modules
;
Module
=
m_Parent
->
m_Pcb
->
m_Modules
;
for
(
;
Module
!=
NULL
;
Module
=
(
MODULE
*
)
Module
->
Pnext
)
for
(
;
Module
!=
NULL
;
Module
=
(
MODULE
*
)
Module
->
Pnext
)
{
{
/*
Examen des pastill
es */
/*
See the pad list for hole siz
es */
pt_pad
=
(
D_PAD
*
)
Module
->
m_Pads
;
pt_pad
=
(
D_PAD
*
)
Module
->
m_Pads
;
for
(
;
pt_pad
!=
NULL
;
pt_pad
=
(
D_PAD
*
)
pt_pad
->
Pnext
)
for
(
;
pt_pad
!=
NULL
;
pt_pad
=
(
D_PAD
*
)
pt_pad
->
Pnext
)
{
{
...
@@ -690,33 +720,30 @@ int WinEDA_DrillFrame::Gen_Liste_Forets( DRILL_TOOL* buffer, bool print_header )
...
@@ -690,33 +720,30 @@ int WinEDA_DrillFrame::Gen_Liste_Forets( DRILL_TOOL* buffer, bool print_header )
if
(
diam
==
0
)
if
(
diam
==
0
)
continue
;
continue
;
foret
=
GetOrAddForet
(
buffer
,
diam
);
ii
=
GetOrAddForet
(
buffer
,
diam
);
if
(
foret
)
if
(
ii
>=
0
)
{
{
foret
->
m_TotalCount
++
;
buffer
[
ii
].
m_TotalCount
++
;
if
(
pt_pad
->
m_DrillShape
==
PAD_OVAL
)
if
(
pt_pad
->
m_DrillShape
==
PAD_OVAL
)
foret
->
m_OvalCount
++
;
buffer
[
ii
].
m_OvalCount
++
;
}
}
}
}
/* Fin examen 1 module */
}
}
/* tri des forets par ordre de diametre croissant */
/* Sort drill_tools by increasing size */
qsort
(
buffer
,
s_DrillToolsCount
,
sizeof
(
DRILL_TOOL
),
sort
(
buffer
.
begin
(),
buffer
.
end
(),
CmpDrillDiameterTool
);
(
int
(
*
)
(
const
void
*
,
const
void
*
)
)
Sort_by_Drill_Value
);
/*
Generation de la section liste des outils
*/
/*
Write the tool list in excellon file
*/
if
(
print_header
)
if
(
print_header
)
{
{
for
(
ii
=
0
,
foret
=
(
DRILL_TOOL
*
)
buffer
;
ii
<
s_DrillToolsCount
;
ii
++
,
foret
++
)
for
(
ii
=
0
;
ii
<
buffer
.
size
();
ii
++
)
{
{
if
(
s_Unit_Drill_is_Inch
)
/* does it need T01, T02 or is T1,T2 ok?*/
if
(
s_Unit_Drill_is_Inch
)
/* does it need T01, T02 or is T1,T2 ok?*/
sprintf
(
line
,
"T%dC%.3f
\n
"
,
ii
+
1
,
sprintf
(
line
,
"T%dC%.3f
\n
"
,
ii
+
1
,
float
(
foret
->
m_Diameter
)
*
conv_unit
);
float
(
buffer
[
ii
].
m_Diameter
)
*
conv_unit
);
else
else
sprintf
(
line
,
"T%dC%.3f
\n
"
,
ii
+
1
,
sprintf
(
line
,
"T%dC%.3f
\n
"
,
ii
+
1
,
float
(
foret
->
m_Diameter
)
*
conv_unit
*
10.0
);
float
(
buffer
[
ii
].
m_Diameter
)
*
conv_unit
*
10.0
);
fputs
(
line
,
dest
);
fputs
(
line
,
dest
);
}
}
...
@@ -732,7 +759,7 @@ int WinEDA_DrillFrame::Gen_Liste_Forets( DRILL_TOOL* buffer, bool print_header )
...
@@ -732,7 +759,7 @@ int WinEDA_DrillFrame::Gen_Liste_Forets( DRILL_TOOL* buffer, bool print_header )
fputs
(
"M71
\n
"
,
dest
);
/* M71 = metric mode */
fputs
(
"M71
\n
"
,
dest
);
/* M71 = metric mode */
}
}
return
s_DrillToolsCount
;
return
buffer
.
size
()
;
}
}
...
@@ -794,16 +821,16 @@ void Write_End_Of_File_Drill()
...
@@ -794,16 +821,16 @@ void Write_End_Of_File_Drill()
}
}
/***********************************************/
/***********************************************
***********************************
/
void
WinEDA_DrillFrame
::
GenDrillMap
(
int
format
)
void
WinEDA_DrillFrame
::
GenDrillMap
(
std
::
vector
<
DRILL_TOOL
>&
buffer
,
int
format
)
/***********************************************/
/***********************************************
***********************************
/
/* Genere le plan de percage (Drill map) format HPGL ou POSTSCRIPT
/* Genere le plan de percage (Drill map) format HPGL ou POSTSCRIPT
*/
*/
{
{
int
ii
,
x
,
y
;
unsigned
ii
;
int
x
,
y
;
int
plotX
,
plotY
,
TextWidth
;
int
plotX
,
plotY
,
TextWidth
;
DRILL_TOOL
*
foret
;
int
intervalle
=
0
,
CharSize
=
0
;
int
intervalle
=
0
,
CharSize
=
0
;
EDA_BaseStruct
*
PtStruct
;
EDA_BaseStruct
*
PtStruct
;
int
old_g_PlotOrient
=
g_PlotOrient
;
int
old_g_PlotOrient
=
g_PlotOrient
;
...
@@ -852,7 +879,7 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
...
@@ -852,7 +879,7 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
if
(
FullFileName
.
IsEmpty
()
)
if
(
FullFileName
.
IsEmpty
()
)
return
;
return
;
setlocale
(
LC_NUMERIC
,
"C"
);
// Use the standard notation for float numbers
setlocale
(
LC_NUMERIC
,
"C"
);
// Use the standard notation for float numbers
g_PlotOrient
=
0
;
g_PlotOrient
=
0
;
/* calcul des dimensions et centre du PCB */
/* calcul des dimensions et centre du PCB */
m_Parent
->
m_Pcb
->
ComputeBoundaryBox
();
m_Parent
->
m_Pcb
->
ComputeBoundaryBox
();
...
@@ -908,8 +935,8 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
...
@@ -908,8 +935,8 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
m_Parent
->
MsgPanel
->
EraseMsgBox
();
m_Parent
->
MsgPanel
->
EraseMsgBox
();
Affiche_1_Parametre
(
m_Parent
,
0
,
_
(
"File"
),
FullFileName
,
BLUE
);
Affiche_1_Parametre
(
m_Parent
,
0
,
_
(
"File"
),
FullFileName
,
BLUE
);
/* Calcul de la liste des diametres de percage (liste des
foret
s) */
/* Calcul de la liste des diametres de percage (liste des
drill_tool
s) */
ii
=
Gen_Liste_
Forets
(
(
DRILL_TOOL
*
)
adr_lowmem
,
FALSE
);
ii
=
Gen_Liste_
Tools
(
s_ToolListBuffer
,
FALSE
);
msg
.
Printf
(
wxT
(
"%d"
),
ii
);
msg
.
Printf
(
wxT
(
"%d"
),
ii
);
Affiche_1_Parametre
(
m_Parent
,
48
,
_
(
"Tools"
),
msg
,
BROWN
);
Affiche_1_Parametre
(
m_Parent
,
48
,
_
(
"Tools"
),
msg
,
BROWN
);
...
@@ -978,7 +1005,7 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
...
@@ -978,7 +1005,7 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
fputs
(
line
,
dest
);
fputs
(
line
,
dest
);
}
}
ii
=
Plot_Drill_PcbMap
(
(
DRILL_TOOL
*
)
adr_lowmem
,
format
);
ii
=
Plot_Drill_PcbMap
(
s_ToolListBuffer
,
format
);
msg
.
Printf
(
wxT
(
"%d"
),
ii
);
msg
.
Printf
(
wxT
(
"%d"
),
ii
);
Affiche_1_Parametre
(
m_Parent
,
64
,
_
(
"Drill"
),
msg
,
GREEN
);
Affiche_1_Parametre
(
m_Parent
,
64
,
_
(
"Drill"
),
msg
,
GREEN
);
...
@@ -1056,13 +1083,13 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
...
@@ -1056,13 +1083,13 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
}
}
for
(
ii
=
0
,
foret
=
(
DRILL_TOOL
*
)
adr_lowmem
;
ii
<
s_DrillToolsCount
;
ii
++
,
foret
++
)
for
(
ii
=
0
;
ii
<
buffer
.
size
();
ii
++
)
{
{
int
plot_diam
;
int
plot_diam
;
if
(
foret
->
m_TotalCount
==
0
)
if
(
buffer
[
ii
].
m_TotalCount
==
0
)
continue
;
continue
;
plot_diam
=
(
int
)
(
foret
->
m_Diameter
);
plot_diam
=
(
int
)
(
buffer
[
ii
].
m_Diameter
);
x
=
plotX
;
y
=
plotY
;
x
=
plotX
;
y
=
plotY
;
x
=
-
g_PlotOffset
.
x
+
(
int
)
(
x
*
fTextScale
);
x
=
-
g_PlotOffset
.
x
+
(
int
)
(
x
*
fTextScale
);
y
=
g_PlotOffset
.
y
-
(
int
)
(
y
*
fTextScale
);
y
=
g_PlotOffset
.
y
-
(
int
)
(
y
*
fTextScale
);
...
@@ -1090,31 +1117,31 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
...
@@ -1090,31 +1117,31 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
sprintf
(
line
,
"PU %d, %d; LB%2.3f
\"
/ %2.2fmm "
,
sprintf
(
line
,
"PU %d, %d; LB%2.3f
\"
/ %2.2fmm "
,
x
+
(
int
)
(
intervalle
*
CharScale
*
fTextScale
),
x
+
(
int
)
(
intervalle
*
CharScale
*
fTextScale
),
y
-
(
int
)
(
CharSize
/
2
*
CharScale
*
fTextScale
),
y
-
(
int
)
(
CharSize
/
2
*
CharScale
*
fTextScale
),
float
(
foret
->
m_Diameter
)
*
0.0001
,
float
(
buffer
[
ii
].
m_Diameter
)
*
0.0001
,
float
(
foret
->
m_Diameter
)
*
0.00254
);
float
(
buffer
[
ii
].
m_Diameter
)
*
0.00254
);
else
else
sprintf
(
line
,
"PU %d, %d; LB%2.2fmm / %2.3f
\"
"
,
sprintf
(
line
,
"PU %d, %d; LB%2.2fmm / %2.3f
\"
"
,
x
+
(
int
)
(
intervalle
*
CharScale
*
fTextScale
),
x
+
(
int
)
(
intervalle
*
CharScale
*
fTextScale
),
y
-
(
int
)
(
CharSize
/
2
*
CharScale
*
fTextScale
),
y
-
(
int
)
(
CharSize
/
2
*
CharScale
*
fTextScale
),
float
(
foret
->
m_Diameter
)
*
0.00254
,
float
(
buffer
[
ii
].
m_Diameter
)
*
0.00254
,
float
(
foret
->
m_Diameter
)
*
0.0001
);
float
(
buffer
[
ii
].
m_Diameter
)
*
0.0001
);
fputs
(
line
,
dest
);
fputs
(
line
,
dest
);
// Now list how many holes and ovals are associated with each drill.
// Now list how many holes and ovals are associated with each drill.
if
(
(
foret
->
m_TotalCount
==
1
)
&&
(
foret
->
m_OvalCount
==
0
)
)
if
(
(
buffer
[
ii
].
m_TotalCount
==
1
)
&&
(
buffer
[
ii
].
m_OvalCount
==
0
)
)
sprintf
(
line
,
"(1 hole)
\n
"
);
sprintf
(
line
,
"(1 hole)
\n
"
);
else
if
(
foret
->
m_TotalCount
==
1
)
// && ( foret->
m_OvalCount == 1 )
else
if
(
buffer
[
ii
].
m_TotalCount
==
1
)
// && ( buffer[ii]
m_OvalCount == 1 )
sprintf
(
line
,
"(1 hole) (with 1 oblong)
\n
"
);
sprintf
(
line
,
"(1 hole) (with 1 oblong)
\n
"
);
else
if
(
foret
->
m_OvalCount
==
0
)
else
if
(
buffer
[
ii
].
m_OvalCount
==
0
)
sprintf
(
line
,
"(%d holes)
\n
"
,
sprintf
(
line
,
"(%d holes)
\n
"
,
foret
->
m_TotalCount
);
buffer
[
ii
].
m_TotalCount
);
else
if
(
foret
->
m_OvalCount
==
1
)
else
if
(
buffer
[
ii
].
m_OvalCount
==
1
)
sprintf
(
line
,
"(%d holes) (with 1 oblong)
\n
"
,
sprintf
(
line
,
"(%d holes) (with 1 oblong)
\n
"
,
foret
->
m_TotalCount
);
buffer
[
ii
].
m_TotalCount
);
else
// if (
foret->
m_OvalCount > 1 )
else
// if (
buffer[ii]
m_OvalCount > 1 )
sprintf
(
line
,
"(%d holes) (with %d oblongs)
\n
"
,
sprintf
(
line
,
"(%d holes) (with %d oblongs)
\n
"
,
foret
->
m_TotalCount
,
buffer
[
ii
].
m_TotalCount
,
foret
->
m_OvalCount
);
buffer
[
ii
].
m_OvalCount
);
fputs
(
line
,
dest
);
fputs
(
line
,
dest
);
fputs
(
"
\03
;
\n
"
,
dest
);
fputs
(
"
\03
;
\n
"
,
dest
);
break
;
break
;
...
@@ -1125,29 +1152,29 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
...
@@ -1125,29 +1152,29 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
// and then its diameter in the other Drill Unit.
// and then its diameter in the other Drill Unit.
if
(
s_Unit_Drill_is_Inch
)
if
(
s_Unit_Drill_is_Inch
)
sprintf
(
line
,
"%2.3f
\"
/ %2.2fmm "
,
sprintf
(
line
,
"%2.3f
\"
/ %2.2fmm "
,
float
(
foret
->
m_Diameter
)
*
0.0001
,
float
(
buffer
[
ii
].
m_Diameter
)
*
0.0001
,
float
(
foret
->
m_Diameter
)
*
0.00254
);
float
(
buffer
[
ii
].
m_Diameter
)
*
0.00254
);
else
else
sprintf
(
line
,
"%2.2fmm / %2.3f
\"
"
,
sprintf
(
line
,
"%2.2fmm / %2.3f
\"
"
,
float
(
foret
->
m_Diameter
)
*
0.00254
,
float
(
buffer
[
ii
].
m_Diameter
)
*
0.00254
,
float
(
foret
->
m_Diameter
)
*
0.0001
);
float
(
buffer
[
ii
].
m_Diameter
)
*
0.0001
);
msg
=
CONV_FROM_UTF8
(
line
);
msg
=
CONV_FROM_UTF8
(
line
);
// Now list how many holes and ovals are associated with each drill.
// Now list how many holes and ovals are associated with each drill.
if
(
(
foret
->
m_TotalCount
==
1
)
&&
(
foret
->
m_OvalCount
==
0
)
)
if
(
(
buffer
[
ii
].
m_TotalCount
==
1
)
&&
(
buffer
[
ii
].
m_OvalCount
==
0
)
)
sprintf
(
line
,
"(1 hole)"
);
sprintf
(
line
,
"(1 hole)"
);
else
if
(
foret
->
m_TotalCount
==
1
)
// && ( foret->
m_OvalCount == 1 )
else
if
(
buffer
[
ii
].
m_TotalCount
==
1
)
// && ( buffer[ii]
m_OvalCount == 1 )
sprintf
(
line
,
"(1 hole) (with 1 oblong)"
);
sprintf
(
line
,
"(1 hole) (with 1 oblong)"
);
else
if
(
foret
->
m_OvalCount
==
0
)
else
if
(
buffer
[
ii
].
m_OvalCount
==
0
)
sprintf
(
line
,
"(%d holes)"
,
sprintf
(
line
,
"(%d holes)"
,
foret
->
m_TotalCount
);
buffer
[
ii
].
m_TotalCount
);
else
if
(
foret
->
m_OvalCount
==
1
)
else
if
(
buffer
[
ii
].
m_OvalCount
==
1
)
sprintf
(
line
,
"(%d holes) (with 1 oblong)"
,
sprintf
(
line
,
"(%d holes) (with 1 oblong)"
,
foret
->
m_TotalCount
);
buffer
[
ii
].
m_TotalCount
);
else
// if (
foret->
m_OvalCount > 1 )
else
// if (
buffer[ii]
m_OvalCount > 1 )
sprintf
(
line
,
"(%d holes) (with %d oblongs)"
,
sprintf
(
line
,
"(%d holes) (with %d oblongs)"
,
foret
->
m_TotalCount
,
buffer
[
ii
].
m_TotalCount
,
foret
->
m_OvalCount
);
buffer
[
ii
].
m_OvalCount
);
msg
+=
CONV_FROM_UTF8
(
line
);
msg
+=
CONV_FROM_UTF8
(
line
);
Plot_1_texte
(
format
,
msg
,
0
,
TextWidth
,
Plot_1_texte
(
format
,
msg
,
0
,
TextWidth
,
x
,
y
,
x
,
y
,
...
@@ -1160,7 +1187,6 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
...
@@ -1160,7 +1187,6 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
plotY
+=
intervalle
;
plotY
+=
intervalle
;
}
}
switch
(
format
)
switch
(
format
)
{
{
case
PLOT_FORMAT_HPGL
:
case
PLOT_FORMAT_HPGL
:
...
@@ -1172,15 +1198,15 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
...
@@ -1172,15 +1198,15 @@ void WinEDA_DrillFrame::GenDrillMap( int format )
break
;
break
;
}
}
setlocale
(
LC_NUMERIC
,
""
);
// Revert to local notation for float numbers
setlocale
(
LC_NUMERIC
,
""
);
// Revert to local notation for float numbers
g_PlotOrient
=
old_g_PlotOrient
;
g_PlotOrient
=
old_g_PlotOrient
;
}
}
/********************************************************************/
/********************************************************************
********************
/
int
WinEDA_DrillFrame
::
Plot_Drill_PcbMap
(
DRILL_TOOL
*
buffer
,
int
format
)
int
WinEDA_DrillFrame
::
Plot_Drill_PcbMap
(
std
::
vector
<
DRILL_TOOL
>&
buffer
,
int
format
)
/*********************************************************************/
/*********************************************************************
*******************
/
/** Creates the drill map file in HPGL or POSTSCRIPT format
/** Creates the drill map file in HPGL or POSTSCRIPT format
* @return drill count
* @return drill count
...
@@ -1188,18 +1214,18 @@ int WinEDA_DrillFrame::Plot_Drill_PcbMap( DRILL_TOOL* buffer, int format )
...
@@ -1188,18 +1214,18 @@ int WinEDA_DrillFrame::Plot_Drill_PcbMap( DRILL_TOOL* buffer, int format )
* @param format = ouput format (hpgl / ps)
* @param format = ouput format (hpgl / ps)
*/
*/
{
{
DRILL_TOOL
*
foret
;
TRACK
*
pt_piste
;
TRACK
*
pt_piste
;
D_PAD
*
pt_pad
;
D_PAD
*
pt_pad
;
MODULE
*
Module
;
MODULE
*
Module
;
int
shape_id
,
diam
,
nb_trous
;
unsigned
shape_id
;
int
diam
,
holes_count
;
wxPoint
pos
;
wxPoint
pos
;
wxSize
size
;
wxSize
size
;
nb_trous
=
0
;
holes_count
=
0
;
/* create the drill list */
/* create the drill list */
if
(
s_DrillToolsCount
>
13
)
if
(
buffer
.
size
()
>
13
)
{
{
DisplayInfo
(
this
,
DisplayInfo
(
this
,
_
(
_
(
...
@@ -1208,7 +1234,7 @@ int WinEDA_DrillFrame::Plot_Drill_PcbMap( DRILL_TOOL* buffer, int format )
...
@@ -1208,7 +1234,7 @@ int WinEDA_DrillFrame::Plot_Drill_PcbMap( DRILL_TOOL* buffer, int format )
}
}
// Plot the drill map:
// Plot the drill map:
for
(
shape_id
=
0
,
foret
=
(
DRILL_TOOL
*
)
buffer
;
shape_id
<
s_DrillToolsCount
;
shape_id
++
,
foret
++
)
for
(
shape_id
=
0
;
shape_id
<
buffer
.
size
();
shape_id
++
)
{
{
/* create the via drill map */
/* create the via drill map */
{
{
...
@@ -1218,12 +1244,12 @@ int WinEDA_DrillFrame::Plot_Drill_PcbMap( DRILL_TOOL* buffer, int format )
...
@@ -1218,12 +1244,12 @@ int WinEDA_DrillFrame::Plot_Drill_PcbMap( DRILL_TOOL* buffer, int format )
if
(
pt_piste
->
Type
()
!=
TYPEVIA
)
if
(
pt_piste
->
Type
()
!=
TYPEVIA
)
continue
;
continue
;
int
via_drill
=
pt_piste
->
GetDrillValue
();
int
via_drill
=
pt_piste
->
GetDrillValue
();
if
(
via_drill
!=
foret
->
m_Diameter
)
if
(
via_drill
!=
buffer
[
shape_id
].
m_Diameter
)
continue
;
continue
;
pos
=
pt_piste
->
m_Start
;
pos
=
pt_piste
->
m_Start
;
PlotDrillSymbol
(
pos
,
via_drill
,
shape_id
,
format
);
PlotDrillSymbol
(
pos
,
via_drill
,
shape_id
,
format
);
nb_trous
++
;
holes_count
++
;
}
}
}
}
/* create the pad drill map: */
/* create the pad drill map: */
...
@@ -1236,7 +1262,7 @@ int WinEDA_DrillFrame::Plot_Drill_PcbMap( DRILL_TOOL* buffer, int format )
...
@@ -1236,7 +1262,7 @@ int WinEDA_DrillFrame::Plot_Drill_PcbMap( DRILL_TOOL* buffer, int format )
{
{
case
PAD_CIRCLE
:
case
PAD_CIRCLE
:
diam
=
pt_pad
->
m_Drill
.
x
;
diam
=
pt_pad
->
m_Drill
.
x
;
if
(
diam
!=
foret
->
m_Diameter
)
if
(
diam
!=
buffer
[
shape_id
].
m_Diameter
)
continue
;
continue
;
PlotDrillSymbol
(
pt_pad
->
m_Pos
,
diam
,
shape_id
,
format
);
PlotDrillSymbol
(
pt_pad
->
m_Pos
,
diam
,
shape_id
,
format
);
break
;
break
;
...
@@ -1245,24 +1271,24 @@ int WinEDA_DrillFrame::Plot_Drill_PcbMap( DRILL_TOOL* buffer, int format )
...
@@ -1245,24 +1271,24 @@ int WinEDA_DrillFrame::Plot_Drill_PcbMap( DRILL_TOOL* buffer, int format )
if
(
pt_pad
->
m_DrillShape
!=
PAD_OVAL
)
if
(
pt_pad
->
m_DrillShape
!=
PAD_OVAL
)
continue
;
continue
;
diam
=
MIN
(
pt_pad
->
m_Drill
.
x
,
pt_pad
->
m_Drill
.
y
);
diam
=
MIN
(
pt_pad
->
m_Drill
.
x
,
pt_pad
->
m_Drill
.
y
);
if
(
diam
!=
foret
->
m_Diameter
)
if
(
diam
!=
buffer
[
shape_id
].
m_Diameter
)
continue
;
continue
;
PlotOvalDrillSymbol
(
pt_pad
->
m_Pos
,
pt_pad
->
m_Drill
,
pt_pad
->
m_Orient
,
format
);
PlotOvalDrillSymbol
(
pt_pad
->
m_Pos
,
pt_pad
->
m_Drill
,
pt_pad
->
m_Orient
,
format
);
break
;
break
;
}
}
nb_trous
++
;
holes_count
++
;
}
}
/* Fin examen 1 module */
/* Fin examen 1 module */
}
}
/* Fin 1 passe de
foret
*/
/* Fin 1 passe de
drill_tool
*/
}
}
/* fin analyse des trous de modules */
/* fin analyse des trous de modules */
return
nb_trous
;
return
holes_count
;
}
}
...
@@ -1445,6 +1471,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int num_forme, int
...
@@ -1445,6 +1471,7 @@ void PlotDrillSymbol( const wxPoint& position, int diametre, int num_forme, int
/*********************************************************************************************/
/*********************************************************************************************/
void
PlotOvalDrillSymbol
(
const
wxPoint
&
position
,
const
wxSize
&
size
,
int
orient
,
int
format
)
void
PlotOvalDrillSymbol
(
const
wxPoint
&
position
,
const
wxSize
&
size
,
int
orient
,
int
format
)
/*********************************************************************************************/
/*********************************************************************************************/
/* Draws an oblong hole.
/* Draws an oblong hole.
* because functions to draw oblong shapes exist to draw oblong pads, Use they.
* because functions to draw oblong shapes exist to draw oblong pads, Use they.
*/
*/
...
@@ -1462,18 +1489,17 @@ void PlotOvalDrillSymbol( const wxPoint& position, const wxSize& size, int orien
...
@@ -1462,18 +1489,17 @@ void PlotOvalDrillSymbol( const wxPoint& position, const wxSize& size, int orien
}
}
/*******************************************/
/*******************************************
********************************
/
void
WinEDA_DrillFrame
::
GenDrillReport
()
void
WinEDA_DrillFrame
::
GenDrillReport
(
std
::
vector
<
DRILL_TOOL
>&
buffer
)
/*******************************************/
/*******************************************
********************************
/
/*
/*
* Create a list of drill values and drill count
* Create a list of drill values and drill count
*/
*/
{
{
wxString
FileName
,
Mask
(
wxT
(
"*"
)
),
Ext
(
wxT
(
".rpt"
)
);
wxString
FileName
,
Mask
(
wxT
(
"*"
)
),
Ext
(
wxT
(
".rpt"
)
);
int
ii
,
TotalHoleCount
;
unsigned
ii
,
TotalHoleCount
;
char
line
[
1024
];
char
line
[
1024
];
DRILL_TOOL
*
foret
;
wxString
msg
;
wxString
msg
;
FileName
=
m_Parent
->
m_CurrentScreen
->
m_FileName
;
FileName
=
m_Parent
->
m_CurrentScreen
->
m_FileName
;
...
@@ -1504,7 +1530,7 @@ void WinEDA_DrillFrame::GenDrillReport()
...
@@ -1504,7 +1530,7 @@ void WinEDA_DrillFrame::GenDrillReport()
Affiche_1_Parametre
(
m_Parent
,
0
,
_
(
"File"
),
FileName
,
BLUE
);
Affiche_1_Parametre
(
m_Parent
,
0
,
_
(
"File"
),
FileName
,
BLUE
);
/* Determine the list of the different drill diameters. */
/* Determine the list of the different drill diameters. */
ii
=
Gen_Liste_
Forets
(
(
DRILL_TOOL
*
)
adr_lowmem
,
FALSE
);
ii
=
Gen_Liste_
Tools
(
buffer
,
FALSE
);
msg
.
Printf
(
wxT
(
"%d"
),
ii
);
msg
.
Printf
(
wxT
(
"%d"
),
ii
);
Affiche_1_Parametre
(
m_Parent
,
30
,
_
(
"Tools"
),
msg
,
BROWN
);
Affiche_1_Parametre
(
m_Parent
,
30
,
_
(
"Tools"
),
msg
,
BROWN
);
...
@@ -1520,7 +1546,7 @@ void WinEDA_DrillFrame::GenDrillReport()
...
@@ -1520,7 +1546,7 @@ void WinEDA_DrillFrame::GenDrillReport()
TotalHoleCount
=
0
;
TotalHoleCount
=
0
;
for
(
ii
=
0
,
foret
=
(
DRILL_TOOL
*
)
adr_lowmem
;
ii
<
s_DrillToolsCount
;
ii
++
,
foret
++
)
for
(
ii
=
0
;
ii
<
buffer
.
size
();
ii
++
)
{
{
// List the tool number assigned to each drill,
// List the tool number assigned to each drill,
// then its diameter in the selected Drill Unit,
// then its diameter in the selected Drill Unit,
...
@@ -1528,37 +1554,39 @@ void WinEDA_DrillFrame::GenDrillReport()
...
@@ -1528,37 +1554,39 @@ void WinEDA_DrillFrame::GenDrillReport()
if
(
s_Unit_Drill_is_Inch
)
if
(
s_Unit_Drill_is_Inch
)
sprintf
(
line
,
"T%d %2.3f
\"
%2.2fmm "
,
sprintf
(
line
,
"T%d %2.3f
\"
%2.2fmm "
,
ii
+
1
,
ii
+
1
,
float
(
foret
->
m_Diameter
)
*
0.0001
,
float
(
buffer
[
ii
].
m_Diameter
)
*
0.0001
,
float
(
foret
->
m_Diameter
)
*
0.00254
);
float
(
buffer
[
ii
].
m_Diameter
)
*
0.00254
);
else
else
sprintf
(
line
,
"T%d %2.2fmm %2.3f
\"
"
,
sprintf
(
line
,
"T%d %2.2fmm %2.3f
\"
"
,
ii
+
1
,
ii
+
1
,
float
(
foret
->
m_Diameter
)
*
0.00254
,
float
(
buffer
[
ii
].
m_Diameter
)
*
0.00254
,
float
(
foret
->
m_Diameter
)
*
0.0001
);
float
(
buffer
[
ii
].
m_Diameter
)
*
0.0001
);
fputs
(
line
,
dest
);
fputs
(
line
,
dest
);
// Now list how many holes and ovals are associated with each drill.
// Now list how many holes and ovals are associated with each drill.
if
(
(
foret
->
m_TotalCount
==
1
)
&&
(
foret
->
m_OvalCount
==
0
)
)
if
(
(
buffer
[
ii
].
m_TotalCount
==
1
)
&&
(
buffer
[
ii
].
m_OvalCount
==
0
)
)
sprintf
(
line
,
"(1 hole)
\n
"
);
sprintf
(
line
,
"(1 hole)
\n
"
);
else
if
(
foret
->
m_TotalCount
==
1
)
else
if
(
buffer
[
ii
].
m_TotalCount
==
1
)
sprintf
(
line
,
"(1 hole) (with 1 oblong)
\n
"
);
sprintf
(
line
,
"(1 hole) (with 1 oblong)
\n
"
);
else
if
(
foret
->
m_OvalCount
==
0
)
else
if
(
buffer
[
ii
].
m_OvalCount
==
0
)
sprintf
(
line
,
"(%d holes)
\n
"
,
sprintf
(
line
,
"(%d holes)
\n
"
,
foret
->
m_TotalCount
);
buffer
[
ii
].
m_TotalCount
);
else
if
(
foret
->
m_OvalCount
==
1
)
else
if
(
buffer
[
ii
].
m_OvalCount
==
1
)
sprintf
(
line
,
"(%d holes) (with 1 oblong)
\n
"
,
sprintf
(
line
,
"(%d holes) (with 1 oblong)
\n
"
,
foret
->
m_TotalCount
);
buffer
[
ii
].
m_TotalCount
);
else
// if (
foret->
m_OvalCount > 1 )
else
// if (
buffer[ii]
m_OvalCount > 1 )
sprintf
(
line
,
"(%d holes) (with %d oblongs)
\n
"
,
sprintf
(
line
,
"(%d holes) (with %d oblongs)
\n
"
,
foret
->
m_TotalCount
,
buffer
[
ii
].
m_TotalCount
,
foret
->
m_OvalCount
);
buffer
[
ii
].
m_OvalCount
);
fputs
(
line
,
dest
);
fputs
(
line
,
dest
);
TotalHoleCount
+=
foret
->
m_TotalCount
;
TotalHoleCount
+=
buffer
[
ii
].
m_TotalCount
;
}
}
msg
.
Printf
(
wxT
(
"%d"
),
TotalHoleCount
);
Affiche_1_Parametre
(
m_Parent
,
45
,
_
(
"Drill"
),
msg
,
GREEN
);
sprintf
(
line
,
"
\n
total holes count %d
\n
"
,
TotalHoleCount
);
fputs
(
line
,
dest
);
fclose
(
dest
);
fclose
(
dest
);
}
}
pcbnew/onleftclick.cpp
View file @
f85ade75
...
@@ -39,7 +39,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
...
@@ -39,7 +39,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
switch
(
DrawStruct
->
Type
()
)
switch
(
DrawStruct
->
Type
()
)
{
{
case
TYPEZONE_CONTAINER
:
case
TYPEZONE_CONTAINER
:
End_Move_Zone_Corner
(
DC
,
(
ZONE_CONTAINER
*
)
DrawStruct
);
End_Move_Zone_Corner
_Or_Outlines
(
DC
,
(
ZONE_CONTAINER
*
)
DrawStruct
);
exit
=
true
;
exit
=
true
;
break
;
break
;
...
...
pcbnew/onrightclick.cpp
View file @
f85ade75
...
@@ -644,8 +644,12 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
...
@@ -644,8 +644,12 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
{
{
if
(
edge_zone
->
m_Flags
)
if
(
edge_zone
->
m_Flags
)
{
{
if
(
(
edge_zone
->
m_Flags
&
IN_EDIT
)
)
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_PLACE_ZONE_CORNER
,
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_PLACE_ZONE_CORNER
,
_
(
"Place Corner"
),
apply_xpm
);
_
(
"Place Corner"
),
apply_xpm
);
else
ADD_MENUITEM
(
aPopMenu
,
ID_POPUP_PCB_PLACE_ZONE_OUTLINES
,
_
(
"Place Zone"
),
apply_xpm
);
}
}
else
else
{
{
...
@@ -677,9 +681,13 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
...
@@ -677,9 +681,13 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
ADD_MENUITEM
(
zones_menu
,
ID_POPUP_PCB_FILL_ZONE
,
ADD_MENUITEM
(
zones_menu
,
ID_POPUP_PCB_FILL_ZONE
,
_
(
"Fill Zone"
),
fill_zone_xpm
);
_
(
"Fill Zone"
),
fill_zone_xpm
);
ADD_MENUITEM
(
zones_menu
,
ID_POPUP_PCB_MOVE_ZONE_OUTLINES
,
_
(
"Move Zone"
),
move_xpm
);
ADD_MENUITEM
(
zones_menu
,
ID_POPUP_PCB_EDIT_ZONE_PARAMS
,
ADD_MENUITEM
(
zones_menu
,
ID_POPUP_PCB_EDIT_ZONE_PARAMS
,
_
(
"Edit Zone Params"
),
edit_xpm
);
_
(
"Edit Zone Params"
),
edit_xpm
);
zones_menu
->
AppendSeparator
();
if
(
index
>=
0
&&
edge_zone
->
m_Poly
->
IsCutoutContour
(
edge_zone
->
m_CornerSelection
)
)
if
(
index
>=
0
&&
edge_zone
->
m_Poly
->
IsCutoutContour
(
edge_zone
->
m_CornerSelection
)
)
ADD_MENUITEM
(
zones_menu
,
ID_POPUP_PCB_DELETE_ZONE_CUTOUT
,
ADD_MENUITEM
(
zones_menu
,
ID_POPUP_PCB_DELETE_ZONE_CUTOUT
,
_
(
"Delete Cutout"
),
delete_xpm
);
_
(
"Delete Cutout"
),
delete_xpm
);
...
...
pcbnew/zones_by_polygon.cpp
View file @
f85ade75
...
@@ -32,15 +32,15 @@ using namespace std;
...
@@ -32,15 +32,15 @@ using namespace std;
#include "protos.h"
#include "protos.h"
/* Local functions */
bool
verbose
=
false
;
// false if zone outline diags mst not be shown
// Outline creation:
// Outline creation:
static
void
Abort_Zone_Create_Outline
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
static
void
Abort_Zone_Create_Outline
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
static
void
Show_New_Zone_Edge_While_Move_Mouse
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
Show_New_Zone_Edge_While_Move_Mouse
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
// Corner moving
// Corner moving
static
void
Abort_Zone_Move_Corner
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
static
void
Abort_Zone_Move_Corner
_Or_Outlines
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
);
static
void
Show_Zone_Corner_While_Move_Mouse
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
static
void
Show_Zone_Corner_
Or_Outline_
While_Move_Mouse
(
WinEDA_DrawPanel
*
panel
,
wxDC
*
DC
,
bool
erase
);
/* Local variables */
/* Local variables */
static
bool
Zone_45_Only
=
FALSE
;
static
bool
Zone_45_Only
=
FALSE
;
...
@@ -104,9 +104,9 @@ void WinEDA_PcbFrame::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container
...
@@ -104,9 +104,9 @@ void WinEDA_PcbFrame::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container
}
}
/*****************************************************************************/
/*****************************************************************************
*****
/
void
WinEDA_PcbFrame
::
Delete_Zone_Fill
(
wxDC
*
DC
,
SEGZONE
*
aZone
,
long
aTimestamp
)
void
WinEDA_PcbFrame
::
Delete_Zone_Fill
(
wxDC
*
DC
,
SEGZONE
*
aZone
,
long
aTimestamp
)
/******************************************************************************/
/******************************************************************************
****
/
/** Function Delete_Zone_Fill
/** Function Delete_Zone_Fill
* Remove the zone fillig which include the segment aZone, or the zone which have the given time stamp.
* Remove the zone fillig which include the segment aZone, or the zone which have the given time stamp.
...
@@ -254,21 +254,21 @@ void WinEDA_PcbFrame::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_con
...
@@ -254,21 +254,21 @@ void WinEDA_PcbFrame::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_con
/**
/**
* Function Start_Move_Zone_Corner
* Function Start_Move_Zone_Corner
* Initialise parametres to move an existing corner of a zone.
* Initialise parametres to move an existing corner of a zone.
* if IsNewCorner is true, the Abort_Zone_Move_Corner will remove this corner, if called
* if IsNewCorner is true, the Abort_Zone_Move_Corner
_Or_Outlines
will remove this corner, if called
*/
*/
{
{
/* Show the Net */
/* Show the Net */
if
(
g_HightLigt_Status
)
if
(
g_HightLigt_Status
&&
DC
)
{
{
Hight_Light
(
DC
);
// Remove old hightlight selection
Hight_Light
(
DC
);
// Remove old hightlight selection
}
}
g_HightLigth_NetCode
=
s_NetcodeSelection
=
zone_container
->
GetNet
();
g_HightLigth_NetCode
=
s_NetcodeSelection
=
zone_container
->
GetNet
();
Hight_Light
(
DC
);
if
(
DC
)
Hight_Light
(
DC
);
zone_container
->
m_Flags
=
IN_EDIT
;
zone_container
->
m_Flags
=
IN_EDIT
;
DrawPanel
->
ManageCurseur
=
Show_Zone_Corner_While_Move_Mouse
;
DrawPanel
->
ManageCurseur
=
Show_Zone_Corner_
Or_Outline_
While_Move_Mouse
;
DrawPanel
->
ForceCloseManageCurseur
=
Abort_Zone_Move_Corner
;
DrawPanel
->
ForceCloseManageCurseur
=
Abort_Zone_Move_Corner
_Or_Outlines
;
s_CornerInitialPosition
.
x
=
zone_container
->
m_Poly
->
GetX
(
corner_id
);
s_CornerInitialPosition
.
x
=
zone_container
->
m_Poly
->
GetX
(
corner_id
);
s_CornerInitialPosition
.
y
=
zone_container
->
m_Poly
->
GetY
(
corner_id
);
s_CornerInitialPosition
.
y
=
zone_container
->
m_Poly
->
GetY
(
corner_id
);
s_CornerIsNew
=
IsNewCorner
;
s_CornerIsNew
=
IsNewCorner
;
...
@@ -276,19 +276,50 @@ void WinEDA_PcbFrame::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_con
...
@@ -276,19 +276,50 @@ void WinEDA_PcbFrame::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_con
s_CurrentZone
=
NULL
;
s_CurrentZone
=
NULL
;
}
}
/*******************************************************************************************************/
void
WinEDA_PcbFrame
::
Start_Move_Zone_Outlines
(
wxDC
*
DC
,
ZONE_CONTAINER
*
zone_container
)
/*******************************************************************************************************/
/***************************************************************************************/
/**
void
WinEDA_PcbFrame
::
End_Move_Zone_Corner
(
wxDC
*
DC
,
ZONE_CONTAINER
*
zone_container
)
* Function Start_Move_Zone_Outlines
/****************************************************************************************/
* Initialise parametres to move an existing zone outlines.
*/
{
/* Show the Net */
if
(
g_HightLigt_Status
)
{
Hight_Light
(
DC
);
// Remove old hightlight selection
}
g_HightLigth_NetCode
=
s_NetcodeSelection
=
zone_container
->
GetNet
();
Hight_Light
(
DC
);
zone_container
->
m_Flags
=
IS_MOVED
;
DrawPanel
->
ManageCurseur
=
Show_Zone_Corner_Or_Outline_While_Move_Mouse
;
DrawPanel
->
ForceCloseManageCurseur
=
Abort_Zone_Move_Corner_Or_Outlines
;
s_CornerInitialPosition
.
x
=
zone_container
->
m_Poly
->
GetX
(
0
);
s_CornerInitialPosition
.
y
=
zone_container
->
m_Poly
->
GetY
(
0
);
s_CornerIsNew
=
false
;
s_AddCutoutToCurrentZone
=
false
;
s_CurrentZone
=
NULL
;
}
/*************************************************************************************************/
void
WinEDA_PcbFrame
::
End_Move_Zone_Corner_Or_Outlines
(
wxDC
*
DC
,
ZONE_CONTAINER
*
zone_container
)
/*************************************************************************************************/
/**
/**
* Function End_Move_Zone_Corner
* Function End_Move_Zone_Corner_Or_Outlines
* Terminates a move corner in a zone outline
* Terminates a move corner in a zone outline, or a move zone outlines
* @param DC = current Device Context (can be NULL)
* @param zone_container: the given zone
*/
*/
{
{
zone_container
->
m_Flags
=
0
;
zone_container
->
m_Flags
=
0
;
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
DrawPanel
->
ForceCloseManageCurseur
=
NULL
;
if
(
DC
)
zone_container
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
zone_container
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
GetScreen
()
->
SetModify
();
GetScreen
()
->
SetModify
();
s_AddCutoutToCurrentZone
=
false
;
s_AddCutoutToCurrentZone
=
false
;
...
@@ -304,15 +335,15 @@ void WinEDA_PcbFrame::End_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_conta
...
@@ -304,15 +335,15 @@ void WinEDA_PcbFrame::End_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_conta
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
{
{
ZONE_CONTAINER
*
edge_zone
=
m_Pcb
->
GetArea
(
ii
);
ZONE_CONTAINER
*
edge_zone
=
m_Pcb
->
GetArea
(
ii
);
if
(
layer
==
edge_zone
->
GetLayer
()
)
if
(
layer
==
edge_zone
->
GetLayer
()
&&
DC
)
edge_zone
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
edge_zone
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
}
}
m_Pcb
->
AreaPolygonModified
(
zone_container
,
true
,
fal
se
);
m_Pcb
->
AreaPolygonModified
(
zone_container
,
true
,
verbo
se
);
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
{
{
ZONE_CONTAINER
*
edge_zone
=
m_Pcb
->
GetArea
(
ii
);
ZONE_CONTAINER
*
edge_zone
=
m_Pcb
->
GetArea
(
ii
);
if
(
layer
==
edge_zone
->
GetLayer
()
)
if
(
layer
==
edge_zone
->
GetLayer
()
&&
DC
)
edge_zone
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
edge_zone
->
Draw
(
DrawPanel
,
DC
,
wxPoint
(
0
,
0
),
GR_OR
);
}
}
...
@@ -359,7 +390,7 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai
...
@@ -359,7 +390,7 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai
zone_container
->
m_Poly
->
DeleteCorner
(
zone_container
->
m_CornerSelection
);
zone_container
->
m_Poly
->
DeleteCorner
(
zone_container
->
m_CornerSelection
);
// modify zones outlines accordiing to the new zone_container shape
// modify zones outlines accordiing to the new zone_container shape
m_Pcb
->
AreaPolygonModified
(
zone_container
,
true
,
fal
se
);
m_Pcb
->
AreaPolygonModified
(
zone_container
,
true
,
verbo
se
);
if
(
DC
)
if
(
DC
)
{
{
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
...
@@ -380,12 +411,12 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai
...
@@ -380,12 +411,12 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai
}
}
/**************************************************************/
/**************************************************************
************
/
void
Abort_Zone_Move_Corner
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
void
Abort_Zone_Move_Corner
_Or_Outlines
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
)
/**************************************************************/
/**************************************************************
************
/
/**
/**
* Function Abort_Zone_Move_Corner
* Function Abort_Zone_Move_Corner
_Or_Outlines
* cancels the Begin_Zone state if at least one EDGE_ZONE has been created.
* cancels the Begin_Zone state if at least one EDGE_ZONE has been created.
*/
*/
{
{
...
@@ -394,6 +425,15 @@ void Abort_Zone_Move_Corner( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -394,6 +425,15 @@ void Abort_Zone_Move_Corner( WinEDA_DrawPanel* Panel, wxDC* DC )
zone_container
->
Draw
(
Panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
zone_container
->
Draw
(
Panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
if
(
zone_container
->
m_Flags
==
IS_MOVED
)
{
wxPoint
offset
;
offset
.
x
=
s_CornerInitialPosition
.
x
-
zone_container
->
m_Poly
->
GetX
(
0
);
offset
.
y
=
s_CornerInitialPosition
.
y
-
zone_container
->
m_Poly
->
GetY
(
0
);
zone_container
->
Move
(
offset
);
}
else
{
if
(
s_CornerIsNew
)
if
(
s_CornerIsNew
)
{
{
zone_container
->
m_Poly
->
DeleteCorner
(
zone_container
->
m_CornerSelection
);
zone_container
->
m_Poly
->
DeleteCorner
(
zone_container
->
m_CornerSelection
);
...
@@ -403,6 +443,7 @@ void Abort_Zone_Move_Corner( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -403,6 +443,7 @@ void Abort_Zone_Move_Corner( WinEDA_DrawPanel* Panel, wxDC* DC )
wxPoint
pos
=
s_CornerInitialPosition
;
wxPoint
pos
=
s_CornerInitialPosition
;
zone_container
->
m_Poly
->
MoveCorner
(
zone_container
->
m_CornerSelection
,
pos
.
x
,
pos
.
y
);
zone_container
->
m_Poly
->
MoveCorner
(
zone_container
->
m_CornerSelection
,
pos
.
x
,
pos
.
y
);
}
}
}
zone_container
->
Draw
(
Panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
zone_container
->
Draw
(
Panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
Panel
->
ManageCurseur
=
NULL
;
Panel
->
ManageCurseur
=
NULL
;
...
@@ -414,9 +455,9 @@ void Abort_Zone_Move_Corner( WinEDA_DrawPanel* Panel, wxDC* DC )
...
@@ -414,9 +455,9 @@ void Abort_Zone_Move_Corner( WinEDA_DrawPanel* Panel, wxDC* DC )
}
}
/**************************************************************************************/
/**************************************************************************************
***********
/
void
Show_Zone_Corner_While_Move_Mouse
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
,
bool
erase
)
void
Show_Zone_Corner_
Or_Outline_
While_Move_Mouse
(
WinEDA_DrawPanel
*
Panel
,
wxDC
*
DC
,
bool
erase
)
/**************************************************************************************/
/**************************************************************************************
***********
/
/* Redraws the zone outline when moving a corner according to the cursor position
/* Redraws the zone outline when moving a corner according to the cursor position
*/
*/
...
@@ -430,7 +471,16 @@ void Show_Zone_Corner_While_Move_Mouse( WinEDA_DrawPanel* Panel, wxDC* DC, bool
...
@@ -430,7 +471,16 @@ void Show_Zone_Corner_While_Move_Mouse( WinEDA_DrawPanel* Panel, wxDC* DC, bool
}
}
wxPoint
pos
=
pcbframe
->
GetScreen
()
->
m_Curseur
;
wxPoint
pos
=
pcbframe
->
GetScreen
()
->
m_Curseur
;
if
(
zone_container
->
m_Flags
==
IS_MOVED
)
{
wxPoint
offset
;
offset
.
x
=
pos
.
x
-
zone_container
->
m_Poly
->
GetX
(
0
);
offset
.
y
=
pos
.
y
-
zone_container
->
m_Poly
->
GetY
(
0
);
zone_container
->
Move
(
offset
);
}
else
zone_container
->
m_Poly
->
MoveCorner
(
zone_container
->
m_CornerSelection
,
pos
.
x
,
pos
.
y
);
zone_container
->
m_Poly
->
MoveCorner
(
zone_container
->
m_CornerSelection
,
pos
.
x
,
pos
.
y
);
zone_container
->
Draw
(
Panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
zone_container
->
Draw
(
Panel
,
DC
,
wxPoint
(
0
,
0
),
GR_XOR
);
}
}
...
@@ -649,7 +699,7 @@ void WinEDA_PcbFrame::End_Zone( wxDC* DC )
...
@@ -649,7 +699,7 @@ void WinEDA_PcbFrame::End_Zone( wxDC* DC )
SetCurItem
(
NULL
);
// This outine can be deleted when merging outlines
SetCurItem
(
NULL
);
// This outine can be deleted when merging outlines
// Combine zones if possible :
// Combine zones if possible :
m_Pcb
->
AreaPolygonModified
(
new_zone_container
,
true
,
fal
se
);
m_Pcb
->
AreaPolygonModified
(
new_zone_container
,
true
,
verbo
se
);
// Redraw the real edge zone :
// Redraw the real edge zone :
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
...
@@ -760,7 +810,7 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
...
@@ -760,7 +810,7 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
zone_container
->
m_GridFillValue
=
g_GridRoutingSize
;
zone_container
->
m_GridFillValue
=
g_GridRoutingSize
;
// Combine zones if possible :
// Combine zones if possible :
m_Pcb
->
AreaPolygonModified
(
zone_container
,
true
,
fal
se
);
m_Pcb
->
AreaPolygonModified
(
zone_container
,
true
,
verbo
se
);
// Redraw the real new zone outlines:
// Redraw the real new zone outlines:
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
for
(
int
ii
=
0
;
ii
<
m_Pcb
->
GetAreaCount
();
ii
++
)
...
...
pcbnew/zones_test_and_combine_areas.cpp
View file @
f85ade75
...
@@ -183,10 +183,10 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea )
...
@@ -183,10 +183,10 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea )
if
(
ret
)
if
(
ret
)
{
{
// intersection between non-adjacent sides
// intersection between non-adjacent sides
bInt
=
TRUE
;
bInt
=
true
;
if
(
style
!=
CPolyLine
::
STRAIGHT
||
style2
!=
CPolyLine
::
STRAIGHT
)
if
(
style
!=
CPolyLine
::
STRAIGHT
||
style2
!=
CPolyLine
::
STRAIGHT
)
{
{
bArcInt
=
TRUE
;
bArcInt
=
true
;
break
;
break
;
}
}
}
}
...
@@ -219,8 +219,8 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea )
...
@@ -219,8 +219,8 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea )
* Function ClipAreaPolygon
* Function ClipAreaPolygon
* Process an area that has been modified, by clipping its polygon against itself.
* 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.
* This may change the number and order of copper areas in the net.
* @param bMessageBoxInt ==
TRUE
, shows message when clipping occurs.
* @param bMessageBoxInt ==
true
, shows message when clipping occurs.
* @param bMessageBoxArc ==
TRUE
, shows message when clipping can't be done due to arcs.
* @param bMessageBoxArc ==
true
, shows message when clipping can't be done due to arcs.
* @return:
* @return:
* -1 if arcs intersect other sides, so polygon can't be clipped
* -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides
* 0 if no intersecting sides
...
@@ -230,7 +230,7 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea )
...
@@ -230,7 +230,7 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea )
int
BOARD
::
ClipAreaPolygon
(
ZONE_CONTAINER
*
CurrArea
,
int
BOARD
::
ClipAreaPolygon
(
ZONE_CONTAINER
*
CurrArea
,
bool
bMessageBoxArc
,
bool
bMessageBoxInt
,
bool
bRetainArcs
)
bool
bMessageBoxArc
,
bool
bMessageBoxInt
,
bool
bRetainArcs
)
{
{
CPolyLine
*
p
=
CurrArea
->
m_Poly
;
CPolyLine
*
curr_polygon
=
CurrArea
->
m_Poly
;
int
test
=
TestAreaPolygon
(
CurrArea
);
// this sets utility2 flag
int
test
=
TestAreaPolygon
(
CurrArea
);
// this sets utility2 flag
if
(
test
==
-
1
&&
!
bRetainArcs
)
if
(
test
==
-
1
&&
!
bRetainArcs
)
...
@@ -241,7 +241,7 @@ int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
...
@@ -241,7 +241,7 @@ int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
if
(
bMessageBoxArc
&&
bDontShowSelfIntersectionArcsWarning
==
false
)
if
(
bMessageBoxArc
&&
bDontShowSelfIntersectionArcsWarning
==
false
)
{
{
wxString
str
;
wxString
str
;
str
.
Printf
(
wxT
(
"Area %X of net
\"
%s
\"
has arcs intersecting other sides.
\n
"
),
str
.
Printf
(
wxT
(
"Area %
8.8
X of net
\"
%s
\"
has arcs intersecting other sides.
\n
"
),
CurrArea
->
m_TimeStamp
,
CurrArea
->
m_Netname
.
GetData
()
);
CurrArea
->
m_TimeStamp
,
CurrArea
->
m_Netname
.
GetData
()
);
str
+=
wxT
(
"This may cause problems with other editing operations,
\n
"
);
str
+=
wxT
(
"This may cause problems with other editing operations,
\n
"
);
str
+=
wxT
(
"such as adding cutouts. It can't be fixed automatically.
\n
"
);
str
+=
wxT
(
"such as adding cutouts. It can't be fixed automatically.
\n
"
);
...
@@ -265,7 +265,7 @@ int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
...
@@ -265,7 +265,7 @@ int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
if
(
bMessageBoxInt
&&
bDontShowSelfIntersectionWarning
==
false
)
if
(
bMessageBoxInt
&&
bDontShowSelfIntersectionWarning
==
false
)
{
{
wxString
str
;
wxString
str
;
str
.
Printf
(
wxT
(
"Area %
d
of net
\"
%s
\"
is self-intersecting and will be clipped.
\n
"
),
str
.
Printf
(
wxT
(
"Area %
8.8X
of net
\"
%s
\"
is self-intersecting and will be clipped.
\n
"
),
CurrArea
->
m_TimeStamp
,
CurrArea
->
m_Netname
.
GetData
()
);
CurrArea
->
m_TimeStamp
,
CurrArea
->
m_Netname
.
GetData
()
);
str
+=
wxT
(
"This may result in splitting the area.
\n
"
);
str
+=
wxT
(
"This may result in splitting the area.
\n
"
);
str
+=
wxT
(
"If the area is complex, this may take a few seconds."
);
str
+=
wxT
(
"If the area is complex, this may take a few seconds."
);
...
@@ -279,25 +279,26 @@ int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
...
@@ -279,25 +279,26 @@ int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
//** if( test == 1 )
//** if( test == 1 )
{
{
std
::
vector
<
CPolyLine
*>
*
pa
=
new
std
::
vector
<
CPolyLine
*>
;
std
::
vector
<
CPolyLine
*>
*
pa
=
new
std
::
vector
<
CPolyLine
*>
;
p
->
Undraw
();
curr_polygon
->
Undraw
();
int
n_poly
=
CurrArea
->
m_Poly
->
NormalizeWithGpc
(
pa
,
bRetainArcs
);
int
n_poly
=
CurrArea
->
m_Poly
->
NormalizeWithGpc
(
pa
,
bRetainArcs
);
if
(
n_poly
>
1
)
// i.e if clippin
f
has created some polygons, we must add these new copper areas
if
(
n_poly
>
1
)
// i.e if clippin
g
has created some polygons, we must add these new copper areas
{
{
ZONE_CONTAINER
*
NewArea
;
for
(
int
ip
=
1
;
ip
<
n_poly
;
ip
++
)
for
(
int
ip
=
1
;
ip
<
n_poly
;
ip
++
)
{
{
// create new copper area and copy poly into it
// create new copper area and copy poly into it
CPolyLine
*
new_p
=
(
*
pa
)[
ip
-
1
];
CPolyLine
*
new_p
=
(
*
pa
)[
ip
-
1
];
Curr
Area
=
AddArea
(
CurrArea
->
GetNet
(),
CurrArea
->
GetLayer
(),
0
,
0
,
0
);
New
Area
=
AddArea
(
CurrArea
->
GetNet
(),
CurrArea
->
GetLayer
(),
0
,
0
,
0
);
// remove the poly that was automatically created for the new area
// remove the poly that was automatically created for the new area
// and replace it with a poly from NormalizeWithGpc
// and replace it with a poly from NormalizeWithGpc
delete
Curr
Area
->
m_Poly
;
delete
New
Area
->
m_Poly
;
Curr
Area
->
m_Poly
=
new_p
;
New
Area
->
m_Poly
=
new_p
;
Curr
Area
->
m_Poly
->
Draw
();
New
Area
->
m_Poly
->
Draw
();
Curr
Area
->
utility
=
1
;
New
Area
->
utility
=
1
;
}
}
}
}
p
->
Draw
();
curr_polygon
->
Draw
();
delete
pa
;
delete
pa
;
}
}
return
test
;
return
test
;
...
@@ -309,7 +310,7 @@ int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
...
@@ -309,7 +310,7 @@ int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
* itself and the polygons for any other areas on the same net.
* 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.
* This may change the number and order of copper areas in the net.
* @param modified_area = area to test
* @param modified_area = area to test
* @param bMessageBox : if
TRUE
, shows message boxes when clipping occurs.
* @param bMessageBox : if
true
, shows message boxes when clipping occurs.
* @return :
* @return :
* -1 if arcs intersect other sides, so polygon can't be clipped
* -1 if arcs intersect other sides, so polygon can't be clipped
* 0 if no intersecting sides
* 0 if no intersecting sides
...
@@ -328,11 +329,11 @@ int BOARD::AreaPolygonModified( ZONE_CONTAINER* modified_area,
...
@@ -328,11 +329,11 @@ int BOARD::AreaPolygonModified( ZONE_CONTAINER* modified_area,
// now see if we need to clip against other areas
// now see if we need to clip against other areas
bool
bCheckAllAreas
=
false
;
bool
bCheckAllAreas
=
false
;
if
(
test
==
1
)
if
(
test
==
1
)
bCheckAllAreas
=
TRUE
;
bCheckAllAreas
=
true
;
else
else
bCheckAllAreas
=
TestAreaIntersections
(
modified_area
);
bCheckAllAreas
=
TestAreaIntersections
(
modified_area
);
if
(
bCheckAllAreas
)
if
(
bCheckAllAreas
)
CombineAllAreasInNet
(
modified_area
->
GetNet
(),
bMessageBoxInt
,
TRUE
);
CombineAllAreasInNet
(
modified_area
->
GetNet
(),
bMessageBoxInt
,
true
);
return
test
;
return
test
;
}
}
...
@@ -400,7 +401,7 @@ int BOARD::CombineAllAreasInNet( int aNetCode, bool bMessageBox, bool bUseUtilit
...
@@ -400,7 +401,7 @@ int BOARD::CombineAllAreasInNet( int aNetCode, bool bMessageBox, bool bUseUtilit
// bDontShowIntersectionWarning = dlg.bDontShowBoxState;
// bDontShowIntersectionWarning = dlg.bDontShowBoxState;
}
}
mod_ia1
=
TRUE
;
mod_ia1
=
true
;
}
}
else
if
(
ret
==
2
)
else
if
(
ret
==
2
)
{
{
...
@@ -508,12 +509,33 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test )
...
@@ -508,12 +509,33 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test )
int
n_int
=
FindSegmentIntersections
(
xi1
,
yi1
,
xf1
,
yf1
,
style1
,
int
n_int
=
FindSegmentIntersections
(
xi1
,
yi1
,
xf1
,
yf1
,
style1
,
xi2
,
yi2
,
xf2
,
yf2
,
style2
);
xi2
,
yi2
,
xf2
,
yf2
,
style2
);
if
(
n_int
)
if
(
n_int
)
return
TRUE
;
return
true
;
}
}
}
}
}
}
}
}
// If a contour is inside an other contour, no segments intersects, but the zones can be combined
// test a corner inside an outline (only one corner is enought)
/* for( int ic2 = 0; ic2 < poly2->GetNumCorners(); ic2++ )
{
int x = poly2->GetX( ic2 );
int y = poly2->GetY( ic2 );
if( poly1->TestPointInside( x, y ) )
{
return true;
}
}
}
for( int ic1 = 0; ic1 < poly1->GetNumCorners(); ic1++ )
{
int x = poly1->GetX( ic1 );
int y = poly1->GetY( ic1 );
if( poly2->TestPointInside( x, y ) )
{
return true;
}
}
*/
}
return
false
;
return
false
;
}
}
...
@@ -594,9 +616,9 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_
...
@@ -594,9 +616,9 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_
xi2
,
yi2
,
xf2
,
yf2
,
style2
);
xi2
,
yi2
,
xf2
,
yf2
,
style2
);
if
(
n_int
)
if
(
n_int
)
{
{
bInt
=
TRUE
;
bInt
=
true
;
if
(
style1
!=
CPolyLine
::
STRAIGHT
||
style2
!=
CPolyLine
::
STRAIGHT
)
if
(
style1
!=
CPolyLine
::
STRAIGHT
||
style2
!=
CPolyLine
::
STRAIGHT
)
bArcInt
=
TRUE
;
bArcInt
=
true
;
break
;
break
;
}
}
}
}
...
@@ -614,7 +636,32 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_
...
@@ -614,7 +636,32 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_
}
}
if
(
!
bInt
)
if
(
!
bInt
)
return
0
;
{
/* if( bArcInt ) return 0;
// If a contour is inside an other contour, no segments intersects, but the zones can be combined
// test a corner inside an outline (only one corner is enought)
for( int ic2 = 0; ic2 < poly2->GetNumCorners(); ic2++ )
{
int x = poly2->GetX( ic2 );
int y = poly2->GetY( ic2 );
if( poly1->TestPointInside( x, y ) )
{
return 1;
}
}
for( int ic1 = 0; ic1 < poly1->GetNumCorners(); ic1++ )
{
int x = poly1->GetX( ic1 );
int y = poly1->GetY( ic1 );
if( poly2->TestPointInside( x, y ) )
{
return 1;
}
}
*/
return
0
;
}
if
(
bArcInt
)
if
(
bArcInt
)
return
2
;
return
2
;
return
1
;
return
1
;
...
...
polygon/PolyLine.cpp
View file @
f85ade75
...
@@ -10,6 +10,9 @@ using namespace std;
...
@@ -10,6 +10,9 @@ using namespace std;
#include <math.h>
#include <math.h>
#include <vector>
#include <vector>
#include "fctsys.h"
#include "PolyLine.h"
#include "PolyLine.h"
#define to_int(x) (int)round((x))
#define to_int(x) (int)round((x))
...
@@ -83,8 +86,7 @@ int CPolyLine::NormalizeWithGpc( std::vector<CPolyLine*> * pa, bool bRetainArcs
...
@@ -83,8 +86,7 @@ int CPolyLine::NormalizeWithGpc( std::vector<CPolyLine*> * pa, bool bRetainArcs
{
{
// next external contour, create new poly
// next external contour, create new poly
CPolyLine
*
poly
=
new
CPolyLine
;
CPolyLine
*
poly
=
new
CPolyLine
;
pa
->
SetSize
(
n_ext_cont
);
// put in array
pa
->
push_back
(
poly
);
// put in array
(
*
pa
)[
n_ext_cont
-
1
]
=
poly
;
for
(
int
i
=
0
;
i
<
m_gpc_poly
->
contour
[
ic
].
num_vertices
;
i
++
)
for
(
int
i
=
0
;
i
<
m_gpc_poly
->
contour
[
ic
].
num_vertices
;
i
++
)
{
{
int
x
=
to_int
(((
m_gpc_poly
->
contour
)[
ic
].
vertex
)[
i
].
x
);
int
x
=
to_int
(((
m_gpc_poly
->
contour
)[
ic
].
vertex
)[
i
].
x
);
...
@@ -136,7 +138,7 @@ int CPolyLine::NormalizeWithGpc( std::vector<CPolyLine*> * pa, bool bRetainArcs
...
@@ -136,7 +138,7 @@ int CPolyLine::NormalizeWithGpc( std::vector<CPolyLine*> * pa, bool bRetainArcs
}
}
}
}
if
(
!
ext_poly
)
if
(
!
ext_poly
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
for
(
int
i
=
0
;
i
<
m_gpc_poly
->
contour
[
ic
].
num_vertices
;
i
++
)
for
(
int
i
=
0
;
i
<
m_gpc_poly
->
contour
[
ic
].
num_vertices
;
i
++
)
{
{
int
x
=
to_int
(((
m_gpc_poly
->
contour
)[
ic
].
vertex
)[
i
].
x
);
int
x
=
to_int
(((
m_gpc_poly
->
contour
)[
ic
].
vertex
)[
i
].
x
);
...
@@ -422,7 +424,7 @@ int CPolyLine::MakeGpcPoly( int icontour, std::vector<CArc> * arc_array )
...
@@ -422,7 +424,7 @@ int CPolyLine::MakeGpcPoly( int icontour, std::vector<CArc> * arc_array )
}
}
}
}
if
(
n_vertices
!=
ivtx
)
if
(
n_vertices
!=
ivtx
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
// add vertex_list to gpc
// add vertex_list to gpc
gpc_add_contour
(
gpc
,
g_v_list
,
0
);
gpc_add_contour
(
gpc
,
g_v_list
,
0
);
// now clip m_gpc_poly with gpc, put new poly into result
// now clip m_gpc_poly with gpc, put new poly into result
...
@@ -641,7 +643,7 @@ void CPolyLine::AppendCorner( int x, int y, int style, bool bDraw )
...
@@ -641,7 +643,7 @@ void CPolyLine::AppendCorner( int x, int y, int style, bool bDraw )
else
if
(
style
==
CPolyLine
::
ARC_CCW
)
else
if
(
style
==
CPolyLine
::
ARC_CCW
)
dl_type
=
DL_ARC_CCW
;
dl_type
=
DL_ARC_CCW
;
else
else
ASSERT
(
0
);
wx
ASSERT
(
0
);
if
(
bDraw
)
if
(
bDraw
)
Draw
();
Draw
();
}
}
...
@@ -651,7 +653,7 @@ void CPolyLine::AppendCorner( int x, int y, int style, bool bDraw )
...
@@ -651,7 +653,7 @@ void CPolyLine::AppendCorner( int x, int y, int style, bool bDraw )
void
CPolyLine
::
Close
(
int
style
,
bool
bDraw
)
void
CPolyLine
::
Close
(
int
style
,
bool
bDraw
)
{
{
if
(
GetClosed
()
)
if
(
GetClosed
()
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
Undraw
();
Undraw
();
side_style
[
corner
.
size
()
-
1
]
=
style
;
side_style
[
corner
.
size
()
-
1
]
=
style
;
corner
[
corner
.
size
()
-
1
].
end_contour
=
TRUE
;
corner
[
corner
.
size
()
-
1
].
end_contour
=
TRUE
;
...
@@ -720,7 +722,7 @@ void CPolyLine::RemoveContour( int icont )
...
@@ -720,7 +722,7 @@ void CPolyLine::RemoveContour( int icont )
if
(
icont
==
0
&&
GetNumContours
()
==
1
)
if
(
icont
==
0
&&
GetNumContours
()
==
1
)
{
{
// remove the only contour
// remove the only contour
ASSERT
(
0
);
wx
ASSERT
(
0
);
}
}
else
if
(
icont
==
GetNumContours
()
-
1
)
else
if
(
icont
==
GetNumContours
()
-
1
)
{
{
...
@@ -919,7 +921,7 @@ int CPolyLine::GetContourStart( int icont )
...
@@ -919,7 +921,7 @@ int CPolyLine::GetContourStart( int icont )
return
i
+
1
;
return
i
+
1
;
}
}
}
}
ASSERT
(
0
);
wx
ASSERT
(
0
);
return
0
;
return
0
;
}
}
...
@@ -941,7 +943,7 @@ int CPolyLine::GetContourEnd( int icont )
...
@@ -941,7 +943,7 @@ int CPolyLine::GetContourEnd( int icont )
ncont
++
;
ncont
++
;
}
}
}
}
ASSERT
(
0
);
wx
ASSERT
(
0
);
return
0
;
return
0
;
}
}
...
@@ -1062,7 +1064,7 @@ void CPolyLine::Hatch()
...
@@ -1062,7 +1064,7 @@ void CPolyLine::Hatch()
else
if
(
layer
<
(
LAY_TOP_COPPER
+
16
)
)
else
if
(
layer
<
(
LAY_TOP_COPPER
+
16
)
)
offset
=
7
*
spacing
/
8
;
offset
=
7
*
spacing
/
8
;
else
else
ASSERT
(
0
);
wx
ASSERT
(
0
);
min_a
+=
offset
;
min_a
+=
offset
;
// now calculate and draw hatch lines
// now calculate and draw hatch lines
...
@@ -1104,20 +1106,20 @@ void CPolyLine::Hatch()
...
@@ -1104,20 +1106,20 @@ void CPolyLine::Hatch()
xx
[
npts
]
=
(
int
)
x
;
xx
[
npts
]
=
(
int
)
x
;
yy
[
npts
]
=
(
int
)
y
;
yy
[
npts
]
=
(
int
)
y
;
npts
++
;
npts
++
;
ASSERT
(
npts
<
MAXPTS
);
// overflow
wx
ASSERT
(
npts
<
MAXPTS
);
// overflow
}
}
if
(
ok
==
2
)
if
(
ok
==
2
)
{
{
xx
[
npts
]
=
(
int
)
x2
;
xx
[
npts
]
=
(
int
)
x2
;
yy
[
npts
]
=
(
int
)
y2
;
yy
[
npts
]
=
(
int
)
y2
;
npts
++
;
npts
++
;
ASSERT
(
npts
<
MAXPTS
);
// overflow
wx
ASSERT
(
npts
<
MAXPTS
);
// overflow
}
}
}
}
nloops
++
;
nloops
++
;
a
+=
PCBU_PER_MIL
/
100
;
a
+=
PCBU_PER_MIL
/
100
;
}
while
(
npts
%
2
!=
0
&&
nloops
<
3
);
}
while
(
npts
%
2
!=
0
&&
nloops
<
3
);
ASSERT
(
npts
%
2
==
0
);
// odd number of intersection points, error
wx
ASSERT
(
npts
%
2
==
0
);
// odd number of intersection points, error
// sort points in order of descending x (if more than 2)
// sort points in order of descending x (if more than 2)
if
(
npts
>
2
)
if
(
npts
>
2
)
...
@@ -1177,7 +1179,7 @@ bool CPolyLine::TestPointInside( int x, int y )
...
@@ -1177,7 +1179,7 @@ bool CPolyLine::TestPointInside( int x, int y )
{
{
enum
{
MAXPTS
=
100
};
enum
{
MAXPTS
=
100
};
if
(
!
GetClosed
()
)
if
(
!
GetClosed
()
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
// define line passing through (x,y), with slope = 2/3;
// define line passing through (x,y), with slope = 2/3;
// get intersection points
// get intersection points
...
@@ -1216,21 +1218,21 @@ bool CPolyLine::TestPointInside( int x, int y )
...
@@ -1216,21 +1218,21 @@ bool CPolyLine::TestPointInside( int x, int y )
xx
[
npts
]
=
(
int
)
x
;
xx
[
npts
]
=
(
int
)
x
;
yy
[
npts
]
=
(
int
)
y
;
yy
[
npts
]
=
(
int
)
y
;
npts
++
;
npts
++
;
ASSERT
(
npts
<
MAXPTS
);
// overflow
wx
ASSERT
(
npts
<
MAXPTS
);
// overflow
}
}
if
(
ok
==
2
)
if
(
ok
==
2
)
{
{
xx
[
npts
]
=
(
int
)
x2
;
xx
[
npts
]
=
(
int
)
x2
;
yy
[
npts
]
=
(
int
)
y2
;
yy
[
npts
]
=
(
int
)
y2
;
npts
++
;
npts
++
;
ASSERT
(
npts
<
MAXPTS
);
// overflow
wx
ASSERT
(
npts
<
MAXPTS
);
// overflow
}
}
}
}
}
}
nloops
++
;
nloops
++
;
a
+=
PCBU_PER_MIL
/
100
;
a
+=
PCBU_PER_MIL
/
100
;
}
while
(
npts
%
2
!=
0
&&
nloops
<
3
);
}
while
(
npts
%
2
!=
0
&&
nloops
<
3
);
ASSERT
(
npts
%
2
==
0
);
// odd number of intersection points, error
wx
ASSERT
(
npts
%
2
==
0
);
// odd number of intersection points, error
// count intersection points to right of (x,y), if odd (x,y) is inside polyline
// count intersection points to right of (x,y), if odd (x,y) is inside polyline
int
ncount
=
0
;
int
ncount
=
0
;
...
@@ -1256,7 +1258,7 @@ bool CPolyLine::TestPointInsideContour( int icont, int x, int y )
...
@@ -1256,7 +1258,7 @@ bool CPolyLine::TestPointInsideContour( int icont, int x, int y )
enum
{
MAXPTS
=
100
};
enum
{
MAXPTS
=
100
};
if
(
!
GetClosed
()
)
if
(
!
GetClosed
()
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
// define line passing through (x,y), with slope = 2/3;
// define line passing through (x,y), with slope = 2/3;
// get intersection points
// get intersection points
...
@@ -1293,20 +1295,20 @@ bool CPolyLine::TestPointInsideContour( int icont, int x, int y )
...
@@ -1293,20 +1295,20 @@ bool CPolyLine::TestPointInsideContour( int icont, int x, int y )
xx
[
npts
]
=
(
int
)
x
;
xx
[
npts
]
=
(
int
)
x
;
yy
[
npts
]
=
(
int
)
y
;
yy
[
npts
]
=
(
int
)
y
;
npts
++
;
npts
++
;
ASSERT
(
npts
<
MAXPTS
);
// overflow
wx
ASSERT
(
npts
<
MAXPTS
);
// overflow
}
}
if
(
ok
==
2
)
if
(
ok
==
2
)
{
{
xx
[
npts
]
=
(
int
)
x2
;
xx
[
npts
]
=
(
int
)
x2
;
yy
[
npts
]
=
(
int
)
y2
;
yy
[
npts
]
=
(
int
)
y2
;
npts
++
;
npts
++
;
ASSERT
(
npts
<
MAXPTS
);
// overflow
wx
ASSERT
(
npts
<
MAXPTS
);
// overflow
}
}
}
}
nloops
++
;
nloops
++
;
a
+=
PCBU_PER_MIL
/
100
;
a
+=
PCBU_PER_MIL
/
100
;
}
while
(
npts
%
2
!=
0
&&
nloops
<
3
);
}
while
(
npts
%
2
!=
0
&&
nloops
<
3
);
ASSERT
(
npts
%
2
==
0
);
// odd number of intersection points, error
wx
ASSERT
(
npts
%
2
==
0
);
// odd number of intersection points, error
// count intersection points to right of (x,y), if odd (x,y) is inside polyline
// count intersection points to right of (x,y), if odd (x,y) is inside polyline
int
ncount
=
0
;
int
ncount
=
0
;
...
@@ -1328,9 +1330,9 @@ bool CPolyLine::TestPointInsideContour( int icont, int x, int y )
...
@@ -1328,9 +1330,9 @@ bool CPolyLine::TestPointInsideContour( int icont, int x, int y )
int
CPolyLine
::
TestIntersection
(
CPolyLine
*
poly
)
int
CPolyLine
::
TestIntersection
(
CPolyLine
*
poly
)
{
{
if
(
!
GetClosed
()
)
if
(
!
GetClosed
()
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
if
(
!
poly
->
GetClosed
()
)
if
(
!
poly
->
GetClosed
()
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
for
(
int
ic
=
0
;
ic
<
GetNumContours
();
ic
++
)
for
(
int
ic
=
0
;
ic
<
GetNumContours
();
ic
++
)
{
{
int
istart
=
GetContourStart
(
ic
);
int
istart
=
GetContourStart
(
ic
);
...
...
polygon/defs-macros.h
View file @
f85ade75
...
@@ -36,6 +36,4 @@
...
@@ -36,6 +36,4 @@
#define TRACE printf
#define TRACE printf
#define ASSERT(x) // todo : change to wxASSERT, under wxWidgets
#endif // ifndef DEFS_MACROS_H
#endif // ifndef DEFS_MACROS_H
polygon/php_polygon.cpp
View file @
f85ade75
...
@@ -50,6 +50,9 @@
...
@@ -50,6 +50,9 @@
#include <math.h>
#include <math.h>
#include "fctsys.h"
#include "php_polygon_vertex.h"
#include "php_polygon_vertex.h"
#include "php_polygon.h"
#include "php_polygon.h"
...
@@ -427,9 +430,9 @@ BOOL polygon::ints( vertex * p1, vertex * p2, vertex * q1, vertex * q2,
...
@@ -427,9 +430,9 @@ BOOL polygon::ints( vertex * p1, vertex * p2, vertex * q1, vertex * q2,
double
tua
=
((
tx4
-
tx3
)
*
(
ty1
-
ty3
)
-
(
ty4
-
ty3
)
*
(
tx1
-
tx3
))
/
td
;
double
tua
=
((
tx4
-
tx3
)
*
(
ty1
-
ty3
)
-
(
ty4
-
ty3
)
*
(
tx1
-
tx3
))
/
td
;
double
tub
=
((
tx2
-
tx1
)
*
(
ty1
-
ty3
)
-
(
ty2
-
ty1
)
*
(
tx1
-
tx3
))
/
td
;
double
tub
=
((
tx2
-
tx1
)
*
(
ty1
-
ty3
)
-
(
ty2
-
ty1
)
*
(
tx1
-
tx3
))
/
td
;
if
(
abs
(
tua
)
<=
eps
||
abs
(
1.0
-
tua
)
<=
eps
||
abs
(
tub
)
<=
eps
||
abs
(
1.0
-
tub
)
<=
eps
)
if
(
abs
(
tua
)
<=
eps
||
abs
(
1.0
-
tua
)
<=
eps
||
abs
(
tub
)
<=
eps
||
abs
(
1.0
-
tub
)
<=
eps
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
else
if
(
(
tua
>
0
&&
tua
<
1
)
&&
(
tub
>
0
&&
tub
<
1
)
)
else
if
(
(
tua
>
0
&&
tua
<
1
)
&&
(
tub
>
0
&&
tub
<
1
)
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
TRACE
(
" perturb:
\n
new s = (%f,%f) to (%f,%f)
\n
new c = (%f,%f) to (%f,%f)
\n
new ua = %.17f, ub = %.17f
\n
"
,
TRACE
(
" perturb:
\n
new s = (%f,%f) to (%f,%f)
\n
new c = (%f,%f) to (%f,%f)
\n
new ua = %.17f, ub = %.17f
\n
"
,
tx1
,
ty1
,
tx2
,
ty2
,
tx3
,
ty3
,
tx4
,
ty4
,
tua
,
tub
);
tx1
,
ty1
,
tx2
,
ty2
,
tx3
,
ty3
,
tx4
,
ty4
,
tua
,
tub
);
}
}
...
@@ -650,7 +653,7 @@ BOOL polygon::isInside( vertex * v )
...
@@ -650,7 +653,7 @@ BOOL polygon::isInside( vertex * v )
{
{
//** modified for testing
//** modified for testing
if
(
v
->
isIntersect
()
)
if
(
v
->
isIntersect
()
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
int
winding_number
=
0
;
int
winding_number
=
0
;
int
winding_number2
=
0
;
int
winding_number2
=
0
;
int
winding_number3
=
0
;
int
winding_number3
=
0
;
...
@@ -689,7 +692,7 @@ BOOL polygon::isInside( vertex * v )
...
@@ -689,7 +692,7 @@ BOOL polygon::isInside( vertex * v )
if
(
winding_number
%
2
!=
winding_number2
%
2
if
(
winding_number
%
2
!=
winding_number2
%
2
||
winding_number3
%
2
!=
winding_number4
%
2
||
winding_number3
%
2
!=
winding_number4
%
2
||
winding_number
%
2
!=
winding_number3
%
2
)
||
winding_number
%
2
!=
winding_number3
%
2
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
if
(
winding_number
%
2
==
0
)
// Check even or odd
if
(
winding_number
%
2
==
0
)
// Check even or odd
return
FALSE
;
// even == outside
return
FALSE
;
// even == outside
else
else
...
@@ -780,9 +783,9 @@ polygon * polygon::boolean( polygon * polyB, int oper )
...
@@ -780,9 +783,9 @@ polygon * polygon::boolean( polygon * polyB, int oper )
s
=
s
->
Next
();
s
=
s
->
Next
();
}
while
(
s
->
id
()
!=
polyB
->
m_first
->
id
()
);
}
while
(
s
->
id
()
!=
polyB
->
m_first
->
id
()
);
if
(
n_ints
!=
n_polyB_ints
)
if
(
n_ints
!=
n_polyB_ints
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
if
(
n_ints
%
2
!=
0
)
if
(
n_ints
%
2
!=
0
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
//** end test
//** end test
/*
/*
...
@@ -817,7 +820,7 @@ polygon * polygon::boolean( polygon * polyB, int oper )
...
@@ -817,7 +820,7 @@ polygon * polygon::boolean( polygon * polyB, int oper )
s
=
m_first
;
s
=
m_first
;
//** testing
//** testing
if
(
s
->
isIntersect
()
)
if
(
s
->
isIntersect
()
)
ASSERT
(
0
);
wx
ASSERT
(
0
);
//** end test
//** end test
BOOL
entry
;
BOOL
entry
;
if
(
polyB
->
isInside
(
s
))
// if we are already inside
if
(
polyB
->
isInside
(
s
))
// if we are already inside
...
...
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