Commit 370356b6 authored by jean-pierre charras's avatar jean-pierre charras

preparing Gerbview enhancements.Add comments

parent 6396c2eb
......@@ -29,7 +29,7 @@
#include "class_am_param.h"
extern int ReadInt( char*& text, bool aSkipSeparator = true );
extern int ReadInt( char*& text, bool aSkipSeparator = true );
extern double ReadDouble( char*& text, bool aSkipSeparator = true );
/*Class AM_PARAM
......@@ -61,6 +61,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
}
}
/**
* Function ReadParam
* Read one aperture macro parameter
......@@ -76,6 +77,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
bool AM_PARAM::ReadParam( char*& aText )
{
bool found = false;
if( *aText == '$' ) // value defined later, in aperture description
{
++aText;
......@@ -91,8 +93,9 @@ bool AM_PARAM::ReadParam( char*& aText )
// Skip extra characters and separator
while( *aText && (*aText != ',') && (*aText != '*') )
aText++;
if( *aText == ',' )
aText++;
aText++;
return found;
}
......@@ -31,74 +31,74 @@
#define _AM_PARAM_H_
/*
An aperture macro defines a complex shape and is a list of aperture primitives.
Each aperture primitive defines a simple shape (circle, rect, regular polygon...)
Inside a given aperture primitive, a fixed list of parameters defines info
about the shape: size, thickness, number of vertex ...
Each parameter can be an immediate value or a defered value.
When value is defered, it is defined when the aperture macro is instancied by
an ADD macro command
Actual values of a parmeter can also be the result of an arithmetic operation.
Here is some examples:
An immediate value:
3.5
A deferend value:
$2 means: replace me by the second value given in the ADD command
Actual value as arithmetic calculation:
$2/2+1
Note also a defered parameter can be defined in aperture macro,
but outside aperture primitives. Example
%AMRECTHERM*
$4=$3/2* parameter $4 is half value of parameter $3
21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
For the aperture primitive, parameters $1 to $3 will be defined in ADD command,
and $4 is defined inside the macro
Some examples of aperture macro definition
A simple definition, no parameters:
%AMMOIRE10*
6,0,0,0.350000,0.005,0.050,3,0.005,0.400000,0.0*%
Example of instanciation:
%ADD19THERM19*%
A simple definition, one parameter:
%AMCIRCLE*
1,1,$1,0,0*
Example of instanciation:
%ADD11CIRCLE,.5*%
A definition, with parameters and arithmetic operations:
%AMVECTOR*
2,1,$1,0,0,$2+1,$3,-135*%
Example of instanciation:
%ADD12VECTOR,0.05X0X0*%
A more complicated aperture macro definition, with parameters and arihmetic operations:
%AMRNDREC*
0 this is a comment*
21,1,$1+$1,$2+$2-$3-$3,0,0,0*
21,1,$1+$1-$3-$3,$2+$2,0,0,0*
1,1,$3+$3,$1-$3,$2-$3*
1,1,$3+$3,$3-$1,$2-$3*
1,1,$3+$3,$1-$3,$3-$2*
1,1,$3+$3,$3-$1,$3-$2*%
Example of instanciation:
A more complicated sample of aperture macro definition:
G04 Rectangular Thermal Macro, params: W/2, H/2, T/2 *
%AMRECTHERM*
$4=$3/2*
21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
21,1,$1-$3,$2-$3,0-$1/2-$4,$2/2+$4,0*
21,1,$1-$3,$2-$3,$1/2+$4,0-$2/2-$4,0*
21,1,$1-$3,$2-$3,$1/2+$4,$2/2+$4,0*%
Example of instanciation:
%ADD28RECTHERM,0.035591X0.041496X0.005000*%
*/
* An aperture macro defines a complex shape and is a list of aperture primitives.
* Each aperture primitive defines a simple shape (circle, rect, regular polygon...)
* Inside a given aperture primitive, a fixed list of parameters defines info
* about the shape: size, thickness, number of vertex ...
*
* Each parameter can be an immediate value or a defered value.
* When value is defered, it is defined when the aperture macro is instancied by
* an ADD macro command
*
* Actual values of a parameter can also be the result of an arithmetic operation.
*
* Here is some examples:
* An immediate value:
* 3.5
* A deferend value:
* $2 means: replace me by the second value given in the ADD command
* Actual value as arithmetic calculation:
* $2/2+1
*
* Note also a defered parameter can be defined in aperture macro,
* but outside aperture primitives. Example
* %AMRECTHERM*
* $4=$3/2* parameter $4 is half value of parameter $3
* 21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
* For the aperture primitive, parameters $1 to $3 will be defined in ADD command,
* and $4 is defined inside the macro
*
* Some examples of aperture macro definition
* A simple definition, no parameters:
* %AMMOIRE10*
* 6,0,0,0.350000,0.005,0.050,3,0.005,0.400000,0.0*%
* Example of instanciation:
* %ADD19THERM19*%
*
* A simple definition, one parameter:
* %AMCIRCLE*
* 1,1,$1,0,0*
* Example of instanciation:
* %ADD11CIRCLE,.5*%
*
* A definition, with parameters and arithmetic operations:
* %AMVECTOR*
* 2,1,$1,0,0,$2+1,$3,-135*%
* Example of instanciation:
* %ADD12VECTOR,0.05X0X0*%
*
* A more complicated aperture macro definition, with parameters and arihmetic operations:
* %AMRNDREC*
* 0 this is a comment*
* 21,1,$1+$1,$2+$2-$3-$3,0,0,0*
* 21,1,$1+$1-$3-$3,$2+$2,0,0,0*
* 1,1,$3+$3,$1-$3,$2-$3*
* 1,1,$3+$3,$3-$1,$2-$3*
* 1,1,$3+$3,$1-$3,$3-$2*
* 1,1,$3+$3,$3-$1,$3-$2*%
* Example of instanciation:
*
* A more complicated sample of aperture macro definition:
* G04 Rectangular Thermal Macro, params: W/2, H/2, T/2 *
* %AMRECTHERM*
* $4=$3/2*
* 21,1,$1-$3,$2-$3,0-$1/2-$4,0-$2/2-$4,0*
* 21,1,$1-$3,$2-$3,0-$1/2-$4,$2/2+$4,0*
* 21,1,$1-$3,$2-$3,$1/2+$4,0-$2/2-$4,0*
* 21,1,$1-$3,$2-$3,$1/2+$4,$2/2+$4,0*%
* Example of instanciation:
* %ADD28RECTHERM,0.035591X0.041496X0.005000*%
*/
#include <vector>
......@@ -114,8 +114,7 @@ Example of instanciation:
*/
class AM_PARAM
{
public:
AM_PARAM() :
public: AM_PARAM() :
index( -1 ),
value( 0.0 )
{}
......@@ -147,6 +146,7 @@ public:
index = aIndex;
}
/**
* Function ReadParam
* Read one aperture macro parameter
......
......@@ -36,6 +36,16 @@
#include "base_struct.h"
#include "class_am_param.h"
/*
* An aperture macro defines a complex shape and is a list of aperture primitives.
* Each aperture primitive defines a simple shape (circle, rect, regular polygon...)
* Inside a given aperture primitive, a fixed list of parameters defines info
* about the shape: size, thickness, number of vertex ...
*
* Each parameter can be an immediate value or a defered value.
* When value is defered, it is defined when the aperture macro is instancied by
* an ADD macro command
*/
/**
* Enum AM_PRIMITIVE_ID
......@@ -74,8 +84,7 @@ public:
bool m_GerbMetric; // units for this primitive:
// false = Inches, true = metric
public:
AM_PRIMITIVE( bool aGerbMetric, AM_PRIMITIVE_ID aId = AMP_UNKNOWN )
public: AM_PRIMITIVE( bool aGerbMetric, AM_PRIMITIVE_ID aId = AMP_UNKNOWN )
{
primitive_id = aId;
m_GerbMetric = aGerbMetric;
......@@ -89,7 +98,7 @@ public:
* returns the first parameter in integer form. Some but not all primitives
* use the first parameter as an exposure control.
*/
int GetExposure( GERBER_DRAW_ITEM* aParent ) const;
int GetExposure( GERBER_DRAW_ITEM* aParent ) const;
/**
* Function mapExposure
......@@ -132,7 +141,7 @@ public:
* @param aParent = the parent GERBER_DRAW_ITEM which is actually drawn
* @return a dimension, or -1 if no dim to calculate
*/
int GetShapeDim( GERBER_DRAW_ITEM* aParent );
int GetShapeDim( GERBER_DRAW_ITEM* aParent );
private:
......@@ -184,7 +193,7 @@ struct APERTURE_MACRO
* @param aParent = the parent GERBER_DRAW_ITEM which is actually drawn
* @return a dimension, or -1 if no dim to calculate
*/
int GetShapeDim( GERBER_DRAW_ITEM* aParent );
int GetShapeDim( GERBER_DRAW_ITEM* aParent );
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment