|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import { setConfig, getConfig, validateConfig } from './mapConfig.js'; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const zoomMin = getConfig('zoom.scaleExtent.0', 0.3); |
|
|
const zoomMax = getConfig('zoom.scaleExtent.1', 3.0); |
|
|
console.log(`Zoom range: ${zoomMin} - ${zoomMax}`); |
|
|
|
|
|
|
|
|
setConfig('zoom.initialScale', 0.9); |
|
|
setConfig('glyph.batchLoading.batchSize', 50); |
|
|
|
|
|
|
|
|
const currentColors = getConfig('color.categories', {}); |
|
|
setConfig('color.categories', { |
|
|
...currentColors, |
|
|
'script': '#e67e22' |
|
|
}); |
|
|
|
|
|
|
|
|
setConfig('centroid.text.fontSize', 18); |
|
|
setConfig('centroid.text.strokeWidth', 6); |
|
|
|
|
|
|
|
|
setConfig('debug.enabled', true); |
|
|
setConfig('debug.verbose', true); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function setHighPerformanceConfig() { |
|
|
setConfig('glyph.batchLoading.batchSize', 100); |
|
|
setConfig('glyph.batchLoading.delay', 5); |
|
|
setConfig('performance.monitoring.enabled', false); |
|
|
setConfig('centroid.behavior.adaptiveSize', false); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function setHighQualityConfig() { |
|
|
setConfig('glyph.batchLoading.batchSize', 20); |
|
|
setConfig('glyph.batchLoading.delay', 20); |
|
|
setConfig('centroid.text.strokeWidth', 6); |
|
|
setConfig('zoom.transitionDuration', 1000); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function setMobileConfig() { |
|
|
setConfig('ui.responsive.adaptiveUI', true); |
|
|
setConfig('glyph.batchLoading.batchSize', 30); |
|
|
setConfig('centroid.text.fontSize', 14); |
|
|
setConfig('ui.positions.leva', { top: 10, left: 10 }); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function setDevelopmentConfig() { |
|
|
setConfig('debug.enabled', true); |
|
|
setConfig('debug.verbose', true); |
|
|
setConfig('performance.monitoring.logLevel', 'debug'); |
|
|
setConfig('data.validation.strictMode', true); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function validateCurrentConfig() { |
|
|
const result = validateConfig(); |
|
|
|
|
|
if (!result.valid) { |
|
|
console.error('Configuration invalide:', result.errors); |
|
|
return false; |
|
|
} |
|
|
|
|
|
if (result.warnings.length > 0) { |
|
|
console.warn('Avertissements de configuration:', result.warnings); |
|
|
} |
|
|
|
|
|
console.log('Configuration valide ✅'); |
|
|
return true; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function showConfigSummary() { |
|
|
console.log('=== RÉSUMÉ DE LA CONFIGURATION ==='); |
|
|
console.log('Zoom:', getConfig('zoom.scaleExtent', [])); |
|
|
console.log('Glyphes par batch:', getConfig('glyph.batchLoading.batchSize', 40)); |
|
|
console.log('Taille de police centroïdes:', getConfig('centroid.text.fontSize', 16)); |
|
|
console.log('Mode debug:', getConfig('debug.enabled', false)); |
|
|
console.log('================================'); |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function saveConfigToStorage() { |
|
|
try { |
|
|
const config = getConfig('', {}); |
|
|
localStorage.setItem('debugUMAP_config', JSON.stringify(config)); |
|
|
console.log('Configuration sauvegardée dans localStorage'); |
|
|
} catch (error) { |
|
|
console.error('Erreur lors de la sauvegarde:', error); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function loadConfigFromStorage() { |
|
|
try { |
|
|
const saved = localStorage.getItem('debugUMAP_config'); |
|
|
if (saved) { |
|
|
const config = JSON.parse(saved); |
|
|
|
|
|
Object.keys(config).forEach(key => { |
|
|
setConfig(key, config[key]); |
|
|
}); |
|
|
console.log('Configuration chargée depuis localStorage'); |
|
|
return true; |
|
|
} |
|
|
} catch (error) { |
|
|
console.error('Erreur lors du chargement:', error); |
|
|
} |
|
|
return false; |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
export function resetConfigToDefaults() { |
|
|
|
|
|
window.location.reload(); |
|
|
} |
|
|
|