Commit d00c83cd authored by Lorenzo Marcantonio's avatar Lorenzo Marcantonio

Migrated the interfaces accepting angles to the double type

The plan goes like this:
- eeschema still uses int in decidegrees
- all the other things internally use double in decidegrees (or radians
  in temporaries)
- in pcbnew UI the unit is *still* int in decidegrees

The idea is to have better precision everywhere while keeping the user with int i
angles. Hopefully, if a fractional angle doesn't come in from the outside, everything
should *look* like an integer angle (unless I forgot something and it broke)

When the time comes, simply updating the UI for allowing doubles from the user should
be enough to get arbitrary angles in pcbnew.
parent cb49ca5a
......@@ -370,7 +370,7 @@ void Draw3D_SolidSegment( const wxPoint& aStart, const wxPoint& aEnd,
void Draw3D_ArcSegment( const wxPoint& aCenterPos, const wxPoint& aStartPoint,
int aArcAngle, int aWidth, int aThickness,
double aArcAngle, int aWidth, int aThickness,
int aZpos, double aBiuTo3DUnits )
{
const int slice = SEGM_PER_CIRCLE;
......
......@@ -85,7 +85,7 @@ void Draw3D_SolidSegment( const wxPoint& aStart, const wxPoint& aEnd,
* @param aBiuTo3DUnits = board internal units to 3D units scaling value
*/
void Draw3D_ArcSegment( const wxPoint& aCenterPos, const wxPoint& aStartPoint,
int aArcAngle, int aWidth, int aThickness,
double aArcAngle, int aWidth, int aThickness,
int aZpos, double aBiuTo3DUnits );
......
......@@ -111,33 +111,29 @@ double PLOTTER::userToDeviceSize( double size )
/**
* Generic fallback: arc rendered as a polyline
*/
void PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
void PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
wxPoint start, end;
const int delta = 50; // increment (in 0.1 degrees) to draw circles
double alpha;
if( StAngle > EndAngle )
EXCHG( StAngle, EndAngle );
SetCurrentLineWidth( width );
/* Please NOTE the different sign due to Y-axis flip */
alpha = DEG2RAD( StAngle / 10.0 );
start.x = centre.x + (int) ( radius * cos( -alpha ) );
start.y = centre.y + (int) ( radius * sin( -alpha ) );
start.x = centre.x + KiROUND( cosdecideg( radius, -StAngle ) );
start.y = centre.y + KiROUND( sindecideg( radius, -StAngle ) );
MoveTo( start );
for( int ii = StAngle + delta; ii < EndAngle; ii += delta )
{
alpha = DEG2RAD( ii / 10.0 );
end.x = centre.x + (int) ( radius * cos( -alpha ) );
end.y = centre.y + (int) ( radius * sin( -alpha ) );
end.x = centre.x + KiROUND( cosdecideg( radius, -ii ) );
end.y = centre.y + KiROUND( sindecideg( radius, -ii ) );
LineTo( end );
}
alpha = DEG2RAD( EndAngle / 10.0 );
end.x = centre.x + (int) ( radius * cos( -alpha ) );
end.y = centre.y + (int) ( radius * sin( -alpha ) );
end.x = centre.x + KiROUND( cosdecideg( radius, -EndAngle ) );
end.y = centre.y + KiROUND( sindecideg( radius, -EndAngle ) );
FinishTo( end );
}
......@@ -380,7 +376,7 @@ void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width
{
wxPoint center( (start.x + end.x) / 2, (start.y + end.y) / 2 );
wxSize size( end.x - start.x, end.y - start.y );
int orient;
double orient;
if( size.y == 0 )
orient = 0;
......@@ -396,7 +392,7 @@ void PLOTTER::segmentAsOval( const wxPoint& start, const wxPoint& end, int width
}
void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, int orient,
void PLOTTER::sketchOval( const wxPoint& pos, const wxSize& aSize, double orient,
int width )
{
SetCurrentLineWidth( width );
......@@ -467,8 +463,8 @@ void PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end, int width,
}
void PLOTTER::ThickArc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
int width, EDA_DRAW_MODE_T tracemode )
void PLOTTER::ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
int radius, int width, EDA_DRAW_MODE_T tracemode )
{
switch( tracemode )
{
......
......@@ -389,7 +389,7 @@ void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int
/** Plot an arc in DXF format
* Filling is not supported
*/
void DXF_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
wxASSERT( outputFile );
......@@ -412,7 +412,7 @@ void DXF_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int rad
/**
* DXF oval pad: always done in sketch mode
*/
void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient,
void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
......@@ -445,7 +445,7 @@ void DXF_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
* DXF rectangular pad: alwayd done in sketch mode
*/
void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
int orient, EDA_DRAW_MODE_T trace_mode )
double orient, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
wxSize size;
......@@ -513,7 +513,7 @@ void DXF_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
* DXF trapezoidal pad: only sketch mode is supported
*/
void DXF_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
wxASSERT( outputFile );
wxPoint coord[4]; /* coord actual corners of a trapezoidal trace */
......@@ -555,7 +555,7 @@ bool containsNonAsciiChars( const wxString& string )
void DXF_PLOTTER::Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
double aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......
......@@ -282,7 +282,7 @@ void GERBER_PLOTTER::Circle( const wxPoint& aCenter, int aDiameter, FILL_T aFill
}
void GERBER_PLOTTER::Arc( const wxPoint& aCenter, int aStAngle, int aEndAngle,
void GERBER_PLOTTER::Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
int aRadius, FILL_T aFill, int aWidth )
{
wxASSERT( outputFile );
......@@ -370,7 +370,7 @@ void GERBER_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
/**
* Filled oval flashes are handled as aperture in the 90 degree positions only
*/
void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient,
void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
......@@ -427,7 +427,7 @@ void GERBER_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int
* Filled rect flashes are handled as aperture in the 90 degree positions only
*/
void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
int orient, EDA_DRAW_MODE_T trace_mode )
double orient, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
......@@ -494,7 +494,7 @@ void GERBER_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
* they require aperture macros
*/
void GERBER_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorners,
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
// XXX to do: use an aperture macro to declare the pad
......
......@@ -381,7 +381,7 @@ void HPGL_PLOTTER::ThickSegment( const wxPoint& start, const wxPoint& end,
* PU PY x, y; PD start_arc_X AA, start_arc_Y, angle, NbSegm; PU;
* Or PU PY x, y; PD start_arc_X AA, start_arc_Y, angle, PU;
*/
void HPGL_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
void HPGL_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
wxASSERT( outputFile );
......@@ -419,7 +419,7 @@ void HPGL_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int ra
/* Plot oval pad.
*/
void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient,
void HPGL_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
......@@ -499,7 +499,7 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
int orient, EDA_DRAW_MODE_T trace_mode )
double orient, EDA_DRAW_MODE_T trace_mode )
{
wxASSERT( outputFile );
wxSize size;
......@@ -616,7 +616,7 @@ void HPGL_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& padsize,
void HPGL_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint* aCorners,
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
wxASSERT( outputFile );
wxPoint polygone[4]; // coordinates of corners relatives to the pad
......
......@@ -201,7 +201,7 @@ void PDF_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T aFill, int wi
* The PDF engine can't directly plot arcs, it uses the base emulation.
* So no filled arcs (not a great loss... )
*/
void PDF_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
void PDF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
wxASSERT( workFile );
......@@ -735,7 +735,7 @@ bool PDF_PLOTTER::EndPlot()
void PDF_PLOTTER::Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
double aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......
......@@ -64,7 +64,7 @@ void PSLIKE_PLOTTER::SetColor( EDA_COLOR_T color )
}
void PSLIKE_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, int orient,
void PSLIKE_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double orient,
EDA_DRAW_MODE_T modetrace )
{
wxASSERT( outputFile );
......@@ -115,7 +115,7 @@ void PSLIKE_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
int orient, EDA_DRAW_MODE_T trace_mode )
double orient, EDA_DRAW_MODE_T trace_mode )
{
static std::vector< wxPoint > cornerList;
wxSize size( aSize );
......@@ -159,7 +159,7 @@ void PSLIKE_PLOTTER::FlashPadRect( const wxPoint& pos, const wxSize& aSize,
void PSLIKE_PLOTTER::FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode )
{
static std::vector< wxPoint > cornerList;
cornerList.clear();
......@@ -471,8 +471,8 @@ void PS_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int widt
}
void PS_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
FILL_T fill, int width )
void PS_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle,
int radius, FILL_T fill, int width )
{
wxASSERT( outputFile );
if( radius <= 0 )
......@@ -805,7 +805,7 @@ bool PS_PLOTTER::EndPlot()
void PS_PLOTTER::Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
double aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......
......@@ -321,7 +321,7 @@ void SVG_PLOTTER::Circle( const wxPoint& pos, int diametre, FILL_T fill, int wid
}
void SVG_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int radius,
void SVG_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
FILL_T fill, int width )
{
/* Draws an arc of a circle, centred on (xc,yc), with starting point
......@@ -347,7 +347,7 @@ void SVG_PLOTTER::Arc( const wxPoint& centre, int StAngle, int EndAngle, int rad
if( !plotMirror )
{
int tmp = StAngle;
double tmp = StAngle;
StAngle = -EndAngle;
EndAngle = -tmp;
}
......@@ -550,7 +550,7 @@ bool SVG_PLOTTER::EndPlot()
void SVG_PLOTTER::Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
double aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......
......@@ -174,7 +174,7 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
startp = aEnd;
}
int delta_angle = ArcTangente( endp.y, endp.x ); // delta_angle is in 0.1 degrees
double delta_angle = ArcTangente( endp.y, endp.x ); // delta_angle is in 0.1 degrees
int seg_len = KiROUND( EuclideanNorm( endp ) );
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
......@@ -237,7 +237,7 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
* @param aWidth = width (thickness) of the line
*/
void TransformArcToPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint aCentre, wxPoint aStart, int aArcAngle,
wxPoint aCentre, wxPoint aStart, double aArcAngle,
int aCircleToSegmentsCount, int aWidth )
{
wxPoint arc_start, arc_end;
......
......@@ -266,7 +266,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
const wxPoint& aPos,
EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
double aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......@@ -566,7 +566,7 @@ void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel,
enum EDA_COLOR_T aColor1,
enum EDA_COLOR_T aColor2,
const wxString &aText,
int aOrient,
double aOrient,
const wxSize &aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......@@ -611,7 +611,7 @@ void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel,
void PLOTTER::Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
double aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......
......@@ -746,7 +746,7 @@ void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
}
else
{
int delta_angle = ArcTangente( dy, dx );
double delta_angle = ArcTangente( dy, dx );
dwx = 0;
dwy = width;
RotatePoint( &dwx, &dwy, -delta_angle );
......@@ -1107,8 +1107,8 @@ void GRFilledArc( EDA_RECT* ClipBox,
wxDC* DC,
int x,
int y,
int StAngle,
int EndAngle,
double StAngle,
double EndAngle,
int r,
int width,
EDA_COLOR_T Color,
......@@ -1153,7 +1153,8 @@ void GRFilledArc( EDA_RECT* ClipBox,
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y,
int StAngle, int EndAngle, int r, EDA_COLOR_T Color, EDA_COLOR_T BgColor )
double StAngle, double EndAngle, int r,
EDA_COLOR_T Color, EDA_COLOR_T BgColor )
{
GRFilledArc( ClipBox, DC, x, y, StAngle, EndAngle, r, 0, Color, BgColor );
}
......@@ -1162,8 +1163,8 @@ void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y,
/*
* Draw an arc in drawing space.
*/
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, int StAngle,
int EndAngle, int r, EDA_COLOR_T Color )
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int xc, int yc, double StAngle,
double EndAngle, int r, EDA_COLOR_T Color )
{
int x1, y1, x2, y2;
......@@ -1210,8 +1211,8 @@ void GRArc( EDA_RECT* ClipBox,
wxDC* DC,
int x,
int y,
int StAngle,
int EndAngle,
double StAngle,
double EndAngle,
int r,
int width,
EDA_COLOR_T Color )
......
......@@ -748,7 +748,7 @@ void LIB_ARC::calcEdit( const wxPoint& aPosition )
// artifacts left behind from the initial draw.
int dx, dy;
int cX, cY;
int angle;
double angle;
cX = aPosition.x;
cY = aPosition.y;
......
......@@ -140,7 +140,7 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
wxPoint curPos = aShapePos;
D_CODE* tool = aParent->GetDcodeDescr();
int rotation;
double rotation;
if( mapExposure( aParent ) == false )
{
EXCHG(aColor, aAltColor);
......@@ -272,7 +272,7 @@ void AM_PRIMITIVE::DrawBasicShape( GERBER_DRAW_ITEM* aParent,
for( int ii = 0; ii < 4; ii++ )
{
subshape_poly = polybuffer;
int sub_rotation = rotation + 900 * ii;
double sub_rotation = rotation + 900 * ii;
for( unsigned jj = 0; jj < subshape_poly.size(); jj++ )
RotatePoint( &subshape_poly[jj], -sub_rotation );
......@@ -459,7 +459,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent,
aBuffer.push_back( currpt );
// Rotate rectangle and move it to the actual start point
int angle = ArcTangente( delta.y, delta.x );
double angle = ArcTangente( delta.y, delta.x );
for( unsigned ii = 0; ii < 4; ii++ )
{
......@@ -512,16 +512,15 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent,
int outerRadius = scaletoIU( params[2].GetValue( tool ), m_GerbMetric ) / 2;
int innerRadius = scaletoIU( params[3].GetValue( tool ), m_GerbMetric ) / 2;
int halfthickness = scaletoIU( params[4].GetValue( tool ), m_GerbMetric ) / 2;
int angle_start = RAD2DECIDEG( asin( (double) halfthickness / innerRadius ) );
double angle_start = RAD2DECIDEG( asin( (double) halfthickness / innerRadius ) );
// Draw shape in the first cadrant (X and Y > 0)
wxPoint pos, startpos;
// Inner arc
startpos.x = innerRadius;
int angle_end = 900 - angle_start;
int angle;
for( angle = angle_start; angle < angle_end; angle += 100 )
double angle_end = 900 - angle_start;
for( double angle = angle_start; angle < angle_end; angle += 100 )
{
pos = startpos;
RotatePoint( &pos, angle );
......@@ -540,7 +539,7 @@ void AM_PRIMITIVE::ConvertShapeToPolygon( GERBER_DRAW_ITEM* aParent,
angle_end = 900 - angle_start;
// First point, near Y axis, outer arc
for( angle = angle_end; angle > angle_start; angle -= 100 )
for( double angle = angle_end; angle > angle_start; angle -= 100 )
{
pos = startpos;
RotatePoint( &pos, angle );
......
......@@ -115,7 +115,7 @@ wxPoint GERBER_DRAW_ITEM::GetABPosition( const wxPoint& aXYPosition ) const
abPos += m_layerOffset + m_imageParams->m_ImageOffset;
abPos.x = KiROUND( abPos.x * m_drawScale.x );
abPos.y = KiROUND( abPos.y * m_drawScale.y );
int rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10;
double rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10;
if( rotation )
RotatePoint( &abPos, -rotation );
......@@ -142,7 +142,7 @@ wxPoint GERBER_DRAW_ITEM::GetXYPosition( const wxPoint& aABPosition )
if( !m_mirrorB )
NEGATE( xyPos.y );
int rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10;
double rotation = m_lyrRotation * 10 + m_imageParams->m_ImageRotation * 10;
if( rotation )
RotatePoint( &xyPos, rotation );
......
......@@ -502,7 +502,7 @@ void D_CODE::ConvertShapeToPolygon()
for( unsigned ii = 0; ii <= SEGS_CNT; ii++ )
{
currpos = initialpos;
RotatePoint( &currpos, ii * 3600 / SEGS_CNT );
RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT );
m_PolyCorners.push_back( currpos );
}
......@@ -552,7 +552,7 @@ void D_CODE::ConvertShapeToPolygon()
for( ; ii <= SEGS_CNT / 2; ii++ )
{
currpos = initialpos;
RotatePoint( &currpos, ii * 3600 / SEGS_CNT );
RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT );
currpos.x += delta;
m_PolyCorners.push_back( currpos );
}
......@@ -561,7 +561,7 @@ void D_CODE::ConvertShapeToPolygon()
for( ii = SEGS_CNT / 2; ii <= SEGS_CNT; ii++ )
{
currpos = initialpos;
RotatePoint( &currpos, ii * 3600 / SEGS_CNT );
RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT );
currpos.x -= delta;
m_PolyCorners.push_back( currpos );
}
......@@ -592,7 +592,7 @@ void D_CODE::ConvertShapeToPolygon()
for( int ii = 0; ii <= m_EdgesCount; ii++ )
{
currpos = initialpos;
RotatePoint( &currpos, ii * 3600 / m_EdgesCount );
RotatePoint( &currpos, ii * 3600.0 / m_EdgesCount );
m_PolyCorners.push_back( currpos );
}
......@@ -633,7 +633,7 @@ static void addHoleToPolygon( std::vector<wxPoint>& aBuffer,
{
currpos.x = 0;
currpos.y = aSize.x / 2; // aSize.x / 2 is the radius of the hole
RotatePoint( &currpos, ii * 3600 / SEGS_CNT );
RotatePoint( &currpos, ii * 3600.0 / SEGS_CNT );
aBuffer.push_back( currpos );
}
......
......@@ -353,7 +353,8 @@ void GBR_LAYOUT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, GR_DRAWMODE aDrawMode,
void GERBVIEW_FRAME::DrawItemsDCodeID( wxDC* aDC, GR_DRAWMODE aDrawMode )
{
wxPoint pos;
int width, orient;
int width;
double orient;
wxString Line;
GRSetDrawMode( aDC, aDrawMode );
......
......@@ -339,8 +339,8 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem,
* angle is trigonometrical (counter-clockwise),
* and axis is the X,Y gerber coordinates
*/
int start_angle = ArcTangente( start.y, start.x );
int end_angle = ArcTangente( end.y, end.x );
double start_angle = ArcTangente( start.y, start.x );
double end_angle = ArcTangente( end.y, end.x );
// dummyTrack has right geometric parameters, but
// fillArcGBRITEM calculates arc parameters for a draw function that expects
......@@ -350,7 +350,7 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem,
if( start_angle > end_angle )
end_angle += 3600;
int arc_angle = start_angle - end_angle;
double arc_angle = start_angle - end_angle;
// Approximate arc by 36 segments per 360 degree
const int increment_angle = 3600 / 36;
int count = std::abs( arc_angle / increment_angle );
......@@ -361,7 +361,7 @@ static void fillArcPOLY( GERBER_DRAW_ITEM* aGbrItem,
wxPoint start_arc = start;
for( int ii = 0; ii <= count; ii++ )
{
int rot;
double rot;
wxPoint end_arc = start;
if( aClockwise )
rot = ii * increment_angle; // rot is in 0.1 deg
......
......@@ -106,7 +106,7 @@ void TransformRoundedEndsSegmentToPolygon( CPOLYGONS_LIST& aCornerBuffer,
* @param aWidth = width (thickness) of the line
*/
void TransformArcToPolygon( CPOLYGONS_LIST& aCornerBuffer,
wxPoint aCentre, wxPoint aStart, int aArcAngle,
wxPoint aCentre, wxPoint aStart, double aArcAngle,
int aCircleToSegmentsCount, int aWidth );
/**
......
......@@ -94,7 +94,7 @@ void DrawGraphicText( EDA_DRAW_PANEL * aPanel,
const wxPoint &aPos,
enum EDA_COLOR_T aColor,
const wxString &aText,
int aOrient,
double aOrient,
const wxSize &aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......@@ -118,7 +118,7 @@ void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel,
enum EDA_COLOR_T aColor1,
enum EDA_COLOR_T aColor2,
const wxString &aText,
int aOrient,
double aOrient,
const wxSize &aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......
......@@ -203,10 +203,10 @@ void GRFilledCircle( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int r, int width
void GRFilledCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, EDA_COLOR_T aColor );
void GRCircle( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aPos, int aRadius, int aWidth, EDA_COLOR_T aColor );
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int StAngle,
int EndAngle, int r, EDA_COLOR_T Color );
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int StAngle,
int EndAngle, int r, int width, EDA_COLOR_T Color );
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
double EndAngle, int r, EDA_COLOR_T Color );
void GRArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
double EndAngle, int r, int width, EDA_COLOR_T Color );
void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
int xc, int yc, EDA_COLOR_T Color );
void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
......@@ -214,9 +214,9 @@ void GRArc1( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
void GRArc1( EDA_RECT* aClipBox, wxDC* aDC, wxPoint aStart, wxPoint aEnd,
wxPoint aCenter, int aWidth, EDA_COLOR_T aColor );
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y,
int StAngle, int EndAngle, int r, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, int StAngle,
int EndAngle, int r, int width, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
double StAngle, double EndAngle, int r, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
void GRFilledArc( EDA_RECT* ClipBox, wxDC* DC, int x, int y, double StAngle,
double EndAngle, int r, int width, EDA_COLOR_T Color, EDA_COLOR_T BgColor );
void GRCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2, int width, EDA_COLOR_T Color );
void GRFillCSegm( EDA_RECT* ClipBox, wxDC* DC, int x1, int y1, int x2, int y2,
......
......@@ -153,8 +153,8 @@ public:
int width = DEFAULT_LINE_WIDTH ) = 0;
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
int width = DEFAULT_LINE_WIDTH ) = 0;
virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle, int rayon,
FILL_T fill, int width = DEFAULT_LINE_WIDTH );
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH );
/**
* moveto/lineto primitive, moves the 'pen' to the specified direction
......@@ -214,8 +214,8 @@ public:
// Higher level primitives -- can be drawn as line, sketch or 'filled'
virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
EDA_DRAW_MODE_T tracemode );
virtual void ThickArc( const wxPoint& centre, int StAngle, int EndAngle, int rayon,
int width, EDA_DRAW_MODE_T tracemode );
virtual void ThickArc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, int width, EDA_DRAW_MODE_T tracemode );
virtual void ThickRect( const wxPoint& p1, const wxPoint& p2, int width,
EDA_DRAW_MODE_T tracemode );
virtual void ThickCircle( const wxPoint& pos, int diametre, int width,
......@@ -224,10 +224,10 @@ public:
// Flash primitives
virtual void FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode ) = 0;
virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, int orient,
virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
EDA_DRAW_MODE_T trace_mode ) = 0;
virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
int orient, EDA_DRAW_MODE_T trace_mode ) = 0;
double orient, EDA_DRAW_MODE_T trace_mode ) = 0;
/** virtual function FlashPadTrapez
* flash a trapezoidal pad
......@@ -238,7 +238,7 @@ public:
* @param aTrace_Mode = FILLED or SKETCH
*/
virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) = 0;
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode ) = 0;
/**
......@@ -247,7 +247,7 @@ public:
virtual void Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
double aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......@@ -297,7 +297,7 @@ protected:
// Helper function for sketched filler segment
void segmentAsOval( const wxPoint& start, const wxPoint& end, int width,
EDA_DRAW_MODE_T tracemode );
void sketchOval( const wxPoint& pos, const wxSize& size, int orient,
void sketchOval( const wxPoint& pos, const wxSize& size, double orient,
int width );
// Coordinate and scaling conversion functions
......@@ -402,17 +402,17 @@ public:
virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
EDA_DRAW_MODE_T tracemode );
virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle, int rayon,
FILL_T fill, int width = DEFAULT_LINE_WIDTH );
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH );
virtual void PenTo( const wxPoint& pos, char plume );
virtual void FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode );
virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, int orient,
virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
EDA_DRAW_MODE_T trace_mode );
virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
int orient, EDA_DRAW_MODE_T trace_mode );
double orient, EDA_DRAW_MODE_T trace_mode );
virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode );
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode );
protected:
void penControl( char plume );
......@@ -459,12 +459,12 @@ public:
// Pad routines are handled with lower level primitives
virtual void FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode );
virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, int orient,
virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
EDA_DRAW_MODE_T trace_mode );
virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
int orient, EDA_DRAW_MODE_T trace_mode );
double orient, EDA_DRAW_MODE_T trace_mode );
virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode );
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode );
/** The SetColor implementation is split with the subclasses:
* The PSLIKE computes the rgb values, the subclass emits the
......@@ -543,7 +543,7 @@ public:
int width = DEFAULT_LINE_WIDTH );
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
int width = DEFAULT_LINE_WIDTH );
virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle,
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH );
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
......@@ -556,7 +556,7 @@ public:
virtual void Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
double aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......@@ -610,7 +610,7 @@ public:
int width = DEFAULT_LINE_WIDTH );
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
int width = DEFAULT_LINE_WIDTH );
virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle,
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH );
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
......@@ -621,7 +621,7 @@ public:
virtual void Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
double aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......@@ -677,7 +677,7 @@ public:
int width = DEFAULT_LINE_WIDTH );
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
int width = DEFAULT_LINE_WIDTH );
virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle,
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH );
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
......@@ -690,7 +690,7 @@ public:
virtual void Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
double aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......@@ -786,21 +786,21 @@ public:
int width = DEFAULT_LINE_WIDTH );
virtual void Circle( const wxPoint& pos, int diametre, FILL_T fill,
int width = DEFAULT_LINE_WIDTH );
virtual void Arc( const wxPoint& aCenter, int aStAngle, int aEndAngle, int aRadius,
FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH );
virtual void Arc( const wxPoint& aCenter, double aStAngle, double aEndAngle,
int aRadius, FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH );
virtual void PlotPoly( const std::vector< wxPoint >& aCornerList,
FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH );
virtual void PenTo( const wxPoint& pos, char plume );
virtual void FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode );
virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, int orient,
virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
EDA_DRAW_MODE_T trace_mode );
virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
int orient, EDA_DRAW_MODE_T trace_mode );
double orient, EDA_DRAW_MODE_T trace_mode );
virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode );
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode );
virtual void SetLayerPolarity( bool aPositive );
......@@ -877,22 +877,22 @@ public:
FILL_T aFill, int aWidth = DEFAULT_LINE_WIDTH );
virtual void ThickSegment( const wxPoint& start, const wxPoint& end, int width,
EDA_DRAW_MODE_T tracemode );
virtual void Arc( const wxPoint& centre, int StAngle, int EndAngle, int rayon,
FILL_T fill, int width = DEFAULT_LINE_WIDTH );
virtual void Arc( const wxPoint& centre, double StAngle, double EndAngle,
int rayon, FILL_T fill, int width = DEFAULT_LINE_WIDTH );
virtual void PenTo( const wxPoint& pos, char plume );
virtual void FlashPadCircle( const wxPoint& pos, int diametre,
EDA_DRAW_MODE_T trace_mode );
virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, int orient,
virtual void FlashPadOval( const wxPoint& pos, const wxSize& size, double orient,
EDA_DRAW_MODE_T trace_mode );
virtual void FlashPadRect( const wxPoint& pos, const wxSize& size,
int orient, EDA_DRAW_MODE_T trace_mode );
double orient, EDA_DRAW_MODE_T trace_mode );
virtual void FlashPadTrapez( const wxPoint& aPadPos, const wxPoint *aCorners,
int aPadOrient, EDA_DRAW_MODE_T aTrace_Mode );
double aPadOrient, EDA_DRAW_MODE_T aTrace_Mode );
virtual void Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
const wxString& aText,
int aOrient,
double aOrient,
const wxSize& aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
......
......@@ -291,7 +291,7 @@ public:
MODULE* Create_1_Module( const wxString& aModuleName );
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, double angle, bool incremental );
/**
* Function PlaceModule
......
......@@ -1482,7 +1482,7 @@ public:
* @param include_fixe = true to orient locked footprints
* @return true if some footprints modified, false if no change
*/
bool ReOrientModules( const wxString& ModuleMask, int Orient, bool include_fixe );
bool ReOrientModules( const wxString& ModuleMask, double Orient, bool include_fixe );
void LockModule( MODULE* aModule, bool aLocked );
void AutoMoveModulesOnPcb( bool PlaceModulesHorsPcb );
......
......@@ -209,7 +209,7 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
/* Same as above, but the rectangle is inclined angle angle. */
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
int angle, LAYER_MSK masque_layer,
double angle, LAYER_MSK masque_layer,
int color, int op_logic );
/* QUEUE.CPP */
......
......@@ -47,7 +47,7 @@ void TracePcbLine( int x0, int y0, int x1, int y1, LAYER_NUM layer, int color );
void TraceArc( int ux0, int uy0,
int ux1, int uy1,
int ArcAngle,
double ArcAngle,
int lg, LAYER_NUM layer, int color,
int op_logic );
......@@ -531,7 +531,7 @@ void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
void TraceFilledRectangle( int ux0, int uy0, int ux1, int uy1,
int angle, LAYER_MSK aLayerMask, int color, int op_logic )
double angle, LAYER_MSK aLayerMask, int color, int op_logic )
{
int row, col;
int cx, cy; // Center of rectangle
......@@ -630,7 +630,6 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer
int row_max, col_max, row_min, col_min;
int demi_pas;
int angle;
int cx, cy, dx, dy;
RoutingMatrix.SetCellOperation( op_logic );
......@@ -686,6 +685,7 @@ void DrawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer
dx = ux1 - ux0;
dy = uy1 - uy0;
double angle;
if( dx )
{
angle = ArcTangente( dy, dx );
......@@ -792,14 +792,14 @@ void TraceCircle( int ux0, int uy0, int ux1, int uy1, int lg, LAYER_NUM layer,
* center = ux0,uy0, starting at ux1, uy1. Coordinates are in
* PCB units.
*/
void TraceArc( int ux0, int uy0, int ux1, int uy1, int ArcAngle, int lg,
void TraceArc( int ux0, int uy0, int ux1, int uy1, double ArcAngle, int lg,
LAYER_NUM layer, int color, int op_logic )
{
int radius, nb_segm;
int x0, y0, // Starting point of the current segment trace
x1, y1; // End point
int ii;
int angle, StAngle;
double angle, StAngle;
radius = KiROUND( Distance( ux0, uy0, ux1, uy1 ) );
......
......@@ -417,11 +417,11 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
double aCorrectionFactor ) const
{
wxPoint corner_position;
int angle;
double angle;
int dx = (m_Size.x / 2) + aClearanceValue;
int dy = (m_Size.y / 2) + aClearanceValue;
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
double delta = 3600.0 / aCircleToSegmentsCount; // rot angle in 0.1 degree
wxPoint PadShapePos = ReturnShapePos(); /* Note: for pad having a shape offset,
* the pad position is NOT the shape position */
wxSize psize = m_Size; /* pad size unsed in RECT and TRAPEZOIDAL pads
......@@ -480,7 +480,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
{
corner_position = wxPoint( 0, -rounding_radius );
RotatePoint( &corner_position, (1800 / aCircleToSegmentsCount) );
RotatePoint( &corner_position, (1800.0 / aCircleToSegmentsCount) );
// Start at half increment offset
angle_pg = i * delta;
......@@ -499,7 +499,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
{
corner_position = wxPoint( -rounding_radius, 0 );
RotatePoint( &corner_position, (1800 / aCircleToSegmentsCount) );
RotatePoint( &corner_position, (1800.0 / aCircleToSegmentsCount) );
angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg );
corner_position -= wxPoint( psize.x / 2, -psize.y / 2 );
......@@ -512,7 +512,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
{
corner_position = wxPoint( 0, rounding_radius );
RotatePoint( &corner_position, (1800 / aCircleToSegmentsCount) );
RotatePoint( &corner_position, (1800.0 / aCircleToSegmentsCount) );
angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg );
corner_position += psize / 2;
......@@ -525,7 +525,7 @@ void D_PAD:: TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
{
corner_position = wxPoint( rounding_radius, 0 );
RotatePoint( &corner_position, (1800 / aCircleToSegmentsCount) );
RotatePoint( &corner_position, (1800.0 / aCircleToSegmentsCount) );
angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg );
corner_position -= wxPoint( -psize.x / 2, psize.y / 2 );
......@@ -665,7 +665,7 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
int aMinThicknessValue,
int aCircleToSegmentsCount,
double aCorrectionFactor,
int aThermalRot )
double aThermalRot )
{
wxPoint corner, corner_end;
wxPoint PadShapePos = aPad.ReturnShapePos(); /* Note: for pad having a shape offset,
......@@ -675,7 +675,7 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
int dx = aPad.GetSize().x / 2;
int dy = aPad.GetSize().y / 2;
int delta = 3600 / aCircleToSegmentsCount; // rot angle in 0.1 degree
double delta = 3600.0 / aCircleToSegmentsCount; // rot angle in 0.1 degree
/* Keep in account the polygon outline thickness
* aThermalGap must be increased by aMinThicknessValue/2 because drawing external outline
......@@ -759,8 +759,8 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
// Now, add the 4 holes ( each is the pattern, rotated by 0, 90, 180 and 270 deg
// aThermalRot = 450 (45.0 degrees orientation) work fine.
int angle_pad = aPad.GetOrientation(); // Pad orientation
int th_angle = aThermalRot;
double angle_pad = aPad.GetOrientation(); // Pad orientation
double th_angle = aThermalRot;
for( unsigned ihole = 0; ihole < 4; ihole++ )
{
......@@ -864,7 +864,7 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
/* Create 2 holes, rotated by pad rotation.
*/
int angle = aPad.GetOrientation() + supp_angle;
double angle = aPad.GetOrientation() + supp_angle;
for( int irect = 0; irect < 2; irect++ )
{
......@@ -946,16 +946,16 @@ void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
corners_buffer.push_back( wxPoint( -copper_thickness.x / 2, -(dy - aThermalGap / 4) ) );
corners_buffer.push_back( wxPoint( -(aThermalGap / 4 + copper_thickness.x / 2), -dy ) );
int angle = aPad.GetOrientation();
double angle = aPad.GetOrientation();
int rounding_radius = KiROUND( aThermalGap * aCorrectionFactor ); // Corner rounding radius
int angle_pg; // Polygon increment angle
double angle_pg; // Polygon increment angle
for( int i = 0; i < aCircleToSegmentsCount / 4 + 1; i++ )
{
wxPoint corner_position = wxPoint( 0, -rounding_radius );
// Start at half increment offset
RotatePoint( &corner_position, 1800 / aCircleToSegmentsCount );
RotatePoint( &corner_position, 1800.0 / aCircleToSegmentsCount );
angle_pg = i * delta;
RotatePoint( &corner_position, angle_pg ); // Rounding vector rotation
......
......@@ -232,7 +232,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
break;
case S_ARC:
int StAngle, EndAngle;
double StAngle, EndAngle;
radius = KiROUND( Distance( ux0, uy0, dx, dy ) );
StAngle = ArcTangente( dy - uy0, dx - ux0 );
EndAngle = StAngle + m_Angle;
......
......@@ -550,7 +550,7 @@ void D_PAD::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM>& aList )
aList.push_back( MSG_PANEL_ITEM( _( "Drill X / Y" ), Line, RED ) );
}
int module_orient = module ? module->GetOrientation() : 0;
double module_orient = module ? module->GetOrientation() : 0;
if( module_orient )
Line.Printf( wxT( "%3.1f(+%3.1f)" ),
......
......@@ -296,7 +296,7 @@ public:
* inflate, < 0 deflate
* @param aRotation = full rotation of the polygon
*/
void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotation ) const;
void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, double aRotation ) const;
/**
* Function BuildPadShapePolygon
......@@ -347,7 +347,7 @@ public:
* @param aRotation = full rotation of the segment
* @return the width of the segment
*/
int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, int aRotation ) const;
int BuildSegmentFromOvalShape( wxPoint& aSegStart, wxPoint& aSegEnd, double aRotation ) const;
void ReturnStringPadName( wxString& text ) const; // Return pad name as string in a buffer
......
......@@ -311,7 +311,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
{
wxPoint coord[4];
int delta_cx, delta_cy;
int angle = m_Orient;
double angle = m_Orient;
int seg_width;
GRSetDrawMode( aDC, aDrawInfo.m_DrawMode );
......@@ -528,7 +528,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
RotatePoint( &tpos, shape_pos, angle );
// Draw text with an angle between -90 deg and + 90 deg
int t_angle = angle;
double t_angle = angle;
NORMALIZE_ANGLE_90( t_angle );
/* Note: in next calculations, texte size is calculated for 3 or more
......@@ -596,7 +596,7 @@ void D_PAD::DrawShape( EDA_RECT* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo )
* aRotation is the asked rotation of the segment (usually m_Orient)
*/
int D_PAD::BuildSegmentFromOvalShape(wxPoint& aSegStart, wxPoint& aSegEnd,
int aRotation) const
double aRotation) const
{
int width;
......@@ -630,7 +630,7 @@ int D_PAD::BuildSegmentFromOvalShape(wxPoint& aSegStart, wxPoint& aSegEnd,
void D_PAD::BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue,
int aRotation ) const
double aRotation ) const
{
wxSize delta;
wxSize halfsize;
......
......@@ -144,7 +144,7 @@ void TEXTE_MODULE::SetLocalCoord()
m_Pos0 = m_Pos - module->GetPosition();
int angle = module->GetOrientation();
double angle = module->GetOrientation();
RotatePoint( &m_Pos0.x, &m_Pos0.y, -angle );
}
......@@ -206,7 +206,7 @@ EDA_RECT TEXTE_MODULE::GetBoundingBox() const
{
// Calculate area without text fields:
EDA_RECT text_area;
int angle = GetDrawRotation();
double angle = GetDrawRotation();
wxPoint textstart, textend;
text_area = GetTextRect();
......@@ -294,7 +294,7 @@ void TEXTE_MODULE::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, GR_DRAWMODE draw_mode,
// Draw the text proper, with the right attributes
wxSize size = m_Size;
int orient = GetDrawRotation();
double orient = GetDrawRotation();
// If the text is mirrored : negate size.x (mirror / Y axis)
if( m_Mirror )
......@@ -324,12 +324,10 @@ void TEXTE_MODULE::DrawUmbilical( EDA_DRAW_PANEL* aPanel,
/* Return text rotation for drawings and plotting
*/
int TEXTE_MODULE::GetDrawRotation() const
double TEXTE_MODULE::GetDrawRotation() const
{
int rotation;
MODULE* module = (MODULE*) m_Parent;
rotation = m_Orient;
double rotation = m_Orient;
if( module )
rotation += module->GetOrientation();
......
......@@ -98,7 +98,7 @@ public:
int GetLength() const; // text length
int GetDrawRotation() const; // Return text rotation for drawings and plotting
double GetDrawRotation() const; // Return text rotation for drawings and plotting
/**
* Function GetTextRect
......
......@@ -711,7 +711,7 @@ void TRACK::Draw( EDA_DRAW_PANEL* panel, wxDC* aDC, GR_DRAWMODE aDrawMode,
// Calculate angle: if the track segment is vertical, angle = 90 degrees
// If horizontal 0 degrees, otherwise compute it
int angle; // angle is in 0.1 degree
double angle; // angle is in 0.1 degree
if( dy == 0 ) // Horizontal segment
{
......
......@@ -165,7 +165,7 @@ void DialogEditModuleText::initDlg( )
AddUnitSymbol( *m_WidthTitle );
PutValueInLocalUnits( *m_TxtWidthCtlr, m_currentText->GetThickness() );
int text_orient = m_currentText->GetOrientation();
double text_orient = m_currentText->GetOrientation();
NORMALIZE_ANGLE_90( text_orient );
if( (text_orient != 0) )
......
......@@ -126,7 +126,10 @@ void DIALOG_GRAPHIC_ITEM_PROPERTIES::initDlg( )
m_StartPointYLabel->SetLabel(_("Center Y"));
m_EndPointXLabel->SetLabel(_("Start Point X"));
m_EndPointYLabel->SetLabel(_("Start Point Y"));
msg << m_Item->GetAngle();
// Here the angle is a double, but the UI is still working
// with integers
msg << int( m_Item->GetAngle() );
m_Angle_Ctrl->SetValue(msg);
break;
......
......@@ -128,7 +128,10 @@ void DIALOG_MODEDIT_FP_BODY_ITEM_PROPERTIES::initDlg()
m_StartPointYLabel->SetLabel(_("Center Y"));
m_EndPointXLabel->SetLabel(_("Start Point X"));
m_EndPointYLabel->SetLabel(_("Start Point Y"));
msg << m_item->GetAngle();
// Here the angle is a double, but the UI is still working
// with integers
msg << int( m_item->GetAngle() );
m_Angle_Ctrl->SetValue(msg);
break;
......
......@@ -110,7 +110,7 @@ void PCB_EDIT_FRAME::OnOrientFootprints( wxCommandEvent& event )
}
bool PCB_EDIT_FRAME::ReOrientModules( const wxString& ModuleMask, int Orient,
bool PCB_EDIT_FRAME::ReOrientModules( const wxString& ModuleMask, double Orient,
bool include_fixe )
{
wxString line;
......
......@@ -354,8 +354,6 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
// If the reference segment is a via, we test it here
if( aRefSeg->Type() == PCB_VIA_T )
{
int angle = 0; // angle du segment a tester;
delta = track->GetEnd() - track->GetStart();
segStartPoint = aRefSeg->GetStart() - track->GetStart();
......@@ -371,8 +369,8 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
}
else // test via to segment
{
// Compute l'angle
angle = ArcTangente( delta.y, delta.x );
// Compute l'angle du segment a tester;
double angle = ArcTangente( delta.y, delta.x );
// Compute new coordinates ( the segment become horizontal)
RotatePoint( &delta, angle );
......@@ -528,7 +526,7 @@ bool DRC::doTrackDrc( TRACK* aRefSeg, TRACK* aStart, bool testPads )
delta = segEndPoint - segStartPoint;
// Compute the segment orientation (angle) en 0,1 degre
int angle = ArcTangente( delta.y, delta.x );
double angle = ArcTangente( delta.y, delta.x );
// Compute the segment lenght: delta.x = lenght after rotation
RotatePoint( &delta, angle );
......@@ -572,7 +570,7 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
{
int dist;
int pad_angle;
double pad_angle;
// Get the clerance between the 2 pads. this is the min distance between aRefPad and aPad
int dist_min = aRefPad->GetClearance( aPad );
......@@ -804,7 +802,6 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad )
bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMinDist )
{
wxSize padHalfsize; // half the dimension of the pad
int orient;
wxPoint startPoint, endPoint;
int seuil;
int deltay;
......@@ -843,7 +840,7 @@ bool DRC::checkClearanceSegmToPad( const D_PAD* aPad, int aSegmentWidth, int aMi
startPoint.x = startPoint.y = 0;
endPoint = m_segmEnd;
orient = aPad->GetOrientation();
double orient = aPad->GetOrientation();
RotatePoint( &startPoint, m_padToTestPos, -orient );
RotatePoint( &endPoint, m_padToTestPos, -orient );
......
......@@ -179,7 +179,7 @@ private:
* so we store the ref segment length (the end point relative to these axis)
* and the segment orientation (used to rotate other coordinates)
*/
int m_segmAngle; // Ref segm orientation in 0,1 degre
double m_segmAngle; // Ref segm orientation in 0,1 degre
int m_segmLength; // length of the reference segment
/* variables used in checkLine to test DRC segm to segm:
......
......@@ -54,7 +54,7 @@ wxPoint MoveVector; // Move vector for move edge, exported
// to dialog_edit mod_text.cpp
static wxPoint TextInitialPosition; // Mouse cursor initial position for
// undo/abort move command
static int TextInitialOrientation; // module text initial orientation for
static double TextInitialOrientation; // module text initial orientation for
// undo/abort move+rot command+rot
......@@ -233,7 +233,7 @@ void PCB_BASE_FRAME::PlaceTexteModule( TEXTE_MODULE* Text, wxDC* DC )
if( Module )
{
// Prepare undo command (a rotation can be made while moving)
int tmp = Text->GetOrientation();
double tmp = Text->GetOrientation();
Text->SetOrientation( TextInitialOrientation );
if( IsType( PCB_FRAME_TYPE ) )
......
......@@ -498,7 +498,6 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
MODULE* module;
D_PAD* pad;
const char* layer;
int orient;
wxString pinname;
const char* mirror = "0";
......@@ -531,7 +530,7 @@ static void CreateShapesSection( FILE* aFile, BOARD* aPcb )
if( pinname.IsEmpty() )
pinname = wxT( "none" );
orient = pad->GetOrientation() - module->GetOrientation();
double orient = pad->GetOrientation() - module->GetOrientation();
NORMALIZE_ANGLE_POS( orient );
// Bottom side modules use the flipped padstack
......@@ -563,7 +562,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
TEXTE_MODULE* textmod;
const char* mirror;
const char* flip;
int orient = module->GetOrientation();
double orient = module->GetOrientation();
if( module->GetFlag() )
{
......@@ -598,7 +597,7 @@ static void CreateComponentsSection( FILE* aFile, BOARD* aPcb )
for( int ii = 0; ii < 2; ii++ )
{
int orient = textmod->GetOrientation();
double orient = textmod->GetOrientation();
wxString layer = GenCADLayerName[(module->GetFlag()) ?
SILKSCREEN_N_BACK : SILKSCREEN_N_FRONT];
......
......@@ -421,7 +421,7 @@ static void export_vrml_circle( LAYER_NUM layer, double startx, double starty, /
static void export_vrml_slot( TRIANGLEBAG& triangles, //{{{
LAYER_NUM top_layer, LAYER_NUM bottom_layer, double xc, double yc,
double dx, double dy, int orient )
double dx, double dy, double orient )
{
double capx, capy; // Cap center
VLoop loop;
......@@ -429,7 +429,7 @@ static void export_vrml_slot( TRIANGLEBAG& triangles, //{{{
loop.z_top = layer_z[top_layer];
loop.z_bottom = layer_z[bottom_layer];
double angle = orient / 1800.0 * M_PI;
double angle = DECIDEG2RAD( orient );
if( dy > dx )
{
......@@ -480,7 +480,7 @@ static void export_vrml_hole( TRIANGLEBAG& triangles,
static void export_vrml_oval_pad( LAYER_NUM layer, double xc, double yc,
double dx, double dy, int orient )
double dx, double dy, double orient )
{
double capx, capy; // Cap center
FLAT_FAN fan;
......
......@@ -67,7 +67,7 @@ public:
int m_Hole_Diameter; // hole value, and for oblong: min(hole size x, hole size y)
int m_Tool_Reference; // Tool reference for this hole = 1 ... n (values <=0 must not be used)
wxSize m_Hole_Size; // hole size for oblong holes
int m_Hole_Orient; // Hole rotation (= pad rotation) for oblong holes
double m_Hole_Orient; // Hole rotation (= pad rotation) for oblong holes
int m_Hole_Shape; // hole shape: round (0) or oval (1)
wxPoint m_Hole_Pos; // hole position
LAYER_NUM m_Hole_Bottom_Layer; // hole starting layer (usually back layer)
......
......@@ -252,7 +252,7 @@ void PCB_BASE_FRAME::GlobalChange_PadSettings( D_PAD* aPad,
if( aPadShapeFilter && ( pad->GetShape() != aPad->GetShape() ) )
continue;
int currpad_orient = pad->GetOrientation() - module->GetOrientation();
double currpad_orient = pad->GetOrientation() - module->GetOrientation();
if( aPadOrientFilter && ( currpad_orient != pad_orient ) )
continue;
......
......@@ -432,7 +432,7 @@ void PCB_BASE_FRAME::PlaceModule( MODULE* aModule, wxDC* aDC, bool aDoNotRecreat
* If DC == NULL, the component does not redraw.
* Otherwise, it erases and redraws turns
*/
void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, int angle, bool incremental )
void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool incremental )
{
if( module == NULL )
return;
......
......@@ -93,8 +93,8 @@ void PCB_ARC::Parse( XNODE* aNode,
SetPosition( lNode->GetNodeContent(), aDefaultMeasurementUnit,
&endX, &endY, aActualConversion );
int alpha1 = ArcTangente( m_startY - m_positionY, m_startX - m_positionX );
int alpha2 = ArcTangente( endY - m_positionY, endX - m_positionX );
double alpha1 = ArcTangente( m_startY - m_positionY, m_startX - m_positionX );
double alpha2 = ArcTangente( endY - m_positionY, endX - m_positionX );
m_angle = alpha1 - alpha2;
NORMALIZE_ANGLE_POS( m_angle );
......
......@@ -41,7 +41,7 @@ class PCB_ARC : public PCB_COMPONENT
public:
int m_startX;
int m_startY;
int m_angle;
double m_angle;
int m_width;
PCB_ARC( PCB_CALLBACKS* aCallbacks, BOARD* aBoard );
......
......@@ -209,7 +209,8 @@ void BRDITEMS_PLOTTER::PlotTextModule( TEXTE_MODULE* pt_texte, EDA_COLOR_T aColo
{
wxSize size;
wxPoint pos;
int orient, thickness;
double orient;
int thickness;
if( aColor == WHITE )
aColor = LIGHTGRAY;
......@@ -447,7 +448,8 @@ void BRDITEMS_PLOTTER::Plot_1_EdgeModule( EDGE_MODULE* aEdge )
// Plot a PCB Text, i;e. a text found on a copper or technical layer
void BRDITEMS_PLOTTER::PlotTextePcb( TEXTE_PCB* pt_texte )
{
int orient, thickness;
double orient;
int thickness;
wxPoint pos;
wxSize size;
......@@ -586,7 +588,8 @@ void BRDITEMS_PLOTTER::PlotFilledAreas( ZONE_CONTAINER* aZone )
void BRDITEMS_PLOTTER::PlotDrawSegment( DRAWSEGMENT* aSeg )
{
int thickness;
int radius = 0, StAngle = 0, EndAngle = 0;
int radius = 0;
double StAngle = 0, EndAngle = 0;
if( (GetLayerMask( aSeg->GetLayer() ) & m_layerMask) == 0 )
return;
......
......@@ -67,7 +67,7 @@
extern void BuildUnconnectedThermalStubsPolygonList( CPOLYGONS_LIST& aCornerBuffer,
BOARD* aPcb, ZONE_CONTAINER* aZone,
double aArcCorrection,
int aRoundPadThermalRotation);
double aRoundPadThermalRotation);
extern void Test_For_Copper_Island_And_Remove( BOARD* aPcb,
ZONE_CONTAINER* aZone_container );
......@@ -79,10 +79,10 @@ extern void CreateThermalReliefPadPolygon( CPOLYGONS_LIST& aCornerBuffer,
int aMinThicknessValue,
int aCircleToSegmentsCount,
double aCorrectionFactor,
int aThermalRot );
double aThermalRot );
// Local Variables:
static int s_thermalRot = 450; // angle of stubs in thermal reliefs for round pads
static double s_thermalRot = 450; // angle of stubs in thermal reliefs for round pads
// how many segments are used to create a polygon from a circle:
static int s_CircleToSegmentsCount = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; /* default value. the real value will be changed to
......
......@@ -130,7 +130,7 @@ void BuildUnconnectedThermalStubsPolygonList( CPOLYGONS_LIST& aCornerBuffer,
BOARD* aPcb,
ZONE_CONTAINER* aZone,
double aArcCorrection,
int aRoundPadThermalRotation )
double aRoundPadThermalRotation )
{
std::vector<wxPoint> corners_buffer; // a local polygon buffer to store one stub
corners_buffer.reserve( 4 );
......@@ -213,7 +213,7 @@ void BuildUnconnectedThermalStubsPolygonList( CPOLYGONS_LIST& aCornerBuffer,
// This is a CIRCLE pad tweak
// for circle pads, the thermal stubs orientation is 45 deg
int fAngle = pad->GetOrientation();
double fAngle = pad->GetOrientation();
if( pad->GetShape() == PAD_CIRCLE )
{
endpoint.x = KiROUND( endpoint.x * aArcCorrection );
......
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