Exemple #1
0
        public override Boolean Equals(SpatialExpression other)
        {
            ExtentsExpression extentsExpression = other as ExtentsExpression;

            return(extentsExpression != null && Equals(_extents, extentsExpression._extents));
        }
        private FeatureQueryExpression transformQuery(FeatureQueryExpression query)
        {
            SpatialBinaryExpression spatial = query.SpatialPredicate;
            ICoordinateSystem querySpatialReference = spatial.SpatialExpression.SpatialReference;

            if (querySpatialReference.EqualParams(OriginalSpatialReference))
            {
                return query;
            }

            //if (querySpatialReference != OriginalSpatialReference)
            //{
            //    throw new InvalidOperationException("The query's spatial reference doesn't match the provider's.");
            //}

            GeometryExpression geoExpression = spatial.SpatialExpression as GeometryExpression;

            if (geoExpression != null)
            {
                IGeometry transformed = CoordinateTransformation.InverseTransform(geoExpression.Geometry,
                                                                                  GeometryFactory);
                geoExpression = new GeometryExpression(transformed);
                spatial = spatial.IsSpatialExpressionLeft
                              ? new SpatialBinaryExpression(geoExpression, spatial.Op, spatial.Expression)
                              : new SpatialBinaryExpression(spatial.Expression, spatial.Op, geoExpression);
            }
            else
            {
                IExtents transformed = CoordinateTransformation.InverseTransform(spatial.SpatialExpression.Extents,
                                                                                 GeometryFactory);
                ExtentsExpression extentsExpression = new ExtentsExpression(transformed);
                spatial = spatial.IsSpatialExpressionLeft
                              ? new SpatialBinaryExpression(extentsExpression, spatial.Op, spatial.Expression)
                              : new SpatialBinaryExpression(spatial.Expression, spatial.Op, extentsExpression);
            }

            query = new FeatureQueryExpression(query, spatial);
            return query;
        }