public void tileBackdropArrived(Tile tile) { // the backdrop may arrive when the tile has been phased out due to TileSet.ReTile() // the tile then hangs around as a means to pass backdrop to TileSet, which is supposed // to find appropriate location for the backdrop. bool found = false; #if DEBUG LibSys.StatusBar.Trace("TileSet::tileBackdropArrived() - " + tile.ToString()); #endif lock (tilesLock) { for (int vv = 0; vv < m_vCount; vv++) { for (int hh = 0; hh < m_hCount; hh++) { Tile tt = m_tiles[vv, hh]; //LibSys.StatusBar.Trace(" = " + tt.baseName + " UseSubstitute=" + tt.UseSubstitute + " SubstituteName=" + tt.SubstituteName); if (tt == tile) { // tile still in the array #if DEBUG LibSys.StatusBar.Trace(" - still in array : " + tt.baseName); #endif if (tt.UseSubstitute && tile.backdrop.HasImage && tt.SubstituteRectangle.IsEmpty) { tt.CalculateSubstituteRectangle(); } ArrangeBackdropRedraw(tt); found = true; } else if ((!tt.UseSubstitute && tt.baseName.Equals(tile.baseName)) || (tt.UseSubstitute && tile.UseSubstitute && tt.SubstituteName.Equals(tile.SubstituteName))) { // tile has been replaced by another tile with the same base name (due to ReTile()) #if DEBUG LibSys.StatusBar.Trace(" - " + tt.baseName + " - replaced by " + tile.baseName + " " + tile.backdrop); #endif tt.backdrop = tile.backdrop; if (!tt.baseName.Equals(tile.baseName)) { //tt.backdrop.MarkUsed(); tt.CalculateSubstituteRectangle(); } ArrangeBackdropRedraw(tt); found = true; } if (found && !tt.MayUseSubstitute) { goto endLoop; } } } endLoop: ; } // lock // tile not found - bitmap/backdrop stays in file system and cache for the future. }
public void ArrangeFeaturesRedraw(Tile tile) { //Point topLeft = tile.pixelTopLeft(); //Point bottomRight = tile.pixelBottomRight(); //Size size = new Size(bottomRight.X - topLeft.X, bottomRight.Y - topLeft.Y); Rectangle tileRect = tile.getFrameRectangle(); //new Rectangle(topLeft, size); //LibSys.StatusBar.Trace("tileFeaturesArrived() - tileRect " + tileRect); Rectangle toDrawRect = m_pictureManager.PictureBox.Bounds; //LibSys.StatusBar.Trace("tileFeaturesArrived() - pbRect " + toDrawRect); if (m_cameraManager.Elev < 5000000.0d) // world map may span 180, redraw whole thing { toDrawRect.Intersect(tileRect); } #if DEBUG LibSys.StatusBar.Trace("tileFeaturesArrived() - tile " + tile.ToString() + " invalidating " + toDrawRect); #endif m_pictureManager.Invalidate(toDrawRect); }
public void tileBackdropArrived(Tile tile) { // the backdrop may arrive when the tile has been phased out due to TileSet.ReTile() // the tile then hangs around as a means to pass backdrop to TileSet, which is supposed // to find appropriate location for the backdrop. bool found = false; #if DEBUG LibSys.StatusBar.Trace("TileSet::tileBackdropArrived() - " + tile.ToString()); #endif lock(tilesLock) { for(int vv=0; vv < m_vCount ;vv++) { for(int hh=0; hh < m_hCount ;hh++) { Tile tt = m_tiles[vv, hh]; //LibSys.StatusBar.Trace(" = " + tt.baseName + " UseSubstitute=" + tt.UseSubstitute + " SubstituteName=" + tt.SubstituteName); if(tt == tile) { // tile still in the array #if DEBUG LibSys.StatusBar.Trace(" - still in array : " + tt.baseName); #endif if(tt.UseSubstitute && tile.backdrop.HasImage && tt.SubstituteRectangle.IsEmpty) { tt.CalculateSubstituteRectangle(); } ArrangeBackdropRedraw(tt); found = true; } else if((!tt.UseSubstitute && tt.baseName.Equals(tile.baseName)) || (tt.UseSubstitute && tile.UseSubstitute && tt.SubstituteName.Equals(tile.SubstituteName))) { // tile has been replaced by another tile with the same base name (due to ReTile()) #if DEBUG LibSys.StatusBar.Trace(" - " + tt.baseName + " - replaced by " + tile.baseName + " " + tile.backdrop); #endif tt.backdrop = tile.backdrop; if(!tt.baseName.Equals(tile.baseName)) { //tt.backdrop.MarkUsed(); tt.CalculateSubstituteRectangle(); } ArrangeBackdropRedraw(tt); found = true; } if(found && !tt.MayUseSubstitute) { goto endLoop; } } } endLoop: ; } // lock // tile not found - bitmap/backdrop stays in file system and cache for the future. }
public void ArrangeFeaturesRedraw(Tile tile) { //Point topLeft = tile.pixelTopLeft(); //Point bottomRight = tile.pixelBottomRight(); //Size size = new Size(bottomRight.X - topLeft.X, bottomRight.Y - topLeft.Y); Rectangle tileRect = tile.getFrameRectangle(); //new Rectangle(topLeft, size); //LibSys.StatusBar.Trace("tileFeaturesArrived() - tileRect " + tileRect); Rectangle toDrawRect = m_pictureManager.PictureBox.Bounds; //LibSys.StatusBar.Trace("tileFeaturesArrived() - pbRect " + toDrawRect); if(m_cameraManager.Elev < 5000000.0d) // world map may span 180, redraw whole thing { toDrawRect.Intersect(tileRect); } #if DEBUG LibSys.StatusBar.Trace("tileFeaturesArrived() - tile " + tile.ToString() + " invalidating " + toDrawRect); #endif m_pictureManager.Invalidate(toDrawRect); }