Commit 97be0050 authored by CHARRAS's avatar CHARRAS

Added: Delete cutout outline in zone popup menu

parent 549e5f68
......@@ -4,12 +4,21 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
email address.
2008-jan-05 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
Added: Delete cutout outline in zone popup menu
the GUI about zones is now working.
Some work is needed ( a zone in a zone of the same net is not merged )
Currently No DRC for outlines
2008-jan-04 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+pcbnew:
More about zones:
Outlines can be edited. Outlines are merged if needeed.
Current No DRC for outlines
Currently No DRC for outlines
2008-jan-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
......
......@@ -560,7 +560,7 @@ enum main_id {
ID_POPUP_PCB_PLACE_ZONE_CORNER,
ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE,
ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE,
ID_POPUP_ZONE_UNUSED1,
ID_POPUP_PCB_DELETE_ZONE_CUTOUT,
ID_POPUP_ZONE_UNUSED2,
ID_POPUP_ZONE_UNUSED3,
ID_POPUP_ZONE_UNUSED4,
......
/***********************************************************/
/* wxstruct.h: */
/* descriptions des principales classes derivees utilisees */
/* wxPcbStruct.h: */
/* Classes used in pcbnew, cvpcb and gerbview */
/***********************************************************/
#ifndef WXPCB_STRUCT_H
......@@ -14,14 +14,6 @@
#define PCB_INTERNAL_UNIT 10000
#endif
// Option for dialog boxes
// #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE|wxFRAME_FLOAT_ON_PARENT|wxSTAY_ON_TOP
#define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER
#define KICAD_DEFAULT_DRAWFRAME_STYLE wxDEFAULT_FRAME_STYLE|wxWANTS_CHARS
#define EDA_DRAW_PANEL wxScrolledWindow
class wxMyDialogModalData;
/* Forward declarations of classes. */
class WinEDA_DrawPanel;
......@@ -29,25 +21,12 @@ class WinEDA_DrawFrame;
#include "base_struct.h"
class WinEDA_App;
class WinEDA_MsgPanel;
class COMMAND;
class WinEDA_MainFrame;
class BASE_SCREEN;
class SCH_SCREEN;
class PCB_SCREEN;
class WinEDA_SchematicFrame; // Schematic main frame
class WinEDA_LibeditFrame; // Component creation and edition main frame
class WinEDA_ViewlibFrame; // Component viewer main frame
class WinEDA_GerberFrame; // GERBER viewer main frame
class WinEDA_Toolbar;
class WinEDA_CvpcbFrame;
class WinEDA_PcbFrame;
class WinEDA_ModuleEditFrame;
class WinEDAChoiceBox;
#define WinEDA_MenuBar wxMenuBar
#define WinEDA_Menu wxMenu
#define WinEDA_MenuItem wxMenuItem
// Used but not defined here:
class BOARD;
......@@ -193,7 +172,9 @@ public:
void InstallModuleOptionsFrame( MODULE* Module,
wxDC* DC, const wxPoint& pos );
MODULE* Copie_Module( MODULE* module );
MODULE* Exchange_Module( wxWindow* winaff, MODULE* old_module, MODULE* new_module );
MODULE* Exchange_Module( wxWindow* winaff,
MODULE* old_module,
MODULE* new_module );
int Save_1_Module( const wxString& LibName, MODULE* Module,
bool Overwrite, bool DisplayDialog );
void Archive_Modules( const wxString& LibName, bool NewModulesOnly );
......@@ -203,7 +184,10 @@ public:
// Modules (footprints)
MODULE* Create_1_Module( wxDC* DC, const wxString& module_name );
void Edit_Module( MODULE* module, wxDC* DC );
void Rotate_Module( wxDC* DC, MODULE* module, int angle, bool incremental );
void Rotate_Module( wxDC* DC,
MODULE* module,
int angle,
bool incremental );
void Change_Side_Module( MODULE* Module, wxDC* DC );
void Place_Module( MODULE* module, wxDC* DC );
void InstallExchangeModuleFrame( MODULE* ExchangeModuleModule,
......@@ -232,8 +216,10 @@ public:
// loading footprints
MODULE* Get_Librairie_Module( wxWindow* winaff, const wxString& library,
const wxString& ModuleName, bool show_msg_err );
MODULE* Get_Librairie_Module( wxWindow* winaff,
const wxString& library,
const wxString& ModuleName,
bool show_msg_err );
wxString Select_1_Module_From_List(
WinEDA_DrawFrame* active_window, const wxString& Library,
......@@ -252,7 +238,9 @@ public:
void trace_ratsnest_pad( wxDC* DC );
void recalcule_pad_net_code(); /* compute and update the PAD net codes */
void build_liste_pads();
int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init );
int* build_ratsnest_pad( EDA_BaseStruct* ref,
const wxPoint& refpos,
bool init );
void Tst_Ratsnest( wxDC* DC, int ref_netcode );
void test_connexions( wxDC* DC );
......@@ -483,16 +471,18 @@ public:
bool Genere_Pad_Connexion( wxDC* DC, int layer );
// zone handling
/** Function Delete_Zone
* Remove the zone which include the segment aZone, or the zone which have the given time stamp.
/** Function Delete_Zone_Fill
* Remove the zone filling which include the segment aZone, or the zone which have the given time stamp.
* A zone is a group of segments which have the same TimeStamp
* @param DC = current Device Context (can be NULL)
* @param aZone = zone segment within the zone to delete. Can be NULL
* @param aTimestamp = Timestamp for the zone to delete, used if aZone == NULL
*/
void Delete_Zone( wxDC* DC, SEGZONE* Track, long aTimestamp = 0 );
void Delete_Zone_Fill( wxDC* DC, SEGZONE* Track, long aTimestamp = 0 );
EDGE_ZONE* Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone );
/**
* Function Begin_Zone
* initiates a zone edge creation process,
......@@ -517,7 +507,7 @@ public:
* @param verbose = true to show error messages
* @return error level (0 = no error)
*/
int Fill_Zone( wxDC* DC, ZONE_CONTAINER * zone_container, bool verbose = TRUE );
int Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool verbose = TRUE );
/** Function Fill_All_Zones()
* Fill all zones on the board
......@@ -536,7 +526,7 @@ public:
* @param DC = current Device Context
* @param zone_container = parent zone outline
*/
void Add_Zone_Cutout( wxDC* DC , ZONE_CONTAINER * zone_container );
void Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Add_Similar_Zone
......@@ -545,13 +535,13 @@ public:
* @param DC = current Device Context
* @param zone_container = parent zone outline
*/
void Add_Similar_Zone( wxDC* DC , ZONE_CONTAINER * zone_container );
void Add_Similar_Zone( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Edit_Zone_Params
* Edit params (layer, clearance, ...) for a zone outline
*/
void Edit_Zone_Params( wxDC* DC , ZONE_CONTAINER * zone_container );
void Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function Start_Move_Zone_Corner
......@@ -559,19 +549,34 @@ public:
* called from a move corner command (IsNewCorner = false),
* or a create new cornet command (IsNewCorner = true )
*/
void Start_Move_Zone_Corner( wxDC* DC , ZONE_CONTAINER * zone_container, int corner_id, bool IsNewCorner );
void Start_Move_Zone_Corner( wxDC* DC,
ZONE_CONTAINER* zone_container,
int corner_id,
bool IsNewCorner );
/**
* Function End_Move_Zone_Corner
* Terminates a move corner in a zone outline
*/
void End_Move_Zone_Corner( wxDC* DC , ZONE_CONTAINER * zone_container );
void End_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container );
/**
* Function End_Move_Zone_Corner
* Remove the currently selected corner in a zone outline
* the .m_CornerSelection is used as corner selection
*/
void Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_container );
void Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_container );
/** Function Delete_Zone
* Remove the zone which include the segment aZone, or the zone which have the given time stamp.
* A zone is a group of segments which have the same TimeStamp
* @param DC = current Device Context (can be NULL)
* @param zone_container = zone to modify
* the member .m_CornerSelection is used to find the outline to remove.
* if the outline is the main outline, all the zone is removed
* otherwise, the hole is deleted
*/
void Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container );
// Target handling
MIREPCB* Create_Mire( wxDC* DC );
......
No preview for this file type
......@@ -2,7 +2,7 @@ msgid ""
msgstr ""
"Project-Id-Version: kicad\n"
"POT-Creation-Date: \n"
"PO-Revision-Date: 2008-01-01 17:55+0100\n"
"PO-Revision-Date: 2008-01-05 14:17+0100\n"
"Last-Translator: \n"
"Language-Team: kicad team <jean-pierre.charras@ujf-grenoble.fr>\n"
"MIME-Version: 1.0\n"
......@@ -639,7 +639,7 @@ msgstr "Cuivre"
#: pcbnew/classpcb.cpp:210
#: pcbnew/class_track.cpp:806
#: pcbnew/class_module.cpp:1217
#: pcbnew/class_zone.cpp:407
#: pcbnew/class_zone.cpp:441
#: gerbview/affiche.cpp:109
msgid "Layer"
msgstr "Couche"
......@@ -1357,7 +1357,7 @@ msgstr "Module"
#: pcbnew/classpcb.cpp:194
#: pcbnew/class_marker.cpp:112
#: pcbnew/class_track.cpp:750
#: pcbnew/class_zone.cpp:388
#: pcbnew/class_zone.cpp:422
#: gerbview/affiche.cpp:93
msgid "Type"
msgstr "Type"
......@@ -1629,11 +1629,11 @@ msgstr "Hauteur Texte Module"
msgid "Text Module Size H"
msgstr "Largeur Texte Module"
#: pcbnew/zone_filling_algorithm.cpp:156
#: pcbnew/zone_filling_algorithm.cpp:155
msgid "No pads or starting point found to fill this zone outline"
msgstr "Pas de pads ou de points de dpart pour remplir ce contour de zone"
#: pcbnew/zone_filling_algorithm.cpp:194
#: pcbnew/zone_filling_algorithm.cpp:193
msgid "Ok"
msgstr "Ok"
......@@ -1911,8 +1911,8 @@ msgstr "Garder"
#: pcbnew/dialog_netlist.cpp:143
#: pcbnew/onrightclick.cpp:589
#: pcbnew/onrightclick.cpp:749
#: pcbnew/onrightclick.cpp:846
#: pcbnew/onrightclick.cpp:754
#: pcbnew/onrightclick.cpp:851
#: eeschema/edit_component_in_lib.cpp:239
#: eeschema/edit_component_in_lib.cpp:320
msgid "Delete"
......@@ -2086,7 +2086,7 @@ msgid "Add Drawing"
msgstr "Ajout d'lments graphiques"
#: pcbnew/modedit.cpp:424
#: pcbnew/edit.cpp:536
#: pcbnew/edit.cpp:518
#: eeschema/schedit.cpp:455
#: eeschema/libframe.cpp:579
msgid "Delete item"
......@@ -2144,8 +2144,8 @@ msgid "Delete Block (shift+ctrl + drag mouse)"
msgstr "Effacement Bloc (shift+ctrl + drag mouse)"
#: pcbnew/modedit_onclick.cpp:252
#: pcbnew/onrightclick.cpp:743
#: pcbnew/onrightclick.cpp:840
#: pcbnew/onrightclick.cpp:748
#: pcbnew/onrightclick.cpp:845
msgid "Rotate"
msgstr "Rotation"
......@@ -2170,17 +2170,17 @@ msgid "Move Pad"
msgstr "Dplace Pad"
#: pcbnew/modedit_onclick.cpp:274
#: pcbnew/onrightclick.cpp:782
#: pcbnew/onrightclick.cpp:787
msgid "Edit Pad"
msgstr "Edit Pad"
#: pcbnew/modedit_onclick.cpp:276
#: pcbnew/onrightclick.cpp:786
#: pcbnew/onrightclick.cpp:791
msgid "New Pad Settings"
msgstr "Nouvelles Caract. Pads"
#: pcbnew/modedit_onclick.cpp:278
#: pcbnew/onrightclick.cpp:788
#: pcbnew/onrightclick.cpp:793
msgid "Export Pad Settings"
msgstr "Exporte Caract. Pads"
......@@ -2189,7 +2189,7 @@ msgid "delete Pad"
msgstr "Supprimer Pad"
#: pcbnew/modedit_onclick.cpp:285
#: pcbnew/onrightclick.cpp:793
#: pcbnew/onrightclick.cpp:798
msgid "Global Pad Settings"
msgstr "Edition Globale des pads"
......@@ -2222,9 +2222,9 @@ msgid "Place edge"
msgstr "Place contour"
#: pcbnew/modedit_onclick.cpp:317
#: pcbnew/onrightclick.cpp:711
#: pcbnew/onrightclick.cpp:745
#: pcbnew/onrightclick.cpp:842
#: pcbnew/onrightclick.cpp:716
#: pcbnew/onrightclick.cpp:750
#: pcbnew/onrightclick.cpp:847
#: eeschema/onrightclick.cpp:313
msgid "Edit"
msgstr "Editer"
......@@ -2565,7 +2565,7 @@ msgid "Footprint name:"
msgstr "Nom Module: "
#: pcbnew/modules.cpp:281
#: pcbnew/onrightclick.cpp:717
#: pcbnew/onrightclick.cpp:722
msgid "Delete Module"
msgstr "Supprimer Module"
......@@ -3212,7 +3212,6 @@ msgid "Add Similar Zone"
msgstr "Addition d'une Zone Semblable"
#: pcbnew/onrightclick.cpp:664
#, fuzzy
msgid "Add Cutout Area"
msgstr "Addition d'une Zone Interdite"
......@@ -3224,44 +3223,48 @@ msgstr "Remplir Zone"
msgid "Edit Zone Params"
msgstr "Editer Paramtres de la Zone"
#: pcbnew/onrightclick.cpp:673
#: pcbnew/onrightclick.cpp:675
msgid "Delete Cutout"
msgstr "Supprimer Zone Interdite"
#: pcbnew/onrightclick.cpp:678
msgid "Delete Zone Outline"
msgstr "Supprimer Contour de Zone"
#: pcbnew/onrightclick.cpp:695
#: pcbnew/onrightclick.cpp:740
#: pcbnew/onrightclick.cpp:778
#: pcbnew/onrightclick.cpp:837
#: pcbnew/onrightclick.cpp:700
#: pcbnew/onrightclick.cpp:745
#: pcbnew/onrightclick.cpp:783
#: pcbnew/onrightclick.cpp:842
msgid "Move"
msgstr "Move"
#: pcbnew/onrightclick.cpp:698
#: pcbnew/onrightclick.cpp:780
#: pcbnew/onrightclick.cpp:703
#: pcbnew/onrightclick.cpp:785
msgid "Drag"
msgstr "Drag"
#: pcbnew/onrightclick.cpp:702
#: pcbnew/onrightclick.cpp:707
msgid "Rotate +"
msgstr "Rotation +"
#: pcbnew/onrightclick.cpp:706
#: pcbnew/onrightclick.cpp:711
#: eeschema/onrightclick.cpp:301
msgid "Rotate -"
msgstr "Rotation -"
#: pcbnew/onrightclick.cpp:707
#: pcbnew/onrightclick.cpp:712
msgid "Flip"
msgstr "Change ct"
#: pcbnew/onrightclick.cpp:797
#: pcbnew/onrightclick.cpp:802
msgid "delete"
msgstr "Effacer"
#: pcbnew/onrightclick.cpp:804
#: pcbnew/onrightclick.cpp:809
msgid "Autoroute Pad"
msgstr "Autoroute Pad"
#: pcbnew/onrightclick.cpp:805
#: pcbnew/onrightclick.cpp:810
msgid "Autoroute Net"
msgstr "Autoroute Net"
......@@ -3612,11 +3615,11 @@ msgstr "Pcb Graphic"
#: pcbnew/class_board_item.cpp:59
#: pcbnew/class_board_item.cpp:68
#: pcbnew/class_board_item.cpp:145
#: pcbnew/class_board_item.cpp:164
#: pcbnew/class_board_item.cpp:180
#: pcbnew/class_board_item.cpp:207
#: pcbnew/class_board_item.cpp:224
#: pcbnew/class_board_item.cpp:230
#: pcbnew/class_board_item.cpp:169
#: pcbnew/class_board_item.cpp:185
#: pcbnew/class_board_item.cpp:212
#: pcbnew/class_board_item.cpp:229
#: pcbnew/class_board_item.cpp:235
msgid " on "
msgstr " sur "
......@@ -3659,46 +3662,51 @@ msgid "Length:"
msgstr "Long.:"
#: pcbnew/class_board_item.cpp:152
#: pcbnew/class_zone.cpp:385
#: pcbnew/class_zone.cpp:416
msgid "Zone Outline"
msgstr "Contour de Zone"
#: pcbnew/class_board_item.cpp:168
#: pcbnew/class_board_item.cpp:156
#: pcbnew/class_zone.cpp:419
msgid "(Cutout)"
msgstr "(Cutout)"
#: pcbnew/class_board_item.cpp:173
#: pcbnew/class_track.cpp:743
msgid "Zone"
msgstr "Zone"
#: pcbnew/class_board_item.cpp:186
#: pcbnew/class_board_item.cpp:191
#: pcbnew/pcbframe.cpp:479
msgid "Via"
msgstr "Via"
#: pcbnew/class_board_item.cpp:190
#: pcbnew/class_board_item.cpp:195
msgid "Blind"
msgstr "Enterre"
#: pcbnew/class_board_item.cpp:192
#: pcbnew/class_board_item.cpp:197
msgid "Buried"
msgstr "Borgne"
#: pcbnew/class_board_item.cpp:214
#: pcbnew/class_board_item.cpp:219
#: pcbnew/class_marker.cpp:112
msgid "Marker"
msgstr "Marqueur"
#: pcbnew/class_board_item.cpp:219
#: pcbnew/class_board_item.cpp:224
msgid "Dimension"
msgstr "Dimension"
#: pcbnew/class_board_item.cpp:224
#: pcbnew/class_board_item.cpp:229
msgid "Target"
msgstr "Mire"
#: pcbnew/class_board_item.cpp:225
#: pcbnew/class_board_item.cpp:230
msgid "size"
msgstr "dimension"
#: pcbnew/class_board_item.cpp:230
#: pcbnew/class_board_item.cpp:235
msgid "Edge Zone"
msgstr "Contour Zone"
......@@ -3874,13 +3882,13 @@ msgstr "Pads"
#: pcbnew/class_track.cpp:765
#: pcbnew/zones.cpp:873
#: pcbnew/zones_by_polygon.cpp:705
#: pcbnew/class_zone.cpp:398
#: pcbnew/zones_by_polygon.cpp:831
#: pcbnew/class_zone.cpp:432
msgid "NetName"
msgstr "NetName"
#: pcbnew/class_track.cpp:770
#: pcbnew/class_zone.cpp:403
#: pcbnew/class_zone.cpp:437
msgid "NetCode"
msgstr "NetCode"
......@@ -4433,73 +4441,30 @@ msgid "Delete Current Zone Edges"
msgstr "Effacer contour zone courant"
#: pcbnew/zones.cpp:871
#: pcbnew/zones_by_polygon.cpp:703
#: pcbnew/zones_by_polygon.cpp:829
msgid "No Net"
msgstr "No Net"
#: pcbnew/dsn.cpp:456
msgid "Line length exceeded"
msgstr "Longueur de ligne dpasse"
#: pcbnew/dsn.cpp:518
msgid "'quoted text delimiter'"
msgstr "'delimiteur de texte balis'"
#: pcbnew/dsn.cpp:524
msgid "'symbol'"
msgstr "'symbole'"
#: pcbnew/dsn.cpp:527
msgid "'number'"
msgstr "'nombre'"
#: pcbnew/dsn.cpp:536
msgid "\"quoted string\""
msgstr "\"chane entre quotes\""
#: pcbnew/dsn.cpp:539
msgid "'end of file'"
msgstr "fin de fichier'"
#: pcbnew/dsn.cpp:556
msgid "in file"
msgstr "dans le fichier"
#: pcbnew/dsn.cpp:557
msgid "on line"
msgstr "en ligne"
#: pcbnew/dsn.cpp:558
msgid "at offset"
msgstr "a l'offset"
#: pcbnew/dsn.cpp:597
msgid "String delimiter must be a single character of ', \", or $"
msgstr "Le caractre de dlimitation de ligne doit tre un seul caractre ', \", or $"
#: pcbnew/dsn.cpp:676
msgid "Un-terminated delimited string"
msgstr "Ligne dlimite non termine"
#: pcbnew/specctra.cpp:271
#: pcbnew/specctra.cpp:280
#: pcbnew/specctra.cpp:1015
#: pcbnew/specctra.cpp:1022
msgid "Expecting"
msgstr "Attendu"
#: pcbnew/specctra.cpp:300
#: pcbnew/specctra.cpp:1031
#: pcbnew/specctra.cpp:1038
msgid "Unexpected"
msgstr "Inattendu"
#: pcbnew/specctra.cpp:1059
#: pcbnew/specctra.cpp:1817
#, c-format
msgid "Unable to open file \"%s\""
msgstr "Ne peut pas ouvrirle fichier \"%s\""
#: pcbnew/specctra.cpp:401
#: pcbnew/specctra.cpp:467
#: pcbnew/specctra.cpp:474
msgid "on or off"
msgstr "on ou off"
#: pcbnew/specctra.cpp:452
msgid "testpoint, guides, or image_conductor"
msgstr "testpoint, guides, ou image_conductor"
#: pcbnew/specctra.cpp:1792
#, c-format
msgid "System file error writing to file \"%s\""
msgstr "Erreur systme sur criture fichier \"%s\""
#: pcbnew/move_or_drag_track.cpp:714
msgid "Unable to drag this segment: too many segments connected"
......@@ -4545,6 +4510,30 @@ msgstr "Erreur. Vous devez choisir une couche"
msgid "Error : you must choose a net name"
msgstr "Erreur. Vous devez choisir une quipotentielle"
#: pcbnew/dsn.cpp:467
msgid "Line length exceeded"
msgstr "Longueur de ligne dpasse"
#: pcbnew/dsn.cpp:577
msgid "in file"
msgstr "dans le fichier"
#: pcbnew/dsn.cpp:578
msgid "on line"
msgstr "en ligne"
#: pcbnew/dsn.cpp:579
msgid "at offset"
msgstr "a l'offset"
#: pcbnew/dsn.cpp:618
msgid "String delimiter must be a single character of ', \", or $"
msgstr "Le caractre de dlimitation de ligne doit tre un seul caractre ', \", or $"
#: pcbnew/dsn.cpp:697
msgid "Un-terminated delimited string"
msgstr "Ligne dlimite non termine"
#: pcbnew/initpcb.cpp:125
msgid "Current Board will be lost ?"
msgstr "Le C.I. courant sera perdu ?"
......@@ -4860,11 +4849,11 @@ msgstr "Fichier rapport termin
msgid "DRC Report file"
msgstr "Fichier rapport de contrle DRC:"
#: pcbnew/class_zone.cpp:411
#: pcbnew/class_zone.cpp:445
msgid "Corners"
msgstr "Sommets"
#: pcbnew/class_zone.cpp:415
#: pcbnew/class_zone.cpp:449
msgid "Hatch lines"
msgstr "Lignes de Hachure"
......
......@@ -150,6 +150,11 @@ wxString BOARD_ITEM::MenuText( const BOARD* aPcb ) const
case TYPEZONE_CONTAINER:
text = _( "Zone Outline" );
{
ZONE_CONTAINER* area = (ZONE_CONTAINER*) this;
int ncont = area->m_Poly->GetContour(area->m_CornerSelection);
if ( ncont ) text << wxT(" ") << _("(Cutout)");
}
text << wxT( " " );
{
wxString TimeStampText;
......
......@@ -331,6 +331,7 @@ int ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
int dist;
unsigned item_pos, lim;
lim = m_Poly->corner.size();
m_CornerSelection = -1;
// Min distance to hit = MIN_DIST_IN_PIXELS pixels :
WinEDA_BasePcbFrame* frame = ((BOARD*)GetParent())->m_PcbFrame;
......@@ -340,8 +341,11 @@ int ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
{
dist = abs( m_Poly->corner[item_pos].x - refPos.x ) + abs( m_Poly->corner[item_pos].y - refPos.y );
if( dist <= min_dist )
{
m_CornerSelection = item_pos;
return item_pos;
}
}
return -1;
}
......@@ -366,6 +370,7 @@ int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
/* Test for an entire segment */
unsigned first_corner_pos = 0, end_segm;
m_CornerSelection = -1;
for ( item_pos = 0; item_pos < lim; item_pos++ )
{
......@@ -389,8 +394,11 @@ int ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
m_Poly->corner[end_segm].x,
m_Poly->corner[end_segm].y );
if( dist <= min_dist )
{
m_CornerSelection = item_pos;
return item_pos;
}
}
return -1;
}
......@@ -407,6 +415,9 @@ void ZONE_CONTAINER::Display_Infos( WinEDA_DrawFrame* frame )
msg = _( "Zone Outline" );
int ncont = m_Poly->GetContour(m_CornerSelection);
if ( ncont ) msg << wxT(" ") << _("(Cutout)");
text_pos = 1;
Affiche_1_Parametre( frame, text_pos, _( "Type" ), msg, DARKCYAN );
......
......@@ -441,7 +441,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema();
if( GetCurItem() == NULL )
break;
Delete_Zone( &dc, (SEGZONE*) GetCurItem() );
Delete_Zone_Fill( &dc, (SEGZONE*) GetCurItem() );
SetCurItem( NULL );
break;
......@@ -460,15 +460,11 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
break;
case ID_POPUP_PCB_DELETE_ZONE_CONTAINER:
{
case ID_POPUP_PCB_DELETE_ZONE_CUTOUT:
DrawPanel->MouseToCursorSchema();
ZONE_CONTAINER * zone_cont = (ZONE_CONTAINER*)GetCurItem();
zone_cont->Draw(DrawPanel,&dc, wxPoint(0,0), GR_XOR);
Delete_Zone( &dc, NULL, zone_cont->m_TimeStamp );
m_Pcb->Delete( zone_cont );
Delete_Zone_Contour( &dc, (ZONE_CONTAINER*)GetCurItem() );
SetCurItem( NULL );
break;
}
case ID_POPUP_PCB_DELETE_ZONE_CORNER:
Remove_Zone_Corner( &dc, (ZONE_CONTAINER*)GetCurItem() );
......@@ -1010,7 +1006,7 @@ void WinEDA_PcbFrame::RemoveStruct( BOARD_ITEM* Item, wxDC* DC )
break;
case TYPEZONE:
Delete_Zone( DC, (SEGZONE*) Item );
Delete_Zone_Fill( DC, (SEGZONE*) Item );
break;
case TYPEMARKER:
......
......@@ -639,37 +639,42 @@ void WinEDA_PcbFrame::createPopUpMenuForZones( ZONE_CONTAINER* edge_zone, wxMenu
}
else
{
edge_zone->m_CornerSelection = -1;
wxMenu * zones_menu = new wxMenu();
ADD_MENUITEM_WITH_SUBMENU( aPopMenu, zones_menu,
-1, _( "Zones" ), add_zone_xpm );
int index;
if( ( index = edge_zone->HitTestForCorner( GetScreen()->m_Curseur ) ) >= 0 )
{
edge_zone->m_CornerSelection = index;
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_MOVE_ZONE_CORNER,
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_MOVE_ZONE_CORNER,
_( "Move Corner" ), move_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_CORNER,
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CORNER,
_( "Delete Corner" ), delete_xpm );
}
else if( ( index = edge_zone->HitTestForEdge( GetScreen()->m_Curseur ) ) >= 0 )
{
edge_zone->m_CornerSelection = index;
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_ADD_ZONE_CORNER,
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_ADD_ZONE_CORNER,
_( "Create Corner" ), Add_Corner_xpm );
}
aPopMenu->AppendSeparator();
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE,
zones_menu->AppendSeparator();
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_ZONE_ADD_SIMILAR_ZONE,
_( "Add Similar Zone" ), add_zone_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE,
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_ZONE_ADD_CUTOUT_ZONE,
_( "Add Cutout Area" ), add_zone_cutout );
aPopMenu->AppendSeparator();
zones_menu->AppendSeparator();
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_FILL_ZONE,
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_FILL_ZONE,
_( "Fill Zone" ), fill_zone_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_EDIT_ZONE_PARAMS,
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_EDIT_ZONE_PARAMS,
_( "Edit Zone Params" ), edit_xpm );
ADD_MENUITEM( aPopMenu, ID_POPUP_PCB_DELETE_ZONE_CONTAINER,
if ( index >= 0 && edge_zone->m_Poly->IsCutoutContour( edge_zone->m_CornerSelection ) )
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CUTOUT,
_( "Delete Cutout" ), delete_xpm );
ADD_MENUITEM( zones_menu, ID_POPUP_PCB_DELETE_ZONE_CONTAINER,
_( "Delete Zone Outline" ), delete_xpm );
}
}
......
......@@ -48,7 +48,7 @@ int ZONE_CONTAINER::Fill_Zone( WinEDA_PcbFrame* frame, wxDC* DC, bool verbose )
s_TimeStamp = m_TimeStamp;
// Delete the old filling, if any :
frame->Delete_Zone( DC, NULL, m_TimeStamp );
frame->Delete_Zone_Fill( DC, NULL, m_TimeStamp );
// calculate the fixed step of the routing matrix as 5 mils or more
E_scale = g_GridRoutingSize / 50;
......
......@@ -104,11 +104,11 @@ void WinEDA_PcbFrame::Add_Zone_Cutout( wxDC* DC, ZONE_CONTAINER* zone_container
/*****************************************************************************/
void WinEDA_PcbFrame::Delete_Zone( wxDC* DC, SEGZONE* aZone, long aTimestamp )
void WinEDA_PcbFrame::Delete_Zone_Fill( wxDC* DC, SEGZONE* aZone, long aTimestamp )
/******************************************************************************/
/** Function Delete_Zone
* Remove the zone which include the segment aZone, or the zone which have the given time stamp.
/** Function Delete_Zone_Fill
* Remove the zone fillig which include the segment aZone, or the zone which have the given time stamp.
* A zone is a group of segments which have the same TimeStamp
* @param DC = current Device Context (can be NULL)
* @param aZone = zone segment within the zone to delete. Can be NULL
......@@ -257,13 +257,12 @@ void WinEDA_PcbFrame::Start_Move_Zone_Corner( wxDC* DC, ZONE_CONTAINER* zone_con
*/
{
/* Show the Net */
if( (g_HightLigth_NetCode > 0) && (g_HightLigth_NetCode != s_NetcodeSelection) )
if( g_HightLigt_Status )
{
Hight_Light( DC ); // Remove old hightlight selection
}
g_HightLigth_NetCode = s_NetcodeSelection;
if( !g_HightLigt_Status )
g_HightLigth_NetCode = s_NetcodeSelection = zone_container->GetNet();
Hight_Light( DC );
zone_container->m_Flags = IN_EDIT;
......@@ -327,7 +326,7 @@ void WinEDA_PcbFrame::Remove_Zone_Corner( wxDC* DC, ZONE_CONTAINER * zone_contai
{
if ( zone_container->m_Poly->GetNumCorners() <= 3 )
{
Delete_Zone( DC, NULL, zone_container->m_TimeStamp );
Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp );
m_Pcb->Delete( zone_container );
return;
}
......@@ -466,7 +465,7 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
s_Zone_Hatching = s_CurrentZone->m_Poly->GetHatchStyle();
}
/* Show the Net */
if( (g_HightLigth_NetCode > 0) && (g_HightLigth_NetCode != s_NetcodeSelection) )
if( g_HightLigt_Status && (g_HightLigth_NetCode != s_NetcodeSelection) )
{
Hight_Light( DC ); // Remove old hightlight selection
}
......@@ -474,7 +473,6 @@ EDGE_ZONE* WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
if( s_CurrentZone )
s_NetcodeSelection = s_CurrentZone->GetNet();
g_HightLigth_NetCode = s_NetcodeSelection;
if( !g_HightLigt_Status )
Hight_Light( DC );
if( !s_AddCutoutToCurrentZone )
......@@ -742,6 +740,39 @@ void WinEDA_PcbFrame::Edit_Zone_Params( wxDC* DC, ZONE_CONTAINER* zone_container
GetScreen()->SetModify();
}
/************************************************************************************/
void WinEDA_PcbFrame::Delete_Zone_Contour( wxDC* DC, ZONE_CONTAINER* zone_container )
/************************************************************************************/
/** Function Delete_Zone_Contour
* Remove the zone which include the segment aZone, or the zone which have the given time stamp.
* A zone is a group of segments which have the same TimeStamp
* @param DC = current Device Context (can be NULL)
* @param zone_container = zone to modify
* the member .m_CornerSelection is used to find the outline to remove.
* if the outline is the main outline, all the zone_container is removed (deleted)
* otherwise, the hole is deleted
*/
{
int ncont = zone_container->m_Poly->GetContour(zone_container->m_CornerSelection);
if ( DC )
zone_container->Draw(DrawPanel, DC, wxPoint(0,0), GR_XOR);
Delete_Zone_Fill( DC, NULL, zone_container->m_TimeStamp ); // Remove fill segments
if ( ncont == 0 ) // This is the main outline: remove all
m_Pcb->Delete( zone_container );
else
{
zone_container->m_Poly->RemoveContour( ncont );
if ( DC )
zone_container->Draw(DrawPanel, DC, wxPoint(0,0), GR_OR);
}
GetScreen()->SetModify();
}
/***************************************************************************************/
int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool verbose )
......@@ -770,13 +801,13 @@ int WinEDA_PcbFrame::Fill_Zone( wxDC* DC, ZONE_CONTAINER* zone_container, bool v
/* Show the Net */
s_NetcodeSelection = zone_container->GetNet();
if( (g_HightLigth_NetCode > 0) && (g_HightLigth_NetCode != s_NetcodeSelection) && DC )
if( g_HightLigt_Status && (g_HightLigth_NetCode != s_NetcodeSelection) && DC )
{
Hight_Light( DC ); // Remove old hightlight selection
}
g_HightLigth_NetCode = s_NetcodeSelection;
if( !g_HightLigt_Status && DC )
if( DC )
Hight_Light( DC );
if( g_HightLigth_NetCode > 0 )
......
......@@ -20,12 +20,6 @@ bool bDontShowIntersectionArcsWarning;
bool bDontShowIntersectionWarning;
#define poly m_Poly
// carea: describes a copper area
#define carea ZONE_CONTAINER
/**
* Function AddArea
* add empty copper area to net
......@@ -69,7 +63,7 @@ ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, int layer, int x, int
else
m_ZoneDescriptorList.push_back( new_area );
new_area->poly->Start( layer, 1, 10 * NM_PER_MIL, x, y,
new_area->m_Poly->Start( layer, 1, 10 * NM_PER_MIL, x, y,
hatch );
return new_area;
}
......@@ -85,9 +79,9 @@ ZONE_CONTAINER* BOARD::InsertArea( int netcode, int iarea, int layer, int x, int
*/
int BOARD::CompleteArea( ZONE_CONTAINER* area_to_complete, int style )
{
if( area_to_complete->poly->GetNumCorners() > 2 )
if( area_to_complete->m_Poly->GetNumCorners() > 2 )
{
area_to_complete->poly->Close( style );
area_to_complete->m_Poly->Close( style );
return 1;
}
else
......@@ -111,7 +105,7 @@ int BOARD::CompleteArea( ZONE_CONTAINER* area_to_complete, int style )
*/
int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea )
{
CPolyLine* p = CurrArea->poly;
CPolyLine* p = CurrArea->m_Poly;
// first, check for sides intersecting other sides, especially arcs
bool bInt = false;
......@@ -234,7 +228,7 @@ int BOARD::TestAreaPolygon( ZONE_CONTAINER* CurrArea )
int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
bool bMessageBoxArc, bool bMessageBoxInt, bool bRetainArcs )
{
CPolyLine* p = CurrArea->poly;
CPolyLine* p = CurrArea->m_Poly;
int test = TestAreaPolygon( CurrArea ); // this sets utility2 flag
if( test == -1 && !bRetainArcs )
......@@ -284,7 +278,7 @@ int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
{
std::vector<CPolyLine*> * pa = new std::vector<CPolyLine*>;
p->Undraw();
int n_poly = CurrArea->poly->NormalizeWithGpc( pa, bRetainArcs );
int n_poly = CurrArea->m_Poly->NormalizeWithGpc( pa, bRetainArcs );
if( n_poly > 1 ) // i.e if clippinf has created some polygons, we must add these new copper areas
{
for( int ip = 1; ip < n_poly; ip++ )
......@@ -295,9 +289,9 @@ int BOARD::ClipAreaPolygon( ZONE_CONTAINER* CurrArea,
// remove the poly that was automatically created for the new area
// and replace it with a poly from NormalizeWithGpc
delete CurrArea->poly;
CurrArea->poly = new_p;
CurrArea->poly->Draw();
delete CurrArea->m_Poly;
CurrArea->m_Poly = new_p;
CurrArea->m_Poly->Draw();
CurrArea->utility = 1;
}
}
......@@ -368,15 +362,15 @@ int BOARD::CombineAllAreasInNet( int aNetCode, bool bMessageBox, bool bUseUtilit
continue;
// legal polygon
CRect b1 = curr_area->poly->GetCornerBounds();
CRect b1 = curr_area->m_Poly->GetCornerBounds();
bool mod_ia1 = false;
for( unsigned ia2 = m_ZoneDescriptorList.size() - 1; ia2 > ia1; ia2-- )
{
ZONE_CONTAINER* area2 = m_ZoneDescriptorList[ia2];
if( curr_area->poly->GetLayer() == area2->poly->GetLayer()
if( curr_area->GetLayer() == area2->GetLayer()
&& curr_area->utility2 != -1 && area2->utility2 != -1 )
{
CRect b2 = area2->poly->GetCornerBounds();
CRect b2 = area2->m_Poly->GetCornerBounds();
if( !( b1.left > b2.right || b1.right < b2.left
|| b1.bottom > b2.top || b1.top < b2.bottom ) )
{
......@@ -443,7 +437,7 @@ int BOARD::CombineAllAreasInNet( int aNetCode, bool bMessageBox, bool bUseUtilit
*/
bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test )
{
CPolyLine* poly1 = area_to_test->poly;
CPolyLine* poly1 = area_to_test->m_Poly;
for( unsigned ia2 = 0; ia2 < m_ZoneDescriptorList.size(); ia2++ )
{
......@@ -456,7 +450,7 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test )
if( area_to_test->GetLayer() != area2->GetLayer() )
continue;
CPolyLine* poly2 = area2->poly;
CPolyLine* poly2 = area2->m_Poly;
// test bounding rects
CRect b1 = poly1->GetCornerBounds();
......@@ -488,7 +482,7 @@ bool BOARD::TestAreaIntersections( ZONE_CONTAINER* area_to_test )
yf1 = poly1->GetY( is1 );
}
style1 = poly1->GetSideStyle( ic1 );
for( int icont2 = 0; icont2<poly2->GetNumContours(); icont2++ )
for( int icont2 = 0; icont2 < poly2->GetNumContours(); icont2++ )
{
int is2 = poly2->GetContourStart( icont2 );
int ie2 = poly2->GetContourEnd( icont2 );
......@@ -539,8 +533,8 @@ int BOARD::TestAreaIntersection( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_
if( area_ref->GetLayer() != area_to_test->GetLayer() )
return 0;
CPolyLine* poly1 = area_ref->poly;
CPolyLine* poly2 = area_to_test->poly;
CPolyLine* poly1 = area_ref->m_Poly;
CPolyLine* poly2 = area_to_test->m_Poly;
// test bounding rects
CRect b1 = poly1->GetCornerBounds();
......@@ -647,8 +641,8 @@ int BOARD::CombineAreas( ZONE_CONTAINER* area_ref, ZONE_CONTAINER* area_to_combi
#endif
// polygons intersect, combine them
CPolyLine* poly1 = area_ref->poly;
CPolyLine* poly2 = area_to_combine->poly;
CPolyLine* poly1 = area_ref->m_Poly;
CPolyLine* poly2 = area_to_combine->m_Poly;
std::vector<CArc> arc_array1;
std::vector<CArc> arc_array2;
poly1->MakeGpcPoly( -1, &arc_array1 );
......@@ -747,7 +741,7 @@ void dra_areas( CDlgLog* log, int copper_layers,
// now iterate through all areas
for( int ia = 0; ia<net->nareas; ia++ )
{
carea* a = &net->area[ia];
ZONE_CONTAINER* a = &net->area[ia];
// iterate through all nets again
POSITION pos2 = pos;
......@@ -759,17 +753,17 @@ void dra_areas( CDlgLog* log, int copper_layers,
cnet* net2 = (cnet*) ptr2;
for( int ia2 = 0; ia2<net2->nareas; ia2++ )
{
carea* a2 = &net2->area[ia2];
ZONE_CONTAINER* a2 = &net2->area[ia2];
// test for same layer
if( a->poly->GetLayer() == a2->poly->GetLayer() )
if( a->m_Poly->GetLayer() == a2->m_Poly->GetLayer() )
{
// test for points inside one another
for( int ic = 0; ic<a->poly->GetNumCorners(); ic++ )
for( int ic = 0; ic<a->m_Poly->GetNumCorners(); ic++ )
{
int x = a->poly->GetX( ic );
int y = a->poly->GetY( ic );
if( a2->poly->TestPointInside( x, y ) )
int x = a->m_Poly->GetX( ic );
int y = a->m_Poly->GetY( ic );
if( a2->m_Poly->TestPointInside( x, y ) )
{
// COPPERAREA_COPPERAREA error
id id_a = net->id;
......@@ -804,11 +798,11 @@ void dra_areas( CDlgLog* log, int copper_layers,
}
}
for( int ic2 = 0; ic2<a2->poly->GetNumCorners(); ic2++ )
for( int ic2 = 0; ic2<a2->m_Poly->GetNumCorners(); ic2++ )
{
int x = a2->poly->GetX( ic2 );
int y = a2->poly->GetY( ic2 );
if( a->poly->TestPointInside( x, y ) )
int x = a2->m_Poly->GetX( ic2 );
int y = a2->m_Poly->GetY( ic2 );
if( a->m_Poly->TestPointInside( x, y ) )
{
// COPPERAREA_COPPERAREA error
id id_a = net2->id;
......@@ -841,10 +835,10 @@ void dra_areas( CDlgLog* log, int copper_layers,
}
// now test spacing between areas
for( int icont = 0; icont<a->poly->GetNumContours(); icont++ )
for( int icont = 0; icont<a->m_Poly->GetNumContours(); icont++ )
{
int ic_start = a->poly->GetContourStart( icont );
int ic_end = a->poly->GetContourEnd( icont );
int ic_start = a->m_Poly->GetContourStart( icont );
int ic_end = a->m_Poly->GetContourEnd( icont );
for( int ic = ic_start; ic<=ic_end; ic++ )
{
id id_a = net->id;
......@@ -852,24 +846,24 @@ void dra_areas( CDlgLog* log, int copper_layers,
id_a.i = ia;
id_a.sst = ID_SIDE;
id_a.ii = ic;
int ax1 = a->poly->GetX( ic );
int ay1 = a->poly->GetY( ic );
int ax1 = a->m_Poly->GetX( ic );
int ay1 = a->m_Poly->GetY( ic );
int ax2, ay2;
if( ic == ic_end )
{
ax2 = a->poly->GetX( ic_start );
ay2 = a->poly->GetY( ic_start );
ax2 = a->m_Poly->GetX( ic_start );
ay2 = a->m_Poly->GetY( ic_start );
}
else
{
ax2 = a->poly->GetX( ic + 1 );
ay2 = a->poly->GetY( ic + 1 );
ax2 = a->m_Poly->GetX( ic + 1 );
ay2 = a->m_Poly->GetY( ic + 1 );
}
int astyle = a->poly->GetSideStyle( ic );
for( int icont2 = 0; icont2<a2->poly->GetNumContours(); icont2++ )
int astyle = a->m_Poly->GetSideStyle( ic );
for( int icont2 = 0; icont2<a2->m_Poly->GetNumContours(); icont2++ )
{
int ic_start2 = a2->poly->GetContourStart( icont2 );
int ic_end2 = a2->poly->GetContourEnd( icont2 );
int ic_start2 = a2->m_Poly->GetContourStart( icont2 );
int ic_end2 = a2->m_Poly->GetContourEnd( icont2 );
for( int ic2 = ic_start2; ic2<=ic_end2; ic2++ )
{
id id_b = net2->id;
......@@ -877,20 +871,20 @@ void dra_areas( CDlgLog* log, int copper_layers,
id_b.i = ia2;
id_b.sst = ID_SIDE;
id_b.ii = ic2;
int bx1 = a2->poly->GetX( ic2 );
int by1 = a2->poly->GetY( ic2 );
int bx1 = a2->m_Poly->GetX( ic2 );
int by1 = a2->m_Poly->GetY( ic2 );
int bx2, by2;
if( ic2 == ic_end2 )
{
bx2 = a2->poly->GetX( ic_start2 );
by2 = a2->poly->GetY( ic_start2 );
bx2 = a2->m_Poly->GetX( ic_start2 );
by2 = a2->m_Poly->GetY( ic_start2 );
}
else
{
bx2 = a2->poly->GetX( ic2 + 1 );
by2 = a2->poly->GetY( ic2 + 1 );
bx2 = a2->m_Poly->GetX( ic2 + 1 );
by2 = a2->m_Poly->GetY( ic2 + 1 );
}
int bstyle = a2->poly->GetSideStyle( ic2 );
int bstyle = a2->m_Poly->GetSideStyle( ic2 );
int x, y;
int d = ::GetClearanceBetweenSegments( bx1,
by1,
......
......@@ -59,7 +59,7 @@ CPolyLine::~CPolyLine()
// If bRetainArcs == TRUE, try to retain arcs in polys
// Returns number of external contours, or -1 if error
//
int CPolyLine::NormalizeWithGpc( std::vector<CPolyLine*> * pa, BOOL bRetainArcs )
int CPolyLine::NormalizeWithGpc( std::vector<CPolyLine*> * pa, bool bRetainArcs )
{
std::vector<CArc> arc_array;
......@@ -495,7 +495,7 @@ int CPolyLine::RestoreArcs( std::vector<CArc> * arc_array, std::vector<CPolyLine
}
// find arcs and replace them
BOOL bFound;
bool bFound;
int arc_start;
int arc_end;
for( unsigned iarc=0; iarc<arc_array->size(); iarc++ )
......@@ -637,7 +637,7 @@ void CPolyLine::Start( int layer, int w, int sel_box, int x, int y,
// add a corner to unclosed polyline
//
void CPolyLine::AppendCorner( int x, int y, int style, BOOL bDraw )
void CPolyLine::AppendCorner( int x, int y, int style, bool bDraw )
{
Undraw();
CPolyPt poly_pt( x, y );
......@@ -663,7 +663,7 @@ void CPolyLine::AppendCorner( int x, int y, int style, BOOL bDraw )
// close last polyline contour
//
void CPolyLine::Close( int style, BOOL bDraw )
void CPolyLine::Close( int style, bool bDraw )
{
if( GetClosed() )
ASSERT(0);
......@@ -686,13 +686,13 @@ void CPolyLine::MoveCorner( int ic, int x, int y )
// delete corner and adjust arrays
//
void CPolyLine::DeleteCorner( int ic, BOOL bDraw )
void CPolyLine::DeleteCorner( int ic, bool bDraw )
{
Undraw();
int icont = GetContour( ic );
int istart = GetContourStart( icont );
int iend = GetContourEnd( icont );
BOOL bClosed = icont < GetNumContours()-1 || GetClosed();
bool bClosed = icont < GetNumContours()-1 || GetClosed();
if( !bClosed )
{
......@@ -719,7 +719,14 @@ void CPolyLine::DeleteCorner( int ic, BOOL bDraw )
Draw();
}
/******************************************/
void CPolyLine::RemoveContour( int icont )
/******************************************/
/**
* Function RemoveContour
* @param icont = contour number to remove
* remove a contour only if there is more than 1 contour
*/
{
Undraw();
int istart = GetContourStart( icont );
......@@ -733,8 +740,8 @@ void CPolyLine::RemoveContour( int icont )
else if( icont == GetNumContours()-1 )
{
// remove last contour
corner.erase( corner.begin() + icont, corner.end() );
side_style.erase( side_style.begin() + icont, side_style.end() );
corner.erase( corner.begin() + istart, corner.end() );
side_style.erase( side_style.begin() + istart, side_style.end() );
}
else
{
......@@ -749,7 +756,9 @@ void CPolyLine::RemoveContour( int icont )
}
/******************************************/
void CPolyLine::RemoveAllContours( void )
/******************************************/
/**
* function RemoveAllContours
* removes all corners from the lists.
......@@ -1162,11 +1171,6 @@ int CPolyLine::GetW()
return m_Width;
}
int CPolyLine::GetSelBoxSize()
{
return m_sel_box;
}
int CPolyLine::GetNumContours()
{
int ncont = 0;
......@@ -1462,7 +1466,7 @@ void CPolyLine::Hatch()
// test to see if a point is inside polyline
//
BOOL CPolyLine::TestPointInside( int x, int y )
bool CPolyLine::TestPointInside( int x, int y )
{
enum { MAXPTS = 100 };
if( !GetClosed() )
......@@ -1538,7 +1542,7 @@ BOOL CPolyLine::TestPointInside( int x, int y )
// test to see if a point is inside polyline contour
//
BOOL CPolyLine::TestPointInsideContour( int icont, int x, int y )
bool CPolyLine::TestPointInsideContour( int icont, int x, int y )
{
if( icont >= GetNumContours() )
return FALSE;
......@@ -1662,25 +1666,6 @@ int CPolyLine::TestIntersection( CPolyLine * poly )
return 0;
}
// set selection box size
//
void CPolyLine::SetSelBoxSize( int sel_box )
{
// Undraw();
m_sel_box = sel_box;
// Draw();
}
// set pointer to display list, and draw into display list
//
void CPolyLine::SetDisplayList( CDisplayList * dl )
{
if( m_dlist )
Undraw();
m_dlist = dl;
if( m_dlist )
Draw();
}
// copy data from another poly, but don't draw it
//
......@@ -1701,6 +1686,20 @@ void CPolyLine::Copy( CPolyLine * src )
FreeGpcPoly();
}
/*******************************************/
bool CPolyLine::IsCutoutContour( int icont )
/*******************************************/
/*
* return true if the corner icont is inside the outline (i.e it is a hole)
*/
{
int ncont = GetContour( icont );
if ( ncont == 0 ) // the first contour is the main outline, not an hole
return false;
return true;
}
void CPolyLine::MoveOrigin( int x_off, int y_off )
{
Undraw();
......@@ -1719,7 +1718,11 @@ void CPolyLine::MoveOrigin( int x_off, int y_off )
//
void CPolyLine::SetX( int ic, int x ) { corner[ic].x = x; }
void CPolyLine::SetY( int ic, int y ) { corner[ic].y = y; }
void CPolyLine::SetEndContour( int ic, BOOL end_contour ) { corner[ic].end_contour = end_contour; }
void CPolyLine::SetEndContour( int ic, bool end_contour )
{
corner[ic].end_contour = end_contour;
}
// Create CPolyLine for a pad
//
......@@ -1750,7 +1753,7 @@ CPolyLine * CPolyLine::MakePolylineForPad( int type, int x, int y, int w, int l,
//
void CPolyLine::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, int spoke_w )
int hole_w, int hole_clearance, bool bThermal, int spoke_w )
{
int dx = l/2;
int dy = w/2;
......
......@@ -46,17 +46,17 @@ public:
int style;
int xi, yi, xf, yf;
int n_steps; // number of straight-line segments in gpc_poly
BOOL bFound;
bool bFound;
};
class CPolyPt
{
public:
CPolyPt( int qx=0, int qy=0, BOOL qf=FALSE )
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;
bool end_contour;
int utility;
};
......@@ -75,11 +75,11 @@ public:
// functions for modifying polyline
void Start( int layer, int w, int sel_box, 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 );
......@@ -93,7 +93,7 @@ public:
void Undraw();
void Draw( CDisplayList * dl = NULL );
void Hatch();
void MakeVisible( BOOL visible = TRUE );
void MakeVisible( bool visible = TRUE );
void MoveOrigin( int x_off, int y_off );
// misc. functions
......@@ -101,8 +101,9 @@ public:
CRect GetCornerBounds();
CRect GetCornerBounds( int icont );
void Copy( CPolyLine * src );
BOOL TestPointInside( int x, int y );
BOOL TestPointInsideContour( int icont, int x, int y );
bool TestPointInside( int x, int y );
bool TestPointInsideContour( int icont, int x, int y );
bool IsCutoutContour( int icont );
int TestIntersection( CPolyLine * poly );
void AppendArc( int xi, int yi, int xf, int yf, int xc, int yc, int num );
......@@ -124,30 +125,25 @@ public:
void SetUtility( int ic, int utility ){ corner[ic].utility = utility; };
int GetW();
int GetSideStyle( int is );
id GetId();
int GetSelBoxSize();
CDisplayList * GetDisplayList(){ return m_dlist; };
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 SetEndContour( int ic, bool end_contour );
// void SetLayer( int layer );
void SetW( int w );
void SetSideStyle( int is, int style );
void SetSelBoxSize( int sel_box );
void SetDisplayList( CDisplayList * dl );
// GPC functions
int MakeGpcPoly( int icontour=0, std::vector<CArc> * arc_array=NULL );
int FreeGpcPoly();
gpc_polygon * GetGpcPoly(){ return m_gpc_poly; };
int NormalizeWithGpc( std::vector<CPolyLine*> * pa=NULL, BOOL bRetainArcs=FALSE );
int NormalizeWithGpc( std::vector<CPolyLine*> * pa=NULL, bool bRetainArcs=FALSE );
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 hole_w, int hole_clearance, bool bThermal=FALSE, int spoke_w=0 );
void ClipGpcPolygon( gpc_op op, CPolyLine * poly );
// PHP functions
......@@ -174,7 +170,7 @@ public:
private:
gpc_polygon * m_gpc_poly; // polygon in gpc format
polygon * m_php_poly;
BOOL bDrawn;
bool bDrawn;
};
#endif // #ifndef POLYLINE_H
......@@ -31,31 +31,6 @@ enum
PAD_OCTAGON
};
/*
enum
{
// visible layers
LAY_SELECTION = 0,
LAY_BACKGND,
LAY_VISIBLE_GRID,
LAY_HILITE,
LAY_DRC_ERROR,
LAY_BOARD_OUTLINE,
LAY_RAT_LINE,
LAY_SILK_TOP,
LAY_SILK_BOTTOM,
LAY_SM_TOP,
LAY_SM_BOTTOM,
LAY_PAD_THRU,
LAY_TOP_COPPER,
LAY_BOTTOM_COPPER,
// invisible layers
LAY_MASK_TOP = -100,
LAY_MASK_BOTTOM = -101,
LAY_PASTE_TOP = -102,
LAY_PASTE_BOTTOM = -103
};
*/
#define LAY_SELECTION 0
#define LAY_TOP_COPPER 0
......
......@@ -2,25 +2,10 @@
#include "PolyLine.h"
dl_element * CDisplayList::Add( id id, void * ptr, int glayer, int gtype, int visible,
int w, int holew, int x, int y, int xf, int yf, int xo, int yo,
int radius, int orig_layer )
{
return NULL;
}
dl_element * CDisplayList::AddSelector( id id, void * ptr, int glayer, int gtype, int visible,
int w, int holew, int x, int y, int xf, int yf, int xo, int yo, int radius )
{
return NULL;
}
void CDisplayList::Set_visible( dl_element * el, int visible )
{
}
int CDisplayList::StopDragging()
{
return 0;
......@@ -31,10 +16,6 @@ int CDisplayList::CancelHighLight()
return 0;
}
void CDisplayList::Set_id( dl_element * el, id * id )
{
}
id CDisplayList::Remove( dl_element * element )
{
return 0;
......@@ -83,3 +64,4 @@ int CDisplayList::StartDraggingArc( CDC * pDC, int style, int x, int y, int xi,
{
return 0;
}
......@@ -656,10 +656,15 @@ BOOL polygon::isInside( vertex * v )
int winding_number3 = 0;
int winding_number4 = 0;
//** vertex * point_at_infinity = new vertex(-10000000,v->Y()); // Create point at infinity
vertex * point_at_infinity = new vertex(-1000000000,-50000000); // Create point at infinity
/* vertex * point_at_infinity = new vertex(-1000000000,-50000000); // Create point at infinity
vertex * point_at_infinity2 = new vertex(1000000000,+50000000); // Create point at infinity
vertex * point_at_infinity3 = new vertex(500000000,1000000000); // Create point at infinity
vertex * point_at_infinity4 = new vertex(-500000000,1000000000); // Create point at infinity
*/
vertex point_at_infinity(-1000000000,-50000000); // Create point at infinity
vertex point_at_infinity2(1000000000,+50000000); // Create point at infinity
vertex point_at_infinity3(500000000,1000000000); // Create point at infinity
vertex point_at_infinity4(-500000000,1000000000); // Create point at infinity
vertex * q = m_first; // End vertex of a line segment in polygon
do
{
......@@ -667,20 +672,20 @@ BOOL polygon::isInside( vertex * v )
{
int n;
double x[2], y[2], aP[2], aQ[2];
if( ints( point_at_infinity, v, q, nxt(q->Next()), &n, x, y, aP, aQ ) )
if( ints( &point_at_infinity, v, q, nxt(q->Next()), &n, x, y, aP, aQ ) )
winding_number += n; // Add number of intersections found
if( ints( point_at_infinity2, v, q, nxt(q->Next()), &n, x, y, aP, aQ ) )
if( ints( &point_at_infinity2, v, q, nxt(q->Next()), &n, x, y, aP, aQ ) )
winding_number2 += n; // Add number of intersections found
if( ints( point_at_infinity3, v, q, nxt(q->Next()), &n, x, y, aP, aQ ) )
if( ints( &point_at_infinity3, v, q, nxt(q->Next()), &n, x, y, aP, aQ ) )
winding_number3 += n; // Add number of intersections found
if( ints( point_at_infinity4, v, q, nxt(q->Next()), &n, x, y, aP, aQ ) )
if( ints( &point_at_infinity4, v, q, nxt(q->Next()), &n, x, y, aP, aQ ) )
winding_number4 += n; // Add number of intersections found
}
q = q->Next();
}
while( q->id() != m_first->id() );
delete point_at_infinity;
delete point_at_infinity2;
// delete point_at_infinity;
// delete point_at_infinity2;
if( winding_number%2 != winding_number2%2
|| winding_number3%2 != winding_number4%2
|| winding_number%2 != winding_number3%2 )
......
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