Ejemplo n.º 1
0
        private void ResizeClick(object sender, RoutedEventArgs e)
        {
            if (myHull.Bulkheads.Count == 0)
            {
                MessageBox.Show("Can't resize a non-existant hull.");
                return;
            }

            EditableHull hull = new EditableHull(myHull);

            Size3D originalSize = hull.GetSize();

            ResizeWindow resize = new ResizeWindow(hull);

            resize.ShowDialog();

            if (resize.OK)
            {
                ResizeWindowData resizeData = (ResizeWindowData)resize.FindResource("ResizeData");
                double           scale_x    = 1.0;
                double           scale_y    = 1.0;
                double           scale_z    = 1.0;

                if (resizeData != null)
                {
                    scale_x = resizeData.Width / originalSize.X;
                    scale_y = resizeData.Height / originalSize.Y;
                    scale_z = resizeData.Length / originalSize.Z;

                    myHull.Scale(scale_x, scale_y, scale_z);
                    UpdateViews();
                }
            }
        }
Ejemplo n.º 2
0
        public ResizeWindow(EditableHull hull)
        {
            InitializeComponent();
            ResizeWindowData resizeData = (ResizeWindowData)this.FindResource("ResizeData");

            if (resizeData != null)
            {
                bool proportional = resizeData.Proportional;

                // Need to turn off Proportional for initial setup
                resizeData.Proportional = false;

                Size3D size = hull.GetSize();
                resizeData.Width        = size.X; // multiply by 2 because this is half-hull
                resizeData.Height       = size.Y;
                resizeData.Length       = size.Z;
                resizeData.Proportional = true;

                // Reset proportional
                resizeData.Proportional = proportional;
            }
        }