Exemplo n.º 1
0
        private void InsertFeatureClassRow(IDbCommand cmd, string name, string displayName, string description, string spatialRef,
                                           int mapscale, string source, string annotable,
                                           Envelope envelope, enumShapeType shapeType, int fetCount)
        {
            string sql = "insert into BGIS_FeatureClass(ID,DATASETID,NAME,DATATABLE,SPATIALREF,CREATETIME," +
                         "MAPSCALE,SOURCE,DESCRIPTION,ANNOTABLE,ENVELOPE,SHAPETYPE,FEATURECOUNT) " +
                         "values('{0}','{1}','{2}','{3}','{4}',{5},{6},'{7}','{8}','{9}',{10},'{11}',{12})";

            if (envelope == null)
            {
                envelope = new Envelope();//empty
            }
            cmd.CommandText = string.Format(sql,
                                            Guid.NewGuid().ToString(),
                                            _datasetId,
                                            displayName,
                                            name,
                                            spatialRef,
                                            _adapter.DateTimeToSql(DateTime.Now),
                                            mapscale.ToString(),
                                            source,
                                            description,
                                            (string.IsNullOrEmpty(annotable)?string.Empty:annotable),
                                            _adapter.GeometryToSQL(envelope.ToPolygon(), SpatialRefToSRID()),
                                            shapeType.ToString(),
                                            fetCount.ToString()
                                            );
            cmd.ExecuteNonQuery();
        }
Exemplo n.º 2
0
        public static string GetStringByShapeType(enumShapeType shapeType)
        {
            switch (shapeType)
            {
            case enumShapeType.Point:
                return("点");

            case enumShapeType.Polyline:
                return("线");

            case enumShapeType.Polygon:
                return("多边形");

            case enumShapeType.NullShape:
                return("空");

            case enumShapeType.MixGeomtry:
                return("混合(点、线、多边形)");

            default:
                throw new NotImplementedException("几何形状\"" + shapeType.ToString() + "\"到字符串的转换未实现。");
            }
        }