Example #1
0
        public void createClick(object sender, RoutedEventArgs e)
        {
            //Point loc = GetMousePosition();

            CreateHullDialog createHullDialog = new CreateHullDialog();

            //createHullDialog.Top = loc.Y;
            //createHullDialog.Left = loc.X;
            if (createHullDialog.ShowDialog() == true)
            {
                CreateHullData data = (CreateHullData)this.FindResource("CreateHullData");
                if (data != null)
                {
                    Hull tempHull = new Hull(data);
                    BaseHull.Instance().Bulkheads = tempHull.Bulkheads;

                    undoLog.Clear();
                    undoLog.Add(BaseHull.Instance());

                    redoLog.Clear();

                    UpdateViews();
                }
            }
        }
Example #2
0
        private void createClick(object sender, RoutedEventArgs e)
        {
            Point loc = GetMousePosition();

            CreateHullDialog createHullDialog = new CreateHullDialog();

            createHullDialog.Top  = loc.Y;
            createHullDialog.Left = loc.X;
            if (createHullDialog.ShowDialog() == true)
            {
                CreateHullData data = (CreateHullData)this.FindResource("CreateHullData");
                if (data != null)
                {
                    myHull = new Hull(data);
                    myHull.PropertyChanged += hull_PropertyChanged;
                    myHull.SetBulkheadHandler();

                    undoLog.Clear();
                    undoLog.Add(myHull);

                    redoLog.Clear();

                    UpdateViews();
                }
            }
        }
Example #3
0
        public Hull(CreateHullData setup)
        {
            Point3DCollection points = new Point3DCollection();
            double            height = 0;
            double            width  = 0;
            double            Z      = 0;

            Bulkheads = new List <Bulkhead>();

            if (setup.IncludeBow)
            {
                Z     = 0;
                width = 0;
                for (int ii = 0; ii < setup.NumChines + 1; ii++)
                {
                    points.Add(new Point3D(width, height, Z));
                    height += setup.Height / setup.NumChines;
                }
                Bulkheads.Add(new Bulkhead(points, Bulkhead.BulkheadType.BOW));
            }

            // Vertical bulkheads
            while (Bulkheads.Count < setup.NumBulkheads - 1)
            {
                points.Clear();
                Z      = Bulkheads.Count * setup.Length / setup.NumBulkheads;
                width  = 0;
                height = 0;
                for (int ii = 0; ii < setup.NumChines + 1; ii++)
                {
                    points.Add(new Point3D(width, height, Z));
                    width  += setup.Width / setup.NumChines;
                    height += setup.Height / setup.NumChines;
                }
                Bulkheads.Add(new Bulkhead(points, Bulkhead.BulkheadType.VERTICAL));
            }

            // Transom
            points.Clear();
            Z      = Bulkheads.Count * setup.Length / setup.NumBulkheads;
            width  = 0;
            height = 0;
            for (int ii = 0; ii < setup.NumChines + 1; ii++)
            {
                points.Add(new Point3D(width, height, Z + height * Math.Cos(Math.PI / 180 * setup.TransomAngle)));
                width  += setup.Width / setup.NumChines;
                height += setup.Height / setup.NumChines;
            }
            Bulkheads.Add(new Bulkhead(points, Bulkhead.BulkheadType.TRANSOM));
        }
Example #4
0
        public Hull(CreateHullData setup)
        {
            Point3DCollection points = new Point3DCollection();
            double            height = 0;
            double            width  = 0;
            double            Z      = 0;

            Bulkheads = new List <Bulkhead>();

            Timestamp = DateTime.Now;

            if (setup.IncludeBow)
            {
                points.Clear();
                Z     = 0;
                width = 0;
                for (int ii = 0; ii < setup.NumChines + 1; ii++)
                {
                    height = ii * setup.Height / setup.NumChines;
                    points.Add(new Point3D(width, height, Z));
                }
                Bulkheads.Add(new Bulkhead(points, Bulkhead.BulkheadType.BOW, setup.FlatBottom, setup.ClosedTop));
            }
            else
            {
                points.Clear();
                Z = setup.Height * Math.Cos(Math.PI / 180 * setup.TransomAngle);
                for (int ii = 0; ii < setup.NumChines + 1; ii++)
                {
                    if (ii == setup.NumChines && setup.ClosedTop)
                    {
                        width = 0;
                    }
                    else if (ii == 0 && setup.FlatBottom)
                    {
                        width = setup.Width / (setup.NumChines + 1);
                    }
                    else
                    {
                        width = ii * setup.Width / setup.NumChines;
                    }

                    height = ii * setup.Height / setup.NumChines;

                    points.Add(new Point3D(width, height, Z - height * Math.Cos(Math.PI / 180 * setup.TransomAngle)));
                }
                Bulkheads.Add(new Bulkhead(points, Bulkhead.BulkheadType.TRANSOM, setup.FlatBottom, setup.ClosedTop));
                CheckTransom();
            }

            // Vertical bulkheads
            while (Bulkheads.Count < setup.NumBulkheads - 1)
            {
                points.Clear();
                Z = Bulkheads.Count * setup.Length / (setup.NumBulkheads - 1);
                for (int ii = 0; ii < setup.NumChines + 1; ii++)
                {
                    if (ii == setup.NumChines && setup.ClosedTop)
                    {
                        width = 0;
                    }
                    else if (ii == 0 && setup.FlatBottom)
                    {
                        width = setup.Width / (setup.NumChines + 1);
                    }
                    else
                    {
                        width = ii * setup.Width / setup.NumChines;
                    }

                    height = ii * setup.Height / setup.NumChines;

                    points.Add(new Point3D(width, height, Z));
                }
                Bulkheads.Add(new Bulkhead(points, Bulkhead.BulkheadType.VERTICAL, setup.FlatBottom, setup.ClosedTop));
            }

            // Transom
            if (setup.IncludeTransom)
            {
                points.Clear();
                Z = setup.Length - setup.Height * Math.Cos(Math.PI / 180 * setup.TransomAngle);
                for (int ii = 0; ii < setup.NumChines + 1; ii++)
                {
                    if (ii == setup.NumChines && setup.ClosedTop)
                    {
                        width = 0;
                    }
                    else if (ii == 0 && setup.FlatBottom)
                    {
                        width = setup.Width / (setup.NumChines + 1);
                    }
                    else
                    {
                        width = ii * setup.Width / setup.NumChines;
                    }

                    height = ii * setup.Height / setup.NumChines;

                    points.Add(new Point3D(width, height, Z + height * Math.Cos(Math.PI / 180 * setup.TransomAngle)));
                }
                Bulkheads.Add(new Bulkhead(points, Bulkhead.BulkheadType.TRANSOM, setup.FlatBottom, setup.ClosedTop));
                CheckTransom();
            }
            else
            {
                points.Clear();
                Z     = setup.Length;
                width = 0;
                for (int ii = 0; ii < setup.NumChines + 1; ii++)
                {
                    height = ii * setup.Height / setup.NumChines;
                    points.Add(new Point3D(width, height, Z));
                }
                Bulkheads.Add(new Bulkhead(points, Bulkhead.BulkheadType.BOW, setup.FlatBottom, setup.ClosedTop));
            }

            SetBulkheadHandler();
        }