// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.F)) { if (_referencePosition == ReferencePosition.THREE) { _referencePosition = ReferencePosition.ONE; } else { ++_referencePosition; } MapPositionReference(); } RaycastHit hit; Vector3 rayVector = _positionReference.position - transform.position; if (Physics.Raycast(transform.position, rayVector.normalized, out hit, rayVector.magnitude)) { CameraObject.position = hit.point; } else { CameraObject.position = _positionReference.position; } CameraObject.LookAt(transform.position); }
bool GoTo(IMethodDebugService methodDebugService, ReferencePosition referencePosition) { if (referencePosition == null) { return(false); } if (referencePosition.MethodSourceStatement != null) { var methodSourceStatement = referencePosition.MethodSourceStatement.Value; var methodStatement = methodDebugService.FindByCodeOffset(methodSourceStatement.Method, methodSourceStatement.Statement.BinSpan.Start); if (methodStatement != null) { MoveCaretToPosition(methodStatement.Value.Statement.TextSpan.Start); return(true); } } if (referencePosition.SpanData != null) { var spanData = FindReferenceInfo(referencePosition.SpanData.Value); if (spanData != null) { return(GoToTarget(spanData, false, false)); } } return(false); }
public void RemoveLastEntry() { Count--; ReferenceName.RemoveAt(Count); ReferencePosition.RemoveAt(Count); ChrIndexer.Remove(NumIndexer[Count]); NumIndexer.Remove(Count); Ad.RemoveAt(Count); Dp.RemoveAt(Count); if (Categories != null) { Categories.RemoveAt(Count); QScores.RemoveAt(Count); Gp.RemoveAt(Count); } }
public void AddLocus(CalledAllele variant) { ReferenceName.Add(variant.Chromosome); ReferencePosition.Add(variant.ReferencePosition); ChrIndexer.Add(variant.Chromosome + ":" + variant.ReferencePosition.ToString(), Count); NumIndexer.Add(Count, variant.Chromosome + ":" + variant.ReferencePosition.ToString()); int dp = variant.TotalCoverage; if (dp < AdaptiveGenotyperCalculator.MaxEffectiveDepth) { Dp.Add(dp); Ad.Add(VariantReader.GetAlternateAlleleSupport(variant)); } else { var(ad, depth) = AdaptiveGenotyperCalculator.DownsampleVariant( VariantReader.GetAlternateAlleleSupport(variant), dp); Dp.Add(depth); Ad.Add(ad); } Count++; }
//[SerializeField] ContactFilter2D tempFilter = new ContactFilter2D(); // Use this for initialization void Start() { activeAnimator = Dcrane; craneAnims = new Animator[] { Rcrane, RUcrane, RDcrane, Lcrane, LUcrane, LDcrane, Ucrane, Dcrane }; oilSprite.SetActive(false); layerScript = GetComponent <arrangeLayers>(); tempLayer = gameObject.layer; myManager = FindObjectOfType <Game_Manager>(); myCollider = GetComponent <PolygonCollider2D>(); rBody = GetComponent <Rigidbody2D>(); jumpSprite = spriteHolder.GetComponent <SpriteRenderer>(); switch (playerNum) { case PlayerNum.P1: this.gameObject.layer = 12; playerId = 0; break; case PlayerNum.P2: this.gameObject.layer = 13; playerId = 1; break; case PlayerNum.P3: this.gameObject.layer = 14; playerId = 2; break; case PlayerNum.P4: this.gameObject.layer = 15; playerId = 3; break; default: break; } //Rewired stuff player = ReInput.players.GetPlayer(playerId); m_rb = GetComponent <Rigidbody2D>(); targetReticle.GetComponent <SpriteRenderer>().enabled = false; throwRange.GetComponent <SpriteRenderer>().enabled = false; //m_arrowOriginalScale = m_arrow.transform.localScale; // No chargin anymore, no need // MoveBackScript = GetComponent<moveBack>(); //isSmelly = true; //setting references referencePos = FindObjectOfType <ReferencePosition>(); //get reference according to objects on references object referenceTop = referencePos.getReferenceTL(); referenceTop1 = referencePos.getReferenceT1(); referenceTop2 = referencePos.getReferenceT2(); referenceMid = referencePos.getReferenceMid(); referenceBot1 = referencePos.getReferenceB1(); referenceBot2 = referencePos.getReferenceB2(); referenceBot = referencePos.getReferenceBL(); //calculate mid point midPointLane1 = referenceTop1 + ((referenceTop - referenceTop1) / 2); midPointLane2 = referenceTop2 + ((referenceTop1 - referenceTop2) / 2); midPointLane3 = referenceMid + ((referenceTop2 - referenceMid) / 2); midPointLane4 = referenceBot1 + ((referenceMid - referenceBot1) / 2); midPointLane5 = referenceBot2 + ((referenceBot1 - referenceBot2) / 2); midPointLane6 = referenceBot + ((referenceBot2 - referenceBot) / 2); /* Debug.Log(midPointLane1); * Debug.Log(midPointLane2); * Debug.Log(midPointLane3); * Debug.Log(midPointLane4); * Debug.Log(midPointLane5); * Debug.Log(midPointLane6);*/ //forceToCenter = 50; // Boris, why here? }
/** * This method uses an adapted greedy strategy for the fixed two position model, above and under. It uses no * priority search tree, because it will not function with symbols only with points. Instead it uses two minimum * heaps. They work similar to a sweep line algorithm but have not a O(n log n +k) runtime. To find the rectangle * that has the leftest edge, I use also a minimum Heap. The rectangles are sorted by their x coordinates. * * @param labels * label positions and text * @param symbols * symbol positions * @param areaLabels * area label positions and text * @return list of labels without overlaps with symbols and other labels by the two fixed position greedy strategy */ private List <pointTextContainer> processTwopointGreedy(List <pointTextContainer> labels, List <SymbolContainer> symbols, List <pointTextContainer> areaLabels) { List <pointTextContainer> resolutionSet = new List <pointTextContainer>(); // Array for the generated reference positions around the points of interests ReferencePosition[] refPos = new ReferencePosition[labels.Count * 2]; // lists that sorts the reference points after the minimum right edge x position PriorityQueue <ReferencePosition> priorRight = new PriorityQueue <ReferencePosition>(labels.Count * 2 + labels.Count / 10 * 2, ReferencePositionWidthComparator.INSTANCE); // lists that sorts the reference points after the minimum left edge x position PriorityQueue <ReferencePosition> priorLeft = new PriorityQueue <ReferencePosition>(labels.Count * 2 + labels.Count / 10 * 2, ReferencePositionXComparator.INSTANCE); // creates the reference positions for (int z = 0; z < labels.Count; z++) { this.label = labels[z]; if (this.label.symbol != null) { refPos[z * 2] = new ReferencePosition(this.label.x - (this.label.boundary.Width / 2) - 0.1f, this.label.y - this.label.boundary.Height - LabelPlacement.START_DISTANCE_TO_SYMBOLS, z, this.label.boundary.Width, this.label.boundary.Height, this.label.symbol); refPos[z * 2 + 1] = new ReferencePosition(this.label.x - (this.label.boundary.Width / 2), this.label.y + this.label.symbol.symbol.Height + LabelPlacement.START_DISTANCE_TO_SYMBOLS, z, this.label.boundary.Width, this.label.boundary.Height, this.label.symbol); } else { refPos[z * 2] = new ReferencePosition(this.label.x - (this.label.boundary.Width / 2) - 0.1f, this.label.y, z, this.label.boundary.Width, this.label.boundary.Height, null); refPos[z * 2 + 1] = null; } } // removes reference positions that overlaps with other symbols or dependency objects removeNonValidateReferencePosition(refPos, symbols, areaLabels); for (int i = 0; i < refPos.Length; i++) { this.referencePosition = refPos[i]; if (this.referencePosition != null) { priorLeft.Add(this.referencePosition); priorRight.Add(this.referencePosition); } } while (priorRight.Count != 0) { this.referencePosition = priorRight.Pool(); this.label = labels[this.referencePosition.nodeNumber]; resolutionSet.Add(new PointTextContainer(this.label.text, this.referencePosition.x, this.referencePosition.y, this.label.paintFront, this.label.paintBack, this.referencePosition.symbol)); // Removes the other position that is a possible position for the label of one point // of interest priorRight.Remove(refPos[this.referencePosition.nodeNumber * 2 + 1]); if (priorRight.Count == 0) { return(resolutionSet); } priorLeft.Remove(this.referencePosition); priorLeft.Remove(refPos[this.referencePosition.nodeNumber * 2 + 1]); // find overlapping labels and deletes the reference points and delete them LinkedList <ReferencePosition> linkedRef = new LinkedList <ReferencePosition>(); while (priorLeft.Count != 0) { if (priorLeft.Peek().x < this.referencePosition.x + this.referencePosition.width) { linkedRef.AddLast(priorLeft.Pool()); } else { break; } } // brute Force collision test (faster then sweep line for a small amount of // objects) linkedRef.RemoveAll(e => (e.x <= this.referencePosition.x + this.referencePosition.width) && (e.y >= this.referencePosition.y - e.height) && (e.y <= this.referencePosition.y + e.height)); priorLeft.AddRange(linkedRef); } return(resolutionSet); }
/** * This method uses an adapted greedy strategy for the fixed four position model, above, under left and right form * the point of interest. It uses no priority search tree, because it will not function with symbols only with * points. Instead it uses two minimum heaps. They work similar to a sweep line algorithm but have not a O(n log n * +k) runtime. To find the rectangle that has the top edge, I use also a minimum Heap. The rectangles are sorted by * their y coordinates. * * @param labels * label positions and text * @param symbols * symbol positions * @param areaLabels * area label positions and text * @return list of labels without overlaps with symbols and other labels by the four fixed position greedy strategy */ private List <pointTextContainer> processFourpointGreedy(List <pointTextContainer> labels, List <SymbolContainer> symbols, List <pointTextContainer> areaLabels) { List <pointTextContainer> resolutionSet = new List <pointTextContainer>(); // Array for the generated reference positions around the points of interests ReferencePosition[] refPos = new ReferencePosition[(labels.Count) * 4]; // lists that sorts the reference points after the minimum top edge y position PriorityQueue <ReferencePosition> priorUp = new PriorityQueue <ReferencePosition>(labels.Count * 4 * 2 + labels.Count / 10 * 2, ReferencePositionYComparator.INSTANCE); // lists that sorts the reference points after the minimum bottom edge y position PriorityQueue <ReferencePosition> priorDown = new PriorityQueue <ReferencePosition>(labels.Count * 4 * 2 + labels.Count / 10 * 2, ReferencePositionHeightComparator.INSTANCE); pointTextContainer tmp; int dis = START_DISTANCE_TO_SYMBOLS; // creates the reference positions for (int z = 0; z < labels.Count; z++) { if (labels[z] != null) { if (labels[z].symbol != null) { tmp = labels[z]; // up refPos[z * 4] = new ReferencePosition(tmp.x - tmp.boundary.Width / 2, tmp.y - tmp.symbol.symbol.Height / 2 - dis, z, tmp.boundary.Width, tmp.boundary.Height, tmp.symbol); // down refPos[z * 4 + 1] = new ReferencePosition(tmp.x - tmp.boundary.Width / 2, tmp.y + tmp.symbol.symbol.Height / 2 + tmp.boundary.Height + dis, z, tmp.boundary.Width, tmp.boundary.Height, tmp.symbol); // left refPos[z * 4 + 2] = new ReferencePosition(tmp.x - tmp.symbol.symbol.Width / 2 - tmp.boundary.Width - dis, tmp.y + tmp.boundary.Height / 2, z, tmp.boundary.Width, tmp.boundary.Height, tmp.symbol); // right refPos[z * 4 + 3] = new ReferencePosition(tmp.x + tmp.symbol.symbol.Width / 2 + dis, tmp.y + tmp.boundary.Height / 2 - 0.1f, z, tmp.boundary.Width, tmp.boundary.Height, tmp.symbol); } else { refPos[z * 4] = new ReferencePosition(labels[z].x - ((labels[z].boundary.Width) / 2), labels[z].y, z, labels[z].boundary.Width, labels[z].boundary.Height, null); refPos[z * 4 + 1] = null; refPos[z * 4 + 2] = null; refPos[z * 4 + 3] = null; } } } removeNonValidateReferencePosition(refPos, symbols, areaLabels); // do while it gives reference positions for (int i = 0; i < refPos.Length; i++) { this.referencePosition = refPos[i]; if (this.referencePosition != null) { priorUp.Add(this.referencePosition); priorDown.Add(this.referencePosition); } } while (priorUp.Count != 0) { this.referencePosition = priorUp.Pool(); this.label = labels[this.referencePosition.nodeNumber]; resolutionSet.Add(new PointTextContainer(this.label.text, this.referencePosition.x, this.referencePosition.y, this.label.paintFront, this.label.paintBack, this.label.symbol)); if (priorUp.Count == 0) { return(resolutionSet); } priorUp.Remove(refPos[this.referencePosition.nodeNumber * 4 + 0]); priorUp.Remove(refPos[this.referencePosition.nodeNumber * 4 + 1]); priorUp.Remove(refPos[this.referencePosition.nodeNumber * 4 + 2]); priorUp.Remove(refPos[this.referencePosition.nodeNumber * 4 + 3]); priorDown.Remove(refPos[this.referencePosition.nodeNumber * 4 + 0]); priorDown.Remove(refPos[this.referencePosition.nodeNumber * 4 + 1]); priorDown.Remove(refPos[this.referencePosition.nodeNumber * 4 + 2]); priorDown.Remove(refPos[this.referencePosition.nodeNumber * 4 + 3]); LinkedList <ReferencePosition> linkedRef = new LinkedList <ReferencePosition>(); while (priorDown.Count != 0) { if (priorDown.Peek().x < this.referencePosition.x + this.referencePosition.width) { linkedRef.AddLast(priorDown.Pool()); } else { break; } } // brute Force collision test (faster then sweep line for a small amount of // objects) linkedRef.RemoveAll(e => (e.x <= this.referencePosition.x + this.referencePosition.width) && (e.y >= this.referencePosition.y - e.height) && (e.y <= this.referencePosition.y + e.height)); priorDown.AddRange(linkedRef); } return(resolutionSet); }
internal void Change(ReferencePosition reference) { Reference = reference; }
public PositionInfo(double posX, double posY, ReferencePosition reference = ReferencePosition.Center) { X = posX; Y = posY; Reference = reference; }
public BasicContainer(uint _stationType, uint _latiude, uint _longitude) { this.stationType = _stationType; ReferencePosition refPosi = new ReferencePosition(_longitude, _longitude); }