예제 #1
0
        private static VectorLayer CreateLayer(string connstr, string name, VectorStyle style)
        {
            if (connstr == null)
            {
                throw new ArgumentNullException("connstr");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }


            SqlServer2008 source = new SqlServer2008(connstr, name, "geom", "ID")
            {
                ValidateGeometries = true
            };
            ICoordinateTransformation transformation = ProjHelper.LatLonToGoogle();
            VectorLayer item = new VectorLayer(name, source)
            {
                SRID       = 4326,
                TargetSRID = 900913,
                CoordinateTransformation = transformation,
                Style         = style,
                SmoothingMode = SmoothingMode.AntiAlias,
            };

            return(item);
        }
예제 #2
0
        private static VectorLayer CreateLayer(string connstr, string name, VectorStyle style)
        {
            if (connstr == null)
            {
                throw new ArgumentNullException("connstr");
            }
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }


            var source = new SqlServer2008(connstr, name, "geom", "ID",
                                           SqlServerSpatialObjectType.Geometry, 0, SqlServer2008ExtentsMode.QueryIndividualFeatures)
            {
                ValidateGeometries = true
            };
            var transformation = ProjHelper.LatLonToGoogle();
            var item           = new VectorLayer(name, source)
            {
                SRID       = 4326,
                TargetSRID = 900913,
                CoordinateTransformation = transformation,
                Style         = style,
                SmoothingMode = SmoothingMode.AntiAlias,
            };

            return(item);
        }
예제 #3
0
        public void TestSqlServer2008()
        {
            var sql2008S = new SqlServer2008("Data Source=IVV-SQLD; Database=OBE;Integrated Security=SSPI;",
                                             "roads", "wkb_geometry", "ogc_fid", SqlServerSpatialObjectType.Geometry);

            var sql2008D = SandD(sql2008S, GetFormatter());

            Assert.AreEqual(sql2008S.ConnectionString, sql2008D.ConnectionString);
            Assert.AreEqual(sql2008S.Table, sql2008D.Table);
            Assert.AreEqual(sql2008S.TableSchema, sql2008D.TableSchema);
            Assert.AreEqual(sql2008S.GeometryColumn, sql2008D.GeometryColumn);
            Assert.AreEqual(sql2008S.ObjectIdColumn, sql2008D.ObjectIdColumn);
            Assert.AreEqual(sql2008S.SpatialObjectType, sql2008D.SpatialObjectType);
            Assert.AreEqual(sql2008S.SRID, sql2008D.SRID);
        }
예제 #4
0
        public void TestSqlServer2008(SqlServerSpatialObjectType spatialType)
        {
            var sql2008S = new SqlServer2008("Data Source=IVV-SQLD; Database=OBE;Integrated Security=SSPI;",
                                             "roads", "spatialCol", "idCol",
                                             spatialType,
                                             4326,
                                             SqlServer2008ExtentsMode.EnvelopeAggregate);

            var sql2008D = SandD(sql2008S, GetFormatter());

            Assert.AreEqual(sql2008S.ConnectionString, sql2008D.ConnectionString);
            Assert.AreEqual(sql2008S.Table, sql2008D.Table);
            Assert.AreEqual(sql2008S.TableSchema, sql2008D.TableSchema);
            Assert.AreEqual(sql2008S.GeometryColumn, sql2008D.GeometryColumn);
            Assert.AreEqual(sql2008S.ObjectIdColumn, sql2008D.ObjectIdColumn);
            Assert.AreEqual(sql2008S.SpatialObjectType, sql2008D.SpatialObjectType);
            Assert.AreEqual(sql2008S.SRID, sql2008D.SRID);
            Assert.AreEqual(sql2008S.ExtentsMode, sql2008D.ExtentsMode);
        }
예제 #5
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello World!");
            Console.WriteLine("--------------------BridgePattern--------------------");
            Console.WriteLine();

            //平台和数据库版本是两个完全不同的维度,平台维度作为数据库的一个成员

            #region 原始写法,每个平台都要写
            //SqlServer2008,Unix平台
            PlatformImplementor unixPlatform2008  = new SqlServer2008UnixImplementor();
            Database            sqlServer2008Unix = new SqlServer2008(unixPlatform2008);
            sqlServer2008Unix.Create();

            //SqlServer2017,Unix平台
            PlatformImplementor unixPlatform2017  = new SqlServer2017UnixImplementor();
            Database            sqlServer2017Unix = new SqlServer2017(unixPlatform2017);
            sqlServer2017Unix.Create();

            //SqlServer2008,Windows平台
            PlatformImplementor windowsPlatform2008  = new SqlServer2008WindowsImplementor();
            Database            sqlServer2008Windows = new SqlServer2008(windowsPlatform2008);
            sqlServer2008Windows.Create();

            //SqlServer2017,Windows平台
            PlatformImplementor windowsPlatform2017  = new SqlServer2017WindowsImplementor();
            Database            sqlServer2017Windows = new SqlServer2017(unixPlatform2017);
            sqlServer2017Windows.Create();

            #endregion


            Console.WriteLine("-----------------------------------------------------");
            #region 数据库版本和平台完全分离的写法
            //unxi平台
            PlatformImplementor unix = new UnixImplementor();
            //Windows平台
            PlatformImplementor windows = new WindowsImplementor();

            //SqlServer2008,Unix平台
            Database sqlServer2008UnixPlatform = new SqlServer2008(unix);
            sqlServer2008UnixPlatform.Create();

            //Sqlserver2017,Unix平台
            Database sqlServer2017UnixPlatform = new SqlServer2017(unix);
            sqlServer2017UnixPlatform.Create();

            //SqlServer2008,Windows平台
            Database sqlServer2008WindowsPlatform = new SqlServer2008(windows);
            sqlServer2008WindowsPlatform.Create();

            //SqlServer2017,Windows平台
            Database sqlServer2017WindowsPlatform = new SqlServer2017(windows);
            sqlServer2017WindowsPlatform.Create();
            Console.WriteLine("-----------------------------------------------------");

            #endregion


            Console.ReadLine();
        }