refactored LandData to use properties, and cleaned up the naming on

the properties a bit to be more consistant with other objects (having things
like .Name .Description, etc).
This commit is contained in:
Sean Dague
2008-07-23 15:50:32 +00:00
parent ecd296ad67
commit 090159defc
16 changed files with 833 additions and 509 deletions

View File

@@ -692,7 +692,7 @@ namespace OpenSim.Data.MySQL
DataTable land = m_landTable;
DataTable landaccesslist = m_landAccessListTable;
DataRow landRow = land.Rows.Find(Util.ToRawUuidString(parcel.landData.globalID));
DataRow landRow = land.Rows.Find(Util.ToRawUuidString(parcel.landData.GlobalID));
if (landRow == null)
{
landRow = land.NewRow();
@@ -708,14 +708,14 @@ namespace OpenSim.Data.MySQL
MySqlCommand cmd =
new MySqlCommand("delete from landaccesslist where LandUUID=?LandUUID", m_connection))
{
cmd.Parameters.Add(new MySqlParameter("?LandUUID", Util.ToRawUuidString(parcel.landData.globalID)));
cmd.Parameters.Add(new MySqlParameter("?LandUUID", Util.ToRawUuidString(parcel.landData.GlobalID)));
cmd.ExecuteNonQuery();
}
foreach (ParcelManager.ParcelAccessEntry entry in parcel.landData.parcelAccessList)
foreach (ParcelManager.ParcelAccessEntry entry in parcel.landData.ParcelAccessList)
{
DataRow newAccessRow = landaccesslist.NewRow();
fillLandAccessRow(newAccessRow, entry, parcel.landData.globalID);
fillLandAccessRow(newAccessRow, entry, parcel.landData.GlobalID);
landaccesslist.Rows.Add(newAccessRow);
}
@@ -787,11 +787,11 @@ namespace OpenSim.Data.MySQL
foreach (DataRow rawDataLand in rawDataForRegion)
{
LandData newLand = buildLandData(rawDataLand);
string accessListSearchExp = "LandUUID = '" + Util.ToRawUuidString(newLand.globalID) + "'";
string accessListSearchExp = "LandUUID = '" + Util.ToRawUuidString(newLand.GlobalID) + "'";
DataRow[] rawDataForLandAccessList = landaccesslist.Select(accessListSearchExp);
foreach (DataRow rawDataLandAccess in rawDataForLandAccessList)
{
newLand.parcelAccessList.Add(buildLandAccessData(rawDataLandAccess));
newLand.ParcelAccessList.Add(buildLandAccessData(rawDataLandAccess));
}
landDataForRegion.Add(newLand);
@@ -1319,59 +1319,59 @@ namespace OpenSim.Data.MySQL
{
LandData newData = new LandData();
newData.globalID = new LLUUID((String) row["UUID"]);
newData.localID = Convert.ToInt32(row["LocalLandID"]);
newData.GlobalID = new LLUUID((String) row["UUID"]);
newData.LocalID = Convert.ToInt32(row["LocalLandID"]);
// Bitmap is a byte[512]
newData.landBitmapByteArray = (Byte[]) row["Bitmap"];
newData.Bitmap = (Byte[]) row["Bitmap"];
newData.landName = (String) row["Name"];
newData.landDesc = (String) row["Description"];
newData.ownerID = (String) row["OwnerUUID"];
newData.isGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
newData.area = Convert.ToInt32(row["Area"]);
newData.auctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
newData.category = (Parcel.ParcelCategory) Convert.ToInt32(row["Category"]);
newData.Name = (String) row["Name"];
newData.Description = (String) row["Description"];
newData.OwnerID = (String) row["OwnerUUID"];
newData.IsGroupOwned = Convert.ToBoolean(row["IsGroupOwned"]);
newData.Area = Convert.ToInt32(row["Area"]);
newData.AuctionID = Convert.ToUInt32(row["AuctionID"]); //Unemplemented
newData.Category = (Parcel.ParcelCategory) Convert.ToInt32(row["Category"]);
//Enum libsecondlife.Parcel.ParcelCategory
newData.claimDate = Convert.ToInt32(row["ClaimDate"]);
newData.claimPrice = Convert.ToInt32(row["ClaimPrice"]);
newData.groupID = new LLUUID((String) row["GroupUUID"]);
newData.salePrice = Convert.ToInt32(row["SalePrice"]);
newData.landStatus = (Parcel.ParcelStatus) Convert.ToInt32(row["LandStatus"]);
newData.ClaimDate = Convert.ToInt32(row["ClaimDate"]);
newData.ClaimPrice = Convert.ToInt32(row["ClaimPrice"]);
newData.GroupID = new LLUUID((String) row["GroupUUID"]);
newData.SalePrice = Convert.ToInt32(row["SalePrice"]);
newData.Status = (Parcel.ParcelStatus) Convert.ToInt32(row["LandStatus"]);
//Enum. libsecondlife.Parcel.ParcelStatus
newData.landFlags = Convert.ToUInt32(row["LandFlags"]);
newData.landingType = Convert.ToByte(row["LandingType"]);
newData.mediaAutoScale = Convert.ToByte(row["MediaAutoScale"]);
newData.mediaID = new LLUUID((String) row["MediaTextureUUID"]);
newData.mediaURL = (String) row["MediaURL"];
newData.musicURL = (String) row["MusicURL"];
newData.passHours = Convert.ToSingle(row["PassHours"]);
newData.passPrice = Convert.ToInt32(row["PassPrice"]);
newData.Flags = Convert.ToUInt32(row["LandFlags"]);
newData.LandingType = Convert.ToByte(row["LandingType"]);
newData.MediaAutoScale = Convert.ToByte(row["MediaAutoScale"]);
newData.MediaID = new LLUUID((String) row["MediaTextureUUID"]);
newData.MediaURL = (String) row["MediaURL"];
newData.MusicURL = (String) row["MusicURL"];
newData.PassHours = Convert.ToSingle(row["PassHours"]);
newData.PassPrice = Convert.ToInt32(row["PassPrice"]);
LLUUID authedbuyer = LLUUID.Zero;
LLUUID snapshotID = LLUUID.Zero;
Helpers.TryParse((string)row["AuthBuyerID"], out authedbuyer);
Helpers.TryParse((string)row["SnapshotUUID"], out snapshotID);
newData.authBuyerID = authedbuyer;
newData.snapshotID = snapshotID;
newData.AuthBuyerID = authedbuyer;
newData.SnapshotID = snapshotID;
try
{
newData.userLocation =
newData.UserLocation =
new LLVector3(Convert.ToSingle(row["UserLocationX"]), Convert.ToSingle(row["UserLocationY"]),
Convert.ToSingle(row["UserLocationZ"]));
newData.userLookAt =
newData.UserLookAt =
new LLVector3(Convert.ToSingle(row["UserLookAtX"]), Convert.ToSingle(row["UserLookAtY"]),
Convert.ToSingle(row["UserLookAtZ"]));
}
catch (InvalidCastException)
{
newData.userLocation = LLVector3.Zero;
newData.userLookAt = LLVector3.Zero;
m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.landName);
newData.UserLocation = LLVector3.Zero;
newData.UserLookAt = LLVector3.Zero;
m_log.ErrorFormat("[PARCEL]: unable to get parcel telehub settings for {1}", newData.Name);
}
newData.parcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
newData.ParcelAccessList = new List<ParcelManager.ParcelAccessEntry>();
return newData;
}
@@ -1576,41 +1576,41 @@ namespace OpenSim.Data.MySQL
/// <param name="regionUUID"></param>
private static void fillLandRow(DataRow row, LandData land, LLUUID regionUUID)
{
row["UUID"] = Util.ToRawUuidString(land.globalID);
row["UUID"] = Util.ToRawUuidString(land.GlobalID);
row["RegionUUID"] = Util.ToRawUuidString(regionUUID);
row["LocalLandID"] = land.localID;
row["LocalLandID"] = land.LocalID;
// Bitmap is a byte[512]
row["Bitmap"] = land.landBitmapByteArray;
row["Bitmap"] = land.Bitmap;
row["Name"] = land.landName;
row["Description"] = land.landDesc;
row["OwnerUUID"] = Util.ToRawUuidString(land.ownerID);
row["IsGroupOwned"] = land.isGroupOwned;
row["Area"] = land.area;
row["AuctionID"] = land.auctionID; //Unemplemented
row["Category"] = land.category; //Enum libsecondlife.Parcel.ParcelCategory
row["ClaimDate"] = land.claimDate;
row["ClaimPrice"] = land.claimPrice;
row["GroupUUID"] = Util.ToRawUuidString(land.groupID);
row["SalePrice"] = land.salePrice;
row["LandStatus"] = land.landStatus; //Enum. libsecondlife.Parcel.ParcelStatus
row["LandFlags"] = land.landFlags;
row["LandingType"] = land.landingType;
row["MediaAutoScale"] = land.mediaAutoScale;
row["MediaTextureUUID"] = Util.ToRawUuidString(land.mediaID);
row["MediaURL"] = land.mediaURL;
row["MusicURL"] = land.musicURL;
row["PassHours"] = land.passHours;
row["PassPrice"] = land.passPrice;
row["SnapshotUUID"] = Util.ToRawUuidString(land.snapshotID);
row["UserLocationX"] = land.userLocation.X;
row["UserLocationY"] = land.userLocation.Y;
row["UserLocationZ"] = land.userLocation.Z;
row["UserLookAtX"] = land.userLookAt.X;
row["UserLookAtY"] = land.userLookAt.Y;
row["UserLookAtZ"] = land.userLookAt.Z;
row["AuthBuyerID"] = land.authBuyerID;
row["Name"] = land.Name;
row["Description"] = land.Description;
row["OwnerUUID"] = Util.ToRawUuidString(land.OwnerID);
row["IsGroupOwned"] = land.IsGroupOwned;
row["Area"] = land.Area;
row["AuctionID"] = land.AuctionID; //Unemplemented
row["Category"] = land.Category; //Enum libsecondlife.Parcel.ParcelCategory
row["ClaimDate"] = land.ClaimDate;
row["ClaimPrice"] = land.ClaimPrice;
row["GroupUUID"] = Util.ToRawUuidString(land.GroupID);
row["SalePrice"] = land.SalePrice;
row["LandStatus"] = land.Status; //Enum. libsecondlife.Parcel.ParcelStatus
row["LandFlags"] = land.Flags;
row["LandingType"] = land.LandingType;
row["MediaAutoScale"] = land.MediaAutoScale;
row["MediaTextureUUID"] = Util.ToRawUuidString(land.MediaID);
row["MediaURL"] = land.MediaURL;
row["MusicURL"] = land.MusicURL;
row["PassHours"] = land.PassHours;
row["PassPrice"] = land.PassPrice;
row["SnapshotUUID"] = Util.ToRawUuidString(land.SnapshotID);
row["UserLocationX"] = land.UserLocation.X;
row["UserLocationY"] = land.UserLocation.Y;
row["UserLocationZ"] = land.UserLocation.Z;
row["UserLookAtX"] = land.UserLookAt.X;
row["UserLookAtY"] = land.UserLookAt.Y;
row["UserLookAtZ"] = land.UserLookAt.Z;
row["AuthBuyerID"] = land.AuthBuyerID;
}
/// <summary>