Ejemplo n.º 1
0
        public LotEditorItemMarker CreateGeometry()
        {
            LotEditorItemMarker   marker = new LotEditorItemMarker(this);
            Model3DCollection     coll   = new Model3DCollection();
            TruncatedConeVisual3D cone   = new TruncatedConeVisual3D();

            cone.Height             = 2.5;
            cone.BaseRadius         = 0;
            cone.TopRadius          = 1;
            cone.Material           = MaterialHelper.CreateMaterial(Brushes.Red, new SolidColorBrush(Color.FromScRgb(1f, 0.2f, 0.0f, 0f)));
            marker.ManipulatorModel = cone.Model;
            marker.Transform        = new MatrixTransform3D(this.Transform.GetAsMatrix3D());
            ModelRepresentation     = marker;

            BillboardTextVisual3D billboard = new BillboardTextVisual3D();

            billboard.Text       = Index.ToString();
            billboard.Background = Brushes.White;
            billboard.Transform  = new TranslateTransform3D(0, 0, 5);

            marker.Children.Add(billboard);


            return(marker);
        }
Ejemplo n.º 2
0
        public void AddCyllinder(HelixViewport3D left)
        {
            cyllinder = new TruncatedConeVisual3D()
            {
                Fill       = new SolidColorBrush(Color.FromArgb(255, 0, 255, 0)),
                Origin     = new Point3D(0, 0, 0),
                BaseRadius = Component.TubeDiameter / 2,
                Height     = cyllinderHeight,
                TopRadius  = Component.TubeDiameter / 2
            };

            left.Children.Add(cyllinder);
        }
Ejemplo n.º 3
0
        public LotEditorItemMarker CreateGeometry()
        {
            LotEditorItemMarker   marker = new LotEditorItemMarker(this);
            TruncatedConeVisual3D cone   = new TruncatedConeVisual3D();

            cone.Height             = 2.5;
            cone.BaseRadius         = 0;
            cone.TopRadius          = 1;
            cone.Material           = MaterialHelper.CreateMaterial(Brushes.Blue, new SolidColorBrush(Color.FromScRgb(1f, 0.0f, 0.0f, 0.2f)));
            marker.ManipulatorModel = cone.Model;
            marker.Transform        = new MatrixTransform3D(this.Transform.GetAsMatrix3D());
            ModelRepresentation     = marker;
            return(marker);
        }
Ejemplo n.º 4
0
        /// <summary>Creates the plot elements.</summary>
        /// <remarks>Changes to the bounding box and other parameters will not take effect until this method is called.</remarks>
        public void CreateElements()
        {
            double lineThickness = 500 / 1000;

            labelOffset        = lineThickness * 50;
            minDistanceSquared = MinDistance * MinDistance;

            if (EnableMarker)//Elements.HasFlag(EElements.Marker
            {
                marker            = new TruncatedConeVisual3D();
                marker.Height     = labelOffset;
                marker.BaseRadius = 0.0;
                marker.TopRadius  = labelOffset / 5;
                marker.TopCap     = true;
                marker.Origin     = new Point3D(0.0, 0.0, 0.0);
                marker.Normal     = new Vector3D(-1.0, -1.0, 1.0);
                marker.Fill       = MarkerBrush;
                parentViewport.Children.Add(marker);

                coords            = new BillboardTextVisual3D();
                coordinateFormat  = string.Format("{{0:F{0}}}, {{1:F{0}}}, {{2:F{0}}}", DecimalPlaces, DecimalPlaces, DecimalPlaces); // "{0:F2}, {1:F2}, {2:F2}"
                coords.Text       = string.Format(coordinateFormat, 0.0, 0.0, 0.0);
                coords.Foreground = MarkerBrush;
                coords.Position   = new Point3D(-labelOffset, -labelOffset, labelOffset);
                parentViewport.Children.Add(coords);
            }
            else
            {
                marker = null;
                coords = null;
            }

            if (trace != null)
            {
                foreach (LinesVisual3D p in trace)
                {
                    parentViewport.Children.Add(p);
                }

                if (trace.Count > 0)
                {
                    path = trace[trace.Count - 1];
                }
            }
        }
Ejemplo n.º 5
0
        public void Graphics()
        {
            //параллолепипед
            box = new BoxVisual3D()
            {
                Height = 3,
                Width  = 3,
                Length = 4,
                Center = new Point3D(4, 0, 1.5),
                Fill   = new SolidColorBrush(Color.FromRgb(255, 0, 0)),
            };

            // конус
            tr1 = new TruncatedConeVisual3D()
            {
                Height     = 5,
                Normal     = new Vector3D(0, 0, 1),
                BaseRadius = 2,
                Origin     = new Point3D(-1, 0, 0),
                Fill       = new SolidColorBrush(Color.FromRgb(0, 255, 0)),
            };

            //конус
            tr2 = new TruncatedConeVisual3D()
            {
                Height     = 5,
                Normal     = new Vector3D(0, 0, -1),
                BaseRadius = 2,
                Origin     = new Point3D(-6, 0, 5),
                Fill       = new SolidColorBrush(Color.FromRgb(0, 255, 0)),
            };

            pole.Children.Add(tr1);
            pole.Children.Add(tr2);
            pole.Children.Add(box);
            rnd1 = new Random();
            rnd2 = new Random();
            rnd3 = new Random();

            System.Windows.Threading.DispatcherTimer timer = new System.Windows.Threading.DispatcherTimer();
            timer.Tick    += new EventHandler(TimerTick);
            timer.Interval = new TimeSpan(0, 0, 1);
            timer.Start();
        }
Ejemplo n.º 6
0
        private TruncatedConeVisual3D Lier([NotNull] TruncatedConeVisual3D forme, [NotNull] ConeWrapper source)
        {
            BindingOperations.SetBinding(forme, TruncatedConeVisual3D.HeightProperty, new Binding(nameof(source.Hauteur))
            {
                Source = source, Mode = BindingMode.TwoWay
            });
            BindingOperations.SetBinding(forme, TruncatedConeVisual3D.BaseRadiusProperty, new Binding(nameof(source.RayonBase))
            {
                Source = source, Mode = BindingMode.TwoWay
            });
            BindingOperations.SetBinding(forme, TruncatedConeVisual3D.TopRadiusProperty, new Binding(nameof(source.RayonTop))
            {
                Source = source, Mode = BindingMode.TwoWay
            });
            BindingOperations.SetBinding(forme, TruncatedConeVisual3D.ThetaDivProperty, new Binding(nameof(source.ThetaDiv))
            {
                Source = source, Mode = BindingMode.TwoWay
            });

            return((TruncatedConeVisual3D)_Lier(forme, source));
        }
Ejemplo n.º 7
0
        /// <summary>
        /// Create a cylinder to encapsulate the arrows.  The cylinder will
        /// be X m/s wide.  The cylinder will be transparent so the arrows within
        /// can be seen.
        /// </summary>
        /// <param name="numBins"></param>
        /// <returns></returns>
        private Model3D CreateCylinder(int numBins)
        {
            var mb = new MeshBuilder(false, false);
            TruncatedConeVisual3D cyl = new TruncatedConeVisual3D();                // This will create a cylinder, basically 2 cones on top of each other

            cyl.BaseRadius = CylinderRadius * SCALE_ARROW;                          // Set the radius of the cylinder based off X m/s using the scale factor
            cyl.TopRadius  = cyl.BaseRadius;                                        // Set the radius of the cylinder
            cyl.Fill       = new SolidColorBrush(Color.FromArgb(40, 00, 130, 255)); // Set the color of the cylinder.  Make it trasparent
            cyl.Origin     = new Point3D(0, 0, 0);                                  // Set the origin of the cylinder as the origin of the plot

            if (YAxis)
            {
                cyl.Normal = new Vector3D(0, 1, 0);                                 // Set the orientation of the cylinder Y Up
                cyl.Height = -numBins * TRANSLATION_SCALE;                          // Set the height based off the number bins and scale (go in the negative direction)
            }
            else
            {
                cyl.Normal = new Vector3D(1, 0, 0);                                // Set the orientation of the cylinder Y Up
                cyl.Height = numBins * TRANSLATION_SCALE;                          // Set the height based off the number bins and scale (go in the Positive direction)
            }

            return(cyl.Content);
        }
Ejemplo n.º 8
0
        private void UpdateVisuals()
        {
            Children.Clear();
            if (WindTurbine == null)
            {
                return;
            }

            var baseTower = new TruncatedConeVisual3D
            {
                Fill   = Brushes.Yellow,
                Origin = new Point3D(0, 0, -WindTurbine.BaseHeight)
            };

            baseTower.Height     = -baseTower.Origin.Z + 2;
            baseTower.BaseRadius = baseTower.TopRadius = WindTurbine.Diameter;

            var tower = new TruncatedConeVisual3D
            {
                Fill       = Brushes.White,
                Origin     = new Point3D(0, 0, 2),
                Height     = WindTurbine.Height,
                BaseRadius = WindTurbine.Diameter
            };

            tower.TopRadius = tower.BaseRadius * (1 - WindTurbine.Height * Math.Sin(WindTurbine.ShaftAngle / 180.0 * Math.PI));

            var nacelle = new TruncatedConeVisual3D
            {
                Fill      = Brushes.White,
                Origin    = new Point3D(WindTurbine.Overhang, 0, tower.Origin.Z + tower.Height),
                Normal    = new Vector3D(-1, 0, 0),
                TopRadius = WindTurbine.NacelleDiameter
            };

            nacelle.BaseRadius = nacelle.TopRadius * 0.7;
            nacelle.Height     = WindTurbine.NacelleLength;

            Children.Add(baseTower);
            Children.Add(tower);
            Children.Add(nacelle);


            var endcap = new SphereVisual3D
            {
                Center = new Point3D(WindTurbine.Overhang - WindTurbine.NacelleLength, 0,
                                     tower.Origin.Z + tower.Height),
                Radius = nacelle.TopRadius,
                Fill   = Brushes.White
            };

            Children.Add(endcap);

            var rotor = new ModelVisual3D();

            for (int i = 0; i < WindTurbine.Blades; i++)
            {
                double angle = (double)i / WindTurbine.Blades * Math.PI * 2;

                // todo: the blade is simplified to a cone... it should be a real profile...
                var blade = new TruncatedConeVisual3D
                {
                    Origin     = nacelle.Origin,
                    Normal     = new Vector3D(0, Math.Cos(angle), Math.Sin(angle)),
                    Height     = WindTurbine.BladeLength,
                    BaseRadius = WindTurbine.BladeRootChord,
                    TopRadius  = WindTurbine.BladeTipChord,
                    Fill       = Brushes.White
                };
                rotor.Children.Add(blade);
            }

            var hub = new SphereVisual3D
            {
                Fill   = Brushes.White,
                Center = nacelle.Origin,
                Radius = WindTurbine.HubDiameter / 2
            };

            rotor.Children.Add(hub);
            Children.Add(rotor);

            var rotation       = new AxisAngleRotation3D(new Vector3D(1, 0, 0), 0);
            var rotorTransform = new RotateTransform3D(null, hub.Center)
            {
                Rotation = rotation
            };

            rotor.Transform = rotorTransform;

            var b = new Binding("RotationAngle")
            {
                Source = this
            };

            BindingOperations.SetBinding(rotation, AxisAngleRotation3D.AngleProperty, b);
        }
Ejemplo n.º 9
0
        /// <summary>Creates the plot elements.</summary>
        /// <remarks>Changes to the bounding box and other parameters will not take effect until this method is called.</remarks>
        public void CreateElements()
        {
            Children.Clear();
            Children.Add(new DefaultLights());

            string[] labels = AxisLabels.Split(',');
            if (labels.Length < 3)
            {
                labels = new string[] { "X", "Y", "Z" }
            }
            ;

            double bbSize        = Math.Max(Math.Max(BoundingBox.SizeX, BoundingBox.SizeY), BoundingBox.SizeZ);
            double lineThickness = bbSize / 1000;
            double arrowOffset   = lineThickness * 30;

            labelOffset        = lineThickness * 50;
            minDistanceSquared = MinDistance * MinDistance;

            if (Elements.HasFlag(EElements.Grid))
            {
                var grid = new GridLinesVisual3D();
                grid.Center        = new Point3D(BoundingBox.X + 0.5 * BoundingBox.SizeX, BoundingBox.Y + 0.5 * BoundingBox.SizeY, BoundingBox.Z);
                grid.Length        = BoundingBox.SizeX;
                grid.Width         = BoundingBox.SizeY;
                grid.MinorDistance = TickSize;
                grid.MajorDistance = bbSize;
                grid.Thickness     = lineThickness;
                grid.Fill          = AxisBrush;
                Children.Add(grid);
            }

            if (Elements.HasFlag(EElements.Axes))
            {
                var arrow = new ArrowVisual3D();
                arrow.Point2   = new Point3D((BoundingBox.X + BoundingBox.SizeX) + arrowOffset, 0.0, 0.0);
                arrow.Diameter = lineThickness * 5;
                arrow.Fill     = AxisBrush;
                Children.Add(arrow);

                var label = new BillboardTextVisual3D();
                label.Text       = labels[0];
                label.FontWeight = FontWeights.Bold;
                label.Foreground = AxisBrush;
                label.Position   = new Point3D((BoundingBox.X + BoundingBox.SizeX) + labelOffset, 0.0, 0.0);
                Children.Add(label);

                arrow          = new ArrowVisual3D();
                arrow.Point2   = new Point3D(0.0, (BoundingBox.Y + BoundingBox.SizeY) + arrowOffset, 0.0);
                arrow.Diameter = lineThickness * 5;
                arrow.Fill     = AxisBrush;
                Children.Add(arrow);

                label            = new BillboardTextVisual3D();
                label.Text       = labels[1];
                label.FontWeight = FontWeights.Bold;
                label.Foreground = AxisBrush;
                label.Position   = new Point3D(0.0, (BoundingBox.Y + BoundingBox.SizeY) + labelOffset, 0.0);
                Children.Add(label);

                if (BoundingBox.SizeZ > 0)
                {
                    arrow          = new ArrowVisual3D();
                    arrow.Point2   = new Point3D(0.0, 0.0, (BoundingBox.Z + BoundingBox.SizeZ) + arrowOffset);
                    arrow.Diameter = lineThickness * 5;
                    arrow.Fill     = AxisBrush;
                    Children.Add(arrow);

                    label            = new BillboardTextVisual3D();
                    label.Text       = labels[2];
                    label.FontWeight = FontWeights.Bold;
                    label.Foreground = AxisBrush;
                    label.Position   = new Point3D(0.0, 0.0, (BoundingBox.Z + BoundingBox.SizeZ) + labelOffset);
                    Children.Add(label);
                }
            }

            if (Elements.HasFlag(EElements.BoundingBox) && BoundingBox.SizeZ > 0)
            {
                var box = new BoundingBoxWireFrameVisual3D();
                box.BoundingBox = BoundingBox;
                box.Thickness   = 1;
                box.Color       = AxisBrush.Color;
                Children.Add(box);
            }

            if (Elements.HasFlag(EElements.Marker))
            {
                marker            = new TruncatedConeVisual3D();
                marker.Height     = labelOffset;
                marker.BaseRadius = 0.0;
                marker.TopRadius  = labelOffset / 5;
                marker.TopCap     = true;
                marker.Origin     = new Point3D(0.0, 0.0, 0.0);
                marker.Normal     = new Vector3D(-1.0, -1.0, 1.0);
                marker.Fill       = MarkerBrush;
                Children.Add(marker);

                coords            = new BillboardTextVisual3D();
                coordinateFormat  = string.Format("{{0:F6}}, {{1:F6}}, {{2:F6}}", DecimalPlaces, DecimalPlaces, DecimalPlaces); // "{0:F2}, {1:F2}, {2:F2}"
                coords.Text       = string.Format(coordinateFormat, 0.0, 0.0, 0.0);
                coords.Foreground = MarkerBrush;
                coords.Position   = new Point3D(-labelOffset, -labelOffset, labelOffset);
                Children.Add(coords);
            }
            else
            {
                marker = null;
                coords = null;
            }

            if (trace != null)
            {
                foreach (LinesVisual3D p in trace)
                {
                    Children.Add(p);
                }
                path = trace[trace.Count - 1];
            }
        }
Ejemplo n.º 10
0
        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);
        }
Ejemplo n.º 11
0
        public LotEditorItemMarker CreateGeometry()
        {
            LotEditorItemMarker marker;

            if (this.ModelRepresentation == null)
            {
                marker = new LotEditorItemMarker(this);
            }
            else
            {
                marker = this.ModelRepresentation;
            }

            if (ViewLotEditor.LightTypes[LightType.InstanceId] == "Spot")
            {
                TruncatedConeVisual3D cone = new TruncatedConeVisual3D();
                cone.Height     = LightLength.Value;
                cone.BaseRadius = 0;
                cone.TopRadius  = LightOuterRadius.Value;
                Transform3DGroup transforms = new Transform3DGroup();
                transforms.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1, 0, 0), -90)));
                Transform3D coneTransform = new MatrixTransform3D(LightTransform.GetAsMatrix3D());
                transforms.Children.Add(coneTransform);
                // cone.Transform = transforms;

                cone.Material = MaterialHelper.CreateMaterial(Brushes.Black, new SolidColorBrush(LightColor.Color), opacity: 0.6);
                //ModelRepresentation.Model = cone.Model;

                marker.Transform        = transforms;
                marker.ManipulatorModel = cone.Model;
                ModelRepresentation     = marker;
                return(marker);
            }
            else if (ViewLotEditor.LightTypes[LightType.InstanceId] == "Point")
            {
                HelixToolkit.Wpf.SphereVisual3D sphere = new HelixToolkit.Wpf.SphereVisual3D();
                sphere.Radius = 1;

                sphere.Material = MaterialHelper.CreateMaterial(Brushes.Black, new SolidColorBrush(LightColor.Color));

                marker.Transform        = new MatrixTransform3D(LightTransform.GetAsMatrix3D());
                marker.ManipulatorModel = sphere.Model;
                ModelRepresentation     = marker;
                return(marker);
            }
            else if (ViewLotEditor.LightTypes[LightType.InstanceId] == "Line")
            {
                BoxVisual3D lineLight = new BoxVisual3D();
                lineLight.Height = LightLength.Value;

                lineLight.Center = new Point3D(0, 0, -(LightLength.Value / 2));

                Transform3DGroup transforms = new Transform3DGroup();
                // transforms.Children.Add(new TranslateTransform3D(0, 0, -(light.LightLength / 2)));
                transforms.Children.Add(new RotateTransform3D(new AxisAngleRotation3D(new Vector3D(1, 0, 0), 90)));
                transforms.Children.Add(new MatrixTransform3D(LightTransform.GetAsMatrix3D()));

                lineLight.Material = MaterialHelper.CreateMaterial(Brushes.Black, new SolidColorBrush(LightColor.Color));

                marker.Transform        = transforms;
                marker.ManipulatorModel = lineLight.Model;
                ModelRepresentation     = marker;
                return(marker);
            }

            return(new LotEditorItemMarker(this));
        }