Preliminary method to record polygons and wire paths with property

records when they are read in into their own subcells using the
cif/gds read options.
This commit is contained in:
Tim Edwards 2017-10-09 11:51:51 -04:00
parent 5ba46da6b9
commit efb1f00879
2 changed files with 60 additions and 0 deletions

View File

@ -272,6 +272,7 @@ calmaElementBoundary()
}
}
CIFPropRecordPath(cifReadCellDef, pathheadp, FALSE);
rp = CIFPolyToRects(pathheadp, plane, CIFPaintTable, (PaintUndoInfo *)NULL);
CIFFreePath(pathheadp);
@ -605,6 +606,7 @@ calmaElementPath()
}
}
CIFPropRecordPath(cifReadCellDef, pathheadp, TRUE);
CIFPaintWirePath(pathheadp, width,
(pathtype == CALMAPATH_SQUAREFLUSH || pathtype == CALMAPATH_CUSTOM) ?
FALSE : TRUE, plane, CIFPaintTable, (PaintUndoInfo *)NULL);

View File

@ -22,6 +22,7 @@ static char rcsid[] __attribute__ ((unused)) = "$Header: /usr/cvsroot/magic-8.0/
#endif /* not lint */
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <math.h> /* for wire path-to-poly path conversion */
@ -218,6 +219,63 @@ CIFParseFlash()
return TRUE;
}
/*
* ----------------------------------------------------------------------------
*
* CIFPropRecordPath --
*
* Generate a property in the current edit cell and set it to a string
* containing the values in the list at pathheadp.
*
* If "iswire" is TRUE, then all values in the path are assumed to be
* double the actual value (because path centerlines can be on half-
* lambda).
* ----------------------------------------------------------------------------
*/
void
CIFPropRecordPath(def, pathheadp, iswire)
CellDef *def;
CIFPath *pathheadp;
{
extern float CIFGetOutputScale();
CIFPath *pathp;
char *pathstr, *sptr;
int components;
float x, y, oscale, mult;
oscale = CIFGetOutputScale(1000); /* 1000 for conversion to um */
if (oscale == 0.0) oscale = 1.0;
mult = (iswire == TRUE) ? 0.5 : 1.0;
pathp = pathheadp;
components = 0;
/* Count the number of components in the path */
while (pathp != NULL)
{
pathp = pathp->cifp_next;
components++;
}
/* Allocate enough space to hold 2 * N points at "infinity" */
pathstr = (char *)mallocMagic(components * 40);
pathp = pathheadp;
sptr = pathstr;
while (pathp != NULL)
{
x = (float)pathp->cifp_x * oscale * mult;
y = (float)pathp->cifp_y * oscale * mult;
sprintf(sptr, "%.3f %.3f ", x, y);
sptr = sptr + strlen(sptr);
pathp = pathp->cifp_next;
}
/* Reallocate pathstr to be no larger than needed to hold the path contents */
StrDup(&pathstr, pathstr);
DBPropPut(def, "path", (ClientData)pathstr);
}
/*
* ----------------------------------------------------------------------------
*