Esempio n. 1
0
        private void RenderDrawables(object sender, EventArgs e)
        {
            var renderArgs = e as VisualizationEventArgs;
            var rd         = renderArgs.Description;

            //aggregate all the render descriptions into one for this node.
            HelixPoints         = null;
            HelixLines          = null;
            HelixMesh           = null;
            HelixXAxes          = null;
            HelixYAxes          = null;
            HelixZAxes          = null;
            HelixPointsSelected = null;
            HelixLinesSelected  = null;
            HelixMeshSelected   = null;

            HelixPoints         = rd.Points;
            HelixLines          = rd.Lines;
            HelixMesh           = VisualizationManager.MergeMeshes(rd.Meshes);
            HelixXAxes          = rd.XAxisPoints;
            HelixYAxes          = rd.YAxisPoints;
            HelixZAxes          = rd.ZAxisPoints;
            HelixPointsSelected = rd.SelectedPoints;
            HelixLinesSelected  = rd.SelectedLines;
            HelixMeshSelected   = VisualizationManager.MergeMeshes(rd.SelectedMeshes);
        }
Esempio n. 2
0
        /// <summary>
        /// Use the render description returned from the visualization manager to update the visuals.
        /// The visualization event arguments will contain a render description and an id representing
        /// the associated node. Visualizations for the background preview will return an empty id.
        /// </summary>
        /// <param name="e"></param>
        private void RenderDrawables(VisualizationEventArgs e)
        {
            //Debug.WriteLine(string.Format("Rendering full screen Watch3D on thread {0}.", System.Threading.Thread.CurrentThread.ManagedThreadId));

            //check the id, if the id is meant for another watch,
            //then ignore it
            if (e.Id != _id)
            {
                return;
            }

            var rd = e.Description;

            HelixPoints         = null;
            HelixLines          = null;
            HelixMesh           = null;
            HelixXAxes          = null;
            HelixYAxes          = null;
            HelixZAxes          = null;
            HelixPointsSelected = null;
            HelixLinesSelected  = null;
            HelixMeshSelected   = null;

            HelixPoints         = rd.Points;
            HelixLines          = rd.Lines;
            HelixPointsSelected = rd.SelectedPoints;
            HelixLinesSelected  = rd.SelectedLines;
            HelixXAxes          = rd.XAxisPoints;
            HelixYAxes          = rd.YAxisPoints;
            HelixZAxes          = rd.ZAxisPoints;
            HelixMesh           = VisualizationManager.MergeMeshes(rd.Meshes);
            HelixMeshSelected   = VisualizationManager.MergeMeshes(rd.SelectedMeshes);
        }
Esempio n. 3
0
        private void RenderDrawables(RenderDescription rd)
        {
            //Debug.WriteLine(string.Format("Rendering full screen Watch3D on thread {0}.", System.Threading.Thread.CurrentThread.ManagedThreadId));

            HelixPoints         = null;
            HelixLines          = null;
            HelixMesh           = null;
            HelixXAxes          = null;
            HelixYAxes          = null;
            HelixZAxes          = null;
            HelixPointsSelected = null;
            HelixLinesSelected  = null;
            HelixMeshSelected   = null;

            HelixPoints         = rd.Points;
            HelixLines          = rd.Lines;
            HelixPointsSelected = rd.SelectedPoints;
            HelixLinesSelected  = rd.SelectedLines;
            HelixXAxes          = rd.XAxisPoints;
            HelixYAxes          = rd.YAxisPoints;
            HelixZAxes          = rd.ZAxisPoints;
            HelixMesh           = VisualizationManager.MergeMeshes(rd.Meshes);
            HelixMeshSelected   = VisualizationManager.MergeMeshes(rd.SelectedMeshes);
        }
Esempio n. 4
0
        /// <summary>
        /// Use the render description returned from the visualization manager to update the visuals.
        /// The visualization event arguments will contain a render description and an id representing
        /// the associated node. Visualizations for the background preview will return an empty id.
        /// </summary>
        /// <param name="e"></param>
        private void RenderDrawables(VisualizationEventArgs e)
        {
            //Debug.WriteLine(string.Format("Rendering full screen Watch3D on thread {0}.", System.Threading.Thread.CurrentThread.ManagedThreadId));

            //check the id, if the id is meant for another watch,
            //then ignore it
            if (e.Id != _id)
            {
                return;
            }

            var sw = new Stopwatch();

            sw.Start();

            var rd = e.Description;

            HelixPoints         = null;
            HelixLines          = null;
            HelixMesh           = null;
            HelixXAxes          = null;
            HelixYAxes          = null;
            HelixZAxes          = null;
            HelixPointsSelected = null;
            HelixLinesSelected  = null;
            HelixMeshSelected   = null;
            HelixText           = null;

            HelixPoints         = rd.Points;
            HelixLines          = rd.Lines;
            HelixPointsSelected = rd.SelectedPoints;
            HelixLinesSelected  = rd.SelectedLines;
            HelixXAxes          = rd.XAxisPoints;
            HelixYAxes          = rd.YAxisPoints;
            HelixZAxes          = rd.ZAxisPoints;
            HelixMesh           = VisualizationManager.MergeMeshes(rd.Meshes);
            HelixMeshSelected   = VisualizationManager.MergeMeshes(rd.SelectedMeshes);
            HelixText           = rd.Text;

            // http://www.japf.fr/2009/10/measure-rendering-time-in-a-wpf-application/comment-page-1/#comment-2892
            //Dispatcher.CurrentDispatcher.BeginInvoke(
            //    DispatcherPriority.Background,
            //    new Action(() =>
            //    {
            var sb = new StringBuilder();

            sb.AppendLine();
            sb.AppendLine(string.Format("Rendering complete:"));
            sb.AppendLine(string.Format("Points: {0}", rd.Points.Count + rd.SelectedPoints.Count));
            sb.AppendLine(string.Format("Line segments: {0}", rd.Lines.Count / 2 + rd.SelectedLines.Count / 2));
            sb.AppendLine(string.Format("Mesh vertices: {0}",
                                        rd.Meshes.SelectMany(x => x.Positions).Count() +
                                        rd.SelectedMeshes.SelectMany(x => x.Positions).Count()));
            sb.Append(string.Format("Mesh faces: {0}",
                                    rd.Meshes.SelectMany(x => x.TriangleIndices).Count() / 3 +
                                    rd.SelectedMeshes.SelectMany(x => x.TriangleIndices).Count() / 3));
            //DynamoLogger.Instance.Log(sb.ToString());
            Debug.WriteLine(sb.ToString());
            sw.Stop();
            //DynamoLogger.Instance.Log(string.Format("{0} ellapsed for updating background preview.", sw.Elapsed));

            Debug.WriteLine(string.Format("{0} ellapsed for updating background preview.", sw.Elapsed));
            //}));
        }