<> <> <> <> <<>> DIRECTORY CD, CDAtomicObjects, CDBasics, CDCells, CDDirectory, CDRects, CDSymbolicObjects, CDCurves, CDTexts, CMosB, Imager, ImagerColor, Pipal, PipalFromCD, PipalInt, PipalMask, PipalPaint, PipalWB, RefTab; PipalFromCDImpl: CEDAR PROGRAM IMPORTS CDAtomicObjects, CDBasics, CDCells, CDDirectory, CDRects, CDSymbolicObjects, CDCurves, CDTexts, CMosB, Imager, ImagerColor, Pipal, PipalInt, PipalMask, PipalWB, RefTab EXPORTS PipalFromCD = BEGIN OPEN PipalFromCD; <> colorTable: ARRAY CD.Layer OF PipalPaint.Color _ ALL[Imager.black]; table: RefTab.Ref _ RefTab.Create[]; Convert: PUBLIC PROC [cdObject: CD.Object] RETURNS [object: Pipal.Object] ~ { object _ RefTab.Fetch[table, cdObject].val; IF object#NIL THEN RETURN; object _ SELECT TRUE FROM CDRects.IsSimpleRect[cdObject] => ConvertCDRect[cdObject], CDAtomicObjects.IsAtomicOb[cdObject] => ConvertCDAtomicObject[cdObject], CDTexts.IsText[cdObject] => ConvertCDText[cdObject], CDCells.IsCell[cdObject] => ConvertCDCell[cdObject], CDSymbolicObjects.IsSymbolicOb[cdObject] => Pipal.CreateOverlay[NIL], CDCurves.IsLine[cdObject] OR CDCurves.IsSpline[cdObject] OR CDCurves.IsPolygon[cdObject] OR CDCurves.IsFilledCurve[cdObject] => Pipal.CreateOverlay[NIL], ENDCASE => Convert[CDDirectory.Expand1[cdObject].new]; [] _ RefTab.Store[table, cdObject, object]; }; CDToPipalSize: PROC [size: CD.Position] RETURNS [PipalInt.Size] ~ { RETURN[[size.x, size.y]]; }; ConvertCDRect: PROC [cdObject: CD.Object] RETURNS [object: Pipal.Object] ~ { object _ PipalMask.CreateBox[ size: CDToPipalSize[CDBasics.SizeOfRect[cdObject.bbox]], layer: colorTable[cdObject.layer]]; }; ConvertCDAtomicObject: PROC [cdObject: CD.Object] RETURNS [object: Pipal.Object] ~ { object _ PipalMask.CreateBox[ size: CDToPipalSize[CDBasics.SizeOfRect[cdObject.bbox]], layer: Imager.MakeGray[0.8]]; }; ConvertCDText: PROC [cdObject: CD.Object] RETURNS [object: Pipal.Object] ~ { text: CDTexts.TextSpecific _ NARROW[cdObject.specific]; object _ PipalWB.CreateBoxedText[text.text, CDToPipalSize[CDBasics.SizeOfRect[cdObject.bbox]]]; }; CDTransformToTransform: PROC [cdT: CD.Transformation] RETURNS [ppT: PipalInt.Transformation] ~ { RETURN[ [ translation: [cdT.off.x, cdT.off.y], orientation: VAL[ORD[cdT.orient]] ] ]; }; ConvertCDCell: PROC [cdObject: CD.Object] RETURNS [object: Pipal.Object] ~ { ConvertInstance: CDCells.InstEnumerator ~ { child: Pipal.Object _ PipalInt.TransformObject[transformation: CDTransformToTransform[inst.trans], child: Convert[inst.ob]]; objects _ CONS[child, objects]; }; objects: Pipal.Objects _ NIL; [] _ CDCells.EnumerateInstances[cdObject, ConvertInstance]; object _ Pipal.CreateOverlay[objects]; }; <> colorTable[CMosB.ndif] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/NDif"]; colorTable[CMosB.pdif] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/PDif"]; colorTable[CMosB.pwellCont] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/PWelCont"]; colorTable[CMosB.nwellCont] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/NWelCont"]; colorTable[CMosB.wndif] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/NDif"]; colorTable[CMosB.wpdif] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/PDif"]; colorTable[CMosB.wpwellCont] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/PWelCont"]; colorTable[CMosB.wnwellCont] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/NWelCont"]; colorTable[CMosB.pwell] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/PWel"]; colorTable[CMosB.nwell] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/NWel"]; colorTable[CMosB.pol] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/Pol"]; colorTable[CMosB.met] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/Met"]; colorTable[CMosB.met2] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/Met2"]; colorTable[CMosB.ovg] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/Ovg"]; colorTable[CMosB.cut] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/Cut"]; colorTable[CMosB.cut2] _ ImagerColor.Find["Xerox/Research/ChipNDale/CMosB/Cut2"]; <<>> END.