Commit c3b448b6 authored by Maciej Suminski's avatar Maciej Suminski
Browse files

Upstream merge.

parents e7ea0480 fca1ba67
Loading
Loading
Loading
Loading
+3 −3
Original line number Original line Diff line number Diff line
@@ -47,7 +47,7 @@
class BOARD_DESIGN_SETTINGS;
class BOARD_DESIGN_SETTINGS;
class EDA_3D_FRAME;
class EDA_3D_FRAME;
class S3D_VERTEX;
class S3D_VERTEX;
class SEGVIA;
class VIA;
class D_PAD;
class D_PAD;


// We are using GL lists to store layers and other items
// We are using GL lists to store layers and other items
@@ -160,8 +160,8 @@ public:
    void   Draw3DGrid( double aGriSizeMM );
    void   Draw3DGrid( double aGriSizeMM );
    void   Draw3DAxis();
    void   Draw3DAxis();


    void   Draw3DViaHole( SEGVIA * aVia );
    void   Draw3DViaHole( const VIA * aVia );
    void   Draw3DPadHole( D_PAD * aPad );
    void   Draw3DPadHole( const D_PAD * aPad );


    DECLARE_EVENT_TABLE()
    DECLARE_EVENT_TABLE()
};
};
+54 −43
Original line number Original line Diff line number Diff line
@@ -257,8 +257,8 @@ void EDA_3D_CANVAS::BuildBoard3DView()


    // Build a polygon from edge cut items
    // Build a polygon from edge cut items
    wxString msg;
    wxString msg;
    if( ! pcb->GetBoardPolygonOutlines( bufferPcbOutlines,

                                        allLayerHoles, &msg ) )
    if( !pcb->GetBoardPolygonOutlines( bufferPcbOutlines, allLayerHoles, &msg ) )
    {
    {
        msg << wxT("\n\n") <<
        msg << wxT("\n\n") <<
            _("Unable to calculate the board outlines.\n"
            _("Unable to calculate the board outlines.\n"
@@ -274,7 +274,7 @@ void EDA_3D_CANVAS::BuildBoard3DView()
    bool            hightQualityMode = false;
    bool            hightQualityMode = false;


    for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER;
    for( LAYER_NUM layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER;
         layer++ )
         ++layer )
    {
    {
        if( layer != LAST_COPPER_LAYER
        if( layer != LAST_COPPER_LAYER
            && layer >= g_Parm_3D_Visu.m_CopperLayersCount )
            && layer >= g_Parm_3D_Visu.m_CopperLayersCount )
@@ -302,18 +302,19 @@ void EDA_3D_CANVAS::BuildBoard3DView()
            // Add via hole
            // Add via hole
            if( track->Type() == PCB_VIA_T )
            if( track->Type() == PCB_VIA_T )
            {
            {
                int shape = track->GetShape();
                VIA *via = static_cast<VIA*>( track );
                int holediameter    = track->GetDrillValue();
                VIATYPE_T viatype = via->GetViaType();
                int holediameter = via->GetDrillValue();
                int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
                int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
                int hole_outer_radius = (holediameter + thickness) / 2;
                int hole_outer_radius = (holediameter + thickness) / 2;


                if( shape != VIA_THROUGH )
                if( viatype != VIA_THROUGH )
                    TransformCircleToPolygon( currLayerHoles,
                    TransformCircleToPolygon( currLayerHoles,
                                              track->GetStart(), hole_outer_radius,
                                              via->GetStart(), hole_outer_radius,
                                              segcountLowQuality );
                                              segcountLowQuality );
                else if( !throughHolesListBuilt )
                else if( !throughHolesListBuilt )
                    TransformCircleToPolygon( allLayerHoles,
                    TransformCircleToPolygon( allLayerHoles,
                                              track->GetStart(), hole_outer_radius,
                                              via->GetStart(), hole_outer_radius,
                                              segcountLowQuality );
                                              segcountLowQuality );
            }
            }
        }
        }
@@ -431,14 +432,16 @@ void EDA_3D_CANVAS::BuildBoard3DView()
    }
    }


    // Draw vias holes (vertical cylinders)
    // Draw vias holes (vertical cylinders)
    for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
    for( const TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )
    {
    {
        if( track->Type() == PCB_VIA_T )
        const VIA *via = dynamic_cast<const VIA*>(track);
            Draw3DViaHole( (SEGVIA*) track );

        if( via )
            Draw3DViaHole( via );
    }
    }


    // Draw pads holes (vertical cylinders)
    // Draw pads holes (vertical cylinders)
    for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
    for( const MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
    {
    {
        for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() )
        for( D_PAD* pad = module->Pads(); pad != NULL; pad = pad->Next() )
            Draw3DPadHole( pad );
            Draw3DPadHole( pad );
@@ -505,6 +508,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
                                                // to reduce time calculations
                                                // to reduce time calculations
                                                // for holes and items which do not need
                                                // for holes and items which do not need
                                                // a fine representation
                                                // a fine representation
    double          correctionFactorLQ = 1.0 / cos( M_PI / (segcountLowQuality * 2) );


    CPOLYGONS_LIST  bufferPolys;
    CPOLYGONS_LIST  bufferPolys;
    bufferPolys.reserve( 100000 );              // Reserve for large board
    bufferPolys.reserve( 100000 );              // Reserve for large board
@@ -514,8 +518,8 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
    CPOLYGONS_LIST  bufferPcbOutlines;          // stores the board main outlines
    CPOLYGONS_LIST  bufferPcbOutlines;          // stores the board main outlines
    // Build a polygon from edge cut items
    // Build a polygon from edge cut items
    wxString msg;
    wxString msg;
    if( ! pcb->GetBoardPolygonOutlines( bufferPcbOutlines,

                                        allLayerHoles, &msg ) )
    if( !pcb->GetBoardPolygonOutlines( bufferPcbOutlines, allLayerHoles, &msg ) )
    {
    {
        msg << wxT("\n\n") <<
        msg << wxT("\n\n") <<
            _("Unable to calculate the board outlines.\n"
            _("Unable to calculate the board outlines.\n"
@@ -524,21 +528,20 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
    }
    }


    int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
    int thickness = g_Parm_3D_Visu.GetCopperThicknessBIU();
    for( TRACK* track = pcb->m_Track; track != NULL; track = track->Next() )

    {
    // Add via holes
       // Add via hole
    for( VIA* via = GetFirstVia( pcb->m_Track ); via != NULL;
        if( track->Type() == PCB_VIA_T )
            via = GetFirstVia( via->Next() ) )
    {
    {
            int shape = track->GetShape();
        VIATYPE_T viatype = via->GetViaType();
            int holediameter    = track->GetDrillValue();
        int holediameter = via->GetDrillValue();
        int hole_outer_radius = (holediameter + thickness) / 2;
        int hole_outer_radius = (holediameter + thickness) / 2;


            if( shape == VIA_THROUGH )
        if( viatype == VIA_THROUGH )
            TransformCircleToPolygon( allLayerHoles,
            TransformCircleToPolygon( allLayerHoles,
                                          track->GetStart(), hole_outer_radius,
                    via->GetStart(), hole_outer_radius,
                    segcountLowQuality );
                    segcountLowQuality );
    }
    }
    }


    // draw pads holes
    // draw pads holes
    for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
    for( MODULE* module = pcb->m_Modules; module != NULL; module = module->Next() )
@@ -557,7 +560,7 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
    allLayerHoles.ExportTo( brdpolysetHoles );
    allLayerHoles.ExportTo( brdpolysetHoles );


    for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER;
    for( LAYER_NUM layer = FIRST_NON_COPPER_LAYER; layer <= LAST_NON_COPPER_LAYER;
         layer++ )
         ++layer )
    {
    {
        // Skip user layers, which are not drawn here
        // Skip user layers, which are not drawn here
        if( IsUserLayer( layer) )
        if( IsUserLayer( layer) )
@@ -606,22 +609,30 @@ void EDA_3D_CANVAS::BuildTechLayers3DView()
                        continue;
                        continue;


                    BuildPadShapeThickOutlineAsPolygon( pad, bufferPolys,
                    BuildPadShapeThickOutlineAsPolygon( pad, bufferPolys,
                                                        linewidth,
                            linewidth, segcountforcircle, correctionFactor );
                                                        segcountforcircle, correctionFactor );
                }
                }
            }
            }
            else
            else
                module->TransformPadsShapesWithClearanceToPolygon( layer,
                module->TransformPadsShapesWithClearanceToPolygon( layer,
                                                                   bufferPolys,
                        bufferPolys, 0, segcountforcircle, correctionFactor );
                                                                   0,
                                                                   segcountforcircle,
                                                                   correctionFactor );


            module->TransformGraphicShapesWithClearanceToPolygonSet( layer,
            module->TransformGraphicShapesWithClearanceToPolygonSet( layer,
                                                                     bufferPolys,
                    bufferPolys, 0, segcountforcircle, correctionFactor );
                                                                     0,
        }
                                                                     segcountforcircle,

                                                                     correctionFactor );
        // Draw non copper zones
        if( g_Parm_3D_Visu.GetFlag( FL_ZONE ) )
        {
            for( int ii = 0; ii < pcb->GetAreaCount(); ii++ )
            {
                ZONE_CONTAINER* zone = pcb->GetArea( ii );

                if( !zone->IsOnLayer( layer ) )
                    continue;

                zone->TransformSolidAreasShapesToPolygonSet(
                        bufferPolys, segcountLowQuality, correctionFactorLQ );
            }
        }
        }


        // bufferPolys contains polygons to merge. Many overlaps .
        // bufferPolys contains polygons to merge. Many overlaps .
@@ -700,7 +711,7 @@ void EDA_3D_CANVAS::BuildBoard3DAuxLayers()
    bufferPolys.reserve( 5000 );    // Reserve for items not on board
    bufferPolys.reserve( 5000 );    // Reserve for items not on board


    for( LAYER_NUM layer = FIRST_USER_LAYER; layer <= LAST_USER_LAYER;
    for( LAYER_NUM layer = FIRST_USER_LAYER; layer <= LAST_USER_LAYER;
         layer++ )
         ++layer )
    {
    {
        if( !Is3DLayerEnabled( layer ) )
        if( !Is3DLayerEnabled( layer ) )
            continue;
            continue;
@@ -1047,7 +1058,7 @@ void EDA_3D_CANVAS::Draw3DGrid( double aGriSizeMM )
}
}




void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia )
void EDA_3D_CANVAS::Draw3DViaHole( const VIA* aVia )
{
{
    LAYER_NUM   top_layer, bottom_layer;
    LAYER_NUM   top_layer, bottom_layer;
    int         inner_radius    = aVia->GetDrillValue() / 2;
    int         inner_radius    = aVia->GetDrillValue() / 2;
@@ -1060,7 +1071,7 @@ void EDA_3D_CANVAS::Draw3DViaHole( SEGVIA* aVia )
        SetGLCopperColor();
        SetGLCopperColor();
    else
    else
    {
    {
        EDA_COLOR_T color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + aVia->GetShape() );
        EDA_COLOR_T color = g_ColorsSettings.GetItemColor( VIAS_VISIBLE + aVia->GetViaType() );
        SetGLColor( color );
        SetGLColor( color );
    }
    }


@@ -1111,7 +1122,7 @@ void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas,




// Draw 3D pads.
// Draw 3D pads.
void EDA_3D_CANVAS::Draw3DPadHole( D_PAD* aPad )
void EDA_3D_CANVAS::Draw3DPadHole( const D_PAD* aPad )
{
{
    // Draw the pad hole
    // Draw the pad hole
    wxSize  drillsize   = aPad->GetDrillSize();
    wxSize  drillsize   = aPad->GetDrillSize();
+1 −1
Original line number Original line Diff line number Diff line
@@ -81,7 +81,7 @@ END_EVENT_TABLE()


EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
EDA_3D_FRAME::EDA_3D_FRAME( KIWAY* aKiway, PCB_BASE_FRAME* aParent,
        const wxString& aTitle, long style ) :
        const wxString& aTitle, long style ) :
    KIWAY_PLAYER( aKiway, aParent, DISPLAY3D_FRAME_TYPE, aTitle,
    KIWAY_PLAYER( aKiway, aParent, FRAME_PCB_DISPLAY3D, aTitle,
            wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
            wxDefaultPosition, wxDefaultSize, style, wxT( "Frame3D" ) )
{
{
    m_canvas        = NULL;
    m_canvas        = NULL;
+26 −3
Original line number Original line Diff line number Diff line
@@ -4,7 +4,7 @@
 * Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
 * Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
 * Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
 * Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
 * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
 * Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
 * Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
 *
 *
 * This program is free software; you can redistribute it and/or
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * modify it under the terms of the GNU General Public License
@@ -71,7 +71,7 @@ void VRML_MODEL_PARSER::Load( const wxString aFilename )
        if ( text == NULL )
        if ( text == NULL )
            continue;
            continue;


        if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Group" ) == 0 )
        if( stricmp( text, "DEF" ) == 0 || stricmp( text, "Transform" ) == 0 || stricmp( text, "Group" ) == 0 )
        {
        {
            while( GetLine( file, line, &LineNum, 512 ) )
            while( GetLine( file, line, &LineNum, 512 ) )
            {
            {
@@ -121,7 +121,7 @@ int VRML_MODEL_PARSER::readMaterial( FILE* file, int* LineNum )
        return 0;
        return 0;
    }
    }


    if( stricmp( command, "DEF" ) == 0 || stricmp( command, "Material") == 0)
    if( stricmp( command, "DEF" ) == 0 || stricmp( command,"Transform" ) == 0 || stricmp( command, "Material") == 0)
    {
    {
        material = new S3D_MATERIAL( GetMaster(), mat_name );
        material = new S3D_MATERIAL( GetMaster(), mat_name );


@@ -197,6 +197,9 @@ int VRML_MODEL_PARSER::readChildren( FILE* file, int* LineNum )
    {
    {
        text = strtok( line, sep_chars );
        text = strtok( line, sep_chars );


        if( *text == '[' )
            continue;

        if( *text == ']' )
        if( *text == ']' )
            return 0;
            return 0;


@@ -233,6 +236,11 @@ int VRML_MODEL_PARSER::readShape( FILE* file, int* LineNum )
            break;
            break;
        }
        }


        if( *text == '{' )
            {
                continue;
            }

        if( stricmp( text, "appearance" ) == 0 )
        if( stricmp( text, "appearance" ) == 0 )
        {
        {
            readAppearance( file, LineNum );
            readAppearance( file, LineNum );
@@ -267,6 +275,11 @@ int VRML_MODEL_PARSER::readAppearance( FILE* file, int* LineNum )
            break;
            break;
        }
        }


        if( *text == '{' )
            {
                continue;
            }

        if( stricmp( text, "material" ) == 0 )
        if( stricmp( text, "material" ) == 0 )
        {
        {
            readMaterial( file, LineNum );
            readMaterial( file, LineNum );
@@ -380,6 +393,16 @@ int VRML_MODEL_PARSER::readGeometry( FILE* file, int* LineNum )
            break;
            break;
        }
        }


        if( stricmp( text, "creaseAngle" ) == 0 )
        {
            continue;
        }

        if( *text == '{' )
        {
            continue;
        }

        if( stricmp( text, "normalPerVertex" ) == 0 )
        if( stricmp( text, "normalPerVertex" ) == 0 )
        {
        {
            text = strtok( NULL, " ,\t\n\r" );
            text = strtok( NULL, " ,\t\n\r" );
+12 −11
Original line number Original line Diff line number Diff line
@@ -623,7 +623,6 @@ add_subdirectory( 3d-viewer )
add_subdirectory( cvpcb )
add_subdirectory( cvpcb )
add_subdirectory( eeschema )
add_subdirectory( eeschema )
add_subdirectory( gerbview )
add_subdirectory( gerbview )
add_subdirectory( kicad )
add_subdirectory( lib_dxf )
add_subdirectory( lib_dxf )
add_subdirectory( pcbnew )
add_subdirectory( pcbnew )
add_subdirectory( polygon )
add_subdirectory( polygon )
@@ -631,9 +630,11 @@ add_subdirectory( pagelayout_editor )
add_subdirectory( potrace )
add_subdirectory( potrace )
add_subdirectory( bitmap2component )
add_subdirectory( bitmap2component )
add_subdirectory( pcb_calculator )
add_subdirectory( pcb_calculator )
add_subdirectory( kicad )               # should follow pcbnew, eeschema
add_subdirectory( tools )
add_subdirectory( tools )
add_subdirectory( utils )
add_subdirectory( utils )
add_subdirectory( qa )
add_subdirectory( qa )

#add_subdirectory( new )
#add_subdirectory( new )




Loading