Ejemplo n.º 1
0
        public virtual void Setup()
        {
            Func <Vector3f> centerPosF = () => { return((Vector3f)(snappedPointsS[0] + snappedPointsS[1]) * 0.5f); };

            centerPos = fPosition.Scene(centerPosF);

            fDimension textHeight = null;

            if (TextHeightDimensionType == DimensionType.VisualAngle)
            {
                textHeight = fDimension.VisualAngle(centerPos, TextHeightDimension);
            }
            else if (TextHeightDimensionType == DimensionType.SceneUnits)
            {
                textHeight = fDimension.Scene(() => { return(TextHeightDimension); });
            }
            else
            {
                textHeight = fDimension.World(() => { return(TextHeightDimension); });
            }

            Func <Vector3f> labelPosF = () => {
                Vector3f p = centerPos.ScenePoint;
                float    h = textHeight.SceneValuef;
                p += 0.5f * h * scene.ToSceneN(Vector3f.AxisY);
                return(p);
            };

            indicators = new ToolIndicatorSet(this, scene);
            LineIndicator diag = new LineIndicator()
            {
                VisibleF    = () => { return(Initialized); },
                SceneStartF = () => { return((Vector3f)snappedPointsS[0]); },
                SceneEndF   = () => { return((Vector3f)snappedPointsS[1]); },
                ColorF      = () => { return(Colorf.VideoRed); },
                LineWidth   = fDimension.VisualAngle(centerPos, 0.5f),
            };

            indicators.AddIndicator(diag);

            dimension = new TextLabelIndicator()
            {
                VisibleF       = () => { return(Initialized && ShowTextLabel); },
                ScenePositionF = labelPosF,
                TextHeight     = textHeight,
                DimensionTextF = () => { return(string.Format("{0:F4}", snappedPointsS[0].Distance(snappedPointsS[1]))); }
            };
            indicators.AddIndicator(dimension);
        }
Ejemplo n.º 2
0
     public override SectionPlaneIndicator MakeSectionPlaneIndicator(
         int id, string name,
         fDimension Width,
         Func <Frame3f> SceneFrameF,
         Func <Colorf> ColorF,
         Func <bool> VisibleF)
     {
         if (name == "endPlane")     // this name comes from TwoPointBandTool.Setup
         {
             ColorF = () => { return(new Colorf(Colorf.Orange, 0.5f)); }
         }
         ;
         return(base.MakeSectionPlaneIndicator(id, name, Width, SceneFrameF, ColorF, VisibleF));
     }
 }