示例#1
0
    void Show3D(Tables.Denso.Table3D table)
    {
        if (table == null)
            return;

        navbarwidget.CurrentPos = table.Location;

        navbarwidget.SetMarkedPositions (new int[] { table.RangeX.Pos, table.RangeY.Pos, table.RangeZ.Pos });

        var valuesZ = table.GetValuesZasFloats ();
        var tableUI = new GtkWidgets.TableWidget3D (coloring, table.ValuesX, table.ValuesY, valuesZ,
                          table.Xmin, table.Xmax, table.Ymin, table.Ymax, table.Zmin, table.Zmax);
        tableUI.TitleMarkup = Util.Markup.NameUnit_Large (table.Title, table.UnitZ);
        tableUI.AxisXMarkup = Util.Markup.NameUnit (table.NameX, table.UnitX);
        tableUI.AxisYMarkup = Util.Markup.NameUnit (table.NameY, table.UnitY);
        tableUI.FormatValues = ScoobyRom.Data.AutomaticValueFormat (valuesZ, table.Zmin, table.Zmax);

        // Viewport needed for ScrolledWindow to work as generated table widget has no scroll support
        var viewPort = new Gtk.Viewport ();
        viewPort.Add (tableUI.Create ());

        Gtk.Widget previous = this.scrolledwindowTable3D.Child;
        if (previous != null)
            this.scrolledwindowTable3D.Remove (previous);
        // previous.Dispose () or previous.Destroy () cause NullReferenceException!

        this.scrolledwindowTable3D.Add (viewPort);
        this.scrolledwindowTable3D.ShowAll ();
    }