Commit 521f428c authored by charras's avatar charras

Using the last version (1.9) of kbool, downloaded from the wxArt2D project site.

parent 5d5698d6
......@@ -8,3 +8,7 @@ include makefile.include
libbitmaps.a: $(OBJECTS)
ar ruv $@ $(OBJECTS)
ranlib $@
clean:
rm -f *.o
rm -f *.a
......@@ -6,6 +6,17 @@ Please add newer entries at the top, list the date and your name with
email address.
2008-Nov-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
kbool:
Using the last version (1.9) of kbool, downloaded from the wxArt2D project site
(see www.wxart2d.org)
But the version 1.8 bug still is here.
So using the workaround remains mandatory.
(this is not a problem because thermal shapes are better...)
2008-Nov-14 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+gerview
......
......@@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion
# include "config.h"
(wxT(KICAD_SVN_VERSION))
# else
(wxT("(20081106-unstable)")) /* main program version */
(wxT("(20081114-unstable)")) /* main program version */
# endif
#endif
;
......@@ -20,7 +20,7 @@ COMMON_GLOBL wxString g_BuildAboutVersion
# include "config.h"
(wxT(KICAD_ABOUT_VERSION))
# else
(wxT("(20081106-unstable)")) /* svn date & rev (normally overridden) */
(wxT("(20081114-unstable)")) /* svn date & rev (normally overridden) */
# endif
#endif
;
......
......@@ -70,8 +70,8 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
m_GridCtrl->SetLabel( msg );
msg = ReturnStringFromValue( g_UnitMetric,
m_Zone_Setting->m_ZoneClearance,
m_Parent->m_InternalUnits );
m_Zone_Setting->m_ZoneClearance,
m_Parent->m_InternalUnits );
m_ZoneClearanceCtrl->SetValue( msg );
if( g_Zone_45_Only )
......@@ -85,8 +85,8 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
for( unsigned ii = 0; ii < 4; ii++ )
{
msg = ReturnStringFromValue( g_UnitMetric,
GridList[ii],
m_Parent->m_InternalUnits );
GridList[ii],
m_Parent->m_InternalUnits );
m_GridCtrl->SetString( ii, msg );
if( grid_routing == GridList[ii] )
selection = ii;
......@@ -98,8 +98,8 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
m_GridCtrl->SetSelection( selection );
msg = ReturnStringFromValue( g_UnitMetric,
m_Zone_Setting->m_ZoneClearance,
m_Parent->m_InternalUnits );
m_Zone_Setting->m_ZoneClearance,
m_Parent->m_InternalUnits );
m_ZoneClearanceCtrl->SetValue( msg );
switch( m_Zone_Setting->m_Zone_Pad_Options )
......@@ -135,11 +135,11 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
AddUnitSymbol( *m_AntipadSizeText, g_UnitMetric );
AddUnitSymbol( *m_CopperBridgeWidthText, g_UnitMetric );
PutValueInLocalUnits( *m_AntipadSizeValue,
m_Zone_Setting->m_ThermalReliefGapValue,
PCB_INTERNAL_UNIT );
m_Zone_Setting->m_ThermalReliefGapValue,
PCB_INTERNAL_UNIT );
PutValueInLocalUnits( *m_CopperWidthValue,
m_Zone_Setting->m_ThermalReliefCopperBridgeValue,
PCB_INTERNAL_UNIT );
m_Zone_Setting->m_ThermalReliefCopperBridgeValue,
PCB_INTERNAL_UNIT );
switch( m_Zone_Setting->m_Zone_HatchingStyle )
{
......@@ -189,8 +189,10 @@ void dialog_copper_zone::OnInitDialog( wxInitDialogEvent& event )
m_NetNameFilter->SetValue( NetNameFilter );
wxArrayString ListNetName;
m_Parent->m_Pcb->ReturnSortedNetnamesList( ListNetName,
m_NetSorting == 0 ? BOARD::ALPHA_SORT : BOARD::PAD_CNT_SORT );
m_Parent->m_Pcb->ReturnSortedNetnamesList(
ListNetName,
m_NetSorting ==
0 ? BOARD::ALPHA_SORT : BOARD::PAD_CNT_SORT );
if( m_NetSorting != 0 )
{
......@@ -287,7 +289,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
if( m_Parent->m_Parent->m_EDA_Config )
{
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_OUTLINES_HATCH_OPTION_KEY,
(long) m_Zone_Setting->m_Zone_HatchingStyle );
(long) m_Zone_Setting->m_Zone_HatchingStyle );
}
switch( m_GridCtrl->GetSelection() )
......@@ -313,7 +315,7 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
m_Zone_Setting->m_GridFillValue = 0;
#if 0 // I hope this feature works fine ( JP Charras)
DisplayInfo( this, wxT(
"You are using No grid for filling zones\nThis is currently in development and for tests only.\n Do not use for production" ) );
"You are using No grid for filling zones\nThis is currently in development and for tests only.\n Do not use for production" ) );
#endif
break;
}
......@@ -329,15 +331,17 @@ bool dialog_copper_zone::AcceptOptions( bool aPromptForErrors, bool aUseExportab
m_Zone_Setting->m_FilledAreasShowMode = m_ShowFilledAreasInSketchOpt->IsChecked() ? 1 : 0;
m_Zone_Setting->m_ThermalReliefGapValue = ReturnValueFromTextCtrl( *m_AntipadSizeValue,
PCB_INTERNAL_UNIT );
PCB_INTERNAL_UNIT );
m_Zone_Setting->m_ThermalReliefCopperBridgeValue = ReturnValueFromTextCtrl(
*m_CopperWidthValue,
PCB_INTERNAL_UNIT );
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_THERMAL_RELIEF_GAP_STRING_KEY,
(long) m_Zone_Setting->m_ThermalReliefGapValue );
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,
(long) m_Zone_Setting->m_ThermalReliefCopperBridgeValue );
(long) m_Zone_Setting->m_ThermalReliefGapValue );
m_Parent->m_Parent->m_EDA_Config->Write(
ZONE_THERMAL_RELIEF_COPPER_WIDTH_STRING_KEY,
(long) m_Zone_Setting->
m_ThermalReliefCopperBridgeValue );
// If we use only exportable to others zones parameters, exit here:
if( aUseExportableSetupOnly )
......@@ -388,8 +392,10 @@ void dialog_copper_zone::OnNetSortingOptionSelected( wxCommandEvent& event )
wxArrayString ListNetName;
m_NetSorting = m_NetSortingOption->GetSelection();
m_Parent->m_Pcb->ReturnSortedNetnamesList( ListNetName,
m_NetSorting == 0 ? BOARD::ALPHA_SORT : BOARD::PAD_CNT_SORT );
m_Parent->m_Pcb->ReturnSortedNetnamesList(
ListNetName,
m_NetSorting ==
0 ? BOARD::ALPHA_SORT : BOARD::PAD_CNT_SORT );
if( m_NetSorting != 0 )
{
wxString Filter = m_NetNameFilter->GetValue();
......@@ -408,7 +414,7 @@ void dialog_copper_zone::OnNetSortingOptionSelected( wxCommandEvent& event )
{
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_SORT_OPTION_KEY, (long) m_NetSorting );
m_Parent->m_Parent->m_EDA_Config->Write( ZONE_NET_FILTER_STRING_KEY,
m_NetNameFilter->GetValue() );
m_NetNameFilter->GetValue() );
}
// Select and isplay current zone net name in listbox:
......@@ -448,12 +454,14 @@ void dialog_copper_zone::ExportSetupToOtherCopperZones( wxCommandEvent& event )
if( !AcceptOptions( true, true ) )
return;
// Export to others zones:
// Export settings ( but layer ) to others zones:
BOARD* pcb = m_Parent->m_Pcb;
for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = pcb->GetArea( ii );
int zone_layer = zone->GetLayer();
m_Zone_Setting->ExportSetting( *zone );
zone->SetLayer( zone_layer );
m_Parent->GetScreen()->SetModify();
}
}
......
......@@ -12,7 +12,7 @@
#include "protos.h"
#include "id.h"
#include "drc_stuff.h"
#include "kbool/include/booleng.h"
#include "kbool/include/kbool/booleng.h"
/*******************************/
/* class WinEDA_PcbFrame */
......
......@@ -464,7 +464,7 @@ 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
// this seems a bug in kbool polygon (exists in 1.9 kbool version)
// angle = 450 (45.0 degrees orientation) seems work fine.
// angle = 0 with thermal shapes without angle < 90 deg seems works fine also
angle = 0;
......
......@@ -17,7 +17,7 @@
#include <vector>
#include "kbool/include/booleng.h"
#include "kbool/include/kbool/booleng.h"
#include "pad_shapes.h"
// inflection modes for DS_LINE and DS_LINE_VERTEX, used in math_for_graphics.cpp
......
project(kbool)
subdirs(src samples)
subdirs(src)
This diff is collapsed.
/*! \file kbool/include/kbool/_lnk_itr.cpp
\author Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence: wxWidgets Licence
RCS-ID: $Id: _lnk_itr.cpp,v 1.1 2005/05/24 19:13:36 titato Exp $
*/
#ifdef __GNUG__
#pragma implementation
#endif
#ifdef __UNIX__
#include "../include/_lnk_itr.h"
#endif
//=======================================================================
// implementation class LinkBaseIter
//=======================================================================
template<class Type>
TDLI<Type>::TDLI(DL_List<void*>* newlist):DL_Iter<void*>(newlist)
{
}
template<class Type>
TDLI<Type>::TDLI(DL_Iter<void*>* otheriter):DL_Iter<void*>(otheriter)
{
}
template<class Type>
TDLI<Type>::TDLI():DL_Iter<void*>()
{
}
// destructor TDLI
template<class Type>
TDLI<Type>::~TDLI()
{
}
template<class Type>
void TDLI<Type>::delete_all()
{
DL_Node<void*>* node;
Type* obj;
for (int i=0; i< NB; i++)
{
node = HD;
HD = node->_next;
obj=(Type*)(node->_item);
delete obj;
delete node;
}
NB=0; //reset memory used (no lost pointers)
TL=RT;
_current=RT;
}
template<class Type>
void TDLI<Type>::foreach_f(void (*fp) (Type* item) )
{
DL_Iter<void*>::foreach_f( (void (*)(void*))fp); //call fp for each item
}
template<class Type>
void TDLI<Type>::foreach_mf(void (Type::*mfp) ())
{
DL_Node<void*>* node=HD; //can be 0 if empty
Type* obj;
for(int i=0; i< NB; i++)
{
obj=(Type*)(node->_item);
(obj->*mfp)();
node=node->_next;
}
}
template<class Type>
void TDLI<Type>::takeover(DL_List<void*>* otherlist)
{
DL_Iter<void*>::takeover( (DL_List<void*>*) otherlist);
}
template<class Type>
void TDLI<Type>::takeover(TDLI* otheriter)
{
DL_Iter<void*>::takeover( (DL_Iter<void*>*) otheriter);
}
template<class Type>
void TDLI<Type>::takeover(TDLI* otheriter,int maxcount)
{
DL_Iter<void*>::takeover( (DL_Iter<void*>*) otheriter,maxcount);
}
// is item element of the list?
template<class Type>
bool TDLI<Type>::has(Type* otheritem)
{
return DL_Iter<void*>::has( (void*) otheritem);
}
// goto to item
template<class Type>
bool TDLI<Type>::toitem(Type* item)
{
return DL_Iter<void*>::toitem( (void*) item);
}
// get current item
template<class Type>
Type* TDLI<Type>::item()
{
return (Type*) DL_Iter<void*>::item();
}
template<class Type>
void TDLI<Type>::insend(Type* newitem)
{
DL_Iter<void*>::insend( (void*) newitem);
}
template<class Type>
void TDLI<Type>::insbegin(Type* newitem)
{
DL_Iter<void*>::insbegin( (void*) newitem);
}
template<class Type>
void TDLI<Type>::insbefore(Type* newitem)
{
DL_Iter<void*>::insbefore( (void*) newitem);
}
template<class Type>
void TDLI<Type>::insafter(Type* newitem)
{
DL_Iter<void*>::insafter( (void*) newitem);
}
template<class Type>
void TDLI<Type>::insend_unsave(Type* newitem)
{
short int iterbackup=_list->_iterlevel;
_list->_iterlevel=0;
DL_Iter<void*>::insend( (void*) newitem);
_list->_iterlevel=iterbackup;
}
template<class Type>
void TDLI<Type>::insbegin_unsave(Type* newitem)
{
short int iterbackup=_list->_iterlevel;
_list->_iterlevel=0;
DL_Iter<void*>::insbegin( (void*) newitem);
_list->_iterlevel=iterbackup;
}
template<class Type>
void TDLI<Type>::insbefore_unsave(Type* newitem)
{
short int iterbackup=_list->_iterlevel;
_list->_iterlevel=0;
DL_Iter<void*>::insbefore( (void*) newitem);
_list->_iterlevel=iterbackup;
}
template<class Type>
void TDLI<Type>::insafter_unsave(Type* newitem)
{
short int iterbackup=_list->_iterlevel;
_list->_iterlevel=0;
DL_Iter<void*>::insafter( (void*) newitem);
_list->_iterlevel=iterbackup;
}
template<class Type>
void TDLI<Type>::mergesort(int (*f)(Type* a,Type* b))
{
DL_Iter<void*>::mergesort( (int (*)(void*,void*)) f);
}
template<class Type>
int TDLI<Type>::cocktailsort(int (*f)(Type* a,Type* b), bool (*f2)(Type* c,Type* d))
{
return DL_Iter<void*>::cocktailsort( (int (*)(void*,void*)) f,( bool(*)(void*,void*)) f2);
}
template<class Type>
TDLISort<Type>::TDLISort(DL_List<void*>* lista, int (*newfunc)(void*,void*))
:DL_SortIter<void*>(lista, newfunc)
{
}
template<class Type>
TDLISort<Type>::~TDLISort()
{
}
template<class Type>
void TDLISort<Type>::delete_all()
{
DL_Node<void*>* node;
Type* obj;
for (int i=0; i< NB; i++)
{
node = HD;
HD = node->_next;
obj=(Type*)(node->_item);
delete obj;
delete node;
}
NB=0; //reset memory used (no lost pointers)
TL=RT;
_current=RT;
}
// is item element of the list?
template<class Type>
bool TDLISort<Type>::has(Type* otheritem)
{
return DL_Iter<void*>::has( (void*) otheritem);
}
// goto to item
template<class Type>
bool TDLISort<Type>::toitem(Type* item)
{
return DL_Iter<void*>::toitem( (void*) item);
}
// get current item
template<class Type>
Type* TDLISort<Type>::item()
{
return (Type*) DL_Iter<void*>::item();
}
template<class Type>
TDLIStack<Type>::TDLIStack(DL_List<void*>* newlist):DL_StackIter<void*>(newlist)
{
}
// destructor TDLI
template<class Type>
TDLIStack<Type>::~TDLIStack()
{
}
// plaats nieuw item op stack
template<class Type>
void TDLIStack<Type>::push(Type* newitem)
{
DL_StackIter<void*>::push((Type*) newitem);
}
// haal bovenste item van stack
template<class Type>
Type* TDLIStack<Type>::pop()
{
return (Type*) DL_StackIter<void*>::pop();
}
/*! \file kbool/include/kbool/_lnk_itr.h
\author Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence: wxWidgets Licence
RCS-ID: $Id: _lnk_itr.h,v 1.1 2005/05/24 19:13:36 titato Exp $
*/
//! author="Klaas Holwerda"
//! version="1.0"
/*
* Definitions of classes, for list implementation
* template list and iterator for any list node type
*/
#ifndef _LinkBaseIter_H
#define _LinkBaseIter_H
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface
#endif
//! headerfiles="_dl_itr.h stdlib.h misc.h gdsmes.h"
#include <stdlib.h>
#include "../include/booleng.h"
#define SWAP(x,y,t)((t)=(x),(x)=(y),(y)=(t))
#include "../include/_dl_itr.h"
//! codefiles="_dl_itr.cpp"
//! Template class TDLI
/*!
class for iterator on DL_List<void*> that is type casted version of DL_Iter
\sa DL_Iter for further documentation
*/
template<class Type> class TDLI : public DL_Iter<void*>
{
public:
//!constructor
/*!
\param list to iterate on.
*/
TDLI(DL_List<void*>* list);
//!constructor
TDLI(DL_Iter<void*>* otheriter);
//! nolist constructor
TDLI();
//! destructor
~TDLI();
//!call fp for each item
void foreach_f(void (*fp) (Type* item) );
//!call fp for each item
void foreach_mf(void (Type::*fp) () );
/* list mutations */
//! delete all items
void delete_all ();
//! insert at end
void insend (Type* n);
//! insert at begin
void insbegin (Type* n);
//! insert before current
void insbefore (Type* n);
//! insert after current
void insafter (Type* n);
//! insert at end unsave (works even if more then one iterator is on the list
//! the user must be sure not to delete/remove items where other iterators
//! are pointing to.
void insend_unsave (Type* n);
//! insert at begin unsave (works even if more then one iterator is on the list
//! the user must be sure not to delete/remove items where other iterators
//! are pointing to.
void insbegin_unsave (Type* n);
//! insert before iterator position unsave (works even if more then one iterator is on the list
//! the user must be sure not to delete/remove items where other iterators
//! are pointing to.
void insbefore_unsave (Type* n);
//! insert after iterator position unsave (works even if more then one iterator is on the list
//! the user must be sure not to delete/remove items where other iterators
//! are pointing to.
void insafter_unsave (Type* n);
//! \sa DL_Iter::takeover(DL_List< Dtype >* otherlist )
void takeover (DL_List<void*>* otherlist);
//! \sa DL_Iter::takeover(DL_Iter* otheriter)
void takeover (TDLI* otheriter);
//! \sa DL_Iter::takeover(DL_Iter* otheriter, int maxcount)
void takeover (TDLI* otheriter, int maxcount);
//! \sa DL_Iter::has
bool has (Type*);
//! \sa DL_Iter::toitem
bool toitem (Type*);
//!get the item then iterator is pointing at
Type* item ();
//! \sa DL_Iter::mergesort
void mergesort (int (*f)(Type* a,Type* b));
//! \sa DL_Iter::cocktailsort
int cocktailsort( int (*) (Type* a,Type* b), bool (*) (Type* c,Type* d) = NULL);
};
//! Template class TDLIsort
/*!
// class for sort iterator on DL_List<void*> that is type casted version of DL_SortIter
// see also inhereted class DL_SortIter for further documentation
*/
template<class Type> class TDLISort : public DL_SortIter<void*>
{
public:
//!constructor givin a list and a sort function
TDLISort(DL_List<void*>* list, int (*newfunc)(void*,void*));
~TDLISort();
//!delete all items from the list
void delete_all();
bool has (Type*);
bool toitem (Type*);
Type* item ();
};
//! Template class TDLIStack
/*!
class for iterator on DL_List<void*> that is type casted version of DL_StackIter
see also inhereted class DL_StackIter for further documentation
*/
template<class Type> class TDLIStack : public DL_StackIter<void*>
{
public:
//constructor givin a list
TDLIStack(DL_List<void*>* list);
~TDLIStack();
void push(Type*);
Type* pop();
};
#include"../include/_lnk_itr.cpp"
#endif
This diff is collapsed.
/*! \file ../include/../graph.h
\author Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence: wxWidgets Licence
RCS-ID: $Id: graph.h,v 1.1 2005/05/24 19:13:37 titato Exp $
*/
/* @@(#) $Source: /cvsroot/wxart2d/wxArt2D/modules/../include/graph.h,v $ $Revision: 1.1 $ $Date: 2005/05/24 19:13:37 $ */
/*
Program GRAPH.H
Purpose Used to Intercect and other process functions
Last Update 03-04-1996
*/
#ifndef GRAPH_H
#define GRAPH_H
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface
#endif
#include "../include/booleng.h"
#include "../include/_lnk_itr.h"
#include "../include/link.h"
#include "../include/line.h"
#include "../include/scanbeam.h"
class Node;
class GraphList;
//! one graph containing links that cab be connected.
class A2DKBOOLDLLEXP Graph
{
protected:
Bool_Engine* _GC;
public:
Graph(Bool_Engine* GC);
Graph(KBoolLink*,Bool_Engine* GC);
Graph( Graph* other );
~Graph();
bool GetBin() { return _bin; };
void SetBin(bool b) { _bin = b; };
void Prepare( int intersectionruns );
void RoundInt(B_INT grid);
void Rotate(bool plus90);
//! adds a link to the linklist
void AddLink(Node *begin,Node *end);
//! adds a link to the linklist
void AddLink(KBoolLink *a_link);
bool AreZeroLines(B_INT Marge);
//! Delete parallel lines
void DeleteDoubles();
//! delete zerolines
bool DeleteZeroLines(B_INT Marge);
bool RemoveNullLinks();
//! Process found intersections
void ProcessCrossings();
//! set flags for operations based on group
void Set_Operation_Flags();
//! Left Right values
void Remove_IN_Links();
//! reset bin and mark flags in links.
void ResetBinMark();
// Remove unused links
void ReverseAllLinks();
//! Simplify the graph
bool Simplify( B_INT Marge );
//! Takes over all links of the argument
bool Smoothen( B_INT Marge);
void TakeOver(Graph*);
//! function for maximum performance
//! Get the First link from the graph
KBoolLink* GetFirstLink();
Node* GetTopNode();
void SetBeenHere(bool);
void Reset_flags();
//! Set the group of a graph
void SetGroup(GroupType);
//! Set the number of the graph
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 MakeOneDirection();
void Make_Rounded_Shape(KBoolLink* a_link, double factor);
bool MakeClockWise();
bool writegraph(bool linked);
bool writeintersections();
void WriteKEY( Bool_Engine* GC, FILE* file = NULL );
void WriteGraphKEY( Bool_Engine* GC );
protected:
//! Extracts partical polygons from the graph
/*
Links are sorted in XY at beginpoint. Bin and mark flag are reset.
Next start to collect subparts from the graph, setting the links bin for all found parts.
The parts are searched starting at a topleft corner NON set bin flag link.
Found parts are numbered, to be easily split into to real sperate graphs by Split()
\param operation operation to collect for.
\param detecthole if you want holes detected, influences also way of extraction.
\param foundholes when holes are found this flag is set true, but only if detecthole is set true.
*/
void Extract_Simples(BOOL_OP operation, bool detecthole, bool& foundholes );
//! split graph into small graph, using the numbers in links.
void Split(GraphList* partlist);
//! Collect a graph by starting at argument link
/*
Called from Extract_Simples, and assumes sorted links with bin flag unset for non extarted piece
Collect graphs pieces from a total graph, by following links set to a given boolean operation.
\param current_node start node to collect
\param operation operation to collect for.
\param detecthole if you want holes detected, influences also way of extraction.
\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 CollectGraphLast(Node *current_node, BOOL_OP operation, bool detecthole,int graphnumber, bool& foundholes );
//! find a link not bin in the top left corner ( links should be sorted already )
/*!
Last found position is used to find it quickly.
Used in ExtractSimples()
*/
Node* GetMostTopLeft(TDLI<KBoolLink>* _LI);
//! calculates crossing for all links in a graph, and add those as part of the graph.
/*
It is not just crossings calculation, snapping close nodes is part of it.
This is not done at maximum stability in economic time.
There are faster ways, but hardly ever they solve the problems, and they do not snap.
Here it is on purpose split into separate steps, to get a better result in snapping, and
to reach a better stability.
\param Marge nodes and lines closer to eachother then this, are merged.
*/
bool CalculateCrossings(B_INT Marge);
//! equal nodes in position are merged into one.
int Merge_NodeToNode(B_INT Marge);
//! basic scan algorithm with a sweeping beam are line.
/*!
\param scantype a different face in the algorithm.
\param holes to detect hole when needed.
*/
int ScanGraph2( SCANTYPE scantype, bool& holes );
//! links not used for a certain operation can be deleted, simplifying extraction
void DeleteNonCond(BOOL_OP operation);
//! links not used for a certain operation can be set bin, simplifying extraction
void HandleNonCond(BOOL_OP operation);
//! debug
bool checksort();
//! used in correction/offset algorithm
bool Small(B_INT howsmall);
bool _bin;
DL_List<void*>* _linklist;
};
#endif
/*! \file ../include/../graphlst.h
\author Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence: wxWidgets Licence
RCS-ID: $Id: graphlst.h,v 1.1 2005/05/24 19:13:37 titato Exp $
*/
/* @@(#) $Source: /cvsroot/wxart2d/wxArt2D/modules/../include/graphlst.h,v $ $Revision: 1.1 $ $Date: 2005/05/24 19:13:37 $ */
/*
Program GRAPHLST.H
Purpose Implements a list of graphs (header)
Last Update 11-03-1996
*/
#ifndef GRAPHLIST_H
#define GRAPHLIST_H
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
#pragma interface
#endif
#include "../include/booleng.h"
#include "../include/_lnk_itr.h"
#include "../include/graph.h"
class Debug_driver;
class A2DKBOOLDLLEXP GraphList: public DL_List<void*>
{
protected:
Bool_Engine* _GC;
public:
GraphList(Bool_Engine* GC);
GraphList( GraphList* other );
~GraphList();
void MakeOneGraph(Graph *total);
void Prepare(Graph *total);
void MakeRings();
void Correction();
void Simplify( double marge);
void Smoothen( double marge);
void Merge();
void Boolean(BOOL_OP operation, int intersectionRunsMax );
void WriteGraphs();
void WriteGraphsKEY( Bool_Engine* GC );
protected:
void Renumber();
void UnMarkAll();
};
#endif
This diff is collapsed.
/*! \file kbool/_lnk_itr.cpp
\author Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence: wxWidgets Licence
RCS-ID: $Id: _lnk_itr.cpp,v 1.3 2006/12/13 21:43:33 titato Exp $
*/
#ifdef __UNIX__
#include "kbool/_lnk_itr.h"
#endif
//=======================================================================
// implementation class LinkBaseIter
//=======================================================================
template<class Type>
TDLI<Type>::TDLI( DL_List<void*>* newlist ): DL_Iter<void*>( newlist )
{}
template<class Type>
TDLI<Type>::TDLI( DL_Iter<void*>* otheriter ): DL_Iter<void*>( otheriter )
{}
template<class Type>
TDLI<Type>::TDLI(): DL_Iter<void*>()
{}
// destructor TDLI
template<class Type>
TDLI<Type>::~TDLI()
{}
template<class Type>
void TDLI<Type>::delete_all()
{
DL_Node<void*>* node;
Type* obj;
for ( int i = 0; i < NB; i++ )
{
node = HD;
HD = node->_next;
obj = ( Type* )( node->_item );
delete obj;
delete node;
}
NB = 0; //reset memory used (no lost pointers)
TL = RT;
_current = RT;
}
template<class Type>
void TDLI<Type>::foreach_f( void ( *fp ) ( Type* item ) )
{
DL_Iter<void*>::foreach_f( ( void ( * )( void* ) )fp ); //call fp for each item
}
template<class Type>
void TDLI<Type>::foreach_mf( void ( Type::*mfp ) () )
{
DL_Node<void*>* node = HD; //can be 0 if empty
Type* obj;
for( int i = 0; i < NB; i++ )
{
obj = ( Type* )( node->_item );
( obj->*mfp )();
node = node->_next;
}
}
template<class Type>
void TDLI<Type>::takeover( DL_List<void*>* otherlist )
{
DL_Iter<void*>::takeover( ( DL_List<void*>* ) otherlist );
}
template<class Type>
void TDLI<Type>::takeover( TDLI* otheriter )
{
DL_Iter<void*>::takeover( ( DL_Iter<void*>* ) otheriter );
}
template<class Type>
void TDLI<Type>::takeover( TDLI* otheriter, int maxcount )
{
DL_Iter<void*>::takeover( ( DL_Iter<void*>* ) otheriter, maxcount );
}
// is item element of the list?
template<class Type>
bool TDLI<Type>::has( Type* otheritem )
{
return DL_Iter<void*>::has( ( void* ) otheritem );
}
// goto to item
template<class Type>
bool TDLI<Type>::toitem( Type* item )
{
return DL_Iter<void*>::toitem( ( void* ) item );
}
// get current item
template<class Type>
Type* TDLI<Type>::item()
{
return ( Type* ) DL_Iter<void*>::item();
}
template<class Type>
void TDLI<Type>::insend( Type* newitem )
{
DL_Iter<void*>::insend( ( void* ) newitem );
}
template<class Type>
void TDLI<Type>::insbegin( Type* newitem )
{
DL_Iter<void*>::insbegin( ( void* ) newitem );
}
template<class Type>
void TDLI<Type>::insbefore( Type* newitem )
{
DL_Iter<void*>::insbefore( ( void* ) newitem );
}
template<class Type>
void TDLI<Type>::insafter( Type* newitem )
{
DL_Iter<void*>::insafter( ( void* ) newitem );
}
template<class Type>
void TDLI<Type>::insend_unsave( Type* newitem )
{
short int iterbackup = _list->_iterlevel;
_list->_iterlevel = 0;
DL_Iter<void*>::insend( ( void* ) newitem );
_list->_iterlevel = iterbackup;
}
template<class Type>
void TDLI<Type>::insbegin_unsave( Type* newitem )
{
short int iterbackup = _list->_iterlevel;
_list->_iterlevel = 0;
DL_Iter<void*>::insbegin( ( void* ) newitem );
_list->_iterlevel = iterbackup;
}
template<class Type>
void TDLI<Type>::insbefore_unsave( Type* newitem )
{
short int iterbackup = _list->_iterlevel;
_list->_iterlevel = 0;
DL_Iter<void*>::insbefore( ( void* ) newitem );
_list->_iterlevel = iterbackup;
}
template<class Type>
void TDLI<Type>::insafter_unsave( Type* newitem )
{
short int iterbackup = _list->_iterlevel;
_list->_iterlevel = 0;
DL_Iter<void*>::insafter( ( void* ) newitem );
_list->_iterlevel = iterbackup;
}
template<class Type>
void TDLI<Type>::mergesort( int ( *f )( Type* a, Type* b ) )
{
DL_Iter<void*>::mergesort( ( int ( * )( void*, void* ) ) f );
}
template<class Type>
int TDLI<Type>::cocktailsort( int ( *f )( Type* a, Type* b ), bool ( *f2 )( Type* c, Type* d ) )
{
return DL_Iter<void*>::cocktailsort( ( int ( * )( void*, void* ) ) f, ( bool( * )( void*, void* ) ) f2 );
}
template<class Type>
TDLISort<Type>::TDLISort( DL_List<void*>* lista, int ( *newfunc )( void*, void* ) )
: DL_SortIter<void*>( lista, newfunc )
{}
template<class Type>
TDLISort<Type>::~TDLISort()
{}
template<class Type>
void TDLISort<Type>::delete_all()
{
DL_Node<void*>* node;
Type* obj;
for ( int i = 0; i < NB; i++ )
{
node = HD;
HD = node->_next;
obj = ( Type* )( node->_item );
delete obj;
delete node;
}
NB = 0; //reset memory used (no lost pointers)
TL = RT;
_current = RT;
}
// is item element of the list?
template<class Type>
bool TDLISort<Type>::has( Type* otheritem )
{
return DL_Iter<void*>::has( ( void* ) otheritem );
}
// goto to item
template<class Type>
bool TDLISort<Type>::toitem( Type* item )
{
return DL_Iter<void*>::toitem( ( void* ) item );
}
// get current item
template<class Type>
Type* TDLISort<Type>::item()
{
return ( Type* ) DL_Iter<void*>::item();
}
template<class Type>
TDLIStack<Type>::TDLIStack( DL_List<void*>* newlist ): DL_StackIter<void*>( newlist )
{}
// destructor TDLI
template<class Type>
TDLIStack<Type>::~TDLIStack()
{}
// plaats nieuw item op stack
template<class Type>
void TDLIStack<Type>::push( Type* newitem )
{
DL_StackIter<void*>::push( ( Type* ) newitem );
}
// haal bovenste item van stack
template<class Type>
Type* TDLIStack<Type>::pop()
{
return ( Type* ) DL_StackIter<void*>::pop();
}
/*! \file kbool/include/kbool/_lnk_itr.h
\author Probably Klaas Holwerda
Copyright: 2001-2004 (C) Probably Klaas Holwerda
Licence: wxWidgets Licence
RCS-ID: $Id: _lnk_itr.h,v 1.2 2006/12/15 21:00:05 titato Exp $
*/
//! author="Klaas Holwerda"
//! version="1.0"
/*
* Definitions of classes, for list implementation
* template list and iterator for any list node type
*/
#ifndef _LinkBaseIter_H
#define _LinkBaseIter_H
//! headerfiles="_dl_itr.h stdlib.h misc.h gdsmes.h"
#include <stdlib.h>
#include "kbool/booleng.h"
#define SWAP(x,y,t)((t)=(x),(x)=(y),(y)=(t))
#include "kbool/_dl_itr.h"
//! codefiles="_dl_itr.cpp"
//! Template class TDLI
/*!
class for iterator on DL_List<void*> that is type casted version of DL_Iter
\sa DL_Iter for further documentation
*/
template<class Type> class TDLI : public DL_Iter<void*>
{
public:
//!constructor
/*!
\param list to iterate on.
*/
TDLI( DL_List<void*>* list );
//!constructor
TDLI( DL_Iter<void*>* otheriter );
//! nolist constructor
TDLI();
//! destructor
~TDLI();
//!call fp for each item
void foreach_f( void ( *fp ) ( Type* item ) );
//!call fp for each item
void foreach_mf( void ( Type::*fp ) () );
/* list mutations */
//! delete all items
void delete_all ();
//! insert at end
void insend ( Type* n );
//! insert at begin
void insbegin ( Type* n );
//! insert before current
void insbefore ( Type* n );
//! insert after current
void insafter ( Type* n );
//! insert at end unsave (works even if more then one iterator is on the list
//! the user must be sure not to delete/remove items where other iterators
//! are pointing to.
void insend_unsave ( Type* n );
//! insert at begin unsave (works even if more then one iterator is on the list
//! the user must be sure not to delete/remove items where other iterators
//! are pointing to.
void insbegin_unsave ( Type* n );
//! insert before iterator position unsave (works even if more then one iterator is on the list
//! the user must be sure not to delete/remove items where other iterators
//! are pointing to.
void insbefore_unsave ( Type* n );
//! insert after iterator position unsave (works even if more then one iterator is on the list
//! the user must be sure not to delete/remove items where other iterators
//! are pointing to.
void insafter_unsave ( Type* n );
//! \sa DL_Iter::takeover(DL_List< Dtype >* otherlist )
void takeover ( DL_List<void*>* otherlist );
//! \sa DL_Iter::takeover(DL_Iter* otheriter)
void takeover ( TDLI* otheriter );
//! \sa DL_Iter::takeover(DL_Iter* otheriter, int maxcount)
void takeover ( TDLI* otheriter, int maxcount );
//! \sa DL_Iter::has
bool has ( Type* );
//! \sa DL_Iter::toitem
bool toitem ( Type* );
//!get the item then iterator is pointing at
Type* item ();
//! \sa DL_Iter::mergesort
void mergesort ( int ( *f )( Type* a, Type* b ) );
//! \sa DL_Iter::cocktailsort
int cocktailsort( int ( * ) ( Type* a, Type* b ), bool ( * ) ( Type* c, Type* d ) = NULL );
};
//! Template class TDLIsort
/*!
// class for sort iterator on DL_List<void*> that is type casted version of DL_SortIter
// see also inhereted class DL_SortIter for further documentation
*/
template<class Type> class TDLISort : public DL_SortIter<void*>
{
public:
//!constructor givin a list and a sort function
TDLISort( DL_List<void*>* list, int ( *newfunc )( void*, void* ) );
~TDLISort();
//!delete all items from the list
void delete_all();
bool has ( Type* );
bool toitem ( Type* );
Type* item ();
};
//! Template class TDLIStack
/*!
class for iterator on DL_List<void*> that is type casted version of DL_StackIter
see also inhereted class DL_StackIter for further documentation
*/
template<class Type> class TDLIStack : public DL_StackIter<void*>
{
public:
//constructor givin a list
TDLIStack( DL_List<void*>* list );
~TDLIStack();
void push( Type* );
Type* pop();
};
#include"kbool/_lnk_itr.cpp"
#endif
This diff is collapsed.
/*! \file include/graph.h
\author Klaas Holwerda
Copyright: 2001-2004 (C) Klaas Holwerda
Licence: see kboollicense.txt
RCS-ID: $Id: graph.h,v 1.3 2008/06/04 21:23:21 titato Exp $
*/
/* @@(#) $Source: /cvsroot/wxart2d/wxArt2D/thirdparty/kbool/include/kbool/graph.h,v $ $Revision: 1.3 $ $Date: 2008/06/04 21:23:21 $ */
/*
Program GRAPH.H
Purpose Used to Intercect and other process functions
Last Update 03-04-1996
*/
#ifndef GRAPH_H
#define GRAPH_H
#include "kbool/booleng.h"
#include "kbool/_lnk_itr.h"
#include "kbool/link.h"
#include "kbool/line.h"
#include "kbool/scanbeam.h"
class Node;
class GraphList;
//! one graph containing links that cab be connected.
class A2DKBOOLDLLEXP Graph
{
protected:
Bool_Engine* _GC;
public:
Graph( Bool_Engine* GC );
Graph( KBoolLink*, Bool_Engine* GC );
Graph( Graph* other );
~Graph();
bool GetBin() { return _bin; };
void SetBin( bool b ) { _bin = b; };
void Prepare( int intersectionruns );
void RoundInt( B_INT grid );
void Rotate( bool plus90 );
//! adds a link to the linklist
void AddLink( Node *begin, Node *end );
//! adds a link to the linklist
void AddLink( KBoolLink *a_link );
bool AreZeroLines( B_INT Marge );
//! Delete parallel lines
void DeleteDoubles();
//! delete zerolines
bool DeleteZeroLines( B_INT Marge );
bool RemoveNullLinks();
//! Process found intersections
void ProcessCrossings();
//! set flags for operations based on group
void Set_Operation_Flags();
//! Left Right values
void Remove_IN_Links();
//! reset bin and mark flags in links.
void ResetBinMark();
// Remove unused links
void ReverseAllLinks();
//! Simplify the graph
bool Simplify( B_INT Marge );
//! Takes over all links of the argument
bool Smoothen( B_INT Marge );
void TakeOver( Graph* );
//! function for maximum performance
//! Get the First link from the graph
KBoolLink* GetFirstLink();
Node* GetTopNode();
void SetBeenHere( bool );
void Reset_flags();
//! Set the group of a graph
void SetGroup( GroupType );
//! Set the number of the graph
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 MakeOneDirection();
void Make_Rounded_Shape( KBoolLink* a_link, double factor );
bool MakeClockWise();
bool writegraph( bool linked );
bool writeintersections();
void WriteKEY( Bool_Engine* GC, FILE* file = NULL );
void WriteGraphKEY( Bool_Engine* GC );
protected:
//! Extracts partical polygons from the graph
/*
Links are sorted in XY at beginpoint. Bin and mark flag are reset.
Next start to collect subparts from the graph, setting the links bin for all found parts.
The parts are searched starting at a topleft corner NON set bin flag link.
Found parts are numbered, to be easily split into to real sperate graphs by Split()
\param operation operation to collect for.
\param detecthole if you want holes detected, influences also way of extraction.
\param foundholes when holes are found this flag is set true, but only if detecthole is set true.
*/
void Extract_Simples( BOOL_OP operation, bool detecthole, bool& foundholes );
//! split graph into small graph, using the numbers in links.
void Split( GraphList* partlist );
//! Collect a graph by starting at argument link
/*
Called from Extract_Simples, and assumes sorted links with bin flag unset for non extarted piece
Collect graphs pieces from a total graph, by following links set to a given boolean operation.
\param current_node start node to collect
\param operation operation to collect for.
\param detecthole if you want holes detected, influences also way of extraction.
\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 CollectGraphLast( Node *current_node, BOOL_OP operation, bool detecthole, int graphnumber, bool& foundholes );
//! find a link not bin in the top left corner ( links should be sorted already )
/*!
Last found position is used to find it quickly.
Used in ExtractSimples()
*/
Node* GetMostTopLeft( TDLI<KBoolLink>* _LI );
//! calculates crossing for all links in a graph, and add those as part of the graph.
/*
It is not just crossings calculation, snapping close nodes is part of it.
This is not done at maximum stability in economic time.
There are faster ways, but hardly ever they solve the problems, and they do not snap.
Here it is on purpose split into separate steps, to get a better result in snapping, and
to reach a better stability.
\param Marge nodes and lines closer to eachother then this, are merged.
*/
bool CalculateCrossings( B_INT Marge );
//! equal nodes in position are merged into one.
int Merge_NodeToNode( B_INT Marge );
//! basic scan algorithm with a sweeping beam are line.
/*!
\param scantype a different face in the algorithm.
\param holes to detect hole when needed.
*/
int ScanGraph2( SCANTYPE scantype, bool& holes );
//! links not used for a certain operation can be deleted, simplifying extraction
void DeleteNonCond( BOOL_OP operation );
//! links not used for a certain operation can be set bin, simplifying extraction
void HandleNonCond( BOOL_OP operation );
//! debug
bool checksort();
//! used in correction/offset algorithm
bool Small( B_INT howsmall );
bool _bin;
DL_List<void*>* _linklist;
};
#endif
/*! \file include/graphlst.h
\author Klaas Holwerda
Copyright: 2001-2004 (C) Klaas Holwerda
Licence: see kboollicense.txt
RCS-ID: $Id: graphlst.h,v 1.3 2008/06/04 21:23:21 titato Exp $
*/
/* @@(#) $Source: /cvsroot/wxart2d/wxArt2D/thirdparty/kbool/include/kbool/graphlst.h,v $ $Revision: 1.3 $ $Date: 2008/06/04 21:23:21 $ */
/*
Program GRAPHLST.H
Purpose Implements a list of graphs (header)
Last Update 11-03-1996
*/
#ifndef GRAPHLIST_H
#define GRAPHLIST_H
#include "kbool/booleng.h"
#include "kbool/_lnk_itr.h"
#include "kbool/graph.h"
class Debug_driver;
class A2DKBOOLDLLEXP GraphList: public DL_List<void*>
{
protected:
Bool_Engine* _GC;
public:
GraphList( Bool_Engine* GC );
GraphList( GraphList* other );
~GraphList();
void MakeOneGraph( Graph *total );
void Prepare( Graph *total );
void MakeRings();
void Correction();
void Simplify( double marge );
void Smoothen( double marge );
void Merge();
void Boolean( BOOL_OP operation, int intersectionRunsMax );
void WriteGraphs();
void WriteGraphsKEY( Bool_Engine* GC );
protected:
void Renumber();
void UnMarkAll();
};
#endif
#ifndef __A2D_KBOOLMOD_H__
#define __A2D_KBOOLMOD_H__
#include "kbool/booleng.h"
#include "kbool/graph.h"
#include "kbool/graphlst.h"
#include "kbool/line.h"
#include "kbool/link.h"
#include "kbool/lpoint.h"
#include "kbool/node.h"
#include "kbool/record.h"
#include "kbool/scanbeam.h"
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment