mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 03:06:05 +08:00
*Added new commands ('backup','show parcels','reset parcels')
*Added parcel join support *Made parcel saving and loading much more efficient *Fixed bug that would not allow joining of parcel locally in the viewer (gives an error before sending to server) *Known Issue: Restoring parcels from storage is not working correctly. For now, do a 'reset parcels' to regenerate a standard parcel
This commit is contained in:
@@ -71,7 +71,7 @@ namespace OpenSim.Storage.LocalStorageDb4o
|
||||
|
||||
public void StorePrim(PrimData prim)
|
||||
{
|
||||
IObjectSet result = db.Query(new UUIDQuery(prim.FullID));
|
||||
IObjectSet result = db.Query(new UUIDPrimQuery(prim.FullID));
|
||||
if(result.Count>0)
|
||||
{
|
||||
//prim already in storage
|
||||
@@ -112,7 +112,7 @@ namespace OpenSim.Storage.LocalStorageDb4o
|
||||
|
||||
public void RemovePrim(LLUUID primID)
|
||||
{
|
||||
IObjectSet result = db.Query(new UUIDQuery(primID));
|
||||
IObjectSet result = db.Query(new UUIDPrimQuery(primID));
|
||||
if(result.Count>0)
|
||||
{
|
||||
PrimData found = (PrimData) result.Next();
|
||||
@@ -133,7 +133,6 @@ namespace OpenSim.Storage.LocalStorageDb4o
|
||||
public float[] LoadWorld()
|
||||
{
|
||||
OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Loading world....");
|
||||
//World blank = new World();
|
||||
float[] heightmap = null;
|
||||
OpenSim.Framework.Console.MainConsole.Instance.Verbose("LoadWorld() - Looking for a heightmap in local DB");
|
||||
IObjectSet world_result = db.Get(typeof(MapStorage));
|
||||
@@ -144,21 +143,6 @@ namespace OpenSim.Storage.LocalStorageDb4o
|
||||
//blank.LandMap = map.Map;
|
||||
heightmap = map.Map;
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - No heightmap found, generating new one");
|
||||
HeightmapGenHills hills = new HeightmapGenHills();
|
||||
// blank.LandMap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||
// heightmap = hills.GenerateHeightmap(200, 4.0f, 80.0f, false);
|
||||
heightmap = new float[256, 256];
|
||||
OpenSim.Framework.Console.MainConsole.Instance.WriteLine("LoadWorld() - Saving heightmap to local database");
|
||||
MapStorage map = new MapStorage();
|
||||
map.Map = heightmap; //blank.LandMap;
|
||||
db.Set(map);
|
||||
db.Commit();
|
||||
*/
|
||||
}
|
||||
return heightmap;
|
||||
}
|
||||
|
||||
@@ -177,27 +161,77 @@ namespace OpenSim.Storage.LocalStorageDb4o
|
||||
db.Commit();
|
||||
}
|
||||
|
||||
public void SaveParcel(ParcelData parcel)
|
||||
{
|
||||
IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID));
|
||||
if (result.Count > 0)
|
||||
{
|
||||
//Old Parcel
|
||||
ParcelData updateParcel = (ParcelData)result.Next();
|
||||
updateParcel.AABBMax = parcel.AABBMax;
|
||||
updateParcel.AABBMin = parcel.AABBMin;
|
||||
updateParcel.area = parcel.area;
|
||||
updateParcel.auctionID = parcel.auctionID;
|
||||
updateParcel.authBuyerID = parcel.authBuyerID;
|
||||
updateParcel.category = parcel.category;
|
||||
updateParcel.claimDate = parcel.claimDate;
|
||||
updateParcel.claimPrice = parcel.claimPrice;
|
||||
updateParcel.groupID = parcel.groupID;
|
||||
updateParcel.groupPrims = parcel.groupPrims;
|
||||
updateParcel.isGroupOwned = parcel.isGroupOwned;
|
||||
updateParcel.localID = parcel.localID;
|
||||
updateParcel.ownerID = parcel.ownerID;
|
||||
updateParcel.parcelBitmapByteArray = (byte[])parcel.parcelBitmapByteArray.Clone();
|
||||
updateParcel.parcelDesc = parcel.parcelDesc;
|
||||
updateParcel.parcelFlags = parcel.parcelFlags;
|
||||
updateParcel.parcelName = parcel.parcelName;
|
||||
updateParcel.parcelStatus = parcel.parcelStatus;
|
||||
updateParcel.salePrice = parcel.salePrice;
|
||||
|
||||
db.Set(updateParcel);
|
||||
}
|
||||
else
|
||||
{
|
||||
db.Set(parcel);
|
||||
}
|
||||
db.Commit();
|
||||
}
|
||||
|
||||
public void SaveParcels(ParcelData[] parcel_data)
|
||||
{
|
||||
MainConsole.Instance.Notice("Parcel Backup: Saving Parcels...");
|
||||
IObjectSet result = db.Get(typeof(ParcelData));
|
||||
foreach (ParcelData parcel in result)
|
||||
{
|
||||
db.Delete(parcel);
|
||||
}
|
||||
MainConsole.Instance.Notice("Parcel Backup: Removing old entries complete. Adding new entries.");
|
||||
int i;
|
||||
for (i = 0; i < parcel_data.GetLength(0); i++)
|
||||
{
|
||||
|
||||
MainConsole.Instance.Notice("Adding : " + i + " - SAMPLE: " + parcel_data[i].parcelBitmapByteArray[0]);
|
||||
db.Set(parcel_data[i]);
|
||||
SaveParcel(parcel_data[i]);
|
||||
|
||||
}
|
||||
db.Commit();
|
||||
MainConsole.Instance.Notice("Parcel Backup: Parcel Save Complete");
|
||||
}
|
||||
|
||||
public void RemoveParcel(ParcelData parcel)
|
||||
{
|
||||
IObjectSet result = db.Query(new UUIDParcelQuery(parcel.globalID));
|
||||
if (result.Count > 0)
|
||||
{
|
||||
db.Delete(result[0]);
|
||||
}
|
||||
db.Commit();
|
||||
}
|
||||
public void RemoveAllParcels()
|
||||
{
|
||||
MainConsole.Instance.Notice("Parcel Backup: Removing all parcels...");
|
||||
IObjectSet result = db.Get(typeof(ParcelData));
|
||||
if (result.Count > 0)
|
||||
{
|
||||
foreach (ParcelData parcelData in result)
|
||||
{
|
||||
RemoveParcel(parcelData);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void LoadParcels(ILocalStorageParcelReceiver recv)
|
||||
{
|
||||
MainConsole.Instance.Notice("Parcel Backup: Loading Parcels...");
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ProjectType>Local</ProjectType>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
@@ -6,7 +6,8 @@
|
||||
<ProjectGuid>{E1B79ECF-0000-0000-0000-000000000000}</ProjectGuid>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ApplicationIcon></ApplicationIcon>
|
||||
<ApplicationIcon>
|
||||
</ApplicationIcon>
|
||||
<AssemblyKeyContainerName>
|
||||
</AssemblyKeyContainerName>
|
||||
<AssemblyName>OpenSim.Storage.LocalStorageDb4o</AssemblyName>
|
||||
@@ -15,9 +16,11 @@
|
||||
<DefaultTargetSchema>IE50</DefaultTargetSchema>
|
||||
<DelaySign>false</DelaySign>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder></AppDesignerFolder>
|
||||
<AppDesignerFolder>
|
||||
</AppDesignerFolder>
|
||||
<RootNamespace>OpenSim.Storage.LocalStorageDb4o</RootNamespace>
|
||||
<StartupObject></StartupObject>
|
||||
<StartupObject>
|
||||
</StartupObject>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
</PropertyGroup>
|
||||
@@ -28,7 +31,8 @@
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE;DEBUG</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>True</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>False</Optimize>
|
||||
@@ -37,7 +41,8 @@
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<AllowUnsafeBlocks>False</AllowUnsafeBlocks>
|
||||
@@ -46,7 +51,8 @@
|
||||
<ConfigurationOverrideFile>
|
||||
</ConfigurationOverrideFile>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DocumentationFile></DocumentationFile>
|
||||
<DocumentationFile>
|
||||
</DocumentationFile>
|
||||
<DebugSymbols>False</DebugSymbols>
|
||||
<FileAlignment>4096</FileAlignment>
|
||||
<Optimize>True</Optimize>
|
||||
@@ -55,22 +61,23 @@
|
||||
<RemoveIntegerChecks>False</RemoveIntegerChecks>
|
||||
<TreatWarningsAsErrors>False</TreatWarningsAsErrors>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<NoWarn></NoWarn>
|
||||
<NoWarn>
|
||||
</NoWarn>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" >
|
||||
<Reference Include="System">
|
||||
<HintPath>System.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml" >
|
||||
<Reference Include="System.Xml">
|
||||
<HintPath>System.Xml.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Db4objects.Db4o.dll" >
|
||||
<Reference Include="Db4objects.Db4o.dll">
|
||||
<HintPath>..\..\..\bin\Db4objects.Db4o.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="libsecondlife.dll" >
|
||||
<Reference Include="libsecondlife.dll">
|
||||
<HintPath>..\..\..\bin\libsecondlife.dll</HintPath>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
@@ -80,26 +87,27 @@
|
||||
<Name>OpenSim.Framework</Name>
|
||||
<Project>{8ACA2445-0000-0000-0000-000000000000}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\..\Common\OpenSim.Framework.Console\OpenSim.Framework.Console.csproj">
|
||||
<Name>OpenSim.Framework.Console</Name>
|
||||
<Project>{A7CD0630-0000-0000-0000-000000000000}</Project>
|
||||
<Package>{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</Package>
|
||||
<Private>False</Private>
|
||||
<Private>False</Private>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Db4LocalStorage.cs">
|
||||
<Compile Include="UUIDParcelQuery.cs" />
|
||||
<Compile Include="UUIDPrimQuery.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MapStorage.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="UUIDQuery.cs">
|
||||
<Compile Include="Db4LocalStorage.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
@@ -110,4 +118,4 @@
|
||||
<PostBuildEvent>
|
||||
</PostBuildEvent>
|
||||
</PropertyGroup>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -36,11 +36,11 @@ using OpenSim.Framework.Types;
|
||||
|
||||
namespace OpenSim.Storage.LocalStorageDb4o
|
||||
{
|
||||
public class UUIDQuery : Predicate
|
||||
public class UUIDPrimQuery : Predicate
|
||||
{
|
||||
private LLUUID _findID;
|
||||
|
||||
public UUIDQuery(LLUUID find)
|
||||
public UUIDPrimQuery(LLUUID find)
|
||||
{
|
||||
_findID = find;
|
||||
}
|
||||
Reference in New Issue
Block a user