Added definitions for FIRST_COPPER_LAYER and LAST_COPPER_LAYER
This commit is contained in:
parent
74b4e03234
commit
5746386290
|
@ -20,7 +20,7 @@
|
|||
#include "pcbstruct.h"
|
||||
#include "macros.h"
|
||||
|
||||
//#include "pcbnew.h"
|
||||
// #include "pcbnew.h"
|
||||
|
||||
#include "3d_viewer.h"
|
||||
#include "trackball.h"
|
||||
|
@ -59,7 +59,8 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
|
|||
glRotatef(g_Parm_3D_Visu.m_Rot[1], 0.0, 1.0, 0.0);
|
||||
glRotatef(g_Parm_3D_Visu.m_Rot[2], 0.0, 0.0, 1.0);
|
||||
|
||||
if( m_gllist ) glCallList( m_gllist );
|
||||
if( m_gllist )
|
||||
glCallList( m_gllist );
|
||||
else
|
||||
{
|
||||
m_gllist = CreateDrawGL_List();
|
||||
|
@ -67,15 +68,17 @@ void Pcb3D_GLCanvas::Redraw( bool finish )
|
|||
}
|
||||
|
||||
glFlush();
|
||||
if (finish) glFinish();
|
||||
if( finish )
|
||||
glFinish();
|
||||
SwapBuffers();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************/
|
||||
GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
|
||||
/**********************************************/
|
||||
/* Creation de la liste des elements a afficher
|
||||
*/
|
||||
*/
|
||||
{
|
||||
GLuint gllist = glGenLists( 1 );
|
||||
WinEDA_BasePcbFrame * pcbframe = m_Parent->m_Parent;
|
||||
|
@ -93,20 +96,21 @@ int ii;
|
|||
g_Parm_3D_Visu.m_Layers = pcb->m_BoardSettings->m_CopperLayerCount;
|
||||
g_Parm_3D_Visu.m_BoardScale = 2.0 / MAX(g_Parm_3D_Visu.m_BoardSize.x, g_Parm_3D_Visu.m_BoardSize.y);
|
||||
float epoxy_width = 1.6; // epoxy width in mm
|
||||
g_Parm_3D_Visu.m_Epoxy_Width = epoxy_width/2.54 * 1000
|
||||
g_Parm_3D_Visu.m_Epoxy_Width = epoxy_width / 2.54 * 1000
|
||||
* g_Parm_3D_Visu.m_BoardScale;
|
||||
|
||||
/* calcul de l'altitude de chaque couche */
|
||||
for ( ii = 0; ii < 32; ii++ )
|
||||
for( ii = 0; ii < 32; ii++ )
|
||||
{
|
||||
if ( ii < g_Parm_3D_Visu.m_Layers )
|
||||
if( ii < g_Parm_3D_Visu.m_Layers )
|
||||
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width * ii
|
||||
/ (g_Parm_3D_Visu.m_Layers-1);
|
||||
else g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width;
|
||||
/ (g_Parm_3D_Visu.m_Layers - 1);
|
||||
else
|
||||
g_Parm_3D_Visu.m_LayerZcoord[ii] = g_Parm_3D_Visu.m_Epoxy_Width;
|
||||
}
|
||||
GLfloat zpos_cu = 500 * g_Parm_3D_Visu.m_BoardScale;
|
||||
GLfloat zpos_cmp = g_Parm_3D_Visu.m_Epoxy_Width + zpos_cu;
|
||||
g_Parm_3D_Visu.m_LayerZcoord[ADHESIVE_N_CU] = -zpos_cu*2;
|
||||
g_Parm_3D_Visu.m_LayerZcoord[ADHESIVE_N_CU] = -zpos_cu * 2;
|
||||
g_Parm_3D_Visu.m_LayerZcoord[ADHESIVE_N_CMP] = zpos_cmp + zpos_cu;
|
||||
g_Parm_3D_Visu.m_LayerZcoord[SILKSCREEN_N_CU] = -zpos_cu;
|
||||
g_Parm_3D_Visu.m_LayerZcoord[SILKSCREEN_N_CMP] = zpos_cmp;
|
||||
|
@ -119,43 +123,49 @@ int ii;
|
|||
|
||||
glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
|
||||
|
||||
/* draw axes*/
|
||||
/* draw axes */
|
||||
glEnable(GL_COLOR_MATERIAL);
|
||||
SetGLColor(WHITE);
|
||||
glBegin(GL_LINES);
|
||||
glNormal3f( 0.0, 0.0, 1.0); // Normal is Z axis
|
||||
glVertex3f( 0.0 , 0.0, 0.0); glVertex3f(1.0, 0.0, 0.0); // X axis
|
||||
glVertex3f( 0.0 , 0.0, 0.0); glVertex3f(0.0, -1.0, 0.0); // y axis
|
||||
glNormal3f( 1.0, 0.0, 0.0); // Normal is Y axis
|
||||
glVertex3f( 0.0 , 0.0, 0.0); glVertex3f(0.0, 0.0, 0.3); // z axis
|
||||
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
||||
glVertex3f( 0.0, 0.0, 0.0 );
|
||||
glVertex3f( 1.0, 0.0, 0.0 ); // X axis
|
||||
glVertex3f( 0.0, 0.0, 0.0);
|
||||
glVertex3f( 0.0, -1.0, 0.0); // Y axis
|
||||
glNormal3f( 1.0, 0.0, 0.0); // Normal is Y axis
|
||||
glVertex3f( 0.0 , 0.0, 0.0);
|
||||
glVertex3f( 0.0, 0.0, 0.3 ); // Z axis
|
||||
glEnd();
|
||||
|
||||
/* Draw epoxy limits (do not use, works and test in progress)*/
|
||||
/* Draw epoxy limits (do not use, works and test in progress) */
|
||||
#if 0
|
||||
glEnable(GL_FOG);
|
||||
glEnable(GL_FOG);
|
||||
GLfloat param;
|
||||
// param = GL_LINEAR; glFogfv(GL_FOG_MODE,& param);
|
||||
param = 0.2; glFogfv(GL_FOG_DENSITY,& param);
|
||||
param = g_Parm_3D_Visu.m_LayerZcoord[15]; glFogfv(GL_FOG_END,& param);
|
||||
// param = GL_LINEAR;
|
||||
// glFogfv(GL_FOG_MODE, & param);
|
||||
param = 0.2;
|
||||
glFogfv(GL_FOG_DENSITY, & param);
|
||||
param = g_Parm_3D_Visu.m_LayerZcoord[15];
|
||||
glFogfv(GL_FOG_END, & param);
|
||||
glBegin(GL_QUADS);
|
||||
SetGLColor(g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N]);
|
||||
double sx = DataScale3D * g_Parm_3D_Visu.m_BoardSize.x / 2;
|
||||
double sy = DataScale3D * g_Parm_3D_Visu.m_BoardSize.y / 2;
|
||||
double zpos = g_Parm_3D_Visu.m_LayerZcoord[15];
|
||||
glNormal3f( 0.0, 0.0, 1.0); // Normal is Z axis
|
||||
glNormal3f( 0.0, 0.0, 1.0); // Normal is Z axis
|
||||
sx = sy = 0.5;
|
||||
glVertex3f( -sx, -sy , zpos);
|
||||
glVertex3f( -sx, sy , zpos);
|
||||
glVertex3f( sx, sy , zpos);
|
||||
glVertex3f( sx, -sy , zpos);
|
||||
glVertex3f( -sx, -sy, zpos );
|
||||
glVertex3f( -sx, sy, zpos );
|
||||
glVertex3f( sx, sy, zpos );
|
||||
glVertex3f( sx, -sy, zpos );
|
||||
glEnd();
|
||||
glBegin(GL_QUADS);
|
||||
SetGLColor(g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[COPPER_LAYER_N]);
|
||||
glNormal3f( 0.0, 0.0, -1.0); // Normal is -Z axis
|
||||
glVertex3f( -sx, -sy , 0);
|
||||
glVertex3f( -sx, sy , 0);
|
||||
glVertex3f( sx, sy , 0);
|
||||
glVertex3f( sx, -sy , 0);
|
||||
glNormal3f( 0.0, 0.0, -1.0 ); // Normal is -Z axis
|
||||
glVertex3f( -sx, -sy, 0 );
|
||||
glVertex3f( -sx, sy, 0 );
|
||||
glVertex3f( sx, sy, 0 );
|
||||
glVertex3f( sx, -sy, 0 );
|
||||
glEnd();
|
||||
#endif
|
||||
|
||||
|
@ -164,27 +174,29 @@ glEnable(GL_FOG);
|
|||
-g_Parm_3D_Visu.m_BoardPos.y * g_Parm_3D_Visu.m_BoardScale,
|
||||
0.0F);
|
||||
|
||||
glNormal3f( 0.0, 0.0, 1.0); // Normal is Z axis
|
||||
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
||||
/* Tracé des pistes : */
|
||||
for (pt_piste = pcb->m_Track ; pt_piste != NULL ; pt_piste = (TRACK*) pt_piste->Pnext )
|
||||
{
|
||||
if ( pt_piste->Type() == TYPEVIA )
|
||||
for( pt_piste = pcb->m_Track; pt_piste != NULL; pt_piste = (TRACK*) pt_piste->Pnext )
|
||||
{
|
||||
if( pt_piste->Type() == TYPEVIA )
|
||||
Draw3D_Via((SEGVIA*)pt_piste);
|
||||
else Draw3D_Track( pt_piste);
|
||||
}
|
||||
else
|
||||
Draw3D_Track( pt_piste);
|
||||
}
|
||||
|
||||
/* Tracé des edges */
|
||||
EDA_BaseStruct * PtStruct;
|
||||
for ( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Pnext)
|
||||
for( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Pnext )
|
||||
{
|
||||
#define STRUCT ((DRAWSEGMENT *) PtStruct)
|
||||
if( PtStruct->Type() != TYPEDRAWSEGMENT ) continue;
|
||||
if( PtStruct->Type() != TYPEDRAWSEGMENT )
|
||||
continue;
|
||||
Draw3D_DrawSegment(STRUCT);
|
||||
}
|
||||
|
||||
/* tracé des modules */
|
||||
MODULE * Module = (MODULE*) pcb->m_Modules;
|
||||
for ( ; Module != NULL; Module = (MODULE *) Module->Pnext )
|
||||
for( ; Module != NULL; Module = (MODULE *) Module->Pnext )
|
||||
{
|
||||
Module->Draw3D(this);
|
||||
}
|
||||
|
@ -192,11 +204,12 @@ MODULE * Module = (MODULE*) pcb->m_Modules;
|
|||
|
||||
/* Test for errors */
|
||||
GLenum err = glGetError();
|
||||
if ( err != GL_NO_ERROR )
|
||||
if( err != GL_NO_ERROR )
|
||||
DisplayError(this, wxT("Error in GL commands") );
|
||||
return gllist;
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
void Pcb3D_GLCanvas::Draw3D_Track(TRACK * track)
|
||||
/************************************************/
|
||||
|
@ -207,13 +220,14 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
|||
double ox, oy, fx, fy;
|
||||
double w;
|
||||
|
||||
if ( color & ITEM_NOT_SHOW ) return;
|
||||
if ( layer == CMP_N )
|
||||
layer = g_Parm_3D_Visu.m_Layers -1;
|
||||
if( color & ITEM_NOT_SHOW )
|
||||
return;
|
||||
if( layer == LAST_COPPER_LAYER )
|
||||
layer = g_Parm_3D_Visu.m_Layers - 1;
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
|
||||
SetGLColor(color);
|
||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0);
|
||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
|
||||
|
||||
w = track->m_Width * g_Parm_3D_Visu.m_BoardScale;
|
||||
ox = track->m_Start.x * g_Parm_3D_Visu.m_BoardScale;
|
||||
|
@ -223,11 +237,12 @@ double w;
|
|||
Draw3D_FilledSegment(ox, -oy, fx, -fy, w, zpos);
|
||||
}
|
||||
|
||||
|
||||
/********************************************/
|
||||
void Pcb3D_GLCanvas::Draw3D_Via(SEGVIA * via)
|
||||
/*********************************************/
|
||||
/* 3D drawing for a VIA (cylinder + filled circles)
|
||||
*/
|
||||
*/
|
||||
{
|
||||
double x, y, r, hole;
|
||||
int layer, top_layer, bottom_layer;
|
||||
|
@ -236,24 +251,26 @@ int color;
|
|||
|
||||
r = via->m_Width * g_Parm_3D_Visu.m_BoardScale / 2;
|
||||
hole = g_Parm_3D_Visu.m_BoardSettings->m_ViaDrill * g_Parm_3D_Visu.m_BoardScale / 2;
|
||||
x = via->m_Start.x * g_Parm_3D_Visu.m_BoardScale;
|
||||
x = via->m_Start.x * g_Parm_3D_Visu.m_BoardScale;
|
||||
y = via->m_Start.y * g_Parm_3D_Visu.m_BoardScale;
|
||||
|
||||
via->ReturnLayerPair(&top_layer, &bottom_layer);
|
||||
|
||||
// Drawing filled circles:
|
||||
for ( layer = bottom_layer; layer < g_Parm_3D_Visu.m_Layers; layer++ )
|
||||
for( layer = bottom_layer; layer < g_Parm_3D_Visu.m_Layers; layer++ )
|
||||
{
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
if ( layer < g_Parm_3D_Visu.m_Layers-1 )
|
||||
if( layer < g_Parm_3D_Visu.m_Layers - 1 )
|
||||
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
||||
else color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N];
|
||||
if ( color & ITEM_NOT_SHOW ) continue;
|
||||
else
|
||||
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[CMP_N];
|
||||
if( color & ITEM_NOT_SHOW )
|
||||
continue;
|
||||
SetGLColor(color);
|
||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0);
|
||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
|
||||
Draw3D_FilledCircle(x, -y, r, hole, zpos);
|
||||
if ( layer >= top_layer) break;
|
||||
|
||||
if( layer >= top_layer)
|
||||
break;
|
||||
}
|
||||
// Drawing hole:
|
||||
SetGLColor(DARKGRAY);
|
||||
|
@ -271,34 +288,34 @@ double x, y, xf, yf;
|
|||
double zpos, w;
|
||||
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[segment->GetLayer()];
|
||||
|
||||
if ( color & ITEM_NOT_SHOW ) return;
|
||||
if( color & ITEM_NOT_SHOW )
|
||||
return;
|
||||
|
||||
SetGLColor(color);
|
||||
w = segment->m_Width * g_Parm_3D_Visu.m_BoardScale;
|
||||
x = segment->m_Start.x * g_Parm_3D_Visu.m_BoardScale;
|
||||
y = segment->m_Start.y * g_Parm_3D_Visu.m_BoardScale;
|
||||
xf = segment->m_End.x * g_Parm_3D_Visu.m_BoardScale;
|
||||
yf = segment->m_End.y * g_Parm_3D_Visu.m_BoardScale;
|
||||
yf = segment->m_End.y * g_Parm_3D_Visu.m_BoardScale;
|
||||
|
||||
if ( segment->GetLayer() == EDGE_N)
|
||||
if( segment->GetLayer() == EDGE_N )
|
||||
{
|
||||
for ( layer = 0; layer < g_Parm_3D_Visu.m_Layers; layer++ )
|
||||
for( layer = 0; layer < g_Parm_3D_Visu.m_Layers; layer++ )
|
||||
{
|
||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0);
|
||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
Draw3D_FilledSegment( x, -y, xf, -yf, w, zpos);
|
||||
Draw3D_FilledSegment( x, -y, xf, -yf, w, zpos );
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[segment->GetLayer()];
|
||||
Draw3D_FilledSegment( x, -y, xf, -yf, w, zpos);
|
||||
Draw3D_FilledSegment( x, -y, xf, -yf, w, zpos );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*********************************************/
|
||||
void MODULE::Draw3D(Pcb3D_GLCanvas * glcanvas)
|
||||
/*********************************************/
|
||||
|
@ -308,43 +325,45 @@ D_PAD * pad = m_Pads;
|
|||
#if 0
|
||||
if( ! DisplayOpt.Show_Modules_Cmp )
|
||||
{
|
||||
if(m_Layer == CMP_N) return;
|
||||
if( m_Layer == CMP_N )
|
||||
return;
|
||||
}
|
||||
if( ! DisplayOpt.Show_Modules_Cu )
|
||||
{
|
||||
if(m_Layer == COPPER_LAYER_N) return;
|
||||
if( m_Layer == COPPER_LAYER_N )
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Draw pads */
|
||||
glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE);
|
||||
glNormal3f( 0.0, 0.0, 1.0); // Normal is Z axis
|
||||
glColorMaterial(GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE);
|
||||
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
||||
for( ; pad != NULL; pad = (D_PAD*) pad->Pnext )
|
||||
{
|
||||
pad->Draw3D(glcanvas);
|
||||
}
|
||||
|
||||
/* Draw module shape: 3D shape if exists (or module edge if not exists)*/
|
||||
/* Draw module shape: 3D shape if exists (or module edge if not exists) */
|
||||
Struct3D_Master * Struct3D = m_3D_Drawings;
|
||||
bool As3dShape = FALSE;
|
||||
glPushMatrix();
|
||||
glTranslatef(m_Pos.x * g_Parm_3D_Visu.m_BoardScale,
|
||||
glTranslatef( m_Pos.x * g_Parm_3D_Visu.m_BoardScale,
|
||||
-m_Pos.y * g_Parm_3D_Visu.m_BoardScale,
|
||||
g_Parm_3D_Visu.m_LayerZcoord[m_Layer] );
|
||||
if ( m_Orient )
|
||||
if( m_Orient )
|
||||
{
|
||||
glRotatef( (double)m_Orient / 10, 0.0, 0.0, 1.0 );
|
||||
}
|
||||
if ( m_Layer == COPPER_LAYER_N )
|
||||
if( m_Layer == COPPER_LAYER_N )
|
||||
{
|
||||
glRotatef( 180.0, 0.0, 1.0, 0.0 );
|
||||
glRotatef( 180.0, 0.0, 0.0, 1.0 );
|
||||
}
|
||||
DataScale3D = g_Parm_3D_Visu.m_BoardScale*UNITS3D_TO_UNITSPCB;
|
||||
DataScale3D = g_Parm_3D_Visu.m_BoardScale * UNITS3D_TO_UNITSPCB;
|
||||
|
||||
for ( ; Struct3D != NULL; Struct3D = (Struct3D_Master *) Struct3D->Pnext )
|
||||
for( ; Struct3D != NULL; Struct3D = (Struct3D_Master *) Struct3D->Pnext )
|
||||
{
|
||||
if ( ! Struct3D->m_Shape3DName.IsEmpty() )
|
||||
if( ! Struct3D->m_Shape3DName.IsEmpty() )
|
||||
{
|
||||
As3dShape = TRUE;
|
||||
Struct3D->ReadData();
|
||||
|
@ -352,39 +371,42 @@ bool As3dShape = FALSE;
|
|||
}
|
||||
glPopMatrix();
|
||||
|
||||
if ( ! As3dShape)
|
||||
if( ! As3dShape )
|
||||
{
|
||||
EDA_BaseStruct * Struct = m_Drawings;
|
||||
glNormal3f( 0.0, 0.0, 1.0); // Normal is Z axis
|
||||
for( ;Struct != NULL; Struct = Struct->Pnext )
|
||||
EDA_BaseStruct * Struct = m_Drawings;
|
||||
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
||||
for( ; Struct != NULL; Struct = Struct->Pnext )
|
||||
{
|
||||
switch( Struct->Type() )
|
||||
{
|
||||
case TYPETEXTEMODULE:
|
||||
break;
|
||||
case TYPETEXTEMODULE:
|
||||
break;
|
||||
|
||||
case TYPEEDGEMODULE:
|
||||
((EDGE_MODULE *) Struct)->Draw3D(glcanvas);
|
||||
break;
|
||||
case TYPEEDGEMODULE:
|
||||
((EDGE_MODULE *) Struct)->Draw3D(glcanvas);
|
||||
break;
|
||||
|
||||
default: break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/***************************************************/
|
||||
void EDGE_MODULE::Draw3D(Pcb3D_GLCanvas * glcanvas)
|
||||
/***************************************************/
|
||||
{
|
||||
int ux0, uy0, dx, dy,rayon, StAngle, EndAngle;
|
||||
double scale, x, y, fx, fy, w, zpos ;
|
||||
int ux0, uy0, dx, dy, rayon, StAngle, EndAngle;
|
||||
double scale, x, y, fx, fy, w, zpos;
|
||||
int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
|
||||
|
||||
if ( color & ITEM_NOT_SHOW ) return;
|
||||
if( color & ITEM_NOT_SHOW )
|
||||
return;
|
||||
|
||||
SetGLColor(color);
|
||||
glNormal3f( 0.0, 0.0, (m_Layer == COPPER_LAYER_N) ? -1.0 : 1.0);
|
||||
glNormal3f( 0.0, 0.0, (m_Layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
|
||||
scale = g_Parm_3D_Visu.m_BoardScale;
|
||||
|
||||
ux0 = m_Start.x;
|
||||
|
@ -393,28 +415,28 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
|
|||
dy = m_End.y;
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[m_Layer];
|
||||
w = m_Width * g_Parm_3D_Visu.m_BoardScale;
|
||||
switch (m_Shape )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
x = m_Start.x * g_Parm_3D_Visu.m_BoardScale;
|
||||
y = m_Start.y * g_Parm_3D_Visu.m_BoardScale;
|
||||
fx = dx * g_Parm_3D_Visu.m_BoardScale;
|
||||
fy = dy * g_Parm_3D_Visu.m_BoardScale;
|
||||
Draw3D_FilledSegment(x, -y, fx, -fy, w, zpos);
|
||||
break ;
|
||||
switch( m_Shape )
|
||||
{
|
||||
case S_SEGMENT:
|
||||
x = m_Start.x * g_Parm_3D_Visu.m_BoardScale;
|
||||
y = m_Start.y * g_Parm_3D_Visu.m_BoardScale;
|
||||
fx = dx * g_Parm_3D_Visu.m_BoardScale;
|
||||
fy = dy * g_Parm_3D_Visu.m_BoardScale;
|
||||
Draw3D_FilledSegment(x, -y, fx, -fy, w, zpos);
|
||||
break ;
|
||||
|
||||
case S_CIRCLE:
|
||||
rayon = (int)hypot((double)(dx-ux0),(double)(dy-uy0) );
|
||||
/* TO DO */
|
||||
break;
|
||||
case S_CIRCLE:
|
||||
rayon = (int)hypot( (double)(dx - ux0), (double)(dy - uy0) );
|
||||
/* TO DO */
|
||||
break;
|
||||
|
||||
case S_ARC:
|
||||
rayon = (int)hypot((double)(dx-ux0),(double)(dy-uy0) );
|
||||
StAngle = (int)ArcTangente( dy-uy0, dx-ux0 );
|
||||
EndAngle = StAngle + m_Angle;
|
||||
/* TO DO */
|
||||
break;
|
||||
}
|
||||
case S_ARC:
|
||||
rayon = (int)hypot( (double)(dx - ux0), (double)(dy - uy0) );
|
||||
StAngle = (int)ArcTangente( dy - uy0, dx - ux0 );
|
||||
EndAngle = StAngle + m_Angle;
|
||||
/* TO DO */
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -422,11 +444,11 @@ int color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[m_Layer];
|
|||
void D_PAD::Draw3D(Pcb3D_GLCanvas * glcanvas)
|
||||
/***********************************************/
|
||||
/* Dessin 3D des pads avec leur trou de percage
|
||||
*/
|
||||
*/
|
||||
{
|
||||
int ii, ll, layer, nlmax;
|
||||
int ux0,uy0,
|
||||
dx,dx0,dy,dy0,
|
||||
int ux0, uy0,
|
||||
dx, dx0, dy, dy0,
|
||||
delta_cx, delta_cy,
|
||||
xc, yc;
|
||||
int angle, delta_angle;
|
||||
|
@ -443,7 +465,7 @@ int color;
|
|||
scale = g_Parm_3D_Visu.m_BoardScale;
|
||||
holeX = (double)m_Drill.x * scale / 2;
|
||||
holeY = (double)m_Drill.y * scale / 2;
|
||||
hole = MIN (holeX,holeY);
|
||||
hole = MIN(holeX, holeY);
|
||||
|
||||
/* calcul du centre des formes des pads : */
|
||||
shape_pos = ReturnShapePos();
|
||||
|
@ -453,86 +475,98 @@ int color;
|
|||
yc = uy0;
|
||||
|
||||
/* le trace depend de la rotation de l'empreinte */
|
||||
dx = dx0 = m_Size.x >> 1 ;
|
||||
dy = dy0 = m_Size.y >> 1 ; /* demi dim dx et dy */
|
||||
dx = dx0 = m_Size.x >> 1;
|
||||
dy = dy0 = m_Size.y >> 1; /* demi dim dx et dy */
|
||||
|
||||
angle = m_Orient;
|
||||
drillx = m_Pos.x * scale;
|
||||
drillx = m_Pos.x * scale;
|
||||
drilly = m_Pos.y * scale;
|
||||
/* Draw the pad hole (TODO: draw OBLONG hole)*/
|
||||
if ( holeX && holeY )
|
||||
/* Draw the pad hole (TODO: draw OBLONG hole) */
|
||||
if( holeX && holeY )
|
||||
{
|
||||
SetGLColor(DARKGRAY);
|
||||
Draw3D_FilledCylinder(drillx, -drilly, hole, g_Parm_3D_Visu.m_LayerZcoord[CMP_N], 0.0);
|
||||
}
|
||||
|
||||
glNormal3f( 0.0, 0.0, 1.0); // Normal is Z axis
|
||||
nlmax = g_Parm_3D_Visu.m_Layers-1;
|
||||
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
|
||||
nlmax = g_Parm_3D_Visu.m_Layers - 1;
|
||||
Oncu = (m_Masque_Layer & CUIVRE_LAYER) ? TRUE : FALSE;
|
||||
Oncmp = (m_Masque_Layer & CMP_LAYER) ? TRUE : FALSE;
|
||||
Both = Oncu && Oncmp;
|
||||
switch (m_PadShape & 0x7F)
|
||||
switch( m_PadShape & 0x7F )
|
||||
{
|
||||
case CIRCLE :
|
||||
x = xc * scale;
|
||||
y = yc * scale;
|
||||
r = (double)dx * scale;
|
||||
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
|
||||
{
|
||||
case CIRCLE :
|
||||
x = xc * scale;
|
||||
y = yc * scale;
|
||||
r = (double)dx * scale;
|
||||
for ( layer = COPPER_LAYER_N; layer <= CMP_N; layer ++)
|
||||
{
|
||||
if (layer && (layer == nlmax) ) layer = CMP_N;
|
||||
if ( (layer == CMP_N) && ! Oncmp ) continue;
|
||||
if ( (layer == COPPER_LAYER_N) && ! Oncu ) continue;
|
||||
if ( (layer > COPPER_LAYER_N) && (layer < CMP_N) && !Both) continue;
|
||||
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
||||
if ( color & ITEM_NOT_SHOW ) continue;
|
||||
SetGLColor(color);
|
||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0);
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
Draw3D_FilledCircle(x, -y, r, hole, zpos);
|
||||
}
|
||||
break;
|
||||
if( layer && (layer == nlmax) )
|
||||
layer = CMP_N;
|
||||
if( (layer == CMP_N) && ! Oncmp )
|
||||
continue;
|
||||
if( (layer == COPPER_LAYER_N) && ! Oncu )
|
||||
continue;
|
||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both)
|
||||
continue;
|
||||
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
||||
if( color & ITEM_NOT_SHOW )
|
||||
continue;
|
||||
SetGLColor(color);
|
||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
Draw3D_FilledCircle(x, -y, r, hole, zpos);
|
||||
}
|
||||
break;
|
||||
|
||||
case OVALE :
|
||||
/* calcul de l'entraxe de l'ellipse */
|
||||
if( dx > dy ) /* ellipse horizontale */
|
||||
{
|
||||
delta_cx = dx - dy; delta_cy = 0;
|
||||
w = m_Size.y * scale;
|
||||
delta_angle = angle+900;
|
||||
}
|
||||
else /* ellipse verticale */
|
||||
{
|
||||
delta_cx = 0; delta_cy = dy - dx;
|
||||
w = m_Size.x * scale;
|
||||
delta_angle = angle;
|
||||
}
|
||||
RotatePoint(&delta_cx, &delta_cy, angle);
|
||||
{
|
||||
case OVALE :
|
||||
/* calcul de l'entraxe de l'ellipse */
|
||||
if( dx > dy ) /* ellipse horizontale */
|
||||
{
|
||||
delta_cx = dx - dy;
|
||||
delta_cy = 0;
|
||||
w = m_Size.y * scale;
|
||||
delta_angle = angle + 900;
|
||||
}
|
||||
else /* ellipse verticale */
|
||||
{
|
||||
delta_cx = 0;
|
||||
delta_cy = dy - dx;
|
||||
w = m_Size.x * scale;
|
||||
delta_angle = angle;
|
||||
}
|
||||
RotatePoint(&delta_cx, &delta_cy, angle);
|
||||
{
|
||||
double ox, oy, fx, fy;
|
||||
ox = (double)(ux0 + delta_cx) * scale;
|
||||
oy = (double)(uy0 + delta_cy) * scale;
|
||||
fx = (double)(ux0 - delta_cx) * scale;
|
||||
fy = (double)(uy0 - delta_cy) * scale;
|
||||
for ( layer = COPPER_LAYER_N; layer <= CMP_N; layer ++)
|
||||
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer ++ )
|
||||
{
|
||||
if (layer && (layer == nlmax) ) layer = CMP_N;
|
||||
if ( (layer == CMP_N) && ! Oncmp ) continue;
|
||||
if ( (layer == COPPER_LAYER_N) && ! Oncu ) continue;
|
||||
if ( (layer > COPPER_LAYER_N) && (layer < CMP_N) && !Both) continue;
|
||||
if( layer && (layer == nlmax) )
|
||||
layer = CMP_N;
|
||||
if( (layer == CMP_N) && ! Oncmp )
|
||||
continue;
|
||||
if( (layer == COPPER_LAYER_N) && ! Oncu )
|
||||
continue;
|
||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
|
||||
continue;
|
||||
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0);
|
||||
if ( color & ITEM_NOT_SHOW ) continue;
|
||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
|
||||
if( color & ITEM_NOT_SHOW )
|
||||
continue;
|
||||
SetGLColor(color);
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
Draw3D_FilledSegmentWithHole(ox, -oy, fx, -fy, w, drillx, -drilly, hole, zpos);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case RECT :
|
||||
// case SPECIAL_PAD:
|
||||
case TRAPEZE:
|
||||
{
|
||||
case RECT :
|
||||
// case SPECIAL_PAD:
|
||||
case TRAPEZE:
|
||||
{
|
||||
int ddx, ddy ;
|
||||
ddx = m_DeltaSize.x >> 1 ;
|
||||
ddy = m_DeltaSize.y >> 1 ; /* demi dim dx et dy */
|
||||
|
@ -549,74 +583,84 @@ int color;
|
|||
coord[3][0] = + dx + ddy;
|
||||
coord[3][1] = + dy - ddx;
|
||||
|
||||
for (ii = 0; ii < 4; ii++)
|
||||
{
|
||||
RotatePoint(&coord[ii][0],&coord[ii][1], angle);
|
||||
for( ii = 0; ii < 4; ii++ )
|
||||
{
|
||||
RotatePoint(&coord[ii][0], &coord[ii][1], angle);
|
||||
coord[ii][0] += ux0;
|
||||
coord[ii][1] += uy0;
|
||||
ll = ii*2;
|
||||
ll = ii * 2;
|
||||
fcoord[ll][0] = coord[ii][0] * scale;
|
||||
fcoord[ll][1] = coord[ii][1] * scale;
|
||||
}
|
||||
for (ii = 0; ii < 7; ii+=2)
|
||||
{
|
||||
ll = ii+2; if (ll > 7) ll -= 8;
|
||||
fcoord[ii+1][0] = (fcoord[ii][0] + fcoord[ll][0])/2;
|
||||
fcoord[ii+1][1] = (fcoord[ii][1] + fcoord[ll][1])/2;
|
||||
}
|
||||
for (ii = 0; ii < 8; ii++)
|
||||
{
|
||||
f_hole_coord[ii][0] = -hole*0.707;
|
||||
f_hole_coord[ii][1] = hole*0.707;
|
||||
}
|
||||
|
||||
for( ii = 0; ii < 7; ii += 2 )
|
||||
{
|
||||
ll = ii + 2;
|
||||
if( ll > 7 )
|
||||
ll -= 8;
|
||||
fcoord[ii + 1][0] = (fcoord[ii][0] + fcoord[ll][0]) / 2;
|
||||
fcoord[ii + 1][1] = (fcoord[ii][1] + fcoord[ll][1]) / 2;
|
||||
}
|
||||
|
||||
for( ii = 0; ii < 8; ii++ )
|
||||
{
|
||||
f_hole_coord[ii][0] = -hole * 0.707;
|
||||
f_hole_coord[ii][1] = hole * 0.707;
|
||||
RotatePoint(&f_hole_coord[ii][0], &f_hole_coord[ii][1],
|
||||
angle -(ii * 450) );
|
||||
angle - (ii * 450));
|
||||
f_hole_coord[ii][0] += drillx;
|
||||
f_hole_coord[ii][1] += drilly;
|
||||
}
|
||||
}
|
||||
|
||||
for ( layer = COPPER_LAYER_N; layer <= CMP_N; layer ++)
|
||||
for( layer = FIRST_COPPER_LAYER; layer <= LAST_COPPER_LAYER; layer++ )
|
||||
{
|
||||
if (layer && (layer == nlmax) ) layer = CMP_N;
|
||||
if ( (layer == CMP_N) && ! Oncmp ) continue;
|
||||
if ( (layer == COPPER_LAYER_N) && ! Oncu ) continue;
|
||||
if ( (layer > COPPER_LAYER_N) && (layer < CMP_N) && !Both) continue;
|
||||
if( layer && (layer == nlmax) )
|
||||
layer = CMP_N;
|
||||
if( (layer == CMP_N) && ! Oncmp )
|
||||
continue;
|
||||
if( (layer == COPPER_LAYER_N) && ! Oncu )
|
||||
continue;
|
||||
if( (layer > FIRST_COPPER_LAYER) && (layer < LAST_COPPER_LAYER) && !Both )
|
||||
continue;
|
||||
color = g_Parm_3D_Visu.m_BoardSettings->m_LayerColor[layer];
|
||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0);
|
||||
if ( color & ITEM_NOT_SHOW ) continue;
|
||||
glNormal3f( 0.0, 0.0, (layer == COPPER_LAYER_N) ? -1.0 : 1.0 );
|
||||
if( color & ITEM_NOT_SHOW )
|
||||
continue;
|
||||
SetGLColor(color);
|
||||
zpos = g_Parm_3D_Visu.m_LayerZcoord[layer];
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for ( ii = 0; ii < 8; ii++ )
|
||||
for( ii = 0; ii < 8; ii++ )
|
||||
{
|
||||
glVertex3f( f_hole_coord[ii][0], -f_hole_coord[ii][1] , zpos);
|
||||
glVertex3f( fcoord[ii][0], -fcoord[ii][1] , zpos);
|
||||
glVertex3f( f_hole_coord[ii][0], -f_hole_coord[ii][1], zpos );
|
||||
glVertex3f( fcoord[ii][0], -fcoord[ii][1], zpos );
|
||||
}
|
||||
glVertex3f( f_hole_coord[0][0], -f_hole_coord[0][1] , zpos);
|
||||
glVertex3f( fcoord[0][0], -fcoord[0][1] , zpos);
|
||||
glVertex3f( f_hole_coord[0][0], -f_hole_coord[0][1], zpos );
|
||||
glVertex3f( fcoord[0][0], -fcoord[0][1], zpos );
|
||||
glEnd();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*************************/
|
||||
void SetGLColor(int color)
|
||||
/*************************/
|
||||
{
|
||||
double red, green,blue;
|
||||
StructColors colordata = ColorRefs[color & MASKCOLOR];
|
||||
double red, green, blue;
|
||||
StructColors colordata = ColorRefs[color & MASKCOLOR];
|
||||
|
||||
red = colordata.m_Red / 255.0;
|
||||
blue = colordata.m_Blue / 255.0;
|
||||
green = colordata.m_Green / 255.0;
|
||||
glColor3f(red, green,blue);
|
||||
blue = colordata.m_Blue / 255.0;
|
||||
green = colordata.m_Green / 255.0;
|
||||
glColor3f(red, green, blue);
|
||||
}
|
||||
|
||||
|
||||
/********************************************************/
|
||||
static void Draw3D_FilledCircle(double posx, double posy,
|
||||
double rayon, double hole, double zpos)
|
||||
|
@ -626,18 +670,21 @@ int ii, slice = 16;
|
|||
double x, y;
|
||||
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
for ( ii = 0; ii <= slice; ii++ )
|
||||
for( ii = 0; ii <= slice; ii++ )
|
||||
{
|
||||
x = hole; y = 0.0;
|
||||
x = hole;
|
||||
y = 0.0;
|
||||
RotatePoint(&x, &y, ii * 225);
|
||||
glVertex3f( x + posx, y + posy, zpos);
|
||||
x = rayon; y = 0.0;
|
||||
glVertex3f( x + posx, y + posy, zpos );
|
||||
x = rayon;
|
||||
y = 0.0;
|
||||
RotatePoint(&x, &y, ii * 225);
|
||||
glVertex3f( x + posx, y + posy, zpos);
|
||||
glVertex3f( x + posx, y + posy, zpos );
|
||||
}
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************/
|
||||
static void Draw3D_FilledCylinder(double posx, double posy,
|
||||
double rayon, double height, double zpos)
|
||||
|
@ -649,43 +696,46 @@ double x, y;
|
|||
S3D_Vertex coords[4];
|
||||
double tmp = DataScale3D;
|
||||
|
||||
DataScale3D = 1.0; //les coord sont deja a l'echelle pour Set_Object_Data();
|
||||
DataScale3D = 1.0; // les coord sont deja a l'echelle pour Set_Object_Data();
|
||||
coords[0].x = coords[1].x = posx + rayon;
|
||||
coords[0].y = coords[1].y = posy;
|
||||
coords[0].z = coords[3].z = zpos;
|
||||
coords[1].z = coords[2].z = zpos + height;
|
||||
|
||||
for ( ii = 0; ii <= NB_SEGM; ii++ )
|
||||
for( ii = 0; ii <= NB_SEGM; ii++ )
|
||||
{
|
||||
x = rayon; y = 0.0;
|
||||
RotatePoint(&x, &y, ii * (3600/NB_SEGM));
|
||||
x = rayon;
|
||||
y = 0.0;
|
||||
RotatePoint(&x, &y, ii * (3600 / NB_SEGM));
|
||||
coords[2].x = coords[3].x = posx + x;
|
||||
coords[2].y = coords[3].y = posy + y;
|
||||
Set_Object_Data(coords, 4 );
|
||||
Set_Object_Data( coords, 4 );
|
||||
coords[0].x = coords[2].x;
|
||||
coords[0].y = coords[2].y;
|
||||
coords[1].x = coords[3].x;
|
||||
coords[1].y = coords[3].y;
|
||||
}
|
||||
glNormal3f( 0.0, 0.0, 1.0); // Normal is Z axis
|
||||
glNormal3f( 0.0, 0.0, 1.0); // Normal is Z axis
|
||||
DataScale3D = tmp;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
static void Draw3D_FilledSegment(double startx, double starty,
|
||||
double endx, double endy,double width, double zpos)
|
||||
/*****************************************************************/
|
||||
/* trace un polygone semblable a un segment a bouts ronds
|
||||
*/
|
||||
*/
|
||||
{
|
||||
double dx, dy, x, y, firstx=0, firsty=0;
|
||||
int ii, angle;
|
||||
|
||||
/* on va calculer les coordonnées du segment supposé horizontal,
|
||||
puis tourner les cordonnes de l'angle voulu */
|
||||
// on va calculer les coordonnées du segment supposé horizontal,
|
||||
// puis tourner les cordonnes de l'angle voulu
|
||||
|
||||
dx = endx - startx; dy = endy - starty;
|
||||
angle = (int)(( atan2( dy, dx ) / M_PI * 1800)+0.5) ;
|
||||
dx = endx - startx;
|
||||
dy = endy - starty;
|
||||
angle = (int)( ( atan2(dy, dx) * 1800 / M_PI ) + 0.5 );
|
||||
|
||||
RotatePoint(&dx, &dy, angle); // apres rotation: dx = longueur du segment
|
||||
// dy = 0;
|
||||
|
@ -693,64 +743,71 @@ int ii, angle;
|
|||
|
||||
glBegin(GL_POLYGON);
|
||||
// tracé de l'arrondi a droite (1er demi polygone a la fin du segment)
|
||||
for ( ii = 0; ii <= 8; ii++ )
|
||||
for( ii = 0; ii <= 8; ii++ )
|
||||
{
|
||||
x = 0.0; y =-width;
|
||||
x = 0.0;
|
||||
y = -width;
|
||||
RotatePoint(&x, &y, -ii * 225);
|
||||
x += dx;
|
||||
RotatePoint(&x, &y, -angle);
|
||||
glVertex3f( startx + x, starty+y, zpos);
|
||||
if ( ii == 0 )
|
||||
glVertex3f( startx + x, starty+y, zpos );
|
||||
if( ii == 0 )
|
||||
{
|
||||
firstx = startx + x;
|
||||
firsty = starty + y;
|
||||
}
|
||||
}
|
||||
// tracé de l'arrondi a gauche (2ieme demi polygone a l'origine du segment)
|
||||
for ( ii = 0; ii <= 8; ii++ )
|
||||
for( ii = 0; ii <= 8; ii++ )
|
||||
{
|
||||
int jj = ii * 225;
|
||||
x = 0.0; y = width;
|
||||
RotatePoint(&x, &y, -angle -jj);
|
||||
glVertex3f( startx + x, starty+y, zpos);
|
||||
x = 0.0;
|
||||
y = width;
|
||||
RotatePoint(&x, &y, -angle - jj);
|
||||
glVertex3f( startx + x, starty+y, zpos );
|
||||
}
|
||||
|
||||
glVertex3f( firstx, firsty, zpos);
|
||||
glVertex3f( firstx, firsty, zpos );
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
static void Draw3D_FilledSegmentWithHole(double startx, double starty,
|
||||
double endx, double endy,double width,
|
||||
double endx, double endy, double width,
|
||||
double holex, double holey, double holeradius, double zpos)
|
||||
/*****************************************************************/
|
||||
/* trace un polygone semblable a un segment a bouts ronds avec trou
|
||||
*/
|
||||
*/
|
||||
{
|
||||
double x, y, xin, yin;
|
||||
double firstx=0, firsty=0, firstxin=0, firstyin=0;
|
||||
double firstx = 0, firsty = 0, firstxin = 0, firstyin = 0;
|
||||
int ii, angle, theta;
|
||||
|
||||
/* on va calculer les coordonnées du segment supposé horizontal,
|
||||
puis tourner les cordonnes de l'angle voulu
|
||||
Tous des calculs se font avec startx, starty comme origine du tracé */
|
||||
// on va calculer les coordonnées du segment supposé horizontal,
|
||||
// puis tourner les cordonnes de l'angle voulu
|
||||
// Tous des calculs se font avec startx, starty comme origine du tracé
|
||||
|
||||
endx -= startx; endy -= starty;
|
||||
holex -= startx; holey -= starty;
|
||||
angle = (int)(( atan2( endy, endx ) / M_PI * 1800)+0.5) ;
|
||||
endx -= startx;
|
||||
endy -= starty;
|
||||
holex -= startx;
|
||||
holey -= starty;
|
||||
angle = (int)( ( atan2(endy, endx) * 1800 / M_PI ) + 0.5 );
|
||||
|
||||
RotatePoint(&endx, &endy, angle); // apres rotation: endx = longueur du segment
|
||||
// endy = 0;
|
||||
RotatePoint(&endx, &endy, angle); // apres rotation: endx = longueur du segment
|
||||
// endy = 0;
|
||||
RotatePoint(&holex, &holey, angle);
|
||||
width /= 2;
|
||||
|
||||
glBegin(GL_QUAD_STRIP);
|
||||
// tracé de l'arrondi a droite (1er demi polygone a la fin du segment)
|
||||
// autour du demi-trou de percage
|
||||
for ( ii = 0; ii <= 8; ii++ )
|
||||
for( ii = 0; ii <= 8; ii++ )
|
||||
{
|
||||
x = 0.0; y = -width;
|
||||
xin = 0.0; yin = - holeradius;
|
||||
x = 0.0;
|
||||
y = -width;
|
||||
xin = 0.0;
|
||||
yin = -holeradius;
|
||||
theta = -ii * 225;
|
||||
RotatePoint(&x, &y, theta);
|
||||
RotatePoint(&xin, &yin, theta);
|
||||
|
@ -758,9 +815,9 @@ int ii, angle, theta;
|
|||
RotatePoint(&x, &y, -angle);
|
||||
xin += holex;
|
||||
RotatePoint(&xin, &yin, -angle);
|
||||
glVertex3f( startx + xin, starty+yin, zpos);
|
||||
glVertex3f( startx + x, starty+y, zpos);
|
||||
if ( ii == 0 ) // Memorisation du point de départ du tracé
|
||||
glVertex3f( startx + xin, starty+yin, zpos );
|
||||
glVertex3f( startx + x, starty+y, zpos );
|
||||
if( ii == 0 ) // Memorisation du point de départ du tracé
|
||||
{
|
||||
firstx = startx + x;
|
||||
firsty = starty + y;
|
||||
|
@ -769,21 +826,22 @@ int ii, angle, theta;
|
|||
}
|
||||
}
|
||||
// tracé de l'arrondi a gauche (2ieme demi polygone a l'origine du segment)
|
||||
for ( ii = 0; ii <= 8; ii++ )
|
||||
for( ii = 0; ii <= 8; ii++ )
|
||||
{
|
||||
theta = - ii * 225;
|
||||
x = 0.0; y = width;
|
||||
theta = -ii * 225;
|
||||
x = 0.0;
|
||||
y = width;
|
||||
RotatePoint(&x, &y, -angle + theta);
|
||||
xin = 0.0; yin = holeradius;
|
||||
xin = 0.0;
|
||||
yin = holeradius;
|
||||
RotatePoint(&xin, &yin, theta);
|
||||
xin += holex;
|
||||
RotatePoint(&xin, &yin, -angle);
|
||||
glVertex3f( startx + xin,starty + yin, zpos);
|
||||
glVertex3f( startx + x, starty + y, zpos);
|
||||
glVertex3f( startx + xin,starty + yin, zpos );
|
||||
glVertex3f( startx + x, starty + y, zpos );
|
||||
}
|
||||
|
||||
glVertex3f( firstxin, firstyin, zpos);
|
||||
glVertex3f( firstx, firsty, zpos);
|
||||
glVertex3f( firstxin, firstyin, zpos );
|
||||
glVertex3f( firstx, firsty, zpos );
|
||||
glEnd();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,6 +4,14 @@ Started 2007-June-11
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
email address.
|
||||
|
||||
2007-Nov-01 UPDATE Geoff Harland <gharlandau@yahoo.com.au>
|
||||
================================================================================
|
||||
+ pcbnew
|
||||
* Provided new definitions of FIRST_COPPER_LAYER and LAST_COPPER_LAYER within
|
||||
include/pcbstruct.h, and used those definitions within various other files.
|
||||
Beautified and generally refined 3d-viewer/3d_draw.cpp and pcbnew/plotgerb.cpp.
|
||||
|
||||
|
||||
2007-Oct-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
================================================================================
|
||||
+kicad:
|
||||
|
@ -401,8 +409,8 @@ email address.
|
|||
field. (Refer to 2007-Oct-2 UPDATE notes for the relevance of this.)
|
||||
* Beautification and house keeping.
|
||||
+ eeschema
|
||||
* The editpart.cpp and editpart.cpp files (which are no longer used) have been
|
||||
removed, and replaced with editpart.cpp.notused and editpart.cpp.notused
|
||||
* The editpart.cpp and libedpart.cpp files (which are no longer used) have been
|
||||
removed, and replaced with editpart.cpp.notused and libedpart.cpp.notused
|
||||
+ cvpcb
|
||||
* Additional "OK", "Cancel", and "Apply" buttons have now been provided for the
|
||||
"Options" dialog box which lists various display options for footprints.
|
||||
|
|
|
@ -153,7 +153,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* aFile,
|
|||
if( pcb_layer_number < 0 )
|
||||
continue;
|
||||
|
||||
if( pcb_layer_number > CMP_N )
|
||||
if( pcb_layer_number > LAST_COPPER_LAYER )
|
||||
{
|
||||
DRAWSEGMENT* drawitem = new DRAWSEGMENT( pcb, TYPEDRAWSEGMENT );
|
||||
|
||||
|
|
|
@ -266,7 +266,7 @@ bool AsCmpLayer = false;
|
|||
AsCmpLayer = true;
|
||||
else
|
||||
{
|
||||
if( LayerLookUpTable[ii] >= CMP_N )
|
||||
if( LayerLookUpTable[ii] >= LAST_COPPER_LAYER )
|
||||
continue; // not a copper layer
|
||||
if( LayerLookUpTable[ii] >= g_DesignSettings.m_CopperLayerCount )
|
||||
g_DesignSettings.m_CopperLayerCount++;
|
||||
|
@ -275,8 +275,8 @@ bool AsCmpLayer = false;
|
|||
|
||||
if( AsCmpLayer )
|
||||
g_DesignSettings.m_CopperLayerCount++;
|
||||
if( g_DesignSettings.m_CopperLayerCount > CMP_N + 1 ) // should not occur.
|
||||
g_DesignSettings.m_CopperLayerCount = CMP_N + 1;
|
||||
if( g_DesignSettings.m_CopperLayerCount > NB_COPPER_LAYERS ) // should not occur.
|
||||
g_DesignSettings.m_CopperLayerCount = NB_COPPER_LAYERS;
|
||||
|
||||
EndModal( 1 );
|
||||
}
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
|
||||
|
||||
/* Layer identification (layer number) */
|
||||
#define FIRST_COPPER_LAYER 0
|
||||
#define COPPER_LAYER_N 0
|
||||
#define LAYER_N_2 1 /* Numero layer 2 */
|
||||
#define LAYER_N_3 2 /* Numero layer 3 */
|
||||
|
@ -52,7 +53,8 @@
|
|||
#define LAYER_N_15 14 /* Numero layer 15 */
|
||||
#define LAYER_CMP_N 15
|
||||
#define CMP_N 15
|
||||
#define NB_COPPER_LAYERS (CMP_N + 1)
|
||||
#define LAST_COPPER_LAYER 15
|
||||
#define NB_COPPER_LAYERS (LAST_COPPER_LAYER + 1)
|
||||
|
||||
#define FIRST_NO_COPPER_LAYER 16
|
||||
#define ADHESIVE_N_CU 16
|
||||
|
|
|
@ -181,7 +181,7 @@ void WinEDA_BasePcbFrame::SwitchLayer( wxDC* DC, int layer )
|
|||
|
||||
// Copper layers cannot be selected unconditionally; how many
|
||||
// of those layers are currently enabled needs to be checked.
|
||||
if( (layer >= COPPER_LAYER_N) && (layer <= CMP_N) )
|
||||
if( (layer >= FIRST_COPPER_LAYER) && (layer <= LAST_COPPER_LAYER) )
|
||||
{
|
||||
// If only one copper layer is enabled, the only such layer
|
||||
// that can be selected to is the "Copper" layer (so the
|
||||
|
|
|
@ -173,7 +173,7 @@ void EDGE_MODULE::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
|
|||
|
||||
GRSetDrawMode( DC, draw_mode );
|
||||
typeaff = frame->m_DisplayModEdge;
|
||||
if( m_Layer <= CMP_N )
|
||||
if( m_Layer <= LAST_COPPER_LAYER )
|
||||
{
|
||||
typeaff = frame->m_DisplayPcbTrackFill;
|
||||
if( !typeaff )
|
||||
|
|
|
@ -99,8 +99,8 @@ int TEXTE_PCB::ReadTextePcbDescr( FILE* File, int* LineNum )
|
|||
{
|
||||
sscanf( Line + 2, " %d %d %lX %d\n", &m_Layer, &m_Miroir,
|
||||
&m_TimeStamp, &dummy );
|
||||
if( m_Layer < COPPER_LAYER_N )
|
||||
m_Layer = COPPER_LAYER_N;
|
||||
if( m_Layer < FIRST_COPPER_LAYER )
|
||||
m_Layer = FIRST_COPPER_LAYER;
|
||||
if( m_Layer > LAST_NO_COPPER_LAYER )
|
||||
m_Layer = LAST_NO_COPPER_LAYER;
|
||||
|
||||
|
|
|
@ -268,7 +268,7 @@ int TRACK::ReturnMaskLayer()
|
|||
if( via_type == VIA_THROUGH )
|
||||
return ALL_CU_LAYERS;
|
||||
|
||||
// VIA_BLIND ou VIA_BURIED:
|
||||
// VIA_BLIND or VIA_BURIED:
|
||||
|
||||
int bottom_layer, top_layer;
|
||||
|
||||
|
@ -720,7 +720,7 @@ void TRACK::Draw( WinEDA_DrawPanel* panel, wxDC* DC, int draw_mode )
|
|||
}
|
||||
|
||||
/* Shows clearance (for tracks and vias, not for zone segments */
|
||||
if( DisplayOpt.DisplayTrackIsol && ( m_Layer <= CMP_N )
|
||||
if( DisplayOpt.DisplayTrackIsol && ( m_Layer <= LAST_COPPER_LAYER )
|
||||
&& ( Type() == TYPETRACK || Type() == TYPEVIA) )
|
||||
{
|
||||
GRCSegm( &panel->m_ClipBox, DC, m_Start.x, m_Start.y,
|
||||
|
|
|
@ -136,12 +136,12 @@ WinEDA_CotationPropertiesFrame::WinEDA_CotationPropertiesFrame( WinEDA_PcbFrame*
|
|||
wxDefaultPosition, wxDefaultSize );
|
||||
LeftBoxSizer->Add( m_SelLayerBox, 0, wxGROW | wxLEFT | wxRIGHT | wxBOTTOM, 5 );
|
||||
int ii;
|
||||
for( ii = CMP_N + 1; ii < NB_LAYERS; ii++ )
|
||||
for( ii = FIRST_NO_COPPER_LAYER; ii < NB_LAYERS; ii++ )
|
||||
{
|
||||
m_SelLayerBox->Append( ReturnPcbLayerName( ii ) );
|
||||
}
|
||||
|
||||
m_SelLayerBox->SetSelection( Cotation->GetLayer() - (CMP_N + 1) );
|
||||
m_SelLayerBox->SetSelection( Cotation->GetLayer() - FIRST_NO_COPPER_LAYER );
|
||||
|
||||
GetSizer()->Fit( this );
|
||||
GetSizer()->SetSizeHints( this );
|
||||
|
@ -175,8 +175,8 @@ void WinEDA_CotationPropertiesFrame::OnOkClick( wxCommandEvent& event )
|
|||
m_TxtWidthCtrl->GetValue();
|
||||
CurrentCotation->m_Text->m_Miroir = (m_Mirror->GetSelection() == 0) ? 1 : 0;
|
||||
|
||||
CurrentCotation->SetLayer( m_SelLayerBox->GetChoice() + CMP_N + 1 );
|
||||
CurrentCotation->m_Text->SetLayer( m_SelLayerBox->GetChoice() + CMP_N + 1 );
|
||||
CurrentCotation->SetLayer( m_SelLayerBox->GetChoice() + FIRST_NO_COPPER_LAYER );
|
||||
CurrentCotation->m_Text->SetLayer( m_SelLayerBox->GetChoice() + FIRST_NO_COPPER_LAYER );
|
||||
|
||||
CurrentCotation->m_Text->CreateDrawData();
|
||||
|
||||
|
|
|
@ -194,11 +194,11 @@ void WinEDA_ModuleEditFrame::Edit_Edge_Layer( EDGE_MODULE* Edge, wxDC* DC )
|
|||
|
||||
|
||||
/* Ask for the new layer */
|
||||
new_layer = SelectLayer( new_layer, COPPER_LAYER_N, LAST_NO_COPPER_LAYER );
|
||||
new_layer = SelectLayer( new_layer, FIRST_COPPER_LAYER, LAST_NO_COPPER_LAYER );
|
||||
if( new_layer < 0 )
|
||||
return;
|
||||
|
||||
if ( new_layer >= COPPER_LAYER_N && new_layer <= LAYER_CMP_N )
|
||||
if ( new_layer >= FIRST_COPPER_LAYER && new_layer <= LAST_COPPER_LAYER )
|
||||
/* an edge is put on a copper layer, and it is very dangerous. a confirmation is requested */
|
||||
{
|
||||
if ( ! IsOK(this, _("The graphic item will be on a copper layer.It is very dangerous. Are you sure") ) )
|
||||
|
|
|
@ -632,7 +632,7 @@ void WinEDA_PcbFrame::Process_Special_Functions( wxCommandEvent& event )
|
|||
break;
|
||||
|
||||
case ID_POPUP_PCB_SELECT_CU_LAYER:
|
||||
itmp = SelectLayer( GetScreen()->m_Active_Layer, -1, CMP_N );
|
||||
itmp = SelectLayer( GetScreen()->m_Active_Layer, -1, LAST_COPPER_LAYER );
|
||||
if( itmp >= 0 )
|
||||
GetScreen()->m_Active_Layer = itmp;
|
||||
break;
|
||||
|
@ -1005,7 +1005,7 @@ void WinEDA_PcbFrame::SwitchLayer( wxDC* DC, int layer )
|
|||
|
||||
// Copper layers cannot be selected unconditionally; how many
|
||||
// of those layers are currently enabled needs to be checked.
|
||||
if( (layer >= COPPER_LAYER_N) && (layer <= CMP_N) )
|
||||
if( (layer >= FIRST_COPPER_LAYER) && (layer <= LAST_COPPER_LAYER) )
|
||||
{
|
||||
// If only one copper layer is enabled, the only such layer
|
||||
// that can be selected to is the "Copper" layer (so the
|
||||
|
|
|
@ -162,7 +162,7 @@ void WinEDA_PcbFrame::Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC
|
|||
COTATION* Cotation;
|
||||
int layer = Segment->GetLayer();
|
||||
|
||||
if( layer <= CMP_N )
|
||||
if( layer <= LAST_COPPER_LAYER )
|
||||
{
|
||||
DisplayError( this, _( "Copper layer global delete not allowed!" ), 20 );
|
||||
return;
|
||||
|
|
|
@ -202,12 +202,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
|
||||
case HK_SWITCH_LAYER_TO_PREVIOUS:
|
||||
ll = GetScreen()->m_Active_Layer;
|
||||
if( (ll <= COPPER_LAYER_N) || (ll > CMP_N) )
|
||||
if( (ll <= FIRST_COPPER_LAYER) || (ll > LAST_COPPER_LAYER) )
|
||||
break;
|
||||
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer
|
||||
ll = COPPER_LAYER_N;
|
||||
else if( ll == CMP_N )
|
||||
ll = MAX( COPPER_LAYER_N, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 );
|
||||
else if( ll == LAST_COPPER_LAYER )
|
||||
ll = MAX( FIRST_COPPER_LAYER, m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 );
|
||||
else
|
||||
ll--;
|
||||
SwitchLayer( DC, ll );
|
||||
|
@ -215,12 +215,12 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
|
||||
case HK_SWITCH_LAYER_TO_NEXT:
|
||||
ll = GetScreen()->m_Active_Layer;
|
||||
if( (ll < COPPER_LAYER_N) || (ll >= CMP_N) )
|
||||
if( (ll < FIRST_COPPER_LAYER) || (ll >= LAST_COPPER_LAYER) )
|
||||
break;
|
||||
if( m_Pcb->m_BoardSettings->m_CopperLayerCount < 2 ) // Single layer
|
||||
ll = COPPER_LAYER_N;
|
||||
else if( ll >= m_Pcb->m_BoardSettings->m_CopperLayerCount - 2 )
|
||||
ll = CMP_N;
|
||||
ll = LAST_COPPER_LAYER;
|
||||
else
|
||||
ll++;
|
||||
SwitchLayer( DC, ll );
|
||||
|
@ -299,7 +299,7 @@ void WinEDA_PcbFrame::OnHotKey( wxDC* DC, int hotkey,
|
|||
break;
|
||||
|
||||
case HK_BACK_SPACE:
|
||||
if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= CMP_N )
|
||||
if( m_ID_current_state == ID_TRACK_BUTT && GetScreen()->m_Active_Layer <= LAST_COPPER_LAYER )
|
||||
{
|
||||
if( ItemFree )
|
||||
{
|
||||
|
@ -570,7 +570,7 @@ bool WinEDA_PcbFrame::OnHotkeyDeleteItem( wxDC* DC, EDA_BaseStruct* DrawStruct )
|
|||
switch( m_ID_current_state )
|
||||
{
|
||||
case ID_TRACK_BUTT:
|
||||
if( GetScreen()->m_Active_Layer > CMP_N )
|
||||
if( GetScreen()->m_Active_Layer > LAST_COPPER_LAYER )
|
||||
return FALSE;
|
||||
if( ItemFree )
|
||||
{
|
||||
|
|
|
@ -163,9 +163,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
if( m_ID_current_state == ID_PCB_ARC_BUTT )
|
||||
shape = S_ARC;
|
||||
|
||||
if( GetScreen()->m_Active_Layer <= CMP_N )
|
||||
if( GetScreen()->m_Active_Layer <= LAST_COPPER_LAYER )
|
||||
{
|
||||
DisplayError( this, _( "Graphic not autorized on Copper layers" ) );
|
||||
DisplayError( this, _( "Graphic not authorized on Copper layers" ) );
|
||||
break;
|
||||
}
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
|
@ -186,7 +186,7 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
}
|
||||
|
||||
case ID_TRACK_BUTT:
|
||||
if( GetScreen()->m_Active_Layer > CMP_N )
|
||||
if( GetScreen()->m_Active_Layer > LAST_COPPER_LAYER )
|
||||
{
|
||||
DisplayError( this, _( "Tracks on Copper layers only " ) );
|
||||
break;
|
||||
|
@ -262,9 +262,9 @@ void WinEDA_PcbFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
|
|||
break;
|
||||
|
||||
case ID_PCB_COTATION_BUTT:
|
||||
if( GetScreen()->m_Active_Layer <= CMP_N )
|
||||
if( GetScreen()->m_Active_Layer <= LAST_COPPER_LAYER )
|
||||
{
|
||||
DisplayError( this, _( "Cotation not autorized on Copper layers" ) );
|
||||
DisplayError( this, _( "Cotation not authorized on Copper layers" ) );
|
||||
break;
|
||||
}
|
||||
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
|
||||
|
@ -426,4 +426,3 @@ void WinEDA_PcbFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -136,7 +136,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer )
|
|||
|
||||
switch( Layer )
|
||||
{
|
||||
case COPPER_LAYER_N:
|
||||
case FIRST_COPPER_LAYER:
|
||||
case LAYER_N_2:
|
||||
case LAYER_N_3:
|
||||
case LAYER_N_4:
|
||||
|
@ -151,7 +151,7 @@ void WinEDA_BasePcbFrame::Genere_HPGL( const wxString& FullFileName, int Layer )
|
|||
case LAYER_N_13:
|
||||
case LAYER_N_14:
|
||||
case LAYER_N_15:
|
||||
case CMP_N:
|
||||
case LAST_COPPER_LAYER:
|
||||
Plot_Layer_HPGL( dest, layer_mask, 0, 1, modetrace );
|
||||
break;
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer )
|
|||
Plot_Layer_PS( dest, layer_mask, 0, 1, modetrace );
|
||||
break;
|
||||
|
||||
case COPPER_LAYER_N:
|
||||
case FIRST_COPPER_LAYER:
|
||||
case LAYER_N_2:
|
||||
case LAYER_N_3:
|
||||
case LAYER_N_4:
|
||||
|
@ -193,7 +193,7 @@ void WinEDA_BasePcbFrame::Genere_PS( const wxString& FullFileName, int Layer )
|
|||
case LAYER_N_13:
|
||||
case LAYER_N_14:
|
||||
case LAYER_N_15:
|
||||
case CMP_N:
|
||||
case LAST_COPPER_LAYER:
|
||||
Plot_Layer_PS( dest, layer_mask, 0, 1, modetrace );
|
||||
break;
|
||||
|
||||
|
|
Loading…
Reference in New Issue