internal void method_9(DxfEntityCollection value, bool updateEntitiesPaperSpaceProperty) { if (value == this.dxfEntityCollection_0) { return; } if (this.dxfEntityCollection_0 != null) { this.dxfEntityCollection_0.Added -= new ItemEventHandler <DxfEntity>(this.method_21); this.dxfEntityCollection_0.Set -= new ItemSetEventHandler <DxfEntity>(this.method_20); } this.dxfEntityCollection_0 = value; if (this.dxfEntityCollection_0 == null) { return; } this.dxfEntityCollection_0.Added += new ItemEventHandler <DxfEntity>(this.method_21); this.dxfEntityCollection_0.Set += new ItemSetEventHandler <DxfEntity>(this.method_20); if (!updateEntitiesPaperSpaceProperty) { return; } foreach (DxfEntity dxfEntity in (DxfHandledObjectCollection <DxfEntity>) this.dxfEntityCollection_0) { dxfEntity.method_10(this.bool_0); } }
/// <summary> /// Run over a collection of entities and remove all with different layers. /// </summary> /// <param name="entities">Entity collection.</param> /// <param name="effectiveLayer">The effective layer.</param> /// <returns><c>true</c> if zero layer entities were included in this collection.</returns> private bool HandleEntityCollection(DxfEntityCollection entities, DxfLayer effectiveLayer) { InsertInfo currentInfo = new InsertInfo(entities, effectiveLayer); try { insertStack.Push(currentInfo); while (currentInfo.currentIndex >= 0) { DxfEntity entity = currentInfo.currentCollection[currentInfo.currentIndex]; entity.Accept(this); --currentInfo.currentIndex; } } finally { insertStack.Pop(); } return(currentInfo.HasZeroLayerEntities); }
public void method_2() { if (this.hashSet_0 == null) { return; } DxfBlock handledObject = (DxfBlock)this.HandledObject; DxfEntityCollection entities = handledObject.Entities; DxfEntity[] array = entities.ToArray(); handledObject.Deactivate(); entities.Clear(); foreach (DxfEntity dxfEntity in array) { if (!this.hashSet_0.Contains(dxfEntity)) { entities.Add(dxfEntity); } } handledObject.method_11(); }
internal void method_10(DxfEntityCollection value) { if (this.dxfEntityCollection_0 == value) { return; } if (this.dxfEntityCollection_0 != null) { this.Deactivate(); } this.dxfEntityCollection_0 = value; if (this.dxfEntityCollection_0 != null) { this.method_11(); foreach (DxfEntity entity in (DxfHandledObjectCollection <DxfEntity>) this.dxfEntityCollection_0) { this.method_16(entity); } } this.OnEntitiesChanged((EventArgs)null); }
/// <summary> /// Initializes a new instance of the <see cref="InsertInfo"/> class. /// </summary> /// <param name="currentCollection">The current collection.</param> /// <param name="effectiveLayer">The effective insertion layer.</param> public InsertInfo(DxfEntityCollection currentCollection, DxfLayer effectiveLayer) { this.effectiveLayer = effectiveLayer; this.currentCollection = currentCollection; currentIndex = currentCollection.Count - 1; }
static void FindEntities(DxfEntityCollection Entities) { foreach (var entityGroups in Entities) { if (typeof(DxfLine) != entityGroups.GetType() && typeof(DxfLwPolyline) != entityGroups.GetType() && typeof(DxfMText) != entityGroups.GetType() && typeof(DxfText) != entityGroups.GetType() && typeof(DxfCircle) != entityGroups.GetType() && typeof(DxfHatch) != entityGroups.GetType() && typeof(DxfInsert) != entityGroups.GetType() && typeof(DxfSpline) != entityGroups.GetType()) { // Console.WriteLine(entityGroups.GetType()); } dxfType.Add(entityGroups.GetType().Name); if (typeof(DxfLine) == entityGroups.GetType()) { dxfLine = entityGroups as DxfLine; int color; if (dxfLine.Color.ColorType.ToString() == "ByLayer") { color = dxfLine.Layer.Color.Rgb; } else { color = dxfLine.Color.Rgb; } CADLine cADLine = new CADLine { parentHandle = dxfLine.OwnerObjectSoftReference.Handle, type = dxfLine.GetType().Name, color = color, transform = dxfLine.Transform.DebugString, startPoint = dxfLine.Start.ToString(), endPoint = dxfLine.End.ToString(), lineWeight = dxfLine.LineWeight }; cadEntities.Add(cADLine); } if (typeof(DxfLwPolyline) == entityGroups.GetType()) { //Console.WriteLine(dxfLwPolyline); dxfLwPolyline = entityGroups as DxfLwPolyline; string[] arrVertices = new string[dxfLwPolyline.Vertices.Count]; for (int i = 0; i < dxfLwPolyline.Vertices.Count; i++) { arrVertices[i] = dxfLwPolyline.Vertices[i].ToString(); } int color; if (dxfLwPolyline.Color.ColorType.ToString() == "ByLayer") { color = dxfLwPolyline.Layer.Color.Rgb; } else { color = dxfLwPolyline.Color.Rgb; } CADLwPolyLine cADLwPolyLine = new CADLwPolyLine { parentHandle = dxfLwPolyline.OwnerObjectSoftReference.Handle, type = dxfLwPolyline.GetType().Name, color = color, transform = dxfLwPolyline.Transform.DebugString, vertices = arrVertices, closed = dxfLwPolyline.Closed.ToString(), }; cadEntities.Add(cADLwPolyLine); } if (typeof(DxfXLine) == entityGroups.GetType()) { dxfXLine = entityGroups as DxfXLine; } if (typeof(DxfSpline) == entityGroups.GetType()) { dxfSpline = entityGroups as DxfSpline; string[] arrFitPoints = new string[dxfSpline.FitPoints.Count]; for (int i = 0; i < dxfSpline.FitPoints.Count; i++) { arrFitPoints[i] = dxfSpline.FitPoints[i].ToString(); } int color; if (dxfSpline.Color.ColorType.ToString() == "ByLayer") { color = dxfSpline.Layer.Color.Rgb; } else { color = dxfSpline.Color.Rgb; } CADSpline cADSpline = new CADSpline { parentHandle = dxfSpline.OwnerObjectSoftReference.Handle, type = dxfSpline.GetType().Name, color = color, transform = dxfSpline.Transform.DebugString, fitPoints = arrFitPoints, }; cadEntities.Add(cADSpline); } if (typeof(DxfCircle) == entityGroups.GetType()) { dxfCircle = entityGroups as DxfCircle; int color; if (dxfCircle.Color.ColorType.ToString() == "ByLayer") { color = dxfCircle.Layer.Color.Rgb; } else { color = dxfCircle.Color.Rgb; } CADCircle cADCircle = new CADCircle { parentHandle = dxfCircle.OwnerObjectSoftReference.Handle, type = dxfCircle.GetType().Name, color = color, transform = dxfCircle.Transform.DebugString, center = dxfCircle.Center.ToString(), radius = dxfCircle.Radius }; cadEntities.Add(cADCircle); kcircle.Add(dxfCircle); } if (typeof(DxfArc) == entityGroups.GetType()) { dxfArc = entityGroups as DxfArc; int color; if (dxfArc.Color.ColorType.ToString() == "ByLayer") { color = dxfArc.Layer.Color.Rgb; } else { color = dxfArc.Color.Rgb; } CADArc cADArc = new CADArc { parentHandle = dxfArc.OwnerObjectSoftReference.Handle, type = dxfArc.GetType().Name, color = color, transform = dxfArc.Transform.DebugString, center = dxfArc.Center.ToString(), startAngle = dxfArc.StartAngle, endAngle = dxfArc.EndAngle, radius = dxfArc.Radius }; cadEntities.Add(cADArc); } if (typeof(DxfEllipse) == entityGroups.GetType()) { dxfEllipse = entityGroups as DxfEllipse; int color; if (dxfEllipse.Color.ColorType.ToString() == "ByLayer") { color = dxfEllipse.Layer.Color.Rgb; } else { color = dxfEllipse.Color.Rgb; } CADEllipse cADEllipse = new CADEllipse { parentHandle = dxfEllipse.OwnerObjectSoftReference.Handle, type = dxfEllipse.GetType().Name, color = color, transform = dxfEllipse.Transform.DebugString, center = dxfEllipse.Center.ToString(), majorAxisEndPoint = dxfEllipse.MajorAxisEndPoint.ToString(), minorAxisEndPoint = dxfEllipse.MinorAxisEndPoint.ToString(), startParameter = dxfEllipse.StartParameter, endParameter = dxfEllipse.EndParameter }; cadEntities.Add(cADEllipse); } if (typeof(DxfMText) == entityGroups.GetType()) { dxfMText = entityGroups as DxfMText; int color; if (dxfMText.Color.ColorType.ToString() == "ByLayer") { color = dxfMText.Layer.Color.Rgb; } else { color = dxfMText.Color.Rgb; } if (dxfMText.SimplifiedText == "C座一层平面图") { ktls.Add(dxfMText); } CADMText cADMText = new CADMText { parentHandle = dxfMText.OwnerObjectSoftReference.Handle, type = dxfMText.GetType().Name, color = color, transform = dxfMText.Transform.DebugString, simplifiedText = dxfMText.SimplifiedText.ToString(), fontStyle = dxfMText.Style.ToString(), size = dxfMText.Height, attachmentPoint = dxfMText.AttachmentPoint.ToString(), boxHeight = dxfMText.BoxHeight, boxWidth = dxfMText.BoxWidth }; cadEntities.Add(cADMText); if (dxfMText.SimplifiedText.ToString() == "图 纸 目 录") { //Console.WriteLine(222222); ktls.Add(dxfMText); } if (dxfMText.SimplifiedText.ToString() == "JS-T5-302") { //Console.WriteLine(222222); ktls.Add(dxfMText); } } if (typeof(DxfText) == entityGroups.GetType()) { dxfText = entityGroups as DxfText; int color; if (dxfText.Color.ColorType.ToString() == "ByLayer") { color = dxfText.Layer.Color.Rgb; } else { color = dxfText.Color.Rgb; } CADText cADText = new CADText { parentHandle = dxfText.OwnerObjectSoftReference.Handle, type = dxfText.GetType().Name, color = color, transform = dxfText.Transform.DebugString, simplifiedText = dxfText.SimplifiedText.ToString(), fontStyle = dxfText.Style.ToString(), size = dxfText.Height, alignMentPoint1 = dxfText.AlignmentPoint1.ToString(), rotationAngle = dxfText.Rotation, }; if (dxfText.SimplifiedText == "JS-T5-001 ") { ktest.Add(dxfText); } cadEntities.Add(cADText); } if (typeof(DxfInsert) == entityGroups.GetType()) { dxfInsert = entityGroups as DxfInsert; kins.Add(dxfInsert); if (dxfInsert.Block != null) { ulong count; if (dxfInsert.Block != null) { count = dxfInsert.Block.Handle; } else { count = 0; } CADInsert cADInsert = new CADInsert(); cADInsert.parentHandle = dxfInsert.OwnerObjectSoftReference.Handle; cADInsert.type = dxfInsert.GetType().Name; cADInsert.transform = dxfInsert.Transform.DebugString; cADInsert.insertPoint = dxfInsert.InsertionPoint.ToString(); cADInsert.rotationAngle = dxfInsert.Rotation; cADInsert.insertName = dxfInsert.Block.Name; cADInsert.nowHandle = count; cADInsert.insertScale = dxfInsert.ScaleFactor.ToString(); cadEntities.Add(cADInsert); FindEntities(dxfInsert.Block.Entities); } } if (typeof(DxfAttributeDefinition) == entityGroups.GetType()) { dxfAttributeDefinition = entityGroups as DxfAttributeDefinition; //Console.WriteLine(dxfAttributeDefinition); } if (typeof(DxfDimension.Linear) == entityGroups.GetType()) { Console.WriteLine(11111); } } }