public ActivateFixityDialog( SlopeDefineCanvas canvas , DrawingPoint p )
        {
            InitializeComponent();

            this.canvas = canvas;

            this.p = p;

            MaterialBlock parent = canvas.Substructs.Find( delegate( MaterialBlock mb ) { return mb.Material.Name != "NULL" && mb.BoundaryPoints.Contains( p ); } );

            isFixedX.IsEnabled = parent != null && p.IsFixedX;
            isFixedY.IsEnabled = parent != null && p.IsFixedY;
            isFixedX.IsChecked = parent != null && p.IsFixActiveX;
            isFixedY.IsChecked = parent != null && p.IsFixActiveY;

            List<LineConstraint> attachedLCs = new List<LineConstraint>();
            canvas.Substructs.ForEach(
                delegate( MaterialBlock mb )
                {
                    attachedLCs.AddRange( mb.LineConstraints.FindAll( delegate( LineConstraint lc ) { return lc.Nodes.Contains( p ); } ) );
                } );
            attachedLCs.ForEach(
                delegate( LineConstraint lc )
                {
                    if ( lc.IsActiveX ) isFixedX.IsEnabled = false;
                    if ( lc.IsActiveY ) isFixedY.IsEnabled = false;
                } );
            attachedLCs.Clear();
        }
        public ActivateFixityDialog( SlopeDefineCanvas canvas , LineConstraint lc )
        {
            InitializeComponent();

            this.canvas = canvas;

            this.lc = lc;

            MaterialBlock parent = canvas.Substructs.Find( delegate( MaterialBlock mb ) { return mb.Material.Name != "NULL" && mb.LineConstraints.Contains( lc ); } );

            isFixedX.IsEnabled = parent != null && lc.IsFixedX;
            isFixedY.IsEnabled = parent != null && lc.IsFixedY;
            isFixedX.IsChecked = parent != null && lc.IsActiveX;
            isFixedY.IsChecked = parent != null && lc.IsActiveY;
        }
        public FactorPointLoadDialog( SlopeDefineCanvas canvas , PointLoad load )
        {
            InitializeComponent();

            this.canvas = canvas;
            this.load = load;

            // get units dependent scaling factor and strings
            double factor;
            string coordUnits , loadUnits;
            switch ( canvas.Units )
            {
                case Units.Metres: factor = 0.0254; coordUnits = "m"; loadUnits = "kN"; break;
                case Units.Millimetres: factor = 25.4; coordUnits = "mm"; loadUnits = "kN"; break;
                case Units.Feet: factor = 1.0 / 12.0; coordUnits = "ft"; loadUnits = "lbf"; break;
                default: factor = 1.0; coordUnits = "in"; loadUnits = "lbf"; break;
            }

            // set units labels
            nodeUnits.Content = coordUnits;
            xLoadUnits.Content = loadUnits;
            yLoadUnits.Content = loadUnits;

            // set node coordinates
            double xCoord , yCoord;
            xCoord = (load.Node.Point.X - canvas.OriginOffsetX) / canvas.DpiX * factor * canvas.Scale;
            yCoord = (canvas.ActualHeight - load.Node.Point.Y - canvas.OriginOffsetY) / canvas.DpiY * factor * canvas.Scale;
            coords.Content = string.Format( "({0}, {1})" , Math.Round( xCoord , 2 ) , Math.Round( yCoord , 2 ) );

            // set existing load values (if present)
            MaterialBlock parent = canvas.Substructs.Find( delegate( MaterialBlock mb ) { return mb.Material.Name != "NULL" && mb.PointLoads.Contains( load ); } );
            isLoadedX.IsEnabled = parent != null && load.IsLoadedX;
            isLoadedX.IsChecked = xFactor.IsEnabled = parent != null && load.IsActiveX;
            xFactor.Text = string.Format( "{0}" , Math.Round( load.XFactor , 3 ) );
            xLoad.Text = string.Format( "{0}" , Math.Round( load.XLoad , 2 ) );
            isLoadedY.IsEnabled = parent != null && load.IsLoadedY;
            isLoadedY.IsChecked = yFactor.IsEnabled = parent != null && load.IsActiveY;
            yFactor.Text = string.Format( "{0}" , Math.Round( load.YFactor , 3 ) );
            yLoad.Text = string.Format( "{0}" , Math.Round( load.YLoad , 2 ) );
        }
Beispiel #4
0
        public DrawingPoint( SlopeDefineCanvas canvas , MaterialBlock parent , Point pt )
        {
            this.defineCanvas = canvas;
            this.parentBlocks = new List<MaterialBlock>() { parent };
            this.point = pt;

            fixLines = new List<Polyline>();
            Polyline newLine;
            for ( int i = 0 ; i < 4 ; i++ )
            {
                newLine = new Polyline();
                newLine.Visibility = Visibility.Hidden;
                newLine.Fill = Brushes.Blue;
                newLine.Opacity = 1.0;
                newLine.StrokeThickness = 1.5;
                newLine.Stroke = Brushes.Blue;
                fixLines.Add( newLine );
                canvas.Children.Add( newLine );

                newLine.MouseLeftButtonUp += new MouseButtonEventHandler( fixLines_MouseLeftButtonUp );
            }

            fixLines[0].Points.Add( new Point( point.X - 7 , point.Y - 3.5 ) );
            fixLines[0].Points.Add( new Point( point.X + 7 , point.Y - 3.5 ) );

            fixLines[1].Points.Add( new Point( point.X - 7 , point.Y + 3.5 ) );
            fixLines[1].Points.Add( new Point( point.X + 7 , point.Y + 3.5 ) );

            fixLines[2].Points.Add( new Point( point.X - 3.5 , point.Y + 7 ) );
            fixLines[2].Points.Add( new Point( point.X - 3.5 , point.Y - 7 ) );

            fixLines[3].Points.Add( new Point( point.X + 3.5 , point.Y + 7 ) );
            fixLines[3].Points.Add( new Point( point.X + 3.5 , point.Y - 7 ) );

            dot = new Ellipse();
            dot.HorizontalAlignment = HorizontalAlignment.Left;
            dot.VerticalAlignment = VerticalAlignment.Top;
            dot.Height = 7;
            dot.Width = 7;
            dot.Margin = new Thickness( point.X - 0.5 * dot.Width , point.Y - 0.5 * dot.Height , 0 , 0 );
            dot.Stroke = Brushes.Black;
            dot.Fill = Brushes.Black;
            dot.Opacity = 0.7;
            dot.Visibility = Visibility.Hidden;
            dot.MouseLeftButtonDown += new MouseButtonEventHandler( MouseLeftButtonDown );

            canvas.Children.Add( dot );
        }
Beispiel #5
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="canvas">Parent drawing canvas</param>
        /// <param name="node">Parent node</param>
        /// <param name="isLoadedX">Is load applied in the horizontal direction?</param>
        /// <param name="xLoad">Value of horizontal load</param>
        /// <param name="isLoadedY">Is load applied in the vertical direction?</param>
        /// <param name="yLoad">Value of vertical load</param>
        public PointLoad( SlopeDefineCanvas canvas , DrawingPoint node ,
                                bool isLoadedX , double xLoad ,
                                bool isLoadedY , double yLoad )
        {
            // set parent drawing canvas
            this.defineCanvas = canvas;

            // set parent node
            this.Node = node;

            // create plotting lines for constraints
            loadLines = new List<Polyline>();
            Polyline newLine;
            for ( int i = 0 ; i < 6 ; i++ )
            {
                newLine = new Polyline();
                newLine.Visibility = Visibility.Hidden;
                newLine.Fill = Brushes.Blue;
                newLine.Opacity = 1.0;
                newLine.StrokeThickness = 1.75;
                newLine.Stroke = Brushes.Blue;
                newLine.Points.Add( new Point() );
                newLine.Points.Add( new Point() );
                loadLines.Add( newLine );
                canvas.Children.Add( newLine );

                newLine.MouseLeftButtonUp += new MouseButtonEventHandler( MouseLeftButtonUp );
            }

            // set load state
            this.IsLoadedX = isLoadedX;
            if ( this.IsLoadedX ) this.XFactor = 1.0;
            this.XLoad = xLoad;
            this.IsLoadedY = isLoadedY;
            if ( this.IsLoadedY ) this.YFactor = 1.0;
            this.YLoad = yLoad;

            // Add the point load to all blocks that contain its point
            List<MaterialBlock> parents = canvas.Substructs.FindAll( delegate( MaterialBlock mb ) { return mb.BoundaryPoints.Contains( node ); } );
            foreach ( MaterialBlock pmb in parents )
            {
                if ( !pmb.PointLoads.Contains( this ) ) pmb.PointLoads.Add( this );
            }

            Update();
        }
Beispiel #6
0
        public MaterialBlock( SlopeDefineCanvas canvas , MaterialType mtl , Point[] pts )
        {
            this.defineCanvas = canvas;

            Boundary = new Polygon();
            boundaryPoints = new List<DrawingPoint>();
            Boundary.Stroke = Brushes.Black;
            Boundary.StrokeThickness = 0.8;
            Boundary.StrokeLineJoin = PenLineJoin.Round;
            Boundary.StrokeStartLineCap = PenLineCap.Round;
            Boundary.StrokeEndLineCap = PenLineCap.Round;
            Boundary.Fill = mtl.Fill;
            Boundary.Opacity = 0.8;
            Boundary.Visibility = Visibility.Visible;

            for ( int i = 0 ; i < pts.Length ; i++ )
            {
                // check if point is same as existing point
                bool foundPoint = false;
                foreach ( MaterialBlock mb in canvas.Substructs )
                {
                    foreach ( DrawingPoint p in mb.BoundaryPoints )
                    {
                        if ( (pts[i] - p.Point).Length < p.Dot.Width / 2 )
                        {
                            Boundary.Points.Add( p.Point );
                            boundaryPoints.Add( p );
                            p.ParentBlocks.Add( this );
                            foundPoint = true;
                            break;
                        }
                    }
                    if ( foundPoint ) break;
                }

                if ( !foundPoint )
                {
                    Boundary.Points.Add( pts[i] );
                    boundaryPoints.Add( new DrawingPoint( canvas , this , pts[i] ) );
                }
            }

            Material = mtl;

            lineConstraints = new List<LineConstraint>();
            lineLoads = new List<LineLoad>();
            pointLoads = new List<PointLoad>();

            foreach ( MaterialBlock mb in canvas.Substructs )
            {
                if ( mb == this ) continue;

                foreach ( LineConstraint lc in mb.LineConstraints )
                {
                    if ( this.BoundaryPoints.Contains( lc.Nodes[0] ) && this.BoundaryPoints.Contains( lc.Nodes[1] ) )
                    {
                        if ( !this.LineConstraints.Contains( lc ) ) this.LineConstraints.Add( lc );
                    }
                }
            }

            SortPoints();
        }
Beispiel #7
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="canvas">Parent drawing canvas</param>
        /// <param name="p1">Node 1 (assumed to be sorted CCW)</param>
        /// <param name="p2">Node 2 (assumed to be sorted CCW)</param>
        /// <param name="isLoadedN">Is load applied in the normal direction?</param>
        /// <param name="nLoad1">Value of normal load at node 1.</param>
        /// <param name="nLoad2">Value of normal load at node 2.</param>
        /// <param name="isLoadedT">Is load applied in the tangential direction?</param>
        /// <param name="tLoad1">Value of tangential load at node 1.</param>
        /// <param name="tLoad2">Value of tangential load at node 2.</param>
        public LineLoad( SlopeDefineCanvas canvas ,
                                DrawingPoint p1 , DrawingPoint p2 ,
                                bool isLoadedN ,
                                double nLoad1 , double nLoad2 ,
                                bool isLoadedT ,
                                double tLoad1 , double tLoad2 )
        {
            // set parent drawing canvas
            this.defineCanvas = canvas;

            // create list of boundary nodes for the load
            Nodes = new List<DrawingPoint>() { p1 , p2 };

            PlotPoints = new List<Point>() { new Point() , new Point() , new Point() };

            // create plotting lines for loads
            loadLines = new List<Polyline>();
            Polyline newLine;
            for ( int i = 0 ; i < 18 ; i++ )
            {
                newLine = new Polyline();
                newLine.Visibility = Visibility.Hidden;
                newLine.Fill = Brushes.Blue;
                newLine.Opacity = 1.0;
                newLine.StrokeThickness = 1.25;
                newLine.Stroke = Brushes.Blue;
                newLine.Points.Add( new Point() );
                newLine.Points.Add( new Point() );
                loadLines.Add( newLine );
                canvas.Children.Add( newLine );

                newLine.MouseLeftButtonUp += new MouseButtonEventHandler( MouseLeftButtonUp );
            }

            // set load state
            this.IsLoadedN = isLoadedN;
            if ( this.IsLoadedN ) this.NFactor = 1.0;
            this.NLoad1 = nLoad1;
            this.NLoad2 = nLoad2;
            this.TFactor = 1.0;
            this.IsLoadedT = isLoadedT;
            if ( this.IsLoadedT ) this.TFactor = 1.0;
            this.TLoad1 = tLoad1;
            this.TLoad2 = tLoad2;

            // Add the constraint to all blocks that contain both of its points
            List<MaterialBlock> parents = canvas.Substructs.FindAll( delegate( MaterialBlock mb ) { return mb.BoundaryPoints.Contains( p1 ) && mb.BoundaryPoints.Contains( p2 ); } );
            foreach ( MaterialBlock pmb in parents )
            {
                if ( !pmb.LineLoads.Contains( this ) ) pmb.LineLoads.Add( this );
            }

            Update();
        }
Beispiel #8
0
        public LineConstraint( SlopeDefineCanvas canvas ,
                                DrawingPoint p1 , DrawingPoint p2 ,
                                bool fixX , bool fixY )
        {
            // set parent drawing canvas
            this.defineCanvas = canvas;

            // create list of boundary nodes for the constraint
            Nodes = new List<DrawingPoint>() { p1 , p2 };

            // set constraints on boundary nodes
            Nodes[0].IsFixedX = fixX || Nodes[0].IsFixedX;
            Nodes[0].IsFixedY = fixY || Nodes[0].IsFixedY;
            Nodes[1].IsFixedX = fixX || Nodes[1].IsFixedX;
            Nodes[1].IsFixedY = fixY || Nodes[1].IsFixedY;

            // compute the point at which to plot the constraint
            MidPoint = new Point( 0.5 * (p1.Point.X + p2.Point.X) , 0.5 * (p1.Point.Y + p2.Point.Y) );

            // create plotting lines for constraints
            fixLines = new List<Polyline>();
            Polyline newLine;
            for ( int i = 0 ; i < 4 ; i++ )
            {
                newLine = new Polyline();
                newLine.Visibility = Visibility.Hidden;
                newLine.Fill = Brushes.Blue;
                newLine.Opacity = 1.0;
                newLine.StrokeThickness = 1.5;
                newLine.Stroke = Brushes.Blue;
                fixLines.Add( newLine );
                canvas.Children.Add( newLine );

                newLine.MouseLeftButtonUp += new MouseButtonEventHandler( MouseLeftButtonUp );
            }

            fixLines[0].Points.Add( new Point( MidPoint.X - 7 , MidPoint.Y - 3.5 ) );
            fixLines[0].Points.Add( new Point( MidPoint.X + 7 , MidPoint.Y - 3.5 ) );

            fixLines[1].Points.Add( new Point( MidPoint.X - 7 , MidPoint.Y + 3.5 ) );
            fixLines[1].Points.Add( new Point( MidPoint.X + 7 , MidPoint.Y + 3.5 ) );

            fixLines[2].Points.Add( new Point( MidPoint.X - 3.5 , MidPoint.Y + 7 ) );
            fixLines[2].Points.Add( new Point( MidPoint.X - 3.5 , MidPoint.Y - 7 ) );

            fixLines[3].Points.Add( new Point( MidPoint.X + 3.5 , MidPoint.Y + 7 ) );
            fixLines[3].Points.Add( new Point( MidPoint.X + 3.5 , MidPoint.Y - 7 ) );

            // Add the constraint to all blocks that contain both of its points
            List<MaterialBlock> parents = canvas.Substructs.FindAll( delegate( MaterialBlock mb ) { return mb.BoundaryPoints.Contains( p1 ) && mb.BoundaryPoints.Contains( p2 ); } );
            foreach ( MaterialBlock pmb in parents )
            {
                if ( !pmb.LineConstraints.Contains( this ) ) pmb.LineConstraints.Add( this );
            }

            // set visibility of constraints
            this.IsFixedX = fixX;
            this.IsFixedY = fixY;
        }
        public DefineAnalysisWindow( Window owner , SlopeCanvas canvas )
        {
            InitializeComponent();

            this.Owner = owner;
            this.canvas = canvas;
            materialTypes = canvas.MaterialTypes;

            // Create Grid to contain two axes, info block, and plotting canvas
            Grid inputGrid = new Grid();
            inputGrid.HorizontalAlignment = HorizontalAlignment.Stretch;
            inputGrid.VerticalAlignment = VerticalAlignment.Stretch;
            inputGrid.Background = Brushes.WhiteSmoke;
            inputGrid.Margin = new Thickness( 0 , menuPanel.Height , 0 , 0 );
            contentGrid.Children.Add( inputGrid );

            // Some formatting constants
            double axisWidth = 55 ,
                    inputAreaWidth = 325 ,
                    progressBarWidth = 10 ,
                    buttonWidth = 60 ,
                    buttonOffset = 2.5 * buttonWidth;

            /*
             * Create coordinate axes
             */

            // X-axis
            Grid xAxis = new Grid();
            xAxis.ClipToBounds = true;
            xAxis.Background = Brushes.WhiteSmoke;
            xAxis.VerticalAlignment = VerticalAlignment.Bottom;
            xAxis.HorizontalAlignment = HorizontalAlignment.Stretch;
            xAxis.Margin = new Thickness( axisWidth , 0 , inputAreaWidth , progressBarWidth );
            xAxis.Height = axisWidth;
            inputGrid.Children.Add( xAxis );
            // Y-axis
            Grid yAxis = new Grid();
            yAxis.ClipToBounds = true;
            yAxis.Background = Brushes.WhiteSmoke;
            yAxis.VerticalAlignment = VerticalAlignment.Stretch;
            yAxis.HorizontalAlignment = HorizontalAlignment.Left;
            yAxis.Margin = new Thickness( 0 , 0 , 0 , axisWidth + progressBarWidth );
            yAxis.Width = axisWidth;
            inputGrid.Children.Add( yAxis );

            /*
             * Create input area for analysis phase data
             */

            // Parent = ScrollViewer
            ScrollViewer inputArea = new ScrollViewer();
            inputArea.ClipToBounds = true;
            inputArea.Background = Brushes.WhiteSmoke;
            inputArea.VerticalAlignment = VerticalAlignment.Stretch;
            inputArea.HorizontalAlignment = HorizontalAlignment.Right;
            inputArea.Margin = new Thickness( 0 , 0 , 0 , progressBarWidth );
            inputArea.Width = inputAreaWidth;
            inputGrid.Children.Add( inputArea );

            // Parent.Content = Grid object for input
            Grid inputBlock = new Grid();
            inputBlock.ClipToBounds = true;
            inputBlock.Background = Brushes.WhiteSmoke;
            inputBlock.VerticalAlignment = VerticalAlignment.Stretch;
            inputBlock.HorizontalAlignment = HorizontalAlignment.Stretch;
            inputBlock.Margin = new Thickness( 0 );
            inputArea.Content = inputBlock;

            // Parent.Content.Children[0] = Border
            Border inputBlockBorder = new Border();
            inputBlockBorder.BorderBrush = Brushes.DimGray;
            inputBlockBorder.VerticalAlignment = VerticalAlignment.Stretch;
            inputBlockBorder.HorizontalAlignment = HorizontalAlignment.Stretch;
            inputBlockBorder.BorderThickness = new Thickness( 1 );
            inputBlockBorder.Margin = new Thickness( 0 );
            inputBlock.Children.Add( inputBlockBorder );

            // Parent.Content.Children[1] = Phase data GroupBox
            GroupBox phaseBox = new GroupBox();
            phaseBox.Header = "Analysis Phase Data";
            phaseBox.FontWeight = FontWeights.Bold;
            phaseBox.VerticalAlignment = VerticalAlignment.Top;
            phaseBox.HorizontalAlignment = HorizontalAlignment.Stretch;
            phaseBox.Margin = new Thickness( 15 , 30 , 15 , 0 );
            phaseBox.Height = 250;
            inputBlock.Children.Add( phaseBox );

            // Parent.Content.Children[1].Content = Grid for phase data GroupBox elements
            Grid phaseGrid = new Grid();
            phaseGrid.VerticalAlignment = VerticalAlignment.Stretch;
            phaseGrid.HorizontalAlignment = HorizontalAlignment.Stretch;
            phaseGrid.Margin = new Thickness( 0 );
            phaseBox.Content = phaseGrid;

            // Label for AnalysisPhase ComboBox
            Label phaseListLabel = new Label();
            phaseListLabel.Content = "Phase:";
            phaseListLabel.Height = 28;
            phaseListLabel.Width = 80;
            phaseListLabel.HorizontalContentAlignment = HorizontalAlignment.Right;
            phaseListLabel.HorizontalAlignment = HorizontalAlignment.Center;
            phaseListLabel.VerticalAlignment = VerticalAlignment.Center;
            phaseListLabel.Margin = new Thickness( -180 , -170 , 0 , 0 );
            phaseListLabel.FontWeight = FontWeights.Normal;
            phaseGrid.Children.Add( phaseListLabel );

            // Name of selected AnalysisPhase
            phaseList = new ComboBox();
            phaseList.Text = "Add new analysis phase...";
            phaseList.Height = 23;
            phaseList.Width = 160;
            phaseList.HorizontalAlignment = HorizontalAlignment.Center;
            phaseList.VerticalAlignment = VerticalAlignment.Center;
            phaseList.Margin = new Thickness( 70 , -170 , 0 , 0 );
            phaseList.FontWeight = FontWeights.Normal;
            phaseList.IsEditable = true;
            phaseList.SelectionChanged += new SelectionChangedEventHandler( phaseList_SelectionChanged );
            phaseGrid.Children.Add( phaseList );

            // Label for AnalysisPhase ComboBox
            Label beginPhaseLabel = new Label();
            beginPhaseLabel.Content = "Begin From:";
            beginPhaseLabel.Height = 28;
            beginPhaseLabel.Width = 80;
            beginPhaseLabel.HorizontalContentAlignment = HorizontalAlignment.Right;
            beginPhaseLabel.HorizontalAlignment = HorizontalAlignment.Center;
            beginPhaseLabel.VerticalAlignment = VerticalAlignment.Center;
            beginPhaseLabel.Margin = new Thickness( -180 , -110 , 0 , 0 );
            beginPhaseLabel.FontWeight = FontWeights.Normal;
            phaseGrid.Children.Add( beginPhaseLabel );

            // Name of AnalysisPhase to begin from
            beginPhaseList = new ComboBox();
            beginPhaseList.Height = 23;
            beginPhaseList.Width = 160;
            beginPhaseList.HorizontalAlignment = HorizontalAlignment.Center;
            beginPhaseList.VerticalAlignment = VerticalAlignment.Center;
            beginPhaseList.Margin = new Thickness( 70 , -110 , 0 , 0 );
            beginPhaseList.FontWeight = FontWeights.Normal;
            beginPhaseList.IsEditable = false;
            beginPhaseList.SelectionChanged += new SelectionChangedEventHandler( beginPhaseList_SelectionChanged );
            phaseGrid.Children.Add( beginPhaseList );

            // CheckBox for reset displacements option
            resetDisplacements = new CheckBox();
            resetDisplacements.Content = "Reset displacements to zero?";
            resetDisplacements.Height = 23;
            resetDisplacements.Width = 180;
            resetDisplacements.HorizontalAlignment = HorizontalAlignment.Center;
            resetDisplacements.VerticalAlignment = VerticalAlignment.Center;
            resetDisplacements.HorizontalContentAlignment = HorizontalAlignment.Center;
            resetDisplacements.Margin = new Thickness( 0 , -50 , 0 , 0 );
            resetDisplacements.FontWeight = FontWeights.Normal;
            phaseGrid.Children.Add( resetDisplacements );

            // Label for number of load steps
            Label loadStepsLabel = new Label();
            loadStepsLabel.Content = "# Load Steps";
            loadStepsLabel.Height = 28;
            loadStepsLabel.Width = 150;
            loadStepsLabel.HorizontalAlignment = HorizontalAlignment.Center;
            loadStepsLabel.VerticalAlignment = VerticalAlignment.Center;
            loadStepsLabel.HorizontalContentAlignment = HorizontalAlignment.Right;
            loadStepsLabel.Margin = new Thickness( -120 , 26 , 0 , 0 );
            loadStepsLabel.FontWeight = FontWeights.Normal;
            phaseGrid.Children.Add( loadStepsLabel );

            // TextBox for number of load steps
            loadSteps = new TextBox();
            loadSteps.Height = 23;
            loadSteps.Width = 90;
            loadSteps.HorizontalAlignment = HorizontalAlignment.Center;
            loadSteps.VerticalAlignment = VerticalAlignment.Center;
            loadSteps.Margin = new Thickness( 140 , 26 , 0 , 0 );
            loadSteps.FontWeight = FontWeights.Normal;
            phaseGrid.Children.Add( loadSteps );

            // Label for number of iterations
            Label iterationsLabel = new Label();
            iterationsLabel.Content = "# Iterations";
            iterationsLabel.Height = 28;
            iterationsLabel.Width = 150;
            iterationsLabel.HorizontalAlignment = HorizontalAlignment.Center;
            iterationsLabel.VerticalAlignment = VerticalAlignment.Center;
            iterationsLabel.HorizontalContentAlignment = HorizontalAlignment.Right;
            iterationsLabel.Margin = new Thickness( -120 , 78 , 0 , 0 );
            iterationsLabel.FontWeight = FontWeights.Normal;
            phaseGrid.Children.Add( iterationsLabel );

            // TextBox for number of iterations
            iterations = new TextBox();
            iterations.Height = 23;
            iterations.Width = 90;
            iterations.HorizontalAlignment = HorizontalAlignment.Center;
            iterations.VerticalAlignment = VerticalAlignment.Center;
            iterations.Margin = new Thickness( 140 , 78 , 0 , 0 );
            iterations.FontWeight = FontWeights.Normal;
            phaseGrid.Children.Add( iterations );

            // Label for number of load steps/print line
            Label printLinesLabel = new Label();
            printLinesLabel.Content = "# Load Steps / Print Line";
            printLinesLabel.Height = 28;
            printLinesLabel.Width = 150;
            printLinesLabel.HorizontalAlignment = HorizontalAlignment.Center;
            printLinesLabel.VerticalAlignment = VerticalAlignment.Center;
            printLinesLabel.HorizontalContentAlignment = HorizontalAlignment.Right;
            printLinesLabel.Margin = new Thickness( -120 , 132 , 0 , 0 );
            printLinesLabel.FontWeight = FontWeights.Normal;
            phaseGrid.Children.Add( printLinesLabel );

            // TextBox for number of load steps/print line
            printLines = new TextBox();
            printLines.Height = 23;
            printLines.Width = 90;
            printLines.HorizontalAlignment = HorizontalAlignment.Center;
            printLines.VerticalAlignment = VerticalAlignment.Center;
            printLines.Margin = new Thickness( 140 , 132 , 0 , 0 );
            printLines.FontWeight = FontWeights.Normal;
            phaseGrid.Children.Add( printLines );

            // Label for gravity factor
            Label gravityLabel = new Label();
            gravityLabel.Content = "Gravity Factor";
            gravityLabel.Height = 28;
            gravityLabel.Width = 150;
            gravityLabel.HorizontalAlignment = HorizontalAlignment.Center;
            gravityLabel.VerticalAlignment = VerticalAlignment.Center;
            gravityLabel.HorizontalContentAlignment = HorizontalAlignment.Right;
            gravityLabel.Margin = new Thickness( -120 , 184 , 0 , 0 );
            gravityLabel.FontWeight = FontWeights.Normal;
            phaseGrid.Children.Add( gravityLabel );

            // TextBox for gravity factor
            gravityFactor = new TextBox();
            gravityFactor.Height = 23;
            gravityFactor.Width = 90;
            gravityFactor.HorizontalAlignment = HorizontalAlignment.Center;
            gravityFactor.VerticalAlignment = VerticalAlignment.Center;
            gravityFactor.Margin = new Thickness( 140 , 184 , 0 , 0 );
            gravityFactor.FontWeight = FontWeights.Normal;
            phaseGrid.Children.Add( gravityFactor );

            /*
             * Initialize analysis phase parameters
             */

            for ( int i = 1 ; i < canvas.AnalysisPhases.Count ; i++ )
            {
                phaseList.Items.Add( canvas.AnalysisPhases[i] );
            }

            for ( int i = 0 ; i < canvas.AnalysisPhases.Count ; i++ )
            {
                beginPhaseList.Items.Add( canvas.AnalysisPhases[i] );
            }

            /*
             * MaterialType selection data
             */

            // Parent.Content.Children[2] = MaterialType GroupBox
            GroupBox materialBox = new GroupBox();
            materialBox.Header = "Assign Materials";
            materialBox.FontWeight = FontWeights.Bold;
            materialBox.VerticalAlignment = VerticalAlignment.Top;
            materialBox.HorizontalAlignment = HorizontalAlignment.Stretch;
            materialBox.Margin = new Thickness( 15 , phaseBox.Margin.Top + phaseBox.Height + 30 , 15 , 0 );
            materialBox.Height = 300;
            inputBlock.Children.Add( materialBox );

            // Parent.Content.Children[2].Content = Grid for MaterialType GroupBox elements
            Grid materialGrid = new Grid();
            materialGrid.VerticalAlignment = VerticalAlignment.Stretch;
            materialGrid.HorizontalAlignment = HorizontalAlignment.Stretch;
            materialGrid.Margin = new Thickness( 0 );
            materialBox.Content = materialGrid;

            // Fill colour for selected MaterialType
            materialFill = new Rectangle();
            materialFill.Height = 20;
            materialFill.Width = 30;
            materialFill.HorizontalAlignment = HorizontalAlignment.Center;
            materialFill.VerticalAlignment = VerticalAlignment.Center;
            materialFill.Margin = new Thickness( -180 , -220 , 0 , 0 );
            materialFill.Stroke = Brushes.Black;
            materialFill.StrokeThickness = 1.5;
            materialFill.Fill = Brushes.Transparent;
            materialGrid.Children.Add( materialFill );

            // Name of selected MaterialType
            materialList = new ComboBox();
            materialList.Height = 23;
            materialList.Width = 150;
            materialList.HorizontalAlignment = HorizontalAlignment.Center;
            materialList.VerticalAlignment = VerticalAlignment.Center;
            materialList.Margin = new Thickness( 50 , -220 , 0 , 0 );
            materialList.FontWeight = FontWeights.Normal;
            materialList.IsEditable = true;
            materialList.SelectionChanged += new SelectionChangedEventHandler( materialList_SelectionChanged );
            materialGrid.Children.Add( materialList );

            // Angle of friction
            // Property Name
            Label phiLabel = new Label();
            phiLabel.Content = "Angle of Friction";
            phiLabel.Height = 28;
            phiLabel.Width = 100;
            phiLabel.HorizontalContentAlignment = HorizontalAlignment.Right;
            phiLabel.HorizontalAlignment = HorizontalAlignment.Center;
            phiLabel.VerticalAlignment = VerticalAlignment.Center;
            phiLabel.Margin = new Thickness( -160 , -125 , 0 , 0 );
            phiLabel.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( phiLabel );
            // Property Value
            phiValue = new TextBlock();
            phiValue.Height = 23;
            phiValue.Width = 90;
            phiValue.Text = "test........................................................";
            phiValue.HorizontalAlignment = HorizontalAlignment.Center;
            phiValue.VerticalAlignment = VerticalAlignment.Center;
            phiValue.Margin = new Thickness( 45 , -125 , 0 , 0 );
            phiValue.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( phiValue );
            // Property Units
            phiUnits = new Label();
            phiUnits.Content = "deg";
            phiUnits.Height = 28;
            phiUnits.Width = 55;
            phiUnits.HorizontalContentAlignment = HorizontalAlignment.Left;
            phiUnits.HorizontalAlignment = HorizontalAlignment.Center;
            phiUnits.VerticalAlignment = VerticalAlignment.Center;
            phiUnits.Margin = new Thickness( 220 , -125 , 0 , 0 );
            phiUnits.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( phiUnits );

            // Cohesion
            // Property Name
            Label cohLabel = new Label();
            cohLabel.Content = "Cohesion";
            cohLabel.Height = 28;
            cohLabel.Width = 100;
            cohLabel.HorizontalContentAlignment = HorizontalAlignment.Right;
            cohLabel.HorizontalAlignment = HorizontalAlignment.Center;
            cohLabel.VerticalAlignment = VerticalAlignment.Center;
            cohLabel.Margin = new Thickness( -160 , -75 , 0 , 0 );
            cohLabel.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( cohLabel );
            // Property Value
            cohValue = new TextBlock();
            cohValue.Height = 23;
            cohValue.Width = 90;
            cohValue.Text = "test...............................................................................";
            cohValue.HorizontalAlignment = HorizontalAlignment.Center;
            cohValue.VerticalAlignment = VerticalAlignment.Center;
            cohValue.Margin = new Thickness( 45 , -75 , 0 , 0 );
            cohValue.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( cohValue );
            // Property Units
            cohUnits = new Label();
            cohUnits.Content = "kPa";
            cohUnits.Height = 28;
            cohUnits.Width = 55;
            cohUnits.HorizontalContentAlignment = HorizontalAlignment.Left;
            cohUnits.HorizontalAlignment = HorizontalAlignment.Center;
            cohUnits.VerticalAlignment = VerticalAlignment.Center;
            cohUnits.Margin = new Thickness( 220 , -75 , 0 , 0 );
            cohUnits.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( cohUnits );

            // Dilatancy angle
            // Property Name
            Label psiLabel = new Label();
            psiLabel.Content = "Dilatancy Angle";
            psiLabel.Height = 28;
            psiLabel.Width = 100;
            psiLabel.HorizontalContentAlignment = HorizontalAlignment.Right;
            psiLabel.HorizontalAlignment = HorizontalAlignment.Center;
            psiLabel.VerticalAlignment = VerticalAlignment.Center;
            psiLabel.Margin = new Thickness( -160 , -25 , 0 , 0 );
            psiLabel.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( psiLabel );
            // Property Value
            psiValue = new TextBlock();
            psiValue.Height = 23;
            psiValue.Width = 90;
            psiValue.Text = "test...............................................................................";
            psiValue.HorizontalAlignment = HorizontalAlignment.Center;
            psiValue.VerticalAlignment = VerticalAlignment.Center;
            psiValue.Margin = new Thickness( 45 , -25 , 0 , 0 );
            psiValue.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( psiValue );
            // Property Units
            psiUnits = new Label();
            psiUnits.Content = "deg";
            psiUnits.Height = 28;
            psiUnits.Width = 55;
            psiUnits.HorizontalContentAlignment = HorizontalAlignment.Left;
            psiUnits.HorizontalAlignment = HorizontalAlignment.Center;
            psiUnits.VerticalAlignment = VerticalAlignment.Center;
            psiUnits.Margin = new Thickness( 220 , -25 , 0 , 0 );
            psiUnits.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( psiUnits );

            // Unit weight
            // Property Name
            Label gammaLabel = new Label();
            gammaLabel.Content = "Unit Weight";
            gammaLabel.Height = 28;
            gammaLabel.Width = 100;
            gammaLabel.HorizontalContentAlignment = HorizontalAlignment.Right;
            gammaLabel.HorizontalAlignment = HorizontalAlignment.Center;
            gammaLabel.VerticalAlignment = VerticalAlignment.Center;
            gammaLabel.Margin = new Thickness( -160 , 25 , 0 , 0 );
            gammaLabel.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( gammaLabel );
            // Property Value
            gammaValue = new TextBlock();
            gammaValue.Height = 23;
            gammaValue.Width = 90;
            gammaValue.Text = "test...............................................................................";
            gammaValue.HorizontalAlignment = HorizontalAlignment.Center;
            gammaValue.VerticalAlignment = VerticalAlignment.Center;
            gammaValue.Margin = new Thickness( 45 , 25 , 0 , 0 );
            gammaValue.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( gammaValue );
            // Property Units
            gammaUnits = new Label();
            gammaUnits.Content = "kN/m^3";
            gammaUnits.Height = 28;
            gammaUnits.Width = 55;
            gammaUnits.HorizontalContentAlignment = HorizontalAlignment.Left;
            gammaUnits.HorizontalAlignment = HorizontalAlignment.Center;
            gammaUnits.VerticalAlignment = VerticalAlignment.Center;
            gammaUnits.Margin = new Thickness( 220 , 25 , 0 , 0 );
            gammaUnits.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( gammaUnits );

            // Elastic modulus
            // Property Name
            Label emodLabel = new Label();
            emodLabel.Content = "Elastic Modulus";
            emodLabel.Height = 28;
            emodLabel.Width = 100;
            emodLabel.HorizontalContentAlignment = HorizontalAlignment.Right;
            emodLabel.HorizontalAlignment = HorizontalAlignment.Center;
            emodLabel.VerticalAlignment = VerticalAlignment.Center;
            emodLabel.Margin = new Thickness( -160 , 75 , 0 , 0 );
            emodLabel.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( emodLabel );
            // Property Value
            emodValue = new TextBlock();
            emodValue.Height = 23;
            emodValue.Width = 90;
            emodValue.Text = "test...............................................................................";
            emodValue.HorizontalAlignment = HorizontalAlignment.Center;
            emodValue.VerticalAlignment = VerticalAlignment.Center;
            emodValue.Margin = new Thickness( 45 , 75 , 0 , 0 );
            emodValue.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( emodValue );
            // Property Units
            emodUnits = new Label();
            emodUnits.Content = "kPa";
            emodUnits.Height = 28;
            emodUnits.Width = 55;
            emodUnits.HorizontalContentAlignment = HorizontalAlignment.Left;
            emodUnits.HorizontalAlignment = HorizontalAlignment.Center;
            emodUnits.VerticalAlignment = VerticalAlignment.Center;
            emodUnits.Margin = new Thickness( 220 , 75 , 0 , 0 );
            emodUnits.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( emodUnits );

            // Poisson's ratio
            // Property Name
            Label nuLabel = new Label();
            nuLabel.Content = "Poisson's Ratio";
            nuLabel.Height = 28;
            nuLabel.Width = 100;
            nuLabel.HorizontalContentAlignment = HorizontalAlignment.Right;
            nuLabel.HorizontalAlignment = HorizontalAlignment.Center;
            nuLabel.VerticalAlignment = VerticalAlignment.Center;
            nuLabel.Margin = new Thickness( -160 , 125 , 0 , 0 );
            nuLabel.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( nuLabel );
            // Property Value
            nuValue = new TextBlock();
            nuValue.Height = 23;
            nuValue.Width = 90;
            nuValue.Text = "test...............................................................................";
            nuValue.HorizontalAlignment = HorizontalAlignment.Center;
            nuValue.VerticalAlignment = VerticalAlignment.Center;
            nuValue.Margin = new Thickness( 45 , 125 , 0 , 0 );
            nuValue.FontWeight = FontWeights.Normal;
            materialGrid.Children.Add( nuValue );

            // Button for setting selected blocks to selected MaterialType
            Button setSelectedButton = new Button();
            setSelectedButton.Content = "Set Selected";
            setSelectedButton.FontWeight = FontWeights.Normal;
            setSelectedButton.Height = 23;
            setSelectedButton.Width = 150;
            setSelectedButton.VerticalAlignment = VerticalAlignment.Center;
            setSelectedButton.HorizontalAlignment = HorizontalAlignment.Center;
            setSelectedButton.Margin = new Thickness( 0 , 220 , 0 , 0 );
            setSelectedButton.Click += new RoutedEventHandler( setSelectedButton_Click );
            materialGrid.Children.Add( setSelectedButton );

            /*
             * Initialize list of MaterialTypes
             */

            canvas.MaterialTypes.ForEach( delegate( MaterialType mt ) { materialList.Items.Add( mt ); } );

            materialList.SelectedIndex = 0;

            switch ( canvas.Units )
            {
                case Units.Metres:
                    cohUnits.Content = emodUnits.Content = "kPa";
                    gammaUnits.Content = "kN/m^3";
                    break;
                case Units.Millimetres:
                    cohUnits.Content = emodUnits.Content = "kPa";
                    gammaUnits.Content = "kN/m^3";
                    break;
                case Units.Feet:
                    cohUnits.Content = emodUnits.Content = "psi";
                    gammaUnits.Content = "pcf";
                    break;
                default:
                    cohUnits.Content = emodUnits.Content = "psi";
                    gammaUnits.Content = "pcf";
                    break;
            }

            /*
             * Analysis Phase buttons
             */

            // Parent.Content.Children[3] = Add button
            add = new Button();
            add.Content = "Add";
            add.Height = 23;
            add.Width = buttonWidth;
            add.VerticalAlignment = VerticalAlignment.Top;
            add.HorizontalAlignment = HorizontalAlignment.Center;
            add.Margin = new Thickness( -buttonOffset , materialBox.Margin.Top + materialBox.Height + 30 , 0 , 15 );
            add.Click += new RoutedEventHandler( add_Click );
            inputBlock.Children.Add( add );

            // Parent.Content.Children[4] = Modify button
            modify = new Button();
            modify.Content = "Modify";
            modify.Height = 23;
            modify.Width = buttonWidth;
            modify.VerticalAlignment = VerticalAlignment.Top;
            modify.HorizontalAlignment = HorizontalAlignment.Center;
            modify.Margin = new Thickness( 0 , add.Margin.Top , 0 , 15 );
            modify.Click += new RoutedEventHandler( modify_Click );
            modify.IsEnabled = false;
            inputBlock.Children.Add( modify );

            // Parent.Content.Children[5] = Delete button
            delete = new Button();
            delete.Content = "Delete";
            delete.Height = 23;
            delete.Width = buttonWidth;
            delete.VerticalAlignment = VerticalAlignment.Top;
            delete.HorizontalAlignment = HorizontalAlignment.Center;
            delete.Margin = new Thickness( buttonOffset , add.Margin.Top , 0 , 15 );
            delete.Click += new RoutedEventHandler( delete_Click );
            delete.IsEnabled = false;
            inputBlock.Children.Add( delete );

            /*
             * Create SlopeDefineCanvas object for drawing surface
             */

            inputCanvas = new SlopeDefineCanvas( canvas );
            inputCanvas.Background = Brushes.White;
            inputCanvas.VerticalAlignment = VerticalAlignment.Stretch;
            inputCanvas.HorizontalAlignment = HorizontalAlignment.Stretch;
            inputCanvas.Margin = new Thickness( axisWidth , 0 , inputAreaWidth , axisWidth + progressBarWidth );
            inputCanvas.InitializeCanvas();
            inputGrid.Children.Add( inputCanvas );
        }