protected SpatialAnalysisExpression(GeometryExpression expressionLeft, SpatialAnalysisOperation operation,
                                     Expression expressionRight)
 {
     _leftExpression  = expressionLeft;
     _rightExpression = expressionRight;
     _operation       = operation;
 }
Exemplo n.º 2
0
        public override Boolean Equals(SpatialExpression other)
        {
            GeometryExpression geometryExpression = other as GeometryExpression;

            return(geometryExpression != null && Equals(_geometry, geometryExpression._geometry));
        }
        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;
        }