From: Richard Alimi <ralimi@us.ibm.com>

The following patch implements retrieving prims in Xml2 format via the REST
interface.  For example:
  http://localhost:9000/admin/regions/<region-uuid>/prims/

It also allows an additional parameter which specifies a bounding box.  If
this parameter is specified, only prims within the bounding box are
retrieved.  For example:

http://localhost:9000/admin/regions/8cd759b4-e077-489d-9a34-e1ff70ef65dd/prims/0,0,0,128,128,128
will retrieve only the prims whose positions are in the bounding box with
corners (0,0,0) and (128,128,128).
0.6.0-stable
Dr Scofield 2008-08-15 07:28:28 +00:00
parent 8d479fe5af
commit 9df18bb544
1 changed files with 35 additions and 4 deletions

View File

@ -149,9 +149,38 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
return RegionStats(httpResponse, scene);
case "prims":
return RegionPrims(httpResponse, scene);
return RegionPrims(httpResponse, scene, LLVector3.Zero, LLVector3.Zero);
}
}
if (3 == comps.Length) {
switch (comps[1].ToLower())
{
case "prims":
string[] subregion = comps[2].Split(',');
if (subregion.Length == 6)
{
LLVector3 min, max;
try
{
min = new LLVector3((float)Double.Parse(subregion[0]), (float)Double.Parse(subregion[1]), (float)Double.Parse(subregion[2]));
max = new LLVector3((float)Double.Parse(subregion[3]), (float)Double.Parse(subregion[4]), (float)Double.Parse(subregion[5]));
}
catch (Exception e)
{
return Failure(httpResponse, OSHttpStatusCode.ClientErrorBadRequest,
"GET", "invalid subregion parameter");
}
return RegionPrims(httpResponse, scene, min, max);
}
else
{
return Failure(httpResponse, OSHttpStatusCode.ClientErrorBadRequest,
"GET", "invalid subregion parameter");
}
}
}
return Failure(httpResponse, OSHttpStatusCode.ClientErrorBadRequest,
"GET", "too many parameters {0}", param);
}
@ -184,10 +213,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
return XmlWriterResult;
}
protected string RegionPrims(OSHttpResponse httpResponse, Scene scene)
protected string RegionPrims(OSHttpResponse httpResponse, Scene scene, LLVector3 min, LLVector3 max)
{
return Failure(httpResponse, OSHttpStatusCode.ServerErrorNotImplemented,
"GET", "prims not implemented");
httpResponse.SendChunked = true;
httpResponse.ContentType = "text/xml";
scene.SavePrimsToXml2(new StreamWriter(httpResponse.OutputStream), min, max);
return "";
}
}
}