aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorJustin Clark-Casey (justincc)2011-04-13 21:48:16 +0100
committerJustin Clark-Casey (justincc)2011-04-13 21:48:16 +0100
commit68cc5b46fefdf4db68cae1202086257ce731f8a1 (patch)
treec7e805586da1aa2b0125db4142cde303a8565cfe /OpenSim/Region
parentFix bug where rezzing coalesced objects would give all objects the same name ... (diff)
downloadopensim-SC_OLD-68cc5b46fefdf4db68cae1202086257ce731f8a1.zip
opensim-SC_OLD-68cc5b46fefdf4db68cae1202086257ce731f8a1.tar.gz
opensim-SC_OLD-68cc5b46fefdf4db68cae1202086257ce731f8a1.tar.bz2
opensim-SC_OLD-68cc5b46fefdf4db68cae1202086257ce731f8a1.tar.xz
refactor: move code to obtain the coalescence size and object offsets into CoalescedSceneObjects from the serializer.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs2
-rw-r--r--OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs26
-rw-r--r--OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs27
3 files changed, 39 insertions, 16 deletions
diff --git a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
index 0f2b610..c197cb9 100644
--- a/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
+++ b/OpenSim/Region/CoreModules/Framework/InventoryAccess/Tests/InventoryAccessModuleTests.cs
@@ -84,7 +84,7 @@ namespace OpenSim.Region.CoreModules.Framework.InventoryAccess.Tests
84 public void TestRezCoalescedObject() 84 public void TestRezCoalescedObject()
85 { 85 {
86 TestHelper.InMethod(); 86 TestHelper.InMethod();
87 log4net.Config.XmlConfigurator.Configure(); 87// log4net.Config.XmlConfigurator.Configure();
88 88
89 // Create asset 89 // Create asset
90 SceneObjectGroup object1; 90 SceneObjectGroup object1;
diff --git a/OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs b/OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs
index 51eac5f..af8ccda 100644
--- a/OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs
+++ b/OpenSim/Region/Framework/Scenes/CoalescedSceneObjects.cs
@@ -124,5 +124,31 @@ namespace OpenSim.Region.Framework.Scenes
124 lock (m_memberObjects) 124 lock (m_memberObjects)
125 return m_memberObjects.Remove(obj); 125 return m_memberObjects.Remove(obj);
126 } 126 }
127
128 /// <summary>
129 /// Get the total size of the coalescence (the size required to cover all the objects within it) and the
130 /// offsets of each of those objects.
131 /// </summary>
132 /// <param name="size"></param>
133 /// <returns>
134 /// An array of offsets. The order of objects is the same as returned from the Objects property
135 /// </returns>
136 public Vector3[] GetSizeAndOffsets(out Vector3 size)
137 {
138 float minX, minY, minZ;
139 float maxX, maxY, maxZ;
140
141 Vector3[] offsets
142 = Scene.GetCombinedBoundingBox(
143 Objects, out minX, out maxX, out minY, out maxY, out minZ, out maxZ);
144
145 float sizeX = maxX - minX;
146 float sizeY = maxY - minY;
147 float sizeZ = maxZ - minZ;
148
149 size = new Vector3(sizeX, sizeY, sizeZ);
150
151 return offsets;
152 }
127 } 153 }
128} \ No newline at end of file 154} \ No newline at end of file
diff --git a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
index 3af2f76..a0e120a 100644
--- a/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
+++ b/OpenSim/Region/Framework/Scenes/Serialization/CoalescedSceneObjectsSerializer.cs
@@ -42,6 +42,9 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
42 /// <summary> 42 /// <summary>
43 /// Serialize and deserialize coalesced scene objects. 43 /// Serialize and deserialize coalesced scene objects.
44 /// </summary> 44 /// </summary>
45 /// <remarks>
46 /// Deserialization not yet here.
47 /// </remarks>
45 public class CoalescedSceneObjectsSerializer 48 public class CoalescedSceneObjectsSerializer
46 { 49 {
47 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); 50 private static readonly ILog m_log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
@@ -60,29 +63,23 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
60 using (StringWriter sw = new StringWriter()) 63 using (StringWriter sw = new StringWriter())
61 { 64 {
62 using (XmlTextWriter writer = new XmlTextWriter(sw)) 65 using (XmlTextWriter writer = new XmlTextWriter(sw))
63 { 66 {
67 Vector3 size;
68
64 List<SceneObjectGroup> coaObjects = coa.Objects; 69 List<SceneObjectGroup> coaObjects = coa.Objects;
65 70
66// m_log.DebugFormat( 71// m_log.DebugFormat(
67// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object", 72// "[COALESCED SCENE OBJECTS SERIALIZER]: Writing {0} objects for coalesced object",
68// coaObjects.Count); 73// coaObjects.Count);
69 74
70 float minX, minY, minZ; 75 // This is weak - we're relying on the set of coalesced objects still being identical
71 float maxX, maxY, maxZ; 76 Vector3[] offsets = coa.GetSizeAndOffsets(out size);
72
73 Vector3[] offsets = Scene.GetCombinedBoundingBox(coaObjects,
74 out minX, out maxX, out minY, out maxY,
75 out minZ, out maxZ);
76 77
77 writer.WriteStartElement("CoalescedObject"); 78 writer.WriteStartElement("CoalescedObject");
78 79
79 float sizeX = maxX - minX; 80 writer.WriteAttributeString("x", size.X.ToString());
80 float sizeY = maxY - minY; 81 writer.WriteAttributeString("y", size.Y.ToString());
81 float sizeZ = maxZ - minZ; 82 writer.WriteAttributeString("z", size.Z.ToString());
82
83 writer.WriteAttributeString("x", sizeX.ToString());
84 writer.WriteAttributeString("y", sizeY.ToString());
85 writer.WriteAttributeString("z", sizeZ.ToString());
86 83
87 // Embed the offsets into the group XML 84 // Embed the offsets into the group XML
88 for (int i = 0; i < coaObjects.Count; i++) 85 for (int i = 0; i < coaObjects.Count; i++)
@@ -100,7 +97,7 @@ namespace OpenSim.Region.Framework.Scenes.Serialization
100 97
101 SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, true); 98 SceneObjectSerializer.ToOriginalXmlFormat(obj, writer, true);
102 99
103 writer.WriteEndElement(); 100 writer.WriteEndElement(); // SceneObjectGroup
104 } 101 }
105 102
106 writer.WriteEndElement(); // CoalescedObject 103 writer.WriteEndElement(); // CoalescedObject