/// <summary> /// Initializes a new instance of the <c>Underlay</c> class. /// </summary> /// <param name="definition">Underlay definition.</param> public Underlay(UnderlayDefinition definition) : base(EntityType.Underlay, DxfObjectCode.Underlay) { this.definition = definition; this.position = Vector3.Zero; this.scale = new Vector3(1.0); this.rotation = 0.0; this.contrast = 100; this.fade = 0; this.displayOptions = UnderlayDisplayFlags.ShowUnderlay; this.clippingBoundary = null; switch (this.definition.Type) { case UnderlayType.DGN: this.CodeName = DxfObjectCode.UnderlayDgn; break; case UnderlayType.DWF: this.CodeName = DxfObjectCode.UnderlayDwf; break; case UnderlayType.PDF: this.CodeName = DxfObjectCode.UnderlayPdf; break; } }
private void WriteUnderlayDefinition(UnderlayDefinition underlayDef, string ownerHandle) { this.chunk.Write(0, underlayDef.CodeName); this.chunk.Write(5, underlayDef.Handle); this.chunk.Write(102, "{ACAD_REACTORS"); List<DxfObject> objects = null; switch (underlayDef.Type) { case UnderlayType.DGN: objects = this.doc.UnderlayDgnDefinitions.References[underlayDef.Name]; break; case UnderlayType.DWF: objects = this.doc.UnderlayDwfDefinitions.References[underlayDef.Name]; break; case UnderlayType.PDF: objects = this.doc.UnderlayPdfDefinitions.References[underlayDef.Name]; break; } if (objects == null) throw new NullReferenceException("Underlay references list cannot be null"); foreach (DxfObject o in objects) { Underlay underlay = o as Underlay; if (underlay != null) this.chunk.Write(330, underlay.Handle); } this.chunk.Write(102, "}"); this.chunk.Write(330, ownerHandle); this.chunk.Write(100, SubclassMarker.UnderlayDefinition); this.chunk.Write(1, this.EncodeNonAsciiCharacters(underlayDef.FileName)); switch (underlayDef.Type) { case UnderlayType.DGN: this.chunk.Write(2, this.EncodeNonAsciiCharacters(((UnderlayDgnDefinition)underlayDef).Layout)); break; case UnderlayType.DWF: this.chunk.Write(2, string.Empty); break; case UnderlayType.PDF: this.chunk.Write(2, this.EncodeNonAsciiCharacters(((UnderlayPdfDefinition)underlayDef).Page)); break; } }