Exemplo n.º 1
0
        /// <summary>
        /// Reads the collection of vertices using the provided reader
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="header"></param>
        public void Read(BinaryReader reader, TTMHeader header)
        {
            bool readCoordinateFloats  = header.VertexCoordinateSize == sizeof(float);
            bool readVertexValueFloats = header.VertexValueSize == sizeof(float);

            Items = new XYZ[header.NumberOfVertices];

            int loopLimit = header.NumberOfVertices;

            for (int i = 0; i < loopLimit; i++)
            {
                long RecPos = reader.BaseStream.Position;

                if (readCoordinateFloats)
                {
                    Items[i].Y = reader.ReadSingle() + header.NorthingOffsetValue;
                    Items[i].X = reader.ReadSingle() + header.EastingOffsetValue;
                }
                else
                {
                    Items[i].Y = reader.ReadDouble() + header.NorthingOffsetValue;
                    Items[i].X = reader.ReadDouble() + header.EastingOffsetValue;
                }

                Items[i].Z = readVertexValueFloats ? reader.ReadSingle() : reader.ReadDouble();

                //ReadVertex(ref Items[i]);
                reader.BaseStream.Position = RecPos + header.VertexRecordSize;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Reads in the collection of edges from the TIN model using the provided reader
        /// </summary>
        public void Read(BinaryReader reader, TTMHeader header)
        {
            Items = new int[header.NumberOfEdgeRecords];

            int loopLimit = header.NumberOfEdgeRecords;

            for (int i = 0; i < loopLimit; i++)
            {
                long RecPos = reader.BaseStream.Position;
                Items[i] = Utilities.ReadInteger(reader, header.TriangleNumberSize) - 1;
                reader.BaseStream.Position = RecPos + header.EdgeRecordSize;
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// Reads the collection of start points from the TTM file using the provided reader
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="header"></param>
        public void Read(BinaryReader reader, TTMHeader header)
        {
            Items = new TTMStartPoint[header.NumberOfStartPoints];

            void ReadStartPoint(ref TTMStartPoint startPoint)
            {
                startPoint.Y = Utilities.ReadFloat(reader, header.VertexCoordinateSize) + header.NorthingOffsetValue;
                startPoint.X = Utilities.ReadFloat(reader, header.VertexCoordinateSize) + header.EastingOffsetValue;

                startPoint.Triangle = Utilities.ReadInteger(reader, header.TriangleNumberSize) - 1;
            }

            int loopLimit = header.NumberOfStartPoints;

            for (int i = 0; i < loopLimit; i++)
            {
                long RecPos = reader.BaseStream.Position;
                ReadStartPoint(ref Items[i]);
                reader.BaseStream.Position = RecPos + header.StartPointRecordSize;
            }
        }