public static string childrenCellCondition(CellID64 cellID) { string cellIDStr = cellID.ToString(); int usedCharIdx = (int)Math.Ceiling((double)(CellID64.getLevel(cellID) / 2)); string tmpStr = "(CELLID LIKE '" + cellIDStr.Substring(0, usedCharIdx) + "%' AND CELLID > '" + cellIDStr + "')"; return(tmpStr); }
public static string parentsCellCondition(CellID64 cellID) { string tmpStr = ""; CellID64 pCell = cellID; for (int i = CellID64.getLevel(cellID); i > 0; i--) { if (i < CellID64.getLevel(cellID)) { tmpStr += " OR "; } pCell = CellID64.parentCell(pCell); tmpStr += "(CELLID = '" + pCell.ToString() + "' OR CELLID = '"; pCell.setBorderCell(); tmpStr += pCell.ToString() + "')"; } return(tmpStr); }
public static List <string> parentCellList(CellID64 cellID) { List <string> cidList = new List <string>(); CellID64 pCell = cellID; for (int i = CellID64.getLevel(pCell); i > 0; i--) { pCell = CellID64.parentCell(pCell); cidList.Add(pCell.ToString()); } return(cidList); }
/// <summary> /// Collect ALL the cellids from userDict for populating transient geometry(ies) /// </summary> /// <param name="elementIDList"></param> /// <param name="cellIDStrList"></param> /// <param name="borderFlagList"></param> public void collectSpatialIndexUserDict(out List <string> elementIDList, out List <string> cellIDStrList, out List <int> XMinB, out List <int> YMinB, out List <int> ZMinB, out List <int> XMaxB, out List <int> YMaxB, out List <int> ZMaxB, out List <int> depthList, out List <int> cellType) { int initArraySize = 50000; elementIDList = new List <string>(initArraySize); cellIDStrList = new List <string>(initArraySize); cellType = new List <int>(initArraySize); XMinB = new List <int>(initArraySize); YMinB = new List <int>(initArraySize); ZMinB = new List <int>(initArraySize); XMaxB = new List <int>(initArraySize); YMaxB = new List <int>(initArraySize); ZMaxB = new List <int>(initArraySize); depthList = new List <int>(initArraySize); int XMin; int YMin; int ZMin; int XMax; int YMax; int ZMax; foreach (KeyValuePair <UInt64, CellData> dictEntry in userDict) { CellID64 cellID = new CellID64(dictEntry.Key); if (dictEntry.Value.data != null) { foreach (int tupEID in dictEntry.Value.data) { ElementID eID = new ElementID(getElementIDByIndex(tupEID)); // For UserGeom, the ID i s generated from string of a simple number padded left with '0'. Now we need to remove them int end0Pos = 0; for (int i = 0; i < eID.ElementIDString.Length; ++i) { if (eID.ElementIDString[i] != '0') { end0Pos = i; break; } } string userGeomID = eID.ElementIDString.Remove(0, end0Pos); elementIDList.Add(userGeomID); cellIDStrList.Add(cellID.ToString()); // cellType.Add(eID.Value); cellType.Add(dictEntry.Value.nodeType); CellID64.getCellIDComponents(cellID, out XMin, out YMin, out ZMin, out XMax, out YMax, out ZMax); XMinB.Add(XMin); YMinB.Add(YMin); ZMinB.Add(ZMin); XMaxB.Add(XMax); YMaxB.Add(YMax); ZMaxB.Add(ZMax); depthList.Add(CellID64.getLevel(cellID)); } } } }