<> <> <> <> <<>> 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.