@@ -56,6 +56,7 @@ public class TriangleTreeReader {
56
56
private final Tile2D tile2D ;
57
57
private final Extent extent ;
58
58
private int treeOffset ;
59
+ private int docValueOffset ;
59
60
60
61
public TriangleTreeReader (CoordinateEncoder coordinateEncoder ) {
61
62
this .coordinateEncoder = coordinateEncoder ;
@@ -66,6 +67,7 @@ public TriangleTreeReader(CoordinateEncoder coordinateEncoder) {
66
67
67
68
public void reset (BytesRef bytesRef ) throws IOException {
68
69
this .input .reset (bytesRef .bytes , bytesRef .offset , bytesRef .length );
70
+ docValueOffset = bytesRef .offset ;
69
71
treeOffset = 0 ;
70
72
}
71
73
@@ -87,25 +89,25 @@ public Extent getExtent() {
87
89
* returns the X coordinate of the centroid.
88
90
*/
89
91
public double getCentroidX () {
90
- input .setPosition (0 );
92
+ input .setPosition (docValueOffset + 0 );
91
93
return coordinateEncoder .decodeX (input .readInt ());
92
94
}
93
95
94
96
/**
95
97
* returns the Y coordinate of the centroid.
96
98
*/
97
99
public double getCentroidY () {
98
- input .setPosition (4 );
100
+ input .setPosition (docValueOffset + 4 );
99
101
return coordinateEncoder .decodeY (input .readInt ());
100
102
}
101
103
102
104
public DimensionalShapeType getDimensionalShapeType () {
103
- input .setPosition (8 );
105
+ input .setPosition (docValueOffset + 8 );
104
106
return DimensionalShapeType .readFrom (input );
105
107
}
106
108
107
109
public double getSumCentroidWeight () {
108
- input .setPosition (9 );
110
+ input .setPosition (docValueOffset + 9 );
109
111
return Double .longBitsToDouble (input .readVLong ());
110
112
}
111
113
0 commit comments