public static Box AddNodeEx(this Container p, double w, double h, string s)
        {
            var box       = p.AddBox(w, h);
            var node_data = new NodeData();

            node_data.Text = s;
            box.Data       = node_data;
            return(box);
        }
Example #2
0
        public OutputView(List <Package> _Packages, DeviceSelector _screen, MainWindow parent)
        {
            Packages.AddRange(_Packages);
            ContainerObject = LoadedContainer.GetModel(Rand);
            InitializeComponent();

            this.parent    = parent;
            previousscreen = _screen;

            Packages = Packages.OrderByDescending(b => b.Volume()).ToList();

            foreach (Package box in Packages.ToArray())
            {
                if (!LoadedContainer.AddBox(box))
                {
                    StepListBox.Items.Add("This Container could not be loaded with these packages.");
                    return;
                }
            }
            foreach (Package box in Packages.ToArray())
            {
                StepListBox.Items.Add(string.Concat("Load ", box.Name, " at the shown location"));
                AllPackageVisuals.Add(box.GetModel(Rand));
            }
            ModelGroup.Children.Add(AllPackageVisuals[0]);
            ModelGroup.Children.Add(ContainerObject);
            ShownStepModel.Content         = ModelGroup;
            StepSlider.Maximum             = Packages.Count();
            StepSlider.Minimum             = 1;
            StepSlider.IsSnapToTickEnabled = true;
            StepSlider.TickFrequency       = 1;


            HorizontalAngleSlider.Value = HorizontalAngle;
            VerticalAngleSlider.Value   = VerticalAngle;
            DistanceSlider.Value        = CameraDistance;

            myPerspectiveCamera.FieldOfView = 60;

            ViewArea.Camera = myPerspectiveCamera;

            SetCameraLocation();
        }