public void updateNode(TrackNode node) { allowedDirections = new List <string>(); allowedDirections.Add(" "); allowedDirections.Add("In"); allowedDirections.Add("Out"); allowedDirections.Add("Both"); //DirBuffer = AllowedDir.NONE; if (NameBuffer != null && NameBuffer.Length > 0 && DirBuffer != AllowedDir.NONE) { Configured = true; } else { Configured = false; } typeItem = (int)TypeItem.BUFFER_ITEM; associateNode = node; //associateNodeIdx = (int)componentItem.Index; associateSectionIdx = 0; Coord = new MSTSCoord(node); Location.X = associateNode.UiD.TileX * 2048f + associateNode.UiD.X; Location.Y = associateNode.UiD.TileZ * 2048f + associateNode.UiD.Z; node.Reduced = true; }
public AESegment(TrVectorSection item1, TrVectorSection item2) { MSTSCoord A = new MSTSCoord(item1); MSTSCoord B = new MSTSCoord(item2); startPoint = A.ConvertToPointF(); endPoint = B.ConvertToPointF(); }
public MSTSCoord(MSTSCoord coord) { TileX = coord.TileX; TileY = coord.TileY; X = coord.X; Y = coord.Y; Reduced = coord.Reduced; }
// Used only in RunActivity public StationItem SearchByLocation(WorldLocation location) { MSTSCoord place = new MSTSCoord(location); List <StationItem> listStation = GetStationItem(); foreach (var item in listStation) { if (item.IsInStation(place)) { return(item); } } return(null); }
} // Never save this information, it comes from MSTS /// <summary> /// The default constructor /// </summary> public GlobalItem() { movable = false; rotable = false; editable = false; lineSnap = false; actEdit = false; isSeen = false; asMetadata = false; typeItem = (int)TypeItem.GLOBAL_ITEM; Location = new PointF(float.NegativeInfinity, float.NegativeInfinity); Location2D = new PointF(float.NegativeInfinity, float.NegativeInfinity); Coord = new MSTSCoord(); }
public static bool near(MSTSCoord x, MSTSCoord y) { float squareA = (float)Math.Pow((x.X - y.X), 2); float squareB = (float)Math.Pow((x.Y - y.Y), 2); float AX = (float)Math.Round((Decimal)(x.X - y.Y), 2, MidpointRounding.ToEven); float AY = (float)Math.Round((Decimal)x.Y, 2, MidpointRounding.ToEven); float BX = (float)Math.Round((Decimal)y.X, 2, MidpointRounding.ToEven); float BY = (float)Math.Round((Decimal)y.Y, 2, MidpointRounding.ToEven); if ((float)Math.Round((Decimal)(squareA + squareB)) < 0.1f && x.TileX == y.TileX && x.TileY == y.TileY) { return(true); } return(false); }
// Equality operator. test if the coordinates are at the same point. public override bool Equals(object obj) { if (obj == null) { return(false); } if (GetType() != obj.GetType()) { return(false); } MSTSCoord other = (MSTSCoord)obj; return(this.X == other.X && this.Y == other.Y && this.TileX == other.TileX && this.TileY == other.TileY); }
/// <summary> /// /// </summary> /// <param name="sideItem"></param> /// <param name="signal"></param> public AEBufferItem(TrackNode item) { allowedDirections = new List <string>(); allowedDirections.Add(" "); allowedDirections.Add("In"); allowedDirections.Add("Out"); allowedDirections.Add("Both"); DirBuffer = AllowedDir.NONE; Configured = false; typeItem = (int)TypeItem.BUFFER_ITEM; associateNode = item; associateNodeIdx = (int)item.Index; associateSectionIdx = 0; Coord = new MSTSCoord(item); Location.X = associateNode.UiD.TileX * 2048f + associateNode.UiD.X; Location.Y = associateNode.UiD.TileZ * 2048f + associateNode.UiD.Z; }
/// <summary> /// Permet de récupérer les coordonnées du node au format MSTSCoord propre à l'éditeur d'activité /// Return the MSTSCoord for the current node as needed by Activity Editor /// For vectorNode with multiple section, the direction is used to give the first encountered section /// </summary> public static MSTSCoord getMSTSCoord(this TrackNode node, int direction) { MSTSCoord coord = new MSTSCoord(); if (node.TrEndNode || node.TrJunctionNode != null || node.TrVectorNode.TrVectorSections == null) { coord.TileX = node.UiD.TileX; coord.TileY = node.UiD.TileZ; coord.X = node.UiD.X; coord.Y = node.UiD.Z; } else if (node.TrVectorNode != null && node.TrVectorNode.TrVectorSections.Length > 1) { if (direction == 0) { TrVectorSection section = node.TrVectorNode.TrVectorSections.Last(); coord.TileX = section.TileX; coord.TileY = section.TileZ; coord.X = section.X; coord.Y = section.Z; } else { TrVectorSection section = node.TrVectorNode.TrVectorSections.First(); coord.TileX = section.TileX; coord.TileY = section.TileZ; coord.X = section.X; coord.Y = section.Z; } } else if (node.TrVectorNode != null) { coord.TileX = node.TrVectorNode.TrVectorSections[0].TileX; coord.TileY = node.TrVectorNode.TrVectorSections[0].TileZ; coord.X = node.TrVectorNode.TrVectorSections[0].X; coord.Y = node.TrVectorNode.TrVectorSections[0].Z; } return(coord); }
public AESegment(MSTSCoord start, MSTSCoord end) { startPoint = start.ConvertToPointF(); endPoint = end.ConvertToPointF(); lengthSegment = 0; }
public MSTSCoord getEnd() { MSTSCoord point = new MSTSCoord(startPoint); return(point); }
public Vector2 getEndPoint() { MSTSCoord info = new MSTSCoord(endPoint); return(info.ConvertVector2()); }
public Vector2 getStartPoint() { MSTSCoord info = new MSTSCoord(startPoint); return(info.ConvertVector2()); }
public MSTSCoord getMstsCoord(PointF point) { MSTSCoord coord = new MSTSCoord(point); return(coord); }
public virtual void configCoord(MSTSCoord coord) { Coord = new MSTSCoord(coord); Location.X = coord.TileX * 2048f + coord.X; Location.Y = coord.TileY * 2048f + coord.Y; }
public virtual void Update(MSTSCoord coord) { }