Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Publisher tools reactification 3d #2741

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions bundles/framework/publisher2/resources/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ Oskari.registerLocalization(
"LayerSelectionPlugin": "Map layers menu",
"MapLegend": "Show map legend",
"MapRotator": "Enable map rotation",
"CameraControls3d": "Camera tools",
"TimeControl3d": "Time control",
"toolbarToolNames": {
"history": "Move to previous or next view",
"history_back": "Move to previous view",
Expand Down
2 changes: 0 additions & 2 deletions bundles/framework/publisher2/resources/locale/fi.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ Oskari.registerLocalization(
"LayerSelectionPlugin": "Karttatasovalikko",
"MapLegend": "Näytä karttaselitteet",
"MapRotator": "Salli kartan pyörittäminen",
"CameraControls3d": "Kameratyökalut",
"TimeControl3d": "Ajanhetken säädin",
"toolbarToolNames": {
"history": "Siirtyminen edelliseen ja seuraavaan näkymään",
"history_back": "Siirtyminen edelliseen näkymään",
Expand Down
2 changes: 0 additions & 2 deletions bundles/framework/publisher2/resources/locale/sv.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,6 @@ Oskari.registerLocalization(
"LayerSelectionPlugin": "Kartlagermeny",
"MapLegend": "Visa kartförklaringen",
"MapRotator": "Tillåt kartrotation",
"CameraControls3d": "Kameraverktyg",
"TimeControl3d": "Tidskontroll",
"toolbarToolNames": {
"history": "Gå bakåt eller framåt",
"history_back": "Gå bakåt",
Expand Down
6 changes: 4 additions & 2 deletions bundles/mapping/camera-controls-3d/resources/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ Oskari.registerLocalization(
},
"rotateModeFailure": {
"message" : "Setting to rotate map mode failed",
"description": "Camera should be pointed towards earth surface when mode is set"
"description": "Camera should be pointed towards earth surface when mode is set"
},
'guidedTour': {
'title': '3D camera tools',
'message': 'In 3D view, the map can be rotated and camera angle and height changed.<br/><br/>The pan and rotate buttons control how the map acts when dragging with the mouse. By default, the pan button is active and the map can be rotated and camera angle changed by pressing Shift / Alt / Ctrl and dragging with a mouse. By choosing the rotate button instead of the pan button, the map can be rotated and camera angle changed by dragging with the mouse. Map can be panned by selecting the pan button again.<br/><br/>The camera height can be changed with the arrow buttons.'
},
"publisher": {
"toolLabel": "Camera tools"
}
}
}
);

7 changes: 5 additions & 2 deletions bundles/mapping/camera-controls-3d/resources/locale/fi.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,16 @@ Oskari.registerLocalization(
},
"rotateModeFailure": {
"message" : "Kiertotilaan asetus epäonnistui",
"description": "Kameran tulee osoittaa kohti maanpintaa kun tila asetetaan"
"description": "Kameran tulee osoittaa kohti maanpintaa kun tila asetetaan"
},
'guidedTour': {
'title': '3D-kameratyökalut',
'message': '3D-näkymässä karttaa voi liikutuksen lisäksi pyörittää sekä katsoa eri kulmista ja korkeuksilta.<br/><br/>Suuntanuoli- ja pyörityspainikkeet määräävät kumpaa hiirellä liikuttamalla tehdään. Oletusarvoisesti suuntanuolipainike on valittuna, jolloin hiirellä liikutetaan karttaa ja yhdistelmällä Shift/Alt/Ctrl + hiiri pyöritetään karttaa sekä säädetään kameran kulmaa. Valitsemalla suuntanuolipainikkeen sijaan pyörityspainikkeen, voi karttaa pyörittää ja kulmaa säätää pelkällä hiirellä. Kartan liikutus tapahtuu valitsemalla jälleen suuntanuolipainike.<br/><br/>Katselukorkeutta voi säätää lähemmäs ja kauemmas maanpinnasta nuolipainikkeilla.'
},
"publisher": {
"toolLabel": "Kameratyökalut"
}

}
}
);

6 changes: 4 additions & 2 deletions bundles/mapping/camera-controls-3d/resources/locale/sv.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@ Oskari.registerLocalization(
},
"rotateModeFailure": {
"message" : "Inställningen för att rotera kartläget misslyckades",
"description": "Kameran bör riktas mot jordytan när läget är inställt"
"description": "Kameran bör riktas mot jordytan när läget är inställt"
},
'guidedTour': {
'title': '3D kamera verktyg',
'message': 'I 3D kan kartan också roteras och visas i olika vinklar och höjder.<br/><br/>Panorering- och rotationsknapparna styr hur kartan fungerar när du drar med musen. Som standard är panorknappen aktiv och kartan kan roteras och kameravinkeln ändras genom att trycka på Shift / Alt / Ctrl + musen. Genom att välja rotationsknappen i stället för panoreringsknappen kan kartan roteras och kameravinkeln ändras med musen. Kartan kan panoreras genom att välja panoreringsknappen igen.<br/><br/>Kamerahöjden kan ändras med pilknapparna.'
},
"publisher": {
"toolLabel": "Kameraverktyg"
}
}
}
);

118 changes: 54 additions & 64 deletions bundles/mapping/camera-controls-3d/tool/CameraControls3dTool.js
Original file line number Diff line number Diff line change
@@ -1,75 +1,65 @@
Oskari.clazz.define('Oskari.mapping.cameracontrols3d.CameraControls3dTool',
function () {
}, {
index: 3,
lefthanded: 'top left',
righthanded: 'top right',
import { AbstractPublisherTool } from '../../../framework/publisher2/tools/AbstractPublisherTool';

groupedSiblings: true,

/**
* Get tool object.
* @method getTool
*
* @returns {Object} tool description
*/
getTool: function () {
return {
id: 'Oskari.mapping.cameracontrols3d.CameraControls3dPlugin',
title: 'CameraControls3d',
config: {}
};
},
class CameraControls3dTool extends AbstractPublisherTool {
constructor (...args) {
super(...args);
this.index = 170;
this.group = 'tools';
this.lefthanded = 'top left';
this.righthanded = 'top right';
this.groupedSiblings = true;
// Key in view config non-map-module-plugin tools (for returning the state when modifying an existing published map).
bundleName: 'camera-controls-3d',
this.bundleName = 'camera-controls-3d';
}

/**
* Initialise tool
* @method init
*/
init: function (data) {
if (data.configuration[this.bundleName]) {
this.setEnabled(true);
init (data) {
if (data.configuration[this.bundleName]) {
this.setEnabled(true);
const location = data.configuration[this.bundleName]?.conf?.location?.classes;
if (location) {
this.getPlugin().setLocation(location);
}
},
/**
}
}

getTool () {
return {
id: 'Oskari.mapping.cameracontrols3d.CameraControls3dPlugin',
title: Oskari.getMsg('CameraControls3d', 'publisher.toolLabel'),
config: {}
};
}

/**
* Get values.
* @method getValues
* @public
*
* @returns {Object} tool value object
*/
getValues: function () {
if (this.state.enabled) {
var pluginConfig = this.getPlugin().getConfig();
var json = {
configuration: {}
};
json.configuration[this.bundleName] = {
conf: pluginConfig,
state: {}
};
return json;
} else {
return null;
}
},
/**
* Stop tool.
* @method stop
* @public
*/
stop: function () {
this.__started = false;
if (!this.__plugin) {
return;
}
if (this.getSandbox()) {
this.__plugin.stopPlugin(this.getSandbox());
}
this.__mapmodule.unregisterPlugin(this.__plugin);
getValues () {
if (this.state.enabled) {
const pluginConfig = this.getPlugin().getConfig();
const json = {
configuration: {}
};
json.configuration[this.bundleName] = {
conf: pluginConfig,
state: {}
};
return json;
} else {
return null;
}
}, {
'extend': ['Oskari.mapframework.publisher.tool.AbstractPluginTool'],
'protocol': ['Oskari.mapframework.publisher.Tool']
});
}
}

// Attach protocol to make this discoverable by Oskari publisher
Oskari.clazz.defineES('Oskari.publisher.CameraControls3dTool',
CameraControls3dTool,
{
protocol: ['Oskari.mapframework.publisher.Tool']
}
);

export { CameraControls3dTool };
3 changes: 3 additions & 0 deletions bundles/mapping/time-control-3d/resources/locale/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Oskari.registerLocalization(
"slow": "Slow",
"normal": "Normal",
"fast": "Fast"
},
"publisher": {
"toolLabel": "Time control"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions bundles/mapping/time-control-3d/resources/locale/fi.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Oskari.registerLocalization(
"slow": "Hidas",
"normal": "Normaali",
"fast": "Nopea"
},
"publisher": {
"toolLabel": "Ajanhetken säädin"
}
}
}
Expand Down
3 changes: 3 additions & 0 deletions bundles/mapping/time-control-3d/resources/locale/sv.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ Oskari.registerLocalization(
"slow": "Långsam",
"normal": "Normal",
"fast": "Snabb"
},
"publisher": {
"toolLabel": "Tidskontroll"
}
}
}
Expand Down
97 changes: 55 additions & 42 deletions bundles/mapping/time-control-3d/tool/TimeControl3dTool.js
Original file line number Diff line number Diff line change
@@ -1,46 +1,59 @@
Oskari.clazz.define('Oskari.mapping.time-control-3d.TimeControl3dTool',
function () {
}, {
index: 2,
lefthanded: 'top left',
righthanded: 'top right',
groupedSiblings: true,
/**
* Get tool object.
* @method getTool
*
* @returns {Object} tool description
*/
getTool: function () {
import { AbstractPublisherTool } from '../../../framework/publisher2/tools/AbstractPublisherTool';

class TimeControl3dTool extends AbstractPublisherTool {
constructor (...args) {
super(...args);
this.index = 180;
this.group = 'tools';
this.lefthanded = 'top left';
this.righthanded = 'top right';
this.groupedSiblings = true;
};

/**
* Get tool object.
* @method getTool
*
* @returns {Object} tool description
*/
getTool () {
return {
id: 'Oskari.mapping.time-control-3d.TimeControl3dPlugin',
title: Oskari.getMsg('TimeControl3d', 'publisher.toolLabel'),
config: this.state?.pluginConfig || {}
};
}

/**
* Get values.
* @method getValues
* @public
*
* @returns {Object} tool value object
*/
getValues () {
if (this.state.enabled) {
return {
id: 'Oskari.mapping.time-control-3d.TimeControl3dPlugin',
title: 'TimeControl3d',
config: {}
};
},
/**
* Get values.
* @method getValues
* @public
*
* @returns {Object} tool value object
*/
getValues: function () {
if (this.state.enabled) {
return {
configuration: {
mapfull: {
conf: {
plugins: [{ id: this.getTool().id, config: this.getPlugin().getConfig() }]
}
configuration: {
mapfull: {
conf: {
plugins: [{ id: this.getTool().id, config: this.getPlugin().getConfig() }]
}
}
};
} else {
return null;
}
}
};
} else {
return null;
}
}, {
'extend': ['Oskari.mapframework.publisher.tool.AbstractPluginTool'],
'protocol': ['Oskari.mapframework.publisher.Tool']
});
}
}

// Attach protocol to make this discoverable by Oskari publisher
Oskari.clazz.defineES('Oskari.publisher.TimeControl3dTool',
TimeControl3dTool,
{
protocol: ['Oskari.mapframework.publisher.Tool']
}
);

export { TimeControl3dTool };
Loading