Esempio n. 1
0
        public static ILPanelEditor AttachTo(ILPanel ilPanel, IPanelEditor editor = null)
        {
            var editorInstance = new ILPanelEditor(ilPanel, editor);
            editorInstance.Update();

            return editorInstance;
        }
Esempio n. 2
0
        private void comboBoxDemo_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (comboBoxDemo.SelectedIndex == -1)
                return;

            // Reset scene
            ilPanel.Scene = new ILScene();

            // Add and render demo content
            switch ((DemoEnum) comboBoxDemo.SelectedIndex)
            {
                case DemoEnum.LinePlot:
                {
                    ILPlotCube plotCube = ilPanel.Scene.Add(new ILPlotCube());
                    plotCube.Add(new ILLinePlot(ILMath.tosingle(ILMath.randn(1, 20))));
                    plotCube.Add(new ILLinePlot(ILMath.tosingle(ILMath.randn(1, 20) + 2.0), lineStyle: DashStyle.Dashed, markerStyle: MarkerStyle.Square));
                    plotCube.Add(new ILLegend("Line 1", "Line 2"));
                }
                    break;
                case DemoEnum.SincSurface:
                {
                    ILPlotCube plotCube = ilPanel.Scene.Add(new ILPlotCube(null, false));
                    plotCube.Add(new ILSurface(ILSpecialData.sincf(40, 60, 2.5f))
                    {
                        Wireframe = { Color = Color.FromArgb(50, Color.LightGray) },
                        Colormap = Colormaps.Jet
                    });
                    ilPanel.Scene.First<ILPlotCube>().Rotation = Matrix4.Rotation(new Vector3(1f, 0.23f, 1), 0.7f);
                }
                    break;
                case DemoEnum.Points:
                    ilPanel.Scene.Add(new ILPoints
                    {
                        Positions = ILMath.tosingle(ILMath.randn(3, 100)),
                        Color = Color.Green,
                        Size = 10
                    });
                    break;
                case DemoEnum.Gear:
                {
                    ILGear gear = ilPanel.Scene.Add(new ILGear());
                    gear.Rotate(Vector3.UnitY, -0.2);
                    gear.Transform = gear.Transform.Scale(0.7, 0.7, 0.7);
                }
                    break;
                default:
                    throw new ArgumentOutOfRangeException();
            }

            ilPanel.Scene.Configure();
            ilPanel.Refresh();

            // Attach ILNEditor
            editor = ILPanelEditor.AttachTo(ilPanel);
        }