@@ -166,7 +166,6 @@ private void InitializeData()
166166
167167 if ( currNode != null )
168168 {
169-
170169 if ( currNode . TrEndNode )
171170 {
172171 //buffers.Add(new PointF(currNode.UiD.TileX * 2048 + currNode.UiD.X, currNode.UiD.TileZ * 2048 + currNode.UiD.Z));
@@ -191,8 +190,6 @@ private void InitializeData()
191190 dVector B = new dVector ( connectedNode . UiD . TileX , connectedNode . UiD . X , connectedNode . UiD . TileZ , connectedNode . UiD . Z ) ;
192191 segments . Add ( new LineSegment ( A , B , /*s.InterlockingTrack.IsOccupied*/ false , null ) ) ;
193192 }
194-
195-
196193 }
197194 }
198195 else if ( currNode . TrJunctionNode != null )
@@ -215,8 +212,8 @@ private void InitializeData()
215212 }
216213
217214 var maxsize = maxX - minX > maxY - minY ? maxX - minX : maxY - minY ;
218- // Take up to next 100
219- maxsize = ( int ) ( maxsize / 100 + 1 ) * 100 ;
215+ // Take up to next 500
216+ maxsize = ( int ) ( maxsize / 100 + 1 ) * 500 ;
220217 mapResolutionUpDown . Maximum = ( decimal ) maxsize ;
221218 Inited = true ;
222219
@@ -1120,108 +1117,9 @@ private void DrawZoomTarget(Graphics g)
11201117
11211118 }
11221119
1123-
1124-
1125-
1126-
1127-
1128-
1129-
1130-
1131-
1132-
1133-
1134-
1135- private PointF DrawSiding ( Graphics g , PointF scaledItem , SidingWidget s )
1136- {
1137- scaledItem . X = ( s . Location . X - subX ) * xScale ;
1138- scaledItem . Y = DetermineSidingLocation ( scaledItem . X , mapCanvas . Height - ( s . Location . Y - subY ) * yScale , s . Name ) ;
1139- if ( scaledItem . Y >= 0f ) //if we need to draw the siding names
1140- {
1141- g . DrawString ( s . Name , sidingFont , sidingBrush , scaledItem ) ;
1142- }
1143- return scaledItem ;
1144- }
1145-
1146- private PointF DrawPlatform ( Graphics g , PointF scaledItem , PlatformWidget s )
1147- {
1148- scaledItem . X = ( s . Location . X - subX ) * xScale ;
1149- scaledItem . Y = DetermineSidingLocation ( scaledItem . X , mapCanvas . Height - ( s . Location . Y - subY ) * yScale , s . Name ) ;
1150- if ( scaledItem . Y >= 0f ) //if we need to draw the siding names
1151- {
1152- g . DrawString ( s . Name , sidingFont , sidingBrush , scaledItem ) ;
1153- }
1154- return scaledItem ;
1155- }
1156-
11571120 public Vector2 [ ] [ ] alignedTextY ;
11581121 public int [ ] alignedTextNum ;
11591122 public const int spacing = 12 ;
1160- private void CleanVerticalCells ( )
1161- {
1162- if ( alignedTextY == null || alignedTextY . Length != IM_Height / spacing ) //first time to put text, or the text height has changed
1163- {
1164- alignedTextY = new Vector2 [ IM_Height / spacing ] [ ] ;
1165- alignedTextNum = new int [ IM_Height / spacing ] ;
1166- for ( var i = 0 ; i < IM_Height / spacing ; i ++ )
1167- alignedTextY [ i ] = new Vector2 [ 4 ] ; //each line has at most 4 sidings
1168- }
1169- for ( var i = 0 ; i < IM_Height / spacing ; i ++ )
1170- {
1171- alignedTextNum [ i ] = 0 ;
1172- }
1173- }
1174-
1175- private float DetermineSidingLocation ( float startX , float wantY , string name )
1176- {
1177- //out of drawing area
1178- if ( startX < - 64 || startX > IM_Width || wantY < - spacing || wantY > IM_Height ) return - 1f ;
1179-
1180- int position = ( int ) ( wantY / spacing ) ; //the cell of the text it wants in
1181- if ( position > alignedTextY . Length ) return wantY ; //position is larger than the number of cells
1182- var endX = startX + name . Length * trainFont . Size ;
1183- int desiredPosition = position ;
1184- while ( position < alignedTextY . Length && position >= 0 )
1185- {
1186- //if the line contains no text yet, put it there
1187- if ( alignedTextNum [ position ] == 0 )
1188- {
1189- alignedTextY [ position ] [ alignedTextNum [ position ] ] . X = startX ;
1190- alignedTextY [ position ] [ alignedTextNum [ position ] ] . Y = endX ; //add info for the text (i.e. start and end location)
1191- alignedTextNum [ position ] ++ ;
1192- return position * spacing ;
1193- }
1194-
1195- bool conflict = false ;
1196- //check if it is intersect any one in the cell
1197- foreach ( Vector2 v in alignedTextY [ position ] )
1198- {
1199- //check conflict with a text, v.x is the start of the text, v.y is the end of the text
1200- if ( ( startX > v . X && startX < v . Y ) || ( endX > v . X && endX < v . Y ) || ( v . X > startX && v . X < endX ) || ( v . Y > startX && v . Y < endX ) )
1201- {
1202- conflict = true ;
1203- break ;
1204- }
1205- }
1206- if ( conflict == false ) //no conflict
1207- {
1208- if ( alignedTextNum [ position ] >= alignedTextY [ position ] . Length ) return - 1f ;
1209- alignedTextY [ position ] [ alignedTextNum [ position ] ] . X = startX ;
1210- alignedTextY [ position ] [ alignedTextNum [ position ] ] . Y = endX ; //add info for the text (i.e. start and end location)
1211- alignedTextNum [ position ] ++ ;
1212- return position * spacing ;
1213- }
1214- position -- ;
1215- //cannot move up, then try to move it down
1216- if ( position - desiredPosition < - 1 )
1217- {
1218- position = desiredPosition + 2 ;
1219- }
1220- //could not find any position up or down, just return negative
1221- if ( position == desiredPosition ) return - 1f ;
1222- }
1223- return position * spacing ;
1224- }
12251123
12261124 const float SignalErrorDistance = 100 ;
12271125 const float SignalWarningDistance = 500 ;
@@ -1991,16 +1889,12 @@ private void penaltyCheckbox_CheckedChanged(object sender, EventArgs e)
19911889 else { MPManager . BroadCast ( new MSGMessage ( "All" , "NoOverSpeed" , "Penalty for overspeed and passing stop light" ) . ToString ( ) ) ; }
19921890 }
19931891
1994-
1995-
19961892 private void DispatchViewerBeta_FormClosing ( object sender , FormClosingEventArgs e )
19971893 {
19981894 // Prevent the window from closing; instead, hide it
19991895 e . Cancel = true ;
20001896 Viewer . DebugViewerBetaEnabled = false ;
20011897 }
2002-
2003-
20041898 }
20051899
20061900 #region SignalWidget
@@ -2314,5 +2208,4 @@ static public double DistanceSqr(dVector v1, dVector v2)
23142208 + Math . Pow ( ( v1 . TileZ - v2 . TileZ ) * 2048 + v1 . Z - v2 . Z , 2 ) ;
23152209 }
23162210 }
2317-
23182211}
0 commit comments