/// <summary> /// Adds a new <see cref="ViewPort">viewport</see> to the document. /// </summary> /// <param name="entity">A <see cref="ViewPort">viewport</see></param> public void AddViewPort( ViewPort viewport ) { if( this.viewports.ContainsKey( viewport.Name ) ) throw new ArgumentException( "The viewport " + viewport.Name + " has already been added to the document.", "viewport" ); this.viewports.Add( viewport.Name, viewport ); }
/// <summary> /// Writes a new view port to the table section. /// </summary> /// <param name="vp">Viewport.</param> public void WriteViewPort(ViewPort vp) { if (this.activeTable != StringCode.ViewPortTable) { throw new InvalidDxfTableException(this.activeTable, this.file); } this.WriteCodePair(0, vp.CodeName); this.WriteCodePair(5, vp.Handle); this.WriteCodePair(100, SubclassMarker.TableRecord); this.WriteCodePair(100, SubclassMarker.ViewPort); this.WriteCodePair(2, vp); this.WriteCodePair(70, 0); this.WriteCodePair(10, vp.LowerLeftCorner.X); this.WriteCodePair(20, vp.LowerLeftCorner.Y); this.WriteCodePair(11, vp.UpperRightCorner.X); this.WriteCodePair(21, vp.UpperRightCorner.Y); this.WriteCodePair(12, vp.LowerLeftCorner.X - vp.UpperRightCorner.X); this.WriteCodePair(22, vp.UpperRightCorner.Y - vp.LowerLeftCorner.Y); this.WriteCodePair(13, vp.SnapBasePoint.X); this.WriteCodePair(23, vp.SnapBasePoint.Y); this.WriteCodePair(14, vp.SnapSpacing.X); this.WriteCodePair(24, vp.SnapSpacing.Y); this.WriteCodePair(15, vp.GridSpacing.X); this.WriteCodePair(25, vp.GridSpacing.Y); Vector3d dir = vp.Camera - vp.Target; this.WriteCodePair(16, dir.X); this.WriteCodePair(26, dir.Y); this.WriteCodePair(36, dir.Z); this.WriteCodePair(17, vp.Target.X); this.WriteCodePair(27, vp.Target.Y); this.WriteCodePair(37, vp.Target.Z); }
public void SetLimits( double fMinX, double fMinY, double fMaxX, double fMaxY ) { //m_dxf.G //m_dxf.GetLayer ViewPort v = new ViewPort( "*Active" ); v.LowerLeftCorner = new Vector2d( fMinX, fMinY ); v.UpperRightCorner = new Vector2d( fMaxX, fMaxY ); //v. m_dxf.AddViewPort( v ); // v.LowerLeftCorner.Y = fMinY; }