예제 #1
0
        protected override void WriteSpatialExtentsExpressionSqlInternal(StringBuilder builder,
                                                                         SpatialOperation spatialOperation, IExtents ext)
        {
            IExtents2D exts = (IExtents2D)ext;

            switch (spatialOperation)
            {
            case SpatialOperation.Intersects:
            {
                builder.AppendFormat(
                    " {0}.{1}_Envelope_MinX < {2} AND {0}.{1}_Envelope_MinY < {3} AND {0}.{1}_Envelope_MaxX > {4} AND {0}.{1}_Envelope_MaxY > {5}",
                    Provider.Table,
                    Provider.GeometryColumn,
                    CreateParameter(exts.XMax).ParameterName,
                    CreateParameter(exts.YMax).ParameterName,
                    CreateParameter(exts.XMin).ParameterName,
                    CreateParameter(exts.YMin).ParameterName
                    );
                break;
            }

            default:
                throw new NotImplementedException();
            }
        }
예제 #2
0
        protected override void WriteSpatialExtentsExpressionSqlInternal(StringBuilder builder,
                                                                         SpatialOperation spatialOperation, IExtents ext)
        {
            //IExtents2D exts = (IExtents2D)ext;
            //ST_SetSRID('BOX3D(0 0,1 1)'::box3d,4326)
            String whereClause = "";

            IExtents2D exts =
                (Provider.SpatialReference == null ||
                 Provider.SpatialReference.EqualParams(Provider.OriginalSpatialReference))
                    ?
                (IExtents2D)ext
                    :
                (IExtents2D)Provider.CoordinateTransformation.Inverse.Transform(ext, Provider.GeometryFactory);

            whereClause =
                string.Format(
                    " {0}.ENVELOPESINTERSECT({1}, CAST({2} AS DOUBLE), CAST({3} AS DOUBLE), CAST({4} AS DOUBLE), CAST({5} AS DOUBLE), {6}) = 1",
                    DB2SpatialExtenderProviderStatic.DefaultSpatialSchema,
                    Provider.QualifyColumnName(Provider.GeometryColumn),
                    exts.XMin.ToString("g", CultureInfo.InvariantCulture), //CreateParameter(exts.XMin).ParameterName,
                    exts.YMin.ToString("g", CultureInfo.InvariantCulture), //CreateParameter(exts.YMin).ParameterName,
                    exts.XMax.ToString("g", CultureInfo.InvariantCulture), //CreateParameter(exts.XMax).ParameterName,
                    exts.YMax.ToString("g", CultureInfo.InvariantCulture), //CreateParameter(exts.YMax).ParameterName,
                    ((DB2SpatialExtenderProvider <TOid>)Provider).DB2SrsId);
            builder.Append(whereClause);
        }
        protected internal void RebuildSpatialIndex(IDbConnection conn, SqlServer2008SpatialIndexGridDensity level1,
                                                    SqlServer2008SpatialIndexGridDensity level2,
                                                    SqlServer2008SpatialIndexGridDensity level3,
                                                    SqlServer2008SpatialIndexGridDensity level4)
        {
            Func <SqlServer2008SpatialIndexGridDensity, string> dlgtName =
                delegate(SqlServer2008SpatialIndexGridDensity o)
            {
                switch (o)
                {
                case SqlServer2008SpatialIndexGridDensity.Low:
                    return("LOW");

                case SqlServer2008SpatialIndexGridDensity.Medium:
                    return("MEDIUM");

                default:
                    return("HIGH");
                }
            };

            IExtents2D ext = GetExtents() as IExtents2D;

            StringBuilder sb = new StringBuilder();

            string ndxName = string.Format("[sidx_{0}_{1}]", Table, GeometryColumn);

            sb.AppendFormat(
                @"IF EXISTS(SELECT * FROM sys.indexes where name='{0}' and object_id = object_id('{1}'))
BEGIN
DROP INDEX {0} ON {1}
END
",
                ndxName, QualifiedTableName);

            sb.AppendFormat(CultureInfo.InvariantCulture,
                            @"CREATE SPATIAL INDEX {0}
   ON {2}({1})
   USING GEOMETRY_GRID
   WITH (
    BOUNDING_BOX = ( xmin={3}, ymin={4}, xmax={5}, ymax={6} ),
    GRIDS = ({7}, {8}, {9}, {10}));
",
                            ndxName, GeometryColumn, QualifiedTableName, ext.Min[Ordinates.X], ext.Min[Ordinates.Y],
                            ext.Max[Ordinates.X], ext.Max[Ordinates.Y], dlgtName(level1), dlgtName(level2),
                            dlgtName(level3),
                            dlgtName(level4));

            using (IDbCommand cmd = conn.CreateCommand())
            {
                cmd.CommandText = sb.ToString();
                cmd.CommandType = CommandType.Text;
                cmd.ExecuteNonQuery();
            }
        }
예제 #4
0
        private void Zoom(double amount)
        {
            IExtents2D ext = (IExtents2D)MapView.ViewEnvelope.Clone();
            double     dx, dy;

            dx = ext.Width * amount / 2;
            dy = ext.Height * amount / 2;
            ICoordinate2D c = (ICoordinate2D)ext.Center;

            MapView.ZoomToWorldBounds(ext.Factory.CreateExtents2D(c.X - dx, c.Y - dy, c.X + dx, c.Y + dy));
        }
예제 #5
0
        private void onRequestViewEnvelopeChange(IExtents2D current, IExtents2D requested)
        {
            EventHandler <MapViewPropertyChangeEventArgs <IExtents2D> > e = ViewEnvelopeChangeRequested;

            if (e != null)
            {
                MapViewPropertyChangeEventArgs <IExtents2D> args =
                    new MapViewPropertyChangeEventArgs <IExtents2D>(current, requested);

                e(this, args);
            }
        }
예제 #6
0
        private void onRequestZoomToWorldBounds(IExtents2D zoomBox)
        {
            EventHandler <MapViewPropertyChangeEventArgs <IExtents2D> > e = ZoomToWorldBoundsRequested;

            if (e != null)
            {
                MapViewPropertyChangeEventArgs <IExtents2D> args =
                    new MapViewPropertyChangeEventArgs <IExtents2D>(ViewEnvelope, zoomBox);

                e(this, args);
            }
        }
예제 #7
0
        private static XmlElement GenerateBoundingBoxElement(IExtents2D bbox, string Srid,
                                                             XmlDocument doc)
        {
            XmlElement xmlBbox = doc.CreateElement("BoundingBox", wmsNamespaceURI);

            xmlBbox.Attributes.Append(CreateAttribute("minx", bbox.XMin.ToString(NumberFormatInfo.InvariantInfo), doc));
            xmlBbox.Attributes.Append(CreateAttribute("miny", bbox.YMin.ToString(NumberFormatInfo.InvariantInfo), doc));
            xmlBbox.Attributes.Append(CreateAttribute("maxx", bbox.XMax.ToString(NumberFormatInfo.InvariantInfo), doc));
            xmlBbox.Attributes.Append(CreateAttribute("maxy", bbox.YMax.ToString(NumberFormatInfo.InvariantInfo), doc));
            xmlBbox.Attributes.Append(CreateAttribute("CRS", "EPSG:" + Srid, doc));
            return(xmlBbox);
        }
예제 #8
0
        protected override void WriteSpatialExtentsExpressionSqlInternal(StringBuilder builder,
                                                                         SpatialOperation spatialOperation, IExtents ext)
        {
            IExtents2D exts = (IExtents2D)ext;

            builder.Append(string.Format(" Mbr{0}( BuildMbr({1}, {2}, {3}, {4}),{5} )",
                                         spatialOperation.ToString(),
                                         CreateParameter <double>(exts.XMin).ParameterName,
                                         CreateParameter <double>(exts.YMin).ParameterName,
                                         CreateParameter <double>(exts.XMax + 1.0e-6).ParameterName,
                                         CreateParameter <double>(exts.YMax + 1.0e-6).ParameterName,
                                         Provider.GeometryColumn));
        }
        protected override void WriteSpatialExtentsExpressionSqlInternal(StringBuilder builder,
                                                                         SpatialOperation spatialOperation, IExtents ext)
        {
            IExtents2D exts = (IExtents2D)ext;
            //ST_SetSRID('BOX3D(0 0,1 1)'::box3d,4326)
            String whereClause = "";

            whereClause = string.Format(" {5} && ST_SetSRID('BOX3D({0} {1}, {2} {3})'::box3d, {4})",
                                        String.Format(CultureInfo.InvariantCulture, "{0}",
                                                      CreateParameter(exts.XMin).Value),
                                        //CreateParameter(exts.XMin).ParameterName,
                                        String.Format(CultureInfo.InvariantCulture, "{0}",
                                                      CreateParameter(exts.YMin).Value),
                                        //CreateParameter(exts.YMin).ParameterName,
                                        String.Format(CultureInfo.InvariantCulture, "{0}",
                                                      CreateParameter(exts.XMax).Value),
                                        //CreateParameter(exts.XMax).ParameterName,
                                        String.Format(CultureInfo.InvariantCulture, "{0}",
                                                      CreateParameter(exts.YMax).Value),
                                        //CreateParameter(exts.YMax).ParameterName,
                                        exts.SpatialReference.AuthorityCode,
                                        Provider.QualifyColumnName(Provider.GeometryColumn));
            builder.Append(whereClause);
        }
예제 #10
0
 public void ZoomToWorldBounds(IExtents2D zoomBox)
 {
     onRequestZoomToWorldBounds(zoomBox);
 }
예제 #11
0
 internal void ZoomToWorldBounds(IExtents2D zoomBox)
 {
     ZoomToWorldBoundsInternal(zoomBox);
 }
예제 #12
0
        private void onRequestViewEnvelopeChange(IExtents2D current, IExtents2D requested)
        {
            EventHandler<MapViewPropertyChangeEventArgs<IExtents2D>> e = ViewEnvelopeChangeRequested;

            if (e != null)
            {
                MapViewPropertyChangeEventArgs<IExtents2D> args =
                    new MapViewPropertyChangeEventArgs<IExtents2D>(current, requested);

                e(this, args);
            }
        }
예제 #13
0
 internal void ZoomToWorldBounds(IExtents2D zoomBox)
 {
     ZoomToWorldBoundsInternal(zoomBox);
 }
예제 #14
0
 protected override void SetViewEnvelope(IExtents2D fromEnvelope, IExtents2D toEnvelope)
 {
 }
예제 #15
0
        private void onRequestZoomToWorldBounds(IExtents2D zoomBox)
        {
            EventHandler<MapViewPropertyChangeEventArgs<IExtents2D>> e = ZoomToWorldBoundsRequested;

            if (e != null)
            {
                MapViewPropertyChangeEventArgs<IExtents2D> args =
                    new MapViewPropertyChangeEventArgs<IExtents2D>(ViewEnvelope, zoomBox);

                e(this, args);
            }
        }
예제 #16
0
 private static XmlElement GenerateBoundingBoxElement(IExtents2D bbox, string Srid,
                                                      XmlDocument doc)
 {
     XmlElement xmlBbox = doc.CreateElement("BoundingBox", wmsNamespaceURI);
     xmlBbox.Attributes.Append(CreateAttribute("minx", bbox.XMin.ToString(NumberFormatInfo.InvariantInfo), doc));
     xmlBbox.Attributes.Append(CreateAttribute("miny", bbox.YMin.ToString(NumberFormatInfo.InvariantInfo), doc));
     xmlBbox.Attributes.Append(CreateAttribute("maxx", bbox.XMax.ToString(NumberFormatInfo.InvariantInfo), doc));
     xmlBbox.Attributes.Append(CreateAttribute("maxy", bbox.YMax.ToString(NumberFormatInfo.InvariantInfo), doc));
     xmlBbox.Attributes.Append(CreateAttribute("CRS", "EPSG:" + Srid, doc));
     return xmlBbox;
 }
예제 #17
0
 public void ZoomToWorldBounds(IExtents2D zoomBox)
 {
     onRequestZoomToWorldBounds(zoomBox);
 }