Commit 4a0b5607 authored by CHARRAS's avatar CHARRAS
Browse files

zone outlines edition refinements

parent 14cd0109
Loading
Loading
Loading
Loading
+4 −1
Original line number Original line Diff line number Diff line
@@ -460,7 +460,10 @@ int EDGE_MODULE::ReadDescr( char* Line, FILE* File,
        m_Width = MAX_WIDTH;
        m_Width = MAX_WIDTH;


	// Check for a reasonnable layer:
	// Check for a reasonnable layer:
	if ( (m_Layer < FIRST_NON_COPPER_LAYER) || (m_Layer > LAST_NON_COPPER_LAYER) )
	// m_Layer must be >= FIRST_NON_COPPER_LAYER, but because microwave footprints
	// can use the copper layers m_Layer < FIRST_NON_COPPER_LAYER is allowed.
	// @todo: changes use of EDGE_MODULE these footprints and allows only m_Layer >= FIRST_NON_COPPER_LAYER
	if ( (m_Layer < 0) || (m_Layer > LAST_NON_COPPER_LAYER) )
		m_Layer = SILKSCREEN_N_CMP;
		m_Layer = SILKSCREEN_N_CMP;
    return error;
    return error;
}
}
+10 −6
Original line number Original line Diff line number Diff line
@@ -154,9 +154,9 @@ void WinEDA_PcbFrame::Delete_Zone_Fill( wxDC* DC, SEGZONE* aZone, long aTimestam


/*******************************************************/
/*******************************************************/
int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC )
int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC )
/*****************************************************************************/
/*******************************************************/


/** Used only while creating a new zone outline
/** Used **only** while creating a new zone outline
 * Remove and delete the current outline segment in progress
 * Remove and delete the current outline segment in progress
 * @return 0 if no corner in list, or corner number
 * @return 0 if no corner in list, or corner number
 * if no corner in list, close the outline creation
 * if no corner in list, close the outline creation
@@ -170,13 +170,13 @@ int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC )
    if( zone->GetNumCorners() == 0 )
    if( zone->GetNumCorners() == 0 )
        return 0;
        return 0;


    zone->Draw( DrawPanel, DC, wxPoint( 0, 0 ), GR_XOR );
    zone->DrawWhileCreateOutline( DrawPanel, DC, GR_XOR );


    if( zone->GetNumCorners() > 1 )
    if( zone->GetNumCorners() > 2 )
    {
    {
        zone->m_Poly->DeleteCorner( zone->GetNumCorners() - 1 );
        zone->m_Poly->DeleteCorner( zone->GetNumCorners() - 1 );
		if ( DrawPanel->ManageCurseur )
		if ( DrawPanel->ManageCurseur )
            DrawPanel->ManageCurseur( DrawPanel, DC, TRUE );
			DrawPanel->ManageCurseur(DrawPanel, DC, false);
    }
    }
    else
    else
    {
    {
@@ -184,6 +184,7 @@ int WinEDA_PcbFrame::Delete_LastCreatedCorner( wxDC* DC )
        DrawPanel->ForceCloseManageCurseur = NULL;
        DrawPanel->ForceCloseManageCurseur = NULL;
        SetCurItem( NULL );
        SetCurItem( NULL );
        zone->RemoveAllContours();
        zone->RemoveAllContours();
		zone->m_Flags = 0;
    }
    }
    return zone->GetNumCorners();
    return zone->GetNumCorners();
}
}
@@ -542,7 +543,10 @@ int WinEDA_PcbFrame::Begin_Zone( wxDC* DC )
        if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) )
        if( zone->GetCornerPosition( ii - 1 ) != zone->GetCornerPosition( ii ) )
        {
        {
            if( Drc_On && m_drc->Drc( zone, ii - 1 ) == OK_DRC )  // Ok, we can add a new corner
            if( Drc_On && m_drc->Drc( zone, ii - 1 ) == OK_DRC )  // Ok, we can add a new corner
			{
                zone->AppendCorner( GetScreen()->m_Curseur );
                zone->AppendCorner( GetScreen()->m_Curseur );
				SetCurItem( zone ); 	// calls Display_Infos().
			}
        }
        }
    }
    }


+2 −19
Original line number Original line Diff line number Diff line
@@ -1038,25 +1038,8 @@ void CPolyLine::Hatch()
			min_a = (int)(min_y - slope*min_x);
			min_a = (int)(min_y - slope*min_x);
		}
		}
		min_a = (min_a/spacing)*spacing;
		min_a = (min_a/spacing)*spacing;
		int offset = 0;
		// calculate an offset depending on layer number, for a better display of hatches on a multilayer board
		if( layer < (LAY_TOP_COPPER+2) )
		int offset =  (layer * 7) / 8;
			offset = 0;
		else if( layer < (LAY_TOP_COPPER+4) )
			offset = spacing/2;
		else if( layer < (LAY_TOP_COPPER+6) )
			offset = spacing/4;
		else if( layer < (LAY_TOP_COPPER+8) )
			offset = 3*spacing/4;
		else if( layer < (LAY_TOP_COPPER+10) )
			offset = 1*spacing/8;
		else if( layer < (LAY_TOP_COPPER+12) )
			offset = 3*spacing/8;
		else if( layer < (LAY_TOP_COPPER+14) )
			offset = 5*spacing/8;
		else if( layer < (LAY_TOP_COPPER+16) )
			offset = 7*spacing/8;
		else
			wxASSERT(0);
		min_a += offset;
		min_a += offset;


		// now calculate and draw hatch lines
		// now calculate and draw hatch lines
+0 −10
Original line number Original line Diff line number Diff line
@@ -10,27 +10,17 @@
//
//
// When used for copper areas, the first contour is the outer edge 
// When used for copper areas, the first contour is the outer edge 
// of the area, subsequent ones are "holes" in the copper.
// of the area, subsequent ones are "holes" in the copper.
//
// If a CDisplayList pointer is provided, the polyline can draw itself 


#ifndef POLYLINE2KICAD_H
#ifndef POLYLINE2KICAD_H
#define POLYLINE2KICAD_H
#define POLYLINE2KICAD_H


#define PCBU_PER_MIL 10
#define PCBU_PER_MIL 10
#define MAX_LAYERS 32
#define NM_PER_MIL 10 // 25400
#define NM_PER_MIL 10 // 25400




#include "pad_shapes.h"
#include "pad_shapes.h"




#define LAY_SELECTION  0
#define LAY_TOP_COPPER 0

#define CDC wxDC
class wxDC;


class CRect {
class CRect {
public:
public:
	int left, right, top, bottom;
	int left, right, top, bottom;
+4 −4
Original line number Original line Diff line number Diff line
@@ -241,7 +241,7 @@ int MakeEllipseFromArc( int xi, int yi, int xf, int yf, int style, EllipseKH * e
		yyf = yf;
		yyf = yf;
	}
	}
	// find center and radii of ellipse
	// find center and radii of ellipse
	double xo, yo;
	double xo=0, yo=0;
	if( xxf > xxi && yyf > yyi )
	if( xxf > xxi && yyf > yyi )
	{
	{
		xo = xxf;
		xo = xxf;
@@ -1281,7 +1281,7 @@ int GetClearanceBetweenSegments( int x1i, int y1i, int x1f, int y1f, int style1,
	EllipseKH el1;
	EllipseKH el1;
	EllipseKH el2;
	EllipseKH el2;
	bool bArcs;
	bool bArcs;
	int xi, yi, xf, yf;
	int xi=0, yi=0, xf=0, yf=0;
	if( style2 == CPolyLine::STRAIGHT )
	if( style2 == CPolyLine::STRAIGHT )
	{
	{
		// style1 = arc, style2 = straight
		// style1 = arc, style2 = straight
@@ -1601,7 +1601,7 @@ int GetArcIntersections( EllipseKH * el1, EllipseKH * el2,
	double yr = el2->yrad*yscale;
	double yr = el2->yrad*yscale;
	// now test NSTEPS positions in arc, moving clockwise (ie. decreasing theta)
	// now test NSTEPS positions in arc, moving clockwise (ie. decreasing theta)
	double step = M_PI/((NSTEPS-1)*2.0);
	double step = M_PI/((NSTEPS-1)*2.0);
	double d_prev, th_prev;
	double d_prev=0, th_prev;
	double th_interp;
	double th_interp;
	double th1;
	double th1;
	int n = 0;
	int n = 0;
@@ -1676,7 +1676,7 @@ double GetArcClearance( EllipseKH * el1, EllipseKH * el2,
	double th_start2 = el2->theta1;
	double th_start2 = el2->theta1;
	double th_end2 = el2->theta2;
	double th_end2 = el2->theta2;
	double dmin = DBL_MAX;
	double dmin = DBL_MAX;
	double xmin, ymin, thmin, thmin2;
	double xmin=0, ymin=0, thmin=0, thmin2=0;


	int nsteps = NSTEPS;
	int nsteps = NSTEPS;
	int nsteps2 = NSTEPS;
	int nsteps2 = NSTEPS;
Loading