public Node FindNodeWhichContains(UV point) { Node n = null; if (IsLeafNode) { if (Contains(point)) { return(this); } } else { if (NW.Contains(point)) { n = NW.FindNodeWhichContains(point); } else if (NE.Contains(point)) { n = NE.FindNodeWhichContains(point); } else if (SW.Contains(point)) { n = SW.FindNodeWhichContains(point); } else if (SE.Contains(point)) { n = SE.FindNodeWhichContains(point); } } return(n); }
public List <Node> FindNodesWithinRadius(UV location, double radius) { var nodes = new List <Node>(); var circle = Circle.ByCenterPointRadius( Autodesk.DesignScript.Geometry.Point.ByCoordinates(location.U, location.V), radius); if (!Intersects(circle)) { return(nodes); } if (IsLeafNode) { nodes.Add(this); return(nodes); } nodes.AddRange(NW.FindNodesWithinRadius(location, radius)); nodes.AddRange(NE.FindNodesWithinRadius(location, radius)); nodes.AddRange(SW.FindNodesWithinRadius(location, radius)); nodes.AddRange(SE.FindNodesWithinRadius(location, radius)); return(nodes); }
public bool TryFind(UV uv, out Node node) { if (!Contains(uv)) { node = null; return(false); } if (IsLeafNode) { if (Point.IsAlmostEqualTo(uv)) { node = this; return(true); } else { node = null; return(false); } } if (NW.Contains(uv)) { if (NW.TryFind(uv, out node)) { return(true); } } else if (NE.Contains(uv)) { if (NE.TryFind(uv, out node)) { return(true); } } else if (SW.Contains(uv)) { if (SW.TryFind(uv, out node)) { return(true); } } else if (SE.Contains(uv)) { if (SE.TryFind(uv, out node)) { return(true); } } node = null; return(false); }
private async Task ShowButtons() { var speed = 25U; await N.FadeTo(1, speed); await NW.FadeTo(1, speed); await SW.FadeTo(1, speed); await S.FadeTo(1, speed); }
private async Task HideButtons() { var speed = 25U; await N.FadeTo(0, speed); await NW.FadeTo(0, speed); await SW.FadeTo(0, speed); await S.FadeTo(0, speed); }
public void Flash(int turnNumber) { LastFlashTurn = turnNumber; FlashCount++; NW?.DoTurn(turnNumber, true); N?.DoTurn(turnNumber, true); NE?.DoTurn(turnNumber, true); W?.DoTurn(turnNumber, true); E?.DoTurn(turnNumber, true); SW?.DoTurn(turnNumber, true); S?.DoTurn(turnNumber, true); SE?.DoTurn(turnNumber, true); }
public void Insert(UV uv) { if (!Contains(uv)) { return; } if (IsLeafNode) { // If the node that is being inserted is // the same as one that exists, then return // true; if (Point == null) { Point = uv; return; } if (uv.IsAlmostEqualTo(Point)) { return; } Split(); // Move the existing point into a new cell NW.Insert(UV.ByCoordinates(Point.U, Point.V)); NE.Insert(UV.ByCoordinates(Point.U, Point.V)); SE.Insert(UV.ByCoordinates(Point.U, Point.V)); SW.Insert(UV.ByCoordinates(Point.U, Point.V)); Point = null; // Insert the new UV into the correct cell NW.Insert(uv); NE.Insert(uv); SW.Insert(uv); SE.Insert(uv); } else { NW.Insert(uv); NE.Insert(uv); SW.Insert(uv); SE.Insert(uv); } }
public List <Node> GetAllNodes() { var nodes = new List <Node>(); if (IsLeafNode) { nodes.Add(this); return(nodes); } nodes.AddRange(NW.GetAllNodes()); nodes.AddRange(NE.GetAllNodes()); nodes.AddRange(SW.GetAllNodes()); nodes.AddRange(SE.GetAllNodes()); return(nodes); }
/// <summary> /// Navigates the specified URL. /// </summary> /// <param name="url">The URL.</param> /// <remarks>...</remarks> public void Navigate(string url) { if (package.CustomizedSettings.RenderingMode == RenderingMode.External) { try { var p = new Process(); p.StartInfo.Arguments = url; p.StartInfo.FileName = package.CustomizedSettings.ExternalBrowserCommand; p.StartInfo.UseShellExecute = true; p.Start(); } catch (Exception ex) { Api.Logger.LogError(InternetPackage.Properties.Resources.UnableToLaunchExternalBrowser, ex); } } else if (package.CustomizedSettings.RenderingMode == RenderingMode.NW) { try { NW.Run(Newgen.InternalHelper.GetHomePagePath(url)); } catch (Exception ex) { Api.Logger.LogError(InternetPackage.Properties.Resources.UnableToRunNW, ex); } } else { Application.Current.Dispatcher.BeginInvoke(new Action(() => { if (hub != null) { if (hub.IsVisible) { hub.Activate(); } hub.Navigate(url); } else { hub = new Hub(package, url); hub.AllowsTransparency = false; hub.ShowDialog(); hub.Navigate(url); } })); } }
/// <summary> /// Returns all objects stored in this node/nodes under this node. /// </summary> /// <returns>A list of objects that are stored under this node.</returns> private List <T> GetAllObjectsUnder() { if (isLeaf) { return(nodeBucket.Where(x => x != null).ToList()); } else { List <T> allObjects = new List <T>(); allObjects.AddRange(NE.GetAllObjectsUnder()); allObjects.AddRange(NW.GetAllObjectsUnder()); allObjects.AddRange(SE.GetAllObjectsUnder()); allObjects.AddRange(SW.GetAllObjectsUnder()); return(allObjects); } }
private async void ShowMenuOptions() { Device.BeginInvokeOnMainThread(() => { circle.ScaleTo(120, animationDelay * 5, Easing.BounceOut); bmiLabel.FadeTo(1, animationDelay * 5); }); await N.ScaleTo(scaleSize, animationDelay, Easing.BounceOut); await NE.ScaleTo(scaleSize, animationDelay, Easing.BounceOut); await SE.ScaleTo(scaleSize, animationDelay, Easing.BounceOut); await SW.ScaleTo(scaleSize, animationDelay, Easing.BounceOut); await NW.ScaleTo(scaleSize, animationDelay, Easing.BounceOut); }
private void ResetAll() { N.GetComponent <Renderer>().enabled = false; NE.GetComponent <Renderer>().enabled = false; E.GetComponent <Renderer>().enabled = false; SE.GetComponent <Renderer>().enabled = false; S.GetComponent <Renderer>().enabled = false; SW.GetComponent <Renderer>().enabled = false; W.GetComponent <Renderer>().enabled = false; NW.GetComponent <Renderer>().enabled = false; }
public override string ToString() { StringBuilder sb = new StringBuilder(); // sb.AppendFormat("{{X={0},Y={1},Z={2}", X, Y, Z); sb.AppendFormat("{{Row={0},Column={1},Count={2}", Row, Column, Count); if (E != null) { sb.AppendFormat(",E={0}", E.GetHashCode()); } if (W != null) { sb.AppendFormat(",W={0}", W.GetHashCode()); } if (N != null) { sb.AppendFormat(",N={0}", N.GetHashCode()); if (NE != null) { sb.AppendFormat(",NE={0}", NE.GetHashCode()); } if (NW != null) { sb.AppendFormat(",NW={0}", NW.GetHashCode()); } } if (S != null) { sb.AppendFormat(",S={0}", S.GetHashCode()); if (SE != null) { sb.AppendFormat(",SE={0}", SE.GetHashCode()); } if (SW != null) { sb.AppendFormat(",SW={0}", SW.GetHashCode()); } } sb.Append("}"); return(sb.ToString()); }
public List <Node> FindNodesIntersectingRectangle(UVRect rectangle) { var nodes = new List <Node>(); if (!Intersects(rectangle)) { return(nodes); } if (IsLeafNode) { nodes.Add(this); return(nodes); } nodes.AddRange(NW.FindNodesIntersectingRectangle(rectangle)); nodes.AddRange(NE.FindNodesIntersectingRectangle(rectangle)); nodes.AddRange(SW.FindNodesIntersectingRectangle(rectangle)); nodes.AddRange(SE.FindNodesIntersectingRectangle(rectangle)); return(nodes); }
// Update is called once per frame void Update() { timer -= Time.deltaTime; int previousChunkx = Mathf.FloorToInt(previousPosition.x / tilex); int previousChunky = Mathf.FloorToInt(previousPosition.y / tiley); int currentChunkx = Mathf.FloorToInt(playerTransform.position.x / tilex); int currentChunky = Mathf.FloorToInt(playerTransform.position.y / tiley); previousPosition = playerTransform.position; if (previousChunkx == currentChunkx && previousChunky == currentChunky) // C --> C { return; } if (previousChunkx + 1 == currentChunkx && previousChunky + 1 == currentChunky) // C --> NE { W.Unload(); SW.Unload(); S.Unload(); NW.Unload(); SE.Unload(); W = N; SW = C; S = E; C = NE; NW = GenChunk(currentChunkx - 1, currentChunky + 1); N = GenChunk(currentChunkx, currentChunky + 1); NE = GenChunk(currentChunkx + 1, currentChunky + 1); E = GenChunk(currentChunkx + 1, currentChunky); SE = GenChunk(currentChunkx + 1, currentChunky - 1); } if (previousChunkx == currentChunkx && previousChunky + 1 == currentChunky) // C --> N { SW.Unload(); S.Unload(); SE.Unload(); SW = W; S = C; SE = E; W = NW; C = N; E = NE; NW = GenChunk(currentChunkx - 1, currentChunky + 1); N = GenChunk(currentChunkx, currentChunky + 1); NE = GenChunk(currentChunkx + 1, currentChunky + 1); } if (previousChunkx - 1 == currentChunkx && previousChunky + 1 == currentChunky) // C --> NW { S.Unload(); SE.Unload(); E.Unload(); NE.Unload(); SW.Unload(); E = N; SE = C; S = W; C = NW; NW = GenChunk(currentChunkx - 1, currentChunky + 1); N = GenChunk(currentChunkx, currentChunky + 1); NE = GenChunk(currentChunkx + 1, currentChunky + 1); W = GenChunk(currentChunkx - 1, currentChunky); SW = GenChunk(currentChunkx - 1, currentChunky - 1); } if (previousChunkx + 1 == currentChunkx && previousChunky == currentChunky) // C --> E { NW.Unload(); W.Unload(); SW.Unload(); NW = N; W = C; SW = S; N = NE; C = E; S = SE; NE = GenChunk(currentChunkx + 1, currentChunky + 1); E = GenChunk(currentChunkx + 1, currentChunky); SE = GenChunk(currentChunkx + 1, currentChunky - 1); } if (previousChunkx - 1 == currentChunkx && previousChunky == currentChunky) // C --> W { NE.Unload(); E.Unload(); SE.Unload(); NE = N; E = C; SE = S; N = NW; C = W; S = SW; NW = GenChunk(currentChunkx - 1, currentChunky + 1); W = GenChunk(currentChunkx - 1, currentChunky); SW = GenChunk(currentChunkx - 1, currentChunky - 1); } if (previousChunkx + 1 == currentChunkx && previousChunky - 1 == currentChunky) // C --> SE { W.Unload(); NW.Unload(); N.Unload(); NE.Unload(); SW.Unload(); NW = C; N = E; C = SE; W = S; NE = GenChunk(currentChunkx + 1, currentChunky + 1); E = GenChunk(currentChunkx + 1, currentChunky); SE = GenChunk(currentChunkx + 1, currentChunky - 1); S = GenChunk(currentChunkx, currentChunky - 1); SW = GenChunk(currentChunkx - 1, currentChunky - 1); } if (previousChunkx == currentChunkx && previousChunky - 1 == currentChunky) // C --> S { NW.Unload(); N.Unload(); NE.Unload(); NW = W; N = C; NE = E; W = SW; C = S; E = SE; SW = GenChunk(currentChunkx - 1, currentChunky - 1); S = GenChunk(currentChunkx, currentChunky - 1); SE = GenChunk(currentChunkx + 1, currentChunky - 1); } if (previousChunkx - 1 == currentChunkx && previousChunky - 1 == currentChunky) // C --> SW { NW.Unload(); N.Unload(); NE.Unload(); E.Unload(); SE.Unload(); N = W; NE = C; E = S; C = SW; W = GenChunk(currentChunkx - 1, currentChunky); SW = GenChunk(currentChunkx - 1, currentChunky - 1); S = GenChunk(currentChunkx, currentChunky - 1); NW = GenChunk(currentChunkx - 1, currentChunky + 1); SE = GenChunk(currentChunkx + 1, currentChunky - 1); } if (C.Horse) { C.Horse.GetComponent <FreeHorseAI> ().Activate(playerTransform); ShowNextCredits(); } }
protected override void OnHandleCreated(EventArgs e) { base.OnHandleCreated(e); nw = new NW(this.Handle, lb); }
/// <summary> /// Handles the MouseLeftButtonUp event of the tileImage control. /// </summary> /// <param name="sender">The source of the event.</param> /// <param name="e">The <see cref="System.Windows.Input.MouseButtonEventArgs"/> instance containing the event data.</param> /// <remarks>...</remarks> private void tileImage_MouseLeftButtonUp(object sender, System.Windows.Input.MouseButtonEventArgs e) { NW.Run(GetServerUriOfPackageResourceFor(customizedSettings.HubPage)); }
public DummyDataContext() { Europa = new Continent(); Europa.ContinentID = 1; Europa.Name = "Europa"; Graad = new Grade(1); Belgium = new Country("Belgie",Europa); England = new Country("England",Europa); Belgium.CountryID = 1; England.CountryID = 2; //Belgium.AboveEquator = true; //England.AboveEquator = false; //voor te testen. England ligt obviously boven de Equator int[] temp = new int[]{1,5,3,4,5,6,7,8,9,10,40,12}; int[] sed = new int[] {10, 206, 30, 200, 50, 60, 70, 80, 20, 100, 110, 120}; int[] temp2 = new int[] { 1, 2, 3, 0, -10, -12, 7, 8, 9, 10, 11, 12 }; int[] sed2 = new int[] { 10, 20, 30, 40, 50, 60, 70, 80, 90, 100, 110, 120 }; NegTempClimateChart = new ClimateChart("Chelsea",2000,2030,temp2,sed2, -20, 10); NegTempClimateChart.Country = England; NegTempClimateChart.ClimateChartID = 2; England.ClimateCharts = new List<ClimateChart>{NegTempClimateChart}; Gent = new ClimateChart("gent",1950,1960,temp,sed, 55, 6); Gent.Country = Belgium; Gent.ClimateChartID = 1; ClimateCharts = new List<ClimateChart>{ Gent }; Belgium.ClimateCharts = ClimateCharts; Countries = new List<Country>{ Belgium,England }; Europa.Countries = Countries; Continenten = new List<Continent>{ Europa }; Graad.Continents = Continenten; Parameter tw = new TW("Wat is de temperatuur van de warmste maand (TW)?"); Parameter mw = new MW("Wat is de warmste maand?"); Parameter mk = new MK("Wat is de temperatuur van de koudste maand?"); Parameter tk = new TK("Wat is de temperatuur van de koudste maand (TK)?"); Parameter d = new D("Hoeveel droge maanden zijn er?"); Parameter nz = new NZ("Hoeveelheid neerslag in de zomer?"); Parameter nw = new NW("Hoeveelheid neerslag in de winter?"); Parameter tj = new TJ(""); Parameter nj = new NJ(""); Parameter tm = new TM(""); //ClauseComponent tw10 = new Clause("TW <= 10", tw, "<=", 10); //ClauseComponent CC2 = new Clause("TW <= 10", tw, "<", 10); //ClauseComponent CC3 = new Clause("TW <= 10", tw, ">=", 10); //ClauseComponent CC4 = new Clause("TW <= 10", tw, ">", 10); //ClauseComponent res1 = new Result("YES", "geen woestijn"); //ClauseComponent res2 = new Result("NO", "woestijn"); //tw10.ClauseComponentId = 1; //res1.ClauseComponentId = 2; //res2.ClauseComponentId = 3; //tw10.Add(true, res1); //tw10.Add(false, res2); //CC2.Add(true, res1); //CC2.Add(false, res2); //CC3.Add(true, res1); //CC3.Add(false, res2); //CC4.Add(true, res1); //CC4.Add(false, res2); //DetTable = new DeterminateTable(); //DetTable2 = new DeterminateTable(); //DetTable3 = new DeterminateTable(); //DetTable4 = new DeterminateTable(); Graad.DeterminateTableProp = DetTable; Country belgië = new Country { Name = "België" }; temps = new int[] { 10, 12, 12, 14, 15, 20, 28, 32, 28, 16, 6, 2 }; sed = new[] { 120, 145, 200, 120, 150, 100, 140, 40, 100, 120, 130, 100 }; chart = new ClimateChart("Gent", 1990, 1991, temps, sed, 55, 6); chart.Country = belgië; temps2 = new int[] { 14, 15, 17, 21, 25, 27, 28, 27, 26, 23, 19, 15 }; sed2 = new[] { 7, 4, 4, 2, 0, 0, 0, 0, 0, 1, 3, 5 }; chart2 = new ClimateChart("Kaïro", 1961, 1990, temps2, sed2, -20, 2); Country egypte = new Country { Name = "Egypte" }; //egypte.AboveEquator = false; chart2.Country = egypte; temps3 = new int[] { 0, 1, 5, 11, 17, 22, 25, 24, 20, 14, 9, 3 }; sed3 = new[] { 77, 73, 91, 96, 97, 91, 103, 95, 86, 77, 97, 86 }; chart3 = new ClimateChart("New York", 1961, 1990, temps3, sed3, 50, -50); Country newyork = new Country { Name = "New York" }; chart3.Country = newyork; temps4 = new int[] { 25, 1, 5, 11, 17, 22, 25, 24, 20, 14, 9, 3 }; sed4 = new[] { 1, 2, 0, 0, 0, 100, 100, 100, 100, 100, 0, 0 }; chart4 = new ClimateChart("Fictief", 1961, 1990, temps4, sed4, 60, 20); Country fictief = new Country { Name = "Fictief" }; chart4.Country = fictief; byte[] picture = null; ClauseComponent tw10 = new Clause("TW <= 10", tw, "<=", 10); ClauseComponent tw0 = new Clause("TW <= 0", tw, "<=", 0); ClauseComponent tw0Yes = new Result("Koud klimaat zonder dooiseizoen", "Ijswoestijnklimaat", picture); ClauseComponent tw0No = new Result("Koud klimaat met dooiseizoen", "Toendraklimaat", picture); tw0.Add(true, tw0Yes); tw0.Add(false, tw0No); tw10.Add(true, tw0); ClauseComponent tj0 = new Clause("TJ <= 0", tj, "<=", 0); tw10.Add(false, tj0); ClauseComponent tj0Yes = new Result("Koudgematigd klimaat met strenge winter", "Taigaklimaat", picture); tj0.Add(true, tj0Yes); ClauseComponent nj200 = new Clause("NJ <= 200", nj, "<=", 200); ClauseComponent tk15 = new Clause("TK <= 15", tk, "<=", 15); ClauseComponent tk15Yes = new Result("Gematigd altijd droog klimaat", "Woestijnklimaat van de middelbreedten", picture); ClauseComponent tk15No = new Result("Warm altijd droog klimaat", "Woestijnklimaat van de tropen", picture); tk15.Add(true, tk15Yes); tk15.Add(false, tk15Yes); nj200.Add(true, tk15); tj0.Add(false, nj200); ClauseComponent tk18 = new Clause("TK <= 18", tk, "<=", 18); ClauseComponent nj400 = new Clause("NJ <= 400", nj, "<=", 400); ClauseComponent nj400Yes = new Result("Gematigd, droog klimaat", "Steppeklimaat", picture); ClauseComponent tk10N = new Clause("TK <= -10", tk, "<=", -10); ClauseComponent tk10NYes = new Result("Koudgematigd klimaat met strenge winter", "Taigaklimaat", picture); ClauseComponent d1 = new Clause(" D <= 1", d, "<=", 1); ClauseComponent tk3N = new Clause("TK <= -3", tk, "<=", -3); ClauseComponent tk3NYes = new Result("Koelgematigd klimaat met koude winter", "Gemengd-woudklimaat", picture); ClauseComponent tw22 = new Clause(" TW <= 22", tw, "<=", 22); ClauseComponent tw22Yes = new Result("Koelgematigd klimaat met zachte winter", "Loofbosklimaat", picture); ClauseComponent tw22No = new Result("Warmgematigd altijd nat klimaat", "Subtropisch regenwoudklimaat", picture); ClauseComponent nznw = new Clause("NZ <= NW", nz, nw); ClauseComponent tw222 = new Clause("TW <= 22", tw, "<=", 22); ClauseComponent tw222Yes = new Result("Koelgematigd klimaat met natte winter", "Hardbladige-vegetatieklimaat van de centrale middelbreedten", picture); ClauseComponent tw222No = new Result("Warmgematigd klimaat met natte winter", "Hardbladige-vegetatieklimaat van de subtropen", picture); ClauseComponent nznwNo = new Result("Warmgematigd klimaat met natte zomer", "Subtropisch savanneklimaat", picture); tw222.Add(true, tw222Yes); tw222.Add(false, tw222No); nznw.Add(true, tw222); nznw.Add(false, nznwNo); tw22.Add(true, tw22Yes); tw22.Add(false, tw22No); tk3N.Add(true, tk3NYes); tk3N.Add(false, tw22); d1.Add(true, tk3N); d1.Add(false, nznw); tk10N.Add(true, tk10NYes); tk10N.Add(false, d1); nj400.Add(true, nj400Yes); nj400.Add(false, tk10N); tk18.Add(true, nj400); nj200.Add(false, tk18); ClauseComponent d12 = new Clause("D <= 1", d, "<=", 1); ClauseComponent d12Yes = new Result("Warm klimaat met nat seizoen", "Tropisch savanneklimaat", picture); ClauseComponent d12No = new Result("Warm altijd nat klimaat", "Tropisch regenwoudklimaat", picture); d12.Add(true, d12Yes); d12.Add(false, d12No); tk18.Add(false, d12); dTable = new DeterminateTable(); List<ClauseComponent> results1 = (new ClauseComponent[] { tw0, tj0,nj200, tk15,tk18, nj400, tk10N, d1, tk3N, tw22, nznw, tw222, d12, tw0Yes, tw0No, tj0Yes, tk15Yes, tk15No, nj400Yes, tk10NYes, tk3NYes, tw22Yes, tw22No, tw222Yes, tw222No, nznwNo, d12Yes, d12No, tw10 }).ToList(); results1.ForEach(r => dTable.AllClauseComponents.Add(r)); }