private Cell <Square> GetSquare(int target, Stream <int> sCheck, Stream <int> sFlag) { Cell <Square> square = sFlag.Filter(target.Equals).Snapshot(Flags[target], (_, value) => value ? new Flag().Square : new Tile().Square).Hold(new Tile().Square).SwitchC(); Stream <ISet <int> > sFlipMine = sCheck.Filter(t => Flags[t].Sample()).Filter(Mines.Contains).Map(_ => Mines); Stream <ISet <int> > sFlipVoid = sCheck.Filter(t => Flags[t].Sample()).Filter(Voids.Contains).Map(t => CollectConnectedVoid(t, Voids, Adjacent)); if (Mines.Contains(target)) { var sFlip = sFlipMine.Filter(targets => targets.Contains(target)).Map(_ => Unit.Value); var sTrigger = sCheck.Filter(target.Equals).Filter(_ => Flags[target].Sample()).Map(_ => Unit.Value).OrElse(sFlip); return(sTrigger.Map(_ => new Mine().Square).Hold(square).SwitchC()); } if (Voids.Contains(target)) { var sFlip = sFlipVoid.Filter(targets => targets.Contains(target)).Map(_ => Unit.Value); var sTrigger = sCheck.Filter(target.Equals).Filter(_ => Flags[target].Sample()).Map(_ => Unit.Value).OrElse(sFlip); return(sTrigger.Map(_ => new Void().Square).Hold(square).SwitchC()); } if (Hints.ContainsKey(target)) { var sFlip = sFlipVoid.Filter(voids => Adjacent[target].Any(voids.Contains)).Map(voids => Unit.Value); var sTrigger = sCheck.Filter(target.Equals).Filter(_ => Flags[target].Sample()).Map(_ => Unit.Value).OrElse(sFlip); return(sTrigger.Map(_ => new Hint(Hints[target]).Square).Hold(square).SwitchC()); } return(new Tile().Square); }
/// <summary> /// Creates or populates Revit elements based on the information contained in this class. /// </summary> /// <param name="doc">The document.</param> protected override void Create(Document doc) { foreach (IFCFeatureElement opening in Openings) { try { // Create the actual Revit element based on the IFCFeatureElement here. CreateElement(doc, opening); // This gets around the issue that the Boolean operation between the void(s) in the IFCFeatureElement and // the solid(s) in the IFCElement may use the Graphics Style of the voids in the resulting Solid(s), meaning // that some faces may disappear when we turn off the visibility of IfcOpeningElements. IFCFeatureElement openingClone = IFCFeatureElement.CreateOpeningClone(opening, this); CreateElement(doc, openingClone); foreach (IFCSolidInfo voidGeom in openingClone.Solids) { Voids.Add(voidGeom); } } catch (Exception ex) { IFCImportFile.TheLog.LogError(opening.Id, ex.Message, false); } } base.Create(doc); }
/// <summary> /// Tests if a point is contained within this profile. Returns false for points that are outside of the profile (or within voids). /// </summary> /// <param name="point">The position to test.</param> /// <param name="containment">Whether the point is inside, outside, at an edge, or at a vertex.</param> /// <returns>True if the point is within the profile.</returns> public bool Contains(Vector3 point, out Containment containment) { IEnumerable <Line> allLines = Perimeter.Segments(); if (Voids != null) { allLines = allLines.Union(Voids.SelectMany(v => v.Segments())); } return(Polygon.Contains(allLines, point, out containment)); }
/// <summary> /// Tests the express where-clause specified in param 'clause' /// </summary> /// <param name="clause">The express clause to test</param> /// <returns>true if the clause is satisfied.</returns> public bool ValidateClause(IfcAdvancedBrepWithVoidsClause clause) { var retVal = false; try { switch (clause) { case IfcAdvancedBrepWithVoidsClause.VoidsHaveAdvancedFaces: retVal = Functions.SIZEOF(Voids.Where(Vsh => Functions.SIZEOF(Vsh.CfsFaces.Where(Afs => (!(Functions.TYPEOF(Afs).Contains("IFC4.IFCADVANCEDFACE"))))) == 0)) == 0; break; } } catch (Exception ex) { var log = Validation.ValidationLogging.CreateLogger <Xbim.Ifc4.GeometricModelResource.IfcAdvancedBrepWithVoids>(); log?.LogError(string.Format("Exception thrown evaluating where-clause 'IfcAdvancedBrepWithVoids.{0}' for #{1}.", clause, EntityLabel), ex); } return(retVal); }
internal override void ParseXml(XmlElement xml) { base.ParseXml(xml); foreach (XmlNode child in xml.ChildNodes) { string name = child.Name; if (string.Compare(name, "Voids") == 0) { foreach (XmlNode cn in child.ChildNodes) { IfcClosedShell s = mDatabase.ParseXml <IfcClosedShell>(cn as XmlElement); if (s != null) { Voids.Add(s); } } } } }
/// <summary> /// Creates or populates Revit elements based on the information contained in this class. /// </summary> /// <param name="doc">The document.</param> protected override void Create(Document doc) { foreach (IFCFeatureElement opening in Openings) { try { // Create the actual Revit element based on the IFCFeatureElement here. CreateElement(doc, opening); // This gets around the issue that the Boolean operation between the void(s) in the IFCFeatureElement and // the solid(s) in the IFCElement may use the Graphics Style of the voids in the resulting Solid(s), meaning // that some faces may disappear when we turn off the visibility of IfcOpeningElements. IList <IFCSolidInfo> voids = CloneElementGeometry(doc, opening, this, true); if (voids != null) { foreach (IFCSolidInfo voidGeom in voids) { Voids.Add(voidGeom); } } } catch (Exception ex) { Importer.TheLog.LogError(opening.Id, ex.Message, false); } } foreach (IFCPort port in Ports) { try { CreateElement(doc, port); } catch (Exception ex) { Importer.TheLog.LogError(port.Id, ex.Message, false); } } base.Create(doc); }
public JudoPayApi(Func <Type, ILog> logger, IClient client) { Payments = new Payments(logger(typeof(Payments)), client, true); Refunds = new Refunds(logger(typeof(Refunds)), client); PreAuths = new PreAuths(logger(typeof(PreAuths)), client, true); Transactions = new Transactions(logger(typeof(Transactions)), client); Collections = new Collections(logger(typeof(Collections)), client); ThreeDs = new ThreeDs(logger(typeof(ThreeDs)), client); RegisterCards = new RegisterCards(logger(typeof(RegisterCards)), client, true); SaveCards = new SaveCard(logger(typeof(SaveCard)), client); Voids = new Voids(logger(typeof(Voids)), client); WebPayments = new WebPayments { Payments = new Clients.WebPayments.Payments(logger(typeof(Clients.WebPayments.Payments)), client), PreAuths = new Clients.WebPayments.PreAuths(logger(typeof(Clients.WebPayments.PreAuths)), client), Transactions = new Clients.WebPayments.Transactions(logger(typeof(Clients.WebPayments.Transactions)), client) }; Consumers = new Consumers(logger(typeof(Consumers)), client); Connection = client.Connection; }
public Frm_ThemKhachHang(Voids vd, bool check) { InitializeComponent(); voids = vd; checkExit = check; }
/// <summary> /// Get all segments from a profile's perimeter and internal voids. /// </summary> public List <Line> Segments() { return(Perimeter.Segments().Union(Voids?.SelectMany(v => v.Segments()) ?? new Line[0]).ToList()); }
public Tipo Type() { if (currentToken.Tipo == TipoToken.TK_CHAR) { Caracter C = new Caracter(); currentToken = lex.NextToken(); return C; } else if (currentToken.Tipo == TipoToken.TK_BOOL) { Booleano B = new Booleano(); currentToken = lex.NextToken(); return B; } else if (currentToken.Tipo == TipoToken.TK_STRING) { Cadena C = new Cadena(); currentToken = lex.NextToken(); return C; } else if (currentToken.Tipo == TipoToken.TK_FLOAT) { Flotante F = new Flotante(); currentToken = lex.NextToken(); return F; } else if (currentToken.Tipo == TipoToken.TK_INT) { Entero C = new Entero(); currentToken = lex.NextToken(); return C; } else if (currentToken.Tipo == TipoToken.TK_VOID) { Voids V = new Voids(); currentToken = lex.NextToken(); return V; } return null; }
/// <summary> /// Creates or populates Revit elements based on the information contained in this class. /// </summary> /// <param name="doc">The document.</param> protected override void Create(Document doc) { bool preventInstances = false; IFCElement element = this as IFCElement; if (element != null) { preventInstances = this is IFCOpeningElement; foreach (IFCFeatureElement opening in element.Openings) { try { preventInstances = true; // Create the actual Revit element based on the IFCFeatureElement here. ElementId openingId = CreateElement(doc, opening); // This gets around the issue that the Boolean operation between the void(s) in the IFCFeatureElement and // the solid(s) in the IFCElement may use the Graphics Style of the voids in the resulting Solid(s), meaning // that some faces may disappear when we turn off the visibility of IfcOpeningElements. IList <IFCSolidInfo> voids = IFCElement.CloneElementGeometry(doc, opening, this, true); if (voids != null) { foreach (IFCSolidInfo voidGeom in voids) { IFCVoidInfo voidInfo = new IFCVoidInfo(voidGeom); if (!Importer.TheProcessor.ApplyTransforms) { // If we aren't applying transforms, then the Voids and Solids will be // in different coordinate spaces, so we need the transform of the // void, so we can transform it into the Solid coordinate space voidInfo.TotalTransform = opening?.ObjectLocation?.TotalTransform; } Voids.Add(voidInfo); } } } catch (Exception ex) { Importer.TheLog.LogError(opening.Id, ex.Message, false); } } } if (HasValidTopLevelGeometry()) { using (IFCImportShapeEditScope shapeEditScope = IFCImportShapeEditScope.Create(doc, this)) { shapeEditScope.GraphicsStyleId = GraphicsStyleId; shapeEditScope.CategoryId = CategoryId; shapeEditScope.PreventInstances = preventInstances; // The name can be added as well. but it is usually less useful than 'oid' string myId = GlobalId; // + "(" + Name + ")"; Transform lcs = IFCImportFile.TheFile.IFCProject.WorldCoordinateSystem; if (lcs == null) { lcs = (ObjectLocation != null) ? ObjectLocation.TotalTransform : Transform.Identity; } else if (ObjectLocation != null) { lcs = lcs.Multiply(ObjectLocation.TotalTransform); } // If we are not applying transforms to the geometry, then pass in the identity matrix. // Lower down this method we then pass lcs to the consumer element, so that it can apply // the transform as required. Transform transformToUse = Importer.TheProcessor.ApplyTransforms ? lcs : Transform.Identity; ProductRepresentation.CreateProductRepresentation(shapeEditScope, transformToUse, transformToUse, myId); int numSolids = Solids.Count; // Attempt to cut each solid with each void. for (int solidIdx = 0; solidIdx < numSolids; solidIdx++) { if (!CutSolidByVoids(Solids[solidIdx])) { Solids.RemoveAt(solidIdx); solidIdx--; numSolids--; } } bool addedCurves = shapeEditScope.AddPlanViewCurves(FootprintCurves, Id); if ((numSolids > 0 || addedCurves)) { if (GlobalId != null) { // If the GlobalId is null, this is a fake IfcProduct that we don't want to create into a DirectShape, or // add to the caches in any way. We only wanted to gather its geometry. DirectShape shape = Importer.TheCache.UseElementByGUID <DirectShape>(doc, GlobalId); if (shape == null) { shape = IFCElementUtil.CreateElement(doc, CategoryId, GlobalId, null, Id, EntityType); } List <GeometryObject> directShapeGeometries = new List <GeometryObject>(); foreach (IFCSolidInfo geometryObject in Solids) { // We need to check if the solid created is good enough for DirectShape. If not, warn and use a fallback Mesh. GeometryObject currObject = geometryObject.GeometryObject; if (currObject is Solid) { Solid solid = currObject as Solid; if (!shape.IsValidGeometry(solid)) { Importer.TheLog.LogWarning(Id, "Couldn't create valid solid, reverting to mesh.", false); directShapeGeometries.AddRange(IFCGeometryUtil.CreateMeshesFromSolid(solid)); currObject = null; } } if (currObject != null) { directShapeGeometries.Add(currObject); } } // We will use the first IfcTypeObject id, if it exists. In general, there should be 0 or 1. IFCTypeObject typeObjectToUse = null; foreach (IFCTypeObject typeObject in TypeObjects) { if (typeObject.IsValidForCreation && typeObject.CreatedElementId != ElementId.InvalidElementId) { typeObjectToUse = typeObject; break; } } if (!Importer.TheProcessor.PostProcessProduct(Id, typeObjectToUse?.Id, lcs, directShapeGeometries)) { if (shape != null) { shape.SetShape(directShapeGeometries); shapeEditScope.SetPlanViewRep(shape); if (typeObjectToUse != null && typeObjectToUse.CreatedElementId != ElementId.InvalidElementId) { shape.SetTypeId(typeObjectToUse.CreatedElementId); } } } PresentationLayerNames.UnionWith(shapeEditScope.PresentationLayerNames); CreatedElementId = shape.Id; CreatedGeometry = directShapeGeometries; } } } } else { if (this is IFCElement || this is IFCGrid) { IList <IFCEntity> visitedEntities = new List <IFCEntity>(); visitedEntities.Add(this); if (!HasValidSubElementGeometry(visitedEntities)) { // We will not warn if this is an IfcSpatialStructureElement; those aren't expected to have their own geometry. Importer.TheLog.LogWarning(Id, "There is no valid geometry for this " + EntityType.ToString() + "; entity will not be built.", false); } } } base.Create(doc); }
/// <summary> /// Creates or populates Revit elements based on the information contained in this class. /// </summary> /// <param name="doc">The document.</param> protected override void Create(Document doc) { bool preventInstances = false; IFCElement element = this as IFCElement; if (element != null) { IFCOpeningElement openingElement = element as IFCOpeningElement; if (openingElement != null) { preventInstances = true; } foreach (IFCFeatureElement opening in element.Openings) { try { preventInstances = true; // Create the actual Revit element based on the IFCFeatureElement here. ElementId openingId = CreateElement(doc, opening); // This gets around the issue that the Boolean operation between the void(s) in the IFCFeatureElement and // the solid(s) in the IFCElement may use the Graphics Style of the voids in the resulting Solid(s), meaning // that some faces may disappear when we turn off the visibility of IfcOpeningElements. IList <IFCSolidInfo> voids = IFCElement.CloneElementGeometry(doc, opening, this, true); if (voids != null) { foreach (IFCSolidInfo voidGeom in voids) { Voids.Add(voidGeom); } } } catch (Exception ex) { Importer.TheLog.LogError(opening.Id, ex.Message, false); } } } if (HasValidTopLevelGeometry()) { using (IFCImportShapeEditScope shapeEditScope = IFCImportShapeEditScope.Create(doc, this)) { shapeEditScope.GraphicsStyleId = GraphicsStyleId; shapeEditScope.CategoryId = CategoryId; shapeEditScope.PreventInstances = preventInstances; // The name can be added as well. but it is usually less useful than 'oid' string myId = GlobalId; // + "(" + Name + ")"; Transform lcs = IFCImportFile.TheFile.IFCProject.WorldCoordinateSystem; if (lcs == null) { lcs = (ObjectLocation != null) ? ObjectLocation.TotalTransform : Transform.Identity; } else if (ObjectLocation != null) { lcs = lcs.Multiply(ObjectLocation.TotalTransform); } ProductRepresentation.CreateProductRepresentation(shapeEditScope, lcs, lcs, myId); int numSolids = Solids.Count; int numVoids = Voids.Count; if ((numSolids > 0) && (numVoids > 0)) { // This may be different than before, with the addition of solids from FamilyInstances. numSolids = Solids.Count; // Attempt to cut each solid with each void. for (int solidIdx = 0; solidIdx < numSolids; solidIdx++) { // We only cut body representation items. if (Solids[solidIdx].RepresentationType != IFCRepresentationIdentifier.Body) { continue; } if (!(Solids[solidIdx].GeometryObject is Solid)) { string typeName = (Solids[solidIdx].GeometryObject is Mesh) ? "mesh" : "instance"; Importer.TheLog.LogError(Id, "Can't cut " + typeName + " geometry, ignoring " + numVoids + " void(s).", false); continue; } for (int voidIdx = 0; voidIdx < numVoids; voidIdx++) { if (!(Voids[voidIdx].GeometryObject is Solid)) { Importer.TheLog.LogError(Id, "Can't cut Solid geometry with a Mesh (# " + Voids[voidIdx].Id + "), ignoring.", false); continue; } Solids[solidIdx].GeometryObject = IFCGeometryUtil.ExecuteSafeBooleanOperation(Solids[solidIdx].Id, Voids[voidIdx].Id, Solids[solidIdx].GeometryObject as Solid, Voids[voidIdx].GeometryObject as Solid, BooleanOperationsType.Difference, null); if ((Solids[solidIdx].GeometryObject as Solid).Faces.IsEmpty) { Solids.RemoveAt(solidIdx); solidIdx--; numSolids--; break; } } } } bool addedCurves = shapeEditScope.AddPlanViewCurves(FootprintCurves, Id); if ((numSolids > 0 || addedCurves)) { if (GlobalId != null) { // If the GlobalId is null, this is a fake IfcProduct that we don't want to create into a DirectShape, or // add to the caches in any way. We only wanted to gather its geometry. DirectShape shape = Importer.TheCache.UseElementByGUID <DirectShape>(doc, GlobalId); if (shape == null) { shape = IFCElementUtil.CreateElement(doc, CategoryId, GlobalId, null, Id); } List <GeometryObject> directShapeGeometries = new List <GeometryObject>(); foreach (IFCSolidInfo geometryObject in Solids) { // We need to check if the solid created is good enough for DirectShape. If not, warn and use a fallback Mesh. GeometryObject currObject = geometryObject.GeometryObject; if (currObject is Solid) { Solid solid = currObject as Solid; if (!shape.IsValidGeometry(solid)) { Importer.TheLog.LogWarning(Id, "Couldn't create valid solid, reverting to mesh.", false); directShapeGeometries.AddRange(IFCGeometryUtil.CreateMeshesFromSolid(solid)); currObject = null; } } if (currObject != null) { directShapeGeometries.Add(currObject); } } // We will use the first IfcTypeObject id, if it exists. In general, there should be 0 or 1. ElementId typeId = ElementId.InvalidElementId; foreach (IFCTypeObject typeObject in TypeObjects) { if (typeObject.IsValidForCreation && typeObject.CreatedElementId != ElementId.InvalidElementId) { typeId = typeObject.CreatedElementId; break; } } shape.SetShape(directShapeGeometries); shapeEditScope.SetPlanViewRep(shape); if (typeId != ElementId.InvalidElementId) { shape.SetTypeId(typeId); } PresentationLayerNames.UnionWith(shapeEditScope.PresentationLayerNames); CreatedElementId = shape.Id; CreatedGeometry = directShapeGeometries; } } } } else { if (this is IFCElement || this is IFCGrid) { IList <IFCEntity> visitedEntities = new List <IFCEntity>(); visitedEntities.Add(this); if (!HasValidSubElementGeometry(visitedEntities)) { // We will not warn if this is an IfcSpatialStructureElement; those aren't expected to have their own geometry. Importer.TheLog.LogWarning(Id, "There is no valid geometry for this " + EntityType.ToString() + "; entity will not be built.", false); } } } base.Create(doc); }
public Frm_ThongKeSLSP(Voids vd) { InitializeComponent(); exit = vd; }