Example #1
0
        protected void Initialize(DES_Header header)
        {
            long iPos = _br.BaseStream.Position;

            byte[] buffer = new byte[36];
            for (int i = 0; i < 4; ++i)
            {
                _br.Write(buffer);
            }

            // des file header
            string sHeader = "FicDes99, PICADOR est une marque déposée.";

            WriteString(sHeader);

            // des file size
            _addressFileSize = _br.BaseStream.Position;
            _br.Write((uint)_iFileSize);

            // valeur du zoom a l'enregistrement
            _xmin = header._xmin;
            _ymin = header._ymin;
            _xmax = header._xmax;
            _ymax = header._ymax;

            _addressZoom = _br.BaseStream.Position;
            _br.Write(_xmin);
            _br.Write(_ymin);
            _br.Write(_xmax);
            _br.Write(_ymax);

            // 2D or 3D
            _br.Write(header._code2D3D);

            if (253 == header._code2D3D) /* 0xFD */
            {                            // 2D -> do not write anything else
            }
            else if (254 == header._code2D3D)
            {   // 3D -> also write transformation matrices
                for (int i = 0; i < 16; ++i)
                {
                    _br.Write(header._viewMatrix[i]);
                }
                for (int i = 0; i < 16; ++i)
                {
                    _br.Write(header._viewMatrixInverse[i]);
                }
            }
        }
Example #2
0
 /// <summary>
 /// Initialize DES_Writer object
 /// </summary>
 /// <param name="factory"></param>
 public override void Initialize(PicFactory factory)
 {
     // save factory
     _factory = factory;
     // build .des file header
     DES_Header header = new DES_Header();
     PicVisitorBoundingBox bbVisitor = new PicVisitorBoundingBox();
     factory.ProcessVisitor(bbVisitor);
     header._xmin = (float)bbVisitor.Box.XMin;
     header._xmax = (float)bbVisitor.Box.XMax;
     header._ymin = (float)bbVisitor.Box.YMin;
     header._ymax = (float)bbVisitor.Box.YMax;
     // initialize des writer
     _desWriter = new DES_WriterMem(header);
     DES_SuperBaseHeader superBaseHeader = new DES_SuperBaseHeader();
     _desWriter.WriteSuperBaseHeader(superBaseHeader);
 }
Example #3
0
 public DES_WriterMem(DES_Header header)
 {
     _br = new System.IO.BinaryWriter(_memStream);
     Initialize(header);
 }
Example #4
0
 public DES_WriterFile(DES_Header header, string filePath)
 {
     _br = new System.IO.BinaryWriter(File.Open(filePath, FileMode.Create));
     Initialize(header);
 }