Beispiel #1
0
        private void InitRenderer()
        {
            // Create the Renderer 3D control.
            //Renderer3D myRenderer3D = new Renderer3D();

            // Add the Renderer control to the panel
            // mainPanel.Controls.Clear();
            //mainPanel.Controls.Add(myRenderer3D);

            // Create a range for the graph generation
            Range range = new Range(-150, 150);
            int   steps = 50;

            // Build a nice surface to display with cool alpha colors
            // (alpha 0.8 for surface color and 0.5 for wireframe)
            Shape surface = Builder.buildOrthonomal(new OrthonormalGrid(range, steps, range, steps), new MyMapper());

            surface.ColorMapper        = new ColorMapper(new ColorMapRainbow(), surface.Bounds.zmin, surface.Bounds.zmax, new Color(1, 1, 1, 0.8));
            surface.FaceDisplayed      = true;
            surface.WireframeDisplayed = true;
            surface.WireframeColor     = Color.CYAN;
            surface.WireframeColor.mul(new Color(1, 1, 1, 0.5));

            // Create the chart and embed the surface within
            Chart chart = new Chart(myRenderer3D, Quality.Nicest);

            chart.Scene.Graph.Add(surface);
            axeLayout = chart.AxeLayout;

            // All activated by default
            DisplayXTicks     = true;
            DisplayXAxisLabel = true;
            DisplayYTicks     = true;
            DisplayYAxisLabel = true;
            DisplayZTicks     = true;
            DisplayZAxisLabel = true;
            DisplayTickLines  = true;

            // Create a mouse control
            nzy3D.Chart.Controllers.Mouse.Camera.CameraMouseController mouse = new nzy3D.Chart.Controllers.Mouse.Camera.CameraMouseController();
            mouse.addControllerEventListener(myRenderer3D);
            chart.addController(mouse);

            // This is just to ensure code is reentrant (used when code is not called in Form_Load but another reentrant event)
            DisposeBackgroundThread();

            // Create a thread to control the camera based on mouse movements
            t = new nzy3D.Chart.Controllers.Thread.Camera.CameraThreadController();
            t.addControllerEventListener(myRenderer3D);
            mouse.addSlaveThreadController(t);
            chart.addController(t);
            t.Start();

            // Associate the chart with current control
            myRenderer3D.setView(chart.View);

            this.Refresh();
        }
Beispiel #2
0
        public void InitRenderer()
        {
            // Create the Renderer 3D control.
            //Renderer3D myRenderer3D = new Renderer3D();

            //// Add the Renderer control to the panel
            //plotPanel.Controls.Clear();
            //plotPanel.Controls.Add(myRenderer3D);

            // Create a range for the graph generation
            int   x      = Math.Max(globalN, globalK);
            Range xRange = new Range(0, x * 10 - 1);
            int   xSteps = 30; //Math.Min(x * 2, 30);
            Range yRange = new Range(0, globalM * 20 - 1);
            int   ySteps = 30; //Math.Min(globalM * 2, 30);

            // Build a nice surface to display with cool alpha colors
            // (alpha 0.8 for surface color and 0.5 for wireframe)
            Shape surface = Builder.buildOrthonomal(new OrthonormalGrid(xRange, xSteps, yRange, ySteps), function);

            surface.ColorMapper        = new ColorMapper(new ColorMapRainbow(), surface.Bounds.zmin, surface.Bounds.zmax, new Color(1, 1, 1, 0.8));
            surface.FaceDisplayed      = true;
            surface.WireframeDisplayed = true;
            surface.WireframeColor     = Color.GRAY;
            surface.WireframeColor.mul(new Color(1, 1, 1, 0.5));

            // Create the chart and embed the surface within
            Chart chart = new Chart(renderer, Quality.Nicest);

            chart.Scene.Graph.Add(surface);
            axeLayout = chart.AxeLayout;

            // Create a mouse control
            nzy3D.Chart.Controllers.Mouse.Camera.CameraMouseController mouse = new nzy3D.Chart.Controllers.Mouse.Camera.CameraMouseController();
            mouse.addControllerEventListener(renderer);
            chart.addController(mouse);

            // This is just to ensure code is reentrant (used when code is not in Form_Load but another reentrant event)
            DisposeBackgroundThread();

            // Create a thread to control the camera based on mouse movements
            t = new CameraThreadController();
            t.addControllerEventListener(renderer);
            mouse.addSlaveThreadController(t);
            chart.addController(t);
            t.Start();

            // Associate the chart with current control
            renderer.setView(chart.View);
        }
 public bool handleSlaveThread(bool isDoucleClick)
 {
     if (isDoucleClick)
     {
         if (((_threadController != null)))
         {
             _threadController.Start();
             return(true);
         }
     }
     if (((_threadController != null)))
     {
         _threadController.StopT();
     }
     return(false);
 }
Beispiel #4
0
        private void InitRenderer()
        {
            // Create the Renderer 3D control.
            //Renderer3D myRenderer3D = new Renderer3D();

            // Add the Renderer control to the panel
            // mainPanel.Controls.Clear();
            //mainPanel.Controls.Add(myRenderer3D);

            // Create a range for the graph generation
            Range xRange = new Range(workTimeArr.Min(), workTimeArr.Max());
            Range yRange = new Range(wrArr.Min(), wrArr.Max());
            int   steps  = 50;

            // Build a nice surface to display with cool alpha colors
            // (alpha 0.8 for surface color and 0.5 for wireframe)
            MyMapper mapper = new MyMapper();

            mapper.coeff = coeffs;
            Shape surface = Builder.buildOrthonomal(new OrthonormalGrid(xRange, steps, yRange, steps), mapper);

            surface.ColorMapper        = new ColorMapper(new ColorMapRainbow(), surface.Bounds.zmin, surface.Bounds.zmax, new nzy3D.Colors.Color(1, 1, 1, 0.8));
            surface.FaceDisplayed      = true;
            surface.WireframeDisplayed = true;
            surface.WireframeColor     = Color.CYAN;
            surface.WireframeColor.mul(new Color(1, 1, 1, 0.5));

            // Create the chart and embed the surface within
            Chart chart = new Chart(myRenderer3D, Quality.Nicest);

            chart.Scene.Graph.Add(surface);


            Scatter scatter = new Scatter(coor.ToArray(), Color.RED, 10);

            chart.Scene.Graph.Add(scatter);


            IAxeLayout axeLayout = chart.AxeLayout;

            axeLayout.TickLineDisplayed   = true;
            axeLayout.XTickLabelDisplayed = true;
            axeLayout.YTickLabelDisplayed = true;
            axeLayout.ZTickLabelDisplayed = true;
            axeLayout.XAxeLabelDisplayed  = true;
            axeLayout.YAxeLabelDisplayed  = true;
            axeLayout.ZAxeLabelDisplayed  = true;
            axeLayout.XAxeLabel           = "Work time (secs)";
            axeLayout.YAxeLabel           = "Work rest ratio";
            axeLayout.ZAxeLabel           = "Cal per min";

            axeLayout = chart.AxeLayout;

            // Create a mouse control
            nzy3D.Chart.Controllers.Mouse.Camera.CameraMouseController mouse = new nzy3D.Chart.Controllers.Mouse.Camera.CameraMouseController();
            mouse.addControllerEventListener(myRenderer3D);
            chart.addController(mouse);

            // This is just to ensure code is reentrant (used when code is not called in Form_Load but another reentrant event)
            DisposeBackgroundThread();

            // Create a thread to control the camera based on mouse movements
            t = new nzy3D.Chart.Controllers.Thread.Camera.CameraThreadController();
            t.addControllerEventListener(myRenderer3D);
            mouse.addSlaveThreadController(t);
            chart.addController(t);
            t.Start();

            // Associate the chart with current control
            myRenderer3D.setView(chart.View);

            this.Refresh();
        }