public SetMagnificationDialog( Window owner ) { InitializeComponent(); this.Owner = owner; plotCanvas = (SlopePlotCanvas) ((Grid) ((PlotResultsWindow) this.Owner).contentGrid.Children[1]).Children[3]; mag.Text = string.Format( "{0}" , Math.Round( plotCanvas.Magnification , 2 ) ); }
/// <summary> /// Initializes the dialog box. /// </summary> public CustomScaleDialog( Window owner ) { InitializeComponent(); this.Owner = owner; if ( this.Owner is MainWindow ) { canvas = (SlopeCanvas) ((Grid) ((TabControl) ((Grid) this.Owner.Content).Children[2]).SelectedContent).Children[2]; scale.Text = string.Format( "{0}" , Math.Round( canvas.Scale , 2 ) ); } else if ( this.Owner is PlotResultsWindow ) { plotCanvas = (SlopePlotCanvas) ((Grid) ((PlotResultsWindow) this.Owner).contentGrid.Children[1]).Children[3]; scale.Text = string.Format( "{0}" , Math.Round( plotCanvas.Scale , 2 ) ); } }
/// <summary> /// Constructor /// </summary> /// <param name="canvas">Parent drawing canvas</param> public DisplacementVector( SlopePlotCanvas canvas, Point plotPoint,List<double>disps ) { // set parent drawing canvas this.canvas = canvas; // set plotting location and disp values this.plotPoint = plotPoint; this.disps = disps; // get magnitude and direction of displacement vector this.dir = new Vector( disps[0] , -disps[1] ); this.magnitude = dir.Length; this.dir /= magnitude; // create plotting lines for constraints plotLines = new List<Polyline>(); Polyline newLine; for ( int i = 0 ; i < 3 ; i++ ) { newLine = new Polyline(); newLine.StrokeStartLineCap = PenLineCap.Triangle; newLine.StrokeEndLineCap = PenLineCap.Triangle; newLine.Fill = Brushes.Red; newLine.Opacity = 1.0; newLine.StrokeThickness = 1.0; newLine.Stroke = Brushes.Red; newLine.Points.Add( new Point() ); newLine.Points.Add( new Point() ); plotLines.Add( newLine ); } Update(); }
public MaterialBlock( SlopePlotCanvas canvas , MaterialType mtl, Point[] pts ) { this.plotCanvas = 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.6; Boundary.Visibility = Visibility.Visible; for ( int i = 0 ; i < pts.Length ; i++ ) { Boundary.Points.Add( pts[i] ); } //Material = mtl; lineConstraints = new List<LineConstraint>(); lineLoads = new List<LineLoad>(); pointLoads = new List<PointLoad>(); }
public PlotResultsWindow( Window owner , SlopeCanvas canvas ) { InitializeComponent(); this.Owner = owner; this.canvas = canvas; // Create Grid to contain two axes, info block, and plotting canvas Grid plottingGrid = new Grid(); plottingGrid.HorizontalAlignment = HorizontalAlignment.Stretch; plottingGrid.VerticalAlignment = VerticalAlignment.Stretch; plottingGrid.Background = Brushes.WhiteSmoke; plottingGrid.Margin = new Thickness( 0 , menuPanel.Height , 0 , 0 ); contentGrid.Children.Add( plottingGrid ); double axisWidth = 55 , infoBlockWidth = 250 , progressBarWidth = 10 , logoSize = 128 , leftAlign = 30 , textBlockWidth = 200 , textBlockHeight = 25 , textAreaTop = 125, fontSize = 12; // Create Grid object for 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 , infoBlockWidth , progressBarWidth ); xAxis.Height = axisWidth; plottingGrid.Children.Add( xAxis ); // Create Grid object for 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; plottingGrid.Children.Add( yAxis ); // Create Grid object for plotting info Grid infoBlock = new Grid(); infoBlock.ClipToBounds = true; infoBlock.Background = Brushes.WhiteSmoke; infoBlock.VerticalAlignment = VerticalAlignment.Stretch; infoBlock.HorizontalAlignment = HorizontalAlignment.Right; infoBlock.Margin = new Thickness( 0 , 0 , 0 , progressBarWidth ); infoBlock.Width = infoBlockWidth; plottingGrid.Children.Add( infoBlock ); // Add plotting elements to infoBlock // CHILD 0 = Border Border infoBlockBorder = new Border(); infoBlockBorder.BorderBrush = Brushes.DimGray; infoBlockBorder.VerticalAlignment = VerticalAlignment.Stretch; infoBlockBorder.HorizontalAlignment = HorizontalAlignment.Stretch; infoBlockBorder.BorderThickness = new Thickness( 1 ); infoBlockBorder.Margin = new Thickness( 0 ); infoBlock.Children.Add( infoBlockBorder ); Image infoBlockLogo = new Image(); // CHILD 1 = Logo infoBlockLogo.Height = 128; infoBlockLogo.Width = 128; infoBlockLogo.HorizontalAlignment = HorizontalAlignment.Center; infoBlockLogo.VerticalAlignment = VerticalAlignment.Top; infoBlockLogo.Margin = new Thickness( 0 , Math.Max( (infoBlockWidth - logoSize) / 2 - 10 , 0 ) , 0 , 0 ); BitmapImage logo = new BitmapImage(); logo.BeginInit(); logo.UriSource = new Uri( "/Slope;component/icons/SlopePlotLogo.ico" , UriKind.Relative ); logo.EndInit(); infoBlockLogo.Stretch = Stretch.Fill; infoBlockLogo.Source = logo; infoBlock.Children.Add( infoBlockLogo ); TextBlock infoBlockTitle = new TextBlock(); // CHILD 2 = Program Name infoBlockTitle.Height = textBlockHeight; infoBlockTitle.Width = textBlockWidth; infoBlockTitle.HorizontalAlignment = HorizontalAlignment.Center; infoBlockTitle.VerticalAlignment = VerticalAlignment.Top; infoBlockTitle.Margin = new Thickness( 0 , infoBlockLogo.Margin.Top + logoSize , 0 , 0 ); infoBlockTitle.TextAlignment = TextAlignment.Center; infoBlockTitle.FontSize = 18; infoBlockTitle.FontWeight = FontWeights.DemiBold; infoBlockTitle.FontFamily = new FontFamily( "Consolas, Arial" ); infoBlockTitle.Text = "SlopeFEA 2011"; infoBlock.Children.Add( infoBlockTitle ); TextBlock projectTitle = new TextBlock(); // CHILD 3 = Project Title projectTitle.Height = textBlockHeight; projectTitle.Width = textBlockWidth; projectTitle.HorizontalAlignment = HorizontalAlignment.Left; projectTitle.VerticalAlignment = VerticalAlignment.Bottom; projectTitle.Margin = new Thickness( leftAlign , 0 , 0 , textAreaTop ); projectTitle.TextAlignment = TextAlignment.Left; projectTitle.FontSize = fontSize; projectTitle.FontWeight = FontWeights.Normal; projectTitle.FontFamily = infoBlockTitle.FontFamily; string[] pt = canvas.FilePath.Split( new char[] { '\\' , '.' } , StringSplitOptions.RemoveEmptyEntries ); projectTitle.Text = "Project: " + pt[pt.Length - 2]; infoBlock.Children.Add( projectTitle ); TextBlock projectDate = new TextBlock(); // CHILD 4 = Date projectDate.Height = textBlockHeight; projectDate.Width = textBlockWidth; projectDate.HorizontalAlignment = HorizontalAlignment.Left; projectDate.VerticalAlignment = VerticalAlignment.Bottom; projectDate.Margin = new Thickness( leftAlign , 0 , 0 , projectTitle.Margin.Bottom - textBlockHeight ); projectDate.TextAlignment = TextAlignment.Left; projectDate.FontSize = fontSize; projectDate.FontWeight = FontWeights.Normal; projectDate.FontFamily = infoBlockTitle.FontFamily; DateTime now = DateTime.Now; projectDate.Text = "Date: " + now.Day.ToString() + "\\" + now.Month.ToString() + "\\" + now.Year.ToString(); infoBlock.Children.Add( projectDate ); TextBlock projectAuthor = new TextBlock(); // CHILD 5 = Author projectAuthor.Height = textBlockHeight; projectAuthor.Width = textBlockWidth; projectAuthor.HorizontalAlignment = HorizontalAlignment.Left; projectAuthor.VerticalAlignment = VerticalAlignment.Bottom; projectAuthor.Margin = new Thickness( leftAlign , 0 , 0 , projectDate.Margin.Bottom - textBlockHeight ); projectAuthor.TextAlignment = TextAlignment.Left; projectAuthor.FontSize = fontSize; projectAuthor.FontWeight = FontWeights.Normal; projectAuthor.FontFamily = infoBlockTitle.FontFamily; projectAuthor.Text = "Author:"; infoBlock.Children.Add( projectAuthor ); TextBlock plotScale = new TextBlock(); // CHILD 6 = Scale plotScale.Height = textBlockHeight; plotScale.Width = textBlockWidth; plotScale.HorizontalAlignment = HorizontalAlignment.Left; plotScale.VerticalAlignment = VerticalAlignment.Bottom; plotScale.Margin = new Thickness( leftAlign , 0 , 0 , projectAuthor.Margin.Bottom - textBlockHeight ); plotScale.TextAlignment = TextAlignment.Left; plotScale.FontSize = fontSize; plotScale.FontWeight = FontWeights.Normal; plotScale.FontFamily = infoBlockTitle.FontFamily; plotScale.Text = "Scale:"; infoBlock.Children.Add( plotScale ); TextBlock plotMag = new TextBlock(); // CHILD 7 = Magnification plotMag.Height = textBlockHeight; plotMag.Width = textBlockWidth; plotMag.HorizontalAlignment = HorizontalAlignment.Left; plotMag.VerticalAlignment = VerticalAlignment.Bottom; plotMag.Margin = new Thickness( leftAlign , 0 , 0 , plotScale.Margin.Bottom - textBlockHeight ); plotMag.TextAlignment = TextAlignment.Left; plotMag.FontSize = fontSize; plotMag.FontWeight = FontWeights.Normal; plotMag.FontFamily = infoBlockTitle.FontFamily; plotMag.Text = "Magnification:"; infoBlock.Children.Add( plotMag ); // Create SlopePlotCanvas object for drawing surface SlopePlotCanvas drawingCanvas = new SlopePlotCanvas( canvas ); drawingCanvas.Background = Brushes.White; drawingCanvas.VerticalAlignment = VerticalAlignment.Stretch; drawingCanvas.HorizontalAlignment = HorizontalAlignment.Stretch; drawingCanvas.Margin = new Thickness( axisWidth , 0 , infoBlockWidth , axisWidth + progressBarWidth ); drawingCanvas.InitializeCanvas(); plottingGrid.Children.Add( drawingCanvas ); // Add analysis phase information to menu MenuItem phaseItem; for ( int i = 1 ; i < canvas.AnalysisPhases.Count ; i++ ) { phaseItem = new MenuItem(); phaseItem.Header = canvas.AnalysisPhases[i]; phaseItem.Click += new RoutedEventHandler( phaseItem_Click ); phaseMenu.Items.Add( phaseItem ); } ((MenuItem) phaseMenu.Items[0]).IsChecked = true; }