Пример #1
0
        public void GetListRelatedDocumentTest()
        {
            var mockDrawing = new Mock<IClassDataManager<Drawing>>();
            var mockTechRoute = new Mock<IClassDataManager<TechRoute>>();
            var mockFabr = new Mock<IDataManagersFactory>();
            mockFabr.Setup(x => x.GetDataManager<Drawing>()).Returns(mockDrawing.Object);
            mockFabr.Setup(x => x.GetDataManager<TechRoute>()).Returns(mockTechRoute.Object);

            mockTechRoute.Setup(x => x.GetListCollection())
                .Returns(new List<TechRoute>()
                {
                    new TechRoute()
                    {
                        TechOperations = new List<TechOperation>()
                        {
                            new TechOperation() {ShortName = "A"},
                            new TechOperation() {ShortName = "B"},
                        }
                    }
                });

            DrawingController controller = new DrawingController(mockFabr.Object);
            var list = controller.GetListRelatedDocument<TechRoute>().ConvertAll(x => (TechRoute)x);
            TechRoute techRoute = list[0];

            Assert.NotNull(techRoute);
            Assert.AreEqual(techRoute.TechOperations.Count, 2);
        }
Пример #2
0
    public void OnDeleteButtonClicked()
    {
        if (selectedDrawing == null)
        {
            return;
        }

        DataLayer.DeleteFile(selectedDrawing.DrawingFile.Index);

        var index = drawings.IndexOf(selectedDrawing);

        drawings.Remove(selectedDrawing);
        Destroy(selectedDrawing.gameObject);
        selectedDrawing = null;
        if (drawings.Count > 0)
        {
            if (index < drawings.Count)
            {
                selectedDrawing = drawings[index];
                foreach (var d in drawings)
                {
                    d.Selected = d == selectedDrawing;
                }
            }
            else if (index - 1 >= 0)
            {
                selectedDrawing = drawings[index - 1];
                foreach (var d in drawings)
                {
                    d.Selected = d == selectedDrawing;
                }
            }
        }
    }
Пример #3
0
		public DrawingScene(Viewport viewport)
			: base(viewport)
		{
			Camera.SetViewDirection(ViewDirection.Standard);
			
			_controller = new DrawingController(this);
			
			EnableViewInteractor = true;
		}
Пример #4
0
    public void OnDrawingPanelClicked()
    {
        selectedDrawing = null;
        foreach (var d in drawings)
        {
            d.Selected = false;
        }

        CopyButton.Hide();
        DeleteButton.Hide();
    }
Пример #5
0
    // Use this for initialization
    private void Start( )
    {
        instance = this;
        draws    = new List <Draw> ( );

        // Create the list of draws and parent them to the right hand.
        for (int i = 0; i < constraint; i++)
        {
            CreateDraw((float)i);
        }
        countShown = constraint;
        transform.SetParent(PlayerCurriculum.instance.GetRightHand( ));
    }
Пример #6
0
        /// <summary>
        /// Event occurs when the pixel grid needs to be re-painted.
        /// </summary>
        private void pixelGrid_Paint(object sender, PaintEventArgs e)
        {
            // Initialize required objects
            SyntheticCamera   c      = new SyntheticCamera(_e, _g, _p, 15, 150, 45.0, 1.0, pixelGrid.Grid.Width, pixelGrid.Grid.Height);
            DrawingController drawer = new DrawingController(e.Graphics);
            RayTracer         ray    = new RayTracer(c, 1);

            int superWidth  = pixelGrid.Grid.Width * ray.ResolutionMultiplier;
            int superHeight = pixelGrid.Grid.Height * ray.ResolutionMultiplier;

            // Buffer holds the super width and super height colors to eventually avg and render.
            Color[,] buffer = new Color[superHeight, superWidth];

            // Loop through each pixel and trace a ray through it to find an intersection with the object
            Parallel.For(0, superHeight, (y) =>
            {
                Parallel.For(0, superWidth, (x) =>
                {
                    PointLight pointLight = new PointLight(Color.FromScRgb(1, 1, 1, 1), new Point3D(1000, 1000, 1000));
                    DirectionalLight sun  = new DirectionalLight(Color.FromScRgb(1, 1, 1, 1), new Vector3D(0, 0, -1));
                    buffer[y, x]          = ray.RayTrace(_objects, x, y, pointLight, sun);
                });
            });

            // Calculates the avg's of the super resolution buffer and displys to screen.
            for (int i = 0; i < buffer.GetLength(0); i += ray.ResolutionMultiplier)
            {
                for (int j = 0; j < buffer.GetLength(1); j += ray.ResolutionMultiplier)
                {
                    // Add all the rbg values for each super resolution block of points.
                    float r = 0, g = 0, b = 0;
                    for (int m = 0; m < ray.ResolutionMultiplier; ++m)
                    {
                        for (int n = 0; n < ray.ResolutionMultiplier; ++n)
                        {
                            r += buffer[i + m, j + n].ScR;
                            g += buffer[i + m, j + n].ScG;
                            b += buffer[i + m, j + n].ScB;
                        }
                    }

                    // Avg the block of points to 1 pixel
                    float avgR = (float)(r / Math.Pow(ray.ResolutionMultiplier, 2));
                    float avgG = (float)(g / Math.Pow(ray.ResolutionMultiplier, 2));
                    float avgB = (float)(b / Math.Pow(ray.ResolutionMultiplier, 2));

                    drawer.Color = Color.FromScRgb(1, avgR, avgG, avgB).ToDColor();
                    drawer.DrawPoint(new System.Drawing.Point(j / ray.ResolutionMultiplier, i / ray.ResolutionMultiplier));
                }
            }
        }
Пример #7
0
    public void OnCopyButtonClicked()
    {
        if (selectedDrawing == null)
        {
            return;
        }

        var file = DataLayer.DuplicateFile(selectedDrawing.DrawingFile.Index);

        selectedDrawing = AddDrawing(file);
        foreach (var d in drawings)
        {
            d.Selected = d == selectedDrawing;
        }
    }
Пример #8
0
    public void OnDrawingClicked(DrawingController drawing)
    {
        CopyButton.Show();
        DeleteButton.Show();

        if (drawing == selectedDrawing)
        {
            App.CurrentDrawingFile = drawing.DrawingFile;
            App.LoadScene(App.DrawingSceneIndex);
        }
        else
        {
            selectedDrawing = drawing;
            foreach (var d in drawings)
            {
                d.Selected = d == selectedDrawing;
            }
        }
    }
Пример #9
0
        public void NewRecipe()
        {
            CommonOpenFileDialog dialog = new CommonOpenFileDialog
            {
                IsFolderPicker = true,
            };

            if (dialog.ShowDialog() == CommonFileDialogResult.Ok)
            {
                Recipe newRecipe = _container.Resolve <Recipe>();
                newRecipe.Name = "Test";
                newRecipe.Path = dialog.FileName;

                foreach (string name in Properties.Settings.Default.DrawingNames)
                {
                    DrawingController newController = _container.Resolve <DrawingController>(
                        name,
                        new ResolverOverride[]
                    {
                        new ParameterOverride("drawing", _container.Resolve <IDrawing>(name)),
                    });

                    newRecipe.DrawingControllerMap.Add(name, newController);
                }

                foreach (string name in Properties.Settings.Default.AlgorithmNames)
                {
                    SpecController newController = _container.Resolve <SpecController>(
                        new ResolverOverride[]
                    {
                        new ParameterOverride("spec", _container.Resolve <ISpec>(name))
                    });

                    newRecipe.SpecControllerMap.Add(name, newController);
                }

                CurrentRecipe = newRecipe;
            }
        }
        //private DrawingTest dt;

        public MainWindow()
        {
            DataContext = this;
            InitializeComponent();

            this.Show();
            this.Topmost = true;

            drawingController = new DrawingController();
            drawingStatus     = new DrawingStatus();

            drawingStatus.eye.x = 0.0f;
            drawingStatus.eye.y = 5.0f;
            drawingStatus.eye.z = 25.0f;

            drawingStatus.kinect.x = 0.0f;
            drawingStatus.kinect.y = 0.34f;
            drawingStatus.kinect.z = 0.0f;

            drawingController.ChangeStatus(drawingStatus);

            // initialize kinect
            InitKinect();
        }
Пример #11
0
 private static void Drawings(EventArgs args)
 {
     DrawingController.Draw();
 }