Esempio n. 1
0
        /// <summary>
        /// Decodes the current line DAD.
        /// </summary>
        private void SetLine()
        {
            // Define the line as the active feature
            m_Feature = (Ntx.Feature)m_Line;

            // Define characteristics common to all features
            this.SetFeature();

            // Initialize the simple stuff
            m_Line.IsTopologicalArc = this.IsArc;
            m_Line.IsCurve = this.IsCurve;
            if (m_Line.IsCurve)
            {
                m_Line.Radius = this.Radius;
                m_Line.Center = this.Center;
                m_Line.BC = this.BC;
                m_Line.EC = this.EC;
            }
            else
            {
                m_Line.Radius = 0.0;
                m_Line.Center = null;
                m_Line.BC = null;
                m_Line.EC = null;
            }

            //	Load data for the line, chaining through the DADs if required.

            m_NumPosition = 0;
            bool islinked = this.LoadPositions();
            while (islinked)
            {
                islinked = this.LoadPositions();
            }
            m_Line.NumPosition = m_NumPosition;
            m_Line.Positions = m_Positions;
        }
Esempio n. 2
0
        /// <summary>
        /// Reads the next feature from the file.
        /// </summary>
        /// <returns>The next feature (null at end of file).</returns>
        Feature GetNext()
        {
            // Deactivate any feature previously found
            m_Feature = null;

            // While we haven't got to something we can understand do
            while (m_Desc[0]==0)
            {
                // Read the next super-descriptor or descriptor
                ReadArray(m_Desc);

                // Return if no more data in the file
                if ((uint)m_Desc[0]==ECC)
                    return null;

                // If we have a super-descriptor, remember it, and read
                // the graphics descriptor that follows. Otherwise
                // remember that there was no super-descriptor.

                if (m_Desc[Pointers.PDCODE] > OFFSUD)
                {
                    Array.Copy(m_Desc, m_SuperDesc, DESL);
                    ReadArray(m_Desc);
                }
                else
                    m_SuperDesc[0] = 0;

                // Read the data array as well
                Read(m_Desc[Pointers.PDLNST]-DESL, m_Data);

                // Exit loop if the descriptor is something we can parse
                if ( m_Desc[Pointers.PDCODE] == (int)Ntx.DataType.DeltaLine ||
                     m_Desc[Pointers.PDCODE] == (int)Ntx.DataType.Line ||
                     m_Desc[Pointers.PDCODE] == (int)Ntx.DataType.Name ||
                     m_Desc[Pointers.PDCODE] == (int)Ntx.DataType.Symbol)
                    break;

                m_Desc[0] = 0;
            }

            // We now have a graphics descriptor, a data array, and
            // possibly a super-descriptor record. Parse the data.

            switch (m_Desc[Pointers.PDCODE])
            {
                case (int)Ntx.DataType.DeltaLine:
                case (int)Ntx.DataType.Line:
                {
                    SetLine();
                    break;
                }
                case (int)Ntx.DataType.Name:
                {
                    SetName();
                    break;
                }
                case (int)Ntx.DataType.Symbol:
                {
                    SetSymbol();
                    break;
                }
            }

            // If we just generated a symbol, and there are more symbols in
            // the DAD, don't de-activate the DAD. Otherwise de-activate by
            // setting the string length to zero. Note that the symbol
            // constructor adjusts the string length to account for the
            // fact that the symbol has been returned as a feature.

            if ( m_Desc[Pointers.PDCODE] == (int)Ntx.DataType.Symbol &&
                 m_Desc[Pointers.PDLNST] >= (DESL+m_Data[Pointers.PQHLEN]+m_Data[Pointers.PQRLEN]))
            {
                // do nothing
            }
            else
                m_Desc[0] = 0;

            // Return the feature we created.
            Debug.Assert(m_Feature!=null);
            return m_Feature;
        }
Esempio n. 3
0
        /// <summary>
        /// Decodes the current symbol DAD.
        /// </summary>
        private void SetSymbol()
        {
            // Define the symbol as the active feature
            m_Feature = (Feature)m_Symbol;

            // Define characteristics common to all features
            this.SetFeature();

            // The location always refers to the first data group
            m_Symbol.Position = this.FirstPosition;

            // Check if this symbol is a topological node
            m_Symbol.IsNode = this.IsNode;

            // If there are actually more symbols in the DAD, shift them back
            this.RemoveFirstGroup();
        }
Esempio n. 4
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public File()
 {
     m_FileSpec = String.Empty;
     m_File = null;
     m_NextWord = 0;
     m_Feature = null;
     m_Desc[0] = 0;
     m_SuperDesc[0] = 0;
     m_Data[0] = 0;
     m_BytesRead = 0;
     m_NumPosition = 0;
 }
Esempio n. 5
0
        /// <summary>
        /// Decodes the current name DAD.
        /// </summary>
        private void SetName()
        {
            //	Define the name as the active feature
            m_Feature = (Feature)m_Name;

            //	Define characteristics common to all features
            this.SetFeature();

            m_Name.RefPosition = this.RefPosition;
            m_Name.Text = this.NameText;
            m_Name.IsLabel = this.IsLabel;
            m_Name.Height = this.Height;
            //m_Name.Rotation = this.FirstRotation;

            // Hold the position of each character in the file's position list.
            int nchar = m_Name.Count;
            m_NumPosition = 0;

            // Names SHOULDN'T be linked, but let's see what happens if they are ...
            bool islinked = this.LoadPositions();
            while (islinked)
            {
                islinked = this.LoadPositions();
            }

            m_Name.Positions = m_Positions;
        }