private void AddCountryPagesSpiral(Model3DGroup modelGroup, List <Color> colors, AuthorCountry authorCountry, string name, WorldCountry country) { int pagesCount = (int)authorCountry.TotalPagesReadFromCountry; int pagesLookup = (int)_countryToLogPagesLookUp[authorCountry.Country]; uint maxPages = _countryToLogPagesLookUp.Values.OrderByDescending(x => x).FirstOrDefault(); double height = (12.0 * pagesLookup) / maxPages; if (height < 1.0) { height = 1.0; } GeometryModel3D countryGeometry = DiagramUtilities.GetCountryHelixArrowGeometry(country.Latitude, country.Longitude, height, colors[pagesLookup]); modelGroup.Children.Add(countryGeometry); string label = $"{name}\nLat/Long ( {country.Latitude:0.###} ,{country.Longitude:0.###} ) \nTotal Pages {pagesCount}"; TextVisual3D countryText = DiagramUtilities.GetCountryText(country.Latitude, country.Longitude, pagesCount, label, height); modelGroup.Children.Add(countryText.Content); }
public static void AddNationPagesPins( Model3DGroup modelGroup, List <Color> colors, AuthorCountry authorCountry, string name, Nation country, Dictionary <string, uint> countryToLogPagesLookUp) { int pagesCount = (int)authorCountry.TotalPagesReadFromCountry; int booksCount = authorCountry.TotalBooksReadFromCountry; int pagesLookup = (int)countryToLogPagesLookUp[authorCountry.Country]; uint maxPages = countryToLogPagesLookUp.Values.OrderByDescending(x => x).FirstOrDefault(); double height = (12.0 * pagesLookup) / maxPages; if (height < 1.0) { height = 1.0; } GeometryModel3D countryGeometry = GetCountryOctahedronGeometry(country.Latitude, country.Longitude, height, colors[pagesLookup], booksCount, country.DisplayImage); modelGroup.Children.Add(countryGeometry); string label = $"{name}\nLat/Long ( {country.Latitude:0.###} ,{country.Longitude:0.###} ) \nTotal Pages {pagesCount}"; TextVisual3D countryText = GetNationText(country, pagesCount, label, height); modelGroup.Children.Add(countryText.Content); }
private void AddCountryPagesPins(Model3DGroup modelGroup, List <OxyColor> colors, AuthorCountry authorCountry, string name, WorldCountry country) { int pagesCount = (int)authorCountry.TotalPagesReadFromCountry; int booksCount = (int)authorCountry.TotalBooksReadFromCountry; var pagesLookup = (int)_countryToLogPagesLookUp[authorCountry.Country]; var maxPages = _countryToLogPagesLookUp.Values.OrderByDescending(x => x).FirstOrDefault(); double height = (12.0 * (double)pagesLookup) / ((double)maxPages); if (height < 1.0) { height = 1.0; } GeometryModel3D countryGeometry = GetCountryOctahedronGeometry(country.Latitude, country.Longitude, height, colors[pagesLookup], booksCount); modelGroup.Children.Add(countryGeometry); string label = string.Format("{0}\nLat/Long ( {1:0.###} ,{2:0.###} ) \nTotal Pages {3}", name, country.Latitude, country.Longitude, pagesCount); TextVisual3D countryText = GetCountryText(country.Latitude, country.Longitude, pagesCount, label, height); modelGroup.Children.Add(countryText.Content); }
private TextVisual3D GetCountryText( double latitude, double longitude, int booksCount, string label, double height) { PolygonPoint latLong = new PolygonPoint() { Latitude = latitude, Longitude = longitude }; double x, y; latLong.GetCoordinates(out x, out y); var labelPoint = new Point3D(x, y + 1, height + 1); TextVisual3D text3D = new TextVisual3D() { Foreground = Brushes.Black, Background = Brushes.LightYellow, BorderBrush = Brushes.DarkBlue, Height = 2, FontWeight = System.Windows.FontWeights.Normal, IsDoubleSided = true, Position = labelPoint, UpDirection = new Vector3D(0, 0.7, 1), TextDirection = new Vector3D(1, 0, 0), HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Bottom, Text = label }; return(text3D); }
private TextVisual3D GetNationText(Nation country, int count, string label, double height) { double latitude = country.Latitude; double longitude = country.Longitude; PolygonPoint latLong = new PolygonPoint() { Latitude = latitude, Longitude = longitude }; double x, y; latLong.GetCoordinates(out x, out y); var labelPoint = new Point3D(x, y + 1, height + 1); Brush background = Brushes.LightYellow; if (country.ImageUri != null) { try { System.Windows.Media.Imaging.BitmapImage im = new System.Windows.Media.Imaging.BitmapImage(country.DisplayImage); background = new ImageBrush(im); background.Opacity = 0.5; } catch (Exception e) { _log.Debug(e); } } TextVisual3D text3D = new TextVisual3D() { Foreground = Brushes.DarkBlue, Background = background, BorderBrush = Brushes.PapayaWhip, Height = 2, FontWeight = System.Windows.FontWeights.Bold, IsDoubleSided = true, Position = labelPoint, UpDirection = new Vector3D(0, 0.7, 1), TextDirection = new Vector3D(1, 0, 0), HorizontalAlignment = System.Windows.HorizontalAlignment.Left, VerticalAlignment = System.Windows.VerticalAlignment.Bottom, Text = label }; return(text3D); }
public virtual void AddLabel() { if (Height < 0.2 || Length <= 0.8) { return; } var textLabel = new TextVisual3D(); textLabel.FontWeight = FontWeights.Bold; textLabel.Position = new Point3D(Center.X, -0.1, Center.Z); textLabel.Height = 0.15; textLabel.TextDirection = new Vector3D(1, 0, 0); textLabel.Text = GetLabelText(); Children.Add(textLabel); }
/*------------ Replace Visualization Boxes' Labels ------------*/ public static void ReplaceVisualizationLabel(TextGroupVisual3D textGroup, int oldVisBoxIndex, int newBoxIndex, string content, Point3D center, float[] dims, Color color) { TextVisual3D labelLeft = new TextVisual3D(); TextVisual3D labelRight = new TextVisual3D(); labelLeft.Text = content; labelRight.Text = content; labelLeft.Position = new Point3D(center.X + (dims[0] / 2 + 0.01), center.Y, center.Z); labelRight.Position = new Point3D(center.X - (dims[0] / 2 + 0.01), center.Y, center.Z); labelLeft.Height = Math.Min(dims[1], dims[2]); labelRight.Height = Math.Min(dims[1], dims[2]); labelLeft.UpDirection = new Vector3D(0, 0, 1); labelRight.UpDirection = new Vector3D(0, 0, 1); labelLeft.TextDirection = new Vector3D(0, 1, 0); labelRight.TextDirection = new Vector3D(0, 1, 0); labelLeft.Padding = new Thickness(2); labelRight.Padding = new Thickness(2); labelLeft.Background = Brushes.Transparent; labelRight.Background = Brushes.Transparent; int mid = (color.R + color.G + color.B) / 3; if (mid < 120) { labelLeft.Foreground = Brushes.White; labelRight.Foreground = Brushes.White; } else { labelLeft.Foreground = Brushes.Black; labelRight.Foreground = Brushes.Black; } textGroup.Children.RemoveAt((2 * oldVisBoxIndex) - 1); textGroup.Children.RemoveAt((2 * oldVisBoxIndex) - 2); textGroup.Children.Insert((2 * newBoxIndex) - 2, labelLeft); textGroup.Children.Insert((2 * newBoxIndex) - 1, labelRight); }
private void AddCountryBooksEllipsoid(Model3DGroup modelGroup, List <OxyColor> colors, AuthorCountry authorCountry, string name, WorldCountry country) { var booksCount = authorCountry.TotalBooksReadFromCountry; GeometryModel3D countryGeometry = GetCountryEllipsoidArrowGeometry(country.Latitude, country.Longitude, booksCount, colors[booksCount]); modelGroup.Children.Add(countryGeometry); string label = string.Format("{0}\nLat/Long ( {1:0.###} ,{2:0.###} ) \nTotal Books {3}", name, country.Latitude, country.Longitude, booksCount); TextVisual3D countryText = GetCountryText(country.Latitude, country.Longitude, booksCount, label); modelGroup.Children.Add(countryText.Content); }
/*------------ Change Foreground Color Of The Visualization Labels ------------*/ public static void ChangeVisualizationLabelColor(TextGroupVisual3D textGroup, int index, byte[] color) { TextVisual3D labelLeft = textGroup.Children[(2 * index) - 2] as TextVisual3D; TextVisual3D labelRight = textGroup.Children[(2 * index) - 1] as TextVisual3D; int mid = (color[0] + color[1] + color[2]) / 3; if (mid < 120) { labelLeft.Foreground = Brushes.White; labelRight.Foreground = Brushes.White; } else { labelLeft.Foreground = Brushes.Black; labelRight.Foreground = Brushes.Black; } }
public static void AddCountryBooksEllipsoid( Model3DGroup modelGroup, List <Color> colors, AuthorCountry authorCountry, string name, WorldCountry country) { int booksCount = authorCountry.TotalBooksReadFromCountry; GeometryModel3D countryGeometry = GetCountryEllipsoidArrowGeometry(country.Latitude, country.Longitude, booksCount, colors[booksCount]); modelGroup.Children.Add(countryGeometry); string label = $"{name}\nLat/Long ( {country.Latitude:0.###} ,{country.Longitude:0.###} ) \nTotal Books {booksCount}"; TextVisual3D countryText = GetCountryText(country.Latitude, country.Longitude, booksCount, label); modelGroup.Children.Add(countryText.Content); }
private void InitializeScene() { const double maxVal = 8; var arrowX = new ArrowVisual3D(); arrowX.Direction = new Vector3D(1, 0, 0); arrowX.Point1 = new Point3D(0, 0, 0); arrowX.Point2 = new Point3D(maxVal, 0, 0); arrowX.Diameter = 0.1; arrowX.Fill = System.Windows.Media.Brushes.Black; HelixViewportLeft.Children.Add(arrowX); arrowX = new ArrowVisual3D(); arrowX.Direction = new Vector3D(1, 0, 0); arrowX.Point1 = new Point3D(0, 0, 0); arrowX.Point2 = new Point3D(maxVal, 0, 0); arrowX.Diameter = 0.1; arrowX.Fill = System.Windows.Media.Brushes.Black; HelixViewportRight.Children.Add(arrowX); var arrowMX = new ArrowVisual3D(); arrowMX.Direction = new Vector3D(-1, 0, 0); arrowMX.Point1 = new Point3D(0, 0, 0); arrowMX.Point2 = new Point3D(-maxVal, 0, 0); arrowMX.Diameter = 0.1; arrowMX.Fill = System.Windows.Media.Brushes.Black; HelixViewportLeft.Children.Add(arrowMX); arrowMX = new ArrowVisual3D(); arrowMX.Direction = new Vector3D(-1, 0, 0); arrowMX.Point1 = new Point3D(0, 0, 0); arrowMX.Point2 = new Point3D(-maxVal, 0, 0); arrowMX.Diameter = 0.1; arrowMX.Fill = System.Windows.Media.Brushes.Black; HelixViewportRight.Children.Add(arrowMX); var arrowY = new ArrowVisual3D(); arrowY.Direction = new Vector3D(0, 1, 0); arrowY.Point1 = new Point3D(0, 0, 0); arrowY.Point2 = new Point3D(0, maxVal, 0); arrowY.Diameter = 0.1; arrowY.Fill = System.Windows.Media.Brushes.Black; HelixViewportLeft.Children.Add(arrowY); arrowY = new ArrowVisual3D(); arrowY.Direction = new Vector3D(0, 1, 0); arrowY.Point1 = new Point3D(0, 0, 0); arrowY.Point2 = new Point3D(0, maxVal, 0); arrowY.Diameter = 0.1; arrowY.Fill = System.Windows.Media.Brushes.Black; HelixViewportRight.Children.Add(arrowY); var arrowMY = new ArrowVisual3D(); arrowMY.Direction = new Vector3D(0, -1, 0); arrowMY.Point1 = new Point3D(0, 0, 0); arrowMY.Point2 = new Point3D(0, -maxVal, 0); arrowMY.Diameter = 0.1; arrowMY.Fill = System.Windows.Media.Brushes.Black; HelixViewportLeft.Children.Add(arrowMY); arrowMY = new ArrowVisual3D(); arrowMY.Direction = new Vector3D(0, -1, 0); arrowMY.Point1 = new Point3D(0, 0, 0); arrowMY.Point2 = new Point3D(0, -maxVal, 0); arrowMY.Diameter = 0.1; arrowMY.Fill = System.Windows.Media.Brushes.Black; HelixViewportRight.Children.Add(arrowMY); var arrowZ = new ArrowVisual3D(); arrowZ.Direction = new Vector3D(0, 0, 1); arrowZ.Point1 = new Point3D(0, 0, 0); arrowZ.Point2 = new Point3D(0, 0, maxVal); arrowZ.Diameter = 0.1; arrowZ.Fill = System.Windows.Media.Brushes.Black; HelixViewportLeft.Children.Add(arrowZ); arrowZ = new ArrowVisual3D(); arrowZ.Direction = new Vector3D(0, 0, 1); arrowZ.Point1 = new Point3D(0, 0, 0); arrowZ.Point2 = new Point3D(0, 0, maxVal); arrowZ.Diameter = 0.1; arrowZ.Fill = System.Windows.Media.Brushes.Black; HelixViewportRight.Children.Add(arrowZ); var arrowMZ = new ArrowVisual3D(); arrowMZ.Direction = new Vector3D(0, 0, -1); arrowMZ.Point1 = new Point3D(0, 0, 0); arrowMZ.Point2 = new Point3D(0, 0, -maxVal); arrowMZ.Diameter = 0.1; arrowMZ.Fill = System.Windows.Media.Brushes.Black; HelixViewportLeft.Children.Add(arrowMZ); arrowMZ = new ArrowVisual3D(); arrowMZ.Direction = new Vector3D(0, 0, -1); arrowMZ.Point1 = new Point3D(0, 0, 0); arrowMZ.Point2 = new Point3D(0, 0, -maxVal); arrowMZ.Diameter = 0.1; arrowMZ.Fill = System.Windows.Media.Brushes.Black; HelixViewportRight.Children.Add(arrowMZ); var xArrowText = new TextVisual3D(); xArrowText.Text = "X"; xArrowText.Position = new Point3D(maxVal - 0.5, 0, 0.5); xArrowText.Height = 0.5; xArrowText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportLeft.Children.Add(xArrowText); xArrowText = new TextVisual3D(); xArrowText.Text = "X"; xArrowText.Position = new Point3D(maxVal - 0.5, 0, 0.5); xArrowText.Height = 0.5; xArrowText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportRight.Children.Add(xArrowText); var yArrowText = new TextVisual3D(); yArrowText.Text = "Y"; yArrowText.Position = new Point3D(0, maxVal - 0.5, 0.5); yArrowText.Height = 0.5; yArrowText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportLeft.Children.Add(yArrowText); yArrowText = new TextVisual3D(); yArrowText.Text = "Y"; yArrowText.Position = new Point3D(0, maxVal - 0.5, 0.5); yArrowText.Height = 0.5; yArrowText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportRight.Children.Add(yArrowText); var zArrowText = new TextVisual3D(); zArrowText.Text = "Z"; zArrowText.Position = new Point3D(0.5, 0, maxVal - 0.5); zArrowText.Height = 0.5; zArrowText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportLeft.Children.Add(zArrowText); zArrowText = new TextVisual3D(); zArrowText.Text = "Z"; zArrowText.Position = new Point3D(0.5, 0, maxVal - 0.5); zArrowText.Height = 0.5; zArrowText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportRight.Children.Add(zArrowText); var leftText = new TextVisual3D(); leftText.Text = "Euler Angles Interpolation"; leftText.Position = new Point3D(0, 0, maxVal + 0.5); leftText.Height = 1; leftText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportLeft.Children.Add(leftText); var rightText = new TextVisual3D(); rightText.Text = "Quaternion Interpolation"; rightText.Position = new Point3D(0, 0, maxVal + 0.5); rightText.Height = 1; rightText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportRight.Children.Add(rightText); SetupStartConfiguration(); SetupEndConfiguration(); frameEuler = new CombinedManipulator() { CanRotateX = false, CanRotateY = false, CanRotateZ = false }; frameQuaternion = new CombinedManipulator() { CanRotateX = false, CanRotateY = false, CanRotateZ = false }; }
/// <summary> /// Create the East and Radius label. /// This will display the text for "East" and the size /// of the cylinder radius. /// </summary> /// <param name="numBins">Number of bins in the ensemble.</param> /// <returns>Model of the label.</returns> private Model3D EastArrow(int numBins) { Model3DGroup group = new Model3DGroup(); // Get the length of the cylinder, if it is 0, then display something. double arrowLength = CylinderRadius * SCALE_ARROW; if (arrowLength <= 0) { arrowLength = SCALE_ARROW; } #region Arrow //Create the shape of the object //This will be an arrow //Length will be the scale value //The position will be above the plot double xAxisLoc = 0; double yAxisLoc = 0; double zAxisLoc = 0; if (YAxis) { yAxisLoc = -numBins * TRANSLATION_SCALE; // Go to the bottom of the column } else { xAxisLoc = numBins * TRANSLATION_SCALE; } var mb = new MeshBuilder(false, false); mb.AddArrow(new Point3D(xAxisLoc, yAxisLoc, zAxisLoc), new Point3D(xAxisLoc, yAxisLoc, arrowLength), LABEL_ARROW_HEAD_SIZE, 3, 100); Geometry3D geometry = mb.ToMesh(); //Set the color Material material = MaterialHelper.CreateMaterial(Colors.Lime); material.Freeze(); ////Rotate the object //var rotation = new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(xAxisLoc, yAxisLoc, zAxisLoc), 90)); //rotation.Freeze(); //var tg = new Transform3DGroup(); //tg.Children.Add(rotation); var model = new GeometryModel3D(geometry, material) { }; model.BackMaterial = material; #endregion #region Text double xAxisLocLabel = 0; double yAxisLocLabel = 0; double zAxisLocLabel = 0; if (YAxis) { xAxisLocLabel = -LABEL_ARROW_HEAD_SIZE; // Make the text in the middle of the East arrow yAxisLocLabel = (-numBins * TRANSLATION_SCALE) - (ARROW_HEAD_SIZE * 2); // Go to the bottom of the column zAxisLocLabel = (arrowLength / 2); // Make the text just in front of the East arrow } else { xAxisLocLabel = (numBins * TRANSLATION_SCALE) + (ARROW_HEAD_SIZE * 2); // Go to the bottom of the column yAxisLocLabel = -(ARROW_HEAD_SIZE * 2); // Make the text just in front of the East arrow zAxisLocLabel = (arrowLength / 2); // Make the text in the middle of the East arrow } TextVisual3D txt = new TextVisual3D(); txt.Position = new Point3D(xAxisLocLabel, yAxisLocLabel, zAxisLocLabel); txt.Height = 0.5; txt.Text = string.Format("East {0} m/s", (arrowLength / SCALE_ARROW).ToString("0.0")); txt.TextDirection = new Vector3D(0, 0, 1); // Set text to run in line with X axis txt.UpDirection = new Vector3D(0, 1, 0); // Set text to Point Up on Y axis txt.Foreground = new SolidColorBrush(Colors.Black); txt.Background = new SolidColorBrush(Colors.WhiteSmoke); txt.Padding = new Thickness(2); #endregion group.Children.Add(model); group.Children.Add(txt.Content); return(group); }
/// <summary> /// Create the text for the north arrow. /// /// It is suggested to use an image instead /// of text for performance purposes. I will /// look into this later. /// </summary> /// <returns>3D Text.</returns> private Model3D NorthArrow(int numBins) { Model3DGroup group = new Model3DGroup(); // Get the length of the cylinder, if it is 0, then display something. double arrowLength = CylinderRadius * SCALE_ARROW; if (arrowLength <= 0) { arrowLength = SCALE_ARROW; } #region Arrow //Create the shape of the object //This will be an arrow //Length will be the scale value //The position will be above the plot double xAxisLoc = 0; double yAxisLoc = 0; double zAxisLoc = 0; if (YAxis) { yAxisLoc = -numBins * TRANSLATION_SCALE; } else { xAxisLoc = numBins * TRANSLATION_SCALE; } var mb = new MeshBuilder(false, false); if (YAxis) { mb.AddArrow(new Point3D(xAxisLoc, yAxisLoc, zAxisLoc), new Point3D(arrowLength, yAxisLoc, zAxisLoc), LABEL_ARROW_HEAD_SIZE, 3, 100); } else { mb.AddArrow(new Point3D(xAxisLoc, yAxisLoc, zAxisLoc), new Point3D(xAxisLoc, arrowLength, zAxisLoc), LABEL_ARROW_HEAD_SIZE, 3, 100); } Geometry3D geometry = mb.ToMesh(); //Set the color Material material = MaterialHelper.CreateMaterial(SELECTED_BIN_COLOR); material.Freeze(); var model = new GeometryModel3D(geometry, material); model.BackMaterial = material; #endregion #region Text double xAxisLocLabel = 0; double yAxisLocLabel = 0; double zAxisLocLabel = LABEL_ARROW_HEAD_SIZE; // Make the text just in front of the North arrow if (YAxis) { xAxisLocLabel = arrowLength / 2; // Make the text in the middle of the North arrow yAxisLocLabel = -numBins * TRANSLATION_SCALE; // Go to the bottom of the column } else { xAxisLocLabel = numBins * TRANSLATION_SCALE; yAxisLocLabel = arrowLength / 2; } TextVisual3D txt = new TextVisual3D(); txt.Position = new Point3D(xAxisLocLabel, yAxisLocLabel, zAxisLocLabel); txt.Height = 0.5; txt.Text = string.Format("North {0} m/s", (arrowLength / SCALE_ARROW).ToString("0.0")); // Need to get the arrowLenght back to m/s txt.TextDirection = new Vector3D(1, 0, 0); // Set text to run in line with X axis txt.UpDirection = new Vector3D(0, 1, 0); // Set text to Point Up on Y axis txt.Foreground = new SolidColorBrush(Colors.Black); txt.Background = new SolidColorBrush(Colors.WhiteSmoke); txt.Padding = new Thickness(2); #endregion group.Children.Add(model); group.Children.Add(txt.Content); return(group); }
public static List <Visual3D> Representation3D(this JupiterWell Well, IXYPoint refpoint) { List <Visual3D> wellrep = new List <Visual3D>(); double x = refpoint.X - Well.X; double y = refpoint.Y - Well.Y; TruncatedConeVisual3D tcvw = new TruncatedConeVisual3D(); tcvw.TopRadius = 0.5; tcvw.BaseRadius = 0.5; tcvw.Origin = new System.Windows.Media.Media3D.Point3D(x, y, Well.Terrain - Well.Depth.Value); if (Well.Depth.HasValue) { tcvw.Height = Well.Depth.Value; } else if (Well.Intakes.SelectMany(var => var.Screens).Count() > 0) { tcvw.Height = Well.Intakes.SelectMany(var => var.Screens).Max(var2 => var2.DepthToBottom.Value); } else { tcvw.Height = Well.LithSamples.Max(var => var.Bottom); } tcvw.Fill = new SolidColorBrush(Colors.Gray); wellrep.Add(tcvw); foreach (var sc in Well.Intakes.SelectMany(var => var.Screens)) { if (sc.DepthToBottom.HasValue & sc.DepthToTop.HasValue) { TruncatedConeVisual3D tcv = new TruncatedConeVisual3D(); tcv.TopRadius = 0.7; tcv.BaseRadius = 0.7; tcv.Origin = new System.Windows.Media.Media3D.Point3D(x, y, sc.BottomAsKote.Value); tcv.Height = sc.TopAsKote.Value - sc.BottomAsKote.Value; tcv.Fill = new SolidColorBrush(Colors.Black); wellrep.Add(tcv); } } foreach (var l in Well.LithSamples) { if (l.Top != -999 & l.Bottom != -999) { TruncatedConeVisual3D tcv = new TruncatedConeVisual3D(); tcv.TopRadius = 1; tcv.BaseRadius = 1; tcv.Origin = new System.Windows.Media.Media3D.Point3D(x, y, Well.Terrain - l.Bottom); tcv.Height = l.Bottom - l.Top; SolidColorBrush m; if (l.RockSymbol.ToLower().Contains("s")) { m = new SolidColorBrush(Colors.Blue); } else if (l.RockSymbol.ToLower().Contains("l")) { m = new SolidColorBrush(Colors.Red); } else { m = new SolidColorBrush(Colors.Green); } m.Opacity = 0.3; tcv.Fill = m; wellrep.Add(tcv); TextVisual3D txt = new TextVisual3D(); txt.Center = new Point3D(x + 3, y + 3, Well.Terrain - (l.Bottom + l.Top) / 2.0); txt.Text = l.RockSymbol; txt.Height = 1; wellrep.Add(txt); } } return(wellrep); }
private static void AddElementsPart2(Model3DGroup modelGroup, out Point3D point, out Point3D point2, out Point3D point3, out Point3D point4) { GeometryModel3D railing = new GeometryModel3D(); railing.Material = MaterialHelper.CreateMaterial(Brushes.LightPink, ambient: 55); var railingBuilder = new MeshBuilder(false, false); double height = 5; double diameter = 3; point = new Point3D(3, 3, 3); railingBuilder.AddCylinder(point, point + new Vector3D(0, 0, height), diameter, 10); railingBuilder.AddSphere(point, diameter * 0.75); railing.Geometry = railingBuilder.ToMesh(); modelGroup.Children.Add(railing); GeometryModel3D railing2 = new GeometryModel3D(); railing2.Material = MaterialHelper.CreateMaterial(Brushes.LightBlue, ambient: 77); var railingBuilder2 = new MeshBuilder(false, false); double height2 = 12; double diameter2 = 4; point2 = new Point3D(-4, -4, -4); railingBuilder2.AddCylinder(point2, point2 + new Vector3D(0, 0, height2), diameter2, 10); railingBuilder2.AddSphere(point2, 2 * diameter2); railing2.Geometry = railingBuilder2.ToMesh(); modelGroup.Children.Add(railing2); GeometryModel3D railing3 = new GeometryModel3D(); railing3.Material = MaterialHelper.CreateMaterial(Brushes.LightGoldenrodYellow, ambient: 177); var railingBuilder3 = new MeshBuilder(false, false); double height3 = 12; double diameter3 = 4; point3 = new Point3D(-7, 5, -3); //railingBuilder3.AddCylinder(point3, point3 + new Vector3D(0, 0, height3), diameter2, 10); //railingBuilder3.AddSphere(point3, 2 * diameter3); railingBuilder3.AddCone(point3, point3 + new Vector3D(0, 0, height3), diameter3, false, 15); railing3.Geometry = railingBuilder3.ToMesh(); modelGroup.Children.Add(railing3); GeometryModel3D railing4 = new GeometryModel3D(); railing4.Material = MaterialHelper.CreateMaterial(Brushes.LightSkyBlue, ambient: 177); var railingBuilder4 = new MeshBuilder(false, false); double height4 = 10; double diameter4 = 4; point4 = new Point3D(-14, 4, -4); //railingBuilder3.AddCylinder(point3, point3 + new Vector3D(0, 0, height3), diameter2, 10); //railingBuilder3.AddSphere(point3, 2 * diameter3); railingBuilder4.AddEllipsoid(point4, diameter4 / 2.0, diameter4 / 2.0, height4, 15); railing4.Geometry = railingBuilder4.ToMesh(); modelGroup.Children.Add(railing4); TextVisual3D text = new TextVisual3D() { Foreground = Brushes.Black, Background = Brushes.LightBlue, BorderBrush = Brushes.DarkBlue, //BorderThickness = System.Windows.Thickness, Height = 2, //Padding = System.Windows.Thickness, FontWeight = System.Windows.FontWeights.Normal, IsDoubleSided = true, Position = point3 + new Vector3D(0, 0, height3 + 1), UpDirection = new Vector3D(0, 0, 1), TextDirection = new Vector3D(0, 1, 0), HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Bottom, Text = "test Text for £3 ono" }; modelGroup.Children.Add(text.Content); }
private void InitializeScene() { linearInterpolator = new LinearInterpolator(); sphericalLinearInterpolator = new SphericalLinearInterpolator(); realTimeInterpolator = new RealTimeInterpolator(); const double maxVal = 8; var arrowX = new ArrowVisual3D(); arrowX.Direction = new Vector3D(1, 0, 0); arrowX.Point1 = new Point3D(0, 0, 0); arrowX.Point2 = new Point3D(maxVal, 0, 0); arrowX.Diameter = 0.1; arrowX.Fill = System.Windows.Media.Brushes.Black; HelixViewportLeft.Children.Add(arrowX); arrowX = new ArrowVisual3D(); arrowX.Direction = new Vector3D(1, 0, 0); arrowX.Point1 = new Point3D(0, 0, 0); arrowX.Point2 = new Point3D(maxVal, 0, 0); arrowX.Diameter = 0.1; arrowX.Fill = System.Windows.Media.Brushes.Black; HelixViewportRight.Children.Add(arrowX); var arrowMX = new ArrowVisual3D(); arrowMX.Direction = new Vector3D(-1, 0, 0); arrowMX.Point1 = new Point3D(0, 0, 0); arrowMX.Point2 = new Point3D(-maxVal, 0, 0); arrowMX.Diameter = 0.1; arrowMX.Fill = System.Windows.Media.Brushes.Black; HelixViewportLeft.Children.Add(arrowMX); arrowMX = new ArrowVisual3D(); arrowMX.Direction = new Vector3D(-1, 0, 0); arrowMX.Point1 = new Point3D(0, 0, 0); arrowMX.Point2 = new Point3D(-maxVal, 0, 0); arrowMX.Diameter = 0.1; arrowMX.Fill = System.Windows.Media.Brushes.Black; HelixViewportRight.Children.Add(arrowMX); var arrowY = new ArrowVisual3D(); arrowY.Direction = new Vector3D(0, 0, 1); arrowY.Point1 = new Point3D(0, 0, 0); arrowY.Point2 = new Point3D(0, 0, maxVal); arrowY.Diameter = 0.1; arrowY.Fill = System.Windows.Media.Brushes.Black; HelixViewportLeft.Children.Add(arrowY); arrowY = new ArrowVisual3D(); arrowY.Direction = new Vector3D(0, 0, 1); arrowY.Point1 = new Point3D(0, 0, 0); arrowY.Point2 = new Point3D(0, 0, maxVal); arrowY.Diameter = 0.1; arrowY.Fill = System.Windows.Media.Brushes.Black; HelixViewportRight.Children.Add(arrowY); var arrowMY = new ArrowVisual3D(); arrowMY.Direction = new Vector3D(0, 0, -1); arrowMY.Point1 = new Point3D(0, 0, 0); arrowMY.Point2 = new Point3D(0, 0, -maxVal); arrowMY.Diameter = 0.1; arrowMY.Fill = System.Windows.Media.Brushes.Black; HelixViewportLeft.Children.Add(arrowMY); arrowMY = new ArrowVisual3D(); arrowMY.Direction = new Vector3D(0, 0, -1); arrowMY.Point1 = new Point3D(0, 0, 0); arrowMY.Point2 = new Point3D(0, 0, -maxVal); arrowMY.Diameter = 0.1; arrowMY.Fill = System.Windows.Media.Brushes.Black; HelixViewportRight.Children.Add(arrowMY); var arrowZ = new ArrowVisual3D(); arrowZ.Direction = new Vector3D(0, 1, 0); arrowZ.Point1 = new Point3D(0, 0, 0); arrowZ.Point2 = new Point3D(0, maxVal, 0); arrowZ.Diameter = 0.1; arrowZ.Fill = System.Windows.Media.Brushes.Black; HelixViewportLeft.Children.Add(arrowZ); arrowZ = new ArrowVisual3D(); arrowZ.Direction = new Vector3D(0, 1, 0); arrowZ.Point1 = new Point3D(0, 0, 0); arrowZ.Point2 = new Point3D(0, maxVal, 0); arrowZ.Diameter = 0.1; arrowZ.Fill = System.Windows.Media.Brushes.Black; HelixViewportRight.Children.Add(arrowZ); var arrowMZ = new ArrowVisual3D(); arrowMZ.Direction = new Vector3D(0, -1, 0); arrowMZ.Point1 = new Point3D(0, 0, 0); arrowMZ.Point2 = new Point3D(0, -maxVal, 0); arrowMZ.Diameter = 0.1; arrowMZ.Fill = System.Windows.Media.Brushes.Black; HelixViewportLeft.Children.Add(arrowMZ); arrowMZ = new ArrowVisual3D(); arrowMZ.Direction = new Vector3D(0, 0, -1); arrowMZ.Point1 = new Point3D(0, 0, 0); arrowMZ.Point2 = new Point3D(0, -maxVal, 0); arrowMZ.Diameter = 0.1; arrowMZ.Fill = System.Windows.Media.Brushes.Black; HelixViewportRight.Children.Add(arrowMZ); var xArrowText = new TextVisual3D(); xArrowText.Text = "X"; xArrowText.Position = new Point3D(maxVal - 0.5, 0, 0.5); xArrowText.Height = 0.5; xArrowText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportLeft.Children.Add(xArrowText); xArrowText = new TextVisual3D(); xArrowText.Text = "X"; xArrowText.Position = new Point3D(maxVal - 0.5, 0, 0.5); xArrowText.Height = 0.5; xArrowText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportRight.Children.Add(xArrowText); var yArrowText = new TextVisual3D(); yArrowText.Text = "Z"; yArrowText.Position = new Point3D(0, 0.5, maxVal - 0.5); yArrowText.Height = 0.5; yArrowText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportLeft.Children.Add(yArrowText); yArrowText = new TextVisual3D(); yArrowText.Text = "Z"; yArrowText.Position = new Point3D(0, 0.5, maxVal - 0.5); yArrowText.Height = 0.5; yArrowText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportRight.Children.Add(yArrowText); var zArrowText = new TextVisual3D(); zArrowText.Text = "Y"; zArrowText.Position = new Point3D(0.5, maxVal - 0.5, 0); zArrowText.Height = 0.5; zArrowText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportLeft.Children.Add(zArrowText); zArrowText = new TextVisual3D(); zArrowText.Text = "Y"; zArrowText.Position = new Point3D(0.5, maxVal - 0.5, 0); zArrowText.Height = 0.5; zArrowText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportRight.Children.Add(zArrowText); var leftText = new TextVisual3D(); leftText.Text = "Internal angles interpolation"; leftText.Position = new Point3D(0, 0, maxVal + 0.5); leftText.Height = 1; leftText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportLeft.Children.Add(leftText); var rightText = new TextVisual3D(); rightText.Text = "Inverse chain"; rightText.Position = new Point3D(0, 0, maxVal + 0.5); rightText.Height = 1; rightText.FontWeight = System.Windows.FontWeights.Bold; HelixViewportRight.Children.Add(rightText); var floor = new RectangleVisual3D { Fill = new SolidColorBrush(Color.FromArgb(30, 0, 0, 0)), Normal = new Vector3D(0, 0, 1), Origin = new Point3D(0, 0, 0) }; floor.Width = floor.Length = 10; floor.LengthDirection = new Vector3D(1, 0, 0); HelixViewportLeft.Children.Add(floor); var wall = new RectangleVisual3D { Fill = new SolidColorBrush(Color.FromArgb(30, 0, 0, 0)), Normal = new Vector3D(0, 0, 1), Origin = new Point3D(0, 0, 0) }; wall.Width = wall.Length = 10; wall.LengthDirection = new Vector3D(1, 0, 0); HelixViewportRight.Children.Add(wall); frameEuler = new CombinedManipulator() { CanRotateX = false, CanRotateY = false, CanRotateZ = false }; frameQuaternion = new CombinedManipulator() { CanRotateX = false, CanRotateY = false, CanRotateZ = false }; }