add some more config options
parent
4d8aa26574
commit
0967dd2660
|
@ -82,7 +82,12 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
private String m_cacheDirectory = "";
|
private String m_cacheDirectory = "";
|
||||||
private bool m_Enabled = false;
|
private bool m_Enabled = false;
|
||||||
|
|
||||||
// private Bitmap lastImage = null;
|
private bool m_enable_date = false;
|
||||||
|
private bool m_enable_regionName = false;
|
||||||
|
private bool m_enable_regionPosition = false;
|
||||||
|
private bool m_enable_refreshEveryMonth = false;
|
||||||
|
|
||||||
|
// private Bitmap lastImage = null;
|
||||||
private DateTime lastImageTime = DateTime.MinValue;
|
private DateTime lastImageTime = DateTime.MinValue;
|
||||||
|
|
||||||
#region Region Module interface
|
#region Region Module interface
|
||||||
|
@ -112,6 +117,12 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
m_cacheDirectory
|
m_cacheDirectory
|
||||||
= Util.GetConfigVarFromSections<string>(m_config, "CacheDirectory", configSections, System.IO.Path.Combine(new DirectoryInfo(".").FullName, "MapImageCache"));
|
= Util.GetConfigVarFromSections<string>(m_config, "CacheDirectory", configSections, System.IO.Path.Combine(new DirectoryInfo(".").FullName, "MapImageCache"));
|
||||||
|
|
||||||
|
|
||||||
|
m_enable_date = Util.GetConfigVarFromSections<bool>(m_config, "enableDate", configSections, false);
|
||||||
|
m_enable_regionName = Util.GetConfigVarFromSections<bool>(m_config, "enableName", configSections, false);
|
||||||
|
m_enable_regionPosition = Util.GetConfigVarFromSections<bool>(m_config, "enablePosition", configSections, false);
|
||||||
|
m_enable_refreshEveryMonth = Util.GetConfigVarFromSections<bool>(m_config, "RefreshEveryMonth", configSections, true);
|
||||||
|
|
||||||
if (!Directory.Exists(m_cacheDirectory))
|
if (!Directory.Exists(m_cacheDirectory))
|
||||||
Directory.CreateDirectory(m_cacheDirectory);
|
Directory.CreateDirectory(m_cacheDirectory);
|
||||||
}
|
}
|
||||||
|
@ -185,18 +196,45 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
|
|
||||||
private void writeDateOnMap(ref Bitmap _map)
|
private void writeDateOnMap(ref Bitmap _map)
|
||||||
{
|
{
|
||||||
RectangleF rectf = new RectangleF(5, 5, 200, 25);
|
RectangleF rectf = new RectangleF(2, 1, 200, 25);
|
||||||
|
|
||||||
Graphics g = Graphics.FromImage(_map);
|
Graphics g = Graphics.FromImage(_map);
|
||||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||||
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||||
g.DrawString(unixTimeToDateString(getCurrentUnixTime()), new Font("Arial", 12), Brushes.White, rectf);
|
g.DrawString(unixTimeToDateString(getCurrentUnixTime()), new Font("Arial", 8), Brushes.White, rectf);
|
||||||
|
g.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writeNameOnMap(ref Bitmap _map)
|
||||||
|
{
|
||||||
|
RectangleF rectf = new RectangleF(2, m_scene.RegionInfo.RegionSizeX - 15, 200, 25);
|
||||||
|
|
||||||
|
Graphics g = Graphics.FromImage(_map);
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||||
|
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||||
|
g.DrawString(m_scene.Name, new Font("Arial", 8), Brushes.White, rectf);
|
||||||
|
g.Flush();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void writePositionOnMap(ref Bitmap _map)
|
||||||
|
{
|
||||||
|
RectangleF rectf = new RectangleF(m_scene.RegionInfo.RegionSizeY - 75, m_scene.RegionInfo.RegionSizeX - 15, 80, 25);
|
||||||
|
|
||||||
|
Graphics g = Graphics.FromImage(_map);
|
||||||
|
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||||
|
g.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||||
|
g.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||||
|
g.DrawString("<" + m_scene.RegionInfo.RegionLocX + " " + m_scene.RegionInfo.RegionLocY + ">", new Font("Arial", 8), Brushes.White, rectf);
|
||||||
g.Flush();
|
g.Flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
public Bitmap CreateMapTile()
|
public Bitmap CreateMapTile()
|
||||||
{
|
{
|
||||||
|
if ((File.GetCreationTime(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")).Month != DateTime.Now.Month) && m_enable_refreshEveryMonth == true)
|
||||||
|
File.Delete(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp"));
|
||||||
|
|
||||||
if(File.Exists(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")))
|
if(File.Exists(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp")))
|
||||||
{
|
{
|
||||||
return new Bitmap(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp"));
|
return new Bitmap(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp"));
|
||||||
|
@ -226,10 +264,20 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
(float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY);
|
(float)m_scene.RegionInfo.RegionSizeX, (float)m_scene.RegionInfo.RegionSizeY);
|
||||||
|
|
||||||
Bitmap tile = CreateMapTile(viewport, false);
|
Bitmap tile = CreateMapTile(viewport, false);
|
||||||
writeDateOnMap(ref tile);
|
|
||||||
|
if (m_enable_date)
|
||||||
|
writeDateOnMap(ref tile);
|
||||||
|
|
||||||
|
if (m_enable_regionName)
|
||||||
|
writeNameOnMap(ref tile);
|
||||||
|
|
||||||
|
if (m_enable_regionPosition)
|
||||||
|
writePositionOnMap(ref tile);
|
||||||
|
|
||||||
tile.Save(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp"));
|
tile.Save(System.IO.Path.Combine(m_cacheDirectory, m_scene.RegionInfo.RegionID + ".bmp"));
|
||||||
m_primMesher = null;
|
m_primMesher = null;
|
||||||
return tile;
|
return tile;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
lastImage = tile;
|
lastImage = tile;
|
||||||
lastImageTime = DateTime.Now;
|
lastImageTime = DateTime.Now;
|
||||||
|
@ -453,8 +501,7 @@ namespace OpenSim.Region.CoreModules.World.Warp3DMap
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim,
|
private void CreatePrim(WarpRenderer renderer, SceneObjectPart prim, bool useTextures)
|
||||||
bool useTextures)
|
|
||||||
{
|
{
|
||||||
const float MIN_SIZE_SQUARE = 4f;
|
const float MIN_SIZE_SQUARE = 4f;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue