/* * This routine is used to invert the hole points, specifically the 'Y' points. * The html canvas has 0,0 at the upper left and 'Y' goes down. For the holegroup canvas * we want a 'Y' that goes up, because that's how the holes are overlaid and appear in * three dimensions, and how we think of them intuitively. To manage this we'll simply flip the * Y points for the duration of the time that they are being edited and reflip them when its time to save */ public void InvertHolePoints() { for (int i = 0; i < HoleGroupList.Count; i++) { HoleGroup hg = HoleGroupList.GetFrom(i); for (int j = 0; j < hg.HoleList.Length; j++) { /* * For all hole types the offset Y is inverted */ LayoutHole oHole = hg.HoleList[j]; oHole.OffsetY = -oHole.OffsetY; /* * For polygon hole types the individual Y's are inverted */ if (oHole.HoleType == "poly") { BoundaryPolygon oPolygon = BoundaryPolygonList.GetFrom(oHole.HoleTypeIndex); for (int k = 0; k < oPolygon.PointList.Length; k++) { Point3D p = oPolygon.PointList[k]; p.Y = -p.Y; } } } } }
public void AddHoleGroup(string HoleGroupID) { HoleGroup hg = new HoleGroup(); hg.HoleGroupID = HoleGroupID; hg.HoleList = new LayoutHole[0]; HoleGroupList.Add(hg); }
public void RemoveHoleFromHoleGroup(HoleGroup hg, int index) { #if DOTNET List <LayoutHole> tmp = new List <LayoutHole>(hg.HoleList); tmp.RemoveAt(index); hg.HoleList = tmp.ToArray(); #else hg.HoleList.splice(index, 1); #endif }
public void AddHoleToHoleGroup(HoleGroup hg, LayoutHole oNewHole) { #if DOTNET List <LayoutHole> tmp = new List <LayoutHole>(hg.HoleList); tmp.Add(oNewHole); hg.HoleList = tmp.ToArray(); #else hg.HoleList.push(oNewHole); #endif }
public void SelectHoleGroup(string name) { for (int i = 0; i < HoleGroupList.Count; i++) { HoleGroup hg = HoleGroupList.GetFrom(i); if (hg.HoleGroupID == name) { MostRecentlySelectedHoleGroup = hg; return; } } }
public void LoadFromJSON( HoleGroup[] HoleGroupArray, BoundaryRectangle[] RectangleArray, BoundaryEllipse[] EllipseArray, BoundaryPolygon[] PolygonArray) { HoleGroupList = new List <HoleGroup>(); for (int i = 0; i < HoleGroupArray.Length; i++) { HoleGroup hg = new HoleGroup(); hg.HoleGroupID = HoleGroupArray[i].HoleGroupID; /* * When the objects get here in JS the holelist is no longer a list type, its an array type because * of serialization. */ int len = GetHoleListLength(HoleGroupArray[i].HoleList); for (int j = 0; j < len; j++) { LayoutHole oHoleToAdd = HoleGroupArray[i].HoleList[j]; AddHoleToHoleGroup(hg, oHoleToAdd); } HoleGroupList.Add(hg); } BoundaryRectangleList = new List <BoundaryRectangle>(); for (int i = 0; i < RectangleArray.Length; i++) { BoundaryRectangleList.Add(RectangleArray[i]); } BoundaryEllipseList = new List <BoundaryEllipse>(); for (int i = 0; i < EllipseArray.Length; i++) { BoundaryEllipseList.Add(EllipseArray[i]); } BoundaryPolygonList = new List <BoundaryPolygon>(); for (int i = 0; i < PolygonArray.Length; i++) { BoundaryPolygonList.Add(PolygonArray[i]); } /* * Now flip all of the Y points so that positive Y values go 'up' */ InvertHolePoints(); }
Dictionary <int, GameObject> fenches = new Dictionary <int, GameObject>(); //存放fenches的对象 void Start() { if (Instance == null) { Instance = this; } else { //Instance.Init(); Destroy(gameObject); } //Init(); //DontDestroyOnLoad(gameObject); //防止restart时自身被销毁 }
void DeleteHoleGroup(string HoleGroupID) { for (int i = 0; i < HoleGroupList.Count; i++) { HoleGroup hg = HoleGroupList.GetFrom(i); if (hg.HoleGroupID == HoleGroupID) { HoleGroupList.RemoveAt(i); MostRecentlySelectedHole = null; MostRecentlySelectedHoleGroup = null; MostRecentlySelectedPolygonEdgeIndex = -1; MostRecentlySelectedPolygonVertexIndex = -1; return; } } }
public void AddHoleToHoleList(HoleGroup hg, Hole oNewHole) { }
public IActionResult Put(string id, HoleGroup data) { return(Json(_col.UpData(id, data))); }
public IActionResult Post(HoleGroup data) { data.Id = Guid.NewGuid().ToString(); return(Json(_col.Insert(data))); }