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

            HullView hull = new HullView();

            Size3D originalSize = hull.GetSize();

            ResizeWindow resize = new ResizeWindow();

            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;

                    BaseHull.Instance().Scale(scale_x, scale_y, scale_z);
                    UpdateViews();
                }
            }
        }
Esempio n. 2
0
        private void OK_Click(object sender, RoutedEventArgs e)
        {
            UI_Params values = (UI_Params)this.FindResource("Curr_UI_Params");

            values.NewBulkheadExpanded = false;

            HullView editableHull = new HullView();

            editableHull.InsertBulkhead(values.NewBulkheadLoc);
        }
Esempio n. 3
0
        public HullControl()
        {
            InitializeComponent();

            sequence = ++SequenceCounter;

            m_editableHull     = null;
            m_bulkheadGeometry = new List <Geometry>();
            m_handles          = new List <RectangleGeometry>();

            m_mouseLoc = (NotifyPoint3D)FindResource("HullMouseLocation");
        }
        private void SetupPanels()
        {
            m_panels = new List <Panel>();
            Hull myHull = BaseHull.Instance();

            // Initialize the panels
            if (myHull != null && myHull.Bulkheads.Count != 0)
            {
                HullView eHull = new HullView();
                List <Point3DCollection> chines = eHull.GenerateChines();

                for (int index = 0; index < chines.Count / 2; index++)
                {
                    Panel p = new Panel(chines[index], chines[index + 1]);
                    p.name = "Panel " + (index + 1);
                    m_panels.Add(p);
                }

                int bulkheadIndex = 1;

                foreach (Bulkhead bulk in eHull.Bulkheads)
                {
                    if (bulk.Type != Bulkhead.BulkheadType.BOW)
                    {
                        Panel p = new Panel(bulk);
                        p.name = "Bulkhead " + bulkheadIndex;
                        bulkheadIndex++;
                        m_panels.Add(p);
                    }
                }
            }

            foreach (Panel panel in m_panels)
            {
                MenuItem item = new MenuItem();
                item.Header = panel.name;
                item.Click += AddPanelClick;
                PanelContextMenu.Items.Add(item);
            }
        }
        public ResizeWindow()
        {
            InitializeComponent();
            ResizeWindowData resizeData = (ResizeWindowData)this.FindResource("ResizeData");

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

                // 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;
            }
        }