private QLEntity[] AddEntity(QLEntity[] tuple, QLEntity referencedEntity) { var newTuple = new List <QLEntity>(tuple); newTuple.Add(referencedEntity); return(newTuple.ToArray()); }
private QLEntity[] AddEntityReplace(QLEntity[] tuple, QLEntity referencedEntity) { var newTuple = new List <QLEntity>(); for (int index = 0; index < tuple.Length; index++) { var qlEntity = tuple[index]; newTuple.Add(index == tuple.Length - 1 ? referencedEntity : qlEntity); } return(newTuple.ToArray()); }
void entity(out QLEntity QLEntity) { QLEntity = new QLEntity(); Expect(2); var value = t.val; Expect(3); QLClass QLClass; myclass(out QLClass); Expect(10); QLEntity.SetEntityAndClass(value, QLClass); }
private TriangleMesh GetMesh(QLEntity qlEntityA) { var gloablIdA = qlEntityA.GetGloablId(); if (string.IsNullOrEmpty(gloablIdA)) { return(null); } var meshA = spatialRepository.MeshByGlobalId(gloablIdA); return(meshA); }
private QLEntity LookUpPropertyNames(List <string> entityLines, QLEntity entity) { var className = entity.ClassName; if (!classNameToProperties.ContainsKey(className)) { var entityLine = entityLines.First(e => e.StartsWith(className, StringComparison.InvariantCultureIgnoreCase)); var props = new List <QLProperty>(); var splitted = entityLine.Split(';'); for (int i = 1; i < splitted.Length - 1; i++) { var item = splitted[i].Trim(); var isOp = false; if (item.Contains("OPTIONAL")) { item = item.Replace("OPTIONAL", string.Empty); isOp = true; } item = item.Replace(" : ", "~"); var parts = item.Split('~'); var type = parts[1].Trim(); NetType netType = new NetType("Entity", "Entity"); if (typeNameToNetType.ContainsKey(type)) { netType = typeNameToNetType[type]; } props.Add(new QLProperty(parts[0].Trim(), type, netType, isOp)); } classNameToProperties.Add(className, props); } repository.SetProperties(className, classNameToProperties[className]); return(entity); }
public void SetInversePropertyVal(QLEntity entity, string propertyName, QLEntityId qlEntityId, bool deleteOld) { var index = repository.InversePropertyIndex(entity.ClassName, propertyName); var part = entity.QlInverseList.List[index]; if (deleteOld || (part.QLEntityId == null && part.QLList == null)) { entity.QlInverseList.List[index] = new QLPart() { QLEntityId = qlEntityId } } ; else { if (part.QLEntityId != null) { var list = new QLList(); list.Add(new QLPart() { QLEntityId = part.QLEntityId }); list.Add(new QLPart() { QLEntityId = qlEntityId }); part.QLEntityId = null; part.QLList = list; } else { part.QLList.Add(new QLPart() { QLEntityId = qlEntityId }); } } }
public bool AttributeSetTestLocal(QLEntity entity, PredicateNode predicateNode) //todo all possible versions { var secondNode = predicateNode.SecondNode; var exAtt = (predicateNode.FirstNode as AttributeAccessNode).ExAttNode; //property present? var part = entity.GetPropertyValue(exAtt.Value); if (part == null) { return(false); } //todo check if un nesting is ok (supports IFC TYPES such as IFCBOOLEAN) if (part.QLClass != null) { part = part.QLClass.QLDirectList[0]; } if (secondNode is CStringNode && TestStringValue(part, secondNode)) { return(true); } if (secondNode is CNumberNode && TestIntValue(part, secondNode, predicateNode.Compare)) { return(true); } if (secondNode is CFloatNode && TestFloatValue(part, secondNode, predicateNode.Compare)) { return(true); } return(false); }
public void SetInverseValues(QLEntity entity, QLList list, int level, int propIndex, Dictionary <int, QLEntity> idToEntity) { var className = entity.ClassName; if (classesToSkipInverse.Contains(className)) //has list of lists and no inverse attributes { return; } for (int i = 0; i < list.List.Count; i++) { var part = list.List[i]; var currentPropIndex = level == 0 ? i : propIndex; //class lookup var propName = repository.DirectProperty(className, currentPropIndex).PropName; List <Tuple <string, string, string> > invertedAttribute = null; if (invertedAttributeReversed.ContainsKey(className)) { invertedAttribute = invertedAttributeReversed[className].ToList(); } if (part.QLEntityId != null) { var referencedWrapper = idToEntity[part.QLEntityId.Id]; //direct attributes if (string.IsNullOrEmpty(part.QLEntityId.ConcreteType)) { part.QLEntityId.ConcreteType = referencedWrapper.ClassName; } var inverseAttributeTarget = invertedAttribute?.FirstOrDefault(a => a.Item1 == propName && a.Item3 == referencedWrapper.ClassName); if (inverseAttributeTarget != null) { var inverseList = referencedWrapper.QlInverseList; var inverseCount = repository.InversePropertyCount(referencedWrapper.ClassName); if (inverseList == null) { var ifcList = new QLList(); for (int j = 0; j < inverseCount; j++) { ifcList.Add(new QLPart()); } referencedWrapper.QlInverseList = ifcList; } SetInversePropertyVal(referencedWrapper, inverseAttributeTarget.Item2, entity.QlEntityId, false); } } if (part.QLList != null) { propIndex = i; SetInverseValues(entity, part.QLList, level + 1, propIndex, idToEntity); } } }