//结束绘制圆形之前,得到Polygon
var pos = gPolyObj.Position;
var bufferR = gPolyObj.Radius;
var cVerticesArray = [-122.415025, 37.76059, 10, ];
var point = sgworld.Creator.GeometryCreator.CreatePointGeometry(cVerticesArray);
point.X = pos.X;
point.Y = pos.Y;
point.Z = pos.Altitude;
var newGeo = point.SpatialOperator.buffer(bufferR);
ExecuteSpatialQuery(null, newGeo);
function ExecuteSpatialQuery(pLayer, pGeo) {
var sgworld = CreateSGObj();
var htmlStr = "";
var layerItemId = sgworld.ProjectTree.FindItem("Building");
if (layerItemId != sgworld.ProjectTree.RootID) {
var pipeLayer = sgworld.ProjectTree.GetObject(layerItemId);
if (pipeLayer.ObjectType == 36) { // OT_FEATURE_LAYER = 36 // OT_3D_MESH_FEATURE_LAYER = 39
var statisticsedLayer = pipeLayer.ExecuteSpatialQuery(pGeo, 1);
//alert(statisticsedLayer.Count);
sgworld.Command.Execute(1086,0);
htmlStr = "<html><head><title></title>";
htmlStr += "<style>table{border-right:1px solid #ED7D31;border-bottom:1px solid #ED7D31}table td{border-left:1px solid #ED7D31;border-top:1px solid #ED7D31}</style>";
htmlStr += "</head><body style='100%;height:100%; margin:2px; padding:2px;'><table style='100%; text-align:center;font-size:12px;' border='0' cellspacing='0' cellpadding='0'><tr style='background-color:#ED7D31'>";
// var firstFeature = statisticsedLayer(0);
htmlStr += "<td>";
htmlStr += "选取设备数量";
htmlStr += "</td>";
htmlStr += "<td>";
htmlStr += " " + statisticsedLayer.Count;
htmlStr += "</td>";
htmlStr += "</tr>";
htmlStr += "</table></body></html>";
if (htmlStr != "") {
var ScreenRectHeight = sgworld.Window.Rect.Height;
var ScreenRectWidth = sgworld.Window.Rect.Width;
var areaPopup = sgworld.Creator.CreatePopupMessage("检修计划表", "", 231, 150, 231, 120);
areaPopup.InnerText = htmlStr;
areaPopup.Flags = 512;
areaPopup.AllowResize = true;
areaPopup.AllowDrag = true;
sgworld.Window.ShowPopup(areaPopup);
}
}
}
}