Exemplo n.º 1
0
        private WirePolyline CreateControlFrameView(ControlInfo c, ControlInfo root)
        {
            var frame = new WirePolyline
            {
                Thickness = 2,
                Rounding  = 4,
                Color     = Colors.Gray,
                Points    = new Point3DCollection(),
            };
            var left   = c.Position.X / root.Size.Width;
            var top    = c.Position.Y / root.Size.Height;
            var right  = left + c.Size.Width / root.Size.Width;
            var bottom = top + c.Size.Height / root.Size.Height;

            left   *= 5;
            top    *= 5;
            right  *= 5;
            bottom *= 5;

            var hw = 2.5;
            var hh = 2.5;

            left   -= hw;
            right  -= hw;
            top    -= hh;
            bottom -= hh;

            frame.Points.Add(new Point3D(left, -top, c.Depth * 0.2));
            frame.Points.Add(new Point3D(right, -top, c.Depth * 0.2));
            frame.Points.Add(new Point3D(right, -bottom, c.Depth * 0.2));
            frame.Points.Add(new Point3D(left, -bottom, c.Depth * 0.2));
            frame.Points.Add(new Point3D(left, -top, c.Depth * 0.2));

            return(frame);
        }
        private WirePolyline CreatePolyline(IEnumerable <Point3D> points, Point3D start)
        {
            WirePolyline line = linesPool.GetOrCreate();

            double ratio = ((start.X - bounds.X) / bounds.SizeX + (start.Y - bounds.Y) / bounds.SizeY) / 2;

            line.Thickness = lineThickness;
            line.Color     = palette.GetColor(ratio);

            line.Points = new Point3DCollection(points);

            return(line);
        }
Exemplo n.º 3
0
        void UpdateMeshResolution(short resolution, double sampling_interval)
        {
            // ------------------------------
            // Adjust cursor size
            // ------------------------------
            CursorScaleB.ScaleX = CursorScaleB.ScaleY = CursorScaleB.ScaleZ = Math.PI / 8 / resolution;

            // ------------------------------
            // Create pixelization scheme
            // ------------------------------
            pixelization            = new Healpix.Healpix();
            pixelization.Resolution = resolution;

            // ------------------------------
            // Create border lines
            // ------------------------------
            border = new HealpixBorder();
            try
            {
                border.SamplingInterval = sampling_interval;
                border.Resolution       = resolution;
            }
            catch (Exception e)
            {
                Console.WriteLine("{0} Exception caught.", e);
            }

            Visual3DCollection elements = BorderContainer.Children;

            elements.Clear();
            int n = border.GetNumberOfBorderLines();

            for (int i = 0; i < n; i++)
            {
                WirePolyline line = new WirePolyline();
                line.Points    = border.GetAsCartesianCoord(i);
                line.Color     = Colors.Black;
                line.Thickness = border.GetBorderThickness(i);
                elements.Add(line);
            }

            UpdateMapMesh();
        }
Exemplo n.º 4
0
        private void DrawTrajectory(int t_id, Color color, string direction, ModelVisual3D model)
        {
            //find trajectory id of last inserted trajectory

            if (tds.trajectories.Count == 0)
            {
                return;
            }

            //int t_id = Globals.ds.trajectories[Globals.ds.trajectories.Count - 1].t_id;

            TrajectoryDbDataSet.pointsRow[] pointsRows = (TrajectoryDbDataSet.pointsRow[])tds.points.Select("t_id = " + t_id);

            if (pointsRows.Count() < 30 && pointsRows.Count() > 2)
            {
                Point3D firstPoint = new Point3D((float)pointsRows[0].X, (float)pointsRows[0].Y, (float)pointsRows[0].Z);

                Point3DCollection pointCollection = new Point3DCollection();

                for (int i = 1; i < pointsRows.Length; i++)
                {
                    TrajectoryDbDataSet.pointsRow currentRow;
                    TrajectoryDbDataSet.pointsRow lastRow;

                    try
                    {
                        currentRow = pointsRows[i];
                        lastRow    = pointsRows[i - 1];
                    }
                    catch (Exception e)
                    {
                        return;
                    }

                    pointCollection.Add(new Point3D(currentRow.X, currentRow.Y, currentRow.Z));
                }


                if (direction.Equals("R"))
                {
                    arrow = Petzold.Media2D.ArrowEnds.End;
                }
                else if (direction.Equals("L"))
                {
                    arrow = Petzold.Media2D.ArrowEnds.Start;
                }
                else
                {
                    arrow = Petzold.Media2D.ArrowEnds.None;
                }

                WirePolyline wl = new WirePolyline()
                {
                    Points    = pointCollection,
                    Thickness = 1,
                    Rounding  = 1,
                    Color     = color,
                    ArrowEnds = Petzold.Media2D.ArrowEnds.End
                };

                model.Children.Add(wl);
                model.Transform = new Transform3DGroup();
            }
        }