This version of openlayers adds the following properties to layers:
- Pixels of a layers can be multiplied with a color. New layer methods:
getColor(): goog.color.Rgb
setColor(color: goog.color.Rgb)
- The range of pixel values can be changes by setting the
min
andmax
attributes, which are then used to compute the resulting value according to this formula. Accessors:getMin(): number
,setMin(min: number)
getMax(): number
,setMax(number)
wherenumber
is a float between 0 and 1.
- Each layer can specify if it should be blended additively together with all other layers that are marked as such.
When rendering the current map state, the additive layers are rendered first followed by all other layers.
The default for this property is
false
. The accessors for this property:getAdditiveBlend(): boolean
,setAdditiveBlend(doBlend: boolean): number
,setMax(number)
All of the above properties can be passed to the layer's constructor like standard TissueMAPS layer properties, i.e.:
var layer = ol.layer.TileLayer({
color: [1, 0, 0],
min: 0,
max: 0.8,
additiveBlend: true
});
The properties are added like normal OpenLayers properties to the base class of all layers in the file: ol/layer/layerbase.js
and to the type of the options that are passed to the constructors (ol/externs/olx.js
).
Some of the build steps require Java 8. Also, make sure to If you are on OSX and encounter some problems during the build step, make sure that you are actually running java 8.
java -version
Should be something like:
λ ~/ java -version
java version "1.8.0_31"
Java(TM) SE Runtime Environment (build 1.8.0_31-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.31-b07, mixed mode)
Otherwise install Java 8 and if the output of java -version
doesn't change check that /usr/bin/java
points to /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java
, rather than /System/Library/Frameworks/JavaVM.framework/Versions/Current/Commands/java
.
When drawing maps with drawBlackPixels
set to false
a new fragment shader called ColorFragmentNoBlack is used. This leads to some strange black artifacts which consist of black pixels around drawn edges. This seems to be related to texture filtering.
Changing the following lines in ol/renderer/webgl/webgllayerrenderer.js
bindFramebuffer
-method:
gl.texParameteri(goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_MAG_FILTER,
goog.webgl.LINEAR);
gl.texParameteri(goog.webgl.TEXTURE_2D, goog.webgl.TEXTURE_MIN_FILTER,
goog.webgl.LINEAR);
to:
gl.texParameteri(goog.webgl.TEXTURE_2D,
goog.webgl.TEXTURE_MAG_FILTER, goog.webgl.NEAREST);
gl.texParameteri(goog.webgl.TEXTURE_2D,
goog.webgl.TEXTURE_MIN_FILTER, goog.webgl.NEAREST);
removes some of them, but not all.
For the moment just use additive blending for the segmentation layer.
Colorization of the pixels is done in the fragment shader that is used when nonstandard image properties are used (e.g. an opacity unequal 1 or a color different from [1, 1, 1]
).
These changes were made directly in shader language in the file ol/renderer/webgl/webglmapcolor.glsl
.
IMPORTANT: OpenLayers generates a Shader javascript class by templating. The build tools have to be run after changes to the glsl
files. Sometimes they won't template the new shader classes. If that's the case, delete the old shader class and run the build tools again.
The newly added properties are pushed onto the GPU in the following file: ol/renderer/webgl/webgllayerrenderer.js
.
OpenLayers 3 is a high-performance, feature-packed library for creating interactive maps on the web.
- Download the latest release
- Install with npm:
npm install openlayers
- Clone the repo:
git clone git@github.com:openlayers/ol3.git
Check out the hosted examples, the workshop or API docs.
Please use the GitHub issue tracker for all bugs and feature requests. Before creating a new issue, do a quick search to see if the problem has been reported already.
Please see our guide on contributing if you're interested in getting involved.
- Need help? Find it on stackoverflow using the tag 'openlayers-3'
- Follow @openlayers on Twitter
- Discuss with openlayers users on IRC in
#openlayers
atchat.freenode