Files
Laca-City/backend/node_modules/generic-pool/lib/PriorityQueue.js
PhongPham c65cc97a33 🎯 MapView v2.0 - Global Deployment Ready
 MAJOR FEATURES:
• Auto-zoom intelligence với smart bounds fitting
• Enhanced 3D GPS markers với pulsing effects
• Professional route display với 6-layer rendering
• Status-based parking icons với availability indicators
• Production-ready build optimizations

🗺️ AUTO-ZOOM FEATURES:
• Smart bounds fitting cho GPS + selected parking
• Adaptive padding (50px) cho visual balance
• Max zoom control (level 16) để tránh quá gần
• Dynamic centering khi không có selection

🎨 ENHANCED VISUALS:
• 3D GPS marker với multi-layer pulse effects
• Advanced parking icons với status colors
• Selection highlighting với animation
• Dimming system cho non-selected items

🛣️ ROUTE SYSTEM:
• OpenRouteService API integration
• Multi-layer route rendering (glow, shadow, main, animated)
• Real-time distance & duration calculation
• Visual route info trong popup

📱 PRODUCTION READY:
• SSR safe với dynamic imports
• Build errors resolved
• Global deployment via Vercel
• Optimized performance

🌍 DEPLOYMENT:
• Vercel: https://whatever-ctk2auuxr-phong12hexdockworks-projects.vercel.app
• Bundle size: 22.8 kB optimized
• Global CDN distribution
• HTTPS enabled

💾 VERSION CONTROL:
• MapView-v2.0.tsx backup created
• MAPVIEW_VERSIONS.md documentation
• Full version history tracking
2025-07-20 19:52:16 +07:00

70 lines
1.4 KiB
JavaScript

"use strict";
const Queue = require("./Queue");
/**
* @class
* @private
*/
class PriorityQueue {
constructor(size) {
this._size = Math.max(+size | 0, 1);
/** @type {Queue[]} */
this._slots = [];
// initialize arrays to hold queue elements
for (let i = 0; i < this._size; i++) {
this._slots.push(new Queue());
}
}
get length() {
let _length = 0;
for (let i = 0, slots = this._slots.length; i < slots; i++) {
_length += this._slots[i].length;
}
return _length;
}
enqueue(obj, priority) {
// Convert to integer with a default value of 0.
priority = (priority && +priority | 0) || 0;
if (priority) {
if (priority < 0 || priority >= this._size) {
priority = this._size - 1;
// put obj at the end of the line
}
}
this._slots[priority].push(obj);
}
dequeue() {
for (let i = 0, sl = this._slots.length; i < sl; i += 1) {
if (this._slots[i].length) {
return this._slots[i].shift();
}
}
return;
}
get head() {
for (let i = 0, sl = this._slots.length; i < sl; i += 1) {
if (this._slots[i].length > 0) {
return this._slots[i].head;
}
}
return;
}
get tail() {
for (let i = this._slots.length - 1; i >= 0; i--) {
if (this._slots[i].length > 0) {
return this._slots[i].tail;
}
}
return;
}
}
module.exports = PriorityQueue;