コード例 #1
0
ファイル: GeometryType.cs プロジェクト: Neo4Net/Neo4Net
        internal override Value AsValue(GenericKey state)
        {
            AssertHasCoordinates(state);
            CoordinateReferenceSystem crs = CoordinateReferenceSystem.get(( int )state.Long1, ( int )state.Long2);

            return(AsValue(state, crs, 0));
        }
コード例 #2
0
//JAVA TO C# CONVERTER WARNING: Method 'throws' clauses are not available in C#:
//ORIGINAL LINE: private org.neo4j.values.storable.PointValue unpackPoint3D() throws java.io.IOException
            internal virtual PointValue UnpackPoint3D()
            {
                int crsCode = UnpackInteger();
                CoordinateReferenceSystem crs = CoordinateReferenceSystem.get(crsCode);

                double[] coordinates = new double[] { UnpackDouble(), UnpackDouble(), UnpackDouble() };
                return(pointValue(crs, coordinates));
            }
コード例 #3
0
ファイル: GeometryArrayType.cs プロジェクト: Neo4Net/Neo4Net
 internal override Value AsValue(GenericKey state)
 {
     Point[] points = new Point[state.ArrayLength];
     if (points.Length > 0)
     {
         assertHasCoordinates(state);
         CoordinateReferenceSystem crs = CoordinateReferenceSystem.get(( int )state.Long1, ( int )state.Long2);
         int dimensions = dimensions(state);
         for (int i = 0; i < points.Length; i++)
         {
             points[i] = GeometryType.AsValue(state, crs, dimensions * i);
         }
     }
     return(Values.pointArray(points));
 }
コード例 #4
0
ファイル: SpatialIndexFiles.cs プロジェクト: Neo4Net/Neo4Net
 private void AddExistingFiles(IList <SpatialFile> existing)
 {
     File[] files = _fs.listFiles(_indexDirectory);
     if (files != null)
     {
         foreach (File file in files)
         {
             string  name    = file.Name;
             Matcher matcher = _crsDirPattern.matcher(name);
             if (matcher.matches())
             {
                 int tableId = int.Parse(matcher.group(1));
                 int code    = int.Parse(matcher.group(2));
                 CoordinateReferenceSystem crs = CoordinateReferenceSystem.get(tableId, code);
                 existing.Add(ForCrs(crs));
             }
         }
     }
 }
コード例 #5
0
        private void ReadNext(ByteBuffer headerBytes)
        {
            int tableId = headerBytes.get() & 0xFF;
            int code    = headerBytes.Int;
            CoordinateReferenceSystem crs = CoordinateReferenceSystem.get(tableId, code);

            int maxLevels  = headerBytes.Short & 0xFFFF;
            int dimensions = headerBytes.Short & 0xFFFF;

            double[] min = new double[dimensions];
            double[] max = new double[dimensions];
            for (int i = 0; i < dimensions; i++)
            {
                min[i] = Double.longBitsToDouble(headerBytes.Long);
                max[i] = Double.longBitsToDouble(headerBytes.Long);
            }
            Envelope extents = new Envelope(min, max);

            _settings[crs] = new SpaceFillingCurveSettings(dimensions, extents, maxLevels);
        }
コード例 #6
0
ファイル: GenericKey.cs プロジェクト: Neo4Net/Neo4Net
 public override void WritePoint(CoordinateReferenceSystem crs, double[] coordinate)
 {
     if (!IsArray)
     {
         Type = Types.Geometry;
         UpdateCurve(crs.Table.TableId, crs.Code);
         Types.Geometry.write(this, SpaceFillingCurve.derivedValueFor(coordinate).Value, coordinate);
     }
     else
     {
         if (CurrentArrayOffset == 0)
         {
             UpdateCurve(crs.Table.TableId, crs.Code);
         }
         else if (this.Long1 != crs.Table.TableId || this.Long2 != crs.Code)
         {
             throw new System.InvalidOperationException(format("Tried to assign a geometry array containing different coordinate reference systems, first:%s, violating:%s at array position:%d", CoordinateReferenceSystem.get(( int )Long1, ( int )Long2), crs, CurrentArrayOffset));
         }
         Types.GeometryArray.write(this, CurrentArrayOffset++, SpaceFillingCurve.derivedValueFor(coordinate).Value, coordinate);
     }
 }
コード例 #7
0
        /// <summary>
        /// Gets <seealso cref="SpaceFillingCurve"/> for a particular coordinate reference system's crsTableId and code point.
        /// </summary>
        /// <param name="crsTableId"> table id of the <seealso cref="CoordinateReferenceSystem"/>. </param>
        /// <param name="crsCodePoint"> code of the <seealso cref="CoordinateReferenceSystem"/>. </param>
        /// <param name="assignToIndexIfNotYetAssigned"> whether or not to make a snapshot of this index-specific setting if this is the
        /// first time it's accessed for this index. It will then show up in <seealso cref="visitIndexSpecificSettings(SettingVisitor)"/>. </param>
        /// <returns> the <seealso cref="SpaceFillingCurve"/> for the given coordinate reference system. </returns>
        public virtual SpaceFillingCurve ForCrs(int crsTableId, int crsCodePoint, bool assignToIndexIfNotYetAssigned)
        {
            CoordinateReferenceSystem crs = CoordinateReferenceSystem.get(crsTableId, crsCodePoint);

            return(ForCrs(crs, assignToIndexIfNotYetAssigned));
        }