feat: execute ordered S-52 runtime rules
This commit is contained in:
@@ -76,6 +76,7 @@
|
||||
</div>
|
||||
|
||||
<script src="/assets/maplibre-gl.js"></script>
|
||||
<script src="/s52_runtime_executor.js"></script>
|
||||
<script>
|
||||
const REFERENCE_STYLE =
|
||||
"https://pbf.jpcn.ccwu.cc/style/style.navsea-delivery-full-semantic-extentfix.json";
|
||||
@@ -129,8 +130,10 @@ const RUNTIME_HAZARD_SOURCE_LAYERS=[
|
||||
"s52_points"
|
||||
];
|
||||
let runtimeEffectiveSafetyContourM=null;
|
||||
let runtimeRuleExecutor=null;
|
||||
|
||||
function removeRuntimePreviewLayers(map){
|
||||
if(runtimeRuleExecutor){runtimeRuleExecutor.remove();runtimeRuleExecutor=null;}
|
||||
for(const id of RUNTIME_LAYER_IDS){
|
||||
if(map.getLayer(id))map.removeLayer(id);
|
||||
}
|
||||
@@ -393,11 +396,12 @@ function addRuntimeHazardLayer(map){
|
||||
function installRuntimePreviewLayers(map){
|
||||
removeRuntimePreviewLayers(map);
|
||||
if(!debugRuntimePreview.checked || !map.getSource("cm95"))return;
|
||||
addRuntimeDepthAreaLayer(map);
|
||||
addRuntimeContourLayer(map);
|
||||
addRuntimeSoundingLayer(map);
|
||||
addRuntimeHazardLayer(map);
|
||||
setTimeout(updateRuntimeSafetyContour,0);
|
||||
runtimeRuleExecutor=new CM95S52Runtime.RuntimeExecutor(map,{settings:RUNTIME_DEFAULTS});
|
||||
runtimeRuleExecutor.install();
|
||||
}
|
||||
|
||||
function refreshRuntimeRuleExecutor(){
|
||||
if(runtimeRuleExecutor)runtimeRuleExecutor.refresh();
|
||||
}
|
||||
|
||||
const CA_COLOR = Object.freeze({
|
||||
@@ -720,12 +724,12 @@ leftMap.on("sourcedata",function(e){
|
||||
if(debugRuntimePreview.checked)updateRuntimeSafetyContour();
|
||||
if(e.isSourceLoaded){
|
||||
refreshLightArcFeatures();
|
||||
refreshRuntimeHazards();
|
||||
refreshRuntimeRuleExecutor();
|
||||
}
|
||||
});
|
||||
leftMap.on("idle",function(){
|
||||
refreshLightArcFeatures();
|
||||
refreshRuntimeHazards();
|
||||
refreshRuntimeRuleExecutor();
|
||||
});
|
||||
leftMap.on("render",scheduleLightArcDraw);
|
||||
leftMap.on("resize",scheduleLightArcDraw);
|
||||
|
||||
Reference in New Issue
Block a user