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
ef2e41e3
Commit
ef2e41e3
authored
Sep 10, 2009
by
charras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
--no commit message
--no commit message
parent
90228980
Changes
43
Hide whitespace changes
Inline
Side-by-side
Showing
43 changed files
with
2572 additions
and
2189 deletions
+2572
-2189
CHANGELOG.txt
CHANGELOG.txt
+8
-0
block_libedit.cpp
eeschema/block_libedit.cpp
+1
-1
lib_export.cpp
eeschema/lib_export.cpp
+1
-1
wxPcbStruct.h
include/wxPcbStruct.h
+8
-3
kicad.mo
internat/fr/kicad.mo
+0
-0
kicad.po
internat/fr/kicad.po
+823
-790
CMakeLists.txt
pcbnew/CMakeLists.txt
+1
-8
class_zone.h
pcbnew/class_zone.h
+1
-0
debug_kbool_key_file_fct.cpp
pcbnew/debug_kbool_key_file_fct.cpp
+150
-0
debug_kbool_key_file_fct.h
pcbnew/debug_kbool_key_file_fct.h
+44
-0
drc.cpp
pcbnew/drc.cpp
+3
-6
zones_by_polygon.cpp
pcbnew/zones_by_polygon.cpp
+3
-2
zones_convert_brd_items_to_polygons.cpp
pcbnew/zones_convert_brd_items_to_polygons.cpp
+171
-7
zones_test_and_combine_areas.cpp
pcbnew/zones_test_and_combine_areas.cpp
+2
-2
PolyLine.cpp
polygon/PolyLine.cpp
+9
-6
_dl_itr.cpp
polygon/kbool/include/kbool/_dl_itr.cpp
+214
-214
_dl_itr.h
polygon/kbool/include/kbool/_dl_itr.h
+11
-9
_lnk_itr.cpp
polygon/kbool/include/kbool/_lnk_itr.cpp
+2
-2
_lnk_itr.h
polygon/kbool/include/kbool/_lnk_itr.h
+4
-4
booleng.h
polygon/kbool/include/kbool/booleng.h
+51
-46
graph.h
polygon/kbool/include/kbool/graph.h
+30
-30
graphlst.h
polygon/kbool/include/kbool/graphlst.h
+6
-6
line.h
polygon/kbool/include/kbool/line.h
+31
-31
link.h
polygon/kbool/include/kbool/link.h
+37
-37
lpoint.h
polygon/kbool/include/kbool/lpoint.h
+15
-15
node.h
polygon/kbool/include/kbool/node.h
+24
-24
record.h
polygon/kbool/include/kbool/record.h
+12
-12
scanbeam.h
polygon/kbool/include/kbool/scanbeam.h
+11
-11
statusb.h
polygon/kbool/include/kbool/statusb.h
+3
-3
valuesvc.h
polygon/kbool/include/kbool/valuesvc.h
+2
-2
boolonly.cpp
polygon/kbool/samples/boolonly/boolonly.cpp
+174
-169
boolonly.h
polygon/kbool/samples/boolonly/boolonly.h
+15
-19
boolonly.rc
polygon/kbool/samples/boolonly/boolonly.rc
+2
-0
booleng.cpp
polygon/kbool/src/booleng.cpp
+36
-56
graph.cpp
polygon/kbool/src/graph.cpp
+242
-239
graphlst.cpp
polygon/kbool/src/graphlst.cpp
+42
-42
instonly.cpp
polygon/kbool/src/instonly.cpp
+2
-2
line.cpp
polygon/kbool/src/line.cpp
+118
-118
link.cpp
polygon/kbool/src/link.cpp
+63
-63
lpoint.cpp
polygon/kbool/src/lpoint.cpp
+23
-23
node.cpp
polygon/kbool/src/node.cpp
+60
-60
record.cpp
polygon/kbool/src/record.cpp
+16
-16
scanbeam.cpp
polygon/kbool/src/scanbeam.cpp
+101
-110
No files found.
CHANGELOG.txt
View file @
ef2e41e3
...
@@ -4,6 +4,14 @@ KiCad ChangeLog 2009
...
@@ -4,6 +4,14 @@ KiCad ChangeLog 2009
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.
2009-sept-10 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
++pcbnew
Work on undo/redo in pcbnew finished.
Used kbool V2.0. This version solves some problems in zones calculationsb but not all.
The Kbool author, Klaas Holveda, is still working on these problems
Thanks to Klaas
2009-aug-23 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
2009-aug-23 UPDATE Jean-Pierre Charras <jean-pierre.charras@gipsa-lab.inpg.fr>
================================================================================
================================================================================
++pcbnew
++pcbnew
...
...
eeschema/block_libedit.cpp
View file @
ef2e41e3
...
@@ -185,7 +185,7 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
...
@@ -185,7 +185,7 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
case
COMPONENT_FIELD_DRAW_TYPE
:
case
COMPONENT_FIELD_DRAW_TYPE
:
break
;
break
;
def
ua
lt:
def
au
lt:
break
;
break
;
}
}
}
}
...
...
eeschema/lib_export.cpp
View file @
ef2e41e3
...
@@ -40,7 +40,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
...
@@ -40,7 +40,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
wxFileName
fn
;
wxFileName
fn
;
LibraryStruct
*
LibTmp
;
LibraryStruct
*
LibTmp
;
LibCmpEntry
*
LibEntry
;
LibCmpEntry
*
LibEntry
;
bool
entryLoaded
;
bool
entryLoaded
=
false
;
LibItemToRepeat
=
NULL
;
LibItemToRepeat
=
NULL
;
...
...
include/wxPcbStruct.h
View file @
ef2e41e3
...
@@ -63,7 +63,6 @@ private:
...
@@ -63,7 +63,6 @@ private:
DRC
*
m_drc
;
///< the DRC controller, see drc.cpp
DRC
*
m_drc
;
///< the DRC controller, see drc.cpp
// we'll use lower case function names for private member functions.
// we'll use lower case function names for private member functions.
void
createPopUpMenuForZones
(
ZONE_CONTAINER
*
edge_zone
,
wxMenu
*
aPopMenu
);
void
createPopUpMenuForZones
(
ZONE_CONTAINER
*
edge_zone
,
wxMenu
*
aPopMenu
);
void
createPopUpMenuForFootprints
(
MODULE
*
aModule
,
wxMenu
*
aPopMenu
);
void
createPopUpMenuForFootprints
(
MODULE
*
aModule
,
wxMenu
*
aPopMenu
);
...
@@ -262,6 +261,12 @@ public:
...
@@ -262,6 +261,12 @@ public:
* @param aQuery = true to prompt user for confirmation, false to initialize silently
* @param aQuery = true to prompt user for confirmation, false to initialize silently
*/
*/
bool
Clear_Pcb
(
bool
aQuery
);
bool
Clear_Pcb
(
bool
aQuery
);
// Drc control
/* function GetDrcController
* @return the DRC controller
*/
DRC
*
GetDrcController
()
{
return
m_drc
;}
///< return the DRC controller, see drc.cpp
/**
/**
* Function RecreateBOMFileFromBoard
* Function RecreateBOMFileFromBoard
...
@@ -426,8 +431,8 @@ public:
...
@@ -426,8 +431,8 @@ public:
* @param aDC = the current device context (can be NULL)
* @param aDC = the current device context (can be NULL)
* @param aNewTrack = the new created track (a pointer to a segment of the track list)
* @param aNewTrack = the new created track (a pointer to a segment of the track list)
* @param aNewTrackSegmentsCount = number of segments in this new track
* @param aNewTrackSegmentsCount = number of segments in this new track
* @param aItemsListPicker = the list picker to use for an undo command (can be NULL)
* @param aItemsListPicker = the list picker to use for an undo command (can be NULL)
*/
*/
int
EraseRedundantTrack
(
wxDC
*
aDC
,
TRACK
*
aNewTrack
,
int
aNewTrackSegmentsCount
,
int
EraseRedundantTrack
(
wxDC
*
aDC
,
TRACK
*
aNewTrack
,
int
aNewTrackSegmentsCount
,
PICKED_ITEMS_LIST
*
aItemsListPicker
);
PICKED_ITEMS_LIST
*
aItemsListPicker
);
...
...
internat/fr/kicad.mo
View file @
ef2e41e3
No preview for this file type
internat/fr/kicad.po
View file @
ef2e41e3
...
@@ -2,8 +2,8 @@ msgid ""
...
@@ -2,8 +2,8 @@ msgid ""
msgstr ""
msgstr ""
"Project-Id-Version: kicad\n"
"Project-Id-Version: kicad\n"
"Report-Msgid-Bugs-To: \n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2009-0
8-28 10:49
+0100\n"
"POT-Creation-Date: 2009-0
9-05 17:38
+0100\n"
"PO-Revision-Date: 2009-0
8-28 11:02
+0100\n"
"PO-Revision-Date: 2009-0
9-05 17:51
+0100\n"
"Last-Translator: \n"
"Last-Translator: \n"
"Language-Team: kicad team <jean-pierre.charras@ujf-grenoble.fr>\n"
"Language-Team: kicad team <jean-pierre.charras@ujf-grenoble.fr>\n"
"MIME-Version: 1.0\n"
"MIME-Version: 1.0\n"
...
@@ -888,7 +888,7 @@ msgstr "%s pin %s non trouvée"
...
@@ -888,7 +888,7 @@ msgstr "%s pin %s non trouvée"
msgid "%s pin %s found"
msgid "%s pin %s found"
msgstr "%s pin %s trouvée"
msgstr "%s pin %s trouvée"
#: pcbnew/gen_drill_report_files.cpp:26
4
#: pcbnew/gen_drill_report_files.cpp:26
7
msgid ""
msgid ""
" Drill map: Too many diameter values to draw to draw one symbol per drill value (max 13)\n"
" Drill map: Too many diameter values to draw to draw one symbol per drill value (max 13)\n"
"Plot uses circle shape for some drill values"
"Plot uses circle shape for some drill values"
...
@@ -1058,41 +1058,6 @@ msgstr " chargé"
...
@@ -1058,41 +1058,6 @@ msgstr " chargé"
msgid "Modules [%d items]"
msgid "Modules [%d items]"
msgstr "Modules [%d éléments]"
msgstr "Modules [%d éléments]"
#: pcbnew/drc.cpp:201
msgid "Compile Ratsnest"
msgstr "Calcul du chevelu"
#: pcbnew/drc.cpp:204
#: pcbnew/drc.cpp:228
msgid " Ok\n"
msgstr " Ok\n"
#: pcbnew/drc.cpp:213
msgid "Test pads to pads clearance"
msgstr "Test isolation pad a pad"
#: pcbnew/drc.cpp:216
#: pcbnew/drc.cpp:235
#: pcbnew/drc.cpp:244
msgid "\n"
msgstr "\n"
#: pcbnew/drc.cpp:225
msgid "Fill zones"
msgstr "Remplissage Zones"
#: pcbnew/drc.cpp:232
msgid "Test zones"
msgstr "Test zones"
#: pcbnew/drc.cpp:241
msgid "List unconnected pads"
msgstr "Liste pads non connectés"
#: pcbnew/drc.cpp:250
msgid "Finished\n"
msgstr "Fini\n"
#: pcbnew/cleaningoptions_dialog.cpp:146
#: pcbnew/cleaningoptions_dialog.cpp:146
msgid "Static"
msgid "Static"
msgstr "Statique"
msgstr "Statique"
...
@@ -2358,246 +2323,246 @@ msgstr "Itération"
...
@@ -2358,246 +2323,246 @@ msgstr "Itération"
msgid "Ok to abort ?"
msgid "Ok to abort ?"
msgstr "Ok pour arrêter ?"
msgstr "Ok pour arrêter ?"
#: pcbnew/pcbplot.cpp:1
65
#: pcbnew/pcbplot.cpp:1
78
#: pcbnew/pcbplot.cpp:3
15
#: pcbnew/pcbplot.cpp:3
28
msgid "Plot"
msgid "Plot"
msgstr "Tracer"
msgstr "Tracer"
#: pcbnew/pcbplot.cpp:2
13
#: pcbnew/pcbplot.cpp:2
26
msgid "Plot Format"
msgid "Plot Format"
msgstr "Format de tracé"
msgstr "Format de tracé"
#: pcbnew/pcbplot.cpp:2
28
#: pcbnew/pcbplot.cpp:2
41
msgid "HPGL Options:"
msgid "HPGL Options:"
msgstr "Options HPGL:"
msgstr "Options HPGL:"
#: pcbnew/pcbplot.cpp:2
33
#: pcbnew/pcbplot.cpp:2
46
msgid "Pen Size"
msgid "Pen Size"
msgstr "Diam Plume"
msgstr "Diam Plume"
#: pcbnew/pcbplot.cpp:2
40
#: pcbnew/pcbplot.cpp:2
53
msgid "Pen Speed (cm/s)"
msgid "Pen Speed (cm/s)"
msgstr "Vitesse Plume ( cm/s )"
msgstr "Vitesse Plume ( cm/s )"
#: pcbnew/pcbplot.cpp:2
44
#: pcbnew/pcbplot.cpp:2
57
msgid "Set pen speed in cm/s"
msgid "Set pen speed in cm/s"
msgstr "Ajuster Vitesse plume en centimètres par seconde"
msgstr "Ajuster Vitesse plume en centimètres par seconde"
#: pcbnew/pcbplot.cpp:2
46
#: pcbnew/pcbplot.cpp:2
59
msgid "Pen ovr"
msgid "Pen ovr"
msgstr "Recouvrement"
msgstr "Recouvrement"
#: pcbnew/pcbplot.cpp:2
52
#: pcbnew/pcbplot.cpp:2
65
msgid "Set plot overlay for filling"
msgid "Set plot overlay for filling"
msgstr "Ajuste recouvrement des tracés pour les remplissages"
msgstr "Ajuste recouvrement des tracés pour les remplissages"
#: pcbnew/pcbplot.cpp:2
54
#: pcbnew/pcbplot.cpp:2
67
msgid "Lines Width"
msgid "Lines Width"
msgstr "Epaiss. Lignes"
msgstr "Epaiss. Lignes"
#: pcbnew/pcbplot.cpp:2
60
#: pcbnew/pcbplot.cpp:2
73
msgid "Set lines width used to plot in sketch mode and plot pads outlines on silk screen layers"
msgid "Set lines width used to plot in sketch mode and plot pads outlines on silk screen layers"
msgstr "Ajuste l'épaisseur des lignes utilisées pour tracer en mode contour et pour les contours des pads sur les couches de sérigraphie"
msgstr "Ajuste l'épaisseur des lignes utilisées pour tracer en mode contour et pour les contours des pads sur les couches de sérigraphie"
#: pcbnew/pcbplot.cpp:2
65
#: pcbnew/pcbplot.cpp:2
78
msgid "Absolute"
msgid "Absolute"
msgstr "Absolu"
msgstr "Absolu"
#: pcbnew/pcbplot.cpp:2
65
#: pcbnew/pcbplot.cpp:2
78
msgid "Auxiliary axis"
msgid "Auxiliary axis"
msgstr "Axe Auxiliaire"
msgstr "Axe Auxiliaire"
#: pcbnew/pcbplot.cpp:2
68
#: pcbnew/pcbplot.cpp:2
81
msgid "Plot Origin"
msgid "Plot Origin"
msgstr "Origine des Coord de Tracé"
msgstr "Origine des Coord de Tracé"
#: pcbnew/pcbplot.cpp:
296
#: pcbnew/pcbplot.cpp:
309
msgid "X scale adjust"
msgid "X scale adjust"
msgstr "Ajustage Echelle X"
msgstr "Ajustage Echelle X"
#: pcbnew/pcbplot.cpp:
299
#: pcbnew/pcbplot.cpp:
312
msgid "Set X scale adjust for exact scale plotting"
msgid "Set X scale adjust for exact scale plotting"
msgstr "Ajuster échelle X pour traçage à l'échelle exacte"
msgstr "Ajuster échelle X pour traçage à l'échelle exacte"
#: pcbnew/pcbplot.cpp:3
03
#: pcbnew/pcbplot.cpp:3
16
msgid "Y scale adjust"
msgid "Y scale adjust"
msgstr "Ajustage Echelle Y"
msgstr "Ajustage Echelle Y"
#: pcbnew/pcbplot.cpp:3
06
#: pcbnew/pcbplot.cpp:3
19
msgid "Set Y scale adjust for exact scale plotting"
msgid "Set Y scale adjust for exact scale plotting"
msgstr "Ajuster échelle Y pour traçage à l'échelle exacte"
msgstr "Ajuster échelle Y pour traçage à l'échelle exacte"
#: pcbnew/pcbplot.cpp:3
09
#: pcbnew/pcbplot.cpp:3
22
msgid "Plot negative"
msgid "Plot negative"
msgstr "Tracé en Négatif"
msgstr "Tracé en Négatif"
#: pcbnew/pcbplot.cpp:3
18
#: pcbnew/pcbplot.cpp:3
31
msgid "Save Options"
msgid "Save Options"
msgstr "Sauver Options"
msgstr "Sauver Options"
#: pcbnew/pcbplot.cpp:3
22
#: pcbnew/pcbplot.cpp:3
35
msgid "Generate drill file"
msgid "Generate drill file"
msgstr "Créer Fichier de perçage"
msgstr "Créer Fichier de perçage"
#: pcbnew/pcbplot.cpp:3
25
#: pcbnew/pcbplot.cpp:3
38
msgid "Close"
msgid "Close"
msgstr "Fermer"
msgstr "Fermer"
#: pcbnew/pcbplot.cpp:3
71
#: pcbnew/pcbplot.cpp:3
84
msgid "Exclude Edges_Pcb layer"
msgid "Exclude Edges_Pcb layer"
msgstr "Exclure Couche Contours PCB"
msgstr "Exclure Couche Contours PCB"
#: pcbnew/pcbplot.cpp:3
75
#: pcbnew/pcbplot.cpp:3
88
msgid "Exclude contents of Edges_Pcb layer from all other layers"
msgid "Exclude contents of Edges_Pcb layer from all other layers"
msgstr "Exclure les tracés contour PCB des autres couches"
msgstr "Exclure les tracés contour PCB des autres couches"
#: pcbnew/pcbplot.cpp:3
82
#: pcbnew/pcbplot.cpp:3
95
msgid "Print sheet ref"
msgid "Print sheet ref"
msgstr "Imprimer cartouche"
msgstr "Imprimer cartouche"
#: pcbnew/pcbplot.cpp:
393
#: pcbnew/pcbplot.cpp:
406
msgid "Print pads on silkscreen"
msgid "Print pads on silkscreen"
msgstr "Pads sur Sérigraphie"
msgstr "Pads sur Sérigraphie"
#: pcbnew/pcbplot.cpp:4
00
#: pcbnew/pcbplot.cpp:4
13
msgid "Enable/disable print/plot pads on silkscreen layers"
msgid "Enable/disable print/plot pads on silkscreen layers"
msgstr "Active/désactive tracé des pastilles sur les couches de sérigraphie"
msgstr "Active/désactive tracé des pastilles sur les couches de sérigraphie"
#: pcbnew/pcbplot.cpp:4
04
#: pcbnew/pcbplot.cpp:4
17
msgid "Always print pads"
msgid "Always print pads"
msgstr "Toujours tracer pads"
msgstr "Toujours tracer pads"
#: pcbnew/pcbplot.cpp:4
09
#: pcbnew/pcbplot.cpp:4
22
msgid "Force print/plot pads on ALL layers"
msgid "Force print/plot pads on ALL layers"
msgstr "Force le tracé des pastilles sur TOUTES les couches"
msgstr "Force le tracé des pastilles sur TOUTES les couches"
#: pcbnew/pcbplot.cpp:4
14
#: pcbnew/pcbplot.cpp:4
27
msgid "Print module value"
msgid "Print module value"
msgstr "Imprimer Valeur Module"
msgstr "Imprimer Valeur Module"
#: pcbnew/pcbplot.cpp:4
18
#: pcbnew/pcbplot.cpp:4
31
msgid "Enable/disable print/plot module value on silkscreen layers"
msgid "Enable/disable print/plot module value on silkscreen layers"
msgstr "Active/désactive le tracé des textes valeurs des modules sur couches de sérigraphie"
msgstr "Active/désactive le tracé des textes valeurs des modules sur couches de sérigraphie"
#: pcbnew/pcbplot.cpp:4
22
#: pcbnew/pcbplot.cpp:4
35
msgid "Print module reference"
msgid "Print module reference"
msgstr "Imprimer Référence Module"
msgstr "Imprimer Référence Module"
#: pcbnew/pcbplot.cpp:4
26
#: pcbnew/pcbplot.cpp:4
39
msgid "Enable/disable print/plot module reference on silkscreen layers"
msgid "Enable/disable print/plot module reference on silkscreen layers"
msgstr "Active/désactive le tracé des textes référence des modules sur couches de sérigraphie"
msgstr "Active/désactive le tracé des textes référence des modules sur couches de sérigraphie"
#: pcbnew/pcbplot.cpp:4
30
#: pcbnew/pcbplot.cpp:4
43
msgid "Print other module texts"
msgid "Print other module texts"
msgstr "Imprimer autres textes module"
msgstr "Imprimer autres textes module"
#: pcbnew/pcbplot.cpp:4
34
#: pcbnew/pcbplot.cpp:4
47
msgid "Enable/disable print/plot module field texts on silkscreen layers"
msgid "Enable/disable print/plot module field texts on silkscreen layers"
msgstr "Active/désactive le tracé des textes des champs des modules sur couches de sérigraphie"
msgstr "Active/désactive le tracé des textes des champs des modules sur couches de sérigraphie"
#: pcbnew/pcbplot.cpp:4
39
#: pcbnew/pcbplot.cpp:4
52
msgid "Force print invisible texts"
msgid "Force print invisible texts"
msgstr "Force tracé textes invisibles"
msgstr "Force tracé textes invisibles"
#: pcbnew/pcbplot.cpp:4
43
#: pcbnew/pcbplot.cpp:4
56
msgid "Force print/plot module invisible texts on silkscreen layers"
msgid "Force print/plot module invisible texts on silkscreen layers"
msgstr "Force le tracé des textes invisibles sur couches de sérigraphie"
msgstr "Force le tracé des textes invisibles sur couches de sérigraphie"
#: pcbnew/pcbplot.cpp:4
48
#: pcbnew/pcbplot.cpp:4
61
msgid "No drill mark"
msgid "No drill mark"
msgstr "Pas de marque"
msgstr "Pas de marque"
#: pcbnew/pcbplot.cpp:4
49
#: pcbnew/pcbplot.cpp:4
62
msgid "Small mark"
msgid "Small mark"
msgstr "Petite marque"
msgstr "Petite marque"
#: pcbnew/pcbplot.cpp:4
50
#: pcbnew/pcbplot.cpp:4
63
msgid "Real drill"
msgid "Real drill"
msgstr "Perçage réel"
msgstr "Perçage réel"
#: pcbnew/pcbplot.cpp:4
54
#: pcbnew/pcbplot.cpp:4
67
msgid "Pads Drill Opt"
msgid "Pads Drill Opt"
msgstr "Options Perçage Pads"
msgstr "Options Perçage Pads"
#: pcbnew/pcbplot.cpp:4
63
#: pcbnew/pcbplot.cpp:4
76
msgid "Auto scale"
msgid "Auto scale"
msgstr "Ech. auto"
msgstr "Ech. auto"
#: pcbnew/pcbplot.cpp:4
64
#: pcbnew/pcbplot.cpp:4
77
msgid "Scale 1"
msgid "Scale 1"
msgstr "Echelle 1"
msgstr "Echelle 1"
#: pcbnew/pcbplot.cpp:4
65
#: pcbnew/pcbplot.cpp:4
78
msgid "Scale 1.5"
msgid "Scale 1.5"
msgstr "Echelle 1,5"
msgstr "Echelle 1,5"
#: pcbnew/pcbplot.cpp:4
66
#: pcbnew/pcbplot.cpp:4
79
msgid "Scale 2"
msgid "Scale 2"
msgstr "Echelle 2"
msgstr "Echelle 2"
#: pcbnew/pcbplot.cpp:4
67
#: pcbnew/pcbplot.cpp:4
80
msgid "Scale 3"
msgid "Scale 3"
msgstr "Echelle 3"
msgstr "Echelle 3"
#: pcbnew/pcbplot.cpp:4
71
#: pcbnew/pcbplot.cpp:4
84
msgid "Scale Opt"
msgid "Scale Opt"
msgstr "Echelle"
msgstr "Echelle"
#: pcbnew/pcbplot.cpp:4
78
#: pcbnew/pcbplot.cpp:4
91
msgid "Line"
msgid "Line"
msgstr "Ligne"
msgstr "Ligne"
#: pcbnew/pcbplot.cpp:4
78
#: pcbnew/pcbplot.cpp:4
91
msgid "Filled"
msgid "Filled"
msgstr "Plein"
msgstr "Plein"
#: pcbnew/pcbplot.cpp:4
79
#: pcbnew/pcbplot.cpp:4
92
msgid "Sketch"
msgid "Sketch"
msgstr "Contour"
msgstr "Contour"
#: pcbnew/pcbplot.cpp:4
81
#: pcbnew/pcbplot.cpp:4
94
msgid "Plot Mode"
msgid "Plot Mode"
msgstr "Mode de Tracé"
msgstr "Mode de Tracé"
#: pcbnew/pcbplot.cpp:
489
#: pcbnew/pcbplot.cpp:
502
msgid "Plot mirror"
msgid "Plot mirror"
msgstr "Tracé Miroir"
msgstr "Tracé Miroir"
#: pcbnew/pcbplot.cpp:
495
#: pcbnew/pcbplot.cpp:
508
msgid "Vias on mask"
msgid "Vias on mask"
msgstr "Vias sur masque"
msgstr "Vias sur masque"
#: pcbnew/pcbplot.cpp:
499
#: pcbnew/pcbplot.cpp:
512
msgid "Print/plot vias on mask layers. They are in this case not protected"
msgid "Print/plot vias on mask layers. They are in this case not protected"
msgstr "Trace vias sur vernis épargne. Elles seront non protégées"
msgstr "Trace vias sur vernis épargne. Elles seront non protégées"
#: pcbnew/pcbplot.cpp:7
4
6
#: pcbnew/pcbplot.cpp:7
5
6
msgid "Adobe post script files (.ps)|*.ps"
msgid "Adobe post script files (.ps)|*.ps"
msgstr "Fichiers Adobe post script (.ps)|*.ps"
msgstr "Fichiers Adobe post script (.ps)|*.ps"
#: pcbnew/pcbplot.cpp:7
5
2
#: pcbnew/pcbplot.cpp:7
6
2
msgid "GERBER photo plot files (.pho)|*.pho"
msgid "GERBER photo plot files (.pho)|*.pho"
msgstr "Fichiers phottraçage GERBER (.pho)|*.pho"
msgstr "Fichiers phottraçage GERBER (.pho)|*.pho"
#: pcbnew/pcbplot.cpp:7
5
7
#: pcbnew/pcbplot.cpp:7
6
7
#: pcbnew/gendrill.cpp:750
#: pcbnew/gendrill.cpp:750
msgid "HPGL plot files (.plt)|*.plt"
msgid "HPGL plot files (.plt)|*.plt"
msgstr "Fichiers Tracé HPGL (.plt)|*.plt"
msgstr "Fichiers Tracé HPGL (.plt)|*.plt"
#: pcbnew/pcbplot.cpp:7
6
3
#: pcbnew/pcbplot.cpp:7
7
3
#: pcbnew/gendrill.cpp:765
#: pcbnew/gendrill.cpp:765
msgid "DXF files (.dxf)|*.dxf"
msgid "DXF files (.dxf)|*.dxf"
msgstr "Fichiers DXF (.dxf)|*.dxf"
msgstr "Fichiers DXF (.dxf)|*.dxf"
#: pcbnew/pcbplot.cpp:7
7
0
#: pcbnew/pcbplot.cpp:7
8
0
msgid "Warning: Scale option set to a very small value"
msgid "Warning: Scale option set to a very small value"
msgstr "Attention: option d'échelle ajustée à une valeur très petite"
msgstr "Attention: option d'échelle ajustée à une valeur très petite"
#: pcbnew/pcbplot.cpp:7
7
3
#: pcbnew/pcbplot.cpp:7
8
3
msgid "Warning: Scale option set to a very large value"
msgid "Warning: Scale option set to a very large value"
msgstr "Attention: option d'échelle ajustée à une valeur très grande"
msgstr "Attention: option d'échelle ajustée à une valeur très grande"
#: pcbnew/pcbplot.cpp:8
2
2
#: pcbnew/pcbplot.cpp:8
3
2
msgid "No layer selected"
msgid "No layer selected"
msgstr "Pas de couche sélectionnée"
msgstr "Pas de couche sélectionnée"
...
@@ -3132,15 +3097,15 @@ msgstr "Au sujet de Pcbnew, concption de PCB"
...
@@ -3132,15 +3097,15 @@ msgstr "Au sujet de Pcbnew, concption de PCB"
#: pcbnew/zones_by_polygon.cpp:309
#: pcbnew/zones_by_polygon.cpp:309
#: pcbnew/zones_by_polygon.cpp:372
#: pcbnew/zones_by_polygon.cpp:372
#: pcbnew/zones_by_polygon.cpp:7
09
#: pcbnew/zones_by_polygon.cpp:7
10
msgid "Area: DRC outline error"
msgid "Area: DRC outline error"
msgstr "Zone; Erreur DRC sur contour"
msgstr "Zone; Erreur DRC sur contour"
#: pcbnew/zones_by_polygon.cpp:58
3
#: pcbnew/zones_by_polygon.cpp:58
4
msgid "DRC error: this start point is inside or too close an other area"
msgid "DRC error: this start point is inside or too close an other area"
msgstr "Erreur DRC: ce point de départ est à l'intérieur d'une autre zone ou trop proche"
msgstr "Erreur DRC: ce point de départ est à l'intérieur d'une autre zone ou trop proche"
#: pcbnew/zones_by_polygon.cpp:64
5
#: pcbnew/zones_by_polygon.cpp:64
6
msgid "DRC error: closing this area creates a drc error with an other area"
msgid "DRC error: closing this area creates a drc error with an other area"
msgstr "Erreur DRC: la fermeture de cette zone crée une erreur DRC avec une autre zone"
msgstr "Erreur DRC: la fermeture de cette zone crée une erreur DRC avec une autre zone"
...
@@ -3224,30 +3189,37 @@ msgid "Edit All Track Sizes"
...
@@ -3224,30 +3189,37 @@ msgid "Edit All Track Sizes"
msgstr "Editer TOUTES Pistes"
msgstr "Editer TOUTES Pistes"
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:28
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:28
#: pcbnew/dialog_copper_zones_base.cpp:38
msgid "Zone Fill Options:"
msgid "Zone Fill Options:"
msgstr "Options Remplissage Zone:"
msgstr "Options Remplissage Zone:"
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:30
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:30
#: pcbnew/dialog_copper_zones_base.cpp:40
msgid "Use polygons"
msgid "Use polygons"
msgstr "Utiliser des polygones"
msgstr "Utiliser des polygones"
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:30
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:30
#: pcbnew/dialog_copper_zones_base.cpp:40
msgid "Use segments"
msgid "Use segments"
msgstr "Utiliser des segments"
msgstr "Utiliser des segments"
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:32
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:32
#: pcbnew/dialog_copper_zones_base.cpp:42
msgid "Filling Mode:"
msgid "Filling Mode:"
msgstr "Mode de Remplissage:"
msgstr "Mode de Remplissage:"
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:36
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:36
#: pcbnew/dialog_copper_zones_base.cpp:125
msgid "Zone min thickness value"
msgid "Zone min thickness value"
msgstr "Valeur épaisseur min pour zone"
msgstr "Valeur épaisseur min pour zone"
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:46
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:46
#: pcbnew/dialog_copper_zones_base.cpp:99
msgid "Outlines Options:"
msgid "Outlines Options:"
msgstr "Options des Contours:"
msgstr "Options des Contours:"
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:48
#: pcbnew/dialog_non_copper_zones_properties_base.cpp:48
#: pcbnew/dialog_copper_zones_base.cpp:101
msgid "Any"
msgid "Any"
msgstr "Tout"
msgstr "Tout"
...
@@ -3914,7 +3886,6 @@ msgid "Export this zone setup to all other copper zones"
...
@@ -3914,7 +3886,6 @@ msgid "Export this zone setup to all other copper zones"
msgstr "Exporter ces options vers les autres zones de cuivre"
msgstr "Exporter ces options vers les autres zones de cuivre"
#: pcbnew/dialog_copper_zones_base.cpp:155
#: pcbnew/dialog_copper_zones_base.cpp:155
#: pcbnew/dialog_pad_properties_base.cpp:91
msgid "Ok"
msgid "Ok"
msgstr "Ok"
msgstr "Ok"
...
@@ -4367,6 +4338,41 @@ msgstr "Le fichier Session a une 'reference' à un composant non existant \"%s\"
...
@@ -4367,6 +4338,41 @@ msgstr "Le fichier Session a une 'reference' à un composant non existant \"%s\"
msgid "A wire_via references a missing padstack \"%s\""
msgid "A wire_via references a missing padstack \"%s\""
msgstr "Une piste ou via a une référence vers un pad \"%s\" manquant"
msgstr "Une piste ou via a une référence vers un pad \"%s\" manquant"
#: pcbnew/drc.cpp:201
msgid "Compile Ratsnest"
msgstr "Calcul du chevelu"
#: pcbnew/drc.cpp:204
#: pcbnew/drc.cpp:228
msgid " Ok\n"
msgstr " Ok\n"
#: pcbnew/drc.cpp:213
msgid "Test pads to pads clearance"
msgstr "Test isolation pad a pad"
#: pcbnew/drc.cpp:216
#: pcbnew/drc.cpp:235
#: pcbnew/drc.cpp:244
msgid "\n"
msgstr "\n"
#: pcbnew/drc.cpp:225
msgid "Fill zones"
msgstr "Remplissage Zones"
#: pcbnew/drc.cpp:232
msgid "Test zones"
msgstr "Test zones"
#: pcbnew/drc.cpp:241
msgid "List unconnected pads"
msgstr "Liste pads non connectés"
#: pcbnew/drc.cpp:250
msgid "Finished\n"
msgstr "Fini\n"
#: pcbnew/muwave_command.cpp:52
#: pcbnew/muwave_command.cpp:52
msgid "Add Line"
msgid "Add Line"
msgstr "Addition de lignes"
msgstr "Addition de lignes"
...
@@ -5864,26 +5870,6 @@ msgstr "Change module(s)"
...
@@ -5864,26 +5870,6 @@ msgstr "Change module(s)"
msgid "No Net"
msgid "No Net"
msgstr "No Net"
msgstr "No Net"
#: eeschema/class_library.cpp:390
msgid "library file name not set"
msgstr "Nom du fichier librairie non sélectionné"
#: eeschema/class_library.cpp:398
msgid "could not open file"
msgstr "ne peut ouvrir le fichier"
#: eeschema/class_library.cpp:406
msgid "file is empty!"
msgstr "Fichier vide!"
#: eeschema/class_library.cpp:412
msgid "file is NOT an EESCHEMA library!"
msgstr "Le fichier n'est PAS une librairie EESCHEMA !"
#: eeschema/class_library.cpp:430
msgid "header read error"
msgstr "erreur lecture entête"
#: eeschema/tool_lib.cpp:46
#: eeschema/tool_lib.cpp:46
msgid "deselect current tool"
msgid "deselect current tool"
msgstr "Désélection outil courant"
msgstr "Désélection outil courant"
...
@@ -6033,57 +6019,41 @@ msgstr "Labels"
...
@@ -6033,57 +6019,41 @@ msgstr "Labels"
msgid "Hierar."
msgid "Hierar."
msgstr "Hiérar."
msgstr "Hiérar."
#: eeschema/database.cpp:52
#: eeschema/getpart.cpp:102
msgid "No components found matching "
#, c-format
msgstr "Pas de composants trouvés qui correspondent "
msgid "component selection (%d items loaded):"
msgstr "Sélection Composant (%d items chargés):"
#: eeschema/database.cpp:55
msgid "name search criteria <"
msgstr "critère de recherche par nom <"
#: eeschema/database.cpp:57
msgid "and "
msgstr "et "
#: eeschema/
database.cpp:61
#: eeschema/
getpart.cpp:173
msgid "
key search criteria <
"
msgid "
Failed to find part
"
msgstr "
critère de recherche par clé <
"
msgstr "
Impossible de trouver le composant
"
#: eeschema/
database.cpp:68
#: eeschema/
getpart.cpp:173
msgid "
Select Component
"
msgid "
in library
"
msgstr "
Sélection Composant
"
msgstr "
en librairie
"
#: eeschema/
symbedit.cpp:58
#: eeschema/
viewlibs.cpp:112
msgid "
Import symbol drawings:
"
msgid "
Library browser
"
msgstr "
Importer les symboles:
"
msgstr "
Visualisateur des librairies
"
#: eeschema/symbedit.cpp:83
#: eeschema/viewlibs.cpp:119
#, c-format
msgid "none selected"
msgid "Failed to open Symbol File <%s>"
msgstr "Pas de sélection"
msgstr "Ne peut pas ouvrir fichier <%s>"
#: eeschema/
symbedit.cpp:94
#: eeschema/
viewlibs.cpp:291
#, c-format
#, c-format
msgid "
Error <%s> occurred loading symbol library <%s>.
"
msgid "
Current Part: <%s> (is Alias of <%s>)
"
msgstr "
Erreur <%s> en chargeant la librairie symbole <%s>.
"
msgstr "
Cmp courant: <%s> (est Alias de <%s>)
"
#: eeschema/
symbedit.cpp:106
#: eeschema/
viewlibs.cpp:300
#, c-format
#, c-format
msgid "No components found in symbol library <%s>."
msgid "Error: Root Part <%s> not found"
msgstr "Pas deomposant trouvé en librairie de symboles <%s>."
msgstr "Erreur: Root Part <%s> non trouvé"
#: eeschema/symbedit.cpp:113
msgid "Warning: more than 1 part in Symbol File"
msgstr "Attention: plus de 1élément dans le fichier symbole"
#: eeschema/symbedit.cpp:180
msgid "Export symbol drawings:"
msgstr "Exporter le symbole"
#: eeschema/
symbedit.cpp:203
#: eeschema/
viewlibs.cpp:320
#, c-format
#, c-format
msgid "
Save Symbol in [%s]
"
msgid "
Current Part: <%s>
"
msgstr "
Symbole sauvé en [%s]
"
msgstr "
Cmp Courant: <%s>
"
#: eeschema/plothpgl.cpp:199
#: eeschema/plothpgl.cpp:199
msgid "Sheet Size"
msgid "Sheet Size"
...
@@ -6174,18 +6144,58 @@ msgstr "&Accepter Offset"
...
@@ -6174,18 +6144,58 @@ msgstr "&Accepter Offset"
msgid "Plot: %s\n"
msgid "Plot: %s\n"
msgstr "Trace: %s\n"
msgstr "Trace: %s\n"
#: eeschema/
selpart.cpp:35
#: eeschema/
libframe.cpp:190
msgid "
No libraries are loaded
"
msgid ""
msgstr "Pas de librairies chargées
"
"Component was modified!\n
"
"Discard changes?"
#: eeschema/selpart.cpp:39
msgstr ""
msgid "Select Lib
"
"Le composant a été modifié\n
"
msgstr "Sélection librairie
"
"Perdre les changements
"
#: eeschema/
selpart.cpp:95
#: eeschema/
libframe.cpp:204
#, c-format
#, c-format
msgid "Select 1 of %d components from library <%s>"
msgid ""
msgstr "Selection 1 sur %d composants en librairie <%s>"
"Library \"%s\" was modified!\n"
"Discard changes?"
msgstr ""
"Librairie \"%s\" modifiée!\n"
"Perdre les changements ?"
#: eeschema/libframe.cpp:440
msgid "Include last component changes?"
msgstr "Inclure les dernières modifications du composant"
#: eeschema/libframe.cpp:492
msgid " Pins Test OK!"
msgstr " Test Pins OK!"
#: eeschema/libframe.cpp:569
msgid "Add Pin"
msgstr "Addition de \"pins\""
#: eeschema/libframe.cpp:573
msgid "Set Pin Options"
msgstr "Choix Options des Pins"
#: eeschema/libframe.cpp:595
msgid "Add Rectangle"
msgstr "Addition de rectangles"
#: eeschema/libframe.cpp:599
msgid "Add Circle"
msgstr "Addition de cercle"
#: eeschema/libframe.cpp:603
msgid "Add Arc"
msgstr "Addition d' arc"
#: eeschema/libframe.cpp:611
msgid "Anchor"
msgstr "Ancre"
#: eeschema/libframe.cpp:621
msgid "Export"
msgstr "Exporter"
#: eeschema/hierarch.cpp:122
#: eeschema/hierarch.cpp:122
msgid "Navigator"
msgid "Navigator"
...
@@ -6215,10 +6225,6 @@ msgstr "Ajustage opt Page"
...
@@ -6215,10 +6225,6 @@ msgstr "Ajustage opt Page"
msgid "Library editor"
msgid "Library editor"
msgstr "Editeur de librairies"
msgstr "Editeur de librairies"
#: eeschema/tool_sch.cpp:53
msgid "Library browser"
msgstr "Visualisateur des librairies"
#: eeschema/tool_sch.cpp:57
#: eeschema/tool_sch.cpp:57
msgid "Schematic hierarchy navigator"
msgid "Schematic hierarchy navigator"
msgstr "Navigation dans la hiérarchie"
msgstr "Navigation dans la hiérarchie"
...
@@ -6335,10 +6341,21 @@ msgstr "Force affichage des pins invisibles"
...
@@ -6335,10 +6341,21 @@ msgstr "Force affichage des pins invisibles"
msgid "HV orientation for Wires and Bus"
msgid "HV orientation for Wires and Bus"
msgstr "Force direction H, V et X pour les fils et bus"
msgstr "Force direction H, V et X pour les fils et bus"
#: eeschema/symbdraw.cpp:798
#: eeschema/libfield.cpp:185
#, c-format
msgid "Edit field"
msgid "Arc %.1f deg"
msgstr "Editer Champ"
msgstr "Arc %.1f deg"
#: eeschema/libfield.cpp:204
msgid ""
"This name is an existing alias of the component\n"
"Aborting"
msgstr ""
"Ce nom est celui d'un alias existant du composant\n"
"Abandon."
#: eeschema/libfield.cpp:223
msgid "No new text: no change"
msgstr "Pas de nouveau texte: pas de changements"
#: eeschema/annotate.cpp:278
#: eeschema/annotate.cpp:278
#, c-format
#, c-format
...
@@ -6408,6 +6425,27 @@ msgstr "Couleur du Fond:"
...
@@ -6408,6 +6425,27 @@ msgstr "Couleur du Fond:"
msgid "Library files:"
msgid "Library files:"
msgstr "Fichiers Librairies:"
msgstr "Fichiers Librairies:"
#: eeschema/database.cpp:52
msgid "No components found matching "
msgstr "Pas de composants trouvés qui correspondent "
#: eeschema/database.cpp:55
msgid "name search criteria <"
msgstr "critère de recherche par nom <"
#: eeschema/database.cpp:57
msgid "and "
msgstr "et "
#: eeschema/database.cpp:61
msgid "key search criteria <"
msgstr "critère de recherche par clé <"
#: eeschema/database.cpp:68
#: eeschema/selpart.cpp:89
msgid "Select Component"
msgstr "Sélection Composant"
#: eeschema/sheetlab.cpp:69
#: eeschema/sheetlab.cpp:69
msgid "PinSheet Properties:"
msgid "PinSheet Properties:"
msgstr "Propriétés des Pins de Hiérarchie"
msgstr "Propriétés des Pins de Hiérarchie"
...
@@ -6524,21 +6562,78 @@ msgstr ""
...
@@ -6524,21 +6562,78 @@ msgstr ""
"\n"
"\n"
" >> Erreurs ERC: %d\n"
" >> Erreurs ERC: %d\n"
#: eeschema/getpart.cpp:105
#: eeschema/selpart.cpp:25
msgid "No libraries are loaded"
msgstr "Pas de librairies chargées"
#: eeschema/selpart.cpp:29
#, c-format
#, c-format
msgid "
component selection (%d items loaded):
"
msgid "
Select 1 of %d libraries.
"
msgstr "S
élection Composant (%d items chargés):
"
msgstr "S
election 1 parmi %d librairies.
"
#: eeschema/
getpart.cpp:176
#: eeschema/
selpart.cpp:48
msgid "
Failed to find part
"
msgid "
Select Library
"
msgstr "
Impossible de trouver le composant
"
msgstr "
Sélection Librairie
"
#: eeschema/
getpart.cpp:176
#: eeschema/
edit_component_in_lib.cpp:302
msgid "
in library
"
msgid "
Ok to Delete Alias LIST
"
msgstr "
en librairie
"
msgstr "
Ok pour effacer la LISTE des Alias
"
#: eeschema/edit_label.cpp:48
#: eeschema/edit_component_in_lib.cpp:327
msgid "Empty Text!"
msgid "New alias:"
msgstr "Noveau alias"
#: eeschema/edit_component_in_lib.cpp:327
msgid "Component Alias"
msgstr "Alias de Composant"
#: eeschema/edit_component_in_lib.cpp:335
msgid "This is the Root Part"
msgstr "Ceci est le composant racine"
#: eeschema/edit_component_in_lib.cpp:344
#: eeschema/edit_component_in_lib.cpp:616
msgid "Already in use"
msgstr "Déjà en usage"
#: eeschema/edit_component_in_lib.cpp:369
msgid " is Current Selected Alias!"
msgstr " est l' Alias actuellement sélectionné!"
#: eeschema/edit_component_in_lib.cpp:422
msgid "Delete units"
msgstr "Supprimer unité"
#: eeschema/edit_component_in_lib.cpp:492
msgid "Create pins for Convert items"
msgstr "Créér les pins des unitées converties"
#: eeschema/edit_component_in_lib.cpp:496
msgid "Part as \"De Morgan\" anymore"
msgstr "Le composant a une représentation convertie"
#: eeschema/edit_component_in_lib.cpp:521
msgid "Delete Convert items"
msgstr "Suppression des éléments convertis"
#: eeschema/edit_component_in_lib.cpp:552
msgid "Doc Files"
msgstr "Fichiers de Doc"
#: eeschema/edit_component_in_lib.cpp:583
msgid "Ok to Delete FootprintFilter LIST"
msgstr "Ok pour effacer la LISTE des filtres de modules"
#: eeschema/edit_component_in_lib.cpp:605
msgid "New FootprintFilter:"
msgstr "Nouveau Filtre de Modules:"
#: eeschema/edit_component_in_lib.cpp:605
msgid "Footprint Filter"
msgstr "Filtrage Modules"
#: eeschema/edit_label.cpp:48
msgid "Empty Text!"
msgstr "Texte vide"
msgstr "Texte vide"
#: eeschema/tool_viewlib.cpp:54
#: eeschema/tool_viewlib.cpp:54
...
@@ -6601,25 +6696,6 @@ msgstr "Marqueur Suivant (F5)"
...
@@ -6601,25 +6696,6 @@ msgstr "Marqueur Suivant (F5)"
msgid "Find Cmp in &Lib"
msgid "Find Cmp in &Lib"
msgstr "Trouver Cmp. en &Libr."
msgstr "Trouver Cmp. en &Libr."
#: eeschema/viewlibs.cpp:131
msgid "none selected"
msgstr "Pas de sélection"
#: eeschema/viewlibs.cpp:306
#, c-format
msgid "Current Part: <%s> (is Alias of <%s>)"
msgstr "Cmp courant: <%s> (est Alias de <%s>)"
#: eeschema/viewlibs.cpp:315
#, c-format
msgid "Error: Root Part <%s> not found"
msgstr "Erreur: Root Part <%s> non trouvé"
#: eeschema/viewlibs.cpp:335
#, c-format
msgid "Current Part: <%s>"
msgstr "Cmp Courant: <%s>"
#: eeschema/plotps.cpp:174
#: eeschema/plotps.cpp:174
msgid "Plot Options:"
msgid "Plot Options:"
msgstr "Options de Tracé:"
msgstr "Options de Tracé:"
...
@@ -6644,62 +6720,138 @@ msgstr "Messages :"
...
@@ -6644,62 +6720,138 @@ msgstr "Messages :"
msgid "Default Line Width"
msgid "Default Line Width"
msgstr "Epaiss. ligne par défaut"
msgstr "Epaiss. ligne par défaut"
#: eeschema/libframe.cpp:192
#: eeschema/libedit.cpp:33
msgid " Part: "
msgstr "Composant "
#: eeschema/libedit.cpp:48
msgid " Convert"
msgstr " Convert"
#: eeschema/libedit.cpp:50
msgid " Normal"
msgstr " Normal"
#: eeschema/libedit.cpp:53
msgid " (Power Symbol)"
msgstr " (Symbole Alimentation)"
#: eeschema/libedit.cpp:89
msgid ""
msgid ""
"C
omponent was modified!
\n"
"C
urrent part not saved.
\n"
"
Discard changes
?"
"
Continue
?"
msgstr ""
msgstr ""
"
Le composant a été modifié
\n"
"
Composant courant non sauvé.
\n"
"
Perdre les changements
"
"
Continuer ?
"
#: eeschema/libframe.cpp:206
#: eeschema/libedit.cpp:118
#: eeschema/libedit.cpp:427
msgid "Component \""
msgstr "Composant \""
#: eeschema/libedit.cpp:119
msgid "\" not found."
msgstr "\" non trouvé"
#: eeschema/libedit.cpp:193
#, c-format
#, c-format
msgid "Could not create copy of part <%s> in library <%s>."
msgstr "Ne peut créer une copie de l'élément <%s> en librairie <%s>."
#: eeschema/libedit.cpp:273
msgid "Modify library file \""
msgstr "Modifier le fichier Librairie \""
#: eeschema/libedit.cpp:273
msgid "\"?"
msgstr "\"?"
#: eeschema/libedit.cpp:284
#, fuzzy
msgid "Error while saving library file \""
msgstr "Erreur en sauvant le fichier Librairie \""
#: eeschema/libedit.cpp:285
#: eeschema/libedit.cpp:429
msgid "\"."
msgstr "\"."
#: eeschema/libedit.cpp:291
msgid "Library file \""
msgstr "Fichier librairie \""
#: eeschema/libedit.cpp:293
msgid "Document file \""
msgstr "Fichier de doc \""
#: eeschema/libedit.cpp:348
msgid "Please select a component library."
msgstr "SVP sélectionner une librairie de composants."
#: eeschema/libedit.cpp:357
#, c-format
msgid "Component library <%s> does not have any entries to delete."
msgstr "La librairie de composants <%s> n'a aucun élément à supprimer"
#: eeschema/libedit.cpp:359
#, fuzzy
msgid "Delete Entry Error"
msgstr "Supprimer Entrée de Bus"
#: eeschema/libedit.cpp:364
#, fuzzy, c-format
msgid ""
msgid ""
"Library \"%s\" was modified!\n"
"Select 1 of %d components to\n"
"Discard changes?"
"delete from library <%s>."
msgstr ""
msgstr "Composant %s supprimé en librairie %s"
"Librairie \"%s\" modifiée!\n"
"Perdre les changements ?"
#: eeschema/lib
frame.cpp:440
#: eeschema/lib
edit.cpp:367
msgid "
Include last component changes?
"
msgid "
Delete Component
"
msgstr "
Inclure les dernières modifications du c
omposant"
msgstr "
Suppression C
omposant"
#: eeschema/libframe.cpp:492
#: eeschema/libedit.cpp:376
msgid " Pins Test OK!"
#, c-format
msgstr " Test Pins OK!"
msgid "Entry <%s> not found in library <%s>."
msgstr "Element <%s> non trouvé en librairie <%s>."
#: eeschema/lib
frame.cpp:566
#: eeschema/lib
edit.cpp:383
msgid "
Add Pin
"
msgid "
Delete component \"
"
msgstr "
Addition de \"pins
\""
msgstr "
Suppression Composant
\""
#: eeschema/lib
frame.cpp:570
#: eeschema/lib
edit.cpp:384
msgid "
Set Pin Options
"
msgid "
\" from library \"
"
msgstr "
Choix Options des Pins
"
msgstr "
\" de la librairie \"
"
#: eeschema/lib
frame.cpp:592
#: eeschema/lib
edit.cpp:406
msgid "
Add Rectangle
"
msgid "
Clear old component from screen (changes will be lost)?
"
msgstr "
Addition de rectangles
"
msgstr "
Supprimer l'ancien composant de l'écran (les changements seront perdus)?
"
#: eeschema/lib
frame.cpp:596
#: eeschema/lib
edit.cpp:428
msgid "
Add Circle
"
msgid "
\" exists in library \"
"
msgstr "
Addition de cercle
"
msgstr "
\" existe en librairie \"
"
#: eeschema/lib
frame.cpp:600
#: eeschema/lib
edit.cpp:471
msgid "
Add Arc
"
msgid "
No component to save.
"
msgstr "
Addition d' arc
"
msgstr "
Pas de composant à sauver.
"
#: eeschema/lib
frame.cpp:608
#: eeschema/lib
edit.cpp:480
msgid "
Anchor
"
msgid "
No library specified.
"
msgstr "
Ancre
"
msgstr "
Pas de librairie spécifiée.
"
#: eeschema/libframe.cpp:618
#: eeschema/libedit.cpp:490
msgid "Export"
#, c-format
msgstr "Exporter"
msgid "Component \"%s\" exists. Change it?"
msgstr "Le composant \" %s\" existe, Le changer ?"
#: eeschema/eeschema.cpp:145
#: eeschema/libedit.cpp:522
msgid "Eeschema is already running, Continue?"
#, c-format
msgstr "Eeschema est en cours d'exécution. Continuer ?"
msgid "Component %s saved in library %s"
msgstr "Composant %s sauvé en librairie %s"
#: eeschema/symbdraw.cpp:792
#, c-format
msgid "Arc %.1f deg"
msgstr "Arc %.1f deg"
#: eeschema/eeredraw.cpp:94
#: eeschema/eeredraw.cpp:94
msgid "Sheet"
msgid "Sheet"
...
@@ -6842,7 +6994,6 @@ msgstr ""
...
@@ -6842,7 +6994,6 @@ msgstr ""
"Pour les portes, ceci est la conversion \"De Morgan\""
"Pour les portes, ceci est la conversion \"De Morgan\""
#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:79
#: eeschema/dialog_edit_component_in_schematic_fbp.cpp:79
#: eeschema/dialog_create_component.cpp:178
msgid "Parts are locked"
msgid "Parts are locked"
msgstr "Les parts sont verrouillées"
msgstr "Les parts sont verrouillées"
...
@@ -7100,140 +7251,65 @@ msgstr "Impossible de créer le fichier librairie archive "
...
@@ -7100,140 +7251,65 @@ msgstr "Impossible de créer le fichier librairie archive "
msgid "Failed to create doc lib file "
msgid "Failed to create doc lib file "
msgstr "Impossible de créer le fichier lib document"
msgstr "Impossible de créer le fichier lib document"
#: eeschema/libedit.cpp:33
#: eeschema/pinedit.cpp:22
msgid " Part: "
msgid "line"
msgstr "Composant "
msgstr "Ligne"
#: eeschema/libedit.cpp:48
msgid " Convert"
msgstr " Convert"
#: eeschema/libedit.cpp:50
msgid " Normal"
msgstr " Normal"
#: eeschema/libedit.cpp:53
msgid " (Power Symbol)"
msgstr " (Symbole Alimentation)"
#: eeschema/libedit.cpp:89
msgid ""
"Current Part not saved.\n"
"Continue?"
msgstr ""
"Composant courant non sauvé.\n"
"Continuer ?"
#: eeschema/libedit.cpp:118
#: eeschema/libedit.cpp:426
msgid "Component \""
msgstr "Composant \""
#: eeschema/libedit.cpp:118
msgid "\" not found."
msgstr "\" non trouvé"
#: eeschema/libedit.cpp:192
#, c-format
msgid "Could not create copy of part <%s> in library <%s>."
msgstr "Ne peut créer une copie de l'élément <%s> en librairie <%s>."
#: eeschema/
libedit.cpp:27
2
#: eeschema/
pinedit.cpp:2
2
msgid "
Modify Library File \"
"
msgid "
invert
"
msgstr "
Ok pour modifier le fichier Librairie \"
"
msgstr "
invert
"
#: eeschema/
libedit.cpp:27
2
#: eeschema/
pinedit.cpp:2
2
msgid "
\"?
"
msgid "
clock
"
msgstr "
\"?
"
msgstr "
clock
"
#: eeschema/
libedit.cpp:283
#: eeschema/
pinedit.cpp:22
msgid "
Error while saving Library File \"
"
msgid "
clock inv
"
msgstr "
Erreur en sauvant le fichier Librairie \"
"
msgstr "
clock inv
"
#: eeschema/libedit.cpp:284
#: eeschema/pinedit.cpp:23
#: eeschema/libedit.cpp:428
msgid "low in"
msgid "\"."
msgstr "low in"
msgstr "\"."
#: eeschema/
libedit.cpp:290
#: eeschema/
pinedit.cpp:23
msgid "
Library File \"
"
msgid "
low clock
"
msgstr "
Fichier Librairie \"
"
msgstr "
low clock
"
#: eeschema/
libedit.cpp:292
#: eeschema/
pinedit.cpp:23
msgid "
Document File \"
"
msgid "
low out
"
msgstr "
Fichier de Doc \"
"
msgstr "
low out
"
#: eeschema/
libedit.cpp:347
#: eeschema/
pinedit.cpp:205
msgid "
Please select a component library.
"
msgid "
Occupied by other pin. Continue?
"
msgstr "
SVP sélectionner une librairie de composants.
"
msgstr "
Occupé par une autre pin, Continuer ?
"
#: eeschema/
libedit.cpp:356
#: eeschema/
pinedit.cpp:1010
#, c-format
#, c-format
msgid "Component library <%s> does not have any entries to delete."
msgid "Duplicate Pin %4.4s (Pin %s loc %d, %d, and Pin %s loc %d, %d)"
msgstr "La librairie de composants <%s> n'a aucun élément à supprimer"
msgstr "Pin dupliquée %4.4s (Pin %s loc %d, %d, etPin %s loc %d, %d)"
#: eeschema/libedit.cpp:358
#, fuzzy
msgid "Delete Entry Error"
msgstr "Supprimer Entrée de Bus"
#: eeschema/libedit.cpp:363
#, fuzzy, c-format
msgid ""
"Select 1 of %d components to\n"
"delete from library <%s>."
msgstr "Composant %s supprimé en librairie %s"
#: eeschema/libedit.cpp:366
msgid "Delete Component"
msgstr "Suppression Composant"
#: eeschema/
libedit.cpp:375
#: eeschema/
pinedit.cpp:1017
#, c-format
#, c-format
msgid "Entry <%s> not found in library <%s>."
msgid " Part %d"
msgstr "Element <%s> non trouvé en librairie <%s>."
msgstr "Composant %d"
#: eeschema/libedit.cpp:382
msgid "Delete component \""
msgstr "Suppression Composant \""
#: eeschema/libedit.cpp:383
msgid "\" from library \""
msgstr "\" de la librairie \""
#: eeschema/libedit.cpp:405
msgid "Clear old component from screen (changes will be lost)?"
msgstr "Supprimer l'ancien composant de l'écran (les changements seront perdus)?"
#: eeschema/libedit.cpp:427
msgid "\" exists in library \""
msgstr "\" existe en librairie \""
#: eeschema/libedit.cpp:470
msgid "No component to save."
msgstr "Pas de composant à sauver."
#: eeschema/
libedit.cpp:479
#: eeschema/
pinedit.cpp:1024
msgid "
No Library specified.
"
msgid "
Convert
"
msgstr "
Pas de Librairie spécifiée.
"
msgstr "
Convert
"
#: eeschema/libedit.cpp:489
#: eeschema/pinedit.cpp:1026
#, c-format
msgid " Normal"
msgid "Component \"%s\" exists. Change it?"
msgstr " Normal"
msgstr "Le composant \" %s\" existe, Le changer ?"
#: eeschema/libedit.cpp:521
#: eeschema/eeschema.cpp:146
#, c-format
msgid "Eeschema is already running, Continue?"
msgid "Component %s saved in library %s"
msgstr "Eeschema est en cours d'exécution. Continuer ?"
msgstr "Composant %s sauvé en librairie %s"
#: eeschema/hotkeys.cpp:285
#: eeschema/hotkeys.cpp:285
#: eeschema/schedit.cpp:249
msgid "Add Component"
msgid "Add Component"
msgstr "Ajout Composant"
msgstr "Ajout Composant"
#: eeschema/hotkeys.cpp:310
#: eeschema/hotkeys.cpp:310
#: eeschema/schedit.cpp:197
msgid "Add Wire"
msgid "Add Wire"
msgstr "Ajouter Fils"
msgstr "Ajouter Fils"
...
@@ -7438,6 +7514,34 @@ msgstr "Importer Connecteur de hiérarchie"
...
@@ -7438,6 +7514,34 @@ msgstr "Importer Connecteur de hiérarchie"
msgid "Add Power"
msgid "Add Power"
msgstr "Ajouter Alims"
msgstr "Ajouter Alims"
#: eeschema/class_libentry.cpp:499
#, c-format
msgid "DEF command expected in line %d, aborted."
msgstr ""
#: eeschema/class_libentry.cpp:521
#, c-format
msgid "Wrong DEF format in line %d, skipped."
msgstr ""
#: eeschema/class_libentry.cpp:614
msgid "file ended prematurely loading component draw element"
msgstr ""
#: eeschema/class_libentry.cpp:654
#, c-format
msgid "undefined DRAW command %c"
msgstr ""
#: eeschema/class_libentry.cpp:661
#, c-format
msgid "error <%s> in DRAW command %c"
msgstr ""
#: eeschema/class_libentry.cpp:670
msgid "file ended prematurely while attempting to flush to end of drawing section."
msgstr ""
#: eeschema/dialog_edit_label_base.cpp:24
#: eeschema/dialog_edit_label_base.cpp:24
#: eeschema/dialog_edit_label_base.cpp:29
#: eeschema/dialog_edit_label_base.cpp:29
msgid "Enter the text to be used within the schematic"
msgid "Enter the text to be used within the schematic"
...
@@ -7467,56 +7571,6 @@ msgstr "Direction"
...
@@ -7467,56 +7571,6 @@ msgstr "Direction"
msgid "Glabel Shape"
msgid "Glabel Shape"
msgstr "Forme GLabel"
msgstr "Forme GLabel"
#: eeschema/pinedit.cpp:22
msgid "line"
msgstr "Ligne"
#: eeschema/pinedit.cpp:22
msgid "invert"
msgstr "invert"
#: eeschema/pinedit.cpp:22
msgid "clock"
msgstr "clock"
#: eeschema/pinedit.cpp:22
msgid "clock inv"
msgstr "clock inv"
#: eeschema/pinedit.cpp:23
msgid "low in"
msgstr "low in"
#: eeschema/pinedit.cpp:23
msgid "low clock"
msgstr "low clock"
#: eeschema/pinedit.cpp:23
msgid "low out"
msgstr "low out"
#: eeschema/pinedit.cpp:201
msgid "Occupied by other pin. Continue?"
msgstr "Occupé par une autre pin, Continuer ?"
#: eeschema/pinedit.cpp:996
#, c-format
msgid "Duplicate Pin %4.4s (Pin %s loc %d, %d, and Pin %s loc %d, %d)"
msgstr "Pin dupliquée %4.4s (Pin %s loc %d, %d, etPin %s loc %d, %d)"
#: eeschema/pinedit.cpp:1003
#, c-format
msgid " Part %d"
msgstr "Composant %d"
#: eeschema/pinedit.cpp:1010
msgid " Convert"
msgstr " Convert"
#: eeschema/pinedit.cpp:1012
msgid " Normal"
msgstr " Normal"
#: eeschema/find.cpp:214
#: eeschema/find.cpp:214
msgid "Pin "
msgid "Pin "
msgstr "Pin "
msgstr "Pin "
...
@@ -7850,71 +7904,37 @@ msgstr "&Voir"
...
@@ -7850,71 +7904,37 @@ msgstr "&Voir"
msgid "&Place"
msgid "&Place"
msgstr "&Placer"
msgstr "&Placer"
#: eeschema/
edit_component_in_lib.cpp:30
2
#: eeschema/
symbedit.cpp:5
2
msgid "
Ok to Delete Alias LIST
"
msgid "
Import Symbol Drawings
"
msgstr "
Ok pour effacer la LISTE des Alias
"
msgstr "
Importer Symbole de Dessin
"
#: eeschema/edit_component_in_lib.cpp:327
#: eeschema/symbedit.cpp:71
msgid "New alias:"
#, c-format
msgstr "Noveau alias"
msgid "Failed to open Symbol File <%s>"
msgstr "Ne peut pas ouvrir fichier <%s>"
#: eeschema/edit_component_in_lib.cpp:327
msgid "Component Alias"
msgstr "Alias de Composant"
#: eeschema/edit_component_in_lib.cpp:335
msgid "This is the Root Part"
msgstr "Ceci est le composant racine"
#: eeschema/edit_component_in_lib.cpp:344
#: eeschema/edit_component_in_lib.cpp:619
msgid "Already in use"
msgstr "Déjà en usage"
#: eeschema/edit_component_in_lib.cpp:369
msgid " is Current Selected Alias!"
msgstr " est l' Alias actuellement sélectionné!"
#: eeschema/edit_component_in_lib.cpp:422
msgid "Delete units"
msgstr "Supprimer unité"
#: eeschema/edit_component_in_lib.cpp:492
msgid "Create pins for Convert items"
msgstr "Créér les pins des unitées converties"
#: eeschema/edit_component_in_lib.cpp:496
msgid "Part as \"De Morgan\" anymore"
msgstr "Le composant a une représentation convertie"
#: eeschema/edit_component_in_lib.cpp:521
msgid "Delete Convert items"
msgstr "Suppression des éléments convertis"
#: eeschema/edit_component_in_lib.cpp:555
msgid "Doc Files"
msgstr "Fichiers de Doc"
#: eeschema/edit_component_in_lib.cpp:586
msgid "Ok to Delete FootprintFilter LIST"
msgstr "Ok pour effacer la LISTE des filtres de modules"
#: eeschema/edit_component_in_lib.cpp:608
msgid "New FootprintFilter:"
msgstr "Nouveau Filtre de Modules:"
#: eeschema/edit_component_in_lib.cpp:608
#: eeschema/symbedit.cpp:82
msgid "Footprint Filter"
#, c-format
msgstr "Filtrage Modules"
msgid "Error <%s> occurred loading symbol library <%s>."
msgstr "Erreur <%s> en chargeant la librairie symbole <%s>."
#: eeschema/
class_BodyItem_Text.cpp:83
#: eeschema/
symbedit.cpp:94
#, c-format
#, c-format
msgid "text only had %d parameters of the required 8"
msgid "No components found in symbol library <%s>."
msgstr "le texte a seulement %d paramètres sur les 8 requis"
msgstr "Pas deomposant trouvé en librairie de symboles <%s>."
#: eeschema/symbedit.cpp:101
msgid "Warning: more than 1 part in Symbol File"
msgstr "Attention: plus de 1élément dans le fichier symbole"
#: eeschema/class_BodyItem_Text.cpp:248
#: eeschema/symbedit.cpp:165
msgid "Line width"
msgid "Export Symbol Drawings"
msgstr "Epaisseur ligne"
msgstr "Exporter Symbole de Dessin"
#: eeschema/symbedit.cpp:191
#, c-format
msgid "Save Symbol in [%s]"
msgstr "Symbole sauvé en [%s]"
#: eeschema/schframe.cpp:315
#: eeschema/schframe.cpp:315
msgid "Schematic modified, Save before exit ?"
msgid "Schematic modified, Save before exit ?"
...
@@ -8117,22 +8137,6 @@ msgstr "Erreur. Vous devez entrer une ligne de commande"
...
@@ -8117,22 +8137,6 @@ msgstr "Erreur. Vous devez entrer une ligne de commande"
msgid "Error. You must provide a Title"
msgid "Error. You must provide a Title"
msgstr "Erreur. Vous devez entrer un titre"
msgstr "Erreur. Vous devez entrer un titre"
#: eeschema/libfield.cpp:250
msgid "Edit field"
msgstr "Editer Champ"
#: eeschema/libfield.cpp:267
msgid ""
"This name is an existing alias of the component\n"
"Aborting"
msgstr ""
"Ce nom est celui d'un alias existant du composant\n"
"Abandon."
#: eeschema/libfield.cpp:287
msgid "No new text: no change"
msgstr "Pas de nouveau texte: pas de changements"
#: eeschema/files-io.cpp:72
#: eeschema/files-io.cpp:72
msgid "Clear Schematic Hierarchy (modified!)?"
msgid "Clear Schematic Hierarchy (modified!)?"
msgstr "Effacer la hiérarchie schématique (modifiée!)?"
msgstr "Effacer la hiérarchie schématique (modifiée!)?"
...
@@ -8178,141 +8182,188 @@ msgstr "Fond Plein"
...
@@ -8178,141 +8182,188 @@ msgstr "Fond Plein"
msgid "Fill:"
msgid "Fill:"
msgstr "Remplissage:"
msgstr "Remplissage:"
#: eeschema/dialog_eeschema_config_fbp.cpp:20
#: eeschema/pinedit-dialog.cpp:153
msgid "Component library files"
msgstr "Fichiers librairies de composants"
#: eeschema/dialog_eeschema_config_fbp.cpp:23
msgid ""
"List of active library files.\n"
"Only library files in this list are loaded by Eeschema.\n"
"The order of this list is important:\n"
"Eeschema searchs for a given component using this list order priority."
msgstr ""
"Liste des librairies actives.\n"
"Seuls les fichiers librairie dans cette liste sont chargés par eeschema.\n"
"L'ordre de cette liste est important:Eeschema cherche un composant donné en utilisant cette liste par ordre de priorité."
#: eeschema/dialog_eeschema_config_fbp.cpp:51
msgid "User defined search path"
msgstr "Chemin de recherche défini par l'utilisateur"
#: eeschema/lib_export.cpp:47
msgid "Import Component"
msgstr "Importer Composant"
#: eeschema/lib_export.cpp:77
msgid "File is empty"
msgstr "Fichier vide"
#: eeschema/lib_export.cpp:100
msgid "No Part to Save"
msgstr "Pas de composant à sauver"
#: eeschema/lib_export.cpp:107
msgid "New Library"
msgstr "Nouvelle Librairie"
#: eeschema/lib_export.cpp:107
msgid "Export Component"
msgstr "Exporter Composant"
#: eeschema/lib_export.cpp:145
msgid " - OK"
msgstr " - OK"
#: eeschema/lib_export.cpp:147
msgid ""
"Note: this new library will be available only if it is loaded by eeschema.\n"
"Modify eeschema config if you want use it."
msgstr ""
"Note: cette nouvelle librairie sera disponible seulement si elle est chargée par eeschema\n"
"Modifier la config de eeschema si vous voulez l'utiliser"
#: eeschema/lib_export.cpp:151
msgid "Error creating "
msgstr "Erreur en création de "
#: eeschema/pinedit-dialog.cpp:148
msgid "Pin Name :"
msgid "Pin Name :"
msgstr "Nom de la pin :"
msgstr "Nom de la pin :"
#: eeschema/pinedit-dialog.cpp:15
4
#: eeschema/pinedit-dialog.cpp:15
9
msgid "Pin Num :"
msgid "Pin Num :"
msgstr "Num de la pin :"
msgstr "Num de la pin :"
#: eeschema/pinedit-dialog.cpp:16
2
#: eeschema/pinedit-dialog.cpp:16
7
msgid " Pin Options :"
msgid " Pin Options :"
msgstr "Options Pin :"
msgstr "Options Pin :"
#: eeschema/pinedit-dialog.cpp:1
77
#: eeschema/pinedit-dialog.cpp:1
82
msgid "Pin Lenght"
msgid "Pin Lenght"
msgstr "Longueur Pin"
msgstr "Longueur Pin"
#: eeschema/pinedit-dialog.cpp:1
88
#: eeschema/pinedit-dialog.cpp:1
93
msgid "No Draw"
msgid "No Draw"
msgstr "Invisible"
msgstr "Invisible"
#: eeschema/pinedit-dialog.cpp:21
4
#: eeschema/pinedit-dialog.cpp:21
9
msgid "Pin Orient:"
msgid "Pin Orient:"
msgstr "Pin Orient:"
msgstr "Pin Orient:"
#: eeschema/pinedit-dialog.cpp:24
2
#: eeschema/pinedit-dialog.cpp:24
7
msgid "Pin Shape:"
msgid "Pin Shape:"
msgstr "Forme Pin:"
msgstr "Forme Pin:"
#: eeschema/pinedit-dialog.cpp:25
0
#: eeschema/pinedit-dialog.cpp:25
5
msgid "3 States"
msgid "3 States"
msgstr "3 Etats"
msgstr "3 Etats"
#: eeschema/pinedit-dialog.cpp:25
2
#: eeschema/pinedit-dialog.cpp:25
7
msgid "Unspecified"
msgid "Unspecified"
msgstr "Non specifié"
msgstr "Non specifié"
#: eeschema/pinedit-dialog.cpp:25
3
#: eeschema/pinedit-dialog.cpp:25
8
msgid "Power In"
msgid "Power In"
msgstr "Power In"
msgstr "Power In"
#: eeschema/pinedit-dialog.cpp:25
4
#: eeschema/pinedit-dialog.cpp:25
9
msgid "Power Out"
msgid "Power Out"
msgstr "Power Out"
msgstr "Power Out"
#: eeschema/pinedit-dialog.cpp:2
55
#: eeschema/pinedit-dialog.cpp:2
60
msgid "Open coll"
msgid "Open coll"
msgstr "Coll ouvert"
msgstr "Coll ouvert"
#: eeschema/pinedit-dialog.cpp:2
56
#: eeschema/pinedit-dialog.cpp:2
61
msgid "Open emit"
msgid "Open emit"
msgstr "Emetteur ouv."
msgstr "Emetteur ouv."
#: eeschema/pinedit-dialog.cpp:2
57
#: eeschema/pinedit-dialog.cpp:2
62
msgid "Electrical Type:"
msgid "Electrical Type:"
msgstr "Type électrique:"
msgstr "Type électrique:"
#: eeschema/
class_pin.cpp:45
#: eeschema/
dialog_eeschema_config_fbp.cpp:20
msgid "
Pin
"
msgid "
Component library files
"
msgstr "
Pin
"
msgstr "
Fichiers librairies de composants
"
#: eeschema/class_pin.cpp:1062
#: eeschema/dialog_eeschema_config_fbp.cpp:23
msgid "PinName"
msgid ""
msgstr "Nom Pin"
"List of active library files.\n"
"Only library files in this list are loaded by Eeschema.\n"
"The order of this list is important:\n"
"Eeschema searchs for a given component using this list order priority."
msgstr ""
"Liste des librairies actives.\n"
"Seuls les fichiers librairie dans cette liste sont chargés par eeschema.\n"
"L'ordre de cette liste est important:Eeschema cherche un composant donné en utilisant cette liste par ordre de priorité."
#: eeschema/
class_pin.cpp:107
1
#: eeschema/
dialog_eeschema_config_fbp.cpp:5
1
msgid "
PinNum
"
msgid "
User defined search path
"
msgstr "
Num Pin
"
msgstr "
Chemin de recherche défini par l'utilisateur
"
#: eeschema/class_pin.cpp:1075
#: eeschema/classes_body_items.cpp:35
msgid "PinType"
msgid "Undefined"
msgstr "Type Pin"
msgstr "Non Défini"
#: eeschema/classes_body_items.cpp:56
#: eeschema/classes_body_items.cpp:62
#: eeschema/dialog_print_using_printer_base.cpp:52
msgid "All"
msgstr "Tout"
#: eeschema/class
_pin.cpp:1081
#: eeschema/class
es_body_items.cpp:64
msgid "no"
msgid "no"
msgstr "non"
msgstr "non"
#: eeschema/class
_pin.cpp:1083
#: eeschema/class
es_body_items.cpp:66
msgid "yes"
msgid "yes"
msgstr "oui"
msgstr "oui"
#: eeschema/classes_body_items.cpp:124
#, c-format
msgid "arc only had %d parameters of the required 8"
msgstr "l'arc a seulement %d paramètres sur les 8 requis"
#: eeschema/classes_body_items.cpp:390
#: eeschema/classes_body_items.cpp:565
#: eeschema/classes_body_items.cpp:695
#: eeschema/classes_body_items.cpp:856
#: eeschema/classes_body_items.cpp:1155
#: eeschema/classes_body_items.cpp:1400
#: eeschema/class_BodyItem_Text.cpp:253
msgid "Line width"
msgstr "Epaisseur ligne"
#: eeschema/classes_body_items.cpp:395
#: eeschema/classes_body_items.cpp:574
#: eeschema/classes_body_items.cpp:861
#: eeschema/classes_body_items.cpp:1160
#: eeschema/classes_body_items.cpp:1405
msgid "Bounding box"
msgstr "Rectange dencadrement"
#: eeschema/classes_body_items.cpp:430
#, c-format
msgid "circle only had %d parameters of the required 6"
msgstr "le cercle a seulement %d paramètres sur les 6 requis"
#: eeschema/classes_body_items.cpp:569
msgid "Radius"
msgstr "Rayon"
#: eeschema/classes_body_items.cpp:587
msgid "Rectangle"
msgstr "Rectangle"
#: eeschema/classes_body_items.cpp:610
#, c-format
msgid "rectangle only had %d parameters of the required 7"
msgstr "le rectangle a seulement %d paramètres sur les 7 requis"
#: eeschema/classes_body_items.cpp:908
msgid "PolyLine"
msgstr "PolyLigne"
#: eeschema/classes_body_items.cpp:940
#, c-format
msgid "polyline only had %d parameters of the required 4"
msgstr "la polyligne a seulement %d paramètres sur les 4 requis"
#: eeschema/classes_body_items.cpp:945
#, c-format
msgid "polyline count parameter %d is invalid"
msgstr "le nombre de paramètes (%d) de la polyligne est mauvais"
#: eeschema/classes_body_items.cpp:961
#, c-format
msgid "polyline point %d X position not defined"
msgstr "la position X du point %d de la polyligne n'est pas définie"
#: eeschema/classes_body_items.cpp:968
#, c-format
msgid "polyline point %d Y position not defined"
msgstr "la position Y du point %d de la polyligne n'est pas définie"
#: eeschema/classes_body_items.cpp:1171
msgid "Bezier"
msgstr "Bezier"
#: eeschema/classes_body_items.cpp:1204
#, c-format
msgid "Bezier only had %d parameters of the required 4"
msgstr "La courbe de Bezier a seulement %d paramètres sur les 4 requis"
#: eeschema/classes_body_items.cpp:1210
#, c-format
msgid "Bezier count parameter %d is invalid"
msgstr "le nombre de paramètes (%d) de la courbe de Bezier est mauvais"
#: eeschema/classes_body_items.cpp:1226
#, c-format
msgid "Bezier point %d X position not defined"
msgstr "la position X du point %d de la courbe de Bezier n'est pas définie"
#: eeschema/classes_body_items.cpp:1232
#, c-format
msgid "Bezier point %d Y position not defined"
msgstr "la position Y du point %d de la courbe de Bezier n'est pas définie"
#: eeschema/dialog_bodygraphictext_properties_base.cpp:57
#: eeschema/dialog_bodygraphictext_properties_base.cpp:57
msgid " Text Options : "
msgid " Text Options : "
msgstr "Options du Texte: "
msgstr "Options du Texte: "
...
@@ -8651,6 +8702,45 @@ msgstr "Copie dans Presse papier"
...
@@ -8651,6 +8702,45 @@ msgstr "Copie dans Presse papier"
msgid "The vertical height of the currently selected field's text in the schematic"
msgid "The vertical height of the currently selected field's text in the schematic"
msgstr "La taille du texte du champ actuellement sélectionné"
msgstr "La taille du texte du champ actuellement sélectionné"
#: eeschema/class_library.cpp:329
msgid "library file name not set"
msgstr "Nom du fichier librairie non sélectionné"
#: eeschema/class_library.cpp:337
msgid "could not open file"
msgstr "ne peut ouvrir le fichier"
#: eeschema/class_library.cpp:343
msgid "file is empty!"
msgstr "Fichier vide!"
#: eeschema/class_library.cpp:349
msgid "file is NOT an EESCHEMA library!"
msgstr "Le fichier n'est PAS une librairie EESCHEMA !"
#: eeschema/class_library.cpp:364
msgid "header read error"
msgstr "erreur lecture entête"
#: eeschema/class_library.cpp:450
#, c-format
msgid ""
"Could not open component document libray file\n"
"<%s>."
msgstr ""
"Ne peut ouvrir le fichier document du composant \n"
"<%s>."
#: eeschema/class_library.cpp:457
#, c-format
msgid "Component document libray file <%s> is empty."
msgstr "Fichier document de composants <%s> vide"
#: eeschema/class_library.cpp:465
#, c-format
msgid "File <%s> is not a valid component library document file."
msgstr "<%s> n'est pas un fichier documentation de composant valide."
#: eeschema/libedit_onrightclick.cpp:79
#: eeschema/libedit_onrightclick.cpp:79
msgid "Move Arc "
msgid "Move Arc "
msgstr "Déplacer arc"
msgstr "Déplacer arc"
...
@@ -8867,61 +8957,98 @@ msgstr ""
...
@@ -8867,61 +8957,98 @@ msgstr ""
"\n"
"\n"
"Cette opération supprimera l'annotation existante et ne peut être annulée."
"Cette opération supprimera l'annotation existante et ne peut être annulée."
#: eeschema/class_sch_component.cpp:1069
msgid "Ref"
msgstr "Ref"
#: eeschema/class_sch_component.cpp:1074
msgid "Pwr Symb"
msgstr "Symb Alim"
#: eeschema/class_sch_component.cpp:1076
msgid "Val"
msgstr "Val"
#: eeschema/class_sch_component.cpp:1080
msgid "RefLib"
msgstr "RefLib"
#: eeschema/class_sch_component.cpp:1083
msgid "Lib"
msgstr "Lib"
#: eeschema/dialog_SVG_print_base.cpp:25
#: eeschema/dialog_SVG_print_base.cpp:25
#: eeschema/dialog_print_using_printer_base.cpp:25
msgid "Default Pen Size"
msgid "Default Pen Size"
msgstr "Dimension Plume par Défaut"
msgstr "Dimension Plume par Défaut"
#: eeschema/dialog_SVG_print_base.cpp:30
#: eeschema/dialog_SVG_print_base.cpp:30
#: eeschema/dialog_print_using_printer_base.cpp:30
msgid "Selection of the default pen thickness used to draw items, when their thickness is set to 0."
msgid "Selection of the default pen thickness used to draw items, when their thickness is set to 0."
msgstr "Valeur de la dimension de la plume utilisée par défaut pour tracer les éléments, lorsque leur épaisseur est à 0."
msgstr "Valeur de la dimension de la plume utilisée par défaut pour tracer les éléments, lorsque leur épaisseur est à 0."
#: eeschema/dialog_SVG_print_base.cpp:53
#: eeschema/dialog_SVG_print_base.cpp:53
msgid "Print Current"
msgid "Print Current"
msgstr "Imprimer Page Courante"
msgstr "Imprimer Page Courante"
#: eeschema/dialog_SVG_print_base.cpp:56
msgid "Print All"
msgstr "Imprimer Tout"
#: eeschema/class_BodyItem_Text.cpp:85
#, c-format
msgid "text only had %d parameters of the required 8"
msgstr "le texte a seulement %d paramètres sur les 8 requis"
#: eeschema/dialog_print_using_printer_base.cpp:52
msgid "Current"
msgstr "Courant"
#: eeschema/dialog_edit_component_in_lib.cpp:49
msgid "Lib Component Properties"
msgstr "Propriétés du composant librairie"
#: eeschema/dialog_edit_component_in_lib.cpp:53
msgid "Properties for "
msgstr "Propriétés pour "
#: eeschema/dialog_edit_component_in_lib.cpp:58
msgid "(alias of "
msgstr "(alias de "
#: eeschema/class_libentry_fields.cpp:112
msgid "invalid field number defined"
msgstr ""
#: eeschema/class_libentry_fields.cpp:151
#, c-format
msgid "field %d does not have the correct number of parameters"
msgstr ""
#: eeschema/class_libentry_fields.cpp:166
#, c-format
msgid "field %d text orientation parameter <%c> is not valid"
msgstr "champ %d parametre d'orientation de texte<%c> non valide"
#: eeschema/class_libentry_fields.cpp:178
#, c-format
msgid "field %d text visible parameter <%c> is not valid"
msgstr "champ %d parametre de visibilité de texte<%c> non valide"
#: eeschema/class_libentry_fields.cpp:197
#, c-format
msgid "field %d text horizontal justification parameter <%c> is not valid"
msgstr ""
#: eeschema/dialog_SVG_print_base.cpp:56
#: eeschema/class_libentry_fields.cpp:211
msgid "Print All"
#, c-format
msgstr "Imprimer Tout"
msgid "field %d text vertical justification parameter <%c> is not valid"
msgstr ""
#: eeschema/
dialog_print_using_printer_base.cpp:52
#: eeschema/
class_libentry_fields.cpp:401
msgid "
Curren
t"
msgid "
Datashee
t"
msgstr "
Courant
"
msgstr "
Documentation
"
#: eeschema/dialog_print_using_printer_base.cpp:52
#: eeschema/class_libentry_fields.cpp:409
msgid "All"
#: eeschema/build_BOM.cpp:621
msgstr "Tout"
msgid "Field"
msgstr "Champ"
#: eeschema/
dialog_edit_component_in_lib.cpp:49
#: eeschema/
class_pin.cpp:45
msgid "
Lib Component Properties
"
msgid "
Pin
"
msgstr "P
ropriétés du composant librairie
"
msgstr "P
in
"
#: eeschema/
dialog_edit_component_in_lib.cpp:53
#: eeschema/
class_pin.cpp:1059
msgid "P
roperties for
"
msgid "P
inName
"
msgstr "
Propriétés pour
"
msgstr "
Nom Pin
"
#: eeschema/dialog_edit_component_in_lib.cpp:58
#: eeschema/class_pin.cpp:1068
msgid "(alias of "
msgid "PinNum"
msgstr "(alias de "
msgstr "Num Pin"
#: eeschema/class_pin.cpp:1072
msgid "PinType"
msgstr "Type Pin"
#: eeschema/dialog_edit_label.cpp:68
#: eeschema/dialog_edit_label.cpp:68
msgid "Global Label Properties"
msgid "Global Label Properties"
...
@@ -8985,10 +9112,6 @@ msgstr ""
...
@@ -8985,10 +9112,6 @@ msgstr ""
"\n"
"\n"
"#End List\n"
"#End List\n"
#: eeschema/build_BOM.cpp:621
msgid "Field"
msgstr "Champ"
#: eeschema/build_BOM.cpp:629
#: eeschema/build_BOM.cpp:629
msgid ""
msgid ""
"\n"
"\n"
...
@@ -9043,7 +9166,7 @@ msgstr "Pin non connectée (pas de symbole de non connexion trouvé sur cette pi
...
@@ -9043,7 +9166,7 @@ msgstr "Pin non connectée (pas de symbole de non connexion trouvé sur cette pi
#: eeschema/class_drc_erc_item.cpp:45
#: eeschema/class_drc_erc_item.cpp:45
msgid "Pin connected to some others pins but no pin to drive it"
msgid "Pin connected to some others pins but no pin to drive it"
msgstr "Pin connectée à d'autres pins, mais aucun
n
e pin pour la piloter"
msgstr "Pin connectée à d'autres pins, mais aucune pin pour la piloter"
#: eeschema/class_drc_erc_item.cpp:47
#: eeschema/class_drc_erc_item.cpp:47
msgid "Confict problem between pins. Severity: warning"
msgid "Confict problem between pins. Severity: warning"
...
@@ -9061,18 +9184,25 @@ msgstr "Différence entre labels de hiérarchieet pins de hiérarchie"
...
@@ -9061,18 +9184,25 @@ msgstr "Différence entre labels de hiérarchieet pins de hiérarchie"
msgid "A no connect symbol is connected to more than 1 pin"
msgid "A no connect symbol is connected to more than 1 pin"
msgstr "Un symbole de non connexion est connecté à plus de une pin"
msgstr "Un symbole de non connexion est connecté à plus de une pin"
#: eeschema/eelibs_read_libraryfiles.cpp:70
#: eeschema/class_sch_component.cpp:1031
#, c-format
msgid "Ref"
msgid "Error <%s> occurred attempting to load component library <%s>"
msgstr "Ref"
msgstr "L'erreur <%s> s'est produite lors du chargement de la librairie de composants <%s>"
#: eeschema/
eelibs_read_libraryfiles.cpp:1
36
#: eeschema/
class_sch_component.cpp:10
36
msgid "
error!
"
msgid "
Pwr Symb
"
msgstr "
erreur!
"
msgstr "
Symb Alim
"
#: eeschema/eelibs_read_libraryfiles.cpp:145
#: eeschema/class_sch_component.cpp:1038
msgid "The following libraries could not be found:"
msgid "Val"
msgstr "Les librairies suivantes n'ont pas pu être trouvées:"
msgstr "Val"
#: eeschema/class_sch_component.cpp:1042
msgid "RefLib"
msgstr "RefLib"
#: eeschema/class_sch_component.cpp:1045
msgid "Lib"
msgstr "Lib"
#: eeschema/dialog_edit_component_in_lib_base.cpp:25
#: eeschema/dialog_edit_component_in_lib_base.cpp:25
msgid "General :"
msgid "General :"
...
@@ -9188,6 +9318,8 @@ msgstr "Chargement terminé "
...
@@ -9188,6 +9318,8 @@ msgstr "Chargement terminé "
#: eeschema/dialog_edit_libentry_fields_in_lib.cpp:159
#: eeschema/dialog_edit_libentry_fields_in_lib.cpp:159
#: eeschema/dialog_edit_libentry_fields_in_lib.cpp:164
#: eeschema/dialog_edit_libentry_fields_in_lib.cpp:164
#: eeschema/dialog_edit_component_in_schematic.cpp:94
#: eeschema/dialog_edit_component_in_schematic.cpp:99
msgid "Pos "
msgid "Pos "
msgstr "Pos "
msgstr "Pos "
...
@@ -9210,116 +9342,41 @@ msgstr "Fichiers Schématiques"
...
@@ -9210,116 +9342,41 @@ msgstr "Fichiers Schématiques"
msgid "File write operation failed."
msgid "File write operation failed."
msgstr "Erreur sur écriture sur fichier."
msgstr "Erreur sur écriture sur fichier."
#: eeschema/classes_body_items.cpp:35
#: eeschema/lib_export.cpp:47
msgid "Undefined"
msgid "Import Component"
msgstr "Non Défini"
msgstr "Importer Composant"
#: eeschema/classes_body_items.cpp:124
#, c-format
msgid "arc only had %d parameters of the required 8"
msgstr "l'arc a seulement %d paramètres sur les 8 requis"
#: eeschema/classes_body_items.cpp:394
#: eeschema/classes_body_items.cpp:572
#: eeschema/classes_body_items.cpp:853
#: eeschema/classes_body_items.cpp:1149
#: eeschema/classes_body_items.cpp:1388
msgid "Bounding box"
msgstr "Rectange dencadrement"
#: eeschema/classes_body_items.cpp:429
#, c-format
msgid "circle only had %d parameters of the required 6"
msgstr "le cercle a seulement %d paramètres sur les 6 requis"
#: eeschema/classes_body_items.cpp:567
msgid "Radius"
msgstr "Rayon"
#: eeschema/classes_body_items.cpp:585
msgid "Rectangle"
msgstr "Rectangle"
#: eeschema/classes_body_items.cpp:608
#, c-format
msgid "rectangle only had %d parameters of the required 7"
msgstr "le rectangle a seulement %d paramètres sur les 7 requis"
#: eeschema/classes_body_items.cpp:898
msgid "PolyLine"
msgstr "PolyLigne"
#: eeschema/classes_body_items.cpp:930
#, c-format
msgid "polyline only had %d parameters of the required 4"
msgstr "la polyligne a seulement %d paramètres sur les 4 requis"
#: eeschema/classes_body_items.cpp:935
#, c-format
msgid "polyline count parameter %d is invalid"
msgstr "le nombre de paramètes (%d) de la polyligne est mauvais"
#: eeschema/classes_body_items.cpp:951
#, c-format
msgid "polyline point %d X position not defined"
msgstr "la position X du point %d de la polyligne n'est pas définie"
#: eeschema/classes_body_items.cpp:958
#, c-format
msgid "polyline point %d Y position not defined"
msgstr "la position Y du point %d de la polyligne n'est pas définie"
#: eeschema/classes_body_items.cpp:1160
msgid "Bezier"
msgstr "Bezier"
#: eeschema/classes_body_items.cpp:1192
#, c-format
msgid "Bezier only had %d parameters of the required 4"
msgstr "La courbe de Bezier a seulement %d paramètres sur les 4 requis"
#: eeschema/classes_body_items.cpp:1197
#, c-format
msgid "Bezier count parameter %d is invalid"
msgstr "le nombre de paramètes (%d) de la courbe de Bezier est mauvais"
#: eeschema/classes_body_items.cpp:1213
#, c-format
msgid "Bezier point %d X position not defined"
msgstr "la position X du point %d de la courbe de Bezier n'est pas définie"
#: eeschema/classes_body_items.cpp:1220
#: eeschema/lib_export.cpp:77
#, c-format
msgid "File is empty"
msgid "Bezier point %d Y position not defined"
msgstr "Fichier vide"
msgstr "la position Y du point %d de la courbe de Bezier n'est pas définie"
#: eeschema/class_libentry.cpp:370
#: eeschema/lib_export.cpp:100
#, c-format
msgid "No Part to Save"
msgid "DEF command expected in line %d, aborted."
msgstr "Pas de composant à sauver"
msgstr ""
#: eeschema/class_libentry.cpp:392
#: eeschema/lib_export.cpp:107
#, c-format
msgid "New Library"
msgid "Wrong DEF format in line %d, skipped."
msgstr "Nouvelle Librairie"
msgstr ""
#: eeschema/
class_libentry.cpp:485
#: eeschema/
lib_export.cpp:107
msgid "
file ended prematurely loading component draw elem
ent"
msgid "
Export Compon
ent"
msgstr ""
msgstr "
Exporter Composant
"
#: eeschema/class_libentry.cpp:525
#: eeschema/lib_export.cpp:145
#, c-format
msgid " - OK"
msgid "undefined DRAW command %c"
msgstr " - OK"
msgstr ""
#: eeschema/class_libentry.cpp:532
#: eeschema/lib_export.cpp:147
#, c-format
msgid ""
msgid "error <%s> in DRAW command %c"
"Note: this new library will be available only if it is loaded by eeschema.\n"
"Modify eeschema config if you want use it."
msgstr ""
msgstr ""
"Note: cette nouvelle librairie sera disponible seulement si elle est chargée par eeschema\n"
"Modifier la config de eeschema si vous voulez l'utiliser"
#: eeschema/
class_libentry.cpp:54
1
#: eeschema/
lib_export.cpp:15
1
msgid "
file ended prematurely while attempting to flush to end of drawing section.
"
msgid "
Error creating
"
msgstr ""
msgstr "
Erreur en création de
"
#: eeschema/dialog_erc_base.cpp:38
#: eeschema/dialog_erc_base.cpp:38
msgid "Erc File Report:"
msgid "Erc File Report:"
...
@@ -9367,38 +9424,18 @@ msgstr "ERC"
...
@@ -9367,38 +9424,18 @@ msgstr "ERC"
msgid "Reset"
msgid "Reset"
msgstr "Défaut"
msgstr "Défaut"
#: eeschema/class_libentry_fields.cpp:112
#: eeschema/eelibs_read_libraryfiles.cpp:68
msgid "invalid field number defined"
msgstr ""
#: eeschema/class_libentry_fields.cpp:151
#, c-format
msgid "field %d does not have the correct number of parameters"
msgstr ""
#: eeschema/class_libentry_fields.cpp:166
#, fuzzy, c-format
msgid "field %d text orientation parameter <%c> is not valid"
msgstr "le nombre de paramètes (%d) de la courbe de Bezier est mauvais"
#: eeschema/class_libentry_fields.cpp:178
#, fuzzy, c-format
msgid "field %d text visible parameter <%c> is not valid"
msgstr "le nombre de paramètes (%d) de la courbe de Bezier est mauvais"
#: eeschema/class_libentry_fields.cpp:197
#, c-format
#, c-format
msgid "
field %d text horizontal justification parameter <%c> is not valid
"
msgid "
Error <%s> occurred attempting to load component library <%s>
"
msgstr ""
msgstr "
L'erreur <%s> s'est produite lors du chargement de la librairie de composants <%s>
"
#: eeschema/class_libentry_fields.cpp:211
#: eeschema/eelibs_read_libraryfiles.cpp:136
#, c-format
msgid " error!"
msgid "field %d text vertical justification parameter <%c> is not valid"
msgstr " erreur!"
msgstr ""
#: eeschema/
class_libentry_fields.cpp:397
#: eeschema/
eelibs_read_libraryfiles.cpp:145
msgid "
Datasheet
"
msgid "
The following libraries could not be found:
"
msgstr "
Documentation
"
msgstr "
Les librairies suivantes n'ont pas pu être trouvées:
"
#: eeschema/edit_component_in_schematic.cpp:38
#: eeschema/edit_component_in_schematic.cpp:38
msgid "No Field to move"
msgid "No Field to move"
...
@@ -9728,6 +9765,28 @@ msgstr "%s %s pin %s : Nets Differents"
...
@@ -9728,6 +9765,28 @@ msgstr "%s %s pin %s : Nets Differents"
msgid "Footprints: %d"
msgid "Footprints: %d"
msgstr "Modules: %d"
msgstr "Modules: %d"
#: cvpcb/readschematicnetlist.cpp:113
msgid "File <"
msgstr "Fichier <"
#: cvpcb/readschematicnetlist.cpp:114
msgid "> not found"
msgstr "> non trouvé"
#: cvpcb/readschematicnetlist.cpp:136
#, c-format
msgid "Unknown file format <%s>"
msgstr " Format fichier inconnu <%s>"
#: cvpcb/readschematicnetlist.cpp:142
msgid "Netlist Format: EESchema"
msgstr " Formats NetListe: EESchema"
#: cvpcb/readschematicnetlist.cpp:203
#, c-format
msgid "Netlist error: %s"
msgstr "Erreur Netliste: %s"
#: cvpcb/cvframe.cpp:266
#: cvpcb/cvframe.cpp:266
msgid ""
msgid ""
"Net and component list modified.\n"
"Net and component list modified.\n"
...
@@ -9871,29 +9930,6 @@ msgstr "Redessin (F3)"
...
@@ -9871,29 +9930,6 @@ msgstr "Redessin (F3)"
msgid "1:1 zoom"
msgid "1:1 zoom"
msgstr "1:1 zoom"
msgstr "1:1 zoom"
#: cvpcb/readschematicnetlist.cpp:113
msgid "File <"
msgstr "Fichier <"
#: cvpcb/readschematicnetlist.cpp:114
#: kicad/prjconfig.cpp:94
msgid "> not found"
msgstr "> non trouvé"
#: cvpcb/readschematicnetlist.cpp:136
#, c-format
msgid "Unknown file format <%s>"
msgstr " Format fichier inconnu <%s>"
#: cvpcb/readschematicnetlist.cpp:142
msgid "Netlist Format: EESchema"
msgstr " Formats NetListe: EESchema"
#: cvpcb/readschematicnetlist.cpp:203
#, c-format
msgid "Netlist error: %s"
msgstr "Erreur Netliste: %s"
#: cvpcb/dialog_display_options.cpp:135
#: cvpcb/dialog_display_options.cpp:135
#: cvpcb/dialog_display_options.cpp:143
#: cvpcb/dialog_display_options.cpp:143
msgid "&Line"
msgid "&Line"
...
@@ -12029,9 +12065,6 @@ msgstr "Ajustage opt Page"
...
@@ -12029,9 +12065,6 @@ msgstr "Ajustage opt Page"
#~ msgstr "erc"
#~ msgstr "erc"
#~ msgid "Could not open PCB foot print library document file <%s>."
#~ msgid "Could not open PCB foot print library document file <%s>."
#~ msgstr "Ne peut pas ouvrir le fichier documentation de module <%s>."
#~ msgstr "Ne peut pas ouvrir le fichier documentation de module <%s>."
#~ msgid "<%s> is not a valid PCB foot print library document file."
#~ msgstr ""
#~ "<%s> n'est pas un fichier librairie documentation module PCB valide."
#~ msgid "ErrType(%d): <b>%s</b><ul><li> %s: %s </li><li> %s: %s </li></ul>"
#~ msgid "ErrType(%d): <b>%s</b><ul><li> %s: %s </li><li> %s: %s </li></ul>"
#~ msgstr "Type Err(%d): <b>%s</b><ul><li> %s: %s </li><li> %s: %s </li></ul>"
#~ msgstr "Type Err(%d): <b>%s</b><ul><li> %s: %s </li><li> %s: %s </li></ul>"
#~ msgid "ErrType(%d): <b>%s</b><ul><li> %s: %s </li></ul>"
#~ msgid "ErrType(%d): <b>%s</b><ul><li> %s: %s </li></ul>"
...
...
pcbnew/CMakeLists.txt
View file @
ef2e41e3
...
@@ -16,13 +16,6 @@ set(PCBNEW_SRCS
...
@@ -16,13 +16,6 @@ set(PCBNEW_SRCS
board.cpp
board.cpp
board_undo_redo.cpp
board_undo_redo.cpp
build_BOM_from_board.cpp
build_BOM_from_board.cpp
# class_board_item.cpp
# class_drawsegment.cpp
# class_edge_mod.cpp
# class_equipot.cpp
# class_module.cpp
# class_text_mod.cpp
# class_track.cpp
clean.cpp
clean.cpp
# cleaningoptions_dialog.cpp
# cleaningoptions_dialog.cpp
connect.cpp
connect.cpp
...
@@ -30,6 +23,7 @@ set(PCBNEW_SRCS
...
@@ -30,6 +23,7 @@ set(PCBNEW_SRCS
# copy_track.cpp <-- not used
# copy_track.cpp <-- not used
cotation.cpp
cotation.cpp
cross-probing.cpp
cross-probing.cpp
debug_kbool_key_file_fct.cpp
deltrack.cpp
deltrack.cpp
dialog_copper_zones.cpp
dialog_copper_zones.cpp
dialog_copper_zones_base.cpp
dialog_copper_zones_base.cpp
...
@@ -140,7 +134,6 @@ set(PCBNEW_SRCS
...
@@ -140,7 +134,6 @@ set(PCBNEW_SRCS
tool_modedit.cpp
tool_modedit.cpp
tool_onrightclick.cpp
tool_onrightclick.cpp
tool_pcb.cpp
tool_pcb.cpp
# tracemod.cpp
tracepcb.cpp
tracepcb.cpp
track.cpp
track.cpp
tr_modif.cpp
tr_modif.cpp
...
...
pcbnew/class_zone.h
View file @
ef2e41e3
...
@@ -52,6 +52,7 @@ public:
...
@@ -52,6 +52,7 @@ public:
* from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole (they are all in one piece)
* from outlines (m_Poly) but unlike m_Poly these filled polygons have no hole (they are all in one piece)
* In very simple cases m_FilledPolysList is same as m_Poly
* In very simple cases m_FilledPolysList is same as m_Poly
* In less simple cases (when m_Poly has holes) m_FilledPolysList is a polygon equivalent to m_Poly, without holes
* In less simple cases (when m_Poly has holes) m_FilledPolysList is a polygon equivalent to m_Poly, without holes
* but with extra outline segment connecting "holes" with external main outline
* In complex cases an ouline decribed by m_Poly can have many filled areas
* In complex cases an ouline decribed by m_Poly can have many filled areas
*/
*/
std
::
vector
<
SEGMENT
>
m_FillSegmList
;
/* set of segments used to fill area, when fill zone by segment is used.
std
::
vector
<
SEGMENT
>
m_FillSegmList
;
/* set of segments used to fill area, when fill zone by segment is used.
...
...
pcbnew/debug_kbool_key_file_fct.cpp
0 → 100644
View file @
ef2e41e3
/* file debug_kbool_key_file_fct.cpp
*/
#include <vector>
#include "fctsys.h"
#include "common.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "zones.h"
#include "PolyLine.h"
#include "debug_kbool_key_file_fct.h"
#ifdef CREATE_KBOOL_KEY_FILES
static
FILE
*
kdebugFile
;
static
const
char
*
sDate_Time
=
"2009-09-07 15:59:24"
;
void
CreateKeyFile
()
{
kdebugFile
=
fopen
(
KEYFILE_FILENAME
,
"wt"
);
if
(
kdebugFile
)
{
fprintf
(
kdebugFile
,
"# KEY file for GDS-II postprocessing tool
\n
"
);
fprintf
(
kdebugFile
,
"# File = %s
\n
"
,
KEYFILE_FILENAME
);
fprintf
(
kdebugFile
,
"# ====================================================================
\n
"
);
fprintf
(
kdebugFile
,
"
\n
HEADER 5; # version
\n
"
);
fprintf
(
kdebugFile
,
"BGNLIB;
\n
"
);
fprintf
(
kdebugFile
,
"LASTMOD {%s}; # last modification time
\n
"
,
sDate_Time
);
fprintf
(
kdebugFile
,
"LASTACC {%s}; # last access time
\n
"
,
sDate_Time
);
fprintf
(
kdebugFile
,
"LIBNAME trial;
\n
"
);
fprintf
(
kdebugFile
,
"UNITS;
\n
# Units are in 0.0001 inch
\n
"
);
fprintf
(
kdebugFile
,
"USERUNITS 1; PHYSUNITS 0.0001;
\n\n
"
);
}
else
{
wxMessageBox
(
wxT
(
"CreateKeyFile() cannot create output file"
)
);
}
}
void
CloseKeyFile
()
{
if
(
kdebugFile
)
{
fprintf
(
kdebugFile
,
"
\n
ENDLIB;
\n
"
);
fclose
(
kdebugFile
);
}
}
const
char
*
sCurrEntityName
=
NULL
;
static
int
s_count
;
void
OpenEntity
(
const
char
*
aName
)
{
if
(
kdebugFile
)
{
fprintf
(
kdebugFile
,
"
\n
BGNSTR; # Begin of structure
\n
"
);
fprintf
(
kdebugFile
,
"CREATION {%s}; # creation time
\n
"
,
sDate_Time
);
fprintf
(
kdebugFile
,
"LASTMOD {%s}; # last modification time
\n
"
,
sDate_Time
);
fprintf
(
kdebugFile
,
"STRNAME %s;
\n
"
,
aName
);
}
sCurrEntityName
=
aName
;
s_count
=
0
;
}
void
CloseEntity
()
{
if
(
kdebugFile
)
fprintf
(
kdebugFile
,
"
\n
ENDSTR %s;
\n
"
,
sCurrEntityName
);
}
void
StartPolygon
(
int
aCornersCount
,
int
aLayer
)
{
fprintf
(
kdebugFile
,
"
\n
BOUNDARY; LAYER %d; DATATYPE 0;
\n
"
,
aLayer
);
fprintf
(
kdebugFile
,
" XY %d;
\n
"
,
aCornersCount
);
s_count
=
0
;
}
void
EndElement
()
{
if
(
s_count
==
1
)
fprintf
(
kdebugFile
,
"
\n
"
);
fprintf
(
kdebugFile
,
"
\n
ENDEL;
\n
"
);
s_count
=
0
;
}
void
CopyPolygonsFromFilledPolysListToKeyFile
(
ZONE_CONTAINER
*
aZone
,
int
aLayer
)
{
if
(
!
kdebugFile
)
return
;
unsigned
corners_count
=
aZone
->
m_FilledPolysList
.
size
();
int
count
=
0
;
unsigned
ic
=
0
;
CPolyPt
*
corner
;
while
(
ic
<
corners_count
)
{
// Count corners:
count
=
0
;
for
(
unsigned
ii
=
ic
;
ii
<
corners_count
;
ii
++
)
{
corner
=
&
aZone
->
m_FilledPolysList
[
ii
];
count
++
;
if
(
corner
->
end_contour
)
break
;
}
// write corners:
StartPolygon
(
count
+
1
,
aLayer
);
corner
=
&
aZone
->
m_FilledPolysList
[
ic
];
int
startpointX
=
corner
->
x
;
int
startpointY
=
corner
->
y
;
for
(
;
ic
<
corners_count
;
ic
++
)
{
corner
=
&
aZone
->
m_FilledPolysList
[
ic
];
AddPointXY
(
corner
->
x
,
corner
->
y
);
if
(
corner
->
end_contour
)
{
ic
++
;
break
;
}
}
// Close polygon:
AddPointXY
(
startpointX
,
startpointY
);
EndElement
();
}
}
void
AddPointXY
(
int
aXcoord
,
int
aYcoord
)
{
if
(
s_count
>=
2
)
{
s_count
=
0
;
fprintf
(
kdebugFile
,
"
\n
"
);
}
SetLocaleTo_C_standard
();
fprintf
(
kdebugFile
,
" X %d; Y %d;"
,
aXcoord
,
aYcoord
);
SetLocaleTo_Default
(
);
s_count
++
;
}
#endif
pcbnew/debug_kbool_key_file_fct.h
0 → 100644
View file @
ef2e41e3
/* debug_kbool_key_file_fct.h
*/
#ifndef _DEBUG_KBOOL_KEY_FILE_FCT_H_
#define _DEBUG_KBOOL_KEY_FILE_FCT_H_
/* This line must be uncommented only if you wan to produce a file
* to debug kbool
*/
//#define CREATE_KBOOL_KEY_FILES
#ifdef CREATE_KBOOL_KEY_FILES
#define KEYFILE_FILENAME "dbgfile.key"
/** function CreateKeyFile
* open KEYFILE_FILENAME file
* and create header
*/
void
CreateKeyFile
();
/** function CloseKeyFile
* close KEYFILE_FILENAME file
*/
void
CloseKeyFile
();
/* create header to start an entity description
*/
void
OpenEntity
(
const
char
*
aName
);
/* close the entity description
*/
void
CloseEntity
();
/* polygon creations:
*/
void
CopyPolygonsFromFilledPolysListToKeyFile
(
ZONE_CONTAINER
*
aZone
,
int
aLayer
);
void
StartPolygon
(
int
aCornersCount
,
int
aLayer
);
void
AddPointXY
(
int
aXcoord
,
int
aYcoord
);
void
EndElement
();
#endif // CREATE_KBOOL_KEY_FILES
#endif // _DEBUG_KBOOL_KEY_FILE_FCT_H_
pcbnew/drc.cpp
View file @
ef2e41e3
...
@@ -1077,8 +1077,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
...
@@ -1077,8 +1077,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
shape_pos
=
aRefPad
->
ReturnShapePos
();
shape_pos
=
aRefPad
->
ReturnShapePos
();
// rel_pos is pad position relative to the aRefPad position
// rel_pos is pad position relative to the aRefPad position
rel_pos
.
x
-=
shape_pos
.
x
;
rel_pos
-=
shape_pos
;
rel_pos
.
y
-=
shape_pos
.
y
;
dist
=
(
int
)
hypot
(
rel_pos
.
x
,
rel_pos
.
y
);
dist
=
(
int
)
hypot
(
rel_pos
.
x
,
rel_pos
.
y
);
...
@@ -1101,8 +1100,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
...
@@ -1101,8 +1100,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
if
(
swap_pads
)
if
(
swap_pads
)
{
{
EXCHG
(
aRefPad
,
aPad
);
EXCHG
(
aRefPad
,
aPad
);
rel_pos
.
x
=
-
rel_pos
.
x
;
rel_pos
=
-
rel_pos
;
rel_pos
.
y
=
-
rel_pos
.
y
;
}
}
switch
(
aRefPad
->
m_PadShape
)
switch
(
aRefPad
->
m_PadShape
)
...
@@ -1128,7 +1126,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
...
@@ -1128,7 +1126,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
wxSize
size
=
aPad
->
m_Size
;
wxSize
size
=
aPad
->
m_Size
;
// The trivial case is if both rects are rotated by multiple of 90°
// The trivial case is if both rects are rotated by multiple of 90°
if
(
((
aRefPad
->
m_Orient
==
0
)
||
(
aRefPad
->
m_Orient
==
900
)
||
(
aRefPad
->
m_Orient
==
1800
)
if
(
((
aRefPad
->
m_Orient
==
0
)
||
(
aRefPad
->
m_Orient
==
900
)
||
(
aRefPad
->
m_Orient
==
1800
)
||
(
aRefPad
->
m_Orient
==
2700
))
&&
||
(
aRefPad
->
m_Orient
==
2700
))
&&
((
aPad
->
m_Orient
==
0
)
||
(
aPad
->
m_Orient
==
900
)
||
(
aPad
->
m_Orient
==
1800
)
((
aPad
->
m_Orient
==
0
)
||
(
aPad
->
m_Orient
==
900
)
||
(
aPad
->
m_Orient
==
1800
)
||
(
aPad
->
m_Orient
==
2700
))
)
||
(
aPad
->
m_Orient
==
2700
))
)
{
{
...
@@ -1230,7 +1228,6 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
...
@@ -1230,7 +1228,6 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
m_finx
=
-
sx
;
m_finx
=
-
sx
;
m_finy
=
-
sy
;
// end of segment coordinate
m_finy
=
-
sy
;
// end of segment coordinate
diag
=
checkClearanceSegmToPad
(
aPad
,
segm_width
/
2
,
dist_min
);
diag
=
checkClearanceSegmToPad
(
aPad
,
segm_width
/
2
,
dist_min
);
break
;
break
;
}
}
...
...
pcbnew/zones_by_polygon.cpp
View file @
ef2e41e3
...
@@ -500,7 +500,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
...
@@ -500,7 +500,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
{
{
int
diag
;
int
diag
;
// Init zone params to reasonnable values
// Init zone params to reasonnable values
zone
->
SetLayer
(
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
);
zone
->
SetLayer
(
GetScreen
(
)
->
m_Active_Layer
);
// Prompt user for parameters:
// Prompt user for parameters:
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
DrawPanel
->
m_IgnoreMouseEvents
=
TRUE
;
...
@@ -518,6 +518,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
...
@@ -518,6 +518,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
wxGetApp
().
m_EDA_Config
->
Read
(
ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY
,
wxGetApp
().
m_EDA_Config
->
Read
(
ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY
,
&
g_Zone_Default_Setting
.
m_ThermalReliefCopperBridgeValue
);
&
g_Zone_Default_Setting
.
m_ThermalReliefCopperBridgeValue
);
g_Zone_Default_Setting
.
m_CurrentZone_Layer
=
zone
->
GetLayer
();
dialog_copper_zone
*
frame
=
new
dialog_copper_zone
(
this
,
&
g_Zone_Default_Setting
);
dialog_copper_zone
*
frame
=
new
dialog_copper_zone
(
this
,
&
g_Zone_Default_Setting
);
diag
=
frame
->
ShowModal
();
diag
=
frame
->
ShowModal
();
frame
->
Destroy
();
frame
->
Destroy
();
...
@@ -534,7 +535,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
...
@@ -534,7 +535,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
return
0
;
return
0
;
// Switch active layer to the selectec zonz layer
// Switch active layer to the selectec zonz layer
(
(
PCB_SCREEN
*
)
GetScreen
()
)
->
m_Active_Layer
=
g_Zone_Default_Setting
.
m_CurrentZone_Layer
;
GetScreen
(
)
->
m_Active_Layer
=
g_Zone_Default_Setting
.
m_CurrentZone_Layer
;
}
}
else
// Start a new contour: init zone params (net and layer) from an existing zone (add cutout or similar zone)
else
// Start a new contour: init zone params (net and layer) from an existing zone (add cutout or similar zone)
{
{
...
...
pcbnew/zones_convert_brd_items_to_polygons.cpp
View file @
ef2e41e3
...
@@ -25,19 +25,38 @@
...
@@ -25,19 +25,38 @@
#include "fctsys.h"
#include "fctsys.h"
#include "common.h"
#include "common.h"
#include "pcbnew.h"
#include "pcbnew.h"
#include "wxPcbStruct.h"
#include "trigo.h"
#include "trigo.h"
#include "zones.h"
#include "zones.h"
#include "PolyLine.h"
#include "PolyLine.h"
// Kbool 1.9 and before had sometimes problemes when calculating thermal shapes as polygons (this is the best solution)
// So as a workaround we can use stubs (small tracks segments) to create thermal shape
// Define USE_STUBS_FOR_THERMAL to work on this workaround
// Currently under development: DO NOT USE
// because the code is not finished, and pcbnew does not work properly when used
// Kbool 2.0 has solved some problems, but not all
//#define USE_STUBS_FOR_THERMAL
using
namespace
std
;
// Used to create data files to debug Kbool
#include "debug_kbool_key_file_fct.h"
// Also we can create test files for Kbool bebug purposes
// when CREATE_KBOOL_KEY_FILES is defined
// See debug_kbool_key_file_fct.h
extern
void
Test_For_Copper_Island_And_Remove
(
BOARD
*
aPcb
,
ZONE_CONTAINER
*
aZone_container
);
extern
void
Test_For_Copper_Island_And_Remove
(
BOARD
*
aPcb
,
ZONE_CONTAINER
*
aZone_container
);
// Local Functions:
// Local Functions:
#ifdef USE_STUBS_FOR_THERMAL
#warning USE_STUBS_FOR_THERMAL defined for test version: do not use for working pcbnew version
void
CreateStubsForThermalShapes
(
BOARD
*
aPcb
,
ZONE_CONTAINER
*
aZone_container
,
int
aThermalGap
,
int
aCopperThickness
,
int
aMinThicknessValue
);
#endif
void
AddTrackWithClearancePolygon
(
Bool_Engine
*
aBooleng
,
void
AddTrackWithClearancePolygon
(
Bool_Engine
*
aBooleng
,
TRACK
&
aTrack
,
int
aClearanceValue
);
TRACK
&
aTrack
,
int
aClearanceValue
);
void
AddPadWithClearancePolygon
(
Bool_Engine
*
aBooleng
,
D_PAD
&
aPad
,
int
aClearanceValue
);
void
AddPadWithClearancePolygon
(
Bool_Engine
*
aBooleng
,
D_PAD
&
aPad
,
int
aClearanceValue
);
...
@@ -202,15 +221,20 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -202,15 +221,20 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
continue
;
continue
;
}
}
int
gap
=
clearance
;
#ifdef USE_STUBS_FOR_THERMAL
gap
=
MAX
(
clearance
,
m_ThermalReliefGapValue
);
#else
if
(
(
m_PadOption
==
PAD_NOT_IN_ZONE
)
if
(
(
m_PadOption
==
PAD_NOT_IN_ZONE
)
||
(
GetNet
()
==
0
)
||
pad
->
m_PadShape
==
PAD_TRAPEZOID
)
||
(
GetNet
()
==
0
)
||
pad
->
m_PadShape
==
PAD_TRAPEZOID
)
// PAD_TRAPEZOID shapes are *never* in zones becuase they are used in microwave apps
// PAD_TRAPEZOID shapes are not in zones because they are used in microwave apps
// and the shae *must not* be changed by thermal pads or others
// and i think it is good shapes are not changed by thermal pads or others
#endif
{
{
item_boundingbox
=
pad
->
GetBoundingBox
();
item_boundingbox
=
pad
->
GetBoundingBox
();
if
(
item_boundingbox
.
Intersects
(
zone_boundingbox
)
)
if
(
item_boundingbox
.
Intersects
(
zone_boundingbox
)
)
{
{
AddPadWithClearancePolygon
(
booleng
,
*
pad
,
clearance
);
AddPadWithClearancePolygon
(
booleng
,
*
pad
,
gap
);
have_poly_to_substract
=
true
;
have_poly_to_substract
=
true
;
}
}
}
}
...
@@ -297,6 +321,18 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -297,6 +321,18 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
}
}
delete
booleng
;
delete
booleng
;
#ifdef USE_STUBS_FOR_THERMAL
// remove thermal gaps if required:
if
(
m_PadOption
!=
THERMAL_PAD
||
aPcb
->
m_Modules
==
NULL
)
{
Test_For_Copper_Island_And_Remove_Insulated_Islands
(
aPcb
);
return
;
}
CreateStubsForThermalShapes
(
aPcb
,
this
,
m_ThermalReliefGapValue
,
m_ThermalReliefCopperBridgeValue
,
m_ZoneMinThickness
);
Test_For_Copper_Island_And_Remove_Insulated_Islands
(
aPcb
);
#else
// Remove insulated islands:
// Remove insulated islands:
if
(
GetNet
()
>
0
)
if
(
GetNet
()
>
0
)
Test_For_Copper_Island_And_Remove_Insulated_Islands
(
aPcb
);
Test_For_Copper_Island_And_Remove_Insulated_Islands
(
aPcb
);
...
@@ -314,6 +350,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -314,6 +350,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
ArmBoolEng
(
booleng
,
true
);
ArmBoolEng
(
booleng
,
true
);
have_poly_to_substract
=
false
;
have_poly_to_substract
=
false
;
#ifdef CREATE_KBOOL_KEY_FILES
CreateKeyFile
();
OpenEntity
(
"Layer"
);
CopyPolygonsFromFilledPolysListToKeyFile
(
this
,
0
);
#endif
for
(
MODULE
*
module
=
aPcb
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
for
(
MODULE
*
module
=
aPcb
->
m_Modules
;
module
;
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
()
)
...
@@ -335,6 +377,9 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -335,6 +377,9 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
}
}
}
}
}
}
#ifdef CREATE_KBOOL_KEY_FILES
CloseEntity
();
#endif
if
(
have_poly_to_substract
)
if
(
have_poly_to_substract
)
{
{
...
@@ -353,6 +398,9 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -353,6 +398,9 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
// Remove insulated islands:
// Remove insulated islands:
if
(
GetNet
()
>
0
)
if
(
GetNet
()
>
0
)
Test_For_Copper_Island_And_Remove_Insulated_Islands
(
aPcb
);
Test_For_Copper_Island_And_Remove_Insulated_Islands
(
aPcb
);
#ifdef CREATE_KBOOL_KEY_FILES
CloseKeyFile
();
#endif
}
}
// Now we remove all unused thermal stubs.
// Now we remove all unused thermal stubs.
...
@@ -402,7 +450,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -402,7 +450,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
{
{
dx
=
(
int
)
(
dx
*
s_Correction
);
dx
=
(
int
)
(
dx
*
s_Correction
);
dy
=
dx
;
dy
=
dx
;
#ifdef CREATE_KBOOL_KEY_FILES
fAngle
=
0
;
#else
fAngle
=
450
;
fAngle
=
450
;
#endif
}
}
// compute north, south, west and east points for zone connection.
// compute north, south, west and east points for zone connection.
...
@@ -500,7 +552,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
...
@@ -500,7 +552,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
delete
booleng
;
delete
booleng
;
#endif
#endif // REMOVE_UNUSED_THERMAL_STUBS
#endif // USE_STUBS_FOR_THERMAL
}
}
...
@@ -671,6 +724,96 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
...
@@ -671,6 +724,96 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
}
}
/** function CreateStubsForThermalShapes()
* Only for testing the thermal shapes by stubs purposes
* Do not use for working pcbnew versions
*/
void
CreateStubsForThermalShapes
(
BOARD
*
aPcb
,
ZONE_CONTAINER
*
aZone_container
,
int
aThermalGap
,
int
aCopperThickness
,
int
aMinThicknessValue
)
{
EDA_Rect
zone_boundingbox
=
aZone_container
->
GetBoundingBox
();
for
(
MODULE
*
module
=
aPcb
->
m_Modules
;
module
;
module
=
module
->
Next
()
)
{
for
(
D_PAD
*
pad
=
module
->
m_Pads
;
pad
!=
NULL
;
pad
=
pad
->
Next
()
)
{
// check
if
(
!
pad
->
IsOnLayer
(
aZone_container
->
GetLayer
()
)
)
continue
;
if
(
pad
->
GetNet
()
!=
aZone_container
->
GetNet
()
)
continue
;
EDA_Rect
item_boundingbox
=
pad
->
GetBoundingBox
();
item_boundingbox
.
Inflate
(
aThermalGap
,
aThermalGap
);
if
(
!
(
item_boundingbox
.
Intersects
(
zone_boundingbox
)
)
)
continue
;
// test point
int
dx
=
(
pad
->
m_Size
.
x
/
2
)
+
aThermalGap
;
int
dy
=
(
pad
->
m_Size
.
y
/
2
)
+
aThermalGap
;
// This is CIRCLE pad tweak (for circle pads the thermal stubs are at 45 deg)
int
fAngle
=
pad
->
m_Orient
;
if
(
pad
->
m_PadShape
==
PAD_CIRCLE
)
{
dx
=
(
int
)
(
dx
*
s_Correction
);
dy
=
dx
;
fAngle
=
450
;
}
// compute north, south, west and east points for zone connection.
// Add a small value to ensure point is inside (or outside) zone, not on an edge
wxPoint
ptTest
[
4
];
ptTest
[
0
]
=
wxPoint
(
0
,
3
+
dy
+
aMinThicknessValue
/
2
);
ptTest
[
1
]
=
wxPoint
(
0
,
-
(
3
+
dy
+
aMinThicknessValue
/
2
)
);
ptTest
[
2
]
=
wxPoint
(
3
+
dx
+
aMinThicknessValue
/
2
,
0
);
ptTest
[
3
]
=
wxPoint
(
-
(
3
+
dx
+
aMinThicknessValue
/
2
),
0
);
// Test all sides
for
(
int
i
=
0
;
i
<
4
;
i
++
)
{
// rotate point
RotatePoint
(
&
ptTest
[
i
],
fAngle
);
// translate point
ptTest
[
i
]
+=
pad
->
ReturnShapePos
();
bool
inside
=
aZone_container
->
HitTestFilledArea
(
ptTest
[
i
]
);
if
(
inside
)
{
TRACK
*
track
=
new
TRACK
(
aPcb
);
track
->
m_Start
=
pad
->
ReturnShapePos
();
track
->
m_End
=
ptTest
[
i
];
track
->
SetNet
(
aZone_container
->
GetNet
());
track
->
SetLayer
(
aZone_container
->
GetLayer
()
);
track
->
m_Width
=
aCopperThickness
;
track
->
m_TimeStamp
=
aZone_container
->
m_TimeStamp
;
track
->
SetState
(
BEGIN_ONPAD
,
ON
);
track
->
start
=
pad
;
// add stub
WinEDA_PcbFrame
*
pcbFrame
=
(
WinEDA_PcbFrame
*
)
aPcb
->
m_PcbFrame
;
if
(
pcbFrame
->
GetDrcController
()
->
Drc
(
track
,
aPcb
->
m_Track
)
==
BAD_DRC
)
delete
track
;
else
{
// If this approach is developped, one must change the way the stubs are handles in pcbnew
// because insert these stubs as tracks does not work with undo/redo functions
// because these stubs must be deleted when refilling zones outside undo/redo calls
// This code is only for trial only, not for working pcbnew versions.
TRACK
*
insertBeforeMe
=
track
->
GetBestInsertPoint
(
aPcb
);
aPcb
->
m_Track
.
Insert
(
track
,
insertBeforeMe
);
}
}
}
}
}
}
/** function AddThermalReliefPadPolygon
/** function AddThermalReliefPadPolygon
* Add holes around a pad to create a thermal relief
* Add holes around a pad to create a thermal relief
* copper thickness is min (dx/2, aCopperWitdh) or min (dy/2, aCopperWitdh)
* copper thickness is min (dx/2, aCopperWitdh) or min (dy/2, aCopperWitdh)
...
@@ -773,7 +916,9 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
...
@@ -773,7 +916,9 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
corner
.
x
=
copper_thickness
.
x
/
2
;
corner
.
x
=
copper_thickness
.
x
/
2
;
int
y
=
outer_radius
-
(
aThermalGap
/
4
);
int
y
=
outer_radius
-
(
aThermalGap
/
4
);
corner
.
y
=
(
int
)
sqrt
(
(
(
(
double
)
y
*
y
)
-
(
double
)
corner
.
x
*
corner
.
x
)
);
corner
.
y
=
(
int
)
sqrt
(
(
(
(
double
)
y
*
y
)
-
(
double
)
corner
.
x
*
corner
.
x
)
);
#ifndef CREATE_KBOOL_KEY_FILES
corners_buffer
.
push_back
(
corner
);
corners_buffer
.
push_back
(
corner
);
#endif
// calculate the starting point of the outter arc
// calculate the starting point of the outter arc
corner
.
x
=
copper_thickness
.
x
/
2
;
corner
.
x
=
copper_thickness
.
x
/
2
;
...
@@ -804,26 +949,45 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
...
@@ -804,26 +949,45 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
// Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg
// Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg
// WARNING: problems with kbool if angle = 0 (in fact when angle < 200):
// WARNING: problems with kbool if angle = 0 (in fact when angle < 200):
// bad filled polygon on some cases, when pads are on a same vertical line
// bad filled polygon on some cases, when pads are on a same vertical line
// this seems a bug in kbool polygon (exists in
1.9
kbool version)
// this seems a bug in kbool polygon (exists in
2.0
kbool version)
// angle = 450 (45.0 degrees orientation) seems work fine.
// angle = 450 (45.0 degrees orientation) seems work fine.
// angle = 0 with thermal shapes without angle < 90 deg has problems in rare circumstances
// angle = 0 with thermal shapes without angle < 90 deg has problems in rare circumstances
// Note: with the 2 step build ( thermal shapes added after areas are built), 0 seems work
// Note: with the 2 step build ( thermal shapes added after areas are built), 0 seems work
#ifdef CREATE_KBOOL_KEY_FILES
angle
=
0
;
#else
angle
=
450
;
angle
=
450
;
#endif
int
angle_pad
=
aPad
.
m_Orient
;
// Pad orientation
int
angle_pad
=
aPad
.
m_Orient
;
// Pad orientation
for
(
unsigned
ihole
=
0
;
ihole
<
4
;
ihole
++
)
for
(
unsigned
ihole
=
0
;
ihole
<
4
;
ihole
++
)
{
{
if
(
aBooleng
->
StartPolygonAdd
(
GROUP_B
)
)
if
(
aBooleng
->
StartPolygonAdd
(
GROUP_B
)
)
{
{
#ifdef CREATE_KBOOL_KEY_FILES
StartPolygon
(
corners_buffer
.
size
()
+
1
,
1
);
#endif
for
(
unsigned
ii
=
0
;
ii
<
corners_buffer
.
size
();
ii
++
)
for
(
unsigned
ii
=
0
;
ii
<
corners_buffer
.
size
();
ii
++
)
{
{
corner
=
corners_buffer
[
ii
];
corner
=
corners_buffer
[
ii
];
RotatePoint
(
&
corner
,
angle
+
angle_pad
);
// Rotate by segment angle and pad orientation
RotatePoint
(
&
corner
,
angle
+
angle_pad
);
// Rotate by segment angle and pad orientation
corner
+=
PadShapePos
;
corner
+=
PadShapePos
;
aBooleng
->
AddPoint
(
corner
.
x
,
corner
.
y
);
aBooleng
->
AddPoint
(
corner
.
x
,
corner
.
y
);
#ifdef CREATE_KBOOL_KEY_FILES
AddPointXY
(
corner
.
x
,
corner
.
y
);
#endif
}
}
#ifdef CREATE_KBOOL_KEY_FILES
// Close polygon
corner
=
corners_buffer
[
0
];
RotatePoint
(
&
corner
,
angle
+
angle_pad
);
// Rotate by segment angle and pad orientation
corner
+=
PadShapePos
;
AddPointXY
(
corner
.
x
,
corner
.
y
);
#endif
aBooleng
->
EndPolygonAdd
();
aBooleng
->
EndPolygonAdd
();
#ifdef CREATE_KBOOL_KEY_FILES
EndElement
();
#endif
angle
+=
900
;
// Note: angle in in 0.1 deg.
angle
+=
900
;
// Note: angle in in 0.1 deg.
}
}
}
}
...
...
pcbnew/zones_test_and_combine_areas.cpp
View file @
ef2e41e3
...
@@ -952,7 +952,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
...
@@ -952,7 +952,7 @@ int BOARD::Test_Drc_Areas_Outlines_To_Areas_Outlines( ZONE_CONTAINER* aArea_To_E
}
}
int
bstyle
=
Area_To_Test
->
m_Poly
->
GetSideStyle
(
ic2
);
int
bstyle
=
Area_To_Test
->
m_Poly
->
GetSideStyle
(
ic2
);
int
x
,
y
;
int
x
,
y
;
int
d
=
::
GetClearanceBetweenSegments
(
int
d
=
GetClearanceBetweenSegments
(
bx1
,
by1
,
bx2
,
by2
,
bstyle
,
bx1
,
by1
,
bx2
,
by2
,
bstyle
,
0
,
0
,
ax1
,
ay1
,
ax2
,
ax1
,
ay1
,
ax2
,
...
@@ -1081,7 +1081,7 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex )
...
@@ -1081,7 +1081,7 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex )
}
}
int
bstyle
=
Area_To_Test
->
m_Poly
->
GetSideStyle
(
ic2
);
int
bstyle
=
Area_To_Test
->
m_Poly
->
GetSideStyle
(
ic2
);
int
x
,
y
;
int
x
,
y
;
int
d
=
::
GetClearanceBetweenSegments
(
bx1
,
by1
,
bx2
,
by2
,
bstyle
,
int
d
=
GetClearanceBetweenSegments
(
bx1
,
by1
,
bx2
,
by2
,
bstyle
,
0
,
0
,
ax1
,
ay1
,
ax2
,
ay2
,
astyle
,
ax1
,
ay1
,
ax2
,
ay2
,
astyle
,
0
,
0
,
...
...
polygon/PolyLine.cpp
View file @
ef2e41e3
...
@@ -538,13 +538,16 @@ void ArmBoolEng( Bool_Engine* aBooleng, bool aConvertHoles )
...
@@ -538,13 +538,16 @@ void ArmBoolEng( Bool_Engine* aBooleng, bool aConvertHoles )
Within the algorithm all input data is multiplied with DGRID, and the result
Within the algorithm all input data is multiplied with DGRID, and the result
is rounded to an integer.
is rounded to an integer.
*/
*/
double
DGRID
=
1.0
;
// round coordinate X or Y value in calculations to this (initial value = 1000.0 in kbool example)
double
DGRID
=
10.0
;
// round coordinate X or Y value in calculations to this (initial value = 1000.0 in kbool example)
// Note: in kicad, coordinates are already integer so DGRID can be set to 1
// Note: in kicad, coordinates are already integer so DGRID could be set to 1
// we choose a DGRID = 10 to have a MARGE = 1.0
double
MARGE
=
1.0
;
// snap with in this range points to lines in the intersection routines
// should always be > 1/DGRID a MARGE >= 10/DGRID is ok
// this is also used to remove small segments and to decide when
// two segments are in line. ( initial value = 0.001 )
// For kicad we choose MARGE = 1, with DGRID = 10
double
MARGE
=
0.001
;
// snap with in this range points to lines in the intersection routines
// should always be > DGRID a MARGE >= 10*DGRID is ok
// this is also used to remove small segments and to decide when
// two segments are in line. ( initial value = 0.001 )
double
CORRECTIONFACTOR
=
0.0
;
// correct the polygons by this number: used in BOOL_CORRECTION operation
double
CORRECTIONFACTOR
=
0.0
;
// correct the polygons by this number: used in BOOL_CORRECTION operation
// this operation shrinks a polygon if CORRECTIONFACTOR < 0
// this operation shrinks a polygon if CORRECTIONFACTOR < 0
// or stretch it if CORRECTIONFACTOR > 0
// or stretch it if CORRECTIONFACTOR > 0
...
...
polygon/kbool/include/kbool/_dl_itr.cpp
View file @
ef2e41e3
/*! \file kbool/_dl_itr.cpp
/*! \file kbool/_dl_itr.cpp
\brief Double Linked list with Iterators on list
\brief Double Linked list with Iterators on list
\author Probably Klaas Holwerda
\author Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence:
wxWidgets Licence
Licence:
see kboollicense.txt
RCS-ID: $Id: _dl_itr.cpp,v 1.
3 2006/12/13 21:43:33
titato Exp $
RCS-ID: $Id: _dl_itr.cpp,v 1.
5 2009/04/23 19:35:24
titato Exp $
*/
*/
#ifdef __UNIX__
#ifdef __UNIX__
...
@@ -116,20 +116,20 @@ Error("remove_all",ITER_GT_O);
...
@@ -116,20 +116,20 @@ Error("remove_all",ITER_GT_O);
\param error code to generate a message for
\param error code to generate a message for
*/
*/
template
<
class
Dtype
>
template
<
class
Dtype
>
void
DL_List
<
Dtype
>::
Error
(
const
char
*
function
,
Lerror
a_error
)
void
DL_List
<
Dtype
>::
Error
(
string
function
,
Lerror
a_error
)
{
{
char
buf
[
100
]
;
string
buf
;
strcpy
(
buf
,
"DL_List<Dtype>::"
)
;
buf
+=
"DL_List<Dtype>::"
;
strcat
(
buf
,
function
)
;
buf
+=
function
;
switch
(
a_error
)
switch
(
a_error
)
{
{
case
NO_MES
:
strcat
(
buf
,
""
)
;
break
;
case
NO_MES
:
buf
+=
""
;
break
;
case
EMPTY
:
strcat
(
buf
,
"list is empty"
)
;
break
;
case
EMPTY
:
buf
+=
"list is empty"
;
break
;
case
ITER_GT_0
:
strcat
(
buf
,
"more then zero iter"
)
;
break
;
case
ITER_GT_0
:
buf
+=
"more then zero iter"
;
break
;
case
NO_LIST
:
strcat
(
buf
,
"no list attached"
)
;
break
;
case
NO_LIST
:
buf
+=
"no list attached"
;
break
;
case
SAME_LIST
:
strcat
(
buf
,
"same list not allowed"
)
;
break
;
case
SAME_LIST
:
buf
+=
"same list not allowed"
;
break
;
case
AC_ITER_LIST_OTHER
:
strcat
(
buf
,
"iter not allowed on other list"
)
;
break
;
case
AC_ITER_LIST_OTHER
:
buf
+=
"iter not allowed on other list"
;
break
;
default
:
strcat
(
buf
,
"unhandled error"
)
;
break
;
default
:
buf
+=
"unhandled error"
;
break
;
}
}
throw
Bool_Engine_Error
(
buf
,
"list error"
,
0
,
1
);
throw
Bool_Engine_Error
(
buf
,
"list error"
,
0
,
1
);
...
@@ -143,9 +143,9 @@ class | Dtype | item object in list
...
@@ -143,9 +143,9 @@ class | Dtype | item object in list
too see if list is empty
too see if list is empty
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
if (_intlist.Empty())
if (_intlist.Empty())
cout << "empty";
cout << "empty";
\endcode
\endcode
*/
*/
...
@@ -163,9 +163,9 @@ bool DL_List<Dtype>::empty()
...
@@ -163,9 +163,9 @@ bool DL_List<Dtype>::empty()
too see if list contains only one object
too see if list contains only one object
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
if (_intlist.count() == 1)
if (_intlist.count() == 1)
cout << "one object in list";
cout << "one object in list";
\endcode
\endcode
*/
*/
...
@@ -181,11 +181,11 @@ int DL_List<Dtype>::count()
...
@@ -181,11 +181,11 @@ int DL_List<Dtype>::count()
\note
\note
The objects itself are not deleted, only removed from the list.
The objects itself are not deleted, only removed from the list.
The user is responsible for memory management.
The user is responsible for memory management.
\note
\note
The iterator level must be zero to be able to use this function,
The iterator level must be zero to be able to use this function,
else an error will be generated
else an error will be generated
\note
\note
Use this function if an iterator is not needed to do more complex things.
Use this function if an iterator is not needed to do more complex things.
This will save time, since the iterator does not have to be created.
This will save time, since the iterator does not have to be created.
...
@@ -194,13 +194,13 @@ int DL_List<Dtype>::count()
...
@@ -194,13 +194,13 @@ int DL_List<Dtype>::count()
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
int b=345;
int b=345;
_intlist.insbegin(a);
_intlist.insbegin(a);
_intlist.insbegin(b);
_intlist.insbegin(b);
_intlist.remove_all();
_intlist.remove_all();
\endcode
\endcode
*/
*/
...
@@ -233,28 +233,28 @@ remove the object at the begin of the list (head).
...
@@ -233,28 +233,28 @@ remove the object at the begin of the list (head).
\note
\note
The object itself is not deleted, only removed from the list.
The object itself is not deleted, only removed from the list.
The user is responsible for memory management.
The user is responsible for memory management.
\note
\note
The iterator level must be zero to be able to use this function, else an error will be generated
The iterator level must be zero to be able to use this function, else an error will be generated
\note
\note
The list must contain objects, else an error will be generated.
The list must contain objects, else an error will be generated.
\note
\note
Use this function if an iterator is not needed to do more complex things. This will save time, since the iterator does not
Use this function if an iterator is not needed to do more complex things. This will save time, since the iterator does not
have to be created.
have to be created.
\par Example:
\par Example:
too insert integer a at begin of list and remove it directly.
too insert integer a at begin of list and remove it directly.
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
_intlist.insbegin(a)
_intlist.insbegin(a)
_intlist.removehead();
_intlist.removehead();
\endcode
\endcode
*/
*/
template
<
class
Dtype
>
template
<
class
Dtype
>
...
@@ -277,7 +277,7 @@ void DL_List<Dtype>::removehead()
...
@@ -277,7 +277,7 @@ void DL_List<Dtype>::removehead()
/*!
/*!
remove the object at the begin of the list (head).
remove the object at the begin of the list (head).
\note
\note
- The object itself is not deleted, only removed from the list.
- The object itself is not deleted, only removed from the list.
The user is responsible for memory management.
The user is responsible for memory management.
...
@@ -286,18 +286,18 @@ remove the object at the begin of the list (head).
...
@@ -286,18 +286,18 @@ remove the object at the begin of the list (head).
- The list must contain objects, else an error will be generated.
- The list must contain objects, else an error will be generated.
- Use this function if an iterator is not needed to do more complex things.
- Use this function if an iterator is not needed to do more complex things.
This will save time, since the iterator does not have to be created.
This will save time, since the iterator does not have to be created.
\par Example:
\par Example:
too insert integer a at end of list and remove it directly.
too insert integer a at end of list and remove it directly.
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
_intlist.insend(a)
_intlist.insend(a)
_intlist.removetail();
_intlist.removetail();
\endcode
\endcode
*/
*/
template
<
class
Dtype
>
template
<
class
Dtype
>
...
@@ -322,7 +322,7 @@ insert the object given at the end of the list, after tail
...
@@ -322,7 +322,7 @@ insert the object given at the end of the list, after tail
\note
\note
The iterator level must be zero to be able to use this function,
The iterator level must be zero to be able to use this function,
else an error will be generated
else an error will be generated
\note
\note
Use this function if an iterator is not needed to do more complex things.
Use this function if an iterator is not needed to do more complex things.
This will save time, since the iterator does not have to be created.
This will save time, since the iterator does not have to be created.
...
@@ -330,9 +330,9 @@ This will save time, since the iterator does not have to be created.
...
@@ -330,9 +330,9 @@ This will save time, since the iterator does not have to be created.
too insert integer a at end of list
too insert integer a at end of list
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
_intlist.insend(a)
_intlist.insend(a)
\endcode
\endcode
\param newitem an object for which the template list was generated
\param newitem an object for which the template list was generated
...
@@ -360,18 +360,18 @@ insert the object given at the begin of the list, before head
...
@@ -360,18 +360,18 @@ insert the object given at the begin of the list, before head
\note
\note
The iterator level must be zero to be able to use this function,
The iterator level must be zero to be able to use this function,
else an error will be generated
else an error will be generated
\note
\note
Use this function if an iterator is not needed to do more complex things.
Use this function if an iterator is not needed to do more complex things.
This will save time, since the iterator does not have to be created.
This will save time, since the iterator does not have to be created.
\par Example:
\par Example:
too insert integer a at begin of list
too insert integer a at begin of list
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
_intlist.insbegin(a)
_intlist.insbegin(a)
\endcode
\endcode
\param newitem an object for which the template list was generated
\param newitem an object for which the template list was generated
...
@@ -401,15 +401,15 @@ get head item
...
@@ -401,15 +401,15 @@ get head item
which is at head of list|
which is at head of list|
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
int b=345;
int b=345;
int c;
int c;
_intlist.insbegin(a)
_intlist.insbegin(a)
_intlist.insbegin(b)
_intlist.insbegin(b)
c=_intlist.headitem()
c=_intlist.headitem()
\endcode
\endcode
...
@@ -428,15 +428,15 @@ get tail item
...
@@ -428,15 +428,15 @@ get tail item
is at the tail of list
is at the tail of list
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
int b=345;
int b=345;
int c;
int c;
_intlist.insbegin(a)
_intlist.insbegin(a)
_intlist.insbegin(b)
_intlist.insbegin(b)
c=_intlist.headitem()
c=_intlist.headitem()
\endcode
\endcode
*/
*/
...
@@ -449,7 +449,7 @@ Dtype DL_List<Dtype>::tailitem()
...
@@ -449,7 +449,7 @@ Dtype DL_List<Dtype>::tailitem()
/*!
/*!
* \note
* \note
The iterator level must be zero to be able to use this function, else an error will be generated
The iterator level must be zero to be able to use this function, else an error will be generated
* \note The list may not be the same list as this list
* \note The list may not be the same list as this list
* \param otherlist the list to take the items from
* \param otherlist the list to take the items from
*/
*/
...
@@ -497,23 +497,23 @@ void DL_List<Dtype>::takeover( DL_List<Dtype>* otherlist )
...
@@ -497,23 +497,23 @@ void DL_List<Dtype>::takeover( DL_List<Dtype>* otherlist )
to insert integer a and b into list and remove_all directly using an iterator
to insert integer a and b into list and remove_all directly using an iterator
\code
\code
DL_List<int>* a_list = new DL_List<int>(); // declaration and allocation
DL_List<int>* a_list = new DL_List<int>(); // declaration and allocation
int a=123;
int a=123;
int b=345;
int b=345;
{
{
DL_Iter<int>* a_listiter=new DL_Iter<int>(a_list);
DL_Iter<int>* a_listiter=new DL_Iter<int>(a_list);
a_listiter->insbegin(a)
a_listiter->insbegin(a)
a_listiter->insbegin(b)
a_listiter->insbegin(b)
a_listiter->remove_all()
a_listiter->remove_all()
} //to destruct the iterator before the list is deleted
} //to destruct the iterator before the list is deleted
delete a_list; #delete it (must have no iterators attached to it)
delete a_list; #delete it (must have no iterators attached to it)
\endcode
\endcode
*/
*/
...
@@ -532,28 +532,28 @@ void DL_List<Dtype>::takeover( DL_List<Dtype>* otherlist )
...
@@ -532,28 +532,28 @@ void DL_List<Dtype>::takeover( DL_List<Dtype>* otherlist )
\param a_error: error code to generate a message for
\param a_error: error code to generate a message for
*/
*/
template
<
class
Dtype
>
template
<
class
Dtype
>
void
DL_Iter
<
Dtype
>::
Error
(
const
char
*
function
,
Lerror
a_error
)
void
DL_Iter
<
Dtype
>::
Error
(
string
function
,
Lerror
a_error
)
{
{
char
buf
[
100
]
;
string
buf
;
strcpy
(
buf
,
"DL_Iter<Dtype>::"
)
;
buf
=
"DL_Iter<Dtype>::"
;
strcat
(
buf
,
function
)
;
buf
+=
function
;
switch
(
a_error
)
switch
(
a_error
)
{
{
case
NO_MES
:
strcat
(
buf
,
""
)
;
break
;
case
NO_MES
:
buf
+=
""
;
break
;
case
NO_LIST
:
strcat
(
buf
,
"no list attached"
)
;
break
;
case
NO_LIST
:
buf
+=
"no list attached"
;
break
;
case
NO_LIST_OTHER
:
strcat
(
buf
,
"no list on other iter"
)
;
break
;
case
NO_LIST_OTHER
:
buf
+=
"no list on other iter"
;
break
;
case
AC_ITER_LIST_OTHER
:
strcat
(
buf
,
"iter not allowed on other list"
)
;
break
;
case
AC_ITER_LIST_OTHER
:
buf
+=
"iter not allowed on other list"
;
break
;
case
SAME_LIST
:
strcat
(
buf
,
"same list not allowed"
)
;
break
;
case
SAME_LIST
:
buf
+=
"same list not allowed"
;
break
;
case
NOT_SAME_LIST
:
strcat
(
buf
,
"must be same list"
)
;
break
;
case
NOT_SAME_LIST
:
buf
+=
"must be same list"
;
break
;
case
ITER_GT_1
:
strcat
(
buf
,
"more then one iter"
)
;
break
;
case
ITER_GT_1
:
buf
+=
"more then one iter"
;
break
;
case
ITER_HITROOT
:
strcat
(
buf
,
"iter at root"
)
;
break
;
case
ITER_HITROOT
:
buf
+=
"iter at root"
;
break
;
case
NO_ITEM
:
strcat
(
buf
,
"no item at current"
)
;
break
;
case
NO_ITEM
:
buf
+=
"no item at current"
;
break
;
case
NO_NEXT
:
strcat
(
buf
,
"no next after current"
)
;
break
;
case
NO_NEXT
:
buf
+=
"no next after current"
;
break
;
case
NO_PREV
:
strcat
(
buf
,
"no prev before current"
)
;
break
;
case
NO_PREV
:
buf
+=
"no prev before current"
;
break
;
case
EMPTY
:
strcat
(
buf
,
"list is empty"
)
;
break
;
case
EMPTY
:
buf
+=
"list is empty"
;
break
;
case
NOT_ALLOW
:
strcat
(
buf
,
"not allowed"
)
;
break
;
case
NOT_ALLOW
:
buf
+=
"not allowed"
;
break
;
case
ITER_NEG
:
strcat
(
buf
,
"to much iters deleted"
)
;
break
;
case
ITER_NEG
:
buf
+=
"to much iters deleted"
;
break
;
default
:
strcat
(
buf
,
"unhandled error"
)
;
break
;
default
:
buf
+=
"unhandled error"
;
break
;
}
}
throw
Bool_Engine_Error
(
buf
,
"list error"
,
0
,
1
);
throw
Bool_Engine_Error
(
buf
,
"list error"
,
0
,
1
);
}
}
...
@@ -585,11 +585,11 @@ tcarg: class | Dtype | list item object
...
@@ -585,11 +585,11 @@ tcarg: class | Dtype | list item object
How to construct a list of type integer and a second iterator for it:|
How to construct a list of type integer and a second iterator for it:|
\code
\code
DL_List<int>* IntegerList;
DL_List<int>* IntegerList;
IntegerList = new DL_List<int>();
IntegerList = new DL_List<int>();
DL_Iter<int>* a_listiter=new DL_Iter<int>(IntegerList);
DL_Iter<int>* a_listiter=new DL_Iter<int>(IntegerList);
DL_Iter<int>* a_secondlistiter=new DL_Iter<int>(a_listiter);
DL_Iter<int>* a_secondlistiter=new DL_Iter<int>(a_listiter);
\endcode
\endcode
\param otheriter other iterator on same list
\param otheriter other iterator on same list
...
@@ -610,21 +610,21 @@ Later on when a list is constructed,the iterator can be attached to it.
...
@@ -610,21 +610,21 @@ Later on when a list is constructed,the iterator can be attached to it.
This way an iterator to a specific list can be made static to a class, and can be used
This way an iterator to a specific list can be made static to a class, and can be used
for several lists at the same time. \n
for several lists at the same time. \n
tcarg: class | Dtype | list item object
tcarg: class | Dtype | list item object
\par Example
\par Example
How to construct an iterator, without having a list first.
How to construct an iterator, without having a list first.
This constructs an iterator for a list of the given type, but the list thus not yet exist.
This constructs an iterator for a list of the given type, but the list thus not yet exist.
\code
\code
DL_Iter<int>* a_iter=new DL_Iter<int>();
DL_Iter<int>* a_iter=new DL_Iter<int>();
DL_List<int>* IntegerList;
DL_List<int>* IntegerList;
IntegerList = new DL_List<int>();
IntegerList = new DL_List<int>();
a_iter.Attach(IntegerList);
a_iter.Attach(IntegerList);
a_iter.insend(123);
a_iter.insend(123);
a_iter.Detach();
a_iter.Detach();
\endcode
\endcode
*/
*/
...
@@ -655,15 +655,15 @@ static to a class, and can be used for several lists at the same time.\n
...
@@ -655,15 +655,15 @@ static to a class, and can be used for several lists at the same time.\n
How to construct an iterator, without having a list first, and attach an iterator later:|
How to construct an iterator, without having a list first, and attach an iterator later:|
\code
\code
DL_Iter<int>* a_iter=new DL_Iter<int>();
DL_Iter<int>* a_iter=new DL_Iter<int>();
DL_List<int>* IntegerList;
DL_List<int>* IntegerList;
IntegerList = new DL_List<int>();
IntegerList = new DL_List<int>();
a_iter.Attach(IntegerList);
a_iter.Attach(IntegerList);
a_iter.insend(123);
a_iter.insend(123);
a_iter.Detach();
a_iter.Detach();
\endcode
\endcode
\param newlist the list to attached the iterator to
\param newlist the list to attached the iterator to
...
@@ -687,15 +687,15 @@ and can be used for several lists at the same time. \n
...
@@ -687,15 +687,15 @@ and can be used for several lists at the same time. \n
How to construct an iterator, without having a list first, and attach an iterator later:
How to construct an iterator, without having a list first, and attach an iterator later:
\code
\code
DL_Iter<int>* a_iter=new DL_Iter<int>();
DL_Iter<int>* a_iter=new DL_Iter<int>();
DL_List<int>* IntegerList;
DL_List<int>* IntegerList;
IntegerList = new DL_List<int>();
IntegerList = new DL_List<int>();
a_iter.Attach(IntegerList);
a_iter.Attach(IntegerList);
a_iter.insend(123);
a_iter.insend(123);
a_iter.Detach();
a_iter.Detach();
\endcode
\endcode
\param newlist: the list to attached the iterator to
\param newlist: the list to attached the iterator to
...
@@ -755,22 +755,22 @@ to move all objects in a list to the list of the iterator.
...
@@ -755,22 +755,22 @@ to move all objects in a list to the list of the iterator.
\note
\note
The iterator level must be one to be able to use this function,
The iterator level must be one to be able to use this function,
else an error will be generated
else an error will be generated
\note
\note
The list may not be the same list as the iterator list
The list may not be the same list as the iterator list
\par Example
\par Example
to take over all items in _intlist|
to take over all items in _intlist|
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist2; #create a list of integers
DL_List<int> _intlist2; #create a list of integers
int a=123;
int a=123;
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist2);
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist2);
_intlist->insend(a) // insert at end
_intlist->insend(a) // insert at end
a_listiter2->takeover(_intlist)
a_listiter2->takeover(_intlist)
\endcode
\endcode
\param otherlist the list to take the items from
\param otherlist the list to take the items from
...
@@ -808,28 +808,28 @@ void DL_Iter<Dtype>::takeover( DL_List<Dtype>* otherlist )
...
@@ -808,28 +808,28 @@ void DL_Iter<Dtype>::takeover( DL_List<Dtype>* otherlist )
to move all objects in a list (using iterator of that list) to the list of the iterator.
to move all objects in a list (using iterator of that list) to the list of the iterator.
\note
\note
The iterator level for both iterators must be one to be able to use this function,
The iterator level for both iterators must be one to be able to use this function,
\note
\note
else an error will be generated
else an error will be generated
\note
\note
The list may not be the same list as the iterator list
The list may not be the same list as the iterator list
\par Example
\par Example
to take over all items in a_listiter1 it's list|
to take over all items in a_listiter1 it's list|
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist2; #create a list of integers
DL_List<int> _intlist2; #create a list of integers
int a=123;
int a=123;
DL_Iter<int>* a_listiter1=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter1=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist2);
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist2);
a_listiter1->insend(a) // insert at end
a_listiter1->insend(a) // insert at end
a_listiter2->takeover(a_listiter1)
a_listiter2->takeover(a_listiter1)
\\!to move all objects in a list (using iterator of that list) to the list of the iterator
\\!to move all objects in a list (using iterator of that list) to the list of the iterator
\endcode
\endcode
...
@@ -872,27 +872,27 @@ to move maxcount objects in a list (using iterator of that list)
...
@@ -872,27 +872,27 @@ to move maxcount objects in a list (using iterator of that list)
to the list of the iterator.
to the list of the iterator.
\note The iterator level for both iterators must be one to be able to use this function,
\note The iterator level for both iterators must be one to be able to use this function,
else an error will be generated
else an error will be generated
\note The list may not be the same list as the iterator list
\note The list may not be the same list as the iterator list
\note If less then maxcount objects are available in the source iterator,
\note If less then maxcount objects are available in the source iterator,
all of them are taken and no error will accur
all of them are taken and no error will accur
\par Example
\par Example
to take over 1 item from a_listiter1 it's list
to take over 1 item from a_listiter1 it's list
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist2; #create a list of integers
DL_List<int> _intlist2; #create a list of integers
int a=123;
int a=123;
DL_Iter<int>* a_listiter1=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter1=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist2);
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist2);
a_listiter1->insend(a) // insert at end
a_listiter1->insend(a) // insert at end
a_listiter2->takeover(a_listiter1,1);
a_listiter2->takeover(a_listiter1,1);
//! to move maxcount objects in a list (using iterator of that list) to the list of the iterator
//! to move maxcount objects in a list (using iterator of that list) to the list of the iterator
\endcode
\endcode
...
@@ -987,13 +987,13 @@ put the iterator root object before the current iterator position in the list.
...
@@ -987,13 +987,13 @@ put the iterator root object before the current iterator position in the list.
The current object will become the new head of the list.
The current object will become the new head of the list.
\note The iterator level must be one to be able to use this function,
\note The iterator level must be one to be able to use this function,
else an error will be generated
else an error will be generated
\par Example
\par Example
move the root object to make the new head the old tail object|
move the root object to make the new head the old tail object|
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->insend(2345);
a_listiter->insend(2345);
a_listiter->insend(3456);
a_listiter->insend(3456);
...
@@ -1036,7 +1036,7 @@ The current object will become the new tail of the list.
...
@@ -1036,7 +1036,7 @@ The current object will become the new tail of the list.
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->insend(2345);
a_listiter->insend(2345);
a_listiter->insend(3456);
a_listiter->insend(3456);
...
@@ -1076,7 +1076,7 @@ is list empty (contains items or not)?
...
@@ -1076,7 +1076,7 @@ is list empty (contains items or not)?
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
if (a_listiter->Empty())
if (a_listiter->Empty())
cout << "empty"
cout << "empty"
\endcode
\endcode
...
@@ -1100,7 +1100,7 @@ the end can be tested with this function.
...
@@ -1100,7 +1100,7 @@ the end can be tested with this function.
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->tohead();
a_listiter->tohead();
//traverse forwards
//traverse forwards
while ( ! a_listiter->hitroot())
while ( ! a_listiter->hitroot())
...
@@ -1108,7 +1108,7 @@ while ( ! a_listiter->hitroot())
...
@@ -1108,7 +1108,7 @@ while ( ! a_listiter->hitroot())
cout << "The item =" << a_listiter->item();
cout << "The item =" << a_listiter->item();
a_listiter++; //goto next object
a_listiter++; //goto next object
}
}
a_listiter->totail();
a_listiter->totail();
//traverse backwards
//traverse backwards
while ( ! a_listiter->hitroot())
while ( ! a_listiter->hitroot())
...
@@ -1135,7 +1135,7 @@ is the iterator at the head of the list.
...
@@ -1135,7 +1135,7 @@ is the iterator at the head of the list.
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->tohead();
a_listiter->tohead();
if (a_listiter->athead())
if (a_listiter->athead())
cout << "at the head The item =" << a_listiter->item();
cout << "at the head The item =" << a_listiter->item();
...
@@ -1159,7 +1159,7 @@ is the iterator at the tail of the list.
...
@@ -1159,7 +1159,7 @@ is the iterator at the tail of the list.
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->totail();
a_listiter->totail();
if (a_listiter->attail())
if (a_listiter->attail())
cout << "at the tail The item =" << a_listiter->item();
cout << "at the tail The item =" << a_listiter->item();
...
@@ -1183,7 +1183,7 @@ does the iterator/list contain the given object
...
@@ -1183,7 +1183,7 @@ does the iterator/list contain the given object
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
if (a_listiter->has(1234))
if (a_listiter->has(1234))
cout << "yes it does";
cout << "yes it does";
\endcode
\endcode
...
@@ -1233,7 +1233,7 @@ go to first item, if list is empty goto hite
...
@@ -1233,7 +1233,7 @@ go to first item, if list is empty goto hite
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->tohead();
a_listiter->tohead();
\endcode
\endcode
...
@@ -1254,7 +1254,7 @@ go to last item, if list is empty goto hite
...
@@ -1254,7 +1254,7 @@ go to last item, if list is empty goto hite
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->totail();
a_listiter->totail();
\endcode
\endcode
...
@@ -1275,7 +1275,7 @@ set the iterator position to the root (empty dummy) object in the list.
...
@@ -1275,7 +1275,7 @@ set the iterator position to the root (empty dummy) object in the list.
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->toroot();
a_listiter->toroot();
while (a_listiter->iterate())
while (a_listiter->iterate())
...
@@ -1298,7 +1298,7 @@ how to iterate backwards
...
@@ -1298,7 +1298,7 @@ how to iterate backwards
\code
\code
DL_List <int> _intlist; //create a list of integers
DL_List <int> _intlist; //create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->tohead();
a_listiter->tohead();
while (!a_listiter->hitroot())
while (!a_listiter->hitroot())
...
@@ -1324,7 +1324,7 @@ how to iterate backwards
...
@@ -1324,7 +1324,7 @@ how to iterate backwards
\code
\code
DL_List <int> _intlist; //create a list of integers
DL_List <int> _intlist; //create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->tohead();
a_listiter->tohead();
while (!a_listiter->hitroot())
while (!a_listiter->hitroot())
...
@@ -1351,7 +1351,7 @@ how to iterate backwards
...
@@ -1351,7 +1351,7 @@ how to iterate backwards
\code
\code
DL_List <int> _intlist; //create a list of integers
DL_List <int> _intlist; //create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->totail();
a_listiter->totail();
while (!a_listiter->hitroot())
while (!a_listiter->hitroot())
...
@@ -1378,7 +1378,7 @@ how to iterate backwards
...
@@ -1378,7 +1378,7 @@ how to iterate backwards
\code
\code
DL_List <int> _intlist; //create a list of integers
DL_List <int> _intlist; //create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->totail();
a_listiter->totail();
while (!a_listiter->hitroot())
while (!a_listiter->hitroot())
...
@@ -1454,11 +1454,11 @@ put the iterator at the position of the given object in the list.
...
@@ -1454,11 +1454,11 @@ put the iterator at the position of the given object in the list.
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->insend(2345);
a_listiter->insend(2345);
a_listiter->insend(3456);
a_listiter->insend(3456);
a_listiter->toitem(2345); template <class Dtype>
a_listiter->toitem(2345); template <class Dtype>
\endcode
\endcode
*/
*/
...
@@ -1488,7 +1488,7 @@ put the iterator at the same position as the given iterator in the list.
...
@@ -1488,7 +1488,7 @@ put the iterator at the same position as the given iterator in the list.
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->insend(2345);
a_listiter->insend(2345);
a_listiter->insend(3456);
a_listiter->insend(3456);
...
@@ -1535,27 +1535,27 @@ bool DL_Iter<Dtype>::tonode( DL_Node<Dtype> *othernode )
...
@@ -1535,27 +1535,27 @@ bool DL_Iter<Dtype>::tonode( DL_Node<Dtype> *othernode )
/*!
/*!
advance the iterator one position in the next direction in the list.
advance the iterator one position in the next direction in the list.
\return returns true if not at the end/root of the list else false.
\return returns true if not at the end/root of the list else false.
\note This function combines iteration and testing for the end of
\note This function combines iteration and testing for the end of
the list in one.
the list in one.
\note Therefore we do not have to advance the iterator ourselves.
\note Therefore we do not have to advance the iterator ourselves.
\note
\note
The iterator is first put to the next object, before testing for the end of the list. |
The iterator is first put to the next object, before testing for the end of the list. |
This is why we need to start at the root element in general usage.
This is why we need to start at the root element in general usage.
\par Example
\par Example
iterate through all the items in a list
iterate through all the items in a list
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->insend(2345);
a_listiter->insend(2345);
a_listiter->insend(3456);
a_listiter->insend(3456);
a_listiter->tobegin(2345);
a_listiter->tobegin(2345);
while (a_listiter->iterate())
while (a_listiter->iterate())
{ cout << a_listiter->item(); }
{ cout << a_listiter->item(); }
\endcode
\endcode
...
@@ -1583,7 +1583,7 @@ since there is no item there.
...
@@ -1583,7 +1583,7 @@ since there is no item there.
\code
\code
DL_List <int> _intlist; //create a list of integers
DL_List <int> _intlist; //create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->tohead();
a_listiter->tohead();
int theitem=a_listiter->item();
int theitem=a_listiter->item();
...
@@ -1634,11 +1634,11 @@ cycle the list twice
...
@@ -1634,11 +1634,11 @@ cycle the list twice
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->insend(2345);
a_listiter->insend(2345);
a_listiter->tohead();
a_listiter->tohead();
int count=2*a_listiter->count();
int count=2*a_listiter->count();
while (count)
while (count)
{
{
...
@@ -1681,11 +1681,11 @@ cycle the list twice
...
@@ -1681,11 +1681,11 @@ cycle the list twice
\code
\code
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(1234);
a_listiter->insend(1234);
a_listiter->insend(2345);
a_listiter->insend(2345);
a_listiter->totail();
a_listiter->totail();
int count=2*a_listiter->count();
int count=2*a_listiter->count();
while (count)
while (count)
{
{
...
@@ -1723,23 +1723,23 @@ void DL_Iter<Dtype>::remove_all()
...
@@ -1723,23 +1723,23 @@ void DL_Iter<Dtype>::remove_all()
/*!
/*!
remove object at current iterator position from the list.
remove object at current iterator position from the list.
\note The object itself is not deleted, only removed from the list. The user is responsible for memory management.
\note The object itself is not deleted, only removed from the list. The user is responsible for memory management.
\note The iterator level must be one to be able to use this function, else an error will be generated
\note The iterator level must be one to be able to use this function, else an error will be generated
\note The list must contain an object at the current iterator position, else an error will be generated.
\note The list must contain an object at the current iterator position, else an error will be generated.
\par Example:
\par Example:
to insert integer a at begin of list and remove it directly
to insert integer a at begin of list and remove it directly
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insbegin(a);
a_listiter->insbegin(a);
a_listiter->tohead();
a_listiter->tohead();
a_listiter->remove();
a_listiter->remove();
\endcode
\endcode
*/
*/
...
@@ -1767,21 +1767,21 @@ void DL_Iter<Dtype>::remove()
...
@@ -1767,21 +1767,21 @@ void DL_Iter<Dtype>::remove()
/*!
/*!
remove the object at the begin of the list using an iterator
remove the object at the begin of the list using an iterator
\note The object itself is not deleted, only removed from the list. The user is responsible for memory management.
\note The object itself is not deleted, only removed from the list. The user is responsible for memory management.
\note The iterator level must be one to be able to use this function, else an error will be generated
\note The iterator level must be one to be able to use this function, else an error will be generated
\note The list must contain objects, else an error will be generated.
\note The list must contain objects, else an error will be generated.
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
\par Example:
\par Example:
to insert integer a at begin of list and remove it directly|
to insert integer a at begin of list and remove it directly|
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insbegin(a);
a_listiter->insbegin(a);
a_listiter->removehead();
a_listiter->removehead();
\endcode
\endcode
...
@@ -1808,21 +1808,21 @@ void DL_Iter<Dtype>::removehead()
...
@@ -1808,21 +1808,21 @@ void DL_Iter<Dtype>::removehead()
/*!
/*!
//remove the object at the end of the list using an iterator
//remove the object at the end of the list using an iterator
\note The object itself is not deleted, only removed from the list. The user is responsible for memory management.
\note The object itself is not deleted, only removed from the list. The user is responsible for memory management.
\note The iterator level must be one to be able to use this function, else an error will be generated
\note The iterator level must be one to be able to use this function, else an error will be generated
\note The list must contain objects, else an error will be generated.
\note The list must contain objects, else an error will be generated.
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
\par Example:
\par Example:
to insert integer a at end of list and remove it directly
to insert integer a at end of list and remove it directly
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(a);
a_listiter->insend(a);
a_listiter->removetail();
a_listiter->removetail();
\endcode
\endcode
...
@@ -1848,19 +1848,19 @@ void DL_Iter<Dtype>::removetail()
...
@@ -1848,19 +1848,19 @@ void DL_Iter<Dtype>::removetail()
/*!
/*!
insert the object given at the end of the list
insert the object given at the end of the list
\note The iterator level must be one to be able to use this function, else an error will be generated
\note The iterator level must be one to be able to use this function, else an error will be generated
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
\par Example:
\par Example:
to insert integer a at end of list|
to insert integer a at end of list|
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(a);
a_listiter->insend(a);
\endcode
\endcode
*/
*/
...
@@ -1882,18 +1882,18 @@ DL_Node<Dtype>* DL_Iter<Dtype>::insend( Dtype newitem )
...
@@ -1882,18 +1882,18 @@ DL_Node<Dtype>* DL_Iter<Dtype>::insend( Dtype newitem )
/*!
/*!
insert the object given at the begin of the list
insert the object given at the begin of the list
\note The iterator level must be one to be able to use this function, else an error will be generated
\note The iterator level must be one to be able to use this function, else an error will be generated
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
\par Example:
\par Example:
to insert integer a at begin of list|
to insert integer a at begin of list|
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insbegin(a);
a_listiter->insbegin(a);
\endcode
\endcode
\param newitem an object for which the template list/iterator was generated
\param newitem an object for which the template list/iterator was generated
...
@@ -1919,9 +1919,9 @@ DL_Node<Dtype>* DL_Iter<Dtype>::insbegin( Dtype newitem )
...
@@ -1919,9 +1919,9 @@ DL_Node<Dtype>* DL_Iter<Dtype>::insbegin( Dtype newitem )
to insert integer before the iterator position in the list|
to insert integer before the iterator position in the list|
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->totail();
a_listiter->totail();
a_listiter->insbefore(a); // insert before tail
a_listiter->insbefore(a); // insert before tail
...
@@ -1954,9 +1954,9 @@ insert the object given after the current position of the iterator in list
...
@@ -1954,9 +1954,9 @@ insert the object given after the current position of the iterator in list
\par Example: to insert integer after the iterator position in the list|
\par Example: to insert integer after the iterator position in the list|
\code
\code
DL_List<int> _intlist; #create a list of integers
DL_List<int> _intlist; #create a list of integers
int a=123;
int a=123;
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->tohead();
a_listiter->tohead();
a_listiter->insafter(a); // insert after head
a_listiter->insafter(a); // insert after head
...
@@ -1986,30 +1986,30 @@ DL_Node<Dtype>* DL_Iter<Dtype>::insafter( Dtype newitem )
...
@@ -1986,30 +1986,30 @@ DL_Node<Dtype>* DL_Iter<Dtype>::insafter( Dtype newitem )
sort all items in the list according to the compare function.
sort all items in the list according to the compare function.
when items need to be swapped to reach the right order the swap function will be called also.
when items need to be swapped to reach the right order the swap function will be called also.
\note There are no restrictions on the internal decision in the compare function when to return -1,0,1.
\note There are no restrictions on the internal decision in the compare function when to return -1,0,1.
\note The swap function can be used to change items when they are swapped.
\note The swap function can be used to change items when they are swapped.
fcmp (function, fcmp)
fcmp (function, fcmp)
\verbatim
\verbatim
Declaration: int (*fcmp) (Dtype,Dtype)
Declaration: int (*fcmp) (Dtype,Dtype)
compare function pointer, the function takes two objects in the list. It must return -1, 0, 1, to sort the list in upgoing
compare function pointer, the function takes two objects in the list. It must return -1, 0, 1, to sort the list in upgoing
order the function should return:
order the function should return:
-1 is returned if the first object is bigger then the second.
-1 is returned if the first object is bigger then the second.
0 is returned if the objects are equal.
0 is returned if the objects are equal.
1 is returned if the first object is smaller then the second.
1 is returned if the first object is smaller then the second.
To sort the list in downgoing order:
To sort the list in downgoing order:
1 is returned if the first object is bigger then the second.
1 is returned if the first object is bigger then the second.
0 is returned if the objects are equal.
0 is returned if the objects are equal.
-1 is returned if the first object is smaller then the second.
-1 is returned if the first object is smaller then the second.
fswap (function, fswap)
fswap (function, fswap)
Declaration: void (*fswap) (Dtype,Dtype)
Declaration: void (*fswap) (Dtype,Dtype)
swap function pointer, the function takes two objects in the list. It will be called when the objects are swapped to
swap function pointer, the function takes two objects in the list. It will be called when the objects are swapped to
reach the right order. If it is NULL, it will not be called.
reach the right order. If it is NULL, it will not be called.
\endverbatim
\endverbatim
...
@@ -2022,10 +2022,10 @@ int numbersorter(int a,int b)
...
@@ -2022,10 +2022,10 @@ int numbersorter(int a,int b)
if(a == b) return(0);
if(a == b) return(0);
return(-1);
return(-1);
}
}
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(2345);
a_listiter->insend(2345);
a_listiter->insend(3456);
a_listiter->insend(3456);
a_listiter->insend(1234);
a_listiter->insend(1234);
...
@@ -2110,34 +2110,34 @@ int DL_Iter<Dtype>::cocktailsort( int ( *fcmp ) ( Dtype, Dtype ), bool ( *fswap
...
@@ -2110,34 +2110,34 @@ int DL_Iter<Dtype>::cocktailsort( int ( *fcmp ) ( Dtype, Dtype ), bool ( *fswap
/*!
/*!
sort all items in the list according to the compare function.
sort all items in the list according to the compare function.
\note
\note
There are no restrictions on the internal decision in the compare function when to return -1,0,1.
There are no restrictions on the internal decision in the compare function when to return -1,0,1.
\note
\note
For the mergesort function the objects will be swapped when the return value is -1.
For the mergesort function the objects will be swapped when the return value is -1.
\note
\note
\verbatim
\verbatim
fcmp (function, fcmp)
fcmp (function, fcmp)
Declaration: int (*fcmp) (Dtype,Dtype)
Declaration: int (*fcmp) (Dtype,Dtype)
compare function pointer, the function takes two objects in the list. It must return -1, 0, 1, to sort the list in upgoing
compare function pointer, the function takes two objects in the list. It must return -1, 0, 1, to sort the list in upgoing
order the function should return:
order the function should return:
-1 is returned if the first object is bigger then the second.
-1 is returned if the first object is bigger then the second.
0 is returned if the objects are equal.
0 is returned if the objects are equal.
1 is returned if the first object is smaller then the second.
1 is returned if the first object is smaller then the second.
To sort the list in downgoing order:
To sort the list in downgoing order:
1 is returned if the first object is bigger then the second.
1 is returned if the first object is bigger then the second.
0 is returned if the objects are equal.
0 is returned if the objects are equal.
-1 is returned if the first object is smaller then the second.
-1 is returned if the first object is smaller then the second.
\endverbatim
\endverbatim
!tcarg: class | Dtype | list item object
!tcarg: class | Dtype | list item object
\par example
\par example
sort the list in upgoing order using mergesort and the function numbersorter|
sort the list in upgoing order using mergesort and the function numbersorter|
...
@@ -2149,10 +2149,10 @@ int numbersorter(int a,int b)
...
@@ -2149,10 +2149,10 @@ int numbersorter(int a,int b)
if(a == b) return(0);
if(a == b) return(0);
return(-1);
return(-1);
}
}
DL_List <int> _intlist; #create a list of integers
DL_List <int> _intlist; #create a list of integers
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
a_listiter->insend(2345);
a_listiter->insend(2345);
a_listiter->insend(3456);
a_listiter->insend(3456);
a_listiter->insend(1234);
a_listiter->insend(1234);
...
...
polygon/kbool/include/kbool/_dl_itr.h
View file @
ef2e41e3
/*! \file kbool/include/kbool/_dl_itr.h
/*! \file kbool/include/kbool/_dl_itr.h
\author
Probably Klaas Holwerda
\author
Klaas Holwerda
Copyright: 2001-2004 (C)
Probably
Klaas Holwerda
Copyright: 2001-2004 (C) Klaas Holwerda
Licence:
wxWidgets Licence
Licence:
see kboollicense.txt
RCS-ID: $Id: _dl_itr.h,v 1.
3 2008/06/04 21:23:21
titato Exp $
RCS-ID: $Id: _dl_itr.h,v 1.
5 2009/04/23 19:35:24
titato Exp $
*/
*/
//! author="Klaas Holwerda"
//! author="Klaas Holwerda"
...
@@ -22,7 +22,9 @@
...
@@ -22,7 +22,9 @@
#include "kbool/booleng.h"
#include "kbool/booleng.h"
#include <stdlib.h>
#include <stdlib.h>
#include <string>
using
namespace
std
;
#ifndef _STATUS_ENUM
#ifndef _STATUS_ENUM
#define _STATUS_ENUM
#define _STATUS_ENUM
...
@@ -103,7 +105,7 @@ public:
...
@@ -103,7 +105,7 @@ public:
~
DL_List
();
~
DL_List
();
//!Report off List Errors
//!Report off List Errors
void
Error
(
const
char
*
function
,
Lerror
a_error
);
void
Error
(
string
function
,
Lerror
a_error
);
//!Number of items in the list
//!Number of items in the list
int
count
();
int
count
();
...
@@ -168,7 +170,7 @@ public:
...
@@ -168,7 +170,7 @@ public:
~
DL_Iter
();
~
DL_Iter
();
//!Report off Iterator Errors
//!Report off Iterator Errors
void
Error
(
const
char
*
function
,
Lerror
a_error
);
void
Error
(
string
function
,
Lerror
a_error
);
//!This attaches an iterator to a list of a given type.
//!This attaches an iterator to a list of a given type.
void
Attach
(
DL_List
<
Dtype
>*
newlist
);
void
Attach
(
DL_List
<
Dtype
>*
newlist
);
...
...
polygon/kbool/include/kbool/_lnk_itr.cpp
View file @
ef2e41e3
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence:
wxWidgets Licence
Licence:
see kboollicense.txt
RCS-ID: $Id: _lnk_itr.cpp,v 1.
3 2006/12/13 21:43:3
3 titato Exp $
RCS-ID: $Id: _lnk_itr.cpp,v 1.
4 2009/02/06 21:33:0
3 titato Exp $
*/
*/
#ifdef __UNIX__
#ifdef __UNIX__
...
...
polygon/kbool/include/kbool/_lnk_itr.h
View file @
ef2e41e3
/*! \file kbool/include/kbool/_lnk_itr.h
/*! \file kbool/include/kbool/_lnk_itr.h
\author
Probably
Klaas Holwerda
\author Klaas Holwerda
Copyright: 2001-2004 (C)
Probably
Klaas Holwerda
Copyright: 2001-2004 (C) Klaas Holwerda
Licence:
wxWidgets Licence
Licence:
see kboollicense.txt
RCS-ID: $Id: _lnk_itr.h,v 1.
2 2006/12/15 21:00:05
titato Exp $
RCS-ID: $Id: _lnk_itr.h,v 1.
3 2009/02/06 21:33:03
titato Exp $
*/
*/
//! author="Klaas Holwerda"
//! author="Klaas Holwerda"
...
...
polygon/kbool/include/kbool/booleng.h
View file @
ef2e41e3
/*! \file include/booleng.h
/*! \file include/booleng.h
\author Klaas Holwerda
\author Klaas Holwerda
Copyright: 2001-2004 (C) Klaas Holwerda
Copyright: 2001-2004 (C) Klaas Holwerda
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: booleng.h,v 1.
4 2008/09/05 19:01:14
titato Exp $
RCS-ID: $Id: booleng.h,v 1.
6 2009/09/07 19:23:28
titato Exp $
*/
*/
#ifndef BOOLENG_H
#ifndef BOOLENG_H
...
@@ -19,9 +19,13 @@
...
@@ -19,9 +19,13 @@
#include <limits.h>
#include <limits.h>
#include <assert.h>
#include <assert.h>
#include <math.h>
#include <math.h>
#include <string>
using
namespace
std
;
#if 0 // Kicad does not use kbool in dll version
#if 0 // Kicad does not use kbool in dll version
#if defined(__WXMSW__)
#if defined(__WXMSW__)
/*
/*
__declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well
__declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well
...
@@ -58,6 +62,7 @@
...
@@ -58,6 +62,7 @@
# define WXEXPORT __declspec(dllexport)
# define WXEXPORT __declspec(dllexport)
# define WXIMPORT __declspec(dllimport)
# define WXIMPORT __declspec(dllimport)
#endif
#endif
#endif // if 0 for kicad
#endif // if 0 for kicad
/* for other platforms/compilers we don't anything */
/* for other platforms/compilers we don't anything */
...
@@ -80,13 +85,13 @@
...
@@ -80,13 +85,13 @@
#define A2DKBOOLDLLEXP_CTORFN
#define A2DKBOOLDLLEXP_CTORFN
#endif
#endif
#define KBOOL_VERSION "
1.9
"
#define KBOOL_VERSION "
2.0
"
#define KBOOL_DEBUG 0
#define KBOOL_DEBUG 0
#define KBOOL_LOG 0
#define KBOOL_LOG 0
#define KBOOL_INT64 1
#define KBOOL_INT64 1
class
KBool
Link
;
class
kb
Link
;
#define LINELENGTH 200
#define LINELENGTH 200
...
@@ -163,17 +168,17 @@ B_INT bmax( B_INT value1, B_INT value2 );
...
@@ -163,17 +168,17 @@ B_INT bmax( B_INT value1, B_INT value2 );
class
A2DKBOOLDLLEXP
Bool_Engine_Error
class
A2DKBOOLDLLEXP
Bool_Engine_Error
{
{
public
:
public
:
Bool_Engine_Error
(
const
char
*
message
,
const
char
*
header
=
0
,
int
degree
=
9
,
int
fatal
=
0
);
Bool_Engine_Error
(
string
message
,
string
header
=
0
,
int
degree
=
9
,
int
fatal
=
0
);
Bool_Engine_Error
(
const
Bool_Engine_Error
&
a
);
Bool_Engine_Error
(
const
Bool_Engine_Error
&
a
);
~
Bool_Engine_Error
();
~
Bool_Engine_Error
();
char
*
GetErrorMessage
();
string
GetErrorMessage
();
char
*
GetHeaderMessage
();
string
GetHeaderMessage
();
int
GetErrorDegree
();
int
GetErrorDegree
();
int
GetFatal
();
int
GetFatal
();
protected
:
protected
:
char
*
_message
;
string
_message
;
char
*
_header
;
string
_header
;
int
_degree
;
int
_degree
;
int
_fatal
;
int
_fatal
;
};
};
...
@@ -207,10 +212,10 @@ enum BOOL_OP
...
@@ -207,10 +212,10 @@ enum BOOL_OP
BOOL_MAKERING
/*!< create a ring on all polygons */
BOOL_MAKERING
/*!< create a ring on all polygons */
};
};
class
GraphList
;
class
kb
GraphList
;
class
Graph
;
class
kb
Graph
;
class
KBool
Link
;
class
kb
Link
;
class
Node
;
class
kb
Node
;
template
<
class
Type
>
class
TDLI
;
template
<
class
Type
>
class
TDLI
;
//! boolean engine to perform operation on two sets of polygons.
//! boolean engine to perform operation on two sets of polygons.
...
@@ -220,7 +225,7 @@ template<class Type> class TDLI;
...
@@ -220,7 +225,7 @@ template<class Type> class TDLI;
The boolean operation ( BOOL_OR, BOOL_AND, BOOL_EXOR, BOOL_A_SUB_B, BOOL_B_SUB_A )
The boolean operation ( BOOL_OR, BOOL_AND, BOOL_EXOR, BOOL_A_SUB_B, BOOL_B_SUB_A )
are based on the two sets of polygons in group A and B.
are based on the two sets of polygons in group A and B.
The other operation on group A only.
The other operation on group A only.
At the end of the operation the resulting polygons can be extracted.
At the end of the operation the resulting polygons can be extracted.
*/
*/
class
A2DKBOOLDLLEXP
Bool_Engine
class
A2DKBOOLDLLEXP
Bool_Engine
...
@@ -234,16 +239,16 @@ public:
...
@@ -234,16 +239,16 @@ public:
//! destructor
//! destructor
virtual
~
Bool_Engine
();
virtual
~
Bool_Engine
();
const
char
*
GetVersion
()
{
return
KBOOL_VERSION
;
}
string
GetVersion
()
{
return
KBOOL_VERSION
;
}
//! reports progress of algorithm.
//! reports progress of algorithm.
virtual
void
SetState
(
const
char
*
=
0
);
virtual
void
SetState
(
string
);
//! called at an internal error.
//! called at an internal error.
virtual
void
error
(
const
char
*
text
,
const
char
*
title
);
virtual
void
error
(
string
text
,
string
title
);
//! called at an internal generated possible error.
//! called at an internal generated possible error.
virtual
void
info
(
const
char
*
text
,
const
char
*
title
);
virtual
void
info
(
string
text
,
string
title
);
bool
Do_Operation
(
BOOL_OP
operation
);
bool
Do_Operation
(
BOOL_OP
operation
);
...
@@ -252,7 +257,7 @@ public:
...
@@ -252,7 +257,7 @@ public:
/*
/*
The algorithm takes into account gaps and inaccuracies caused by rounding to integer coordinates
The algorithm takes into account gaps and inaccuracies caused by rounding to integer coordinates
in the original data.
in the original data.
Imagine two rectangles one with a side ( 0,0 ) ( 2.0, 17.0 )
Imagine two rectangles one with a side ( 0,0 ) ( 2.0, 17.0 )
and the other has a side ( 0,0 ) ( 1.0, 8.5 )
and the other has a side ( 0,0 ) ( 1.0, 8.5 )
If for some reason those coordinates where round to ( 0,0 ) ( 2, 17 ) ( 0,0 ) ( 1, 9 ),
If for some reason those coordinates where round to ( 0,0 ) ( 2, 17 ) ( 0,0 ) ( 1, 9 ),
there will be clearly a gap or overlap that was not intended.
there will be clearly a gap or overlap that was not intended.
...
@@ -275,8 +280,8 @@ public:
...
@@ -275,8 +280,8 @@ public:
Grid makes sure that the integer data used within the algorithm has room for extra intersections
Grid makes sure that the integer data used within the algorithm has room for extra intersections
smaller than the smallest number within the input data.
smaller than the smallest number within the input data.
The input data scaled up with DGrid is related to the accuracy the user has in his input data.
The input data scaled up with DGrid is related to the accuracy the user has in his input data.
Another scaling with Grid is applied on top of it to create space in the integer number for
Another scaling with Grid is applied on top of it to create space in the integer number for
even smaller numbers.
even smaller numbers.
*/
*/
void
SetGrid
(
B_INT
grid
);
void
SetGrid
(
B_INT
grid
);
...
@@ -294,7 +299,7 @@ public:
...
@@ -294,7 +299,7 @@ public:
doubles, part of the integers used in vertexes within the boolean algorithm.
doubles, part of the integers used in vertexes within the boolean algorithm.
And therefore DGRID bigger than 1 is not usefull, you would only loose accuracy.
And therefore DGRID bigger than 1 is not usefull, you would only loose accuracy.
Within the algorithm all input data is multiplied with DGRID, and the result
Within the algorithm all input data is multiplied with DGRID, and the result
is rounded to an integer.
is rounded to an integer.
*/
*/
void
SetDGrid
(
double
dgrid
);
void
SetDGrid
(
double
dgrid
);
...
@@ -405,7 +410,7 @@ public:
...
@@ -405,7 +410,7 @@ public:
//! if set true holes are linked into outer contours by double overlapping segments.
//! if set true holes are linked into outer contours by double overlapping segments.
/*!
/*!
This mode is needed when the software using the boolean algorithm does
This mode is needed when the software using the boolean algorithm does
not understand hole polygons. In that case a contour and its holes form one
not understand hole polygons. In that case a contour and its holes form one
polygon. In cases where software understands the concept of holes, contours
polygon. In cases where software understands the concept of holes, contours
are clockwise oriented, while holes are anticlockwise oriented.
are clockwise oriented, while holes are anticlockwise oriented.
...
@@ -422,13 +427,13 @@ public:
...
@@ -422,13 +427,13 @@ public:
void
SetLog
(
bool
OnOff
);
void
SetLog
(
bool
OnOff
);
//! used to write to log file
//! used to write to log file
void
Write_Log
(
const
char
*
);
void
Write_Log
(
string
);
//! used to write to log file
//! used to write to log file
void
Write_Log
(
const
char
*
,
const
char
*
);
void
Write_Log
(
string
,
string
);
//! used to write to log file
//! used to write to log file
void
Write_Log
(
const
char
*
,
double
);
void
Write_Log
(
string
,
double
);
//! used to write to log file
//! used to write to log file
void
Write_Log
(
const
char
*
,
B_INT
);
void
Write_Log
(
string
,
B_INT
);
FILE
*
GetLogFile
()
{
return
m_logfile
;
}
FILE
*
GetLogFile
()
{
return
m_logfile
;
}
...
@@ -445,11 +450,11 @@ public:
...
@@ -445,11 +450,11 @@ public:
if (booleng->StartPolygonAdd(GROUP_A))
if (booleng->StartPolygonAdd(GROUP_A))
{
{
booleng->AddPoint(100,100);
booleng->AddPoint(100,100);
booleng->AddPoint(-100,100);
booleng->AddPoint(-100,100);
booleng->AddPoint(-100,-100);
booleng->AddPoint(-100,-100);
booleng->AddPoint(100,-100);
booleng->AddPoint(100,-100);
}
}
booleng->EndPolygonAdd();
booleng->EndPolygonAdd();
\param A_or_B defines if the new polygon will be of group A or B
\param A_or_B defines if the new polygon will be of group A or B
...
@@ -457,7 +462,7 @@ public:
...
@@ -457,7 +462,7 @@ public:
to another polygon added.
to another polygon added.
So the contour polygon ClockWise, then add counterclockwise polygons for holes, and visa versa.
So the contour polygon ClockWise, then add counterclockwise polygons for holes, and visa versa.
BUT only if m_orientationEntryMode is set true, else all polygons are redirected, and become
BUT only if m_orientationEntryMode is set true, else all polygons are redirected, and become
individual areas without holes.
individual areas without holes.
Holes in such a case must be linked into the contour using two extra segments.
Holes in such a case must be linked into the contour using two extra segments.
*/
*/
bool
StartPolygonAdd
(
GroupType
A_or_B
);
bool
StartPolygonAdd
(
GroupType
A_or_B
);
...
@@ -492,8 +497,8 @@ public:
...
@@ -492,8 +497,8 @@ public:
//! see StartPolygonGet
//! see StartPolygonGet
/*!
/*!
This iterates through the first graph in the graphlist.
This iterates through the first graph in the graphlist.
Setting the current Node properly by following the links in the graph
Setting the current
kb
Node properly by following the links in the graph
through its nodes.
through its nodes.
*/
*/
bool
PolygonHasMorePoints
();
bool
PolygonHasMorePoints
();
...
@@ -526,7 +531,7 @@ private:
...
@@ -526,7 +531,7 @@ private:
bool
m_doLog
;
bool
m_doLog
;
//! contains polygons in graph form
//! contains polygons in graph form
GraphList
*
m_graphlist
;
kb
GraphList
*
m_graphlist
;
double
m_MARGE
;
double
m_MARGE
;
B_INT
m_GRID
;
B_INT
m_GRID
;
...
@@ -544,21 +549,21 @@ private:
...
@@ -544,21 +549,21 @@ private:
bool
m_doLinkHoles
;
bool
m_doLinkHoles
;
//! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence
//! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence
Graph
*
m_GraphToAdd
;
kb
Graph
*
m_GraphToAdd
;
//! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence
//! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence
Node
*
m_lastNodeToAdd
;
kb
Node
*
m_lastNodeToAdd
;
//! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence
//! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence
Node
*
m_firstNodeToAdd
;
kb
Node
*
m_firstNodeToAdd
;
//! the current group type ( group A or B )
//! the current group type ( group A or B )
GroupType
m_groupType
;
GroupType
m_groupType
;
//! used in extracting the points from the resultant polygons
//! used in extracting the points from the resultant polygons
Graph
*
m_getGraph
;
kb
Graph
*
m_getGraph
;
//! used in extracting the points from the resultant polygons
//! used in extracting the points from the resultant polygons
KBool
Link
*
m_getLink
;
kb
Link
*
m_getLink
;
//! used in extracting the points from the resultant polygons
//! used in extracting the points from the resultant polygons
Node
*
m_getNode
;
kb
Node
*
m_getNode
;
//! used in extracting the points from the resultant polygons
//! used in extracting the points from the resultant polygons
double
m_PolygonXPoint
;
double
m_PolygonXPoint
;
//! used in extracting the points from the resultant polygons
//! used in extracting the points from the resultant polygons
...
@@ -572,8 +577,8 @@ private:
...
@@ -572,8 +577,8 @@ private:
public
:
public
:
//! use in Node to iterate links.
//! use in
kb
Node to iterate links.
TDLI
<
KBool
Link
>*
_linkiter
;
TDLI
<
kb
Link
>*
_linkiter
;
//! how many time run intersections fase.
//! how many time run intersections fase.
unsigned
int
m_intersectionruns
;
unsigned
int
m_intersectionruns
;
...
...
polygon/kbool/include/kbool/graph.h
View file @
ef2e41e3
...
@@ -5,10 +5,10 @@
...
@@ -5,10 +5,10 @@
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: graph.h,v 1.
3 2008/06/04 21:23:21
titato Exp $
RCS-ID: $Id: graph.h,v 1.
4 2009/09/07 19:23:28
titato Exp $
*/
*/
/* @@(#) $Source: /cvsroot/wxart2d/wxArt2D/thirdparty/kbool/include/kbool/graph.h,v $ $Revision: 1.
3 $ $Date: 2008/06/04 21:23:21
$ */
/* @@(#) $Source: /cvsroot/wxart2d/wxArt2D/thirdparty/kbool/include/kbool/graph.h,v $ $Revision: 1.
4 $ $Date: 2009/09/07 19:23:28
$ */
/*
/*
Program GRAPH.H
Program GRAPH.H
...
@@ -25,23 +25,23 @@ Last Update 03-04-1996
...
@@ -25,23 +25,23 @@ Last Update 03-04-1996
#include "kbool/line.h"
#include "kbool/line.h"
#include "kbool/scanbeam.h"
#include "kbool/scanbeam.h"
class
Node
;
class
kb
Node
;
class
GraphList
;
class
kb
GraphList
;
//! one graph containing links that cab be connected.
//! one graph containing links that cab be connected.
class
A2DKBOOLDLLEXP
Graph
class
A2DKBOOLDLLEXP
kb
Graph
{
{
protected
:
protected
:
Bool_Engine
*
_GC
;
Bool_Engine
*
_GC
;
public
:
public
:
Graph
(
Bool_Engine
*
GC
);
kb
Graph
(
Bool_Engine
*
GC
);
Graph
(
KBool
Link
*
,
Bool_Engine
*
GC
);
kbGraph
(
kb
Link
*
,
Bool_Engine
*
GC
);
Graph
(
Graph
*
other
);
kbGraph
(
kb
Graph
*
other
);
~
Graph
();
~
kb
Graph
();
bool
GetBin
()
{
return
_bin
;
};
bool
GetBin
()
{
return
_bin
;
};
void
SetBin
(
bool
b
)
{
_bin
=
b
;
};
void
SetBin
(
bool
b
)
{
_bin
=
b
;
};
...
@@ -51,10 +51,10 @@ public:
...
@@ -51,10 +51,10 @@ public:
void
Rotate
(
bool
plus90
);
void
Rotate
(
bool
plus90
);
//! adds a link to the linklist
//! adds a link to the linklist
void
AddLink
(
Node
*
begin
,
Node
*
end
);
void
AddLink
(
kbNode
*
begin
,
kb
Node
*
end
);
//! adds a link to the linklist
//! adds a link to the linklist
void
AddLink
(
KBool
Link
*
a_link
);
void
AddLink
(
kb
Link
*
a_link
);
bool
AreZeroLines
(
B_INT
Marge
);
bool
AreZeroLines
(
B_INT
Marge
);
...
@@ -79,42 +79,42 @@ public:
...
@@ -79,42 +79,42 @@ public:
// Remove unused links
// Remove unused links
void
ReverseAllLinks
();
void
ReverseAllLinks
();
//! Simplify the
g
raph
//! Simplify the
kbG
raph
bool
Simplify
(
B_INT
Marge
);
bool
Simplify
(
B_INT
Marge
);
//! Takes over all links of the argument
//! Takes over all links of the argument
bool
Smoothen
(
B_INT
Marge
);
bool
Smoothen
(
B_INT
Marge
);
void
TakeOver
(
Graph
*
);
void
TakeOver
(
kb
Graph
*
);
//! function for maximum performance
//! function for maximum performance
//! Get the First link from the
g
raph
//! Get the First link from the
kbG
raph
KBool
Link
*
GetFirstLink
();
kb
Link
*
GetFirstLink
();
Node
*
GetTopNode
();
kb
Node
*
GetTopNode
();
void
SetBeenHere
(
bool
);
void
SetBeenHere
(
bool
);
void
Reset_flags
();
void
Reset_flags
();
//! Set the group of a
g
raph
//! Set the group of a
kbG
raph
void
SetGroup
(
GroupType
);
void
SetGroup
(
GroupType
);
//! Set the number of the
g
raph
//! Set the number of the
kbG
raph
void
SetNumber
(
int
);
void
SetNumber
(
int
);
void
Reset_Mark_and_Bin
();
void
Reset_Mark_and_Bin
();
bool
GetBeenHere
();
bool
GetBeenHere
();
int
GetGraphNum
();
int
GetGraphNum
();
int
GetNumberOfLinks
();
int
GetNumberOfLinks
();
void
Boolean
(
BOOL_OP
operation
,
GraphList
*
Result
);
void
Boolean
(
BOOL_OP
operation
,
kb
GraphList
*
Result
);
void
Correction
(
GraphList
*
Result
,
double
factor
);
void
Correction
(
kb
GraphList
*
Result
,
double
factor
);
void
MakeRing
(
GraphList
*
Result
,
double
factor
);
void
MakeRing
(
kb
GraphList
*
Result
,
double
factor
);
void
CreateRing
(
GraphList
*
ring
,
double
factor
);
void
CreateRing
(
kb
GraphList
*
ring
,
double
factor
);
void
CreateRing_fast
(
GraphList
*
ring
,
double
factor
);
void
CreateRing_fast
(
kb
GraphList
*
ring
,
double
factor
);
void
CreateArc
(
Node
*
center
,
KBoolLine
*
incoming
,
Node
*
end
,
double
radius
,
double
aber
);
void
CreateArc
(
kbNode
*
center
,
kbLine
*
incoming
,
kb
Node
*
end
,
double
radius
,
double
aber
);
void
CreateArc
(
Node
*
center
,
Node
*
begin
,
Node
*
end
,
double
radius
,
bool
clock
,
double
aber
);
void
CreateArc
(
kbNode
*
center
,
kbNode
*
begin
,
kb
Node
*
end
,
double
radius
,
bool
clock
,
double
aber
);
void
MakeOneDirection
();
void
MakeOneDirection
();
void
Make_Rounded_Shape
(
KBool
Link
*
a_link
,
double
factor
);
void
Make_Rounded_Shape
(
kb
Link
*
a_link
,
double
factor
);
bool
MakeClockWise
();
bool
MakeClockWise
();
bool
writegraph
(
bool
linked
);
bool
writegraph
(
bool
linked
);
bool
writeintersections
();
bool
writeintersections
();
...
@@ -137,7 +137,7 @@ protected:
...
@@ -137,7 +137,7 @@ protected:
void
Extract_Simples
(
BOOL_OP
operation
,
bool
detecthole
,
bool
&
foundholes
);
void
Extract_Simples
(
BOOL_OP
operation
,
bool
detecthole
,
bool
&
foundholes
);
//! split graph into small graph, using the numbers in links.
//! split graph into small graph, using the numbers in links.
void
Split
(
GraphList
*
partlist
);
void
Split
(
kb
GraphList
*
partlist
);
//! Collect a graph by starting at argument link
//! Collect a graph by starting at argument link
/*
/*
...
@@ -150,16 +150,16 @@ protected:
...
@@ -150,16 +150,16 @@ protected:
\param graphnumber number to be given to links in the extracted graph piece
\param graphnumber number to be given to links in the extracted graph piece
\param foundholes when holes are found this flag is set true.
\param foundholes when holes are found this flag is set true.
*/
*/
void
CollectGraph
(
Node
*
current_node
,
BOOL_OP
operation
,
bool
detecthole
,
int
graphnumber
,
bool
&
foundholes
);
void
CollectGraph
(
kb
Node
*
current_node
,
BOOL_OP
operation
,
bool
detecthole
,
int
graphnumber
,
bool
&
foundholes
);
void
CollectGraphLast
(
Node
*
current_node
,
BOOL_OP
operation
,
bool
detecthole
,
int
graphnumber
,
bool
&
foundholes
);
void
CollectGraphLast
(
kb
Node
*
current_node
,
BOOL_OP
operation
,
bool
detecthole
,
int
graphnumber
,
bool
&
foundholes
);
//! find a link not bin in the top left corner ( links should be sorted already )
//! find a link not bin in the top left corner ( links should be sorted already )
/*!
/*!
Last found position is used to find it quickly.
Last found position is used to find it quickly.
Used in ExtractSimples()
Used in ExtractSimples()
*/
*/
Node
*
GetMostTopLeft
(
TDLI
<
KBool
Link
>*
_LI
);
kbNode
*
GetMostTopLeft
(
TDLI
<
kb
Link
>*
_LI
);
//! calculates crossing for all links in a graph, and add those as part of the graph.
//! calculates crossing for all links in a graph, and add those as part of the graph.
/*
/*
...
...
polygon/kbool/include/kbool/graphlst.h
View file @
ef2e41e3
...
@@ -28,21 +28,21 @@ Last Update 11-03-1996
...
@@ -28,21 +28,21 @@ Last Update 11-03-1996
class
Debug_driver
;
class
Debug_driver
;
class
A2DKBOOLDLLEXP
GraphList
:
public
DL_List
<
void
*>
class
A2DKBOOLDLLEXP
kb
GraphList
:
public
DL_List
<
void
*>
{
{
protected
:
protected
:
Bool_Engine
*
_GC
;
Bool_Engine
*
_GC
;
public
:
public
:
GraphList
(
Bool_Engine
*
GC
);
kb
GraphList
(
Bool_Engine
*
GC
);
GraphList
(
GraphList
*
other
);
kbGraphList
(
kb
GraphList
*
other
);
~
GraphList
();
~
kb
GraphList
();
void
MakeOneGraph
(
Graph
*
total
);
void
MakeOneGraph
(
kb
Graph
*
total
);
void
Prepare
(
Graph
*
total
);
void
Prepare
(
kb
Graph
*
total
);
void
MakeRings
();
void
MakeRings
();
void
Correction
();
void
Correction
();
...
...
polygon/kbool/include/kbool/line.h
View file @
ef2e41e3
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: line.h,v 1.
3 2008/06/04 21:23:21
titato Exp $
RCS-ID: $Id: line.h,v 1.
4 2009/09/07 19:23:28
titato Exp $
*/
*/
#ifndef LINE_H
#ifndef LINE_H
...
@@ -20,72 +20,72 @@ class A2DKBOOLDLLEXP Bool_Engine;
...
@@ -20,72 +20,72 @@ class A2DKBOOLDLLEXP Bool_Engine;
// Status of a point to a line
// Status of a point to a line
enum
PointStatus
{
LEFT_SIDE
,
RIGHT_SIDE
,
ON_AREA
,
IN_AREA
};
enum
PointStatus
{
LEFT_SIDE
,
RIGHT_SIDE
,
ON_AREA
,
IN_AREA
};
class
A2DKBOOLDLLEXP
Graph
;
class
A2DKBOOLDLLEXP
kb
Graph
;
class
A2DKBOOLDLLEXP
KBool
Line
class
A2DKBOOLDLLEXP
kb
Line
{
{
protected
:
protected
:
Bool_Engine
*
m_GC
;
Bool_Engine
*
m_GC
;
public
:
public
:
// constructors and destructor
// constructors and destructor
KBool
Line
(
Bool_Engine
*
GC
);
kb
Line
(
Bool_Engine
*
GC
);
KBoolLine
(
KBool
Link
*
,
Bool_Engine
*
GC
);
kbLine
(
kb
Link
*
,
Bool_Engine
*
GC
);
~
KBool
Line
();
~
kb
Line
();
void
Set
(
KBool
Link
*
);
void
Set
(
kb
Link
*
);
KBool
Link
*
GetLink
();
kb
Link
*
GetLink
();
//! Get the beginnode from a line
//! Get the beginnode from a line
Node
*
GetBeginNode
();
kb
Node
*
GetBeginNode
();
//! Get the endnode from a line
//! Get the endnode from a line
Node
*
GetEndNode
();
kb
Node
*
GetEndNode
();
//! Check if two lines intersects
//! Check if two lines intersects
int
CheckIntersect
(
KBool
Line
*
,
double
Marge
);
int
CheckIntersect
(
kb
Line
*
,
double
Marge
);
//! Intersects two lines
//! Intersects two lines
int
Intersect
(
KBool
Line
*
,
double
Marge
);
int
Intersect
(
kb
Line
*
,
double
Marge
);
int
Intersect_simple
(
KBool
Line
*
lijn
);
int
Intersect_simple
(
kb
Line
*
lijn
);
bool
Intersect2
(
Node
*
crossing
,
KBool
Line
*
lijn
);
bool
Intersect2
(
kbNode
*
crossing
,
kb
Line
*
lijn
);
//!For an infinite line
//!For an infinite line
PointStatus
PointOnLine
(
Node
*
a_node
,
double
&
Distance
,
double
Marge
);
PointStatus
PointOnLine
(
kb
Node
*
a_node
,
double
&
Distance
,
double
Marge
);
//!For a non-infinite line
//!For a non-infinite line
PointStatus
PointInLine
(
Node
*
a_node
,
double
&
Distance
,
double
Marge
);
PointStatus
PointInLine
(
kb
Node
*
a_node
,
double
&
Distance
,
double
Marge
);
//! Caclulate Y if X is known
//! Caclulate Y if X is known
B_INT
Calculate_Y
(
B_INT
X
);
B_INT
Calculate_Y
(
B_INT
X
);
B_INT
Calculate_Y_from_X
(
B_INT
X
);
B_INT
Calculate_Y_from_X
(
B_INT
X
);
void
Virtual_Point
(
LPoint
*
a_point
,
double
distance
);
void
Virtual_Point
(
kb
LPoint
*
a_point
,
double
distance
);
//! assignment operator
//! assignment operator
KBoolLine
&
operator
=
(
const
KBool
Line
&
);
kbLine
&
operator
=
(
const
kb
Line
&
);
Node
*
OffsetContour
(
KBoolLine
*
const
nextline
,
Node
*
last_ins
,
double
factor
,
Graph
*
shape
);
kbNode
*
OffsetContour
(
kbLine
*
const
nextline
,
kbNode
*
last_ins
,
double
factor
,
kb
Graph
*
shape
);
Node
*
OffsetContour_rounded
(
KBoolLine
*
const
nextline
,
Node
*
_last_ins
,
double
factor
,
Graph
*
shape
);
kbNode
*
OffsetContour_rounded
(
kbLine
*
const
nextline
,
kbNode
*
_last_ins
,
double
factor
,
kb
Graph
*
shape
);
bool
OkeForContour
(
KBoolLine
*
const
nextline
,
double
factor
,
Node
*
LastLeft
,
Node
*
LastRight
,
LinkStatus
&
_outproduct
);
bool
OkeForContour
(
kbLine
*
const
nextline
,
double
factor
,
kbNode
*
LastLeft
,
kb
Node
*
LastRight
,
LinkStatus
&
_outproduct
);
bool
Create_Ring_Shape
(
KBoolLine
*
nextline
,
Node
**
_last_ins_left
,
Node
**
_last_ins_right
,
double
factor
,
Graph
*
shape
);
bool
Create_Ring_Shape
(
kbLine
*
nextline
,
kbNode
**
_last_ins_left
,
kbNode
**
_last_ins_right
,
double
factor
,
kb
Graph
*
shape
);
void
Create_Begin_Shape
(
KBoolLine
*
nextline
,
Node
**
_last_ins_left
,
Node
**
_last_ins_right
,
double
factor
,
Graph
*
shape
);
void
Create_Begin_Shape
(
kbLine
*
nextline
,
kbNode
**
_last_ins_left
,
kbNode
**
_last_ins_right
,
double
factor
,
kb
Graph
*
shape
);
void
Create_End_Shape
(
KBoolLine
*
nextline
,
Node
*
_last_ins_left
,
Node
*
_last_ins_right
,
double
factor
,
Graph
*
shape
);
void
Create_End_Shape
(
kbLine
*
nextline
,
kbNode
*
_last_ins_left
,
kbNode
*
_last_ins_right
,
double
factor
,
kb
Graph
*
shape
);
//! Calculate the parameters if nessecary
//! Calculate the parameters if nessecary
void
CalculateLineParameters
();
void
CalculateLineParameters
();
//! Adds a crossing between the intersecting lines
//! Adds a crossing between the intersecting lines
void
AddLineCrossing
(
B_INT
,
B_INT
,
KBool
Line
*
);
void
AddLineCrossing
(
B_INT
,
B_INT
,
kb
Line
*
);
void
AddCrossing
(
Node
*
a_node
);
void
AddCrossing
(
kb
Node
*
a_node
);
Node
*
AddCrossing
(
B_INT
X
,
B_INT
Y
);
kb
Node
*
AddCrossing
(
B_INT
X
,
B_INT
Y
);
bool
ProcessCrossings
(
TDLI
<
KBool
Link
>*
_LI
);
bool
ProcessCrossings
(
TDLI
<
kb
Link
>*
_LI
);
// Linecrosslist
// Linecrosslist
void
SortLineCrossings
();
void
SortLineCrossings
();
bool
CrossListEmpty
();
bool
CrossListEmpty
();
DL_List
<
void
*>*
GetCrossList
();
DL_List
<
void
*>*
GetCrossList
();
// bool HasInCrossList(Node*);
// bool HasInCrossList(
kb
Node*);
private
:
private
:
...
@@ -94,10 +94,10 @@ private:
...
@@ -94,10 +94,10 @@ private:
//! Function needed for Intersect
//! Function needed for Intersect
int
ActionOnTable2
(
PointStatus
,
PointStatus
);
int
ActionOnTable2
(
PointStatus
,
PointStatus
);
double
m_AA
;
double
m_AA
;
double
m_BB
;
double
m_BB
;
double
m_CC
;
double
m_CC
;
KBool
Link
*
m_link
;
kb
Link
*
m_link
;
bool
m_valid_parameters
;
bool
m_valid_parameters
;
//! List with crossings through this link
//! List with crossings through this link
...
...
polygon/kbool/include/kbool/link.h
View file @
ef2e41e3
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: link.h,v 1.
3 2008/06/04 21:23:22
titato Exp $
RCS-ID: $Id: link.h,v 1.
4 2009/09/07 19:23:28
titato Exp $
*/
*/
#ifndef LINK_H
#ifndef LINK_H
...
@@ -17,53 +17,53 @@
...
@@ -17,53 +17,53 @@
enum
LinkStatus
{
IS_LEFT
,
IS_ON
,
IS_RIGHT
};
enum
LinkStatus
{
IS_LEFT
,
IS_ON
,
IS_RIGHT
};
class
LPoint
;
class
kb
LPoint
;
class
Node
;
class
kb
Node
;
class
Record
;
class
kb
Record
;
//! segment within a graph
//! segment within a graph
/*
/*
A Graph contains a list of
KBoolLink, the KBool
Link or connected by Node's.
A Graph contains a list of
kbLink, the kb
Link or connected by Node's.
Several
KBool
Link can be connected to one Node.
Several
kb
Link can be connected to one Node.
A
KBool
Link has a direction defined by its begin and end node.
A
kb
Link has a direction defined by its begin and end node.
Node do have a list of connected
KBool
Link's.
Node do have a list of connected
kb
Link's.
So one can walk trough a graph in two ways:
So one can walk trough a graph in two ways:
1- via its
KBool
Link list
1- via its
kb
Link list
2- via the node connected to the
KBool
Link's
2- via the node connected to the
kb
Link's
*/
*/
class
A2DKBOOLDLLEXP
KBool
Link
class
A2DKBOOLDLLEXP
kb
Link
{
{
protected
:
protected
:
Bool_Engine
*
_GC
;
Bool_Engine
*
_GC
;
public
:
public
:
//! contructors
//! contructors
KBool
Link
(
Bool_Engine
*
GC
);
kb
Link
(
Bool_Engine
*
GC
);
//! contructors
//! contructors
KBoolLink
(
int
graphnr
,
Node
*
begin
,
Node
*
end
,
Bool_Engine
*
GC
);
kbLink
(
int
graphnr
,
kbNode
*
begin
,
kb
Node
*
end
,
Bool_Engine
*
GC
);
//! contructors
//! contructors
KBoolLink
(
Node
*
begin
,
Node
*
end
,
Bool_Engine
*
GC
);
kbLink
(
kbNode
*
begin
,
kb
Node
*
end
,
Bool_Engine
*
GC
);
//! destructors
//! destructors
~
KBool
Link
();
~
kb
Link
();
//! Merges the other node with argument
//! Merges the other node with argument
void
MergeNodes
(
Node
*
const
);
void
MergeNodes
(
kb
Node
*
const
);
//! outproduct of two links
//! outproduct of two links
LinkStatus
OutProduct
(
KBool
Link
*
const
two
,
double
accur
);
LinkStatus
OutProduct
(
kb
Link
*
const
two
,
double
accur
);
//! link three compared to this and two
//! link three compared to this and two
LinkStatus
PointOnCorner
(
KBoolLink
*
const
,
KBool
Link
*
const
);
LinkStatus
PointOnCorner
(
kbLink
*
const
,
kb
Link
*
const
);
//! Removes argument from the link
//! Removes argument from the link
void
Remove
(
Node
*
);
void
Remove
(
kb
Node
*
);
//! replaces olddone in the link by newnode
//! replaces olddone in the link by newnode
void
Replace
(
Node
*
oldnode
,
Node
*
newnode
);
void
Replace
(
kbNode
*
oldnode
,
kb
Node
*
newnode
);
//!top hole marking
//!top hole marking
void
SetTopHole
(
bool
value
);
void
SetTopHole
(
bool
value
);
...
@@ -97,15 +97,15 @@ public:
...
@@ -97,15 +97,15 @@ public:
void
UnLink
();
void
UnLink
();
//! functions for maximum performance
//! functions for maximum performance
Node
*
GetBeginNode
();
kb
Node
*
GetBeginNode
();
//! Datamember access functions
//! Datamember access functions
Node
*
GetEndNode
();
kb
Node
*
GetEndNode
();
Node
*
GetLowNode
();
kb
Node
*
GetLowNode
();
Node
*
GetHighNode
();
kb
Node
*
GetHighNode
();
//! Returns a next link beginning with argument
//! Returns a next link beginning with argument
KBoolLink
*
Forth
(
Node
*
);
kbLink
*
Forth
(
kb
Node
*
);
int
GetGraphNum
();
int
GetGraphNum
();
bool
GetInc
();
bool
GetInc
();
...
@@ -113,10 +113,10 @@ public:
...
@@ -113,10 +113,10 @@ public:
bool
GetLeftB
();
bool
GetLeftB
();
bool
GetRightA
();
bool
GetRightA
();
bool
GetRightB
();
bool
GetRightB
();
void
GetLRO
(
LPoint
*
,
int
&
,
int
&
,
double
);
void
GetLRO
(
kb
LPoint
*
,
int
&
,
int
&
,
double
);
//! Return a node not equal to arg.
//! Return a node not equal to arg.
Node
*
GetOther
(
const
Node
*
const
);
kbNode
*
GetOther
(
const
kb
Node
*
const
);
//! Is this link unused ?
//! Is this link unused ?
bool
IsUnused
();
bool
IsUnused
();
...
@@ -143,10 +143,10 @@ public:
...
@@ -143,10 +143,10 @@ public:
bool
ShorterThan
(
B_INT
marge
);
bool
ShorterThan
(
B_INT
marge
);
//! Resets the link
//! Resets the link
void
Reset
(
Node
*
begin
,
Node
*
end
,
int
graphnr
=
0
);
void
Reset
(
kbNode
*
begin
,
kb
Node
*
end
,
int
graphnr
=
0
);
void
Set
(
Node
*
begin
,
Node
*
end
);
void
Set
(
kbNode
*
begin
,
kb
Node
*
end
);
void
SetBeginNode
(
Node
*
);
void
SetBeginNode
(
kb
Node
*
);
void
SetEndNode
(
Node
*
);
void
SetEndNode
(
kb
Node
*
);
void
SetGraphNum
(
int
);
void
SetGraphNum
(
int
);
void
SetInc
(
bool
);
void
SetInc
(
bool
);
void
SetLeftA
(
bool
);
void
SetLeftA
(
bool
);
...
@@ -162,18 +162,18 @@ public:
...
@@ -162,18 +162,18 @@ public:
void
Reset_flags
();
void
Reset_flags
();
//!put in this direction
//!put in this direction
void
Redirect
(
Node
*
a_node
);
void
Redirect
(
kb
Node
*
a_node
);
void
TakeOverOperationFlags
(
KBool
Link
*
link
);
void
TakeOverOperationFlags
(
kb
Link
*
link
);
void
SetRecordNode
(
DL_Node
<
Record
*>*
recordNode
)
{
m_record
=
recordNode
;
}
void
SetRecordNode
(
DL_Node
<
kb
Record
*>*
recordNode
)
{
m_record
=
recordNode
;
}
DL_Node
<
Record
*>*
GetRecordNode
()
{
return
m_record
;
}
DL_Node
<
kb
Record
*>*
GetRecordNode
()
{
return
m_record
;
}
protected
:
protected
:
//! The mainitems of a link
//! The mainitems of a link
Node
*
m_beginnode
,
*
m_endnode
;
kb
Node
*
m_beginnode
,
*
m_endnode
;
//! Marker for walking over the graph
//! Marker for walking over the graph
bool
m_bin
:
1
;
bool
m_bin
:
1
;
//! Is this a part of hole ?
//! Is this a part of hole ?
...
@@ -223,7 +223,7 @@ GroupType m_group : 1;
...
@@ -223,7 +223,7 @@ GroupType m_group : 1;
//! belongs to this polygon part in the graph.
//! belongs to this polygon part in the graph.
int
m_graphnum
;
int
m_graphnum
;
DL_Node
<
Record
*>*
m_record
;
DL_Node
<
kb
Record
*>*
m_record
;
};
};
#endif
#endif
...
...
polygon/kbool/include/kbool/lpoint.h
View file @
ef2e41e3
...
@@ -21,35 +21,35 @@ Last Update 12-12-1995
...
@@ -21,35 +21,35 @@ Last Update 12-12-1995
#include "kbool/booleng.h"
#include "kbool/booleng.h"
class
A2DKBOOLDLLEXP
LPoint
class
A2DKBOOLDLLEXP
kb
LPoint
{
{
public
:
public
:
LPoint
();
kb
LPoint
();
LPoint
(
B_INT
const
,
B_INT
const
);
kb
LPoint
(
B_INT
const
,
B_INT
const
);
LPoint
(
LPoint
*
const
);
kbLPoint
(
kb
LPoint
*
const
);
void
Set
(
const
B_INT
,
const
B_INT
);
void
Set
(
const
B_INT
,
const
B_INT
);
void
Set
(
const
LPoint
&
);
void
Set
(
const
kb
LPoint
&
);
LPoint
GetPoint
();
kb
LPoint
GetPoint
();
B_INT
GetX
();
B_INT
GetX
();
B_INT
GetY
();
B_INT
GetY
();
void
SetX
(
B_INT
);
void
SetX
(
B_INT
);
void
SetY
(
B_INT
);
void
SetY
(
B_INT
);
bool
Equal
(
const
LPoint
a_point
,
B_INT
Marge
);
bool
Equal
(
const
kb
LPoint
a_point
,
B_INT
Marge
);
bool
Equal
(
const
B_INT
,
const
B_INT
,
B_INT
Marge
);
bool
Equal
(
const
B_INT
,
const
B_INT
,
B_INT
Marge
);
bool
ShorterThan
(
const
LPoint
a_point
,
B_INT
marge
);
bool
ShorterThan
(
const
kb
LPoint
a_point
,
B_INT
marge
);
bool
ShorterThan
(
const
B_INT
X
,
const
B_INT
Y
,
B_INT
);
bool
ShorterThan
(
const
B_INT
X
,
const
B_INT
Y
,
B_INT
);
LPoint
&
operator
=
(
const
LPoint
&
);
kbLPoint
&
operator
=
(
const
kb
LPoint
&
);
LPoint
&
operator
+
(
const
LPoint
&
);
kbLPoint
&
operator
+
(
const
kb
LPoint
&
);
LPoint
&
operator
-
(
const
LPoint
&
);
kbLPoint
&
operator
-
(
const
kb
LPoint
&
);
LPoint
&
operator
*
(
int
);
kb
LPoint
&
operator
*
(
int
);
LPoint
&
operator
/
(
int
);
kb
LPoint
&
operator
/
(
int
);
int
operator
==
(
const
LPoint
&
)
const
;
int
operator
==
(
const
kb
LPoint
&
)
const
;
int
operator
!=
(
const
LPoint
&
)
const
;
int
operator
!=
(
const
kb
LPoint
&
)
const
;
protected
:
protected
:
B_INT
_x
;
B_INT
_x
;
...
...
polygon/kbool/include/kbool/node.h
View file @
ef2e41e3
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: node.h,v 1.
3 2008/06/04 21:23:22
titato Exp $
RCS-ID: $Id: node.h,v 1.
4 2009/09/07 19:23:28
titato Exp $
*/
*/
#ifndef NODE_H
#ifndef NODE_H
...
@@ -22,7 +22,7 @@
...
@@ -22,7 +22,7 @@
enum
NodePosition
{
N_LEFT
,
N_ON
,
N_RIGHT
};
enum
NodePosition
{
N_LEFT
,
N_ON
,
N_RIGHT
};
class
A2DKBOOLDLLEXP
Node
:
public
LPoint
class
A2DKBOOLDLLEXP
kbNode
:
public
kb
LPoint
{
{
protected
:
protected
:
Bool_Engine
*
_GC
;
Bool_Engine
*
_GC
;
...
@@ -31,52 +31,52 @@ public:
...
@@ -31,52 +31,52 @@ public:
friend
class
Debug_driver
;
friend
class
Debug_driver
;
// constructors and destructors
// constructors and destructors
Node
(
Bool_Engine
*
GC
);
kb
Node
(
Bool_Engine
*
GC
);
Node
(
const
B_INT
,
const
B_INT
,
Bool_Engine
*
GC
);
kb
Node
(
const
B_INT
,
const
B_INT
,
Bool_Engine
*
GC
);
Node
(
LPoint
*
const
a_point
,
Bool_Engine
*
GC
);
kbNode
(
kb
LPoint
*
const
a_point
,
Bool_Engine
*
GC
);
Node
(
Node
*
const
,
Bool_Engine
*
GC
);
kbNode
(
kb
Node
*
const
,
Bool_Engine
*
GC
);
Node
&
operator
=
(
const
Node
&
other_node
);
kbNode
&
operator
=
(
const
kb
Node
&
other_node
);
~
Node
();
~
kb
Node
();
//public member functions
//public member functions
void
AddLink
(
KBool
Link
*
);
void
AddLink
(
kb
Link
*
);
DL_List
<
void
*>*
GetLinklist
();
DL_List
<
void
*>*
GetLinklist
();
//! check two link for its operation flags to be the same when coming from the prev link.
//! check two link for its operation flags to be the same when coming from the prev link.
bool
SameSides
(
KBoolLink
*
const
prev
,
KBool
Link
*
const
link
,
BOOL_OP
operation
);
bool
SameSides
(
kbLink
*
const
prev
,
kb
Link
*
const
link
,
BOOL_OP
operation
);
//! get the link most right or left to the current link, but with the specific operation
//! get the link most right or left to the current link, but with the specific operation
/*! flags the same on the sides of the new link.
/*! flags the same on the sides of the new link.
*/
*/
KBoolLink
*
GetMost
(
KBool
Link
*
const
prev
,
LinkStatus
whatside
,
BOOL_OP
operation
);
kbLink
*
GetMost
(
kb
Link
*
const
prev
,
LinkStatus
whatside
,
BOOL_OP
operation
);
//! get link that is leading to a hole ( hole segment or linking segment )
//! get link that is leading to a hole ( hole segment or linking segment )
KBoolLink
*
GetMostHole
(
KBool
Link
*
const
prev
,
LinkStatus
whatside
,
BOOL_OP
operation
);
kbLink
*
GetMostHole
(
kb
Link
*
const
prev
,
LinkStatus
whatside
,
BOOL_OP
operation
);
//! get link that is not vertical.
//! get link that is not vertical.
KBool
Link
*
GetNotFlat
();
kb
Link
*
GetNotFlat
();
//! get a link to a hole or from a hole.
//! get a link to a hole or from a hole.
KBoolLink
*
GetHoleLink
(
KBool
Link
*
const
prev
,
bool
checkbin
,
BOOL_OP
operation
);
kbLink
*
GetHoleLink
(
kb
Link
*
const
prev
,
bool
checkbin
,
BOOL_OP
operation
);
int
Merge
(
Node
*
);
int
Merge
(
kb
Node
*
);
void
RemoveLink
(
KBool
Link
*
);
void
RemoveLink
(
kb
Link
*
);
bool
Simplify
(
Node
*
First
,
Node
*
Second
,
B_INT
Marge
);
bool
Simplify
(
kbNode
*
First
,
kb
Node
*
Second
,
B_INT
Marge
);
// memberfunctions for maximum performance
// memberfunctions for maximum performance
void
RoundInt
(
B_INT
grid
);
void
RoundInt
(
B_INT
grid
);
KBool
Link
*
GetIncomingLink
();
kb
Link
*
GetIncomingLink
();
int
GetNumberOfLinks
();
int
GetNumberOfLinks
();
KBool
Link
*
GetNextLink
();
kb
Link
*
GetNextLink
();
KBoolLink
*
GetOtherLink
(
KBool
Link
*
);
kbLink
*
GetOtherLink
(
kb
Link
*
);
KBool
Link
*
GetOutgoingLink
();
kb
Link
*
GetOutgoingLink
();
KBool
Link
*
GetPrevLink
();
kb
Link
*
GetPrevLink
();
KBoolLink
*
Follow
(
KBool
Link
*
const
prev
);
kbLink
*
Follow
(
kb
Link
*
const
prev
);
KBool
Link
*
GetBinHighest
(
bool
binset
);
kb
Link
*
GetBinHighest
(
bool
binset
);
protected
:
protected
:
DL_List
<
void
*>*
_linklist
;
DL_List
<
void
*>*
_linklist
;
...
...
polygon/kbool/include/kbool/record.h
View file @
ef2e41e3
...
@@ -5,13 +5,13 @@
...
@@ -5,13 +5,13 @@
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: record.h,v 1.
3 2008/06/04 21:23:22
titato Exp $
RCS-ID: $Id: record.h,v 1.
4 2009/09/07 19:23:28
titato Exp $
*/
*/
#ifndef RECORD_H
#ifndef RECORD_H
#define RECORD_H
#define RECORD_H
class
Node
;
class
kb
Node
;
#include "kbool/booleng.h"
#include "kbool/booleng.h"
#include "kbool/link.h"
#include "kbool/link.h"
...
@@ -24,30 +24,30 @@ enum DIRECTION {GO_LEFT, GO_RIGHT};
...
@@ -24,30 +24,30 @@ enum DIRECTION {GO_LEFT, GO_RIGHT};
//extern void DeleteRecordPool();
//extern void DeleteRecordPool();
class
A2DKBOOLDLLEXP
Bool_Engine
;
class
A2DKBOOLDLLEXP
Bool_Engine
;
class
A2DKBOOLDLLEXP
Record
class
A2DKBOOLDLLEXP
kb
Record
{
{
protected
:
protected
:
Bool_Engine
*
_GC
;
Bool_Engine
*
_GC
;
public
:
public
:
// void deletepool();
// void deletepool();
Record
(
KBool
Link
*
link
,
Bool_Engine
*
GC
);
kbRecord
(
kb
Link
*
link
,
Bool_Engine
*
GC
);
~
Record
();
~
kb
Record
();
// void* operator new(size_t size);
// void* operator new(size_t size);
// void operator delete(void* recordptr);
// void operator delete(void* recordptr);
void
SetNewLink
(
KBool
Link
*
link
);
void
SetNewLink
(
kb
Link
*
link
);
void
Set_Flags
();
void
Set_Flags
();
void
Calc_Ysp
(
Node
*
low
);
void
Calc_Ysp
(
kb
Node
*
low
);
KBool
Link
*
GetLink
();
kb
Link
*
GetLink
();
KBool
Line
*
GetLine
();
kb
Line
*
GetLine
();
B_INT
Ysp
();
B_INT
Ysp
();
...
@@ -55,12 +55,12 @@ public:
...
@@ -55,12 +55,12 @@ public:
DIRECTION
Direction
();
DIRECTION
Direction
();
bool
Calc_Left_Right
(
Record
*
record_above_me
);
bool
Calc_Left_Right
(
kb
Record
*
record_above_me
);
bool
Equal
(
Record
*
);
bool
Equal
(
kb
Record
*
);
private
:
private
:
KBool
Line
_line
;
kb
Line
_line
;
B_INT
_ysp
;
B_INT
_ysp
;
...
...
polygon/kbool/include/kbool/scanbeam.h
View file @
ef2e41e3
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: scanbeam.h,v 1.
4 2008/09/05 19:01:14
titato Exp $
RCS-ID: $Id: scanbeam.h,v 1.
5 2009/09/07 19:23:28
titato Exp $
*/
*/
#ifndef SCANBEAM_H
#ifndef SCANBEAM_H
...
@@ -20,10 +20,10 @@
...
@@ -20,10 +20,10 @@
enum
SCANTYPE
{
NODELINK
,
LINKLINK
,
GENLR
,
LINKHOLES
,
INOUT
};
enum
SCANTYPE
{
NODELINK
,
LINKLINK
,
GENLR
,
LINKHOLES
,
INOUT
};
#if defined(WXART2D_USINGDLL)
#if defined(WXART2D_USINGDLL)
template
class
A2DKBOOLDLLEXP
DL_Iter
<
Record
*>
;
template
class
A2DKBOOLDLLEXP
DL_Iter
<
kb
Record
*>
;
#endif
#endif
class
A2DKBOOLDLLEXP
ScanBeam
:
public
DL_List
<
Record
*>
class
A2DKBOOLDLLEXP
ScanBeam
:
public
DL_List
<
kb
Record
*>
{
{
protected
:
protected
:
Bool_Engine
*
_GC
;
Bool_Engine
*
_GC
;
...
@@ -31,26 +31,26 @@ protected:
...
@@ -31,26 +31,26 @@ protected:
public
:
public
:
ScanBeam
(
Bool_Engine
*
GC
);
ScanBeam
(
Bool_Engine
*
GC
);
~
ScanBeam
();
~
ScanBeam
();
void
SetType
(
Node
*
low
,
Node
*
high
);
void
SetType
(
kbNode
*
low
,
kb
Node
*
high
);
bool
FindNew
(
SCANTYPE
scantype
,
TDLI
<
KBool
Link
>*
_I
,
bool
&
holes
);
bool
FindNew
(
SCANTYPE
scantype
,
TDLI
<
kb
Link
>*
_I
,
bool
&
holes
);
bool
RemoveOld
(
SCANTYPE
scantype
,
TDLI
<
KBool
Link
>*
_I
,
bool
&
holes
);
bool
RemoveOld
(
SCANTYPE
scantype
,
TDLI
<
kb
Link
>*
_I
,
bool
&
holes
);
private
:
private
:
bool
ProcessHoles
(
bool
atinsert
,
TDLI
<
KBool
Link
>*
_LI
);
bool
ProcessHoles
(
bool
atinsert
,
TDLI
<
kb
Link
>*
_LI
);
int
Process_LinkToLink_Crossings
();
// find crossings
int
Process_LinkToLink_Crossings
();
// find crossings
int
Process_PointToLink_Crossings
();
int
Process_PointToLink_Crossings
();
int
Process_LinkToLink_Flat
(
KBool
Line
*
flatline
);
int
Process_LinkToLink_Flat
(
kb
Line
*
flatline
);
void
SortTheBeam
(
bool
backangle
);
void
SortTheBeam
(
bool
backangle
);
bool
checksort
();
bool
checksort
();
bool
writebeam
();
bool
writebeam
();
void
Calc_Ysp
();
void
Calc_Ysp
();
//int FindCloseLinksAndCross(TDLI<
KBoolLink>* _I,
Node* _lowf);
//int FindCloseLinksAndCross(TDLI<
kbLink>* _I,kb
Node* _lowf);
void
Generate_INOUT
(
int
graphnumber
);
void
Generate_INOUT
(
int
graphnumber
);
Node
*
_low
;
kb
Node
*
_low
;
DL_Iter
<
Record
*>
_BI
;
DL_Iter
<
kb
Record
*>
_BI
;
int
lastinserted
;
int
lastinserted
;
BEAM_TYPE
_type
;
BEAM_TYPE
_type
;
};
};
...
...
polygon/kbool/include/kbool/statusb.h
View file @
ef2e41e3
...
@@ -3,12 +3,12 @@
...
@@ -3,12 +3,12 @@
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence:
wxWidgets Licence
Licence:
see kboollicense.txt
RCS-ID: $Id: statusb.h,v 1.
2 2006/12/15 21:00:06
titato Exp $
RCS-ID: $Id: statusb.h,v 1.
3 2009/02/06 21:33:03
titato Exp $
*/
*/
/* @@(#) $Source: /cvsroot/wxart2d/wxArt2D/thirdparty/kbool/include/kbool/statusb.h,v $ $Revision: 1.
2 $ $Date: 2006/12/15 21:00:06
$ */
/* @@(#) $Source: /cvsroot/wxart2d/wxArt2D/thirdparty/kbool/include/kbool/statusb.h,v $ $Revision: 1.
3 $ $Date: 2009/02/06 21:33:03
$ */
/*
/*
Program STATUSB.H
Program STATUSB.H
...
...
polygon/kbool/include/kbool/valuesvc.h
View file @
ef2e41e3
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence:
wxWidgets Licence
Licence:
see kboollicense.txt
RCS-ID: $Id: valuesvc.h,v 1.
1 2006/11/04 21:49:01
titato Exp $
RCS-ID: $Id: valuesvc.h,v 1.
2 2009/02/06 21:33:03
titato Exp $
*/
*/
polygon/kbool/samples/boolonly/boolonly.cpp
View file @
ef2e41e3
/*! \file
kbool/
samples/boolonly/boolonly.cpp
/*! \file samples/boolonly/boolonly.cpp
\brief boolonly demonstrates the use of the boolean algorithm
\brief boolonly demonstrates the use of the boolean algorithm
\author Probably Klaas Holwerda
\author Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence:
wxWidgets Licence
Licence:
see kboollicense.txt
RCS-ID: $Id: boolonly.cpp,v 1.
9 2005/01/16 18:39:24 kire_putsje
Exp $
RCS-ID: $Id: boolonly.cpp,v 1.
7 2009/05/28 19:49:48 titato
Exp $
*/
*/
#ifdef __GNUG__
#pragma implementation
#endif
#include "boolonly.h"
#include "boolonly.h"
...
@@ -24,7 +21,7 @@ KBoolPoint::KBoolPoint()
...
@@ -24,7 +21,7 @@ KBoolPoint::KBoolPoint()
_y
=
0.0
;
_y
=
0.0
;
}
}
KBoolPoint
::
KBoolPoint
(
double
const
X
,
double
const
Y
)
KBoolPoint
::
KBoolPoint
(
double
const
X
,
double
const
Y
)
{
{
_x
=
X
;
_x
=
X
;
_y
=
Y
;
_y
=
Y
;
...
@@ -48,23 +45,23 @@ void ArmBoolEng( Bool_Engine* booleng )
...
@@ -48,23 +45,23 @@ void ArmBoolEng( Bool_Engine* booleng )
// set some global vals to arm the boolean engine
// set some global vals to arm the boolean engine
double
DGRID
=
1000
;
// round coordinate X or Y value in calculations to this
double
DGRID
=
1000
;
// round coordinate X or Y value in calculations to this
double
MARGE
=
0.001
;
// snap with in this range points to lines in the intersection routines
double
MARGE
=
0.001
;
// snap with in this range points to lines in the intersection routines
// should always be > DGRID a MARGE >= 10*DGRID is oke
// should always be > DGRID a MARGE >= 10*DGRID is oke
// this is also used to remove small segments and to decide when
// this is also used to remove small segments and to decide when
// two segments are in line.
// two segments are in line.
double
CORRECTIONFACTOR
=
500.0
;
// correct the polygons by this number
double
CORRECTIONFACTOR
=
500.0
;
// correct the polygons by this number
double
CORRECTIONABER
=
1.0
;
// the accuracy for the rounded shapes used in correction
double
CORRECTIONABER
=
1.0
;
// the accuracy for the rounded shapes used in correction
double
ROUNDFACTOR
=
1.5
;
// when will we round the correction shape to a circle
double
ROUNDFACTOR
=
1.5
;
// when will we round the correction shape to a circle
double
SMOOTHABER
=
10.0
;
// accuracy when smoothing a polygon
double
SMOOTHABER
=
10.0
;
// accuracy when smoothing a polygon
double
MAXLINEMERGE
=
1000.0
;
// leave as is, segments of this length in smoothen
double
MAXLINEMERGE
=
1000.0
;
// leave as is, segments of this length in smoothen
// DGRID is only meant to make fractional parts of input data which
// DGRID is only meant to make fractional parts of input data which
// are doubles, part of the integers used in vertexes within the boolean algorithm.
// are doubles, part of the integers used in vertexes within the boolean algorithm.
// Within the algorithm all input data is multiplied with DGRID
// Within the algorithm all input data is multiplied with DGRID
// space for extra intersection inside the boolean algorithms
// space for extra intersection inside the boolean algorithms
// only change this if there are problems
// only change this if there are problems
int
GRID
=
10000
;
int
GRID
=
10000
;
booleng
->
SetMarge
(
MARGE
);
booleng
->
SetMarge
(
MARGE
);
booleng
->
SetGrid
(
GRID
);
booleng
->
SetGrid
(
GRID
);
...
@@ -87,19 +84,21 @@ void AddPolygonsToBoolEng2( Bool_Engine* booleng )
...
@@ -87,19 +84,21 @@ void AddPolygonsToBoolEng2( Bool_Engine* booleng )
int
numRowsAndCols
=
120
;
int
numRowsAndCols
=
120
;
int
i
,
j
;
int
i
,
j
;
for
(
i
=
0
;
i
<
numRowsAndCols
;
i
++
)
{
for
(
i
=
0
;
i
<
numRowsAndCols
;
i
++
)
for
(
j
=
0
;
j
<
numRowsAndCols
;
j
++
)
{
{
for
(
j
=
0
;
j
<
numRowsAndCols
;
j
++
)
{
// foreach point in a polygon ...
// foreach point in a polygon ...
if
(
booleng
->
StartPolygonAdd
(
GROUP_A
)
)
if
(
booleng
->
StartPolygonAdd
(
GROUP_A
)
)
{
{
// Counter-Clockwise
// Counter-Clockwise
booleng
->
AddPoint
(
x1
,
y1
);
booleng
->
AddPoint
(
x1
,
y1
);
booleng
->
AddPoint
(
x2
,
y1
);
booleng
->
AddPoint
(
x2
,
y1
);
booleng
->
AddPoint
(
x2
,
y2
);
booleng
->
AddPoint
(
x2
,
y2
);
booleng
->
AddPoint
(
x1
,
y2
);
booleng
->
AddPoint
(
x1
,
y2
);
}
}
booleng
->
EndPolygonAdd
();
booleng
->
EndPolygonAdd
();
x1
+=
pitch1
;
x1
+=
pitch1
;
x2
+=
pitch1
;
x2
+=
pitch1
;
}
}
...
@@ -116,19 +115,21 @@ void AddPolygonsToBoolEng2( Bool_Engine* booleng )
...
@@ -116,19 +115,21 @@ void AddPolygonsToBoolEng2( Bool_Engine* booleng )
y1
=
150
;
y1
=
150
;
y2
=
250
;
y2
=
250
;
for
(
i
=
0
;
i
<
numRowsAndCols
;
i
++
)
{
for
(
i
=
0
;
i
<
numRowsAndCols
;
i
++
)
for
(
int
j
=
0
;
j
<
numRowsAndCols
;
j
++
)
{
{
for
(
int
j
=
0
;
j
<
numRowsAndCols
;
j
++
)
{
// foreach point in a polygon ...
// foreach point in a polygon ...
if
(
booleng
->
StartPolygonAdd
(
GROUP_B
)
)
if
(
booleng
->
StartPolygonAdd
(
GROUP_B
)
)
{
{
// Counter Clockwise
// Counter Clockwise
booleng
->
AddPoint
(
x1
,
y1
);
booleng
->
AddPoint
(
x1
,
y1
);
booleng
->
AddPoint
(
x2
,
y1
);
booleng
->
AddPoint
(
x2
,
y1
);
booleng
->
AddPoint
(
x2
,
y2
);
booleng
->
AddPoint
(
x2
,
y2
);
booleng
->
AddPoint
(
x1
,
y2
);
booleng
->
AddPoint
(
x1
,
y2
);
}
}
booleng
->
EndPolygonAdd
();
booleng
->
EndPolygonAdd
();
x1
+=
pitch1
;
x1
+=
pitch1
;
x2
+=
pitch1
;
x2
+=
pitch1
;
}
}
...
@@ -145,68 +146,68 @@ void AddPolygonsToBoolEng2( Bool_Engine* booleng )
...
@@ -145,68 +146,68 @@ void AddPolygonsToBoolEng2( Bool_Engine* booleng )
void
AddPolygonsToBoolEng
(
Bool_Engine
*
booleng
)
void
AddPolygonsToBoolEng
(
Bool_Engine
*
booleng
)
{
{
// foreach point in a polygon ...
// foreach point in a polygon ...
if
(
booleng
->
StartPolygonAdd
(
GROUP_A
)
)
if
(
booleng
->
StartPolygonAdd
(
GROUP_A
)
)
{
{
booleng
->
AddPoint
(
28237.480000
,
396.364000
);
booleng
->
AddPoint
(
28237.480000
,
396.364000
);
booleng
->
AddPoint
(
28237.980000
,
394.121000
);
booleng
->
AddPoint
(
28237.980000
,
394.121000
);
booleng
->
AddPoint
(
28242.000000
,
395.699000
);
booleng
->
AddPoint
(
28242.000000
,
395.699000
);
booleng
->
AddPoint
(
28240.830000
,
397.679000
);
booleng
->
AddPoint
(
28240.830000
,
397.679000
);
}
}
booleng
->
EndPolygonAdd
();
booleng
->
EndPolygonAdd
();
// foreach point in a polygon ...
// foreach point in a polygon ...
if
(
booleng
->
StartPolygonAdd
(
GROUP_B
)
)
if
(
booleng
->
StartPolygonAdd
(
GROUP_B
)
)
{
{
booleng
->
AddPoint
(
28242.100000
,
398.491000
);
booleng
->
AddPoint
(
28242.100000
,
398.491000
);
booleng
->
AddPoint
(
28240.580000
,
397.485000
);
booleng
->
AddPoint
(
28240.580000
,
397.485000
);
booleng
->
AddPoint
(
28237.910000
,
394.381000
);
booleng
->
AddPoint
(
28237.910000
,
394.381000
);
}
}
booleng
->
EndPolygonAdd
();
booleng
->
EndPolygonAdd
();
if
(
booleng
->
StartPolygonAdd
(
GROUP_B
)
)
if
(
booleng
->
StartPolygonAdd
(
GROUP_B
)
)
{
{
booleng
->
AddPoint
(
28243.440000
,
399.709000
);
booleng
->
AddPoint
(
28243.440000
,
399.709000
);
booleng
->
AddPoint
(
28237.910000
,
394.381000
);
booleng
->
AddPoint
(
28237.910000
,
394.381000
);
booleng
->
AddPoint
(
28239.290000
,
394.763000
);
booleng
->
AddPoint
(
28239.290000
,
394.763000
);
}
}
booleng
->
EndPolygonAdd
();
booleng
->
EndPolygonAdd
();
}
}
void
AddPolygonsToBoolEng3
(
Bool_Engine
*
booleng
)
void
AddPolygonsToBoolEng3
(
Bool_Engine
*
booleng
)
{
{
// foreach point in a polygon ...
// foreach point in a polygon ...
if
(
booleng
->
StartPolygonAdd
(
GROUP_A
)
)
if
(
booleng
->
StartPolygonAdd
(
GROUP_A
)
)
{
{
booleng
->
AddPoint
(
100
,
100
);
booleng
->
AddPoint
(
100
,
100
);
booleng
->
AddPoint
(
-
100
,
100
);
booleng
->
AddPoint
(
-
100
,
100
);
booleng
->
AddPoint
(
-
100
,
-
100
);
booleng
->
AddPoint
(
-
100
,
-
100
);
booleng
->
AddPoint
(
100
,
-
100
);
booleng
->
AddPoint
(
100
,
-
100
);
}
}
booleng
->
EndPolygonAdd
();
booleng
->
EndPolygonAdd
();
// foreach point in a polygon ...
// foreach point in a polygon ...
if
(
booleng
->
StartPolygonAdd
(
GROUP_B
)
)
if
(
booleng
->
StartPolygonAdd
(
GROUP_B
)
)
{
{
booleng
->
AddPoint
(
50
,
50
);
booleng
->
AddPoint
(
50
,
50
);
booleng
->
AddPoint
(
-
50
,
50
);
booleng
->
AddPoint
(
-
50
,
50
);
booleng
->
AddPoint
(
-
50
,
-
50
);
booleng
->
AddPoint
(
-
50
,
-
50
);
booleng
->
AddPoint
(
50
,
-
50
);
booleng
->
AddPoint
(
50
,
-
50
);
booleng
->
EndPolygonAdd
();
booleng
->
EndPolygonAdd
();
}
}
booleng
->
EndPolygonAdd
();
booleng
->
EndPolygonAdd
();
}
}
void
AddPolygonsToBoolEng4
(
Bool_Engine
*
booleng
)
void
AddPolygonsToBoolEng4
(
Bool_Engine
*
booleng
)
{
{
// foreach point in a polygon ...
// foreach point in a polygon ...
if
(
booleng
->
StartPolygonAdd
(
GROUP_A
)
)
if
(
booleng
->
StartPolygonAdd
(
GROUP_A
)
)
{
{
booleng
->
AddPoint
(
0
,
0
);
booleng
->
AddPoint
(
0
,
0
);
booleng
->
AddPoint
(
0
,
1000
);
booleng
->
AddPoint
(
0
,
1000
);
booleng
->
AddPoint
(
1000
,
1000
);
booleng
->
AddPoint
(
1000
,
1000
);
booleng
->
AddPoint
(
1000
,
0
);
booleng
->
AddPoint
(
1000
,
0
);
}
}
booleng
->
EndPolygonAdd
();
booleng
->
EndPolygonAdd
();
}
}
void
GetPolygonsFromBoolEng
(
Bool_Engine
*
booleng
)
void
GetPolygonsFromBoolEng
(
Bool_Engine
*
booleng
)
...
@@ -217,8 +218,8 @@ void GetPolygonsFromBoolEng( Bool_Engine* booleng )
...
@@ -217,8 +218,8 @@ void GetPolygonsFromBoolEng( Bool_Engine* booleng )
// foreach point in the polygon
// foreach point in the polygon
while
(
booleng
->
PolygonHasMorePoints
()
)
while
(
booleng
->
PolygonHasMorePoints
()
)
{
{
fprintf
(
stderr
,
"x = %f
\t
"
,
booleng
->
GetPolygonXPoint
()
);
fprintf
(
stderr
,
"x = %f
\t
"
,
booleng
->
GetPolygonXPoint
()
);
fprintf
(
stderr
,
"y = %f
\n
"
,
booleng
->
GetPolygonYPoint
()
);
fprintf
(
stderr
,
"y = %f
\n
"
,
booleng
->
GetPolygonYPoint
()
);
}
}
booleng
->
EndPolygonGet
();
booleng
->
EndPolygonGet
();
}
}
...
@@ -226,143 +227,147 @@ void GetPolygonsFromBoolEng( Bool_Engine* booleng )
...
@@ -226,143 +227,147 @@ void GetPolygonsFromBoolEng( Bool_Engine* booleng )
void
GetPolygonsFromBoolEngKEY
(
Bool_Engine
*
booleng
)
void
GetPolygonsFromBoolEngKEY
(
Bool_Engine
*
booleng
)
{
{
FILE
*
file
=
fopen
(
"keyfile.key"
,
"w"
);
FILE
*
file
=
fopen
(
"keyfile.key"
,
"w"
);
fprintf
(
file
,
"\
fprintf
(
file
,
"\
HEADER 5; \
HEADER 5; \
BGNLIB; \
BGNLIB; \
LASTMOD {2-11-15 15:39:21}; \
LASTMOD {2-11-15 15:39:21}; \
LASTACC {2-11-15 15:39:21}; \
LASTACC {2-11-15 15:39:21}; \
LIBNAME trial; \
LIBNAME trial; \
UNITS; \
UNITS; \
USERUNITS 0.0001; PHYSUNITS 2.54e-009; \
USERUNITS 0.0001; PHYSUNITS 2.54e-009; \
\
\
BGNSTR; \
BGNSTR; \
CREATION {2-11-15 15:39:21}; \
CREATION {2-11-15 15:39:21}; \
LASTMOD {2-11-15 15:39:21}; \
LASTMOD {2-11-15 15:39:21}; \
STRNAME top; \
STRNAME top; \
"
);
"
);
// foreach resultant polygon in the booleng ...
// foreach resultant polygon in the booleng ...
while
(
booleng
->
StartPolygonGet
()
)
while
(
booleng
->
StartPolygonGet
()
)
{
{
fprintf
(
file
,
"BOUNDARY; LAYER 2; DATATYPE 0;
\n
"
);
fprintf
(
file
,
"BOUNDARY; LAYER 2; DATATYPE 0;
\n
"
);
fprintf
(
file
,
" XY %d;
\n
"
,
booleng
->
GetNumPointsInPolygon
()
+
1
);
fprintf
(
file
,
" XY %
d;
\n
"
,
booleng
->
GetNumPointsInPolygon
()
+
1
);
booleng
->
PolygonHasMorePoints
();
booleng
->
PolygonHasMorePoints
();
double
firstx
=
booleng
->
GetPolygonXPoint
();
double
firstx
=
booleng
->
GetPolygonXPoint
();
double
firsty
=
booleng
->
GetPolygonYPoint
();
double
firsty
=
booleng
->
GetPolygonYPoint
();
fprintf
(
file
,
"X %f;
\t
"
,
firstx
);
fprintf
(
file
,
"X %
f;
\t
"
,
firstx
);
fprintf
(
file
,
"Y %
f;
\n
"
,
firsty
);
fprintf
(
file
,
"Y %
f;
\n
"
,
firsty
);
// foreach point in the polygon
// foreach point in the polygon
while
(
booleng
->
PolygonHasMorePoints
()
)
while
(
booleng
->
PolygonHasMorePoints
()
)
{
{
fprintf
(
file
,
"X %f;
\t
"
,
booleng
->
GetPolygonXPoint
());
fprintf
(
file
,
"X %
f;
\t
"
,
booleng
->
GetPolygonXPoint
());
fprintf
(
file
,
"Y %
f;
\n
"
,
booleng
->
GetPolygonYPoint
());
fprintf
(
file
,
"Y %
f;
\n
"
,
booleng
->
GetPolygonYPoint
());
}
}
booleng
->
EndPolygonGet
();
booleng
->
EndPolygonGet
();
fprintf
(
file
,
"X %f;
\t
"
,
firstx
);
fprintf
(
file
,
"X %
f;
\t
"
,
firstx
);
fprintf
(
file
,
"Y %
f;
\n
"
,
firsty
);
fprintf
(
file
,
"Y %
f;
\n
"
,
firsty
);
fprintf
(
file
,
"ENDEL;
\n
"
);
fprintf
(
file
,
"ENDEL;
\n
"
);
}
}
fprintf
(
file
,
"\
fprintf
(
file
,
"\
ENDSTR top; \
ENDSTR top; \
ENDLIB; \
ENDLIB; \
"
);
"
);
fclose
(
file
);
fclose
(
file
);
}
}
int
main
()
int
main
()
{
{
printf
(
"------------------------------------------------------
\n
"
);
printf
(
"------------------------------------------------------
\n
"
);
printf
(
"
| Unit test of the KBool Engine |
\n
"
);
printf
(
"
| Unit test of the KBool Engine |
\n
"
);
printf
(
"------------------------------------------------------
\n
"
);
printf
(
"------------------------------------------------------
\n
"
);
float
correction
;
float
correction
;
char
a
=
'1'
;
char
a
=
'1'
;
while
(
a
!=
'0'
)
while
(
a
!=
'0'
)
{
{
Bool_Engine
*
booleng
=
new
Bool_Engine
();
Bool_Engine
*
booleng
=
new
Bool_Engine
();
ArmBoolEng
(
booleng
);
ArmBoolEng
(
booleng
);
AddPolygonsToBoolEng
(
booleng
);
AddPolygonsToBoolEng3
(
booleng
);
printf
(
"
\n
***********************************
\n
"
);
printf
(
"
\n
***********************************
\n
"
);
printf
(
"*** version: %s
\n
"
,
booleng
->
GetVersion
()
);
printf
(
"*** version: % s
\n
"
,
booleng
->
GetVersion
().
c_str
()
);
printf
(
"***********************************
\n
"
);
printf
(
"***********************************
\n
"
);
printf
(
"1: OR operation
\n
"
);
printf
(
"1: OR operation
\n
"
);
printf
(
"2: AND operation
\n
"
);
printf
(
"2: AND operation
\n
"
);
printf
(
"3: EXOR operation
\n
"
);
printf
(
"3: EXOR operation
\n
"
);
printf
(
"4: A subtract B
\n
"
);
printf
(
"4: A subtract B
\n
"
);
printf
(
"5: B subtract A
\n
"
);
printf
(
"5: B subtract A
\n
"
);
printf
(
"6: Correct each polygon with a factor
\n
"
);
printf
(
"6: Correct each polygon with a factor
\n
"
);
printf
(
"7: Smoothen each polygon
\n
"
);
printf
(
"7: Smoothen each polygon
\n
"
);
printf
(
"8: Make a ring around each polygon
\n
"
);
printf
(
"8: Make a ring around each polygon
\n
"
);
printf
(
"9: No operation
\n
"
);
printf
(
"9: No operation
\n
"
);
printf
(
"0: Quit
\n
"
);
printf
(
"0: Quit
\n
"
);
printf
(
"***********************************
\n
"
);
printf
(
"***********************************
\n
"
);
printf
(
"type a number and <return>"
);
printf
(
"type a number and <return>"
);
scanf
(
"%c"
,
&
a
);
scanf
(
"%c"
,
&
a
,
1
);
//scanf( " % c", &a );
switch
(
a
)
{
switch
(
a
)
case
(
'0'
):
{
break
;
case
(
'0'
):
case
(
'1'
):
{
booleng
->
Do_Operation
(
BOOL_OR
);
GetPolygonsFromBoolEng
(
booleng
);
break
;
break
;
case
(
'2'
):
}
booleng
->
Do_Operation
(
BOOL_AND
);
case
(
'1'
):
break
;
booleng
->
Do_Operation
(
BOOL_OR
);
case
(
'3'
):
break
;
booleng
->
Do_Operation
(
BOOL_EXOR
);
case
(
'2'
):
break
;
booleng
->
Do_Operation
(
BOOL_AND
);
case
(
'4'
):
break
;
booleng
->
Do_Operation
(
BOOL_A_SUB_B
);
case
(
'3'
):
break
;
booleng
->
Do_Operation
(
BOOL_EXOR
);
case
(
'5'
):
break
;
booleng
->
Do_Operation
(
BOOL_B_SUB_A
);
case
(
'4'
):
break
;
booleng
->
Do_Operation
(
BOOL_A_SUB_B
);
case
(
'6'
):
break
;
printf
(
"give correction factor (eg. 100.0 or -100.0)<return>:"
);
case
(
'5'
):
scanf
(
"%f"
,
&
correction
);
// correct the polygons by this number
booleng
->
Do_Operation
(
BOOL_B_SUB_A
);
booleng
->
SetCorrectionFactor
(
correction
);
break
;
booleng
->
Do_Operation
(
BOOL_CORRECTION
);
case
(
'6'
):
break
;
printf
(
"give correction factor ( eg. 100.0 or - 100.0 )<return>: "
);
case
(
'7'
):
scanf
(
" % f"
,
&
correction
);
// correct the polygons by this number
booleng
->
Do_Operation
(
BOOL_SMOOTHEN
);
booleng
->
SetCorrectionFactor
(
correction
);
break
;
booleng
->
Do_Operation
(
BOOL_CORRECTION
);
case
(
'8'
):
break
;
printf
(
"give width of ring <return>:"
);
case
(
'7'
):
scanf
(
"%f"
,
&
correction
);
booleng
->
Do_Operation
(
BOOL_SMOOTHEN
);
// create a ring of this size
break
;
booleng
->
SetCorrectionFactor
(
fabs
(
correction
/
2.0
)
);
case
(
'8'
):
booleng
->
Do_Operation
(
BOOL_MAKERING
);
printf
(
"give width of ring <return>: "
);
break
;
scanf
(
" % f"
,
&
correction
);
case
(
'9'
):
// create a ring of this size
break
;
booleng
->
SetCorrectionFactor
(
fabs
(
correction
/
2.0
)
);
default:
booleng
->
Do_Operation
(
BOOL_MAKERING
);
break
;
break
;
case
(
'9'
):
}
break
;
default:
if
(
a
!=
'0'
)
break
;
{
printf
(
"
\n
resulting polygons
\n
"
);
}
GetPolygonsFromBoolEng
(
booleng
);
if
(
a
!=
'0'
)
{
//OR USE THIS
printf
(
"
\n
resulting polygons
\n
"
);
//GetPolygonsFromBoolEngKEY( booleng );
GetPolygonsFromBoolEng
(
booleng
);
printf
(
"
\n\n
type a character and <return>"
);
scanf
(
"%c"
,
&
a
);
//OR USE THIS
}
//GetPolygonsFromBoolEngKEY( booleng );
delete
booleng
;
}
printf
(
"
\n\n
type a character and <return>"
);
scanf
(
" % c"
,
&
a
);
return
0
;
}
delete
booleng
;
}
return
0
;
}
}
polygon/kbool/samples/boolonly/boolonly.h
View file @
ef2e41e3
/*! \file kbool/samples/boolonly/boolonly.h
/*! \file kbool/samples/boolonly/boolonly.h
\author Probably Klaas Holwerda
\author Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence:
wxWidgets Licence
Licence:
see kboollicense.txt
RCS-ID: $Id: boolonly.h,v 1.5 200
5/05/24 19:13:38
titato Exp $
RCS-ID: $Id: boolonly.h,v 1.5 200
9/02/06 21:33:03
titato Exp $
*/
*/
#ifdef __GNUG__
#include "kbool/booleng.h"
#pragma implementation
#include "kbool/_lnk_itr.h"
#endif
#include "kbool/include/_lnk_itr.h"
#include "kbool/include/booleng.h"
class
KBoolPoint
class
KBoolPoint
{
{
public
:
public
:
KBoolPoint
();
KBoolPoint
();
KBoolPoint
(
double
const
,
double
const
);
KBoolPoint
(
double
const
,
double
const
);
double
GetX
();
double
GetX
();
double
GetY
();
double
GetY
();
private
:
private
:
double
_x
;
double
_x
;
double
_y
;
double
_y
;
};
};
polygon/kbool/samples/boolonly/boolonly.rc
View file @
ef2e41e3
mondrian ICON "sample.ico"
#include "wx/msw/wx.rc"
polygon/kbool/src/booleng.cpp
View file @
ef2e41e3
/*! \file src/booleng.cpp
/*! \file src/booleng.cpp
\author Klaas Holwerda
\author Klaas Holwerda
Copyright: 2001-2004 (C) Klaas Holwerda
Copyright: 2001-2004 (C) Klaas Holwerda
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: booleng.cpp,v 1.
3 2008/06/04 21:23:22
titato Exp $
RCS-ID: $Id: booleng.cpp,v 1.
5 2009/09/07 19:23:28
titato Exp $
*/
*/
#include "kbool/booleng.h"
#include "kbool/booleng.h"
...
@@ -38,19 +38,10 @@ B_INT babs( B_INT a )
...
@@ -38,19 +38,10 @@ B_INT babs( B_INT a )
//----------------- Bool_Engine_Error -------------------------------/
//----------------- Bool_Engine_Error -------------------------------/
//-------------------------------------------------------------------/
//-------------------------------------------------------------------/
Bool_Engine_Error
::
Bool_Engine_Error
(
const
char
*
message
,
const
char
*
header
,
int
degree
,
int
fatal
)
Bool_Engine_Error
::
Bool_Engine_Error
(
string
message
,
string
header
,
int
degree
,
int
fatal
)
{
{
_message
=
new
char
[
LINELENGTH
];
_message
=
message
;
_header
=
new
char
[
LINELENGTH
];
_header
=
header
;
if
(
message
)
strcpy
(
_message
,
message
);
else
strcpy
(
_message
,
"non specified"
);
if
(
header
)
strcpy
(
_header
,
header
);
else
strcpy
(
_header
,
"non specified"
);
_degree
=
degree
;
_degree
=
degree
;
_fatal
=
fatal
;
_fatal
=
fatal
;
...
@@ -59,17 +50,8 @@ Bool_Engine_Error::Bool_Engine_Error( const char* message, const char* header, i
...
@@ -59,17 +50,8 @@ Bool_Engine_Error::Bool_Engine_Error( const char* message, const char* header, i
Bool_Engine_Error
::
Bool_Engine_Error
(
const
Bool_Engine_Error
&
a
)
Bool_Engine_Error
::
Bool_Engine_Error
(
const
Bool_Engine_Error
&
a
)
{
{
_message
=
new
char
[
LINELENGTH
];
_message
=
a
.
_message
;
_header
=
new
char
[
LINELENGTH
];
_header
=
a
.
_header
;
if
(
a
.
_message
)
strcpy
(
_message
,
a
.
_message
);
else
strcpy
(
_message
,
"non specified"
);
if
(
a
.
_header
)
strcpy
(
_header
,
a
.
_header
);
else
strcpy
(
_header
,
"non specified"
);
_degree
=
a
.
_degree
;
_degree
=
a
.
_degree
;
_fatal
=
a
.
_fatal
;
_fatal
=
a
.
_fatal
;
...
@@ -78,18 +60,16 @@ Bool_Engine_Error::Bool_Engine_Error( const Bool_Engine_Error& a )
...
@@ -78,18 +60,16 @@ Bool_Engine_Error::Bool_Engine_Error( const Bool_Engine_Error& a )
Bool_Engine_Error
::~
Bool_Engine_Error
()
Bool_Engine_Error
::~
Bool_Engine_Error
()
{
{
strcpy
(
_message
,
""
);
_message
=
""
;
strcpy
(
_header
,
""
);
_header
=
""
;
delete
_message
;
delete
_header
;
}
}
char
*
Bool_Engine_Error
::
GetErrorMessage
()
string
Bool_Engine_Error
::
GetErrorMessage
()
{
{
return
_message
;
return
_message
;
}
}
char
*
Bool_Engine_Error
::
GetHeaderMessage
()
string
Bool_Engine_Error
::
GetHeaderMessage
()
{
{
return
_header
;
return
_header
;
}
}
...
@@ -110,13 +90,13 @@ int Bool_Engine_Error::GetFatal()
...
@@ -110,13 +90,13 @@ int Bool_Engine_Error::GetFatal()
Bool_Engine
::
Bool_Engine
()
Bool_Engine
::
Bool_Engine
()
{
{
_linkiter
=
new
TDLI
<
KBool
Link
>
();
_linkiter
=
new
TDLI
<
kb
Link
>
();
m_intersectionruns
=
1
;
m_intersectionruns
=
1
;
m_orientationEntryMode
=
false
;
m_orientationEntryMode
=
false
;
m_doLinkHoles
=
true
;
m_doLinkHoles
=
true
;
m_graphlist
=
new
GraphList
(
this
);
m_graphlist
=
new
kb
GraphList
(
this
);
m_ACCUR
=
1e-4
;
m_ACCUR
=
1e-4
;
m_WINDINGRULE
=
true
;
m_WINDINGRULE
=
true
;
m_GraphToAdd
=
NULL
;
m_GraphToAdd
=
NULL
;
...
@@ -173,19 +153,19 @@ void Bool_Engine::SetLog( bool OnOff )
...
@@ -173,19 +153,19 @@ void Bool_Engine::SetLog( bool OnOff )
}
}
}
}
void
Bool_Engine
::
SetState
(
const
char
*
process
)
void
Bool_Engine
::
SetState
(
string
process
)
{
{
Write_Log
(
process
);
Write_Log
(
process
);
}
}
void
Bool_Engine
::
error
(
const
char
*
text
,
const
char
*
title
)
void
Bool_Engine
::
error
(
string
text
,
string
title
)
{
{
Write_Log
(
"FATAL ERROR: "
,
title
);
Write_Log
(
"FATAL ERROR: "
,
title
);
Write_Log
(
"FATAL ERROR: "
,
text
);
Write_Log
(
"FATAL ERROR: "
,
text
);
throw
Bool_Engine_Error
(
" Fatal Error"
,
"Fatal Error"
,
9
,
1
);
throw
Bool_Engine_Error
(
" Fatal Error"
,
"Fatal Error"
,
9
,
1
);
};
};
void
Bool_Engine
::
info
(
const
char
*
text
,
const
char
*
title
)
void
Bool_Engine
::
info
(
string
text
,
string
title
)
{
{
Write_Log
(
"FATAL ERROR: "
,
title
);
Write_Log
(
"FATAL ERROR: "
,
title
);
Write_Log
(
"FATAL ERROR: "
,
text
);
Write_Log
(
"FATAL ERROR: "
,
text
);
...
@@ -331,7 +311,7 @@ bool Bool_Engine::Do_Operation( BOOL_OP operation )
...
@@ -331,7 +311,7 @@ bool Bool_Engine::Do_Operation( BOOL_OP operation )
{
{
#if KBOOL_DEBUG
#if KBOOL_DEBUG
GraphList
*
saveme
=
new
GraphList
(
m_graphlist
);
kbGraphList
*
saveme
=
new
kb
GraphList
(
m_graphlist
);
#endif
#endif
try
try
...
@@ -366,7 +346,7 @@ bool Bool_Engine::Do_Operation( BOOL_OP operation )
...
@@ -366,7 +346,7 @@ bool Bool_Engine::Do_Operation( BOOL_OP operation )
#if KBOOL_DEBUG
#if KBOOL_DEBUG
delete
m_graphlist
;
delete
m_graphlist
;
m_graphlist
=
new
GraphList
(
saveme
);
m_graphlist
=
new
kb
GraphList
(
saveme
);
m_graphlist
->
WriteGraphsKEY
(
this
);
m_graphlist
->
WriteGraphsKEY
(
this
);
#endif
#endif
...
@@ -384,7 +364,7 @@ bool Bool_Engine::Do_Operation( BOOL_OP operation )
...
@@ -384,7 +364,7 @@ bool Bool_Engine::Do_Operation( BOOL_OP operation )
#if KBOOL_DEBUG
#if KBOOL_DEBUG
delete
m_graphlist
;
delete
m_graphlist
;
m_graphlist
=
new
GraphList
(
saveme
);
m_graphlist
=
new
kb
GraphList
(
saveme
);
m_graphlist
->
WriteGraphsKEY
(
this
);
m_graphlist
->
WriteGraphsKEY
(
this
);
#endif
#endif
...
@@ -414,7 +394,7 @@ bool Bool_Engine::StartPolygonAdd( GroupType A_or_B )
...
@@ -414,7 +394,7 @@ bool Bool_Engine::StartPolygonAdd( GroupType A_or_B )
if
(
m_GraphToAdd
!=
NULL
)
if
(
m_GraphToAdd
!=
NULL
)
return
false
;
return
false
;
Graph
*
myGraph
=
new
Graph
(
this
);
kbGraph
*
myGraph
=
new
kb
Graph
(
this
);
m_graphlist
->
insbegin
(
myGraph
);
m_graphlist
->
insbegin
(
myGraph
);
m_GraphToAdd
=
myGraph
;
m_GraphToAdd
=
myGraph
;
m_groupType
=
A_or_B
;
m_groupType
=
A_or_B
;
...
@@ -437,7 +417,7 @@ bool Bool_Engine::AddPoint( double x, double y )
...
@@ -437,7 +417,7 @@ bool Bool_Engine::AddPoint( double x, double y )
B_INT
rintx
=
(
(
B_INT
)
(
x
*
m_DGRID
)
)
*
m_GRID
;
B_INT
rintx
=
(
(
B_INT
)
(
x
*
m_DGRID
)
)
*
m_GRID
;
B_INT
rinty
=
(
(
B_INT
)
(
y
*
m_DGRID
)
)
*
m_GRID
;
B_INT
rinty
=
(
(
B_INT
)
(
y
*
m_DGRID
)
)
*
m_GRID
;
Node
*
myNode
=
new
Node
(
rintx
,
rinty
,
this
);
kbNode
*
myNode
=
new
kb
Node
(
rintx
,
rinty
,
this
);
// adding first point to graph
// adding first point to graph
if
(
m_firstNodeToAdd
==
NULL
)
if
(
m_firstNodeToAdd
==
NULL
)
...
@@ -451,8 +431,8 @@ bool Bool_Engine::AddPoint( double x, double y )
...
@@ -451,8 +431,8 @@ bool Bool_Engine::AddPoint( double x, double y )
}
}
#endif
#endif
m_firstNodeToAdd
=
(
Node
*
)
myNode
;
m_firstNodeToAdd
=
(
kb
Node
*
)
myNode
;
m_lastNodeToAdd
=
(
Node
*
)
myNode
;
m_lastNodeToAdd
=
(
kb
Node
*
)
myNode
;
}
}
else
else
{
{
...
@@ -466,7 +446,7 @@ bool Bool_Engine::AddPoint( double x, double y )
...
@@ -466,7 +446,7 @@ bool Bool_Engine::AddPoint( double x, double y )
#endif
#endif
m_GraphToAdd
->
AddLink
(
m_lastNodeToAdd
,
myNode
);
m_GraphToAdd
->
AddLink
(
m_lastNodeToAdd
,
myNode
);
m_lastNodeToAdd
=
(
Node
*
)
myNode
;
m_lastNodeToAdd
=
(
kb
Node
*
)
myNode
;
}
}
return
true
;
return
true
;
...
@@ -489,7 +469,7 @@ bool Bool_Engine::StartPolygonGet()
...
@@ -489,7 +469,7 @@ bool Bool_Engine::StartPolygonGet()
{
{
if
(
!
m_graphlist
->
empty
()
)
if
(
!
m_graphlist
->
empty
()
)
{
{
m_getGraph
=
(
Graph
*
)
m_graphlist
->
headitem
();
m_getGraph
=
(
kb
Graph
*
)
m_graphlist
->
headitem
();
m_getLink
=
m_getGraph
->
GetFirstLink
();
m_getLink
=
m_getGraph
->
GetFirstLink
();
m_getNode
=
m_getLink
->
GetBeginNode
();
m_getNode
=
m_getLink
->
GetBeginNode
();
m_numPtsInPolygon
=
m_getGraph
->
GetNumberOfLinks
();
m_numPtsInPolygon
=
m_getGraph
->
GetNumberOfLinks
();
...
@@ -571,34 +551,34 @@ kbEdgeType Bool_Engine::GetPolygonPointEdgeType()
...
@@ -571,34 +551,34 @@ kbEdgeType Bool_Engine::GetPolygonPointEdgeType()
}
}
void
Bool_Engine
::
Write_Log
(
const
char
*
msg1
)
void
Bool_Engine
::
Write_Log
(
string
msg1
)
{
{
if
(
m_logfile
==
NULL
)
if
(
m_logfile
==
NULL
)
return
;
return
;
fprintf
(
m_logfile
,
"%s
\n
"
,
msg1
);
fprintf
(
m_logfile
,
"%s
\n
"
,
msg1
.
c_str
()
);
}
}
void
Bool_Engine
::
Write_Log
(
const
char
*
msg1
,
const
char
*
msg2
)
void
Bool_Engine
::
Write_Log
(
string
msg1
,
string
msg2
)
{
{
if
(
m_logfile
==
NULL
)
if
(
m_logfile
==
NULL
)
return
;
return
;
fprintf
(
m_logfile
,
"%s %s
\n
"
,
msg1
,
msg2
);
fprintf
(
m_logfile
,
"%s %s
\n
"
,
msg1
.
c_str
(),
msg2
.
c_str
()
);
}
}
void
Bool_Engine
::
Write_Log
(
const
char
*
fmt
,
double
dval
)
void
Bool_Engine
::
Write_Log
(
string
fmt
,
double
dval
)
{
{
if
(
m_logfile
==
NULL
)
if
(
m_logfile
==
NULL
)
return
;
return
;
fprintf
(
m_logfile
,
fmt
,
dval
);
fprintf
(
m_logfile
,
fmt
.
c_str
()
,
dval
);
}
}
void
Bool_Engine
::
Write_Log
(
const
char
*
fmt
,
B_INT
bval
)
void
Bool_Engine
::
Write_Log
(
string
fmt
,
B_INT
bval
)
{
{
if
(
m_logfile
==
NULL
)
if
(
m_logfile
==
NULL
)
return
;
return
;
fprintf
(
m_logfile
,
fmt
,
bval
);
fprintf
(
m_logfile
,
fmt
.
c_str
()
,
bval
);
}
}
polygon/kbool/src/graph.cpp
View file @
ef2e41e3
/*! \file src/graph.cpp
/*! \file src/graph.cpp
\brief Used to Intercect and other process functions
\brief Used to Intercect and other process functions
\author Klaas Holwerda
\author Klaas Holwerda
Copyright: 2001-2004 (C) Klaas Holwerda
Copyright: 2001-2004 (C) Klaas Holwerda
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: graph.cpp,v 1.
3 2008/06/04 21:23:22
titato Exp $
RCS-ID: $Id: graph.cpp,v 1.
4 2009/09/07 19:23:28
titato Exp $
*/
*/
// Grpah is the structure used to store polygons
// Grpah is the structure used to store polygons
...
@@ -17,15 +17,15 @@
...
@@ -17,15 +17,15 @@
#include "kbool/node.h"
#include "kbool/node.h"
// Prototype of function
// Prototype of function
int
linkXYsorter
(
KBoolLink
*
,
KBool
Link
*
);
int
linkXYsorter
(
kbLink
*
,
kb
Link
*
);
int
linkYXsorter
(
KBoolLink
*
,
KBool
Link
*
);
int
linkYXsorter
(
kbLink
*
,
kb
Link
*
);
int
linkLsorter
(
KBoolLink
*
,
KBool
Link
*
);
int
linkLsorter
(
kbLink
*
,
kb
Link
*
);
int
linkYXtopsorter
(
KBoolLink
*
a
,
KBool
Link
*
b
);
int
linkYXtopsorter
(
kbLink
*
a
,
kb
Link
*
b
);
int
linkGraphNumsorter
(
KBoolLink
*
_l1
,
KBool
Link
*
_l2
);
int
linkGraphNumsorter
(
kbLink
*
_l1
,
kb
Link
*
_l2
);
// constructor, initialize with one link
// constructor, initialize with one link
// usage:
Graph *a_graph = new
Graph(a_link);
// usage:
kbGraph *a_graph = new kb
Graph(a_link);
Graph
::
Graph
(
KBool
Link
*
a_link
,
Bool_Engine
*
GC
)
kbGraph
::
kbGraph
(
kb
Link
*
a_link
,
Bool_Engine
*
GC
)
{
{
_GC
=
GC
;
_GC
=
GC
;
_linklist
=
new
DL_List
<
void
*>
();
_linklist
=
new
DL_List
<
void
*>
();
...
@@ -37,26 +37,26 @@ Graph::Graph( KBoolLink *a_link, Bool_Engine* GC )
...
@@ -37,26 +37,26 @@ Graph::Graph( KBoolLink *a_link, Bool_Engine* GC )
// constructor, initialize graph with no contents
// constructor, initialize graph with no contents
// usage:
Graph *a_graph = new
Graph();
// usage:
kbGraph *a_graph = new kb
Graph();
Graph
::
Graph
(
Bool_Engine
*
GC
)
kbGraph
::
kb
Graph
(
Bool_Engine
*
GC
)
{
{
_GC
=
GC
;
_GC
=
GC
;
_linklist
=
new
DL_List
<
void
*>
();
_linklist
=
new
DL_List
<
void
*>
();
_bin
=
false
;
_bin
=
false
;
}
}
Graph
::
Graph
(
Graph
*
other
)
kbGraph
::
kbGraph
(
kb
Graph
*
other
)
{
{
_GC
=
other
->
_GC
;
_GC
=
other
->
_GC
;
_linklist
=
new
DL_List
<
void
*>
();
_linklist
=
new
DL_List
<
void
*>
();
_bin
=
false
;
_bin
=
false
;
int
_nr_of_points
=
other
->
_linklist
->
count
();
int
_nr_of_points
=
other
->
_linklist
->
count
();
KBool
Link
*
_current
=
other
->
GetFirstLink
();
kb
Link
*
_current
=
other
->
GetFirstLink
();
Node
*
_last
=
_current
->
GetBeginNode
();
kb
Node
*
_last
=
_current
->
GetBeginNode
();
Node
*
node
=
new
Node
(
_current
->
GetBeginNode
()
->
GetX
(),
_current
->
GetBeginNode
()
->
GetY
(),
_GC
);
kbNode
*
node
=
new
kb
Node
(
_current
->
GetBeginNode
()
->
GetX
(),
_current
->
GetBeginNode
()
->
GetY
(),
_GC
);
Node
*
nodefirst
=
node
;
kb
Node
*
nodefirst
=
node
;
for
(
int
i
=
0
;
i
<
_nr_of_points
;
i
++
)
for
(
int
i
=
0
;
i
<
_nr_of_points
;
i
++
)
{
{
// get the other node on the link
// get the other node on the link
...
@@ -64,19 +64,19 @@ Graph::Graph( Graph* other )
...
@@ -64,19 +64,19 @@ Graph::Graph( Graph* other )
// get the other link on the _last node
// get the other link on the _last node
_current
=
_current
->
Forth
(
_last
);
_current
=
_current
->
Forth
(
_last
);
Node
*
node2
=
new
Node
(
_current
->
GetBeginNode
()
->
GetX
(),
_current
->
GetBeginNode
()
->
GetY
(),
_GC
);
kbNode
*
node2
=
new
kb
Node
(
_current
->
GetBeginNode
()
->
GetX
(),
_current
->
GetBeginNode
()
->
GetY
(),
_GC
);
_linklist
->
insend
(
new
KBool
Link
(
node
,
node2
,
_GC
)
);
_linklist
->
insend
(
new
kb
Link
(
node
,
node2
,
_GC
)
);
node
=
node2
;
node
=
node2
;
}
}
_linklist
->
insend
(
new
KBool
Link
(
node
,
nodefirst
,
_GC
)
);
_linklist
->
insend
(
new
kb
Link
(
node
,
nodefirst
,
_GC
)
);
}
}
// destructor
// destructor
// deletes all object of the linklist
// deletes all object of the linklist
Graph
::~
Graph
()
kbGraph
::~
kb
Graph
()
{
{
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
//first empty the graph
//first empty the graph
_LI
.
delete_all
();
_LI
.
delete_all
();
...
@@ -85,13 +85,13 @@ Graph::~Graph()
...
@@ -85,13 +85,13 @@ Graph::~Graph()
delete
_linklist
;
delete
_linklist
;
}
}
KBoolLink
*
Graph
::
GetFirstLink
()
kbLink
*
kb
Graph
::
GetFirstLink
()
{
{
return
(
KBool
Link
*
)
_linklist
->
headitem
();
return
(
kb
Link
*
)
_linklist
->
headitem
();
};
};
void
Graph
::
Prepare
(
int
intersectionruns
)
void
kb
Graph
::
Prepare
(
int
intersectionruns
)
{
{
_GC
->
SetState
(
"Intersection"
);
_GC
->
SetState
(
"Intersection"
);
...
@@ -107,8 +107,8 @@ void Graph::Prepare( int intersectionruns )
...
@@ -107,8 +107,8 @@ void Graph::Prepare( int intersectionruns )
// Round(_GC->Get_Grid());
// Round(_GC->Get_Grid());
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
foreach_mf
(
&
KBool
Link
::
UnMark
);
// Reset Bin and Mark flag
_LI
.
foreach_mf
(
&
kb
Link
::
UnMark
);
// Reset Bin and Mark flag
}
}
_GC
->
SetState
(
"Set group A/B Flags"
);
_GC
->
SetState
(
"Set group A/B Flags"
);
...
@@ -127,7 +127,7 @@ void Graph::Prepare( int intersectionruns )
...
@@ -127,7 +127,7 @@ void Graph::Prepare( int intersectionruns )
_GC
->
SetState
(
"Remove doubles"
);
_GC
->
SetState
(
"Remove doubles"
);
// Remove the marked links
// Remove the marked links
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -152,9 +152,9 @@ void Graph::Prepare( int intersectionruns )
...
@@ -152,9 +152,9 @@ void Graph::Prepare( int intersectionruns )
// x and y of the point will be rounded to the nearest
// x and y of the point will be rounded to the nearest
// xnew=N*grid and ynew=N*grid
// xnew=N*grid and ynew=N*grid
void
Graph
::
RoundInt
(
B_INT
grid
)
void
kb
Graph
::
RoundInt
(
B_INT
grid
)
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -165,16 +165,16 @@ void Graph::RoundInt( B_INT grid )
...
@@ -165,16 +165,16 @@ void Graph::RoundInt( B_INT grid )
}
}
// rotate graph minus 90 degrees or plus 90 degrees
// rotate graph minus 90 degrees or plus 90 degrees
void
Graph
::
Rotate
(
bool
plus90
)
void
kb
Graph
::
Rotate
(
bool
plus90
)
{
{
B_INT
swap
;
B_INT
swap
;
Node
*
last
=
NULL
;
kb
Node
*
last
=
NULL
;
B_INT
neg
=
-
1
;
B_INT
neg
=
-
1
;
if
(
plus90
)
if
(
plus90
)
neg
=
1
;
neg
=
1
;
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
mergesort
(
linkXYsorter
);
_LI
.
mergesort
(
linkXYsorter
);
_LI
.
tohead
();
_LI
.
tohead
();
...
@@ -191,11 +191,11 @@ void Graph::Rotate( bool plus90 )
...
@@ -191,11 +191,11 @@ void Graph::Rotate( bool plus90 )
}
}
}
}
bool
Graph
::
RemoveNullLinks
()
bool
kb
Graph
::
RemoveNullLinks
()
{
{
bool
graph_is_modified
=
false
;
bool
graph_is_modified
=
false
;
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -214,7 +214,7 @@ bool Graph::RemoveNullLinks()
...
@@ -214,7 +214,7 @@ bool Graph::RemoveNullLinks()
// Add a link to the graph connection with
// Add a link to the graph connection with
// other links is through the link his nodes
// other links is through the link his nodes
void
Graph
::
AddLink
(
KBool
Link
*
a_link
)
void
kbGraph
::
AddLink
(
kb
Link
*
a_link
)
{
{
assert
(
a_link
);
assert
(
a_link
);
...
@@ -224,20 +224,20 @@ void Graph::AddLink( KBoolLink *a_link )
...
@@ -224,20 +224,20 @@ void Graph::AddLink( KBoolLink *a_link )
// Add a link to the graph, by giving it two nodes
// Add a link to the graph, by giving it two nodes
// the link is then made and added to the graph
// the link is then made and added to the graph
void
Graph
::
AddLink
(
Node
*
begin
,
Node
*
end
)
void
kbGraph
::
AddLink
(
kbNode
*
begin
,
kb
Node
*
end
)
{
{
assert
(
begin
&&
end
);
assert
(
begin
&&
end
);
assert
(
begin
!=
end
);
assert
(
begin
!=
end
);
AddLink
(
new
KBool
Link
(
0
,
begin
,
end
,
_GC
)
);
AddLink
(
new
kb
Link
(
0
,
begin
,
end
,
_GC
)
);
}
}
// Checks if there is a zeroline in the graph
// Checks if there is a zeroline in the graph
bool
Graph
::
AreZeroLines
(
B_INT
Marge
)
bool
kb
Graph
::
AreZeroLines
(
B_INT
Marge
)
{
{
bool
Found_it
=
false
;
bool
Found_it
=
false
;
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -253,9 +253,9 @@ bool Graph::AreZeroLines( B_INT Marge )
...
@@ -253,9 +253,9 @@ bool Graph::AreZeroLines( B_INT Marge )
// Delete links that do not fit the condition for given operation
// Delete links that do not fit the condition for given operation
void
Graph
::
DeleteNonCond
(
BOOL_OP
operation
)
void
kb
Graph
::
DeleteNonCond
(
BOOL_OP
operation
)
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -269,9 +269,9 @@ void Graph::DeleteNonCond( BOOL_OP operation )
...
@@ -269,9 +269,9 @@ void Graph::DeleteNonCond( BOOL_OP operation )
}
}
}
}
void
Graph
::
HandleNonCond
(
BOOL_OP
operation
)
void
kb
Graph
::
HandleNonCond
(
BOOL_OP
operation
)
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -289,11 +289,11 @@ void Graph::HandleNonCond( BOOL_OP operation )
...
@@ -289,11 +289,11 @@ void Graph::HandleNonCond( BOOL_OP operation )
// input : a marge, standard on _GC->Get_Marge()
// input : a marge, standard on _GC->Get_Marge()
// return: true if lines in the graph are deleted
// return: true if lines in the graph are deleted
// : false if no lines in the graph are deleted
// : false if no lines in the graph are deleted
bool
Graph
::
DeleteZeroLines
(
B_INT
Marge
)
bool
kb
Graph
::
DeleteZeroLines
(
B_INT
Marge
)
{
{
// Is the graph modified ?
// Is the graph modified ?
bool
Is_Modified
=
false
;
bool
Is_Modified
=
false
;
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
int
Processed
=
_LI
.
count
();
int
Processed
=
_LI
.
count
();
...
@@ -333,14 +333,14 @@ bool Graph::DeleteZeroLines( B_INT Marge )
...
@@ -333,14 +333,14 @@ bool Graph::DeleteZeroLines( B_INT Marge )
// for instance a top link of a hole that is horizontal, always
// for instance a top link of a hole that is horizontal, always
// is IN above the link and OUT underneath the link.
// is IN above the link and OUT underneath the link.
// this for a non hole the opposite
// this for a non hole the opposite
void
Graph
::
CollectGraph
(
Node
*
current_node
,
BOOL_OP
operation
,
bool
detecthole
,
int
graphnumber
,
bool
&
foundholes
)
void
kbGraph
::
CollectGraph
(
kb
Node
*
current_node
,
BOOL_OP
operation
,
bool
detecthole
,
int
graphnumber
,
bool
&
foundholes
)
{
{
KBool
Link
*
currentlink
;
kb
Link
*
currentlink
;
KBool
Link
*
nextlink
;
kb
Link
*
nextlink
;
Node
*
next_node
;
kb
Node
*
next_node
;
Node
*
MyFirst
;
kb
Node
*
MyFirst
;
Node
*
Unlinked
;
kb
Node
*
Unlinked
;
KBool
Link
*
MyFirstlink
;
kb
Link
*
MyFirstlink
;
bool
Hole
;
bool
Hole
;
LinkStatus
whatside
;
LinkStatus
whatside
;
...
@@ -435,7 +435,7 @@ void Graph::CollectGraph( Node *current_node, BOOL_OP operation, bool detecthole
...
@@ -435,7 +435,7 @@ void Graph::CollectGraph( Node *current_node, BOOL_OP operation, bool detecthole
if
(
current_node
->
GetNumberOfLinks
()
>
2
)
if
(
current_node
->
GetNumberOfLinks
()
>
2
)
{
// replace endnode of currentlink and beginnode of nextlink with new node
{
// replace endnode of currentlink and beginnode of nextlink with new node
Unlinked
=
new
Node
(
current_node
,
_GC
);
Unlinked
=
new
kb
Node
(
current_node
,
_GC
);
currentlink
->
Replace
(
current_node
,
Unlinked
);
currentlink
->
Replace
(
current_node
,
Unlinked
);
nextlink
->
Replace
(
current_node
,
Unlinked
);
nextlink
->
Replace
(
current_node
,
Unlinked
);
}
}
...
@@ -449,7 +449,7 @@ void Graph::CollectGraph( Node *current_node, BOOL_OP operation, bool detecthole
...
@@ -449,7 +449,7 @@ void Graph::CollectGraph( Node *current_node, BOOL_OP operation, bool detecthole
//close the found graph properly
//close the found graph properly
if
(
current_node
->
GetNumberOfLinks
()
>
2
)
if
(
current_node
->
GetNumberOfLinks
()
>
2
)
{
// replace endnode of currentlink and beginnode of nextlink with new node
{
// replace endnode of currentlink and beginnode of nextlink with new node
Unlinked
=
new
Node
(
current_node
,
_GC
);
Unlinked
=
new
kb
Node
(
current_node
,
_GC
);
currentlink
->
Replace
(
current_node
,
Unlinked
);
currentlink
->
Replace
(
current_node
,
Unlinked
);
MyFirstlink
->
Replace
(
current_node
,
Unlinked
);
MyFirstlink
->
Replace
(
current_node
,
Unlinked
);
}
}
...
@@ -465,14 +465,14 @@ void Graph::CollectGraph( Node *current_node, BOOL_OP operation, bool detecthole
...
@@ -465,14 +465,14 @@ void Graph::CollectGraph( Node *current_node, BOOL_OP operation, bool detecthole
}
}
}
}
void
Graph
::
CollectGraphLast
(
Node
*
current_node
,
BOOL_OP
operation
,
bool
detecthole
,
int
graphnumber
,
bool
&
foundholes
)
void
kbGraph
::
CollectGraphLast
(
kb
Node
*
current_node
,
BOOL_OP
operation
,
bool
detecthole
,
int
graphnumber
,
bool
&
foundholes
)
{
{
KBool
Link
*
currentlink
;
kb
Link
*
currentlink
;
KBool
Link
*
nextlink
;
kb
Link
*
nextlink
;
Node
*
next_node
;
kb
Node
*
next_node
;
Node
*
MyFirst
;
kb
Node
*
MyFirst
;
Node
*
Unlinked
;
kb
Node
*
Unlinked
;
KBool
Link
*
MyFirstlink
;
kb
Link
*
MyFirstlink
;
bool
Hole
;
bool
Hole
;
LinkStatus
whatside
;
LinkStatus
whatside
;
...
@@ -609,7 +609,7 @@ void Graph::CollectGraphLast( Node *current_node, BOOL_OP operation, bool detect
...
@@ -609,7 +609,7 @@ void Graph::CollectGraphLast( Node *current_node, BOOL_OP operation, bool detect
if
(
current_node
->
GetNumberOfLinks
()
>
2
)
if
(
current_node
->
GetNumberOfLinks
()
>
2
)
{
// replace endnode of currentlink and beginnode of nextlink with new node
{
// replace endnode of currentlink and beginnode of nextlink with new node
Unlinked
=
new
Node
(
current_node
,
_GC
);
Unlinked
=
new
kb
Node
(
current_node
,
_GC
);
currentlink
->
Replace
(
current_node
,
Unlinked
);
currentlink
->
Replace
(
current_node
,
Unlinked
);
nextlink
->
Replace
(
current_node
,
Unlinked
);
nextlink
->
Replace
(
current_node
,
Unlinked
);
}
}
...
@@ -621,7 +621,7 @@ void Graph::CollectGraphLast( Node *current_node, BOOL_OP operation, bool detect
...
@@ -621,7 +621,7 @@ void Graph::CollectGraphLast( Node *current_node, BOOL_OP operation, bool detect
//close the found graph properly
//close the found graph properly
if
(
current_node
->
GetNumberOfLinks
()
>
2
)
if
(
current_node
->
GetNumberOfLinks
()
>
2
)
{
// replace endnode of currentlink and beginnode of nextlink with new node
{
// replace endnode of currentlink and beginnode of nextlink with new node
Unlinked
=
new
Node
(
current_node
,
_GC
);
Unlinked
=
new
kb
Node
(
current_node
,
_GC
);
currentlink
->
Replace
(
current_node
,
Unlinked
);
currentlink
->
Replace
(
current_node
,
Unlinked
);
MyFirstlink
->
Replace
(
current_node
,
Unlinked
);
MyFirstlink
->
Replace
(
current_node
,
Unlinked
);
}
}
...
@@ -641,11 +641,11 @@ void Graph::CollectGraphLast( Node *current_node, BOOL_OP operation, bool detect
...
@@ -641,11 +641,11 @@ void Graph::CollectGraphLast( Node *current_node, BOOL_OP operation, bool detect
// Extract bi-directional graphs from this graph
// Extract bi-directional graphs from this graph
// Mark the graphs also as being a hole or not.
// Mark the graphs also as being a hole or not.
void
Graph
::
Extract_Simples
(
BOOL_OP
operation
,
bool
detecthole
,
bool
&
foundholes
)
void
kb
Graph
::
Extract_Simples
(
BOOL_OP
operation
,
bool
detecthole
,
bool
&
foundholes
)
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
if
(
_LI
.
empty
()
)
return
;
if
(
_LI
.
empty
()
)
return
;
Node
*
begin
;
kb
Node
*
begin
;
int
graphnumber
=
1
;
int
graphnumber
=
1
;
_LI
.
mergesort
(
linkYXtopsorter
);
_LI
.
mergesort
(
linkYXtopsorter
);
...
@@ -674,12 +674,12 @@ void Graph::Extract_Simples( BOOL_OP operation, bool detecthole, bool& foundhole
...
@@ -674,12 +674,12 @@ void Graph::Extract_Simples( BOOL_OP operation, bool detecthole, bool& foundhole
}
}
}
}
void
Graph
::
Split
(
GraphList
*
partlist
)
void
kbGraph
::
Split
(
kb
GraphList
*
partlist
)
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
if
(
_LI
.
empty
()
)
return
;
if
(
_LI
.
empty
()
)
return
;
Graph
*
part
=
NULL
;
kb
Graph
*
part
=
NULL
;
int
graphnumber
=
0
;
int
graphnumber
=
0
;
//sort the graph on graphnumber
//sort the graph on graphnumber
...
@@ -691,10 +691,10 @@ void Graph::Split( GraphList* partlist )
...
@@ -691,10 +691,10 @@ void Graph::Split( GraphList* partlist )
if
(
_LI
.
item
()
->
GetGraphNum
()
>
0
&&
graphnumber
!=
_LI
.
item
()
->
GetGraphNum
()
)
if
(
_LI
.
item
()
->
GetGraphNum
()
>
0
&&
graphnumber
!=
_LI
.
item
()
->
GetGraphNum
()
)
{
{
graphnumber
=
_LI
.
item
()
->
GetGraphNum
();
graphnumber
=
_LI
.
item
()
->
GetGraphNum
();
part
=
new
Graph
(
_GC
);
part
=
new
kb
Graph
(
_GC
);
partlist
->
insend
(
part
);
partlist
->
insend
(
part
);
}
}
KBool
Link
*
tmp
=
_LI
.
item
();
kb
Link
*
tmp
=
_LI
.
item
();
if
(
_LI
.
item
()
->
GetGraphNum
()
>
0
)
if
(
_LI
.
item
()
->
GetGraphNum
()
>
0
)
{
{
part
->
AddLink
(
tmp
);
part
->
AddLink
(
tmp
);
...
@@ -707,23 +707,23 @@ void Graph::Split( GraphList* partlist )
...
@@ -707,23 +707,23 @@ void Graph::Split( GraphList* partlist )
}
}
}
}
bool
Graph
::
GetBeenHere
()
bool
kb
Graph
::
GetBeenHere
()
{
{
return
_bin
;
return
_bin
;
}
}
// return total number of links in this graph
// return total number of links in this graph
int
Graph
::
GetNumberOfLinks
()
int
kb
Graph
::
GetNumberOfLinks
()
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
return
_LI
.
count
();
return
_LI
.
count
();
}
}
//for all operations set the operation flags for the links
//for all operations set the operation flags for the links
//based on the Group_Left_Right values
//based on the Group_Left_Right values
void
Graph
::
Set_Operation_Flags
()
void
kb
Graph
::
Set_Operation_Flags
()
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -733,9 +733,9 @@ void Graph::Set_Operation_Flags()
...
@@ -733,9 +733,9 @@ void Graph::Set_Operation_Flags()
}
}
// Remove unused (those not used for any operation) links
// Remove unused (those not used for any operation) links
void
Graph
::
Remove_IN_Links
()
void
kb
Graph
::
Remove_IN_Links
()
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
for
(
int
t
=
_LI
.
count
()
;
t
>
0
;
t
--
)
for
(
int
t
=
_LI
.
count
()
;
t
>
0
;
t
--
)
{
{
...
@@ -750,17 +750,17 @@ void Graph::Remove_IN_Links()
...
@@ -750,17 +750,17 @@ void Graph::Remove_IN_Links()
}
}
}
}
void
Graph
::
ResetBinMark
()
void
kb
Graph
::
ResetBinMark
()
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
if
(
_LI
.
empty
()
)
return
;
if
(
_LI
.
empty
()
)
return
;
_LI
.
foreach_mf
(
&
KBool
Link
::
UnMark
);
//reset bin and mark flag of each link
_LI
.
foreach_mf
(
&
kb
Link
::
UnMark
);
//reset bin and mark flag of each link
}
}
void
Graph
::
ReverseAllLinks
()
void
kb
Graph
::
ReverseAllLinks
()
{
{
Node
*
dummy
;
kb
Node
*
dummy
;
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -772,29 +772,29 @@ void Graph::ReverseAllLinks()
...
@@ -772,29 +772,29 @@ void Graph::ReverseAllLinks()
}
}
}
}
void
Graph
::
SetBeenHere
(
bool
value
)
void
kb
Graph
::
SetBeenHere
(
bool
value
)
{
{
_bin
=
value
;
_bin
=
value
;
}
}
// ReSet the flags of the links
// ReSet the flags of the links
void
Graph
::
Reset_flags
()
void
kb
Graph
::
Reset_flags
()
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
foreach_mf
(
&
KBool
Link
::
Reset_flags
);
_LI
.
foreach_mf
(
&
kb
Link
::
Reset_flags
);
}
}
// ReSet the bin and mark flag of the links
// ReSet the bin and mark flag of the links
void
Graph
::
Reset_Mark_and_Bin
()
void
kb
Graph
::
Reset_Mark_and_Bin
()
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
foreach_mf
(
&
KBool
Link
::
UnMark
);
//reset bin and mark flag of each link
_LI
.
foreach_mf
(
&
kb
Link
::
UnMark
);
//reset bin and mark flag of each link
}
}
// Set the group of the links to the same as newgroup
// Set the group of the links to the same as newgroup
void
Graph
::
SetGroup
(
GroupType
newgroup
)
void
kb
Graph
::
SetGroup
(
GroupType
newgroup
)
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -805,9 +805,9 @@ void Graph::SetGroup( GroupType newgroup )
...
@@ -805,9 +805,9 @@ void Graph::SetGroup( GroupType newgroup )
// Set the number of the links to the same as newnr
// Set the number of the links to the same as newnr
void
Graph
::
SetNumber
(
const
int
newnr
)
void
kb
Graph
::
SetNumber
(
const
int
newnr
)
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -827,13 +827,13 @@ void Graph::SetNumber( const int newnr )
...
@@ -827,13 +827,13 @@ void Graph::SetNumber( const int newnr )
// input : a marge
// input : a marge
// return: true if graph is modified
// return: true if graph is modified
// : false if graph is NOT simplified
// : false if graph is NOT simplified
bool
Graph
::
Simplify
(
B_INT
Marge
)
bool
kb
Graph
::
Simplify
(
B_INT
Marge
)
{
{
bool
graph_is_modified
=
false
;
bool
graph_is_modified
=
false
;
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
int
Processed
=
_LI
.
count
();
int
Processed
=
_LI
.
count
();
_LI
.
foreach_mf
(
&
KBool
Link
::
UnMark
);
//reset bin and mark flag of each link
_LI
.
foreach_mf
(
&
kb
Link
::
UnMark
);
//reset bin and mark flag of each link
_LI
.
tohead
();
_LI
.
tohead
();
GroupType
mygroup
=
_LI
.
item
()
->
Group
();
GroupType
mygroup
=
_LI
.
item
()
->
Group
();
...
@@ -873,8 +873,8 @@ bool Graph::Simplify( B_INT Marge )
...
@@ -873,8 +873,8 @@ bool Graph::Simplify( B_INT Marge )
{
{
// Line is not marked, not zero, so maybe it can be simplified
// Line is not marked, not zero, so maybe it can be simplified
bool
virtual_link_is_modified
;
bool
virtual_link_is_modified
;
Node
*
new_begin
,
*
new_end
,
*
a_node
;
kb
Node
*
new_begin
,
*
new_end
,
*
a_node
;
KBool
Link
*
a_link
;
kb
Link
*
a_link
;
_LI
.
item
()
->
Mark
();
_LI
.
item
()
->
Mark
();
new_begin
=
_LI
.
item
()
->
GetBeginNode
();
new_begin
=
_LI
.
item
()
->
GetBeginNode
();
...
@@ -922,7 +922,7 @@ bool Graph::Simplify( B_INT Marge )
...
@@ -922,7 +922,7 @@ bool Graph::Simplify( B_INT Marge )
if
(
_LI
.
hitroot
()
)
if
(
_LI
.
hitroot
()
)
_LI
.
tohead
();
_LI
.
tohead
();
KBoolLink
*
newlink
=
new
KBool
Link
(
number
,
new_begin
,
new_end
,
_GC
);
kbLink
*
newlink
=
new
kb
Link
(
number
,
new_begin
,
new_end
,
_GC
);
newlink
->
SetGroup
(
mygroup
);
newlink
->
SetGroup
(
mygroup
);
_LI
.
insend
(
newlink
);
_LI
.
insend
(
newlink
);
...
@@ -1001,19 +1001,19 @@ bool Graph::Simplify( B_INT Marge )
...
@@ -1001,19 +1001,19 @@ bool Graph::Simplify( B_INT Marge )
// -1 L1 > L2
// -1 L1 > L2
//
//
*/
*/
bool
Graph
::
Smoothen
(
B_INT
Marge
)
bool
kb
Graph
::
Smoothen
(
B_INT
Marge
)
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
if
(
_LI
.
count
()
<=
3
)
// Don't modify it
if
(
_LI
.
count
()
<=
3
)
// Don't modify it
return
false
;
return
false
;
Node
*
Z
,
*
A
,
*
B
,
*
C
,
*
cross_node
=
new
Node
(
_GC
);
kbNode
*
Z
,
*
A
,
*
B
,
*
C
,
*
cross_node
=
new
kb
Node
(
_GC
);
KBool
Link
*
prevlink
,
*
nextlink
,
*
thislink
;
kb
Link
*
prevlink
,
*
nextlink
,
*
thislink
;
KBool
Line
prevline
(
_GC
),
nextline
(
_GC
),
thisline
(
_GC
);
kb
Line
prevline
(
_GC
),
nextline
(
_GC
),
thisline
(
_GC
);
KBool
Line
prevhelp
(
_GC
),
nexthelp
(
_GC
);
kb
Line
prevhelp
(
_GC
),
nexthelp
(
_GC
);
KBoolLink
LZB
(
new
Node
(
_GC
),
new
Node
(
_GC
),
_GC
),
kbLink
LZB
(
new
kbNode
(
_GC
),
new
kb
Node
(
_GC
),
_GC
),
LAC
(
new
Node
(
_GC
),
new
Node
(
_GC
),
_GC
);
LAC
(
new
kbNode
(
_GC
),
new
kb
Node
(
_GC
),
_GC
);
double
distance
=
0
;
double
distance
=
0
;
double
prevdist
,
nextdist
;
double
prevdist
,
nextdist
;
...
@@ -1258,19 +1258,19 @@ bool Graph::Smoothen( B_INT Marge )
...
@@ -1258,19 +1258,19 @@ bool Graph::Smoothen( B_INT Marge )
// Give the graphnumber of the first link in the graphlist
// Give the graphnumber of the first link in the graphlist
int
Graph
::
GetGraphNum
()
int
kb
Graph
::
GetGraphNum
()
{
{
return
(
(
KBool
Link
*
)
_linklist
->
headitem
()
)
->
GetGraphNum
();
return
(
(
kb
Link
*
)
_linklist
->
headitem
()
)
->
GetGraphNum
();
}
}
// get the node with the highest Y value
// get the node with the highest Y value
Node
*
Graph
::
GetTopNode
()
kbNode
*
kb
Graph
::
GetTopNode
()
{
{
B_INT
max_Y
=
MAXB_INT
;
B_INT
max_Y
=
MAXB_INT
;
Node
*
result
;
kb
Node
*
result
;
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
...
@@ -1287,13 +1287,13 @@ Node* Graph::GetTopNode()
...
@@ -1287,13 +1287,13 @@ Node* Graph::GetTopNode()
// THE GRAPH MUST be SORTED before using this function
// THE GRAPH MUST be SORTED before using this function
// mergesort(linkYXtopsorter);
// mergesort(linkYXtopsorter);
// Get the mostleft top node from the graph for which the link flag is not set yet
// Get the mostleft top node from the graph for which the link flag is not set yet
Node
*
Graph
::
GetMostTopLeft
(
TDLI
<
KBool
Link
>*
_LI
)
kbNode
*
kbGraph
::
GetMostTopLeft
(
TDLI
<
kb
Link
>*
_LI
)
{
{
while
(
!
_LI
->
hitroot
()
)
while
(
!
_LI
->
hitroot
()
)
{
{
if
(
!
_LI
->
item
()
->
BeenHere
()
)
if
(
!
_LI
->
item
()
->
BeenHere
()
)
{
{
KBool
Link
*
a
=
_LI
->
item
();
kb
Link
*
a
=
_LI
->
item
();
//find the top node of this link (sorted on top allready)
//find the top node of this link (sorted on top allready)
if
(
a
->
GetBeginNode
()
->
GetY
()
>
a
->
GetEndNode
()
->
GetY
()
)
if
(
a
->
GetBeginNode
()
->
GetY
()
>
a
->
GetEndNode
()
->
GetY
()
)
return
(
a
->
GetBeginNode
()
);
return
(
a
->
GetBeginNode
()
);
...
@@ -1309,14 +1309,14 @@ Node* Graph::GetMostTopLeft( TDLI<KBoolLink>* _LI )
...
@@ -1309,14 +1309,14 @@ Node* Graph::GetMostTopLeft( TDLI<KBoolLink>* _LI )
// Take the linkslist over from a other graph
// Take the linkslist over from a other graph
// The linklist of the other graph will be empty afterwards
// The linklist of the other graph will be empty afterwards
void
Graph
::
TakeOver
(
Graph
*
other
)
void
kbGraph
::
TakeOver
(
kb
Graph
*
other
)
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
takeover
(
other
->
_linklist
);
_LI
.
takeover
(
other
->
_linklist
);
}
}
// calculate crossing with scanbeams
// calculate crossing with scanbeams
bool
Graph
::
CalculateCrossings
(
B_INT
Marge
)
bool
kb
Graph
::
CalculateCrossings
(
B_INT
Marge
)
{
{
// POINT <==> POINT
// POINT <==> POINT
_GC
->
SetState
(
"Node to Node"
);
_GC
->
SetState
(
"Node to Node"
);
...
@@ -1330,14 +1330,14 @@ bool Graph::CalculateCrossings( B_INT Marge )
...
@@ -1330,14 +1330,14 @@ bool Graph::CalculateCrossings( B_INT Marge )
return
found
;
return
found
;
// POINT <==> LINK
// POINT <==> LINK
_GC
->
SetState
(
"Node to
KBool
Link 0"
);
_GC
->
SetState
(
"Node to
kb
Link 0"
);
found
=
ScanGraph2
(
NODELINK
,
dummy
)
!=
0
||
found
;
found
=
ScanGraph2
(
NODELINK
,
dummy
)
!=
0
||
found
;
_GC
->
SetState
(
"Rotate -90"
);
_GC
->
SetState
(
"Rotate -90"
);
Rotate
(
false
);
Rotate
(
false
);
_GC
->
SetState
(
"Node to
KBool
Link -90"
);
_GC
->
SetState
(
"Node to
kb
Link -90"
);
found
=
ScanGraph2
(
NODELINK
,
dummy
)
!=
0
||
found
;
found
=
ScanGraph2
(
NODELINK
,
dummy
)
!=
0
||
found
;
_GC
->
SetState
(
"Rotate +90"
);
_GC
->
SetState
(
"Rotate +90"
);
...
@@ -1351,7 +1351,7 @@ bool Graph::CalculateCrossings( B_INT Marge )
...
@@ -1351,7 +1351,7 @@ bool Graph::CalculateCrossings( B_INT Marge )
/*
/*
if (!checksort())
if (!checksort())
{ {
{ {
TDLI<
KBoolLink> _LI=TDLI<KBool
Link>(_linklist);
TDLI<
kbLink> _LI=TDLI<kb
Link>(_linklist);
_LI.mergesort(linkXYsorter);
_LI.mergesort(linkXYsorter);
}
}
writeintersections();
writeintersections();
...
@@ -1360,7 +1360,7 @@ bool Graph::CalculateCrossings( B_INT Marge )
...
@@ -1360,7 +1360,7 @@ bool Graph::CalculateCrossings( B_INT Marge )
*/
*/
// Rotate(false);
// Rotate(false);
// _GC->SetState("
KBoolLink to KBool
Link -90");
// _GC->SetState("
kbLink to kb
Link -90");
// ScanGraph2(LINKLINK);
// ScanGraph2(LINKLINK);
// Rotate(true);
// Rotate(true);
...
@@ -1376,25 +1376,25 @@ bool Graph::CalculateCrossings( B_INT Marge )
...
@@ -1376,25 +1376,25 @@ bool Graph::CalculateCrossings( B_INT Marge )
}
}
// neem de nodes die binnen de margeafstand bij elkaar liggen samen RICHARD
// neem de nodes die binnen de margeafstand bij elkaar liggen samen RICHARD
int
Graph
::
Merge_NodeToNode
(
B_INT
Marge
)
int
kb
Graph
::
Merge_NodeToNode
(
B_INT
Marge
)
{
{
//aantal punten dat verplaatst is
//aantal punten dat verplaatst is
int
merges
=
0
;
int
merges
=
0
;
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
//unmark all links; markflag wordt gebruikt om aan te geven
//unmark all links; markflag wordt gebruikt om aan te geven
//of een link (eigenlijk beginnode ervan) al verwerkt is
//of een link (eigenlijk beginnode ervan) al verwerkt is
_LI
.
foreach_mf
(
&
KBool
Link
::
UnMark
);
_LI
.
foreach_mf
(
&
kb
Link
::
UnMark
);
//sort links on x value of beginnode
//sort links on x value of beginnode
_LI
.
mergesort
(
linkXYsorter
);
_LI
.
mergesort
(
linkXYsorter
);
//extra iterator voor doorlopen links in graph
//extra iterator voor doorlopen links in graph
{
{
TDLI
<
KBoolLink
>
links
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
links
=
TDLI
<
kb
Link
>
(
_linklist
);
Node
*
nodeOne
,
*
nodeTwo
;
kb
Node
*
nodeOne
,
*
nodeTwo
;
//verwerk alle links (alle (begin)nodes)
//verwerk alle links (alle (begin)nodes)
for
(
_LI
.
tohead
();
!
_LI
.
hitroot
();
_LI
++
)
for
(
_LI
.
tohead
();
!
_LI
.
hitroot
();
_LI
++
)
{
{
...
@@ -1449,9 +1449,9 @@ int Graph::Merge_NodeToNode( B_INT Marge )
...
@@ -1449,9 +1449,9 @@ int Graph::Merge_NodeToNode( B_INT Marge )
}
}
int
Graph
::
ScanGraph2
(
SCANTYPE
scantype
,
bool
&
holes
)
int
kb
Graph
::
ScanGraph2
(
SCANTYPE
scantype
,
bool
&
holes
)
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
int
found
=
0
;
int
found
=
0
;
//sort links on x and y value of beginnode
//sort links on x and y value of beginnode
...
@@ -1460,11 +1460,11 @@ int Graph::ScanGraph2( SCANTYPE scantype, bool& holes )
...
@@ -1460,11 +1460,11 @@ int Graph::ScanGraph2( SCANTYPE scantype, bool& holes )
writegraph
(
false
);
writegraph
(
false
);
//bin flag is used in scanbeam so reset
//bin flag is used in scanbeam so reset
_LI
.
foreach_mf
(
&
KBool
Link
::
SetNotBeenHere
);
_LI
.
foreach_mf
(
&
kb
Link
::
SetNotBeenHere
);
ScanBeam
*
scanbeam
=
new
ScanBeam
(
_GC
);
ScanBeam
*
scanbeam
=
new
ScanBeam
(
_GC
);
Node
*
_low
;
kb
Node
*
_low
;
Node
*
_high
;
kb
Node
*
_high
;
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
attail
()
)
while
(
!
_LI
.
attail
()
)
...
@@ -1497,9 +1497,9 @@ int Graph::ScanGraph2( SCANTYPE scantype, bool& holes )
...
@@ -1497,9 +1497,9 @@ int Graph::ScanGraph2( SCANTYPE scantype, bool& holes )
/*
/*
// scanbeam->writebeam();
// scanbeam->writebeam();
if (j%100 ==0)
if (j%100 ==0)
{
{
long x;
long x;
...
@@ -1511,33 +1511,33 @@ int Graph::ScanGraph2( SCANTYPE scantype, bool& holes )
...
@@ -1511,33 +1511,33 @@ int Graph::ScanGraph2( SCANTYPE scantype, bool& holes )
_GC->SetState(buf);
_GC->SetState(buf);
scanbeam->writebeam();
scanbeam->writebeam();
}
}
writegraph(false);
writegraph(false);
if (!checksort())
if (!checksort())
{
{
double x=_lowlink->GetBeginNode()->GetX();
double x=_lowlink->GetBeginNode()->GetX();
checksort();
checksort();
}
}
_LI++;
_LI++;
}
}
}
}
delete scanbeam;
delete scanbeam;
return 0;
return 0;
}
}
if (!checksort())
if (!checksort())
{
{
x=_lowlink->GetBeginNode()->GetX();
x=_lowlink->GetBeginNode()->GetX();
checksort();
checksort();
}
}
if (x >= -112200)
if (x >= -112200)
{
{
// writegraph(true);
// writegraph(true);
...
@@ -1549,7 +1549,7 @@ int Graph::ScanGraph2( SCANTYPE scantype, bool& holes )
...
@@ -1549,7 +1549,7 @@ int Graph::ScanGraph2( SCANTYPE scantype, bool& holes )
//=============================== Global Functions =============================
//=============================== Global Functions =============================
// Sorts the links on the X values
// Sorts the links on the X values
int
linkXYsorter
(
KBoolLink
*
a
,
KBool
Link
*
b
)
int
linkXYsorter
(
kbLink
*
a
,
kb
Link
*
b
)
{
{
if
(
a
->
GetBeginNode
()
->
GetX
()
<
b
->
GetBeginNode
()
->
GetX
()
)
if
(
a
->
GetBeginNode
()
->
GetX
()
<
b
->
GetBeginNode
()
->
GetX
()
)
return
(
1
);
return
(
1
);
...
@@ -1565,7 +1565,7 @@ int linkXYsorter( KBoolLink *a, KBoolLink* b )
...
@@ -1565,7 +1565,7 @@ int linkXYsorter( KBoolLink *a, KBoolLink* b )
}
}
// Sorts the links on the Y value of the beginnode
// Sorts the links on the Y value of the beginnode
int
linkYXsorter
(
KBoolLink
*
a
,
KBool
Link
*
b
)
int
linkYXsorter
(
kbLink
*
a
,
kb
Link
*
b
)
{
{
if
(
a
->
GetBeginNode
()
->
GetY
()
>
b
->
GetBeginNode
()
->
GetY
()
)
if
(
a
->
GetBeginNode
()
->
GetY
()
>
b
->
GetBeginNode
()
->
GetY
()
)
return
(
1
);
return
(
1
);
...
@@ -1580,7 +1580,7 @@ int linkYXsorter( KBoolLink *a, KBoolLink* b )
...
@@ -1580,7 +1580,7 @@ int linkYXsorter( KBoolLink *a, KBoolLink* b )
// The sort function for sorting graph from shortest to longest (_l1 < _l2)
// The sort function for sorting graph from shortest to longest (_l1 < _l2)
int
linkLsorter
(
KBoolLink
*
_l1
,
KBool
Link
*
_l2
)
int
linkLsorter
(
kbLink
*
_l1
,
kb
Link
*
_l2
)
{
{
B_INT
dx1
,
dx2
,
dy1
,
dy2
;
B_INT
dx1
,
dx2
,
dy1
,
dy2
;
dx1
=
(
_l1
->
GetEndNode
()
->
GetX
()
-
_l1
->
GetBeginNode
()
->
GetX
()
);
dx1
=
(
_l1
->
GetEndNode
()
->
GetX
()
-
_l1
->
GetBeginNode
()
->
GetX
()
);
...
@@ -1604,7 +1604,7 @@ int linkLsorter( KBoolLink *_l1, KBoolLink* _l2 )
...
@@ -1604,7 +1604,7 @@ int linkLsorter( KBoolLink *_l1, KBoolLink* _l2 )
// The sort function for the links in a graph (a.topnode < b.topnode)
// The sort function for the links in a graph (a.topnode < b.topnode)
// if the two links lay with the top nodes on eachother the most left will be selected
// if the two links lay with the top nodes on eachother the most left will be selected
int
linkYXtopsorter
(
KBoolLink
*
a
,
KBool
Link
*
b
)
int
linkYXtopsorter
(
kbLink
*
a
,
kb
Link
*
b
)
{
{
if
(
bmax
(
a
->
GetBeginNode
()
->
GetY
(),
a
->
GetEndNode
()
->
GetY
()
)
<
bmax
(
b
->
GetBeginNode
()
->
GetY
(),
b
->
GetEndNode
()
->
GetY
()
)
)
if
(
bmax
(
a
->
GetBeginNode
()
->
GetY
(),
a
->
GetEndNode
()
->
GetY
()
)
<
bmax
(
b
->
GetBeginNode
()
->
GetY
(),
b
->
GetEndNode
()
->
GetY
()
)
)
...
@@ -1624,7 +1624,7 @@ int linkYXtopsorter( KBoolLink *a, KBoolLink *b )
...
@@ -1624,7 +1624,7 @@ int linkYXtopsorter( KBoolLink *a, KBoolLink *b )
}
}
// The sort function for sorting graph from shortest to longest (_l1 < _l2)
// The sort function for sorting graph from shortest to longest (_l1 < _l2)
int
linkGraphNumsorter
(
KBoolLink
*
_l1
,
KBool
Link
*
_l2
)
int
linkGraphNumsorter
(
kbLink
*
_l1
,
kb
Link
*
_l2
)
{
{
if
(
_l1
->
GetGraphNum
()
>
_l2
->
GetGraphNum
()
)
if
(
_l1
->
GetGraphNum
()
>
_l2
->
GetGraphNum
()
)
return
(
-
1
);
return
(
-
1
);
...
@@ -1634,7 +1634,7 @@ int linkGraphNumsorter( KBoolLink *_l1, KBoolLink* _l2 )
...
@@ -1634,7 +1634,7 @@ int linkGraphNumsorter( KBoolLink *_l1, KBoolLink* _l2 )
}
}
// Perform an operation on the graph
// Perform an operation on the graph
void
Graph
::
Boolean
(
BOOL_OP
operation
,
GraphList
*
Result
)
void
kbGraph
::
Boolean
(
BOOL_OP
operation
,
kb
GraphList
*
Result
)
{
{
_GC
->
SetState
(
"Performing Operation"
);
_GC
->
SetState
(
"Performing Operation"
);
...
@@ -1682,7 +1682,10 @@ void Graph::Boolean( BOOL_OP operation, GraphList* Result )
...
@@ -1682,7 +1682,10 @@ void Graph::Boolean( BOOL_OP operation, GraphList* Result )
//The scanlines can not cope with this, so merge them, and later extract one more time.
//The scanlines can not cope with this, so merge them, and later extract one more time.
Merge_NodeToNode
(
0
);
Merge_NodeToNode
(
0
);
#if KBOOL_LOG == 1
_GC
->
SetLog
(
true
);
_GC
->
Write_Log
(
"LINKHOLES
\n
"
);
_GC
->
Write_Log
(
"LINKHOLES
\n
"
);
#endif
writegraph
(
false
);
writegraph
(
false
);
//link the holes into the non holes if there are any.
//link the holes into the non holes if there are any.
...
@@ -1711,7 +1714,7 @@ void Graph::Boolean( BOOL_OP operation, GraphList* Result )
...
@@ -1711,7 +1714,7 @@ void Graph::Boolean( BOOL_OP operation, GraphList* Result )
}
}
// Perform an correction on the graph
// Perform an correction on the graph
void
Graph
::
Correction
(
GraphList
*
Result
,
double
factor
)
void
kbGraph
::
Correction
(
kb
GraphList
*
Result
,
double
factor
)
{
{
// At this moment we have one graph
// At this moment we have one graph
// step one, split it up in single graphs, and mark the holes
// step one, split it up in single graphs, and mark the holes
...
@@ -1724,16 +1727,16 @@ void Graph::Correction( GraphList* Result, double factor )
...
@@ -1724,16 +1727,16 @@ void Graph::Correction( GraphList* Result, double factor )
if
(
GetNumberOfLinks
()
<
3
)
if
(
GetNumberOfLinks
()
<
3
)
return
;
return
;
Graph
*
original
=
new
Graph
(
_GC
);
kbGraph
*
original
=
new
kb
Graph
(
_GC
);
{
{
if
(
_linklist
->
empty
()
)
return
;
if
(
_linklist
->
empty
()
)
return
;
KBool
Link
*
_current
=
GetFirstLink
();
kb
Link
*
_current
=
GetFirstLink
();
Node
*
_first
=
new
Node
(
_current
->
GetBeginNode
(),
_GC
);
kbNode
*
_first
=
new
kb
Node
(
_current
->
GetBeginNode
(),
_GC
);
Node
*
_last
=
_current
->
GetBeginNode
();
kb
Node
*
_last
=
_current
->
GetBeginNode
();
Node
*
_begin
=
_first
;
kb
Node
*
_begin
=
_first
;
Node
*
_end
=
_first
;
kb
Node
*
_end
=
_first
;
int
_nr_of_points
=
GetNumberOfLinks
();
int
_nr_of_points
=
GetNumberOfLinks
();
for
(
int
i
=
1
;
i
<
_nr_of_points
;
i
++
)
for
(
int
i
=
1
;
i
<
_nr_of_points
;
i
++
)
...
@@ -1741,7 +1744,7 @@ void Graph::Correction( GraphList* Result, double factor )
...
@@ -1741,7 +1744,7 @@ void Graph::Correction( GraphList* Result, double factor )
// get the other node on the link
// get the other node on the link
_last
=
_current
->
GetOther
(
_last
);
_last
=
_current
->
GetOther
(
_last
);
// make a node from this point
// make a node from this point
_end
=
new
Node
(
_last
,
_GC
);
_end
=
new
kb
Node
(
_last
,
_GC
);
// make a link between begin and end
// make a link between begin and end
original
->
AddLink
(
_begin
,
_end
);
original
->
AddLink
(
_begin
,
_end
);
...
@@ -1775,8 +1778,8 @@ void Graph::Correction( GraphList* Result, double factor )
...
@@ -1775,8 +1778,8 @@ void Graph::Correction( GraphList* Result, double factor )
_GC
->
SetState
(
"Create rings"
);
_GC
->
SetState
(
"Create rings"
);
//first create a ring around all simple graphs
//first create a ring around all simple graphs
{
{
TDLI
<
Graph
>
IResult
=
TDLI
<
Graph
>
(
Result
);
TDLI
<
kbGraph
>
IResult
=
TDLI
<
kb
Graph
>
(
Result
);
GraphList
*
_ring
=
new
GraphList
(
_GC
);
kbGraphList
*
_ring
=
new
kb
GraphList
(
_GC
);
{
{
//put into one graphlist
//put into one graphlist
IResult
.
tohead
();
IResult
.
tohead
();
...
@@ -1796,8 +1799,8 @@ void Graph::Correction( GraphList* Result, double factor )
...
@@ -1796,8 +1799,8 @@ void Graph::Correction( GraphList* Result, double factor )
while
(
!
_ring
->
empty
()
)
while
(
!
_ring
->
empty
()
)
{
{
//add to end
//add to end
(
(
Graph
*
)
_ring
->
headitem
()
)
->
MakeClockWise
();
(
(
kb
Graph
*
)
_ring
->
headitem
()
)
->
MakeClockWise
();
IResult
.
insend
(
(
Graph
*
)
_ring
->
headitem
()
);
IResult
.
insend
(
(
kb
Graph
*
)
_ring
->
headitem
()
);
_ring
->
removehead
();
_ring
->
removehead
();
}
}
}
}
...
@@ -1826,7 +1829,7 @@ void Graph::Correction( GraphList* Result, double factor )
...
@@ -1826,7 +1829,7 @@ void Graph::Correction( GraphList* Result, double factor )
Prepare
(
1
);
Prepare
(
1
);
Boolean
(
BOOL_OR
,
Result
);
Boolean
(
BOOL_OR
,
Result
);
TDLI
<
Graph
>
IResult
=
TDLI
<
Graph
>
(
Result
);
TDLI
<
kbGraph
>
IResult
=
TDLI
<
kb
Graph
>
(
Result
);
//IResult contains all rings
//IResult contains all rings
//prepare the graphs for extracting the links of a certain operation
//prepare the graphs for extracting the links of a certain operation
//set original graphlist to groupA and ring to groupB
//set original graphlist to groupA and ring to groupB
...
@@ -1887,7 +1890,7 @@ void Graph::Correction( GraphList* Result, double factor )
...
@@ -1887,7 +1890,7 @@ void Graph::Correction( GraphList* Result, double factor )
}
}
// Perform an operation on the graph
// Perform an operation on the graph
void
Graph
::
MakeRing
(
GraphList
*
Result
,
double
factor
)
void
kbGraph
::
MakeRing
(
kb
GraphList
*
Result
,
double
factor
)
{
{
bool
rule
=
_GC
->
GetWindingRule
();
bool
rule
=
_GC
->
GetWindingRule
();
...
@@ -1917,8 +1920,8 @@ void Graph::MakeRing( GraphList* Result, double factor )
...
@@ -1917,8 +1920,8 @@ void Graph::MakeRing( GraphList* Result, double factor )
_GC
->
SetState
(
"Create rings"
);
_GC
->
SetState
(
"Create rings"
);
//first create a ring around all simple graphs
//first create a ring around all simple graphs
TDLI
<
Graph
>
IResult
=
TDLI
<
Graph
>
(
Result
);
TDLI
<
kbGraph
>
IResult
=
TDLI
<
kb
Graph
>
(
Result
);
GraphList
*
_ring
=
new
GraphList
(
_GC
);
kbGraphList
*
_ring
=
new
kb
GraphList
(
_GC
);
{
{
IResult
.
tohead
();
IResult
.
tohead
();
int
i
;
int
i
;
...
@@ -1936,8 +1939,8 @@ void Graph::MakeRing( GraphList* Result, double factor )
...
@@ -1936,8 +1939,8 @@ void Graph::MakeRing( GraphList* Result, double factor )
while
(
!
_ring
->
empty
()
)
while
(
!
_ring
->
empty
()
)
{
{
//add to end
//add to end
(
(
Graph
*
)
_ring
->
headitem
()
)
->
MakeClockWise
();
(
(
kb
Graph
*
)
_ring
->
headitem
()
)
->
MakeClockWise
();
IResult
.
insend
(
(
Graph
*
)
_ring
->
headitem
()
);
IResult
.
insend
(
(
kb
Graph
*
)
_ring
->
headitem
()
);
_ring
->
removehead
();
_ring
->
removehead
();
}
}
}
}
...
@@ -1947,13 +1950,13 @@ void Graph::MakeRing( GraphList* Result, double factor )
...
@@ -1947,13 +1950,13 @@ void Graph::MakeRing( GraphList* Result, double factor )
}
}
//create a ring shapes on every edge of the graph
//create a ring shapes on every edge of the graph
void
Graph
::
CreateRing
(
GraphList
*
ring
,
double
factor
)
void
kbGraph
::
CreateRing
(
kb
GraphList
*
ring
,
double
factor
)
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
Graph
*
shape
=
new
Graph
(
_GC
);
kbGraph
*
shape
=
new
kb
Graph
(
_GC
);
//generate shape around link
//generate shape around link
shape
->
Make_Rounded_Shape
(
_LI
.
item
(),
factor
);
shape
->
Make_Rounded_Shape
(
_LI
.
item
(),
factor
);
ring
->
insbegin
(
shape
);
ring
->
insbegin
(
shape
);
...
@@ -1962,20 +1965,20 @@ void Graph::CreateRing( GraphList *ring, double factor )
...
@@ -1962,20 +1965,20 @@ void Graph::CreateRing( GraphList *ring, double factor )
}
}
//create a ring shapes on every edge of the graph
//create a ring shapes on every edge of the graph
void
Graph
::
CreateRing_fast
(
GraphList
*
ring
,
double
factor
)
void
kbGraph
::
CreateRing_fast
(
kb
GraphList
*
ring
,
double
factor
)
{
{
Node
*
begin
;
kb
Node
*
begin
;
KBool
Link
*
currentlink
;
kb
Link
*
currentlink
;
KBool
Line
currentline
(
_GC
);
kb
Line
currentline
(
_GC
);
KBool
Line
firstline
(
_GC
);
kb
Line
firstline
(
_GC
);
KBool
Link
*
nextlink
;
kb
Link
*
nextlink
;
KBool
Line
nextline
(
_GC
);
kb
Line
nextline
(
_GC
);
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
foreach_mf
(
&
KBool
Link
::
UnMark
);
//reset bin and mark flag of each link
_LI
.
foreach_mf
(
&
kb
Link
::
UnMark
);
//reset bin and mark flag of each link
_LI
.
mergesort
(
linkYXsorter
);
_LI
.
mergesort
(
linkYXsorter
);
_LI
.
tohead
();
_LI
.
tohead
();
...
@@ -1998,11 +2001,11 @@ void Graph::CreateRing_fast( GraphList *ring, double factor )
...
@@ -1998,11 +2001,11 @@ void Graph::CreateRing_fast( GraphList *ring, double factor )
while
(
nextlink
)
while
(
nextlink
)
{
{
Graph
*
shape
=
new
Graph
(
_GC
);
kbGraph
*
shape
=
new
kb
Graph
(
_GC
);
{
{
Node
*
_last_ins_left
=
0
;
kb
Node
*
_last_ins_left
=
0
;
Node
*
_last_ins_right
=
0
;
kb
Node
*
_last_ins_right
=
0
;
currentline
.
Create_Begin_Shape
(
&
nextline
,
&
_last_ins_left
,
&
_last_ins_right
,
factor
,
shape
);
currentline
.
Create_Begin_Shape
(
&
nextline
,
&
_last_ins_left
,
&
_last_ins_right
,
factor
,
shape
);
...
@@ -2037,11 +2040,11 @@ void Graph::CreateRing_fast( GraphList *ring, double factor )
...
@@ -2037,11 +2040,11 @@ void Graph::CreateRing_fast( GraphList *ring, double factor )
//if the shape is very small first merge it with the previous shape
//if the shape is very small first merge it with the previous shape
if
(
!
ring
->
empty
()
&&
shape
->
Small
(
(
B_INT
)
fabs
(
factor
*
3
)
)
)
if
(
!
ring
->
empty
()
&&
shape
->
Small
(
(
B_INT
)
fabs
(
factor
*
3
)
)
)
{
{
TDLI
<
Graph
>
Iring
=
TDLI
<
Graph
>
(
ring
);
TDLI
<
kbGraph
>
Iring
=
TDLI
<
kb
Graph
>
(
ring
);
Iring
.
totail
();
Iring
.
totail
();
GraphList
*
_twoshapes
=
new
GraphList
(
_GC
);
kbGraphList
*
_twoshapes
=
new
kb
GraphList
(
_GC
);
_twoshapes
->
insbegin
(
shape
);
_twoshapes
->
insbegin
(
shape
);
_twoshapes
->
insbegin
(
Iring
.
item
()
);
_twoshapes
->
insbegin
(
Iring
.
item
()
);
Iring
.
remove
();
Iring
.
remove
();
...
@@ -2064,15 +2067,15 @@ void Graph::CreateRing_fast( GraphList *ring, double factor )
...
@@ -2064,15 +2067,15 @@ void Graph::CreateRing_fast( GraphList *ring, double factor )
//end point of arc
//end point of arc
//radius of arc
//radius of arc
//aberation for generating the segments
//aberation for generating the segments
void
Graph
::
CreateArc
(
Node
*
center
,
Node
*
begin
,
Node
*
end
,
double
radius
,
bool
clock
,
double
aber
)
void
kbGraph
::
CreateArc
(
kbNode
*
center
,
kbNode
*
begin
,
kb
Node
*
end
,
double
radius
,
bool
clock
,
double
aber
)
{
{
double
phi
,
dphi
,
dx
,
dy
;
double
phi
,
dphi
,
dx
,
dy
;
int
Segments
;
int
Segments
;
int
i
;
int
i
;
double
ang1
,
ang2
,
phit
;
double
ang1
,
ang2
,
phit
;
Node
*
_last_ins
;
kb
Node
*
_last_ins
;
Node
*
_current
;
kb
Node
*
_current
;
_last_ins
=
begin
;
_last_ins
=
begin
;
...
@@ -2122,7 +2125,7 @@ void Graph::CreateArc( Node* center, Node* begin, Node* end, double radius, bool
...
@@ -2122,7 +2125,7 @@ void Graph::CreateArc( Node* center, Node* begin, Node* end, double radius, bool
dy
=
(
double
)
_last_ins
->
GetY
()
-
center
->
GetY
();
dy
=
(
double
)
_last_ins
->
GetY
()
-
center
->
GetY
();
phi
=
atan2
(
dy
,
dx
);
phi
=
atan2
(
dy
,
dx
);
_current
=
new
Node
(
(
B_INT
)
(
center
->
GetX
()
+
radius
*
cos
(
phi
-
dphi
)
),
_current
=
new
kb
Node
(
(
B_INT
)
(
center
->
GetX
()
+
radius
*
cos
(
phi
-
dphi
)
),
(
B_INT
)
(
center
->
GetY
()
+
radius
*
sin
(
phi
-
dphi
)
),
_GC
);
(
B_INT
)
(
center
->
GetY
()
+
radius
*
sin
(
phi
-
dphi
)
),
_GC
);
AddLink
(
_last_ins
,
_current
);
AddLink
(
_last_ins
,
_current
);
...
@@ -2133,7 +2136,7 @@ void Graph::CreateArc( Node* center, Node* begin, Node* end, double radius, bool
...
@@ -2133,7 +2136,7 @@ void Graph::CreateArc( Node* center, Node* begin, Node* end, double radius, bool
AddLink
(
_last_ins
,
end
);
AddLink
(
_last_ins
,
end
);
}
}
void
Graph
::
CreateArc
(
Node
*
center
,
KBoolLine
*
incoming
,
Node
*
end
,
double
radius
,
double
aber
)
void
kbGraph
::
CreateArc
(
kbNode
*
center
,
kbLine
*
incoming
,
kb
Node
*
end
,
double
radius
,
double
aber
)
{
{
double
distance
=
0
;
double
distance
=
0
;
if
(
incoming
->
PointOnLine
(
center
,
distance
,
_GC
->
GetAccur
()
)
==
RIGHT_SIDE
)
if
(
incoming
->
PointOnLine
(
center
,
distance
,
_GC
->
GetAccur
()
)
==
RIGHT_SIDE
)
...
@@ -2142,13 +2145,13 @@ void Graph::CreateArc( Node* center, KBoolLine* incoming, Node* end, double radi
...
@@ -2142,13 +2145,13 @@ void Graph::CreateArc( Node* center, KBoolLine* incoming, Node* end, double radi
CreateArc
(
center
,
incoming
->
GetEndNode
(),
end
,
radius
,
false
,
aber
);
CreateArc
(
center
,
incoming
->
GetEndNode
(),
end
,
radius
,
false
,
aber
);
}
}
void
Graph
::
MakeOneDirection
()
void
kb
Graph
::
MakeOneDirection
()
{
{
int
_nr_of_points
=
_linklist
->
count
();
int
_nr_of_points
=
_linklist
->
count
();
KBoolLink
*
_current
=
(
KBool
Link
*
)
_linklist
->
headitem
();
kbLink
*
_current
=
(
kb
Link
*
)
_linklist
->
headitem
();
Node
*
_last
=
_current
->
GetBeginNode
();
kb
Node
*
_last
=
_current
->
GetBeginNode
();
Node
*
dummy
;
kb
Node
*
dummy
;
for
(
int
i
=
0
;
i
<
_nr_of_points
;
i
++
)
for
(
int
i
=
0
;
i
<
_nr_of_points
;
i
++
)
{
{
...
@@ -2167,12 +2170,12 @@ void Graph::MakeOneDirection()
...
@@ -2167,12 +2170,12 @@ void Graph::MakeOneDirection()
}
}
}
}
bool
Graph
::
Small
(
B_INT
howsmall
)
bool
kb
Graph
::
Small
(
B_INT
howsmall
)
{
{
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
_LI
.
tohead
();
_LI
.
tohead
();
Node
*
bg
=
_LI
.
item
()
->
GetBeginNode
();
kb
Node
*
bg
=
_LI
.
item
()
->
GetBeginNode
();
B_INT
xmin
=
bg
->
GetX
();
B_INT
xmin
=
bg
->
GetX
();
B_INT
xmax
=
bg
->
GetX
();
B_INT
xmax
=
bg
->
GetX
();
B_INT
ymin
=
bg
->
GetY
();
B_INT
ymin
=
bg
->
GetY
();
...
@@ -2201,24 +2204,24 @@ bool Graph::Small( B_INT howsmall )
...
@@ -2201,24 +2204,24 @@ bool Graph::Small( B_INT howsmall )
//create a circle at end and begin point
//create a circle at end and begin point
// and block in between
// and block in between
void
Graph
::
Make_Rounded_Shape
(
KBool
Link
*
a_link
,
double
factor
)
void
kbGraph
::
Make_Rounded_Shape
(
kb
Link
*
a_link
,
double
factor
)
{
{
double
phi
,
dphi
,
dx
,
dy
;
double
phi
,
dphi
,
dx
,
dy
;
int
Segments
=
6
;
int
Segments
=
6
;
int
i
;
int
i
;
KBool
Line
theline
(
a_link
,
_GC
);
kb
Line
theline
(
a_link
,
_GC
);
theline
.
CalculateLineParameters
();
theline
.
CalculateLineParameters
();
Node
*
_current
;
kb
Node
*
_current
;
Node
*
_first
=
new
Node
(
a_link
->
GetBeginNode
(),
_GC
);
kbNode
*
_first
=
new
kb
Node
(
a_link
->
GetBeginNode
(),
_GC
);
Node
*
_last_ins
=
_first
;
kb
Node
*
_last_ins
=
_first
;
theline
.
Virtual_Point
(
_first
,
factor
);
theline
.
Virtual_Point
(
_first
,
factor
);
// make a node from this point
// make a node from this point
_current
=
new
Node
(
a_link
->
GetEndNode
(),
_GC
);
_current
=
new
kb
Node
(
a_link
->
GetEndNode
(),
_GC
);
theline
.
Virtual_Point
(
_current
,
factor
);
theline
.
Virtual_Point
(
_current
,
factor
);
// make a link between the current and the previous and add this to graph
// make a link between the current and the previous and add this to graph
...
@@ -2234,7 +2237,7 @@ void Graph::Make_Rounded_Shape( KBoolLink* a_link, double factor )
...
@@ -2234,7 +2237,7 @@ void Graph::Make_Rounded_Shape( KBoolLink* a_link, double factor )
dy
=
(
double
)
_last_ins
->
GetY
()
-
a_link
->
GetEndNode
()
->
GetY
();
dy
=
(
double
)
_last_ins
->
GetY
()
-
a_link
->
GetEndNode
()
->
GetY
();
phi
=
atan2
(
dy
,
dx
);
phi
=
atan2
(
dy
,
dx
);
_current
=
new
Node
(
(
B_INT
)
(
a_link
->
GetEndNode
()
->
GetX
()
+
factor
*
cos
(
phi
-
dphi
)
),
_current
=
new
kb
Node
(
(
B_INT
)
(
a_link
->
GetEndNode
()
->
GetX
()
+
factor
*
cos
(
phi
-
dphi
)
),
(
B_INT
)
(
a_link
->
GetEndNode
()
->
GetY
()
+
factor
*
sin
(
phi
-
dphi
)
),
_GC
);
(
B_INT
)
(
a_link
->
GetEndNode
()
->
GetY
()
+
factor
*
sin
(
phi
-
dphi
)
),
_GC
);
AddLink
(
_last_ins
,
_current
);
AddLink
(
_last_ins
,
_current
);
...
@@ -2243,13 +2246,13 @@ void Graph::Make_Rounded_Shape( KBoolLink* a_link, double factor )
...
@@ -2243,13 +2246,13 @@ void Graph::Make_Rounded_Shape( KBoolLink* a_link, double factor )
}
}
// make a node from the endnode of link
// make a node from the endnode of link
_current
=
new
Node
(
a_link
->
GetEndNode
(),
_GC
);
_current
=
new
kb
Node
(
a_link
->
GetEndNode
(),
_GC
);
theline
.
Virtual_Point
(
_current
,
-
factor
);
theline
.
Virtual_Point
(
_current
,
-
factor
);
AddLink
(
_last_ins
,
_current
);
AddLink
(
_last_ins
,
_current
);
_last_ins
=
_current
;
_last_ins
=
_current
;
// make a node from this beginnode of link
// make a node from this beginnode of link
_current
=
new
Node
(
a_link
->
GetBeginNode
(),
_GC
);
_current
=
new
kb
Node
(
a_link
->
GetBeginNode
(),
_GC
);
theline
.
Virtual_Point
(
_current
,
-
factor
);
theline
.
Virtual_Point
(
_current
,
-
factor
);
AddLink
(
_last_ins
,
_current
);
AddLink
(
_last_ins
,
_current
);
_last_ins
=
_current
;
_last_ins
=
_current
;
...
@@ -2260,7 +2263,7 @@ void Graph::Make_Rounded_Shape( KBoolLink* a_link, double factor )
...
@@ -2260,7 +2263,7 @@ void Graph::Make_Rounded_Shape( KBoolLink* a_link, double factor )
dy
=
(
double
)
_last_ins
->
GetY
()
-
a_link
->
GetBeginNode
()
->
GetY
();
dy
=
(
double
)
_last_ins
->
GetY
()
-
a_link
->
GetBeginNode
()
->
GetY
();
phi
=
atan2
(
dy
,
dx
);
phi
=
atan2
(
dy
,
dx
);
_current
=
new
Node
(
(
B_INT
)(
a_link
->
GetBeginNode
()
->
GetX
()
+
factor
*
cos
(
phi
-
dphi
)
),
_current
=
new
kb
Node
(
(
B_INT
)(
a_link
->
GetBeginNode
()
->
GetX
()
+
factor
*
cos
(
phi
-
dphi
)
),
(
B_INT
)(
a_link
->
GetBeginNode
()
->
GetY
()
+
factor
*
sin
(
phi
-
dphi
)
),
_GC
);
(
B_INT
)(
a_link
->
GetBeginNode
()
->
GetY
()
+
factor
*
sin
(
phi
-
dphi
)
),
_GC
);
AddLink
(
_last_ins
,
_current
);
AddLink
(
_last_ins
,
_current
);
...
@@ -2274,18 +2277,18 @@ void Graph::Make_Rounded_Shape( KBoolLink* a_link, double factor )
...
@@ -2274,18 +2277,18 @@ void Graph::Make_Rounded_Shape( KBoolLink* a_link, double factor )
//make the graph clockwise orientation,
//make the graph clockwise orientation,
//return if the graph needed redirection
//return if the graph needed redirection
bool
Graph
::
MakeClockWise
()
bool
kb
Graph
::
MakeClockWise
()
{
{
if
(
_GC
->
GetOrientationEntryMode
()
)
if
(
_GC
->
GetOrientationEntryMode
()
)
return
false
;
return
false
;
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
if
(
_LI
.
empty
()
)
return
false
;
if
(
_LI
.
empty
()
)
return
false
;
KBool
Link
*
currentlink
;
kb
Link
*
currentlink
;
Node
*
begin
;
kb
Node
*
begin
;
_LI
.
foreach_mf
(
&
KBool
Link
::
UnMark
);
//reset bin and mark flag of each link
_LI
.
foreach_mf
(
&
kb
Link
::
UnMark
);
//reset bin and mark flag of each link
_LI
.
mergesort
(
linkYXtopsorter
);
_LI
.
mergesort
(
linkYXtopsorter
);
_LI
.
tohead
();
_LI
.
tohead
();
...
@@ -2324,7 +2327,7 @@ bool Graph::MakeClockWise()
...
@@ -2324,7 +2327,7 @@ bool Graph::MakeClockWise()
return
false
;
return
false
;
}
}
bool
Graph
::
writegraph
(
bool
linked
)
bool
kb
Graph
::
writegraph
(
bool
linked
)
{
{
#if KBOOL_DEBUG == 1
#if KBOOL_DEBUG == 1
...
@@ -2335,7 +2338,7 @@ bool Graph::writegraph( bool linked )
...
@@ -2335,7 +2338,7 @@ bool Graph::writegraph( bool linked )
fprintf
(
file
,
"# graph
\n
"
);
fprintf
(
file
,
"# graph
\n
"
);
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
if
(
_LI
.
empty
()
)
if
(
_LI
.
empty
()
)
{
{
return
true
;
return
true
;
...
@@ -2344,13 +2347,13 @@ bool Graph::writegraph( bool linked )
...
@@ -2344,13 +2347,13 @@ bool Graph::writegraph( bool linked )
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
KBool
Link
*
curl
=
_LI
.
item
();
kb
Link
*
curl
=
_LI
.
item
();
fprintf
(
file
,
" linkbegin %I64d %I64d
\n
"
,
curl
->
GetBeginNode
()
->
GetX
()
,
curl
->
GetBeginNode
()
->
GetY
()
);
fprintf
(
file
,
" linkbegin %I64d %I64d
\n
"
,
curl
->
GetBeginNode
()
->
GetX
()
,
curl
->
GetBeginNode
()
->
GetY
()
);
if
(
linked
)
if
(
linked
)
{
{
TDLI
<
KBool
Link
>
Inode
(
curl
->
GetBeginNode
()
->
GetLinklist
()
);
TDLI
<
kb
Link
>
Inode
(
curl
->
GetBeginNode
()
->
GetLinklist
()
);
Inode
.
tohead
();
Inode
.
tohead
();
while
(
!
Inode
.
hitroot
()
)
while
(
!
Inode
.
hitroot
()
)
{
{
...
@@ -2367,7 +2370,7 @@ bool Graph::writegraph( bool linked )
...
@@ -2367,7 +2370,7 @@ bool Graph::writegraph( bool linked )
if
(
linked
)
if
(
linked
)
{
{
TDLI
<
KBool
Link
>
Inode
(
curl
->
GetEndNode
()
->
GetLinklist
()
);
TDLI
<
kb
Link
>
Inode
(
curl
->
GetEndNode
()
->
GetLinklist
()
);
Inode
.
tohead
();
Inode
.
tohead
();
while
(
!
Inode
.
hitroot
()
)
while
(
!
Inode
.
hitroot
()
)
{
{
...
@@ -2407,7 +2410,7 @@ bool Graph::writegraph( bool linked )
...
@@ -2407,7 +2410,7 @@ bool Graph::writegraph( bool linked )
return
true
;
return
true
;
}
}
bool
Graph
::
writeintersections
()
bool
kb
Graph
::
writeintersections
()
{
{
#if KBOOL_DEBUG == 1
#if KBOOL_DEBUG == 1
...
@@ -2419,7 +2422,7 @@ bool Graph::writeintersections()
...
@@ -2419,7 +2422,7 @@ bool Graph::writeintersections()
fprintf
(
file
,
"# graph
\n
"
);
fprintf
(
file
,
"# graph
\n
"
);
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
if
(
_LI
.
empty
()
)
if
(
_LI
.
empty
()
)
{
{
return
true
;
return
true
;
...
@@ -2428,8 +2431,8 @@ bool Graph::writeintersections()
...
@@ -2428,8 +2431,8 @@ bool Graph::writeintersections()
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
KBool
Link
*
curl
=
_LI
.
item
();
kb
Link
*
curl
=
_LI
.
item
();
TDLI
<
KBool
Link
>
Inode
(
curl
->
GetBeginNode
()
->
GetLinklist
()
);
TDLI
<
kb
Link
>
Inode
(
curl
->
GetBeginNode
()
->
GetLinklist
()
);
Inode
.
tohead
();
Inode
.
tohead
();
if
(
Inode
.
count
()
>
2
)
if
(
Inode
.
count
()
>
2
)
{
{
...
@@ -2443,21 +2446,21 @@ bool Graph::writeintersections()
...
@@ -2443,21 +2446,21 @@ bool Graph::writeintersections()
return
true
;
return
true
;
}
}
bool
Graph
::
checksort
()
bool
kb
Graph
::
checksort
()
{
{
// if empty then just insert
// if empty then just insert
if
(
_linklist
->
empty
()
)
if
(
_linklist
->
empty
()
)
return
true
;
return
true
;
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
// put new item left of the one that is bigger
// put new item left of the one that is bigger
_LI
.
tohead
();
_LI
.
tohead
();
KBool
Link
*
prev
=
_LI
.
item
();
kb
Link
*
prev
=
_LI
.
item
();
KBool
Link
*
cur
=
_LI
.
item
();
kb
Link
*
cur
=
_LI
.
item
();
_LI
++
;
_LI
++
;
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
KBool
Link
*
aap
=
_LI
.
item
();
kb
Link
*
aap
=
_LI
.
item
();
if
(
linkXYsorter
(
prev
,
_LI
.
item
()
)
==
-
1
)
if
(
linkXYsorter
(
prev
,
_LI
.
item
()
)
==
-
1
)
{
{
cur
=
aap
;
cur
=
aap
;
...
@@ -2471,7 +2474,7 @@ bool Graph::checksort()
...
@@ -2471,7 +2474,7 @@ bool Graph::checksort()
}
}
void
Graph
::
WriteKEY
(
Bool_Engine
*
GC
,
FILE
*
file
)
void
kb
Graph
::
WriteKEY
(
Bool_Engine
*
GC
,
FILE
*
file
)
{
{
double
scale
=
1.0
/
GC
->
GetGrid
()
/
GC
->
GetGrid
();
double
scale
=
1.0
/
GC
->
GetGrid
()
/
GC
->
GetGrid
();
...
@@ -2497,7 +2500,7 @@ void Graph::WriteKEY( Bool_Engine* GC, FILE* file )
...
@@ -2497,7 +2500,7 @@ void Graph::WriteKEY( Bool_Engine* GC, FILE* file )
"
);
"
);
}
}
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
if
(
_LI
.
empty
())
if
(
_LI
.
empty
())
{
{
if
(
ownfile
)
if
(
ownfile
)
...
@@ -2514,7 +2517,7 @@ void Graph::WriteKEY( Bool_Engine* GC, FILE* file )
...
@@ -2514,7 +2517,7 @@ void Graph::WriteKEY( Bool_Engine* GC, FILE* file )
_LI
.
tohead
();
_LI
.
tohead
();
KBool
Link
*
curl
=
_LI
.
item
();
kb
Link
*
curl
=
_LI
.
item
();
if
(
_LI
.
item
()
->
Group
()
==
GROUP_A
)
if
(
_LI
.
item
()
->
Group
()
==
GROUP_A
)
fprintf
(
file
,
"BOUNDARY; LAYER 0; DATATYPE 0;
\n
"
);
fprintf
(
file
,
"BOUNDARY; LAYER 0; DATATYPE 0;
\n
"
);
...
@@ -2530,7 +2533,7 @@ void Graph::WriteKEY( Bool_Engine* GC, FILE* file )
...
@@ -2530,7 +2533,7 @@ void Graph::WriteKEY( Bool_Engine* GC, FILE* file )
while
(
!
_LI
.
hitroot
())
while
(
!
_LI
.
hitroot
())
{
{
KBool
Link
*
curl
=
_LI
.
item
();
kb
Link
*
curl
=
_LI
.
item
();
fprintf
(
file
,
"X % f;
\t
"
,
curl
->
GetBeginNode
()
->
GetX
()
*
scale
);
fprintf
(
file
,
"X % f;
\t
"
,
curl
->
GetBeginNode
()
->
GetX
()
*
scale
);
fprintf
(
file
,
"Y % f;
\n
"
,
curl
->
GetBeginNode
()
->
GetY
()
*
scale
);
fprintf
(
file
,
"Y % f;
\n
"
,
curl
->
GetBeginNode
()
->
GetY
()
*
scale
);
...
@@ -2553,9 +2556,9 @@ void Graph::WriteKEY( Bool_Engine* GC, FILE* file )
...
@@ -2553,9 +2556,9 @@ void Graph::WriteKEY( Bool_Engine* GC, FILE* file )
}
}
void
Graph
::
WriteGraphKEY
(
Bool_Engine
*
GC
)
void
kb
Graph
::
WriteGraphKEY
(
Bool_Engine
*
GC
)
{
{
#if KBOOL_DEBUG
== 1
#if KBOOL_DEBUG
double
scale
=
1.0
/
GC
->
GetGrid
()
/
GC
->
GetGrid
();
double
scale
=
1.0
/
GC
->
GetGrid
()
/
GC
->
GetGrid
();
FILE
*
file
=
fopen
(
"keygraphfile.key"
,
"w"
);
FILE
*
file
=
fopen
(
"keygraphfile.key"
,
"w"
);
...
@@ -2576,7 +2579,7 @@ void Graph::WriteGraphKEY(Bool_Engine* GC)
...
@@ -2576,7 +2579,7 @@ void Graph::WriteGraphKEY(Bool_Engine* GC)
"
);
"
);
TDLI
<
KBoolLink
>
_LI
=
TDLI
<
KBool
Link
>
(
_linklist
);
TDLI
<
kbLink
>
_LI
=
TDLI
<
kb
Link
>
(
_linklist
);
if
(
_LI
.
empty
())
if
(
_LI
.
empty
())
{
{
fprintf
(
file
,
"\
fprintf
(
file
,
"\
...
@@ -2588,7 +2591,7 @@ void Graph::WriteGraphKEY(Bool_Engine* GC)
...
@@ -2588,7 +2591,7 @@ void Graph::WriteGraphKEY(Bool_Engine* GC)
}
}
_LI
.
tohead
();
_LI
.
tohead
();
KBool
Link
*
curl
;
kb
Link
*
curl
;
int
_nr_of_points
=
_linklist
->
count
();
int
_nr_of_points
=
_linklist
->
count
();
for
(
int
i
=
0
;
i
<
_nr_of_points
;
i
++
)
for
(
int
i
=
0
;
i
<
_nr_of_points
;
i
++
)
...
...
polygon/kbool/src/graphlst.cpp
View file @
ef2e41e3
...
@@ -17,37 +17,37 @@
...
@@ -17,37 +17,37 @@
//this here is to initialize the static iterator of graphlist
//this here is to initialize the static iterator of graphlist
//with NOLIST constructor
//with NOLIST constructor
int
graphsorterX
(
Graph
*
,
Graph
*
);
int
graphsorterX
(
kbGraph
*
,
kb
Graph
*
);
int
graphsorterY
(
Graph
*
,
Graph
*
);
int
graphsorterY
(
kbGraph
*
,
kb
Graph
*
);
GraphList
::
GraphList
(
Bool_Engine
*
GC
)
kbGraphList
::
kb
GraphList
(
Bool_Engine
*
GC
)
{
{
_GC
=
GC
;
_GC
=
GC
;
}
}
GraphList
::
GraphList
(
GraphList
*
other
)
kbGraphList
::
kbGraphList
(
kb
GraphList
*
other
)
{
{
_GC
=
other
->
_GC
;
_GC
=
other
->
_GC
;
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
other
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
other
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
insend
(
new
Graph
(
_LI
.
item
()
)
);
insend
(
new
kb
Graph
(
_LI
.
item
()
)
);
_LI
++
;
_LI
++
;
}
}
}
}
GraphList
::~
GraphList
()
kbGraphList
::~
kb
GraphList
()
{
{
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
//first empty the graph
//first empty the graph
_LI
.
delete_all
();
_LI
.
delete_all
();
}
}
//prepare the graphlist for the boolean operations
//prepare the graphlist for the boolean operations
//group all graphs into ONE graph
//group all graphs into ONE graph
void
GraphList
::
Prepare
(
Graph
*
total
)
void
kbGraphList
::
Prepare
(
kb
Graph
*
total
)
{
{
if
(
empty
()
)
if
(
empty
()
)
return
;
return
;
...
@@ -60,7 +60,7 @@ void GraphList::Prepare( Graph* total )
...
@@ -60,7 +60,7 @@ void GraphList::Prepare( Graph* total )
if
(
!
_GC
->
GetOrientationEntryMode
()
)
if
(
!
_GC
->
GetOrientationEntryMode
()
)
{
{
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -78,9 +78,9 @@ void GraphList::Prepare( Graph* total )
...
@@ -78,9 +78,9 @@ void GraphList::Prepare( Graph* total )
// the function will make from all the graphs in the graphlist one graph,
// the function will make from all the graphs in the graphlist one graph,
// simply by throwing all the links in one graph, the graphnumbers will
// simply by throwing all the links in one graph, the graphnumbers will
// not be changed
// not be changed
void
GraphList
::
MakeOneGraph
(
Graph
*
total
)
void
kbGraphList
::
MakeOneGraph
(
kb
Graph
*
total
)
{
{
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -93,11 +93,11 @@ void GraphList::MakeOneGraph( Graph* total )
...
@@ -93,11 +93,11 @@ void GraphList::MakeOneGraph( Graph* total )
//
//
// Renumber all the graphs
// Renumber all the graphs
//
//
void
GraphList
::
Renumber
()
void
kb
GraphList
::
Renumber
()
{
{
if
(
_GC
->
GetOrientationEntryMode
()
)
if
(
_GC
->
GetOrientationEntryMode
()
)
{
{
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -111,7 +111,7 @@ void GraphList::Renumber()
...
@@ -111,7 +111,7 @@ void GraphList::Renumber()
else
else
{
{
unsigned
int
Number
=
1
;
unsigned
int
Number
=
1
;
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -123,10 +123,10 @@ void GraphList::Renumber()
...
@@ -123,10 +123,10 @@ void GraphList::Renumber()
// Simplify the graphs
// Simplify the graphs
void
GraphList
::
Simplify
(
double
marge
)
void
kb
GraphList
::
Simplify
(
double
marge
)
{
{
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
_LI
.
foreach_mf
(
&
Graph
::
Reset_Mark_and_Bin
);
_LI
.
foreach_mf
(
&
kb
Graph
::
Reset_Mark_and_Bin
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
...
@@ -146,10 +146,10 @@ void GraphList::Simplify( double marge )
...
@@ -146,10 +146,10 @@ void GraphList::Simplify( double marge )
}
}
// Smoothen the graphs
// Smoothen the graphs
void
GraphList
::
Smoothen
(
double
marge
)
void
kb
GraphList
::
Smoothen
(
double
marge
)
{
{
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
_LI
.
foreach_mf
(
&
Graph
::
Reset_Mark_and_Bin
);
_LI
.
foreach_mf
(
&
kb
Graph
::
Reset_Mark_and_Bin
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
...
@@ -170,10 +170,10 @@ void GraphList::Smoothen( double marge )
...
@@ -170,10 +170,10 @@ void GraphList::Smoothen( double marge )
// Turn off all markers in all the graphs
// Turn off all markers in all the graphs
void
GraphList
::
UnMarkAll
()
void
kb
GraphList
::
UnMarkAll
()
{
{
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
_LI
.
foreach_mf
(
&
Graph
::
Reset_Mark_and_Bin
);
_LI
.
foreach_mf
(
&
kb
Graph
::
Reset_Mark_and_Bin
);
}
}
//==============================================================================
//==============================================================================
...
@@ -182,9 +182,9 @@ void GraphList::UnMarkAll()
...
@@ -182,9 +182,9 @@ void GraphList::UnMarkAll()
//
//
//==============================================================================
//==============================================================================
void
GraphList
::
Correction
()
void
kb
GraphList
::
Correction
()
{
{
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
int
todo
=
_LI
.
count
();
int
todo
=
_LI
.
count
();
if
(
_GC
->
GetInternalCorrectionFactor
()
)
//not zero
if
(
_GC
->
GetInternalCorrectionFactor
()
)
//not zero
...
@@ -193,7 +193,7 @@ void GraphList::Correction()
...
@@ -193,7 +193,7 @@ void GraphList::Correction()
for
(
int
i
=
0
;
i
<
todo
;
i
++
)
for
(
int
i
=
0
;
i
<
todo
;
i
++
)
{
{
//the input graph will be empty in the end
//the input graph will be empty in the end
GraphList
*
_correct
=
new
GraphList
(
_GC
);
kbGraphList
*
_correct
=
new
kb
GraphList
(
_GC
);
{
{
_LI
.
item
()
->
MakeClockWise
();
_LI
.
item
()
->
MakeClockWise
();
_LI
.
item
()
->
Correction
(
_correct
,
_GC
->
GetInternalCorrectionFactor
()
);
_LI
.
item
()
->
Correction
(
_correct
,
_GC
->
GetInternalCorrectionFactor
()
);
...
@@ -205,7 +205,7 @@ void GraphList::Correction()
...
@@ -205,7 +205,7 @@ void GraphList::Correction()
while
(
!
_correct
->
empty
()
)
while
(
!
_correct
->
empty
()
)
{
{
//add to end
//add to end
_LI
.
insend
(
(
Graph
*
)
_correct
->
headitem
()
);
_LI
.
insend
(
(
kb
Graph
*
)
_correct
->
headitem
()
);
_correct
->
removehead
();
_correct
->
removehead
();
}
}
}
}
...
@@ -214,16 +214,16 @@ void GraphList::Correction()
...
@@ -214,16 +214,16 @@ void GraphList::Correction()
}
}
}
}
void
GraphList
::
MakeRings
()
void
kb
GraphList
::
MakeRings
()
{
{
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
int
todo
=
_LI
.
count
();
int
todo
=
_LI
.
count
();
_LI
.
tohead
();
_LI
.
tohead
();
for
(
int
i
=
0
;
i
<
todo
;
i
++
)
for
(
int
i
=
0
;
i
<
todo
;
i
++
)
{
{
//the input graph will be empty in the end
//the input graph will be empty in the end
GraphList
*
_ring
=
new
GraphList
(
_GC
);
kbGraphList
*
_ring
=
new
kb
GraphList
(
_GC
);
{
{
_LI
.
item
()
->
MakeClockWise
();
_LI
.
item
()
->
MakeClockWise
();
_LI
.
item
()
->
MakeRing
(
_ring
,
_GC
->
GetInternalCorrectionFactor
()
);
_LI
.
item
()
->
MakeRing
(
_ring
,
_GC
->
GetInternalCorrectionFactor
()
);
...
@@ -235,8 +235,8 @@ void GraphList::MakeRings()
...
@@ -235,8 +235,8 @@ void GraphList::MakeRings()
while
(
!
_ring
->
empty
()
)
while
(
!
_ring
->
empty
()
)
{
{
//add to end
//add to end
(
(
Graph
*
)
_ring
->
headitem
()
)
->
MakeClockWise
();
(
(
kb
Graph
*
)
_ring
->
headitem
()
)
->
MakeClockWise
();
_LI
.
insend
(
(
Graph
*
)
_ring
->
headitem
()
);
_LI
.
insend
(
(
kb
Graph
*
)
_ring
->
headitem
()
);
_ring
->
removehead
();
_ring
->
removehead
();
}
}
}
}
...
@@ -246,13 +246,13 @@ void GraphList::MakeRings()
...
@@ -246,13 +246,13 @@ void GraphList::MakeRings()
}
}
//merge the graphs in the list and return the merged result
//merge the graphs in the list and return the merged result
void
GraphList
::
Merge
()
void
kb
GraphList
::
Merge
()
{
{
if
(
count
()
<=
1
)
if
(
count
()
<=
1
)
return
;
return
;
{
{
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -261,7 +261,7 @@ void GraphList::Merge()
...
@@ -261,7 +261,7 @@ void GraphList::Merge()
}
}
}
}
Graph
*
_tomerge
=
new
Graph
(
_GC
);
kbGraph
*
_tomerge
=
new
kb
Graph
(
_GC
);
Renumber
();
Renumber
();
...
@@ -279,14 +279,14 @@ void GraphList::Merge()
...
@@ -279,14 +279,14 @@ void GraphList::Merge()
#define SAVEME 1
#define SAVEME 1
//perform boolean operation on the graphs in the list
//perform boolean operation on the graphs in the list
void
GraphList
::
Boolean
(
BOOL_OP
operation
,
int
intersectionRunsMax
)
void
kb
GraphList
::
Boolean
(
BOOL_OP
operation
,
int
intersectionRunsMax
)
{
{
_GC
->
SetState
(
"Performing Boolean Operation"
);
_GC
->
SetState
(
"Performing Boolean Operation"
);
if
(
count
()
==
0
)
if
(
count
()
==
0
)
return
;
return
;
Graph
*
_prepared
=
new
Graph
(
_GC
);
kbGraph
*
_prepared
=
new
kb
Graph
(
_GC
);
if
(
empty
()
)
if
(
empty
()
)
return
;
return
;
...
@@ -345,9 +345,9 @@ void GraphList::Boolean( BOOL_OP operation, int intersectionRunsMax )
...
@@ -345,9 +345,9 @@ void GraphList::Boolean( BOOL_OP operation, int intersectionRunsMax )
}
}
void
GraphList
::
WriteGraphs
()
void
kb
GraphList
::
WriteGraphs
()
{
{
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
()
)
while
(
!
_LI
.
hitroot
()
)
{
{
...
@@ -356,7 +356,7 @@ void GraphList::WriteGraphs()
...
@@ -356,7 +356,7 @@ void GraphList::WriteGraphs()
}
}
}
}
void
GraphList
::
WriteGraphsKEY
(
Bool_Engine
*
GC
)
void
kb
GraphList
::
WriteGraphsKEY
(
Bool_Engine
*
GC
)
{
{
FILE
*
file
=
fopen
(
"graphkeyfile.key"
,
"w"
);
FILE
*
file
=
fopen
(
"graphkeyfile.key"
,
"w"
);
...
@@ -375,7 +375,7 @@ void GraphList::WriteGraphsKEY( Bool_Engine* GC )
...
@@ -375,7 +375,7 @@ void GraphList::WriteGraphsKEY( Bool_Engine* GC )
STRNAME top; \
STRNAME top; \
"
);
"
);
TDLI
<
Graph
>
_LI
=
TDLI
<
Graph
>
(
this
);
TDLI
<
kbGraph
>
_LI
=
TDLI
<
kb
Graph
>
(
this
);
_LI
.
tohead
();
_LI
.
tohead
();
while
(
!
_LI
.
hitroot
())
while
(
!
_LI
.
hitroot
())
{
{
...
...
polygon/kbool/src/instonly.cpp
View file @
ef2e41e3
...
@@ -3,9 +3,9 @@
...
@@ -3,9 +3,9 @@
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence:
wxWidgets Licence
Licence:
see kboollicense.txt
RCS-ID: $Id: instonly.cpp,v 1.
2 2006/11/05 14:59:31
titato Exp $
RCS-ID: $Id: instonly.cpp,v 1.
3 2009/02/06 21:33:03
titato Exp $
*/
*/
#ifdef __GNUG__
#ifdef __GNUG__
...
...
polygon/kbool/src/line.cpp
View file @
ef2e41e3
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: line.cpp,v 1.
3 2008/06/04 21:23:22
titato Exp $
RCS-ID: $Id: line.cpp,v 1.
4 2009/09/07 19:23:28
titato Exp $
*/
*/
// Standard include files
// Standard include files
...
@@ -25,7 +25,7 @@
...
@@ -25,7 +25,7 @@
//
//
// The default constructor
// The default constructor
//
//
KBoolLine
::
KBool
Line
(
Bool_Engine
*
GC
)
kbLine
::
kb
Line
(
Bool_Engine
*
GC
)
{
{
m_GC
=
GC
;
m_GC
=
GC
;
m_AA
=
0.0
;
m_AA
=
0.0
;
...
@@ -36,7 +36,7 @@ KBoolLine::KBoolLine( Bool_Engine* GC )
...
@@ -36,7 +36,7 @@ KBoolLine::KBoolLine( Bool_Engine* GC )
m_valid_parameters
=
false
;
m_valid_parameters
=
false
;
}
}
KBoolLine
::~
KBool
Line
()
kbLine
::~
kb
Line
()
{
{
if
(
linecrosslist
)
if
(
linecrosslist
)
delete
linecrosslist
;
delete
linecrosslist
;
...
@@ -45,7 +45,7 @@ KBoolLine::~KBoolLine()
...
@@ -45,7 +45,7 @@ KBoolLine::~KBoolLine()
//
//
// constructor with a link
// constructor with a link
//
//
KBoolLine
::
KBoolLine
(
KBool
Link
*
a_link
,
Bool_Engine
*
GC
)
kbLine
::
kbLine
(
kb
Link
*
a_link
,
Bool_Engine
*
GC
)
{
{
m_GC
=
GC
;
m_GC
=
GC
;
// a_link must exist
// a_link must exist
...
@@ -80,7 +80,7 @@ KBoolLine::KBoolLine( KBoolLink *a_link, Bool_Engine* GC )
...
@@ -80,7 +80,7 @@ KBoolLine::KBoolLine( KBoolLink *a_link, Bool_Engine* GC )
// 4: beginnode and endnode are crosspoints, no further investigation
// 4: beginnode and endnode are crosspoints, no further investigation
// 5: beginnode is a crosspoint, need further investigation
// 5: beginnode is a crosspoint, need further investigation
// 6: endnode is a crosspoint, need further investigation
// 6: endnode is a crosspoint, need further investigation
int
KBool
Line
::
ActionOnTable1
(
PointStatus
Result_beginnode
,
PointStatus
Result_endnode
)
int
kb
Line
::
ActionOnTable1
(
PointStatus
Result_beginnode
,
PointStatus
Result_endnode
)
{
{
// Action 1.5 beginnode and endnode are crosspoints, no further investigation needed
// Action 1.5 beginnode and endnode are crosspoints, no further investigation needed
if
(
if
(
...
@@ -196,7 +196,7 @@ int KBoolLine::ActionOnTable1( PointStatus Result_beginnode, PointStatus Result_
...
@@ -196,7 +196,7 @@ int KBoolLine::ActionOnTable1( PointStatus Result_beginnode, PointStatus Result_
// 2: endnode is a crosspoint
// 2: endnode is a crosspoint
// 3: beginnode is a crosspoint
// 3: beginnode is a crosspoint
// 4: beginnode and endnode are crosspoints
// 4: beginnode and endnode are crosspoints
int
KBool
Line
::
ActionOnTable2
(
PointStatus
Result_beginnode
,
PointStatus
Result_endnode
)
int
kb
Line
::
ActionOnTable2
(
PointStatus
Result_beginnode
,
PointStatus
Result_endnode
)
{
{
// Action 2.5, beginnode and eindpoint are crosspoints
// Action 2.5, beginnode and eindpoint are crosspoints
if
(
if
(
...
@@ -290,7 +290,7 @@ int KBoolLine::ActionOnTable2( PointStatus Result_beginnode, PointStatus Result_
...
@@ -290,7 +290,7 @@ int KBoolLine::ActionOnTable2( PointStatus Result_beginnode, PointStatus Result_
// the crossing will be put in the link, because the line will be destructed
// the crossing will be put in the link, because the line will be destructed
// after use of the variable
// after use of the variable
//
//
void
KBoolLine
::
AddLineCrossing
(
B_INT
X
,
B_INT
Y
,
KBool
Line
*
other_line
)
void
kbLine
::
AddLineCrossing
(
B_INT
X
,
B_INT
Y
,
kb
Line
*
other_line
)
{
{
// the other line must exist
// the other line must exist
assert
(
other_line
);
assert
(
other_line
);
...
@@ -301,7 +301,7 @@ void KBoolLine::AddLineCrossing( B_INT X, B_INT Y, KBoolLine *other_line )
...
@@ -301,7 +301,7 @@ void KBoolLine::AddLineCrossing( B_INT X, B_INT Y, KBoolLine *other_line )
// Calculate the Y when the X is given
// Calculate the Y when the X is given
//
//
B_INT
KBool
Line
::
Calculate_Y
(
B_INT
X
)
B_INT
kb
Line
::
Calculate_Y
(
B_INT
X
)
{
{
// link must exist to get info about the nodes
// link must exist to get info about the nodes
assert
(
m_link
);
assert
(
m_link
);
...
@@ -314,7 +314,7 @@ B_INT KBoolLine::Calculate_Y( B_INT X )
...
@@ -314,7 +314,7 @@ B_INT KBoolLine::Calculate_Y( B_INT X )
return
m_link
->
GetBeginNode
()
->
GetY
();
return
m_link
->
GetBeginNode
()
->
GetY
();
}
}
B_INT
KBool
Line
::
Calculate_Y_from_X
(
B_INT
X
)
B_INT
kb
Line
::
Calculate_Y_from_X
(
B_INT
X
)
{
{
// link must exist to get info about the nodes
// link must exist to get info about the nodes
assert
(
m_link
);
assert
(
m_link
);
...
@@ -327,7 +327,7 @@ B_INT KBoolLine::Calculate_Y_from_X( B_INT X )
...
@@ -327,7 +327,7 @@ B_INT KBoolLine::Calculate_Y_from_X( B_INT X )
return
m_link
->
GetBeginNode
()
->
GetY
();
return
m_link
->
GetBeginNode
()
->
GetY
();
}
}
void
KBoolLine
::
Virtual_Point
(
LPoint
*
a_point
,
double
distance
)
void
kbLine
::
Virtual_Point
(
kb
LPoint
*
a_point
,
double
distance
)
{
{
// link must exist to get info about the nodes
// link must exist to get info about the nodes
assert
(
m_link
);
assert
(
m_link
);
...
@@ -345,7 +345,7 @@ void KBoolLine::Virtual_Point( LPoint *a_point, double distance )
...
@@ -345,7 +345,7 @@ void KBoolLine::Virtual_Point( LPoint *a_point, double distance )
//
//
// Calculate the lineparameters for the line if nessecary
// Calculate the lineparameters for the line if nessecary
//
//
void
KBool
Line
::
CalculateLineParameters
()
void
kb
Line
::
CalculateLineParameters
()
{
{
// linkmust exist to get beginnode AND endnode
// linkmust exist to get beginnode AND endnode
assert
(
m_link
);
assert
(
m_link
);
...
@@ -353,7 +353,7 @@ void KBoolLine::CalculateLineParameters()
...
@@ -353,7 +353,7 @@ void KBoolLine::CalculateLineParameters()
// if not valid_parameters calculate the parameters
// if not valid_parameters calculate the parameters
if
(
!
m_valid_parameters
)
if
(
!
m_valid_parameters
)
{
{
Node
*
bp
,
*
ep
;
kb
Node
*
bp
,
*
ep
;
double
length
;
double
length
;
// get the begin and endnode via the link
// get the begin and endnode via the link
...
@@ -390,7 +390,7 @@ void KBoolLine::CalculateLineParameters()
...
@@ -390,7 +390,7 @@ void KBoolLine::CalculateLineParameters()
// return true : lines are crossing
// return true : lines are crossing
// false: lines are not crossing
// false: lines are not crossing
//
//
int
KBoolLine
::
CheckIntersect
(
KBool
Line
*
lijn
,
double
Marge
)
int
kbLine
::
CheckIntersect
(
kb
Line
*
lijn
,
double
Marge
)
{
{
double
distance
=
0
;
double
distance
=
0
;
// link must exist
// link must exist
...
@@ -405,7 +405,7 @@ int KBoolLine::CheckIntersect ( KBoolLine * lijn, double Marge )
...
@@ -405,7 +405,7 @@ int KBoolLine::CheckIntersect ( KBoolLine * lijn, double Marge )
assert
(
!
m_link
);
assert
(
!
m_link
);
int
Take_Action1
,
Take_Action2
,
Total_Result
;
int
Take_Action1
,
Take_Action2
,
Total_Result
;
Node
*
bp
,
*
ep
;
kb
Node
*
bp
,
*
ep
;
PointStatus
Result_beginnode
,
Result_endnode
;
PointStatus
Result_beginnode
,
Result_endnode
;
bp
=
lijn
->
m_link
->
GetBeginNode
();
bp
=
lijn
->
m_link
->
GetBeginNode
();
...
@@ -440,9 +440,9 @@ int KBoolLine::CheckIntersect ( KBoolLine * lijn, double Marge )
...
@@ -440,9 +440,9 @@ int KBoolLine::CheckIntersect ( KBoolLine * lijn, double Marge )
//
//
// Get the beginnode from the line
// Get the beginnode from the line
// usage: Node *anode = a_line.GetBeginNode()
// usage:
kb
Node *anode = a_line.GetBeginNode()
//
//
Node
*
KBool
Line
::
GetBeginNode
()
kbNode
*
kb
Line
::
GetBeginNode
()
{
{
// link must exist
// link must exist
assert
(
m_link
);
assert
(
m_link
);
...
@@ -452,9 +452,9 @@ Node *KBoolLine::GetBeginNode()
...
@@ -452,9 +452,9 @@ Node *KBoolLine::GetBeginNode()
//
//
// Get the endnode from the line
// Get the endnode from the line
// usage: Node *anode = a_line.GetEndNode()
// usage:
kb
Node *anode = a_line.GetEndNode()
//
//
Node
*
KBool
Line
::
GetEndNode
()
kbNode
*
kb
Line
::
GetEndNode
()
{
{
// link must exist
// link must exist
assert
(
m_link
);
assert
(
m_link
);
...
@@ -468,7 +468,7 @@ Node *KBoolLine::GetEndNode()
...
@@ -468,7 +468,7 @@ Node *KBoolLine::GetEndNode()
// return 0: If there are no crossings
// return 0: If there are no crossings
// 1: If there is one crossing
// 1: If there is one crossing
// 2: If there are two crossings
// 2: If there are two crossings
int
KBoolLine
::
Intersect
(
KBool
Line
*
lijn
,
double
Marge
)
int
kbLine
::
Intersect
(
kb
Line
*
lijn
,
double
Marge
)
{
{
double
distance
=
0
;
double
distance
=
0
;
// lijn must exist
// lijn must exist
...
@@ -480,7 +480,7 @@ int KBoolLine::Intersect( KBoolLine * lijn, double Marge )
...
@@ -480,7 +480,7 @@ int KBoolLine::Intersect( KBoolLine * lijn, double Marge )
if
(
m_link
->
GetBeginNode
()
==
m_link
->
GetEndNode
()
)
if
(
m_link
->
GetBeginNode
()
==
m_link
->
GetEndNode
()
)
assert
(
!
m_link
);
assert
(
!
m_link
);
Node
*
bp
,
*
ep
;
kb
Node
*
bp
,
*
ep
;
PointStatus
Result_beginnode
,
Result_endnode
;
PointStatus
Result_beginnode
,
Result_endnode
;
int
Take_Action1
,
Take_Action2
,
Number_of_Crossings
=
0
;
int
Take_Action1
,
Take_Action2
,
Number_of_Crossings
=
0
;
...
@@ -558,7 +558,7 @@ case 1: case 5: case 6:
...
@@ -558,7 +558,7 @@ case 1: case 5: case 6:
// Intersects two lines there must be a crossing
// Intersects two lines there must be a crossing
int
KBoolLine
::
Intersect_simple
(
KBool
Line
*
lijn
)
int
kbLine
::
Intersect_simple
(
kb
Line
*
lijn
)
{
{
// lijn must exist
// lijn must exist
assert
(
lijn
);
assert
(
lijn
);
...
@@ -577,7 +577,7 @@ int KBoolLine::Intersect_simple( KBoolLine * lijn )
...
@@ -577,7 +577,7 @@ int KBoolLine::Intersect_simple( KBoolLine * lijn )
}
}
// Intersects two lines there must be a crossing
// Intersects two lines there must be a crossing
bool
KBoolLine
::
Intersect2
(
Node
*
crossing
,
KBool
Line
*
lijn
)
bool
kbLine
::
Intersect2
(
kbNode
*
crossing
,
kb
Line
*
lijn
)
{
{
// lijn must exist
// lijn must exist
assert
(
lijn
);
assert
(
lijn
);
...
@@ -606,7 +606,7 @@ bool KBoolLine::Intersect2( Node* crossing, KBoolLine * lijn )
...
@@ -606,7 +606,7 @@ bool KBoolLine::Intersect2( Node* crossing, KBoolLine * lijn )
// ON_AREA, when point lies on the infinite line within a range
// ON_AREA, when point lies on the infinite line within a range
// IN_AREA, when point lies in the area of the linesegment
// IN_AREA, when point lies in the area of the linesegment
// the returnvalues are declared in (LINE.H)
// the returnvalues are declared in (LINE.H)
PointStatus
KBoolLine
::
PointInLine
(
Node
*
a_node
,
double
&
Distance
,
double
Marge
)
PointStatus
kbLine
::
PointInLine
(
kb
Node
*
a_node
,
double
&
Distance
,
double
Marge
)
{
{
Distance
=
0
;
Distance
=
0
;
...
@@ -616,7 +616,7 @@ PointStatus KBoolLine::PointInLine( Node *a_node, double& Distance, double Marge
...
@@ -616,7 +616,7 @@ PointStatus KBoolLine::PointInLine( Node *a_node, double& Distance, double Marge
assert
(
m_link
);
assert
(
m_link
);
// get the nodes form the line via the link
// get the nodes form the line via the link
Node
*
bp
,
*
ep
;
kb
Node
*
bp
,
*
ep
;
bp
=
m_link
->
GetBeginNode
();
bp
=
m_link
->
GetBeginNode
();
ep
=
m_link
->
GetEndNode
();
ep
=
m_link
->
GetEndNode
();
...
@@ -662,7 +662,7 @@ PointStatus KBoolLine::PointInLine( Node *a_node, double& Distance, double Marge
...
@@ -662,7 +662,7 @@ PointStatus KBoolLine::PointInLine( Node *a_node, double& Distance, double Marge
// ON_AREA, when point lies on the infinite line within a range
// ON_AREA, when point lies on the infinite line within a range
// RIGHT_SIDE, when point lies on the right side of the line
// RIGHT_SIDE, when point lies on the right side of the line
// LEFT_SIDE , RIGHT_SIDE , ON_AREA
// LEFT_SIDE , RIGHT_SIDE , ON_AREA
PointStatus
KBoolLine
::
PointOnLine
(
Node
*
a_node
,
double
&
Distance
,
double
Marge
)
PointStatus
kbLine
::
PointOnLine
(
kb
Node
*
a_node
,
double
&
Distance
,
double
Marge
)
{
{
Distance
=
0
;
Distance
=
0
;
...
@@ -672,7 +672,7 @@ PointStatus KBoolLine::PointOnLine( Node *a_node, double& Distance, double Marge
...
@@ -672,7 +672,7 @@ PointStatus KBoolLine::PointOnLine( Node *a_node, double& Distance, double Marge
assert
(
m_link
);
assert
(
m_link
);
// get the nodes from the line via the link
// get the nodes from the line via the link
Node
*
bp
,
*
ep
;
kb
Node
*
bp
,
*
ep
;
bp
=
m_link
->
GetBeginNode
();
bp
=
m_link
->
GetBeginNode
();
ep
=
m_link
->
GetEndNode
();
ep
=
m_link
->
GetEndNode
();
...
@@ -705,7 +705,7 @@ PointStatus KBoolLine::PointOnLine( Node *a_node, double& Distance, double Marge
...
@@ -705,7 +705,7 @@ PointStatus KBoolLine::PointOnLine( Node *a_node, double& Distance, double Marge
// Sets lines parameters
// Sets lines parameters
// usage: a_line.Set(a_pointer_to_a_link);
// usage: a_line.Set(a_pointer_to_a_link);
//
//
void
KBoolLine
::
Set
(
KBool
Link
*
a_link
)
void
kbLine
::
Set
(
kb
Link
*
a_link
)
{
{
// points must exist
// points must exist
assert
(
a_link
);
assert
(
a_link
);
...
@@ -719,7 +719,7 @@ void KBoolLine::Set( KBoolLink *a_link )
...
@@ -719,7 +719,7 @@ void KBoolLine::Set( KBoolLink *a_link )
m_valid_parameters
=
false
;
m_valid_parameters
=
false
;
}
}
KBoolLink
*
KBool
Line
::
GetLink
()
kbLink
*
kb
Line
::
GetLink
()
{
{
return
m_link
;
return
m_link
;
}
}
...
@@ -727,7 +727,7 @@ KBoolLink* KBoolLine::GetLink()
...
@@ -727,7 +727,7 @@ KBoolLink* KBoolLine::GetLink()
// makes a line same as these
// makes a line same as these
// usage : line1 = line2;
// usage : line1 = line2;
//
//
KBoolLine
&
KBoolLine
::
operator
=
(
const
KBool
Line
&
a_line
)
kbLine
&
kbLine
::
operator
=
(
const
kb
Line
&
a_line
)
{
{
m_AA
=
a_line
.
m_AA
;
m_AA
=
a_line
.
m_AA
;
m_BB
=
a_line
.
m_BB
;
m_BB
=
a_line
.
m_BB
;
...
@@ -738,37 +738,37 @@ KBoolLine& KBoolLine::operator=( const KBoolLine& a_line )
...
@@ -738,37 +738,37 @@ KBoolLine& KBoolLine::operator=( const KBoolLine& a_line )
return
*
this
;
return
*
this
;
}
}
Node
*
KBoolLine
::
OffsetContour
(
KBoolLine
*
const
nextline
,
Node
*
_last_ins
,
double
factor
,
Graph
*
shape
)
kbNode
*
kbLine
::
OffsetContour
(
kbLine
*
const
nextline
,
kbNode
*
_last_ins
,
double
factor
,
kb
Graph
*
shape
)
{
{
KBool
Link
*
offs_currentlink
;
kb
Link
*
offs_currentlink
;
KBool
Line
offs_currentline
(
m_GC
);
kb
Line
offs_currentline
(
m_GC
);
KBool
Link
*
offs_nextlink
;
kb
Link
*
offs_nextlink
;
KBool
Line
offs_nextline
(
m_GC
);
kb
Line
offs_nextline
(
m_GC
);
Node
*
offs_end
;
kb
Node
*
offs_end
;
Node
*
offs_bgn_next
;
kb
Node
*
offs_bgn_next
;
Node
*
offs_end_next
;
kb
Node
*
offs_end_next
;
// make a node from this point
// make a node from this point
offs_end
=
new
Node
(
GetEndNode
(),
m_GC
);
offs_end
=
new
kb
Node
(
GetEndNode
(),
m_GC
);
Virtual_Point
(
offs_end
,
factor
);
Virtual_Point
(
offs_end
,
factor
);
offs_currentlink
=
new
KBool
Link
(
0
,
_last_ins
,
offs_end
,
m_GC
);
offs_currentlink
=
new
kb
Link
(
0
,
_last_ins
,
offs_end
,
m_GC
);
offs_currentline
.
Set
(
offs_currentlink
);
offs_currentline
.
Set
(
offs_currentlink
);
offs_bgn_next
=
new
Node
(
nextline
->
m_link
->
GetBeginNode
(),
m_GC
);
offs_bgn_next
=
new
kb
Node
(
nextline
->
m_link
->
GetBeginNode
(),
m_GC
);
nextline
->
Virtual_Point
(
offs_bgn_next
,
factor
);
nextline
->
Virtual_Point
(
offs_bgn_next
,
factor
);
offs_end_next
=
new
Node
(
nextline
->
m_link
->
GetEndNode
(),
m_GC
);
offs_end_next
=
new
kb
Node
(
nextline
->
m_link
->
GetEndNode
(),
m_GC
);
nextline
->
Virtual_Point
(
offs_end_next
,
factor
);
nextline
->
Virtual_Point
(
offs_end_next
,
factor
);
offs_nextlink
=
new
KBool
Link
(
0
,
offs_bgn_next
,
offs_end_next
,
m_GC
);
offs_nextlink
=
new
kb
Link
(
0
,
offs_bgn_next
,
offs_end_next
,
m_GC
);
offs_nextline
.
Set
(
offs_nextlink
);
offs_nextline
.
Set
(
offs_nextlink
);
offs_currentline
.
CalculateLineParameters
();
offs_currentline
.
CalculateLineParameters
();
offs_nextline
.
CalculateLineParameters
();
offs_nextline
.
CalculateLineParameters
();
offs_currentline
.
Intersect2
(
offs_end
,
&
offs_nextline
);
offs_currentline
.
Intersect2
(
offs_end
,
&
offs_nextline
);
// make a link between the current and the previous and add this to
g
raph
// make a link between the current and the previous and add this to
kbG
raph
shape
->
AddLink
(
offs_currentlink
);
shape
->
AddLink
(
offs_currentlink
);
delete
offs_nextlink
;
delete
offs_nextlink
;
...
@@ -777,35 +777,35 @@ Node* KBoolLine::OffsetContour( KBoolLine* const nextline, Node* _last_ins, doub
...
@@ -777,35 +777,35 @@ Node* KBoolLine::OffsetContour( KBoolLine* const nextline, Node* _last_ins, doub
}
}
Node
*
KBoolLine
::
OffsetContour_rounded
(
KBoolLine
*
const
nextline
,
Node
*
_last_ins
,
double
factor
,
Graph
*
shape
)
kbNode
*
kbLine
::
OffsetContour_rounded
(
kbLine
*
const
nextline
,
kbNode
*
_last_ins
,
double
factor
,
kb
Graph
*
shape
)
{
{
KBool
Link
*
offs_currentlink
;
kb
Link
*
offs_currentlink
;
KBool
Line
offs_currentline
(
m_GC
);
kb
Line
offs_currentline
(
m_GC
);
KBool
Link
*
offs_nextlink
;
kb
Link
*
offs_nextlink
;
KBool
Line
offs_nextline
(
m_GC
);
kb
Line
offs_nextline
(
m_GC
);
Node
*
offs_end
;
kb
Node
*
offs_end
;
Node
*
medial_axes_point
=
new
Node
(
m_GC
);
kbNode
*
medial_axes_point
=
new
kb
Node
(
m_GC
);
Node
*
bu_last_ins
=
new
Node
(
_last_ins
,
m_GC
);
kbNode
*
bu_last_ins
=
new
kb
Node
(
_last_ins
,
m_GC
);
Node
*
offs_bgn_next
;
kb
Node
*
offs_bgn_next
;
Node
*
offs_end_next
;
kb
Node
*
offs_end_next
;
// make a node from this point
// make a node from this point
offs_end
=
new
Node
(
GetEndNode
(),
m_GC
);
offs_end
=
new
kb
Node
(
GetEndNode
(),
m_GC
);
*
_last_ins
=
*
GetBeginNode
();
*
_last_ins
=
*
GetBeginNode
();
Virtual_Point
(
_last_ins
,
factor
);
Virtual_Point
(
_last_ins
,
factor
);
Virtual_Point
(
offs_end
,
factor
);
Virtual_Point
(
offs_end
,
factor
);
offs_currentlink
=
new
KBool
Link
(
0
,
_last_ins
,
offs_end
,
m_GC
);
offs_currentlink
=
new
kb
Link
(
0
,
_last_ins
,
offs_end
,
m_GC
);
offs_currentline
.
Set
(
offs_currentlink
);
offs_currentline
.
Set
(
offs_currentlink
);
offs_bgn_next
=
new
Node
(
nextline
->
m_link
->
GetBeginNode
(),
m_GC
);
offs_bgn_next
=
new
kb
Node
(
nextline
->
m_link
->
GetBeginNode
(),
m_GC
);
nextline
->
Virtual_Point
(
offs_bgn_next
,
factor
);
nextline
->
Virtual_Point
(
offs_bgn_next
,
factor
);
offs_end_next
=
new
Node
(
nextline
->
m_link
->
GetEndNode
(),
m_GC
);
offs_end_next
=
new
kb
Node
(
nextline
->
m_link
->
GetEndNode
(),
m_GC
);
nextline
->
Virtual_Point
(
offs_end_next
,
factor
);
nextline
->
Virtual_Point
(
offs_end_next
,
factor
);
offs_nextlink
=
new
KBool
Link
(
0
,
offs_bgn_next
,
offs_end_next
,
m_GC
);
offs_nextlink
=
new
kb
Link
(
0
,
offs_bgn_next
,
offs_end_next
,
m_GC
);
offs_nextline
.
Set
(
offs_nextlink
);
offs_nextline
.
Set
(
offs_nextlink
);
offs_currentline
.
CalculateLineParameters
();
offs_currentline
.
CalculateLineParameters
();
...
@@ -821,7 +821,7 @@ Node* KBoolLine::OffsetContour_rounded( KBoolLine* const nextline, Node* _last_i
...
@@ -821,7 +821,7 @@ Node* KBoolLine::OffsetContour_rounded( KBoolLine* const nextline, Node* _last_i
*
offs_end
=
*
medial_axes_point
;
*
offs_end
=
*
medial_axes_point
;
delete
medial_axes_point
;
delete
medial_axes_point
;
delete
bu_last_ins
;
delete
bu_last_ins
;
// make a link between the current and the previous and add this to
g
raph
// make a link between the current and the previous and add this to
kbG
raph
delete
offs_nextlink
;
delete
offs_nextlink
;
shape
->
AddLink
(
offs_currentlink
);
shape
->
AddLink
(
offs_currentlink
);
return
(
offs_end
);
return
(
offs_end
);
...
@@ -831,7 +831,7 @@ Node* KBoolLine::OffsetContour_rounded( KBoolLine* const nextline, Node* _last_i
...
@@ -831,7 +831,7 @@ Node* KBoolLine::OffsetContour_rounded( KBoolLine* const nextline, Node* _last_i
*
_last_ins
=
*
bu_last_ins
;
*
_last_ins
=
*
bu_last_ins
;
delete
medial_axes_point
;
delete
medial_axes_point
;
delete
bu_last_ins
;
delete
bu_last_ins
;
Node
*
endarc
=
new
Node
(
offs_bgn_next
,
m_GC
);
kbNode
*
endarc
=
new
kb
Node
(
offs_bgn_next
,
m_GC
);
shape
->
AddLink
(
offs_currentlink
);
shape
->
AddLink
(
offs_currentlink
);
delete
offs_nextlink
;
delete
offs_nextlink
;
shape
->
CreateArc
(
GetEndNode
(),
&
offs_currentline
,
endarc
,
fabs
(
factor
),
m_GC
->
GetInternalCorrectionAber
()
);
shape
->
CreateArc
(
GetEndNode
(),
&
offs_currentline
,
endarc
,
fabs
(
factor
),
m_GC
->
GetInternalCorrectionAber
()
);
...
@@ -840,7 +840,7 @@ Node* KBoolLine::OffsetContour_rounded( KBoolLine* const nextline, Node* _last_i
...
@@ -840,7 +840,7 @@ Node* KBoolLine::OffsetContour_rounded( KBoolLine* const nextline, Node* _last_i
}
}
bool
KBoolLine
::
OkeForContour
(
KBoolLine
*
const
nextline
,
double
factor
,
Node
*
LastLeft
,
Node
*
LastRight
,
LinkStatus
&
_outproduct
)
bool
kbLine
::
OkeForContour
(
kbLine
*
const
nextline
,
double
factor
,
kbNode
*
LastLeft
,
kb
Node
*
LastRight
,
LinkStatus
&
_outproduct
)
{
{
assert
(
m_link
);
assert
(
m_link
);
assert
(
m_valid_parameters
);
assert
(
m_valid_parameters
);
...
@@ -852,7 +852,7 @@ bool KBoolLine::OkeForContour( KBoolLine* const nextline, double factor, Node* L
...
@@ -852,7 +852,7 @@ bool KBoolLine::OkeForContour( KBoolLine* const nextline, double factor, Node* L
// PointStatus status=ON_AREA;
// PointStatus status=ON_AREA;
double
distance
=
0
;
double
distance
=
0
;
Node
offs_end_next
(
nextline
->
m_link
->
GetEndNode
(),
m_GC
);
kb
Node
offs_end_next
(
nextline
->
m_link
->
GetEndNode
(),
m_GC
);
_outproduct
=
m_link
->
OutProduct
(
nextline
->
m_link
,
m_GC
->
GetAccur
()
);
_outproduct
=
m_link
->
OutProduct
(
nextline
->
m_link
,
m_GC
->
GetAccur
()
);
...
@@ -899,9 +899,9 @@ bool KBoolLine::OkeForContour( KBoolLine* const nextline, double factor, Node* L
...
@@ -899,9 +899,9 @@ bool KBoolLine::OkeForContour( KBoolLine* const nextline, double factor, Node* L
}
}
bool
KBoolLine
::
Create_Ring_Shape
(
KBoolLine
*
nextline
,
Node
**
_last_ins_left
,
Node
**
_last_ins_right
,
double
factor
,
Graph
*
shape
)
bool
kbLine
::
Create_Ring_Shape
(
kbLine
*
nextline
,
kbNode
**
_last_ins_left
,
kbNode
**
_last_ins_right
,
double
factor
,
kb
Graph
*
shape
)
{
{
Node
*
_current
;
kb
Node
*
_current
;
LinkStatus
_outproduct
=
IS_ON
;
LinkStatus
_outproduct
=
IS_ON
;
if
(
OkeForContour
(
nextline
,
factor
,
*
_last_ins_left
,
*
_last_ins_right
,
_outproduct
)
)
if
(
OkeForContour
(
nextline
,
factor
,
*
_last_ins_left
,
*
_last_ins_right
,
_outproduct
)
)
...
@@ -926,14 +926,14 @@ bool KBoolLine::Create_Ring_Shape( KBoolLine* nextline, Node** _last_ins_left, N
...
@@ -926,14 +926,14 @@ bool KBoolLine::Create_Ring_Shape( KBoolLine* nextline, Node** _last_ins_left, N
case
IS_ON
:
case
IS_ON
:
{
{
// make a node from this point
// make a node from this point
_current
=
new
Node
(
m_link
->
GetEndNode
(),
m_GC
);
_current
=
new
kb
Node
(
m_link
->
GetEndNode
(),
m_GC
);
Virtual_Point
(
_current
,
factor
);
Virtual_Point
(
_current
,
factor
);
// make a link between the current and the previous and add this to
g
raph
// make a link between the current and the previous and add this to
kbG
raph
shape
->
AddLink
(
*
_last_ins_left
,
_current
);
shape
->
AddLink
(
*
_last_ins_left
,
_current
);
*
_last_ins_left
=
_current
;
*
_last_ins_left
=
_current
;
_current
=
new
Node
(
m_link
->
GetEndNode
(),
m_GC
);
_current
=
new
kb
Node
(
m_link
->
GetEndNode
(),
m_GC
);
Virtual_Point
(
_current
,
-
factor
);
Virtual_Point
(
_current
,
-
factor
);
shape
->
AddLink
(
*
_last_ins_right
,
_current
);
shape
->
AddLink
(
*
_last_ins_right
,
_current
);
...
@@ -965,14 +965,14 @@ bool KBoolLine::Create_Ring_Shape( KBoolLine* nextline, Node** _last_ins_left, N
...
@@ -965,14 +965,14 @@ bool KBoolLine::Create_Ring_Shape( KBoolLine* nextline, Node** _last_ins_left, N
case IS_ON :
case IS_ON :
{
{
// make a node from this point
// make a node from this point
_current = new Node(m_link->GetEndNode());
_current = new
kb
Node(m_link->GetEndNode());
Virtual_Point(_current,factor);
Virtual_Point(_current,factor);
// make a link between the current and the previous and add this to
g
raph
// make a link between the current and the previous and add this to
kbG
raph
Ishape->AddLink(*_last_ins_left, _current);
Ishape->AddLink(*_last_ins_left, _current);
*_last_ins_left=_current;
*_last_ins_left=_current;
_current = new Node(m_link->GetEndNode());
_current = new
kb
Node(m_link->GetEndNode());
Virtual_Point(_current,-factor);
Virtual_Point(_current,-factor);
Ishape->AddLink(*_last_ins_right, _current);
Ishape->AddLink(*_last_ins_right, _current);
...
@@ -987,7 +987,7 @@ bool KBoolLine::Create_Ring_Shape( KBoolLine* nextline, Node** _last_ins_left, N
...
@@ -987,7 +987,7 @@ bool KBoolLine::Create_Ring_Shape( KBoolLine* nextline, Node** _last_ins_left, N
}
}
void
KBoolLine
::
Create_Begin_Shape
(
KBoolLine
*
nextline
,
Node
**
_last_ins_left
,
Node
**
_last_ins_right
,
double
factor
,
Graph
*
shape
)
void
kbLine
::
Create_Begin_Shape
(
kbLine
*
nextline
,
kbNode
**
_last_ins_left
,
kbNode
**
_last_ins_right
,
double
factor
,
kb
Graph
*
shape
)
{
{
factor
=
fabs
(
factor
);
factor
=
fabs
(
factor
);
LinkStatus
_outproduct
;
LinkStatus
_outproduct
;
...
@@ -997,11 +997,11 @@ void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left,
...
@@ -997,11 +997,11 @@ void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left,
{
{
case
IS_RIGHT
:
case
IS_RIGHT
:
{
{
*
_last_ins_left
=
new
Node
(
m_link
->
GetEndNode
(),
m_GC
);
*
_last_ins_left
=
new
kb
Node
(
m_link
->
GetEndNode
(),
m_GC
);
Virtual_Point
(
*
_last_ins_left
,
factor
);
Virtual_Point
(
*
_last_ins_left
,
factor
);
*
_last_ins_right
=
new
Node
(
nextline
->
m_link
->
GetBeginNode
(),
m_GC
);
*
_last_ins_right
=
new
kb
Node
(
nextline
->
m_link
->
GetBeginNode
(),
m_GC
);
nextline
->
Virtual_Point
(
*
_last_ins_right
,
-
factor
);
nextline
->
Virtual_Point
(
*
_last_ins_right
,
-
factor
);
shape
->
AddLink
(
*
_last_ins_left
,
*
_last_ins_right
);
shape
->
AddLink
(
*
_last_ins_left
,
*
_last_ins_right
);
...
@@ -1011,10 +1011,10 @@ void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left,
...
@@ -1011,10 +1011,10 @@ void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left,
break
;
break
;
case
IS_LEFT
:
case
IS_LEFT
:
{
{
*
_last_ins_left
=
new
Node
(
nextline
->
m_link
->
GetBeginNode
(),
m_GC
);
*
_last_ins_left
=
new
kb
Node
(
nextline
->
m_link
->
GetBeginNode
(),
m_GC
);
nextline
->
Virtual_Point
(
*
_last_ins_left
,
factor
);
nextline
->
Virtual_Point
(
*
_last_ins_left
,
factor
);
*
_last_ins_right
=
new
Node
(
m_link
->
GetEndNode
(),
m_GC
);
*
_last_ins_right
=
new
kb
Node
(
m_link
->
GetEndNode
(),
m_GC
);
Virtual_Point
(
*
_last_ins_right
,
-
factor
);
Virtual_Point
(
*
_last_ins_right
,
-
factor
);
shape
->
AddLink
(
*
_last_ins_left
,
*
_last_ins_right
);
shape
->
AddLink
(
*
_last_ins_left
,
*
_last_ins_right
);
...
@@ -1025,10 +1025,10 @@ void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left,
...
@@ -1025,10 +1025,10 @@ void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left,
// Line 2 lies on this line
// Line 2 lies on this line
case
IS_ON
:
case
IS_ON
:
{
{
*
_last_ins_left
=
new
Node
(
nextline
->
m_link
->
GetBeginNode
(),
m_GC
);
*
_last_ins_left
=
new
kb
Node
(
nextline
->
m_link
->
GetBeginNode
(),
m_GC
);
Virtual_Point
(
*
_last_ins_left
,
factor
);
Virtual_Point
(
*
_last_ins_left
,
factor
);
*
_last_ins_right
=
new
Node
(
nextline
->
m_link
->
GetBeginNode
(),
m_GC
);
*
_last_ins_right
=
new
kb
Node
(
nextline
->
m_link
->
GetBeginNode
(),
m_GC
);
Virtual_Point
(
*
_last_ins_right
,
-
factor
);
Virtual_Point
(
*
_last_ins_right
,
-
factor
);
shape
->
AddLink
(
*
_last_ins_left
,
*
_last_ins_right
);
shape
->
AddLink
(
*
_last_ins_left
,
*
_last_ins_right
);
...
@@ -1038,9 +1038,9 @@ void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left,
...
@@ -1038,9 +1038,9 @@ void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left,
}
}
void
KBoolLine
::
Create_End_Shape
(
KBoolLine
*
nextline
,
Node
*
_last_ins_left
,
Node
*
_last_ins_right
,
double
factor
,
Graph
*
shape
)
void
kbLine
::
Create_End_Shape
(
kbLine
*
nextline
,
kbNode
*
_last_ins_left
,
kbNode
*
_last_ins_right
,
double
factor
,
kb
Graph
*
shape
)
{
{
Node
*
_current
;
kb
Node
*
_current
;
factor
=
fabs
(
factor
);
factor
=
fabs
(
factor
);
LinkStatus
_outproduct
;
LinkStatus
_outproduct
;
_outproduct
=
m_link
->
OutProduct
(
nextline
->
m_link
,
m_GC
->
GetAccur
()
);
_outproduct
=
m_link
->
OutProduct
(
nextline
->
m_link
,
m_GC
->
GetAccur
()
);
...
@@ -1049,7 +1049,7 @@ void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Nod
...
@@ -1049,7 +1049,7 @@ void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Nod
{
{
case
IS_RIGHT
:
case
IS_RIGHT
:
{
{
_current
=
new
Node
(
m_link
->
GetEndNode
(),
m_GC
);
_current
=
new
kb
Node
(
m_link
->
GetEndNode
(),
m_GC
);
Virtual_Point
(
_current
,
-
factor
);
Virtual_Point
(
_current
,
-
factor
);
shape
->
AddLink
(
_last_ins_right
,
_current
);
shape
->
AddLink
(
_last_ins_right
,
_current
);
_last_ins_right
=
_current
;
_last_ins_right
=
_current
;
...
@@ -1060,7 +1060,7 @@ void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Nod
...
@@ -1060,7 +1060,7 @@ void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Nod
break
;
break
;
case
IS_LEFT
:
case
IS_LEFT
:
{
{
_current
=
new
Node
(
m_link
->
GetEndNode
(),
m_GC
);
_current
=
new
kb
Node
(
m_link
->
GetEndNode
(),
m_GC
);
Virtual_Point
(
_current
,
factor
);
Virtual_Point
(
_current
,
factor
);
shape
->
AddLink
(
_last_ins_left
,
_current
);
shape
->
AddLink
(
_last_ins_left
,
_current
);
_last_ins_left
=
_current
;
_last_ins_left
=
_current
;
...
@@ -1072,12 +1072,12 @@ void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Nod
...
@@ -1072,12 +1072,12 @@ void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Nod
// Line 2 lies on this line
// Line 2 lies on this line
case
IS_ON
:
case
IS_ON
:
{
{
_current
=
new
Node
(
m_link
->
GetEndNode
(),
m_GC
);
_current
=
new
kb
Node
(
m_link
->
GetEndNode
(),
m_GC
);
Virtual_Point
(
_current
,
factor
);
Virtual_Point
(
_current
,
factor
);
shape
->
AddLink
(
_last_ins_left
,
_current
);
shape
->
AddLink
(
_last_ins_left
,
_current
);
_last_ins_left
=
_current
;
_last_ins_left
=
_current
;
_current
=
new
Node
(
m_link
->
GetEndNode
(),
m_GC
);
_current
=
new
kb
Node
(
m_link
->
GetEndNode
(),
m_GC
);
Virtual_Point
(
_current
,
-
factor
);
Virtual_Point
(
_current
,
-
factor
);
shape
->
AddLink
(
_last_ins_right
,
_current
);
shape
->
AddLink
(
_last_ins_right
,
_current
);
_last_ins_right
=
_current
;
_last_ins_right
=
_current
;
...
@@ -1090,11 +1090,11 @@ void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Nod
...
@@ -1090,11 +1090,11 @@ void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Nod
}
}
//
//
// Generate from the found crossings a part of the
g
raph
// Generate from the found crossings a part of the
kbG
raph
//
//
bool
KBoolLine
::
ProcessCrossings
(
TDLI
<
KBool
Link
>*
_LI
)
bool
kbLine
::
ProcessCrossings
(
TDLI
<
kb
Link
>*
_LI
)
{
{
Node
*
last
;
KBool
Link
*
dummy
;
kbNode
*
last
;
kb
Link
*
dummy
;
// assert (beginnode && endnode);
// assert (beginnode && endnode);
if
(
!
linecrosslist
)
return
false
;
if
(
!
linecrosslist
)
return
false
;
...
@@ -1106,11 +1106,11 @@ bool KBoolLine::ProcessCrossings( TDLI<KBoolLink>* _LI )
...
@@ -1106,11 +1106,11 @@ bool KBoolLine::ProcessCrossings( TDLI<KBoolLink>* _LI )
// Make new links :
// Make new links :
while
(
!
linecrosslist
->
empty
()
)
while
(
!
linecrosslist
->
empty
()
)
{
{
dummy
=
new
KBoolLink
(
m_link
->
GetGraphNum
(),
(
Node
*
)
linecrosslist
->
tailitem
(),
last
,
m_GC
);
dummy
=
new
kbLink
(
m_link
->
GetGraphNum
(),
(
kb
Node
*
)
linecrosslist
->
tailitem
(),
last
,
m_GC
);
dummy
->
SetBeenHere
();
dummy
->
SetBeenHere
();
dummy
->
SetGroup
(
m_link
->
Group
()
);
dummy
->
SetGroup
(
m_link
->
Group
()
);
_LI
->
insbegin
(
dummy
);
_LI
->
insbegin
(
dummy
);
last
=
(
Node
*
)
linecrosslist
->
tailitem
();
last
=
(
kb
Node
*
)
linecrosslist
->
tailitem
();
linecrosslist
->
removetail
();
linecrosslist
->
removetail
();
}
}
// Recycle this link :
// Recycle this link :
...
@@ -1123,7 +1123,7 @@ bool KBoolLine::ProcessCrossings( TDLI<KBoolLink>* _LI )
...
@@ -1123,7 +1123,7 @@ bool KBoolLine::ProcessCrossings( TDLI<KBoolLink>* _LI )
/*
/*
// Sorts the links on the X values
// Sorts the links on the X values
int NodeXYsorter(
Node* a,
Node* b)
int NodeXYsorter(
kbNode* a, kb
Node* b)
{
{
if ( a->GetX() < b->GetX())
if ( a->GetX() < b->GetX())
return(1);
return(1);
...
@@ -1147,11 +1147,11 @@ int NodeXYsorter(Node* a, Node* b)
...
@@ -1147,11 +1147,11 @@ int NodeXYsorter(Node* a, Node* b)
// The mostleft link most become the new link for the beam record
// The mostleft link most become the new link for the beam record
// therefore the mostleft new/old link is returned to become the beam record link
// therefore the mostleft new/old link is returned to become the beam record link
// also the part returned needs to have the bin flag set to the original value it had in the beam
// also the part returned needs to have the bin flag set to the original value it had in the beam
KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBool
Link>* _LI)
kbLink* kbLine::ProcessCrossingsSmart(TDLI<kb
Link>* _LI)
{
{
Node *lastinserted;
kb
Node *lastinserted;
KBool
Link *new_link;
kb
Link *new_link;
KBool
Link *returnlink;
kb
Link *returnlink;
assert (beginnode && endnode);
assert (beginnode && endnode);
if (!linecrosslist) return this;
if (!linecrosslist) return this;
...
@@ -1168,7 +1168,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
...
@@ -1168,7 +1168,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
//re_use this link
//re_use this link
endnode->RemoveLink(this);
endnode->RemoveLink(this);
linecrosslist->insend(endnode); //the last link to create is towards this node
linecrosslist->insend(endnode); //the last link to create is towards this node
endnode=(Node*) linecrosslist->headitem();
endnode=(
kb
Node*) linecrosslist->headitem();
endnode->AddLink(this);
endnode->AddLink(this);
inbeam=NodeXYsorter(_LI->item()->beginnode,beginnode);
inbeam=NodeXYsorter(_LI->item()->beginnode,beginnode);
switch (inbeam)
switch (inbeam)
...
@@ -1188,7 +1188,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
...
@@ -1188,7 +1188,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
// Make new links starting at endnode
// Make new links starting at endnode
while (!linecrosslist->empty())
while (!linecrosslist->empty())
{
{
new_link=new
KBoolLink(graphnum,lastinserted,(
Node*) linecrosslist->headitem());
new_link=new
kbLink(graphnum,lastinserted,(kb
Node*) linecrosslist->headitem());
new_link->group=group;
new_link->group=group;
int inbeam=NodeXYsorter(_LI->item()->beginnode,lastinserted);
int inbeam=NodeXYsorter(_LI->item()->beginnode,lastinserted);
...
@@ -1198,8 +1198,8 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
...
@@ -1198,8 +1198,8 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
{
{
double x,y,xl,yl;
double x,y,xl,yl;
char buf[80];
char buf[80];
x=((Node*)(linecrosslist->headitem()))->GetX();
x=((
kb
Node*)(linecrosslist->headitem()))->GetX();
y=((Node*)(linecrosslist->headitem()))->GetY();
y=((
kb
Node*)(linecrosslist->headitem()))->GetY();
xl=_LI->item()->beginnode->GetX();
xl=_LI->item()->beginnode->GetX();
yl=_LI->item()->beginnode->GetY();
yl=_LI->item()->beginnode->GetY();
sprintf(buf," x=%f , y=%f inserted before %f,%f",x,y,xl,yl);
sprintf(buf," x=%f , y=%f inserted before %f,%f",x,y,xl,yl);
...
@@ -1238,7 +1238,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
...
@@ -1238,7 +1238,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
_LI->insbefore_unsave(new_link);
_LI->insbefore_unsave(new_link);
if (insert==0 && _LI->item()->beginnode!=new_link->beginnode)
if (insert==0 && _LI->item()->beginnode!=new_link->beginnode)
//the begin nodes are equal but not the same merge them into one node
//the begin nodes are equal but not the same merge them into one node
{ Node* todelete=_LI->item()->beginnode;
{
kb
Node* todelete=_LI->item()->beginnode;
new_link->beginnode->Merge(todelete);
new_link->beginnode->Merge(todelete);
delete todelete;
delete todelete;
}
}
...
@@ -1247,7 +1247,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
...
@@ -1247,7 +1247,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
(*_LI) << (i+1);
(*_LI) << (i+1);
}
}
lastinserted=(Node*)linecrosslist->headitem();
lastinserted=(
kb
Node*)linecrosslist->headitem();
linecrosslist->removehead();
linecrosslist->removehead();
}
}
}
}
...
@@ -1256,7 +1256,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
...
@@ -1256,7 +1256,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
//re_use this link
//re_use this link
endnode->RemoveLink(this);
endnode->RemoveLink(this);
linecrosslist->insend(endnode); //the last link to create is towards this node
linecrosslist->insend(endnode); //the last link to create is towards this node
endnode=(Node*) linecrosslist->headitem();
endnode=(
kb
Node*) linecrosslist->headitem();
endnode->AddLink(this);
endnode->AddLink(this);
inbeam=NodeXYsorter(_LI->item()->beginnode,endnode);
inbeam=NodeXYsorter(_LI->item()->beginnode,endnode);
switch (inbeam)
switch (inbeam)
...
@@ -1277,10 +1277,10 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
...
@@ -1277,10 +1277,10 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
// Make new links starting at endnode
// Make new links starting at endnode
while (!linecrosslist->empty())
while (!linecrosslist->empty())
{
{
new_link=new
KBoolLink(graphnum,lastinserted,(
Node*) linecrosslist->headitem());
new_link=new
kbLink(graphnum,lastinserted,(kb
Node*) linecrosslist->headitem());
new_link->group=group;
new_link->group=group;
inbeam=NodeXYsorter(_LI->item()->beginnode,(Node*) linecrosslist->headitem());
inbeam=NodeXYsorter(_LI->item()->beginnode,(
kb
Node*) linecrosslist->headitem());
switch (inbeam)
switch (inbeam)
{
{
case -1:
case -1:
...
@@ -1335,7 +1335,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
...
@@ -1335,7 +1335,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
_LI->insbefore_unsave(new_link);
_LI->insbefore_unsave(new_link);
if (insert==0 && _LI->item()->beginnode!=new_link->beginnode)
if (insert==0 && _LI->item()->beginnode!=new_link->beginnode)
//the begin nodes are equal but not the same merge them into one node
//the begin nodes are equal but not the same merge them into one node
{ Node* todelete=_LI->item()->beginnode;
{
kb
Node* todelete=_LI->item()->beginnode;
new_link->beginnode->Merge(todelete);
new_link->beginnode->Merge(todelete);
delete todelete;
delete todelete;
}
}
...
@@ -1343,7 +1343,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
...
@@ -1343,7 +1343,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
(*_LI) << (i+1);
(*_LI) << (i+1);
}
}
lastinserted=(Node*)linecrosslist->headitem();
lastinserted=(
kb
Node*)linecrosslist->headitem();
linecrosslist->removehead();
linecrosslist->removehead();
}
}
}
}
...
@@ -1354,7 +1354,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
...
@@ -1354,7 +1354,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
}
}
*/
*/
static
int
NODE_X_ASCENDING_L
(
Node
*
a
,
Node
*
b
)
static
int
NODE_X_ASCENDING_L
(
kbNode
*
a
,
kb
Node
*
b
)
{
{
if
(
b
->
GetX
()
>
a
->
GetX
()
)
return
(
1
);
if
(
b
->
GetX
()
>
a
->
GetX
()
)
return
(
1
);
else
else
...
@@ -1363,7 +1363,7 @@ static int NODE_X_ASCENDING_L ( Node* a, Node* b )
...
@@ -1363,7 +1363,7 @@ static int NODE_X_ASCENDING_L ( Node* a, Node* b )
return
(
-
1
);
return
(
-
1
);
}
}
static
int
NODE_X_DESCENDING_L
(
Node
*
a
,
Node
*
b
)
static
int
NODE_X_DESCENDING_L
(
kbNode
*
a
,
kb
Node
*
b
)
{
{
if
(
a
->
GetX
()
>
b
->
GetX
()
)
return
(
1
);
if
(
a
->
GetX
()
>
b
->
GetX
()
)
return
(
1
);
else
else
...
@@ -1372,7 +1372,7 @@ static int NODE_X_DESCENDING_L( Node* a, Node* b )
...
@@ -1372,7 +1372,7 @@ static int NODE_X_DESCENDING_L( Node* a, Node* b )
return
(
-
1
);
return
(
-
1
);
}
}
static
int
NODE_Y_ASCENDING_L
(
Node
*
a
,
Node
*
b
)
static
int
NODE_Y_ASCENDING_L
(
kbNode
*
a
,
kb
Node
*
b
)
{
{
if
(
b
->
GetY
()
>
a
->
GetY
()
)
return
(
1
);
if
(
b
->
GetY
()
>
a
->
GetY
()
)
return
(
1
);
else
else
...
@@ -1380,7 +1380,7 @@ static int NODE_Y_ASCENDING_L ( Node* a, Node* b )
...
@@ -1380,7 +1380,7 @@ static int NODE_Y_ASCENDING_L ( Node* a, Node* b )
return
(
-
1
);
return
(
-
1
);
}
}
static
int
NODE_Y_DESCENDING_L
(
Node
*
a
,
Node
*
b
)
static
int
NODE_Y_DESCENDING_L
(
kbNode
*
a
,
kb
Node
*
b
)
{
{
if
(
a
->
GetY
()
>
b
->
GetY
()
)
return
(
1
);
if
(
a
->
GetY
()
>
b
->
GetY
()
)
return
(
1
);
else
else
...
@@ -1393,9 +1393,9 @@ static int NODE_Y_DESCENDING_L( Node* a, Node* b )
...
@@ -1393,9 +1393,9 @@ static int NODE_Y_DESCENDING_L( Node* a, Node* b )
// This function finds out which sortfunction to use with sorting
// This function finds out which sortfunction to use with sorting
// the crossings.
// the crossings.
//
//
void
KBool
Line
::
SortLineCrossings
()
void
kb
Line
::
SortLineCrossings
()
{
{
TDLI
<
Node
>
I
(
linecrosslist
);
TDLI
<
kb
Node
>
I
(
linecrosslist
);
B_INT
dx
,
dy
;
B_INT
dx
,
dy
;
dx
=
babs
(
m_link
->
GetEndNode
()
->
GetX
()
-
m_link
->
GetBeginNode
()
->
GetX
()
);
dx
=
babs
(
m_link
->
GetEndNode
()
->
GetX
()
-
m_link
->
GetBeginNode
()
->
GetX
()
);
...
@@ -1419,7 +1419,7 @@ void KBoolLine::SortLineCrossings()
...
@@ -1419,7 +1419,7 @@ void KBoolLine::SortLineCrossings()
//
//
// Adds a cross Node to this. a_node may not be deleted before processing the crossings
// Adds a cross Node to this. a_node may not be deleted before processing the crossings
//
//
void
KBoolLine
::
AddCrossing
(
Node
*
a_node
)
void
kbLine
::
AddCrossing
(
kb
Node
*
a_node
)
{
{
if
(
a_node
==
m_link
->
GetBeginNode
()
||
a_node
==
m_link
->
GetEndNode
()
)
return
;
if
(
a_node
==
m_link
->
GetBeginNode
()
||
a_node
==
m_link
->
GetEndNode
()
)
return
;
...
@@ -1431,7 +1431,7 @@ void KBoolLine::AddCrossing( Node *a_node )
...
@@ -1431,7 +1431,7 @@ void KBoolLine::AddCrossing( Node *a_node )
}
}
else
else
{
{
TDLI
<
Node
>
I
(
linecrosslist
);
TDLI
<
kb
Node
>
I
(
linecrosslist
);
if
(
!
I
.
has
(
a_node
)
)
if
(
!
I
.
has
(
a_node
)
)
I
.
insend
(
a_node
);
I
.
insend
(
a_node
);
}
}
...
@@ -1440,21 +1440,21 @@ void KBoolLine::AddCrossing( Node *a_node )
...
@@ -1440,21 +1440,21 @@ void KBoolLine::AddCrossing( Node *a_node )
//
//
// see above
// see above
//
//
Node
*
KBool
Line
::
AddCrossing
(
B_INT
X
,
B_INT
Y
)
kbNode
*
kb
Line
::
AddCrossing
(
B_INT
X
,
B_INT
Y
)
{
{
Node
*
result
=
new
Node
(
X
,
Y
,
m_GC
);
kbNode
*
result
=
new
kb
Node
(
X
,
Y
,
m_GC
);
AddCrossing
(
result
);
AddCrossing
(
result
);
return
result
;
return
result
;
}
}
DL_List
<
void
*>*
KBool
Line
::
GetCrossList
()
DL_List
<
void
*>*
kb
Line
::
GetCrossList
()
{
{
if
(
linecrosslist
)
if
(
linecrosslist
)
return
linecrosslist
;
return
linecrosslist
;
return
NULL
;
return
NULL
;
}
}
bool
KBool
Line
::
CrossListEmpty
()
bool
kb
Line
::
CrossListEmpty
()
{
{
if
(
linecrosslist
)
if
(
linecrosslist
)
return
linecrosslist
->
empty
();
return
linecrosslist
->
empty
();
...
@@ -1462,11 +1462,11 @@ bool KBoolLine::CrossListEmpty()
...
@@ -1462,11 +1462,11 @@ bool KBoolLine::CrossListEmpty()
}
}
/*
/*
bool
KBoolLine::HasInCrossList(
Node *n)
bool
kbLine::HasInCrossList(kb
Node *n)
{
{
if(linecrosslist!=NULL)
if(linecrosslist!=NULL)
{
{
TDLI<Node> I(linecrosslist);
TDLI<
kb
Node> I(linecrosslist);
return I.has(n);
return I.has(n);
}
}
return false;
return false;
...
...
polygon/kbool/src/link.cpp
View file @
ef2e41e3
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: link.cpp,v 1.
3 2008/06/04 21:23:22
titato Exp $
RCS-ID: $Id: link.cpp,v 1.
4 2009/09/07 19:23:28
titato Exp $
*/
*/
#include "kbool/booleng.h"
#include "kbool/booleng.h"
...
@@ -19,12 +19,12 @@
...
@@ -19,12 +19,12 @@
#include "kbool/graph.h"
#include "kbool/graph.h"
#include "kbool/graphlst.h"
#include "kbool/graphlst.h"
int
linkXYsorter
(
KBoolLink
*
,
KBool
Link
*
);
int
linkXYsorter
(
kbLink
*
,
kb
Link
*
);
//
//
// Default constructor
// Default constructor
//
//
KBoolLink
::
KBool
Link
(
Bool_Engine
*
GC
)
kbLink
::
kb
Link
(
Bool_Engine
*
GC
)
{
{
_GC
=
GC
;
_GC
=
GC
;
Reset
();
Reset
();
...
@@ -34,7 +34,7 @@ KBoolLink::KBoolLink( Bool_Engine* GC )
...
@@ -34,7 +34,7 @@ KBoolLink::KBoolLink( Bool_Engine* GC )
//
//
// This constructor makes this link a valid part of a graph
// This constructor makes this link a valid part of a graph
//
//
KBoolLink
::
KBoolLink
(
int
graphnr
,
Node
*
begin
,
Node
*
end
,
Bool_Engine
*
GC
)
kbLink
::
kbLink
(
int
graphnr
,
kbNode
*
begin
,
kb
Node
*
end
,
Bool_Engine
*
GC
)
{
{
_GC
=
GC
;
_GC
=
GC
;
Reset
();
Reset
();
...
@@ -50,7 +50,7 @@ KBoolLink::KBoolLink( int graphnr, Node *begin, Node *end, Bool_Engine* GC )
...
@@ -50,7 +50,7 @@ KBoolLink::KBoolLink( int graphnr, Node *begin, Node *end, Bool_Engine* GC )
//
//
// This constructor makes this link a valid part of a graph
// This constructor makes this link a valid part of a graph
//
//
KBoolLink
::
KBoolLink
(
Node
*
begin
,
Node
*
end
,
Bool_Engine
*
GC
)
kbLink
::
kbLink
(
kbNode
*
begin
,
kb
Node
*
end
,
Bool_Engine
*
GC
)
{
{
_GC
=
GC
;
_GC
=
GC
;
Reset
();
Reset
();
...
@@ -67,7 +67,7 @@ KBoolLink::KBoolLink( Node *begin, Node *end, Bool_Engine* GC )
...
@@ -67,7 +67,7 @@ KBoolLink::KBoolLink( Node *begin, Node *end, Bool_Engine* GC )
//
//
// Destructor
// Destructor
//
//
KBoolLink
::~
KBool
Link
()
kbLink
::~
kb
Link
()
{
{
UnLink
();
UnLink
();
}
}
...
@@ -75,13 +75,13 @@ KBoolLink::~KBoolLink()
...
@@ -75,13 +75,13 @@ KBoolLink::~KBoolLink()
//
//
// Checks whether the current algorithm has been on this link
// Checks whether the current algorithm has been on this link
//
//
bool
KBool
Link
::
BeenHere
()
bool
kb
Link
::
BeenHere
()
{
{
if
(
m_bin
)
return
true
;
if
(
m_bin
)
return
true
;
return
false
;
return
false
;
}
}
void
KBoolLink
::
TakeOverOperationFlags
(
KBool
Link
*
link
)
void
kbLink
::
TakeOverOperationFlags
(
kb
Link
*
link
)
{
{
m_merge_L
=
link
->
m_merge_L
;
m_merge_L
=
link
->
m_merge_L
;
m_a_substract_b_L
=
link
->
m_a_substract_b_L
;
m_a_substract_b_L
=
link
->
m_a_substract_b_L
;
...
@@ -98,7 +98,7 @@ void KBoolLink::TakeOverOperationFlags( KBoolLink* link )
...
@@ -98,7 +98,7 @@ void KBoolLink::TakeOverOperationFlags( KBoolLink* link )
//
//
// Returns the next link from the argument
// Returns the next link from the argument
//
//
KBoolLink
*
KBoolLink
::
Forth
(
Node
*
node
)
kbLink
*
kbLink
::
Forth
(
kb
Node
*
node
)
{
{
assert
(
node
==
m_beginnode
||
node
==
m_endnode
);
assert
(
node
==
m_beginnode
||
node
==
m_endnode
);
return
node
->
GetOtherLink
(
this
);
return
node
->
GetOtherLink
(
this
);
...
@@ -107,7 +107,7 @@ KBoolLink* KBoolLink::Forth( Node *node )
...
@@ -107,7 +107,7 @@ KBoolLink* KBoolLink::Forth( Node *node )
//
//
// Returns the Beginnode
// Returns the Beginnode
//
//
Node
*
KBool
Link
::
GetBeginNode
()
kbNode
*
kb
Link
::
GetBeginNode
()
{
{
return
m_beginnode
;
return
m_beginnode
;
}
}
...
@@ -115,17 +115,17 @@ Node *KBoolLink::GetBeginNode()
...
@@ -115,17 +115,17 @@ Node *KBoolLink::GetBeginNode()
//
//
// Returns the endnode
// Returns the endnode
//
//
Node
*
KBool
Link
::
GetEndNode
()
kbNode
*
kb
Link
::
GetEndNode
()
{
{
return
m_endnode
;
return
m_endnode
;
}
}
Node
*
KBool
Link
::
GetLowNode
()
kbNode
*
kb
Link
::
GetLowNode
()
{
{
return
(
(
m_beginnode
->
GetY
()
<
m_endnode
->
GetY
()
)
?
m_beginnode
:
m_endnode
);
return
(
(
m_beginnode
->
GetY
()
<
m_endnode
->
GetY
()
)
?
m_beginnode
:
m_endnode
);
}
}
Node
*
KBool
Link
::
GetHighNode
()
kbNode
*
kb
Link
::
GetHighNode
()
{
{
return
(
(
m_beginnode
->
GetY
()
>
m_endnode
->
GetY
()
)
?
m_beginnode
:
m_endnode
);
return
(
(
m_beginnode
->
GetY
()
>
m_endnode
->
GetY
()
)
?
m_beginnode
:
m_endnode
);
}
}
...
@@ -133,61 +133,61 @@ Node* KBoolLink::GetHighNode()
...
@@ -133,61 +133,61 @@ Node* KBoolLink::GetHighNode()
//
//
// Returns the graphnumber
// Returns the graphnumber
//
//
int
KBool
Link
::
GetGraphNum
()
int
kb
Link
::
GetGraphNum
()
{
{
return
m_graphnum
;
return
m_graphnum
;
}
}
bool
KBool
Link
::
GetInc
()
bool
kb
Link
::
GetInc
()
{
{
return
m_Inc
;
return
m_Inc
;
// if (Inc) return true;
// if (Inc) return true;
// return false;
// return false;
}
}
void
KBool
Link
::
SetInc
(
bool
inc
)
void
kb
Link
::
SetInc
(
bool
inc
)
{
{
m_Inc
=
inc
;
m_Inc
=
inc
;
// Inc=0;
// Inc=0;
// if (inc) Inc=1;
// if (inc) Inc=1;
}
}
bool
KBool
Link
::
GetLeftA
()
bool
kb
Link
::
GetLeftA
()
{
{
return
m_LeftA
;
return
m_LeftA
;
}
}
void
KBool
Link
::
SetLeftA
(
bool
la
)
void
kb
Link
::
SetLeftA
(
bool
la
)
{
{
m_LeftA
=
la
;
m_LeftA
=
la
;
}
}
bool
KBool
Link
::
GetLeftB
()
bool
kb
Link
::
GetLeftB
()
{
{
return
m_LeftB
;
return
m_LeftB
;
}
}
void
KBool
Link
::
SetLeftB
(
bool
lb
)
void
kb
Link
::
SetLeftB
(
bool
lb
)
{
{
m_LeftB
=
lb
;
m_LeftB
=
lb
;
}
}
bool
KBool
Link
::
GetRightA
()
bool
kb
Link
::
GetRightA
()
{
{
return
m_RightA
;
return
m_RightA
;
}
}
void
KBool
Link
::
SetRightA
(
bool
ra
)
void
kb
Link
::
SetRightA
(
bool
ra
)
{
{
m_RightA
=
ra
;
m_RightA
=
ra
;
}
}
bool
KBool
Link
::
GetRightB
()
bool
kb
Link
::
GetRightB
()
{
{
return
m_RightB
;
return
m_RightB
;
}
}
void
KBool
Link
::
SetRightB
(
bool
rb
)
void
kb
Link
::
SetRightB
(
bool
rb
)
{
{
m_RightB
=
rb
;
m_RightB
=
rb
;
}
}
...
@@ -196,7 +196,7 @@ void KBoolLink::SetRightB( bool rb )
...
@@ -196,7 +196,7 @@ void KBoolLink::SetRightB( bool rb )
// This function is very popular by GP-faults
// This function is very popular by GP-faults
// It returns the node different from a
// It returns the node different from a
//
//
Node
*
KBoolLink
::
GetOther
(
const
Node
*
const
a
)
kbNode
*
kbLink
::
GetOther
(
const
kb
Node
*
const
a
)
{
{
return
(
(
a
!=
m_beginnode
)
?
m_beginnode
:
m_endnode
);
return
(
(
a
!=
m_beginnode
)
?
m_beginnode
:
m_endnode
);
}
}
...
@@ -205,7 +205,7 @@ Node* KBoolLink::GetOther( const Node *const a )
...
@@ -205,7 +205,7 @@ Node* KBoolLink::GetOther( const Node *const a )
//
//
// Is this marked for given operation
// Is this marked for given operation
//
//
bool
KBool
Link
::
IsMarked
(
BOOL_OP
operation
)
bool
kb
Link
::
IsMarked
(
BOOL_OP
operation
)
{
{
switch
(
operation
)
switch
(
operation
)
{
{
...
@@ -218,7 +218,7 @@ bool KBoolLink::IsMarked( BOOL_OP operation )
...
@@ -218,7 +218,7 @@ bool KBoolLink::IsMarked( BOOL_OP operation )
}
}
}
}
bool
KBool
Link
::
IsMarkedLeft
(
BOOL_OP
operation
)
bool
kb
Link
::
IsMarkedLeft
(
BOOL_OP
operation
)
{
{
switch
(
operation
)
switch
(
operation
)
{
{
...
@@ -231,7 +231,7 @@ bool KBoolLink::IsMarkedLeft( BOOL_OP operation )
...
@@ -231,7 +231,7 @@ bool KBoolLink::IsMarkedLeft( BOOL_OP operation )
}
}
}
}
bool
KBool
Link
::
IsMarkedRight
(
BOOL_OP
operation
)
bool
kb
Link
::
IsMarkedRight
(
BOOL_OP
operation
)
{
{
switch
(
operation
)
switch
(
operation
)
{
{
...
@@ -247,7 +247,7 @@ bool KBoolLink::IsMarkedRight( BOOL_OP operation )
...
@@ -247,7 +247,7 @@ bool KBoolLink::IsMarkedRight( BOOL_OP operation )
//
//
// Is this a hole for given operation
// Is this a hole for given operation
// beginnode must be to the left
// beginnode must be to the left
bool
KBool
Link
::
IsHole
(
BOOL_OP
operation
)
bool
kb
Link
::
IsHole
(
BOOL_OP
operation
)
{
{
bool
topsideA
,
topsideB
;
bool
topsideA
,
topsideB
;
...
@@ -271,13 +271,13 @@ bool KBoolLink::IsHole( BOOL_OP operation )
...
@@ -271,13 +271,13 @@ bool KBoolLink::IsHole( BOOL_OP operation )
//
//
// Is this a part of a hole
// Is this a part of a hole
//
//
bool
KBool
Link
::
GetHole
()
bool
kb
Link
::
GetHole
()
{
{
return
(
m_hole
);
return
(
m_hole
);
}
}
void
KBool
Link
::
SetHole
(
bool
h
)
void
kb
Link
::
SetHole
(
bool
h
)
{
{
m_hole
=
h
;
m_hole
=
h
;
}
}
...
@@ -286,7 +286,7 @@ void KBoolLink::SetHole( bool h )
...
@@ -286,7 +286,7 @@ void KBoolLink::SetHole( bool h )
//
//
// Is this not marked at all
// Is this not marked at all
//
//
bool
KBool
Link
::
IsUnused
()
bool
kb
Link
::
IsUnused
()
{
{
return
return
!
(
m_merge_L
||
m_merge_R
||
!
(
m_merge_L
||
m_merge_R
||
...
@@ -297,13 +297,13 @@ bool KBoolLink::IsUnused()
...
@@ -297,13 +297,13 @@ bool KBoolLink::IsUnused()
}
}
bool
KBool
Link
::
IsZero
(
B_INT
marge
)
bool
kb
Link
::
IsZero
(
B_INT
marge
)
{
{
return
(
m_beginnode
->
Equal
(
m_endnode
,
marge
)
)
;
return
(
m_beginnode
->
Equal
(
m_endnode
,
marge
)
)
;
}
}
bool
KBool
Link
::
ShorterThan
(
B_INT
marge
)
bool
kb
Link
::
ShorterThan
(
B_INT
marge
)
{
{
return
(
m_beginnode
->
ShorterThan
(
m_endnode
,
marge
)
)
;
return
(
m_beginnode
->
ShorterThan
(
m_endnode
,
marge
)
)
;
}
}
...
@@ -312,7 +312,7 @@ bool KBoolLink::ShorterThan( B_INT marge )
...
@@ -312,7 +312,7 @@ bool KBoolLink::ShorterThan( B_INT marge )
//
//
// Mark this link
// Mark this link
//
//
void
KBool
Link
::
Mark
()
void
kb
Link
::
Mark
()
{
{
m_mark
=
true
;
m_mark
=
true
;
}
}
...
@@ -328,7 +328,7 @@ void KBoolLink::Mark()
...
@@ -328,7 +328,7 @@ void KBoolLink::Mark()
// The references to this link in the node will also be deleted
// The references to this link in the node will also be deleted
// After doing that, link link can be deleted or be recycled.
// After doing that, link link can be deleted or be recycled.
//
//
void
KBoolLink
::
MergeNodes
(
Node
*
const
begin_or_end_node
)
void
kbLink
::
MergeNodes
(
kb
Node
*
const
begin_or_end_node
)
{
{
// assert(beginnode && endnode);
// assert(beginnode && endnode);
// assert ((begin_or_end_node == beginnode)||(begin_or_end_node == endnode));
// assert ((begin_or_end_node == beginnode)||(begin_or_end_node == endnode));
...
@@ -350,15 +350,15 @@ void KBoolLink::MergeNodes( Node *const begin_or_end_node )
...
@@ -350,15 +350,15 @@ void KBoolLink::MergeNodes( Node *const begin_or_end_node )
// Here Left and Right is defined as being left or right from
// Here Left and Right is defined as being left or right from
// the this link towards the center (common) node
// the this link towards the center (common) node
//
//
LinkStatus
KBoolLink
::
OutProduct
(
KBool
Link
*
const
two
,
double
accur
)
LinkStatus
kbLink
::
OutProduct
(
kb
Link
*
const
two
,
double
accur
)
{
{
Node
*
center
;
kb
Node
*
center
;
double
distance
;
double
distance
;
if
(
two
->
GetBeginNode
()
->
Equal
(
two
->
GetEndNode
(),
1
)
)
if
(
two
->
GetBeginNode
()
->
Equal
(
two
->
GetEndNode
(),
1
)
)
assert
(
!
two
);
assert
(
!
two
);
if
(
GetBeginNode
()
->
Equal
(
GetEndNode
(),
1
)
)
if
(
GetBeginNode
()
->
Equal
(
GetEndNode
(),
1
)
)
assert
(
!
this
);
assert
(
!
this
);
KBoolLine
*
temp_line
=
new
KBool
Line
(
this
,
_GC
);
kbLine
*
temp_line
=
new
kb
Line
(
this
,
_GC
);
//the this link should connect to the other two link at at least one node
//the this link should connect to the other two link at at least one node
if
(
m_endnode
==
two
->
m_endnode
||
m_endnode
==
two
->
m_beginnode
)
if
(
m_endnode
==
two
->
m_endnode
||
m_endnode
==
two
->
m_beginnode
)
...
@@ -405,7 +405,7 @@ LinkStatus KBoolLink::OutProduct( KBoolLink* const two, double accur )
...
@@ -405,7 +405,7 @@ LinkStatus KBoolLink::OutProduct( KBoolLink* const two, double accur )
// the second link
// the second link
// Result = IS_ON | IS_LEFT | IS_RIGHT
// Result = IS_ON | IS_LEFT | IS_RIGHT
//
//
LinkStatus
KBoolLink
::
PointOnCorner
(
KBoolLink
*
const
two
,
KBool
Link
*
const
third
)
LinkStatus
kbLink
::
PointOnCorner
(
kbLink
*
const
two
,
kb
Link
*
const
third
)
{
{
LinkStatus
LinkStatus
TwoToOne
,
// Position of two to this line
TwoToOne
,
// Position of two to this line
...
@@ -413,7 +413,7 @@ LinkStatus KBoolLink::PointOnCorner( KBoolLink* const two, KBoolLink* const thir
...
@@ -413,7 +413,7 @@ LinkStatus KBoolLink::PointOnCorner( KBoolLink* const two, KBoolLink* const thir
ThirdToTwo
,
// Position of third to two
ThirdToTwo
,
// Position of third to two
Result
;
Result
;
//m Node* center;
//m
kb
Node* center;
//the this link should connect to the other two link at at least one node
//the this link should connect to the other two link at at least one node
//m if (endnode==two->endnode || endnode==two->beginnode)
//m if (endnode==two->endnode || endnode==two->beginnode)
...
@@ -462,7 +462,7 @@ LinkStatus KBoolLink::PointOnCorner( KBoolLink* const two, KBoolLink* const thir
...
@@ -462,7 +462,7 @@ LinkStatus KBoolLink::PointOnCorner( KBoolLink* const two, KBoolLink* const thir
//
//
// Remove the reference from this link to a_node
// Remove the reference from this link to a_node
//
//
void
KBoolLink
::
Remove
(
Node
*
a_node
)
void
kbLink
::
Remove
(
kb
Node
*
a_node
)
{
{
(
m_beginnode
==
a_node
)
?
m_beginnode
=
NULL
:
m_endnode
=
NULL
;
(
m_beginnode
==
a_node
)
?
m_beginnode
=
NULL
:
m_endnode
=
NULL
;
}
}
...
@@ -471,7 +471,7 @@ void KBoolLink::Remove( Node *a_node )
...
@@ -471,7 +471,7 @@ void KBoolLink::Remove( Node *a_node )
//
//
// Replace oldnode by newnode and correct the references
// Replace oldnode by newnode and correct the references
//
//
void
KBoolLink
::
Replace
(
Node
*
oldnode
,
Node
*
newnode
)
void
kbLink
::
Replace
(
kbNode
*
oldnode
,
kb
Node
*
newnode
)
{
{
if
(
m_beginnode
==
oldnode
)
if
(
m_beginnode
==
oldnode
)
{
{
...
@@ -491,7 +491,7 @@ void KBoolLink::Replace( Node *oldnode, Node *newnode )
...
@@ -491,7 +491,7 @@ void KBoolLink::Replace( Node *oldnode, Node *newnode )
//
//
// Reset all values
// Reset all values
//
//
void
KBool
Link
::
Reset
()
void
kb
Link
::
Reset
()
{
{
m_beginnode
=
0
;
m_beginnode
=
0
;
m_endnode
=
0
;
m_endnode
=
0
;
...
@@ -502,7 +502,7 @@ void KBoolLink::Reset()
...
@@ -502,7 +502,7 @@ void KBoolLink::Reset()
//
//
// Reset all flags
// Reset all flags
//
//
void
KBool
Link
::
Reset_flags
()
void
kb
Link
::
Reset_flags
()
{
{
m_bin
=
false
;
// Marker for walking over the graph
m_bin
=
false
;
// Marker for walking over the graph
m_hole
=
false
;
// Is this a part of hole ?
m_hole
=
false
;
// Is this a part of hole ?
...
@@ -525,7 +525,7 @@ void KBoolLink::Reset_flags()
...
@@ -525,7 +525,7 @@ void KBoolLink::Reset_flags()
//
//
// Refill this link by the arguments
// Refill this link by the arguments
//
//
void
KBoolLink
::
Reset
(
Node
*
begin
,
Node
*
end
,
int
graphnr
)
void
kbLink
::
Reset
(
kbNode
*
begin
,
kb
Node
*
end
,
int
graphnr
)
{
{
// Remove all the previous references
// Remove all the previous references
UnLink
();
UnLink
();
...
@@ -540,29 +540,29 @@ void KBoolLink::Reset( Node *begin, Node *end, int graphnr )
...
@@ -540,29 +540,29 @@ void KBoolLink::Reset( Node *begin, Node *end, int graphnr )
}
}
void
KBoolLink
::
Set
(
Node
*
begin
,
Node
*
end
)
void
kbLink
::
Set
(
kbNode
*
begin
,
kb
Node
*
end
)
{
{
m_beginnode
=
begin
;
m_beginnode
=
begin
;
m_endnode
=
end
;
m_endnode
=
end
;
}
}
void
KBool
Link
::
SetBeenHere
()
void
kb
Link
::
SetBeenHere
()
{
{
m_bin
=
true
;
m_bin
=
true
;
}
}
void
KBool
Link
::
SetNotBeenHere
()
void
kb
Link
::
SetNotBeenHere
()
{
{
m_bin
=
false
;
m_bin
=
false
;
}
}
void
KBoolLink
::
SetBeginNode
(
Node
*
new_node
)
void
kbLink
::
SetBeginNode
(
kb
Node
*
new_node
)
{
{
m_beginnode
=
new_node
;
m_beginnode
=
new_node
;
}
}
void
KBoolLink
::
SetEndNode
(
Node
*
new_node
)
void
kbLink
::
SetEndNode
(
kb
Node
*
new_node
)
{
{
m_endnode
=
new_node
;
m_endnode
=
new_node
;
}
}
...
@@ -571,12 +571,12 @@ void KBoolLink::SetEndNode( Node* new_node )
...
@@ -571,12 +571,12 @@ void KBoolLink::SetEndNode( Node* new_node )
//
//
// Sets the graphnumber to argument num
// Sets the graphnumber to argument num
//
//
void
KBool
Link
::
SetGraphNum
(
int
num
)
void
kb
Link
::
SetGraphNum
(
int
num
)
{
{
m_graphnum
=
num
;
m_graphnum
=
num
;
}
}
GroupType
KBool
Link
::
Group
()
GroupType
kb
Link
::
Group
()
{
{
return
m_group
;
return
m_group
;
}
}
...
@@ -585,7 +585,7 @@ GroupType KBoolLink::Group()
...
@@ -585,7 +585,7 @@ GroupType KBoolLink::Group()
//
//
// Reset the groupflag to argument groep
// Reset the groupflag to argument groep
//
//
void
KBool
Link
::
SetGroup
(
GroupType
groep
)
void
kb
Link
::
SetGroup
(
GroupType
groep
)
{
{
m_group
=
groep
;
m_group
=
groep
;
}
}
...
@@ -594,7 +594,7 @@ void KBoolLink::SetGroup( GroupType groep )
...
@@ -594,7 +594,7 @@ void KBoolLink::SetGroup( GroupType groep )
//
//
// Remove all references to this link and from this link
// Remove all references to this link and from this link
//
//
void
KBool
Link
::
UnLink
()
void
kb
Link
::
UnLink
()
{
{
if
(
m_beginnode
)
if
(
m_beginnode
)
{
{
...
@@ -611,13 +611,13 @@ void KBoolLink::UnLink()
...
@@ -611,13 +611,13 @@ void KBoolLink::UnLink()
}
}
void
KBool
Link
::
UnMark
()
void
kb
Link
::
UnMark
()
{
{
m_mark
=
false
;
m_mark
=
false
;
m_bin
=
false
;
m_bin
=
false
;
}
}
void
KBool
Link
::
SetMark
(
bool
value
)
void
kb
Link
::
SetMark
(
bool
value
)
{
{
m_mark
=
value
;
m_mark
=
value
;
}
}
...
@@ -625,16 +625,16 @@ void KBoolLink::SetMark( bool value )
...
@@ -625,16 +625,16 @@ void KBoolLink::SetMark( bool value )
//
//
// general purpose mark checker
// general purpose mark checker
//
//
bool
KBool
Link
::
IsMarked
()
{
return
m_mark
;
}
bool
kb
Link
::
IsMarked
()
{
return
m_mark
;
}
void
KBool
Link
::
SetTopHole
(
bool
value
)
{
m_hole_top
=
value
;
}
void
kb
Link
::
SetTopHole
(
bool
value
)
{
m_hole_top
=
value
;
}
bool
KBool
Link
::
IsTopHole
()
{
return
m_hole_top
;
}
bool
kb
Link
::
IsTopHole
()
{
return
m_hole_top
;
}
//
//
// Calculates the merge/substact/exor/intersect flags
// Calculates the merge/substact/exor/intersect flags
//
//
void
KBool
Link
::
SetLineTypes
()
void
kb
Link
::
SetLineTypes
()
{
{
m_merge_R
=
m_merge_R
=
m_a_substract_b_R
=
m_a_substract_b_R
=
...
@@ -681,12 +681,12 @@ void KBoolLink::SetLineTypes()
...
@@ -681,12 +681,12 @@ void KBoolLink::SetLineTypes()
//put in direction with a_node as beginnode
//put in direction with a_node as beginnode
void
KBoolLink
::
Redirect
(
Node
*
a_node
)
void
kbLink
::
Redirect
(
kb
Node
*
a_node
)
{
{
if
(
a_node
!=
m_beginnode
)
if
(
a_node
!=
m_beginnode
)
{
{
// swap the begin- and endnode of the current link
// swap the begin- and endnode of the current link
Node
*
dummy
=
m_beginnode
;
kb
Node
*
dummy
=
m_beginnode
;
m_beginnode
=
m_endnode
;
m_beginnode
=
m_endnode
;
m_endnode
=
dummy
;
m_endnode
=
dummy
;
...
...
polygon/kbool/src/lpoint.cpp
View file @
ef2e41e3
/*! \file src/lpoint.cpp
/*! \file src/lpoint.cpp
\brief Definition of GDSII LPoint type structure
\brief Definition of GDSII
kb
LPoint type structure
\author Klaas Holwerda
\author Klaas Holwerda
Copyright: 2001-2004 (C) Klaas Holwerda
Copyright: 2001-2004 (C) Klaas Holwerda
...
@@ -13,73 +13,73 @@
...
@@ -13,73 +13,73 @@
#include <math.h>
#include <math.h>
// Constructors
// Constructors
LPoint
::
LPoint
()
kbLPoint
::
kb
LPoint
()
{
{
_x
=
0
;
_x
=
0
;
_y
=
0
;
_y
=
0
;
}
}
LPoint
::
LPoint
(
B_INT
const
X
,
B_INT
const
Y
)
kbLPoint
::
kb
LPoint
(
B_INT
const
X
,
B_INT
const
Y
)
{
{
_x
=
X
;
_x
=
X
;
_y
=
Y
;
_y
=
Y
;
}
}
LPoint
::
LPoint
(
LPoint
*
const
a_point
)
kbLPoint
::
kbLPoint
(
kb
LPoint
*
const
a_point
)
{
{
if
(
!
a_point
)
if
(
!
a_point
)
throw
Bool_Engine_Error
(
"Cannot copy a NULL Point Object.
\n\n
Could not create a LPoint Object."
,
throw
Bool_Engine_Error
(
"Cannot copy a NULL Point Object.
\n\n
Could not create a
kb
LPoint Object."
,
"Fatal Creation Error"
,
0
,
1
);
"Fatal Creation Error"
,
0
,
1
);
_x
=
a_point
->
_x
;
_x
=
a_point
->
_x
;
_y
=
a_point
->
_y
;
_y
=
a_point
->
_y
;
}
}
B_INT
LPoint
::
GetX
()
B_INT
kb
LPoint
::
GetX
()
{
{
return
_x
;
return
_x
;
}
}
B_INT
LPoint
::
GetY
()
B_INT
kb
LPoint
::
GetY
()
{
{
return
_y
;
return
_y
;
}
}
void
LPoint
::
SetX
(
B_INT
a_point_x
)
void
kb
LPoint
::
SetX
(
B_INT
a_point_x
)
{
{
_x
=
a_point_x
;
_x
=
a_point_x
;
}
}
void
LPoint
::
SetY
(
B_INT
a_point_y
)
void
kb
LPoint
::
SetY
(
B_INT
a_point_y
)
{
{
_y
=
a_point_y
;
_y
=
a_point_y
;
}
}
LPoint
LPoint
::
GetPoint
()
kbLPoint
kb
LPoint
::
GetPoint
()
{
{
return
*
this
;
return
*
this
;
}
}
void
LPoint
::
Set
(
const
B_INT
X
,
const
B_INT
Y
)
void
kb
LPoint
::
Set
(
const
B_INT
X
,
const
B_INT
Y
)
{
{
_x
=
X
;
_x
=
X
;
_y
=
Y
;
_y
=
Y
;
}
}
void
LPoint
::
Set
(
const
LPoint
&
a_point
)
void
kbLPoint
::
Set
(
const
kb
LPoint
&
a_point
)
{
{
_x
=
a_point
.
_x
;
_x
=
a_point
.
_x
;
_y
=
a_point
.
_y
;
_y
=
a_point
.
_y
;
}
}
bool
LPoint
::
Equal
(
const
LPoint
a_point
,
B_INT
Marge
)
bool
kbLPoint
::
Equal
(
const
kb
LPoint
a_point
,
B_INT
Marge
)
{
{
B_INT
delta_x
,
delta_y
;
B_INT
delta_x
,
delta_y
;
...
@@ -93,12 +93,12 @@ bool LPoint::Equal( const LPoint a_point, B_INT Marge )
...
@@ -93,12 +93,12 @@ bool LPoint::Equal( const LPoint a_point, B_INT Marge )
}
}
bool
LPoint
::
Equal
(
const
B_INT
X
,
const
B_INT
Y
,
B_INT
Marge
)
bool
kb
LPoint
::
Equal
(
const
B_INT
X
,
const
B_INT
Y
,
B_INT
Marge
)
{
{
return
(
bool
)(
(
babs
(
_x
-
X
)
<=
Marge
)
&&
(
babs
(
_y
-
Y
)
<=
Marge
)
);
return
(
bool
)(
(
babs
(
_x
-
X
)
<=
Marge
)
&&
(
babs
(
_y
-
Y
)
<=
Marge
)
);
}
}
bool
LPoint
::
ShorterThan
(
const
LPoint
a_point
,
B_INT
Marge
)
bool
kbLPoint
::
ShorterThan
(
const
kb
LPoint
a_point
,
B_INT
Marge
)
{
{
double
a
,
b
;
double
a
,
b
;
a
=
(
double
)
(
a_point
.
_x
-
_x
);
a
=
(
double
)
(
a_point
.
_x
-
_x
);
...
@@ -110,7 +110,7 @@ bool LPoint::ShorterThan( const LPoint a_point, B_INT Marge )
...
@@ -110,7 +110,7 @@ bool LPoint::ShorterThan( const LPoint a_point, B_INT Marge )
}
}
bool
LPoint
::
ShorterThan
(
const
B_INT
X
,
const
B_INT
Y
,
B_INT
Marge
)
bool
kb
LPoint
::
ShorterThan
(
const
B_INT
X
,
const
B_INT
Y
,
B_INT
Marge
)
{
{
double
a
,
b
;
double
a
,
b
;
a
=
(
double
)
(
X
-
_x
);
a
=
(
double
)
(
X
-
_x
);
...
@@ -125,7 +125,7 @@ bool LPoint::ShorterThan( const B_INT X, const B_INT Y, B_INT Marge )
...
@@ -125,7 +125,7 @@ bool LPoint::ShorterThan( const B_INT X, const B_INT Y, B_INT Marge )
// overload the assign (=) operator
// overload the assign (=) operator
// usage : a_point = another_point;
// usage : a_point = another_point;
LPoint
&
LPoint
::
operator
=
(
const
LPoint
&
other_point
)
kbLPoint
&
kbLPoint
::
operator
=
(
const
kb
LPoint
&
other_point
)
{
{
_x
=
other_point
.
_x
;
_x
=
other_point
.
_x
;
_y
=
other_point
.
_y
;
_y
=
other_point
.
_y
;
...
@@ -136,7 +136,7 @@ LPoint &LPoint::operator=( const LPoint &other_point )
...
@@ -136,7 +136,7 @@ LPoint &LPoint::operator=( const LPoint &other_point )
// overload the + operator
// overload the + operator
// usage : a_point = point1 + point2;
// usage : a_point = point1 + point2;
LPoint
&
LPoint
::
operator
+
(
const
LPoint
&
other_point
)
kbLPoint
&
kbLPoint
::
operator
+
(
const
kb
LPoint
&
other_point
)
{
{
_x
+=
other_point
.
_x
;
_x
+=
other_point
.
_x
;
_y
+=
other_point
.
_y
;
_y
+=
other_point
.
_y
;
...
@@ -148,7 +148,7 @@ LPoint &LPoint::operator+( const LPoint &other_point )
...
@@ -148,7 +148,7 @@ LPoint &LPoint::operator+( const LPoint &other_point )
// overload the - operator
// overload the - operator
// usage : a_point = point1 - point2;
// usage : a_point = point1 - point2;
LPoint
&
LPoint
::
operator
-
(
const
LPoint
&
other_point
)
kbLPoint
&
kbLPoint
::
operator
-
(
const
kb
LPoint
&
other_point
)
{
{
_x
-=
other_point
.
_x
;
_x
-=
other_point
.
_x
;
_y
-=
other_point
.
_y
;
_y
-=
other_point
.
_y
;
...
@@ -159,7 +159,7 @@ LPoint &LPoint::operator-( const LPoint &other_point )
...
@@ -159,7 +159,7 @@ LPoint &LPoint::operator-( const LPoint &other_point )
// overload the * operator
// overload the * operator
// usage: a_point = point1 * 100;
// usage: a_point = point1 * 100;
LPoint
&
LPoint
::
operator
*
(
int
factor
)
kbLPoint
&
kb
LPoint
::
operator
*
(
int
factor
)
{
{
_x
*=
factor
;
_x
*=
factor
;
_y
*=
factor
;
_y
*=
factor
;
...
@@ -170,7 +170,7 @@ LPoint &LPoint::operator*( int factor )
...
@@ -170,7 +170,7 @@ LPoint &LPoint::operator*( int factor )
// overload the / operator
// overload the / operator
// usage: a_point = point1 / 100;
// usage: a_point = point1 / 100;
LPoint
&
LPoint
::
operator
/
(
int
factor
)
kbLPoint
&
kb
LPoint
::
operator
/
(
int
factor
)
{
{
_x
/=
factor
;
_x
/=
factor
;
_y
/=
factor
;
_y
/=
factor
;
...
@@ -181,7 +181,7 @@ LPoint &LPoint::operator/( int factor )
...
@@ -181,7 +181,7 @@ LPoint &LPoint::operator/( int factor )
// overload the compare (==) operator
// overload the compare (==) operator
// usage: if (point1 == point2) { };
// usage: if (point1 == point2) { };
int
LPoint
::
operator
==
(
const
LPoint
&
other_point
)
const
int
kbLPoint
::
operator
==
(
const
kb
LPoint
&
other_point
)
const
{
{
return
(
(
other_point
.
_x
==
_x
)
&&
(
other_point
.
_y
==
_y
)
);
return
(
(
other_point
.
_x
==
_x
)
&&
(
other_point
.
_y
==
_y
)
);
}
}
...
@@ -190,7 +190,7 @@ int LPoint::operator==( const LPoint &other_point ) const
...
@@ -190,7 +190,7 @@ int LPoint::operator==( const LPoint &other_point ) const
// overload the diffrent (!=) operator
// overload the diffrent (!=) operator
// usage: if (point1 != point2) { };
// usage: if (point1 != point2) { };
int
LPoint
::
operator
!=
(
const
LPoint
&
other_point
)
const
int
kbLPoint
::
operator
!=
(
const
kb
LPoint
&
other_point
)
const
{
{
return
(
(
other_point
.
_x
!=
_x
)
||
(
other_point
.
_y
!=
_y
)
);
return
(
(
other_point
.
_x
!=
_x
)
||
(
other_point
.
_y
!=
_y
)
);
}
}
...
...
polygon/kbool/src/node.cpp
View file @
ef2e41e3
...
@@ -6,7 +6,7 @@
...
@@ -6,7 +6,7 @@
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: node.cpp,v 1.
3 2008/06/04 21:23:22
titato Exp $
RCS-ID: $Id: node.cpp,v 1.
4 2009/09/07 19:23:28
titato Exp $
*/
*/
#include "kbool/node.h"
#include "kbool/node.h"
...
@@ -16,31 +16,31 @@
...
@@ -16,31 +16,31 @@
//this here is to initialize the static iterator of node
//this here is to initialize the static iterator of node
//with NOLIST constructor
//with NOLIST constructor
//TDLI<
KBoolLink> Node::_linkiter=TDLI<KBool
Link>(_GC);
//TDLI<
kbLink> kbNode::_linkiter=TDLI<kb
Link>(_GC);
Node
::
Node
(
Bool_Engine
*
GC
)
:
LPoint
(
0
,
0
)
kbNode
::
kbNode
(
Bool_Engine
*
GC
)
:
kb
LPoint
(
0
,
0
)
{
{
_GC
=
GC
;
_GC
=
GC
;
_linklist
=
new
DL_List
<
void
*>
();
_linklist
=
new
DL_List
<
void
*>
();
}
}
Node
::
Node
(
B_INT
const
X
,
B_INT
const
Y
,
Bool_Engine
*
GC
)
:
LPoint
(
X
,
Y
)
kbNode
::
kbNode
(
B_INT
const
X
,
B_INT
const
Y
,
Bool_Engine
*
GC
)
:
kb
LPoint
(
X
,
Y
)
{
{
_GC
=
GC
;
_GC
=
GC
;
_linklist
=
new
DL_List
<
void
*>
();
_linklist
=
new
DL_List
<
void
*>
();
}
}
Node
::
Node
(
LPoint
*
const
a_point
,
Bool_Engine
*
GC
)
:
LPoint
(
a_point
)
kbNode
::
kbNode
(
kbLPoint
*
const
a_point
,
Bool_Engine
*
GC
)
:
kb
LPoint
(
a_point
)
{
{
_GC
=
GC
;
_GC
=
GC
;
_linklist
=
new
DL_List
<
void
*>
();
_linklist
=
new
DL_List
<
void
*>
();
}
}
//
Node::Node(Node * const other) :
LPoint(other)
//
kbNode::kbNode(kbNode * const other) : kb
LPoint(other)
Node
::
Node
(
Node
*
const
other
,
Bool_Engine
*
GC
)
kbNode
::
kbNode
(
kb
Node
*
const
other
,
Bool_Engine
*
GC
)
{
{
_GC
=
GC
;
_GC
=
GC
;
_x
=
other
->
_x
;
_x
=
other
->
_x
;
...
@@ -48,7 +48,7 @@ Node::Node( Node * const other, Bool_Engine* GC )
...
@@ -48,7 +48,7 @@ Node::Node( Node * const other, Bool_Engine* GC )
_linklist
=
new
DL_List
<
void
*>
();
_linklist
=
new
DL_List
<
void
*>
();
}
}
Node
&
Node
::
operator
=
(
const
Node
&
other_node
)
kbNode
&
kbNode
::
operator
=
(
const
kb
Node
&
other_node
)
{
{
_x
=
other_node
.
_x
;
_x
=
other_node
.
_x
;
_y
=
other_node
.
_y
;
_y
=
other_node
.
_y
;
...
@@ -59,64 +59,64 @@ Node& Node::operator=( const Node &other_node )
...
@@ -59,64 +59,64 @@ Node& Node::operator=( const Node &other_node )
// x and y of the point will be rounded to the nearest
// x and y of the point will be rounded to the nearest
// xnew=N*grid and ynew=N*grid
// xnew=N*grid and ynew=N*grid
void
Node
::
RoundInt
(
B_INT
grid
)
void
kb
Node
::
RoundInt
(
B_INT
grid
)
{
{
_x
=
(
B_INT
)
floor
(
(
_x
+
grid
*
0.5
)
/
grid
)
*
grid
;
_x
=
(
B_INT
)
floor
(
(
_x
+
grid
*
0.5
)
/
grid
)
*
grid
;
_y
=
(
B_INT
)
floor
(
(
_y
+
grid
*
0.5
)
/
grid
)
*
grid
;
_y
=
(
B_INT
)
floor
(
(
_y
+
grid
*
0.5
)
/
grid
)
*
grid
;
}
}
Node
::~
Node
()
kbNode
::~
kb
Node
()
{
{
delete
_linklist
;
delete
_linklist
;
}
}
DL_List
<
void
*>*
Node
::
GetLinklist
()
DL_List
<
void
*>*
kb
Node
::
GetLinklist
()
{
{
return
_linklist
;
return
_linklist
;
}
}
void
Node
::
AddLink
(
KBool
Link
*
a_link
)
void
kbNode
::
AddLink
(
kb
Link
*
a_link
)
{
{
// assert(a_link);
// assert(a_link);
_linklist
->
insbegin
(
a_link
);
_linklist
->
insbegin
(
a_link
);
}
}
KBoolLink
*
Node
::
GetIncomingLink
()
kbLink
*
kb
Node
::
GetIncomingLink
()
{
{
if
(
(
(
KBool
Link
*
)
_linklist
->
headitem
()
)
->
GetEndNode
()
==
this
)
if
(
(
(
kb
Link
*
)
_linklist
->
headitem
()
)
->
GetEndNode
()
==
this
)
return
(
KBool
Link
*
)
_linklist
->
headitem
();
return
(
kb
Link
*
)
_linklist
->
headitem
();
else
else
return
(
KBool
Link
*
)
_linklist
->
tailitem
();
return
(
kb
Link
*
)
_linklist
->
tailitem
();
}
}
KBoolLink
*
Node
::
GetOutgoingLink
()
kbLink
*
kb
Node
::
GetOutgoingLink
()
{
{
if
(
(
(
KBool
Link
*
)
_linklist
->
headitem
()
)
->
GetBeginNode
()
==
this
)
if
(
(
(
kb
Link
*
)
_linklist
->
headitem
()
)
->
GetBeginNode
()
==
this
)
return
(
KBool
Link
*
)
_linklist
->
headitem
();
return
(
kb
Link
*
)
_linklist
->
headitem
();
else
else
return
(
KBool
Link
*
)
_linklist
->
tailitem
();
return
(
kb
Link
*
)
_linklist
->
tailitem
();
}
}
//
//
// Returns the number of connected links
// Returns the number of connected links
//
//
int
Node
::
GetNumberOfLinks
()
int
kb
Node
::
GetNumberOfLinks
()
{
{
return
_linklist
->
count
();
return
_linklist
->
count
();
}
}
KBoolLink
*
Node
::
GetOtherLink
(
KBool
Link
*
prev
)
kbLink
*
kbNode
::
GetOtherLink
(
kb
Link
*
prev
)
{
{
if
(
prev
==
(
KBool
Link
*
)
_linklist
->
headitem
()
)
if
(
prev
==
(
kb
Link
*
)
_linklist
->
headitem
()
)
return
(
KBool
Link
*
)
_linklist
->
tailitem
();
return
(
kb
Link
*
)
_linklist
->
tailitem
();
if
(
prev
==
(
KBool
Link
*
)
_linklist
->
tailitem
()
)
if
(
prev
==
(
kb
Link
*
)
_linklist
->
tailitem
()
)
return
(
KBool
Link
*
)
_linklist
->
headitem
();
return
(
kb
Link
*
)
_linklist
->
headitem
();
return
NULL
;
return
NULL
;
}
}
int
Node
::
Merge
(
Node
*
other
)
int
kbNode
::
Merge
(
kb
Node
*
other
)
{
{
if
(
this
==
other
)
//they are already merged dummy
if
(
this
==
other
)
//they are already merged dummy
return
0
;
return
0
;
...
@@ -127,8 +127,8 @@ int Node::Merge( Node *other )
...
@@ -127,8 +127,8 @@ int Node::Merge( Node *other )
// otherwise there can't be a takeover, because for takeover there can't
// otherwise there can't be a takeover, because for takeover there can't
// be an iterator on other->_linklist;
// be an iterator on other->_linklist;
{
{
TDLI
<
KBool
Link
>
Iother
(
other
->
_linklist
);
TDLI
<
kb
Link
>
Iother
(
other
->
_linklist
);
KBool
Link
*
temp
;
kb
Link
*
temp
;
Counter
=
Iother
.
count
();
Counter
=
Iother
.
count
();
...
@@ -153,7 +153,7 @@ int Node::Merge( Node *other )
...
@@ -153,7 +153,7 @@ int Node::Merge( Node *other )
}
}
void
Node
::
RemoveLink
(
KBool
Link
*
a_link
)
void
kbNode
::
RemoveLink
(
kb
Link
*
a_link
)
{
{
// assert(a_link);
// assert(a_link);
_GC
->
_linkiter
->
Attach
(
_linklist
);
_GC
->
_linkiter
->
Attach
(
_linklist
);
...
@@ -172,7 +172,7 @@ void Node::RemoveLink( KBoolLink *a_link )
...
@@ -172,7 +172,7 @@ void Node::RemoveLink( KBoolLink *a_link )
// output: -
// output: -
// return: true if points can be simplified
// return: true if points can be simplified
// false if points can't be simplified
// false if points can't be simplified
bool
Node
::
Simplify
(
Node
*
First
,
Node
*
Second
,
B_INT
Marge
)
bool
kbNode
::
Simplify
(
kbNode
*
First
,
kb
Node
*
Second
,
B_INT
Marge
)
{
{
double
distance
=
0
;
double
distance
=
0
;
...
@@ -189,9 +189,9 @@ bool Node::Simplify( Node *First, Node *Second, B_INT Marge )
...
@@ -189,9 +189,9 @@ bool Node::Simplify( Node *First, Node *Second, B_INT Marge )
// Used tmp_link.set here, because the link may not be linked in the graph,
// Used tmp_link.set here, because the link may not be linked in the graph,
// because the point of the graphs are used, after use of the line we have
// because the point of the graphs are used, after use of the line we have
//to set the link to zero so the nodes will not be destructed by exit of the function
//to set the link to zero so the nodes will not be destructed by exit of the function
KBool
Link
tmp_link
(
_GC
);
kb
Link
tmp_link
(
_GC
);
tmp_link
.
Set
(
First
,
Second
);
tmp_link
.
Set
(
First
,
Second
);
KBool
Line
tmp_line
(
_GC
);
kb
Line
tmp_line
(
_GC
);
tmp_line
.
Set
(
&
tmp_link
);
tmp_line
.
Set
(
&
tmp_link
);
// If third point is on the same line which is made from the first
// If third point is on the same line which is made from the first
...
@@ -215,7 +215,7 @@ bool Node::Simplify( Node *First, Node *Second, B_INT Marge )
...
@@ -215,7 +215,7 @@ bool Node::Simplify( Node *First, Node *Second, B_INT Marge )
}
}
KBoolLink
*
Node
::
GetNextLink
()
kbLink
*
kb
Node
::
GetNextLink
()
{
{
int
Aantal
=
_linklist
->
count
();
int
Aantal
=
_linklist
->
count
();
...
@@ -225,7 +225,7 @@ KBoolLink* Node::GetNextLink()
...
@@ -225,7 +225,7 @@ KBoolLink* Node::GetNextLink()
if
(
Aantal
==
1
)
if
(
Aantal
==
1
)
return
NULL
;
return
NULL
;
int
Marked_Counter
=
0
;
int
Marked_Counter
=
0
;
KBool
Link
*
the_link
=
NULL
;
kb
Link
*
the_link
=
NULL
;
// count the marked links
// count the marked links
_GC
->
_linkiter
->
Attach
(
_linklist
);
_GC
->
_linkiter
->
Attach
(
_linklist
);
...
@@ -255,7 +255,7 @@ KBoolLink* Node::GetNextLink()
...
@@ -255,7 +255,7 @@ KBoolLink* Node::GetNextLink()
}
}
KBoolLink
*
Node
::
GetPrevLink
()
kbLink
*
kb
Node
::
GetPrevLink
()
{
{
int
Aantal
;
int
Aantal
;
if
(
!
_linklist
)
if
(
!
_linklist
)
...
@@ -270,7 +270,7 @@ KBoolLink* Node::GetPrevLink()
...
@@ -270,7 +270,7 @@ KBoolLink* Node::GetPrevLink()
return
NULL
;
return
NULL
;
int
Marked_Counter
=
0
;
int
Marked_Counter
=
0
;
KBool
Link
*
the_link
=
NULL
;
kb
Link
*
the_link
=
NULL
;
_GC
->
_linkiter
->
Attach
(
_linklist
);
_GC
->
_linkiter
->
Attach
(
_linklist
);
// count the marked links
// count the marked links
...
@@ -299,7 +299,7 @@ KBoolLink* Node::GetPrevLink()
...
@@ -299,7 +299,7 @@ KBoolLink* Node::GetPrevLink()
}
}
}
}
bool
Node
::
SameSides
(
KBoolLink
*
const
prev
,
KBool
Link
*
const
link
,
BOOL_OP
operation
)
bool
kbNode
::
SameSides
(
kbLink
*
const
prev
,
kb
Link
*
const
link
,
BOOL_OP
operation
)
{
{
bool
directedLeft
;
bool
directedLeft
;
bool
directedRight
;
bool
directedRight
;
...
@@ -331,16 +331,16 @@ bool Node::SameSides( KBoolLink* const prev , KBoolLink* const link, BOOL_OP ope
...
@@ -331,16 +331,16 @@ bool Node::SameSides( KBoolLink* const prev , KBoolLink* const link, BOOL_OP ope
// on the node get the link
// on the node get the link
// is the most right or left one
// is the most right or left one
// This function is used to collect the simple graphs from a graph
// This function is used to collect the simple graphs from a graph
KBoolLink
*
Node
::
GetMost
(
KBool
Link
*
const
prev
,
LinkStatus
whatside
,
BOOL_OP
operation
)
kbLink
*
kbNode
::
GetMost
(
kb
Link
*
const
prev
,
LinkStatus
whatside
,
BOOL_OP
operation
)
{
{
KBool
Link
*
reserve
=
0
;
kb
Link
*
reserve
=
0
;
KBool
Link
*
Result
=
NULL
,
*
link
;
kb
Link
*
Result
=
NULL
,
*
link
;
Node
*
prevbegin
=
prev
->
GetOther
(
this
);
kb
Node
*
prevbegin
=
prev
->
GetOther
(
this
);
if
(
_linklist
->
count
()
==
2
)
// only two links to this node take the one != prev
if
(
_linklist
->
count
()
==
2
)
// only two links to this node take the one != prev
{
{
if
(
(
link
=
(
KBool
Link
*
)
_linklist
->
headitem
()
)
==
prev
)
//this is NOT the one to go on
if
(
(
link
=
(
kb
Link
*
)
_linklist
->
headitem
()
)
==
prev
)
//this is NOT the one to go on
link
=
(
KBool
Link
*
)
_linklist
->
tailitem
();
link
=
(
kb
Link
*
)
_linklist
->
tailitem
();
if
(
!
link
->
BeenHere
()
&&
SameSides
(
prev
,
link
,
operation
)
)
if
(
!
link
->
BeenHere
()
&&
SameSides
(
prev
,
link
,
operation
)
)
//we are back where we started (bin is true) return Null
//we are back where we started (bin is true) return Null
return
link
;
return
link
;
...
@@ -349,7 +349,7 @@ KBoolLink* Node::GetMost( KBoolLink* const prev , LinkStatus whatside, BOOL_OP o
...
@@ -349,7 +349,7 @@ KBoolLink* Node::GetMost( KBoolLink* const prev , LinkStatus whatside, BOOL_OP o
_GC
->
_linkiter
->
Attach
(
_linklist
);
_GC
->
_linkiter
->
Attach
(
_linklist
);
_GC
->
_linkiter
->
tohead
();
_GC
->
_linkiter
->
tohead
();
//more then 2 links to the Node
//more then 2 links to the
kb
Node
while
(
!
_GC
->
_linkiter
->
hitroot
()
)
while
(
!
_GC
->
_linkiter
->
hitroot
()
)
{
{
link
=
_GC
->
_linkiter
->
item
();
link
=
_GC
->
_linkiter
->
item
();
...
@@ -387,16 +387,16 @@ KBoolLink* Node::GetMost( KBoolLink* const prev , LinkStatus whatside, BOOL_OP o
...
@@ -387,16 +387,16 @@ KBoolLink* Node::GetMost( KBoolLink* const prev , LinkStatus whatside, BOOL_OP o
// on the node get the link
// on the node get the link
// is the most right or left one
// is the most right or left one
// This function is used to collect the simple graphs from a graph
// This function is used to collect the simple graphs from a graph
KBoolLink
*
Node
::
GetMostHole
(
KBool
Link
*
const
prev
,
LinkStatus
whatside
,
BOOL_OP
operation
)
kbLink
*
kbNode
::
GetMostHole
(
kb
Link
*
const
prev
,
LinkStatus
whatside
,
BOOL_OP
operation
)
{
{
KBool
Link
*
reserve
=
0
;
kb
Link
*
reserve
=
0
;
KBool
Link
*
Result
=
NULL
,
*
link
;
kb
Link
*
Result
=
NULL
,
*
link
;
Node
*
prevbegin
=
prev
->
GetOther
(
this
);
kb
Node
*
prevbegin
=
prev
->
GetOther
(
this
);
if
(
_linklist
->
count
()
==
2
)
// only two links to this node take the one != prev
if
(
_linklist
->
count
()
==
2
)
// only two links to this node take the one != prev
{
{
if
(
(
link
=
(
KBool
Link
*
)
_linklist
->
headitem
()
)
==
prev
)
//this is NOT the one to go on
if
(
(
link
=
(
kb
Link
*
)
_linklist
->
headitem
()
)
==
prev
)
//this is NOT the one to go on
link
=
(
KBool
Link
*
)
_linklist
->
tailitem
();
link
=
(
kb
Link
*
)
_linklist
->
tailitem
();
if
(
link
->
GetHole
()
&&
!
link
->
GetHoleLink
()
&&
!
link
->
BeenHere
()
&&
SameSides
(
prev
,
link
,
operation
)
)
if
(
link
->
GetHole
()
&&
!
link
->
GetHoleLink
()
&&
!
link
->
BeenHere
()
&&
SameSides
(
prev
,
link
,
operation
)
)
//we are back where we started (bin is true) return Null
//we are back where we started (bin is true) return Null
return
link
;
return
link
;
...
@@ -405,7 +405,7 @@ KBoolLink* Node::GetMostHole( KBoolLink* const prev, LinkStatus whatside, BOOL_O
...
@@ -405,7 +405,7 @@ KBoolLink* Node::GetMostHole( KBoolLink* const prev, LinkStatus whatside, BOOL_O
_GC
->
_linkiter
->
Attach
(
_linklist
);
_GC
->
_linkiter
->
Attach
(
_linklist
);
_GC
->
_linkiter
->
tohead
();
_GC
->
_linkiter
->
tohead
();
//more then 2 links to the Node
//more then 2 links to the
kb
Node
while
(
!
_GC
->
_linkiter
->
hitroot
()
)
while
(
!
_GC
->
_linkiter
->
hitroot
()
)
{
{
link
=
_GC
->
_linkiter
->
item
();
link
=
_GC
->
_linkiter
->
item
();
...
@@ -443,9 +443,9 @@ KBoolLink* Node::GetMostHole( KBoolLink* const prev, LinkStatus whatside, BOOL_O
...
@@ -443,9 +443,9 @@ KBoolLink* Node::GetMostHole( KBoolLink* const prev, LinkStatus whatside, BOOL_O
}
}
// this function gets the highest not flat link
// this function gets the highest not flat link
KBoolLink
*
Node
::
GetHoleLink
(
KBool
Link
*
const
prev
,
bool
checkbin
,
BOOL_OP
operation
)
kbLink
*
kbNode
::
GetHoleLink
(
kb
Link
*
const
prev
,
bool
checkbin
,
BOOL_OP
operation
)
{
{
KBool
Link
*
Result
=
NULL
,
*
link
;
kb
Link
*
Result
=
NULL
,
*
link
;
_GC
->
_linkiter
->
Attach
(
_linklist
);
_GC
->
_linkiter
->
Attach
(
_linklist
);
...
@@ -467,9 +467,9 @@ KBoolLink* Node::GetHoleLink( KBoolLink* const prev, bool checkbin, BOOL_OP oper
...
@@ -467,9 +467,9 @@ KBoolLink* Node::GetHoleLink( KBoolLink* const prev, bool checkbin, BOOL_OP oper
}
}
// this function gets the highest not flat link
// this function gets the highest not flat link
KBoolLink
*
Node
::
GetNotFlat
()
kbLink
*
kb
Node
::
GetNotFlat
()
{
{
KBool
Link
*
Result
=
NULL
,
*
link
;
kb
Link
*
Result
=
NULL
,
*
link
;
_GC
->
_linkiter
->
Attach
(
_linklist
);
_GC
->
_linkiter
->
Attach
(
_linklist
);
...
@@ -519,9 +519,9 @@ KBoolLink* Node::GetNotFlat()
...
@@ -519,9 +519,9 @@ KBoolLink* Node::GetNotFlat()
// on the node get the link that is not BIN
// on the node get the link that is not BIN
// and that has the same graphnumber and is in same direction
// and that has the same graphnumber and is in same direction
KBoolLink
*
Node
::
Follow
(
KBool
Link
*
const
prev
)
kbLink
*
kbNode
::
Follow
(
kb
Link
*
const
prev
)
{
{
KBool
Link
*
temp
;
kb
Link
*
temp
;
_GC
->
_linkiter
->
Attach
(
_linklist
);
_GC
->
_linkiter
->
Attach
(
_linklist
);
_GC
->
_linkiter
->
tohead
();
_GC
->
_linkiter
->
tohead
();
...
@@ -555,9 +555,9 @@ KBoolLink *Node::Follow( KBoolLink* const prev )
...
@@ -555,9 +555,9 @@ KBoolLink *Node::Follow( KBoolLink* const prev )
// this function gets the highest (other node) link ascending from the node
// this function gets the highest (other node) link ascending from the node
// that has the bin flag set as the argument binset
// that has the bin flag set as the argument binset
// if no such link exists return 0
// if no such link exists return 0
KBoolLink
*
Node
::
GetBinHighest
(
bool
binset
)
kbLink
*
kb
Node
::
GetBinHighest
(
bool
binset
)
{
{
KBool
Link
*
Result
=
NULL
,
*
link
;
kb
Link
*
Result
=
NULL
,
*
link
;
_GC
->
_linkiter
->
Attach
(
_linklist
);
_GC
->
_linkiter
->
Attach
(
_linklist
);
double
tangold
=
0.0
;
double
tangold
=
0.0
;
...
...
polygon/kbool/src/record.cpp
View file @
ef2e41e3
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: record.cpp,v 1.
3 2008/06/04 21:23:22
titato Exp $
RCS-ID: $Id: record.cpp,v 1.
4 2009/09/07 19:23:28
titato Exp $
*/
*/
#include "kbool/booleng.h"
#include "kbool/booleng.h"
...
@@ -28,11 +28,11 @@
...
@@ -28,11 +28,11 @@
// }
// }
//}
//}
Record
::~
Record
()
kbRecord
::~
kb
Record
()
{}
{}
//void* Record::operator new(size_t size)
//void*
kb
Record::operator new(size_t size)
//{
//{
//
//
// if (r_index!=-1)
// if (r_index!=-1)
...
@@ -43,7 +43,7 @@ Record::~Record()
...
@@ -43,7 +43,7 @@ Record::~Record()
// return malloc(size);
// return malloc(size);
//}
//}
//void Record::operator delete(void* recordptr)
//void
kb
Record::operator delete(void* recordptr)
//{
//{
//
//
// if (r_index < 28)
// if (r_index < 28)
...
@@ -55,7 +55,7 @@ Record::~Record()
...
@@ -55,7 +55,7 @@ Record::~Record()
// free (recordptr);
// free (recordptr);
//}
//}
//void Record::deletepool()
//void
kb
Record::deletepool()
//{
//{
//
//
// while (r_index!=-1)
// while (r_index!=-1)
...
@@ -64,7 +64,7 @@ Record::~Record()
...
@@ -64,7 +64,7 @@ Record::~Record()
// }
// }
//}
//}
Record
::
Record
(
KBool
Link
*
link
,
Bool_Engine
*
GC
)
kbRecord
::
kbRecord
(
kb
Link
*
link
,
Bool_Engine
*
GC
)
:
_line
(
GC
)
:
_line
(
GC
)
{
{
_GC
=
GC
;
_GC
=
GC
;
...
@@ -77,14 +77,14 @@ Record::Record( KBoolLink* link, Bool_Engine* GC )
...
@@ -77,14 +77,14 @@ Record::Record( KBoolLink* link, Bool_Engine* GC )
//when the dimensions of a link for a record changes, its line parameters need to be recalculated
//when the dimensions of a link for a record changes, its line parameters need to be recalculated
void
Record
::
SetNewLink
(
KBool
Link
*
link
)
void
kbRecord
::
SetNewLink
(
kb
Link
*
link
)
{
{
_line
.
Set
(
link
);
_line
.
Set
(
link
);
_line
.
CalculateLineParameters
();
_line
.
CalculateLineParameters
();
}
}
//for beams calculate the ysp on the low scanline
//for beams calculate the ysp on the low scanline
void
Record
::
Calc_Ysp
(
Node
*
low
)
void
kbRecord
::
Calc_Ysp
(
kb
Node
*
low
)
{
{
if
(
(
LNK
->
GetEndNode
()
==
low
)
||
(
LNK
->
GetBeginNode
()
==
low
)
)
if
(
(
LNK
->
GetEndNode
()
==
low
)
||
(
LNK
->
GetBeginNode
()
==
low
)
)
{
{
...
@@ -103,7 +103,7 @@ void Record::Calc_Ysp( Node* low )
...
@@ -103,7 +103,7 @@ void Record::Calc_Ysp( Node* low )
}
}
//to set the _dir for new links in the beam
//to set the _dir for new links in the beam
void
Record
::
Set_Flags
()
void
kb
Record
::
Set_Flags
()
{
{
if
(
LNK
->
GetEndNode
()
->
GetX
()
==
LNK
->
GetBeginNode
()
->
GetX
()
)
//flatlink ?
if
(
LNK
->
GetEndNode
()
->
GetX
()
==
LNK
->
GetBeginNode
()
->
GetX
()
)
//flatlink ?
{
//only happens in flat beams
{
//only happens in flat beams
...
@@ -121,27 +121,27 @@ void Record::Set_Flags()
...
@@ -121,27 +121,27 @@ void Record::Set_Flags()
}
}
}
}
KBoolLink
*
Record
::
GetLink
()
kbLink
*
kb
Record
::
GetLink
()
{
{
return
LNK
;
return
LNK
;
}
}
B_INT
Record
::
Ysp
()
B_INT
kb
Record
::
Ysp
()
{
{
return
_ysp
;
return
_ysp
;
}
}
void
Record
::
SetYsp
(
B_INT
ysp
)
void
kb
Record
::
SetYsp
(
B_INT
ysp
)
{
{
_ysp
=
ysp
;
_ysp
=
ysp
;
}
}
DIRECTION
Record
::
Direction
()
DIRECTION
kb
Record
::
Direction
()
{
{
return
DIRECTION
(
_dir
);
return
DIRECTION
(
_dir
);
}
}
bool
Record
::
Calc_Left_Right
(
Record
*
record_above_me
)
bool
kbRecord
::
Calc_Left_Right
(
kb
Record
*
record_above_me
)
{
{
bool
par
=
false
;
bool
par
=
false
;
...
@@ -337,14 +337,14 @@ bool Record::Calc_Left_Right( Record* record_above_me )
...
@@ -337,14 +337,14 @@ bool Record::Calc_Left_Right( Record* record_above_me )
return
par
;
return
par
;
}
}
bool
Record
::
Equal
(
Record
*
a
)
bool
kbRecord
::
Equal
(
kb
Record
*
a
)
{
{
return
(
(
bool
)(
(
LNK
->
GetOther
(
a
->
LNK
->
GetBeginNode
()
)
==
a
->
LNK
->
GetEndNode
()
)
&&
return
(
(
bool
)(
(
LNK
->
GetOther
(
a
->
LNK
->
GetBeginNode
()
)
==
a
->
LNK
->
GetEndNode
()
)
&&
(
LNK
->
GetOther
(
a
->
LNK
->
GetEndNode
()
)
==
a
->
LNK
->
GetBeginNode
()
)
)
);
(
LNK
->
GetOther
(
a
->
LNK
->
GetEndNode
()
)
==
a
->
LNK
->
GetBeginNode
()
)
)
);
}
}
KBoolLine
*
Record
::
GetLine
()
kbLine
*
kb
Record
::
GetLine
()
{
{
return
&
_line
;
return
&
_line
;
}
}
...
...
polygon/kbool/src/scanbeam.cpp
View file @
ef2e41e3
...
@@ -5,7 +5,7 @@
...
@@ -5,7 +5,7 @@
Licence: see kboollicense.txt
Licence: see kboollicense.txt
RCS-ID: $Id: scanbeam.cpp,v 1.
3 2008/06/04 21:23:22
titato Exp $
RCS-ID: $Id: scanbeam.cpp,v 1.
4 2009/09/07 19:23:28
titato Exp $
*/
*/
// class scanbeam
// class scanbeam
...
@@ -22,12 +22,12 @@
...
@@ -22,12 +22,12 @@
//this here is to initialize the static iterator of scanbeam
//this here is to initialize the static iterator of scanbeam
//with NOLIST constructor
//with NOLIST constructor
int
recordsorter
(
Record
*
,
Record
*
);
int
recordsorter
(
kbRecord
*
,
kb
Record
*
);
int
recordsorter_ysp_angle
(
Record
*
,
Record
*
);
int
recordsorter_ysp_angle
(
kbRecord
*
,
kb
Record
*
);
int
recordsorter_ysp_angle_back
(
Record
*
rec1
,
Record
*
rec2
);
int
recordsorter_ysp_angle_back
(
kbRecord
*
rec1
,
kb
Record
*
rec2
);
ScanBeam
::
ScanBeam
(
Bool_Engine
*
GC
)
:
DL_List
<
Record
*>
()
ScanBeam
::
ScanBeam
(
Bool_Engine
*
GC
)
:
DL_List
<
kb
Record
*>
()
{
{
_GC
=
GC
;
_GC
=
GC
;
_type
=
NORMAL
;
_type
=
NORMAL
;
...
@@ -43,7 +43,7 @@ ScanBeam::~ScanBeam()
...
@@ -43,7 +43,7 @@ ScanBeam::~ScanBeam()
//DeleteRecordPool();
//DeleteRecordPool();
}
}
void
ScanBeam
::
SetType
(
Node
*
low
,
Node
*
high
)
void
ScanBeam
::
SetType
(
kbNode
*
low
,
kb
Node
*
high
)
{
{
if
(
low
->
GetX
()
<
high
->
GetX
()
)
if
(
low
->
GetX
()
<
high
->
GetX
()
)
_type
=
NORMAL
;
_type
=
NORMAL
;
...
@@ -54,12 +54,12 @@ void ScanBeam::SetType( Node* low, Node* high )
...
@@ -54,12 +54,12 @@ void ScanBeam::SetType( Node* low, Node* high )
/*
/*
//catch node to link crossings
//catch node to link crossings
// must be sorted on ysp
// must be sorted on ysp
int ScanBeam::FindCloseLinksAndCross(TDLI<
KBoolLink>* _I,
Node* _lowf)
int ScanBeam::FindCloseLinksAndCross(TDLI<
kbLink>* _I,kb
Node* _lowf)
{
{
int merges = 0;
int merges = 0;
Record* record;
kb
Record* record;
TDLI<
Record> _BBI=TDLI<
Record>(this);
TDLI<
kbRecord> _BBI=TDLI<kb
Record>(this);
if (_BI.count() > 1)
if (_BI.count() > 1)
{
{
...
@@ -131,16 +131,16 @@ int ScanBeam::FindCloseLinksAndCross(TDLI<KBoolLink>* _I,Node* _lowf)
...
@@ -131,16 +131,16 @@ int ScanBeam::FindCloseLinksAndCross(TDLI<KBoolLink>* _I,Node* _lowf)
*/
*/
/*
/*
bool ScanBeam::Update(TDLI<
KBoolLink>* _I,
Node* _lowf)
bool ScanBeam::Update(TDLI<
kbLink>* _I,kb
Node* _lowf)
{
{
bool found=false;
bool found=false;
KBool
Link* link;
kb
Link* link;
_BI.tohead();
_BI.tohead();
while (!_BI.hitroot())
while (!_BI.hitroot())
{
{
Record* record=_BI.item();
kb
Record* record=_BI.item();
record->Calc_Ysp(_type,_low);
record->Calc_Ysp(_type,_low);
_BI++;
_BI++;
}
}
...
@@ -150,7 +150,7 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
...
@@ -150,7 +150,7 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
_BI.tohead();
_BI.tohead();
while (!_BI.hitroot())
while (!_BI.hitroot())
{
{
Record* record=_BI.item();
kb
Record* record=_BI.item();
//records containing links towards the new low node
//records containing links towards the new low node
//are links to be marked for removal
//are links to be marked for removal
...
@@ -166,7 +166,7 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
...
@@ -166,7 +166,7 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
_BI--;
_BI--;
if (!_BI.hitroot() && (_BI.count() > 1))
if (!_BI.hitroot() && (_BI.count() > 1))
{
{
Record* prev=_BI.item();
kb
Record* prev=_BI.item();
_BI++;
_BI++;
if (!_BI.hitroot())
if (!_BI.hitroot())
{
{
...
@@ -195,7 +195,7 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
...
@@ -195,7 +195,7 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
//so for following beams it will not be checked again
//so for following beams it will not be checked again
while ( bool(link=_lowf->GetBinHighest(false)) )
while ( bool(link=_lowf->GetBinHighest(false)) )
{
{
Record* record=new
Record(link);
kbRecord* record=new kb
Record(link);
// yp_new will always be the y of low node since all new links are
// yp_new will always be the y of low node since all new links are
// from this node
// from this node
record->SetYsp(_lowf->GetY());
record->SetYsp(_lowf->GetY());
...
@@ -222,7 +222,7 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
...
@@ -222,7 +222,7 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
_BI--;_BI--; //just before the new record inserted
_BI--;_BI--; //just before the new record inserted
if (!_BI.hitroot())
if (!_BI.hitroot())
{
{
Record* prev=_BI.item();
kb
Record* prev=_BI.item();
_BI++; //goto the new record inserted
_BI++; //goto the new record inserted
if (!_BI.item()->Equal(prev)) // records NOT parallel
if (!_BI.item()->Equal(prev)) // records NOT parallel
{
{
...
@@ -238,11 +238,11 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
...
@@ -238,11 +238,11 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
else
else
_BI++;
_BI++;
Record* prev=_BI.item(); //the new record
kb
Record* prev=_BI.item(); //the new record
_BI++;
_BI++;
if (!_BI.hitroot() && !_BI.item()->Equal(prev)) // records NOT parallel
if (!_BI.hitroot() && !_BI.item()->Equal(prev)) // records NOT parallel
{
{
Record* cur=_BI.item();
kb
Record* cur=_BI.item();
if (cur->GetLine()->Intersect(prev->GetLine(),MARGE))
if (cur->GetLine()->Intersect(prev->GetLine(),MARGE))
{
{
//this may modify the links already part of the record
//this may modify the links already part of the record
...
@@ -264,13 +264,13 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
...
@@ -264,13 +264,13 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
}
}
*/
*/
bool
ScanBeam
::
FindNew
(
SCANTYPE
scantype
,
TDLI
<
KBool
Link
>*
_I
,
bool
&
holes
)
bool
ScanBeam
::
FindNew
(
SCANTYPE
scantype
,
TDLI
<
kb
Link
>*
_I
,
bool
&
holes
)
{
{
bool
foundnew
=
false
;
bool
foundnew
=
false
;
_low
=
_I
->
item
()
->
GetBeginNode
();
_low
=
_I
->
item
()
->
GetBeginNode
();
KBool
Link
*
link
;
kb
Link
*
link
;
//if (!checksort())
//if (!checksort())
// SortTheBeam();
// SortTheBeam();
...
@@ -291,7 +291,7 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -291,7 +291,7 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
{
{
//all vertical links in flatbeam are ignored
//all vertical links in flatbeam are ignored
//normal link in beam
//normal link in beam
Record
*
record
=
new
Record
(
link
,
_GC
);
kbRecord
*
record
=
new
kb
Record
(
link
,
_GC
);
// yp_new will always be the y of low node since all new links are
// yp_new will always be the y of low node since all new links are
// from this node
// from this node
record
->
SetYsp
(
_low
->
GetY
()
);
record
->
SetYsp
(
_low
->
GetY
()
);
...
@@ -309,7 +309,7 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -309,7 +309,7 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
case
LINKLINK
:
case
LINKLINK
:
//is the new record a flat link
//is the new record a flat link
{
{
KBoolLine
flatline
=
KBool
Line
(
link
,
_GC
);
kbLine
flatline
=
kb
Line
(
link
,
_GC
);
foundnew
=
Process_LinkToLink_Flat
(
&
flatline
)
||
foundnew
;
foundnew
=
Process_LinkToLink_Flat
(
&
flatline
)
||
foundnew
;
//flatlinks are not part of the beams, still they are used to find new beams
//flatlinks are not part of the beams, still they are used to find new beams
//they can be processed now if the beginnode does not change, since this is used to
//they can be processed now if the beginnode does not change, since this is used to
...
@@ -327,7 +327,7 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -327,7 +327,7 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
else
else
{
{
//normal link in beam
//normal link in beam
Record
*
record
=
new
Record
(
link
,
_GC
);
kbRecord
*
record
=
new
kb
Record
(
link
,
_GC
);
// yp_new will always be the y of low node since all new links are
// yp_new will always be the y of low node since all new links are
// from this node
// from this node
record
->
SetYsp
(
_low
->
GetY
()
);
record
->
SetYsp
(
_low
->
GetY
()
);
...
@@ -361,7 +361,7 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -361,7 +361,7 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
//now we can set the a/b group flags based on the above link
//now we can set the a/b group flags based on the above link
_BI
--
;
_BI
--
;
_BI
--
;
_BI
--
;
Record
*
above
=
0
;
kb
Record
*
above
=
0
;
if
(
!
_BI
.
hitroot
()
)
if
(
!
_BI
.
hitroot
()
)
above
=
_BI
.
item
();
above
=
_BI
.
item
();
_BI
++
;
_BI
++
;
...
@@ -396,11 +396,11 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -396,11 +396,11 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
return
foundnew
;
return
foundnew
;
}
}
bool
ScanBeam
::
RemoveOld
(
SCANTYPE
scantype
,
TDLI
<
KBool
Link
>*
_I
,
bool
&
holes
)
bool
ScanBeam
::
RemoveOld
(
SCANTYPE
scantype
,
TDLI
<
kb
Link
>*
_I
,
bool
&
holes
)
{
{
bool
found
=
false
;
bool
found
=
false
;
bool
foundnew
=
false
;
bool
foundnew
=
false
;
DL_Iter
<
Record
*>
_BBI
=
DL_Iter
<
Record
*>
();
DL_Iter
<
kbRecord
*>
_BBI
=
DL_Iter
<
kb
Record
*>
();
bool
attached
=
false
;
bool
attached
=
false
;
_low
=
_I
->
item
()
->
GetBeginNode
();
_low
=
_I
->
item
()
->
GetBeginNode
();
...
@@ -416,10 +416,14 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -416,10 +416,14 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
{
{
if
(
scantype
==
LINKHOLES
)
if
(
scantype
==
LINKHOLES
)
{
{
// Tophole links can be linked at the begin or end point, depending on
// which is higher in Y.
// A link pointing to the low node, and which is a tophole link,
// and which was not linked in sofar should be linked now.
_BI
.
tohead
();
_BI
.
tohead
();
while
(
!
_BI
.
hitroot
()
)
while
(
!
_BI
.
hitroot
()
)
{
{
Record
*
record
=
_BI
.
item
();
kb
Record
*
record
=
_BI
.
item
();
//records containing links towards the new low node
//records containing links towards the new low node
//are links to be removed
//are links to be removed
if
(
(
record
->
GetLink
()
->
GetEndNode
()
==
_low
)
||
if
(
(
record
->
GetLink
()
->
GetEndNode
()
==
_low
)
||
...
@@ -435,37 +439,17 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -435,37 +439,17 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
_BI
.
tohead
();
_BI
.
tohead
();
while
(
!
_BI
.
hitroot
()
)
while
(
!
_BI
.
hitroot
()
)
{
{
Record
*
record
=
_BI
.
item
();
kb
Record
*
record
=
_BI
.
item
();
//records containing links towards the new low node
//records containing links towards the new low node
//are links to be removed
//are links to be removed
if
(
(
record
->
GetLink
()
->
GetEndNode
()
==
_low
)
||
if
(
(
record
->
GetLink
()
->
GetEndNode
()
==
_low
)
||
(
record
->
GetLink
()
->
GetBeginNode
()
==
_low
)
(
record
->
GetLink
()
->
GetBeginNode
()
==
_low
)
)
)
{
{
if
(
attached
)
//there is a bug
{
_BBI
.
Detach
();
if
(
!
checksort
()
)
SortTheBeam
(
true
);
_BI
.
tohead
();
attached
=
false
;
}
delete
_BI
.
item
();
delete
_BI
.
item
();
_BI
.
remove
();
_BI
.
remove
();
found
=
true
;
found
=
true
;
}
}
else
if
(
found
)
//only once in here
{
attached
=
true
;
found
=
false
;
_BBI
.
Attach
(
this
);
_BBI
.
toiter
(
&
_BI
);
//this is the position new records will be inserted
//recalculate ysp for the new scanline
record
->
Calc_Ysp
(
_low
);
_BI
++
;
}
else
else
{
{
//recalculate ysp for the new scanline
//recalculate ysp for the new scanline
...
@@ -474,21 +458,35 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -474,21 +458,35 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
}
}
}
}
if
(
attached
)
// all records are renewed in Ysp.
// found links to remove, we search the new insert position for new links.
if
(
found
)
{
{
_BI
.
toiter
(
&
_BBI
);
_BI
.
tohead
();
_BBI
.
Detach
();
while
(
!
_BI
.
hitroot
()
)
{
kbRecord
*
record
=
_BI
.
item
();
if
(
record
->
Ysp
()
<
_low
->
GetY
()
)
{
break
;
}
_BI
++
;
}
}
}
}
}
else
else
{
{
// nothing is removed from the beam, still we moved forward with the scanline
// at the new _low, so we need to recalculate the intersections of the links
// with the new scanline.
// Also the the insert position for new links is determined, being the first
// link below _low.
_BBI
.
Attach
(
this
);
_BBI
.
Attach
(
this
);
_BBI
.
toroot
();
_BBI
.
toroot
();
_BI
.
tohead
();
_BI
.
tohead
();
while
(
!
_BI
.
hitroot
()
)
while
(
!
_BI
.
hitroot
()
)
{
{
Record
*
record
=
_BI
.
item
();
kb
Record
*
record
=
_BI
.
item
();
record
->
Calc_Ysp
(
_low
);
record
->
Calc_Ysp
(
_low
);
if
(
!
found
&&
(
record
->
Ysp
()
<
_low
->
GetY
()
)
)
if
(
!
found
&&
(
record
->
Ysp
()
<
_low
->
GetY
()
)
)
...
@@ -502,7 +500,7 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -502,7 +500,7 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
_BBI
.
Detach
();
_BBI
.
Detach
();
}
}
}
}
else
else
// _type == NORMAL
{
//because the previous beam was flat the links to remove are
{
//because the previous beam was flat the links to remove are
//below the last insert position
//below the last insert position
if
(
_low
->
GetBinHighest
(
true
)
)
//is there something to remove
if
(
_low
->
GetBinHighest
(
true
)
)
//is there something to remove
...
@@ -513,7 +511,7 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -513,7 +511,7 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
_BI
.
tohead
();
_BI
.
tohead
();
while
(
!
_BI
.
hitroot
()
)
while
(
!
_BI
.
hitroot
()
)
{
{
Record
*
record
=
_BI
.
item
();
kb
Record
*
record
=
_BI
.
item
();
//records containing links towards the new low node
//records containing links towards the new low node
//are links to be removed
//are links to be removed
if
(
(
record
->
GetLink
()
->
GetEndNode
()
==
_low
)
||
if
(
(
record
->
GetLink
()
->
GetEndNode
()
==
_low
)
||
...
@@ -531,14 +529,10 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -531,14 +529,10 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
//if there was no record before the last deleted record this means
//if there was no record before the last deleted record this means
//we where at the beginning of the beam, so at root
//we where at the beginning of the beam, so at root
//_BI << (lastinserted+1);
//_BI--;
//if (_BI.hitroot()) //only possible when at the begin of the beam
_BI
.
tohead
();
_BI
.
tohead
();
while
(
!
_BI
.
hitroot
()
)
while
(
!
_BI
.
hitroot
()
)
{
{
Record
*
record
=
_BI
.
item
();
kb
Record
*
record
=
_BI
.
item
();
//records containing links towards the new low node
//records containing links towards the new low node
//are links to be removed
//are links to be removed
if
(
(
record
->
GetLink
()
->
GetEndNode
()
==
_low
)
||
if
(
(
record
->
GetLink
()
->
GetEndNode
()
==
_low
)
||
...
@@ -566,13 +560,10 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -566,13 +560,10 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
//if there was no record before the last deleted record this means
//if there was no record before the last deleted record this means
//we where at the beginning of the beam, so at root
//we where at the beginning of the beam, so at root
//_BI << (lastinserted+ 1);
//_BI--;
//if (_BI.hitroot()) //only possible when at the begin of the beam
_BI
.
tohead
();
_BI
.
tohead
();
while
(
!
_BI
.
hitroot
()
)
while
(
!
_BI
.
hitroot
()
)
{
{
Record
*
record
=
_BI
.
item
();
kb
Record
*
record
=
_BI
.
item
();
if
(
record
->
Ysp
()
<
_low
->
GetY
()
)
if
(
record
->
Ysp
()
<
_low
->
GetY
()
)
break
;
break
;
_BI
++
;
_BI
++
;
...
@@ -601,14 +592,14 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -601,14 +592,14 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
_BI
.
tohead
();
_BI
.
tohead
();
while
(
!
_BI
.
hitroot
()
)
while
(
!
_BI
.
hitroot
()
)
{
{
Record
*
record
=
_BI
.
item
();
kb
Record
*
record
=
_BI
.
item
();
//records containing links towards the new low node
//records containing links towards the new low node
//are links to be removed
//are links to be removed
if
(
(
record
->
GetLink
()
->
GetEndNode
()
==
_low
)
||
if
(
(
record
->
GetLink
()
->
GetEndNode
()
==
_low
)
||
(
record
->
GetLink
()
->
GetBeginNode
()
==
_low
)
(
record
->
GetLink
()
->
GetBeginNode
()
==
_low
)
)
)
{
{
KBool
Line
*
line
=
record
->
GetLine
();
kb
Line
*
line
=
record
->
GetLine
();
if
(
scantype
==
NODELINK
)
if
(
scantype
==
NODELINK
)
foundnew
=
Process_PointToLink_Crossings
()
!=
0
||
foundnew
;
foundnew
=
Process_PointToLink_Crossings
()
!=
0
||
foundnew
;
line
->
ProcessCrossings
(
_I
);
line
->
ProcessCrossings
(
_I
);
...
@@ -629,7 +620,7 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -629,7 +620,7 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
_BI
.
tohead
();
_BI
.
tohead
();
while
(
!
_BI
.
hitroot
()
)
while
(
!
_BI
.
hitroot
()
)
{
{
Record
*
record
=
_BI
.
item
();
kb
Record
*
record
=
_BI
.
item
();
//because the beam is sorted on ysp, stop when
//because the beam is sorted on ysp, stop when
//the right insertion point for new links has been found
//the right insertion point for new links has been found
if
(
(
record
->
Ysp
()
<
_low
->
GetY
()
)
)
if
(
(
record
->
Ysp
()
<
_low
->
GetY
()
)
)
...
@@ -647,11 +638,11 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
...
@@ -647,11 +638,11 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
return
foundnew
;
return
foundnew
;
}
}
/*
/*
bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<
KBool
Link>* _I, bool& holes )
bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<
kb
Link>* _I, bool& holes )
{
{
bool found = false;
bool found = false;
bool foundnew = false;
bool foundnew = false;
DL_Iter<
Record*> _BBI=DL_Iter<
Record*>();
DL_Iter<
kbRecord*> _BBI=DL_Iter<kb
Record*>();
bool attached=false;
bool attached=false;
_low = _I->item()->GetBeginNode();
_low = _I->item()->GetBeginNode();
...
@@ -663,7 +654,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
...
@@ -663,7 +654,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
case LINKHOLES:
case LINKHOLES:
if (_type==NORMAL )
if (_type==NORMAL )
{
{
KBool
Link* link = _low->GetBinHighest(true);
kb
Link* link = _low->GetBinHighest(true);
if ( link ) //is there something to remove
if ( link ) //is there something to remove
{
{
link->SetRecordNode( NULL );
link->SetRecordNode( NULL );
...
@@ -673,7 +664,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
...
@@ -673,7 +664,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
_BI.tohead();
_BI.tohead();
while (!_BI.hitroot())
while (!_BI.hitroot())
{
{
Record* record = _BI.item();
kb
Record* record = _BI.item();
//records containing links towards the new low node
//records containing links towards the new low node
//are links to be removed
//are links to be removed
if ((record->GetLink()->GetEndNode() == _low) ||
if ((record->GetLink()->GetEndNode() == _low) ||
...
@@ -689,7 +680,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
...
@@ -689,7 +680,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
_BI.tohead();
_BI.tohead();
while (!_BI.hitroot())
while (!_BI.hitroot())
{
{
Record* record=_BI.item();
kb
Record* record=_BI.item();
//records containing links towards the new low node
//records containing links towards the new low node
//are links to be removed
//are links to be removed
if ((record->GetLink()->GetEndNode() == _low) ||
if ((record->GetLink()->GetEndNode() == _low) ||
...
@@ -721,7 +712,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
...
@@ -721,7 +712,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
_BI.tohead();
_BI.tohead();
while (!_BI.hitroot())
while (!_BI.hitroot())
{
{
Record* record=_BI.item();
kb
Record* record=_BI.item();
record->Calc_Ysp(_low);
record->Calc_Ysp(_low);
_BI++;
_BI++;
}
}
...
@@ -730,7 +721,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
...
@@ -730,7 +721,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
else
else
{ //because the previous beam was flat the links to remove are
{ //because the previous beam was flat the links to remove are
//below the last insert position
//below the last insert position
KBool
Link* link;
kb
Link* link;
link = _low->GetBinHighest(true);
link = _low->GetBinHighest(true);
if( link )//is there something to remove
if( link )//is there something to remove
{
{
...
@@ -740,7 +731,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
...
@@ -740,7 +731,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
_BI.tohead();
_BI.tohead();
while (!_BI.hitroot())
while (!_BI.hitroot())
{
{
Record* record = _BI.item();
kb
Record* record = _BI.item();
if (record->GetLink() == link)
if (record->GetLink() == link)
linkf = true;
linkf = true;
_BI++;
_BI++;
...
@@ -755,7 +746,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
...
@@ -755,7 +746,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
_BI.tohead();
_BI.tohead();
while (!_BI.hitroot())
while (!_BI.hitroot())
{
{
Record* record=_BI.item();
kb
Record* record=_BI.item();
//records containing links towards the new low node
//records containing links towards the new low node
//are links to be removed
//are links to be removed
if ((record->GetLink()->GetEndNode() == _low) ||
if ((record->GetLink()->GetEndNode() == _low) ||
...
@@ -786,7 +777,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
...
@@ -786,7 +777,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
_BI.tohead();
_BI.tohead();
while (!_BI.hitroot())
while (!_BI.hitroot())
{
{
Record* record=_BI.item();
kb
Record* record=_BI.item();
//records containing links towards the new low node
//records containing links towards the new low node
//are links to be removed
//are links to be removed
if ((record->GetLink()->GetEndNode() == _low) ||
if ((record->GetLink()->GetEndNode() == _low) ||
...
@@ -835,7 +826,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
...
@@ -835,7 +826,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
_BI.tohead();
_BI.tohead();
while (!_BI.hitroot())
while (!_BI.hitroot())
{
{
Record* record=_BI.item();
kb
Record* record=_BI.item();
if (record->Ysp() < _low->GetY())
if (record->Ysp() < _low->GetY())
break;
break;
_BI++;
_BI++;
...
@@ -865,14 +856,14 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
...
@@ -865,14 +856,14 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
_BI.tohead();
_BI.tohead();
while (!_BI.hitroot())
while (!_BI.hitroot())
{
{
Record* record=_BI.item();
kb
Record* record=_BI.item();
//records containing links towards the new low node
//records containing links towards the new low node
//are links to be removed
//are links to be removed
if ((record->GetLink()->GetEndNode() == _low) ||
if ((record->GetLink()->GetEndNode() == _low) ||
(record->GetLink()->GetBeginNode() == _low)
(record->GetLink()->GetBeginNode() == _low)
)
)
{
{
KBool
Line* line=record->GetLine();
kb
Line* line=record->GetLine();
if (scantype==NODELINK)
if (scantype==NODELINK)
foundnew = Process_PointToLink_Crossings() !=0 || foundnew;
foundnew = Process_PointToLink_Crossings() !=0 || foundnew;
line->ProcessCrossings(_I);
line->ProcessCrossings(_I);
...
@@ -893,7 +884,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
...
@@ -893,7 +884,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
_BI.tohead();
_BI.tohead();
while (!_BI.hitroot())
while (!_BI.hitroot())
{
{
Record* record=_BI.item();
kb
Record* record=_BI.item();
//because the beam is sorted on ysp, stop when
//because the beam is sorted on ysp, stop when
//the right insertion point for new links has been found
//the right insertion point for new links has been found
if ((record->Ysp() < _low->GetY()))
if ((record->Ysp() < _low->GetY()))
...
@@ -925,8 +916,8 @@ void ScanBeam::Calc_Ysp()
...
@@ -925,8 +916,8 @@ void ScanBeam::Calc_Ysp()
_BI
.
tohead
();
_BI
.
tohead
();
while
(
!
_BI
.
hitroot
()
)
while
(
!
_BI
.
hitroot
()
)
{
{
Record
*
record
=
_BI
.
item
();
kb
Record
*
record
=
_BI
.
item
();
//
KBool
Link* link=_BI.item()->GetLink();
//
kb
Link* link=_BI.item()->GetLink();
record
->
Calc_Ysp
(
_low
);
record
->
Calc_Ysp
(
_low
);
_BI
++
;
_BI
++
;
}
}
...
@@ -940,7 +931,7 @@ void ScanBeam::Generate_INOUT( int graphnumber )
...
@@ -940,7 +931,7 @@ void ScanBeam::Generate_INOUT( int graphnumber )
DIRECTION
first_dir
=
GO_LEFT
;
DIRECTION
first_dir
=
GO_LEFT
;
int
diepte
=
0
;
int
diepte
=
0
;
DL_Iter
<
Record
*>
_BBI
=
DL_Iter
<
Record
*>
();
DL_Iter
<
kbRecord
*>
_BBI
=
DL_Iter
<
kb
Record
*>
();
_BBI
.
Attach
(
this
);
_BBI
.
Attach
(
this
);
for
(
_BBI
.
tohead
();
!
_BBI
.
hitroot
();
_BBI
++
)
for
(
_BBI
.
tohead
();
!
_BBI
.
hitroot
();
_BBI
++
)
{
{
...
@@ -999,14 +990,14 @@ void ScanBeam::Generate_INOUT( int graphnumber )
...
@@ -999,14 +990,14 @@ void ScanBeam::Generate_INOUT( int graphnumber )
// in a later beam will be higher than the current, if so we will wait
// in a later beam will be higher than the current, if so we will wait
// till that node comes around otherwise we will link this node to the
// till that node comes around otherwise we will link this node to the
// closest link (prev in beam)
// closest link (prev in beam)
bool
ScanBeam
::
ProcessHoles
(
bool
atinsert
,
TDLI
<
KBool
Link
>*
_LI
)
bool
ScanBeam
::
ProcessHoles
(
bool
atinsert
,
TDLI
<
kb
Link
>*
_LI
)
{
{
// The scanbeam must already be sorted at this moment
// The scanbeam must already be sorted at this moment
Node
*
topnode
;
kb
Node
*
topnode
;
bool
foundholes
=
false
;
bool
foundholes
=
false
;
Record
*
record
=
_BI
.
item
();
kb
Record
*
record
=
_BI
.
item
();
KBool
Link
*
link
=
record
->
GetLink
();
kb
Link
*
link
=
record
->
GetLink
();
if
(
!
record
->
GetLine
()
->
CrossListEmpty
()
)
if
(
!
record
->
GetLine
()
->
CrossListEmpty
()
)
{
{
...
@@ -1018,14 +1009,14 @@ bool ScanBeam::ProcessHoles( bool atinsert, TDLI<KBoolLink>* _LI )
...
@@ -1018,14 +1009,14 @@ bool ScanBeam::ProcessHoles( bool atinsert, TDLI<KBoolLink>* _LI )
// make new nodes and links and set them, re-use the old link, so the links
// make new nodes and links and set them, re-use the old link, so the links
// that still stand in the linecrosslist will not be lost.
// that still stand in the linecrosslist will not be lost.
// There is a hole that must be linked to this link !
// There is a hole that must be linked to this link !
TDLI
<
Node
>
I
(
record
->
GetLine
()
->
GetCrossList
()
);
TDLI
<
kb
Node
>
I
(
record
->
GetLine
()
->
GetCrossList
()
);
I
.
tohead
();
I
.
tohead
();
while
(
!
I
.
hitroot
()
)
while
(
!
I
.
hitroot
()
)
{
{
topnode
=
I
.
item
();
topnode
=
I
.
item
();
I
.
remove
();
I
.
remove
();
KBool
Line
line
(
_GC
);
kb
Line
line
(
_GC
);
line
.
Set
(
link
);
line
.
Set
(
link
);
B_INT
Y
=
line
.
Calculate_Y
(
topnode
->
GetX
()
);
B_INT
Y
=
line
.
Calculate_Y
(
topnode
->
GetX
()
);
...
@@ -1053,16 +1044,16 @@ bool ScanBeam::ProcessHoles( bool atinsert, TDLI<KBoolLink>* _LI )
...
@@ -1053,16 +1044,16 @@ bool ScanBeam::ProcessHoles( bool atinsert, TDLI<KBoolLink>* _LI )
// all holes are oriented left around
// all holes are oriented left around
Node
*
leftnode
;
//left node of clossest link
kb
Node
*
leftnode
;
//left node of clossest link
(
link
->
GetBeginNode
()
->
GetX
()
<
link
->
GetEndNode
()
->
GetX
()
)
?
(
link
->
GetBeginNode
()
->
GetX
()
<
link
->
GetEndNode
()
->
GetX
()
)
?
leftnode
=
link
->
GetBeginNode
()
:
leftnode
=
link
->
GetBeginNode
()
:
leftnode
=
link
->
GetEndNode
();
leftnode
=
link
->
GetEndNode
();
Node
*
node_A
=
new
Node
(
topnode
->
GetX
(),
Y
,
_GC
);
kbNode
*
node_A
=
new
kb
Node
(
topnode
->
GetX
(),
Y
,
_GC
);
KBoolLink
*
link_A
=
new
KBool
Link
(
0
,
leftnode
,
node_A
,
_GC
);
kbLink
*
link_A
=
new
kb
Link
(
0
,
leftnode
,
node_A
,
_GC
);
KBoolLink
*
link_B
=
new
KBool
Link
(
0
,
node_A
,
topnode
,
_GC
);
kbLink
*
link_B
=
new
kb
Link
(
0
,
node_A
,
topnode
,
_GC
);
KBoolLink
*
link_BB
=
new
KBool
Link
(
0
,
topnode
,
node_A
,
_GC
);
kbLink
*
link_BB
=
new
kb
Link
(
0
,
topnode
,
node_A
,
_GC
);
KBool
Link
*
link_D
=
_BI
.
item
()
->
GetLink
();
kb
Link
*
link_D
=
_BI
.
item
()
->
GetLink
();
link_D
->
Replace
(
leftnode
,
node_A
);
link_D
->
Replace
(
leftnode
,
node_A
);
_LI
->
insbegin
(
link_A
);
_LI
->
insbegin
(
link_A
);
_LI
->
insbegin
(
link_B
);
_LI
->
insbegin
(
link_B
);
...
@@ -1137,7 +1128,7 @@ bool ScanBeam::ProcessHoles( bool atinsert, TDLI<KBoolLink>* _LI )
...
@@ -1137,7 +1128,7 @@ bool ScanBeam::ProcessHoles( bool atinsert, TDLI<KBoolLink>* _LI )
}
}
//sort the records on Ysp if eqaul, sort on tangent at ysp
//sort the records on Ysp if eqaul, sort on tangent at ysp
int
recordsorter_ysp_angle
(
Record
*
rec1
,
Record
*
rec2
)
int
recordsorter_ysp_angle
(
kbRecord
*
rec1
,
kb
Record
*
rec2
)
{
{
if
(
rec1
->
Ysp
()
>
rec2
->
Ysp
()
)
if
(
rec1
->
Ysp
()
>
rec2
->
Ysp
()
)
return
(
1
);
return
(
1
);
...
@@ -1163,7 +1154,7 @@ int recordsorter_ysp_angle( Record* rec1, Record* rec2 )
...
@@ -1163,7 +1154,7 @@ int recordsorter_ysp_angle( Record* rec1, Record* rec2 )
}
}
//sort the records on Ysp if eqaul, sort on tangent at ysp
//sort the records on Ysp if eqaul, sort on tangent at ysp
int
recordsorter_ysp_angle_back
(
Record
*
rec1
,
Record
*
rec2
)
int
recordsorter_ysp_angle_back
(
kbRecord
*
rec1
,
kb
Record
*
rec2
)
{
{
if
(
rec1
->
Ysp
()
>
rec2
->
Ysp
()
)
if
(
rec1
->
Ysp
()
>
rec2
->
Ysp
()
)
return
(
1
);
return
(
1
);
...
@@ -1189,7 +1180,7 @@ int recordsorter_ysp_angle_back( Record* rec1, Record* rec2 )
...
@@ -1189,7 +1180,7 @@ int recordsorter_ysp_angle_back( Record* rec1, Record* rec2 )
}
}
// swap functie for cocktailsort ==> each swap means an intersection of links
// swap functie for cocktailsort ==> each swap means an intersection of links
bool
swap_crossing_normal
(
Record
*
a
,
Record
*
b
)
bool
swap_crossing_normal
(
kbRecord
*
a
,
kb
Record
*
b
)
{
{
if
(
!
a
->
Equal
(
b
)
)
// records NOT parallel
if
(
!
a
->
Equal
(
b
)
)
// records NOT parallel
{
{
...
@@ -1210,11 +1201,11 @@ int ScanBeam::Process_LinkToLink_Crossings()
...
@@ -1210,11 +1201,11 @@ int ScanBeam::Process_LinkToLink_Crossings()
int
ScanBeam
::
Process_PointToLink_Crossings
()
int
ScanBeam
::
Process_PointToLink_Crossings
()
{
{
int
merges
=
0
;
int
merges
=
0
;
Record
*
record
;
kb
Record
*
record
;
if
(
_BI
.
count
()
>
1
)
if
(
_BI
.
count
()
>
1
)
{
{
DL_Iter
<
Record
*>
IL
=
DL_Iter
<
Record
*>
(
this
);
DL_Iter
<
kbRecord
*>
IL
=
DL_Iter
<
kb
Record
*>
(
this
);
IL
.
toiter
(
&
_BI
);
IL
.
toiter
(
&
_BI
);
//from IL search back for close links
//from IL search back for close links
...
@@ -1263,11 +1254,11 @@ int ScanBeam::Process_PointToLink_Crossings()
...
@@ -1263,11 +1254,11 @@ int ScanBeam::Process_PointToLink_Crossings()
return
merges
;
return
merges
;
}
}
int
ScanBeam
::
Process_LinkToLink_Flat
(
KBool
Line
*
flatline
)
int
ScanBeam
::
Process_LinkToLink_Flat
(
kb
Line
*
flatline
)
{
{
int
crossfound
=
0
;
int
crossfound
=
0
;
Record
*
record
;
kb
Record
*
record
;
DL_Iter
<
Record
*>
_BBI
=
DL_Iter
<
Record
*>
();
DL_Iter
<
kbRecord
*>
_BBI
=
DL_Iter
<
kb
Record
*>
();
_BBI
.
Attach
(
this
);
_BBI
.
Attach
(
this
);
_BBI
.
toiter
(
&
_BI
);
_BBI
.
toiter
(
&
_BI
);
...
@@ -1292,7 +1283,7 @@ int ScanBeam::Process_LinkToLink_Flat( KBoolLine* flatline )
...
@@ -1292,7 +1283,7 @@ int ScanBeam::Process_LinkToLink_Flat( KBoolLine* flatline )
(
record
->
GetLink
()
->
GetBeginNode
()
!=
flatline
->
GetLink
()
->
GetLowNode
()
)
(
record
->
GetLink
()
->
GetBeginNode
()
!=
flatline
->
GetLink
()
->
GetLowNode
()
)
)
)
{
{
Node
*
newnode
=
new
Node
(
_low
->
GetX
(),
_BI
.
item
()
->
Ysp
(),
_GC
);
kbNode
*
newnode
=
new
kb
Node
(
_low
->
GetX
(),
_BI
.
item
()
->
Ysp
(),
_GC
);
flatline
->
AddCrossing
(
newnode
);
flatline
->
AddCrossing
(
newnode
);
record
->
GetLine
()
->
AddCrossing
(
newnode
);
record
->
GetLine
()
->
AddCrossing
(
newnode
);
crossfound
++
;
crossfound
++
;
...
@@ -1313,11 +1304,11 @@ bool ScanBeam::checksort()
...
@@ -1313,11 +1304,11 @@ bool ScanBeam::checksort()
// put new item left of the one that is bigger
// put new item left of the one that is bigger
_BI
.
tohead
();
_BI
.
tohead
();
Record
*
prev
=
_BI
.
item
();
kb
Record
*
prev
=
_BI
.
item
();
_BI
++
;
_BI
++
;
while
(
!
_BI
.
hitroot
()
)
while
(
!
_BI
.
hitroot
()
)
{
{
Record
*
curr
=
_BI
.
item
();
kb
Record
*
curr
=
_BI
.
item
();
if
(
recordsorter_ysp_angle
(
prev
,
curr
)
==
-
1
)
if
(
recordsorter_ysp_angle
(
prev
,
curr
)
==
-
1
)
{
{
recordsorter_ysp_angle
(
prev
,
curr
);
recordsorter_ysp_angle
(
prev
,
curr
);
...
@@ -1347,17 +1338,17 @@ bool ScanBeam::writebeam()
...
@@ -1347,17 +1338,17 @@ bool ScanBeam::writebeam()
return
true
;
return
true
;
}
}
DL_Iter
<
Record
*>
_BI
(
this
);
DL_Iter
<
kb
Record
*>
_BI
(
this
);
// put new item left of the one that is bigger
// put new item left of the one that is bigger
_BI
.
tohead
();
_BI
.
tohead
();
while
(
!
_BI
.
hitroot
()
)
while
(
!
_BI
.
hitroot
()
)
{
{
Record
*
cur
=
_BI
.
item
();
kb
Record
*
cur
=
_BI
.
item
();
fprintf
(
file
,
" ysp %I64d
\n
"
,
cur
->
Ysp
()
);
fprintf
(
file
,
" ysp %I64d
\n
"
,
cur
->
Ysp
()
);
KBool
Link
*
curl
=
cur
->
GetLink
();
kb
Link
*
curl
=
cur
->
GetLink
();
fprintf
(
file
,
" linkbegin %I64d %I64d
\n
"
,
curl
->
GetBeginNode
()
->
GetX
(),
curl
->
GetBeginNode
()
->
GetY
()
);
fprintf
(
file
,
" linkbegin %I64d %I64d
\n
"
,
curl
->
GetBeginNode
()
->
GetX
(),
curl
->
GetBeginNode
()
->
GetY
()
);
fprintf
(
file
,
" linkend %I64d %I64d
\n
"
,
curl
->
GetEndNode
()
->
GetX
(),
curl
->
GetEndNode
()
->
GetY
()
);
fprintf
(
file
,
" linkend %I64d %I64d
\n
"
,
curl
->
GetEndNode
()
->
GetX
(),
curl
->
GetEndNode
()
->
GetY
()
);
...
...
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