diff options
author | Adam Frisby | 2008-04-21 06:39:16 +0000 |
---|---|---|
committer | Adam Frisby | 2008-04-21 06:39:16 +0000 |
commit | 05e24c8f58e5cc41b3e7704b1912dfbe9703d4fe (patch) | |
tree | 09f7aa55e82ede0839373e85895a34fb3e797b31 /OpenSim/Region/Environment/Modules/Terrain/FileLoaders | |
parent | * Written a improved self-contained version of the XML Object Serialiser for ... (diff) | |
download | opensim-SC-05e24c8f58e5cc41b3e7704b1912dfbe9703d4fe.zip opensim-SC-05e24c8f58e5cc41b3e7704b1912dfbe9703d4fe.tar.gz opensim-SC-05e24c8f58e5cc41b3e7704b1912dfbe9703d4fe.tar.bz2 opensim-SC-05e24c8f58e5cc41b3e7704b1912dfbe9703d4fe.tar.xz |
* Terrain Module code has been reformatted to comply with guidelines.
* Fixed a variety of code quality issues. (Yes, I've found ReSharper.)
Diffstat (limited to 'OpenSim/Region/Environment/Modules/Terrain/FileLoaders')
9 files changed, 77 insertions, 79 deletions
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/BMP.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/BMP.cs index cad0edf..f975872 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/BMP.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/BMP.cs | |||
@@ -24,8 +24,8 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using System; | ||
28 | using System.Drawing; | 27 | using System.Drawing; |
28 | using System.Drawing.Imaging; | ||
29 | using OpenSim.Region.Environment.Interfaces; | 29 | using OpenSim.Region.Environment.Interfaces; |
30 | 30 | ||
31 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | 31 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders |
@@ -36,7 +36,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
36 | /// | 36 | /// |
37 | /// Uses the System.Drawing filesystem loader. | 37 | /// Uses the System.Drawing filesystem loader. |
38 | /// </summary> | 38 | /// </summary> |
39 | class BMP : GenericSystemDrawing | 39 | internal class BMP : GenericSystemDrawing |
40 | { | 40 | { |
41 | /// <summary> | 41 | /// <summary> |
42 | /// Exports a file to a image on the disk using a System.Drawing exporter. | 42 | /// Exports a file to a image on the disk using a System.Drawing exporter. |
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
47 | { | 47 | { |
48 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 48 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); |
49 | 49 | ||
50 | colours.Save(filename, System.Drawing.Imaging.ImageFormat.Bmp); | 50 | colours.Save(filename, ImageFormat.Bmp); |
51 | } | 51 | } |
52 | 52 | ||
53 | /// <summary> | 53 | /// <summary> |
@@ -59,4 +59,4 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
59 | return "BMP"; | 59 | return "BMP"; |
60 | } | 60 | } |
61 | } | 61 | } |
62 | } | 62 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GIF.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GIF.cs index 7f07fd9..cf82000 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GIF.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GIF.cs | |||
@@ -24,19 +24,19 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using System; | ||
28 | using System.Drawing; | 27 | using System.Drawing; |
28 | using System.Drawing.Imaging; | ||
29 | using OpenSim.Region.Environment.Interfaces; | 29 | using OpenSim.Region.Environment.Interfaces; |
30 | 30 | ||
31 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | 31 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders |
32 | { | 32 | { |
33 | class GIF : GenericSystemDrawing | 33 | internal class GIF : GenericSystemDrawing |
34 | { | 34 | { |
35 | public override void SaveFile(string filename, ITerrainChannel map) | 35 | public override void SaveFile(string filename, ITerrainChannel map) |
36 | { | 36 | { |
37 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 37 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); |
38 | 38 | ||
39 | colours.Save(filename, System.Drawing.Imaging.ImageFormat.Gif); | 39 | colours.Save(filename, ImageFormat.Gif); |
40 | } | 40 | } |
41 | 41 | ||
42 | public override string ToString() | 42 | public override string ToString() |
@@ -44,4 +44,4 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
44 | return "GIF"; | 44 | return "GIF"; |
45 | } | 45 | } |
46 | } | 46 | } |
47 | } | 47 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GenericSystemDrawing.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GenericSystemDrawing.cs index 9bcf94d..47e0e4cb 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GenericSystemDrawing.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/GenericSystemDrawing.cs | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.Drawing; | 29 | using System.Drawing; |
30 | using System.Drawing.Imaging; | ||
30 | using OpenSim.Region.Environment.Interfaces; | 31 | using OpenSim.Region.Environment.Interfaces; |
31 | 32 | ||
32 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | 33 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders |
@@ -72,6 +73,20 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
72 | throw new NotImplementedException(); | 73 | throw new NotImplementedException(); |
73 | } | 74 | } |
74 | 75 | ||
76 | /// <summary> | ||
77 | /// Exports a file to a image on the disk using a System.Drawing exporter. | ||
78 | /// </summary> | ||
79 | /// <param name="filename">The target filename</param> | ||
80 | /// <param name="map">The terrain channel being saved</param> | ||
81 | public virtual void SaveFile(string filename, ITerrainChannel map) | ||
82 | { | ||
83 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | ||
84 | |||
85 | colours.Save(filename, ImageFormat.Png); | ||
86 | } | ||
87 | |||
88 | #endregion | ||
89 | |||
75 | public override string ToString() | 90 | public override string ToString() |
76 | { | 91 | { |
77 | return "SYS.DRAWING"; | 92 | return "SYS.DRAWING"; |
@@ -100,7 +115,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
100 | for (int x = 0; x < map.Width; x++) | 115 | for (int x = 0; x < map.Width; x++) |
101 | { | 116 | { |
102 | // 512 is the largest possible height before colours clamp | 117 | // 512 is the largest possible height before colours clamp |
103 | int colorindex = (int)(Math.Max(Math.Min(1.0, map[x, y] / 128.0), 0.0) * (pallete - 1)); | 118 | int colorindex = (int) (Math.Max(Math.Min(1.0, map[x, y] / 128.0), 0.0) * (pallete - 1)); |
104 | 119 | ||
105 | // Handle error conditions | 120 | // Handle error conditions |
106 | if (colorindex > pallete - 1 || colorindex < 0) | 121 | if (colorindex > pallete - 1 || colorindex < 0) |
@@ -137,7 +152,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
137 | for (int x = 0; x < map.Width; x++) | 152 | for (int x = 0; x < map.Width; x++) |
138 | { | 153 | { |
139 | // 512 is the largest possible height before colours clamp | 154 | // 512 is the largest possible height before colours clamp |
140 | int colorindex = (int)(Math.Max(Math.Min(1.0, map[x, y] / 512.0), 0.0) * (pallete - 1)); | 155 | int colorindex = (int) (Math.Max(Math.Min(1.0, map[x, y] / 512.0), 0.0) * (pallete - 1)); |
141 | 156 | ||
142 | // Handle error conditions | 157 | // Handle error conditions |
143 | if (colorindex > pallete - 1 || colorindex < 0) | 158 | if (colorindex > pallete - 1 || colorindex < 0) |
@@ -148,19 +163,5 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
148 | } | 163 | } |
149 | return bmp; | 164 | return bmp; |
150 | } | 165 | } |
151 | |||
152 | /// <summary> | ||
153 | /// Exports a file to a image on the disk using a System.Drawing exporter. | ||
154 | /// </summary> | ||
155 | /// <param name="filename">The target filename</param> | ||
156 | /// <param name="map">The terrain channel being saved</param> | ||
157 | public virtual void SaveFile(string filename, ITerrainChannel map) | ||
158 | { | ||
159 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | ||
160 | |||
161 | colours.Save(filename, System.Drawing.Imaging.ImageFormat.Png); | ||
162 | } | ||
163 | |||
164 | #endregion | ||
165 | } | 166 | } |
166 | } | 167 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs index d6430cd..f25b29b 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/JPEG.cs | |||
@@ -26,8 +26,8 @@ | |||
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | 28 | using System; |
29 | using System.IO; | ||
30 | using System.Drawing; | 29 | using System.Drawing; |
30 | using System.Drawing.Imaging; | ||
31 | using OpenSim.Region.Environment.Interfaces; | 31 | using OpenSim.Region.Environment.Interfaces; |
32 | 32 | ||
33 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | 33 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders |
@@ -46,6 +46,15 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
46 | throw new NotImplementedException(); | 46 | throw new NotImplementedException(); |
47 | } | 47 | } |
48 | 48 | ||
49 | public void SaveFile(string filename, ITerrainChannel map) | ||
50 | { | ||
51 | Bitmap colours = CreateBitmapFromMap(map); | ||
52 | |||
53 | colours.Save(filename, ImageFormat.Jpeg); | ||
54 | } | ||
55 | |||
56 | #endregion | ||
57 | |||
49 | public override string ToString() | 58 | public override string ToString() |
50 | { | 59 | { |
51 | return "JPEG"; | 60 | return "JPEG"; |
@@ -70,20 +79,11 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
70 | for (int x = 0; x < map.Width; x++) | 79 | for (int x = 0; x < map.Width; x++) |
71 | { | 80 | { |
72 | // 512 is the largest possible height before colours clamp | 81 | // 512 is the largest possible height before colours clamp |
73 | int colorindex = (int)(Math.Max(Math.Min(1.0, map[x, y] / 512.0), 0.0) * (pallete - 1)); | 82 | int colorindex = (int) (Math.Max(Math.Min(1.0, map[x, y] / 512.0), 0.0) * (pallete - 1)); |
74 | bmp.SetPixel(x, map.Height - y - 1, colours[colorindex]); | 83 | bmp.SetPixel(x, map.Height - y - 1, colours[colorindex]); |
75 | } | 84 | } |
76 | } | 85 | } |
77 | return bmp; | 86 | return bmp; |
78 | } | 87 | } |
79 | |||
80 | public void SaveFile(string filename, ITerrainChannel map) | ||
81 | { | ||
82 | Bitmap colours = CreateBitmapFromMap(map); | ||
83 | |||
84 | colours.Save(filename, System.Drawing.Imaging.ImageFormat.Jpeg); | ||
85 | } | ||
86 | |||
87 | #endregion | ||
88 | } | 88 | } |
89 | } | 89 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs index 7436dc5..fda46f0 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/LLRAW.cs | |||
@@ -47,7 +47,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
47 | { | 47 | { |
48 | for (x = 0; x < retval.Width; x++) | 48 | for (x = 0; x < retval.Width; x++) |
49 | { | 49 | { |
50 | retval[x, y] = (double)bs.ReadByte() * ((double)bs.ReadByte() / 127.0); | 50 | retval[x, y] = (double) bs.ReadByte() * ((double) bs.ReadByte() / 127.0); |
51 | bs.ReadBytes(11); // Advance the stream to next bytes. | 51 | bs.ReadBytes(11); // Advance the stream to next bytes. |
52 | } | 52 | } |
53 | } | 53 | } |
@@ -58,11 +58,6 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
58 | return retval; | 58 | return retval; |
59 | } | 59 | } |
60 | 60 | ||
61 | public override string ToString() | ||
62 | { | ||
63 | return "LL/SL RAW"; | ||
64 | } | ||
65 | |||
66 | public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) | 61 | public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) |
67 | { | 62 | { |
68 | throw new NotImplementedException(); | 63 | throw new NotImplementedException(); |
@@ -81,7 +76,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
81 | { | 76 | { |
82 | for (j = 0; j < 256; j++) | 77 | for (j = 0; j < 256; j++) |
83 | { | 78 | { |
84 | lookupHeightTable[i + (j * 256)] = ((double)i * ((double)j / 127.0)); | 79 | lookupHeightTable[i + (j * 256)] = ((double) i * ((double) j / 127.0)); |
85 | } | 80 | } |
86 | } | 81 | } |
87 | 82 | ||
@@ -103,9 +98,9 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
103 | } | 98 | } |
104 | } | 99 | } |
105 | 100 | ||
106 | byte red = (byte)(index & 0xFF); | 101 | byte red = (byte) (index & 0xFF); |
107 | byte green = (byte)((index >> 8) & 0xFF); | 102 | byte green = (byte) ((index >> 8) & 0xFF); |
108 | byte blue = 20; | 103 | byte blue = 20; |
109 | byte alpha1 = 0; // Land Parcels | 104 | byte alpha1 = 0; // Land Parcels |
110 | byte alpha2 = 0; // For Sale Land | 105 | byte alpha2 = 0; // For Sale Land |
111 | byte alpha3 = 0; // Public Edit Object | 106 | byte alpha3 = 0; // Public Edit Object |
@@ -138,5 +133,10 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
138 | } | 133 | } |
139 | 134 | ||
140 | #endregion | 135 | #endregion |
136 | |||
137 | public override string ToString() | ||
138 | { | ||
139 | return "LL/SL RAW"; | ||
140 | } | ||
141 | } | 141 | } |
142 | } | 142 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/PNG.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/PNG.cs index d7f34ee..16f1e3c 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/PNG.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/PNG.cs | |||
@@ -24,19 +24,19 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using System; | ||
28 | using System.Drawing; | 27 | using System.Drawing; |
28 | using System.Drawing.Imaging; | ||
29 | using OpenSim.Region.Environment.Interfaces; | 29 | using OpenSim.Region.Environment.Interfaces; |
30 | 30 | ||
31 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | 31 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders |
32 | { | 32 | { |
33 | class PNG : GenericSystemDrawing | 33 | internal class PNG : GenericSystemDrawing |
34 | { | 34 | { |
35 | public override void SaveFile(string filename, ITerrainChannel map) | 35 | public override void SaveFile(string filename, ITerrainChannel map) |
36 | { | 36 | { |
37 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 37 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); |
38 | 38 | ||
39 | colours.Save(filename, System.Drawing.Imaging.ImageFormat.Png); | 39 | colours.Save(filename, ImageFormat.Png); |
40 | } | 40 | } |
41 | 41 | ||
42 | public override string ToString() | 42 | public override string ToString() |
@@ -44,4 +44,4 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
44 | return "PNG"; | 44 | return "PNG"; |
45 | } | 45 | } |
46 | } | 46 | } |
47 | } | 47 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs index 7575b1b..d496069 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/RAW32.cs | |||
@@ -25,7 +25,6 @@ | |||
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | using System; | ||
29 | using System.IO; | 28 | using System.IO; |
30 | using OpenSim.Region.Environment.Interfaces; | 29 | using OpenSim.Region.Environment.Interfaces; |
31 | 30 | ||
@@ -57,11 +56,6 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
57 | return retval; | 56 | return retval; |
58 | } | 57 | } |
59 | 58 | ||
60 | public override string ToString() | ||
61 | { | ||
62 | return "RAW32"; | ||
63 | } | ||
64 | |||
65 | public ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight) | 59 | public ITerrainChannel LoadFile(string filename, int offsetX, int offsetY, int fileWidth, int fileHeight, int sectionWidth, int sectionHeight) |
66 | { | 60 | { |
67 | TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight); | 61 | TerrainChannel retval = new TerrainChannel(sectionWidth, sectionHeight); |
@@ -69,7 +63,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
69 | FileInfo file = new FileInfo(filename); | 63 | FileInfo file = new FileInfo(filename); |
70 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); | 64 | FileStream s = file.Open(FileMode.Open, FileAccess.Read); |
71 | BinaryReader bs = new BinaryReader(s); | 65 | BinaryReader bs = new BinaryReader(s); |
72 | 66 | ||
73 | int currFileXOffset = 0; | 67 | int currFileXOffset = 0; |
74 | int currFileYOffset = 0; | 68 | int currFileYOffset = 0; |
75 | 69 | ||
@@ -79,7 +73,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
79 | { | 73 | { |
80 | // read a whole strip of regions | 74 | // read a whole strip of regions |
81 | int heightsToRead = sectionHeight * (fileWidth * sectionWidth); | 75 | int heightsToRead = sectionHeight * (fileWidth * sectionWidth); |
82 | bs.ReadBytes( heightsToRead * 4); // because the floats are 4 bytes in the file | 76 | bs.ReadBytes(heightsToRead * 4); // because the floats are 4 bytes in the file |
83 | currFileYOffset++; | 77 | currFileYOffset++; |
84 | } | 78 | } |
85 | 79 | ||
@@ -90,13 +84,13 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
90 | for (y = 0; y < sectionHeight; y++) | 84 | for (y = 0; y < sectionHeight; y++) |
91 | { | 85 | { |
92 | currFileXOffset = 0; | 86 | currFileXOffset = 0; |
93 | 87 | ||
94 | // if our region isn't the first X section of the areas to be landscaped, then | 88 | // if our region isn't the first X section of the areas to be landscaped, then |
95 | // advance the stream to the X start pos of our section in the file | 89 | // advance the stream to the X start pos of our section in the file |
96 | // i.e. eat X upto where we start | 90 | // i.e. eat X upto where we start |
97 | while (currFileXOffset < offsetX) | 91 | while (currFileXOffset < offsetX) |
98 | { | 92 | { |
99 | bs.ReadBytes( sectionWidth * 4); // 4 bytes = single | 93 | bs.ReadBytes(sectionWidth * 4); // 4 bytes = single |
100 | currFileXOffset++; | 94 | currFileXOffset++; |
101 | } | 95 | } |
102 | 96 | ||
@@ -111,14 +105,12 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
111 | 105 | ||
112 | // if our region isn't the last X section of the areas to be landscaped, then | 106 | // if our region isn't the last X section of the areas to be landscaped, then |
113 | // advance the stream to the end of this Y column | 107 | // advance the stream to the end of this Y column |
114 | while (currFileXOffset < fileWidth ) | 108 | while (currFileXOffset < fileWidth) |
115 | { | 109 | { |
116 | // eat the next regions x line | 110 | // eat the next regions x line |
117 | bs.ReadBytes(sectionWidth * 4); // 4 bytes = single | 111 | bs.ReadBytes(sectionWidth * 4); // 4 bytes = single |
118 | currFileXOffset++; | 112 | currFileXOffset++; |
119 | } | 113 | } |
120 | |||
121 | |||
122 | } | 114 | } |
123 | 115 | ||
124 | bs.Close(); | 116 | bs.Close(); |
@@ -138,7 +130,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
138 | { | 130 | { |
139 | for (x = 0; x < map.Width; x++) | 131 | for (x = 0; x < map.Width; x++) |
140 | { | 132 | { |
141 | bs.Write((float)map[x, y]); | 133 | bs.Write((float) map[x, y]); |
142 | } | 134 | } |
143 | } | 135 | } |
144 | 136 | ||
@@ -147,5 +139,10 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
147 | } | 139 | } |
148 | 140 | ||
149 | #endregion | 141 | #endregion |
142 | |||
143 | public override string ToString() | ||
144 | { | ||
145 | return "RAW32"; | ||
146 | } | ||
150 | } | 147 | } |
151 | } | 148 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/TIFF.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/TIFF.cs index 8eb53fc..39c2428 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/TIFF.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/TIFF.cs | |||
@@ -24,19 +24,19 @@ | |||
24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | 24 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 25 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ | 26 | */ |
27 | using System; | ||
28 | using System.Drawing; | 27 | using System.Drawing; |
28 | using System.Drawing.Imaging; | ||
29 | using OpenSim.Region.Environment.Interfaces; | 29 | using OpenSim.Region.Environment.Interfaces; |
30 | 30 | ||
31 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | 31 | namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders |
32 | { | 32 | { |
33 | class TIFF : GenericSystemDrawing | 33 | internal class TIFF : GenericSystemDrawing |
34 | { | 34 | { |
35 | public override void SaveFile(string filename, ITerrainChannel map) | 35 | public override void SaveFile(string filename, ITerrainChannel map) |
36 | { | 36 | { |
37 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); | 37 | Bitmap colours = CreateGrayscaleBitmapFromMap(map); |
38 | 38 | ||
39 | colours.Save(filename, System.Drawing.Imaging.ImageFormat.Tiff); | 39 | colours.Save(filename, ImageFormat.Tiff); |
40 | } | 40 | } |
41 | 41 | ||
42 | public override string ToString() | 42 | public override string ToString() |
@@ -44,4 +44,4 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
44 | return "TIFF"; | 44 | return "TIFF"; |
45 | } | 45 | } |
46 | } | 46 | } |
47 | } | 47 | } \ No newline at end of file |
diff --git a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs index 6a3c354..9f9edbc 100644 --- a/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs +++ b/OpenSim/Region/Environment/Modules/Terrain/FileLoaders/Terragen.cs | |||
@@ -37,7 +37,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
37 | /// Built from specification at | 37 | /// Built from specification at |
38 | /// http://www.planetside.co.uk/terragen/dev/tgterrain.html | 38 | /// http://www.planetside.co.uk/terragen/dev/tgterrain.html |
39 | /// </summary> | 39 | /// </summary> |
40 | class Terragen : ITerrainLoader | 40 | internal class Terragen : ITerrainLoader |
41 | { | 41 | { |
42 | #region ITerrainLoader Members | 42 | #region ITerrainLoader Members |
43 | 43 | ||
@@ -84,7 +84,7 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
84 | { | 84 | { |
85 | for (y = 0; y < h; y++) | 85 | for (y = 0; y < h; y++) |
86 | { | 86 | { |
87 | retval[x, y] = (double)baseHeight + (double)bs.ReadInt16() * (double)heightScale / 65536.0; | 87 | retval[x, y] = (double) baseHeight + (double) bs.ReadInt16() * (double) heightScale / 65536.0; |
88 | } | 88 | } |
89 | } | 89 | } |
90 | break; | 90 | break; |
@@ -107,16 +107,16 @@ namespace OpenSim.Region.Environment.Modules.Terrain.FileLoaders | |||
107 | throw new NotImplementedException(); | 107 | throw new NotImplementedException(); |
108 | } | 108 | } |
109 | 109 | ||
110 | public override string ToString() | ||
111 | { | ||
112 | return "Terragen"; | ||
113 | } | ||
114 | |||
115 | public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) | 110 | public ITerrainChannel LoadFile(string filename, int x, int y, int fileWidth, int fileHeight, int w, int h) |
116 | { | 111 | { |
117 | throw new NotImplementedException(); | 112 | throw new NotImplementedException(); |
118 | } | 113 | } |
119 | 114 | ||
120 | #endregion | 115 | #endregion |
116 | |||
117 | public override string ToString() | ||
118 | { | ||
119 | return "Terragen"; | ||
120 | } | ||
121 | } | 121 | } |
122 | } | 122 | } \ No newline at end of file |