This commit is contained in:
parent
9022898040
commit
ef2e41e347
|
@ -4,6 +4,14 @@ KiCad ChangeLog 2009
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
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>
|
||||
================================================================================
|
||||
++pcbnew
|
||||
|
|
|
@ -185,7 +185,7 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
|
|||
case COMPONENT_FIELD_DRAW_TYPE:
|
||||
break;
|
||||
|
||||
defualt:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
|
|||
wxFileName fn;
|
||||
LibraryStruct* LibTmp;
|
||||
LibCmpEntry* LibEntry;
|
||||
bool entryLoaded;
|
||||
bool entryLoaded = false;
|
||||
|
||||
LibItemToRepeat = NULL;
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ private:
|
|||
|
||||
DRC* m_drc; ///< the DRC controller, see drc.cpp
|
||||
|
||||
|
||||
// we'll use lower case function names for private member functions.
|
||||
void createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu* aPopMenu );
|
||||
void createPopUpMenuForFootprints( MODULE* aModule, wxMenu* aPopMenu );
|
||||
|
@ -262,6 +261,12 @@ public:
|
|||
* @param aQuery = true to prompt user for confirmation, false to initialize silently
|
||||
*/
|
||||
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
|
||||
|
@ -426,8 +431,8 @@ public:
|
|||
* @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 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,
|
||||
PICKED_ITEMS_LIST* aItemsListPicker );
|
||||
|
||||
|
|
Binary file not shown.
1657
internat/fr/kicad.po
1657
internat/fr/kicad.po
File diff suppressed because it is too large
Load Diff
|
@ -16,13 +16,6 @@ set(PCBNEW_SRCS
|
|||
board.cpp
|
||||
board_undo_redo.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
|
||||
# cleaningoptions_dialog.cpp
|
||||
connect.cpp
|
||||
|
@ -30,6 +23,7 @@ set(PCBNEW_SRCS
|
|||
# copy_track.cpp <-- not used
|
||||
cotation.cpp
|
||||
cross-probing.cpp
|
||||
debug_kbool_key_file_fct.cpp
|
||||
deltrack.cpp
|
||||
dialog_copper_zones.cpp
|
||||
dialog_copper_zones_base.cpp
|
||||
|
@ -140,7 +134,6 @@ set(PCBNEW_SRCS
|
|||
tool_modedit.cpp
|
||||
tool_onrightclick.cpp
|
||||
tool_pcb.cpp
|
||||
# tracemod.cpp
|
||||
tracepcb.cpp
|
||||
track.cpp
|
||||
tr_modif.cpp
|
||||
|
|
|
@ -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)
|
||||
* In very simple cases m_FilledPolysList is same as m_Poly
|
||||
* In less simple cases (when m_Poly has holes) m_FilledPolysList is a polygon equivalent to m_Poly, without holes
|
||||
* but with extra outline segment connecting "holes" with external main outline
|
||||
* In complex cases an 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.
|
||||
|
|
|
@ -0,0 +1,150 @@
|
|||
/* 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
|
|
@ -0,0 +1,44 @@
|
|||
/* 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
|
|||
shape_pos = aRefPad->ReturnShapePos();
|
||||
|
||||
// rel_pos is pad position relative to the aRefPad position
|
||||
rel_pos.x -= shape_pos.x;
|
||||
rel_pos.y -= shape_pos.y;
|
||||
rel_pos -= shape_pos;
|
||||
|
||||
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
|
|||
if( swap_pads )
|
||||
{
|
||||
EXCHG( aRefPad, aPad );
|
||||
rel_pos.x = -rel_pos.x;
|
||||
rel_pos.y = -rel_pos.y;
|
||||
rel_pos = -rel_pos;
|
||||
}
|
||||
|
||||
switch( aRefPad->m_PadShape )
|
||||
|
@ -1128,7 +1126,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
|
|||
wxSize size = aPad->m_Size;
|
||||
// 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)
|
||||
|| (aRefPad->m_Orient == 2700)) &&
|
||||
|| (aRefPad->m_Orient == 2700)) &&
|
||||
((aPad->m_Orient == 0) || (aPad->m_Orient == 900) || (aPad->m_Orient == 1800)
|
||||
|| (aPad->m_Orient == 2700)) )
|
||||
{
|
||||
|
@ -1230,7 +1228,6 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, const int dist_mi
|
|||
|
||||
m_finx = -sx;
|
||||
m_finy = -sy; // end of segment coordinate
|
||||
|
||||
diag = checkClearanceSegmToPad( aPad, segm_width / 2, dist_min );
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -500,7 +500,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
|
|||
{
|
||||
int diag;
|
||||
// Init zone params to reasonnable values
|
||||
zone->SetLayer( ( (PCB_SCREEN*) GetScreen() )->m_Active_Layer );
|
||||
zone->SetLayer( GetScreen()->m_Active_Layer );
|
||||
|
||||
// Prompt user for parameters:
|
||||
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||
|
@ -518,6 +518,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
|
|||
wxGetApp().m_EDA_Config->Read( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,
|
||||
&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 );
|
||||
diag = frame->ShowModal();
|
||||
frame->Destroy();
|
||||
|
@ -534,7 +535,7 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
|
|||
return 0;
|
||||
|
||||
// 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)
|
||||
{
|
||||
|
|
|
@ -25,19 +25,38 @@
|
|||
#include "fctsys.h"
|
||||
#include "common.h"
|
||||
#include "pcbnew.h"
|
||||
#include "wxPcbStruct.h"
|
||||
#include "trigo.h"
|
||||
|
||||
#include "zones.h"
|
||||
|
||||
#include "PolyLine.h"
|
||||
// Kbool 1.9 and before had sometimes problemes when calculating thermal shapes as polygons (this is the best solution)
|
||||
// So as a workaround we can use stubs (small tracks segments) to create thermal shape
|
||||
// Define USE_STUBS_FOR_THERMAL to work on this workaround
|
||||
// Currently under development: DO NOT USE
|
||||
// because the code is not finished, and pcbnew does not work properly when used
|
||||
// Kbool 2.0 has solved some problems, but not all
|
||||
//#define USE_STUBS_FOR_THERMAL
|
||||
|
||||
using namespace std;
|
||||
// Used to create data files to debug Kbool
|
||||
#include "debug_kbool_key_file_fct.h"
|
||||
|
||||
// Also we can create test files for Kbool bebug purposes
|
||||
// when CREATE_KBOOL_KEY_FILES is defined
|
||||
// See debug_kbool_key_file_fct.h
|
||||
|
||||
|
||||
extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb, ZONE_CONTAINER* aZone_container );
|
||||
|
||||
|
||||
// Local Functions:
|
||||
#ifdef USE_STUBS_FOR_THERMAL
|
||||
#warning USE_STUBS_FOR_THERMAL defined for test version: do not use for working pcbnew version
|
||||
void CreateStubsForThermalShapes(BOARD* aPcb, ZONE_CONTAINER* aZone_container,
|
||||
int aThermalGap,
|
||||
int aCopperThickness, int aMinThicknessValue);
|
||||
#endif
|
||||
void AddTrackWithClearancePolygon( Bool_Engine* aBooleng,
|
||||
TRACK& aTrack, int aClearanceValue );
|
||||
void AddPadWithClearancePolygon( Bool_Engine* aBooleng, D_PAD& aPad, int aClearanceValue );
|
||||
|
@ -202,15 +221,20 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
|||
continue;
|
||||
}
|
||||
|
||||
int gap = clearance;
|
||||
#ifdef USE_STUBS_FOR_THERMAL
|
||||
gap = MAX( clearance, m_ThermalReliefGapValue );
|
||||
#else
|
||||
if( (m_PadOption == PAD_NOT_IN_ZONE)
|
||||
|| (GetNet() == 0) || pad->m_PadShape == PAD_TRAPEZOID )
|
||||
// PAD_TRAPEZOID shapes are *never* in zones becuase they are used in microwave apps
|
||||
// and the shae *must not* be changed by thermal pads or others
|
||||
// PAD_TRAPEZOID shapes are not in zones because they are used in microwave apps
|
||||
// and i think it is good shapes are not changed by thermal pads or others
|
||||
#endif
|
||||
{
|
||||
item_boundingbox = pad->GetBoundingBox();
|
||||
if( item_boundingbox.Intersects( zone_boundingbox ) )
|
||||
{
|
||||
AddPadWithClearancePolygon( booleng, *pad, clearance );
|
||||
AddPadWithClearancePolygon( booleng, *pad, gap );
|
||||
have_poly_to_substract = true;
|
||||
}
|
||||
}
|
||||
|
@ -297,6 +321,18 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
|||
}
|
||||
delete booleng;
|
||||
|
||||
#ifdef USE_STUBS_FOR_THERMAL
|
||||
// remove thermal gaps if required:
|
||||
if( m_PadOption != THERMAL_PAD || aPcb->m_Modules == NULL )
|
||||
{
|
||||
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
|
||||
return;
|
||||
}
|
||||
|
||||
CreateStubsForThermalShapes(aPcb, this, m_ThermalReliefGapValue,
|
||||
m_ThermalReliefCopperBridgeValue, m_ZoneMinThickness);
|
||||
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
|
||||
#else
|
||||
// Remove insulated islands:
|
||||
if( GetNet() > 0 )
|
||||
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
|
||||
|
@ -314,6 +350,12 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
|||
ArmBoolEng( booleng, true );
|
||||
have_poly_to_substract = false;
|
||||
|
||||
#ifdef CREATE_KBOOL_KEY_FILES
|
||||
CreateKeyFile();
|
||||
OpenEntity("Layer");
|
||||
CopyPolygonsFromFilledPolysListToKeyFile(this, 0);
|
||||
#endif
|
||||
|
||||
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() )
|
||||
|
@ -335,6 +377,9 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
|||
}
|
||||
}
|
||||
}
|
||||
#ifdef CREATE_KBOOL_KEY_FILES
|
||||
CloseEntity();
|
||||
#endif
|
||||
|
||||
if( have_poly_to_substract )
|
||||
{
|
||||
|
@ -353,6 +398,9 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
|||
// Remove insulated islands:
|
||||
if( GetNet() > 0 )
|
||||
Test_For_Copper_Island_And_Remove_Insulated_Islands( aPcb );
|
||||
#ifdef CREATE_KBOOL_KEY_FILES
|
||||
CloseKeyFile();
|
||||
#endif
|
||||
}
|
||||
|
||||
// Now we remove all unused thermal stubs.
|
||||
|
@ -402,7 +450,11 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
|||
{
|
||||
dx = (int) ( dx * s_Correction );
|
||||
dy = dx;
|
||||
#ifdef CREATE_KBOOL_KEY_FILES
|
||||
fAngle = 0;
|
||||
#else
|
||||
fAngle = 450;
|
||||
#endif
|
||||
}
|
||||
|
||||
// compute north, south, west and east points for zone connection.
|
||||
|
@ -500,7 +552,8 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList( BOARD* aPcb )
|
|||
|
||||
delete booleng;
|
||||
|
||||
#endif
|
||||
#endif // REMOVE_UNUSED_THERMAL_STUBS
|
||||
#endif // USE_STUBS_FOR_THERMAL
|
||||
}
|
||||
|
||||
|
||||
|
@ -671,6 +724,96 @@ void AddPadWithClearancePolygon( Bool_Engine* aBooleng,
|
|||
}
|
||||
|
||||
|
||||
/** function CreateStubsForThermalShapes()
|
||||
* Only for testing the thermal shapes by stubs purposes
|
||||
* Do not use for working pcbnew versions
|
||||
*/
|
||||
void CreateStubsForThermalShapes(BOARD* aPcb, ZONE_CONTAINER* aZone_container,
|
||||
int aThermalGap,
|
||||
int aCopperThickness, int aMinThicknessValue)
|
||||
{
|
||||
EDA_Rect zone_boundingbox = aZone_container->GetBoundingBox();
|
||||
|
||||
for( MODULE* module = aPcb->m_Modules; module; module = module->Next() )
|
||||
{
|
||||
for( D_PAD* pad = module->m_Pads; pad != NULL; pad = pad->Next() )
|
||||
{
|
||||
// check
|
||||
if( !pad->IsOnLayer( aZone_container->GetLayer() ) )
|
||||
continue;
|
||||
if( pad->GetNet() != aZone_container->GetNet() )
|
||||
continue;
|
||||
|
||||
EDA_Rect item_boundingbox = pad->GetBoundingBox();
|
||||
item_boundingbox.Inflate( aThermalGap, aThermalGap );
|
||||
if( !( item_boundingbox.Intersects( zone_boundingbox ) ) )
|
||||
continue;
|
||||
|
||||
// test point
|
||||
int dx = ( pad->m_Size.x / 2 ) + aThermalGap;
|
||||
int dy = ( pad->m_Size.y / 2 ) + aThermalGap;
|
||||
|
||||
// This is CIRCLE pad tweak (for circle pads the thermal stubs are at 45 deg)
|
||||
int fAngle = pad->m_Orient;
|
||||
if( pad->m_PadShape == PAD_CIRCLE )
|
||||
{
|
||||
dx = (int) ( dx * s_Correction );
|
||||
dy = dx;
|
||||
fAngle = 450;
|
||||
}
|
||||
|
||||
// compute north, south, west and east points for zone connection.
|
||||
// Add a small value to ensure point is inside (or outside) zone, not on an edge
|
||||
wxPoint ptTest[4];
|
||||
ptTest[0] = wxPoint( 0, 3 + dy + aMinThicknessValue / 2 );
|
||||
ptTest[1] = wxPoint( 0, -(3 + dy + aMinThicknessValue / 2) );
|
||||
ptTest[2] = wxPoint( 3 + dx + aMinThicknessValue / 2, 0 );
|
||||
ptTest[3] = wxPoint( -(3 + dx + aMinThicknessValue / 2), 0 );
|
||||
|
||||
|
||||
// Test all sides
|
||||
for( int i = 0; i<4; i++ )
|
||||
{
|
||||
// rotate point
|
||||
RotatePoint( &ptTest[i], fAngle );
|
||||
|
||||
// translate point
|
||||
ptTest[i] += pad->ReturnShapePos();
|
||||
bool inside = aZone_container->HitTestFilledArea( ptTest[i] );
|
||||
|
||||
if( inside )
|
||||
{
|
||||
|
||||
TRACK*track = new TRACK(aPcb);
|
||||
track->m_Start = pad->ReturnShapePos();
|
||||
track->m_End = ptTest[i];
|
||||
track->SetNet(aZone_container->GetNet());
|
||||
track->SetLayer(aZone_container->GetLayer() );
|
||||
track->m_Width = aCopperThickness;
|
||||
track->m_TimeStamp = aZone_container->m_TimeStamp;
|
||||
track->SetState( BEGIN_ONPAD, ON );
|
||||
track->start = pad;
|
||||
|
||||
// add stub
|
||||
WinEDA_PcbFrame* pcbFrame = (WinEDA_PcbFrame*) aPcb->m_PcbFrame;
|
||||
if( pcbFrame->GetDrcController()->Drc( track, aPcb->m_Track ) == BAD_DRC )
|
||||
delete track;
|
||||
else
|
||||
{
|
||||
// If this approach is developped, one must change the way the stubs are handles in pcbnew
|
||||
// because insert these stubs as tracks does not work with undo/redo functions
|
||||
// because these stubs must be deleted when refilling zones outside undo/redo calls
|
||||
// This code is only for trial only, not for working pcbnew versions.
|
||||
TRACK* insertBeforeMe = track->GetBestInsertPoint( aPcb );
|
||||
aPcb->m_Track.Insert( track, insertBeforeMe );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** function AddThermalReliefPadPolygon
|
||||
* Add holes around a pad to create a thermal relief
|
||||
* copper thickness is min (dx/2, aCopperWitdh) or min (dy/2, aCopperWitdh)
|
||||
|
@ -773,7 +916,9 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
|
|||
corner.x = copper_thickness.x / 2;
|
||||
int y = outer_radius - (aThermalGap / 4);
|
||||
corner.y = (int) sqrt( ( ( (double) y * y ) - (double) corner.x * corner.x ) );
|
||||
#ifndef CREATE_KBOOL_KEY_FILES
|
||||
corners_buffer.push_back( corner );
|
||||
#endif
|
||||
|
||||
// calculate the starting point of the outter arc
|
||||
corner.x = copper_thickness.x / 2;
|
||||
|
@ -804,26 +949,45 @@ void AddThermalReliefPadPolygon( Bool_Engine* aBooleng,
|
|||
// Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg
|
||||
// WARNING: problems with kbool if angle = 0 (in fact when angle < 200):
|
||||
// bad filled polygon on some cases, when pads are on a same vertical line
|
||||
// this seems a bug in kbool polygon (exists in 1.9 kbool version)
|
||||
// this seems a bug in kbool polygon (exists in 2.0 kbool version)
|
||||
// angle = 450 (45.0 degrees orientation) seems work fine.
|
||||
// angle = 0 with thermal shapes without angle < 90 deg has problems in rare circumstances
|
||||
// Note: with the 2 step build ( thermal shapes added after areas are built), 0 seems work
|
||||
#ifdef CREATE_KBOOL_KEY_FILES
|
||||
angle = 0;
|
||||
#else
|
||||
angle = 450;
|
||||
#endif
|
||||
int angle_pad = aPad.m_Orient; // Pad orientation
|
||||
for( unsigned ihole = 0; ihole < 4; ihole++ )
|
||||
{
|
||||
if( aBooleng->StartPolygonAdd( GROUP_B ) )
|
||||
{
|
||||
#ifdef CREATE_KBOOL_KEY_FILES
|
||||
StartPolygon(corners_buffer.size() +1, 1);
|
||||
#endif
|
||||
for( unsigned ii = 0; ii < corners_buffer.size(); ii++ )
|
||||
{
|
||||
corner = corners_buffer[ii];
|
||||
RotatePoint( &corner, angle + angle_pad ); // Rotate by segment angle and pad orientation
|
||||
corner += PadShapePos;
|
||||
aBooleng->AddPoint( corner.x, corner.y );
|
||||
#ifdef CREATE_KBOOL_KEY_FILES
|
||||
AddPointXY(corner.x, corner.y);
|
||||
#endif
|
||||
}
|
||||
#ifdef CREATE_KBOOL_KEY_FILES
|
||||
// Close polygon
|
||||
corner = corners_buffer[0];
|
||||
RotatePoint( &corner, angle + angle_pad ); // Rotate by segment angle and pad orientation
|
||||
corner += PadShapePos;
|
||||
AddPointXY( corner.x, corner.y );
|
||||
#endif
|
||||
|
||||
aBooleng->EndPolygonAdd();
|
||||
|
||||
#ifdef CREATE_KBOOL_KEY_FILES
|
||||
EndElement();
|
||||
#endif
|
||||
angle += 900; // Note: angle in in 0.1 deg.
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 x, y;
|
||||
int d = ::GetClearanceBetweenSegments(
|
||||
int d = GetClearanceBetweenSegments(
|
||||
bx1, by1, bx2, by2, bstyle,
|
||||
0,
|
||||
ax1, ay1, ax2,
|
||||
|
@ -1081,7 +1081,7 @@ bool DRC::doEdgeZoneDrc( ZONE_CONTAINER* aArea, int aCornerIndex )
|
|||
}
|
||||
int bstyle = Area_To_Test->m_Poly->GetSideStyle( ic2 );
|
||||
int x, y;
|
||||
int d = ::GetClearanceBetweenSegments( bx1, by1, bx2, by2, bstyle,
|
||||
int d = GetClearanceBetweenSegments( bx1, by1, bx2, by2, bstyle,
|
||||
0,
|
||||
ax1, ay1, ax2, ay2, astyle,
|
||||
0,
|
||||
|
|
|
@ -538,13 +538,16 @@ void ArmBoolEng( Bool_Engine* aBooleng, bool aConvertHoles )
|
|||
Within the algorithm all input data is multiplied with DGRID, and the result
|
||||
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)
|
||||
// Note: in kicad, coordinates are already integer so DGRID can be set to 1
|
||||
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 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
|
||||
// this operation shrinks a polygon if CORRECTIONFACTOR < 0
|
||||
// or stretch it if CORRECTIONFACTOR > 0
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
/*! \file kbool/_dl_itr.cpp
|
||||
\brief Double Linked list with Iterators on list
|
||||
\author Probably Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Probably Klaas Holwerda
|
||||
|
||||
Licence: wxWidgets Licence
|
||||
|
||||
RCS-ID: $Id: _dl_itr.cpp,v 1.3 2006/12/13 21:43:33 titato Exp $
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: _dl_itr.cpp,v 1.5 2009/04/23 19:35:24 titato Exp $
|
||||
*/
|
||||
|
||||
#ifdef __UNIX__
|
||||
|
@ -116,20 +116,20 @@ Error("remove_all",ITER_GT_O);
|
|||
\param error code to generate a message for
|
||||
*/
|
||||
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];
|
||||
strcpy( buf, "DL_List<Dtype>::" );
|
||||
strcat( buf, function );
|
||||
string buf;
|
||||
buf += "DL_List<Dtype>::";
|
||||
buf += function;
|
||||
switch ( a_error )
|
||||
{
|
||||
case NO_MES: strcat( buf, "" ); break;
|
||||
case EMPTY: strcat( buf, "list is empty" ); break;
|
||||
case ITER_GT_0: strcat( buf, "more then zero iter" ); break;
|
||||
case NO_LIST: strcat( buf, "no list attached" ); break;
|
||||
case SAME_LIST: strcat( buf, "same list not allowed" ); break;
|
||||
case AC_ITER_LIST_OTHER: strcat( buf, "iter not allowed on other list" ); break;
|
||||
default: strcat( buf, "unhandled error" ); break;
|
||||
case NO_MES: buf += ""; break;
|
||||
case EMPTY: buf += "list is empty"; break;
|
||||
case ITER_GT_0: buf += "more then zero iter"; break;
|
||||
case NO_LIST: buf += "no list attached"; break;
|
||||
case SAME_LIST: buf += "same list not allowed"; break;
|
||||
case AC_ITER_LIST_OTHER: buf += "iter not allowed on other list"; break;
|
||||
default: buf += "unhandled error"; break;
|
||||
}
|
||||
|
||||
throw Bool_Engine_Error( buf, "list error", 0, 1 );
|
||||
|
@ -143,9 +143,9 @@ class | Dtype | item object in list
|
|||
too see if list is empty
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
if (_intlist.Empty())
|
||||
|
||||
|
||||
cout << "empty";
|
||||
\endcode
|
||||
*/
|
||||
|
@ -163,9 +163,9 @@ bool DL_List<Dtype>::empty()
|
|||
too see if list contains only one object
|
||||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
if (_intlist.count() == 1)
|
||||
|
||||
|
||||
cout << "one object in list";
|
||||
\endcode
|
||||
*/
|
||||
|
@ -181,11 +181,11 @@ int DL_List<Dtype>::count()
|
|||
\note
|
||||
The objects itself are not deleted, only removed from the list.
|
||||
The user is responsible for memory management.
|
||||
|
||||
|
||||
\note
|
||||
The iterator level must be zero to be able to use this function,
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\note
|
||||
Use this function if an iterator is not needed to do more complex things.
|
||||
This will save time, since the iterator does not have to be created.
|
||||
|
@ -194,13 +194,13 @@ int DL_List<Dtype>::count()
|
|||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
int a=123;
|
||||
|
||||
|
||||
int b=345;
|
||||
|
||||
|
||||
_intlist.insbegin(a);
|
||||
|
||||
|
||||
_intlist.insbegin(b);
|
||||
|
||||
|
||||
_intlist.remove_all();
|
||||
\endcode
|
||||
*/
|
||||
|
@ -233,28 +233,28 @@ remove the object at the begin of the list (head).
|
|||
\note
|
||||
The object itself is not deleted, only removed from the list.
|
||||
The user is responsible for memory management.
|
||||
|
||||
|
||||
\note
|
||||
The iterator level must be zero to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
\note
|
||||
The list must contain objects, else an error will be generated.
|
||||
|
||||
|
||||
\note
|
||||
Use this function if an iterator is not needed to do more complex things. This will save time, since the iterator does not
|
||||
have to be created.
|
||||
|
||||
|
||||
\par Example:
|
||||
too insert integer a at begin of list and remove it directly.
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
_intlist.insbegin(a)
|
||||
|
||||
|
||||
_intlist.removehead();
|
||||
|
||||
|
||||
\endcode
|
||||
*/
|
||||
template <class Dtype>
|
||||
|
@ -277,7 +277,7 @@ void DL_List<Dtype>::removehead()
|
|||
|
||||
/*!
|
||||
remove the object at the begin of the list (head).
|
||||
|
||||
|
||||
\note
|
||||
- The object itself is not deleted, only removed from the list.
|
||||
The user is responsible for memory management.
|
||||
|
@ -286,18 +286,18 @@ remove the object at the begin of the list (head).
|
|||
- The list must contain objects, else an error will be generated.
|
||||
- Use this function if an iterator is not needed to do more complex things.
|
||||
This will save time, since the iterator does not have to be created.
|
||||
|
||||
|
||||
\par Example:
|
||||
too insert integer a at end of list and remove it directly.
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
_intlist.insend(a)
|
||||
|
||||
|
||||
_intlist.removetail();
|
||||
|
||||
|
||||
\endcode
|
||||
*/
|
||||
template <class Dtype>
|
||||
|
@ -322,7 +322,7 @@ insert the object given at the end of the list, after tail
|
|||
\note
|
||||
The iterator level must be zero to be able to use this function,
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\note
|
||||
Use this function if an iterator is not needed to do more complex things.
|
||||
This will save time, since the iterator does not have to be created.
|
||||
|
@ -330,9 +330,9 @@ This will save time, since the iterator does not have to be created.
|
|||
too insert integer a at end of list
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
_intlist.insend(a)
|
||||
\endcode
|
||||
\param newitem an object for which the template list was generated
|
||||
|
@ -360,18 +360,18 @@ insert the object given at the begin of the list, before head
|
|||
\note
|
||||
The iterator level must be zero to be able to use this function,
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\note
|
||||
Use this function if an iterator is not needed to do more complex things.
|
||||
This will save time, since the iterator does not have to be created.
|
||||
|
||||
|
||||
\par Example:
|
||||
too insert integer a at begin of list
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
_intlist.insbegin(a)
|
||||
\endcode
|
||||
\param newitem an object for which the template list was generated
|
||||
|
@ -401,15 +401,15 @@ get head item
|
|||
which is at head of list|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
int b=345;
|
||||
|
||||
|
||||
int c;
|
||||
|
||||
|
||||
_intlist.insbegin(a)
|
||||
|
||||
|
||||
_intlist.insbegin(b)
|
||||
c=_intlist.headitem()
|
||||
\endcode
|
||||
|
@ -428,15 +428,15 @@ get tail item
|
|||
is at the tail of list
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
int b=345;
|
||||
|
||||
|
||||
int c;
|
||||
_intlist.insbegin(a)
|
||||
_intlist.insbegin(b)
|
||||
|
||||
|
||||
c=_intlist.headitem()
|
||||
\endcode
|
||||
*/
|
||||
|
@ -449,7 +449,7 @@ Dtype DL_List<Dtype>::tailitem()
|
|||
/*!
|
||||
* \note
|
||||
The iterator level must be zero to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
* \note The list may not be the same list as this list
|
||||
* \param otherlist the list to take the items from
|
||||
*/
|
||||
|
@ -497,23 +497,23 @@ void DL_List<Dtype>::takeover( DL_List<Dtype>* otherlist )
|
|||
to insert integer a and b into list and remove_all directly using an iterator
|
||||
\code
|
||||
DL_List<int>* a_list = new DL_List<int>(); // declaration and allocation
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
int b=345;
|
||||
|
||||
|
||||
{
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(a_list);
|
||||
|
||||
|
||||
a_listiter->insbegin(a)
|
||||
|
||||
|
||||
a_listiter->insbegin(b)
|
||||
|
||||
|
||||
a_listiter->remove_all()
|
||||
|
||||
|
||||
} //to destruct the iterator before the list is deleted
|
||||
|
||||
|
||||
delete a_list; #delete it (must have no iterators attached to it)
|
||||
\endcode
|
||||
*/
|
||||
|
@ -532,28 +532,28 @@ void DL_List<Dtype>::takeover( DL_List<Dtype>* otherlist )
|
|||
\param a_error: error code to generate a message for
|
||||
*/
|
||||
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];
|
||||
strcpy( buf, "DL_Iter<Dtype>::" );
|
||||
strcat( buf, function );
|
||||
string buf;
|
||||
buf = "DL_Iter<Dtype>::";
|
||||
buf += function;
|
||||
switch ( a_error )
|
||||
{
|
||||
case NO_MES: strcat( buf, "" ); break;
|
||||
case NO_LIST: strcat( buf, "no list attached" ); break;
|
||||
case NO_LIST_OTHER: strcat( buf, "no list on other iter" ); break;
|
||||
case AC_ITER_LIST_OTHER: strcat( buf, "iter not allowed on other list" ); break;
|
||||
case SAME_LIST: strcat( buf, "same list not allowed" ); break;
|
||||
case NOT_SAME_LIST: strcat( buf, "must be same list" ); break;
|
||||
case ITER_GT_1: strcat( buf, "more then one iter" ); break;
|
||||
case ITER_HITROOT: strcat( buf, "iter at root" ); break;
|
||||
case NO_ITEM: strcat( buf, "no item at current" ); break;
|
||||
case NO_NEXT: strcat( buf, "no next after current" ); break;
|
||||
case NO_PREV: strcat( buf, "no prev before current" ); break;
|
||||
case EMPTY: strcat( buf, "list is empty" ); break;
|
||||
case NOT_ALLOW: strcat( buf, "not allowed" ); break;
|
||||
case ITER_NEG: strcat( buf, "to much iters deleted" ); break;
|
||||
default: strcat( buf, "unhandled error" ); break;
|
||||
case NO_MES: buf += ""; break;
|
||||
case NO_LIST: buf += "no list attached"; break;
|
||||
case NO_LIST_OTHER: buf += "no list on other iter"; break;
|
||||
case AC_ITER_LIST_OTHER: buf += "iter not allowed on other list"; break;
|
||||
case SAME_LIST: buf += "same list not allowed"; break;
|
||||
case NOT_SAME_LIST: buf += "must be same list"; break;
|
||||
case ITER_GT_1: buf += "more then one iter"; break;
|
||||
case ITER_HITROOT: buf += "iter at root"; break;
|
||||
case NO_ITEM: buf += "no item at current"; break;
|
||||
case NO_NEXT: buf += "no next after current"; break;
|
||||
case NO_PREV: buf += "no prev before current"; break;
|
||||
case EMPTY: buf += "list is empty"; break;
|
||||
case NOT_ALLOW: buf += "not allowed"; break;
|
||||
case ITER_NEG: buf += "to much iters deleted"; break;
|
||||
default: buf += "unhandled error"; break;
|
||||
}
|
||||
throw Bool_Engine_Error( buf, "list error", 0, 1 );
|
||||
}
|
||||
|
@ -585,11 +585,11 @@ tcarg: class | Dtype | list item object
|
|||
How to construct a list of type integer and a second iterator for it:|
|
||||
\code
|
||||
DL_List<int>* IntegerList;
|
||||
|
||||
|
||||
IntegerList = new DL_List<int>();
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(IntegerList);
|
||||
|
||||
|
||||
DL_Iter<int>* a_secondlistiter=new DL_Iter<int>(a_listiter);
|
||||
\endcode
|
||||
\param otheriter other iterator on same list
|
||||
|
@ -610,21 +610,21 @@ Later on when a list is constructed,the iterator can be attached to it.
|
|||
This way an iterator to a specific list can be made static to a class, and can be used
|
||||
for several lists at the same time. \n
|
||||
tcarg: class | Dtype | list item object
|
||||
|
||||
|
||||
\par Example
|
||||
How to construct an iterator, without having a list first.
|
||||
This constructs an iterator for a list of the given type, but the list thus not yet exist.
|
||||
\code
|
||||
DL_Iter<int>* a_iter=new DL_Iter<int>();
|
||||
|
||||
|
||||
DL_List<int>* IntegerList;
|
||||
|
||||
|
||||
IntegerList = new DL_List<int>();
|
||||
|
||||
|
||||
a_iter.Attach(IntegerList);
|
||||
|
||||
|
||||
a_iter.insend(123);
|
||||
|
||||
|
||||
a_iter.Detach();
|
||||
\endcode
|
||||
*/
|
||||
|
@ -655,15 +655,15 @@ static to a class, and can be used for several lists at the same time.\n
|
|||
How to construct an iterator, without having a list first, and attach an iterator later:|
|
||||
\code
|
||||
DL_Iter<int>* a_iter=new DL_Iter<int>();
|
||||
|
||||
|
||||
DL_List<int>* IntegerList;
|
||||
|
||||
|
||||
IntegerList = new DL_List<int>();
|
||||
|
||||
|
||||
a_iter.Attach(IntegerList);
|
||||
|
||||
|
||||
a_iter.insend(123);
|
||||
|
||||
|
||||
a_iter.Detach();
|
||||
\endcode
|
||||
\param newlist the list to attached the iterator to
|
||||
|
@ -687,15 +687,15 @@ and can be used for several lists at the same time. \n
|
|||
How to construct an iterator, without having a list first, and attach an iterator later:
|
||||
\code
|
||||
DL_Iter<int>* a_iter=new DL_Iter<int>();
|
||||
|
||||
|
||||
DL_List<int>* IntegerList;
|
||||
|
||||
|
||||
IntegerList = new DL_List<int>();
|
||||
|
||||
|
||||
a_iter.Attach(IntegerList);
|
||||
|
||||
|
||||
a_iter.insend(123);
|
||||
|
||||
|
||||
a_iter.Detach();
|
||||
\endcode
|
||||
\param newlist: the list to attached the iterator to
|
||||
|
@ -755,22 +755,22 @@ to move all objects in a list to the list of the iterator.
|
|||
\note
|
||||
The iterator level must be one to be able to use this function,
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\note
|
||||
The list may not be the same list as the iterator list
|
||||
\par Example
|
||||
to take over all items in _intlist|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
DL_List<int> _intlist2; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist2);
|
||||
|
||||
|
||||
_intlist->insend(a) // insert at end
|
||||
|
||||
|
||||
a_listiter2->takeover(_intlist)
|
||||
\endcode
|
||||
\param otherlist the list to take the items from
|
||||
|
@ -808,28 +808,28 @@ void DL_Iter<Dtype>::takeover( DL_List<Dtype>* otherlist )
|
|||
to move all objects in a list (using iterator of that list) to the list of the iterator.
|
||||
\note
|
||||
The iterator level for both iterators must be one to be able to use this function,
|
||||
|
||||
|
||||
\note
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\note
|
||||
The list may not be the same list as the iterator list
|
||||
|
||||
|
||||
\par Example
|
||||
to take over all items in a_listiter1 it's list|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
DL_List<int> _intlist2; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter1=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist2);
|
||||
|
||||
|
||||
a_listiter1->insend(a) // insert at end
|
||||
|
||||
|
||||
a_listiter2->takeover(a_listiter1)
|
||||
\\!to move all objects in a list (using iterator of that list) to the list of the iterator
|
||||
\endcode
|
||||
|
@ -872,27 +872,27 @@ to move maxcount objects in a list (using iterator of that list)
|
|||
to the list of the iterator.
|
||||
\note The iterator level for both iterators must be one to be able to use this function,
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\note The list may not be the same list as the iterator list
|
||||
|
||||
|
||||
\note If less then maxcount objects are available in the source iterator,
|
||||
all of them are taken and no error will accur
|
||||
|
||||
|
||||
\par Example
|
||||
to take over 1 item from a_listiter1 it's list
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
DL_List<int> _intlist2; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter1=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist2);
|
||||
|
||||
|
||||
a_listiter1->insend(a) // insert at end
|
||||
|
||||
|
||||
a_listiter2->takeover(a_listiter1,1);
|
||||
//! to move maxcount objects in a list (using iterator of that list) to the list of the iterator
|
||||
\endcode
|
||||
|
@ -987,13 +987,13 @@ put the iterator root object before the current iterator position in the list.
|
|||
The current object will become the new head of the list.
|
||||
\note The iterator level must be one to be able to use this function,
|
||||
else an error will be generated
|
||||
|
||||
|
||||
\par Example
|
||||
move the root object to make the new head the old tail object|
|
||||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
|
@ -1036,7 +1036,7 @@ The current object will become the new tail of the list.
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
|
@ -1076,7 +1076,7 @@ is list empty (contains items or not)?
|
|||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
if (a_listiter->Empty())
|
||||
cout << "empty"
|
||||
\endcode
|
||||
|
@ -1100,7 +1100,7 @@ the end can be tested with this function.
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->tohead();
|
||||
//traverse forwards
|
||||
while ( ! a_listiter->hitroot())
|
||||
|
@ -1108,7 +1108,7 @@ while ( ! a_listiter->hitroot())
|
|||
cout << "The item =" << a_listiter->item();
|
||||
a_listiter++; //goto next object
|
||||
}
|
||||
|
||||
|
||||
a_listiter->totail();
|
||||
//traverse backwards
|
||||
while ( ! a_listiter->hitroot())
|
||||
|
@ -1135,7 +1135,7 @@ is the iterator at the head of the list.
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->tohead();
|
||||
if (a_listiter->athead())
|
||||
cout << "at the head The item =" << a_listiter->item();
|
||||
|
@ -1159,7 +1159,7 @@ is the iterator at the tail of the list.
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->totail();
|
||||
if (a_listiter->attail())
|
||||
cout << "at the tail The item =" << a_listiter->item();
|
||||
|
@ -1183,7 +1183,7 @@ does the iterator/list contain the given object
|
|||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
a_listiter->insend(1234);
|
||||
|
||||
|
||||
if (a_listiter->has(1234))
|
||||
cout << "yes it does";
|
||||
\endcode
|
||||
|
@ -1233,7 +1233,7 @@ go to first item, if list is empty goto hite
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->tohead();
|
||||
\endcode
|
||||
|
@ -1254,7 +1254,7 @@ go to last item, if list is empty goto hite
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->totail();
|
||||
\endcode
|
||||
|
@ -1275,7 +1275,7 @@ set the iterator position to the root (empty dummy) object in the list.
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->toroot();
|
||||
while (a_listiter->iterate())
|
||||
|
@ -1298,7 +1298,7 @@ how to iterate backwards
|
|||
\code
|
||||
DL_List <int> _intlist; //create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->tohead();
|
||||
while (!a_listiter->hitroot())
|
||||
|
@ -1324,7 +1324,7 @@ how to iterate backwards
|
|||
\code
|
||||
DL_List <int> _intlist; //create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->tohead();
|
||||
while (!a_listiter->hitroot())
|
||||
|
@ -1351,7 +1351,7 @@ how to iterate backwards
|
|||
\code
|
||||
DL_List <int> _intlist; //create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->totail();
|
||||
while (!a_listiter->hitroot())
|
||||
|
@ -1378,7 +1378,7 @@ how to iterate backwards
|
|||
\code
|
||||
DL_List <int> _intlist; //create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->totail();
|
||||
while (!a_listiter->hitroot())
|
||||
|
@ -1454,11 +1454,11 @@ put the iterator at the position of the given object in the list.
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
|
||||
|
||||
a_listiter->toitem(2345); template <class Dtype>
|
||||
\endcode
|
||||
*/
|
||||
|
@ -1488,7 +1488,7 @@ put the iterator at the same position as the given iterator in the list.
|
|||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
DL_Iter<int>* a_listiter2=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
|
@ -1535,27 +1535,27 @@ bool DL_Iter<Dtype>::tonode( DL_Node<Dtype> *othernode )
|
|||
/*!
|
||||
advance the iterator one position in the next direction in the list.
|
||||
\return returns true if not at the end/root of the list else false.
|
||||
|
||||
|
||||
\note This function combines iteration and testing for the end of
|
||||
the list in one.
|
||||
|
||||
|
||||
\note Therefore we do not have to advance the iterator ourselves.
|
||||
|
||||
|
||||
\note
|
||||
The iterator is first put to the next object, before testing for the end of the list. |
|
||||
This is why we need to start at the root element in general usage.
|
||||
|
||||
|
||||
\par Example
|
||||
iterate through all the items in a list
|
||||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
a_listiter->tobegin(2345);
|
||||
|
||||
|
||||
while (a_listiter->iterate())
|
||||
{ cout << a_listiter->item(); }
|
||||
\endcode
|
||||
|
@ -1583,7 +1583,7 @@ since there is no item there.
|
|||
\code
|
||||
DL_List <int> _intlist; //create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->tohead();
|
||||
int theitem=a_listiter->item();
|
||||
|
@ -1634,11 +1634,11 @@ cycle the list twice
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->tohead();
|
||||
|
||||
|
||||
int count=2*a_listiter->count();
|
||||
while (count)
|
||||
{
|
||||
|
@ -1681,11 +1681,11 @@ cycle the list twice
|
|||
\code
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(1234);
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->totail();
|
||||
|
||||
|
||||
int count=2*a_listiter->count();
|
||||
while (count)
|
||||
{
|
||||
|
@ -1723,23 +1723,23 @@ void DL_Iter<Dtype>::remove_all()
|
|||
/*!
|
||||
remove object at current iterator position from the list.
|
||||
\note The object itself is not deleted, only removed from the list. The user is responsible for memory management.
|
||||
|
||||
|
||||
\note The iterator level must be one to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
\note The list must contain an object at the current iterator position, else an error will be generated.
|
||||
\par Example:
|
||||
to insert integer a at begin of list and remove it directly
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insbegin(a);
|
||||
|
||||
|
||||
a_listiter->tohead();
|
||||
|
||||
|
||||
a_listiter->remove();
|
||||
\endcode
|
||||
*/
|
||||
|
@ -1767,21 +1767,21 @@ void DL_Iter<Dtype>::remove()
|
|||
/*!
|
||||
remove the object at the begin of the list using an iterator
|
||||
\note The object itself is not deleted, only removed from the list. The user is responsible for memory management.
|
||||
|
||||
|
||||
\note The iterator level must be one to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
\note The list must contain objects, else an error will be generated.
|
||||
|
||||
|
||||
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
|
||||
\par Example:
|
||||
to insert integer a at begin of list and remove it directly|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insbegin(a);
|
||||
a_listiter->removehead();
|
||||
\endcode
|
||||
|
@ -1808,21 +1808,21 @@ void DL_Iter<Dtype>::removehead()
|
|||
/*!
|
||||
//remove the object at the end of the list using an iterator
|
||||
\note The object itself is not deleted, only removed from the list. The user is responsible for memory management.
|
||||
|
||||
|
||||
\note The iterator level must be one to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
\note The list must contain objects, else an error will be generated.
|
||||
|
||||
|
||||
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
|
||||
\par Example:
|
||||
to insert integer a at end of list and remove it directly
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(a);
|
||||
a_listiter->removetail();
|
||||
\endcode
|
||||
|
@ -1848,19 +1848,19 @@ void DL_Iter<Dtype>::removetail()
|
|||
|
||||
/*!
|
||||
insert the object given at the end of the list
|
||||
|
||||
|
||||
\note The iterator level must be one to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
|
||||
\par Example:
|
||||
to insert integer a at end of list|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(a);
|
||||
\endcode
|
||||
*/
|
||||
|
@ -1882,18 +1882,18 @@ DL_Node<Dtype>* DL_Iter<Dtype>::insend( Dtype newitem )
|
|||
/*!
|
||||
insert the object given at the begin of the list
|
||||
\note The iterator level must be one to be able to use this function, else an error will be generated
|
||||
|
||||
|
||||
\note Use this function if an iterator is needed to do more complex things. Else use the list member functions directly.
|
||||
|
||||
|
||||
\par Example:
|
||||
to insert integer a at begin of list|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insbegin(a);
|
||||
\endcode
|
||||
\param newitem an object for which the template list/iterator was generated
|
||||
|
@ -1919,9 +1919,9 @@ DL_Node<Dtype>* DL_Iter<Dtype>::insbegin( Dtype newitem )
|
|||
to insert integer before the iterator position in the list|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
a_listiter->totail();
|
||||
a_listiter->insbefore(a); // insert before tail
|
||||
|
@ -1954,9 +1954,9 @@ insert the object given after the current position of the iterator in list
|
|||
\par Example: to insert integer after the iterator position in the list|
|
||||
\code
|
||||
DL_List<int> _intlist; #create a list of integers
|
||||
|
||||
|
||||
int a=123;
|
||||
|
||||
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
a_listiter->tohead();
|
||||
a_listiter->insafter(a); // insert after head
|
||||
|
@ -1986,30 +1986,30 @@ DL_Node<Dtype>* DL_Iter<Dtype>::insafter( Dtype newitem )
|
|||
sort all items in the list according to the compare function.
|
||||
when items need to be swapped to reach the right order the swap function will be called also.
|
||||
\note There are no restrictions on the internal decision in the compare function when to return -1,0,1.
|
||||
|
||||
|
||||
\note The swap function can be used to change items when they are swapped.
|
||||
fcmp (function, fcmp)
|
||||
\verbatim
|
||||
|
||||
|
||||
Declaration: int (*fcmp) (Dtype,Dtype)
|
||||
|
||||
|
||||
compare function pointer, the function takes two objects in the list. It must return -1, 0, 1, to sort the list in upgoing
|
||||
order the function should return:
|
||||
|
||||
|
||||
-1 is returned if the first object is bigger then the second.
|
||||
0 is returned if the objects are equal.
|
||||
1 is returned if the first object is smaller then the second.
|
||||
|
||||
|
||||
To sort the list in downgoing order:
|
||||
|
||||
|
||||
1 is returned if the first object is bigger then the second.
|
||||
0 is returned if the objects are equal.
|
||||
-1 is returned if the first object is smaller then the second.
|
||||
|
||||
|
||||
fswap (function, fswap)
|
||||
|
||||
|
||||
Declaration: void (*fswap) (Dtype,Dtype)
|
||||
|
||||
|
||||
swap function pointer, the function takes two objects in the list. It will be called when the objects are swapped to
|
||||
reach the right order. If it is NULL, it will not be called.
|
||||
\endverbatim
|
||||
|
@ -2022,10 +2022,10 @@ int numbersorter(int a,int b)
|
|||
if(a == b) return(0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
a_listiter->insend(1234);
|
||||
|
@ -2110,34 +2110,34 @@ int DL_Iter<Dtype>::cocktailsort( int ( *fcmp ) ( Dtype, Dtype ), bool ( *fswap
|
|||
|
||||
/*!
|
||||
sort all items in the list according to the compare function.
|
||||
|
||||
|
||||
\note
|
||||
There are no restrictions on the internal decision in the compare function when to return -1,0,1.
|
||||
|
||||
|
||||
\note
|
||||
For the mergesort function the objects will be swapped when the return value is -1.
|
||||
|
||||
|
||||
\note
|
||||
\verbatim
|
||||
|
||||
|
||||
fcmp (function, fcmp)
|
||||
|
||||
|
||||
Declaration: int (*fcmp) (Dtype,Dtype)
|
||||
|
||||
|
||||
compare function pointer, the function takes two objects in the list. It must return -1, 0, 1, to sort the list in upgoing
|
||||
order the function should return:
|
||||
|
||||
|
||||
-1 is returned if the first object is bigger then the second.
|
||||
0 is returned if the objects are equal.
|
||||
1 is returned if the first object is smaller then the second.
|
||||
|
||||
|
||||
To sort the list in downgoing order:
|
||||
|
||||
|
||||
1 is returned if the first object is bigger then the second.
|
||||
0 is returned if the objects are equal.
|
||||
-1 is returned if the first object is smaller then the second.
|
||||
\endverbatim
|
||||
|
||||
|
||||
!tcarg: class | Dtype | list item object
|
||||
\par example
|
||||
sort the list in upgoing order using mergesort and the function numbersorter|
|
||||
|
@ -2149,10 +2149,10 @@ int numbersorter(int a,int b)
|
|||
if(a == b) return(0);
|
||||
return(-1);
|
||||
}
|
||||
|
||||
|
||||
DL_List <int> _intlist; #create a list of integers
|
||||
DL_Iter<int>* a_listiter=new DL_Iter<int>(&_intlist);
|
||||
|
||||
|
||||
a_listiter->insend(2345);
|
||||
a_listiter->insend(3456);
|
||||
a_listiter->insend(1234);
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*! \file kbool/include/kbool/_dl_itr.h
|
||||
\author Probably Klaas Holwerda
|
||||
|
||||
Copyright: 2001-2004 (C) Probably Klaas Holwerda
|
||||
|
||||
Licence: wxWidgets Licence
|
||||
|
||||
RCS-ID: $Id: _dl_itr.h,v 1.3 2008/06/04 21:23:21 titato Exp $
|
||||
\author Klaas Holwerda
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: _dl_itr.h,v 1.5 2009/04/23 19:35:24 titato Exp $
|
||||
*/
|
||||
|
||||
//! author="Klaas Holwerda"
|
||||
|
@ -22,7 +22,9 @@
|
|||
|
||||
#include "kbool/booleng.h"
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
#ifndef _STATUS_ENUM
|
||||
#define _STATUS_ENUM
|
||||
|
@ -103,7 +105,7 @@ public:
|
|||
~DL_List();
|
||||
|
||||
//!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
|
||||
int count();
|
||||
|
@ -168,7 +170,7 @@ public:
|
|||
~DL_Iter();
|
||||
|
||||
//!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.
|
||||
void Attach( DL_List<Dtype>* newlist );
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
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__
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*! \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"
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
/*! \file include/booleng.h
|
||||
\author Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: booleng.h,v 1.4 2008/09/05 19:01:14 titato Exp $
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: booleng.h,v 1.6 2009/09/07 19:23:28 titato Exp $
|
||||
*/
|
||||
|
||||
#ifndef BOOLENG_H
|
||||
|
@ -19,9 +19,13 @@
|
|||
#include <limits.h>
|
||||
#include <assert.h>
|
||||
#include <math.h>
|
||||
#include <string>
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
#if 0 // Kicad does not use kbool in dll version
|
||||
|
||||
#if defined(__WXMSW__)
|
||||
/*
|
||||
__declspec works in BC++ 5 and later, Watcom C++ 11.0 and later as well
|
||||
|
@ -58,6 +62,7 @@
|
|||
# define WXEXPORT __declspec(dllexport)
|
||||
# define WXIMPORT __declspec(dllimport)
|
||||
#endif
|
||||
|
||||
#endif // if 0 for kicad
|
||||
|
||||
/* for other platforms/compilers we don't anything */
|
||||
|
@ -80,13 +85,13 @@
|
|||
#define A2DKBOOLDLLEXP_CTORFN
|
||||
#endif
|
||||
|
||||
#define KBOOL_VERSION "1.9"
|
||||
#define KBOOL_VERSION "2.0"
|
||||
|
||||
#define KBOOL_DEBUG 0
|
||||
#define KBOOL_LOG 0
|
||||
#define KBOOL_INT64 1
|
||||
|
||||
class KBoolLink;
|
||||
class kbLink;
|
||||
|
||||
#define LINELENGTH 200
|
||||
|
||||
|
@ -163,17 +168,17 @@ B_INT bmax( B_INT value1, B_INT value2 );
|
|||
class A2DKBOOLDLLEXP Bool_Engine_Error
|
||||
{
|
||||
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();
|
||||
char* GetErrorMessage();
|
||||
char* GetHeaderMessage();
|
||||
string GetErrorMessage();
|
||||
string GetHeaderMessage();
|
||||
int GetErrorDegree();
|
||||
int GetFatal();
|
||||
|
||||
protected:
|
||||
char* _message;
|
||||
char* _header;
|
||||
string _message;
|
||||
string _header;
|
||||
int _degree;
|
||||
int _fatal;
|
||||
};
|
||||
|
@ -207,10 +212,10 @@ enum BOOL_OP
|
|||
BOOL_MAKERING /*!< create a ring on all polygons */
|
||||
};
|
||||
|
||||
class GraphList;
|
||||
class Graph;
|
||||
class KBoolLink;
|
||||
class Node;
|
||||
class kbGraphList;
|
||||
class kbGraph;
|
||||
class kbLink;
|
||||
class kbNode;
|
||||
template<class Type> class TDLI;
|
||||
|
||||
//! boolean engine to perform operation on two sets of polygons.
|
||||
|
@ -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 )
|
||||
are based on the two sets of polygons in group A and B.
|
||||
The other operation on group A only.
|
||||
|
||||
|
||||
At the end of the operation the resulting polygons can be extracted.
|
||||
*/
|
||||
class A2DKBOOLDLLEXP Bool_Engine
|
||||
|
@ -234,16 +239,16 @@ public:
|
|||
//! destructor
|
||||
virtual ~Bool_Engine();
|
||||
|
||||
const char* GetVersion() { return KBOOL_VERSION; }
|
||||
string GetVersion() { return KBOOL_VERSION; }
|
||||
|
||||
//! reports progress of algorithm.
|
||||
virtual void SetState( const char* = 0 );
|
||||
virtual void SetState( string );
|
||||
|
||||
//! 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.
|
||||
virtual void info( const char *text, const char *title );
|
||||
virtual void info( string text, string title );
|
||||
|
||||
bool Do_Operation( BOOL_OP operation );
|
||||
|
||||
|
@ -252,7 +257,7 @@ public:
|
|||
/*
|
||||
The algorithm takes into account gaps and inaccuracies caused by rounding to integer coordinates
|
||||
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 )
|
||||
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.
|
||||
|
@ -275,8 +280,8 @@ public:
|
|||
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.
|
||||
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
|
||||
even smaller numbers.
|
||||
Another scaling with Grid is applied on top of it to create space in the integer number for
|
||||
even smaller numbers.
|
||||
*/
|
||||
void SetGrid( B_INT grid );
|
||||
|
||||
|
@ -294,7 +299,7 @@ public:
|
|||
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.
|
||||
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 );
|
||||
|
||||
|
@ -405,7 +410,7 @@ public:
|
|||
|
||||
//! 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
|
||||
polygon. In cases where software understands the concept of holes, contours
|
||||
are clockwise oriented, while holes are anticlockwise oriented.
|
||||
|
@ -422,13 +427,13 @@ public:
|
|||
void SetLog( bool OnOff );
|
||||
|
||||
//! used to write to log file
|
||||
void Write_Log( const char * );
|
||||
void Write_Log( string);
|
||||
//! used to write to log file
|
||||
void Write_Log( const char *, const char * );
|
||||
void Write_Log( string, string );
|
||||
//! used to write to log file
|
||||
void Write_Log( const char *, double );
|
||||
void Write_Log( string, double );
|
||||
//! used to write to log file
|
||||
void Write_Log( const char *, B_INT );
|
||||
void Write_Log( string, B_INT );
|
||||
|
||||
FILE* GetLogFile() { return m_logfile; }
|
||||
|
||||
|
@ -445,11 +450,11 @@ public:
|
|||
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->EndPolygonAdd();
|
||||
booleng->EndPolygonAdd();
|
||||
|
||||
\param A_or_B defines if the new polygon will be of group A or B
|
||||
|
||||
|
@ -457,7 +462,7 @@ public:
|
|||
to another polygon added.
|
||||
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
|
||||
individual areas without holes.
|
||||
individual areas without holes.
|
||||
Holes in such a case must be linked into the contour using two extra segments.
|
||||
*/
|
||||
bool StartPolygonAdd( GroupType A_or_B );
|
||||
|
@ -492,8 +497,8 @@ public:
|
|||
//! see StartPolygonGet
|
||||
/*!
|
||||
This iterates through the first graph in the graphlist.
|
||||
Setting the current Node properly by following the links in the graph
|
||||
through its nodes.
|
||||
Setting the current kbNode properly by following the links in the graph
|
||||
through its nodes.
|
||||
*/
|
||||
bool PolygonHasMorePoints();
|
||||
|
||||
|
@ -526,7 +531,7 @@ private:
|
|||
bool m_doLog;
|
||||
|
||||
//! contains polygons in graph form
|
||||
GraphList* m_graphlist;
|
||||
kbGraphList* m_graphlist;
|
||||
|
||||
double m_MARGE;
|
||||
B_INT m_GRID;
|
||||
|
@ -544,21 +549,21 @@ private:
|
|||
bool m_doLinkHoles;
|
||||
|
||||
//! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence
|
||||
Graph* m_GraphToAdd;
|
||||
kbGraph* m_GraphToAdd;
|
||||
//! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence
|
||||
Node* m_lastNodeToAdd;
|
||||
kbNode* m_lastNodeToAdd;
|
||||
//! used in the StartPolygonAdd, AddPt, EndPolygonAdd sequence
|
||||
Node* m_firstNodeToAdd;
|
||||
kbNode* m_firstNodeToAdd;
|
||||
|
||||
//! the current group type ( group A or B )
|
||||
GroupType m_groupType;
|
||||
|
||||
//! used in extracting the points from the resultant polygons
|
||||
Graph* m_getGraph;
|
||||
kbGraph* m_getGraph;
|
||||
//! used in extracting the points from the resultant polygons
|
||||
KBoolLink* m_getLink;
|
||||
kbLink* m_getLink;
|
||||
//! used in extracting the points from the resultant polygons
|
||||
Node* m_getNode;
|
||||
kbNode* m_getNode;
|
||||
//! used in extracting the points from the resultant polygons
|
||||
double m_PolygonXPoint;
|
||||
//! used in extracting the points from the resultant polygons
|
||||
|
@ -572,8 +577,8 @@ private:
|
|||
|
||||
public:
|
||||
|
||||
//! use in Node to iterate links.
|
||||
TDLI<KBoolLink>* _linkiter;
|
||||
//! use in kbNode to iterate links.
|
||||
TDLI<kbLink>* _linkiter;
|
||||
|
||||
//! how many time run intersections fase.
|
||||
unsigned int m_intersectionruns;
|
||||
|
|
|
@ -5,10 +5,10 @@
|
|||
|
||||
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
|
||||
|
@ -25,23 +25,23 @@ Last Update 03-04-1996
|
|||
#include "kbool/line.h"
|
||||
#include "kbool/scanbeam.h"
|
||||
|
||||
class Node;
|
||||
class kbNode;
|
||||
|
||||
class GraphList;
|
||||
class kbGraphList;
|
||||
|
||||
//! one graph containing links that cab be connected.
|
||||
class A2DKBOOLDLLEXP Graph
|
||||
class A2DKBOOLDLLEXP kbGraph
|
||||
{
|
||||
protected:
|
||||
Bool_Engine* _GC;
|
||||
public:
|
||||
|
||||
Graph( Bool_Engine* GC );
|
||||
Graph( KBoolLink*, Bool_Engine* GC );
|
||||
kbGraph( Bool_Engine* GC );
|
||||
kbGraph( kbLink*, Bool_Engine* GC );
|
||||
|
||||
Graph( Graph* other );
|
||||
kbGraph( kbGraph* other );
|
||||
|
||||
~Graph();
|
||||
~kbGraph();
|
||||
|
||||
bool GetBin() { return _bin; };
|
||||
void SetBin( bool b ) { _bin = b; };
|
||||
|
@ -51,10 +51,10 @@ public:
|
|||
void Rotate( bool plus90 );
|
||||
|
||||
//! adds a link to the linklist
|
||||
void AddLink( Node *begin, Node *end );
|
||||
void AddLink( kbNode *begin, kbNode *end );
|
||||
|
||||
//! adds a link to the linklist
|
||||
void AddLink( KBoolLink *a_link );
|
||||
void AddLink( kbLink *a_link );
|
||||
|
||||
bool AreZeroLines( B_INT Marge );
|
||||
|
||||
|
@ -79,42 +79,42 @@ public:
|
|||
// Remove unused links
|
||||
void ReverseAllLinks();
|
||||
|
||||
//! Simplify the graph
|
||||
//! Simplify the kbGraph
|
||||
bool Simplify( B_INT Marge );
|
||||
|
||||
|
||||
//! Takes over all links of the argument
|
||||
bool Smoothen( B_INT Marge );
|
||||
|
||||
void TakeOver( Graph* );
|
||||
void TakeOver( kbGraph* );
|
||||
|
||||
//! function for maximum performance
|
||||
|
||||
//! Get the First link from the graph
|
||||
KBoolLink* GetFirstLink();
|
||||
Node* GetTopNode();
|
||||
//! Get the First link from the kbGraph
|
||||
kbLink* GetFirstLink();
|
||||
kbNode* GetTopNode();
|
||||
void SetBeenHere( bool );
|
||||
void Reset_flags();
|
||||
|
||||
//! Set the group of a graph
|
||||
//! Set the group of a kbGraph
|
||||
void SetGroup( GroupType );
|
||||
|
||||
//! Set the number of the graph
|
||||
//! Set the number of the kbGraph
|
||||
void SetNumber( int );
|
||||
void Reset_Mark_and_Bin();
|
||||
bool GetBeenHere();
|
||||
int GetGraphNum();
|
||||
int GetNumberOfLinks();
|
||||
|
||||
void Boolean( BOOL_OP operation, GraphList* Result );
|
||||
void Correction( GraphList* Result, double factor );
|
||||
void MakeRing( GraphList* Result, double factor );
|
||||
void CreateRing( GraphList *ring, double factor );
|
||||
void CreateRing_fast( GraphList *ring, double factor );
|
||||
void CreateArc( Node* center, KBoolLine* incoming, Node* end, double radius, double aber );
|
||||
void CreateArc( Node* center, Node* begin, Node* end, double radius, bool clock, double aber );
|
||||
void Boolean( BOOL_OP operation, kbGraphList* Result );
|
||||
void Correction( kbGraphList* Result, double factor );
|
||||
void MakeRing( kbGraphList* Result, double factor );
|
||||
void CreateRing( kbGraphList *ring, double factor );
|
||||
void CreateRing_fast( kbGraphList *ring, double factor );
|
||||
void CreateArc( kbNode* center, kbLine* incoming, kbNode* end, double radius, double aber );
|
||||
void CreateArc( kbNode* center, kbNode* begin, kbNode* end, double radius, bool clock, double aber );
|
||||
void MakeOneDirection();
|
||||
void Make_Rounded_Shape( KBoolLink* a_link, double factor );
|
||||
void Make_Rounded_Shape( kbLink* a_link, double factor );
|
||||
bool MakeClockWise();
|
||||
bool writegraph( bool linked );
|
||||
bool writeintersections();
|
||||
|
@ -137,7 +137,7 @@ protected:
|
|||
void Extract_Simples( BOOL_OP operation, bool detecthole, bool& foundholes );
|
||||
|
||||
//! 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
|
||||
/*
|
||||
|
@ -150,16 +150,16 @@ protected:
|
|||
\param graphnumber number to be given to links in the extracted graph piece
|
||||
\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 )
|
||||
/*!
|
||||
Last found position is used to find it quickly.
|
||||
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.
|
||||
/*
|
||||
|
|
|
@ -28,21 +28,21 @@ Last Update 11-03-1996
|
|||
class Debug_driver;
|
||||
|
||||
|
||||
class A2DKBOOLDLLEXP GraphList: public DL_List<void*>
|
||||
class A2DKBOOLDLLEXP kbGraphList: public DL_List<void*>
|
||||
{
|
||||
protected:
|
||||
Bool_Engine* _GC;
|
||||
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 Correction();
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
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
|
||||
|
@ -20,72 +20,72 @@ class A2DKBOOLDLLEXP Bool_Engine;
|
|||
// Status of a point to a line
|
||||
enum PointStatus {LEFT_SIDE, RIGHT_SIDE, ON_AREA, IN_AREA};
|
||||
|
||||
class A2DKBOOLDLLEXP Graph;
|
||||
class A2DKBOOLDLLEXP kbGraph;
|
||||
|
||||
class A2DKBOOLDLLEXP KBoolLine
|
||||
class A2DKBOOLDLLEXP kbLine
|
||||
{
|
||||
protected:
|
||||
Bool_Engine* m_GC;
|
||||
public:
|
||||
|
||||
// constructors and destructor
|
||||
KBoolLine( Bool_Engine* GC );
|
||||
KBoolLine( KBoolLink*, Bool_Engine* GC );
|
||||
~KBoolLine();
|
||||
kbLine( Bool_Engine* GC );
|
||||
kbLine( kbLink*, Bool_Engine* GC );
|
||||
~kbLine();
|
||||
|
||||
void Set( KBoolLink * );
|
||||
KBoolLink* GetLink();
|
||||
void Set( kbLink * );
|
||||
kbLink* GetLink();
|
||||
|
||||
//! Get the beginnode from a line
|
||||
Node* GetBeginNode();
|
||||
kbNode* GetBeginNode();
|
||||
|
||||
//! Get the endnode from a line
|
||||
Node* GetEndNode();
|
||||
kbNode* GetEndNode();
|
||||
|
||||
//! Check if two lines intersects
|
||||
int CheckIntersect( KBoolLine*, double Marge );
|
||||
int CheckIntersect( kbLine*, double Marge );
|
||||
|
||||
//! Intersects two lines
|
||||
int Intersect( KBoolLine*, double Marge );
|
||||
int Intersect_simple( KBoolLine * lijn );
|
||||
bool Intersect2( Node* crossing, KBoolLine * lijn );
|
||||
int Intersect( kbLine*, double Marge );
|
||||
int Intersect_simple( kbLine * lijn );
|
||||
bool Intersect2( kbNode* crossing, kbLine * lijn );
|
||||
|
||||
//!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
|
||||
PointStatus PointInLine( Node* a_node, double& Distance, double Marge );
|
||||
PointStatus PointInLine( kbNode* a_node, double& Distance, double Marge );
|
||||
|
||||
//! Caclulate Y if X is known
|
||||
B_INT Calculate_Y( 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
|
||||
KBoolLine& operator=( const KBoolLine& );
|
||||
kbLine& operator=( const kbLine& );
|
||||
|
||||
Node* OffsetContour( KBoolLine* const nextline, Node* last_ins, double factor, Graph *shape );
|
||||
Node* OffsetContour_rounded( KBoolLine* const nextline, Node* _last_ins, double factor, Graph *shape );
|
||||
bool OkeForContour( KBoolLine* const nextline, double factor, Node* LastLeft, Node* LastRight, LinkStatus& _outproduct );
|
||||
bool Create_Ring_Shape( KBoolLine* nextline, Node** _last_ins_left, Node** _last_ins_right, double factor, Graph *shape );
|
||||
void Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left, Node** _last_ins_right, double factor, Graph *shape );
|
||||
void Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Node* _last_ins_right, double factor, Graph *shape );
|
||||
kbNode* OffsetContour( kbLine* const nextline, kbNode* last_ins, double factor, kbGraph *shape );
|
||||
kbNode* OffsetContour_rounded( kbLine* const nextline, kbNode* _last_ins, double factor, kbGraph *shape );
|
||||
bool OkeForContour( kbLine* const nextline, double factor, kbNode* LastLeft, kbNode* LastRight, LinkStatus& _outproduct );
|
||||
bool Create_Ring_Shape( kbLine* nextline, kbNode** _last_ins_left, kbNode** _last_ins_right, double factor, kbGraph *shape );
|
||||
void Create_Begin_Shape( kbLine* nextline, kbNode** _last_ins_left, kbNode** _last_ins_right, double factor, kbGraph *shape );
|
||||
void Create_End_Shape( kbLine* nextline, kbNode* _last_ins_left, kbNode* _last_ins_right, double factor, kbGraph *shape );
|
||||
|
||||
//! Calculate the parameters if nessecary
|
||||
void CalculateLineParameters();
|
||||
|
||||
//! 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 );
|
||||
Node* AddCrossing( B_INT X, B_INT Y );
|
||||
bool ProcessCrossings( TDLI<KBoolLink>* _LI );
|
||||
void AddCrossing( kbNode *a_node );
|
||||
kbNode* AddCrossing( B_INT X, B_INT Y );
|
||||
bool ProcessCrossings( TDLI<kbLink>* _LI );
|
||||
|
||||
// Linecrosslist
|
||||
void SortLineCrossings();
|
||||
bool CrossListEmpty();
|
||||
DL_List<void*>* GetCrossList();
|
||||
// bool HasInCrossList(Node*);
|
||||
// bool HasInCrossList(kbNode*);
|
||||
|
||||
private:
|
||||
|
||||
|
@ -94,10 +94,10 @@ private:
|
|||
//! Function needed for Intersect
|
||||
int ActionOnTable2( PointStatus, PointStatus );
|
||||
|
||||
double m_AA;
|
||||
double m_AA;
|
||||
double m_BB;
|
||||
double m_CC;
|
||||
KBoolLink* m_link;
|
||||
kbLink* m_link;
|
||||
bool m_valid_parameters;
|
||||
|
||||
//! List with crossings through this link
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
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
|
||||
|
@ -17,53 +17,53 @@
|
|||
|
||||
enum LinkStatus {IS_LEFT, IS_ON, IS_RIGHT};
|
||||
|
||||
class LPoint;
|
||||
class Node;
|
||||
class Record;
|
||||
class kbLPoint;
|
||||
class kbNode;
|
||||
class kbRecord;
|
||||
|
||||
//! segment within a graph
|
||||
/*
|
||||
A Graph contains a list of KBoolLink, the KBoolLink or connected by Node's.
|
||||
Several KBoolLink can be connected to one Node.
|
||||
A KBoolLink has a direction defined by its begin and end node.
|
||||
Node do have a list of connected KBoolLink's.
|
||||
A Graph contains a list of kbLink, the kbLink or connected by Node's.
|
||||
Several kbLink can be connected to one Node.
|
||||
A kbLink has a direction defined by its begin and end node.
|
||||
Node do have a list of connected kbLink's.
|
||||
So one can walk trough a graph in two ways:
|
||||
1- via its KBoolLink list
|
||||
2- via the node connected to the KBoolLink's
|
||||
1- via its kbLink list
|
||||
2- via the node connected to the kbLink's
|
||||
*/
|
||||
class A2DKBOOLDLLEXP KBoolLink
|
||||
class A2DKBOOLDLLEXP kbLink
|
||||
{
|
||||
protected:
|
||||
Bool_Engine* _GC;
|
||||
public:
|
||||
|
||||
//! contructors
|
||||
KBoolLink( Bool_Engine* GC );
|
||||
kbLink( Bool_Engine* GC );
|
||||
|
||||
//! contructors
|
||||
KBoolLink( int graphnr, Node* begin, Node* end, Bool_Engine* GC );
|
||||
kbLink( int graphnr, kbNode* begin, kbNode* end, Bool_Engine* GC );
|
||||
|
||||
//! contructors
|
||||
KBoolLink( Node *begin, Node *end, Bool_Engine* GC );
|
||||
kbLink( kbNode *begin, kbNode *end, Bool_Engine* GC );
|
||||
|
||||
//! destructors
|
||||
~KBoolLink();
|
||||
~kbLink();
|
||||
|
||||
|
||||
//! Merges the other node with argument
|
||||
void MergeNodes( Node* const );
|
||||
void MergeNodes( kbNode* const );
|
||||
|
||||
//! 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
|
||||
LinkStatus PointOnCorner( KBoolLink* const, KBoolLink* const );
|
||||
LinkStatus PointOnCorner( kbLink* const, kbLink* const );
|
||||
|
||||
//! Removes argument from the link
|
||||
void Remove( Node* );
|
||||
void Remove( kbNode* );
|
||||
|
||||
//! replaces olddone in the link by newnode
|
||||
void Replace( Node* oldnode, Node* newnode );
|
||||
void Replace( kbNode* oldnode, kbNode* newnode );
|
||||
|
||||
//!top hole marking
|
||||
void SetTopHole( bool value );
|
||||
|
@ -97,15 +97,15 @@ public:
|
|||
void UnLink();
|
||||
|
||||
//! functions for maximum performance
|
||||
Node* GetBeginNode();
|
||||
kbNode* GetBeginNode();
|
||||
|
||||
//! Datamember access functions
|
||||
Node* GetEndNode();
|
||||
Node* GetLowNode();
|
||||
Node* GetHighNode();
|
||||
kbNode* GetEndNode();
|
||||
kbNode* GetLowNode();
|
||||
kbNode* GetHighNode();
|
||||
|
||||
//! Returns a next link beginning with argument
|
||||
KBoolLink* Forth( Node* );
|
||||
kbLink* Forth( kbNode* );
|
||||
|
||||
int GetGraphNum();
|
||||
bool GetInc();
|
||||
|
@ -113,10 +113,10 @@ public:
|
|||
bool GetLeftB();
|
||||
bool GetRightA();
|
||||
bool GetRightB();
|
||||
void GetLRO( LPoint*, int&, int&, double );
|
||||
void GetLRO( kbLPoint*, int&, int&, double );
|
||||
|
||||
//! Return a node not equal to arg.
|
||||
Node* GetOther( const Node* const );
|
||||
kbNode* GetOther( const kbNode* const );
|
||||
//! Is this link unused ?
|
||||
bool IsUnused();
|
||||
|
||||
|
@ -143,10 +143,10 @@ public:
|
|||
bool ShorterThan( B_INT marge );
|
||||
|
||||
//! Resets the link
|
||||
void Reset( Node* begin, Node* end, int graphnr = 0 );
|
||||
void Set( Node* begin, Node* end );
|
||||
void SetBeginNode( Node* );
|
||||
void SetEndNode( Node* );
|
||||
void Reset( kbNode* begin, kbNode* end, int graphnr = 0 );
|
||||
void Set( kbNode* begin, kbNode* end );
|
||||
void SetBeginNode( kbNode* );
|
||||
void SetEndNode( kbNode* );
|
||||
void SetGraphNum( int );
|
||||
void SetInc( bool );
|
||||
void SetLeftA( bool );
|
||||
|
@ -162,18 +162,18 @@ public:
|
|||
void Reset_flags();
|
||||
|
||||
//!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:
|
||||
|
||||
//! The mainitems of a link
|
||||
Node *m_beginnode, *m_endnode;
|
||||
kbNode *m_beginnode, *m_endnode;
|
||||
//! Marker for walking over the graph
|
||||
bool m_bin : 1;
|
||||
//! Is this a part of hole ?
|
||||
|
@ -223,7 +223,7 @@ GroupType m_group : 1;
|
|||
//! belongs to this polygon part in the graph.
|
||||
int m_graphnum;
|
||||
|
||||
DL_Node<Record*>* m_record;
|
||||
DL_Node<kbRecord*>* m_record;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,35 +21,35 @@ Last Update 12-12-1995
|
|||
|
||||
#include "kbool/booleng.h"
|
||||
|
||||
class A2DKBOOLDLLEXP LPoint
|
||||
class A2DKBOOLDLLEXP kbLPoint
|
||||
{
|
||||
public:
|
||||
LPoint();
|
||||
LPoint( B_INT const , B_INT const );
|
||||
LPoint( LPoint* const );
|
||||
kbLPoint();
|
||||
kbLPoint( B_INT const , B_INT const );
|
||||
kbLPoint( kbLPoint* const );
|
||||
|
||||
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 GetY();
|
||||
void SetX( 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 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 );
|
||||
|
||||
LPoint &operator=( const LPoint & );
|
||||
LPoint &operator+( const LPoint & );
|
||||
LPoint &operator-( const LPoint & );
|
||||
kbLPoint &operator=( const kbLPoint & );
|
||||
kbLPoint &operator+( const kbLPoint & );
|
||||
kbLPoint &operator-( const kbLPoint & );
|
||||
|
||||
LPoint &operator*( int );
|
||||
LPoint &operator/( int );
|
||||
kbLPoint &operator*( int );
|
||||
kbLPoint &operator/( int );
|
||||
|
||||
int operator==( const LPoint & ) const;
|
||||
int operator!=( const LPoint & ) const;
|
||||
int operator==( const kbLPoint & ) const;
|
||||
int operator!=( const kbLPoint & ) const;
|
||||
|
||||
protected:
|
||||
B_INT _x;
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
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
|
||||
|
@ -22,7 +22,7 @@
|
|||
|
||||
enum NodePosition { N_LEFT, N_ON, N_RIGHT};
|
||||
|
||||
class A2DKBOOLDLLEXP Node : public LPoint
|
||||
class A2DKBOOLDLLEXP kbNode : public kbLPoint
|
||||
{
|
||||
protected:
|
||||
Bool_Engine* _GC;
|
||||
|
@ -31,52 +31,52 @@ public:
|
|||
friend class Debug_driver;
|
||||
|
||||
// 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 );
|
||||
Node( Node * const, Bool_Engine* GC );
|
||||
Node& operator=( const Node &other_node );
|
||||
~Node();
|
||||
kbNode( kbLPoint* const a_point, Bool_Engine* GC );
|
||||
kbNode( kbNode * const, Bool_Engine* GC );
|
||||
kbNode& operator=( const kbNode &other_node );
|
||||
~kbNode();
|
||||
|
||||
//public member functions
|
||||
void AddLink( KBoolLink* );
|
||||
void AddLink( kbLink* );
|
||||
DL_List<void*>* GetLinklist();
|
||||
|
||||
//! 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
|
||||
/*! 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 )
|
||||
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.
|
||||
KBoolLink* GetNotFlat();
|
||||
kbLink* GetNotFlat();
|
||||
|
||||
//! 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* );
|
||||
void RemoveLink( KBoolLink* );
|
||||
bool Simplify( Node* First, Node* Second, B_INT Marge );
|
||||
int Merge( kbNode* );
|
||||
void RemoveLink( kbLink* );
|
||||
bool Simplify( kbNode* First, kbNode* Second, B_INT Marge );
|
||||
|
||||
// memberfunctions for maximum performance
|
||||
void RoundInt( B_INT grid );
|
||||
KBoolLink* GetIncomingLink();
|
||||
kbLink* GetIncomingLink();
|
||||
|
||||
int GetNumberOfLinks();
|
||||
KBoolLink* GetNextLink();
|
||||
KBoolLink* GetOtherLink( KBoolLink* );
|
||||
KBoolLink* GetOutgoingLink();
|
||||
KBoolLink* GetPrevLink();
|
||||
kbLink* GetNextLink();
|
||||
kbLink* GetOtherLink( kbLink* );
|
||||
kbLink* GetOutgoingLink();
|
||||
kbLink* GetPrevLink();
|
||||
|
||||
KBoolLink* Follow( KBoolLink* const prev );
|
||||
KBoolLink* GetBinHighest( bool binset );
|
||||
kbLink* Follow( kbLink* const prev );
|
||||
kbLink* GetBinHighest( bool binset );
|
||||
|
||||
protected:
|
||||
DL_List<void*>* _linklist;
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
|
||||
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
|
||||
#define RECORD_H
|
||||
|
||||
class Node;
|
||||
class kbNode;
|
||||
#include "kbool/booleng.h"
|
||||
|
||||
#include "kbool/link.h"
|
||||
|
@ -24,30 +24,30 @@ enum DIRECTION {GO_LEFT, GO_RIGHT};
|
|||
//extern void DeleteRecordPool();
|
||||
class A2DKBOOLDLLEXP Bool_Engine;
|
||||
|
||||
class A2DKBOOLDLLEXP Record
|
||||
class A2DKBOOLDLLEXP kbRecord
|
||||
{
|
||||
protected:
|
||||
Bool_Engine* _GC;
|
||||
public:
|
||||
// void deletepool();
|
||||
|
||||
Record( KBoolLink* link, Bool_Engine* GC );
|
||||
kbRecord( kbLink* link, Bool_Engine* GC );
|
||||
|
||||
~Record();
|
||||
~kbRecord();
|
||||
|
||||
// void* operator new(size_t size);
|
||||
|
||||
// void operator delete(void* recordptr);
|
||||
|
||||
void SetNewLink( KBoolLink* link );
|
||||
void SetNewLink( kbLink* link );
|
||||
|
||||
void Set_Flags();
|
||||
|
||||
void Calc_Ysp( Node* low );
|
||||
void Calc_Ysp( kbNode* low );
|
||||
|
||||
KBoolLink* GetLink();
|
||||
kbLink* GetLink();
|
||||
|
||||
KBoolLine* GetLine();
|
||||
kbLine* GetLine();
|
||||
|
||||
B_INT Ysp();
|
||||
|
||||
|
@ -55,12 +55,12 @@ public:
|
|||
|
||||
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:
|
||||
KBoolLine _line;
|
||||
kbLine _line;
|
||||
|
||||
B_INT _ysp;
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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
|
||||
|
@ -20,10 +20,10 @@
|
|||
enum SCANTYPE{NODELINK, LINKLINK, GENLR, LINKHOLES, INOUT};
|
||||
|
||||
#if defined(WXART2D_USINGDLL)
|
||||
template class A2DKBOOLDLLEXP DL_Iter<Record*>;
|
||||
template class A2DKBOOLDLLEXP DL_Iter<kbRecord*>;
|
||||
#endif
|
||||
|
||||
class A2DKBOOLDLLEXP ScanBeam : public DL_List<Record*>
|
||||
class A2DKBOOLDLLEXP ScanBeam : public DL_List<kbRecord*>
|
||||
{
|
||||
protected:
|
||||
Bool_Engine* _GC;
|
||||
|
@ -31,26 +31,26 @@ protected:
|
|||
public:
|
||||
ScanBeam( Bool_Engine* GC );
|
||||
~ScanBeam();
|
||||
void SetType( Node* low, Node* high );
|
||||
void SetType( kbNode* low, kbNode* high );
|
||||
|
||||
bool FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes );
|
||||
bool RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes );
|
||||
bool FindNew( SCANTYPE scantype, TDLI<kbLink>* _I, bool& holes );
|
||||
bool RemoveOld( SCANTYPE scantype, TDLI<kbLink>* _I, bool& holes );
|
||||
|
||||
private:
|
||||
|
||||
bool ProcessHoles( bool atinsert, TDLI<KBoolLink>* _LI );
|
||||
bool ProcessHoles( bool atinsert, TDLI<kbLink>* _LI );
|
||||
int Process_LinkToLink_Crossings(); // find crossings
|
||||
int Process_PointToLink_Crossings();
|
||||
int Process_LinkToLink_Flat( KBoolLine* flatline );
|
||||
int Process_LinkToLink_Flat( kbLine* flatline );
|
||||
void SortTheBeam( bool backangle );
|
||||
bool checksort();
|
||||
bool writebeam();
|
||||
void Calc_Ysp();
|
||||
//int FindCloseLinksAndCross(TDLI<KBoolLink>* _I,Node* _lowf);
|
||||
//int FindCloseLinksAndCross(TDLI<kbLink>* _I,kbNode* _lowf);
|
||||
void Generate_INOUT( int graphnumber );
|
||||
|
||||
Node* _low;
|
||||
DL_Iter<Record*> _BI;
|
||||
kbNode* _low;
|
||||
DL_Iter<kbRecord*> _BI;
|
||||
int lastinserted;
|
||||
BEAM_TYPE _type;
|
||||
};
|
||||
|
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
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
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
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 $
|
||||
*/
|
||||
|
|
|
@ -1,17 +1,14 @@
|
|||
/*! \file kbool/samples/boolonly/boolonly.cpp
|
||||
/*! \file samples/boolonly/boolonly.cpp
|
||||
\brief boolonly demonstrates the use of the boolean algorithm
|
||||
\author Probably Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Probably Klaas Holwerda
|
||||
|
||||
Licence: wxWidgets Licence
|
||||
|
||||
RCS-ID: $Id: boolonly.cpp,v 1.9 2005/01/16 18:39:24 kire_putsje Exp $
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: boolonly.cpp,v 1.7 2009/05/28 19:49:48 titato Exp $
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "boolonly.h"
|
||||
|
||||
|
@ -24,7 +21,7 @@ KBoolPoint::KBoolPoint()
|
|||
_y = 0.0;
|
||||
}
|
||||
|
||||
KBoolPoint::KBoolPoint(double const X, double const Y)
|
||||
KBoolPoint::KBoolPoint( double const X, double const Y )
|
||||
{
|
||||
_x = X;
|
||||
_y = Y;
|
||||
|
@ -48,23 +45,23 @@ void ArmBoolEng( Bool_Engine* booleng )
|
|||
// set some global vals to arm the boolean engine
|
||||
double DGRID = 1000; // round coordinate X or Y value in calculations to this
|
||||
double MARGE = 0.001; // snap with in this range points to lines in the intersection routines
|
||||
// should always be > DGRID a MARGE >= 10*DGRID is oke
|
||||
// this is also used to remove small segments and to decide when
|
||||
// two segments are in line.
|
||||
// should always be > DGRID a MARGE >= 10*DGRID is oke
|
||||
// this is also used to remove small segments and to decide when
|
||||
// two segments are in line.
|
||||
double CORRECTIONFACTOR = 500.0; // correct the polygons by this number
|
||||
double CORRECTIONABER = 1.0; // the accuracy for the rounded shapes used in correction
|
||||
double ROUNDFACTOR = 1.5; // when will we round the correction shape to a circle
|
||||
double SMOOTHABER = 10.0; // accuracy when smoothing a polygon
|
||||
double MAXLINEMERGE = 1000.0; // leave as is, segments of this length in smoothen
|
||||
|
||||
|
||||
// DGRID is only meant to make fractional parts of input data which
|
||||
|
||||
// DGRID is only meant to make fractional parts of input data which
|
||||
// are doubles, part of the integers used in vertexes within the boolean algorithm.
|
||||
// Within the algorithm all input data is multiplied with DGRID
|
||||
|
||||
|
||||
// space for extra intersection inside the boolean algorithms
|
||||
// only change this if there are problems
|
||||
int GRID =10000;
|
||||
int GRID = 10000;
|
||||
|
||||
booleng->SetMarge( MARGE );
|
||||
booleng->SetGrid( GRID );
|
||||
|
@ -87,19 +84,21 @@ void AddPolygonsToBoolEng2( Bool_Engine* booleng )
|
|||
int numRowsAndCols = 120;
|
||||
int i, j;
|
||||
|
||||
for ( i = 0; i < numRowsAndCols; i++) {
|
||||
for ( j = 0; j < numRowsAndCols; j++) {
|
||||
for ( i = 0; i < numRowsAndCols; i++ )
|
||||
{
|
||||
for ( j = 0; j < numRowsAndCols; j++ )
|
||||
{
|
||||
// foreach point in a polygon ...
|
||||
if (booleng->StartPolygonAdd(GROUP_A))
|
||||
if ( booleng->StartPolygonAdd( GROUP_A ) )
|
||||
{
|
||||
// Counter-Clockwise
|
||||
booleng->AddPoint(x1,y1);
|
||||
booleng->AddPoint(x2,y1);
|
||||
booleng->AddPoint(x2,y2);
|
||||
booleng->AddPoint(x1,y2);
|
||||
booleng->AddPoint( x1, y1 );
|
||||
booleng->AddPoint( x2, y1 );
|
||||
booleng->AddPoint( x2, y2 );
|
||||
booleng->AddPoint( x1, y2 );
|
||||
|
||||
}
|
||||
booleng->EndPolygonAdd();
|
||||
booleng->EndPolygonAdd();
|
||||
x1 += pitch1;
|
||||
x2 += pitch1;
|
||||
}
|
||||
|
@ -116,19 +115,21 @@ void AddPolygonsToBoolEng2( Bool_Engine* booleng )
|
|||
y1 = 150;
|
||||
y2 = 250;
|
||||
|
||||
for ( i = 0; i < numRowsAndCols; i++) {
|
||||
for ( int j = 0; j < numRowsAndCols; j++) {
|
||||
for ( i = 0; i < numRowsAndCols; i++ )
|
||||
{
|
||||
for ( int j = 0; j < numRowsAndCols; j++ )
|
||||
{
|
||||
// foreach point in a polygon ...
|
||||
if (booleng->StartPolygonAdd(GROUP_B))
|
||||
if ( booleng->StartPolygonAdd( GROUP_B ) )
|
||||
{
|
||||
// Counter Clockwise
|
||||
booleng->AddPoint(x1,y1);
|
||||
booleng->AddPoint(x2,y1);
|
||||
booleng->AddPoint(x2,y2);
|
||||
booleng->AddPoint(x1,y2);
|
||||
booleng->AddPoint( x1, y1 );
|
||||
booleng->AddPoint( x2, y1 );
|
||||
booleng->AddPoint( x2, y2 );
|
||||
booleng->AddPoint( x1, y2 );
|
||||
|
||||
}
|
||||
booleng->EndPolygonAdd();
|
||||
booleng->EndPolygonAdd();
|
||||
x1 += pitch1;
|
||||
x2 += pitch1;
|
||||
}
|
||||
|
@ -145,68 +146,68 @@ void AddPolygonsToBoolEng2( Bool_Engine* booleng )
|
|||
void AddPolygonsToBoolEng( Bool_Engine* booleng )
|
||||
{
|
||||
// foreach point in a polygon ...
|
||||
if (booleng->StartPolygonAdd(GROUP_A))
|
||||
if ( booleng->StartPolygonAdd( GROUP_A ) )
|
||||
{
|
||||
booleng->AddPoint( 28237.480000, 396.364000 );
|
||||
booleng->AddPoint( 28237.980000, 394.121000 );
|
||||
booleng->AddPoint( 28242.000000, 395.699000 );
|
||||
booleng->AddPoint( 28240.830000, 397.679000 );
|
||||
}
|
||||
booleng->EndPolygonAdd();
|
||||
booleng->EndPolygonAdd();
|
||||
|
||||
// foreach point in a polygon ...
|
||||
if (booleng->StartPolygonAdd(GROUP_B))
|
||||
if ( booleng->StartPolygonAdd( GROUP_B ) )
|
||||
{
|
||||
booleng->AddPoint( 28242.100000, 398.491000 );
|
||||
booleng->AddPoint( 28240.580000, 397.485000 );
|
||||
booleng->AddPoint( 28237.910000, 394.381000 );
|
||||
}
|
||||
booleng->EndPolygonAdd();
|
||||
booleng->EndPolygonAdd();
|
||||
|
||||
if (booleng->StartPolygonAdd(GROUP_B))
|
||||
if ( booleng->StartPolygonAdd( GROUP_B ) )
|
||||
{
|
||||
booleng->AddPoint( 28243.440000, 399.709000 );
|
||||
booleng->AddPoint( 28237.910000, 394.381000 );
|
||||
booleng->AddPoint( 28239.290000, 394.763000 );
|
||||
}
|
||||
booleng->EndPolygonAdd();
|
||||
booleng->EndPolygonAdd();
|
||||
}
|
||||
|
||||
void AddPolygonsToBoolEng3( Bool_Engine* booleng )
|
||||
{
|
||||
// foreach point in a polygon ...
|
||||
if (booleng->StartPolygonAdd(GROUP_A))
|
||||
if ( booleng->StartPolygonAdd( GROUP_A ) )
|
||||
{
|
||||
booleng->AddPoint(100,100);
|
||||
booleng->AddPoint(-100,100);
|
||||
booleng->AddPoint(-100,-100);
|
||||
booleng->AddPoint(100,-100);
|
||||
booleng->AddPoint( 100, 100 );
|
||||
booleng->AddPoint( -100, 100 );
|
||||
booleng->AddPoint( -100, -100 );
|
||||
booleng->AddPoint( 100, -100 );
|
||||
}
|
||||
booleng->EndPolygonAdd();
|
||||
booleng->EndPolygonAdd();
|
||||
|
||||
// foreach point in a polygon ...
|
||||
if (booleng->StartPolygonAdd(GROUP_B))
|
||||
if ( booleng->StartPolygonAdd( GROUP_B ) )
|
||||
{
|
||||
booleng->AddPoint(50,50);
|
||||
booleng->AddPoint(-50,50);
|
||||
booleng->AddPoint(-50,-50);
|
||||
booleng->AddPoint(50,-50);
|
||||
booleng->AddPoint( 50, 50 );
|
||||
booleng->AddPoint( -50, 50 );
|
||||
booleng->AddPoint( -50, -50 );
|
||||
booleng->AddPoint( 50, -50 );
|
||||
booleng->EndPolygonAdd();
|
||||
}
|
||||
booleng->EndPolygonAdd();
|
||||
booleng->EndPolygonAdd();
|
||||
}
|
||||
|
||||
void AddPolygonsToBoolEng4( Bool_Engine* booleng )
|
||||
{
|
||||
// foreach point in a polygon ...
|
||||
if (booleng->StartPolygonAdd(GROUP_A))
|
||||
if ( booleng->StartPolygonAdd( GROUP_A ) )
|
||||
{
|
||||
booleng->AddPoint(0,0);
|
||||
booleng->AddPoint(0,1000);
|
||||
booleng->AddPoint(1000,1000);
|
||||
booleng->AddPoint(1000,0);
|
||||
booleng->AddPoint( 0, 0 );
|
||||
booleng->AddPoint( 0, 1000 );
|
||||
booleng->AddPoint( 1000, 1000 );
|
||||
booleng->AddPoint( 1000, 0 );
|
||||
}
|
||||
booleng->EndPolygonAdd();
|
||||
booleng->EndPolygonAdd();
|
||||
}
|
||||
|
||||
void GetPolygonsFromBoolEng( Bool_Engine* booleng )
|
||||
|
@ -217,8 +218,8 @@ void GetPolygonsFromBoolEng( Bool_Engine* booleng )
|
|||
// foreach point in the polygon
|
||||
while ( booleng->PolygonHasMorePoints() )
|
||||
{
|
||||
fprintf(stderr,"x = %f\t", booleng->GetPolygonXPoint());
|
||||
fprintf(stderr,"y = %f\n", booleng->GetPolygonYPoint());
|
||||
fprintf( stderr, "x = %f\t", booleng->GetPolygonXPoint() );
|
||||
fprintf( stderr, "y = %f\n", booleng->GetPolygonYPoint() );
|
||||
}
|
||||
booleng->EndPolygonGet();
|
||||
}
|
||||
|
@ -226,143 +227,147 @@ void GetPolygonsFromBoolEng( Bool_Engine* booleng )
|
|||
|
||||
void GetPolygonsFromBoolEngKEY( Bool_Engine* booleng )
|
||||
{
|
||||
FILE* file = fopen("keyfile.key", "w");
|
||||
FILE * file = fopen( "keyfile.key", "w" );
|
||||
|
||||
fprintf(file,"\
|
||||
HEADER 5; \
|
||||
BGNLIB; \
|
||||
LASTMOD {2-11-15 15:39:21}; \
|
||||
LASTACC {2-11-15 15:39:21}; \
|
||||
LIBNAME trial; \
|
||||
UNITS; \
|
||||
USERUNITS 0.0001; PHYSUNITS 2.54e-009; \
|
||||
\
|
||||
BGNSTR; \
|
||||
CREATION {2-11-15 15:39:21}; \
|
||||
LASTMOD {2-11-15 15:39:21}; \
|
||||
STRNAME top; \
|
||||
");
|
||||
fprintf( file, "\
|
||||
HEADER 5; \
|
||||
BGNLIB; \
|
||||
LASTMOD {2-11-15 15:39:21}; \
|
||||
LASTACC {2-11-15 15:39:21}; \
|
||||
LIBNAME trial; \
|
||||
UNITS; \
|
||||
USERUNITS 0.0001; PHYSUNITS 2.54e-009; \
|
||||
\
|
||||
BGNSTR; \
|
||||
CREATION {2-11-15 15:39:21}; \
|
||||
LASTMOD {2-11-15 15:39:21}; \
|
||||
STRNAME top; \
|
||||
");
|
||||
// foreach resultant polygon in the booleng ...
|
||||
while ( booleng->StartPolygonGet() )
|
||||
{
|
||||
fprintf(file,"BOUNDARY; LAYER 2; DATATYPE 0;\n");
|
||||
fprintf(file," XY %d; \n",booleng->GetNumPointsInPolygon()+1 );
|
||||
fprintf(file," XY % d; \n",booleng->GetNumPointsInPolygon()+1 );
|
||||
|
||||
booleng->PolygonHasMorePoints();
|
||||
double firstx = booleng->GetPolygonXPoint();
|
||||
double firsty = booleng->GetPolygonYPoint();
|
||||
fprintf(file,"X %f;\t", firstx);
|
||||
fprintf(file,"Y %f; \n", firsty);
|
||||
fprintf(file,"X % f;\t", firstx);
|
||||
fprintf(file,"Y % f; \n", firsty);
|
||||
|
||||
// foreach point in the polygon
|
||||
while ( booleng->PolygonHasMorePoints() )
|
||||
{
|
||||
fprintf(file,"X %f;\t", booleng->GetPolygonXPoint());
|
||||
fprintf(file,"Y %f; \n", booleng->GetPolygonYPoint());
|
||||
fprintf(file,"X % f;\t", booleng->GetPolygonXPoint());
|
||||
fprintf(file,"Y % f; \n", booleng->GetPolygonYPoint());
|
||||
}
|
||||
booleng->EndPolygonGet();
|
||||
fprintf(file,"X %f;\t", firstx);
|
||||
fprintf(file,"Y %f; \n", firsty);
|
||||
fprintf(file,"X % f;\t", firstx);
|
||||
fprintf(file,"Y % f; \n", firsty);
|
||||
fprintf(file,"ENDEL;\n");
|
||||
}
|
||||
|
||||
fprintf(file,"\
|
||||
ENDSTR top; \
|
||||
ENDLIB; \
|
||||
");
|
||||
fclose (file);
|
||||
fprintf(file,"\
|
||||
ENDSTR top; \
|
||||
ENDLIB; \
|
||||
");
|
||||
fclose (file);
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
printf( "------------------------------------------------------\n" );
|
||||
printf( "| Unit test of the KBool Engine |\n" );
|
||||
printf( " | Unit test of the KBool Engine | \n" );
|
||||
printf( "------------------------------------------------------\n" );
|
||||
|
||||
float correction;
|
||||
char a = '1';
|
||||
while (a != '0')
|
||||
{
|
||||
Bool_Engine* booleng = new Bool_Engine();
|
||||
ArmBoolEng( booleng );
|
||||
Bool_Engine* booleng = new Bool_Engine();
|
||||
ArmBoolEng( booleng );
|
||||
|
||||
AddPolygonsToBoolEng( booleng );
|
||||
AddPolygonsToBoolEng3( booleng );
|
||||
|
||||
printf( "\n***********************************\n" );
|
||||
printf( "*** version: %s \n", booleng->GetVersion() );
|
||||
printf( "***********************************\n" );
|
||||
printf( "1: OR operation\n" );
|
||||
printf( "2: AND operation\n" );
|
||||
printf( "3: EXOR operation\n" );
|
||||
printf( "4: A subtract B\n" );
|
||||
printf( "5: B subtract A\n" );
|
||||
printf( "6: Correct each polygon with a factor\n" );
|
||||
printf( "7: Smoothen each polygon\n" );
|
||||
printf( "8: Make a ring around each polygon\n" );
|
||||
printf( "9: No operation\n" );
|
||||
printf( "0: Quit\n" );
|
||||
printf( "***********************************\n" );
|
||||
printf( "\n***********************************\n" );
|
||||
printf( "*** version: % s \n", booleng->GetVersion().c_str() );
|
||||
printf( "***********************************\n" );
|
||||
printf( "1: OR operation\n" );
|
||||
printf( "2: AND operation\n" );
|
||||
printf( "3: EXOR operation\n" );
|
||||
printf( "4: A subtract B\n" );
|
||||
printf( "5: B subtract A\n" );
|
||||
printf( "6: Correct each polygon with a factor\n" );
|
||||
printf( "7: Smoothen each polygon\n" );
|
||||
printf( "8: Make a ring around each polygon\n" );
|
||||
printf( "9: No operation\n" );
|
||||
printf( "0: Quit\n" );
|
||||
printf( "***********************************\n" );
|
||||
|
||||
printf( "type a number and <return>" );
|
||||
scanf( "%c", &a );
|
||||
printf( "type a number and <return>" );
|
||||
scanf("%c", &a, 1);
|
||||
//scanf( " % c", &a );
|
||||
|
||||
switch (a)
|
||||
{
|
||||
case ('0'):
|
||||
break;
|
||||
case ('1'):
|
||||
booleng->Do_Operation(BOOL_OR);
|
||||
break;
|
||||
case ('2'):
|
||||
booleng->Do_Operation(BOOL_AND);
|
||||
break;
|
||||
case ('3'):
|
||||
booleng->Do_Operation(BOOL_EXOR);
|
||||
break;
|
||||
case ('4'):
|
||||
booleng->Do_Operation(BOOL_A_SUB_B);
|
||||
break;
|
||||
case ('5'):
|
||||
booleng->Do_Operation(BOOL_B_SUB_A);
|
||||
break;
|
||||
case ('6'):
|
||||
printf( "give correction factor (eg. 100.0 or -100.0)<return>:");
|
||||
scanf("%f", &correction ); // correct the polygons by this number
|
||||
booleng->SetCorrectionFactor( correction );
|
||||
booleng->Do_Operation(BOOL_CORRECTION);
|
||||
break;
|
||||
case ('7'):
|
||||
booleng->Do_Operation(BOOL_SMOOTHEN);
|
||||
break;
|
||||
case ('8'):
|
||||
printf("give width of ring <return>:");
|
||||
scanf("%f", &correction );
|
||||
// create a ring of this size
|
||||
booleng->SetCorrectionFactor( fabs( correction / 2.0) );
|
||||
booleng->Do_Operation(BOOL_MAKERING);
|
||||
break;
|
||||
case ('9'):
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (a)
|
||||
{
|
||||
case ('0'):
|
||||
{
|
||||
GetPolygonsFromBoolEng( booleng );
|
||||
break;
|
||||
}
|
||||
case ('1'):
|
||||
booleng->Do_Operation(BOOL_OR);
|
||||
break;
|
||||
case ('2'):
|
||||
booleng->Do_Operation(BOOL_AND);
|
||||
break;
|
||||
case ('3'):
|
||||
booleng->Do_Operation(BOOL_EXOR);
|
||||
break;
|
||||
case ('4'):
|
||||
booleng->Do_Operation(BOOL_A_SUB_B);
|
||||
break;
|
||||
case ('5'):
|
||||
booleng->Do_Operation(BOOL_B_SUB_A);
|
||||
break;
|
||||
case ('6'):
|
||||
printf( "give correction factor ( eg. 100.0 or - 100.0 )<return>: ");
|
||||
scanf(" % f", &correction ); // correct the polygons by this number
|
||||
booleng->SetCorrectionFactor( correction );
|
||||
booleng->Do_Operation(BOOL_CORRECTION);
|
||||
break;
|
||||
case ('7'):
|
||||
booleng->Do_Operation(BOOL_SMOOTHEN);
|
||||
break;
|
||||
case ('8'):
|
||||
printf("give width of ring <return>: ");
|
||||
scanf(" % f", &correction );
|
||||
// create a ring of this size
|
||||
booleng->SetCorrectionFactor( fabs( correction / 2.0) );
|
||||
booleng->Do_Operation(BOOL_MAKERING);
|
||||
break;
|
||||
case ('9'):
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (a != '0')
|
||||
{
|
||||
printf("\nresulting polygons\n" );
|
||||
if (a != '0')
|
||||
{
|
||||
printf("\nresulting polygons\n" );
|
||||
|
||||
GetPolygonsFromBoolEng( booleng );
|
||||
GetPolygonsFromBoolEng( booleng );
|
||||
|
||||
//OR USE THIS
|
||||
//GetPolygonsFromBoolEngKEY( booleng );
|
||||
//OR USE THIS
|
||||
//GetPolygonsFromBoolEngKEY( booleng );
|
||||
|
||||
printf( "\n\ntype a character and <return>");
|
||||
scanf( "%c", &a );
|
||||
}
|
||||
delete booleng;
|
||||
}
|
||||
printf( "\n\ntype a character and <return>");
|
||||
scanf( " % c", &a );
|
||||
}
|
||||
delete booleng;
|
||||
}
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,32 +1,28 @@
|
|||
/*! \file kbool/samples/boolonly/boolonly.h
|
||||
\author Probably Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Probably Klaas Holwerda
|
||||
|
||||
Licence: wxWidgets Licence
|
||||
|
||||
RCS-ID: $Id: boolonly.h,v 1.5 2005/05/24 19:13:38 titato Exp $
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: boolonly.h,v 1.5 2009/02/06 21:33:03 titato Exp $
|
||||
*/
|
||||
|
||||
#ifdef __GNUG__
|
||||
#pragma implementation
|
||||
#endif
|
||||
|
||||
#include "kbool/include/_lnk_itr.h"
|
||||
#include "kbool/include/booleng.h"
|
||||
#include "kbool/booleng.h"
|
||||
#include "kbool/_lnk_itr.h"
|
||||
|
||||
class KBoolPoint
|
||||
{
|
||||
public:
|
||||
public:
|
||||
|
||||
KBoolPoint();
|
||||
KBoolPoint(double const ,double const);
|
||||
double GetX();
|
||||
double GetY();
|
||||
KBoolPoint();
|
||||
KBoolPoint( double const , double const );
|
||||
double GetX();
|
||||
double GetY();
|
||||
|
||||
private:
|
||||
double _x;
|
||||
double _y;
|
||||
private:
|
||||
double _x;
|
||||
double _y;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -0,0 +1,2 @@
|
|||
mondrian ICON "sample.ico"
|
||||
#include "wx/msw/wx.rc"
|
|
@ -1,11 +1,11 @@
|
|||
/*! \file src/booleng.cpp
|
||||
\author Klaas Holwerda
|
||||
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: booleng.cpp,v 1.3 2008/06/04 21:23:22 titato Exp $
|
||||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: booleng.cpp,v 1.5 2009/09/07 19:23:28 titato Exp $
|
||||
*/
|
||||
|
||||
#include "kbool/booleng.h"
|
||||
|
@ -38,19 +38,10 @@ B_INT babs( B_INT a )
|
|||
//----------------- 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];
|
||||
_header = new char[LINELENGTH];
|
||||
if ( message )
|
||||
strcpy( _message, message );
|
||||
else
|
||||
strcpy( _message, "non specified" );
|
||||
|
||||
if ( header )
|
||||
strcpy( _header, header );
|
||||
else
|
||||
strcpy( _header, "non specified" );
|
||||
_message = message;
|
||||
_header = header;
|
||||
|
||||
_degree = degree;
|
||||
_fatal = fatal;
|
||||
|
@ -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 )
|
||||
{
|
||||
_message = new char[LINELENGTH];
|
||||
_header = new char[LINELENGTH];
|
||||
if ( a._message )
|
||||
strcpy( _message, a._message );
|
||||
else
|
||||
strcpy( _message, "non specified" );
|
||||
|
||||
if ( a._header )
|
||||
strcpy( _header, a._header );
|
||||
else
|
||||
strcpy( _header, "non specified" );
|
||||
_message = a._message;
|
||||
_header = a._header;
|
||||
|
||||
_degree = a._degree;
|
||||
_fatal = a._fatal;
|
||||
|
@ -78,18 +60,16 @@ Bool_Engine_Error::Bool_Engine_Error( const Bool_Engine_Error& a )
|
|||
|
||||
Bool_Engine_Error::~Bool_Engine_Error()
|
||||
{
|
||||
strcpy( _message, "" );
|
||||
strcpy( _header, "" );
|
||||
delete _message;
|
||||
delete _header;
|
||||
_message = "";
|
||||
_header = "";
|
||||
}
|
||||
|
||||
char* Bool_Engine_Error::GetErrorMessage()
|
||||
string Bool_Engine_Error::GetErrorMessage()
|
||||
{
|
||||
return _message;
|
||||
}
|
||||
|
||||
char* Bool_Engine_Error::GetHeaderMessage()
|
||||
string Bool_Engine_Error::GetHeaderMessage()
|
||||
{
|
||||
return _header;
|
||||
}
|
||||
|
@ -110,13 +90,13 @@ int Bool_Engine_Error::GetFatal()
|
|||
|
||||
Bool_Engine::Bool_Engine()
|
||||
{
|
||||
_linkiter = new TDLI<KBoolLink>();
|
||||
_linkiter = new TDLI<kbLink>();
|
||||
m_intersectionruns = 1;
|
||||
|
||||
m_orientationEntryMode = false;
|
||||
m_doLinkHoles = true;
|
||||
|
||||
m_graphlist = new GraphList( this );
|
||||
m_graphlist = new kbGraphList( this );
|
||||
m_ACCUR = 1e-4;
|
||||
m_WINDINGRULE = true;
|
||||
m_GraphToAdd = NULL;
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
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: ", text );
|
||||
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: ", text );
|
||||
|
@ -331,7 +311,7 @@ bool Bool_Engine::Do_Operation( BOOL_OP operation )
|
|||
{
|
||||
|
||||
#if KBOOL_DEBUG
|
||||
GraphList * saveme = new GraphList( m_graphlist );
|
||||
kbGraphList * saveme = new kbGraphList( m_graphlist );
|
||||
#endif
|
||||
|
||||
try
|
||||
|
@ -366,7 +346,7 @@ bool Bool_Engine::Do_Operation( BOOL_OP operation )
|
|||
|
||||
#if KBOOL_DEBUG
|
||||
delete m_graphlist;
|
||||
m_graphlist = new GraphList( saveme );
|
||||
m_graphlist = new kbGraphList( saveme );
|
||||
m_graphlist->WriteGraphsKEY( this );
|
||||
#endif
|
||||
|
||||
|
@ -384,7 +364,7 @@ bool Bool_Engine::Do_Operation( BOOL_OP operation )
|
|||
|
||||
#if KBOOL_DEBUG
|
||||
delete m_graphlist;
|
||||
m_graphlist = new GraphList( saveme );
|
||||
m_graphlist = new kbGraphList( saveme );
|
||||
m_graphlist->WriteGraphsKEY( this );
|
||||
#endif
|
||||
|
||||
|
@ -414,7 +394,7 @@ bool Bool_Engine::StartPolygonAdd( GroupType A_or_B )
|
|||
if ( m_GraphToAdd != NULL )
|
||||
return false;
|
||||
|
||||
Graph *myGraph = new Graph( this );
|
||||
kbGraph *myGraph = new kbGraph( this );
|
||||
m_graphlist->insbegin( myGraph );
|
||||
m_GraphToAdd = myGraph;
|
||||
m_groupType = A_or_B;
|
||||
|
@ -437,7 +417,7 @@ bool Bool_Engine::AddPoint( double x, double y )
|
|||
|
||||
B_INT rintx = ( ( B_INT ) ( x * 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
|
||||
if ( m_firstNodeToAdd == NULL )
|
||||
|
@ -451,8 +431,8 @@ bool Bool_Engine::AddPoint( double x, double y )
|
|||
}
|
||||
#endif
|
||||
|
||||
m_firstNodeToAdd = ( Node * ) myNode;
|
||||
m_lastNodeToAdd = ( Node * ) myNode;
|
||||
m_firstNodeToAdd = ( kbNode * ) myNode;
|
||||
m_lastNodeToAdd = ( kbNode * ) myNode;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -466,7 +446,7 @@ bool Bool_Engine::AddPoint( double x, double y )
|
|||
#endif
|
||||
|
||||
m_GraphToAdd->AddLink( m_lastNodeToAdd, myNode );
|
||||
m_lastNodeToAdd = ( Node * ) myNode;
|
||||
m_lastNodeToAdd = ( kbNode * ) myNode;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -489,7 +469,7 @@ bool Bool_Engine::StartPolygonGet()
|
|||
{
|
||||
if ( !m_graphlist->empty() )
|
||||
{
|
||||
m_getGraph = ( Graph* ) m_graphlist->headitem();
|
||||
m_getGraph = ( kbGraph* ) m_graphlist->headitem();
|
||||
m_getLink = m_getGraph->GetFirstLink();
|
||||
m_getNode = m_getLink->GetBeginNode();
|
||||
m_numPtsInPolygon = m_getGraph->GetNumberOfLinks();
|
||||
|
@ -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 )
|
||||
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 )
|
||||
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 )
|
||||
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 )
|
||||
return;
|
||||
|
||||
fprintf( m_logfile, fmt, bval );
|
||||
fprintf( m_logfile, fmt.c_str(), bval );
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -17,37 +17,37 @@
|
|||
//this here is to initialize the static iterator of graphlist
|
||||
//with NOLIST constructor
|
||||
|
||||
int graphsorterX( Graph *, Graph * );
|
||||
int graphsorterY( Graph *, Graph * );
|
||||
int graphsorterX( kbGraph *, kbGraph * );
|
||||
int graphsorterY( kbGraph *, kbGraph * );
|
||||
|
||||
GraphList::GraphList( Bool_Engine* GC )
|
||||
kbGraphList::kbGraphList( Bool_Engine* GC )
|
||||
{
|
||||
_GC = GC;
|
||||
}
|
||||
|
||||
GraphList::GraphList( GraphList* other )
|
||||
kbGraphList::kbGraphList( kbGraphList* other )
|
||||
{
|
||||
_GC = other->_GC;
|
||||
|
||||
TDLI<Graph> _LI = TDLI<Graph>( other );
|
||||
TDLI<kbGraph> _LI = TDLI<kbGraph>( other );
|
||||
_LI.tohead();
|
||||
while ( !_LI.hitroot() )
|
||||
{
|
||||
insend( new Graph( _LI.item() ) );
|
||||
insend( new kbGraph( _LI.item() ) );
|
||||
_LI++;
|
||||
}
|
||||
}
|
||||
|
||||
GraphList::~GraphList()
|
||||
kbGraphList::~kbGraphList()
|
||||
{
|
||||
TDLI<Graph> _LI = TDLI<Graph>( this );
|
||||
TDLI<kbGraph> _LI = TDLI<kbGraph>( this );
|
||||
//first empty the graph
|
||||
_LI.delete_all();
|
||||
}
|
||||
|
||||
//prepare the graphlist for the boolean operations
|
||||
//group all graphs into ONE graph
|
||||
void GraphList::Prepare( Graph* total )
|
||||
void kbGraphList::Prepare( kbGraph* total )
|
||||
{
|
||||
if ( empty() )
|
||||
return;
|
||||
|
@ -60,7 +60,7 @@ void GraphList::Prepare( Graph* total )
|
|||
|
||||
if ( ! _GC->GetOrientationEntryMode() )
|
||||
{
|
||||
TDLI<Graph> _LI = TDLI<Graph>( this );
|
||||
TDLI<kbGraph> _LI = TDLI<kbGraph>( this );
|
||||
_LI.tohead();
|
||||
while ( !_LI.hitroot() )
|
||||
{
|
||||
|
@ -78,9 +78,9 @@ void GraphList::Prepare( Graph* total )
|
|||
// 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
|
||||
// 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();
|
||||
while( !_LI.hitroot() )
|
||||
{
|
||||
|
@ -93,11 +93,11 @@ void GraphList::MakeOneGraph( Graph* total )
|
|||
//
|
||||
// Renumber all the graphs
|
||||
//
|
||||
void GraphList::Renumber()
|
||||
void kbGraphList::Renumber()
|
||||
{
|
||||
if ( _GC->GetOrientationEntryMode() )
|
||||
{
|
||||
TDLI<Graph> _LI = TDLI<Graph>( this );
|
||||
TDLI<kbGraph> _LI = TDLI<kbGraph>( this );
|
||||
_LI.tohead();
|
||||
while ( !_LI.hitroot() )
|
||||
{
|
||||
|
@ -111,7 +111,7 @@ void GraphList::Renumber()
|
|||
else
|
||||
{
|
||||
unsigned int Number = 1;
|
||||
TDLI<Graph> _LI = TDLI<Graph>( this );
|
||||
TDLI<kbGraph> _LI = TDLI<kbGraph>( this );
|
||||
_LI.tohead();
|
||||
while ( !_LI.hitroot() )
|
||||
{
|
||||
|
@ -123,10 +123,10 @@ void GraphList::Renumber()
|
|||
|
||||
|
||||
// Simplify the graphs
|
||||
void GraphList::Simplify( double marge )
|
||||
void kbGraphList::Simplify( double marge )
|
||||
{
|
||||
TDLI<Graph> _LI = TDLI<Graph>( this );
|
||||
_LI.foreach_mf( &Graph::Reset_Mark_and_Bin );
|
||||
TDLI<kbGraph> _LI = TDLI<kbGraph>( this );
|
||||
_LI.foreach_mf( &kbGraph::Reset_Mark_and_Bin );
|
||||
|
||||
_LI.tohead();
|
||||
while ( !_LI.hitroot() )
|
||||
|
@ -146,10 +146,10 @@ void GraphList::Simplify( double marge )
|
|||
}
|
||||
|
||||
// Smoothen the graphs
|
||||
void GraphList::Smoothen( double marge )
|
||||
void kbGraphList::Smoothen( double marge )
|
||||
{
|
||||
TDLI<Graph> _LI = TDLI<Graph>( this );
|
||||
_LI.foreach_mf( &Graph::Reset_Mark_and_Bin );
|
||||
TDLI<kbGraph> _LI = TDLI<kbGraph>( this );
|
||||
_LI.foreach_mf( &kbGraph::Reset_Mark_and_Bin );
|
||||
|
||||
_LI.tohead();
|
||||
while ( !_LI.hitroot() )
|
||||
|
@ -170,10 +170,10 @@ void GraphList::Smoothen( double marge )
|
|||
|
||||
|
||||
// Turn off all markers in all the graphs
|
||||
void GraphList::UnMarkAll()
|
||||
void kbGraphList::UnMarkAll()
|
||||
{
|
||||
TDLI<Graph> _LI = TDLI<Graph>( this );
|
||||
_LI.foreach_mf( &Graph::Reset_Mark_and_Bin );
|
||||
TDLI<kbGraph> _LI = TDLI<kbGraph>( this );
|
||||
_LI.foreach_mf( &kbGraph::Reset_Mark_and_Bin );
|
||||
}
|
||||
|
||||
//==============================================================================
|
||||
|
@ -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();
|
||||
|
||||
if ( _GC->GetInternalCorrectionFactor() ) //not zero
|
||||
|
@ -193,7 +193,7 @@ void GraphList::Correction()
|
|||
for( int i = 0; i < todo ; i++ )
|
||||
{
|
||||
//the input graph will be empty in the end
|
||||
GraphList *_correct = new GraphList( _GC );
|
||||
kbGraphList *_correct = new kbGraphList( _GC );
|
||||
{
|
||||
_LI.item()->MakeClockWise();
|
||||
_LI.item()->Correction( _correct, _GC->GetInternalCorrectionFactor() );
|
||||
|
@ -205,7 +205,7 @@ void GraphList::Correction()
|
|||
while ( !_correct->empty() )
|
||||
{
|
||||
//add to end
|
||||
_LI.insend( ( Graph* )_correct->headitem() );
|
||||
_LI.insend( ( kbGraph* )_correct->headitem() );
|
||||
_correct->removehead();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
|
||||
_LI.tohead();
|
||||
for( int i = 0; i < todo ; i++ )
|
||||
{
|
||||
//the input graph will be empty in the end
|
||||
GraphList *_ring = new GraphList( _GC );
|
||||
kbGraphList *_ring = new kbGraphList( _GC );
|
||||
{
|
||||
_LI.item()->MakeClockWise();
|
||||
_LI.item()->MakeRing( _ring, _GC->GetInternalCorrectionFactor() );
|
||||
|
@ -235,8 +235,8 @@ void GraphList::MakeRings()
|
|||
while ( !_ring->empty() )
|
||||
{
|
||||
//add to end
|
||||
( ( Graph* )_ring->headitem() )->MakeClockWise();
|
||||
_LI.insend( ( Graph* )_ring->headitem() );
|
||||
( ( kbGraph* )_ring->headitem() )->MakeClockWise();
|
||||
_LI.insend( ( kbGraph* )_ring->headitem() );
|
||||
_ring->removehead();
|
||||
}
|
||||
}
|
||||
|
@ -246,13 +246,13 @@ void GraphList::MakeRings()
|
|||
}
|
||||
|
||||
//merge the graphs in the list and return the merged result
|
||||
void GraphList::Merge()
|
||||
void kbGraphList::Merge()
|
||||
{
|
||||
if ( count() <= 1 )
|
||||
return;
|
||||
|
||||
{
|
||||
TDLI<Graph> _LI = TDLI<Graph>( this );
|
||||
TDLI<kbGraph> _LI = TDLI<kbGraph>( this );
|
||||
_LI.tohead();
|
||||
while ( !_LI.hitroot() )
|
||||
{
|
||||
|
@ -261,7 +261,7 @@ void GraphList::Merge()
|
|||
}
|
||||
}
|
||||
|
||||
Graph* _tomerge = new Graph( _GC );
|
||||
kbGraph* _tomerge = new kbGraph( _GC );
|
||||
|
||||
Renumber();
|
||||
|
||||
|
@ -279,14 +279,14 @@ void GraphList::Merge()
|
|||
#define SAVEME 1
|
||||
|
||||
//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" );
|
||||
|
||||
if ( count() == 0 )
|
||||
return;
|
||||
|
||||
Graph* _prepared = new Graph( _GC );
|
||||
kbGraph* _prepared = new kbGraph( _GC );
|
||||
|
||||
if ( empty() )
|
||||
return;
|
||||
|
@ -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();
|
||||
while( !_LI.hitroot() )
|
||||
{
|
||||
|
@ -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" );
|
||||
|
||||
|
@ -375,7 +375,7 @@ void GraphList::WriteGraphsKEY( Bool_Engine* GC )
|
|||
STRNAME top; \
|
||||
");
|
||||
|
||||
TDLI<Graph> _LI=TDLI<Graph>(this);
|
||||
TDLI<kbGraph> _LI=TDLI<kbGraph>(this);
|
||||
_LI.tohead();
|
||||
while(!_LI.hitroot())
|
||||
{
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
|
||||
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__
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: line.cpp,v 1.3 2008/06/04 21:23:22 titato Exp $
|
||||
RCS-ID: $Id: line.cpp,v 1.4 2009/09/07 19:23:28 titato Exp $
|
||||
*/
|
||||
|
||||
// Standard include files
|
||||
|
@ -25,7 +25,7 @@
|
|||
//
|
||||
// The default constructor
|
||||
//
|
||||
KBoolLine::KBoolLine( Bool_Engine* GC )
|
||||
kbLine::kbLine( Bool_Engine* GC )
|
||||
{
|
||||
m_GC = GC;
|
||||
m_AA = 0.0;
|
||||
|
@ -36,7 +36,7 @@ KBoolLine::KBoolLine( Bool_Engine* GC )
|
|||
m_valid_parameters = false;
|
||||
}
|
||||
|
||||
KBoolLine::~KBoolLine()
|
||||
kbLine::~kbLine()
|
||||
{
|
||||
if ( linecrosslist )
|
||||
delete linecrosslist;
|
||||
|
@ -45,7 +45,7 @@ KBoolLine::~KBoolLine()
|
|||
//
|
||||
// constructor with a link
|
||||
//
|
||||
KBoolLine::KBoolLine( KBoolLink *a_link, Bool_Engine* GC )
|
||||
kbLine::kbLine( kbLink *a_link, Bool_Engine* GC )
|
||||
{
|
||||
m_GC = GC;
|
||||
// a_link must exist
|
||||
|
@ -80,7 +80,7 @@ KBoolLine::KBoolLine( KBoolLink *a_link, Bool_Engine* GC )
|
|||
// 4: beginnode and endnode are crosspoints, no further investigation
|
||||
// 5: beginnode is a crosspoint, need further investigation
|
||||
// 6: endnode is a crosspoint, need further investigation
|
||||
int KBoolLine::ActionOnTable1( PointStatus Result_beginnode, PointStatus Result_endnode )
|
||||
int kbLine::ActionOnTable1( PointStatus Result_beginnode, PointStatus Result_endnode )
|
||||
{
|
||||
// Action 1.5 beginnode and endnode are crosspoints, no further investigation needed
|
||||
if (
|
||||
|
@ -196,7 +196,7 @@ int KBoolLine::ActionOnTable1( PointStatus Result_beginnode, PointStatus Result_
|
|||
// 2: endnode is a crosspoint
|
||||
// 3: beginnode is a crosspoint
|
||||
// 4: beginnode and endnode are crosspoints
|
||||
int KBoolLine::ActionOnTable2( PointStatus Result_beginnode, PointStatus Result_endnode )
|
||||
int kbLine::ActionOnTable2( PointStatus Result_beginnode, PointStatus Result_endnode )
|
||||
{
|
||||
// Action 2.5, beginnode and eindpoint are crosspoints
|
||||
if (
|
||||
|
@ -290,7 +290,7 @@ int KBoolLine::ActionOnTable2( PointStatus Result_beginnode, PointStatus Result_
|
|||
// the crossing will be put in the link, because the line will be destructed
|
||||
// after use of the variable
|
||||
//
|
||||
void KBoolLine::AddLineCrossing( B_INT X, B_INT Y, KBoolLine *other_line )
|
||||
void kbLine::AddLineCrossing( B_INT X, B_INT Y, kbLine *other_line )
|
||||
{
|
||||
// the other line must exist
|
||||
assert( other_line );
|
||||
|
@ -301,7 +301,7 @@ void KBoolLine::AddLineCrossing( B_INT X, B_INT Y, KBoolLine *other_line )
|
|||
|
||||
// Calculate the Y when the X is given
|
||||
//
|
||||
B_INT KBoolLine::Calculate_Y( B_INT X )
|
||||
B_INT kbLine::Calculate_Y( B_INT X )
|
||||
{
|
||||
// link must exist to get info about the nodes
|
||||
assert( m_link );
|
||||
|
@ -314,7 +314,7 @@ B_INT KBoolLine::Calculate_Y( B_INT X )
|
|||
return m_link->GetBeginNode()->GetY();
|
||||
}
|
||||
|
||||
B_INT KBoolLine::Calculate_Y_from_X( B_INT X )
|
||||
B_INT kbLine::Calculate_Y_from_X( B_INT X )
|
||||
{
|
||||
// link must exist to get info about the nodes
|
||||
assert( m_link );
|
||||
|
@ -327,7 +327,7 @@ B_INT KBoolLine::Calculate_Y_from_X( B_INT X )
|
|||
return m_link->GetBeginNode()->GetY();
|
||||
}
|
||||
|
||||
void KBoolLine::Virtual_Point( LPoint *a_point, double distance )
|
||||
void kbLine::Virtual_Point( kbLPoint *a_point, double distance )
|
||||
{
|
||||
// link must exist to get info about the nodes
|
||||
assert( m_link );
|
||||
|
@ -345,7 +345,7 @@ void KBoolLine::Virtual_Point( LPoint *a_point, double distance )
|
|||
//
|
||||
// Calculate the lineparameters for the line if nessecary
|
||||
//
|
||||
void KBoolLine::CalculateLineParameters()
|
||||
void kbLine::CalculateLineParameters()
|
||||
{
|
||||
// linkmust exist to get beginnode AND endnode
|
||||
assert( m_link );
|
||||
|
@ -353,7 +353,7 @@ void KBoolLine::CalculateLineParameters()
|
|||
// if not valid_parameters calculate the parameters
|
||||
if ( !m_valid_parameters )
|
||||
{
|
||||
Node * bp, *ep;
|
||||
kbNode * bp, *ep;
|
||||
double length;
|
||||
|
||||
// get the begin and endnode via the link
|
||||
|
@ -390,7 +390,7 @@ void KBoolLine::CalculateLineParameters()
|
|||
// return true : lines are crossing
|
||||
// false: lines are not crossing
|
||||
//
|
||||
int KBoolLine::CheckIntersect ( KBoolLine * lijn, double Marge )
|
||||
int kbLine::CheckIntersect ( kbLine * lijn, double Marge )
|
||||
{
|
||||
double distance = 0;
|
||||
// link must exist
|
||||
|
@ -405,7 +405,7 @@ int KBoolLine::CheckIntersect ( KBoolLine * lijn, double Marge )
|
|||
assert( !m_link );
|
||||
|
||||
int Take_Action1, Take_Action2, Total_Result;
|
||||
Node *bp, *ep;
|
||||
kbNode *bp, *ep;
|
||||
PointStatus Result_beginnode, Result_endnode;
|
||||
|
||||
bp = lijn->m_link->GetBeginNode();
|
||||
|
@ -440,9 +440,9 @@ int KBoolLine::CheckIntersect ( KBoolLine * lijn, double Marge )
|
|||
|
||||
//
|
||||
// Get the beginnode from the line
|
||||
// usage: Node *anode = a_line.GetBeginNode()
|
||||
// usage: kbNode *anode = a_line.GetBeginNode()
|
||||
//
|
||||
Node *KBoolLine::GetBeginNode()
|
||||
kbNode *kbLine::GetBeginNode()
|
||||
{
|
||||
// link must exist
|
||||
assert( m_link );
|
||||
|
@ -452,9 +452,9 @@ Node *KBoolLine::GetBeginNode()
|
|||
|
||||
//
|
||||
// Get the endnode from the line
|
||||
// usage: Node *anode = a_line.GetEndNode()
|
||||
// usage: kbNode *anode = a_line.GetEndNode()
|
||||
//
|
||||
Node *KBoolLine::GetEndNode()
|
||||
kbNode *kbLine::GetEndNode()
|
||||
{
|
||||
// link must exist
|
||||
assert( m_link );
|
||||
|
@ -468,7 +468,7 @@ Node *KBoolLine::GetEndNode()
|
|||
// return 0: If there are no crossings
|
||||
// 1: If there is one crossing
|
||||
// 2: If there are two crossings
|
||||
int KBoolLine::Intersect( KBoolLine * lijn, double Marge )
|
||||
int kbLine::Intersect( kbLine * lijn, double Marge )
|
||||
{
|
||||
double distance = 0;
|
||||
// lijn must exist
|
||||
|
@ -480,7 +480,7 @@ int KBoolLine::Intersect( KBoolLine * lijn, double Marge )
|
|||
if ( m_link->GetBeginNode() == m_link->GetEndNode() )
|
||||
assert( !m_link );
|
||||
|
||||
Node *bp, *ep;
|
||||
kbNode *bp, *ep;
|
||||
PointStatus Result_beginnode, Result_endnode;
|
||||
int Take_Action1, Take_Action2, Number_of_Crossings = 0;
|
||||
|
||||
|
@ -558,7 +558,7 @@ case 1: case 5: case 6:
|
|||
|
||||
|
||||
// Intersects two lines there must be a crossing
|
||||
int KBoolLine::Intersect_simple( KBoolLine * lijn )
|
||||
int kbLine::Intersect_simple( kbLine * lijn )
|
||||
{
|
||||
// lijn must exist
|
||||
assert( lijn );
|
||||
|
@ -577,7 +577,7 @@ int KBoolLine::Intersect_simple( KBoolLine * lijn )
|
|||
}
|
||||
|
||||
// Intersects two lines there must be a crossing
|
||||
bool KBoolLine::Intersect2( Node* crossing, KBoolLine * lijn )
|
||||
bool kbLine::Intersect2( kbNode* crossing, kbLine * lijn )
|
||||
{
|
||||
// lijn must exist
|
||||
assert( lijn );
|
||||
|
@ -606,7 +606,7 @@ bool KBoolLine::Intersect2( Node* crossing, KBoolLine * lijn )
|
|||
// ON_AREA, when point lies on the infinite line within a range
|
||||
// IN_AREA, when point lies in the area of the linesegment
|
||||
// the returnvalues are declared in (LINE.H)
|
||||
PointStatus KBoolLine::PointInLine( Node *a_node, double& Distance, double Marge )
|
||||
PointStatus kbLine::PointInLine( kbNode *a_node, double& Distance, double Marge )
|
||||
{
|
||||
Distance = 0;
|
||||
|
||||
|
@ -616,7 +616,7 @@ PointStatus KBoolLine::PointInLine( Node *a_node, double& Distance, double Marge
|
|||
assert( m_link );
|
||||
|
||||
// get the nodes form the line via the link
|
||||
Node *bp, *ep;
|
||||
kbNode *bp, *ep;
|
||||
bp = m_link->GetBeginNode();
|
||||
ep = m_link->GetEndNode();
|
||||
|
||||
|
@ -662,7 +662,7 @@ PointStatus KBoolLine::PointInLine( Node *a_node, double& Distance, double Marge
|
|||
// ON_AREA, when point lies on the infinite line within a range
|
||||
// RIGHT_SIDE, when point lies on the right side of the line
|
||||
// LEFT_SIDE , RIGHT_SIDE , ON_AREA
|
||||
PointStatus KBoolLine::PointOnLine( Node *a_node, double& Distance, double Marge )
|
||||
PointStatus kbLine::PointOnLine( kbNode *a_node, double& Distance, double Marge )
|
||||
{
|
||||
Distance = 0;
|
||||
|
||||
|
@ -672,7 +672,7 @@ PointStatus KBoolLine::PointOnLine( Node *a_node, double& Distance, double Marge
|
|||
assert( m_link );
|
||||
|
||||
// get the nodes from the line via the link
|
||||
Node *bp, *ep;
|
||||
kbNode *bp, *ep;
|
||||
bp = m_link->GetBeginNode();
|
||||
ep = m_link->GetEndNode();
|
||||
|
||||
|
@ -705,7 +705,7 @@ PointStatus KBoolLine::PointOnLine( Node *a_node, double& Distance, double Marge
|
|||
// Sets lines parameters
|
||||
// usage: a_line.Set(a_pointer_to_a_link);
|
||||
//
|
||||
void KBoolLine::Set( KBoolLink *a_link )
|
||||
void kbLine::Set( kbLink *a_link )
|
||||
{
|
||||
// points must exist
|
||||
assert( a_link );
|
||||
|
@ -719,7 +719,7 @@ void KBoolLine::Set( KBoolLink *a_link )
|
|||
m_valid_parameters = false;
|
||||
}
|
||||
|
||||
KBoolLink* KBoolLine::GetLink()
|
||||
kbLink* kbLine::GetLink()
|
||||
{
|
||||
return m_link;
|
||||
}
|
||||
|
@ -727,7 +727,7 @@ KBoolLink* KBoolLine::GetLink()
|
|||
// makes a line same as these
|
||||
// usage : line1 = line2;
|
||||
//
|
||||
KBoolLine& KBoolLine::operator=( const KBoolLine& a_line )
|
||||
kbLine& kbLine::operator=( const kbLine& a_line )
|
||||
{
|
||||
m_AA = a_line.m_AA;
|
||||
m_BB = a_line.m_BB;
|
||||
|
@ -738,37 +738,37 @@ KBoolLine& KBoolLine::operator=( const KBoolLine& a_line )
|
|||
return *this;
|
||||
}
|
||||
|
||||
Node* KBoolLine::OffsetContour( KBoolLine* const nextline, Node* _last_ins, double factor, Graph *shape )
|
||||
kbNode* kbLine::OffsetContour( kbLine* const nextline, kbNode* _last_ins, double factor, kbGraph *shape )
|
||||
{
|
||||
KBoolLink * offs_currentlink;
|
||||
KBoolLine offs_currentline( m_GC );
|
||||
KBoolLink* offs_nextlink;
|
||||
KBoolLine offs_nextline( m_GC );
|
||||
Node* offs_end;
|
||||
kbLink * offs_currentlink;
|
||||
kbLine offs_currentline( m_GC );
|
||||
kbLink* offs_nextlink;
|
||||
kbLine offs_nextline( m_GC );
|
||||
kbNode* offs_end;
|
||||
|
||||
Node* offs_bgn_next;
|
||||
Node* offs_end_next;
|
||||
kbNode* offs_bgn_next;
|
||||
kbNode* offs_end_next;
|
||||
|
||||
// make a node from this point
|
||||
offs_end = new Node( GetEndNode(), m_GC );
|
||||
offs_end = new kbNode( GetEndNode(), m_GC );
|
||||
Virtual_Point( offs_end, factor );
|
||||
offs_currentlink = new KBoolLink( 0, _last_ins, offs_end, m_GC );
|
||||
offs_currentlink = new kbLink( 0, _last_ins, offs_end, m_GC );
|
||||
offs_currentline.Set( offs_currentlink );
|
||||
|
||||
offs_bgn_next = new Node( nextline->m_link->GetBeginNode(), m_GC );
|
||||
offs_bgn_next = new kbNode( nextline->m_link->GetBeginNode(), m_GC );
|
||||
nextline->Virtual_Point( offs_bgn_next, factor );
|
||||
|
||||
offs_end_next = new Node( nextline->m_link->GetEndNode(), m_GC );
|
||||
offs_end_next = new kbNode( nextline->m_link->GetEndNode(), m_GC );
|
||||
nextline->Virtual_Point( offs_end_next, factor );
|
||||
|
||||
offs_nextlink = new KBoolLink( 0, offs_bgn_next, offs_end_next, m_GC );
|
||||
offs_nextlink = new kbLink( 0, offs_bgn_next, offs_end_next, m_GC );
|
||||
offs_nextline.Set( offs_nextlink );
|
||||
|
||||
offs_currentline.CalculateLineParameters();
|
||||
offs_nextline.CalculateLineParameters();
|
||||
offs_currentline.Intersect2( offs_end, &offs_nextline );
|
||||
|
||||
// make a link between the current and the previous and add this to graph
|
||||
// make a link between the current and the previous and add this to kbGraph
|
||||
shape->AddLink( offs_currentlink );
|
||||
|
||||
delete offs_nextlink;
|
||||
|
@ -777,35 +777,35 @@ Node* KBoolLine::OffsetContour( KBoolLine* const nextline, Node* _last_ins, doub
|
|||
}
|
||||
|
||||
|
||||
Node* KBoolLine::OffsetContour_rounded( KBoolLine* const nextline, Node* _last_ins, double factor, Graph *shape )
|
||||
kbNode* kbLine::OffsetContour_rounded( kbLine* const nextline, kbNode* _last_ins, double factor, kbGraph *shape )
|
||||
{
|
||||
KBoolLink * offs_currentlink;
|
||||
KBoolLine offs_currentline( m_GC );
|
||||
KBoolLink* offs_nextlink;
|
||||
KBoolLine offs_nextline( m_GC );
|
||||
Node* offs_end;
|
||||
Node* medial_axes_point = new Node( m_GC );
|
||||
Node* bu_last_ins = new Node( _last_ins, m_GC );
|
||||
kbLink * offs_currentlink;
|
||||
kbLine offs_currentline( m_GC );
|
||||
kbLink* offs_nextlink;
|
||||
kbLine offs_nextline( m_GC );
|
||||
kbNode* offs_end;
|
||||
kbNode* medial_axes_point = new kbNode( m_GC );
|
||||
kbNode* bu_last_ins = new kbNode( _last_ins, m_GC );
|
||||
|
||||
Node* offs_bgn_next;
|
||||
Node* offs_end_next;
|
||||
kbNode* offs_bgn_next;
|
||||
kbNode* offs_end_next;
|
||||
|
||||
// make a node from this point
|
||||
offs_end = new Node( GetEndNode(), m_GC );
|
||||
offs_end = new kbNode( GetEndNode(), m_GC );
|
||||
|
||||
*_last_ins = *GetBeginNode();
|
||||
Virtual_Point( _last_ins, factor );
|
||||
Virtual_Point( offs_end, factor );
|
||||
offs_currentlink = new KBoolLink( 0, _last_ins, offs_end, m_GC );
|
||||
offs_currentlink = new kbLink( 0, _last_ins, offs_end, m_GC );
|
||||
offs_currentline.Set( offs_currentlink );
|
||||
|
||||
offs_bgn_next = new Node( nextline->m_link->GetBeginNode(), m_GC );
|
||||
offs_bgn_next = new kbNode( nextline->m_link->GetBeginNode(), m_GC );
|
||||
nextline->Virtual_Point( offs_bgn_next, factor );
|
||||
|
||||
offs_end_next = new Node( nextline->m_link->GetEndNode(), m_GC );
|
||||
offs_end_next = new kbNode( nextline->m_link->GetEndNode(), m_GC );
|
||||
nextline->Virtual_Point( offs_end_next, factor );
|
||||
|
||||
offs_nextlink = new KBoolLink( 0, offs_bgn_next, offs_end_next, m_GC );
|
||||
offs_nextlink = new kbLink( 0, offs_bgn_next, offs_end_next, m_GC );
|
||||
offs_nextline.Set( offs_nextlink );
|
||||
|
||||
offs_currentline.CalculateLineParameters();
|
||||
|
@ -821,7 +821,7 @@ Node* KBoolLine::OffsetContour_rounded( KBoolLine* const nextline, Node* _last_i
|
|||
*offs_end = *medial_axes_point;
|
||||
delete medial_axes_point;
|
||||
delete bu_last_ins;
|
||||
// make a link between the current and the previous and add this to graph
|
||||
// make a link between the current and the previous and add this to kbGraph
|
||||
delete offs_nextlink;
|
||||
shape->AddLink( offs_currentlink );
|
||||
return( offs_end );
|
||||
|
@ -831,7 +831,7 @@ Node* KBoolLine::OffsetContour_rounded( KBoolLine* const nextline, Node* _last_i
|
|||
*_last_ins = *bu_last_ins;
|
||||
delete medial_axes_point;
|
||||
delete bu_last_ins;
|
||||
Node* endarc = new Node( offs_bgn_next, m_GC );
|
||||
kbNode* endarc = new kbNode( offs_bgn_next, m_GC );
|
||||
shape->AddLink( offs_currentlink );
|
||||
delete offs_nextlink;
|
||||
shape->CreateArc( GetEndNode(), &offs_currentline, endarc, fabs( factor ), m_GC->GetInternalCorrectionAber() );
|
||||
|
@ -840,7 +840,7 @@ Node* KBoolLine::OffsetContour_rounded( KBoolLine* const nextline, Node* _last_i
|
|||
}
|
||||
|
||||
|
||||
bool KBoolLine::OkeForContour( KBoolLine* const nextline, double factor, Node* LastLeft, Node* LastRight, LinkStatus& _outproduct )
|
||||
bool kbLine::OkeForContour( kbLine* const nextline, double factor, kbNode* LastLeft, kbNode* LastRight, LinkStatus& _outproduct )
|
||||
{
|
||||
assert( m_link );
|
||||
assert( m_valid_parameters );
|
||||
|
@ -852,7 +852,7 @@ bool KBoolLine::OkeForContour( KBoolLine* const nextline, double factor, Node* L
|
|||
// PointStatus status=ON_AREA;
|
||||
double distance = 0;
|
||||
|
||||
Node offs_end_next( nextline->m_link->GetEndNode(), m_GC );
|
||||
kbNode offs_end_next( nextline->m_link->GetEndNode(), m_GC );
|
||||
|
||||
_outproduct = m_link->OutProduct( nextline->m_link, m_GC->GetAccur() );
|
||||
|
||||
|
@ -899,9 +899,9 @@ bool KBoolLine::OkeForContour( KBoolLine* const nextline, double factor, Node* L
|
|||
}
|
||||
|
||||
|
||||
bool KBoolLine::Create_Ring_Shape( KBoolLine* nextline, Node** _last_ins_left, Node** _last_ins_right, double factor, Graph *shape )
|
||||
bool kbLine::Create_Ring_Shape( kbLine* nextline, kbNode** _last_ins_left, kbNode** _last_ins_right, double factor, kbGraph *shape )
|
||||
{
|
||||
Node * _current;
|
||||
kbNode * _current;
|
||||
LinkStatus _outproduct = IS_ON;
|
||||
|
||||
if ( OkeForContour( nextline, factor, *_last_ins_left, *_last_ins_right, _outproduct ) )
|
||||
|
@ -926,14 +926,14 @@ bool KBoolLine::Create_Ring_Shape( KBoolLine* nextline, Node** _last_ins_left, N
|
|||
case IS_ON :
|
||||
{
|
||||
// make a node from this point
|
||||
_current = new Node( m_link->GetEndNode(), m_GC );
|
||||
_current = new kbNode( m_link->GetEndNode(), m_GC );
|
||||
Virtual_Point( _current, factor );
|
||||
|
||||
// make a link between the current and the previous and add this to graph
|
||||
// make a link between the current and the previous and add this to kbGraph
|
||||
shape->AddLink( *_last_ins_left, _current );
|
||||
*_last_ins_left = _current;
|
||||
|
||||
_current = new Node( m_link->GetEndNode(), m_GC );
|
||||
_current = new kbNode( m_link->GetEndNode(), m_GC );
|
||||
Virtual_Point( _current, -factor );
|
||||
|
||||
shape->AddLink( *_last_ins_right, _current );
|
||||
|
@ -965,14 +965,14 @@ bool KBoolLine::Create_Ring_Shape( KBoolLine* nextline, Node** _last_ins_left, N
|
|||
case IS_ON :
|
||||
{
|
||||
// make a node from this point
|
||||
_current = new Node(m_link->GetEndNode());
|
||||
_current = new kbNode(m_link->GetEndNode());
|
||||
Virtual_Point(_current,factor);
|
||||
|
||||
// make a link between the current and the previous and add this to graph
|
||||
// make a link between the current and the previous and add this to kbGraph
|
||||
Ishape->AddLink(*_last_ins_left, _current);
|
||||
*_last_ins_left=_current;
|
||||
|
||||
_current = new Node(m_link->GetEndNode());
|
||||
_current = new kbNode(m_link->GetEndNode());
|
||||
Virtual_Point(_current,-factor);
|
||||
|
||||
Ishape->AddLink(*_last_ins_right, _current);
|
||||
|
@ -987,7 +987,7 @@ bool KBoolLine::Create_Ring_Shape( KBoolLine* nextline, Node** _last_ins_left, N
|
|||
}
|
||||
|
||||
|
||||
void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left, Node** _last_ins_right, double factor, Graph *shape )
|
||||
void kbLine::Create_Begin_Shape( kbLine* nextline, kbNode** _last_ins_left, kbNode** _last_ins_right, double factor, kbGraph *shape )
|
||||
{
|
||||
factor = fabs( factor );
|
||||
LinkStatus _outproduct;
|
||||
|
@ -997,11 +997,11 @@ void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left,
|
|||
{
|
||||
case IS_RIGHT :
|
||||
{
|
||||
*_last_ins_left = new Node( m_link->GetEndNode(), m_GC );
|
||||
*_last_ins_left = new kbNode( m_link->GetEndNode(), m_GC );
|
||||
|
||||
Virtual_Point( *_last_ins_left, factor );
|
||||
|
||||
*_last_ins_right = new Node( nextline->m_link->GetBeginNode(), m_GC );
|
||||
*_last_ins_right = new kbNode( nextline->m_link->GetBeginNode(), m_GC );
|
||||
nextline->Virtual_Point( *_last_ins_right, -factor );
|
||||
|
||||
shape->AddLink( *_last_ins_left, *_last_ins_right );
|
||||
|
@ -1011,10 +1011,10 @@ void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left,
|
|||
break;
|
||||
case IS_LEFT :
|
||||
{
|
||||
*_last_ins_left = new Node( nextline->m_link->GetBeginNode(), m_GC );
|
||||
*_last_ins_left = new kbNode( nextline->m_link->GetBeginNode(), m_GC );
|
||||
nextline->Virtual_Point( *_last_ins_left, factor );
|
||||
|
||||
*_last_ins_right = new Node( m_link->GetEndNode(), m_GC );
|
||||
*_last_ins_right = new kbNode( m_link->GetEndNode(), m_GC );
|
||||
Virtual_Point( *_last_ins_right, -factor );
|
||||
|
||||
shape->AddLink( *_last_ins_left, *_last_ins_right );
|
||||
|
@ -1025,10 +1025,10 @@ void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left,
|
|||
// Line 2 lies on this line
|
||||
case IS_ON :
|
||||
{
|
||||
*_last_ins_left = new Node( nextline->m_link->GetBeginNode(), m_GC );
|
||||
*_last_ins_left = new kbNode( nextline->m_link->GetBeginNode(), m_GC );
|
||||
Virtual_Point( *_last_ins_left, factor );
|
||||
|
||||
*_last_ins_right = new Node( nextline->m_link->GetBeginNode(), m_GC );
|
||||
*_last_ins_right = new kbNode( nextline->m_link->GetBeginNode(), m_GC );
|
||||
Virtual_Point( *_last_ins_right, -factor );
|
||||
|
||||
shape->AddLink( *_last_ins_left, *_last_ins_right );
|
||||
|
@ -1038,9 +1038,9 @@ void KBoolLine::Create_Begin_Shape( KBoolLine* nextline, Node** _last_ins_left,
|
|||
|
||||
}
|
||||
|
||||
void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Node* _last_ins_right, double factor, Graph *shape )
|
||||
void kbLine::Create_End_Shape( kbLine* nextline, kbNode* _last_ins_left, kbNode* _last_ins_right, double factor, kbGraph *shape )
|
||||
{
|
||||
Node * _current;
|
||||
kbNode * _current;
|
||||
factor = fabs( factor );
|
||||
LinkStatus _outproduct;
|
||||
_outproduct = m_link->OutProduct( nextline->m_link, m_GC->GetAccur() );
|
||||
|
@ -1049,7 +1049,7 @@ void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Nod
|
|||
{
|
||||
case IS_RIGHT :
|
||||
{
|
||||
_current = new Node( m_link->GetEndNode(), m_GC );
|
||||
_current = new kbNode( m_link->GetEndNode(), m_GC );
|
||||
Virtual_Point( _current, -factor );
|
||||
shape->AddLink( _last_ins_right, _current );
|
||||
_last_ins_right = _current;
|
||||
|
@ -1060,7 +1060,7 @@ void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Nod
|
|||
break;
|
||||
case IS_LEFT :
|
||||
{
|
||||
_current = new Node( m_link->GetEndNode(), m_GC );
|
||||
_current = new kbNode( m_link->GetEndNode(), m_GC );
|
||||
Virtual_Point( _current, factor );
|
||||
shape->AddLink( _last_ins_left, _current );
|
||||
_last_ins_left = _current;
|
||||
|
@ -1072,12 +1072,12 @@ void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Nod
|
|||
// Line 2 lies on this line
|
||||
case IS_ON :
|
||||
{
|
||||
_current = new Node( m_link->GetEndNode(), m_GC );
|
||||
_current = new kbNode( m_link->GetEndNode(), m_GC );
|
||||
Virtual_Point( _current, factor );
|
||||
shape->AddLink( _last_ins_left, _current );
|
||||
_last_ins_left = _current;
|
||||
|
||||
_current = new Node( m_link->GetEndNode(), m_GC );
|
||||
_current = new kbNode( m_link->GetEndNode(), m_GC );
|
||||
Virtual_Point( _current, -factor );
|
||||
shape->AddLink( _last_ins_right, _current );
|
||||
_last_ins_right = _current;
|
||||
|
@ -1090,11 +1090,11 @@ void KBoolLine::Create_End_Shape( KBoolLine* nextline, Node* _last_ins_left, Nod
|
|||
}
|
||||
|
||||
//
|
||||
// Generate from the found crossings a part of the graph
|
||||
// Generate from the found crossings a part of the kbGraph
|
||||
//
|
||||
bool KBoolLine::ProcessCrossings( TDLI<KBoolLink>* _LI )
|
||||
bool kbLine::ProcessCrossings( TDLI<kbLink>* _LI )
|
||||
{
|
||||
Node * last; KBoolLink *dummy;
|
||||
kbNode * last; kbLink *dummy;
|
||||
// assert (beginnode && endnode);
|
||||
|
||||
if ( !linecrosslist ) return false;
|
||||
|
@ -1106,11 +1106,11 @@ bool KBoolLine::ProcessCrossings( TDLI<KBoolLink>* _LI )
|
|||
// Make new links :
|
||||
while ( !linecrosslist->empty() )
|
||||
{
|
||||
dummy = new KBoolLink( m_link->GetGraphNum(), ( Node* ) linecrosslist->tailitem(), last, m_GC );
|
||||
dummy = new kbLink( m_link->GetGraphNum(), ( kbNode* ) linecrosslist->tailitem(), last, m_GC );
|
||||
dummy->SetBeenHere();
|
||||
dummy->SetGroup( m_link->Group() );
|
||||
_LI->insbegin( dummy );
|
||||
last = ( Node* )linecrosslist->tailitem();
|
||||
last = ( kbNode* )linecrosslist->tailitem();
|
||||
linecrosslist->removetail();
|
||||
}
|
||||
// Recycle this link :
|
||||
|
@ -1123,7 +1123,7 @@ bool KBoolLine::ProcessCrossings( TDLI<KBoolLink>* _LI )
|
|||
|
||||
/*
|
||||
// Sorts the links on the X values
|
||||
int NodeXYsorter(Node* a, Node* b)
|
||||
int NodeXYsorter(kbNode* a, kbNode* b)
|
||||
{
|
||||
if ( a->GetX() < b->GetX())
|
||||
return(1);
|
||||
|
@ -1147,11 +1147,11 @@ int NodeXYsorter(Node* a, Node* b)
|
|||
// The mostleft link most become the new link for the beam record
|
||||
// therefore the mostleft new/old link is returned to become the beam record link
|
||||
// also the part returned needs to have the bin flag set to the original value it had in the beam
|
||||
KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
|
||||
kbLink* kbLine::ProcessCrossingsSmart(TDLI<kbLink>* _LI)
|
||||
{
|
||||
Node *lastinserted;
|
||||
KBoolLink *new_link;
|
||||
KBoolLink *returnlink;
|
||||
kbNode *lastinserted;
|
||||
kbLink *new_link;
|
||||
kbLink *returnlink;
|
||||
assert (beginnode && endnode);
|
||||
if (!linecrosslist) return this;
|
||||
|
||||
|
@ -1168,7 +1168,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
|
|||
//re_use this link
|
||||
endnode->RemoveLink(this);
|
||||
linecrosslist->insend(endnode); //the last link to create is towards this node
|
||||
endnode=(Node*) linecrosslist->headitem();
|
||||
endnode=(kbNode*) linecrosslist->headitem();
|
||||
endnode->AddLink(this);
|
||||
inbeam=NodeXYsorter(_LI->item()->beginnode,beginnode);
|
||||
switch (inbeam)
|
||||
|
@ -1188,7 +1188,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
|
|||
// Make new links starting at endnode
|
||||
while (!linecrosslist->empty())
|
||||
{
|
||||
new_link=new KBoolLink(graphnum,lastinserted,(Node*) linecrosslist->headitem());
|
||||
new_link=new kbLink(graphnum,lastinserted,(kbNode*) linecrosslist->headitem());
|
||||
|
||||
new_link->group=group;
|
||||
int inbeam=NodeXYsorter(_LI->item()->beginnode,lastinserted);
|
||||
|
@ -1198,8 +1198,8 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
|
|||
{
|
||||
double x,y,xl,yl;
|
||||
char buf[80];
|
||||
x=((Node*)(linecrosslist->headitem()))->GetX();
|
||||
y=((Node*)(linecrosslist->headitem()))->GetY();
|
||||
x=((kbNode*)(linecrosslist->headitem()))->GetX();
|
||||
y=((kbNode*)(linecrosslist->headitem()))->GetY();
|
||||
xl=_LI->item()->beginnode->GetX();
|
||||
yl=_LI->item()->beginnode->GetY();
|
||||
sprintf(buf," x=%f , y=%f inserted before %f,%f",x,y,xl,yl);
|
||||
|
@ -1238,7 +1238,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
|
|||
_LI->insbefore_unsave(new_link);
|
||||
if (insert==0 && _LI->item()->beginnode!=new_link->beginnode)
|
||||
//the begin nodes are equal but not the same merge them into one node
|
||||
{ Node* todelete=_LI->item()->beginnode;
|
||||
{ kbNode* todelete=_LI->item()->beginnode;
|
||||
new_link->beginnode->Merge(todelete);
|
||||
delete todelete;
|
||||
}
|
||||
|
@ -1247,7 +1247,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
|
|||
(*_LI) << (i+1);
|
||||
}
|
||||
|
||||
lastinserted=(Node*)linecrosslist->headitem();
|
||||
lastinserted=(kbNode*)linecrosslist->headitem();
|
||||
linecrosslist->removehead();
|
||||
}
|
||||
}
|
||||
|
@ -1256,7 +1256,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
|
|||
//re_use this link
|
||||
endnode->RemoveLink(this);
|
||||
linecrosslist->insend(endnode); //the last link to create is towards this node
|
||||
endnode=(Node*) linecrosslist->headitem();
|
||||
endnode=(kbNode*) linecrosslist->headitem();
|
||||
endnode->AddLink(this);
|
||||
inbeam=NodeXYsorter(_LI->item()->beginnode,endnode);
|
||||
switch (inbeam)
|
||||
|
@ -1277,10 +1277,10 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
|
|||
// Make new links starting at endnode
|
||||
while (!linecrosslist->empty())
|
||||
{
|
||||
new_link=new KBoolLink(graphnum,lastinserted,(Node*) linecrosslist->headitem());
|
||||
new_link=new kbLink(graphnum,lastinserted,(kbNode*) linecrosslist->headitem());
|
||||
new_link->group=group;
|
||||
|
||||
inbeam=NodeXYsorter(_LI->item()->beginnode,(Node*) linecrosslist->headitem());
|
||||
inbeam=NodeXYsorter(_LI->item()->beginnode,(kbNode*) linecrosslist->headitem());
|
||||
switch (inbeam)
|
||||
{
|
||||
case -1:
|
||||
|
@ -1335,7 +1335,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
|
|||
_LI->insbefore_unsave(new_link);
|
||||
if (insert==0 && _LI->item()->beginnode!=new_link->beginnode)
|
||||
//the begin nodes are equal but not the same merge them into one node
|
||||
{ Node* todelete=_LI->item()->beginnode;
|
||||
{ kbNode* todelete=_LI->item()->beginnode;
|
||||
new_link->beginnode->Merge(todelete);
|
||||
delete todelete;
|
||||
}
|
||||
|
@ -1343,7 +1343,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
|
|||
(*_LI) << (i+1);
|
||||
}
|
||||
|
||||
lastinserted=(Node*)linecrosslist->headitem();
|
||||
lastinserted=(kbNode*)linecrosslist->headitem();
|
||||
linecrosslist->removehead();
|
||||
}
|
||||
}
|
||||
|
@ -1354,7 +1354,7 @@ KBoolLink* KBoolLine::ProcessCrossingsSmart(TDLI<KBoolLink>* _LI)
|
|||
}
|
||||
*/
|
||||
|
||||
static int NODE_X_ASCENDING_L ( Node* a, Node* b )
|
||||
static int NODE_X_ASCENDING_L ( kbNode* a, kbNode* b )
|
||||
{
|
||||
if( b->GetX() > a->GetX() ) return( 1 );
|
||||
else
|
||||
|
@ -1363,7 +1363,7 @@ static int NODE_X_ASCENDING_L ( Node* a, Node* b )
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
static int NODE_X_DESCENDING_L( Node* a, Node* b )
|
||||
static int NODE_X_DESCENDING_L( kbNode* a, kbNode* b )
|
||||
{
|
||||
if( a->GetX() > b->GetX() ) return( 1 );
|
||||
else
|
||||
|
@ -1372,7 +1372,7 @@ static int NODE_X_DESCENDING_L( Node* a, Node* b )
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
static int NODE_Y_ASCENDING_L ( Node* a, Node* b )
|
||||
static int NODE_Y_ASCENDING_L ( kbNode* a, kbNode* b )
|
||||
{
|
||||
if( b->GetY() > a->GetY() ) return( 1 );
|
||||
else
|
||||
|
@ -1380,7 +1380,7 @@ static int NODE_Y_ASCENDING_L ( Node* a, Node* b )
|
|||
return( -1 );
|
||||
}
|
||||
|
||||
static int NODE_Y_DESCENDING_L( Node* a, Node* b )
|
||||
static int NODE_Y_DESCENDING_L( kbNode* a, kbNode* b )
|
||||
{
|
||||
if( a->GetY() > b->GetY() ) return( 1 );
|
||||
else
|
||||
|
@ -1393,9 +1393,9 @@ static int NODE_Y_DESCENDING_L( Node* a, Node* b )
|
|||
// This function finds out which sortfunction to use with sorting
|
||||
// the crossings.
|
||||
//
|
||||
void KBoolLine::SortLineCrossings()
|
||||
void kbLine::SortLineCrossings()
|
||||
{
|
||||
TDLI<Node> I( linecrosslist );
|
||||
TDLI<kbNode> I( linecrosslist );
|
||||
|
||||
B_INT dx, dy;
|
||||
dx = babs( m_link->GetEndNode()->GetX() - m_link->GetBeginNode()->GetX() );
|
||||
|
@ -1419,7 +1419,7 @@ void KBoolLine::SortLineCrossings()
|
|||
//
|
||||
// Adds a cross Node to this. a_node may not be deleted before processing the crossings
|
||||
//
|
||||
void KBoolLine::AddCrossing( Node *a_node )
|
||||
void kbLine::AddCrossing( kbNode *a_node )
|
||||
{
|
||||
if ( a_node == m_link->GetBeginNode() || a_node == m_link->GetEndNode() ) return;
|
||||
|
||||
|
@ -1431,7 +1431,7 @@ void KBoolLine::AddCrossing( Node *a_node )
|
|||
}
|
||||
else
|
||||
{
|
||||
TDLI<Node> I( linecrosslist );
|
||||
TDLI<kbNode> I( linecrosslist );
|
||||
if ( !I.has( a_node ) )
|
||||
I.insend( a_node );
|
||||
}
|
||||
|
@ -1440,21 +1440,21 @@ void KBoolLine::AddCrossing( Node *a_node )
|
|||
//
|
||||
// see above
|
||||
//
|
||||
Node* KBoolLine::AddCrossing( B_INT X, B_INT Y )
|
||||
kbNode* kbLine::AddCrossing( B_INT X, B_INT Y )
|
||||
{
|
||||
Node * result = new Node( X, Y, m_GC );
|
||||
kbNode * result = new kbNode( X, Y, m_GC );
|
||||
AddCrossing( result );
|
||||
return result;
|
||||
}
|
||||
|
||||
DL_List<void*>* KBoolLine::GetCrossList()
|
||||
DL_List<void*>* kbLine::GetCrossList()
|
||||
{
|
||||
if ( linecrosslist )
|
||||
return linecrosslist;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool KBoolLine::CrossListEmpty()
|
||||
bool kbLine::CrossListEmpty()
|
||||
{
|
||||
if ( linecrosslist )
|
||||
return linecrosslist->empty();
|
||||
|
@ -1462,11 +1462,11 @@ bool KBoolLine::CrossListEmpty()
|
|||
}
|
||||
|
||||
/*
|
||||
bool KBoolLine::HasInCrossList(Node *n)
|
||||
bool kbLine::HasInCrossList(kbNode *n)
|
||||
{
|
||||
if(linecrosslist!=NULL)
|
||||
{
|
||||
TDLI<Node> I(linecrosslist);
|
||||
TDLI<kbNode> I(linecrosslist);
|
||||
return I.has(n);
|
||||
}
|
||||
return false;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: link.cpp,v 1.3 2008/06/04 21:23:22 titato Exp $
|
||||
RCS-ID: $Id: link.cpp,v 1.4 2009/09/07 19:23:28 titato Exp $
|
||||
*/
|
||||
|
||||
#include "kbool/booleng.h"
|
||||
|
@ -19,12 +19,12 @@
|
|||
#include "kbool/graph.h"
|
||||
#include "kbool/graphlst.h"
|
||||
|
||||
int linkXYsorter( KBoolLink *, KBoolLink * );
|
||||
int linkXYsorter( kbLink *, kbLink * );
|
||||
|
||||
//
|
||||
// Default constructor
|
||||
//
|
||||
KBoolLink::KBoolLink( Bool_Engine* GC )
|
||||
kbLink::kbLink( Bool_Engine* GC )
|
||||
{
|
||||
_GC = GC;
|
||||
Reset();
|
||||
|
@ -34,7 +34,7 @@ KBoolLink::KBoolLink( Bool_Engine* GC )
|
|||
//
|
||||
// This constructor makes this link a valid part of a graph
|
||||
//
|
||||
KBoolLink::KBoolLink( int graphnr, Node *begin, Node *end, Bool_Engine* GC )
|
||||
kbLink::kbLink( int graphnr, kbNode *begin, kbNode *end, Bool_Engine* GC )
|
||||
{
|
||||
_GC = GC;
|
||||
Reset();
|
||||
|
@ -50,7 +50,7 @@ KBoolLink::KBoolLink( int graphnr, Node *begin, Node *end, Bool_Engine* GC )
|
|||
//
|
||||
// This constructor makes this link a valid part of a graph
|
||||
//
|
||||
KBoolLink::KBoolLink( Node *begin, Node *end, Bool_Engine* GC )
|
||||
kbLink::kbLink( kbNode *begin, kbNode *end, Bool_Engine* GC )
|
||||
{
|
||||
_GC = GC;
|
||||
Reset();
|
||||
|
@ -67,7 +67,7 @@ KBoolLink::KBoolLink( Node *begin, Node *end, Bool_Engine* GC )
|
|||
//
|
||||
// Destructor
|
||||
//
|
||||
KBoolLink::~KBoolLink()
|
||||
kbLink::~kbLink()
|
||||
{
|
||||
UnLink();
|
||||
}
|
||||
|
@ -75,13 +75,13 @@ KBoolLink::~KBoolLink()
|
|||
//
|
||||
// Checks whether the current algorithm has been on this link
|
||||
//
|
||||
bool KBoolLink::BeenHere()
|
||||
bool kbLink::BeenHere()
|
||||
{
|
||||
if ( m_bin ) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void KBoolLink::TakeOverOperationFlags( KBoolLink* link )
|
||||
void kbLink::TakeOverOperationFlags( kbLink* link )
|
||||
{
|
||||
m_merge_L = link->m_merge_L;
|
||||
m_a_substract_b_L = link->m_a_substract_b_L;
|
||||
|
@ -98,7 +98,7 @@ void KBoolLink::TakeOverOperationFlags( KBoolLink* link )
|
|||
//
|
||||
// Returns the next link from the argument
|
||||
//
|
||||
KBoolLink* KBoolLink::Forth( Node *node )
|
||||
kbLink* kbLink::Forth( kbNode *node )
|
||||
{
|
||||
assert( node == m_beginnode || node == m_endnode );
|
||||
return node->GetOtherLink( this );
|
||||
|
@ -107,7 +107,7 @@ KBoolLink* KBoolLink::Forth( Node *node )
|
|||
//
|
||||
// Returns the Beginnode
|
||||
//
|
||||
Node *KBoolLink::GetBeginNode()
|
||||
kbNode *kbLink::GetBeginNode()
|
||||
{
|
||||
return m_beginnode;
|
||||
}
|
||||
|
@ -115,17 +115,17 @@ Node *KBoolLink::GetBeginNode()
|
|||
//
|
||||
// Returns the endnode
|
||||
//
|
||||
Node* KBoolLink::GetEndNode()
|
||||
kbNode* kbLink::GetEndNode()
|
||||
{
|
||||
return m_endnode;
|
||||
}
|
||||
|
||||
Node* KBoolLink::GetLowNode()
|
||||
kbNode* kbLink::GetLowNode()
|
||||
{
|
||||
return ( ( m_beginnode->GetY() < m_endnode->GetY() ) ? m_beginnode : m_endnode );
|
||||
}
|
||||
|
||||
Node* KBoolLink::GetHighNode()
|
||||
kbNode* kbLink::GetHighNode()
|
||||
{
|
||||
return ( ( m_beginnode->GetY() > m_endnode->GetY() ) ? m_beginnode : m_endnode );
|
||||
}
|
||||
|
@ -133,61 +133,61 @@ Node* KBoolLink::GetHighNode()
|
|||
//
|
||||
// Returns the graphnumber
|
||||
//
|
||||
int KBoolLink::GetGraphNum()
|
||||
int kbLink::GetGraphNum()
|
||||
{
|
||||
return m_graphnum;
|
||||
}
|
||||
|
||||
bool KBoolLink::GetInc()
|
||||
bool kbLink::GetInc()
|
||||
{
|
||||
return m_Inc;
|
||||
// if (Inc) return true;
|
||||
// return false;
|
||||
}
|
||||
|
||||
void KBoolLink::SetInc( bool inc )
|
||||
void kbLink::SetInc( bool inc )
|
||||
{
|
||||
m_Inc = inc;
|
||||
// Inc=0;
|
||||
// if (inc) Inc=1;
|
||||
}
|
||||
|
||||
bool KBoolLink::GetLeftA()
|
||||
bool kbLink::GetLeftA()
|
||||
{
|
||||
return m_LeftA;
|
||||
}
|
||||
|
||||
void KBoolLink::SetLeftA( bool la )
|
||||
void kbLink::SetLeftA( bool la )
|
||||
{
|
||||
m_LeftA = la;
|
||||
}
|
||||
|
||||
bool KBoolLink::GetLeftB()
|
||||
bool kbLink::GetLeftB()
|
||||
{
|
||||
return m_LeftB;
|
||||
}
|
||||
|
||||
void KBoolLink::SetLeftB( bool lb )
|
||||
void kbLink::SetLeftB( bool lb )
|
||||
{
|
||||
m_LeftB = lb;
|
||||
}
|
||||
|
||||
bool KBoolLink::GetRightA()
|
||||
bool kbLink::GetRightA()
|
||||
{
|
||||
return m_RightA;
|
||||
}
|
||||
|
||||
void KBoolLink::SetRightA( bool ra )
|
||||
void kbLink::SetRightA( bool ra )
|
||||
{
|
||||
m_RightA = ra;
|
||||
}
|
||||
|
||||
bool KBoolLink::GetRightB()
|
||||
bool kbLink::GetRightB()
|
||||
{
|
||||
return m_RightB;
|
||||
}
|
||||
|
||||
void KBoolLink::SetRightB( bool rb )
|
||||
void kbLink::SetRightB( bool rb )
|
||||
{
|
||||
m_RightB = rb;
|
||||
}
|
||||
|
@ -196,7 +196,7 @@ void KBoolLink::SetRightB( bool rb )
|
|||
// This function is very popular by GP-faults
|
||||
// It returns the node different from a
|
||||
//
|
||||
Node* KBoolLink::GetOther( const Node *const a )
|
||||
kbNode* kbLink::GetOther( const kbNode *const a )
|
||||
{
|
||||
return ( ( a != m_beginnode ) ? m_beginnode : m_endnode );
|
||||
}
|
||||
|
@ -205,7 +205,7 @@ Node* KBoolLink::GetOther( const Node *const a )
|
|||
//
|
||||
// Is this marked for given operation
|
||||
//
|
||||
bool KBoolLink::IsMarked( BOOL_OP operation )
|
||||
bool kbLink::IsMarked( BOOL_OP operation )
|
||||
{
|
||||
switch ( operation )
|
||||
{
|
||||
|
@ -218,7 +218,7 @@ bool KBoolLink::IsMarked( BOOL_OP operation )
|
|||
}
|
||||
}
|
||||
|
||||
bool KBoolLink::IsMarkedLeft( BOOL_OP operation )
|
||||
bool kbLink::IsMarkedLeft( BOOL_OP operation )
|
||||
{
|
||||
switch ( operation )
|
||||
{
|
||||
|
@ -231,7 +231,7 @@ bool KBoolLink::IsMarkedLeft( BOOL_OP operation )
|
|||
}
|
||||
}
|
||||
|
||||
bool KBoolLink::IsMarkedRight( BOOL_OP operation )
|
||||
bool kbLink::IsMarkedRight( BOOL_OP operation )
|
||||
{
|
||||
switch ( operation )
|
||||
{
|
||||
|
@ -247,7 +247,7 @@ bool KBoolLink::IsMarkedRight( BOOL_OP operation )
|
|||
//
|
||||
// Is this a hole for given operation
|
||||
// beginnode must be to the left
|
||||
bool KBoolLink::IsHole( BOOL_OP operation )
|
||||
bool kbLink::IsHole( BOOL_OP operation )
|
||||
{
|
||||
|
||||
bool topsideA, topsideB;
|
||||
|
@ -271,13 +271,13 @@ bool KBoolLink::IsHole( BOOL_OP operation )
|
|||
//
|
||||
// Is this a part of a hole
|
||||
//
|
||||
bool KBoolLink::GetHole()
|
||||
bool kbLink::GetHole()
|
||||
{
|
||||
return ( m_hole );
|
||||
}
|
||||
|
||||
|
||||
void KBoolLink::SetHole( bool h )
|
||||
void kbLink::SetHole( bool h )
|
||||
{
|
||||
m_hole = h;
|
||||
}
|
||||
|
@ -286,7 +286,7 @@ void KBoolLink::SetHole( bool h )
|
|||
//
|
||||
// Is this not marked at all
|
||||
//
|
||||
bool KBoolLink::IsUnused()
|
||||
bool kbLink::IsUnused()
|
||||
{
|
||||
return
|
||||
!( m_merge_L || m_merge_R ||
|
||||
|
@ -297,13 +297,13 @@ bool KBoolLink::IsUnused()
|
|||
}
|
||||
|
||||
|
||||
bool KBoolLink::IsZero( B_INT marge )
|
||||
bool kbLink::IsZero( B_INT marge )
|
||||
{
|
||||
return ( m_beginnode->Equal( m_endnode, marge ) ) ;
|
||||
}
|
||||
|
||||
|
||||
bool KBoolLink::ShorterThan( B_INT marge )
|
||||
bool kbLink::ShorterThan( B_INT marge )
|
||||
{
|
||||
return ( m_beginnode->ShorterThan( m_endnode, marge ) ) ;
|
||||
}
|
||||
|
@ -312,7 +312,7 @@ bool KBoolLink::ShorterThan( B_INT marge )
|
|||
//
|
||||
// Mark this link
|
||||
//
|
||||
void KBoolLink::Mark()
|
||||
void kbLink::Mark()
|
||||
{
|
||||
m_mark = true;
|
||||
}
|
||||
|
@ -328,7 +328,7 @@ void KBoolLink::Mark()
|
|||
// The references to this link in the node will also be deleted
|
||||
// After doing that, link link can be deleted or be recycled.
|
||||
//
|
||||
void KBoolLink::MergeNodes( Node *const begin_or_end_node )
|
||||
void kbLink::MergeNodes( kbNode *const begin_or_end_node )
|
||||
{
|
||||
// assert(beginnode && endnode);
|
||||
// assert ((begin_or_end_node == beginnode)||(begin_or_end_node == endnode));
|
||||
|
@ -350,15 +350,15 @@ void KBoolLink::MergeNodes( Node *const begin_or_end_node )
|
|||
// Here Left and Right is defined as being left or right from
|
||||
// the this link towards the center (common) node
|
||||
//
|
||||
LinkStatus KBoolLink::OutProduct( KBoolLink* const two, double accur )
|
||||
LinkStatus kbLink::OutProduct( kbLink* const two, double accur )
|
||||
{
|
||||
Node * center;
|
||||
kbNode * center;
|
||||
double distance;
|
||||
if ( two->GetBeginNode()->Equal( two->GetEndNode(), 1 ) )
|
||||
assert( !two );
|
||||
if ( GetBeginNode()->Equal( GetEndNode(), 1 ) )
|
||||
assert( !this );
|
||||
KBoolLine* temp_line = new KBoolLine( this, _GC );
|
||||
kbLine* temp_line = new kbLine( this, _GC );
|
||||
|
||||
//the this link should connect to the other two link at at least one node
|
||||
if ( m_endnode == two->m_endnode || m_endnode == two->m_beginnode )
|
||||
|
@ -405,7 +405,7 @@ LinkStatus KBoolLink::OutProduct( KBoolLink* const two, double accur )
|
|||
// the second link
|
||||
// Result = IS_ON | IS_LEFT | IS_RIGHT
|
||||
//
|
||||
LinkStatus KBoolLink::PointOnCorner( KBoolLink* const two, KBoolLink* const third )
|
||||
LinkStatus kbLink::PointOnCorner( kbLink* const two, kbLink* const third )
|
||||
{
|
||||
LinkStatus
|
||||
TwoToOne, // Position of two to this line
|
||||
|
@ -413,7 +413,7 @@ LinkStatus KBoolLink::PointOnCorner( KBoolLink* const two, KBoolLink* const thir
|
|||
ThirdToTwo, // Position of third to two
|
||||
Result;
|
||||
|
||||
//m Node* center;
|
||||
//m kbNode* center;
|
||||
|
||||
//the this link should connect to the other two link at at least one node
|
||||
//m if (endnode==two->endnode || endnode==two->beginnode)
|
||||
|
@ -462,7 +462,7 @@ LinkStatus KBoolLink::PointOnCorner( KBoolLink* const two, KBoolLink* const thir
|
|||
//
|
||||
// Remove the reference from this link to a_node
|
||||
//
|
||||
void KBoolLink::Remove( Node *a_node )
|
||||
void kbLink::Remove( kbNode *a_node )
|
||||
{
|
||||
( m_beginnode == a_node ) ? m_beginnode = NULL : m_endnode = NULL;
|
||||
}
|
||||
|
@ -471,7 +471,7 @@ void KBoolLink::Remove( Node *a_node )
|
|||
//
|
||||
// Replace oldnode by newnode and correct the references
|
||||
//
|
||||
void KBoolLink::Replace( Node *oldnode, Node *newnode )
|
||||
void kbLink::Replace( kbNode *oldnode, kbNode *newnode )
|
||||
{
|
||||
if ( m_beginnode == oldnode )
|
||||
{
|
||||
|
@ -491,7 +491,7 @@ void KBoolLink::Replace( Node *oldnode, Node *newnode )
|
|||
//
|
||||
// Reset all values
|
||||
//
|
||||
void KBoolLink::Reset()
|
||||
void kbLink::Reset()
|
||||
{
|
||||
m_beginnode = 0;
|
||||
m_endnode = 0;
|
||||
|
@ -502,7 +502,7 @@ void KBoolLink::Reset()
|
|||
//
|
||||
// Reset all flags
|
||||
//
|
||||
void KBoolLink::Reset_flags()
|
||||
void kbLink::Reset_flags()
|
||||
{
|
||||
m_bin = false; // Marker for walking over the graph
|
||||
m_hole = false; // Is this a part of hole ?
|
||||
|
@ -525,7 +525,7 @@ void KBoolLink::Reset_flags()
|
|||
//
|
||||
// Refill this link by the arguments
|
||||
//
|
||||
void KBoolLink::Reset( Node *begin, Node *end, int graphnr )
|
||||
void kbLink::Reset( kbNode *begin, kbNode *end, int graphnr )
|
||||
{
|
||||
// Remove all the previous references
|
||||
UnLink();
|
||||
|
@ -540,29 +540,29 @@ void KBoolLink::Reset( Node *begin, Node *end, int graphnr )
|
|||
}
|
||||
|
||||
|
||||
void KBoolLink::Set( Node *begin, Node *end )
|
||||
void kbLink::Set( kbNode *begin, kbNode *end )
|
||||
{
|
||||
m_beginnode = begin;
|
||||
m_endnode = end;
|
||||
}
|
||||
|
||||
void KBoolLink::SetBeenHere()
|
||||
void kbLink::SetBeenHere()
|
||||
{
|
||||
m_bin = true;
|
||||
}
|
||||
|
||||
void KBoolLink::SetNotBeenHere()
|
||||
void kbLink::SetNotBeenHere()
|
||||
{
|
||||
m_bin = false;
|
||||
}
|
||||
|
||||
void KBoolLink::SetBeginNode( Node* new_node )
|
||||
void kbLink::SetBeginNode( kbNode* new_node )
|
||||
{
|
||||
m_beginnode = new_node;
|
||||
}
|
||||
|
||||
|
||||
void KBoolLink::SetEndNode( Node* new_node )
|
||||
void kbLink::SetEndNode( kbNode* new_node )
|
||||
{
|
||||
m_endnode = new_node;
|
||||
}
|
||||
|
@ -571,12 +571,12 @@ void KBoolLink::SetEndNode( Node* new_node )
|
|||
//
|
||||
// Sets the graphnumber to argument num
|
||||
//
|
||||
void KBoolLink::SetGraphNum( int num )
|
||||
void kbLink::SetGraphNum( int num )
|
||||
{
|
||||
m_graphnum = num;
|
||||
}
|
||||
|
||||
GroupType KBoolLink::Group()
|
||||
GroupType kbLink::Group()
|
||||
{
|
||||
return m_group;
|
||||
}
|
||||
|
@ -585,7 +585,7 @@ GroupType KBoolLink::Group()
|
|||
//
|
||||
// Reset the groupflag to argument groep
|
||||
//
|
||||
void KBoolLink::SetGroup( GroupType groep )
|
||||
void kbLink::SetGroup( GroupType groep )
|
||||
{
|
||||
m_group = groep;
|
||||
}
|
||||
|
@ -594,7 +594,7 @@ void KBoolLink::SetGroup( GroupType groep )
|
|||
//
|
||||
// Remove all references to this link and from this link
|
||||
//
|
||||
void KBoolLink::UnLink()
|
||||
void kbLink::UnLink()
|
||||
{
|
||||
if ( m_beginnode )
|
||||
{
|
||||
|
@ -611,13 +611,13 @@ void KBoolLink::UnLink()
|
|||
}
|
||||
|
||||
|
||||
void KBoolLink::UnMark()
|
||||
void kbLink::UnMark()
|
||||
{
|
||||
m_mark = false;
|
||||
m_bin = false;
|
||||
}
|
||||
|
||||
void KBoolLink::SetMark( bool value )
|
||||
void kbLink::SetMark( bool value )
|
||||
{
|
||||
m_mark = value;
|
||||
}
|
||||
|
@ -625,16 +625,16 @@ void KBoolLink::SetMark( bool value )
|
|||
//
|
||||
// general purpose mark checker
|
||||
//
|
||||
bool KBoolLink::IsMarked() { return m_mark; }
|
||||
bool kbLink::IsMarked() { return m_mark; }
|
||||
|
||||
void KBoolLink::SetTopHole( bool value ) { m_hole_top = value; }
|
||||
void kbLink::SetTopHole( bool value ) { m_hole_top = value; }
|
||||
|
||||
bool KBoolLink::IsTopHole() { return m_hole_top; }
|
||||
bool kbLink::IsTopHole() { return m_hole_top; }
|
||||
|
||||
//
|
||||
// Calculates the merge/substact/exor/intersect flags
|
||||
//
|
||||
void KBoolLink::SetLineTypes()
|
||||
void kbLink::SetLineTypes()
|
||||
{
|
||||
m_merge_R =
|
||||
m_a_substract_b_R =
|
||||
|
@ -681,12 +681,12 @@ void KBoolLink::SetLineTypes()
|
|||
|
||||
|
||||
//put in direction with a_node as beginnode
|
||||
void KBoolLink::Redirect( Node* a_node )
|
||||
void kbLink::Redirect( kbNode* a_node )
|
||||
{
|
||||
if ( a_node != m_beginnode )
|
||||
{
|
||||
// swap the begin- and endnode of the current link
|
||||
Node * dummy = m_beginnode;
|
||||
kbNode * dummy = m_beginnode;
|
||||
m_beginnode = m_endnode;
|
||||
m_endnode = dummy;
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*! \file src/lpoint.cpp
|
||||
\brief Definition of GDSII LPoint type structure
|
||||
\brief Definition of GDSII kbLPoint type structure
|
||||
\author Klaas Holwerda
|
||||
|
||||
Copyright: 2001-2004 (C) Klaas Holwerda
|
||||
|
@ -13,73 +13,73 @@
|
|||
#include <math.h>
|
||||
|
||||
// Constructors
|
||||
LPoint::LPoint()
|
||||
kbLPoint::kbLPoint()
|
||||
{
|
||||
_x = 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;
|
||||
_y = Y;
|
||||
}
|
||||
|
||||
|
||||
LPoint::LPoint( LPoint* const a_point )
|
||||
kbLPoint::kbLPoint( kbLPoint* const 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 );
|
||||
_x = a_point->_x;
|
||||
_y = a_point->_y;
|
||||
}
|
||||
|
||||
|
||||
B_INT LPoint::GetX()
|
||||
B_INT kbLPoint::GetX()
|
||||
{
|
||||
return _x;
|
||||
}
|
||||
|
||||
B_INT LPoint::GetY()
|
||||
B_INT kbLPoint::GetY()
|
||||
{
|
||||
return _y;
|
||||
}
|
||||
|
||||
|
||||
void LPoint::SetX( B_INT a_point_x )
|
||||
void kbLPoint::SetX( B_INT 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;
|
||||
}
|
||||
|
||||
|
||||
LPoint LPoint::GetPoint()
|
||||
kbLPoint kbLPoint::GetPoint()
|
||||
{
|
||||
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;
|
||||
_y = Y;
|
||||
}
|
||||
|
||||
|
||||
void LPoint::Set( const LPoint &a_point )
|
||||
void kbLPoint::Set( const kbLPoint &a_point )
|
||||
{
|
||||
_x = a_point._x;
|
||||
_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;
|
||||
|
||||
|
@ -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 ) );
|
||||
}
|
||||
|
||||
bool LPoint::ShorterThan( const LPoint a_point, B_INT Marge )
|
||||
bool kbLPoint::ShorterThan( const kbLPoint a_point, B_INT Marge )
|
||||
{
|
||||
double a, b;
|
||||
a = ( double ) ( a_point._x - _x );
|
||||
|
@ -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;
|
||||
a = ( double ) ( X - _x );
|
||||
|
@ -125,7 +125,7 @@ bool LPoint::ShorterThan( const B_INT X, const B_INT Y, B_INT Marge )
|
|||
// overload the assign (=) operator
|
||||
// usage : a_point = another_point;
|
||||
|
||||
LPoint &LPoint::operator=( const LPoint &other_point )
|
||||
kbLPoint &kbLPoint::operator=( const kbLPoint &other_point )
|
||||
{
|
||||
_x = other_point._x;
|
||||
_y = other_point._y;
|
||||
|
@ -136,7 +136,7 @@ LPoint &LPoint::operator=( const LPoint &other_point )
|
|||
// overload the + operator
|
||||
// usage : a_point = point1 + point2;
|
||||
|
||||
LPoint &LPoint::operator+( const LPoint &other_point )
|
||||
kbLPoint &kbLPoint::operator+( const kbLPoint &other_point )
|
||||
{
|
||||
_x += other_point._x;
|
||||
_y += other_point._y;
|
||||
|
@ -148,7 +148,7 @@ LPoint &LPoint::operator+( const LPoint &other_point )
|
|||
// overload the - operator
|
||||
// usage : a_point = point1 - point2;
|
||||
|
||||
LPoint &LPoint::operator-( const LPoint &other_point )
|
||||
kbLPoint &kbLPoint::operator-( const kbLPoint &other_point )
|
||||
{
|
||||
_x -= other_point._x;
|
||||
_y -= other_point._y;
|
||||
|
@ -159,7 +159,7 @@ LPoint &LPoint::operator-( const LPoint &other_point )
|
|||
// overload the * operator
|
||||
// usage: a_point = point1 * 100;
|
||||
|
||||
LPoint &LPoint::operator*( int factor )
|
||||
kbLPoint &kbLPoint::operator*( int factor )
|
||||
{
|
||||
_x *= factor;
|
||||
_y *= factor;
|
||||
|
@ -170,7 +170,7 @@ LPoint &LPoint::operator*( int factor )
|
|||
// overload the / operator
|
||||
// usage: a_point = point1 / 100;
|
||||
|
||||
LPoint &LPoint::operator/( int factor )
|
||||
kbLPoint &kbLPoint::operator/( int factor )
|
||||
{
|
||||
_x /= factor;
|
||||
_y /= factor;
|
||||
|
@ -181,7 +181,7 @@ LPoint &LPoint::operator/( int factor )
|
|||
// overload the compare (==) operator
|
||||
// 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 ) );
|
||||
}
|
||||
|
@ -190,7 +190,7 @@ int LPoint::operator==( const LPoint &other_point ) const
|
|||
// overload the diffrent (!=) operator
|
||||
// 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 ) );
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: node.cpp,v 1.3 2008/06/04 21:23:22 titato Exp $
|
||||
RCS-ID: $Id: node.cpp,v 1.4 2009/09/07 19:23:28 titato Exp $
|
||||
*/
|
||||
|
||||
#include "kbool/node.h"
|
||||
|
@ -16,31 +16,31 @@
|
|||
|
||||
//this here is to initialize the static iterator of node
|
||||
//with NOLIST constructor
|
||||
//TDLI<KBoolLink> Node::_linkiter=TDLI<KBoolLink>(_GC);
|
||||
//TDLI<kbLink> kbNode::_linkiter=TDLI<kbLink>(_GC);
|
||||
|
||||
Node::Node( Bool_Engine* GC ) : LPoint( 0, 0 )
|
||||
kbNode::kbNode( Bool_Engine* GC ) : kbLPoint( 0, 0 )
|
||||
{
|
||||
_GC = GC;
|
||||
_linklist = new DL_List<void*>();
|
||||
}
|
||||
|
||||
|
||||
Node::Node( B_INT const X, B_INT const Y, Bool_Engine* GC ) : LPoint( X, Y )
|
||||
kbNode::kbNode( B_INT const X, B_INT const Y, Bool_Engine* GC ) : kbLPoint( X, Y )
|
||||
{
|
||||
_GC = GC;
|
||||
_linklist = new DL_List<void*>();
|
||||
}
|
||||
|
||||
|
||||
Node::Node( LPoint* const a_point, Bool_Engine* GC ) : LPoint( a_point )
|
||||
kbNode::kbNode( kbLPoint* const a_point, Bool_Engine* GC ) : kbLPoint( a_point )
|
||||
{
|
||||
_GC = GC;
|
||||
_linklist = new DL_List<void*>();
|
||||
}
|
||||
|
||||
|
||||
//Node::Node(Node * const other) : LPoint(other)
|
||||
Node::Node( Node * const other, Bool_Engine* GC )
|
||||
//kbNode::kbNode(kbNode * const other) : kbLPoint(other)
|
||||
kbNode::kbNode( kbNode * const other, Bool_Engine* GC )
|
||||
{
|
||||
_GC = GC;
|
||||
_x = other->_x;
|
||||
|
@ -48,7 +48,7 @@ Node::Node( Node * const other, Bool_Engine* GC )
|
|||
_linklist = new DL_List<void*>();
|
||||
}
|
||||
|
||||
Node& Node::operator=( const Node &other_node )
|
||||
kbNode& kbNode::operator=( const kbNode &other_node )
|
||||
{
|
||||
_x = other_node._x;
|
||||
_y = other_node._y;
|
||||
|
@ -59,64 +59,64 @@ Node& Node::operator=( const Node &other_node )
|
|||
|
||||
// x and y of the point will be rounded to the nearest
|
||||
// xnew=N*grid and ynew=N*grid
|
||||
void Node::RoundInt( B_INT grid )
|
||||
void kbNode::RoundInt( B_INT grid )
|
||||
{
|
||||
_x = ( B_INT ) floor( ( _x + grid * 0.5 ) / grid ) * grid;
|
||||
_y = ( B_INT ) floor( ( _y + grid * 0.5 ) / grid ) * grid;
|
||||
}
|
||||
|
||||
Node::~Node()
|
||||
kbNode::~kbNode()
|
||||
{
|
||||
delete _linklist;
|
||||
}
|
||||
|
||||
DL_List<void*>* Node::GetLinklist()
|
||||
DL_List<void*>* kbNode::GetLinklist()
|
||||
{
|
||||
return _linklist;
|
||||
}
|
||||
|
||||
void Node::AddLink( KBoolLink *a_link )
|
||||
void kbNode::AddLink( kbLink *a_link )
|
||||
{
|
||||
// assert(a_link);
|
||||
_linklist->insbegin( a_link );
|
||||
}
|
||||
|
||||
KBoolLink* Node::GetIncomingLink()
|
||||
kbLink* kbNode::GetIncomingLink()
|
||||
{
|
||||
if ( ( ( KBoolLink* )_linklist->headitem() )->GetEndNode() == this )
|
||||
return ( KBoolLink* )_linklist->headitem();
|
||||
if ( ( ( kbLink* )_linklist->headitem() )->GetEndNode() == this )
|
||||
return ( kbLink* )_linklist->headitem();
|
||||
else
|
||||
return ( KBoolLink* )_linklist->tailitem();
|
||||
return ( kbLink* )_linklist->tailitem();
|
||||
}
|
||||
|
||||
KBoolLink* Node::GetOutgoingLink()
|
||||
kbLink* kbNode::GetOutgoingLink()
|
||||
{
|
||||
if ( ( ( KBoolLink* )_linklist->headitem() )->GetBeginNode() == this )
|
||||
return ( KBoolLink* )_linklist->headitem();
|
||||
if ( ( ( kbLink* )_linklist->headitem() )->GetBeginNode() == this )
|
||||
return ( kbLink* )_linklist->headitem();
|
||||
else
|
||||
return ( KBoolLink* )_linklist->tailitem();
|
||||
return ( kbLink* )_linklist->tailitem();
|
||||
}
|
||||
|
||||
//
|
||||
// Returns the number of connected links
|
||||
//
|
||||
int Node::GetNumberOfLinks()
|
||||
int kbNode::GetNumberOfLinks()
|
||||
{
|
||||
return _linklist->count();
|
||||
}
|
||||
|
||||
KBoolLink* Node::GetOtherLink( KBoolLink* prev )
|
||||
kbLink* kbNode::GetOtherLink( kbLink* prev )
|
||||
{
|
||||
if ( prev == ( KBoolLink* )_linklist->headitem() )
|
||||
return ( KBoolLink* )_linklist->tailitem();
|
||||
if ( prev == ( KBoolLink* )_linklist->tailitem() )
|
||||
return ( KBoolLink* )_linklist->headitem();
|
||||
if ( prev == ( kbLink* )_linklist->headitem() )
|
||||
return ( kbLink* )_linklist->tailitem();
|
||||
if ( prev == ( kbLink* )_linklist->tailitem() )
|
||||
return ( kbLink* )_linklist->headitem();
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
int Node::Merge( Node *other )
|
||||
int kbNode::Merge( kbNode *other )
|
||||
{
|
||||
if ( this == other ) //they are already merged dummy
|
||||
return 0;
|
||||
|
@ -127,8 +127,8 @@ int Node::Merge( Node *other )
|
|||
// otherwise there can't be a takeover, because for takeover there can't
|
||||
// be an iterator on other->_linklist;
|
||||
{
|
||||
TDLI<KBoolLink> Iother( other->_linklist );
|
||||
KBoolLink* temp;
|
||||
TDLI<kbLink> Iother( other->_linklist );
|
||||
kbLink* temp;
|
||||
|
||||
Counter = Iother.count();
|
||||
|
||||
|
@ -153,7 +153,7 @@ int Node::Merge( Node *other )
|
|||
}
|
||||
|
||||
|
||||
void Node::RemoveLink( KBoolLink *a_link )
|
||||
void kbNode::RemoveLink( kbLink *a_link )
|
||||
{
|
||||
// assert(a_link);
|
||||
_GC->_linkiter->Attach( _linklist );
|
||||
|
@ -172,7 +172,7 @@ void Node::RemoveLink( KBoolLink *a_link )
|
|||
// output: -
|
||||
// return: true if points can be simplified
|
||||
// false if points can't be simplified
|
||||
bool Node::Simplify( Node *First, Node *Second, B_INT Marge )
|
||||
bool kbNode::Simplify( kbNode *First, kbNode *Second, B_INT Marge )
|
||||
{
|
||||
double distance = 0;
|
||||
|
||||
|
@ -189,9 +189,9 @@ bool Node::Simplify( Node *First, Node *Second, B_INT Marge )
|
|||
// Used tmp_link.set here, because the link may not be linked in the graph,
|
||||
// because the point of the graphs are used, after use of the line we have
|
||||
//to set the link to zero so the nodes will not be destructed by exit of the function
|
||||
KBoolLink tmp_link( _GC );
|
||||
kbLink tmp_link( _GC );
|
||||
tmp_link.Set( First, Second );
|
||||
KBoolLine tmp_line( _GC );
|
||||
kbLine tmp_line( _GC );
|
||||
tmp_line.Set( &tmp_link );
|
||||
|
||||
// If third point is on the same line which is made from the first
|
||||
|
@ -215,7 +215,7 @@ bool Node::Simplify( Node *First, Node *Second, B_INT Marge )
|
|||
}
|
||||
|
||||
|
||||
KBoolLink* Node::GetNextLink()
|
||||
kbLink* kbNode::GetNextLink()
|
||||
{
|
||||
int Aantal = _linklist->count();
|
||||
|
||||
|
@ -225,7 +225,7 @@ KBoolLink* Node::GetNextLink()
|
|||
if ( Aantal == 1 )
|
||||
return NULL;
|
||||
int Marked_Counter = 0;
|
||||
KBoolLink *the_link = NULL;
|
||||
kbLink *the_link = NULL;
|
||||
|
||||
// count the marked links
|
||||
_GC->_linkiter->Attach( _linklist );
|
||||
|
@ -255,7 +255,7 @@ KBoolLink* Node::GetNextLink()
|
|||
}
|
||||
|
||||
|
||||
KBoolLink* Node::GetPrevLink()
|
||||
kbLink* kbNode::GetPrevLink()
|
||||
{
|
||||
int Aantal;
|
||||
if ( !_linklist )
|
||||
|
@ -270,7 +270,7 @@ KBoolLink* Node::GetPrevLink()
|
|||
return NULL;
|
||||
|
||||
int Marked_Counter = 0;
|
||||
KBoolLink *the_link = NULL;
|
||||
kbLink *the_link = NULL;
|
||||
|
||||
_GC->_linkiter->Attach( _linklist );
|
||||
// count the marked links
|
||||
|
@ -299,7 +299,7 @@ KBoolLink* Node::GetPrevLink()
|
|||
}
|
||||
}
|
||||
|
||||
bool Node::SameSides( KBoolLink* const prev , KBoolLink* const link, BOOL_OP operation )
|
||||
bool kbNode::SameSides( kbLink* const prev , kbLink* const link, BOOL_OP operation )
|
||||
{
|
||||
bool directedLeft;
|
||||
bool directedRight;
|
||||
|
@ -331,16 +331,16 @@ bool Node::SameSides( KBoolLink* const prev , KBoolLink* const link, BOOL_OP ope
|
|||
// on the node get the link
|
||||
// is the most right or left one
|
||||
// This function is used to collect the simple graphs from a graph
|
||||
KBoolLink* Node::GetMost( KBoolLink* const prev , LinkStatus whatside, BOOL_OP operation )
|
||||
kbLink* kbNode::GetMost( kbLink* const prev , LinkStatus whatside, BOOL_OP operation )
|
||||
{
|
||||
KBoolLink * reserve = 0;
|
||||
KBoolLink *Result = NULL, *link;
|
||||
Node* prevbegin = prev->GetOther( this );
|
||||
kbLink * reserve = 0;
|
||||
kbLink *Result = NULL, *link;
|
||||
kbNode* prevbegin = prev->GetOther( this );
|
||||
|
||||
if ( _linklist->count() == 2 ) // only two links to this node take the one != prev
|
||||
{
|
||||
if ( ( link = ( KBoolLink* )_linklist->headitem() ) == prev ) //this is NOT the one to go on
|
||||
link = ( KBoolLink* )_linklist->tailitem();
|
||||
if ( ( link = ( kbLink* )_linklist->headitem() ) == prev ) //this is NOT the one to go on
|
||||
link = ( kbLink* )_linklist->tailitem();
|
||||
if ( !link->BeenHere() && SameSides( prev, link, operation ) )
|
||||
//we are back where we started (bin is true) return Null
|
||||
return link;
|
||||
|
@ -349,7 +349,7 @@ KBoolLink* Node::GetMost( KBoolLink* const prev , LinkStatus whatside, BOOL_OP o
|
|||
|
||||
_GC->_linkiter->Attach( _linklist );
|
||||
_GC->_linkiter->tohead();
|
||||
//more then 2 links to the Node
|
||||
//more then 2 links to the kbNode
|
||||
while( !_GC->_linkiter->hitroot() )
|
||||
{
|
||||
link = _GC->_linkiter->item();
|
||||
|
@ -387,16 +387,16 @@ KBoolLink* Node::GetMost( KBoolLink* const prev , LinkStatus whatside, BOOL_OP o
|
|||
// on the node get the link
|
||||
// is the most right or left one
|
||||
// This function is used to collect the simple graphs from a graph
|
||||
KBoolLink* Node::GetMostHole( KBoolLink* const prev, LinkStatus whatside, BOOL_OP operation )
|
||||
kbLink* kbNode::GetMostHole( kbLink* const prev, LinkStatus whatside, BOOL_OP operation )
|
||||
{
|
||||
KBoolLink * reserve = 0;
|
||||
KBoolLink *Result = NULL, *link;
|
||||
Node* prevbegin = prev->GetOther( this );
|
||||
kbLink * reserve = 0;
|
||||
kbLink *Result = NULL, *link;
|
||||
kbNode* prevbegin = prev->GetOther( this );
|
||||
|
||||
if ( _linklist->count() == 2 ) // only two links to this node take the one != prev
|
||||
{
|
||||
if ( ( link = ( KBoolLink* )_linklist->headitem() ) == prev ) //this is NOT the one to go on
|
||||
link = ( KBoolLink* )_linklist->tailitem();
|
||||
if ( ( link = ( kbLink* )_linklist->headitem() ) == prev ) //this is NOT the one to go on
|
||||
link = ( kbLink* )_linklist->tailitem();
|
||||
if ( link->GetHole() && !link->GetHoleLink() && !link->BeenHere() && SameSides( prev, link, operation ) )
|
||||
//we are back where we started (bin is true) return Null
|
||||
return link;
|
||||
|
@ -405,7 +405,7 @@ KBoolLink* Node::GetMostHole( KBoolLink* const prev, LinkStatus whatside, BOOL_O
|
|||
|
||||
_GC->_linkiter->Attach( _linklist );
|
||||
_GC->_linkiter->tohead();
|
||||
//more then 2 links to the Node
|
||||
//more then 2 links to the kbNode
|
||||
while( !_GC->_linkiter->hitroot() )
|
||||
{
|
||||
link = _GC->_linkiter->item();
|
||||
|
@ -443,9 +443,9 @@ KBoolLink* Node::GetMostHole( KBoolLink* const prev, LinkStatus whatside, BOOL_O
|
|||
}
|
||||
|
||||
// this function gets the highest not flat link
|
||||
KBoolLink* Node::GetHoleLink( KBoolLink* const prev, bool checkbin, BOOL_OP operation )
|
||||
kbLink* kbNode::GetHoleLink( kbLink* const prev, bool checkbin, BOOL_OP operation )
|
||||
{
|
||||
KBoolLink * Result = NULL, *link;
|
||||
kbLink * Result = NULL, *link;
|
||||
|
||||
_GC->_linkiter->Attach( _linklist );
|
||||
|
||||
|
@ -467,9 +467,9 @@ KBoolLink* Node::GetHoleLink( KBoolLink* const prev, bool checkbin, BOOL_OP oper
|
|||
}
|
||||
|
||||
// this function gets the highest not flat link
|
||||
KBoolLink* Node::GetNotFlat()
|
||||
kbLink* kbNode::GetNotFlat()
|
||||
{
|
||||
KBoolLink * Result = NULL, *link;
|
||||
kbLink * Result = NULL, *link;
|
||||
|
||||
_GC->_linkiter->Attach( _linklist );
|
||||
|
||||
|
@ -519,9 +519,9 @@ KBoolLink* Node::GetNotFlat()
|
|||
|
||||
// on the node get the link that is not BIN
|
||||
// and that has the same graphnumber and is in same direction
|
||||
KBoolLink *Node::Follow( KBoolLink* const prev )
|
||||
kbLink *kbNode::Follow( kbLink* const prev )
|
||||
{
|
||||
KBoolLink * temp;
|
||||
kbLink * temp;
|
||||
_GC->_linkiter->Attach( _linklist );
|
||||
|
||||
_GC->_linkiter->tohead();
|
||||
|
@ -555,9 +555,9 @@ KBoolLink *Node::Follow( KBoolLink* const prev )
|
|||
// this function gets the highest (other node) link ascending from the node
|
||||
// that has the bin flag set as the argument binset
|
||||
// if no such link exists return 0
|
||||
KBoolLink* Node::GetBinHighest( bool binset )
|
||||
kbLink* kbNode::GetBinHighest( bool binset )
|
||||
{
|
||||
KBoolLink * Result = NULL, *link;
|
||||
kbLink * Result = NULL, *link;
|
||||
_GC->_linkiter->Attach( _linklist );
|
||||
|
||||
double tangold = 0.0;
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
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"
|
||||
|
@ -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)
|
||||
|
@ -43,7 +43,7 @@ Record::~Record()
|
|||
// return malloc(size);
|
||||
//}
|
||||
|
||||
//void Record::operator delete(void* recordptr)
|
||||
//void kbRecord::operator delete(void* recordptr)
|
||||
//{
|
||||
//
|
||||
// if (r_index < 28)
|
||||
|
@ -55,7 +55,7 @@ Record::~Record()
|
|||
// free (recordptr);
|
||||
//}
|
||||
|
||||
//void Record::deletepool()
|
||||
//void kbRecord::deletepool()
|
||||
//{
|
||||
//
|
||||
// while (r_index!=-1)
|
||||
|
@ -64,7 +64,7 @@ Record::~Record()
|
|||
// }
|
||||
//}
|
||||
|
||||
Record::Record( KBoolLink* link, Bool_Engine* GC )
|
||||
kbRecord::kbRecord( kbLink* link, Bool_Engine* GC )
|
||||
: _line( GC )
|
||||
{
|
||||
_GC = 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
|
||||
void Record::SetNewLink( KBoolLink* link )
|
||||
void kbRecord::SetNewLink( kbLink* link )
|
||||
{
|
||||
_line.Set( link );
|
||||
_line.CalculateLineParameters();
|
||||
}
|
||||
|
||||
//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 ) )
|
||||
{
|
||||
|
@ -103,7 +103,7 @@ void Record::Calc_Ysp( Node* low )
|
|||
}
|
||||
|
||||
//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 ?
|
||||
{ //only happens in flat beams
|
||||
|
@ -121,27 +121,27 @@ void Record::Set_Flags()
|
|||
}
|
||||
}
|
||||
|
||||
KBoolLink* Record::GetLink()
|
||||
kbLink* kbRecord::GetLink()
|
||||
{
|
||||
return LNK;
|
||||
}
|
||||
|
||||
B_INT Record::Ysp()
|
||||
B_INT kbRecord::Ysp()
|
||||
{
|
||||
return _ysp;
|
||||
}
|
||||
|
||||
void Record::SetYsp( B_INT ysp )
|
||||
void kbRecord::SetYsp( B_INT ysp )
|
||||
{
|
||||
_ysp = ysp;
|
||||
}
|
||||
|
||||
DIRECTION Record::Direction()
|
||||
DIRECTION kbRecord::Direction()
|
||||
{
|
||||
return DIRECTION( _dir );
|
||||
}
|
||||
|
||||
bool Record::Calc_Left_Right( Record* record_above_me )
|
||||
bool kbRecord::Calc_Left_Right( kbRecord* record_above_me )
|
||||
{
|
||||
bool par = false;
|
||||
|
||||
|
@ -337,14 +337,14 @@ bool Record::Calc_Left_Right( Record* record_above_me )
|
|||
return par;
|
||||
}
|
||||
|
||||
bool Record::Equal( Record *a )
|
||||
bool kbRecord::Equal( kbRecord *a )
|
||||
{
|
||||
return( ( bool )( ( LNK->GetOther( a->LNK->GetBeginNode() ) == a->LNK->GetEndNode() ) &&
|
||||
( LNK->GetOther( a->LNK->GetEndNode() ) == a->LNK->GetBeginNode() ) ) );
|
||||
}
|
||||
|
||||
|
||||
KBoolLine* Record::GetLine()
|
||||
kbLine* kbRecord::GetLine()
|
||||
{
|
||||
return & _line;
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
|
||||
Licence: see kboollicense.txt
|
||||
|
||||
RCS-ID: $Id: scanbeam.cpp,v 1.3 2008/06/04 21:23:22 titato Exp $
|
||||
RCS-ID: $Id: scanbeam.cpp,v 1.4 2009/09/07 19:23:28 titato Exp $
|
||||
*/
|
||||
|
||||
// class scanbeam
|
||||
|
@ -22,12 +22,12 @@
|
|||
//this here is to initialize the static iterator of scanbeam
|
||||
//with NOLIST constructor
|
||||
|
||||
int recordsorter( Record* , Record* );
|
||||
int recordsorter( kbRecord* , kbRecord* );
|
||||
|
||||
int recordsorter_ysp_angle( Record* , Record* );
|
||||
int recordsorter_ysp_angle_back( Record* rec1, Record* rec2 );
|
||||
int recordsorter_ysp_angle( kbRecord* , kbRecord* );
|
||||
int recordsorter_ysp_angle_back( kbRecord* rec1, kbRecord* rec2 );
|
||||
|
||||
ScanBeam::ScanBeam( Bool_Engine* GC ): DL_List<Record*>()
|
||||
ScanBeam::ScanBeam( Bool_Engine* GC ): DL_List<kbRecord*>()
|
||||
{
|
||||
_GC = GC;
|
||||
_type = NORMAL;
|
||||
|
@ -43,7 +43,7 @@ ScanBeam::~ScanBeam()
|
|||
//DeleteRecordPool();
|
||||
}
|
||||
|
||||
void ScanBeam::SetType( Node* low, Node* high )
|
||||
void ScanBeam::SetType( kbNode* low, kbNode* high )
|
||||
{
|
||||
if ( low->GetX() < high->GetX() )
|
||||
_type = NORMAL;
|
||||
|
@ -54,12 +54,12 @@ void ScanBeam::SetType( Node* low, Node* high )
|
|||
/*
|
||||
//catch node to link crossings
|
||||
// must be sorted on ysp
|
||||
int ScanBeam::FindCloseLinksAndCross(TDLI<KBoolLink>* _I,Node* _lowf)
|
||||
int ScanBeam::FindCloseLinksAndCross(TDLI<kbLink>* _I,kbNode* _lowf)
|
||||
{
|
||||
int merges = 0;
|
||||
Record* record;
|
||||
kbRecord* record;
|
||||
|
||||
TDLI<Record> _BBI=TDLI<Record>(this);
|
||||
TDLI<kbRecord> _BBI=TDLI<kbRecord>(this);
|
||||
|
||||
if (_BI.count() > 1)
|
||||
{
|
||||
|
@ -131,16 +131,16 @@ int ScanBeam::FindCloseLinksAndCross(TDLI<KBoolLink>* _I,Node* _lowf)
|
|||
*/
|
||||
|
||||
/*
|
||||
bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
|
||||
bool ScanBeam::Update(TDLI<kbLink>* _I,kbNode* _lowf)
|
||||
{
|
||||
bool found=false;
|
||||
KBoolLink* link;
|
||||
kbLink* link;
|
||||
|
||||
_BI.tohead();
|
||||
while (!_BI.hitroot())
|
||||
{
|
||||
|
||||
Record* record=_BI.item();
|
||||
kbRecord* record=_BI.item();
|
||||
record->Calc_Ysp(_type,_low);
|
||||
_BI++;
|
||||
}
|
||||
|
@ -150,7 +150,7 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
|
|||
_BI.tohead();
|
||||
while (!_BI.hitroot())
|
||||
{
|
||||
Record* record=_BI.item();
|
||||
kbRecord* record=_BI.item();
|
||||
//records containing links towards the new low node
|
||||
//are links to be marked for removal
|
||||
|
||||
|
@ -166,7 +166,7 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
|
|||
_BI--;
|
||||
if (!_BI.hitroot() && (_BI.count() > 1))
|
||||
{
|
||||
Record* prev=_BI.item();
|
||||
kbRecord* prev=_BI.item();
|
||||
_BI++;
|
||||
if (!_BI.hitroot())
|
||||
{
|
||||
|
@ -195,7 +195,7 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
|
|||
//so for following beams it will not be checked again
|
||||
while ( bool(link=_lowf->GetBinHighest(false)) )
|
||||
{
|
||||
Record* record=new Record(link);
|
||||
kbRecord* record=new kbRecord(link);
|
||||
// yp_new will always be the y of low node since all new links are
|
||||
// from this node
|
||||
record->SetYsp(_lowf->GetY());
|
||||
|
@ -222,7 +222,7 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
|
|||
_BI--;_BI--; //just before the new record inserted
|
||||
if (!_BI.hitroot())
|
||||
{
|
||||
Record* prev=_BI.item();
|
||||
kbRecord* prev=_BI.item();
|
||||
_BI++; //goto the new record inserted
|
||||
if (!_BI.item()->Equal(prev)) // records NOT parallel
|
||||
{
|
||||
|
@ -238,11 +238,11 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
|
|||
else
|
||||
_BI++;
|
||||
|
||||
Record* prev=_BI.item(); //the new record
|
||||
kbRecord* prev=_BI.item(); //the new record
|
||||
_BI++;
|
||||
if (!_BI.hitroot() && !_BI.item()->Equal(prev)) // records NOT parallel
|
||||
{
|
||||
Record* cur=_BI.item();
|
||||
kbRecord* cur=_BI.item();
|
||||
if (cur->GetLine()->Intersect(prev->GetLine(),MARGE))
|
||||
{
|
||||
//this may modify the links already part of the record
|
||||
|
@ -264,13 +264,13 @@ bool ScanBeam::Update(TDLI<KBoolLink>* _I,Node* _lowf)
|
|||
}
|
||||
*/
|
||||
|
||||
bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
||||
bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<kbLink>* _I, bool& holes )
|
||||
{
|
||||
bool foundnew = false;
|
||||
|
||||
_low = _I->item()->GetBeginNode();
|
||||
|
||||
KBoolLink* link;
|
||||
kbLink* link;
|
||||
|
||||
//if (!checksort())
|
||||
// SortTheBeam();
|
||||
|
@ -291,7 +291,7 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
{
|
||||
//all vertical links in flatbeam are ignored
|
||||
//normal link in beam
|
||||
Record * record = new Record( link, _GC );
|
||||
kbRecord * record = new kbRecord( link, _GC );
|
||||
// yp_new will always be the y of low node since all new links are
|
||||
// from this node
|
||||
record->SetYsp( _low->GetY() );
|
||||
|
@ -309,7 +309,7 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
case LINKLINK:
|
||||
//is the new record a flat link
|
||||
{
|
||||
KBoolLine flatline = KBoolLine( link, _GC );
|
||||
kbLine flatline = kbLine( link, _GC );
|
||||
foundnew = Process_LinkToLink_Flat( &flatline ) || foundnew;
|
||||
//flatlinks are not part of the beams, still they are used to find new beams
|
||||
//they can be processed now if the beginnode does not change, since this is used to
|
||||
|
@ -327,7 +327,7 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
else
|
||||
{
|
||||
//normal link in beam
|
||||
Record* record = new Record( link, _GC );
|
||||
kbRecord* record = new kbRecord( link, _GC );
|
||||
// yp_new will always be the y of low node since all new links are
|
||||
// from this node
|
||||
record->SetYsp( _low->GetY() );
|
||||
|
@ -361,7 +361,7 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
//now we can set the a/b group flags based on the above link
|
||||
_BI--;
|
||||
_BI--;
|
||||
Record* above = 0;
|
||||
kbRecord* above = 0;
|
||||
if ( !_BI.hitroot() )
|
||||
above = _BI.item();
|
||||
_BI++;
|
||||
|
@ -396,11 +396,11 @@ bool ScanBeam::FindNew( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
return foundnew;
|
||||
}
|
||||
|
||||
bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
||||
bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<kbLink>* _I, bool& holes )
|
||||
{
|
||||
bool found = false;
|
||||
bool foundnew = false;
|
||||
DL_Iter<Record*> _BBI = DL_Iter<Record*>();
|
||||
DL_Iter<kbRecord*> _BBI = DL_Iter<kbRecord*>();
|
||||
bool attached = false;
|
||||
|
||||
_low = _I->item()->GetBeginNode();
|
||||
|
@ -416,10 +416,14 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
{
|
||||
if ( scantype == LINKHOLES )
|
||||
{
|
||||
// Tophole links can be linked at the begin or end point, depending on
|
||||
// which is higher in Y.
|
||||
// A link pointing to the low node, and which is a tophole link,
|
||||
// and which was not linked in sofar should be linked now.
|
||||
_BI.tohead();
|
||||
while ( !_BI.hitroot() )
|
||||
{
|
||||
Record * record = _BI.item();
|
||||
kbRecord * record = _BI.item();
|
||||
//records containing links towards the new low node
|
||||
//are links to be removed
|
||||
if ( ( record->GetLink()->GetEndNode() == _low ) ||
|
||||
|
@ -435,37 +439,17 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while ( !_BI.hitroot() )
|
||||
{
|
||||
Record * record = _BI.item();
|
||||
kbRecord * record = _BI.item();
|
||||
//records containing links towards the new low node
|
||||
//are links to be removed
|
||||
if ( ( record->GetLink()->GetEndNode() == _low ) ||
|
||||
( record->GetLink()->GetBeginNode() == _low )
|
||||
)
|
||||
{
|
||||
if ( attached ) //there is a bug
|
||||
{
|
||||
_BBI.Detach();
|
||||
if ( !checksort() )
|
||||
SortTheBeam( true );
|
||||
_BI.tohead();
|
||||
attached = false;
|
||||
|
||||
}
|
||||
delete _BI.item();
|
||||
_BI.remove();
|
||||
found = true;
|
||||
}
|
||||
else if ( found ) //only once in here
|
||||
{
|
||||
attached = true;
|
||||
found = false;
|
||||
_BBI.Attach( this );
|
||||
_BBI.toiter( &_BI ); //this is the position new records will be inserted
|
||||
|
||||
//recalculate ysp for the new scanline
|
||||
record->Calc_Ysp( _low );
|
||||
_BI++;
|
||||
}
|
||||
else
|
||||
{
|
||||
//recalculate ysp for the new scanline
|
||||
|
@ -474,21 +458,35 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
}
|
||||
}
|
||||
|
||||
if ( attached )
|
||||
// all records are renewed in Ysp.
|
||||
// found links to remove, we search the new insert position for new links.
|
||||
if ( found )
|
||||
{
|
||||
_BI.toiter( &_BBI );
|
||||
_BBI.Detach();
|
||||
_BI.tohead();
|
||||
while ( !_BI.hitroot() )
|
||||
{
|
||||
kbRecord * record = _BI.item();
|
||||
if ( record->Ysp() < _low->GetY() )
|
||||
{
|
||||
break;
|
||||
}
|
||||
_BI++;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
// nothing is removed from the beam, still we moved forward with the scanline
|
||||
// at the new _low, so we need to recalculate the intersections of the links
|
||||
// with the new scanline.
|
||||
// Also the the insert position for new links is determined, being the first
|
||||
// link below _low.
|
||||
_BBI.Attach( this );
|
||||
_BBI.toroot();
|
||||
_BI.tohead();
|
||||
while ( !_BI.hitroot() )
|
||||
{
|
||||
Record * record = _BI.item();
|
||||
kbRecord * record = _BI.item();
|
||||
|
||||
record->Calc_Ysp( _low );
|
||||
if ( !found && ( record->Ysp() < _low->GetY() ) )
|
||||
|
@ -502,7 +500,7 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BBI.Detach();
|
||||
}
|
||||
}
|
||||
else
|
||||
else // _type == NORMAL
|
||||
{ //because the previous beam was flat the links to remove are
|
||||
//below the last insert position
|
||||
if ( _low->GetBinHighest( true ) ) //is there something to remove
|
||||
|
@ -513,7 +511,7 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while ( !_BI.hitroot() )
|
||||
{
|
||||
Record * record = _BI.item();
|
||||
kbRecord * record = _BI.item();
|
||||
//records containing links towards the new low node
|
||||
//are links to be removed
|
||||
if ( ( record->GetLink()->GetEndNode() == _low ) ||
|
||||
|
@ -531,14 +529,10 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
//if there was no record before the last deleted record this means
|
||||
//we where at the beginning of the beam, so at root
|
||||
|
||||
//_BI << (lastinserted+1);
|
||||
//_BI--;
|
||||
//if (_BI.hitroot()) //only possible when at the begin of the beam
|
||||
|
||||
_BI.tohead();
|
||||
while ( !_BI.hitroot() )
|
||||
{
|
||||
Record * record = _BI.item();
|
||||
kbRecord * record = _BI.item();
|
||||
//records containing links towards the new low node
|
||||
//are links to be removed
|
||||
if ( ( record->GetLink()->GetEndNode() == _low ) ||
|
||||
|
@ -566,13 +560,10 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
//if there was no record before the last deleted record this means
|
||||
//we where at the beginning of the beam, so at root
|
||||
|
||||
//_BI << (lastinserted+ 1);
|
||||
//_BI--;
|
||||
//if (_BI.hitroot()) //only possible when at the begin of the beam
|
||||
_BI.tohead();
|
||||
while ( !_BI.hitroot() )
|
||||
{
|
||||
Record * record = _BI.item();
|
||||
kbRecord * record = _BI.item();
|
||||
if ( record->Ysp() < _low->GetY() )
|
||||
break;
|
||||
_BI++;
|
||||
|
@ -601,14 +592,14 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while ( !_BI.hitroot() )
|
||||
{
|
||||
Record * record = _BI.item();
|
||||
kbRecord * record = _BI.item();
|
||||
//records containing links towards the new low node
|
||||
//are links to be removed
|
||||
if ( ( record->GetLink()->GetEndNode() == _low ) ||
|
||||
( record->GetLink()->GetBeginNode() == _low )
|
||||
)
|
||||
{
|
||||
KBoolLine * line = record->GetLine();
|
||||
kbLine * line = record->GetLine();
|
||||
if ( scantype == NODELINK )
|
||||
foundnew = Process_PointToLink_Crossings() != 0 || foundnew;
|
||||
line->ProcessCrossings( _I );
|
||||
|
@ -629,7 +620,7 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while ( !_BI.hitroot() )
|
||||
{
|
||||
Record * record = _BI.item();
|
||||
kbRecord * record = _BI.item();
|
||||
//because the beam is sorted on ysp, stop when
|
||||
//the right insertion point for new links has been found
|
||||
if ( ( record->Ysp() < _low->GetY() ) )
|
||||
|
@ -647,11 +638,11 @@ bool ScanBeam::RemoveOld( SCANTYPE scantype, TDLI<KBoolLink>* _I, bool& holes )
|
|||
return foundnew;
|
||||
}
|
||||
/*
|
||||
bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
|
||||
bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<kbLink>* _I, bool& holes )
|
||||
{
|
||||
bool found = false;
|
||||
bool foundnew = false;
|
||||
DL_Iter<Record*> _BBI=DL_Iter<Record*>();
|
||||
DL_Iter<kbRecord*> _BBI=DL_Iter<kbRecord*>();
|
||||
bool attached=false;
|
||||
|
||||
_low = _I->item()->GetBeginNode();
|
||||
|
@ -663,7 +654,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
|
|||
case LINKHOLES:
|
||||
if (_type==NORMAL )
|
||||
{
|
||||
KBoolLink* link = _low->GetBinHighest(true);
|
||||
kbLink* link = _low->GetBinHighest(true);
|
||||
if ( link ) //is there something to remove
|
||||
{
|
||||
link->SetRecordNode( NULL );
|
||||
|
@ -673,7 +664,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while (!_BI.hitroot())
|
||||
{
|
||||
Record* record = _BI.item();
|
||||
kbRecord* record = _BI.item();
|
||||
//records containing links towards the new low node
|
||||
//are links to be removed
|
||||
if ((record->GetLink()->GetEndNode() == _low) ||
|
||||
|
@ -689,7 +680,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while (!_BI.hitroot())
|
||||
{
|
||||
Record* record=_BI.item();
|
||||
kbRecord* record=_BI.item();
|
||||
//records containing links towards the new low node
|
||||
//are links to be removed
|
||||
if ((record->GetLink()->GetEndNode() == _low) ||
|
||||
|
@ -721,7 +712,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while (!_BI.hitroot())
|
||||
{
|
||||
Record* record=_BI.item();
|
||||
kbRecord* record=_BI.item();
|
||||
record->Calc_Ysp(_low);
|
||||
_BI++;
|
||||
}
|
||||
|
@ -730,7 +721,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
|
|||
else
|
||||
{ //because the previous beam was flat the links to remove are
|
||||
//below the last insert position
|
||||
KBoolLink* link;
|
||||
kbLink* link;
|
||||
link = _low->GetBinHighest(true);
|
||||
if( link )//is there something to remove
|
||||
{
|
||||
|
@ -740,7 +731,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while (!_BI.hitroot())
|
||||
{
|
||||
Record* record = _BI.item();
|
||||
kbRecord* record = _BI.item();
|
||||
if (record->GetLink() == link)
|
||||
linkf = true;
|
||||
_BI++;
|
||||
|
@ -755,7 +746,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while (!_BI.hitroot())
|
||||
{
|
||||
Record* record=_BI.item();
|
||||
kbRecord* record=_BI.item();
|
||||
//records containing links towards the new low node
|
||||
//are links to be removed
|
||||
if ((record->GetLink()->GetEndNode() == _low) ||
|
||||
|
@ -786,7 +777,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while (!_BI.hitroot())
|
||||
{
|
||||
Record* record=_BI.item();
|
||||
kbRecord* record=_BI.item();
|
||||
//records containing links towards the new low node
|
||||
//are links to be removed
|
||||
if ((record->GetLink()->GetEndNode() == _low) ||
|
||||
|
@ -835,7 +826,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while (!_BI.hitroot())
|
||||
{
|
||||
Record* record=_BI.item();
|
||||
kbRecord* record=_BI.item();
|
||||
if (record->Ysp() < _low->GetY())
|
||||
break;
|
||||
_BI++;
|
||||
|
@ -865,14 +856,14 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while (!_BI.hitroot())
|
||||
{
|
||||
Record* record=_BI.item();
|
||||
kbRecord* record=_BI.item();
|
||||
//records containing links towards the new low node
|
||||
//are links to be removed
|
||||
if ((record->GetLink()->GetEndNode() == _low) ||
|
||||
(record->GetLink()->GetBeginNode() == _low)
|
||||
)
|
||||
{
|
||||
KBoolLine* line=record->GetLine();
|
||||
kbLine* line=record->GetLine();
|
||||
if (scantype==NODELINK)
|
||||
foundnew = Process_PointToLink_Crossings() !=0 || foundnew;
|
||||
line->ProcessCrossings(_I);
|
||||
|
@ -893,7 +884,7 @@ bool ScanBeam::RemoveOld(SCANTYPE scantype,TDLI<KBoolLink>* _I, bool& holes )
|
|||
_BI.tohead();
|
||||
while (!_BI.hitroot())
|
||||
{
|
||||
Record* record=_BI.item();
|
||||
kbRecord* record=_BI.item();
|
||||
//because the beam is sorted on ysp, stop when
|
||||
//the right insertion point for new links has been found
|
||||
if ((record->Ysp() < _low->GetY()))
|
||||
|
@ -925,8 +916,8 @@ void ScanBeam::Calc_Ysp()
|
|||
_BI.tohead();
|
||||
while ( !_BI.hitroot() )
|
||||
{
|
||||
Record * record = _BI.item();
|
||||
// KBoolLink* link=_BI.item()->GetLink();
|
||||
kbRecord * record = _BI.item();
|
||||
// kbLink* link=_BI.item()->GetLink();
|
||||
record->Calc_Ysp( _low );
|
||||
_BI++;
|
||||
}
|
||||
|
@ -940,7 +931,7 @@ void ScanBeam::Generate_INOUT( int graphnumber )
|
|||
DIRECTION first_dir = GO_LEFT;
|
||||
int diepte = 0;
|
||||
|
||||
DL_Iter<Record*> _BBI = DL_Iter<Record*>();
|
||||
DL_Iter<kbRecord*> _BBI = DL_Iter<kbRecord*>();
|
||||
_BBI.Attach( this );
|
||||
for( _BBI.tohead(); !_BBI.hitroot(); _BBI++ )
|
||||
{
|
||||
|
@ -999,14 +990,14 @@ void ScanBeam::Generate_INOUT( int graphnumber )
|
|||
// in a later beam will be higher than the current, if so we will wait
|
||||
// till that node comes around otherwise we will link this node to the
|
||||
// closest link (prev in beam)
|
||||
bool ScanBeam::ProcessHoles( bool atinsert, TDLI<KBoolLink>* _LI )
|
||||
bool ScanBeam::ProcessHoles( bool atinsert, TDLI<kbLink>* _LI )
|
||||
{
|
||||
// The scanbeam must already be sorted at this moment
|
||||
Node * topnode;
|
||||
kbNode * topnode;
|
||||
bool foundholes = false;
|
||||
|
||||
Record* record = _BI.item();
|
||||
KBoolLink* link = record->GetLink();
|
||||
kbRecord* record = _BI.item();
|
||||
kbLink* link = record->GetLink();
|
||||
|
||||
if ( !record->GetLine()->CrossListEmpty() )
|
||||
{
|
||||
|
@ -1018,14 +1009,14 @@ bool ScanBeam::ProcessHoles( bool atinsert, TDLI<KBoolLink>* _LI )
|
|||
// make new nodes and links and set them, re-use the old link, so the links
|
||||
// that still stand in the linecrosslist will not be lost.
|
||||
// There is a hole that must be linked to this link !
|
||||
TDLI<Node> I( record->GetLine()->GetCrossList() );
|
||||
TDLI<kbNode> I( record->GetLine()->GetCrossList() );
|
||||
I.tohead();
|
||||
while( !I.hitroot() )
|
||||
{
|
||||
topnode = I.item();
|
||||
I.remove();
|
||||
|
||||
KBoolLine line( _GC );
|
||||
kbLine line( _GC );
|
||||
line.Set( link );
|
||||
|
||||
B_INT Y = line.Calculate_Y( topnode->GetX() );
|
||||
|
@ -1053,16 +1044,16 @@ bool ScanBeam::ProcessHoles( bool atinsert, TDLI<KBoolLink>* _LI )
|
|||
// all holes are oriented left around
|
||||
|
||||
|
||||
Node * leftnode; //left node of clossest link
|
||||
kbNode * leftnode; //left node of clossest link
|
||||
( link->GetBeginNode()->GetX() < link->GetEndNode()->GetX() ) ?
|
||||
leftnode = link->GetBeginNode() :
|
||||
leftnode = link->GetEndNode();
|
||||
|
||||
Node *node_A = new Node( topnode->GetX(), Y, _GC );
|
||||
KBoolLink *link_A = new KBoolLink( 0, leftnode, node_A, _GC );
|
||||
KBoolLink *link_B = new KBoolLink( 0, node_A, topnode, _GC );
|
||||
KBoolLink *link_BB = new KBoolLink( 0, topnode, node_A, _GC );
|
||||
KBoolLink *link_D = _BI.item()->GetLink();
|
||||
kbNode *node_A = new kbNode( topnode->GetX(), Y, _GC );
|
||||
kbLink *link_A = new kbLink( 0, leftnode, node_A, _GC );
|
||||
kbLink *link_B = new kbLink( 0, node_A, topnode, _GC );
|
||||
kbLink *link_BB = new kbLink( 0, topnode, node_A, _GC );
|
||||
kbLink *link_D = _BI.item()->GetLink();
|
||||
link_D->Replace( leftnode, node_A );
|
||||
_LI->insbegin( link_A );
|
||||
_LI->insbegin( link_B );
|
||||
|
@ -1137,7 +1128,7 @@ bool ScanBeam::ProcessHoles( bool atinsert, TDLI<KBoolLink>* _LI )
|
|||
}
|
||||
|
||||
//sort the records on Ysp if eqaul, sort on tangent at ysp
|
||||
int recordsorter_ysp_angle( Record* rec1, Record* rec2 )
|
||||
int recordsorter_ysp_angle( kbRecord* rec1, kbRecord* rec2 )
|
||||
{
|
||||
if ( rec1->Ysp() > rec2->Ysp() )
|
||||
return( 1 );
|
||||
|
@ -1163,7 +1154,7 @@ int recordsorter_ysp_angle( Record* rec1, Record* rec2 )
|
|||
}
|
||||
|
||||
//sort the records on Ysp if eqaul, sort on tangent at ysp
|
||||
int recordsorter_ysp_angle_back( Record* rec1, Record* rec2 )
|
||||
int recordsorter_ysp_angle_back( kbRecord* rec1, kbRecord* rec2 )
|
||||
{
|
||||
if ( rec1->Ysp() > rec2->Ysp() )
|
||||
return( 1 );
|
||||
|
@ -1189,7 +1180,7 @@ int recordsorter_ysp_angle_back( Record* rec1, Record* rec2 )
|
|||
}
|
||||
|
||||
// swap functie for cocktailsort ==> each swap means an intersection of links
|
||||
bool swap_crossing_normal( Record *a, Record *b )
|
||||
bool swap_crossing_normal( kbRecord *a, kbRecord *b )
|
||||
{
|
||||
if ( !a->Equal( b ) ) // records NOT parallel
|
||||
{
|
||||
|
@ -1210,11 +1201,11 @@ int ScanBeam::Process_LinkToLink_Crossings()
|
|||
int ScanBeam::Process_PointToLink_Crossings()
|
||||
{
|
||||
int merges = 0;
|
||||
Record* record;
|
||||
kbRecord* record;
|
||||
|
||||
if ( _BI.count() > 1 )
|
||||
{
|
||||
DL_Iter<Record*> IL = DL_Iter<Record*>( this );
|
||||
DL_Iter<kbRecord*> IL = DL_Iter<kbRecord*>( this );
|
||||
IL.toiter( &_BI );
|
||||
|
||||
//from IL search back for close links
|
||||
|
@ -1263,11 +1254,11 @@ int ScanBeam::Process_PointToLink_Crossings()
|
|||
return merges;
|
||||
}
|
||||
|
||||
int ScanBeam::Process_LinkToLink_Flat( KBoolLine* flatline )
|
||||
int ScanBeam::Process_LinkToLink_Flat( kbLine* flatline )
|
||||
{
|
||||
int crossfound = 0;
|
||||
Record* record;
|
||||
DL_Iter<Record*> _BBI = DL_Iter<Record*>();
|
||||
kbRecord* record;
|
||||
DL_Iter<kbRecord*> _BBI = DL_Iter<kbRecord*>();
|
||||
_BBI.Attach( this );
|
||||
_BBI.toiter( &_BI );
|
||||
|
||||
|
@ -1292,7 +1283,7 @@ int ScanBeam::Process_LinkToLink_Flat( KBoolLine* flatline )
|
|||
( record->GetLink()->GetBeginNode() != flatline->GetLink()->GetLowNode() )
|
||||
)
|
||||
{
|
||||
Node * newnode = new Node( _low->GetX(), _BI.item()->Ysp(), _GC );
|
||||
kbNode * newnode = new kbNode( _low->GetX(), _BI.item()->Ysp(), _GC );
|
||||
flatline->AddCrossing( newnode );
|
||||
record->GetLine()->AddCrossing( newnode );
|
||||
crossfound++;
|
||||
|
@ -1313,11 +1304,11 @@ bool ScanBeam::checksort()
|
|||
|
||||
// put new item left of the one that is bigger
|
||||
_BI.tohead();
|
||||
Record* prev = _BI.item();
|
||||
kbRecord* prev = _BI.item();
|
||||
_BI++;
|
||||
while( !_BI.hitroot() )
|
||||
{
|
||||
Record * curr = _BI.item();
|
||||
kbRecord * curr = _BI.item();
|
||||
if ( recordsorter_ysp_angle( prev, curr ) == -1 )
|
||||
{
|
||||
recordsorter_ysp_angle( prev, curr );
|
||||
|
@ -1347,17 +1338,17 @@ bool ScanBeam::writebeam()
|
|||
return true;
|
||||
}
|
||||
|
||||
DL_Iter<Record*> _BI( this );
|
||||
DL_Iter<kbRecord*> _BI( this );
|
||||
|
||||
// put new item left of the one that is bigger
|
||||
_BI.tohead();
|
||||
while( !_BI.hitroot() )
|
||||
{
|
||||
Record * cur = _BI.item();
|
||||
kbRecord * cur = _BI.item();
|
||||
|
||||
fprintf( file, " ysp %I64d \n", cur->Ysp() );
|
||||
|
||||
KBoolLink* curl = cur->GetLink();
|
||||
kbLink* curl = cur->GetLink();
|
||||
|
||||
fprintf( file, " linkbegin %I64d %I64d \n", curl->GetBeginNode()->GetX(), curl->GetBeginNode()->GetY() );
|
||||
fprintf( file, " linkend %I64d %I64d \n", curl->GetEndNode()->GetX(), curl->GetEndNode()->GetY() );
|
||||
|
|
Loading…
Reference in New Issue