Exemplo n.º 1
0
        private void ShowRandomSceneWindow(object sender, EventArgs e)
        {
            if (ImageControler.IsLoadScene())
            {
                var randScene = new RandomSceneWindow(this, InputControler, ImageControler);
                randScene.Show();
            }
            else
            {
                string            message = "You have load scene, do you want save and create new?";
                string            caption = "Exist scene";
                MessageBoxButtons buttons = MessageBoxButtons.YesNoCancel;
                DialogResult      result  = MessageBox.Show(message, caption, buttons);

                if (result == DialogResult.Yes)
                {
                    ImageControler.SaveSceneControl();
                    var randScene = new RandomSceneWindow(this, InputControler, ImageControler);
                    randScene.Show();
                }
                else if (result == DialogResult.No)
                {
                    var randScene = new RandomSceneWindow(this, InputControler, ImageControler);
                    randScene.Show();
                }
            }
        }
Exemplo n.º 2
0
        public CameraEditWindow(ImageControler imageControler, InputFormControler inputFormControler)
        {
            this.inputFormControler = inputFormControler;
            this.imageControler     = imageControler;

            InitializeComponent();
            SetDataToComponents();
        }
Exemplo n.º 3
0
        public OwnSceneWindow(InitWindow initWindow, InputFormControler inputControler, ImageControler imageControler)
        {
            InputControler  = inputControler;
            ImageControler  = imageControler;
            this.initWindow = initWindow;

            InitializeComponent();
        }
Exemplo n.º 4
0
 public InitWindow(ImageControler imageControler, InputFormControler inputControler)
 {
     ImageControler = imageControler;
     InputControler = inputControler;
     InitializeComponent();
     canvas2D1.ImageControler     = imageControler;
     canvas2D1.InputFormControler = inputControler;
     BackColor = Color.Brown;
 }
Exemplo n.º 5
0
 private void SaveSceneBT_Click(object sender, EventArgs e)
 {
     if (!ImageControler.SaveSceneControl())
     {
         string message = "You must load or create scene ";
         string caption = "Error Detected in Rendering";
         ShowErrorMessage(message, caption);
     }
 }
Exemplo n.º 6
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Scene          scene          = new Scene();
            ImageControler imageControler = new ImageControler(scene);

            Application.Run(imageControler.InitWindow);
        }
Exemplo n.º 7
0
        public SceneEditWindow(InitWindow initWindow, InputFormControler inputControler, ImageControler imageControler)
        {
            InputControler  = inputControler;
            ImageControler  = imageControler;
            this.initWindow = initWindow;

            InitializeComponent();
            SetDataToComponets();
        }
Exemplo n.º 8
0
        public CuboidEditWindow(Cuboid cuboid, ImageControler imageControler, InputFormControler inputFormControler)
        {
            this.inputFormControler = inputFormControler;
            this.imageControler     = imageControler;
            this.cuboid             = cuboid;

            InitializeComponent();
            SetDataToComponents();
        }
Exemplo n.º 9
0
        public SphereEditWindow(Sphere sphere, int light, ImageControler imageControler, InputFormControler inputFormControler)
        {
            this.inputFormControler = inputFormControler;
            this.imageControler     = imageControler;
            this.sphere             = sphere;
            this.light = light;

            InitializeComponent();
            SetDataToComponents();
        }
Exemplo n.º 10
0
 private void AddLightBT_Click(object sender, EventArgs e)
 {
     if (!ImageControler.AddLightToSceneControl())
     {
         ShowErrorMessage("You must choose or create sceen for add", "Error Detected in Add to Scene");
     }
     else
     {
         RepaintCanvas();
     }
 }
Exemplo n.º 11
0
 private void D3ViewBT_Click(object sender, EventArgs e)
 {
     if (ImageControler.Scene?.Image != null || ImageControler.IsAvailableImage())
     {
         canvas2D1.Set3DScene();
     }
     else
     {
         ShowErrorMessage("You must render image for 3D view ", "Error Detected in Rendering");
     }
 }
Exemplo n.º 12
0
 private void EditScene_Click(object sender, EventArgs e)
 {
     if (!ImageControler.IsLoadScene())
     {
         var editScene = new SceneEditWindow(this, InputControler, ImageControler);
         editScene.Show();
     }
     else
     {
         ShowErrorMessage("You do not load scene for edit", "Edit Scene problem");
     }
 }
Exemplo n.º 13
0
 private void StartRenderingBT_Click(object sender, EventArgs e)
 {
     if (ImageControler.Scene?.Camera != null)
     {
         ImageControler.RenderImage(canvas2D1.Camera.Point.X, canvas2D1.Camera.Point.Y);
     }
     else
     {
         string message = "You must load or create scene ";
         string caption = "Error Detected in Rendering";
         ShowErrorMessage(message, caption);
     }
 }
Exemplo n.º 14
0
        private void ShowLoadSceneDialog(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.Filter = "Scene Files|*.xml";
            openFileDialog.Title  = "Select a scene File";


            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                string fileName = openFileDialog.FileName;
                ImageControler.LoadSceneFromFile(fileName);
                Show2DSceneClick(sender, e);
            }
        }
Exemplo n.º 15
0
        List <byte> GetReadyBytes(out byte[] protocol)
        {
            string answer;
            int    width  = Screen.PrimaryScreen.Bounds.Width;
            int    height = Screen.PrimaryScreen.Bounds.Height;
            //var bytes = ImageControler.GetScreenshotBytes(150,150);
            var         bytes       = ImageControler.GetScreenshotBytes();
            List <byte> newRgbValue = new List <byte>();
            var         tmp         = Utils.Packcage(bytes);

            answer   = String.Format("{3}x{0}x{1}x{2}|", width, height, tmp.Count(), "ScreenShot");
            protocol = Encoding.Unicode.GetBytes(answer);
            //newRgbValue.AddRange(bts);
            //newRgbValue.AddRange(tmp);
            return(tmp);
        }
Exemplo n.º 16
0
        private void LoadSceneButton_Click(object sender, EventArgs e)
        {
            if (ImageControler.IsLoadScene())
            {
                ShowLoadSceneDialog(sender, e);
            }
            else
            {
                string            message = "You have load scene, do you want save and create new?";
                string            caption = "Exist scene";
                MessageBoxButtons buttons = MessageBoxButtons.YesNoCancel;
                DialogResult      result  = MessageBox.Show(message, caption, buttons);

                if (result == DialogResult.Yes)
                {
                    ImageControler.SaveSceneControl();
                    ShowLoadSceneDialog(sender, e);
                }
                else if (result == DialogResult.No)
                {
                    ShowLoadSceneDialog(sender, e);
                }
            }
        }
Exemplo n.º 17
0
        List <byte> GetReadyBytes(out byte[] btProtocol)
        {
            string answer;
            int    width  = Screen.PrimaryScreen.Bounds.Width;
            int    height = Screen.PrimaryScreen.Bounds.Height;

            System.Drawing.Size Coords = Utils.GetRectangleSize(width, height);
            int countHorizontalBlocks  = width / Coords.Width;
            int countVerticalBlocks    = height / Coords.Height;
            int totalBlockCount        = countHorizontalBlocks * countVerticalBlocks;
            var bytes = ImageControler.GetScreenshotBytes();

            this.tmpShot = new ClientScreenShotData(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, bytes.ToArray());

            List <byte> newRgbValue = new List <byte>();
            DateTime    start       = DateTime.Now;

            if (this.screenShotData != null)
            {
                List <int> blocks     = ImageControler.ImageCompressor.getChanges(width, height, Coords.Width, Coords.Height, countHorizontalBlocks, countVerticalBlocks, totalBlockCount, bytes, this.screenShotData);
                var        readyBytes = Utils.Compress(ImageControler.ImageCompressor.byteCompressor(blocks, bytes, Coords.Width, Coords.Height, countHorizontalBlocks, countVerticalBlocks, width, height));
                btProtocol = Utils.GetArraysProtocol(blocks, width, height, readyBytes.Length);
                newRgbValue.AddRange(readyBytes);
                Console.WriteLine("{0}ms Length:{1}", (DateTime.Now - start).Milliseconds, newRgbValue.Count);
            }
            else
            {
                var tmp = Utils.Packcage(bytes);
                answer = String.Format("{3}x{0}x{1}x{2}|", width, height, tmp.Count(), "ScreenShot");
                var bts = Encoding.Unicode.GetBytes(answer);
                btProtocol = bts;
                newRgbValue.AddRange(tmp);
            }

            return(newRgbValue);
        }
Exemplo n.º 18
0
 public RenderManager(Scene scene, FileManipulator fileManipulator, ImageControler imageControler)
 {
     this.scene           = scene;
     this.fileManipulator = fileManipulator;
     this.imageControler  = imageControler;
 }
Exemplo n.º 19
0
 private void StopRenderingBT_Click(object sender, EventArgs e)
 {
     ImageControler.StopRenderingImage();
 }