Ejemplo n.º 1
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graphVisualizer"></param>
        public Graph(GraphVisualizer graphVisualizer)
        {
            GraphVisualizer = graphVisualizer;

            Data = new Series();
            GraphVisualizer.Series.Add(Data);
        }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="graphVisualizer"></param>
 /// <param name="function"></param>
 public GradientProfileGraph(GraphVisualizer graphVisualizer, ProfileFunction function)
     : base(graphVisualizer, function)
 {
     Function = function;
     graphVisualizer.EnableAxisY2();  // the gradients are displayed on axis Y2
     Data.YAxisType = AxisType.Secondary;
 }
Ejemplo n.º 3
0
        /// <summary>
        ///     Constructor
        /// </summary>
        /// <param name="graphVisualizer"></param>
        public Graph(GraphVisualizer graphVisualizer)
        {
            GraphVisualizer = graphVisualizer;

            Data = new Series();
            GraphVisualizer.Series.Add(Data);
        }
Ejemplo n.º 4
0
 // Update is called once per frame
 void Update()
 {
     GraphVisualizer.DrawPath(path);
     DrawPath();
     if (canIGo)
     {
         RidePath(path, Time.deltaTime);
     }
 }
Ejemplo n.º 5
0
    void Awake()
    {
        GraphVisualizer g = FindObjectOfType <GraphVisualizer>();

        dataset          = g.dataset.name;
        anim             = GetComponent <Animator>();
        meshrenderer     = GetComponentInChildren <SkinnedMeshRenderer>();
        nodesText        = transform.GetChild(2).GetComponentInChildren <Text>();
        default_text     = nodesText.text;
        paper_plane_anim = transform.GetChild(3).GetComponent <Animator>();
    }
Ejemplo n.º 6
0
 private void runVisualization(object sender, DoWorkEventArgs e)
 {
     if (isPressed[Keys.D])
     {
         GraphVisualizer.dfs((INode)e.Argument);
     }
     else if (isPressed[Keys.B])
     {
         GraphVisualizer.bfs((INode)e.Argument);
     }
 }
Ejemplo n.º 7
0
        static void DrawPathGraph(int task)
        {
            var fname = string.Format("...\\..\\..\\problems\\{0:D3}.spec.txt", task);
            var spec  = ProblemSpec.Parse(File.ReadAllText(fname));
            var r     = Pathfinder.BuildGraph(spec);

            var lens = r.Edges.Select(z => z.Data.length).OrderBy(z => z).ToList();

            var matrix = new PathStat[r.NodesCount, r.NodesCount];

            foreach (var e in Pathfinder.FindAllPathes(r, 1, 0.7))
            {
                var i = e.FirstEdge.From.NodeNumber;
                var j = e.LastEdge.To.NodeNumber;
                if (matrix[i, j] == null)
                {
                    matrix[i, j] = new PathStat();
                }
                matrix[i, j].pathes.Add(e);
            }


            var gr = new Graph <PathStat, NodeInfo>(r.NodesCount);

            for (int i = 0; i < gr.NodesCount; i++)
            {
                gr[i].Data = r[i].Data;
            }

            for (int i = 0; i < gr.NodesCount; i++)
            {
                for (int j = 0; j < gr.NodesCount; j++)
                {
                    if (matrix[i, j] != null)
                    {
                        gr.NonDirectedConnect(i, j, matrix[i, j]);
                    }
                }
            }

            var viz = new GraphVisualizer <PathStat, NodeInfo>();

            viz.GetX = z => (double)z.Data.Location.X;
            viz.GetY = z => (double)z.Data.Location.Y;

            Func <PathStat, string> stat = z => z.pathes.Count().ToString();;

            viz.EdgeCaption = z => stat(z.Data);
            viz.NodeCaption = z => z.Data.Location.ToString();


            viz.Window(500, gr);
        }
    // Use this for initialization
    private void Start()
    {
        nodePositions = new Transform[studySize];
        // Get graphvisualizer from hierarchy and assign a transform position from a random cluster
        // in this case the fifth child (2nd cluster).
        GraphVisualizer g = FindObjectOfType <GraphVisualizer> ();

        transform.position = g.transform.GetChild(grabClusterPoint).GetChild(0).GetChild(1).position;
        recorder           = FindObjectOfType <Recorder>();
        nodeReferences     = new Transform[studyNodes.Length];
        wim = FindObjectOfType <World_Miniature_Graph>();
    }
 // Use this for initialization
 void Awake()
 {
     if (GetComponent <MeshRenderer>())
     {
         def       = GetComponent <MeshRenderer>().material.color;
         highlight = Color.yellow;
         def_mat   = GetComponent <MeshRenderer>().material;
     }
     transform.tag = "cluster";
     ignoreNodes   = new ArrayList();
     graph         = FindObjectOfType <GraphVisualizer>();
 }
Ejemplo n.º 10
0
        public static void Visualize(PointProjectionSolver solver, Projection p = null, string name = "")
        {
            if (p == null)
            {
                p = solver.ProjectionScheme;
            }
            var gr  = GenerateOutGraph(p, true);
            var viz = new GraphVisualizer <PointProjectionSolver.ProjectedEdgeInfo, PointProjectionSolver.ProjectedNodeInfo>();

            viz.GetX = z => z.Data.Projection.X;
            viz.GetY = z => z.Data.Projection.Y;
            // viz.NodeCaption = z => z.Data.Original.Data.Location.ToString();
            viz.Window(500, gr, name);
        }
Ejemplo n.º 11
0
        static void DrawProblem(int task)
        {
            var spec  = new ProblemsRepo().Get(task);
            var graph = Pathfinder.BuildGraph(spec);
            var viz   = new GraphVisualizer <EdgeInfo, NodeInfo>();

            viz.GetX = z => z.Data.Location.X;
            viz.GetY = z => z.Data.Location.Y;
            //viz.NodeCaption = z => z.Data.Location.ToString() + " ("+z.NodeNumber.ToString()+")";
            viz.NodeCaption = z => z.NodeNumber.ToString();

            //viz.EdgeCaption = z => z.Data.length.ToString();

            viz.Window(600, graph);
        }
 private void Awake()
 {
     if (edgeType == EdgeType.NormalRig)
     {
         anchor1 = transform.GetChild(0).GetChild(0);
         anchor2 = transform.GetChild(0).GetChild(0).GetChild(0);
     }
     if (edgeType == EdgeType.CurvedRig)
     {
         anchor1   = transform.GetChild(0).GetChild(0);
         anchorMid = transform.GetChild(0).GetChild(0).GetChild(0);
         anchor2   = transform.GetChild(0).GetChild(0).GetChild(0).GetChild(0);
     }
     edgeManager = Camera.main.GetComponent <EdgeManager>();
     graph       = FindObjectOfType <GraphVisualizer>();
 }
 // Update is called once per frame
 private void Update()
 {
     FindStudyNodes();
     RunExperiment();
     if (recorder == null)
     {
         recorder = FindObjectOfType <Recorder>();
     }
     // check if studynodes is empty, if it is then re-assign
     if (nodePositions [0] == null)
     {
         print("null");
         GraphVisualizer g = FindObjectOfType <GraphVisualizer> ();
         transform.position = g.transform.GetChild(grabClusterPoint).GetChild(0).GetChild(1).position;
     }
 }
 void Awake()
 {
     trackedObj = transform.parent.GetComponent <SteamVR_TrackedObject>();
     if (laserPrefab != null)
     {
         laser = Instantiate(laserPrefab);
     }
     laserTransform        = laser.transform;
     laser.gameObject.name = trackedObj.name + " laser";
     graph         = FindObjectOfType <GraphVisualizer>();
     rotateGraphTo = graph.transform.rotation;
     if (userStudyRunning)
     {
         studyAssign = FindObjectOfType <StudyAssign>();
     }
 }
Ejemplo n.º 15
0
 // Update is called once per frame
 public void Update()
 {
     if (transform.childCount != childrenCount)
     {
         Initialize();
         childrenCount = transform.childCount;
     }
     if (drawGraph)
     {
         if (Application.isPlaying)
         {
             GraphVisualizer.Redraw(this);
         }
         //Debug.Log("Graph is updated");
         DrawGraph();
     }
 }
Ejemplo n.º 16
0
 /// <summary>
 ///     Displays the graph
 /// </summary>
 /// <param name="maxDistance"></param>
 /// <param name="minDistance"></param>
 /// <param name="height"></param>
 public void Display(double maxDistance, double minDistance = 0, double height = double.NaN)
 {
     if (IsEnabled)
     {
         HandleDisplay(maxDistance, minDistance, height);
     }
     // in case the maximum value of Y axis is not determined automatically => compute it
     if (!double.IsNaN(GraphVisualizer.MaxY))
     {
         foreach (DataPoint point in Data.Points)
         {
             if (point.YValues[0] > GraphVisualizer.AxisY.Maximum && !point.IsEmpty)
             {
                 GraphVisualizer.SetMaxY(point.YValues[0]);
             }
         }
     }
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="graph_visualizer"></param>
        public Train(GraphVisualizer graph_visualizer)
            : base(graph_visualizer)
        {
            Position             = new DataPoint();
            Position.XValue      = 0;
            hidden_point         = new DataPoint(0, 0);
            hidden_point.IsEmpty = true;

            TopLeft     = new DataPoint();
            BottomLeft  = new DataPoint();
            BottomRight = new DataPoint();
            TopRight    = new DataPoint();

            under_reading_amount = 0;
            over_reading_amount  = 0;
            SpeedLowerBound      = 0.08;
            SpeedUpperBound      = 0.08;

            TrainAnnotation = new ImageAnnotation();
            TrainAnnotation.AnchorDataPoint = Position;
            TrainAnnotation.AnchorOffsetY   = -4;
            TrainAnnotation.Image           = "TrainMoving";

            TrainLineAnnotation                      = new VerticalLineAnnotation();
            TrainLineAnnotation.AxisX                = GraphVisualizer.AxisX;
            TrainLineAnnotation.AxisY                = GraphVisualizer.AxisY;
            TrainLineAnnotation.LineColor            = Color.LightGray;
            TrainLineAnnotation.LineDashStyle        = ChartDashStyle.Dash;
            TrainLineAnnotation.LineWidth            = 2;
            TrainLineAnnotation.IsSizeAlwaysRelative = false;

            UpdateToolTip();

            InitializeProperties(SeriesChartType.Line, "Train position and accuracy",
                                 "Represents the position of the train and the odometry accuracy", Color.Red);
        }
        public void UpdateLibrary(object o, NotifyCollectionChangedEventArgs args)
        {
            foreach (var g in args.NewItems)
            {
                if (Lib.Count > 1)
                {
                    StackPanel.Children.Add(new Rectangle
                    {
                        Stroke = new SolidColorBrush(Colors.Transparent),
                        Fill   = new SolidColorBrush(Color.FromArgb(255, 112, 128, 144)),
                        Margin = new Thickness(5, 0, 5, 0),
                        Width  = 1
                    });
                }
                var label = new Label
                {
                    Content           = Lib.Count + ")",
                    VerticalAlignment = VerticalAlignment.Top
                };
                StackPanel.Children.Add(label);
                label.UpdateLayout();
                label.Margin = new Thickness(0, 0, -label.ActualWidth, 0);

                var gv = new GraphVisualizer
                {
                    Width = StackPanel.ActualHeight,
                    HorizontalAlignment    = HorizontalAlignment.Left,
                    VisualizationAlgorithm = VisualizationAlgorithm.Circle,
                    Foreground             = new SolidColorBrush(Color.FromArgb(0, 0, 0, 0)),
                    DefaultVertexRadius    = 10
                };
                StackPanel.Children.Add(gv);
                gv.UpdateLayout();
                gv.Graph = (UndirectedGraph)g;
            }
        }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="graphVisualizer"></param>
 /// <param name="function"></param>
 public ProfileFunctionGraph(GraphVisualizer graphVisualizer, ProfileFunction function)
     : base(graphVisualizer)
 {
     Function = function;
 }
Ejemplo n.º 20
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="graphVisualizer"></param>
 /// <param name="function"></param>
 public PointFunctionGraph(GraphVisualizer graphVisualizer, PointFunction function)
     : base(graphVisualizer)
 {
     Function        = function;
     Data.MarkerSize = 8;
 }
Ejemplo n.º 21
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="graphVisualizer"></param>
 /// <param name="function"></param>
 public SurfaceGraph(GraphVisualizer graphVisualizer, SurfaceFunction function)
     : base(graphVisualizer)
 {
     Function = function;
 }
 // Use this for initialization
 void Start()
 {
     graph = FindObjectOfType <GraphVisualizer> ();
     a     = transform.GetChild(0);
     b     = transform.GetChild(1);
 }
Ejemplo n.º 23
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="graphVisualizer"></param>
 /// <param name="function"></param>
 public SurfaceGraph(GraphVisualizer graphVisualizer, SurfaceFunction function)
     : base(graphVisualizer)
 {
     Function = function;
 }
Ejemplo n.º 24
0
 private void Awake()
 {
     random          = new Random();
     graphVisualizer = GetComponent <GraphVisualizer>();
 }
 public EfsProfileFunctionGraph(GraphVisualizer graphVisualizer, ProfileFunction function, string functionName)
     : base(graphVisualizer, function)
 {
     InitializeProperties(SeriesChartType.Line, functionName, functionName);
 }
 void Start()
 {
     d     = transform.parent.GetComponent <Document_Behaviour>();
     graph = FindObjectOfType <GraphVisualizer>();
 }
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="graphVisualizer"></param>
 /// <param name="function"></param>
 public PointFunctionGraph(GraphVisualizer graphVisualizer, PointFunction function)
     : base(graphVisualizer)
 {
     Function = function;
     Data.MarkerSize = 8;
 }
Ejemplo n.º 28
0
 /// <summary>
 ///     Constructor
 /// </summary>
 /// <param name="graphVisualizer"></param>
 /// <param name="function"></param>
 public ProfileFunctionGraph(GraphVisualizer graphVisualizer, ProfileFunction function)
     : base(graphVisualizer)
 {
     Function = function;
 }