Skip to content

Commit

Permalink
Merge pull request #96 from DavidLevinsky/master
Browse files Browse the repository at this point in the history
Support for new fonts
  • Loading branch information
davidmtech authored Mar 15, 2018
2 parents 3bba9bb + e18ba58 commit fa3c626
Show file tree
Hide file tree
Showing 28 changed files with 5,886 additions and 601 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "vts-browser-js",
"version": "2.13.6",
"version": "2.14.4",
"description": "JavaScript WebGL 3D maps rendering engine",
"main": "src/browser/index.js",
"scripts": {
Expand Down
18 changes: 14 additions & 4 deletions src/browser/autopilot/autopilot.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,14 +170,24 @@ Autopilot.prototype.tick = function() {


Autopilot.prototype.generateTrajectory = function(p1, p2, options) {
if(!this.map) return;
return this.map.generateTrajectory(p1, p2, options);
var map = this.browser.core.map;
if (!map) {
return;
}

options = options || {};
return map.generateTrajectory(p1, p2, options);
};


Autopilot.prototype.generatePIHTrajectory = function(position, azimuth, distance, options) {
if(!this.map) return;
return this.map.generatePIHTrajectory(position, azimuth, distance, options);
var map = this.browser.core.map;
if (!map) {
return;
}

options = options || {};
return map.generatePIHTrajectory(position, azimuth, distance, options);
};


Expand Down
4 changes: 3 additions & 1 deletion src/core/core.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ var Core = function(element, config, coreInterface) {
mapRefreshCycles : 3,
mapDegradeHorizon : false,
mapDegradeHorizonParams : [1, 1500, 97500, 3500], //[1, 3000, 15000, 7000],
mapDefaultFont : '//cdn.melown.com/libs/vtsjs/fonts/noto-basic/1.0.0/noto.fnt',
//mapDefaultFont : '../fonts/basic.fnt',
mapFog : true,
rendererAntialiasing : true,
rendererAllowScreenshots : false,
Expand Down Expand Up @@ -479,7 +481,7 @@ string getCoreVersion()
*/

function getCoreVersion(full) {
return (full ? 'Core: ' : '') + '2.13.6';
return (full ? 'Core: ' : '') + '2.14.4';
}


Expand Down
7 changes: 3 additions & 4 deletions src/core/map/geodata-processor/processor.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,11 @@ MapGeodataProcessor.prototype.setStylesheet = function(stylesheet, fontsOnly) {
return;
}

this.setFont('#system', this.renderer.font);
//this.setFont('#default', this.renderer.font);
this.sendCommand('setStylesheet', { 'data' : stylesheet.data, 'geocent' : (!this.map.getNavigationSrs().isProjected()) } );

var fonts = stylesheet.fonts;
var fontMap = { '#system' : '#system' };
var fontMap = {}; //'#default' : '#default' };

for (var key in fonts) {
var fontUrl = fonts[key];
Expand All @@ -125,8 +125,7 @@ MapGeodataProcessor.prototype.setStylesheet = function(stylesheet, fontsOnly) {
MapGeodataProcessor.prototype.setFont = function(url, font) {
if (!this.fonts[url]) {
this.fonts[url] = font;
this.sendCommand('setFont', {'url' : url, 'chars' : font.chars, 'space' : font.space, 'cly' : font.cly,
'size' : font.size, 'version':font.version});
this.sendCommand('setFont', {'url' : url, 'data': font.data}, [font.data]);
}
};

Expand Down
Loading

0 comments on commit fa3c626

Please sign in to comment.