Commit ef2e41e3 authored by charras's avatar charras

--no commit message

--no commit message
parent 90228980
...@@ -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
......
...@@ -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;
defualt: default:
break; break;
} }
} }
......
...@@ -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;
......
...@@ -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 );
......
No preview for this file type
This diff is collapsed.
...@@ -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
......
...@@ -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.
......
/* 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, "\nHEADER 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, "\nENDLIB;\n" );
fclose( kdebugFile );
}
}
const char* sCurrEntityName = NULL;
static int s_count;
void OpenEntity( const char* aName )
{
if( kdebugFile )
{
fprintf( kdebugFile, "\nBGNSTR; # 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, "\nENDSTR %s;\n", sCurrEntityName );
}
void StartPolygon(int aCornersCount, int aLayer)
{
fprintf( kdebugFile, "\nBOUNDARY; 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, "\nENDEL;\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
/* 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_
...@@ -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;
} }
......
...@@ -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)
{ {
......
...@@ -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,
......
...@@ -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
......
This diff is collapsed.
/*! \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 );
......
...@@ -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:33 titato Exp $ RCS-ID: $Id: _lnk_itr.cpp,v 1.4 2009/02/06 21:33:03 titato Exp $
*/ */
#ifdef __UNIX__ #ifdef __UNIX__
......
/*! \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"
......
/*! \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 KBoolLink; class kbLink;
#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 kbGraphList;
class Graph; class kbGraph;
class KBoolLink; class kbLink;
class Node; class kbNode;
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 kbNode 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; kbGraphList* 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; kbGraph* m_GraphToAdd;
//! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence //! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence
Node* m_lastNodeToAdd; kbNode* m_lastNodeToAdd;
//! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence //! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence
Node* m_firstNodeToAdd; kbNode* 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; kbGraph* m_getGraph;
//! used in extracting the points from the resultant polygons //! used in extracting the points from the resultant polygons
KBoolLink* m_getLink; kbLink* m_getLink;
//! used in extracting the points from the resultant polygons //! used in extracting the points from the resultant polygons
Node* m_getNode; kbNode* 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 kbNode to iterate links.
TDLI<KBoolLink>* _linkiter; TDLI<kbLink>* _linkiter;
//! how many time run intersections fase. //! how many time run intersections fase.
unsigned int m_intersectionruns; unsigned int m_intersectionruns;
......
...@@ -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 kbNode;
class GraphList; class kbGraphList;
//! one graph containing links that cab be connected. //! one graph containing links that cab be connected.
class A2DKBOOLDLLEXP Graph class A2DKBOOLDLLEXP kbGraph
{ {
protected: protected:
Bool_Engine* _GC; Bool_Engine* _GC;
public: public:
Graph( Bool_Engine* GC ); kbGraph( Bool_Engine* GC );
Graph( KBoolLink*, Bool_Engine* GC ); kbGraph( kbLink*, Bool_Engine* GC );
Graph( Graph* other ); kbGraph( kbGraph* other );
~Graph(); ~kbGraph();
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, kbNode *end );
//! adds a link to the linklist //! adds a link to the linklist
void AddLink( KBoolLink *a_link ); void AddLink( kbLink *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 graph //! Simplify the kbGraph
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( kbGraph* );
//! function for maximum performance //! function for maximum performance
//! Get the First link from the graph //! Get the First link from the kbGraph
KBoolLink* GetFirstLink(); kbLink* GetFirstLink();
Node* GetTopNode(); kbNode* GetTopNode();
void SetBeenHere( bool ); void SetBeenHere( bool );
void Reset_flags(); void Reset_flags();
//! Set the group of a graph //! Set the group of a kbGraph
void SetGroup( GroupType ); void SetGroup( GroupType );
//! Set the number of the graph //! Set the number of the kbGraph
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, kbGraphList* Result );
void Correction( GraphList* Result, double factor ); void Correction( kbGraphList* Result, double factor );
void MakeRing( GraphList* Result, double factor ); void MakeRing( kbGraphList* Result, double factor );
void CreateRing( GraphList *ring, double factor ); void CreateRing( kbGraphList *ring, double factor );
void CreateRing_fast( GraphList *ring, double factor ); void CreateRing_fast( kbGraphList *ring, double factor );
void CreateArc( Node* center, KBoolLine* incoming, Node* end, double radius, double aber ); void CreateArc( kbNode* center, kbLine* incoming, kbNode* 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, kbNode* end, double radius, bool clock, double aber );
void MakeOneDirection(); void MakeOneDirection();
void Make_Rounded_Shape( KBoolLink* a_link, double factor ); void Make_Rounded_Shape( kbLink* 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( kbGraphList* 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( kbNode *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( kbNode *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<KBoolLink>* _LI ); kbNode* GetMostTopLeft( TDLI<kbLink>* _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.
/* /*
......
...@@ -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 kbGraphList: public DL_List<void*>
{ {
protected: protected:
Bool_Engine* _GC; Bool_Engine* _GC;
public: public:
GraphList( Bool_Engine* GC ); kbGraphList( Bool_Engine* GC );
GraphList( GraphList* other ); kbGraphList( kbGraphList* other );
~GraphList(); ~kbGraphList();
void MakeOneGraph( Graph *total ); void MakeOneGraph( kbGraph *total );
void Prepare( Graph *total ); void Prepare( kbGraph *total );
void MakeRings(); void MakeRings();
void Correction(); void Correction();
......
...@@ -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 kbGraph;
class A2DKBOOLDLLEXP KBoolLine class A2DKBOOLDLLEXP kbLine
{ {
protected: protected:
Bool_Engine* m_GC; Bool_Engine* m_GC;
public: public:
// constructors and destructor // constructors and destructor
KBoolLine( Bool_Engine* GC ); kbLine( Bool_Engine* GC );
KBoolLine( KBoolLink*, Bool_Engine* GC ); kbLine( kbLink*, Bool_Engine* GC );
~KBoolLine(); ~kbLine();
void Set( KBoolLink * ); void Set( kbLink * );
KBoolLink* GetLink(); kbLink* GetLink();
//! Get the beginnode from a line //! Get the beginnode from a line
Node* GetBeginNode(); kbNode* GetBeginNode();
//! Get the endnode from a line //! Get the endnode from a line
Node* GetEndNode(); kbNode* GetEndNode();
//! Check if two lines intersects //! Check if two lines intersects
int CheckIntersect( KBoolLine*, double Marge ); int CheckIntersect( kbLine*, double Marge );
//! Intersects two lines //! Intersects two lines
int Intersect( KBoolLine*, double Marge ); int Intersect( kbLine*, double Marge );
int Intersect_simple( KBoolLine * lijn ); int Intersect_simple( kbLine * lijn );
bool Intersect2( Node* crossing, KBoolLine * lijn ); bool Intersect2( kbNode* crossing, kbLine * lijn );
//!For an infinite line //!For an infinite line
PointStatus PointOnLine( Node* a_node, double& Distance, double Marge ); PointStatus PointOnLine( kbNode* 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( kbNode* 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( kbLPoint *a_point, double distance );
//! assignment operator //! assignment operator
KBoolLine& operator=( const KBoolLine& ); kbLine& operator=( const kbLine& );
Node* OffsetContour( KBoolLine* const nextline, Node* last_ins, double factor, Graph *shape ); kbNode* OffsetContour( kbLine* const nextline, kbNode* last_ins, double factor, kbGraph *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, kbGraph *shape );
bool OkeForContour( KBoolLine* const nextline, double factor, Node* LastLeft, Node* LastRight, LinkStatus& _outproduct ); bool OkeForContour( kbLine* const nextline, double factor, kbNode* LastLeft, kbNode* 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, kbGraph *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, kbGraph *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, kbGraph *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 , KBoolLine * ); void AddLineCrossing( B_INT , B_INT , kbLine * );
void AddCrossing( Node *a_node ); void AddCrossing( kbNode *a_node );
Node* AddCrossing( B_INT X, B_INT Y ); kbNode* AddCrossing( B_INT X, B_INT Y );
bool ProcessCrossings( TDLI<KBoolLink>* _LI ); bool ProcessCrossings( TDLI<kbLink>* _LI );
// Linecrosslist // Linecrosslist
void SortLineCrossings(); void SortLineCrossings();
bool CrossListEmpty(); bool CrossListEmpty();
DL_List<void*>* GetCrossList(); DL_List<void*>* GetCrossList();
// bool HasInCrossList(Node*); // bool HasInCrossList(kbNode*);
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;
KBoolLink* m_link; kbLink* m_link;
bool m_valid_parameters; bool m_valid_parameters;
//! List with crossings through this link //! List with crossings through this link
......
...@@ -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 kbLPoint;
class Node; class kbNode;
class Record; class kbRecord;
//! segment within a graph //! segment within a graph
/* /*
A Graph contains a list of KBoolLink, the KBoolLink or connected by Node's. A Graph contains a list of kbLink, the kbLink or connected by Node's.
Several KBoolLink can be connected to one Node. Several kbLink can be connected to one Node.
A KBoolLink has a direction defined by its begin and end node. A kbLink has a direction defined by its begin and end node.
Node do have a list of connected KBoolLink's. Node do have a list of connected kbLink's.
So one can walk trough a graph in two ways: So one can walk trough a graph in two ways:
1- via its KBoolLink list 1- via its kbLink list
2- via the node connected to the KBoolLink's 2- via the node connected to the kbLink's
*/ */
class A2DKBOOLDLLEXP KBoolLink class A2DKBOOLDLLEXP kbLink
{ {
protected: protected:
Bool_Engine* _GC; Bool_Engine* _GC;
public: public:
//! contructors //! contructors
KBoolLink( Bool_Engine* GC ); kbLink( Bool_Engine* GC );
//! contructors //! contructors
KBoolLink( int graphnr, Node* begin, Node* end, Bool_Engine* GC ); kbLink( int graphnr, kbNode* begin, kbNode* end, Bool_Engine* GC );
//! contructors //! contructors
KBoolLink( Node *begin, Node *end, Bool_Engine* GC ); kbLink( kbNode *begin, kbNode *end, Bool_Engine* GC );
//! destructors //! destructors
~KBoolLink(); ~kbLink();
//! Merges the other node with argument //! Merges the other node with argument
void MergeNodes( Node* const ); void MergeNodes( kbNode* const );
//! outproduct of two links //! outproduct of two links
LinkStatus OutProduct( KBoolLink* const two, double accur ); LinkStatus OutProduct( kbLink* const two, double accur );
//! link three compared to this and two //! link three compared to this and two
LinkStatus PointOnCorner( KBoolLink* const, KBoolLink* const ); LinkStatus PointOnCorner( kbLink* const, kbLink* const );
//! Removes argument from the link //! Removes argument from the link
void Remove( Node* ); void Remove( kbNode* );
//! replaces olddone in the link by newnode //! replaces olddone in the link by newnode
void Replace( Node* oldnode, Node* newnode ); void Replace( kbNode* oldnode, kbNode* 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(); kbNode* GetBeginNode();
//! Datamember access functions //! Datamember access functions
Node* GetEndNode(); kbNode* GetEndNode();
Node* GetLowNode(); kbNode* GetLowNode();
Node* GetHighNode(); kbNode* GetHighNode();
//! Returns a next link beginning with argument //! Returns a next link beginning with argument
KBoolLink* Forth( Node* ); kbLink* Forth( kbNode* );
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( kbLPoint*, 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 kbNode* 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, kbNode* end, int graphnr = 0 );
void Set( Node* begin, Node* end ); void Set( kbNode* begin, kbNode* end );
void SetBeginNode( Node* ); void SetBeginNode( kbNode* );
void SetEndNode( Node* ); void SetEndNode( kbNode* );
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( kbNode* a_node );
void TakeOverOperationFlags( KBoolLink* link ); void TakeOverOperationFlags( kbLink* link );
void SetRecordNode( DL_Node<Record*>* recordNode ) { m_record = recordNode; } void SetRecordNode( DL_Node<kbRecord*>* recordNode ) { m_record = recordNode; }
DL_Node<Record*>* GetRecordNode() { return m_record; } DL_Node<kbRecord*>* GetRecordNode() { return m_record; }
protected: protected:
//! The mainitems of a link //! The mainitems of a link
Node *m_beginnode, *m_endnode; kbNode *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<kbRecord*>* m_record;
}; };
#endif #endif
......
...@@ -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 kbLPoint
{ {
public: public:
LPoint(); kbLPoint();
LPoint( B_INT const , B_INT const ); kbLPoint( B_INT const , B_INT const );
LPoint( LPoint* const ); kbLPoint( kbLPoint* const );
void Set( const B_INT, const B_INT ); void Set( const B_INT, const B_INT );
void Set( const LPoint & ); void Set( const kbLPoint & );
LPoint GetPoint(); kbLPoint 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 kbLPoint 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 kbLPoint 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 kbLPoint & );
LPoint &operator+( const LPoint & ); kbLPoint &operator+( const kbLPoint & );
LPoint &operator-( const LPoint & ); kbLPoint &operator-( const kbLPoint & );
LPoint &operator*( int ); kbLPoint &operator*( int );
LPoint &operator/( int ); kbLPoint &operator/( int );
int operator==( const LPoint & ) const; int operator==( const kbLPoint & ) const;
int operator!=( const LPoint & ) const; int operator!=( const kbLPoint & ) const;
protected: protected:
B_INT _x; B_INT _x;
......
...@@ -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 kbLPoint
{ {
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 ); kbNode( Bool_Engine* GC );
Node( const B_INT, const B_INT, Bool_Engine* GC ); kbNode( const B_INT, const B_INT, Bool_Engine* GC );
Node( LPoint* const a_point, Bool_Engine* GC ); kbNode( kbLPoint* const a_point, Bool_Engine* GC );
Node( Node * const, Bool_Engine* GC ); kbNode( kbNode * const, Bool_Engine* GC );
Node& operator=( const Node &other_node ); kbNode& operator=( const kbNode &other_node );
~Node(); ~kbNode();
//public member functions //public member functions
void AddLink( KBoolLink* ); void AddLink( kbLink* );
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 , KBoolLink* const link, BOOL_OP operation ); bool SameSides( kbLink* const prev , kbLink* 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( KBoolLink* const prev , LinkStatus whatside, BOOL_OP operation ); kbLink* GetMost( kbLink* 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( KBoolLink* const prev , LinkStatus whatside, BOOL_OP operation ); kbLink* GetMostHole( kbLink* const prev , LinkStatus whatside, BOOL_OP operation );
//! get link that is not vertical. //! get link that is not vertical.
KBoolLink* GetNotFlat(); kbLink* GetNotFlat();
//! get a link to a hole or from a hole. //! get a link to a hole or from a hole.
KBoolLink* GetHoleLink( KBoolLink* const prev, bool checkbin, BOOL_OP operation ); kbLink* GetHoleLink( kbLink* const prev, bool checkbin, BOOL_OP operation );
int Merge( Node* ); int Merge( kbNode* );
void RemoveLink( KBoolLink* ); void RemoveLink( kbLink* );
bool Simplify( Node* First, Node* Second, B_INT Marge ); bool Simplify( kbNode* First, kbNode* Second, B_INT Marge );
// memberfunctions for maximum performance // memberfunctions for maximum performance
void RoundInt( B_INT grid ); void RoundInt( B_INT grid );
KBoolLink* GetIncomingLink(); kbLink* GetIncomingLink();
int GetNumberOfLinks(); int GetNumberOfLinks();
KBoolLink* GetNextLink(); kbLink* GetNextLink();
KBoolLink* GetOtherLink( KBoolLink* ); kbLink* GetOtherLink( kbLink* );
KBoolLink* GetOutgoingLink(); kbLink* GetOutgoingLink();
KBoolLink* GetPrevLink(); kbLink* GetPrevLink();
KBoolLink* Follow( KBoolLink* const prev ); kbLink* Follow( kbLink* const prev );
KBoolLink* GetBinHighest( bool binset ); kbLink* GetBinHighest( bool binset );
protected: protected:
DL_List<void*>* _linklist; DL_List<void*>* _linklist;
......
...@@ -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 kbNode;
#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 kbRecord
{ {
protected: protected:
Bool_Engine* _GC; Bool_Engine* _GC;
public: public:
// void deletepool(); // void deletepool();
Record( KBoolLink* link, Bool_Engine* GC ); kbRecord( kbLink* link, Bool_Engine* GC );
~Record(); ~kbRecord();
// void* operator new(size_t size); // void* operator new(size_t size);
// void operator delete(void* recordptr); // void operator delete(void* recordptr);
void SetNewLink( KBoolLink* link ); void SetNewLink( kbLink* link );
void Set_Flags(); void Set_Flags();
void Calc_Ysp( Node* low ); void Calc_Ysp( kbNode* low );
KBoolLink* GetLink(); kbLink* GetLink();
KBoolLine* GetLine(); kbLine* 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( kbRecord* record_above_me );
bool Equal( Record* ); bool Equal( kbRecord* );
private: private:
KBoolLine _line; kbLine _line;
B_INT _ysp; B_INT _ysp;
......
...@@ -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<kbRecord*>;
#endif #endif
class A2DKBOOLDLLEXP ScanBeam : public DL_List<Record*> class A2DKBOOLDLLEXP ScanBeam : public DL_List<kbRecord*>
{ {
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, kbNode* high );
bool FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes ); bool FindNew( SCANTYPE scantype, TDLI<kbLink>* _I, bool& holes );
bool RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes ); bool RemoveOld( SCANTYPE scantype, TDLI<kbLink>* _I, bool& holes );
private: private:
bool ProcessHoles( bool atinsert, TDLI<KBoolLink>* _LI ); bool ProcessHoles( bool atinsert, TDLI<kbLink>* _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( KBoolLine* flatline ); int Process_LinkToLink_Flat( kbLine* 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,kbNode* _lowf);
void Generate_INOUT( int graphnumber ); void Generate_INOUT( int graphnumber );
Node* _low; kbNode* _low;
DL_Iter<Record*> _BI; DL_Iter<kbRecord*> _BI;
int lastinserted; int lastinserted;
BEAM_TYPE _type; BEAM_TYPE _type;
}; };
......
...@@ -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
......
...@@ -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 $
*/ */
This diff is collapsed.
/*! \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 2005/05/24 19:13:38 titato Exp $ RCS-ID: $Id: boolonly.h,v 1.5 2009/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;
}; };
mondrian ICON "sample.ico"
#include "wx/msw/wx.rc"
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -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__
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment