Loading 3d-viewer/3d_draw.cpp +59 −12 Original line number Original line Diff line number Diff line Loading @@ -205,11 +205,58 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() if( g_Parm_3D_Visu.m_Draw3DZone ) if( g_Parm_3D_Visu.m_Draw3DZone ) { { // Draw segments used to fill copper areas for( segzone = pcb->m_Zone; segzone != NULL; segzone = segzone->Next() ) for( segzone = pcb->m_Zone; segzone != NULL; segzone = segzone->Next() ) { { if( segzone->Type() == TYPE_ZONE ) if( segzone->Type() == TYPE_ZONE ) Draw3D_Track( segzone ); Draw3D_Track( segzone ); } } // Draw copper areas outlines for( ii = 0; ii < pcb->GetAreaCount(); ii++ ) { ZONE_CONTAINER* zone = pcb->GetArea( ii ); if( zone->m_FilledPolysList.size() == 0 ) continue; if( zone->m_ZoneMinThickness <= 1 ) continue; int imax = zone->m_FilledPolysList.size() - 1; CPolyPt* firstcorner = &zone->m_FilledPolysList[0]; CPolyPt* begincorner = firstcorner; SEGZONE dummysegment(pcb); dummysegment.SetLayer( zone->GetLayer() ); dummysegment.m_Width = zone->m_ZoneMinThickness; for( int ic = 1; ic <= imax; ic++ ) { CPolyPt* endcorner = &zone->m_FilledPolysList[ic]; if( begincorner->utility == 0 ) // Draw only basic outlines, not extra segments { dummysegment.m_Start.x = begincorner->x; dummysegment.m_Start.y = begincorner->y; dummysegment.m_End.x = endcorner->x; dummysegment.m_End.y = endcorner->y; Draw3D_Track( &dummysegment ); } if( (endcorner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it { if( endcorner->utility == 0 ) // Draw only basic outlines, not extra segments { dummysegment.m_Start.x = endcorner->x; dummysegment.m_Start.y = endcorner->y; dummysegment.m_End.x = firstcorner->x; dummysegment.m_End.y = firstcorner->y; Draw3D_Track( &dummysegment ); } ic++; if( ic < imax - 1 ) begincorner = firstcorner = &zone->m_FilledPolysList[ic]; } else begincorner = endcorner; } } } } /* draw graphic items */ /* draw graphic items */ Loading CHANGELOG.txt +8 −0 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with email address. email address. 2009-feb-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ ++All: change filename drawpanel_wxstruct.h to class_drawpanel.h and move class BASE_SCREEN description from drawpanel_wxstruct.h to a new file: class_base_screen.h minor enhancement for window zoom command. refinements in 3D zones drawing. 2009-jan-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2009-jan-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ ================================================================================ ++All: ++All: Loading common/base_screen.cpp +19 −1 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,6 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType ) m_Zoom = 32 * m_ZoomScalar; m_Zoom = 32 * m_ZoomScalar; m_Grid = wxSize( 50, 50 ); /* Default grid size */ m_Grid = wxSize( 50, 50 ); /* Default grid size */ m_UserGridIsON = FALSE; m_UserGridIsON = FALSE; m_Diviseur_Grille = 1; m_Center = true; m_Center = true; m_CurrentSheetDesc = &g_Sheet_A4; m_CurrentSheetDesc = &g_Sheet_A4; Loading Loading @@ -118,6 +117,25 @@ wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos ) return curpos; return curpos; } } /** Function SetScalingFactor * calculates the .m_Zoom member to have a given scaling facort * @param the the current scale used to draw items on screen * draw coordinates are user coordinates * GetScalingFactor( ) */ void BASE_SCREEN::SetScalingFactor(double aScale ) { int zoom = static_cast<int>( ceil(aScale * m_ZoomScalar) ); // Limit zoom to max and min allowed values: if (zoom < m_ZoomList[0]) zoom = m_ZoomList[0]; int idxmax = m_ZoomList.GetCount() - 1; if (zoom > m_ZoomList[idxmax]) zoom = m_ZoomList[idxmax]; SetZoom( zoom ); } /** /** * Calculate coordinate value for zooming. * Calculate coordinate value for zooming. * * Loading common/zoom.cpp +5 −8 Original line number Original line Diff line number Diff line Loading @@ -81,21 +81,18 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect ) * @param Rect = selected area to show after zooming * @param Rect = selected area to show after zooming */ */ { { int ii, jj; double scalex, bestscale; int bestzoom; wxSize size; wxSize size; /* Compute the best zoom */ /* Compute the best zoom */ Rect.Normalize(); Rect.Normalize(); size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize(); // Use ceil to at least show the full rect // Use ceil to at least show the full rect ii = static_cast<int>( ceil(1.0 * Rect.GetSize().x / size.x) ); scalex = (double) Rect.GetSize().x / size.x; jj = static_cast<int>( ceil(1.0 * Rect.GetSize().y / size.y) ); bestscale = (double)Rect.GetSize().y / size.y; bestzoom = MAX( ii, jj ); bestscale = MAX( bestscale, scalex ); if( bestzoom <= 0 ) bestzoom = 1; GetBaseScreen()->SetZoom( bestzoom * GetBaseScreen()->m_ZoomScalar ); GetBaseScreen()->SetScalingFactor( bestscale ); GetBaseScreen()->m_Curseur = Rect.Centre(); GetBaseScreen()->m_Curseur = Rect.Centre(); Recadre_Trace( TRUE ); Recadre_Trace( TRUE ); } } Loading eeschema/component_class.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -10,7 +10,7 @@ #endif #endif #include "base_struct.h" #include "base_struct.h" #include "class_screen.h" #include "class_sch_screen.h" #include <wx/arrstr.h> #include <wx/arrstr.h> #include <wx/dynarray.h> #include <wx/dynarray.h> Loading Loading
3d-viewer/3d_draw.cpp +59 −12 Original line number Original line Diff line number Diff line Loading @@ -205,11 +205,58 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() if( g_Parm_3D_Visu.m_Draw3DZone ) if( g_Parm_3D_Visu.m_Draw3DZone ) { { // Draw segments used to fill copper areas for( segzone = pcb->m_Zone; segzone != NULL; segzone = segzone->Next() ) for( segzone = pcb->m_Zone; segzone != NULL; segzone = segzone->Next() ) { { if( segzone->Type() == TYPE_ZONE ) if( segzone->Type() == TYPE_ZONE ) Draw3D_Track( segzone ); Draw3D_Track( segzone ); } } // Draw copper areas outlines for( ii = 0; ii < pcb->GetAreaCount(); ii++ ) { ZONE_CONTAINER* zone = pcb->GetArea( ii ); if( zone->m_FilledPolysList.size() == 0 ) continue; if( zone->m_ZoneMinThickness <= 1 ) continue; int imax = zone->m_FilledPolysList.size() - 1; CPolyPt* firstcorner = &zone->m_FilledPolysList[0]; CPolyPt* begincorner = firstcorner; SEGZONE dummysegment(pcb); dummysegment.SetLayer( zone->GetLayer() ); dummysegment.m_Width = zone->m_ZoneMinThickness; for( int ic = 1; ic <= imax; ic++ ) { CPolyPt* endcorner = &zone->m_FilledPolysList[ic]; if( begincorner->utility == 0 ) // Draw only basic outlines, not extra segments { dummysegment.m_Start.x = begincorner->x; dummysegment.m_Start.y = begincorner->y; dummysegment.m_End.x = endcorner->x; dummysegment.m_End.y = endcorner->y; Draw3D_Track( &dummysegment ); } if( (endcorner->end_contour) || (ic == imax) ) // the last corner of a filled area is found: draw it { if( endcorner->utility == 0 ) // Draw only basic outlines, not extra segments { dummysegment.m_Start.x = endcorner->x; dummysegment.m_Start.y = endcorner->y; dummysegment.m_End.x = firstcorner->x; dummysegment.m_End.y = firstcorner->y; Draw3D_Track( &dummysegment ); } ic++; if( ic < imax - 1 ) begincorner = firstcorner = &zone->m_FilledPolysList[ic]; } else begincorner = endcorner; } } } } /* draw graphic items */ /* draw graphic items */ Loading
CHANGELOG.txt +8 −0 Original line number Original line Diff line number Diff line Loading @@ -5,6 +5,14 @@ Started 2007-June-11 Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with email address. email address. 2009-feb-01 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ ++All: change filename drawpanel_wxstruct.h to class_drawpanel.h and move class BASE_SCREEN description from drawpanel_wxstruct.h to a new file: class_base_screen.h minor enhancement for window zoom command. refinements in 3D zones drawing. 2009-jan-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2009-jan-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> ================================================================================ ================================================================================ ++All: ++All: Loading
common/base_screen.cpp +19 −1 Original line number Original line Diff line number Diff line Loading @@ -35,7 +35,6 @@ BASE_SCREEN::BASE_SCREEN( KICAD_T aType ) : EDA_BaseStruct( aType ) m_Zoom = 32 * m_ZoomScalar; m_Zoom = 32 * m_ZoomScalar; m_Grid = wxSize( 50, 50 ); /* Default grid size */ m_Grid = wxSize( 50, 50 ); /* Default grid size */ m_UserGridIsON = FALSE; m_UserGridIsON = FALSE; m_Diviseur_Grille = 1; m_Center = true; m_Center = true; m_CurrentSheetDesc = &g_Sheet_A4; m_CurrentSheetDesc = &g_Sheet_A4; Loading Loading @@ -118,6 +117,25 @@ wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos ) return curpos; return curpos; } } /** Function SetScalingFactor * calculates the .m_Zoom member to have a given scaling facort * @param the the current scale used to draw items on screen * draw coordinates are user coordinates * GetScalingFactor( ) */ void BASE_SCREEN::SetScalingFactor(double aScale ) { int zoom = static_cast<int>( ceil(aScale * m_ZoomScalar) ); // Limit zoom to max and min allowed values: if (zoom < m_ZoomList[0]) zoom = m_ZoomList[0]; int idxmax = m_ZoomList.GetCount() - 1; if (zoom > m_ZoomList[idxmax]) zoom = m_ZoomList[idxmax]; SetZoom( zoom ); } /** /** * Calculate coordinate value for zooming. * Calculate coordinate value for zooming. * * Loading
common/zoom.cpp +5 −8 Original line number Original line Diff line number Diff line Loading @@ -81,21 +81,18 @@ void WinEDA_DrawFrame::Window_Zoom( EDA_Rect& Rect ) * @param Rect = selected area to show after zooming * @param Rect = selected area to show after zooming */ */ { { int ii, jj; double scalex, bestscale; int bestzoom; wxSize size; wxSize size; /* Compute the best zoom */ /* Compute the best zoom */ Rect.Normalize(); Rect.Normalize(); size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize(); // Use ceil to at least show the full rect // Use ceil to at least show the full rect ii = static_cast<int>( ceil(1.0 * Rect.GetSize().x / size.x) ); scalex = (double) Rect.GetSize().x / size.x; jj = static_cast<int>( ceil(1.0 * Rect.GetSize().y / size.y) ); bestscale = (double)Rect.GetSize().y / size.y; bestzoom = MAX( ii, jj ); bestscale = MAX( bestscale, scalex ); if( bestzoom <= 0 ) bestzoom = 1; GetBaseScreen()->SetZoom( bestzoom * GetBaseScreen()->m_ZoomScalar ); GetBaseScreen()->SetScalingFactor( bestscale ); GetBaseScreen()->m_Curseur = Rect.Centre(); GetBaseScreen()->m_Curseur = Rect.Centre(); Recadre_Trace( TRUE ); Recadre_Trace( TRUE ); } } Loading
eeschema/component_class.h +1 −1 Original line number Original line Diff line number Diff line Loading @@ -10,7 +10,7 @@ #endif #endif #include "base_struct.h" #include "base_struct.h" #include "class_screen.h" #include "class_sch_screen.h" #include <wx/arrstr.h> #include <wx/arrstr.h> #include <wx/dynarray.h> #include <wx/dynarray.h> Loading