Beispiel #1
0
        void update_selection(IEnumerable <SceneObject> vSelection)
        {
            List <SceneObject> l   = new List <SceneObject>(vSelection);
            SceneObject        use = l.Find((x) => { return(x is MeshSO); });

            if (use == null)
            {
                return;
            }

            meshTarget = use as MeshSO;
            update_measurement();
        }
Beispiel #2
0
        public RadialMeasureTool(FScene scene, SceneObject target)
        {
            this.scene = scene;

            behaviors = new InputBehaviorSet();

            // TODO is this where we should be doing this??
            behaviors.Add(
                new RadialMeasureTool_MouseBehavior(scene.Context)
            {
                Priority = 5
            });
            //behaviors.Add(
            //    new RevolveTool_SpatialDeviceBehavior(scene.ActiveController) { Priority = 5 });

            // shut off transform gizmo
            scene.Context.TransformManager.PushOverrideGizmoType(TransformManager.NoGizmoType);

            scene.SelectionChangedEvent += Scene_SelectionChangedEvent;

            this.meshTarget = target as MeshSO;

            var boundsW = meshTarget.GetBoundingBox(CoordSpace.WorldCoords);

            measureHitPos = boundsW.Center;
            update_measurement();


            indicators = new ToolIndicatorSet(this, scene);
            TextLabelIndicator dimensionLabel = new TextLabelIndicator()
            {
                ScenePositionF = () => { return(displayPosS + 0.01f * Vector3f.AxisY); },
                TextHeight     = fDimension.Scene(0.05f),
                DimensionTextF = () => { return(" " + (curDimension * 100).ToString("F2") + "cm"); }
            };

            indicators.AddIndicator(dimensionLabel);
            CircleIndicator circle = new CircleIndicator()
            {
                SceneFrameF = () => { return(new Frame3f(circleCenterS)); },
                RadiusF     = () => { return((float)(curDimension * 0.5)); },
                ColorF      = () => { return(new Colorf(Colorf.VideoRed, 0.5f)); },
                LineWidth   = fDimension.Scene(0.001f)
            };

            indicators.AddIndicator(circle);
            LineIndicator diag = new LineIndicator()
            {
                SceneStartF = () => { return(maxStart); },
                SceneEndF   = () => { return(maxEnd); },
                ColorF      = () => { return(Colorf.VideoRed); },
                LineWidth   = fDimension.Scene(0.001f)
            };

            indicators.AddIndicator(diag);
            SectionPlaneIndicator section_plane = new SectionPlaneIndicator()
            {
                SceneFrameF = () => { return(new Frame3f(displayPosS)); },
                Width       = fDimension.Scene(() => { return((float)(curDimension * 1.5)); })
            };

            indicators.AddIndicator(section_plane);
        }