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

Enhancement add new web nodes #5328

Merged
merged 20 commits into from
Oct 14, 2022
458 changes: 347 additions & 111 deletions resources/web/wwi/Parser.js

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbAccelerometer.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbAccelerometer extends WbSolid {
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbAltimeter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbAltimeter extends WbSolid {
}
51 changes: 51 additions & 0 deletions resources/web/wwi/nodes/WbBallJoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import WbHinge2Joint from './WbHinge2Joint.js';

export default class WbBallJoint extends WbHinge2Joint {
#device3;
#jointParameters3;
constructor(id) {
super(id);
this.#device3 = [];
}

get device3() {
return this.#device3;
}

set device3(device) {
this.#device3 = device;
}

get jointParameters3() {
return this.#jointParameters3;
}

set jointParameters3(jointParameters) {
this.#jointParameters3 = jointParameters;
}

preFinalize() {
super.preFinalize();
this.#device3.forEach(child => child.preFinalize());
this.#jointParameters3?.preFinalize();
}

postFinalize() {
super.postFinalize();

this.#device3.forEach(child => child.postFinalize());
this.#jointParameters3?.postFinalize();
}

delete() {
let index = this.#device3.length - 1;
while (index >= 0) {
this.#device3[index].delete();
--index;
}

this.#jointParameters3?.delete();

super.delete();
}
}
13 changes: 13 additions & 0 deletions resources/web/wwi/nodes/WbBallJointParameters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import WbJointParameters from './WbJointParameters.js';

export default class WbBallJointParameters extends WbJointParameters {
#anchor;
constructor(id, position, axis, anchor, minStop, maxStop) {
super(id, position, axis, minStop, maxStop);
this.#anchor = anchor;
}

get anchor() {
return this.#anchor;
}
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbBrake.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbLogicalDevice from './WbLogicalDevice.js';

// This class is used to retrieve the type of device present in the joint
export default class WbBrake extends WbLogicalDevice {
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbCamera.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbCamera extends WbSolid {
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbCharger.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbCharger extends WbSolid {
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbCompass.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbCompass extends WbSolid {
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbConnector.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbConnector extends WbSolid {
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbDisplay.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbDisplay extends WbSolid {
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbDistanceSensor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbDistanceSensor extends WbSolid {
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbEmitter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbEmitter extends WbSolid {
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbGps.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbGps extends WbSolid {
}
11 changes: 11 additions & 0 deletions resources/web/wwi/nodes/WbGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,23 @@ import WbWorld from './WbWorld.js';
import {getAnId} from './utils/id_provider.js';

export default class WbGroup extends WbBaseNode {
#device;
constructor(id, isPropeller) {
super(id);
this.children = [];

this.isPropeller = isPropeller;
this.currentHelix = -1; // to switch between fast and slow helix
if (isPropeller)
this.#device = [];
}

get device() {
return this.#device;
}

set device(device) {
this.#device = device;
}

clone(customID) {
Expand Down
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbGyro.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbGyro extends WbSolid {
}
51 changes: 51 additions & 0 deletions resources/web/wwi/nodes/WbHinge2Joint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import WbHingeJoint from './WbHingeJoint.js';

export default class WbHinge2Joint extends WbHingeJoint {
#device2;
#jointParameters2;
constructor(id) {
super(id);
this.#device2 = [];
}

get device2() {
return this.#device2;
}

set device2(device) {
this.#device2 = device;
}

get jointParameters2() {
return this.#jointParameters2;
}

set jointParameters2(jointParameters) {
this.#jointParameters2 = jointParameters;
}

preFinalize() {
super.preFinalize();
this.#device2.forEach(child => child.preFinalize());
this.#jointParameters2?.preFinalize();
}

postFinalize() {
super.postFinalize();

this.#device2.forEach(child => child.postFinalize());
this.#jointParameters2?.postFinalize();
}

delete() {
let index = this.#device2.length - 1;
while (index >= 0) {
this.#device2[index].delete();
--index;
}

this.#jointParameters2?.delete();

super.delete();
}
}
38 changes: 38 additions & 0 deletions resources/web/wwi/nodes/WbHingeJoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import WbJoint from './WbJoint.js';

export default class WbHingeJoint extends WbJoint {
#device;
constructor(id) {
super(id);
this.#device = [];
}

get device() {
return this.#device;
}

set device(device) {
this.#device = device;
}

preFinalize() {
super.preFinalize();
this.#device.forEach(child => child.preFinalize());
}

postFinalize() {
super.postFinalize();

this.#device.forEach(child => child.postFinalize());
}

delete() {
let index = this.#device.length - 1;
while (index >= 0) {
this.#device[index].delete();
--index;
}

super.delete();
}
}
13 changes: 13 additions & 0 deletions resources/web/wwi/nodes/WbHingeJointParameters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import WbJointParameters from './WbJointParameters.js';

export default class WbHingeJointParameters extends WbJointParameters {
#anchor;
constructor(id, position, axis, anchor, minStop, maxStop) {
super(id, position, axis, minStop, maxStop);
this.#anchor = anchor;
}

get anchor() {
return this.#anchor;
}
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbInertialUnit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbInertialUnit extends WbSolid {
}
63 changes: 63 additions & 0 deletions resources/web/wwi/nodes/WbJoint.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
import WbBaseNode from './WbBaseNode.js';
import WbWorld from './WbWorld.js';

export default class WbJoint extends WbBaseNode {
#endPoint;
#jointParameters;

get endPoint() {
return this.#endPoint;
}

set endPoint(endPoint) {
this.#endPoint = endPoint;
}

get jointParameters() {
return this.#jointParameters;
}

set jointParameters(jointParameters) {
this.#jointParameters = jointParameters;
}

updateBoundingObjectVisibility() {
this.#endPoint?.updateBoundingObjectVisibility();
}

createWrenObjects() {
super.createWrenObjects();

this.#endPoint?.createWrenObjects();
}

delete() {
const parent = WbWorld.instance.nodes.get(this.parent);
if (typeof parent !== 'undefined') {
if (typeof parent.endPoint !== 'undefined')
parent.endPoint = undefined;
else {
const index = parent.children.indexOf(this);
parent.children.splice(index, 1);
}
}

this.#jointParameters?.delete();
this.#endPoint?.delete();

super.delete();
}

preFinalize() {
super.preFinalize();
this.#jointParameters?.preFinalize();
this.#endPoint?.preFinalize();
}

postFinalize() {
super.postFinalize();

this.#jointParameters?.postFinalize();
this.#endPoint?.postFinalize();
}
}
42 changes: 42 additions & 0 deletions resources/web/wwi/nodes/WbJointParameters.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import WbBaseNode from './WbBaseNode.js';
import WbWorld from './WbWorld.js';

export default class WbJointParameters extends WbBaseNode {
#position;
#axis;
#minStop;
#maxStop;
constructor(id, position, axis, minStop, maxStop) {
super(id);
this.#position = position;
this.#axis = axis;
this.#minStop = minStop;
this.#maxStop = maxStop;
}

get position() {
return this.#position;
}

get axis() {
return this.#axis;
}

get minStop() {
return this.#minStop;
}

get maxStop() {
return this.#maxStop;
}

delete() {
const parent = WbWorld.instance.nodes.get(this.parent);
if (typeof parent !== 'undefined') {
if (typeof parent.jointParameters !== 'undefined')
parent.jointParameters = undefined;
}

super.delete();
}
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbLed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbLed extends WbSolid {
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbLidar.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbLidar extends WbSolid {
}
5 changes: 5 additions & 0 deletions resources/web/wwi/nodes/WbLightSensor.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import WbSolid from './WbSolid.js';

// This class is used to retrieve the type of device
export default class WbLightSensor extends WbSolid {
}
Loading