private IFeature[] GetFeatureArray(MgFeatureReader reader, string name)
        {
            MgFeatureReader nr       = reader.GetFeatureObject(name);
            var             lr       = new LocalNativeFeatureReader(nr);
            List <IFeature> features = new List <IFeature>(lr);

            return(features.ToArray());
        }
Exemplo n.º 2
0
        /// <summary>Получает набор свойств MgPropertyCollection из текущей записи _reader в соответствии со списком _listed_prop_defs</summary>
        /// <param name="_reader"></param>
        /// <param name="_listed_prop_defs"></param>
        /// <returns></returns>
        internal static MgPropertyCollection GetPropertiesFromReader(MgFeatureReader _reader, MgPropertyDefinitionCollection _listed_prop_defs)
        {
            MgPropertyCollection result_props = new MgPropertyCollection();

            MgPropertyDefinitionCollection reader_prop_defs = _reader.GetClassDefinition().GetProperties();

            foreach (MgPropertyDefinition curr_prop_def in _listed_prop_defs)
            {
                if (!reader_prop_defs.Contains(curr_prop_def.Name) || _reader.IsNull(curr_prop_def.Name))
                {
                    continue;
                }

                int property_type = _reader.GetPropertyType(curr_prop_def.Name);
                if (property_type == MgPropertyType.Blob)
                {
                    result_props.Add(
                        new MgBlobProperty(curr_prop_def.Name, _reader.GetBLOB(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.Boolean)
                {
                    result_props.Add(
                        new MgBooleanProperty(curr_prop_def.Name, _reader.GetBoolean(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.Byte)
                {
                    result_props.Add(
                        new MgByteProperty(curr_prop_def.Name, _reader.GetByte(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.Clob)
                {
                    result_props.Add(
                        new MgClobProperty(curr_prop_def.Name, _reader.GetCLOB(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.DateTime)
                {
                    result_props.Add(
                        new MgDateTimeProperty(curr_prop_def.Name, _reader.GetDateTime(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.Double)
                {
                    result_props.Add(
                        new MgDoubleProperty(curr_prop_def.Name, _reader.GetDouble(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.Feature)
                {
                    result_props.Add(
                        new MgFeatureProperty(curr_prop_def.Name, _reader.GetFeatureObject(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.Geometry)
                {
                    result_props.Add(
                        new MgGeometryProperty(curr_prop_def.Name, _reader.GetGeometry(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.Int16)
                {
                    result_props.Add(
                        new MgInt16Property(curr_prop_def.Name, _reader.GetInt16(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.Int32)
                {
                    result_props.Add(
                        new MgInt32Property(curr_prop_def.Name, _reader.GetInt32(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.Int64)
                {
                    result_props.Add(
                        new MgInt64Property(curr_prop_def.Name, _reader.GetInt64(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.Raster)
                {
                    result_props.Add(
                        new MgRasterProperty(curr_prop_def.Name, _reader.GetRaster(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.Single)
                {
                    result_props.Add(
                        new MgSingleProperty(curr_prop_def.Name, _reader.GetSingle(curr_prop_def.Name))
                        );
                }
                else if (property_type == MgPropertyType.String)
                {
                    result_props.Add(
                        new MgStringProperty(curr_prop_def.Name, _reader.GetString(curr_prop_def.Name))
                        );
                }
            }              //foreach

            return(result_props);
        }
Exemplo n.º 3
0
 private IFeature[] GetFeatureArray(MgFeatureReader reader, string name)
 {
     MgFeatureReader nr = reader.GetFeatureObject(name);
     var lr = new LocalNativeFeatureReader(nr);
     List<IFeature> features = new List<IFeature>(lr);
     return features.ToArray();
 }
Exemplo n.º 4
0
 //---------------------------------------------------------------------------------------
 //
 //        ���ܣ�δ֪��ѯ����е��������ݵ����͵Ĵ������
 //
 //
 //         ���ߣ�
 //
 //         ���ڣ� 2007.5.23
 //        
 //         �޸���ʷ����
 //        
 //---------------------------------------------------------------------------------------
 public void GetPropertyValue(MgFeatureReader featureReader, int propertyType, string propertyName)
 {
     switch (propertyType )
        {
            case MgPropertyType.Null:
                break;
            case MgPropertyType.Boolean:
                bool val1 = featureReader.GetBoolean(propertyName);
                break;
            case MgPropertyType.Byte:
                Byte val2 = featureReader.GetByte(propertyName);
                break;
            case MgPropertyType.DateTime:
                MgDateTime val3 = featureReader.GetDateTime(propertyName);
                break;
            case MgPropertyType.Single:
                float val4 = featureReader.GetSingle(propertyName);
                break;
            case MgPropertyType.Double:
                double val5 = featureReader.GetDouble(propertyName);
                break;
            case MgPropertyType.Int16:
                Int16 val6 = featureReader.GetInt16(propertyName);
                break;
            case MgPropertyType.Int32:
                Int32 val7 = featureReader.GetInt32(propertyName);
                break;
            case MgPropertyType.Int64:
                Int64 val8 = featureReader.GetInt64(propertyName);
                break;
            case MgPropertyType.String:
                string val9 = featureReader.GetString(propertyName);
                break;
            case MgPropertyType.Blob:
                string val10 = propertyName + " ��Blob����";
                break;
            case MgPropertyType.Clob:
                string val11 = propertyName + " ��Clob����";
                break;
            case MgPropertyType.Feature:
                MgFeatureReader val12 = featureReader.GetFeatureObject(propertyName);
                break;
            case MgPropertyType.Geometry:
                MgByteReader va13l = featureReader.GetGeometry(propertyName);
                MgAgfReaderWriter agfReader = new MgAgfReaderWriter();
                MgGeometry districtGeometry = agfReader.Read(va13l);
                break;
            case MgPropertyType.Raster:
                MgRaster val14 = featureReader.GetRaster(propertyName) ;
                break;
            default:
                string val13 =  "δ֪����";
                break;
        }
 }