public override void Save(bool force) { if (!force && !Modified) { return; } string ext = parent.MosaicDesc.FileExt; // swap the z coord of the tiles to deal with our -Z = north coordinate system int loadTileZ = parent.MosaicDesc.SizeZTiles - 1 - tileZ; string tileName = string.Format("{0}_x{1}y{2}.{3}", parent.BaseName, tileX, loadTileZ, ext); string fileName; if (ResourceManager.HasCommonResourceData(tileName)) { fileName = ResourceManager.GetCommonResourceDataFilePath(tileName); } else { string saveDir = parent.MosaicDesc.DefaultTerrainSaveDirectory; fileName = Path.Combine(saveDir, tileName); if (!Directory.Exists(saveDir)) { Directory.CreateDirectory(saveDir); } ResourceManager.AddCommonSearchPath(saveDir); } TaoImage image = new TaoImage(tileSizeSamples, tileSizeSamples, tileData.BytesPerSample, tileData.IlFormat); for (int z = 0; z < tileSizeSamples; z++) { for (int x = 0; x < tileSizeSamples; x++) { uint heightData = tileData.GetData(x, z); image.SetPixel(x, z, heightData); } } if (File.Exists(fileName)) { File.Delete(fileName); } image.Save(fileName); if (Modified) { Modified = false; } }