You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@streampipes.apache.org by GitBox <gi...@apache.org> on 2023/01/18 20:19:48 UTC

[GitHub] [streampipes] tenthe commented on a diff in pull request #1120: [#877] Format and lint core-ui module

tenthe commented on code in PR #1120:
URL: https://github.com/apache/streampipes/pull/1120#discussion_r1074033902


##########
ui/src/app/core-ui/image/image-labeling/image-labeling.component.ts:
##########
@@ -34,243 +33,358 @@ import { Label } from '@streampipes/platform-services';
 import { LabelService } from '../../labels/services/label.service';
 
 @Component({
-  selector: 'sp-image-labeling',
-  templateUrl: './image-labeling.component.html',
-  styleUrls: ['./image-labeling.component.css']
+    selector: 'sp-image-labeling',
+    templateUrl: './image-labeling.component.html',
+    styleUrls: ['./image-labeling.component.css'],
 })
 export class ImageLabelingComponent implements OnInit {
+    // label
+    public labels;
+    public selectedLabel: Label;
+
+    public _imagesRoutes;
+    @Input()
+    set imagesRoutes(routes) {
+        this._imagesRoutes = routes;
+        this.getCocoFile(this._imagesRoutes, 0);
+    }
 
-  // label
-  public labels;
-  public selectedLabel: Label;
-
-  public _imagesRoutes;
-  @Input()
-  set imagesRoutes(routes) {
-   this._imagesRoutes = routes;
-   this.getCocoFile(this._imagesRoutes, 0);
-  }
-
-  public imagesIndex = 0;
-
-  public cocoFile: CocoFormat;
-
-  public isHoverComponent;
-  public brushSize: number;
+    public imagesIndex = 0;
 
-  public isDrawing = false;
+    public cocoFile: CocoFormat;
 
-  @ViewChild(ImageContainerComponent) imageView: ImageContainerComponent;
+    public isHoverComponent;
+    public brushSize: number;
 
-  constructor(private reactLabelingService: ReactLabelingService,
-              private polygonLabelingService: PolygonLabelingService,
-              private brushLabelingService: BrushLabelingService,
-              private snackBar: MatSnackBar,
-              private cocoFormatService: CocoFormatService,
-              private labelService: LabelService,
-              public labelingMode: LabelingModeService) { }
+    public isDrawing = false;
 
-  ngOnInit(): void {
-    this.isHoverComponent = false;
-    this.brushSize = 5;
-    this.labelService.getAllLabels().subscribe(res => {
-       this.labels = res;
-    });
-    // this.labels = this.restService.getLabels();
-  }
+    @ViewChild(ImageContainerComponent) imageView: ImageContainerComponent;
 
-  handleImageIndexChange(index) {
-    this.save(this.imagesIndex);
-    this.getCocoFile(this._imagesRoutes, index);
-  }
+    constructor(
+        private reactLabelingService: ReactLabelingService,
+        private polygonLabelingService: PolygonLabelingService,
+        private brushLabelingService: BrushLabelingService,
+        private snackBar: MatSnackBar,
+        private cocoFormatService: CocoFormatService,
+        private labelService: LabelService,
+        public labelingMode: LabelingModeService,
+    ) {}
 
-  getCocoFile(routes, index) {
-      // This is relevant for coco
-      // this.restService.getCocoFileForImage(routes[index]).subscribe(
-      //   coco => {
-      //     if (coco === null) {
-      //       const cocoFile = new CocoFormat();
-      //       this.cocoFormatService.addImage(cocoFile, (routes[index]));
-      //       this.cocoFile = cocoFile;
-      //     } else {
-      //       this.cocoFile = coco as CocoFormat;
-      //     }
-      //     this.imagesIndex = index;
-      //   }
-      // );
-  }
+    ngOnInit(): void {
+        this.isHoverComponent = false;
+        this.brushSize = 5;
+        this.labelService.getAllLabels().subscribe(res => {
+            this.labels = res;
+        });
+        // this.labels = this.restService.getLabels();
+    }
 
-  /* sp-image-view handler */
-  handleMouseDownLeft(layer: Konva.Layer, shift: ICoordinates, position: ICoordinates) {
-    if (this.labelingEnabled()) {
-      switch (this.labelingMode.getMode()) {
-        case LabelingMode.ReactLabeling: this.reactLabelingService.startLabeling(position);
-          break;
-        case LabelingMode.PolygonLabeling: this.polygonLabelingService.startLabeling(position);
-          break;
-        case LabelingMode.BrushLabeling: this.brushLabelingService.startLabeling(position, this.brushSize);
-      }
+    handleImageIndexChange(index) {
+        this.save(this.imagesIndex);
+        this.getCocoFile(this._imagesRoutes, index);
     }
-  }
 
-  handleMouseMove(layer: Konva.Layer, shift: ICoordinates, position: ICoordinates) {
-    switch (this.labelingMode.getMode()) {
-      case LabelingMode.PolygonLabeling: {
-        this.polygonLabelingService.executeLabeling(position);
-        this.polygonLabelingService.tempDraw(layer, shift, this.selectedLabel);
-      }
+    getCocoFile(routes, index) {
+        // This is relevant for coco

Review Comment:
   Yes, this is an old class that we don't need anymore. But my suggestion would be to do it in a separate PR. If something breaks, it will be harder to find the reason. So my suggestion would be to do that in a different PR.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscribe@streampipes.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org