Update svn properties, formatting cleanup.

0.6.0-stable
Jeff Ames 2008-08-19 02:59:27 +00:00
parent 6d2e1ad6ba
commit bea7d4d81a
17 changed files with 78 additions and 177 deletions

View File

@ -49,8 +49,8 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
public string Version { get { return m_version; } } public string Version { get { return m_version; } }
public string Name { get { return m_name; } } public string Name { get { return m_name; } }
public void Initialise() public void Initialise()
{ {
m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!"); m_log.Info("[LOADREGIONS]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name); throw new PluginNotInitialisedException (Name);
} }
@ -75,7 +75,7 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
RegionInfo[] regionsToLoad = regionLoader.LoadRegions(); RegionInfo[] regionsToLoad = regionLoader.LoadRegions();
openSim.ModuleLoader.LoadDefaultSharedModules(); openSim.ModuleLoader.LoadDefaultSharedModules();
if (!CheckRegionsForSanity(regionsToLoad)) if (!CheckRegionsForSanity(regionsToLoad))
{ {
m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations"); m_log.Error("[LOADREGIONS]: Halting startup due to conflicts in region configurations");
@ -95,10 +95,10 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
public void Dispose() public void Dispose()
{ {
} }
#endregion #endregion
/// <summary> /// <summary>
/// Check that region configuration information makes sense. /// Check that region configuration information makes sense.
/// </summary> /// </summary>
@ -108,43 +108,43 @@ namespace OpenSim.ApplicationPlugins.LoadRegions
{ {
if (regions.Length <= 0) if (regions.Length <= 0)
return true; return true;
List<RegionInfo> checkedRegions = new List<RegionInfo>(); List<RegionInfo> checkedRegions = new List<RegionInfo>();
checkedRegions.Add(regions[0]); checkedRegions.Add(regions[0]);
for (int i = 1; i < regions.Length; i++) for (int i = 1; i < regions.Length; i++)
{ {
RegionInfo region = regions[i]; RegionInfo region = regions[i];
foreach (RegionInfo checkedRegion in checkedRegions) foreach (RegionInfo checkedRegion in checkedRegions)
{ {
if (region.RegionID == checkedRegion.RegionID) if (region.RegionID == checkedRegion.RegionID)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}", "[LOADREGIONS]: Regions {0} and {1} have the same UUID {2}",
region.RegionName, checkedRegion.RegionName, region.RegionID); region.RegionName, checkedRegion.RegionName, region.RegionID);
return false; return false;
} }
else if (region.RegionLocX == checkedRegion.RegionLocX && region.RegionLocY == checkedRegion.RegionLocY) else if (region.RegionLocX == checkedRegion.RegionLocX && region.RegionLocY == checkedRegion.RegionLocY)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[LOADREGIONS]: Regions {0} and {1} have the same location {2} {3}", "[LOADREGIONS]: Regions {0} and {1} have the same location {2} {3}",
region.RegionName, checkedRegion.RegionName, region.RegionLocX, region.RegionLocY); region.RegionName, checkedRegion.RegionName, region.RegionLocX, region.RegionLocY);
return false; return false;
} }
else if (region.InternalEndPoint.Port == checkedRegion.InternalEndPoint.Port) else if (region.InternalEndPoint.Port == checkedRegion.InternalEndPoint.Port)
{ {
m_log.ErrorFormat( m_log.ErrorFormat(
"[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}", "[LOADREGIONS]: Regions {0} and {1} have the same internal IP port {2}",
region.RegionName, checkedRegion.RegionName, region.InternalEndPoint.Port); region.RegionName, checkedRegion.RegionName, region.InternalEndPoint.Port);
return false; return false;
} }
} }
} }
return true; return true;
} }
public void LoadRegionFromConfig(OpenSimBase openSim, ulong regionhandle) public void LoadRegionFromConfig(OpenSimBase openSim, ulong regionhandle)
{ {
m_log.Info("[LOADREGIONS]: Load Regions addin being initialised"); m_log.Info("[LOADREGIONS]: Load Regions addin being initialised");

View File

@ -23,14 +23,12 @@
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*/ */
using System; using System;
namespace OpenSim.ApplicationPlugins.Rest.Inventory namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
/// <summary> /// <summary>
/// This interface represents the boundary between the general purpose /// This interface represents the boundary between the general purpose
/// REST plugin handling, and the functionally specific handlers. The /// REST plugin handling, and the functionally specific handlers. The
@ -44,5 +42,4 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
void Initialize(); void Initialize();
void Close(); void Close();
} }
} }

View File

@ -40,7 +40,6 @@ using System.Xml;
namespace OpenSim.ApplicationPlugins.Rest.Inventory namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
/// <summary> /// <summary>
/// This class represents the current REST request. It /// This class represents the current REST request. It
/// encapsulates the request/response state and takes care /// encapsulates the request/response state and takes care
@ -66,7 +65,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal class RequestData internal class RequestData
{ {
// HTTP Server interface data // HTTP Server interface data
internal OSHttpRequest request = null; internal OSHttpRequest request = null;
@ -170,7 +168,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal RequestData(OSHttpRequest p_request, OSHttpResponse p_response, string p_qprefix) internal RequestData(OSHttpRequest p_request, OSHttpResponse p_response, string p_qprefix)
{ {
request = p_request; request = p_request;
response = p_response; response = p_response;
qprefix = p_qprefix; qprefix = p_qprefix;
@ -187,7 +184,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
initUrl(); initUrl();
initParameters(p_qprefix.Length); initParameters(p_qprefix.Length);
} }
// Just for convenience... // Just for convenience...
@ -212,7 +208,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
return authenticated; return authenticated;
} }
else return true; else
return true;
} }
} }
@ -229,7 +226,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private void authenticate() private void authenticate()
{ {
string authdata = request.Headers.Get("Authorization"); string authdata = request.Headers.Get("Authorization");
string reqscheme = String.Empty; string reqscheme = String.Empty;
@ -291,7 +287,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} Challenge reason: Authentication failed", MsgId); Rest.Log.DebugFormat("{0} Challenge reason: Authentication failed", MsgId);
DoChallenge(); DoChallenge();
} }
} }
/// <summary> /// <summary>
@ -315,7 +310,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private void DoBasic(string authdata) private void DoBasic(string authdata)
{ {
string response = null; string response = null;
MatchCollection matches = basicParms.Matches(authdata); MatchCollection matches = basicParms.Matches(authdata);
@ -346,7 +340,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// Validate against user database // Validate against user database
authenticated = Validate(userName,userPass); authenticated = Validate(userName,userPass);
} }
} }
/// <summary> /// <summary>
@ -357,7 +350,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private void DoDigest(string authdata) private void DoDigest(string authdata)
{ {
string response = null; string response = null;
MatchCollection matches = digestParm1.Matches(authdata); MatchCollection matches = digestParm1.Matches(authdata);
@ -390,12 +382,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (authparms.TryGetValue("response", out response)) if (authparms.TryGetValue("response", out response))
{ {
string temp = null; string temp = null;
do do
{ {
string nck = null; string nck = null;
string ncl = null; string ncl = null;
@ -448,7 +438,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (authparms.TryGetValue("qop", out temp)) if (authparms.TryGetValue("qop", out temp))
{ {
qop = temp.ToLower(); // replace with actual value used qop = temp.ToLower(); // replace with actual value used
// if QOP was specified then // if QOP was specified then
@ -485,11 +474,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
lock (cntable) cntable.Add(nonce, nck); lock (cntable) cntable.Add(nonce, nck);
} }
} }
else else
{ {
qop = String.Empty; qop = String.Empty;
// if QOP was not specified then // if QOP was not specified then
@ -509,12 +496,9 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// Validate the supplied userid/password info // Validate the supplied userid/password info
authenticated = ValidateDigest(userName, nonce, cnonce, nck, authPrefix, response); authenticated = ValidateDigest(userName, nonce, cnonce, nck, authPrefix, response);
} }
while (false); while (false);
} }
} }
// Indicate that authentication is required // Indicate that authentication is required
@ -523,7 +507,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
string opaque, string stale, string alg, string opaque, string stale, string alg,
string qop, string auth) string qop, string auth)
{ {
sbuilder.Length = 0; sbuilder.Length = 0;
if (scheme == null || scheme == Rest.AS_BASIC) if (scheme == null || scheme == Rest.AS_BASIC)
@ -544,7 +527,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (scheme == null || scheme == Rest.AS_DIGEST) if (scheme == null || scheme == Rest.AS_DIGEST)
{ {
sbuilder.Append(Rest.AS_DIGEST); sbuilder.Append(Rest.AS_DIGEST);
sbuilder.Append(" "); sbuilder.Append(" ");
@ -617,9 +599,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
sbuilder.Append(Rest.CS_DQUOTE); sbuilder.Append(Rest.CS_DQUOTE);
AddHeader(Rest.HttpHeaderWWWAuthenticate,sbuilder.ToString()); AddHeader(Rest.HttpHeaderWWWAuthenticate,sbuilder.ToString());
} }
} }
/// <summary> /// <summary>
@ -631,7 +611,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private bool Validate(string user, string pass) private bool Validate(string user, string pass)
{ {
Rest.Log.DebugFormat("{0} Simple User Validation", MsgId); Rest.Log.DebugFormat("{0} Simple User Validation", MsgId);
// Both values are required // Both values are required
@ -643,7 +622,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
user = user.Trim(); user = user.Trim();
return vetPassword(user, pass); return vetPassword(user, pass);
} }
/// <summary> /// <summary>
@ -658,7 +636,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private string getPassword(string user) private string getPassword(string user)
{ {
int x; int x;
string first; string first;
string last; string last;
@ -690,7 +667,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user); Rest.Log.DebugFormat("{0} Normal User {1}", MsgId, user);
return udata.PasswordHash; return udata.PasswordHash;
} }
} }
/// <summary> /// <summary>
@ -704,7 +680,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private bool vetPassword(string user, string pass) private bool vetPassword(string user, string pass)
{ {
int x; int x;
string HA1; string HA1;
string first; string first;
@ -734,13 +709,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt)); HA1 = HashToString(String.Format("{0}:{1}",HA1,udata.PasswordSalt));
return (0 == sc.Compare(HA1, udata.PasswordHash)); return (0 == sc.Compare(HA1, udata.PasswordHash));
} }
// Validate the request-digest // Validate the request-digest
private bool ValidateDigest(string user, string nonce, string cnonce, string nck, string uri, string response) private bool ValidateDigest(string user, string nonce, string cnonce, string nck, string uri, string response)
{ {
string patt = null; string patt = null;
string payl = String.Empty; string payl = String.Empty;
string KDS = null; string KDS = null;
@ -798,12 +771,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// Compare the generated sequence with the original // Compare the generated sequence with the original
return (0 == sc.Compare(KDS, response)); return (0 == sc.Compare(KDS, response));
} }
private string HashToString(string pattern) private string HashToString(string pattern)
{ {
Rest.Log.DebugFormat("{0} Generate <{1}>", MsgId, pattern); Rest.Log.DebugFormat("{0} Generate <{1}>", MsgId, pattern);
byte[] hash = md5hash.ComputeHash(encoding.GetBytes(pattern)); byte[] hash = md5hash.ComputeHash(encoding.GetBytes(pattern));
@ -818,7 +789,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} Hash = <{1}>", MsgId, sbuilder.ToString()); Rest.Log.DebugFormat("{0} Hash = <{1}>", MsgId, sbuilder.ToString());
return sbuilder.ToString(); return sbuilder.ToString();
} }
internal void Complete() internal void Complete()
@ -829,7 +799,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal void Redirect(string Url, bool temp) internal void Redirect(string Url, bool temp)
{ {
redirectLocation = Url; redirectLocation = Url;
if (temp) if (temp)
@ -844,7 +813,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
Fail(statusCode, statusDescription, true); Fail(statusCode, statusDescription, true);
} }
// Fail for an arbitrary reason. Just a failure with // Fail for an arbitrary reason. Just a failure with
@ -867,7 +835,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal void Fail(int code, string message, bool reset) internal void Fail(int code, string message, bool reset)
{ {
statusCode = code; statusCode = code;
statusDescription = message; statusDescription = message;
@ -907,7 +874,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
re.httppath = path; re.httppath = path;
throw re; throw re;
} }
// Reject this request // Reject this request
@ -924,19 +890,16 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal virtual bool Respond(string reason) internal virtual bool Respond(string reason)
{ {
Rest.Log.DebugFormat("{0} Respond ENTRY, handled = {1}, reason = {2}", MsgId, handled, reason); Rest.Log.DebugFormat("{0} Respond ENTRY, handled = {1}, reason = {2}", MsgId, handled, reason);
if (!handled) if (!handled)
{ {
Rest.Log.DebugFormat("{0} Generating Response", MsgId); Rest.Log.DebugFormat("{0} Generating Response", MsgId);
Rest.Log.DebugFormat("{0} Method is {1}", MsgId, method); Rest.Log.DebugFormat("{0} Method is {1}", MsgId, method);
// A Head request can NOT have a body! // A Head request can NOT have a body!
if (method != Rest.HEAD) if (method != Rest.HEAD)
{ {
Rest.Log.DebugFormat("{0} Response is not abbreviated", MsgId); Rest.Log.DebugFormat("{0} Response is not abbreviated", MsgId);
// If the writer is non-null then we know that an XML // If the writer is non-null then we know that an XML
@ -993,7 +956,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
response.SendChunked = chunked; response.SendChunked = chunked;
response.KeepAlive = keepAlive; response.KeepAlive = keepAlive;
} }
// Set the status code & description. If nothing has been stored, // Set the status code & description. If nothing has been stored,
@ -1054,13 +1016,11 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Rest.Log.DebugFormat("{0} Closing output stream", MsgId); Rest.Log.DebugFormat("{0} Closing output stream", MsgId);
response.OutputStream.Close(); response.OutputStream.Close();
} }
Rest.Log.DebugFormat("{0} Respond EXIT, handled = {1}, reason = {2}", MsgId, handled, reason); Rest.Log.DebugFormat("{0} Respond EXIT, handled = {1}, reason = {2}", MsgId, handled, reason);
return handled; return handled;
} }
// Add a header to the table. We need to allow // Add a header to the table. We need to allow
@ -1122,7 +1082,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private void initUrl() private void initUrl()
{ {
uri = request.Url; uri = request.Url;
if (query == null) if (query == null)
@ -1137,7 +1096,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
path = uri.AbsolutePath; path = uri.AbsolutePath;
if (path.EndsWith(Rest.UrlPathSeparator)) if (path.EndsWith(Rest.UrlPathSeparator))
path = path.Substring(0,path.Length-1); path = path.Substring(0, path.Length-1);
} }
// If we succeeded in getting a path, perform any // If we succeeded in getting a path, perform any
@ -1149,7 +1108,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
// Handle "+". Not a standard substitution, but // Handle "+". Not a standard substitution, but
// common enough... // common enough...
path = path.Replace(Rest.C_PLUS,Rest.C_SPACE); path = path.Replace(Rest.C_PLUS, Rest.C_SPACE);
} }
pathNodes = path.Split(Rest.CA_PATHSEP); pathNodes = path.Split(Rest.CA_PATHSEP);
} }
@ -1167,12 +1126,10 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
hostname = uri.Host; hostname = uri.Host;
port = uri.Port; port = uri.Port;
} }
internal int initParameters(int prfxlen) internal int initParameters(int prfxlen)
{ {
if (prfxlen < path.Length-1) if (prfxlen < path.Length-1)
{ {
parameters = path.Substring(prfxlen+1).Split(Rest.CA_PATHSEP); parameters = path.Substring(prfxlen+1).Split(Rest.CA_PATHSEP);
@ -1194,7 +1151,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
return parameters.Length; return parameters.Length;
} }
internal string[] PathNodes internal string[] PathNodes
@ -1211,7 +1167,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal string BuildUrl(int first, int last) internal string BuildUrl(int first, int last)
{ {
if (pathNodes == null) if (pathNodes == null)
{ {
initUrl(); initUrl();
@ -1252,7 +1207,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
return sbuilder.ToString(); return sbuilder.ToString();
} }
// Setup the XML writer for output // Setup the XML writer for output
@ -1272,7 +1226,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal void initXmlReader() internal void initXmlReader()
{ {
XmlReaderSettings settings = new XmlReaderSettings(); XmlReaderSettings settings = new XmlReaderSettings();
settings.ConformanceLevel = ConformanceLevel.Fragment; settings.ConformanceLevel = ConformanceLevel.Fragment;
@ -1282,14 +1235,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
settings.ValidationType = ValidationType.None; settings.ValidationType = ValidationType.None;
reader = XmlReader.Create(request.InputStream,settings); reader = XmlReader.Create(request.InputStream,settings);
} }
private void Flush() private void Flush()
{ {
byte[] dbuffer = new byte[8192]; byte[] dbuffer = new byte[8192];
while (request.InputStream.Read(dbuffer,0,dbuffer.Length) != 0); while (request.InputStream.Read(dbuffer,0,dbuffer.Length) != 0);
return;
} }
// This allows us to make errors a bit more apparent in REST // This allows us to make errors a bit more apparent in REST
@ -1301,7 +1252,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
internal void SendHtml(string title, string text) internal void SendHtml(string title, string text)
{ {
AddHeader(Rest.HttpHeaderContentType, "text/html"); AddHeader(Rest.HttpHeaderContentType, "text/html");
sbuilder.Length = 0; sbuilder.Length = 0;
@ -1321,7 +1271,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
sbuilder.Append("</html>"); sbuilder.Append("</html>");
html = sbuilder.ToString(); html = sbuilder.ToString();
} }
} }
} }

View File

@ -38,10 +38,8 @@ using Nini.Config;
namespace OpenSim.ApplicationPlugins.Rest.Inventory namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
public class Rest public class Rest
{ {
internal static readonly log4net.ILog Log = internal static readonly log4net.ILog Log =
log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); log4net.LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@ -374,7 +372,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
return sum; return sum;
} }
public static string Int2Hex8(int val) public static string Int2Hex8(int val)
@ -409,7 +406,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public static void Dump(byte[] data) public static void Dump(byte[] data)
{ {
char[] buffer = new char[Rest.DumpLineSize]; char[] buffer = new char[Rest.DumpLineSize];
int cc = 0; int cc = 0;
@ -435,7 +431,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
Console.Write(" |"+(new String(buffer))+"|"); Console.Write(" |"+(new String(buffer))+"|");
cc = 0; cc = 0;
} }
} }
// Finish off any incomplete line // Finish off any incomplete line
@ -455,16 +450,13 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
Console.Write("\n"); Console.Write("\n");
} }
} }
} }
// Local exception type // Local exception type
public class RestException : Exception public class RestException : Exception
{ {
internal int statusCode; internal int statusCode;
internal string statusDesc; internal string statusDesc;
internal string httpmethod; internal string httpmethod;
@ -474,5 +466,4 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
} }
} }
} }

View File

@ -182,7 +182,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
} }
Rest.Log.DebugFormat("{0} REST Asset handler EXIT", MsgId); Rest.Log.DebugFormat("{0} REST Asset handler EXIT", MsgId);
} }
#endregion Interface #endregion Interface

View File

@ -358,8 +358,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
if (path.StartsWith(key)) if (path.StartsWith(key))
{ {
return ( path.Length == key.Length || return (path.Length == key.Length ||
path.Substring(key.Length,1) == Rest.UrlPathSeparator); path.Substring(key.Length, 1) == Rest.UrlPathSeparator);
} }
} }

View File

@ -257,7 +257,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid)) if (Rest.InventoryServices.HasInventoryForUser(rdata.uuid))
{ {
rdata.root = Rest.InventoryServices.RequestRootFolder(rdata.uuid); rdata.root = Rest.InventoryServices.RequestRootFolder(rdata.uuid);
Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}", Rest.Log.DebugFormat("{0} Inventory Root retrieved for {1} {2}",
@ -646,7 +645,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// Scan the set of folders in the entity collection for an // Scan the set of folders in the entity collection for an
// entry that matches the context folder. It is assumed that // entry that matches the context folder. It is assumed that
// the only reliable indicator of this is a zero UUID ( using // the only reliable indicator of this is a zero UUID (using
// implicit context), or the parent's UUID matches that of the // implicit context), or the parent's UUID matches that of the
// URI designated node (explicit context). We don't allow // URI designated node (explicit context). We don't allow
// ambiguity in this case because this is POST and we are // ambiguity in this case because this is POST and we are
@ -1368,7 +1367,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
foreach (InventoryFolderBase parent in ic.rdata.folders) foreach (InventoryFolderBase parent in ic.rdata.folders)
{ {
if ( parent.ID == result.ParentID ) if (parent.ID == result.ParentID)
{ {
found = true; found = true;
break; break;
@ -1382,7 +1381,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
ic.Fail(Rest.HttpStatusCodeBadRequest, ic.Fail(Rest.HttpStatusCodeBadRequest,
Rest.HttpStatusDescBadRequest+": invalid parent"); Rest.HttpStatusDescBadRequest+": invalid parent");
} }
} }
// This is a new folder, so no existing UUID is available // This is a new folder, so no existing UUID is available

View File

@ -40,10 +40,8 @@ using OpenSim.Framework.Communications.Cache;
namespace OpenSim.ApplicationPlugins.Rest.Inventory namespace OpenSim.ApplicationPlugins.Rest.Inventory
{ {
public class RestTestServices : IRest public class RestTestServices : IRest
{ {
private bool enabled = false; private bool enabled = false;
private string qPrefix = "test"; private string qPrefix = "test";
@ -52,7 +50,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public RestTestServices() public RestTestServices()
{ {
Rest.Log.InfoFormat("{0} Test services initializing", MsgId); Rest.Log.InfoFormat("{0} Test services initializing", MsgId);
Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version); Rest.Log.InfoFormat("{0} Using REST Implementation Version {1}", MsgId, Rest.Version);
@ -67,7 +64,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
// Load test cases // Load test cases
loadTests(); loadTests();
foreach ( ITest test in tests ) foreach (ITest test in tests)
{ {
test.Initialize(); test.Initialize();
} }
@ -81,7 +78,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
enabled = true; enabled = true;
Rest.Log.InfoFormat("{0} Test services initialization complete", MsgId); Rest.Log.InfoFormat("{0} Test services initialization complete", MsgId);
} }
// Post-construction, pre-enabled initialization opportunity // Post-construction, pre-enabled initialization opportunity
@ -98,7 +94,7 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
public void Close() public void Close()
{ {
enabled = false; enabled = false;
foreach ( ITest test in tests ) foreach (ITest test in tests)
{ {
test.Close(); test.Close();
} }
@ -123,8 +119,8 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
private void DoTests(RequestData rdata) private void DoTests(RequestData rdata)
{ {
if (!enabled)
if (!enabled) return; return;
// Now that we know this is a serious attempt to // Now that we know this is a serious attempt to
// access inventory data, we should find out who // access inventory data, we should find out who
@ -177,7 +173,6 @@ namespace OpenSim.ApplicationPlugins.Rest.Inventory
if (!rdata.handled) if (!rdata.handled)
test.Execute(rdata); test.Execute(rdata);
} }
} }
#endregion Interface #endregion Interface

View File

@ -668,7 +668,7 @@ namespace OpenSim.Data.MySQL
while (r.Read()) while (r.Read())
{ {
int attachpoint = Convert.ToInt32(r["attachpoint"]); int attachpoint = Convert.ToInt32(r["attachpoint"]);
if(ret.ContainsKey(attachpoint)) if (ret.ContainsKey(attachpoint))
continue; continue;
Hashtable item = new Hashtable(); Hashtable item = new Hashtable();
item.Add("item", r["item"].ToString()); item.Add("item", r["item"].ToString());
@ -676,7 +676,7 @@ namespace OpenSim.Data.MySQL
ret.Add(attachpoint, item); ret.Add(attachpoint, item);
} }
r.Close(); r.Close();
return ret; return ret;
@ -1205,7 +1205,7 @@ namespace OpenSim.Data.MySQL
MySqlCommand cmd = (MySqlCommand) dbcon.CreateCommand(); MySqlCommand cmd = (MySqlCommand) dbcon.CreateCommand();
cmd.CommandText = sql; cmd.CommandText = sql;
cmd.Parameters.AddWithValue("?uuid", agentID.ToString()); cmd.Parameters.AddWithValue("?uuid", agentID.ToString());
cmd.ExecuteNonQuery(); cmd.ExecuteNonQuery();
if (data == null) if (data == null)
@ -1216,7 +1216,7 @@ namespace OpenSim.Data.MySQL
cmd = (MySqlCommand) dbcon.CreateCommand(); cmd = (MySqlCommand) dbcon.CreateCommand();
cmd.CommandText = sql; cmd.CommandText = sql;
foreach(DictionaryEntry e in data) foreach (DictionaryEntry e in data)
{ {
int attachpoint = Convert.ToInt32(e.Key); int attachpoint = Convert.ToInt32(e.Key);

View File

@ -57,8 +57,8 @@ namespace OpenSim.Data.MySQL
private string m_appearanceTableName = "avatarappearance"; private string m_appearanceTableName = "avatarappearance";
private string m_connectString; private string m_connectString;
public override void Initialise() public override void Initialise()
{ {
m_log.Info("[MySQLUserData]: " + Name + " cannot be default-initialized!"); m_log.Info("[MySQLUserData]: " + Name + " cannot be default-initialized!");
throw new PluginNotInitialisedException (Name); throw new PluginNotInitialisedException (Name);
} }
@ -409,7 +409,7 @@ namespace OpenSim.Data.MySQL
Lfli.Add(fli); Lfli.Add(fli);
} }
reader.Dispose(); reader.Dispose();
result.Dispose(); result.Dispose();
} }

View File

@ -363,7 +363,7 @@ namespace OpenSim.Framework
h["skirt_asset"] = SkirtAsset.ToString(); h["skirt_asset"] = SkirtAsset.ToString();
string attachments = GetAttachmentsString(); string attachments = GetAttachmentsString();
if(attachments != String.Empty) if (attachments != String.Empty)
h["attachments"] = attachments; h["attachments"] = attachments;
return h; return h;
@ -411,7 +411,7 @@ namespace OpenSim.Framework
SkirtItem = new LLUUID((string)h["skirt_item"]); SkirtItem = new LLUUID((string)h["skirt_item"]);
SkirtAsset = new LLUUID((string)h["skirt_asset"]); SkirtAsset = new LLUUID((string)h["skirt_asset"]);
if(h.ContainsKey("attachments")) if (h.ContainsKey("attachments"))
{ {
SetAttachmentsString(h["attachments"].ToString()); SetAttachmentsString(h["attachments"].ToString());
} }
@ -441,7 +441,7 @@ namespace OpenSim.Framework
{ {
m_attachments.Clear(); m_attachments.Clear();
if(data == null) if (data == null)
return; return;
foreach (DictionaryEntry e in data) foreach (DictionaryEntry e in data)
@ -468,7 +468,7 @@ namespace OpenSim.Framework
public Hashtable GetAttachments() public Hashtable GetAttachments()
{ {
if(m_attachments.Count == 0) if (m_attachments.Count == 0)
return null; return null;
Hashtable ret = new Hashtable(); Hashtable ret = new Hashtable();

View File

@ -245,7 +245,7 @@ namespace OpenSim.Framework.Console
try try
{ {
string line = System.Console.ReadLine(); string line = System.Console.ReadLine();
while (line == null) while (line == null)
{ {
line = System.Console.ReadLine(); line = System.Console.ReadLine();

View File

@ -255,8 +255,8 @@ namespace OpenSim.Framework.Servers
SetConsoleLogLevel(setParams); SetConsoleLogLevel(setParams);
} }
} }
/// <summary> /// <summary>
/// Show help information /// Show help information
/// </summary> /// </summary>
@ -270,7 +270,7 @@ namespace OpenSim.Framework.Servers
//Notice("help [command] - display general help or specific command help. Try help help for more info."); //Notice("help [command] - display general help or specific command help. Try help help for more info.");
Notice("quit - equivalent to shutdown."); Notice("quit - equivalent to shutdown.");
Notice("set log level [level] - change the console logging level only. For example, off or debug."); Notice("set log level [level] - change the console logging level only. For example, off or debug.");
Notice("show info - show server information (e.g. startup path)."); Notice("show info - show server information (e.g. startup path).");
if (m_stats != null) if (m_stats != null)
@ -280,7 +280,7 @@ namespace OpenSim.Framework.Servers
Notice("show uptime - show server startup time and uptime."); Notice("show uptime - show server startup time and uptime.");
Notice("show version - show server version."); Notice("show version - show server version.");
Notice("shutdown - shutdown the server.\n"); Notice("shutdown - shutdown the server.\n");
return; return;
} }
} }

View File

@ -56,7 +56,7 @@ namespace OpenSim
private string m_timedScript = "disabled"; private string m_timedScript = "disabled";
private Timer m_scriptTimer; private Timer m_scriptTimer;
/// <summary> /// <summary>
/// List of Console Plugin Commands /// List of Console Plugin Commands
/// </summary> /// </summary>
@ -601,11 +601,11 @@ namespace OpenSim
break; break;
} }
} }
public override void ShowHelp(string[] helpArgs) public override void ShowHelp(string[] helpArgs)
{ {
base.ShowHelp(helpArgs); base.ShowHelp(helpArgs);
m_console.Notice("alert - send alert to a designated user or all users."); m_console.Notice("alert - send alert to a designated user or all users.");
m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive."); m_console.Notice(" alert [First] [Last] [Message] - send an alert to a user. Case sensitive.");
m_console.Notice(" alert general [Message] - send an alert to all users."); m_console.Notice(" alert general [Message] - send an alert to all users.");
@ -619,7 +619,7 @@ namespace OpenSim
m_console.Notice(" debug scene [scripting] [collision] [physics] - Enable/Disable debug stuff, each can be True/False"); m_console.Notice(" debug scene [scripting] [collision] [physics] - Enable/Disable debug stuff, each can be True/False");
m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim"); m_console.Notice("edit-scale [prim name] [x] [y] [z] - resize given prim");
m_console.Notice("export-map [filename] - save image of world map"); m_console.Notice("export-map [filename] - save image of world map");
m_console.Notice("force-update - force an update of prims in the scene"); m_console.Notice("force-update - force an update of prims in the scene");
m_console.Notice("restart - disconnects all clients and restarts the sims in the instance."); m_console.Notice("restart - disconnects all clients and restarts the sims in the instance.");
m_console.Notice("remove-region [name] - remove a region"); m_console.Notice("remove-region [name] - remove a region");
m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)"); m_console.Notice("load-xml [filename] - load prims from XML (DEPRECATED)");
@ -637,15 +637,15 @@ namespace OpenSim
m_console.Notice("config set section field value - set a config value"); m_console.Notice("config set section field value - set a config value");
m_console.Notice("config get section field - get a config value"); m_console.Notice("config get section field - get a config value");
m_console.Notice("config save - save OpenSim.ini"); m_console.Notice("config save - save OpenSim.ini");
m_console.Notice("terrain help - show help for terrain commands."); m_console.Notice("terrain help - show help for terrain commands.");
ShowPluginCommandsHelp(CombineParams(helpArgs, 0), m_console); ShowPluginCommandsHelp(CombineParams(helpArgs, 0), m_console);
if (m_sandbox) if (m_sandbox)
{ {
m_console.Notice(""); m_console.Notice("");
m_console.Notice("create user - adds a new user."); m_console.Notice("create user - adds a new user.");
} }
} }
// see BaseOpenSimServer // see BaseOpenSimServer

View File

@ -457,7 +457,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
public void Close(bool shutdownCircuit) public void Close(bool shutdownCircuit)
{ {
m_clientPingTimer.Enabled = false; m_clientPingTimer.Enabled = false;
m_log.DebugFormat( m_log.DebugFormat(
"[CLIENT]: Close has been called with shutdownCircuit = {0} on scene {1}", "[CLIENT]: Close has been called with shutdownCircuit = {0} on scene {1}",
shutdownCircuit, m_scene.RegionInfo.RegionName); shutdownCircuit, m_scene.RegionInfo.RegionName);
@ -658,15 +658,15 @@ namespace OpenSim.Region.ClientStack.LindenUDP
|| (m_probesWithNoIngressPackets > 90 && m_clientBlocked)) || (m_probesWithNoIngressPackets > 90 && m_clientBlocked))
{ {
m_clientPingTimer.Enabled = false; m_clientPingTimer.Enabled = false;
m_log.WarnFormat( m_log.WarnFormat(
"[CLIENT]: Client for agent {0} {1} has stopped responding to pings. Closing connection", "[CLIENT]: Client for agent {0} {1} has stopped responding to pings. Closing connection",
Name, AgentId); Name, AgentId);
if (OnConnectionClosed != null) if (OnConnectionClosed != null)
{ {
OnConnectionClosed(this); OnConnectionClosed(this);
} }
} }
else else
{ {

View File

@ -168,7 +168,7 @@ namespace OpenSim.Region.ClientStack.LindenUDP
ThrottleCheck(ref TextureThrottle, ref TextureOutgoingPacketQueue, item); ThrottleCheck(ref TextureThrottle, ref TextureOutgoingPacketQueue, item);
break; break;
case ThrottleOutPacketType.Task: case ThrottleOutPacketType.Task:
if((item.throttleType & ThrottleOutPacketType.LowPriority) != 0) if ((item.throttleType & ThrottleOutPacketType.LowPriority) != 0)
ThrottleCheck(ref TaskThrottle, ref TaskLowpriorityPacketQueue, item); ThrottleCheck(ref TaskThrottle, ref TaskLowpriorityPacketQueue, item);
else else
ThrottleCheck(ref TaskThrottle, ref TaskOutgoingPacketQueue, item); ThrottleCheck(ref TaskThrottle, ref TaskOutgoingPacketQueue, item);

View File

@ -97,7 +97,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
DrawObjectVolume(m_scene, mapbmp); DrawObjectVolume(m_scene, mapbmp);
} }
try try
{ {
imageData = OpenJPEG.EncodeFromImage(mapbmp, true); imageData = OpenJPEG.EncodeFromImage(mapbmp, true);
@ -153,14 +152,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// if (entity is SceneObjectGroup) // if (entity is SceneObjectGroup)
// { // {
// SceneObjectGroup sog = (SceneObjectGroup) entity; // SceneObjectGroup sog = (SceneObjectGroup) entity;
// //
// foreach (SceneObjectPart primitive in sog.Children.Values) // foreach (SceneObjectPart primitive in sog.Children.Values)
// { // {
// int x = (int) (primitive.AbsolutePosition.X - (primitive.Scale.X / 2)); // int x = (int) (primitive.AbsolutePosition.X - (primitive.Scale.X / 2));
// int y = (int) (primitive.AbsolutePosition.Y - (primitive.Scale.Y / 2)); // int y = (int) (primitive.AbsolutePosition.Y - (primitive.Scale.Y / 2));
// int w = (int) primitive.Scale.X; // int w = (int) primitive.Scale.X;
// int h = (int) primitive.Scale.Y; // int h = (int) primitive.Scale.Y;
// //
// int dx; // int dx;
// for (dx = x; dx < x + w; dx++) // for (dx = x; dx < x + w; dx++)
// { // {
@ -171,7 +170,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// continue; // continue;
// if (x >= map.Width || y >= map.Height) // if (x >= map.Width || y >= map.Height)
// continue; // continue;
// //
// map.SetPixel(dx, dy, Color.DarkGray); // map.SetPixel(dx, dy, Color.DarkGray);
// } // }
// } // }
@ -189,7 +188,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
double[,] hm = whichScene.Heightmap.GetDoubles(); double[,] hm = whichScene.Heightmap.GetDoubles();
bool ShadowDebugContinue = true; bool ShadowDebugContinue = true;
bool terraincorruptedwarningsaid = false; bool terraincorruptedwarningsaid = false;
float low = 255; float low = 255;
@ -220,13 +219,10 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
//int tc = System.Environment.TickCount; //int tc = System.Environment.TickCount;
for (int y = 0; y < 256; y++) for (int y = 0; y < 256; y++)
{ {
float heightvalue = (float)hm[x, y]; float heightvalue = (float)hm[x, y];
if (heightvalue > (float)whichScene.RegionInfo.RegionSettings.WaterHeight) if (heightvalue > (float)whichScene.RegionInfo.RegionSettings.WaterHeight)
{ {
// scale height value // scale height value
heightvalue = low + mid * (heightvalue - low) / mid; heightvalue = low + mid * (heightvalue - low) / mid;
@ -238,6 +234,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue)) if (Single.IsInfinity(heightvalue) || Single.IsNaN(heightvalue))
heightvalue = 0; heightvalue = 0;
try try
{ {
Color green = Color.FromArgb((int)heightvalue, 100, (int)heightvalue); Color green = Color.FromArgb((int)heightvalue, 100, (int)heightvalue);
@ -264,7 +261,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
if (hfdiff > 0.3f) if (hfdiff > 0.3f)
{ {
} }
else if (hfdiff < -0.3f) else if (hfdiff < -0.3f)
{ {
@ -301,15 +297,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
mapbmp.SetPixel(x - 1, (256 - y) - 1, Shade); mapbmp.SetPixel(x - 1, (256 - y) - 1, Shade);
} }
} }
} }
} }
} }
catch (System.ArgumentException) catch (System.ArgumentException)
{ {
@ -367,7 +356,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
return mapbmp; return mapbmp;
} }
private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp) private Bitmap DrawObjectVolume(Scene whichScene, Bitmap mapbmp)
{ {
int tc = 0; int tc = 0;
@ -395,7 +383,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
if (part == null) if (part == null)
continue; continue;
// Draw if the object is at least 1 meter wide in any direction // Draw if the object is at least 1 meter wide in any direction
if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f) if (part.Scale.X > 1f || part.Scale.Y > 1f || part.Scale.Z > 1f)
{ {
@ -459,8 +446,8 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
continue; continue;
// skip prim in non-finite position // skip prim in non-finite position
if (Single.IsNaN(pos.X) || Single.IsNaN(pos.Y) || Single.IsInfinity(pos.X) if (Single.IsNaN(pos.X) || Single.IsNaN(pos.Y) ||
|| Single.IsInfinity(pos.Y)) Single.IsInfinity(pos.X) || Single.IsInfinity(pos.Y))
continue; continue;
// Figure out if object is under 256m above the height of the terrain // Figure out if object is under 256m above the height of the terrain
@ -481,7 +468,6 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
Vector3 scale = new Vector3(); Vector3 scale = new Vector3();
Vector3 tScale = new Vector3(); Vector3 tScale = new Vector3();
Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z); Vector3 axPos = new Vector3(pos.X,pos.Y,pos.Z);
LLQuaternion llrot = part.GetWorldRotation(); LLQuaternion llrot = part.GetWorldRotation();
Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z); Quaternion rot = new Quaternion(llrot.W, llrot.X, llrot.Y, llrot.Z);
@ -609,7 +595,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
FaceC[3] = vertexes[7]; FaceC[3] = vertexes[7];
FaceD[5] = vertexes[7]; FaceD[5] = vertexes[7];
#endregion #endregion
//int wy = 0; //int wy = 0;
//bool breakYN = false; // If we run into an error drawing, break out of the //bool breakYN = false; // If we run into an error drawing, break out of the
@ -618,14 +604,10 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
ds.brush = new SolidBrush(mapdotspot); ds.brush = new SolidBrush(mapdotspot);
//ds.rect = new Rectangle(mapdrawstartX, (255 - mapdrawstartY), mapdrawendX - mapdrawstartX, mapdrawendY - mapdrawstartY); //ds.rect = new Rectangle(mapdrawstartX, (255 - mapdrawstartY), mapdrawendX - mapdrawstartX, mapdrawendY - mapdrawstartY);
ds.trns = new face[FaceA.Length]; ds.trns = new face[FaceA.Length];
for (int i = 0; i < FaceA.Length; i++) for (int i = 0; i < FaceA.Length; i++)
{ {
Point[] working = new Point[5]; Point[] working = new Point[5];
working[0] = project(FaceA[i], axPos); working[0] = project(FaceA[i], axPos);
working[1] = project(FaceB[i], axPos); working[1] = project(FaceB[i], axPos);
@ -635,20 +617,14 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
face workingface = new face(); face workingface = new face();
workingface.pts = working; workingface.pts = working;
ds.trns[i] = workingface;
}
ds.trns[i] = workingface;
}
z_sort.Add(part.LocalId, ds); z_sort.Add(part.LocalId, ds);
z_localIDs.Add(part.LocalId); z_localIDs.Add(part.LocalId);
z_sortheights.Add(pos.Z); z_sortheights.Add(pos.Z);
//for (int wx = mapdrawstartX; wx < mapdrawendX; wx++) //for (int wx = mapdrawstartX; wx < mapdrawendX; wx++)
//{ //{
//for (wy = mapdrawstartY; wy < mapdrawendY; wy++) //for (wy = mapdrawstartY; wy < mapdrawendY; wy++)
@ -676,20 +652,17 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
} // loop over group children } // loop over group children
} // entitybase is sceneobject group } // entitybase is sceneobject group
} // foreach loop over entities } // foreach loop over entities
float[] sortedZHeights = z_sortheights.ToArray(); float[] sortedZHeights = z_sortheights.ToArray();
uint[] sortedlocalIds = z_localIDs.ToArray(); uint[] sortedlocalIds = z_localIDs.ToArray();
// Sort prim by Z position // Sort prim by Z position
Array.Sort(sortedZHeights, sortedlocalIds); Array.Sort(sortedZHeights, sortedlocalIds);
Graphics g = Graphics.FromImage(mapbmp); Graphics g = Graphics.FromImage(mapbmp);
for (int s = 0; s < sortedZHeights.Length; s++) for (int s = 0; s < sortedZHeights.Length; s++)
{ {
if (z_sort.ContainsKey(sortedlocalIds[s])) if (z_sort.ContainsKey(sortedlocalIds[s]))
{ {
DrawStruct rectDrawStruct = z_sort[sortedlocalIds[s]]; DrawStruct rectDrawStruct = z_sort[sortedlocalIds[s]];
@ -701,13 +674,13 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
} }
} }
g.Dispose(); g.Dispose();
} // lock entities objs } // lock entities objs
m_log.Info("[MAPTILE]: Generating Maptile Step 2: Done in " + (System.Environment.TickCount - tc) + " ms"); m_log.Info("[MAPTILE]: Generating Maptile Step 2: Done in " + (System.Environment.TickCount - tc) + " ms");
return mapbmp; return mapbmp;
} }
private Point project(Vector3 point3d, Vector3 originpos) private Point project(Vector3 point3d, Vector3 originpos)
{ {
Point returnpt = new Point(); Point returnpt = new Point();
@ -716,12 +689,11 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
//Vector3 topos = new Vector3(0, 0, 0); //Vector3 topos = new Vector3(0, 0, 0);
// float z = -point3d.z - topos.z; // float z = -point3d.z - topos.z;
returnpt.X = (int)point3d.x;//(int)((topos.x - point3d.x) / z * d); returnpt.X = (int)point3d.x;//(int)((topos.x - point3d.x) / z * d);
returnpt.Y = (int)(255 - point3d.y);//(int)(255 - (((topos.y - point3d.y) / z * d))); returnpt.Y = (int)(255 - point3d.y);//(int)(255 - (((topos.y - point3d.y) / z * d)));
return returnpt; return returnpt;
} }
// TODO: unused: // TODO: unused:
@ -729,17 +701,17 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// private Bitmap TerrainToBitmap(string gradientmap) // private Bitmap TerrainToBitmap(string gradientmap)
// { // {
// Bitmap gradientmapLd = new Bitmap(gradientmap); // Bitmap gradientmapLd = new Bitmap(gradientmap);
// //
// int pallete = gradientmapLd.Height; // int pallete = gradientmapLd.Height;
// //
// Bitmap bmp = new Bitmap(m_scene.Heightmap.Width, m_scene.Heightmap.Height); // Bitmap bmp = new Bitmap(m_scene.Heightmap.Width, m_scene.Heightmap.Height);
// Color[] colours = new Color[pallete]; // Color[] colours = new Color[pallete];
// //
// for (int i = 0; i < pallete; i++) // for (int i = 0; i < pallete; i++)
// { // {
// colours[i] = gradientmapLd.GetPixel(0, i); // colours[i] = gradientmapLd.GetPixel(0, i);
// } // }
// //
// lock (m_scene.Heightmap) // lock (m_scene.Heightmap)
// { // {
// ITerrainChannel copy = m_scene.Heightmap; // ITerrainChannel copy = m_scene.Heightmap;
@ -749,7 +721,7 @@ namespace OpenSim.Region.Environment.Modules.World.WorldMap
// { // {
// // 512 is the largest possible height before colours clamp // // 512 is the largest possible height before colours clamp
// int colorindex = (int) (Math.Max(Math.Min(1.0, copy[x, y] / 512.0), 0.0) * (pallete - 1)); // int colorindex = (int) (Math.Max(Math.Min(1.0, copy[x, y] / 512.0), 0.0) * (pallete - 1));
// //
// // Handle error conditions // // Handle error conditions
// if (colorindex > pallete - 1 || colorindex < 0) // if (colorindex > pallete - 1 || colorindex < 0)
// bmp.SetPixel(x, copy.Height - y - 1, Color.Red); // bmp.SetPixel(x, copy.Height - y - 1, Color.Red);