public static int GetCircuitObjectCount(SearchCicuitType type, bool IsConnect = false) { int count = 0; foreach (NDlabObject obj in g_AllLabObject.Values) { if (CheckSameType(obj, type, IsConnect) == true) { count++; } } return(count); }
public static List <NDlabObject> SearchLabObject(SearchCicuitType type, bool IsConnect = false) { List <NDlabObject> l = new List <NDlabObject> (); foreach (NDlabObject obj in g_AllLabObject.Values) { if (obj == null) { continue; } if (CheckSameType(obj, type, IsConnect) == true) { l.Add(obj); } } return(l); }
private static bool CheckSameType(NDlabObject obj, SearchCicuitType type, bool IsConnect) { if (obj == null) { return(false); } if (IsConnect == true) { if (obj.CheckConnect() == false) { return(false); } } //类型需匹配 if (type == SearchCicuitType.All) { return(true); } else if (type == SearchCicuitType.ELELINE) { if (obj is EleLine) { return(true); } } else if (type == SearchCicuitType.NormalCircuit) { bool b = (obj is EleLine); if (b == false) { return(true); } } else if (type == SearchCicuitType.Power) { if (obj is CurrentSourceElement) { return(true); } } return(false); }