Skip to content

Commit

Permalink
Add rendering test for rotated image vector clipping with intersection
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Jul 30, 2020
1 parent 562b2f6 commit 5a86e1a
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
import Feature from '../../../src/ol/Feature.js';
import Map from '../../../src/ol/Map.js';
import Point from '../../../src/ol/geom/Point.js';
import VectorImageLayer from '../../../src/ol/layer/VectorImage.js';
import VectorSource from '../../../src/ol/source/Vector.js';
import View from '../../../src/ol/View.js';
import {Fill, RegularShape, Stroke, Style} from '../../../src/ol/style.js';
import {fromExtent} from '../../../src/ol/geom/Polygon.js';

const extent = [
1900e3 - 100000,
6300e3 - 100000,
1900e3 + 100000,
6300e3 + 100000,
];

const pt1 = new Feature({
name: 'point',
geometry: new Point([1900e3, 6300e3]),
});
pt1.setStyle(
new Style({
image: new RegularShape({
points: 4,
radius: 20,
fill: new Fill({
color: 'fuchsia',
}),
}),
})
);

const border = new Feature({
name: 'extent border',
geometry: fromExtent(extent),
});

new Map({
layers: [
new VectorImageLayer({
style: new Style({
stroke: new Stroke({
color: 'yellow',
width: 20,
}),
}),
source: new VectorSource({
features: [border],
}),
}),
new VectorImageLayer({
style: new Style({
stroke: new Stroke({
color: 'green',
width: 20,
}),
}),
source: new VectorSource({
features: [pt1, border],
}),
extent: extent,
}),
],
target: 'map',
view: new View({
center: [1900e3, 6300e3],
zoom: 7,
rotation: Math.PI / 4,
}),
});

render();

0 comments on commit 5a86e1a

Please sign in to comment.