Ejemplo n.º 1
0
        void origin_MouseEnter(object sender, MouseEventArgs e)
        {
            var origin = sender as DCEL2D.DCELVertex2D;

            switch (MeshViewMode)
            {
            case ViewMode.Geometry:
                break;

            case ViewMode.Wireframe:
                break;

            case ViewMode.DCELStructure:
                origin.Fill           = Brushes.Blue;
                origin.Leaving.Stroke = Brushes.Green;
                break;

            case ViewMode.LeavingEdges:
                origin.Fill = Brushes.Blue;
                foreach (var item in LINQueries.LeavingEdges(this, origin, LINQueries.QueryExecutionMode.Default))
                {
                    buffer.Add(item);
                    item.Stroke = Brushes.Green;
                }
                break;

            case ViewMode.AdjacentFaces:
                origin.Fill = Brushes.Blue;
                foreach (var item in origin.AdjacentFaces())
                {
                    buffer.Add(item);
                    item.Fill = Brushes.Green;
                }
                break;

            case ViewMode.AdjacentVertices:
                origin.Fill = Brushes.Blue;
                foreach (var item in origin.AdjacentVertices())
                {
                    buffer.Add(item);
                    item.Fill = Brushes.Orange;
                }
                break;

            case ViewMode.KStar:
                origin.Fill = Brushes.Blue;
                foreach (var item in origin.KStar(K))
                {
                    buffer.Add(item);
                    item.Fill = Brushes.Green;
                }
                break;

            default:
                break;
            }
        }
Ejemplo n.º 2
0
        public ActionResult Edit([Bind(Include = "ID,Title,Details,PromotorID,PromotorName,IsTaken,IsAccepted,IsRejected,IsProposed,TakenByID, TypeOf")] Topics topics)
        {
            if (ModelState.IsValid)
            {
                db.Entry(topics).State = EntityState.Modified;
                topics.PromotorName    = LINQueries.GetNameByID(topics.PromotorID);
                db.SaveChanges();

                return(RedirectToAction("Index"));
            }
            return(View(topics));
        }
Ejemplo n.º 3
0
        public ActionResult StudentProposition([Bind(Include = "ID,Title,Details,PromotorID,PromotorName,IsTaken,IsAccepted,IsRejected,IsProposed, TakenByID, TypeOf")] Topics topics)
        {
            if (ModelState.IsValid)
            {
                db.Topics.Add(topics);
                topics.TakenBy      = User.Identity.Name.ToString();
                topics.TakenByID    = User.Identity.GetUserId().ToString();
                topics.IsProposed   = true;
                topics.PromotorName = LINQueries.GetNameByID(topics.PromotorID);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(topics));
        }
Ejemplo n.º 4
0
        //public DCELMesh mesh = DCELTools.LoadFromOFF(@"shapes/hexagon.off");

        public TestApp()
        {
            Stopwatch sw = new Stopwatch();

            mesh.AddVertex(new DCELVertex2D(5, 5, null));

            for (int i = 0; i < 1000000; i++)
            {
                mesh.AddHalfEdge(new DCELHalfEdge2D(mesh.VertexList[0], null, null, null));
            }

            sw.Start();
            var q1 = LINQueries.LeavingEdges(mesh, mesh.VertexList[0],
                                             LINQueries.QueryExecutionMode.ForEachLoop).ToList();

            sw.Stop();
            Console.WriteLine("Foreach loop: " + sw.Elapsed.TotalMilliseconds);

            sw.Restart();
            var q2 = LINQueries.LeavingEdges(mesh, mesh.VertexList[0],
                                             LINQueries.QueryExecutionMode.ForLoop).ToList();

            sw.Stop();
            Console.WriteLine("For loop: " + sw.Elapsed.TotalMilliseconds);

            sw.Restart();
            var q5 = LINQueries.LeavingEdges(mesh, mesh.VertexList[0],
                                             LINQueries.QueryExecutionMode.ForWithAssignment).ToList();

            sw.Stop();
            Console.WriteLine("For with assignment loop: " + sw.Elapsed.TotalMilliseconds);

            sw.Restart();
            var q3 = LINQueries.LeavingEdges(mesh, mesh.VertexList[0],
                                             LINQueries.QueryExecutionMode.Default).ToList();

            sw.Stop();
            Console.WriteLine("Default: " + sw.Elapsed.TotalMilliseconds);

            sw.Restart();
            var q4 = LINQueries.LeavingEdges(mesh, mesh.VertexList[0],
                                             LINQueries.QueryExecutionMode.AsParallel).ToList();

            sw.Stop();
            Console.WriteLine("As parallel: " + sw.Elapsed.TotalMilliseconds);

            Console.ReadLine();
        }