public override void RemoveItem(List <UndoRedoAction> undoPipe) { lock (board.ParentControl) { base.RemoveItem(undoPipe); PointA.RemoveItem(undoPipe); PointB.RemoveItem(undoPipe); PointC.RemoveItem(undoPipe); PointD.RemoveItem(undoPipe); } }
public override void OnItemPlaced(List <UndoRedoAction> undoPipe) { lock (board.ParentControl) { base.OnItemPlaced(undoPipe); PointA.OnItemPlaced(undoPipe); PointB.OnItemPlaced(undoPipe); PointC.OnItemPlaced(undoPipe); PointD.OnItemPlaced(undoPipe); } }
private void RemovePointA() { PointA.ClearValues(); if (isPointA) { SelectedStationVisibility = Visibility.Collapsed; SelectedSearchItemVisibility = Visibility.Collapsed; SelectedCustomPointVisibility = Visibility.Collapsed; } }
public void PointA_GetEnumeratorTest() { var p = new PointA(123.456, 789.012); Assert.IsInstanceOfType(p.GetEnumerator(), typeof(IEnumerator <double>)); IEnumerator <double> pe = p.GetEnumerator(); pe.MoveNext(); Assert.AreEqual(123.456, pe.Current); pe.MoveNext(); Assert.AreEqual(789.012, pe.Current); }
public void PointA_GetEnumeratorTest() { var p = new PointA(123.456, 789.012); Assert.IsAssignableFrom <IEnumerator <double> >(p.GetEnumerator()); IEnumerator <double> pe = p.GetEnumerator(); pe.MoveNext(); Assert.Equal(123.456, pe.Current); pe.MoveNext(); Assert.Equal(789.012, pe.Current); }
private void PointAClick() { if (!this.isPointA) { PointA.Select(); this.isPointA = true; PointB.Deselect(); if (PointA.HasValue()) { if (PointA.Station == null && PointA.CustomPoint == null) { SelectedSearchItemForView = PointA.SearchItem; SelectedStationVisibility = Visibility.Collapsed; SelectedCustomPointVisibility = Visibility.Collapsed; SelectedSearchItemVisibility = Visibility.Visible; } else if (PointA.SearchItem == null && PointA.CustomPoint == null) { SelectedStationForView = PointA.Station; SelectedSearchItemVisibility = Visibility.Collapsed; SelectedCustomPointVisibility = Visibility.Collapsed; SelectedStationVisibility = Visibility.Visible; } else { SelectedCustomPointForView = PointA.CustomPoint; SelectedSearchItemVisibility = Visibility.Collapsed; SelectedStationVisibility = Visibility.Collapsed; SelectedCustomPointVisibility = Visibility.Visible; } PointA.Show(); } else { PointA.Hide(); SelectedStationVisibility = Visibility.Collapsed; SelectedSearchItemVisibility = Visibility.Collapsed; SelectedCustomPointVisibility = Visibility.Collapsed; } } }
/// <summary> /// override method get square for right triangle /// </summary> /// <returns>Value of the square right triangle</returns> public override double GetSquare() { double sizeSideAB = PointA.GetDistance(PointB); double sizeSideAC = PointA.GetDistance(PointC); double sizeSideBC = PointB.GetDistance(PointC); if (sizeSideAB < sizeSideBC && sizeSideAC < sizeSideBC) { return(sizeSideAB * sizeSideAC / 2); } else { if (sizeSideAB < sizeSideBC && sizeSideBC < sizeSideAC) { return(sizeSideAB * sizeSideBC / 2); } } return(sizeSideAC * sizeSideBC / 2); }
public byte[] GetBytes() { List <byte> bytes = new List <byte>(0x40) { CamType, Unknown, PanSpeed, Priority }; unchecked { bytes.AddRange(BitConverter.GetBytes((ushort)Unknown_2)); bytes.AddRange(BitConverter.GetBytes((ushort)Rotation.Y)); } bytes.AddRange(Position.GetBytes()); bytes.AddRange(Scale.GetBytes()); bytes.AddRange(BitConverter.GetBytes(NotUsed)); bytes.AddRange(PointA.GetBytes()); bytes.AddRange(PointB.GetBytes()); bytes.AddRange(BitConverter.GetBytes(Variable)); return(bytes.ToArray()); }
public double GetPerimeter() { return(PointA.DistanceTo(PointB) + PointA.DistanceTo(PointC) + PointB.DistanceTo(PointC)); }
public string ToString() { return("Created the line based on points " + PointA.ToString() + " and " + PointB.ToString()); }
public override double GetPerimeter() { return(PointA.GetDistance(PointB) + PointA.GetDistance(PointC) + PointB.GetDistance(PointC)); }
public override string ToString() { return(PointA.ToString() + " -> " + PointB.ToString()); }
public bool HasOverlappingLocation(Hop hop) { return(PointA.Equals(hop.PointA) || PointB.Equals(hop.PointB) || PointA.Equals(hop.PointB) || PointB.Equals(hop.PointA)); }
private void SetSelectionMode(StationsAndPlacesOfInterestModeMessage mode) { ClearPoints(); fromWhereTo = mode.FromWhereTo; switch (mode.Reason) { case Messages.Enums.StationsAndPlacesOfInterestModeReason.SearchPointA: PointA.Select(); this.isPointA = true; PointB.Deselect(); SwitchToList(); LoadSearch(); break; case Messages.Enums.StationsAndPlacesOfInterestModeReason.SearchPointB: PointB.Select(); this.isPointA = false; PointA.Deselect(); SwitchToList(); LoadSearch(); break; case Messages.Enums.StationsAndPlacesOfInterestModeReason.StationsPointA: PointA.Select(); this.isPointA = true; PointB.Deselect(); SwitchToList(); LoadStations(); break; case Messages.Enums.StationsAndPlacesOfInterestModeReason.StationsPointB: PointB.Select(); this.isPointA = false; PointA.Deselect(); SwitchToList(); LoadStations(); break; case Messages.Enums.StationsAndPlacesOfInterestModeReason.MapPointA: PointA.Select(); this.isPointA = true; PointB.Deselect(); SwitchToMap(); LoadStations(); break; case Messages.Enums.StationsAndPlacesOfInterestModeReason.MapPointB: PointB.Select(); this.isPointA = false; PointA.Deselect(); SwitchToMap(); LoadStations(); break; } }
/// <summary> /// Loads the VectorFeature array with the features from the /// shapefile. /// </summary> public void LoadFile() { FileStream fs = new FileStream(_Filename, FileMode.Open); BinaryReader br = new BinaryReader(fs); //VectorFeature tempFeature; int[] segments; int segmentPosition; int pointsInSegment; PointA[] segmentPoints; if (_ShapeType == ShapeType.Point) { _Features = new VectorPoint[_FeatureCount]; for (int a = 0; a < _FeatureCount; ++a) { // Point types don't have parts (segments) / one point per feature VectorPoint tempFeature = new VectorPoint(1, _ShapeType); tempFeature.Coordinates = new double[2]; fs.Seek(_OffsetOfRecord[a], 0); br.ReadInt32(); //Record number (not needed) br.ReadInt32(); //Content length (not needed) tempFeature.Type = Enum.GetName(typeof(ShapeType), br.ReadInt32()); tempFeature.Coordinates[0] = br.ReadDouble(); tempFeature.Coordinates[1] = br.ReadDouble(); int colNum = 0; foreach(string col in _Dbase.FieldNames) { tempFeature.Properties.Add(col.Trim().ToLower(), _Dbase[a][colNum].Trim().ToLower()); colNum++; } _Features[a] = tempFeature; } } else { _Features = new VectorShape[_FeatureCount]; PointA[] tempPoints; for (int a = 0; a < _FeatureCount; ++a) { fs.Seek(_OffsetOfRecord[a] + 44, 0); int segmentCount = br.ReadInt32(); // Read the number of parts (segments) and create a new VectorFeature VectorShape tempFeature = new VectorShape(segmentCount, _ShapeType); fs.Seek(_OffsetOfRecord[a], 0); br.ReadInt32(); //Record number (not needed) br.ReadInt32(); //Content length (not needed) tempFeature.Type = Enum.GetName(typeof(ShapeType), br.ReadInt32()); tempFeature.Bbox[0] = br.ReadDouble(); // X tempFeature.Bbox[1] = br.ReadDouble(); // Y tempFeature.Bbox[2] = br.ReadDouble(); // X tempFeature.Bbox[3] = br.ReadDouble(); // Y br.ReadInt32(); // Number of parts (segments) gotten earlier tempPoints = new PointA[br.ReadInt32()]; // Number of points segments = new int[segmentCount + 1]; //Read in the segment indexes for (int b = 0; b < segmentCount; ++b) { segments[b] = br.ReadInt32(); } //Read in *ALL* of the points in the feature for (int c = 0; c < tempPoints.Length; ++c) { tempPoints[c] = new PointA(br.ReadDouble(), br.ReadDouble()); } //Add in an ending point for the inner loop that follows (e) segments[segmentCount] = tempPoints.Length; //Watch your step... for (int d = 0; d < segmentCount; ++d) { pointsInSegment = segments[d + 1] - segments[d]; segmentPoints = new PointA[pointsInSegment]; segmentPosition = 0; for (int e = segments[d]; e < segments[d + 1]; ++e) { segmentPoints[segmentPosition] = tempPoints[e]; ++segmentPosition; } tempFeature.Coordinates.Add(segmentPoints); } int colNum = 0; foreach (string col in _Dbase.FieldNames) { tempFeature.Properties.Add(col.Trim().ToLower(), _Dbase[a][colNum].Trim().ToLower()); colNum++; } _Features[a] = tempFeature; } } br.Close(); }
/// <summary> /// override method get square for equilateral triangle /// </summary> /// <returns>Value of the square equilateral triangle</returns> public override double GetSquare() { double sizeSideAB = PointA.GetDistance(PointB); return(sizeSideAB * sizeSideAB * Math.Sqrt(3) / 4); }
public override int GetHashCode() => PointA.GetHashCode() ^ PointB.GetHashCode();
public bool Equals(LineSegment2D other) { return(PointA.Equals(other.PointA) && PointB.Equals(other.PointB)); }
public override int GetHashCode() { return(PointA.GetHashCode() + PointB.GetHashCode() + PointC.GetHashCode()); }
public override double GetArea() { double p = this.GetPerimeter() / 2.0; return(Math.Sqrt(p * (p - PointA.GetDistance(PointB)) * (p - PointA.GetDistance(PointC)) * (p - PointB.GetDistance(PointC)))); }
public override string ToString() { return($"Triangle: PointA({PointA.ToString()}), PointB({PointB.ToString()}), PointC({PointC.ToString()}) "); }