DIRECTORY CedarProcess, Controls, Draw2d, FS, G3dBasic, G3dShape, G3dTool, IO, MessageWindow, Rope; G3dToolIOImpl: CEDAR PROGRAM IMPORTS CedarProcess, Controls, Draw2d, FS, G3dShape, G3dTool, IO, MessageWindow, Rope EXPORTS G3dTool ~ BEGIN Surface: TYPE ~ G3dBasic.Surface; Shape: TYPE ~ G3dShape.Shape; Vertex: TYPE ~ G3dShape.Vertex; Tool: TYPE ~ G3dTool.Tool; Triple: TYPE ~ G3dTool.Triple; ROPE: TYPE ~ Rope.ROPE; STREAM: TYPE ~ IO.STREAM; IOOpsButton: PUBLIC G3dTool.ClickProc ~ { t: Tool ¬ NARROW[clientData]; Inner: PROC ~ { choice: INT ¬ Controls.PopUpRequest[["Output"], LIST[ -- 1 -- ["Read Shape"], -- 2 -- ["Read Shape and Auto Scale"], -- 3 -- ["Write .SHAPE", "Output a points-polygons shape file"], -- 4 -- ["Write .NONE", "Output a points-polygons .none file"], -- 5 -- ["Write INTERPRESS", "Output interpress file of the current display"], -- 6 -- ["IP stroke width", "width of strokes for IP output"], -- 7 -- ["Write RIB", "write output to a named file"]]]; G3dTool.SetCursor[t, TRUE]; SELECT choice FROM 1 => ReadShape[t, FALSE]; 2 => ReadShape[t, TRUE]; 3, 4 => { shape: INT ¬ G3dTool.ChooseShape[t, "Output Shape"]; SELECT shape FROM -2 => G3dTool.TSWrite[t, "No shape to write."]; -1 => G3dTool.TSWrite[t, "Choose only one shape."]; ENDCASE => { r: ROPE ¬ Controls.TypescriptReadFileName[t.typescript]; IF choice = 3 THEN G3dShape.ShapeToFile[r, t.shapes[shape]] ELSE { out: STREAM ¬ FS.StreamOpen[r, $create]; s: Shape ¬ t.shapes[shape]; IF NOT s.vertices.valid[normal] THEN G3dShape.SetVertexNormals[s]; IF NOT G3dShape.ShapeToStreamPerFormat[s, out, $DotNone] THEN G3dTool.TSWrite[t, "can't write shape"]; IO.Close[out]; }; }; }; 5 => { Draw: Controls.DrawProc ~ { v: G3dTool.View ¬ G3dTool.GetView[viewer, t]; G3dTool.Draw[context, viewer, $IPOut, v.camera.matrix, v.viewport, v, t, t]; }; t.forInterpress ¬ TRUE; Draw2d.IPOut[Controls.TypescriptReadFileName[t.typescript], Draw, t]; t.forInterpress ¬ FALSE; }; 6 => t.ipStrokeWidth ¬ Controls.GetReal[t.typescript, "Stroke width", t.ipStrokeWidth]; 7 => G3dTool.WriteRIBtoFile[t, Controls.TypescriptReadFileName[t.typescript]]; ENDCASE; G3dTool.SetCursor[t, FALSE]; }; CedarProcess.DoWithPriority[background, Inner]; }; ReadShape: PROC [t: Tool, autoScale: BOOL] ~ { prompt: ROPE ¬ IO.PutFR1["Add shape: (dir = %g) ", IO.rope[t.outerData.directory]]; r: ROPE ¬ Controls.TypescriptRead[t.typescript, prompt]; IF r # NIL THEN { c: CHAR ¬ Rope.Fetch[r, 0]; IF c # '[ AND c # '/ THEN r ¬ Rope.Concat[t.outerData.directory, r]; IF (r ¬ G3dTool.ReadFromShapeFile[t, r, autoScale]) # NIL THEN Blink[r] ELSE G3dTool.Repaint[t, $ShapeOps]; }; }; Blink: PROC [r: ROPE] ~ { MessageWindow.Append[Rope.Concat["\t\t", r], TRUE]; MessageWindow.Blink[]; }; END. .. Δ G3dToolIOImpl.mesa Copyright c 1985 by Xerox Corporation. All rights reserved. Bloomenthal, April 2, 1993 3:37 pm PST 3d Tool: IO Types IO --6-- ["RIB to selection", "write output to current (Tioga) selection"], --7-- ["Color Display", "Write out Color Image"]]]; 6 => { v: ViewerClasses.Viewer ¬ ViewerTools.GetSelectedViewer[]; IF v # NIL AND (v.class.flavor = $Text OR v.class.flavor = $Typescript) THEN WriteRIBtoStream[t, ViewerIO.CreateViewerStreams[NIL, v].out] ELSE Blink["Make a primary selection first\n"]; }; 7 => IF G3dTool.Context3dOk[t] THEN G3dRenderWithImager.MakeInterpressPage[GetFirstActiveContext3d[t], Controls.TypescriptReadFileName[t.typescript] ! G3dRender.Error => CONTINUE] Κρ•NewlineDelimiter ™™Jšœ Οmœ1™Jš’œ1˜8—JšœŸœ˜šŸœŸ˜JšœŸœ˜JšœŸœ˜šœ ˜ JšœŸœ*˜4šŸœŸ˜Jšœ/˜/Jšœ3˜3šŸœ˜ JšœŸœ1˜8šŸœ ˜ JšŸœ)˜-šŸœ˜JšœŸœŸœ˜(J˜JšŸœŸœŸœ˜BšŸœŸœ2˜8JšŸœ)˜-—JšŸœ ˜J˜——J˜—J˜——˜š‘œ˜J˜-J˜MJ˜—JšœŸœ˜J˜EJšœŸœ˜J˜—J˜WJšœN˜NJšŸœ˜JšœŸœ˜—J˜—J˜/J˜J˜—š‘ œŸœŸœ˜.IcodešœŸœŸœ"Ÿœ˜SLšœŸœ1˜8šŸœŸœŸœ˜JšœŸœ˜JšŸœŸœŸœ+˜DšŸœ4Ÿ˜9JšŸœ ˜ JšŸœ˜#—J˜—J˜J˜—š‘œŸœŸœ˜Jšœ-Ÿœ˜3J˜J˜J˜——JšŸœ˜˜Jš’œC™HJš’œ.™3šœ™J™:šŸœΟsœ£Ÿ£Ÿ£œ£œ£œ£Ÿ£œ£œ£œ ™GJšŸœ2Ÿœ ™BJšŸœ+™/—Jšœ™—™šŸœŸ™™BJšœCŸœ™L———J˜——…— Ζ{