forked from Viglino/ol-ext
-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUG] chart and pixelratio Viglino#1109
- Loading branch information
Showing
3 changed files
with
40 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,14 @@ | |
|
||
<!-- Openlayers --> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@latest/ol.css" /> | ||
|
||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ol@latest/dist/ol.js"></script> | ||
<!-- | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"></script> | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"></script> | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"></script> | ||
<script type="text/javascript" src="https://openlayers.org/en/v6.15.1/build/ol.js"></script> | ||
--> | ||
|
||
|
||
<!-- ol-ext --> | ||
|
@@ -117,6 +124,7 @@ <h2>Select options:</h2> | |
var data = [0,0,0,0]; | ||
for (var i=0, f; f=features[i]; i++) data[f.get('type')]++; | ||
var style = styleCache[data.join(',')]; | ||
style = false; | ||
if (!style) { | ||
var radius = Math.min(size+7, 20); | ||
style = styleCache[data.join(',')] = new ol.style.Style({ | ||
|
@@ -235,7 +243,6 @@ <h2>Select options:</h2> | |
}) | ||
|
||
function testFontLoaded () { | ||
console.log('TEST', $(".maki-bus").width()) | ||
// Loaded ? | ||
if ($(".maki-bus").width() > 60) { | ||
styleCache = {}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,15 @@ | |
|
||
<!-- Openlayers --> | ||
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/ol@latest/ol.css" /> | ||
|
||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/ol@latest/dist/ol.js"></script> | ||
|
||
<!-- | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"></script> | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"></script> | ||
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/[email protected]/dist/ol.js"></script> | ||
<script type="text/javascript" src="https://openlayers.org/en/v6.15.1/build/ol.js"></script> | ||
--> | ||
|
||
|
||
<!-- ol-ext --> | ||
|
@@ -83,8 +91,11 @@ <h2>Options:</h2> | |
var styleCache = {}; | ||
|
||
function getFeatureStyle (feature, sel) { | ||
var k = $("#graph").val()+"-"+ $("#color").val()+"-"+(sel?"1-":"")+feature.get("data"); | ||
var style = styleCache[k]; | ||
var key = $("#graph").val() | ||
+"-"+ $("#color").val() | ||
+"-"+ (sel?"sel":"nsel") | ||
+"-"+ feature.get("data").join('-'); | ||
var style = styleCache[key]; | ||
if (!style) { | ||
var radius = 15; | ||
// area proportional to data size: s=PI*r^2 | ||
|
@@ -93,7 +104,7 @@ <h2>Options:</h2> | |
} | ||
// Create chart style | ||
var c = $("#color").val(); | ||
styleCache[k] = style = [ | ||
styleCache[key] = style = [ | ||
new ol.style.Style({ | ||
image: new ol.style.Chart({ | ||
type: $("#graph").val(), | ||
|
@@ -113,14 +124,22 @@ <h2>Options:</h2> | |
}) | ||
}), | ||
/* | ||
new ol.style.Style({ | ||
text: new ol.style.Text({ | ||
text: key,//feature.get("data").join('-'), | ||
fill: new ol.style.Fill({ | ||
color: '#000' | ||
}) | ||
}) | ||
}), | ||
new ol.style.Style({ | ||
image: new ol.style.Circle({ | ||
radius: 5, | ||
stroke: new ol.style.Stroke({ color: '#fff', width: 1.5 }), | ||
fill: new ol.style.Fill({ color: '#f00' }) | ||
}) | ||
}) | ||
*/ | ||
/**/ | ||
]; | ||
} | ||
style[0].getImage().setAnimation(animation); | ||
|
@@ -189,7 +208,7 @@ <h2>Options:</h2> | |
//map.renderSync(); | ||
} | ||
|
||
doAnimate(); | ||
// doAnimate(); | ||
</script> | ||
|
||
</body> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters