Skip to content

Web Improvements including Cloud Tiling#42

Closed
indig0fox wants to merge 31 commits intomainfrom
ind/leaflet-functionality
Closed

Web Improvements including Cloud Tiling#42
indig0fox wants to merge 31 commits intomainfrom
ind/leaflet-functionality

Conversation

@indig0fox
Copy link
Member

No description provided.

@indig0fox indig0fox self-assigned this Apr 14, 2022
@indig0fox
Copy link
Member Author

  • adds leaflet control to show/hide of units/vehicles, side markers, global markers, and projectile markers
  • adds leaflet control to select displayed terrain layer, if map has more than just topo rendered
    • supports "Topographic", "Topographic Dark", "Topographic Relief", "Color Relief"
  • changes popups over entities to a 'glow white' effect surrounding black text, for easy of seeing units in very close proximity as well as on dark backgrounds
  • adds compatibility for LOGIC side objects, which are typically excluded but in some cases have been re-initialized as live entities due to module actions (add editable objects)
  • adds "GeneralEvent" class for support with new addon functionality to add generic messaging in event timeline
  • minor EN localization improvement on time menu display
  • sets up ocap.ui.js setting for useCloudTiles -- will fetch data from a centralized map server and load tiles from there, eliminating the need for server admins to install individual maps

@indig0fox indig0fox marked this pull request as ready for review April 14, 2022 16:02
@fank fank self-requested a review April 22, 2022 13:40
<div id="frameSliderContainer">
<div id="eventTimeline"></div>
<div class="frameSliderContainer2">
<input type="range" id="frameSlider" min="0" value="0" />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In html a / at the end of an element is not needed, its only part of the xhtml specification

"ru": "Время миссии",
"en": "Mission Time Elapsed",
"en": "In-Game World Time",
"de": "Verstrichene Missionszeit"
Copy link
Member

@fank fank Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"de": "Verstrichene Missionszeit"
"de": "In-Game Zeit"

}
// getElement() {
// return this._element;
// }
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just remove it when not neede anymore

indig0fox and others added 2 commits May 5, 2022 10:38
@indig0fox
Copy link
Member Author

Need assistance in checking local files for installed maps before then loading from remote tileserver.

Currently this uses ui.useCloudTiles defined in /static/scripts/ocap.ui.js as a hard switch. Instead, check server and if not installed fall back to centralized repository to check.

This is for map.json

web/static/scripts/ocap.js

Lines 178 to 194 in a10d227

let mapJsonUrl;
if (ui.useCloudTiles) {
mapJsonUrl = `https://maps.ocap2.com/${worldName}/map.json`;
} else {
mapJsonUrl = 'images/maps/' + worldName + '/map.json';
}
// $.getJSON(mapJsonUrl, function (data) {
// console.log(data);
// console.log(data.responseJSON);
// });
map = $.ajax({
type: "GET",
url: mapJsonUrl,
async: false
}).responseJSON;
return Object.assign(defaultMap, map);

This is for the actual layers

web/static/scripts/ocap.js

Lines 386 to 403 in a10d227

switch (ui.useCloudTiles) {
case true: {
topoLayerUrl = ('https://maps.ocap2.com/' + worldName.toLowerCase() + '/{z}/{x}/{y}.png');
topoDarkLayerUrl = ('https://maps.ocap2.com/' + worldName.toLowerCase() + '/topoDark/{z}/{x}/{y}.png');
topoReliefLayerUrl = ('https://maps.ocap2.com/' + worldName.toLowerCase() + '/topoRelief/{z}/{x}/{y}.png');
colorReliefLayerUrl = ('https://maps.ocap2.com/' + worldName.toLowerCase() + '/colorRelief/{z}/{x}/{y}.png');
contourLayerUrl = ('https://maps.ocap2.com/' + worldName.toLowerCase() + '/contours.geojson');
break;
}
case false: {
topoLayerUrl = ('images/maps/' + worldName + '/{z}/{x}/{y}.png');
topoDarkLayerUrl = ('images/maps/' + worldName + '/topoDark/{z}/{x}/{y}.png');
topoReliefLayerUrl = ('images/maps/' + worldName + '/topoRelief/{z}/{x}/{y}.png');
colorReliefLayerUrl = ('images/maps/' + worldName + '/colorRelief/{z}/{x}/{y}.png');
contourLayerUrl = ('images/maps/' + worldName + '/contours.geojson');
break;
}
}

@indig0fox indig0fox linked an issue May 24, 2023 that may be closed by this pull request
indig0fox added 4 commits May 23, 2023 22:36
- account for new "displayName" attribute in worlds' map.json to supercede the previous "name" attribute
- reduce max zoom by 1 level
- fix console logging for incomplete hit/killed events
- change to calculating initial view bounds by initial marker positions if BIS_fnc_moduleCoverMap not present
- add better logging in general, including in debug stream
- if world isn't rendered in cloud or local, show alert & load placeholder map so playback can still be viewed
- don't cache map.json to support future installation/render and stop it from requiring a full browser cache clear
- cleanup old geojson code
- move Leaflet controls to bottom right and integrate with Leaflet DOM
- removes a couple css overrides for the above
- update ui title bar to also include the played date and map name
- linting
- fix error where popup is not initialized yet but tries to update
- reposition website logo to bottom left
- ensure it follows left panel visibility
- fix loading the shareURL using proper URLSearchParams
- parse date from opRecord, or if from share URL, from filename if possible. if backup file that was manually restored and failed initial upload, show "<UnknownDate>"
- created setting.json.example, but left setting.json so as not to break Docker build on accident
fank added a commit that referenced this pull request Jan 30, 2026
Merges indig0fox's feature branch with the following improvements:

- Add cloud tile fallback (maps.ocap2.com) when local map tiles unavailable
- Add Leaflet layer controls for switching between terrain styles
  (Topo/TopoDark/TopoRelief/ColorRelief)
- Add Leaflet zoom info control
- Add jQuery dependency for improved DOM handling
- Add version info display (extension and addon versions)
- Improve localization with better English/German translations
- Add map bounds fitting after operation loads
- Various code style improvements

New files:
- static/leaflet/L.Control.Basemaps.js/css
- static/leaflet/L.Control.Zoominfo.js/css
- setting.json.example

This merge resolves conflicts between the original PR (created Apr 2022)
and the current main branch which includes chunked streaming support.

Co-authored-by: IndigoFox <[email protected]>
@fank fank closed this Jan 30, 2026
@fank fank deleted the ind/leaflet-functionality branch January 30, 2026 17:39
fank added a commit that referenced this pull request Jan 30, 2026
…s) (#87)

* number of improvements

- adds leaflet control
- allows satellite layer to be loaded if available and switched between topo and sat
- allows show/hide of units/vehicles, side markers, global markers, and projectile markers

- fixes setCrew bug

* visual improvements, cloud tiling

* enough for now

* more

* adds generalEvent for custom event announcements in timeline

* fix markers

* fix for sideLogic units

* small ui changes

* changes to new topo modes

* fixes cloud tiling CORS issues

* now uses https map.json fetch

* crisper entity popup text

* hide AI names by default, more work needed

* hotfix leaflet.pattern failure

* minor index cleanup

* Update static/scripts/localizable.js

Co-authored-by: Florian Kinder <[email protected]>

* Update static/scripts/localizable.js

Co-authored-by: Florian Kinder <[email protected]>

* use cloud tiles as fallback (#44)

* only use cloud tiles as fallback when enabled

* debug log

* show cloud map data parsing error

* fix `world._useCloudTiles` condition check

* fix vehicle crew display, dont carry d/c deaths to rejoined players

* ignore data and maps files in git

* ensure that groups in left pane are ordered alphabetically

* update missing tiles URL

* update data and maps ignores

* fix basemaps control file reference

* addon and extension version in info screen

* - account for new "displayName" attribute in worlds' map.json to supercede the previous "name" attribute
- reduce max zoom by 1 level
- fix console logging for incomplete hit/killed events
- change to calculating initial view bounds by initial marker positions if BIS_fnc_moduleCoverMap not present
- add better logging in general, including in debug stream
- if world isn't rendered in cloud or local, show alert & load placeholder map so playback can still be viewed
- don't cache map.json to support future installation/render and stop it from requiring a full browser cache clear
- cleanup old geojson code
- move Leaflet controls to bottom right and integrate with Leaflet DOM
- removes a couple css overrides for the above
- update ui title bar to also include the played date and map name
- linting
- fix error where popup is not initialized yet but tries to update

* fix loading share URL, fix websiteLogo position

- reposition website logo to bottom left
- ensure it follows left panel visibility
- fix loading the shareURL using proper URLSearchParams
- parse date from opRecord, or if from share URL, from filename if possible. if backup file that was manually restored and failed initial upload, show "<UnknownDate>"
- created setting.json.example, but left setting.json so as not to break Docker build on accident

* fix fetch exception for loading without a rendered map

* fix: revert Leaflet to 1.6.0 for plugin compatibility

The PR's Leaflet 1.7.1 uses ES module syntax which breaks
when loaded as a regular script tag. The plugins (rotatedMarker,
svgIcon, pattern, etc.) depend on the global L variable being
defined synchronously.

* fix: set worldObject global in streaming mode

The streaming mode path (processOpStreaming) was not setting
the global worldObject variable, causing getMapImageBounds()
to fail with 'Cannot read properties of null'.

* fix: use HTTPS for cloud tile URLs and fix corrupted .gitkeep

- Change all http://maps.ocap2.com to https://maps.ocap2.com to avoid
  mixed content warnings when served over HTTPS
- Fix maps/.gitkeep which contained RTF markup instead of being empty

* chore: remove unnecessary .gitkeep files

The data/ and maps/ directories are already in .gitignore,
so .gitkeep files cannot be tracked anyway. The application
or deployment should create these directories as needed.

* chore: remove redundant .gitignore patterns

The patterns /data/*.json.gz, /data/*.json, and /maps/*/ are
already covered by data/ and maps/ respectively.

* chore: gitignore setting.json, expand setting.json.example

- Add setting.json to .gitignore (contains secrets)
- Update setting.json.example with all available options:
  - prefixURL, db, markers, ammo, maps, data, static paths
  - conversion settings (enabled, interval, batchSize, chunkSize, storageEngine)
- Change example secret to 'change-me' to make it clear it must be changed

* feat: implement leaflet.pattern support for marker brushes

Re-enable L.StripePattern support for marker brush types:
- Horizontal, Vertical, Grid, FDiagonal, BDiagonal, DiagGrid, Cross

The pattern is created in the constructor when brush options are set,
and added to the map when the marker is rendered. The pattern library
handles duplicate additions gracefully via L.stamp tracking.

Removes commented-out dead code that was marked as 'broken'.

---------

Co-authored-by: IndigoFox <[email protected]>
Co-authored-by: goto-10 <[email protected]>
Co-authored-by: JessevGool <[email protected]>
Co-authored-by: IndigoFox <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Player disconnect counts as death

4 participants

Comments