using System; using System.Collections.Generic; using System.Linq; using Autodesk.Revit.DB; namespace IFC_Revit_Interop { // Token: 0x0200000C RID: 12 public class ViewData { // Token: 0x0600004B RID: 75 RVA: 0x00004F14 File Offset: 0x00003114 public ViewData() { } // Token: 0x0600004C RID: 76 RVA: 0x00004F80 File Offset: 0x00003180 public ViewData(View v) { this.ViewId = v.Id.IntegerValue; this.ViewName = v.Name; this.ViewOrigin.Add(v.Origin.X); this.ViewOrigin.Add(v.Origin.Y); this.ViewOrigin.Add(v.Origin.Z); this.Scale = v.Scale; this.ViewDirectionXYZ.Add(v.ViewDirection.X); this.ViewDirectionXYZ.Add(v.ViewDirection.Y); this.ViewDirectionXYZ.Add(v.ViewDirection.Z); this.UpDirectionXYZ.Add(v.UpDirection.X); this.UpDirectionXYZ.Add(v.UpDirection.Y); this.UpDirectionXYZ.Add(v.UpDirection.Z); this.RightDirectionXYZ.Add(v.RightDirection.X); this.RightDirectionXYZ.Add(v.RightDirection.Y); this.RightDirectionXYZ.Add(v.RightDirection.Z); this.CropBoxActive = v.CropBoxActive; if (v.CropBox.Enabled) { this.CropBox["Min"] = new List(); this.CropBox["Min"].Add(v.CropBox.Min.X); this.CropBox["Min"].Add(v.CropBox.Min.Y); this.CropBox["Min"].Add(v.CropBox.Min.Z); this.CropBox["Max"] = new List(); this.CropBox["Max"].Add(v.CropBox.Max.X); this.CropBox["Max"].Add(v.CropBox.Max.Y); this.CropBox["Max"].Add(v.CropBox.Max.Z); } foreach (Element element in Command_ViewExport.GetAllInViewCollector(v).ToElements()) { if (!ViewData.IsElementOutsideCropBox(element, v)) { this.Elements.Add(new ElementData(element, this)); } } this.GetFilterColorsAndElements(v); } // Token: 0x0600004D RID: 77 RVA: 0x000052A0 File Offset: 0x000034A0 private static bool IsElementOutsideCropBox(Element e, View v) { bool flag = v.CropBoxActive; if (flag && v.CropBox.Enabled) { BoundingBoxXYZ cropBox = v.CropBox; BoundingBoxXYZ boundingBoxXYZ = e.get_BoundingBox(v); if (boundingBoxXYZ == null) { return true; } Transform inverse = v.CropBox.Transform.Inverse; boundingBoxXYZ.Max = inverse.OfPoint(boundingBoxXYZ.Max); boundingBoxXYZ.Min = inverse.OfPoint(boundingBoxXYZ.Min); flag = boundingBoxXYZ.Min.X > cropBox.Max.X || boundingBoxXYZ.Max.X < cropBox.Min.X || boundingBoxXYZ.Min.Y > cropBox.Max.Y || boundingBoxXYZ.Max.Y < cropBox.Min.Y || boundingBoxXYZ.Min.Z > cropBox.Max.Z || boundingBoxXYZ.Max.Z < cropBox.Min.Z; } return flag; } // Token: 0x0600004E RID: 78 RVA: 0x000053A8 File Offset: 0x000035A8 public void GetFilterColorsAndElements(View view) { HashSet hashSet = new HashSet(); foreach (ElementData elementData in this.Elements) { hashSet.Add(elementData.Id); } Document document = view.Document; try { foreach (ElementId elementId in view.GetFilters()) { if (view.IsFilterApplied(elementId)) { FilterElement filterElement = document.GetElement(elementId) as FilterElement; ICollection collection = null; if (filterElement is ParameterFilterElement) { FilteredElementCollector filteredElementCollector = new FilteredElementCollector(document); ParameterFilterElement parameterFilterElement = filterElement as ParameterFilterElement; ICollection categories = parameterFilterElement.GetCategories(); if (categories.Count > 0) { ElementMulticategoryFilter elementMulticategoryFilter = new ElementMulticategoryFilter(categories); filteredElementCollector = filteredElementCollector.WherePasses(elementMulticategoryFilter); } ICollection rules = parameterFilterElement.GetRules(); if (rules.Count > 0) { ElementParameterFilter elementParameterFilter = new ElementParameterFilter(rules.ToList()); filteredElementCollector = filteredElementCollector.WherePasses(elementParameterFilter); } collection = filteredElementCollector.ToElementIds(); } else if (filterElement is SelectionFilterElement) { collection = (filterElement as SelectionFilterElement).GetElementIds(); } if (collection.Count != 0) { Color projectionFillColor = view.GetFilterOverrides(elementId).ProjectionFillColor; if (projectionFillColor.IsValid) { string name = filterElement.Name; this.FilterColors[name] = new List(); this.FilterColors[name].Add((int)projectionFillColor.Red); this.FilterColors[name].Add((int)projectionFillColor.Green); this.FilterColors[name].Add((int)projectionFillColor.Blue); this.FilterCoveredElements[name] = new List(); foreach (ElementId elementId2 in collection) { if (hashSet.Contains(elementId2.IntegerValue)) { this.FilterCoveredElements[name].Add(elementId2.IntegerValue); } } } } } } } catch (Exception ex) { throw ex; } } // Token: 0x0400003A RID: 58 public int ViewId; // Token: 0x0400003B RID: 59 public string ViewName; // Token: 0x0400003C RID: 60 public List ViewOrigin = new List(); // Token: 0x0400003D RID: 61 public int Scale; // Token: 0x0400003E RID: 62 public List ViewDirectionXYZ = new List(); // Token: 0x0400003F RID: 63 public List UpDirectionXYZ = new List(); // Token: 0x04000040 RID: 64 public List RightDirectionXYZ = new List(); // Token: 0x04000041 RID: 65 public bool CropBoxActive; // Token: 0x04000042 RID: 66 public Dictionary> CropBox = new Dictionary>(); // Token: 0x04000043 RID: 67 public List Elements = new List(); // Token: 0x04000044 RID: 68 public Dictionary> FilterColors = new Dictionary>(); // Token: 0x04000045 RID: 69 public Dictionary> FilterCoveredElements = new Dictionary>(); } }