コード例 #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
ファイル: DatasetUnit.cs プロジェクト: Netkidxp/TPLC
 protected DatasetUnit()
 {
     lookupTable = vtkLookupTable.New();
     lookupTable.SetNumberOfColors(100);
     lookupTable.SetHueRange(0.67, 0.0);
     lookupTable.Build();
     scalarBarActor.SetOrientationToHorizontal();
     scalarBarActor.SetLookupTable(lookupTable);
     scalarBarActor.SetTitle(fieldName);
     scalarBarActor.GetAnnotationTextProperty().SetColor(0, 0, 0);
     scalarBarActor.GetTitleTextProperty().SetColor(0, 0, 0);
     scalarBarActor.GetLabelTextProperty().SetColor(0, 0, 0);
     scalarBarActor.GetAnnotationTextProperty().SetFontSize(20);
     scalarBarActor.GetTitleTextProperty().SetFontSize(20);
     scalarBarActor.GetLabelTextProperty().SetFontSize(20);
     scalarBarActor.GetAnnotationTextProperty().SetFontFamilyToArial();
     scalarBarActor.GetTitleTextProperty().SetFontFamilyToArial();
     scalarBarActor.GetLabelTextProperty().SetFontFamilyToArial();
     scalarBarActor.GetAnnotationTextProperty().ItalicOff();
     scalarBarActor.GetTitleTextProperty().ItalicOff();
     scalarBarActor.GetLabelTextProperty().ItalicOff();
     scalarBarActor.GetAnnotationTextProperty().BoldOff();
     scalarBarActor.GetTitleTextProperty().BoldOff();
     scalarBarActor.GetLabelTextProperty().BoldOff();
     scalarBarActor.SetUnconstrainedFontSize(true);
     scalarBarActor.SetBarRatio(0.15);
     scalarBarActor.SetNumberOfLabels(11);
 }
コード例 #3
0
        //绘制色标
        private vtkScalarBarActor BuildScalarBar()
        {
            vtkScalarBarActor scalarBar = vtkScalarBarActor.New();

            scalarBar.SetLookupTable(m_LookupTable);
            //scalarBar.SetTitle("Color Scale");
            scalarBar.GetLabelTextProperty().SetFontSize(2);
            scalarBar.GetLabelTextProperty().SetFontFamilyToTimes();
            scalarBar.GetLabelTextProperty().SetItalic(0);
            scalarBar.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewport();
            //设置位置(笛卡尔坐标系)
            scalarBar.GetPositionCoordinate().SetValue(0.01, 0.5);
            //设置色标的标注数目
            scalarBar.SetNumberOfLabels(5);
            scalarBar.SetOrientationToVertical();
            scalarBar.SetWidth(0.12);
            scalarBar.SetHeight(0.5);

            return(scalarBar);
        }
コード例 #4
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);
        }
コード例 #5
0
ファイル: RenderInterface.cs プロジェクト: ovevans/STAN
 public void ChangeColorNumber(int numb)
 {
     colorLookupTable.SetNumberOfColors(numb);
     ScalarBar.SetNumberOfLabels(numb);
 }