public BuildRoad(IMapController map, int k, int depth) : base(map, depth, "Build road") { kPoints = k / 1000.0f; kCantBuildTown = 1.0f - kPoints; lastBestRoad = null; }
public void ChurchRule_Is_Not_Satisfied_When_There_Are_More_Less_100_ResidencesAnd_In_Neighborhood() { IRoad road = _settlement.Roads.First(); var church = new Church() { Position = new Point(50, 51) }; var buildingPositions = road.GetPossibleBuildingPositions(new PossibleBuildingPositions(_settlement.Roads, _settlement.Fields)); buildingPositions.Remove(church.Position); while (_settlement.Roads.SelectMany(g => g.Buildings).Count() < 10) { var position = buildingPositions[RandomProvider.Next(buildingPositions.Count)]; var building = new Residence { Position = position }; building.Road = road; _settlement.AddBuildingToRoad(road, building); } Assert.AreEqual(0, church.CalculateFitness(new BuildingRule() { BuildingRoad = road, Fields = _settlement.Fields, Roads = _settlement.Roads, SettlementCenter = _settlement.SettlementCenter })); }
public void SchoolRule_IsSatisfied__When_Ratio_Schools_Per_Residences_Is_Less_Than_1_To_100() { IRoad road = _settlement.Roads.First(); var school = new School() { Position = new Point(50, 51) }; var buildingPositions = road.GetPossibleBuildingPositions(new PossibleBuildingPositions(_settlement.Roads, _settlement.Fields)); buildingPositions.Remove(school.Position); while (_settlement.Roads.SelectMany(g => g.Buildings).Count() < 120) { var position = buildingPositions[RandomProvider.Next(buildingPositions.Count)]; var building = new Residence { Position = position }; building.Road = road; _settlement.AddBuildingToRoad(road, building); } Assert.AreEqual(5, school.CalculateFitness(new BuildingRule() { BuildingRoad = road, Fields = _settlement.Fields, Roads = _settlement.Roads, SettlementCenter = _settlement.SettlementCenter })); }
public void ChangeRoad() { DistanceTravelledOnCurrentRoad = DistanceTravelledOnCurrentRoad - CurrentRoad.Length; DepartureStation = ArrivalStation; Route.TryDequeue(out _); if (Route.Count == 0) { ReachedFinalDestination = true; return; } if (Route.TryPeek(out var arrivalStation)) { ArrivalStation = arrivalStation; } // //TODO: Hashmap or dictionary // CurrentRoad = DepartureStation.RoadList[ArrivalStation]; CurrentRoad = DepartureStation.RoadList.ContainsKey(ArrivalStation) ? DepartureStation.RoadList[ArrivalStation] : ArrivalStation.RoadList[DepartureStation]; // foreach (var road in ArrivalStation.RoadList) // { // foreach (var road1 in DepartureStation.RoadList) // { // if (road1.Equals(road)) // { // CurrentRoad = road; // } // } // } }
public void AdministrationRule_Is_Not_Satisfied_When_Distance_To_SettlementCenter_Is_Greater_Than_40_Pixels() { IRoad road = _settlement.Roads.First(); var administration = new Administration() { Position = new Point(99, 51) }; var buildingPositions = road.GetPossibleBuildingPositions(new PossibleBuildingPositions(_settlement.Roads, _settlement.Fields)); buildingPositions.Remove(administration.Position); while (_settlement.Roads.SelectMany(g => g.Buildings).Count() < 120) { var position = buildingPositions[RandomProvider.Next(buildingPositions.Count)]; var building = new Residence { Position = position }; building.Road = road; _settlement.AddBuildingToRoad(road, building); } Assert.AreEqual(0, administration.CalculateFitness(new BuildingRule() { BuildingRoad = road, Fields = _settlement.Fields, Roads = _settlement.Roads, SettlementCenter = _settlement.SettlementCenter })); }
public void PortRule_Is_Not_Satisfied_When_There_Is_Other_Port() { IRoad road1 = _settlement.Roads.First(); var roadGenerator = new RoadPointsGenerator(); var road2 = new Road(roadGenerator.GenerateStraight(new RoadGenerationTwoPoints() { Start = new Point(50, 51), End = new Point(50, 10), Fields = _settlement.Fields })); _settlement.AddRoad(road2); var port = new Port() { Position = new Point(51, 10) }; var exitingPort = new Port() { Position = new Point(49, 10) }; exitingPort.Road = road2; _settlement.AddBuildingToRoad(road2, exitingPort); Assert.AreEqual(0, port.CalculateFitness(new BuildingRule() { BuildingRoad = road1, Fields = _settlement.Fields, Roads = _settlement.Roads, SettlementCenter = _settlement.SettlementCenter })); }
public void PortRule_IsSatisfied_When_Distance_To_Water_Is_Less_Than_10_Pixels_And_There_Is_No_Other_Port() { IRoad road1 = _settlement.Roads.First(); var roadGenerator = new RoadPointsGenerator(); var road2 = new Road(roadGenerator.GenerateStraight(new RoadGenerationTwoPoints() { Start = new Point(50, 51), End = new Point(50, 10), Fields = _settlement.Fields })); _settlement.AddRoad(road2); var port = new Port() { Position = new Point(51, 10) }; Assert.AreEqual(15, port.CalculateFitness(new BuildingRule() { BuildingRoad = road1, Fields = _settlement.Fields, Roads = _settlement.Roads, SettlementCenter = _settlement.SettlementCenter })); }
public DropOnEdge(IPoint pointFrom) { this.pointFrom = pointFrom; this.pointTo = null; this.l = Double.PositiveInfinity; this.edge = null; }
public bool IsCrossed(IRoad other) { if (this.IsVertical && !other.IsVertical) { if (this.Start.X >= other.Start.X && this.Start.X <= other.End.X && this.Start.Y <= other.Start.Y && this.End.Y >= other.Start.Y) { return(true); } } else { if (this.Start.Y >= other.Start.Y && this.Start.Y <= other.End.Y && this.Start.X <= other.Start.X && this.End.X >= other.Start.X) { return(true); } } return(false); }
public virtual DropOnEdge heuristic_between_point_and_line(IPoint point, IRoad road) { DecardPoint A = new DecardPoint(road.Start), B = new DecardPoint(road.Finish), C = new DecardPoint(point); Vector RA = new Vector(A); Vector RB = new Vector(B); Vector RC = new Vector(C); Vector Norm_AB = RA * RB; Vector Norm_XC = Norm_AB * RC; Vector OX = Norm_AB * Norm_XC; OX = OX.Normalized(); DecardPoint X = new DecardPoint(OX); DecardPoint XNeg = new DecardPoint(-OX); double distX = X.DistanceTo(C); double distXNeg = XNeg.DistanceTo(C); double distA = A.DistanceTo(C); double distB = B.DistanceTo(C); double distRoad = A.DistanceTo(B); if (distX > distXNeg) { X = XNeg; distX = distXNeg; } if (distRoad < A.DistanceTo(X) || distRoad < B.DistanceTo(X)) { distX = Double.PositiveInfinity; } if (distX < Math.Min(distA, distB)) { var geoX = X.FormDecardToGeo(); return(new DropOnEdge(geoX, point, distX, road)); } else if (distA < distB) { return(new DropOnEdge(road.Start, point, distA, road)); } else { return(new DropOnEdge(road.Finish, point, distB, road)); } }
public DropOnEdge(IPoint pointTo, IPoint pointFrom, double l, IRoad edge) { this.pointFrom = pointFrom; this.pointTo = pointTo; this.l = l; this.edge = edge; }
public DropOnEdge(IPoint pointTo, IPoint pointFrom, double l) { this.pointFrom = pointFrom; this.pointTo = pointTo; this.l = l; this.edge = null; }
public override void Init() { if (lastBestRoad != null) { AddSubgoal(new RaiseSources(map, map.GetPrice(PriceKind.BRoad), depth + 1)); AddSubgoal(new BuildRoadAtom(map, lastBestRoad, depth + 1)); lastBestRoad = null; } }
private RoadDto ConvertToRoadDto(IRoad road) { return(new RoadDto() { Type = road.Type.ToString(), Locations = road.Segments .Select(p => new LocationDto(p.Position.X, p.Position.Y)) .ToArray() }); }
public void AddBuildingToRoad(IRoad road, IBuilding building) { if (road != building.Road) { throw new Exception("Road and building road are not the same"); } if (road.AddBuilding(building)) { Fields[building.Position.X, building.Position.Y].IsBlocked = true; } }
public void RemoveBuildingFromRoad(IRoad road, IBuilding building) { if (road != building.Road) { throw new Exception("Road and building road are not the same"); } if (road.RemoveBuilding(building)) { Fields[building.Position.X, building.Position.Y].IsBlocked = false; } }
public void MarketRule_IsSatisfied_When_Exists_Other_Market_But_It_Further_Than_50_Pixels_Away() { IRoad road1 = _settlement.Roads.First(); var market1 = new Market() { Position = new Point(50, 51) }; market1.Road = road1; _settlement.AddBuildingToRoad(road1, market1); //add vertical road to the end of the road to increase distance between markets var roadGenerator = new RoadPointsGenerator(); var road2 = new Road(roadGenerator.GenerateStraight(new RoadGenerationTwoPoints() { Start = new Point(98, 51), End = new Point(98, 21), Fields = _settlement.Fields })); _settlement.AddRoad(road2); var market2 = new Market() { Position = new Point(99, 21) }; market2.Road = road1; _settlement.AddBuildingToRoad(road1, market2); while (_settlement.Roads.SelectMany(g => g.Buildings).Count() < 120) { var buildingPositions = road1.GetPossibleBuildingPositions(new PossibleBuildingPositions(_settlement.Roads, _settlement.Fields)); if (!buildingPositions.Any()) { continue; } var building = new Residence { Position = buildingPositions[RandomProvider.Next(buildingPositions.Count)] }; building.Road = road1; _settlement.AddBuildingToRoad(road1, building); } Assert.AreEqual(5, market1.CalculateFitness(new BuildingRule() { BuildingRoad = road1, Fields = _settlement.Fields, Roads = _settlement.Roads, SettlementCenter = _settlement.SettlementCenter })); }
public ActiveState() { activeLicenceKind = LicenceKind.SecondLicence; activeRoad = null; activeTown = null; activeHexa = null; activeTownPos = 255; activeSourceKind = SourceKind.Count; activeUpgradeKind = UpgradeKind.SecondUpgrade; activeSourceBuildingKind = SourceBuildingKind.Count; activePlayer = null; }
public static float GetFitness(IRoad road) { if (road == null) return 0.0f; float fitness = 0.0f; IRoad tempRoad; bool con; foreach (ITown town1 in road.GetITown()) { // if (town1.GetIOwner() != null) continue; con = false; for (byte loop1 = 0; loop1 < 3; loop1++) { tempRoad = town1.GetIRoad(loop1); if (tempRoad != null && tempRoad.GetIOwner() == map.GetPlayerMe()) { con = true; break ; } } if (con) continue; if (town1.IsPossibleToBuildTown()) fitness += GetFitness(town1); for(byte loop1 = 0; loop1 < 3; loop1++) { tempRoad = town1.GetIRoad(loop1); if (tempRoad == null || tempRoad.GetIsBuild()) continue; foreach(ITown town2 in tempRoad.GetITown()) { if(town2 != town1 && town2.IsPossibleToBuildTown()) fitness += GetFitness(town2) / 2.5f; } } } return fitness / 2.0f; }
public void AddLink(IStation stationA, IStation stationB, IRoad road) { if (stationA == null || stationB == null) { throw new System.ArgumentNullException(); } this.links.Add(new Link() { V1 = stationA, V2 = stationB, Road = road, }); this.OnEdited(); }
public IEnumerator MoveToStationAnimate(IRoad road) { _setLeftRightSpriteDircection(road.GetPosition(1).x - road.GetPosition(0).x); float duration = road.GetTotalDistance() * 0.3f; var startTime = Time.time; var endTime = startTime + duration; while (Time.time < endTime) { var t = Mathf.InverseLerp(startTime, endTime, Time.time); _busPrefab.transform.position = road.GetPosition(t); yield return(null); } _busPrefab.transform.position = road.GetPosition(1); }
private IRoad CreateNewRoad(IRoad road) { var roadGenerator = new RoadPointsGenerator(); var roadPoints = roadGenerator.GenerateAttached(new RoadGenerationAttached() { Road = road, Roads = this.Roads, Fields = this.Fields, SettlementCenter = this.SettlementCenter, MinDistanceBetweenRoads = MinDistanceBetweenRoads, MinRoadLength = MinRoadLength, MaxRoadLength = MaxRoadLength }).ToList(); return(new Road(roadPoints)); }
public void UniversityRule_IsSatisfied__When_Ratio_Universities_Per_Schools_Is_Less_Than_1_To_5() { IRoad road = _settlement.Roads.First(); var schools = new List <School>(5) { new School() { Position = new Point(50, 51) }, new School() { Position = new Point(55, 51) }, new School() { Position = new Point(60, 51) }, new School() { Position = new Point(65, 51) }, new School() { Position = new Point(70, 51) } }; schools.ForEach(s => { s.Road = road; _settlement.AddBuildingToRoad(road, s); }); var university = new University() { Position = new Point(50, 49) }; Assert.AreEqual(15, university.CalculateFitness(new BuildingRule() { BuildingRoad = road, Fields = _settlement.Fields, Roads = _settlement.Roads, SettlementCenter = _settlement.SettlementCenter })); }
public Tuple <IPoint, IPoint> find_cross_line_and_edge(double phi, IRoad edge) { var result = new List <IPoint>(); //x = Ax+By+C=0; //y = Phi; //x = -B * phi - C / edge.A; if (edge.A == 0) { return(new Tuple <IPoint, IPoint>(null, null)); } else { return(new Tuple <IPoint, IPoint>(new SimplePoint(((edge.B * phi) + edge.C) / -edge.A, phi), null)); } }
public bool CanAddRoad(IRoad road) { if (!road.Segments.Any()) { return(false); } if (road.Length < MinRoadLength) { return(false); } if (road.IsVertical) { if (this.Roads.Where(g => g.IsVertical).Any(g => Math.Abs(g.Start.X - road.Start.X) <= 2 && g.Segments.Any(s => road.Segments.Any(r => r.Position.Y == s.Position.Y)))) { return(false); } } else { if (this.Roads.Where(g => !g.IsVertical).Any(g => Math.Abs(g.Start.Y - road.Start.Y) <= 2 && g.Segments.Any(s => road.Segments.Any(r => r.Position.X == s.Position.X)))) { return(false); } } if (road.Segments.Any(s => !this.Fields[s.Position.X, s.Position.Y].InSettlement || (this.Fields[s.Position.X, s.Position.Y].IsBlocked.HasValue && this.Fields[s.Position.X, s.Position.Y].IsBlocked.Value))) { return(false); } if (road.Buildings.Any(b => !this.Fields[b.Position.X, b.Position.Y].InSettlement || (this.Fields[b.Position.X, b.Position.Y].IsBlocked.HasValue && this.Fields[b.Position.X, b.Position.Y].IsBlocked.Value))) { return(false); } return(true); }
public void AddRoad(IRoad road) { if (road.Buildings.Any(b => b.Road != road)) { throw new Exception("Road and building road are not the same"); } foreach (var segment in road.Segments) { Fields[segment.Position.X, segment.Position.Y].IsBlocked = true; } foreach (var building in road.Buildings) { Fields[building.Position.X, building.Position.Y].IsBlocked = true; } this.Roads.Add(road); }
private void GenerateTravelTimeHelper() { for (var x = 0; x < LiveMap.GetLength(0); x++) { for (var y = 0; y < LiveMap.GetLength(1); y++) { if (LiveMap[x, y] is IRoad) { IRoad buffer = (IRoad)LiveMap[x, y]; TravelTimes[x, y] = buffer.TimeToTraverse; } else if (LiveMap[x, y] is Intersection) { TravelTimes[x, y] = -1; } } } }
public void MarketRule_Is_Not_Satisfied_When_Exists_Other_Market_Which_Is_Less_Than_50_Pixels_Away() { //add randomly 100 residences IRoad road = _settlement.Roads.First(); var market1 = new Market() { Position = new Point(50, 51) }; market1.Road = road; _settlement.AddBuildingToRoad(road, market1); var market2 = new Market() { Position = new Point(90, 51) }; market2.Road = road; _settlement.AddBuildingToRoad(road, market2); while (_settlement.Roads.SelectMany(g => g.Buildings).Count() < 120) { var buildingPositions = road.GetPossibleBuildingPositions(new PossibleBuildingPositions(_settlement.Roads, _settlement.Fields)); if (!buildingPositions.Any()) { continue; } var building = new Residence { Position = buildingPositions[RandomProvider.Next(buildingPositions.Count)] }; building.Road = road; _settlement.AddBuildingToRoad(road, building); } Assert.AreEqual(0, market1.CalculateFitness(new BuildingRule() { BuildingRoad = road, Fields = _settlement.Fields, Roads = _settlement.Roads, SettlementCenter = _settlement.SettlementCenter })); }
public void SchoolRule_Is_Not_Satisfied__When_Ratio_Schools_Per_Residences_Is_Greater_Than_1_To_100() { IRoad road = _settlement.Roads.First(); var school1 = new School() { Position = new Point(50, 51) }; school1.Road = road; _settlement.AddBuildingToRoad(road, school1); while (_settlement.Roads.SelectMany(g => g.Buildings).Count() < 120) { var buildingPositions = road.GetPossibleBuildingPositions(new PossibleBuildingPositions(_settlement.Roads, _settlement.Fields)); if (!buildingPositions.Any()) { continue; } var building = new Residence { Position = buildingPositions[RandomProvider.Next(buildingPositions.Count)] }; building.Road = road; _settlement.AddBuildingToRoad(road, building); } var school2 = new School() { Position = new Point(80, 51) }; Assert.AreEqual(0, school2.CalculateFitness(new BuildingRule() { BuildingRoad = road, Fields = _settlement.Fields, Roads = _settlement.Roads, SettlementCenter = _settlement.SettlementCenter })); }
public virtual DropOnEdge heuristic_between_point_and_line(IPoint point, IRoad line) { double x = (line.B * (line.B * point.X - line.A * point.Y) - line.A * line.C) / (line.A * line.A + line.B * line.B); double y = (line.A * (-1 * line.B * point.X + line.A * point.Y) - line.B * line.C) / (line.A * line.A + line.B * line.B); double l = 0; if (x < Math.Min(line.X, line.X0) || x > Math.Max(line.X, line.X0) || y < Math.Min(line.Y, line.Y0) || y > Math.Max(line.Y, line.Y0)) { var lstart = between_point(point, line.Start); var lfinish = between_point(point, line.Finish); if (lstart < lfinish) { x = line.Start.X; y = line.Start.Y; l = lstart; } else { x = line.Finish.X; y = line.Finish.Y; l = lfinish; } return(new DropOnEdge(new SimplePoint(x, y), point, l, line, true)); } else { l = Math.Abs(line.A * point.X + line.B * point.Y + line.C) / Math.Sqrt(line.A * line.A + line.B * line.B); return(new DropOnEdge(new SimplePoint(x, y), point, l, line)); } }
private IEnumerable<IRoad> GetLongestBranch(IRoad current, IEnumerable<IRoad> roads) { var result = new HashSet<IRoad>(); result.Add(current); var adjacentRoads = roads.Where(r => r.IsAdjacentTo(current)); foreach (var adjacent in adjacentRoads) { var temp = new List<IRoad>(new IRoad[] { current }); temp.AddRange(GetLongestBranch(adjacent, roads.Except(adjacentRoads.Union(temp)))); if (temp.Count > result.Count) result = new HashSet<IRoad>(temp); } return result; }
public BuildRoadAtom(IMapController map, IRoad road, int depth) : base(map, depth, "Build road") { this.road = road; }
private int FindBestRoad() { int maxRoadID = map.GetMaxRoadID(); List<IPlayer> players = map.GetPlayerOthers(); IRoad bestRoad = null; int best = 99999; foreach(IPlayer player in players) { for (int loop1 = 1; loop1 < maxRoadID; loop1++) { RoadBuildError error = map.CanBuildRoad(loop1); if (error == RoadBuildError.NoSources || error == RoadBuildError.OK) { IRoad tempRoad = map.GetIRoadByID(loop1); int temp = map.GetDistanceToRoad(tempRoad, player); if (temp < best) { best = temp; bestRoad = tempRoad; } } } } lastBestRoad = bestRoad; return best; }
public void UpdateRoadSequence(IRoad nextroad) { if (nextroad == null) { GlobalPixelPosition = - Bounds.Y; return; } this.nextroad = nextroad; GlobalPixelPosition = nextroad.GlobalPixelPosition + ((IDrawableActor)nextroad).Bounds.Height; nextroad.prevroad = this; //coloca a marcação de distancia do check point a cada 1000m e quando menor que 1000m coloca a marca de 500m também int Y1 = map.CheckPointPixelDistance - GlobalPixelPosition; int Y2 = map.CheckPointPixelDistance - GlobalPixelPosition - Bounds.Height; int div = 1000; if ( Y1 < (1000*map.RatioPxMt) ) div=500; int mark = (int) ( Y1 / (div * map.RatioPxMt) ); int markpx = (int) ( mark * div * map.RatioPxMt ); if (Y1 >= markpx && Y2 < markpx) { this.Distance = mark * div;} }
public DropOnEdge(IPoint pointTo, IPoint pointFrom, double l, IRoad edge, bool flag) : this(pointTo, pointFrom, l, edge) { dropNode = flag; }
public void SetActiveObject(IRoad road) { activeState.activeRoad = road; }
public void Clear() { ancestorTown = null; ancestorRoad = null; distance = INFINITY; }
internal void Set(int distance, TownModel ancestorTown, IRoad ancestorRoad) { this.distance = distance; this.ancestorTown = ancestorTown; this.ancestorRoad = ancestorRoad; }
public void AddRoad(IRoad t) { road.Add(t); AddPoints(PlayerPoints.Road); AddBuilding(Building.Road); foreach (int id in Settings.goalRoad) { if (id == t.GetRoadID()) { AddPoints(PlayerPoints.RoadID); break; } } }
public FourLanesCheckPoint(IRoad road, int ajuste) { this.road = road; _laneslist = new List<int>(); for (int i = _starindex; i < _count; i++) { _laneslist.Add(ajuste + 270 + 130 * i); _lastindex = i; } //_laneslist[_lastindex] = _laneslist[_lastindex]-10 }
public Tuple <IPoint, IPoint> find_cross_line_and_edge(double phi, IRoad edge) { throw new NotImplementedException(); }
internal bool BuildRoad(IRoad activeRoad) { if (activeRoad == null) return false; if (activeRoad.Build() != null) { freeRoadPlaces.Remove(activeRoad); foreach (ITown town in activeRoad.GetITown()) { if (town.GetIOwner() != mapController.GetPlayerMe() && town.GetIOwner() != null) continue; for (byte loop1 = 0; loop1 < 3; loop1++) { IRoad road = town.GetIRoad(loop1); if (road != null) { RoadBuildError tempError = road.CanBuildRoad(); if (tempError == RoadBuildError.OK || tempError == RoadBuildError.NoSources) { if (!freeRoadPlaces.Contains(road)) { freeRoadPlaces.Add(road); } } } } if (town.IsPossibleToBuildTown()) { freeTownPlaces.Remove(town); freeTownPlaces.Add(town); } } return true; } else { freeRoadPlaces.Remove(activeRoad); throw new Exception("Buidling road. " + mapController.GetLastError()); //return false; } }
public int GetDistanceToRoad(IRoad road, IPlayer player) { FindWaysToAllTowns(player); RoadModel roadModel = (RoadModel)road; return roadModel.GetPathNode().GetDistance(); }
public TwoLanes(IRoad road, int ajuste) { this.road = road; _laneslist = new List<int>(); for (int i = _starindex; i < _count; i++) { _laneslist.Add(ajuste + 270 + 130 * i); _lastindex = i; } }
public bool IsAdjacentTo(IRoad road) { return Edge.IsAdjacentTo(road.Edge); }
protected override DropOnEdge CheckSquere(int a, int b, SquareMatrixBase square_matrix, DropOnEdge result) { var s_matrix = square_matrix as SquareMatrixEdges; if (s_matrix == null) { throw new ArgumentException(nameof(square_matrix)); } if (a < 0 || a >= s_matrix.SizeX || b < 0 || b >= s_matrix.SizeY) { return(result); } double curDistance = result.L; IRoad curRoad = result.Edge; IPoint curPointTo = result.Point_To; bool curDropNodeFlag = result.DropNodeFlag; double curA = 0, curB = 0, curC = 0; if (result.Edge != null) { curA = result.Edge.A; curB = result.Edge.B; curC = result.Edge.C; } if (s_matrix.Matrix[a, b] != null) { foreach (var road in s_matrix.Matrix[a, b]) { DropOnEdge temp = fun_set.heuristic_between_point_and_line(result.Point_From, road); if (temp.L <= curDistance && temp.Edge.Finish != temp.Point_To) { if (temp.IsRightTurn) { curDistance = temp.L; curRoad = temp.Edge; curPointTo = temp.Point_To; curDropNodeFlag = temp.DropNodeFlag; } else if (temp.L < curDistance) { curDistance = temp.L; curRoad = temp.Edge; curPointTo = temp.Point_To; curDropNodeFlag = temp.DropNodeFlag; } } } } return(new DropOnEdge(curPointTo, result.Point_From, curDistance, curRoad, curDropNodeFlag)); }
public void AddLink(int indexA, int indexB, IRoad road) { this.AddLink(GetStation(indexA), GetStation(indexB), road); }
internal void SetPathNode(int distance, TownModel ancestorTown, IRoad ancestorRoad) { pathNode.Set(distance, ancestorTown, ancestorRoad); }