~andrew-plumb/kicad/kicad

« back to all changes in this revision

Viewing changes to pcbnew/specctra.h

  • Committer: jean-pierre charras
  • Date: 2013-10-04 14:32:59 UTC
  • mfrom: (4363.1.3 testing)
  • Revision ID: jp.charras@wanadoo.fr-20131004143259-uwro11qhd63wlhj3
3D board display: better rendering of the board: the board polygon outlines (generated by the specctra function which calclaltes outlines) is now used to create the 3D body of the board,
in pcbnew and cvpcb.

Show diffs side-by-side

added added

removed removed

Lines of Context:
465
465
        point1.FixNegativeZero();
466
466
    }
467
467
 
 
468
    POINT GetOrigin() { return point0; }
 
469
    POINT GetEnd() { return point1; }
 
470
 
468
471
    void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR )
469
472
    {
470
473
        const char* newline = nestLevel ? "\n" : "";
593
596
        points.push_back( aPoint );
594
597
    }
595
598
 
 
599
    POINTS& GetPoints() {return points; }
 
600
 
596
601
    void SetLayerId( const char* aLayerId )
597
602
    {
598
603
        layer_id = aLayerId;
662
667
        delete rectangle;
663
668
    }
664
669
 
 
670
    /**
 
671
     * GetCorners fills aBuffer with a list of coordinates (x,y) of corners
 
672
     */
 
673
    void GetCorners( std::vector<double>& aBuffer )
 
674
    {
 
675
        if( rectangle )
 
676
        {
 
677
            aBuffer.push_back( rectangle->GetOrigin().x );
 
678
            aBuffer.push_back( rectangle->GetOrigin().y );
 
679
 
 
680
            aBuffer.push_back( rectangle->GetOrigin().x );
 
681
            aBuffer.push_back( rectangle->GetEnd().y );
 
682
 
 
683
            aBuffer.push_back( rectangle->GetEnd().x );
 
684
            aBuffer.push_back( rectangle->GetEnd().y );
 
685
 
 
686
            aBuffer.push_back( rectangle->GetEnd().x );
 
687
            aBuffer.push_back( rectangle->GetOrigin().y );
 
688
        }
 
689
        else
 
690
        {
 
691
            for( PATHS::iterator i=paths.begin();  i!=paths.end();  ++i )
 
692
            {
 
693
                POINTS& plist = i->GetPoints();
 
694
                for( unsigned jj = 0; jj < plist.size(); jj++ )
 
695
                {
 
696
                    aBuffer.push_back( plist[jj].x );
 
697
                    aBuffer.push_back( plist[jj].y );
 
698
                }
 
699
            }
 
700
        }
 
701
    }
 
702
 
 
703
 
665
704
    void Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR )
666
705
    {
667
706
        out->Print( nestLevel, "(%s\n", Name() );
3926
3965
     * flips the modules which were on the back side of the board back to the back.
3927
3966
     */
3928
3967
    void RevertMODULEs( BOARD* aBoard );
 
3968
 
 
3969
    /**
 
3970
     * Function GetBoardPolygonOutlines
 
3971
     * Is not used in SPECCTRA export, but uses a lot of functions from it
 
3972
     * and is used to extract a board outlines (3D view, automatic zones build ...)
 
3973
     * makes the board perimeter by filling the BOUNDARY element
 
3974
     * any closed outline inside the main outline is a hole
 
3975
     * All contours should be closed, i.e. have valid vertices to build a closed polygon
 
3976
     * @param aBoard The BOARD to get information from in order to make the outlines.
 
3977
     * @param aOutlines The CPOLYGONS_LIST to fill in with main outlines.
 
3978
     * @param aHoles The empty CPOLYGONS_LIST to fill in with holes, if any.
 
3979
     * @param aErrorText = a wxString reference to display an error message
 
3980
     *          with the coordinate of the point which creates the error
 
3981
     *          (default = NULL , no message returned on error)
 
3982
     * @return true if success, false if a contour is not valid
 
3983
     */
 
3984
    bool GetBoardPolygonOutlines( BOARD* aBoard,
 
3985
                                  CPOLYGONS_LIST& aOutlines,
 
3986
                                  CPOLYGONS_LIST& aHoles,
 
3987
                                  wxString* aErrorText = NULL );
3929
3988
};
3930
3989
 
3931
3990