コード例 #1
0
ファイル: RenderInterface.cs プロジェクト: ovevans/STAN
        private void CreateScalarBar()
        {
            // Initialize ScalarBar actor
            ScalarBar = vtkScalarBarActor.New();
            ScalarBar.SetLookupTable(colorLookupTable);

            // Assign default number of colors and label format
            ScalarBar.SetNumberOfLabels(10);
            ScalarBar.SetLabelFormat("%.2e");

            TextProp = vtkTextProperty.New();
            TextProp.SetFontSize(12);
            TextProp.SetBold(0);
            TextProp.SetFontFamilyToArial();
            TextProp.ItalicOff();
            TextProp.SetJustificationToLeft();
            TextProp.SetVerticalJustificationToBottom();
            TextProp.ShadowOff();
            TextProp.SetColor(1, 1, 1);

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

            // Assign default size of Scalar Bar
            ScalarBar.SetMaximumWidthInPixels(120);
            ScalarBar.SetPosition(0.015, 0.10);
            ScalarBar.SetPosition2(0.16, 0.90);

            //Hide ScalarBar
            ScalarBar.VisibilityOff();

            //Add to Viewport
            Viewport.AddActor2D(ScalarBar);
        }
コード例 #2
0
ファイル: RenderInterface.cs プロジェクト: ovevans/STAN
        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]);
        }
コード例 #3
0
        //Parameters for building a model

        private void BasicVTKBuilder(ref vtkActor actor, ref vtkPoints points, ref vtkCellArray polys,
                                     ref vtkFloatArray scalars, ref vtkLookupTable Luk, ref vtkActor2D actor2D)
        {
            int pointsNum = 0;

            TowerModelInstance.VTKDrawModel(ref points, ref polys, ref scalars, ref pointsNum, paras);

            vtkPolyData profile = vtkPolyData.New();

            profile.SetPoints(points);
            profile.SetPolys(polys);

            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();

            if (paras.RotateAngle == 0)
            {
                profile.GetCellData().SetScalars(scalars);
                mapper.SetInput(profile);
            }
            else
            {
                vtkRotationalExtrusionFilter refilter = vtkRotationalExtrusionFilter.New();
                profile.Update();
                profile.GetCellData().SetScalars(scalars);
                //profile.GetPointData().SetScalars(scalars);
                refilter.SetInput(profile);
                refilter.SetResolution(50);
                refilter.SetAngle(paras.RotateAngle);
                refilter.SetTranslation(0);
                refilter.SetDeltaRadius(0);

                mapper.SetInputConnection(refilter.GetOutputPort());
            }

            mapper.SetScalarRange(TowerModelInstance.GetColorGenColorTableMinvalue(),
                                  TowerModelInstance.GetColorGenColorTableMaxValue());
            actor.SetMapper(mapper);

            // This text property is for scalarBar
            vtkTextProperty textProperty = vtkTextProperty.New();

            //textProperty.SetFontFamilyToCourier();
            //textProperty.SetColor(1.0, 1.0, 0.5);
            textProperty.SetFontSize(10);

            vtkScalarBarActor scalarBar = vtkScalarBarActor.New();

            scalarBar.SetLookupTable(mapper.GetLookupTable());
            scalarBar.SetTitle("Color Table");
            scalarBar.SetNumberOfLabels(TowerModelInstance.GetColorGenColorTableSize());
            scalarBar.SetTitleTextProperty(textProperty);
            scalarBar.SetLabelTextProperty(textProperty);
            scalarBar.SetWidth(0.07);
            scalarBar.SetHeight(0.6);
            //scalarBar.SetDrawFrame(1);

            vtkLookupTable hueLut = vtkLookupTable.New();

            hueLut.SetTableRange(TowerModelInstance.GetColorGenColorTableMinvalue(),
                                 TowerModelInstance.GetColorGenColorTableMaxValue());
            hueLut.SetHueRange(0.667, 0);
            hueLut.SetSaturationRange(1, 1);
            hueLut.SetValueRange(1, 1);
            hueLut.SetNumberOfTableValues(TowerModelInstance.GetColorGenColorTableSize());
            hueLut.Build();

            mapper.SetLookupTable(hueLut);
            scalarBar.SetLookupTable(hueLut);

            // The actor links the data pipeline to the rendering subsystem
            actor2D = scalarBar;
            //actor.GetProperty().SetColor(0.388, 0.388, 0.388);
        }