private void surfaceButton1_Click(object sender, RoutedEventArgs e)
        {
            bool error = false;
            try
            {
                List<IHapticObject> selectedObjs = HaptiQsManager.Instance.getSelectedObjects();
                HapticShape link = new HapticLink((HapticShape) selectedObjs[selectedObjs.Count - 2],
                    (HapticShape) selectedObjs[selectedObjs.Count - 1], 
                    surfaceCheckBox1.IsChecked.Value);
                link.color(Helper.getBrush(_currentColor));
                _grid.Children.Add(link);
            }
            catch (FormatException fe)
            {
                error = true;
                surfaceButton1.Background = Brushes.Red;
            }

            if (!error)
                this.Close();
        }
Exemple #2
0
        private void addTestObjects()
        {
            HapticShape rectangle = new HapticRectangle(700, 450, 100, 70);
            rectangle.color(Brushes.Brown);
            Container.Children.Add(rectangle);

            HapticShape circle = new HapticCircle(1050, 250, 50);
            circle.color(Brushes.Yellow);
            Container.Children.Add(circle);

            HapticShape circle1 = new HapticCircle(900, 750, 80);
            circle1.color(Brushes.Purple);
            Container.Children.Add(circle1);

            HapticShape link = new HapticLink(rectangle, circle, true);
            link.color(Brushes.White);
            Container.Children.Add(link);

            HapticShape link1 = new HapticLink(circle1, circle, false);
            link1.color(Brushes.White);
            link1.thickness(10);
            Container.Children.Add(link1);

            HapticShape rectangle1 = new HapticRectangle(500, 150, 200, 180);
            rectangle1.color(Brushes.LightCoral);
            rectangle1.registerAction(new BasicAction("This is a test - add any information you want"));
            Container.Children.Add(rectangle1);

            HapticShape rectangle2 = new HapticRectangle(200, 100, 150, 150);
            rectangle2.color(Brushes.LightCoral);
            rectangle2.registerAction(new BasicAction("Other information you can add"));
            Container.Children.Add(rectangle2);

            HapticShape link2 = new HapticLink(rectangle1, rectangle2, false);
            link2.color(Brushes.Orange);
            link2.thickness(15);
            Container.Children.Add(link2);

            HapticShape circle2 = new HapticCircle(450, 450, 100);
            circle2.color(Brushes.Linen);
            Container.Children.Add(circle2);


            //HapticShape line = new HapticLine(new Point(10, 30), new Point(100, 30));
            //line.color(Brushes.White);
            //Container.Children.Add(line);

            //List<Point> points = new List<Point>();
            //points.Add(new Point(10, 70));
            //points.Add(new Point(60, 130));
            //points.Add(new Point(60, 200));
            //points.Add(new Point(180, 380));
            //HapticShape polyline = new HapticPolyline(points);
            //polyline.color(Brushes.Yellow);
            //Container.Children.Add(polyline);
        }