示例#1
0
        private void ReadElementInstanceBinary( PLYElementDescription elementDescription )
        {
            string elementName = elementDescription.ElementName;
            foreach( string propertyName in elementDescription.PropertyNames )
            {
                int listLength = ReadListLength( elementDescription, propertyName );
                OnPropertyBegin( elementName, propertyName, listLength );

                PLYScalarType dataType = elementDescription.PropertyDataType( propertyName );
                for( int i = 0; i < listLength; ++i )
                {
                    switch( dataType )
                    {
                        case PLYScalarType.BYTE:
                        {
                            byte val = ReadByteBinary();
                            OnByteRead( elementName, propertyName, i, val );
                            break;
                        }

                        case PLYScalarType.INT:
                        {
                            int val = ReadIntBinary();
                            OnIntRead( elementName, propertyName, i, val );
                            break;
                        }

                        case PLYScalarType.FLOAT:
                        {
                            float val = ReadFloatBinary();
                            OnFloatRead( elementName, propertyName, i, val );
                            break;
                        }

                        case PLYScalarType.DOUBLE:
                        {
                            double val = ReadDoubleBinary();
                            OnDoubleRead( elementName, propertyName, i, val );
                            break;
                        }

                        default:
                            throw new NotImplementedException( "Sorry, I need to implement reading other types" );
                    }
                }

                OnPropertyEnd( elementName, propertyName, listLength );
            }
        }