示例#1
0
 public JsonResult AddNeighbor(Neighbor neighbor)
 {
     try
     {
         //var neighbor = JsonConvert.DeserializeObject<Neighbor>(stringNeighbor);
         _neighborManager.Add(neighbor);
         return(Json(new { msg = "Başarılı", data = _neighborManager.Get(neighbor), drm = true }));
     }
     catch (Exception ex)
     {
         return(Json(new { msg = ex.Message.ToString(), drm = false }));
     }
 }
示例#2
0
        public JsonResult UpdateHandle(UpdateHandlerModel model)
        {
            List <Door>     doors     = new List <Door>();
            List <Neighbor> neighbors = new List <Neighbor>();

            foreach (var fakeDoor in model.Points)
            {
                var door = _doorManager.Get(new Door {
                    Id = fakeDoor.Id
                });
                door.Geometry = fakeDoor.Geometry;
                doors.Add(door);
            }

            foreach (var fakeNeighbor in model.Polygons)
            {
                var neighbor = _neighborManager.Get(new Neighbor {
                    Id = fakeNeighbor.Id
                });
                neighbor.Geometry = fakeNeighbor.Geometry;
                neighbors.Add(neighbor);
            }

            try
            {
                UpdateHandler.Control(doors, neighbors);
            }
            catch (Exception ex)
            {
                UpdateHandler.TakeOver();
                return(Json(new { msg = ex.Message, drm = false }));
            }

            return(Json(new { msg = "Başarılı", drm = true }));
        }
示例#3
0
        public static void Control(List <Door> doors, List <Neighbor> neighbors)
        {
            foreach (var door in doors)
            {
                dataDoors.Add(doorManager.Get(door));
                doorManager.Update(door);
            }

            foreach (var neighbor in neighbors)
            {
                dataNeighbors.Add(neighborManager.Get(neighbor));
                neighborManager.Update(neighbor);
            }

            Handle(doors);
            Handle(neighbors);
        }
        public void MeanBoundary_NeiborsHaveTheSame()
        {
            var pixMan = new PixelsManager <Basin3>(healpixManager);

            foreach (var basin in pixMan.Pixels)
            {
                foreach (Direction to in Enum.GetValues(typeof(Direction)))
                {
                    var edge = man.MeanBoundary(basin, to).Direction;

                    var toBasin = pixMan.Pixels[man.Get(to, basin)];
                    var from    = (Direction)basin.GetFromAndFillType(to, toBasin, healpixManager);
                    var edgeTo  = man.MeanBoundary(toBasin, from).Direction;

                    Assert.AreEqual(edge.X, edgeTo.X, .0000000001);
                    Assert.AreEqual(edge.Y, edgeTo.Y, .0000000001);
                    Assert.AreEqual(edge.Z, edgeTo.Z, .0000000001);
                }
            }
        }