コード例 #1
0
ファイル: UtilityClass.cs プロジェクト: guchanghai/Cut
 //---------------------------------------------------------------------------------------
 //
 //        ���ܣ�GetPropertyType()������GetPropertyName()������ʹ��
 //
 //         ���ߣ�
 //
 //         ���ڣ� 2007.5.23
 //        
 //         �޸���ʷ����
 //        
 //---------------------------------------------------------------------------------------
 public void OutputReader(MgFeatureReader featureReader)
 {
     while (featureReader.ReadNext())
        {
            int propCount = featureReader.GetPropertyCount();
            for (int j = 0; j < propCount; j++)
            {
                string propertyName = featureReader.GetPropertyName(j);
                bool boolVal = featureReader.IsNull(propertyName);
                if (boolVal)
                {
                    continue;
                }
                //MgPropertyType propertyType = (MgPropertyType)featureReader.GetPropertyType(propertyName);
                int proType = featureReader.GetPropertyType(propertyName);
                GetPropertyValue(featureReader, proType, propertyName);
            }
        }
 }
コード例 #2
0
ファイル: IPropertyPane.cs プロジェクト: kanbang/Colt
        private MgFeature CreateFeatureFromReader(MgFeatureReader reader)
        {
            var feature = new MgFeature();
            var hash = feature.Properties;
            for (int i = 0; i < reader.GetPropertyCount(); i++)
            {
                var pt = reader.GetPropertyType(i);
                //Skip un-presentable types
                if (pt == MgPropertyType.Null ||
                    pt == MgPropertyType.Raster ||
                    pt == MgPropertyType.Blob ||
                    pt == MgPropertyType.Feature ||
                    pt == MgPropertyType.Clob)
                    continue;

                string name = reader.GetPropertyName(i);

                if (reader.IsNull(i))
                {
                    hash[name] = null;
                }
                else
                {
                    switch (pt)
                    {
                        case MgPropertyType.Boolean:
                            hash[name] = reader.GetBoolean(i);
                            break;
                        case MgPropertyType.Byte:
                            hash[name] = reader.GetByte(i);
                            break;
                        case MgPropertyType.DateTime:
                            {
                                var dt = reader.GetDateTime(i);
                                hash[name] = new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, 0);
                            }
                            break;
                        case MgPropertyType.Double:
                        case MgPropertyType.Decimal:
                            hash[name] = reader.GetDouble(i);
                            break;
                        case MgPropertyType.Int16:
                            hash[name] = reader.GetInt16(i);
                            break;
                        case MgPropertyType.Int32:
                            hash[name] = reader.GetInt32(i);
                            break;
                        case MgPropertyType.Int64:
                            hash[name] = reader.GetInt64(i);
                            break;
                        case MgPropertyType.Single:
                            hash[name] = reader.GetSingle(i);
                            break;
                        case MgPropertyType.String:
                            hash[name] = reader.GetString(i);
                            break;
                        case MgPropertyType.Geometry:
                            {
                                MgByteReader agf = reader.GetGeometry(i);
                                feature.Geometry = _agfRw.Read(agf);
                            }
                            break;
                    }
                }
            }
            return feature;
        }
コード例 #3
0
ファイル: IPropertyPane.cs プロジェクト: achilex/MgDev
        private MgFeature CreateFeatureFromReader(MgFeatureReader reader)
        {
            var feature = new MgFeature();
            var hash    = feature.Properties;

            for (int i = 0; i < reader.GetPropertyCount(); i++)
            {
                var pt = reader.GetPropertyType(i);
                //Skip un-presentable types
                if (pt == MgPropertyType.Null ||
                    pt == MgPropertyType.Raster ||
                    pt == MgPropertyType.Blob ||
                    pt == MgPropertyType.Feature ||
                    pt == MgPropertyType.Clob)
                {
                    continue;
                }

                string name = reader.GetPropertyName(i);

                if (reader.IsNull(i))
                {
                    hash[name] = null;
                }
                else
                {
                    switch (pt)
                    {
                    case MgPropertyType.Boolean:
                        hash[name] = reader.GetBoolean(i);
                        break;

                    case MgPropertyType.Byte:
                        hash[name] = reader.GetByte(i);
                        break;

                    case MgPropertyType.DateTime:
                    {
                        var dt = reader.GetDateTime(i);
                        hash[name] = new DateTime(dt.Year, dt.Month, dt.Day, dt.Hour, dt.Minute, dt.Second, 0);
                    }
                    break;

                    case MgPropertyType.Double:
                    case MgPropertyType.Decimal:
                        hash[name] = reader.GetDouble(i);
                        break;

                    case MgPropertyType.Int16:
                        hash[name] = reader.GetInt16(i);
                        break;

                    case MgPropertyType.Int32:
                        hash[name] = reader.GetInt32(i);
                        break;

                    case MgPropertyType.Int64:
                        hash[name] = reader.GetInt64(i);
                        break;

                    case MgPropertyType.Single:
                        hash[name] = reader.GetSingle(i);
                        break;

                    case MgPropertyType.String:
                        hash[name] = reader.GetString(i);
                        break;

                    case MgPropertyType.Geometry:
                    {
                        MgByteReader agf = reader.GetGeometry(i);
                        feature.Geometry = _agfRw.Read(agf);
                    }
                    break;
                    }
                }
            }
            return(feature);
        }