Simplify arc drawing guides to be more consistent with other tools.
This commit is contained in:
parent
77aa48b825
commit
3fd0df658d
|
@ -86,9 +86,6 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
|
|
||||||
gal.ResetTextAttributes();
|
gal.ResetTextAttributes();
|
||||||
|
|
||||||
// angle reference arc size
|
|
||||||
const double innerRad = 12.0 / gal.GetWorldScale();
|
|
||||||
|
|
||||||
const auto origin = m_constructMan.GetOrigin();
|
const auto origin = m_constructMan.GetOrigin();
|
||||||
|
|
||||||
KIGFX::PREVIEW::DRAW_CONTEXT preview_ctx( *aView );
|
KIGFX::PREVIEW::DRAW_CONTEXT preview_ctx( *aView );
|
||||||
|
@ -107,42 +104,31 @@ void ARC_ASSISTANT::ViewDraw( int aLayer, KIGFX::VIEW* aView ) const
|
||||||
|
|
||||||
double initAngle = m_constructMan.GetStartAngle();
|
double initAngle = m_constructMan.GetStartAngle();
|
||||||
|
|
||||||
const auto angleRefLineEnd = m_constructMan.GetOrigin() + VECTOR2D( innerRad * 1.5, 0.0 );
|
|
||||||
|
|
||||||
// draw the short reference baseline
|
|
||||||
preview_ctx.DrawLine( origin, angleRefLineEnd, false );
|
|
||||||
|
|
||||||
// draw the angle reference arc
|
|
||||||
preview_ctx.DrawArcWithAngleHighlight( origin, innerRad, initAngle, 0.0 );
|
|
||||||
|
|
||||||
// draw the radius guide circle
|
// draw the radius guide circle
|
||||||
preview_ctx.DrawCircle( origin, m_constructMan.GetRadius(), true );
|
preview_ctx.DrawCircle( origin, m_constructMan.GetRadius(), true );
|
||||||
|
|
||||||
double degs = getNormDeciDegFromRad( initAngle );
|
double degs = getNormDeciDegFromRad( initAngle );
|
||||||
|
|
||||||
cursorStrings.push_back( DimensionLabel( "r", m_constructMan.GetRadius(), m_units ) );
|
cursorStrings.push_back( DimensionLabel( "r", m_constructMan.GetRadius(), m_units ) );
|
||||||
cursorStrings.push_back(
|
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), degs,
|
||||||
DimensionLabel( wxString::FromUTF8( "θ" ), degs, EDA_UNITS::DEGREES ) );
|
EDA_UNITS::DEGREES ) );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetEndRadiusEnd(), false );
|
preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetEndRadiusEnd(), false );
|
||||||
|
|
||||||
auto start = m_constructMan.GetStartAngle();
|
double start = m_constructMan.GetStartAngle();
|
||||||
auto subtended = m_constructMan.GetSubtended();
|
double subtended = m_constructMan.GetSubtended();
|
||||||
|
double subtendedDeg = getNormDeciDegFromRad( subtended );
|
||||||
preview_ctx.DrawArcWithAngleHighlight( origin, innerRad, start, start + subtended );
|
double endAngleDeg = getNormDeciDegFromRad( start + subtended );
|
||||||
|
|
||||||
double subtendedDeg = getNormDeciDegFromRad( subtended );
|
|
||||||
double endAngleDeg = getNormDeciDegFromRad( start + subtended );
|
|
||||||
|
|
||||||
// draw dimmed extender line to cursor
|
// draw dimmed extender line to cursor
|
||||||
preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetLastPoint(), true );
|
preview_ctx.DrawLineWithAngleHighlight( origin, m_constructMan.GetLastPoint(), true );
|
||||||
|
|
||||||
cursorStrings.push_back(
|
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "Δθ" ), subtendedDeg,
|
||||||
DimensionLabel( wxString::FromUTF8( "Δθ" ), subtendedDeg, EDA_UNITS::DEGREES ) );
|
EDA_UNITS::DEGREES ) );
|
||||||
cursorStrings.push_back(
|
cursorStrings.push_back( DimensionLabel( wxString::FromUTF8( "θ" ), endAngleDeg,
|
||||||
DimensionLabel( wxString::FromUTF8( "θ" ), endAngleDeg, EDA_UNITS::DEGREES ) );
|
EDA_UNITS::DEGREES ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// place the text next to cursor, on opposite side from radius
|
// place the text next to cursor, on opposite side from radius
|
||||||
|
|
|
@ -65,25 +65,6 @@ void DRAW_CONTEXT::DrawCircle( const VECTOR2I& aOrigin, double aRad, bool aDeEmp
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DRAW_CONTEXT::DrawArcWithAngleHighlight(
|
|
||||||
const VECTOR2I& aOrigin, double aRad, double aStartAngle, double aEndAngle )
|
|
||||||
{
|
|
||||||
COLOR4D color = m_render_settings.GetLayerColor( m_currLayer );
|
|
||||||
|
|
||||||
if( angleIsSpecial( aStartAngle - aEndAngle ) )
|
|
||||||
color = getSpecialAngleColour();
|
|
||||||
|
|
||||||
m_gal.SetLineWidth( m_lineWidth );
|
|
||||||
m_gal.SetIsStroke( true );
|
|
||||||
m_gal.SetIsFill( true );
|
|
||||||
m_gal.SetStrokeColor( color );
|
|
||||||
m_gal.SetFillColor( color.WithAlpha( 0.2 ) );
|
|
||||||
|
|
||||||
// draw the angle reference arc
|
|
||||||
m_gal.DrawArc( aOrigin, aRad, -aStartAngle, -aEndAngle );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DRAW_CONTEXT::DrawLine( const VECTOR2I& aStart, const VECTOR2I& aEnd, bool aDeEmphasised )
|
void DRAW_CONTEXT::DrawLine( const VECTOR2I& aStart, const VECTOR2I& aEnd, bool aDeEmphasised )
|
||||||
{
|
{
|
||||||
COLOR4D strokeColor = m_render_settings.GetLayerColor( m_currLayer );
|
COLOR4D strokeColor = m_render_settings.GetLayerColor( m_currLayer );
|
||||||
|
@ -95,8 +76,8 @@ void DRAW_CONTEXT::DrawLine( const VECTOR2I& aStart, const VECTOR2I& aEnd, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DRAW_CONTEXT::DrawLineWithAngleHighlight(
|
void DRAW_CONTEXT::DrawLineWithAngleHighlight( const VECTOR2I& aStart, const VECTOR2I& aEnd,
|
||||||
const VECTOR2I& aStart, const VECTOR2I& aEnd, bool aDeEmphasised )
|
bool aDeEmphasised )
|
||||||
{
|
{
|
||||||
const VECTOR2I vec = aEnd - aStart;
|
const VECTOR2I vec = aEnd - aStart;
|
||||||
COLOR4D strokeColor = m_render_settings.GetLayerColor( m_currLayer );
|
COLOR4D strokeColor = m_render_settings.GetLayerColor( m_currLayer );
|
||||||
|
|
Loading…
Reference in New Issue