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 );
...@@ -263,6 +262,12 @@ public: ...@@ -263,6 +262,12 @@ public:
*/ */
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
* Recreates a .cmp file from the current loaded board * Recreates a .cmp file from the current loaded board
......
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 )
...@@ -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 = 0.001; // snap with in this range points to lines in the intersection routines double MARGE = 1.0; // snap with in this range points to lines in the intersection routines
// should always be > DGRID a MARGE >= 10*DGRID is ok // should always be > 1/DGRID a MARGE >= 10/DGRID is ok
// 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. ( initial value = 0.001 ) // two segments are in line. ( initial value = 0.001 )
// For kicad we choose MARGE = 1, with DGRID = 10
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
......
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,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: _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 );
...@@ -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 );
} }
......
/*! \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"
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
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.
...@@ -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 );
...@@ -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; }
...@@ -492,7 +497,7 @@ public: ...@@ -492,7 +497,7 @@ 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:
...@@ -97,7 +97,7 @@ private: ...@@ -97,7 +97,7 @@ private:
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.
...@@ -3,28 +3,24 @@ ...@@ -3,28 +3,24 @@
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"
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
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<KBoolLink>(); _linkiter = new TDLI<kbLink>();
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 kbGraphList( 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 kbGraphList( 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 kbGraphList( 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 kbGraphList( 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 kbGraph( 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 kbNode( 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 = ( kbNode * ) myNode;
m_lastNodeToAdd = ( Node * ) myNode; m_lastNodeToAdd = ( kbNode * ) 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 = ( kbNode * ) 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 = ( kbGraph* ) 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 );
} }
This diff is collapsed.
...@@ -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 *, kbGraph * );
int graphsorterY( Graph *, Graph * ); int graphsorterY( kbGraph *, kbGraph * );
GraphList::GraphList( Bool_Engine* GC ) kbGraphList::kbGraphList( Bool_Engine* GC )
{ {
_GC = GC; _GC = GC;
} }
GraphList::GraphList( GraphList* other ) kbGraphList::kbGraphList( kbGraphList* other )
{ {
_GC = other->_GC; _GC = other->_GC;
TDLI<Graph> _LI = TDLI<Graph>( other ); TDLI<kbGraph> _LI = TDLI<kbGraph>( other );
_LI.tohead(); _LI.tohead();
while ( !_LI.hitroot() ) while ( !_LI.hitroot() )
{ {
insend( new Graph( _LI.item() ) ); insend( new kbGraph( _LI.item() ) );
_LI++; _LI++;
} }
} }
GraphList::~GraphList() kbGraphList::~kbGraphList()
{ {
TDLI<Graph> _LI = TDLI<Graph>( this ); TDLI<kbGraph> _LI = TDLI<kbGraph>( 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( kbGraph* 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<kbGraph>( 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( kbGraph* total )
{ {
TDLI<Graph> _LI = TDLI<Graph>( this ); TDLI<kbGraph> _LI = TDLI<kbGraph>( 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 kbGraphList::Renumber()
{ {
if ( _GC->GetOrientationEntryMode() ) if ( _GC->GetOrientationEntryMode() )
{ {
TDLI<Graph> _LI = TDLI<Graph>( this ); TDLI<kbGraph> _LI = TDLI<kbGraph>( 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<kbGraph>( 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 kbGraphList::Simplify( double marge )
{ {
TDLI<Graph> _LI = TDLI<Graph>( this ); TDLI<kbGraph> _LI = TDLI<kbGraph>( this );
_LI.foreach_mf( &Graph::Reset_Mark_and_Bin ); _LI.foreach_mf( &kbGraph::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 kbGraphList::Smoothen( double marge )
{ {
TDLI<Graph> _LI = TDLI<Graph>( this ); TDLI<kbGraph> _LI = TDLI<kbGraph>( this );
_LI.foreach_mf( &Graph::Reset_Mark_and_Bin ); _LI.foreach_mf( &kbGraph::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 kbGraphList::UnMarkAll()
{ {
TDLI<Graph> _LI = TDLI<Graph>( this ); TDLI<kbGraph> _LI = TDLI<kbGraph>( this );
_LI.foreach_mf( &Graph::Reset_Mark_and_Bin ); _LI.foreach_mf( &kbGraph::Reset_Mark_and_Bin );
} }
//============================================================================== //==============================================================================
...@@ -182,9 +182,9 @@ void GraphList::UnMarkAll() ...@@ -182,9 +182,9 @@ void GraphList::UnMarkAll()
// //
//============================================================================== //==============================================================================
void GraphList::Correction() void kbGraphList::Correction()
{ {
TDLI<Graph> _LI = TDLI<Graph>( this ); TDLI<kbGraph> _LI = TDLI<kbGraph>( 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 kbGraphList( _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( ( kbGraph* )_correct->headitem() );
_correct->removehead(); _correct->removehead();
} }
} }
...@@ -214,16 +214,16 @@ void GraphList::Correction() ...@@ -214,16 +214,16 @@ void GraphList::Correction()
} }
} }
void GraphList::MakeRings() void kbGraphList::MakeRings()
{ {
TDLI<Graph> _LI = TDLI<Graph>( this ); TDLI<kbGraph> _LI = TDLI<kbGraph>( 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 kbGraphList( _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(); ( ( kbGraph* )_ring->headitem() )->MakeClockWise();
_LI.insend( ( Graph* )_ring->headitem() ); _LI.insend( ( kbGraph* )_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 kbGraphList::Merge()
{ {
if ( count() <= 1 ) if ( count() <= 1 )
return; return;
{ {
TDLI<Graph> _LI = TDLI<Graph>( this ); TDLI<kbGraph> _LI = TDLI<kbGraph>( 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 kbGraph( _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 kbGraphList::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 kbGraph( _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 kbGraphList::WriteGraphs()
{ {
TDLI<Graph> _LI = TDLI<Graph>( this ); TDLI<kbGraph> _LI = TDLI<kbGraph>( 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 kbGraphList::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<kbGraph>(this);
_LI.tohead(); _LI.tohead();
while(!_LI.hitroot()) while(!_LI.hitroot())
{ {
......
...@@ -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.
/*! \file src/lpoint.cpp /*! \file src/lpoint.cpp
\brief Definition of GDSII LPoint type structure \brief Definition of GDSII kbLPoint 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::kbLPoint()
{ {
_x = 0; _x = 0;
_y = 0; _y = 0;
} }
LPoint::LPoint( B_INT const X, B_INT const Y ) kbLPoint::kbLPoint( B_INT const X, B_INT const Y )
{ {
_x = X; _x = X;
_y = Y; _y = Y;
} }
LPoint::LPoint( LPoint* const a_point ) kbLPoint::kbLPoint( kbLPoint* const a_point )
{ {
if ( !a_point ) if ( !a_point )
throw Bool_Engine_Error( "Cannot copy a NULL Point Object.\n\nCould not create a LPoint Object.", throw Bool_Engine_Error( "Cannot copy a NULL Point Object.\n\nCould not create a kbLPoint 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 kbLPoint::GetX()
{ {
return _x; return _x;
} }
B_INT LPoint::GetY() B_INT kbLPoint::GetY()
{ {
return _y; return _y;
} }
void LPoint::SetX( B_INT a_point_x ) void kbLPoint::SetX( B_INT a_point_x )
{ {
_x = a_point_x; _x = a_point_x;
} }
void LPoint::SetY( B_INT a_point_y ) void kbLPoint::SetY( B_INT a_point_y )
{ {
_y = a_point_y; _y = a_point_y;
} }
LPoint LPoint::GetPoint() kbLPoint kbLPoint::GetPoint()
{ {
return * this; return * this;
} }
void LPoint::Set( const B_INT X, const B_INT Y ) void kbLPoint::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 kbLPoint &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 kbLPoint 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 kbLPoint::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 kbLPoint 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 kbLPoint::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 kbLPoint &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 kbLPoint &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 kbLPoint &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 &kbLPoint::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 &kbLPoint::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 kbLPoint &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 kbLPoint &other_point ) const
{ {
return ( ( other_point._x != _x ) || ( other_point._y != _y ) ); return ( ( other_point._x != _x ) || ( other_point._y != _y ) );
} }
......
This diff is collapsed.
...@@ -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::~kbRecord()
{} {}
//void* Record::operator new(size_t size) //void* kbRecord::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 kbRecord::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 kbRecord::deletepool()
//{ //{
// //
// while (r_index!=-1) // while (r_index!=-1)
...@@ -64,7 +64,7 @@ Record::~Record() ...@@ -64,7 +64,7 @@ Record::~Record()
// } // }
//} //}
Record::Record( KBoolLink* link, Bool_Engine* GC ) kbRecord::kbRecord( kbLink* 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( KBoolLink* link ) void kbRecord::SetNewLink( kbLink* 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( kbNode* 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 kbRecord::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* kbRecord::GetLink()
{ {
return LNK; return LNK;
} }
B_INT Record::Ysp() B_INT kbRecord::Ysp()
{ {
return _ysp; return _ysp;
} }
void Record::SetYsp( B_INT ysp ) void kbRecord::SetYsp( B_INT ysp )
{ {
_ysp = ysp; _ysp = ysp;
} }
DIRECTION Record::Direction() DIRECTION kbRecord::Direction()
{ {
return DIRECTION( _dir ); return DIRECTION( _dir );
} }
bool Record::Calc_Left_Right( Record* record_above_me ) bool kbRecord::Calc_Left_Right( kbRecord* 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( kbRecord *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* kbRecord::GetLine()
{ {
return & _line; return & _line;
} }
......
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