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
parent
8d479fe5af
commit
9df18bb544
OpenSim/ApplicationPlugins/Rest/Regions
|
@ -149,9 +149,38 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||||
return RegionStats(httpResponse, scene);
|
return RegionStats(httpResponse, scene);
|
||||||
|
|
||||||
case "prims":
|
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,
|
return Failure(httpResponse, OSHttpStatusCode.ClientErrorBadRequest,
|
||||||
"GET", "too many parameters {0}", param);
|
"GET", "too many parameters {0}", param);
|
||||||
}
|
}
|
||||||
|
@ -184,10 +213,12 @@ namespace OpenSim.ApplicationPlugins.Rest.Regions
|
||||||
return XmlWriterResult;
|
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,
|
httpResponse.SendChunked = true;
|
||||||
"GET", "prims not implemented");
|
httpResponse.ContentType = "text/xml";
|
||||||
|
scene.SavePrimsToXml2(new StreamWriter(httpResponse.OutputStream), min, max);
|
||||||
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue