You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@streampipes.apache.org by ze...@apache.org on 2020/08/26 15:16:44 UTC

[incubator-streampipes] 02/05: Fix image bar

This is an automated email from the ASF dual-hosted git repository.

zehnder pushed a commit to branch dev
in repository https://gitbox.apache.org/repos/asf/incubator-streampipes.git

commit 6d740836ad13d8f4fcfc69cb575d38961b3d3e8b
Author: Philipp Zehnder <ze...@fzi.de>
AuthorDate: Wed Aug 26 16:32:06 2020 +0200

    Fix image bar
---
 .../components/image-bar/image-bar.component.html  |  30 +++++-
 .../components/image-bar/image-bar.component.ts    |  13 ++-
 .../image-categorize.component.html                |  18 ++--
 .../image-labeling/image-labeling.component.html   | 112 ++++++++++-----------
 .../image/image-viewer/image-viewer.component.html |   2 +-
 5 files changed, 104 insertions(+), 71 deletions(-)

diff --git a/ui/src/app/core-ui/image/components/image-bar/image-bar.component.html b/ui/src/app/core-ui/image/components/image-bar/image-bar.component.html
index d768eaf..718d794 100644
--- a/ui/src/app/core-ui/image/components/image-bar/image-bar.component.html
+++ b/ui/src/app/core-ui/image/components/image-bar/image-bar.component.html
@@ -16,13 +16,37 @@
   ~
   -->
 
+<div fxLayout="row" fxLayoutAlign="center center"><div>{{selectedIndex + 1}} / {{maxImages}}</div></div>
+
 <div fxLayout="row" fxLayoutAlign="space-around center" >
     <button mat-icon-button (click)="nextPage()"> <mat-icon>skip_previous</mat-icon></button>
     <button mat-icon-button (click)="nextImage()"> <mat-icon>keyboard_arrow_left</mat-icon></button>
 
-    <div fxLayout="row" fxLayoutAlign="center " class="imageBar">
-        <img *ngFor="let src of imagesSrcs; let i = index" src="{{this.restService.getImageUrl(src)}}" (click)="changeImage(i)"
-             [style.border]="i == selectedIndex ? '5px solid #39b54a' : 'none'" style="height: 65px">
+<!--    <div fxLayout="row" fxLayoutAlign="center " class="imageBar">-->
+<!--        <img *ngFor="let src of _imageRoutes; let i = index" src="{{this.restService.getImageUrl(src)}}" (click)="changeImage(i)"-->
+<!--             [style.border]="i == selectedIndex ? '5px solid #39b54a' : 'none'" style="height: 65px">-->
+<!--    </div>-->
+
+    <div fxLayout="row" fxLayoutAlign="center center"  class="imageBar">
+        <div fxFlex="40" fxLayoutAlign="end center">
+            <img *ngIf="selectedIndex >= 3" src="{{this.restService.getImageUrl(_imageRoutes[selectedIndex - 3])}}" (click)="changeImage(selectedIndex - 3)" style="height: 65px">
+            <img *ngIf="selectedIndex >= 2" src="{{this.restService.getImageUrl(_imageRoutes[selectedIndex - 2])}}" (click)="changeImage(selectedIndex - 2)" style="height: 65px">
+            <img *ngIf="selectedIndex >= 1" src="{{this.restService.getImageUrl(_imageRoutes[selectedIndex - 1])}}" (click)="changeImage(selectedIndex - 1)" style="height: 65px">
+        </div>
+
+        <div fxFlex="20">
+            <div fxLayout="row" fxLayoutAlign="center">
+                <img  src="{{this.restService.getImageUrl(_imageRoutes[selectedIndex])}}" (click)="changeImage(3)" style="border: '5px solid #39b54a'; height: 65px">
+            </div>
+        </div>
+
+        <div fxFlex="40">
+            <div fxLayout="row" fxLayoutAlign="start center">
+                <img *ngIf="selectedIndex < maxImages - 1" src="{{this.restService.getImageUrl(_imageRoutes[selectedIndex + 1])}}" (click)="changeImage(selectedIndex + 1)" style="height: 65px">
+                <img *ngIf="selectedIndex < maxImages - 2" src="{{this.restService.getImageUrl(_imageRoutes[selectedIndex + 2])}}" (click)="changeImage(selectedIndex + 2)" style="height: 65px">
+                <img *ngIf="selectedIndex < maxImages - 3" src="{{this.restService.getImageUrl(_imageRoutes[selectedIndex + 3])}}" (click)="changeImage(selectedIndex + 3)" style="height: 65px">
+            </div>
+        </div>
     </div>
 
 
diff --git a/ui/src/app/core-ui/image/components/image-bar/image-bar.component.ts b/ui/src/app/core-ui/image/components/image-bar/image-bar.component.ts
index 08ccbd6..bdccea4 100644
--- a/ui/src/app/core-ui/image/components/image-bar/image-bar.component.ts
+++ b/ui/src/app/core-ui/image/components/image-bar/image-bar.component.ts
@@ -17,6 +17,7 @@
 
 import { Component, EventEmitter, HostListener, Input, OnInit, Output } from '@angular/core';
 import { DatalakeRestService } from '../../../../core-services/datalake/datalake-rest.service';
+import { DetectedBoxModel } from '../../../../app-transport-monitoring/model/detected-box.model';
 
 @Component({
   selector: 'sp-image-bar',
@@ -25,11 +26,19 @@ import { DatalakeRestService } from '../../../../core-services/datalake/datalake
 })
 export class ImageBarComponent implements OnInit {
 
-  @Input() imagesSrcs: string [];
+  public _imageRoutes;
+
+  @Input()
+  set imagesRoutes(imageRoutes) {
+    this.maxImages = imageRoutes.length;
+    this._imageRoutes = imageRoutes;
+  }
   @Input() selectedIndex: number;
   @Input() enableShortCuts: boolean;
 
   @Output() indexChange: EventEmitter<number> = new EventEmitter<number>();
+
+  public maxImages;
   // @Output() pageUp: EventEmitter<void> = new EventEmitter<void>();
   // @Output() pageDown: EventEmitter<void> = new EventEmitter<void>();
 
@@ -48,7 +57,7 @@ export class ImageBarComponent implements OnInit {
 
   }
   previousImage() {
-    if (this.selectedIndex < this.imagesSrcs.length - 1) {
+    if (this.selectedIndex < this._imageRoutes.length - 1) {
       this.indexChange.emit(this.selectedIndex + 1);
     } else {
       // this.pageDown.emit();
diff --git a/ui/src/app/core-ui/image/image-categorize/image-categorize.component.html b/ui/src/app/core-ui/image/image-categorize/image-categorize.component.html
index 2b090d1..1cb3110 100644
--- a/ui/src/app/core-ui/image/image-categorize/image-categorize.component.html
+++ b/ui/src/app/core-ui/image/image-categorize/image-categorize.component.html
@@ -46,14 +46,14 @@
             </div>
         </div>
         <br />
-        <div fxLayout="row" fxLayoutAlign="center center"><div>{{pageIndex + 1}} / {{pageSum}}</div></div>
-        <sp-image-bar style="width: 100%"
-                      [imagesSrcs]="imagesSrcs"
-                      [selectedIndex]="imagesIndex"
-                      [enableShortCuts]="true"
-                      (indexChange)="handleImageIndexChange($event)"
-                      (pageUp)="handleImagePageUp($event)"
-                      (pageDown)="handleImagePageDown($event)">
-        </sp-image-bar>
+<!--        <div fxLayout="row" fxLayoutAlign="center center"><div>{{pageIndex + 1}} / {{pageSum}}</div></div>-->
+<!--        <sp-image-bar style="width: 100%"-->
+<!--                      [imagesSrcs]="imagesSrcs"-->
+<!--                      [selectedIndex]="imagesIndex"-->
+<!--                      [enableShortCuts]="true"-->
+<!--                      (indexChange)="handleImageIndexChange($event)"-->
+<!--                      (pageUp)="handleImagePageUp($event)"-->
+<!--                      (pageDown)="handleImagePageDown($event)">-->
+<!--        </sp-image-bar>-->
     </div>
 </div>
diff --git a/ui/src/app/core-ui/image/image-labeling/image-labeling.component.html b/ui/src/app/core-ui/image/image-labeling/image-labeling.component.html
index c464c71..66c4db8 100644
--- a/ui/src/app/core-ui/image/image-labeling/image-labeling.component.html
+++ b/ui/src/app/core-ui/image/image-labeling/image-labeling.component.html
@@ -21,64 +21,64 @@
     <div fxLayout="column" fxLayoutAlign="space-between " >
         <div  fxLayout="row" fxLayoutAlign="space-around start">
 
-            <sp-image-labels style="width: 270px"
-                    [labels]="labels"
-                    [enableShortCuts]="isHoverComponent"
-                    (labelChange)="handleLabelChange($event)">
-            </sp-image-labels>
+<!--            <sp-image-labels style="width: 270px"-->
+<!--                    [labels]="labels"-->
+<!--                    [enableShortCuts]="isHoverComponent"-->
+<!--                    (labelChange)="handleLabelChange($event)">-->
+<!--            </sp-image-labels>-->
 
-            <div fxLayout="column" fxLayoutAlign="space-between " >
-                <div style="display: flex; position: relative">
-                    <button mat-button matTooltip="Edit Annotations"
-                            (click)="labelingMode.setNoneMode()" [style.background-color]="labelingMode.isNoneMode() ? 'lightgrey' : 'white'"> <mat-icon>create</mat-icon></button>
-                    <button mat-button matTooltip="Create React Annotation"
-                            (click)="labelingMode.setReactMode()" [style.background-color]="labelingMode.isReactMode() ? 'lightgrey' : 'white'"> <mat-icon>crop_3_2</mat-icon></button>
-                    <button mat-button matTooltip="Create Polygon Annotation"
-                            (click)="labelingMode.setPolygonMode()" [style.background-color]="labelingMode.isPolygonMode() ? 'lightgrey' : 'white'"> <mat-icon>details</mat-icon></button>
-                    <button mat-button matTooltip="Create Brush Annotation"
-                            (click)="labelingMode.setBrushMode()" [style.background-color]="labelingMode.isBrushMode() ? 'lightgrey' : 'white'"> <mat-icon>blur_circular</mat-icon></button>
-                    <mat-slider [min]="1"  [max]="50" [step]="1" [thumbLabel]="true" [(ngModel)]="brushSize"></mat-slider>
-                    <button mat-button (click)="save()" style="position: absolute; right: 0px;"> <mat-icon>save</mat-icon></button>
-                    <button mat-button matTooltip="Description" [matMenuTriggerFor]="aboveMenu">
-                            <span class="material-icons">
-                        info
-                    </span></button>
-                        <mat-menu #aboveMenu="matMenu" yPosition="above">
-                                <p><em>The Description of the selected image</em></p>
-                        </mat-menu>
-                    
-                </div>
+<!--            <div fxLayout="column" fxLayoutAlign="space-between " >-->
+<!--                <div style="display: flex; position: relative">-->
+<!--                    <button mat-button matTooltip="Edit Annotations"-->
+<!--                            (click)="labelingMode.setNoneMode()" [style.background-color]="labelingMode.isNoneMode() ? 'lightgrey' : 'white'"> <mat-icon>create</mat-icon></button>-->
+<!--                    <button mat-button matTooltip="Create React Annotation"-->
+<!--                            (click)="labelingMode.setReactMode()" [style.background-color]="labelingMode.isReactMode() ? 'lightgrey' : 'white'"> <mat-icon>crop_3_2</mat-icon></button>-->
+<!--                    <button mat-button matTooltip="Create Polygon Annotation"-->
+<!--                            (click)="labelingMode.setPolygonMode()" [style.background-color]="labelingMode.isPolygonMode() ? 'lightgrey' : 'white'"> <mat-icon>details</mat-icon></button>-->
+<!--                    <button mat-button matTooltip="Create Brush Annotation"-->
+<!--                            (click)="labelingMode.setBrushMode()" [style.background-color]="labelingMode.isBrushMode() ? 'lightgrey' : 'white'"> <mat-icon>blur_circular</mat-icon></button>-->
+<!--                    <mat-slider [min]="1"  [max]="50" [step]="1" [thumbLabel]="true" [(ngModel)]="brushSize"></mat-slider>-->
+<!--                    <button mat-button (click)="save()" style="position: absolute; right: 0px;"> <mat-icon>save</mat-icon></button>-->
+<!--                    <button mat-button matTooltip="Description" [matMenuTriggerFor]="aboveMenu">-->
+<!--                            <span class="material-icons">-->
+<!--                        info-->
+<!--                    </span></button>-->
+<!--                        <mat-menu #aboveMenu="matMenu" yPosition="above">-->
+<!--                                <p><em>The Description of the selected image</em></p>-->
+<!--                        </mat-menu>-->
+<!--                    -->
+<!--                </div>-->
 
-                <sp-image-container
-                        [imageSrc]="imagesSrcs[imagesIndex]"
-                        (childRedraw)="handleChildRedraw($event[0], $event[1])"
-                        (mouseDownLeft)="handleMouseDownLeft($event[0], $event[1], $event[2])"
-                        (mouseMove)="handleMouseMove($event[0], $event[1], $event[2])"
-                        (mouseMoveLeft)="handleMouseMoveLeft($event[0], $event[1], $event[2])"
-                        (mouseUpLeft)="handleMouseUpLeft($event[0], $event[1], $event[2], $event[3])"
-                        (shortCut)="handleImageViewShortCuts($event)"
-                        (dbclick)="handleImageViewDBClick($event[0], $event[1], $event[2])"
-                        (mouseDownRight)="handleMouseDownRight($event[0], $event[1], $event[2])"
-                        (isDrawing)="handleIsDrawing($event)">
-                </sp-image-container>
-            </div>
+<!--                <sp-image-container-->
+<!--                        [imageSrc]="imagesSrcs[imagesIndex]"-->
+<!--                        (childRedraw)="handleChildRedraw($event[0], $event[1])"-->
+<!--                        (mouseDownLeft)="handleMouseDownLeft($event[0], $event[1], $event[2])"-->
+<!--                        (mouseMove)="handleMouseMove($event[0], $event[1], $event[2])"-->
+<!--                        (mouseMoveLeft)="handleMouseMoveLeft($event[0], $event[1], $event[2])"-->
+<!--                        (mouseUpLeft)="handleMouseUpLeft($event[0], $event[1], $event[2], $event[3])"-->
+<!--                        (shortCut)="handleImageViewShortCuts($event)"-->
+<!--                        (dbclick)="handleImageViewDBClick($event[0], $event[1], $event[2])"-->
+<!--                        (mouseDownRight)="handleMouseDownRight($event[0], $event[1], $event[2])"-->
+<!--                        (isDrawing)="handleIsDrawing($event)">-->
+<!--                </sp-image-container>-->
+<!--            </div>-->
 
-            <sp-image-annotations style="width: 270px"
-                    [annotations]="this.cocoFiles[this.imagesIndex]?.annotations"
-                    [labels]="labels"
-                    (changeAnnotationLabel)="handleChangeAnnotationLabel($event)"
-                    (deleteAnnotation)="handleDeleteAnnotation($event)">
-            </sp-image-annotations>
-        </div>
-        <br />
-        <div fxLayout="row" fxLayoutAlign="center center"><div>{{pageIndex + 1}} / {{pageSum}}</div></div>
-        <sp-image-bar style="width: 100%"
-                [imagesSrcs]="imagesSrcs"
-                [selectedIndex]="imagesIndex"
-                [enableShortCuts]="isHoverComponent"
-                (indexChange)="handleImageIndexChange($event)"
-                (pageUp)="handleImagePageUp($event)"
-                (pageDown)="handleImagePageDown($event)">
-        </sp-image-bar>
+<!--            <sp-image-annotations style="width: 270px"-->
+<!--                    [annotations]="this.cocoFiles[this.imagesIndex]?.annotations"-->
+<!--                    [labels]="labels"-->
+<!--                    (changeAnnotationLabel)="handleChangeAnnotationLabel($event)"-->
+<!--                    (deleteAnnotation)="handleDeleteAnnotation($event)">-->
+<!--            </sp-image-annotations>-->
+<!--        </div>-->
+<!--        <br />-->
+<!--        <div fxLayout="row" fxLayoutAlign="center center"><div>{{pageIndex + 1}} / {{pageSum}}</div></div>-->
+<!--        <sp-image-bar style="width: 100%"-->
+<!--                [imagesSrcs]="imagesSrcs"-->
+<!--                [selectedIndex]="imagesIndex"-->
+<!--                [enableShortCuts]="isHoverComponent"-->
+<!--                (indexChange)="handleImageIndexChange($event)"-->
+<!--                (pageUp)="handleImagePageUp($event)"-->
+<!--                (pageDown)="handleImagePageDown($event)">-->
+<!--        </sp-image-bar>-->
     </div>
 </div>
\ No newline at end of file
diff --git a/ui/src/app/core-ui/image/image-viewer/image-viewer.component.html b/ui/src/app/core-ui/image/image-viewer/image-viewer.component.html
index 87e4a3c..adcc65d 100644
--- a/ui/src/app/core-ui/image/image-viewer/image-viewer.component.html
+++ b/ui/src/app/core-ui/image/image-viewer/image-viewer.component.html
@@ -29,7 +29,7 @@
 
 <!--        <div fxLayout="row" fxLayoutAlign="center center"><div>{{pageIndex + 1}} / {{pageSum}}</div></div>-->
         <sp-image-bar style="width: 100%"
-                      [imagesSrcs]="imagesRoutes"
+                      [imagesRoutes]="imagesRoutes"
                       [selectedIndex]="imagesIndex"
                       [enableShortCuts]="true"
                       (indexChange)="handleImageIndexChange($event)">