//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @BeforeEach void setup()
        internal virtual void Setup()
        {
            Pair <PointValue, PointValue> collidingPoints = SpatialIndexValueTestUtil.pointsWithSameValueOnSpaceFillingCurve(Config.defaults());

            _point1 = collidingPoints.First();
            _point2 = collidingPoints.Other();
        }
Beispiel #2
0
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: public static <VALUE extends org.neo4j.values.storable.Value> RangePredicate<?> range(int propertyKeyId, VALUE from, boolean fromInclusive, VALUE to, boolean toInclusive)
        public static RangePredicate <object> Range <VALUE>(int propertyKeyId, VALUE from, bool fromInclusive, VALUE to, bool toInclusive) where VALUE : Org.Neo4j.Values.Storable.Value
        {
            if (from == null && to == null)
            {
                throw new System.ArgumentException("Cannot create RangePredicate without at least one bound");
            }

            ValueGroup valueGroup = from != null?from.valueGroup() : to.valueGroup();

            switch (valueGroup.innerEnumValue)
            {
            case ValueGroup.InnerEnum.NUMBER:
                return(new NumberRangePredicate(propertyKeyId, ( NumberValue )from, fromInclusive, ( NumberValue )to, toInclusive));

            case ValueGroup.InnerEnum.TEXT:
                return(new TextRangePredicate(propertyKeyId, ( TextValue )from, fromInclusive, ( TextValue )to, toInclusive));

            case ValueGroup.InnerEnum.GEOMETRY:
                PointValue pFrom = ( PointValue )from;
                PointValue pTo   = ( PointValue )to;
                CoordinateReferenceSystem crs = pFrom != null ? pFrom.CoordinateReferenceSystem : pTo.CoordinateReferenceSystem;
                return(new GeometryRangePredicate(propertyKeyId, crs, pFrom, fromInclusive, pTo, toInclusive));

            default:
//JAVA TO C# CONVERTER WARNING: Java wildcard generics have no direct equivalent in .NET:
//ORIGINAL LINE: return new RangePredicate<>(propertyKeyId, valueGroup, from, fromInclusive, to, toInclusive);
                return(new RangePredicate <object>(propertyKeyId, valueGroup, from, fromInclusive, to, toInclusive));
            }
        }
Beispiel #3
0
        protected internal override void AssertSameDerivedValue(PointValue p1, PointValue p2)
        {
            ConfiguredSpaceFillingCurveSettingsCache settingsFactory = new ConfiguredSpaceFillingCurveSettingsCache(Config.defaults());
            SpaceFillingCurveSettings spaceFillingCurveSettings      = settingsFactory.ForCRS(CoordinateReferenceSystem.WGS84);
            SpaceFillingCurve         curve = spaceFillingCurveSettings.Curve();

            assertEquals(curve.DerivedValueFor(p1.Coordinate()), curve.DerivedValueFor(p2.Coordinate()));
        }
Beispiel #4
0
//JAVA TO C# CONVERTER TODO TASK: Most Java annotations will not have direct .NET equivalent attributes:
//ORIGINAL LINE: @Test void shouldHandlePoints()
        internal virtual void ShouldHandlePoints()
        {
            // Given
            PointValue    pointValue = Values.pointValue(CoordinateReferenceSystem.Cartesian, 11d, 12d);
            PrettyPrinter printer    = new PrettyPrinter();

            // When
            pointValue.WriteTo(printer);

            // Then
            assertThat(printer.Value(), equalTo("{geometry: {type: \"Point\", coordinates: [11.0, 12.0], " + "crs: {type: link, properties: " + "{href: \"http://spatialreference.org/ref/sr-org/7203/\", code: " + "7203}}}}"));
        }
Beispiel #5
0
        public static Pair <PointValue, PointValue> PointsWithSameValueOnSpaceFillingCurve(Config config)
        {
            ConfiguredSpaceFillingCurveSettingsCache configuredCache = new ConfiguredSpaceFillingCurveSettingsCache(config);
            SpaceFillingCurveSettings spaceFillingCurveSettings      = configuredCache.ForCRS(CoordinateReferenceSystem.WGS84);
            SpaceFillingCurve         curve = spaceFillingCurveSettings.Curve();

            double[] origin = new double[] { 0.0, 0.0 };
            long?    spaceFillingCurveMapForOrigin = curve.DerivedValueFor(origin);

            double[]   centerPointForOriginTile = curve.CenterPointFor(spaceFillingCurveMapForOrigin.Value);
            PointValue originValue      = Values.pointValue(CoordinateReferenceSystem.WGS84, origin);
            PointValue centerPointValue = Values.pointValue(CoordinateReferenceSystem.WGS84, centerPointForOriginTile);

            assertThat("need non equal points for this test", origin, not(equalTo(centerPointValue)));
            return(Pair.of(originValue, centerPointValue));
        }
Beispiel #6
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: public void process(org.neo4j.kernel.api.index.IndexEntryUpdate<?> update) throws org.neo4j.kernel.api.exceptions.index.IndexEntryConflictException
        public override void Process <T1>(IndexEntryUpdate <T1> update)
        {
            PointValue value = ( PointValue )update.Values()[0];

            switch (update.UpdateMode())
            {
            case ADDED:
                Select(value.CoordinateReferenceSystem).process(update);
                break;

            case CHANGED:
                // These are both spatial, but could belong in different parts
                PointValue   fromValue = ( PointValue )update.BeforeValues()[0];
                IndexUpdater from      = Select(fromValue.CoordinateReferenceSystem);
                IndexUpdater to        = Select(value.CoordinateReferenceSystem);
                // There are two cases:
                // - both before/after go into the same updater --> pass update into that updater
                if (from == to)
                {
                    from.Process(update);
                }
                // - before go into one and after into the other --> REMOVED from one and ADDED into the other
                else
                {
                    from.Process(IndexEntryUpdate.remove(update.EntityId, update.IndexKey(), update.BeforeValues()));
                    to.Process(IndexEntryUpdate.add(update.EntityId, update.IndexKey(), update.Values()));
                }
                break;

            case REMOVED:
                Select(value.CoordinateReferenceSystem).process(update);
                break;

            default:
                throw new System.ArgumentException("Unknown update mode");
            }
        }
Beispiel #7
0
 public override Value MapPoint(PointValue value)
 {
     throw new CypherTypeException("Don't know how to treat that as a boolean: " + value, null);
 }
 public override AnyValue MapPoint(PointValue value)
 {
     return(value);
 }