Example #1
0
        private vtkTextWidget CreateClipButton(string Text, double[] Position, int FontSize)
        {
            // Create Text Actor and Representation
            vtkTextActor TextActor = vtkTextActor.New();

            TextActor.SetInput(Text);
            TextActor.GetTextProperty().SetBold(0);
            TextActor.GetTextProperty().SetFontFamilyToArial();
            vtkTextRepresentation Rep = vtkTextRepresentation.New();

            Rep.SetPosition(Position[0], Position[1]);
            Rep.SetTextActor(TextActor);
            Rep.SetShowBorderToOff();

            // Set widget
            vtkTextWidget Widget = vtkTextWidget.New();

            Widget.SetRepresentation(Rep);
            Widget.GetTextActor().GetTextProperty().SetFontSize(FontSize);
            Widget.GetTextActor().SetTextScaleModeToViewport();
            Widget.SetInteractor(renderWindow.GetInteractor());
            Widget.SelectableOn();
            Widget.SetEnabled(0);
            Widget.ResizableOff();

            return(Widget);
        }
Example #2
0
        private void ShowGrid(vtkObject sender, vtkObjectEventArgs e)
        {
            if (ClipPlaneActor.GetVisibility() == 1)
            {
                ClipPlaneActor.VisibilityOff();
                Grid.GetTextActor().SetInput("Grid ON");
            }
            else
            {
                ClipPlaneActor.VisibilityOn();
                Grid.GetTextActor().SetInput("Grid OFF");
            }

            Refresh();
        }
Example #3
0
        public void ChangeLabelColor(double[] color)
        {
            TextProp.SetColor(color[0], color[1], color[2]);
            SliderRep.GetTitleProperty().SetColor(color[0], color[1], color[2]);
            SliderRep.GetLabelProperty().SetColor(color[0], color[1], color[2]);

            ScalarBar.SetLabelTextProperty(TextProp);
            ScalarBar.SetTitleTextProperty(TextProp);

            Axes.GetXAxisCaptionActor2D().GetCaptionTextProperty().SetColor(color[0], color[1], color[2]);
            Axes.GetYAxisCaptionActor2D().GetCaptionTextProperty().SetColor(color[0], color[1], color[2]);
            Axes.GetZAxisCaptionActor2D().GetCaptionTextProperty().SetColor(color[0], color[1], color[2]);

            Reverse.GetTextActor().GetTextProperty().SetColor(color[0], color[1], color[2]);
            ClipX.GetTextActor().GetTextProperty().SetColor(color[0], color[1], color[2]);
            ClipY.GetTextActor().GetTextProperty().SetColor(color[0], color[1], color[2]);
            ClipZ.GetTextActor().GetTextProperty().SetColor(color[0], color[1], color[2]);
            Grid.GetTextActor().GetTextProperty().SetColor(color[0], color[1], color[2]);
        }
Example #4
0
        private void SetClipPlaneNormal(vtkObject sender, vtkObjectEventArgs e)
        {
            vtkTextWidget widget = sender as vtkTextWidget;
            string        text   = widget.GetTextActor().GetInput();

            if (text == "Clip X")
            {
                SetClipPlane("X");
            }
            if (text == "Clip Y")
            {
                SetClipPlane("Y");
            }
            if (text == "Clip Z")
            {
                SetClipPlane("Z");
            }

            Refresh();
        }