void LIB_ARC::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor, int aDrawMode, void* aData, const TRANSFORM& aTransform ) { // Don't draw the arc until the end point is selected. Only the edit indicators // get drawn at this time. if( IsNew() && m_lastEditState == 1 ) return; wxPoint pos1, pos2, posc; int color = ReturnLayerColor( LAYER_DEVICE ); if( aColor < 0 ) // Used normal color or selected color { if( IsSelected() ) color = g_ItemSelectetColor; } else { color = aColor; } pos1 = aTransform.TransformCoordinate( m_ArcEnd ) + aOffset; pos2 = aTransform.TransformCoordinate( m_ArcStart ) + aOffset; posc = aTransform.TransformCoordinate( m_Pos ) + aOffset; int pt1 = m_t1; int pt2 = m_t2; bool swap = aTransform.MapAngles( &pt1, &pt2 ); if( swap ) { EXCHG( pos1.x, pos2.x ); EXCHG( pos1.y, pos2.y ); } GRSetDrawMode( aDC, aDrawMode ); FILL_T fill = aData ? NO_FILL : m_Fill; if( aColor >= 0 ) fill = NO_FILL; if( fill == FILLED_WITH_BG_BODYCOLOR ) { GRFilledArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, GetPenSize( ), (m_Flags & IS_MOVED) ? color : ReturnLayerColor( LAYER_DEVICE_BACKGROUND ), ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); } else if( fill == FILLED_SHAPE && !aData ) { GRFilledArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, color, color ); } else { #ifdef DRAW_ARC_WITH_ANGLE GRArc( aPanel->GetClipBox(), aDC, posc.x, posc.y, pt1, pt2, m_Radius, GetPenSize(), color ); #else GRArc1( aPanel->GetClipBox(), aDC, pos1.x, pos1.y, pos2.x, pos2.y, posc.x, posc.y, GetPenSize(), color ); #endif } /* Set to one (1) to draw bounding box around arc to validate bounding box * calculation. */ #if 0 EDA_RECT bBox = GetBoundingBox(); GRRect( aPanel->GetClipBox(), aDC, bBox.GetOrigin().x, bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y, 0, LIGHTMAGENTA ); #endif }
/* DrawMode = GrXOR, GrOR ..*/ void DrawLibPartAux(WinEDA_DrawPanel * panel,wxDC * DC, EDA_SchComponentStruct *Component, EDA_LibComponentStruct *Entry, const wxPoint & Pos, int TransMat[2][2], int Multi, int convert, int DrawMode, int Color, bool DrawPinText) { int i, x1, y1, x2, y2, t1, t2, orient; LibEDA_BaseStruct *DEntry = NULL; int CharColor; int fill_option; int SetHightColor; //#define GETCOLOR(l) Color < 0 ? (ReturnLayerColor(l)| SetHightColor) : Color; #define GETCOLOR(l) Color < 0 ? SetHightColor ? s_ItemSelectColor : (ReturnLayerColor(l)| SetHightColor) : Color; if (Entry->m_Drawings == NULL) return; GRSetDrawMode(DC, DrawMode); for( DEntry = Entry->m_Drawings; DEntry != NULL;DEntry = DEntry->Next()) { /* Elimination des elements non relatifs a l'unite */ if( Multi && DEntry->m_Unit && (DEntry->m_Unit != Multi) ) continue; if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) ) continue; if ( DEntry->m_Flags & IS_MOVED ) continue; // Element en deplacement non trace SetHightColor = (DEntry->m_Selected & IS_SELECTED) ? HIGHT_LIGHT_FLAG : 0; switch (DEntry->m_StructType) { case COMPONENT_ARC_DRAW_TYPE: { int xc,yc, x2, y2; LibDrawArc * Arc = (LibDrawArc *) DEntry; CharColor = GETCOLOR(LAYER_DEVICE); xc = Pos.x + TransMat[0][0] * Arc->m_Pos.x + TransMat[0][1] * Arc->m_Pos.y; yc = Pos.y + TransMat[1][0] * Arc->m_Pos.x + TransMat[1][1] * Arc->m_Pos.y; x2 = Pos.x + TransMat[0][0] * Arc->m_Start.x + TransMat[0][1] * Arc->m_Start.y;; y2 = Pos.y + TransMat[1][0] * Arc->m_Start.x + TransMat[1][1] * Arc->m_Start.y; x1 = Pos.x + TransMat[0][0] * Arc->m_End.x + TransMat[0][1] * Arc->m_End.y;; y1 = Pos.y + TransMat[1][0] * Arc->m_End.x + TransMat[1][1] * Arc->m_End.y; t1 = Arc->t1; t2 = Arc->t2; bool swap = MapAngles(&t1, &t2, TransMat); if ( swap ) { EXCHG(x1,x2); EXCHG(y1, y2) } fill_option = Arc->m_Fill & (~g_PrintFillMask); if ( Color < 0 ) // Normal Color Layer { if ( (fill_option == FILLED_WITH_BG_BODYCOLOR) && ! g_IsPrinting ) GRFilledArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, Arc->m_Rayon, CharColor, ReturnLayerColor(LAYER_DEVICE_BACKGROUND)); else if ( fill_option == FILLED_SHAPE) GRFilledArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, Arc->m_Rayon, CharColor, CharColor); #ifdef DRAW_ARC_WITH_ANGLE else GRArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, Arc->m_Rayon, CharColor); #else else GRArc1(&panel->m_ClipBox, DC, x1, y1, x2, y2, xc, yc , CharColor); #endif } #ifdef DRAW_ARC_WITH_ANGLE else GRArc(&panel->m_ClipBox, DC, xc, yc, t1, t2, Arc->m_Rayon, CharColor); #else else GRArc1(&panel->m_ClipBox, DC, x1, y1, x2, y2, xc, yc, CharColor); #endif }