Skip to content

Commit 89d1abc

Browse files
committed
Merge pull request #133 from gberaudo/geometry_offset_core
Geometry offset core
2 parents 85c23ea + 55e929e commit 89d1abc

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/core.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,24 @@ goog.require('olcs.core.OlLayerPrimitive');
2424
*/
2525
olcs.core.glAliasedLineWidthRange = -1;
2626

27+
/**
28+
*
29+
* @param {!ol.geom.Geometry} geometry
30+
* @param {number} height
31+
* @api
32+
*/
33+
olcs.core.applyHeightOffsetToGeometry = function(geometry, height) {
34+
geometry.applyTransform(function(input, output, stride) {
35+
goog.asserts.assert(input === output);
36+
if (goog.isDef(stride) && stride >= 3) {
37+
for (var i = 0; i < output.length; i += stride) {
38+
output[i + 2] = output[i + 2] + height;
39+
}
40+
}
41+
return output;
42+
});
43+
};
44+
2745

2846
/**
2947
* Get 3D positiion of the point at the bottom-center of the screen.

0 commit comments

Comments
 (0)