/// <summary> /// 根据查询条件获取GGGX数据 /// </summary> /// <param name="bot"></param> /// <param name="bos"></param> /// <param name="filter"></param> /// <param name="category"></param> /// <returns></returns> public XmlDocument Get3GXByFilter(string bot, List <string> bos, string filter, GGGXDataCategory category) { string sqlWhere = string.Empty; StringBuilder strSql = new StringBuilder(); strSql.Append("SELECT DISTINCT BO.*,OBJECTTYPE.BOT,OBJECTTYPE.FT FROM BO,OBJECTTYPE"); if (!string.IsNullOrEmpty(filter)) { strSql.Append(" ,PROPERTY PROPERTY "); strSql.Append(" WHERE BO.BOTID = OBJECTTYPE.BOTID "); strSql.Append(" AND PROPERTY.BOID = BO.BOID "); strSql.Append(string.Format(" AND OBJECTTYPE.BOT='{0}' ", bot)); strSql.Append(" AND BO.BOTID=OBJECTTYPE.BOTID "); } else { strSql.Append(string.Format(" WHERE OBJECTTYPE.BOT='{0}' ", bot)); strSql.Append(" AND BO.BOTID=OBJECTTYPE.BOTID "); } //对象名称 if (bos != null && bos.Count > 0) { string strBos = string.Empty; for (int i = 0; i < bos.Count; i++) { if (i == bos.Count - 1) { strBos += "'" + bos[i].Trim() + "'"; } else { strBos += "'" + bos[i].Trim() + "',"; } } strSql.Append(string.Format(" AND BO.NAME in ({0}) ", strBos)); } //属性 if (!string.IsNullOrEmpty(filter)) { strSql.Append(" AND " + "( " + MongoJsonToSql.JsonToSql(filter, bot).ToString() + " )"); } DataTable dt = SqlServerDBHelper.GetDataTable(strSql.ToString()); List <GeoFeature> ftList = new List <GeoFeature>(); foreach (DataRow row in dt.Rows) { GeoFeature ft = new GeoFeature(); ft.BOID = row["Boid"].ToString(); ft.BOT = row["BOT"].ToString(); ft.FT = row["FT"].ToString(); ft.NAME = row["Name"].ToString(); if (category == GGGXDataCategory.B) { ft.PropertyList = Comm.GetPropertyByBoid(ft.BOID); ft.GeometryList = Comm.GetGeometryByBoid(ft.BOID); } else if (category == GGGXDataCategory.P) { ft.PropertyList = Comm.GetPropertyByBoid(ft.BOID); ft.GeometryList = null; } else if (category == GGGXDataCategory.G) { ft.PropertyList = null; ft.GeometryList = Comm.GetGeometryByBoid(ft.BOID); } ftList.Add(ft); } return(GGGXParse.ConvertFT.FeatureToGGGX(ftList)); }