Skip to content
This repository has been archived by the owner on Dec 23, 2020. It is now read-only.

Commit

Permalink
update with new camera
Browse files Browse the repository at this point in the history
  • Loading branch information
shijianjian committed Dec 9, 2017
1 parent f891782 commit 0121a6c
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 429 deletions.
3 changes: 1 addition & 2 deletions app/angular/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
<app-camera-native class="app-container-inline" [pointcloud]="pointcloud"></app-camera-native>
<app-segmentation
*ngIf="filename"
[pointcloud]="pointcloud"
[filename]="filename"
[pointcloud]="pointcloud"
(segments)="onSegments($event)"
></app-segmentation>
</div>
Expand Down
17 changes: 7 additions & 10 deletions app/angular/src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { FileUploader } from 'ng2-file-upload/ng2-file-upload';

import { AppService } from './app.service';
import { baseUrl } from './settings';
import { PointsSettings, VoxelPointsViews } from './model/points-settings';

@Component({
selector: 'app-root',
Expand All @@ -24,8 +23,7 @@ export class AppComponent {
filename: string;

pointcloud: Array<Array<number>>;
segs: Array<PointsSettings> = [];
cameraSettings: VoxelPointsViews;
segs: Array<number[][]> = [];

@HostBinding('class.container') cont: boolean = true;

Expand Down Expand Up @@ -59,11 +57,6 @@ export class AppComponent {
this.$appService.getPoints(this.filename).subscribe(
data => {
this.pointcloud = data.json();
this.$appService.getCameraSettings(this.pointcloud, this.filename, 32).subscribe(
data => {
this.cameraSettings = data;
}
)
}
)
});
Expand All @@ -76,8 +69,12 @@ export class AppComponent {
}
}

onSegments(event: PointsSettings[]) {
this.segs = Array.from(event);
onSegments(event: JSON) {
let segs = []
for (let key in event) {
segs.push(event[key]);
}
this.segs = segs;
}

}
13 changes: 0 additions & 13 deletions app/angular/src/app/app.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import { Observable } from "rxjs/Observable";
import { map } from 'rxjs/operators';

import { baseUrl } from "./settings";
import { VoxelPointsViews } from "./model/points-settings";
import { Algorithm, DBSCAN, MeanShift } from "./model/cluster-algorithm";
import { Subject, BehaviorSubject } from "rxjs";

Expand Down Expand Up @@ -34,18 +33,6 @@ export class AppService {
return this._http.get(`${baseUrl}/plot/points/${filename}`);
}

getCameraSettings(pointcloud: Array<Array<number>>, name?: string, gridSize?: number): Observable<VoxelPointsViews> {
if (typeof pointcloud != 'undefined'
&& typeof name == 'undefined') {
throw new TypeError("Invalid Input, please provide a file name for point cloud data");
}
let body = new FormData();
body.append('name', name);
typeof pointcloud != 'undefined' ? body.append('pointcloud', JSON.stringify(pointcloud)) : null;
typeof gridSize != 'undefined' ? body.append('grid_size', `[${gridSize}, ${gridSize}, ${gridSize}]`) : null;
return this._httpClient.post<VoxelPointsViews>(`${baseUrl}/plot/settings`, body);
}

predict(pointcloud: number[][], model: string): Observable<Response> {
let body = new FormData();
if (typeof pointcloud != 'undefined') {
Expand Down
10 changes: 4 additions & 6 deletions app/angular/src/app/camera/camera-native.component.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Component, OnInit, OnChanges, Input, ViewChild, ElementRef } from '@angular/core';
import { MeshBasicMaterial, PointsMaterial, Points, Mesh } from 'three';

import { CameraSettings, VoxelPointsViews } from '../model/points-settings';
import { CameraGuiService } from '../camera-gui.service';
import { GuiControllerTypes, GuiParameters } from '../model/GUI';
import { MatTabChangeEvent } from '@angular/material';
Expand All @@ -14,7 +13,7 @@ declare const OrbitControls;

@Component({
selector: 'app-camera-native',
templateUrl: './camera.component.html'
templateUrl: './camera-native.component.html'
})
export class CameraNativeComponent implements OnChanges {

Expand Down Expand Up @@ -47,14 +46,13 @@ export class CameraNativeComponent implements OnChanges {
})
}

ngOnInit() {
this.renderer = PointCloudLoader.initRender(this.canvas);
}

ngOnChanges() {
if (!this.pointcloud) {
return;
}
if (!this.renderer) {
this.renderer = PointCloudLoader.initRender(this.canvas);
}
if (this.scene.children.length > 0) {
this.removeAll();
this.voxelgrid = undefined;
Expand Down
5 changes: 0 additions & 5 deletions app/angular/src/app/camera/camera.component.html

This file was deleted.

275 changes: 0 additions & 275 deletions app/angular/src/app/camera/camera.component.ts

This file was deleted.

Loading

0 comments on commit 0121a6c

Please sign in to comment.