Skip to content

Commit 711b66b

Browse files
committed
Clean up
1 parent 8def4fe commit 711b66b

File tree

1 file changed

+2
-170
lines changed

1 file changed

+2
-170
lines changed

src/widget.ts

Lines changed: 2 additions & 170 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ export class UrdfWidget extends DocumentWidget<UrdfPanel, DocumentModel> {
3030
/**
3131
* UrdfPanel: widget that contains the main view of the UrdfWidget.
3232
*/
33-
3433
export class UrdfPanel extends Panel {
3534
private _context: DocumentRegistry.IContext<DocumentModel>;
3635

@@ -40,22 +39,18 @@ export class UrdfPanel extends Panel {
4039
* @param context - The documents context
4140
*/
4241
constructor(context: DocumentRegistry.IContext<DocumentModel>) {
43-
super({
44-
layout: new URDFLayout()
45-
});
42+
super({ layout: new URDFLayout() });
43+
4644
this.addClass('jp-urdf-canvas'); // for css styling
4745
this._context = context;
4846

4947
this._context.ready.then(value => {
50-
// TODO
5148
(this.layout as URDFLayout).setURDF(this._context.model.toString());
5249
this._context.model.contentChanged.connect((sender, args)=>{
5350
console.log("Model changed.", args);
5451
(this.layout as URDFLayout).setURDF(this._context.model.toString());
5552
});
5653
});
57-
58-
// TODO
5954
}
6055

6156
// Dispose of resources held by widget
@@ -74,7 +69,6 @@ export class UrdfPanel extends Panel {
7469
*/
7570
protected onAfterAttach(msg: Message): void {
7671
super.onAfterAttach(msg);
77-
// TODO
7872
}
7973

8074
/**
@@ -84,7 +78,6 @@ export class UrdfPanel extends Panel {
8478
*/
8579
protected onBeforeDetach(msg: Message): void {
8680
super.onBeforeDetach(msg);
87-
// TODO
8881
}
8982

9083
/**
@@ -93,166 +86,5 @@ export class UrdfPanel extends Panel {
9386
* @param event - Event on the widget
9487
*/
9588
public handleEvent(event: MouseEvent): void {
96-
// TODO
9789
}
9890
}
99-
// export class UrdfPanel extends Widget {
100-
// /**
101-
// * Construct a UrdfPanel
102-
// *
103-
// * @param context - The documents context
104-
// */
105-
// constructor(context: DocumentRegistry.IContext<DocumentModel>) {
106-
// super();
107-
// this.id = 'canvasP';
108-
// this.addClass('jp-urdf-canvas'); // for css styling
109-
// this._context = context;
110-
// // this._isDown = false;
111-
// // this._offset = { x: 0, y: 0};
112-
113-
114-
// this._context.ready.then((value) => {
115-
// // TODO
116-
// this.update();
117-
// });
118-
119-
120-
121-
// // TODO
122-
// // const obj = this._context.model.getSharedObject();
123-
// this._canvas = document.createElement('div');
124-
// this._canvas.className = 'jp-urdf-canvas';
125-
// this._canvas.style.left = '0px';
126-
// this._canvas.innerText = 'URDF ROBOT';
127-
// // this.node.appendChild(this._canvas);
128-
129-
// // URDF Loader
130-
// this._scene = new Scene();
131-
// this._scene.background = new Color(0x263238);
132-
133-
// this._camera = new PerspectiveCamera();
134-
// this._camera.position.set(10, 10, 10);
135-
// this._camera.lookAt(0, 0, 0);
136-
137-
// this._renderer = new WebGLRenderer({ antialias: true });
138-
// this._renderer.outputEncoding = sRGBEncoding;
139-
// this._renderer.shadowMap.enable = true;
140-
// this._renderer.shadowMap.type = PCFSoftShadowMap;
141-
142-
// const directionalLight = new DirectionalLight(0xffffff, 1.0);
143-
// directionalLight.castShadow = true;
144-
// directionalLight.shadow.mapSize.setScalar(1024);
145-
// directionalLight.position.set(5, 30, 5);
146-
// this._scene.add(directionalLight);
147-
148-
// const ambientLight = new AmbientLight(0xffffff, 0.2);
149-
// this._scene.add(ambientLight);
150-
151-
// const ground = new Mesh(new PlaneBufferGeometry(),
152-
// new ShadowMaterial({ opacity: 0.25}));
153-
// ground.rotation.x = -Math.PI / 2;
154-
// ground.scale.setScalar(30);
155-
// ground.receiveShadow = true;
156-
// this._scene.add(ground);
157-
158-
// // TODO import orbit controls
159-
160-
// // Load Robot
161-
// this._manager = new LoadingManager();
162-
// this._loader = new URDFLoader(this._manager);
163-
164-
// // this._loader.load(context.path, (result: any) => {
165-
// // this._robot = result;
166-
// // });
167-
168-
// this._robot = this._loader.parse(context.model.value.text);
169-
170-
171-
// // Wait until all geometry has been loaded to add model to scene
172-
// this._manager.onLoad = () => {
173-
// this._robot.rotation.x = Math.PI / 2;
174-
// this._robot.traverse((c : any) => {
175-
// c.castShadow = true;
176-
// });
177-
// for (let i = 1; i <=6; i++) {
178-
// this._robot.joints[`HP${ i }`].setJointValue(MathUtils.degToRad(30));
179-
// this._robot.joints[`KP${ i }`].setJointValue(MathUtils.degToRad(120));
180-
// this._robot.joints[`AP${ i }`].setJointValue(MathUtils.degToRad(-60));
181-
// }
182-
// this._robot.updateMatrixWorld(true);
183-
184-
// const bb = new Box3();
185-
// bb.setFromObject(this._robot);
186-
187-
// this._robot.position.y -= bb.min.y;
188-
// this._scene.add(this._robot);
189-
// };
190-
191-
// // TODO add onResize()
192-
193-
// this._renderer.render(this._scene, this._camera);
194-
195-
// this.node.appendChild(this._renderer.domElement);
196-
197-
198-
// }
199-
200-
// // Dispose of resources held by widget
201-
// dispose(): void {
202-
// if (this.isDisposed) {
203-
// return;
204-
// }
205-
// Signal.clearData(this);
206-
// super.dispose();
207-
// }
208-
209-
// /**
210-
// * Handle after-attach messages sent to widget
211-
// *
212-
// * @param msg - Widget layout message
213-
// */
214-
// protected onAfterAttach(msg: Message): void {
215-
// super.onAfterAttach(msg);
216-
// // this._cube.addEventListener('mousedown', this, true);
217-
// // TODO
218-
// }
219-
220-
// /**
221-
// * Handle before-detach messages sent to widget
222-
// *
223-
// * @param msg - Widget layout message
224-
// */
225-
// protected onBeforeDetach(msg: Message): void {
226-
// super.onBeforeDetach(msg);
227-
// // this._cube.removeEventListener('mousedown', this, true);
228-
// // TODO
229-
// }
230-
231-
// /**
232-
// * Handle event messages sent to widget
233-
// *
234-
// * @param event - Event on the widget
235-
// */
236-
// public handleEvent(event: MouseEvent): void {
237-
// event.preventDefault();
238-
// event.stopPropagation();
239-
240-
// // TODO
241-
// }
242-
243-
244-
// private _context: DocumentRegistry.IContext<DocumentModel>;
245-
// private _canvas: HTMLElement;
246-
// // private _isDown: boolean;
247-
// // private _offset: Position;
248-
// // private _cube: HTMLElement;
249-
250-
// // URDF Loader variables
251-
// private _scene: any;
252-
// private _camera: any;
253-
// private _renderer: any;
254-
// private _robot: any;
255-
// // private _controls: any;
256-
// private _manager: any;
257-
// private _loader: any;
258-
// }

0 commit comments

Comments
 (0)