Commit 44743723 authored by charras's avatar charras

removed GPC library due to its unacceptable license. Using the great and...

removed GPC library due to its unacceptable license. Using the great and powerfull kbool library insteed
parent e3b63f83
......@@ -101,6 +101,7 @@ add_subdirectory(gerbview)
add_subdirectory(kicad)
add_subdirectory(pcbnew)
add_subdirectory(polygon)
add_subdirectory(polygon/kbool/src)
# Resources.
add_subdirectory(demos)
add_subdirectory(internat)
......
# Generate a static library target named "libbitmaps.a"
# Copy the *.xmp files to *.cpp, on change only.
# Compile those *.cpp files and put them into the library, then done.
OBJECTS = \
3d.o\
Add_Arc.o\
......@@ -287,5 +283,88 @@ OBJECTS = \
Zoom_Page.o\
Zoom_Selected.o\
Zoom_Select.o\
zoom.o
zoom.o\
axis3d_back.o\
axis3d_bottom.o\
axis3d_front.o\
axis3d_left.o\
axis3d_right.o\
axis3d_top.o\
axis3d.o\
import3d.o\
rotate-x.o\
rotate+x.o\
rotate-y.o\
rotate+y.o\
rotate-z.o\
rotate+z.o\
zoomoins3d.o\
zoompage3d.o\
zoomplus3d.o\
zoomrefr3d.o\
Lang_Catalan.o\
Lang_chinese.o\
Lang_Default.o\
Lang_De.o\
Lang_En.o\
Lang_Es.o\
Lang_Fr.o\
Lang_Hu.o\
Lang_It.o\
Lang_Ko.o\
Lang_Nl.o\
Lang_Pl.o\
Lang_Pt.o\
Lang_Ru.o\
Lang_Sl.o\
Language.o\
delete_association.o\
module_filtered_list.o\
module_full_list.o\
Break_Bus.o\
cvpcb.o\
Delete_Bus.o\
Delete_Connection.o\
Delete_GLabel.o\
Delete_Pinsheet.o\
Delete_Pin.o\
Delete_Sheet.o\
Edit_Comp_Footprint.o\
Edit_Component.o\
Edit_Comp_Ref.o\
Edit_Comp_Value.o\
Edit_Part.o\
Edit_Sheet.o\
Enter_Sheet.o\
GLabel2Label.o\
GLabel2Text.o\
GL_Change.o\
Hidden_Pin.o\
Hierarchy_cursor.o\
Hierarchy_Nav.o\
Label2GLabel.o\
Label2Text.o\
Leave_Sheet.o\
libedit_icon.o\
libedit.o\
Lib_next.o\
Lib_previous.o\
library_browse.o\
Lines90.o\
Move_GLabel.o\
Move_Pinsheet.o\
Move_Sheet.o\
new_component.o\
Normal.o\
Options_Pinsheet.o\
Options_Pin.o\
part_properties.o\
pin2pin.o\
Pin_Name_to.o\
Pin_Number_to.o\
Pin_Size_to.o\
Pin_to.o\
Resize_Sheet.o\
Rotate_GLabel.o\
Rotate_Pin.o\
viewlibs_icon.o
......@@ -5,6 +5,14 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-May-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew
removed GPC library due to its unacceptable (and stupid) license
using the powerfull kbool library insteed (see polygon/kbool)
+all:
minor changes
2008-May-22 UPDATE Martin Kajdas <kajdas@cox.com>
================================================================================
......
......@@ -244,7 +244,7 @@ void WinEDA_BasicFrame::GetKicadHelp( wxCommandEvent& event )
void WinEDA_BasicFrame::GetKicadAbout( wxCommandEvent& event )
/**********************************************************/
{
Print_Kicad_Infos( this, m_AboutTitle );
Print_Kicad_Infos( this, m_AboutTitle, wxEmptyString );
}
......
/************************************************************************/
/* MODULE edamenu.cpp */
/************************************************************************/
/****************************/
/* INCLUDES SYSTEMES */
/****************************/
#include "fctsys.h"
#include "wxstruct.h"
#include "gr_basic.h"
#include "macros.h"
#include "common.h"
#include "worksheet.h"
/* Pour imprimer / lire en unites utilisateur ( INCHES / MM ) */
/* Retourne la valeur en inch ou mm de la valeur val en units internes
*/
double To_User_Unit(bool is_metric, int val,int internal_unit_value)
{
double value;
if (is_metric)
value = (double) (val) * 25.4 / internal_unit_value;
else value = (double) (val) / internal_unit_value;
return value;
}
/* Retourne la valeur en units internes de la valeur val exprime en inch ou mm
*/
int From_User_Unit(bool is_metric, double val,int internal_unit_value)
{
double value;
if (is_metric) value = val * internal_unit_value / 25.4 ;
else value = val * internal_unit_value;
return (int) round(value);
}
/**********************/
wxString GenDate()
/**********************/
/* Retourne la chaine de caractere donnant la date */
{
static char * mois[12] =
{
"jan", "feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"
};
time_t buftime;
struct tm * Date;
wxString string_date;
char Line[1024];
time(&buftime);
Date = gmtime(&buftime);
sprintf(Line,"%d %s %d", Date->tm_mday,
mois[Date->tm_mon],
Date->tm_year + 1900);
string_date = Line;
return(string_date);
}
/***********************************/
void * MyMalloc (size_t nb_octets)
/***********************************/
/* Routine d'allocation memoire */
{
void * pt_mem;
char txt[60];
if (nb_octets == 0)
{
DisplayError(NULL, "Allocate 0 bytes !!");
return(NULL);
}
pt_mem = malloc(nb_octets);
if (pt_mem == NULL)
{
sprintf(txt,"Out of memory: allocation %d bytes", nb_octets);
DisplayError(NULL, txt);
}
return(pt_mem);
}
/************************************/
void * MyZMalloc (size_t nb_octets)
/************************************/
/* Routine d'allocation memoire, avec remise a zero de la zone allouee */
{
void * pt_mem = MyMalloc (nb_octets);
if ( pt_mem) memset(pt_mem, 0, nb_octets);
return(pt_mem);
}
/*******************************/
void MyFree (void * pt_mem)
/*******************************/
{
if( pt_mem ) free(pt_mem);
}
/****************************************************/
/* Display a generic info about kikac (copyright..) */
/* Common tp CVPCB, EESCHEMA, PCBNEW and GERBVIEW */
/****************************************************/
/****************************************************/
/* Display a generic info about kikac (copyright..) */
/* Common tp CVPCB, EESCHEMA, PCBNEW and GERBVIEW */
/****************************************************/
#include "fctsys.h"
#include "gr_basic.h"
......@@ -14,53 +14,52 @@
// Import:
extern wxString g_Main_Title;
/* Program title strings used in about dialog. They are kept hear to make
/* Program title strings used in about dialog. They are kept here to make
* it easy to update the copyright dates. */
wxString g_KicadAboutTitle = wxT("** KICAD (jul 2000 .. 2008) **");
wxString g_CvpcbAboutTitle = wxT("** CVPCB (sept 1992 .. 2008) **");
wxString g_EeschemaAboutTitle = wxT("** EESCHEMA (sept 1994 .. 2008) **");
wxString g_PcbnewAboutTitle = wxT("** PCBNEW (sept 1992 .. 2008) **");
wxString g_GerbviewAboutTitle = wxT("** GERBVIEW (jul 2001 .. 2008) **");
wxString g_KicadAboutTitle = wxT( "** KICAD (jul 2000 .. 2008) **" );
wxString g_CvpcbAboutTitle = wxT( "** CVPCB (sept 1992 .. 2008) **" );
wxString g_EeschemaAboutTitle = wxT( "** EESCHEMA (sept 1994 .. 2008) **" );
wxString g_PcbnewAboutTitle = wxT( "** PCBNEW (sept 1992 .. 2008) **" );
wxString g_GerbviewAboutTitle = wxT( "** GERBVIEW (jul 2001 .. 2008) **" );
// Routines Locales
/*******************************************/
void Print_Kicad_Infos(wxWindow * frame, const wxString& title)
/*******************************************/
/**************************************************************/
void Print_Kicad_Infos( wxWindow* frame, const wxString& title,
const wxString& aExtra_infos )
/**************************************************************/
{
wxString AboutCaption = wxT("About ");
wxString AboutCaption = wxT( "About " );
wxString Msg = title;
Msg << wxT("\n\n") << _("Build Version:") << wxT("\n") ;
Msg << wxT( "\n\n" ) << _( "Build Version:" ) << wxT( "\n" );
Msg << g_Main_Title << wxT(" ") << GetBuildVersion();
Msg << g_Main_Title << wxT( " " ) << GetBuildVersion();
#if wxUSE_UNICODE
Msg << wxT(" - Unicode version");
Msg << wxT( " - Unicode version" );
#else
Msg << wxT(" - Ansi version");
Msg << wxT( " - Ansi version" );
#endif
#ifdef KICAD_PYTHON
Msg << wxT("\n");
Msg << wxT( "\n" );
Msg << wxT( "python : " );
Msg << wxString::FromAscii( PyHandler::GetInstance()->GetVersion() );
#endif
Msg << wxT("\n\n") << _("Author:");
Msg << wxT(" JP CHARRAS\n\n") << _("Based on wxWidgets ");
Msg << wxMAJOR_VERSION << wxT(".") <<
wxMINOR_VERSION << wxT(".") << wxRELEASE_NUMBER;
Msg << wxT( "\n\n" ) << _( "Author:" );
Msg << wxT( " JP CHARRAS\n\n" ) << _( "Based on wxWidgets " );
Msg << wxMAJOR_VERSION << wxT( "." ) <<
wxMINOR_VERSION << wxT( "." ) << wxRELEASE_NUMBER;
if( wxSUBRELEASE_NUMBER )
Msg << wxT(".") << wxSUBRELEASE_NUMBER;
Msg << _("\n\nGPL License");
Msg << _("\n\nAuthor's sites:\n");
Msg << wxT("http://iut-tice.ujf-grenoble.fr/kicad/\n");
Msg << wxT("http://www.gipsa-lab.inpg.fr/realise_au_lis/kicad/");
Msg << _("\n\nInternational wiki:\n");
Msg << wxT("http://kicad.sourceforge.net/\n");
Msg << wxT( "." ) << wxSUBRELEASE_NUMBER;
Msg << _( "\n\nGPL License" );
Msg << _( "\n\nAuthor's sites:\n" );
Msg << wxT( "http://iut-tice.ujf-grenoble.fr/kicad/\n" );
Msg << wxT( "http://www.gipsa-lab.inpg.fr/realise_au_lis/kicad/" );
Msg << _( "\n\nInternational wiki:\n" );
Msg << wxT( "http://kicad.sourceforge.net/\n" );
Msg << aExtra_infos;
AboutCaption << g_Main_Title << wxT(" ") << GetBuildVersion();
AboutCaption << g_Main_Title << wxT( " " ) << GetBuildVersion();
wxMessageBox(Msg, AboutCaption, wxICON_INFORMATION, frame);
wxMessageBox( Msg, AboutCaption, wxICON_INFORMATION, frame );
}
......@@ -71,7 +71,7 @@ endif(APPLE)
add_executable(cvpcb WIN32 MACOSX_BUNDLE ${CVPCB_SRCS} ${CVPCB_EXTRA_SRCS} ${CVPCB_RESOURCES})
target_link_libraries(cvpcb 3d-viewer common polygon bitmaps ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES})
target_link_libraries(cvpcb 3d-viewer common polygon kbool bitmaps ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES})
install(TARGETS cvpcb RUNTIME DESTINATION ${KICAD_BIN}
COMPONENT binary)
......@@ -3,10 +3,12 @@ OBJSUFF = o
EXTRACPPFLAGS += -DCVPCB -fno-strict-aliasing\
-I./ -I../cvpcb -I../include -Ibitmaps\
-I../pcbnew -I../3d-viewer\
-I../polygon
-I../pcbnew -I../3d-viewer -I ../polygon
EXTRALIBS = ../common/common.a ../bitmaps/libbitmaps.a\
../polygon/lib_polygon.a\
../polygon/kbool/src/libkbool.a
EXTRALIBS = ../common/common.a ../bitmaps/libbitmaps.a ../polygon/lib_polygon.a
LIBVIEWER3D = ../3d-viewer/3d-viewer.a
......
......@@ -73,7 +73,7 @@ endif(APPLE)
add_executable(gerbview WIN32 MACOSX_BUNDLE ${GERBVIEW_SRCS} ${GERBVIEW_EXTRA_SRCS} ${GERBVIEW_RESOURCES})
target_link_libraries(gerbview 3d-viewer common polygon bitmaps ${wxWidgets_LIBRARIES})
target_link_libraries(gerbview 3d-viewer common polygon kbool bitmaps ${wxWidgets_LIBRARIES})
install(TARGETS gerbview RUNTIME DESTINATION ${KICAD_BIN}
COMPONENT binary)
......@@ -9,7 +9,7 @@ COMMON_GLOBL wxString g_BuildVersion
# include "config.h"
(wxT(KICAD_SVN_VERSION))
# else
(wxT("(20080429-r1010)"))
(wxT("(20080530-r1107)"))
# endif
#endif
;
......
This diff is collapsed.
......@@ -329,6 +329,8 @@ public:
~WinEDA_PcbFrame();
void GetKicadAbout( wxCommandEvent& event );
// Configurations:
void InstallConfigFrame( const wxPoint& pos );
void Process_Config( wxCommandEvent& event );
......
No preview for this file type
This diff is collapsed.
......@@ -27,6 +27,24 @@
// UnComment this to load subdirs files in the tree project
#define ADD_FILES_IN_SUBDIRS
// list of files extensions listed in the tree project window
// *.sch files are always allowed, do not add here
// Add extensions in a compatible regex format to see others files types
const wxChar * s_AllowedExtensionsToList[] =
{
wxT( "^.*\\.pro$" ),
wxT( "^.*\\.pdf$" ),
wxT( "^[^$].*\\.brd$" ),
wxT( "^.*\\.net$" ),
wxT( "^.*\\.txt$" ),
wxT( "^.*\\.pho$" ),
wxT( "^.*\\.odt$" ),
wxT( "^.*\\.sxw$" ),
wxT( "^.*\\.htm$" ),
wxT( "^.*\\.html$" ),
NULL // end of list
};
/******************************************************************/
WinEDA_PrjFrame::WinEDA_PrjFrame( WinEDA_MainFrame* parent,
const wxPoint& pos,
......@@ -44,12 +62,10 @@ WinEDA_PrjFrame::WinEDA_PrjFrame( WinEDA_MainFrame* parent,
* for a given file type.
*/
m_Filters.push_back( wxT( "^.*\\.sch$" ) ); // note: sch filter must be first because of a test in AddFile() below
m_Filters.push_back( wxT( "^.*\\.pro$" ) );
m_Filters.push_back( wxT( "^.*\\.pdf$" ) );
m_Filters.push_back( wxT( "^[^$].*\\.brd$" ) );
m_Filters.push_back( wxT( "^.*\\.net$" ) );
m_Filters.push_back( wxT( "^.*\\.txt$" ) );
m_Filters.push_back( wxT( "^.*\\.pho$" ) );
for ( int ii = 0; s_AllowedExtensionsToList[ii] != NULL; ii++ )
{
m_Filters.push_back( s_AllowedExtensionsToList[ii] );
}
m_Filters.push_back( wxT( "^no kicad files found" ) );
#ifdef KICAD_PYTHON
......
KICAD_SUBDIRS = common bitmaps 3d-viewer polygon eeschema eeschema/plugins pcbnew kicad cvpcb gerbview
KICAD_SUBDIRS = common bitmaps 3d-viewer polygon polygon/kbool/src eeschema eeschema/plugins pcbnew kicad cvpcb gerbview
KICAD_SUBDIRS_BIN = eeschema eeschema/plugins pcbnew cvpcb kicad gerbview
# How to invoke make:
MAKE = make -k -f makefile.g95
......
......@@ -163,7 +163,7 @@ endif(APPLE)
add_executable(pcbnew WIN32 MACOSX_BUNDLE ${PCBNEW_SRCS} ${PCBNEW_EXTRA_SRCS} ${PCBNEW_RESOURCES})
target_link_libraries(pcbnew 3d-viewer common polygon bitmaps ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} )
target_link_libraries(pcbnew 3d-viewer common polygon kbool bitmaps ${wxWidgets_LIBRARIES} ${OPENGL_LIBRARIES} )
install(TARGETS pcbnew RUNTIME DESTINATION ${KICAD_BIN}
COMPONENT binary)
......
EXTRALIBS = ../common/common.a ../bitmaps/libbitmaps.a ../polygon/lib_polygon.a
EXTRALIBS = ../common/common.a ../bitmaps/libbitmaps.a\
../polygon/lib_polygon.a\
../polygon/kbool/src/libkbool.a
EXTRACPPFLAGS += -DPCBNEW -fno-strict-aliasing -I./ -Ibitmaps -I../include -I../share\
-I../pcbnew -I../3d-viewer -I../polygon
......
......@@ -478,7 +478,7 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
wxMenu* via_mnu = new wxMenu();
ADD_MENUITEM_WITH_SUBMENU( PopMenu, via_mnu,
ID_POPUP_PCB_VIA_EDITING, _( "Edit Via" ), edit_xpm );
ID_POPUP_PCB_VIA_EDITING, _( "Edit Via Drill" ), edit_xpm );
ADD_MENUITEM( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_DEFAULT,
_( "Set via hole to Default" ), apply_xpm );
msg = _( "Set via hole to a specific value. This specfic value is currently" );
......@@ -486,7 +486,7 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_TO_VALUE,
_( "Set via hole to alt value" ), msg,
options_new_pad_xpm );
msg = _( "Set alt via hole value. This value is currently" );
msg = _( "Set a specific via hole value. This value is currently" );
msg << wxT(" ") << ReturnStringFromValue( g_UnitMetric, g_DesignSettings.m_ViaDrillCustomValue, m_InternalUnits );
ADD_MENUITEM_WITH_HELP( via_mnu, ID_POPUP_PCB_VIA_HOLE_ENTER_VALUE,
_( "Set the via hole alt value" ), msg, edit_xpm );
......@@ -559,18 +559,18 @@ void WinEDA_PcbFrame::createPopupMenuForTracks( TRACK* Track, wxMenu* PopMenu )
ADD_MENUITEM_WITH_SUBMENU( PopMenu, track_mnu,
ID_POPUP_PCB_EDIT_TRACK_MNU, _( "Change Width" ), width_track_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACKSEG,
Track->Type()==TYPEVIA ? _( "Edit Via" ) : _( "Edit Segment" ), width_segment_xpm );
Track->Type()==TYPEVIA ? _( "Change Via Size" ) : _( "Change Segment Width" ), width_segment_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_TRACK,
_( "Edit Track" ), width_track_xpm );
_( "Change Track Width" ), width_track_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_NET,
_( "Edit Net" ), width_net_xpm );
_( "Change Net" ), width_net_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE,
_( "Edit ALL Tracks and Vias" ), width_track_via_xpm );
_( "Change ALL Tracks and Vias" ), width_track_via_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_VIAS_SIZE,
_( "Edit ALL Vias (no track)" ), width_vias_xpm );
_( "Change ALL Vias (no track)" ), width_vias_xpm );
ADD_MENUITEM( track_mnu, ID_POPUP_PCB_EDIT_ALL_TRACK_SIZE,
_( "Edit ALL Tracks (no via)" ), width_track_xpm );
_( "Change ALL Tracks (no via)" ), width_track_xpm );
}
// Delete control:
......
......@@ -12,7 +12,7 @@
#include "protos.h"
#include "id.h"
#include "drc_stuff.h"
#include "kbool/include/booleng.h"
/*******************************/
/* class WinEDA_PcbFrame */
......@@ -99,7 +99,7 @@ BEGIN_EVENT_TABLE( WinEDA_PcbFrame, WinEDA_BasePcbFrame )
// Menu Help
EVT_MENU( ID_GENERAL_HELP, WinEDA_DrawFrame::GetKicadHelp )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_DrawFrame::GetKicadAbout )
EVT_MENU( ID_KICAD_ABOUT, WinEDA_PcbFrame::GetKicadAbout )
// Menu 3D Frame
EVT_MENU( ID_MENU_PCB_SHOW_3D_FRAME, WinEDA_PcbFrame::Show3D_Frame )
......@@ -245,8 +245,9 @@ WinEDA_PcbFrame::WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent,
ReCreateOptToolbar();
}
/************************************/
WinEDA_PcbFrame::~WinEDA_PcbFrame()
/************************************/
{
m_Parent->m_PcbFrame = NULL;
SetBaseScreen( ScreenPcb );
......@@ -566,3 +567,15 @@ void WinEDA_PcbFrame::SetToolbars()
DisplayUnitsMsg();
}
/***********************************************************/
void WinEDA_PcbFrame::GetKicadAbout( wxCommandEvent& event )
/**********************************************************/
{
wxString extra_message =
wxT("\nPcbnew uses the kbool library (boolean operations on sets of 2d polygons)\n");
extra_message << wxT("version ") << wxT(KBOOL_VERSION)
<< wxT("\nsee http://boolean.klaasholwerda.nl/bool.html\n");
Print_Kicad_Infos( this, m_AboutTitle, extra_message );
}
This diff is collapsed.
set(POLYGON_SRCS
GenericPolygonClipperLibrary.cpp
math_for_graphics.cpp
php_polygon.cpp
php_polygon_vertex.cpp
PolyLine.cpp)
add_library(polygon ${POLYGON_SRCS})
This diff is collapsed.
/*
===========================================================================
Project: Generic Polygon Clipper
A new algorithm for calculating the difference, intersection,
exclusive-or or union of arbitrary polygon sets.
File: gpc.h
Author: Alan Murta (email: gpc@cs.man.ac.uk)
Version: 2.32
Date: 17th December 2004
Copyright: (C) Advanced Interfaces Group,
University of Manchester.
This software is free for non-commercial use. It may be copied,
modified, and redistributed provided that this copyright notice
is preserved on all copies. The intellectual property rights of
the algorithms used reside with the University of Manchester
Advanced Interfaces Group.
You may not use this software, in whole or in part, in support
of any commercial product without the express consent of the
author.
There is no warranty or other guarantee of fitness of this
software for any purpose. It is provided solely "as is".
===========================================================================
*/
#ifndef __gpc_h
#define __gpc_h
#include <stdio.h>
/*
===========================================================================
Constants
===========================================================================
*/
/* Increase GPC_EPSILON to encourage merging of near coincident edges */
#define GPC_EPSILON (DBL_EPSILON)
#define GPC_VERSION "2.32"
/*
===========================================================================
Public Data Types
===========================================================================
*/
typedef enum /* Set operation type */
{
GPC_DIFF, /* Difference */
GPC_INT, /* Intersection */
GPC_XOR, /* Exclusive or */
GPC_UNION /* Union */
} gpc_op;
typedef struct /* Polygon vertex structure */
{
double x; /* Vertex x component */
double y; /* vertex y component */
} gpc_vertex;
typedef struct /* Vertex list structure */
{
int num_vertices; /* Number of vertices in list */
gpc_vertex *vertex; /* Vertex array pointer */
} gpc_vertex_list;
typedef struct /* Polygon set structure */
{
int num_contours; /* Number of contours in polygon */
int *hole; /* Hole / external contour flags */
gpc_vertex_list *contour; /* Contour array pointer */
} gpc_polygon;
typedef struct /* Tristrip set structure */
{
int num_strips; /* Number of tristrips */
gpc_vertex_list *strip; /* Tristrip array pointer */
} gpc_tristrip;
/*
===========================================================================
Public Function Prototypes
===========================================================================
*/
void gpc_read_polygon (FILE *infile_ptr,
int read_hole_flags,
gpc_polygon *polygon);
void gpc_write_polygon (FILE *outfile_ptr,
int write_hole_flags,
gpc_polygon *polygon);
void gpc_add_contour (gpc_polygon *polygon,
gpc_vertex_list *contour,
int hole);
void gpc_polygon_clip (gpc_op set_operation,
gpc_polygon *subject_polygon,
gpc_polygon *clip_polygon,
gpc_polygon *result_polygon);
void gpc_tristrip_clip (gpc_op set_operation,
gpc_polygon *subject_polygon,
gpc_polygon *clip_polygon,
gpc_tristrip *result_tristrip);
void gpc_polygon_to_tristrip (gpc_polygon *polygon,
gpc_tristrip *tristrip);
void gpc_free_polygon (gpc_polygon *polygon);
void gpc_free_tristrip (gpc_tristrip *tristrip);
#endif
/*
===========================================================================
End of file: gpc.h
===========================================================================
*/
Generic Polygon Clipper (gpc) Revision History
==============================================
v2.32 17th Dec 2004
---------------------
Fixed occasional memory leak occurring when processing some
degenerate polygon arrangements.
Added explicit type casting to memory allocator in support of
increased code portability.
v2.31 4th Jun 1999
---------------------
Separated edge merging measure based on a user-defined GPC_EPSILON
value from general numeric equality testing and ordering, which now
uses direct arithmetic comparison rather an EPSILON based proximity
test.
Fixed problem with numerical equality test during construction of
local minima and scanbeam tables, leading to occasional crash.
Fixed hole array memory leak in gpc_add_contour.
Fixed uninitialised hole field bug in gpc_polygon_clip result.
v2.30 11th Apr 1999
---------------------
Major re-write.
Minor API change: additional 'hole' array field added to gpc_polygon
datatype to indicate which constituent contours are internal holes,
and which form external boundaries.
Minor API change: additional 'hole' argument to gpc_add_contour
to indicate whether the new contour is a hole or external contour.
Minor API change: additional parameter to gpc_read_polygon and
gpc_write_polygon to indicate whether or not to read or write
contour hole flags.
Fixed NULL pointer bug in add/merge left/right operations.
Fixed numerical problem in intersection table generation.
Fixed zero byte malloc problem.
Fixed problem producing occasional 2 vertex contours.
Added bounding box test optimisations.
Simplified edge bundle creation, detection of scanbeam internal
edge intersections and tristrip scanbeam boundary code.
Renamed 'class' variable to be C++ friendly.
v2.22 17th Oct 1998
---------------------
Re-implemented edge interpolation and intersection calculations
to improve numerical robustness.
Simplified setting of GPC_EPSILON.
v2.21 19th Aug 1998
---------------------
Fixed problem causing occasional incorrect output when processing
self-intersecting polygons (bow-ties etc).
Removed bug which may lead to non-generation of uppermost triangle
in tristrip output.
v2.20 26th May 1998
---------------------
Major re-write.
Added exclusive-or polygon set operation.
Replaced table-based processing of edge intersections with
rule-based system.
Replaced two-pass approach to scanbeam interior processing with
single pass method.
v2.10a 14th May 1998
---------------------
Minor bug-fixes to counter some v2.10 reliability problems.
v2.10 11th May 1998
---------------------
Major re-write.
Incorporated edge bundle processing of AET to overcome coincident
edge problems present in previous releases.
Replaced Vatti's method for processing scanbeam interior regions
with an adapted version of the scanbeam boundary processing
algorithm.
v2.02 16th Apr 1998 (unreleased)
----------------------------------
Fixed internal minimum vertex duplication in gpc_polygon_clip
result.
Improved line intersection code discourage superfluous
intersections near line ends.
Removed limited precision number formatting in gpc_write_polygon.
Modification to allow subject or clip polygon to be reused as the
result in gpc_polygon_clip without memory leakage.
v2.01 23rd Feb 1998
---------------------
Removed bug causing duplicated vertices in output polygon.
Fixed scanbeam table index overrun problem.
v2.00 25th Nov 1997
---------------------
Major re-write.
Replaced temporary horizontal edge work-around (using tilting)
with true horizontal edge handling.
Trapezoidal output replaced by tristrips.
gpc_op constants now feature a `GPC_' prefix.
Data structures now passed by reference to gpc functions.
Replaced AET search by proxy addressing in polygon table.
Eliminated most (all?) coincident vertex / edge crashes.
v1.02 18th Oct 1997 (unreleased)
----------------------------------
Significantly reduced number of mallocs in build_lmt.
Scanbeam table now built using heapsort rather than insertion
sort.
v1.01 12th Oct 1997
---------------------
Fixed memory leak during output polygon build in
gpc_clip_polygon.
Removed superfluous logfile debug code.
Commented out malloc counts.
Added missing horizontal edge tilt-correction code in
gpc_clip_polygon.
v1.00 8th Oct 1997
--------------------
First release.
This diff is collapsed.
// PolyLine.h ... definition of CPolyLine class
//
// A polyline contains one or more contours, where each contour
// is defined by a list of corners and side-styles
......@@ -16,33 +17,67 @@
#include <vector>
#define USE_GPC_POLY_LIB
//#define USE_GPL_POLY_LIB
#include "kbool/include/booleng.h"
#include "freepcbDisplayList.h"
#include "pad_shapes.h"
#include "defs-macros.h"
#include "GenericPolygonClipperLibrary.h"
#include "php_polygon.h"
#include "php_polygon_vertex.h"
/** Function ArmBoolEng
* Initialise parameters used in kbool
* @param aBooleng = pointer to the Bool_Engine to initialise
* @param aConvertHoles = mode for holes when a boolean operation is made
* true: holes are linked into outer contours by double overlapping segments
* false: holes are not linked: in this mode contours are added clockwise
* and polygons added counter clockwise are holes
*/
void ArmBoolEng( Bool_Engine* aBooleng, bool aConvertHoles = false);
#include "PolyLine2Kicad.h"
#define PCBU_PER_MIL 10
#define NM_PER_MIL 10 // 25400
#include "freepcbDisplayList.h"
#include "math_for_graphics.h"
#define to_int( x ) (int) round( (x) )
#ifndef min
#define min( x1, x2 ) ( (x1) > (x2) ) ? (x2) : (x1)
#endif
#ifndef max
#define max( x1, x2 ) ( (x1) > (x2) ) ? (x1) : (x2)
#endif
class CRect
{
public:
int left, right, top, bottom;
};
class CSegment {
class CPoint
{
public:
int x, y;
public:
CPoint( void ) { x = y = 0; };
CPoint( int i, int j ) { x = i; y = j; };
};
class CSegment
{
public:
int xi, yi, xf, yf;
CSegment() {};
CSegment(int x0, int y0, int x1, int y1) {
xi = x0; yi = y0; xf = x1; yf = y1; }
CSegment() { };
CSegment( int x0, int y0, int x1, int y1 )
{
xi = x0; yi = y0; xf = x1; yf = y1;
}
};
class CArc {
#include "math_for_graphics.h"
class CArc
{
public:
enum{ MAX_STEP = 50*25400 }; // max step is 20 mils
enum{ MIN_STEPS = 18 }; // min step is 5 degrees
enum { MAX_STEP = 50 * 25400 }; // max step is 20 mils
enum { MIN_STEPS = 18 }; // min step is 5 degrees
int style;
int xi, yi, xf, yf;
int n_steps; // number of straight-line segments in gpc_poly
......@@ -52,8 +87,8 @@ public:
class CPolyPt
{
public:
CPolyPt( int qx=0, int qy=0, bool qf=FALSE )
{ x=qx; y=qy; end_contour=qf; utility = 0; };
CPolyPt( int qx = 0, int qy = 0, bool qf = FALSE )
{ x = qx; y = qy; end_contour = qf; utility = 0; };
int x;
int y;
bool end_contour;
......@@ -72,17 +107,18 @@ public:
// functions for modifying polyline
void Start( int layer, int x, int y, int hatch );
void AppendCorner( int x, int y, int style = STRAIGHT, bool bDraw=TRUE );
void AppendCorner( int x, int y, int style = STRAIGHT, bool bDraw = TRUE );
void InsertCorner( int ic, int x, int y );
void DeleteCorner( int ic, bool bDraw=TRUE );
void DeleteCorner( int ic, bool bDraw = TRUE );
void MoveCorner( int ic, int x, int y );
void Close( int style = STRAIGHT, bool bDraw=TRUE );
void Close( int style = STRAIGHT, bool bDraw = TRUE );
void RemoveContour( int icont );
void RemoveAllContours( void );
// drawing functions
void Undraw();
void Draw( );
void Draw();
void Hatch();
void MoveOrigin( int x_off, int y_off );
......@@ -90,7 +126,7 @@ public:
CRect GetBounds();
CRect GetCornerBounds();
CRect GetCornerBounds( int icont );
void Copy( CPolyLine * src );
void Copy( CPolyLine* src );
bool TestPointInside( int x, int y );
bool TestPointInsideContour( int icont, int x, int y );
bool IsCutoutContour( int icont );
......@@ -98,7 +134,7 @@ public:
// access functions
int GetLayer() { return m_layer;}
int GetLayer() { return m_layer; }
int GetNumCorners();
int GetNumSides();
int GetClosed();
......@@ -110,42 +146,72 @@ public:
int GetX( int ic );
int GetY( int ic );
int GetEndContour( int ic );
int GetUtility( int ic ){ return corner[ic].utility; };
void SetUtility( int ic, int utility ){ corner[ic].utility = utility; };
int GetUtility( int ic ) { return corner[ic].utility; };
void SetUtility( int ic, int utility ) { corner[ic].utility = utility; };
int GetSideStyle( int is );
int GetHatchStyle(){ return m_HatchStyle; }
void SetHatch( int hatch ){ Undraw(); m_HatchStyle = hatch; Draw(); };
int GetHatchStyle() { return m_HatchStyle; }
void SetHatch( int hatch ) { Undraw(); m_HatchStyle = hatch; Draw(); };
void SetX( int ic, int x );
void SetY( int ic, int y );
void SetEndContour( int ic, bool end_contour );
void SetSideStyle( int is, int style );
int RestoreArcs( std::vector<CArc> * arc_array, std::vector<CPolyLine*> * pa=NULL );
CPolyLine * MakePolylineForPad( int type, int x, int y, int w, int l, int r, int angle );
void AddContourForPadClearance( int type, int x, int y, int w,
int l, int r, int angle, int fill_clearance,
int hole_w, int hole_clearance, bool bThermal=FALSE, int spoke_w=0 );
int MakePolygonFromAreaOutlines( int icontour, std::vector<CArc> * arc_array );
void FreePolygon();
int NormalizeAreaOutlines( std::vector<CPolyLine*> * pa=NULL, bool bRetainArcs=FALSE );
#ifdef USE_GPC_POLY_LIB
// GPC functions
int MakeGpcPoly( int icontour=0, std::vector<CArc> * arc_array=NULL );
void FreeGpcPoly();
gpc_polygon * GetGpcPoly(){ return m_gpc_poly; };
int NormalizeWithGpc( std::vector<CPolyLine*> * pa=NULL, bool bRetainArcs=FALSE );
#endif
// PHP functions
#ifdef USE_GPL_POLY_LIB
int MakePhpPoly();
void FreePhpPoly();
void ClipPhpPolygon( int php_op, CPolyLine * poly );
polygon * GetPhpPoly(){ return m_php_poly; };
#endif
int RestoreArcs( std::vector<CArc> * arc_array, std::vector<CPolyLine*> * pa = NULL );
CPolyLine* MakePolylineForPad( int type, int x, int y, int w, int l, int r, int angle );
void AddContourForPadClearance( int type,
int x,
int y,
int w,
int l,
int r,
int angle,
int fill_clearance,
int hole_w,
int hole_clearance,
bool bThermal = FALSE,
int spoke_w = 0 );
int NormalizeAreaOutlines( std::vector<CPolyLine*> * pa = NULL,
bool bRetainArcs = FALSE );
// KBOOL functions
/** Function AddPolygonsToBoolEng
* and edges contours to a kbool engine, preparing a boolean op between polygons
* @param aStart_contour: starting contour number (-1 = all, 0 is the outlines of zone, > 1 = holes in zone
* @param aEnd_contour: ending contour number (-1 = all after aStart_contour)
* @param arc_array: arc connverted to poly (NULL if not exists)
* @param aBooleng : pointer on a bool engine (handle a set of polygons)
* @param aGroup : group to fill (aGroup = GROUP_A or GROUP_B) operations are made between GROUP_A and GROUP_B
*/
int AddPolygonsToBoolEng( Bool_Engine* aBooleng,
GroupType aGroup,
int aStart_contour = -1,
int aEnd_contour = -1,
std::vector<CArc> * arc_array = NULL );
/** Function MakeKboolPoly
* fill a kbool engine with a closed polyline contour
* approximates arcs with multiple straight-line segments
* @param aStart_contour: starting contour number (-1 = all, 0 is the outlines of zone, > 1 = holes in zone
* @param aEnd_contour: ending contour number (-1 = all after aStart_contour)
* combining intersecting contours if possible
* @param arc_array : return data on arcs in arc_array
* @return error: 0 if Ok, 1 if error
*/
int MakeKboolPoly( int aStart_contour = -1, int aEnd_contour = -1, std::vector<CArc> * arc_array = NULL );
/** Function NormalizeWithKbool
* Use the Kbool Library to clip contours: if outlines are crossing, the self-crossing polygon
* is converted in 2 or more non self-crossing polygons
* If this results in new polygons, return them as std::vector pa
* @param pa: pointer on a std::vector<CPolyLine*> to store extra polylines
* @param bRetainArcs == TRUE, try to retain arcs in polys
* @return number of external contours, or -1 if error
*/
int NormalizeWithKbool( std::vector<CPolyLine*> * pa, bool bRetainArcs );
private:
int m_layer; // layer to draw on
......@@ -157,8 +223,7 @@ public:
int m_HatchStyle; // hatch style, see enum above
std::vector <CSegment> m_HatchLines; // hatch lines
private:
gpc_polygon * m_gpc_poly; // polygon in gpc format
polygon * m_php_poly;
Bool_Engine * m_Kbool_Poly_Engine; // polygons set in kbool engine data
bool bDrawn;
};
......
// PolyLine.h ... definition of CPolyLine class
//
// A polyline contains one or more contours, where each contour
// is defined by a list of corners and side-styles
// There may be multiple contours in a polyline.
// The last contour may be open or closed, any others must be closed.
// All of the corners and side-styles are concatenated into 2 arrays,
// separated by setting the end_contour flag of the last corner of
// each contour.
//
// When used for copper areas, the first contour is the outer edge
// of the area, subsequent ones are "holes" in the copper.
#ifndef POLYLINE2KICAD_H
#define POLYLINE2KICAD_H
#define PCBU_PER_MIL 10
#define NM_PER_MIL 10 // 25400
#include "pad_shapes.h"
class CRect {
public:
int left, right, top, bottom;
};
class CPoint {
public:
int x, y;
public:
CPoint(void) { x = y = 0;};
CPoint(int i, int j) { x = i; y = j;};
};
#endif // #ifndef POLYLINE2KICAD_H
/**********************/
/* Some usual defines */
/**********************/
#ifndef DEFS_MACROS_H
#define DEFS_MACROS_H
#ifndef BOOL
#define BOOL bool
#endif
#ifndef FALSE
#define FALSE false
#endif
#ifndef TRUE
#define TRUE true
#endif
#ifndef NULL
#define NULL 0
#endif
#ifndef abs
#define abs(x) (((x) >=0) ? (x) : (-(x)))
#endif
#ifndef min
#define min(x,y) (((x) <= (y)) ? (x) : (y))
#endif
#ifndef max
#define max(x,y) (((x) >= (y)) ? (x) : (y))
#endif
#define TRACE printf
#endif // ifndef DEFS_MACROS_H
PROJECT( kbool )
SUBDIRS( src samples )
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*! \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.
This diff is collapsed.
/*! \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.
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.
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