SVDescribeImpl.mesa
Copyright © 1986 by Xerox Corporation. All rights reserved.
Last edited by Bier on March 12, 1987 9:15:31 pm PST
Contents: Routines for producing human-readable textual descriptions of Solidviews objects.
DIRECTORY
Atom, IO, Rope, SVAssembly, SVDescribe, SVInterfaceTypes, SVSceneTypes;
SVDescribeImpl:
CEDAR
PROGRAM
IMPORTS IO, Rope, SVAssembly
EXPORTS SVDescribe
=
BEGIN
AlignmentPoint: TYPE = SVInterfaceTypes.AlignmentPoint;
FeatureData: TYPE = SVInterfaceTypes.FeatureData;
MasterObject: TYPE = SVSceneTypes.MasterObject;
Shape: TYPE = SVSceneTypes.Shape;
Slice: TYPE = SVSceneTypes.Slice;
SliceDescriptor: TYPE = SVSceneTypes.SliceDescriptor;
SVData: TYPE = SVInterfaceTypes.SVData;
DescribeSourceFeature:
PROC [feature: FeatureData, svData: SVData]
RETURNS [rope: Rope.
ROPE] = {
IF feature = NIL THEN RETURN["nothing"]
ELSE {
SELECT feature.type
FROM
slice => {
slice: Slice ← NARROW[feature.shape, SliceDescriptor].slice;
mo: MasterObject ← NARROW[slice.shape, Shape].mo;
rope ← Rope.Concat[mo.class.name, " slice"];
};
distanceLine => rope ← "distance line";
slopeLine => rope ← "slope line";
angleLine => rope ← "angle line";
symmetryLine => rope ← "symmetry line";
sphere => rope ← "alignment sphere";
intersectionPoint => {
firstObj, secondObj: Rope.ROPE;
firstObj ←
IF
NARROW[feature.shape, AlignmentPoint].curve1 #
NIL
THEN DescribeSourceFeature[
NARROW[feature.shape, AlignmentPoint].curve1, svData]
ELSE "unknown";
secondObj ←
IF
NARROW[feature.shape, AlignmentPoint].curve2 #
NIL
THEN DescribeSourceFeature[
NARROW[feature.shape, AlignmentPoint].curve2, svData]
ELSE "unknown";
rope ← IO.PutFR["a %g/%g intersection point", [rope[firstObj]], [rope[secondObj]] ];
};
midpoint => rope ← IO.PutFR["midpoint of segment ???"];
ENDCASE => ERROR;
};
};
DescribeFeature:
PUBLIC
PROC [feature: FeatureData, hitData:
REF
ANY, svData: SVData]
RETURNS [description: Rope.
ROPE] = {
IF feature = NIL THEN RETURN["nothing"]
ELSE {
SELECT feature.type
FROM
slice => {
slice: Slice ← NARROW[feature.shape, SliceDescriptor].slice;
description ← SVAssembly.DescribeHit[slice, hitData];
};
anchor => {
description ← IO.PutFR["anchor"];
};
distanceLine => description ← "distance line";
slopeLine => description ← "slope line";
angleLine => description ← "angle line";
symmetryLine => description ← "symmetry line";
sphere => description ← "alignment sphere";
intersectionPoint => {
firstObj, secondObj: Rope.ROPE;
alignPoint: AlignmentPoint ← NARROW[feature.shape];
obj1: FeatureData ← alignPoint.curve1;
obj2: FeatureData ← alignPoint.curve2;
tangent: BOOL ← alignPoint.tangent;
firstObj ←
IF obj1 #
NIL
THEN DescribeSourceFeature[obj1, svData]
ELSE "unknown";
secondObj ←
IF obj2 #
NIL
THEN DescribeSourceFeature[obj2, svData]
ELSE "unknown";
IF tangent THEN description ← IO.PutFR["a %g/%g tangency point", [rope[firstObj]], [rope[secondObj]] ]
ELSE description ← IO.PutFR["a %g/%g intersection point", [rope[firstObj]], [rope[secondObj]] ];
};
ENDCASE => ERROR;
};
};
END.