public void DeleteStrand(Strand strand) { strand.Species.Clear(); _db.StrandModStructures.RemoveRange(_db.StrandModStructures.Where(m => m.StrandId == strand.Id)); _db.SetEntityStateDeleted(strand); _db.SaveChanges(); }
public void CreateStrand(Strand strand) { if (!IsStrandExists(strand)) { // TODO: implement right way to handle relations between objects. var orientation = strand.Orientation.Name; strand.Target = null; strand.Orientation = null; PopulateSpecies(strand); PopulateModStructures(strand); _db.SetEntityStateAdded(strand); _db.SaveChanges(); // todo: PH (after addition of StrandModStructure table) //item.MW = CalculateMW(item.BaseSequence, item.Sequence); //item.ExtinctionCoefficient = CalculateEC(item.BaseSequence, item.Sequence); foreach (var modStructure in strand.StrandModStructures) { _db.Entry(modStructure).Reference(c => c.ModStructure).Load(); } strand.CalculateMW(); strand.CalculateEC(); strand.BuildSequence(); strand.BuildBaseSequence(); strand.StrandId = GetNextStrandId(strand.Id, orientation); _db.SetEntityStateModified(strand); _db.SaveChanges(); } }
GameObject DrawScaledStrand(float startX, float startY, float endX, float endY) { float spriteSize = strand.GetComponent <SpriteRenderer>().bounds.size.x; float lineDistance = Mathf.Sqrt(Mathf.Pow(endX - startX, 2) + Mathf.Pow(endY - startY, 2)); float lineAngle = Mathf.Atan2(endY - startY, endX - startX) * (180 / Mathf.PI); float scale = lineDistance / spriteSize; Strand strandToAdd = new Strand( new Node(startX, startY), new Node(endX, endY) ); GameObject newStrand = Instantiate( strand, new Vector3(startX, startY, 0), Quaternion.AngleAxis(lineAngle, Vector3.forward) ) as GameObject; strandList.Add(strandToAdd); newStrand.name = string.Format("Strand{0}", (strandList.Count - 4)); Vector3 originalRotation = newStrand.transform.localScale; newStrand.transform.localScale = new Vector3( scale, originalRotation.y, originalRotation.z ); return(newStrand); }
public IHttpActionResult CreateMultiple([FromBody] ICollection <StrandModel> model) { try { foreach (var strandModel in model) { var strand = new Strand(); Mapper.Map(strandModel, strand); if (!_strandsService.IsStrandExists(strand)) { _strandsService.CreateStrand(strand); strandModel.Id = strand.Id; } else { strandModel.SetError("Sequence", "Duplicate strand"); } } return(Ok(model)); } catch (Exception) { return(InternalServerError()); } }
public Vector3 LineIntersectsWindowframeAt(Vector3 begin, Vector3 finish) { Strand segment = new Strand( new Node(begin.x, begin.y), new Node(finish.x, finish.y) ); Vector3 direction = (finish - begin).normalized; float m = segment.getLineM(), c = segment.getLineC(); Vector3 topIntersect, leftIntersect, bottomIntersect, rightIntersect, result = Vector3.zero; topIntersect = new Vector3((float)(8 - c) / m, 8, 0); leftIntersect = new Vector3(-8, (float)(m * -8) + c, 0); bottomIntersect = new Vector3((float)(-8 - c) / m, -8, 0); rightIntersect = new Vector3(8, (float)(m * 8) + c, 0); Vector3[] intersects = new Vector3[] { topIntersect, leftIntersect, bottomIntersect, rightIntersect }; float angle; foreach (Vector3 pt in intersects) { Vector3 otherDirection = (pt - finish).normalized; angle = Vector3.Angle(otherDirection, direction); if (angle == 0 && (pt.x <= 8 && pt.x >= -8) && (pt.y <= 8 && pt.y >= -8)) { result = pt; } } return(result); }
// Use this for initialization void Start() { nodeList = new List <Node>(); strandList = new List <Strand>(); float frameX = 8; float frameY = 8; Node topRight, topLeft, bottomRight, bottomLeft; topRight = new Node(frameX, frameY); topLeft = new Node(-1 * frameX, frameY); bottomRight = new Node(frameX, -1 * frameY); bottomLeft = new Node(-1 * frameX, -1 * frameY); nodeList.Add(topRight); nodeList.Add(topLeft); nodeList.Add(bottomRight); nodeList.Add(bottomLeft); Strand topWall, rightWall, bottomWall, leftWall; topWall = new Strand(topLeft, topRight); rightWall = new Strand(topRight, bottomRight); bottomWall = new Strand(bottomRight, bottomLeft); leftWall = new Strand(bottomLeft, topLeft); strandList.Add(topWall); strandList.Add(rightWall); strandList.Add(bottomWall); strandList.Add(leftWall); UpdateAdjacencyMatrix(); }
private void DrawStrand(Graphics graphics, Rectangle clip, Strand strand) { int x; int y; x = strand.Position.X; y = strand.Position.Y; if (this.ShouldRender(clip, x, y)) { if (_drawShapes) { GraphicsState state; state = graphics.Save(); graphics.TranslateTransform(x, y); graphics.RotateTransform(Compass.GetAngle(strand.Heading)); graphics.DrawPolygon(_strandPen, _strandShape); graphics.Restore(state); } else { graphics.DrawLine(_strandPen, new Point(strand.Position.X - 1, strand.Position.Y - 1), new Point(strand.Position.X + 1, strand.Position.Y + 1)); graphics.DrawLine(_strandPen, new Point(strand.Position.X - 1, strand.Position.Y + 1), new Point(strand.Position.X + 1, strand.Position.Y - 1)); } } }
private void btnAddMark_Click(object sender, EventArgs e) { studentName = Interaction.InputBox("Enter Student Name:"); string strandName = Interaction.InputBox("Enter Strand Name:"); string expectationName = Interaction.InputBox("Enter Expectation Name:"); double mark = double.Parse(Interaction.InputBox("Enter Assignment Mark:")); double weight = double.Parse(Interaction.InputBox("Enter Mark Weight:")); Strand strandUsed = new Strand("", 0); foreach (Strand s in strands) { if (s.name == strandName) { strandUsed = s; break; } } Expectation exUsed = new Expectation("", 0); foreach (Expectation ex in strandUsed.expectationList) { if (ex.name == expectationName) { exUsed = ex; break; } } exUsed.assignmentList.Add(new Assignment(mark, weight)); }
// Use this for initialization void Start() { return; System.Random rnd = new System.Random(); float spiderStartX, spiderStartY; spiderStartX = rnd.Next(-8, 8); spiderStartY = 8; Vector3 spiderPos = new Vector3(spiderStartX, spiderStartY, 0); nodeList = new List <Node>(); playerMovePath = new List <Node>(); strandList = new List <Strand>(); intersectNodes = new List <GameObject>(); splitStrands = new List <GameObject>(); // as per camera othographic size float frameX = 8; float frameY = 8; Node topRight, topLeft, bottomRight, bottomLeft; topRight = new Node(frameX, frameY); topLeft = new Node(-1 * frameX, frameY); bottomRight = new Node(frameX, -1 * frameY); bottomLeft = new Node(-1 * frameX, -1 * frameY); nodeList.Add(topRight); nodeList.Add(topLeft); nodeList.Add(bottomRight); nodeList.Add(bottomLeft); Strand topWall, rightWall, bottomWall, leftWall; topWall = new Strand(topLeft, topRight); rightWall = new Strand(topRight, bottomRight); bottomWall = new Strand(bottomRight, bottomLeft); leftWall = new Strand(bottomLeft, topLeft); strandList.Add(topWall); strandList.Add(rightWall); strandList.Add(bottomWall); strandList.Add(leftWall); Instantiate(windowFrame, Vector3.zero, Quaternion.identity); player = Instantiate(spider, spiderPos, Quaternion.identity) as GameObject; player.name = "Player"; positionToMove = spiderPos; playerIsMoving = false; newStrandDrawn = true; UpdateAdjacencyMatrix(); graph = new Graph(); plane = new Plane(Vector3.back, GameObject.FindGameObjectWithTag("GameController").transform.position); InvokeRepeating("CreateInsect", 3.0f, 3f); }
void Update() { foreach (GameObject go in strands) { Strand script = go.GetComponent <Strand>(); script.Grow(Time.deltaTime); } }
private static string GetCachePath(Strand Strand) { string sectionName = (Strand.ActualSection != null) ? Strand.ActualSection.Name : ""; string elementName = (Strand.ActualSection != null && Strand.ActualSection.ActualElement != null) ? Strand.ActualSection.ActualElement.Name : ""; string browserTag = strands.Services.FeatureDetection.MathMLSupport() ? "FF" : ""; return HttpContext.Current.Server.MapPath(HttpRuntime.AppDomainAppVirtualPath + "/App_Data/Cache/" + Strand.Name + sectionName + elementName + browserTag + ".txt"); }
public static void AreEqual(Strand expected, Strand actual) { Assert.AreEqual(expected.Heading, actual.Heading, nameof(Strand.Heading) + " does not match."); Assert.AreEqual(expected.Position, actual.Position, nameof(Strand.Position) + " does not match."); Assert.AreEqual(expected.Strength, actual.Strength, nameof(Strand.Strength) + " does not match."); Assert.AreEqual(expected.Generation, actual.Generation, nameof(Strand.Generation) + " does not match."); Assert.AreEqual(expected.PreviousSensor, actual.PreviousSensor, nameof(Strand.PreviousSensor) + " does not match."); CollectionAssert.AreEqual(expected.PreviousPositions.ToArray(), actual.PreviousPositions.ToArray(), nameof(Strand.PreviousPositions) + " does not match."); }
public static string Write(Strand Strand, string HtmlString) { if (_enabled && !Strand.Name.StartsWith("Theme")) { string cachePath = StrandsCache.GetCachePath(Strand); System.IO.File.WriteAllText(cachePath, HtmlString); } return HtmlString; }
public GameObject drawStrandBetween(Vector3 begin, Vector3 finish, bool addEndNodes = true) { Node startPoint = new Node(begin.x, begin.y), endPoint = new Node(finish.x, finish.y); // Drawing to screen if (addEndNodes) { int startIndex, endIndex; if (nodeListContainsAt(startPoint, out startIndex)) { startPoint = nodeList[startIndex]; existingStartNode = true; } else { startNode = Instantiate(nodePrefab, begin, Quaternion.identity) as GameObject; startNode.name = string.Format("Node{0}", nodeList.Count - 3); nodeList.Add(startPoint); } if (nodeListContainsAt(endPoint, out endIndex)) { endPoint = nodeList[endIndex]; existingEndNode = true; } else { endNode = Instantiate(nodePrefab, finish, Quaternion.identity) as GameObject; endNode.name = string.Format("Node{0}", nodeList.Count - 3); nodeList.Add(endPoint); } UpdateAdjacencyMatrix(); } float startX = startPoint.xPos(), startY = startPoint.yPos(), endX = endPoint.xPos(), endY = endPoint.yPos(); float lineDistance = Mathf.Sqrt(Mathf.Pow(endX - startX, 2) + Mathf.Pow(endY - startY, 2)); float lineAngle = Mathf.Atan2(endY - startY, endX - startX) * (180 / Mathf.PI); float spriteSize = strandPrefab.GetComponent <SpriteRenderer>().bounds.size.x; float scale = lineDistance / spriteSize; Strand strandToAdd = new Strand(startPoint, endPoint); drawnStrand = Instantiate(strandPrefab, begin, Quaternion.AngleAxis(lineAngle, Vector3.forward)) as GameObject; // Debug.Log(string.Format("strandList.Count = {0}, naming new strand as {1}", strandList.Count, strandList.Count - 3)); drawnStrand.name = string.Format("Strand{0}", strandList.Count - 3); strandList.Add(strandToAdd); drawnStrand.transform.localScale = new Vector3( scale, drawnStrand.transform.localScale.y, drawnStrand.transform.localScale.z ); return(drawnStrand); }
static void Main(string[] args) { Strand strand = new Strand("Római"); strand.SzolgaltatasFelvetele(new Bufe("Lángos", 500)); strand.SzolgaltatasFelvetele(new Bufe("Sör", 400)); strand.SzolgaltatasFelvetele(new Bufe("Víz", 300)); strand.SzolgaltatasFelvetele(new ViziSzolgaltatas("Csúszda", 100)); strand.SzolgaltatasFelvetele(new ViziSzolgaltatas("Szauna", 100)); try { strand.SzolgaltatasTorlese("Víz"); } catch (Exception e) { Console.WriteLine(e.Message); } Strandolo strandolo = new Strandolo("Feri", 1000); strandolo.FigyelotFeliratkoztat(EsemenyKezelo); if (strandolo.Penz >= strand.szolgaltatasok.SzolgaltatasokAraOsszesitve()) { Console.WriteLine($"{strandolo.Nev} meg tudja látogatni az összes szolgáltatást!"); } else { Console.WriteLine($"{strandolo.Nev} nem tudja meglátogatni az összes szolgáltatást!"); } int bufe = 0; foreach (ISzolgaltatas szolgaltatas in strand.szolgaltatasok) { try { strandolo.SzolgaltatasIgenybevetele(szolgaltatas); } catch (Exception e) { Console.WriteLine(e.Message); } Bufe bufeE = szolgaltatas as Bufe; if (bufeE != null) { bufe++; } } Console.WriteLine("Összesen, {0} db büfét látogatott meg.", bufe); Console.ReadKey(); }
public static string Read(Strand Strand) { if (!_enabled) return ""; else { string cachePath = StrandsCache.GetCachePath(Strand); return System.IO.File.ReadAllText(cachePath); } }
public AbstractLocation(IPoint start, IPoint end, Strand strand, bool circular, bool betweenCompounds, AccessionID accession, List <ILocation> subLocations) { this._start = start; this._end = end; this._strand = strand; this._circular = circular; this._betweenCompounds = betweenCompounds; this._accession = accession; this._subLocations = subLocations == null ? null : new List <ILocation>(subLocations); AssertLocation(); }
public bool StrandListContainsPoint(Vector3 pos, out Strand str) { bool pointOnStrand = false; str = null; foreach (Strand s in strandList) { if (s.ContainsPointWithEnds(pos.x, pos.y)) { pointOnStrand = true; str = s; } } return(pointOnStrand); }
GameObject CreateStrand() { GameObject strand = Instantiate(StrandPrefab, transform); Strand script = strand.GetComponent <Strand>(); script.head = head; Vector3 scale = StrandPrefab.transform.localScale; Vector3 invertScale = new Vector3(1.0f / transform.lossyScale.x, 1.0f / transform.lossyScale.y, 1.0f / transform.lossyScale.z); strand.transform.localScale = new Vector3(scale.x * invertScale.x, scale.y * invertScale.y, scale.z * invertScale.z); // TODO: replace this pudding bowl with styles which specify the root base locations for each strand MoveToSurface(strand); return(strand); }
List <GameObject> SplitStrand(Strand str, Node[] n, bool hidden = false) { List <GameObject> splits = new List <GameObject>(); int strandIndex = strandList.IndexOf(str); if (strandIndex < 4) { return(splits); } float startX, startY, endX, endY; GameObject strandGO = GameObject.Find(string.Format("Strand{0}", strandIndex - 3)); Node startN = str.GetStartNode(), endN = str.GetEndNode(); strandList.RemoveAt(strandIndex); Destroy(strandGO); strandGO = null; for (int i = strandIndex; i < strandList.Count; i++) { GameObject go = GameObject.Find(string.Format("Strand{0}", i - 2)); go.name = string.Format("Strand{0}", i - 3); } startX = startN.xPos(); startY = startN.yPos(); endX = endN.xPos(); endY = endN.yPos(); GameObject ds; ds = DrawScaledStrand(startX, startY, n[0].xPos(), n[0].yPos()); ds.GetComponent <Renderer>().enabled = !hidden; splits.Add(ds); for (int i = 0; i < n.Length - 1; i++) { ds = DrawScaledStrand(n[i].xPos(), n[i].yPos(), n[i + 1].xPos(), n[i + 1].yPos()); ds.GetComponent <Renderer>().enabled = !hidden; splits.Add(ds); } ds = DrawScaledStrand(n[n.Length - 1].xPos(), n[n.Length - 1].yPos(), endX, endY); ds.GetComponent <Renderer>().enabled = !hidden; splits.Add(ds); return(splits); }
public static ILocation Location(int start, int end, Strand strand, int length) { int min = Math.Min(start, end); bool isReverse = (min != start); if (isReverse) { return(new SimpleLocation( new SimplePoint(start).Reverse(length), new SimplePoint(end).Reverse(length), strand)); } return(new SimpleLocation(start, end, strand)); }
private void PopulateSpecies(Strand strand) { if (strand.Species != null) { var speciesList = strand.Species.ToList(); strand.Species.Clear(); foreach (var species in speciesList) { var match = _db.SpeciesList.FirstOrDefault(s => s.Id == species.Id); if (match != null) { match.Strands.Add(strand); strand.Species.Add(match); } } } }
public static ILocation CircularLocation(int start, int end, Strand strand, int length) { int min = Math.Min(start, end); int max = Math.Max(start, end); bool isReverse = (min != start); if (min > length) { throw new ArgumentException("Cannot process a " + "location whose lowest coordinate is less than " + "the given length " + length); } if (max <= length) { return(Location(start, end, strand, length)); } int modStart = ModulateCircularIndex(start, length); int modEnd = ModulateCircularIndex(end, length); int numberOfPasses = CompleteCircularPasses(Math.Max(start, end), length); if (isReverse) { int reversedModStart = new SimplePoint(modStart).Reverse(length).GetPosition(); int reversedModEnd = new SimplePoint(modEnd).Reverse(length).GetPosition(); modStart = reversedModStart; modEnd = reversedModEnd; start = reversedModStart; end = (length * (numberOfPasses + 1)) + modEnd; } List <ILocation> locations = new List <ILocation>(); locations.Add(new SimpleLocation(modStart, length, strand)); for (int i = 0; i < numberOfPasses; i++) { locations.Add(new SimpleLocation(1, length, strand)); } locations.Add(new SimpleLocation(1, modEnd, strand)); return(new SimpleLocation(new SimplePoint(start), new SimplePoint(end), strand, true, false, locations)); }
public bool Equals(Strand other) { if (this.startNode.Equals(other.startNode)) { if (this.endNode.Equals(other.endNode)) { return(true); } } else if (this.startNode.Equals(other.endNode)) { if (this.endNode.Equals(other.startNode)) { return(true); } } return(false); }
public bool StrandExistsBetween(Node otherStart, Node otherEnd) { Strand strandToCompare = new Strand(otherStart, otherEnd); bool strandExists = false; foreach (Strand s in strandList) { bool strandContainsStartPoint = s.ContainsPointWithEnds(otherStart.xPos(), otherStart.yPos()); bool strandContainsEndPoint = s.ContainsPointWithEnds(otherEnd.xPos(), otherEnd.yPos()); bool isReqdStrand = s.Equals(strandToCompare); if (isReqdStrand || (strandContainsStartPoint && strandContainsEndPoint)) { strandExists = true; } } return(strandExists); }
private void btnAddExpectation_Click(object sender, EventArgs e) { string strandName = Interaction.InputBox("Enter Strand Name:"); Strand strandUsed = new Strand("", 0); foreach (Strand s in strands) { if (s.name == strandName) { strandUsed = s; break; } } string tempName = Interaction.InputBox("Enter Expectation Name:"); double tempWeight = double.Parse(Interaction.InputBox("Enter Expectation Weight:")); strandUsed.expectationList.Add(new Expectation(tempName, tempWeight)); }
public MetadataListItem <List <string> > GetGtfFeatureMetadata() { var feature = new MetadataListItem <List <string> >(FeatureType, GetGtfAttributes()); feature.SubItems["source"] = new List <string> { Source.ToString() }; feature.SubItems["start"] = new List <string> { OneBasedStart.ToString() }; feature.SubItems["end"] = new List <string> { OneBasedEnd.ToString() }; if (Strand != ".") { feature.SubItems["strand"] = new List <string> { Strand.ToString() }; } // might take in features without strand later on return(feature); }
public void UpdateStrand(Strand strand) { if (!IsStrandExists(strand)) { var orientation = strand.Orientation.Name; strand.StrandId = GetUpdatedStrandId(strand.StrandId, orientation); strand.CalculateMW(); strand.CalculateEC(); strand.BuildSequence(); strand.BuildBaseSequence(); strand.Orientation = null; strand.Target = null; PopulateSpecies(strand); PopulateModStructures(strand); _db.SetEntityStateModified(strand); _db.SaveChanges(); } }
private void PopulateModStructures(Strand strand) { if (strand.StrandModStructures != null) { var strandModStructures = strand.StrandModStructures.ToList(); strand.StrandModStructures.Clear(); foreach (var strandModStructure in strandModStructures) { var strandMod = new StrandModStructure { ModStructureId = strandModStructure.ModStructureId, OrdinalPosition = strandModStructure.OrdinalPosition, StrandId = strand.Id, Strand = null, ModStructure = null }; _db.StrandModStructures.Add(strandMod); } strandModStructures.Clear(); } }
public IHttpActionResult Merge([FromBody] ICollection <StrandModel> model) { foreach (var strandModel in model) { var strandId = strandModel.Id; var strand = new Strand(strandModel.StrandId); Mapper.Map(strandModel, strand); strand.Sequence = strandModel.Sequence; strand.Id = 0; if (!_strandsService.IsStrandExists(strand)) { strand.Id = strandId; _strandsService.MergeStrand(strand); } else { strandModel.SetError("Sequence", "Duplicate Sequence"); } } return(Ok(model)); }
public bool Intersects(Strand other, out Vector3 intersectPt) { Vector3 pt = Vector3.zero; intersectPt = pt; float m1, m2, c1, c2, x = 0, y = 0; m1 = this.m; c1 = this.c; m2 = other.getLineM(); c2 = other.getLineC(); if (double.IsInfinity(m1)) { //vertical line x = c x = c1; y = (m2 * x) + c2; } else if (double.IsInfinity(m2)) { x = c2; y = (m1 * x) + c1; } else if (m1 != m2) { x = (float)System.Math.Round((c1 - c2) / (m2 - m1), 3); y = (float)System.Math.Round(((m2 * c1) - (m1 * c2)) / (m2 - m1), 3); } if (this.ContainsPoint(x, y) && other.ContainsPoint(x, y)) { // Debug.Log(string.Format("{0} contains ({1},{2})", other.PositionString(), x, y)); intersectPt = new Vector3(x, y, 0); return(true); } return(false); }
public static bool Contains(Strand Strand) { if (_enabled && !Strand.Name.StartsWith("Theme")) { string cachePath = StrandsCache.GetCachePath(Strand); if (!System.IO.File.Exists(cachePath)) { return false; } else { DateTime dtXml = System.IO.File.GetLastWriteTimeUtc(Strand.GetDirectoryPath()); DateTime dtCache = System.IO.File.GetLastWriteTimeUtc(cachePath); if (dtXml.CompareTo(dtCache) == -1) return true; else return false; } } else return false; }
public void MergeStrand(Strand strand) { var strandId = strand.Id; strand.Id = 0; if (!IsStrandExists(strand)) { var sourceStrand = GetStrand(strandId); if (sourceStrand != null) { strand.ExtinctionCoefficient = sourceStrand.ExtinctionCoefficient; strand.GenomeNumber = sourceStrand.GenomeNumber; strand.GenomePosition = sourceStrand.GenomePosition; strand.MW = sourceStrand.MW; strand.Notes = sourceStrand.Notes; strand.OrientationId = sourceStrand.Orientation.Id; strand.ParentSequence = sourceStrand.ParentSequence; strand.TargetId = sourceStrand.Target.Id; strand.Species = sourceStrand.Species; _db.SetEntityStateAdded(strand); _db.SaveChanges(); foreach (var modStructure in strand.StrandModStructures) { _db.Entry(modStructure).Reference(a => a.ModStructure).Load(); } strand.BuildSequence(); strand.BuildBaseSequence(); strand.StrandId = GetNextStrandId(strand.Id, strand.Orientation.Name); _db.SetEntityStateModified(strand); _db.SaveChanges(); } } }
public bool PointIsOnFrame(Vector3 point, out Strand strand) { bool onFrame = false; strand = new Strand(new Node(0, 0), new Node(0, 0)); bool onTop = Mathf.Abs(8 - point.y) < 0.5; bool onBottom = Mathf.Abs(-8 - point.y) < 0.5; bool OnLeft = Mathf.Abs(-8 - point.x) < 0.5; bool onRight = Mathf.Abs(8 - point.x) < 0.5; if (onTop) { strand = new Strand(new Node(-8, 8), new Node(8, 8)); // Debug.Log("Top"); onFrame = true; } else if (onBottom) { strand = new Strand(new Node(-8, -8), new Node(8, -8)); // Debug.Log("Bottom"); onFrame = true; } else if (OnLeft) { strand = new Strand(new Node(-8, -8), new Node(-8, 8)); // Debug.Log("Left"); onFrame = true; } else if (onRight) { strand = new Strand(new Node(8, -8), new Node(8, 8)); // Debug.Log("Right"); onFrame = true; } return(onFrame); }
public TimerThread(Func<DateTime> aClock) { iTimerThread = new Strand(); iTimer = new Timer(Callback); iHeap = new BinaryHeap<DateTime>(Comparer<DateTime>.Default); iClock = aClock; }
public TimerCallback(Action aCallback, TimerThread aTimerThread, Strand aStrand) { iCallback = aCallback; iTimerThread = aTimerThread; iStrand = aStrand; }
public StrandDocument(Strand theStrand, string displayType) : base(theStrand) { this.DisplayType = displayType; this._html = this.ToHtml(); }
private XsltArgumentList TransformArguments(Strand Strand) { var arguments = new XsltArgumentList(); string theme = ""; switch (Strand.ActualSection.Name) { case "Home": theme = "0"; break; case "Science": case "Science_&_Philosophy": case "Science & Philophy": theme = "1"; break; case "Arts": case "Arts_&_Literature": case "Arts & Literature": theme = "2"; break; case "Music": theme = "3"; break; case "Public": case "Public_Affairs": case "Public Affairs": theme = "4"; break; case "Questionnaire": theme = "5"; break; default: theme = "0"; break; } arguments.AddParam("TabId", "", theme); arguments.AddParam("AppURL", "", this._applUrl); arguments.AddParam("AppImgBase", "", this._applUrl + "/" + this._applImgBase); arguments.AddParam("DocBase", "", this._docBase); arguments.AddParam("ArticleBase", "", StrandsModel.BaseUrl); arguments.AddParam("XBaseURL", "", StrandsModel.CrossBaseUri); arguments.AddParam("AppBase", "", Strand.Uri.Substring(0, Strand.Uri.LastIndexOf("/")) + "/"); arguments.AddParam("SrcURL", "", Strand.Name); arguments.AddParam("Sect", "", Strand.GetSectionData()); arguments.AddParam("cssclasstype", "", this.DisplayType); //Put switches for RQRenderer here. Actually only MathRenderers (MathPlayer) implemented arguments.AddParam("Extensions", "", _mathRenderer.GetMathTransformParams()); arguments.AddExtensionObject("urn:StrandsExtension", new StrandsExtension.LinkUtils()); return arguments; }
public AppRecord(IRawXapp aApp, string aId, Strand aStrand) { App = aApp; Id = aId; Strand = aStrand; }
public AppThreadScheduler(IAppTab aAppTab, Strand aAppThread) { iAppTab = aAppTab; iAppThread = aAppThread; }
GraphComponent ComposeRendering(Strand strand) { GraphComponent component = new GraphComponent(this); this.ComposeRendering(component, strand, 0); WireHydrogenBonds(component, strand.AllStrands()); return component; }
GraphComponent ComposeRendering(GraphComponent component, Strand strand, double y0 = 0) // We render a strand as a linear sequence of spring-separated particles. // We initially lay things out in a linear line, either to the right (for // normally oriented strands) or left (for reverse oriented strands). { if (null==component) component = new GraphComponent(this); // // Compose edges for domains along the strand backbone // List<GraphVertex> strandVertices = new List<GraphVertex>(); List<GraphEdge> strandEdges = new List<GraphEdge>(); // double count = strand.AllDomains().Count(); double length = strand.AllDomains().Sum(d => this.EdgeFromDomain(component, d).PreferredLength); double radius = length / 2.0 / Math.PI; // radius /= 3; // hack -> otherwise the forces pulling the circle together overshoot // int i = 0; foreach (Domain d in strand.AllDomains()) { GraphEdge edge = this.EdgeFromDomain(component, d); strandEdges.Add(edge); // // The first vertex in the strand needs to be explicitly positioned // double x,y; // if (strandVertices.IsEmpty()) { strandVertices.Add(edge.A); if (strand.IsCircular) x = strand.Orientation==Strand.Direction.FiveToThree ? -radius : radius; else x = 0; edge.A.SetLocation(x,y0); } // // Position the B vertex of the edge // if (strand.IsCircular) { double theta = i / count * 2 * Math.PI; x = radius * Math.Cos(theta); y = radius * Math.Sin(theta); if (strand.Orientation==Strand.Direction.FiveToThree) { x = -x; y = -y; } } else { y = y0; x = edge.PreferredLength; if (strand.Orientation == Strand.Direction.ThreeToFive) x = -x; x += strandVertices.Last().Location.X; } // edge.B.SetLocation(x, y); strandVertices.Add(edge.B); // i++; } // // Make a spline for the strand as a whole // if (strandVertices.NotEmpty()) { VisualStrand vStrand = new VisualStrand(strand, component, strandEdges, strandVertices); this.mpStrandVisualization[strand] = vStrand; // // Place ticks at the ends of each of the interior domains in the strand // for (i = strand.IsCircular ? 0 : 1; i < strandVertices.Count-1; i++) { new VisualDomainEndTick(component, vStrand, i, Constants.DomainEndLength); } // // Add domain labels and nucleotides // foreach (Domain d in strand.AllDomains()) { i = d.StrandIndex; // VisualStrandLabel label = new VisualStrandLabel(component, vStrand, i, i+1, d.FullDisplayName, Constants.StyleDomainLabel); label.LabelType = VisualStrandLabel.LABELTYPE.DOMAIN; vStrand.NoteDomainLabel(i, label); // if (d.Nucleotides.Length > 0 && true) { label = new VisualStrandLabel(component, vStrand, i, i+1, d.Nucleotides, Constants.StyleNucleotides); label.LabelType = VisualStrandLabel.LABELTYPE.NUCLEOTIDE; label.FontVerticallyCentered = true; label.AutoReverseText = true; } } } // if (strandVertices.NotEmpty()) { // Help a bit with initial placement: left align if we moved leftward // from zero due to strand direction. // if (!strand.IsCircular && strand.Orientation == Strand.Direction.ThreeToFive) { double dx = -strandVertices.Last().Location.X; foreach (GraphVertex v in strandVertices) { v.TranslateBy(dx, 0); } } } // // Put in stiffness along the strand // foreach (Domain d in strand.AllDomains()) { if (d.CircularNextTo5 != null) { GraphEdge curEdge = this.EdgeFromDomain(component, d); GraphEdge prevEdge = this.EdgeFromDomain(component, d.CircularNextTo5); // new StraighteningForce(component, prevEdge.A, curEdge.A, curEdge.B, Constants.StraighteningStrength); } } // return component; }
//----------------------------------------------------------------------------------- // Construction //----------------------------------------------------------------------------------- public StrandVerifier(Strand strand, SequenceDesigner designer) : base(designer) { this.strand = strand; }
// public StrandScoringState(Strand strand, NucleotidesInContext nucleotidesInContext, string nucleotides) { this.Strand = strand; this.Nucleotides = nucleotides; this.NucleotidesInContext = nucleotidesInContext; this.IntrinsicScoreIsUpToDate = false; this.IntrinsicScore = 0; this.StrandScore = 0; this.Importance = 1.0; }
public AppsStateFactory(ITabStatusListener aTabListener, Func<DateTime> aClock, ServerTabTimeoutPolicy aTimeoutPolicy, UserList aUserList) { iAppsStateThread = new Strand(); iTabStatusQueue = new TabStatusQueue(aTabListener); iTimeoutPolicy = aTimeoutPolicy; iUserList = aUserList; iClock = aClock; iTimerThread = new TimerThread(iClock); }
//---------------------------------------------------------------------------------------- // Construction //---------------------------------------------------------------------------------------- public VisualStrand(Strand strand, GraphComponent component, List<GraphEdge> strandEdges, List<GraphVertex> strandVertices) : base(component) { this.Strand = strand; this.strandEdges = strandEdges; this.strandVertices = strandVertices; this.Vertices = new List<VisualGraphVertex>(strandVertices.Select((v) => v.Visualization)); component.AddRenderable(this); this.SetStyleName(Constants.StyleSpline); // default this.IsSelectable = true; }