diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 4d1a14d4..7d15cbe2 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -188,6 +188,7 @@ import { NodeCreatedLabelStylesFixer } from './components/project-map/helpers/no
import { NonNegativeValidator } from './validators/non-negative-validator';
import { RotationValidator } from './validators/rotation-validator';
import { MapSettingService } from './services/mapsettings.service';
+import { ProjectMapMenuComponent } from './components/project-map/project-map-menu/project-map-menu.component';
import { HelpComponent } from './components/help/help.component';
if (environment.production) {
@@ -308,6 +309,7 @@ if (environment.production) {
ConsoleDeviceActionComponent,
ConsoleComponent,
NodesMenuComponent,
+ ProjectMapMenuComponent,
HelpComponent
],
imports: [
diff --git a/src/app/components/project-map/project-map-menu/project-map-menu.component.html b/src/app/components/project-map/project-map-menu/project-map-menu.component.html
new file mode 100644
index 00000000..b0b20e55
--- /dev/null
+++ b/src/app/components/project-map/project-map-menu/project-map-menu.component.html
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+
diff --git a/src/app/components/project-map/project-map-menu/project-map-menu.component.scss b/src/app/components/project-map/project-map-menu/project-map-menu.component.scss
new file mode 100644
index 00000000..f7626cab
--- /dev/null
+++ b/src/app/components/project-map/project-map-menu/project-map-menu.component.scss
@@ -0,0 +1,24 @@
+.menu-button {
+ outline: 0 !important;
+ transition: 0.5s;
+ margin-bottom: 16px;
+ width: 40px;
+ margin-right: 12px !important;
+ margin-left: 12px !important;
+ background: #263238;
+ padding: 0;
+ border: none;
+ background-color: transparent;
+}
+
+mat-divider.divider {
+ height: 40px;
+ margin-left: 1px;
+ margin-right: 7px;
+ width: 10px;
+ color: gray;
+}
+
+.non-visible {
+ display: none;
+}
diff --git a/src/app/components/project-map/project-map-menu/project-map-menu.component.spec.ts b/src/app/components/project-map/project-map-menu/project-map-menu.component.spec.ts
new file mode 100644
index 00000000..f998feac
--- /dev/null
+++ b/src/app/components/project-map/project-map-menu/project-map-menu.component.spec.ts
@@ -0,0 +1,67 @@
+import { ProjectMapMenuComponent } from "./project-map-menu.component";
+import { ComponentFixture, async, TestBed } from '@angular/core/testing';
+import { MockedDrawingService } from '../project-map.component.spec';
+import { MapSettingService } from '../../../services/mapsettings.service';
+import { MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule } from '@angular/material';
+import { CommonModule } from '@angular/common';
+import { NoopAnimationsModule } from '@angular/platform-browser/animations';
+import { DrawingService } from '../../../services/drawing.service';
+import { ToolsService } from '../../../services/tools.service';
+import { D3MapComponent } from '../../../cartography/components/d3-map/d3-map.component';
+import { ANGULAR_MAP_DECLARATIONS } from '../../../cartography/angular-map.imports';
+import { NO_ERRORS_SCHEMA } from '@angular/core';
+
+describe('ProjectMapMenuComponent', () => {
+ let component: ProjectMapMenuComponent;
+ let fixture: ComponentFixture;
+ let drawingService = new MockedDrawingService();
+ let mapSettingService = new MapSettingService();
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ imports: [MatIconModule, MatToolbarModule, MatMenuModule, MatCheckboxModule, CommonModule, NoopAnimationsModule],
+ providers: [
+ { provide: DrawingService, useValue: drawingService },
+ { provide: ToolsService },
+ { provide: MapSettingService, useValue: mapSettingService }
+ ],
+ declarations: [ProjectMapMenuComponent, D3MapComponent, ...ANGULAR_MAP_DECLARATIONS],
+ schemas: [NO_ERRORS_SCHEMA]
+ }).compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(ProjectMapMenuComponent);
+ component = fixture.componentInstance;
+ });
+
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('should reset choice on draw menu after saving drawing', () => {
+ spyOn(component, 'resetDrawToolChoice');
+
+ component.onDrawingSaved();
+
+ expect(component.resetDrawToolChoice).toHaveBeenCalled();
+ });
+
+ it('should call map settings service when lock value was changed', () => {
+ spyOn(mapSettingService, 'changeMapLockValue');
+
+ component.changeLockValue();
+
+ expect(mapSettingService.changeMapLockValue).toHaveBeenCalled();
+ });
+
+ it('should call map settings service with proper value', () => {
+ spyOn(mapSettingService, 'changeMapLockValue');
+
+ component.changeLockValue();
+ expect(mapSettingService.changeMapLockValue).toHaveBeenCalledWith(true);
+
+ component.changeLockValue();
+ expect(mapSettingService.changeMapLockValue).toHaveBeenCalledWith(false);
+ });
+});
diff --git a/src/app/components/project-map/project-map-menu/project-map-menu.component.ts b/src/app/components/project-map/project-map-menu/project-map-menu.component.ts
new file mode 100644
index 00000000..f7edbc45
--- /dev/null
+++ b/src/app/components/project-map/project-map-menu/project-map-menu.component.ts
@@ -0,0 +1,110 @@
+import { Component, OnInit, OnDestroy, Input } from '@angular/core';
+import { Project } from '../../../models/project';
+import { Server } from '../../../models/server';
+import { ToolsService } from '../../../services/tools.service';
+import { MapSettingService } from '../../../services/mapsettings.service';
+import { DrawingService } from '../../../services/drawing.service';
+
+
+@Component({
+ selector: 'app-project-map-menu',
+ templateUrl: './project-map-menu.component.html',
+ styleUrls: ['./project-map-menu.component.scss']
+})
+export class ProjectMapMenuComponent implements OnInit, OnDestroy {
+ @Input() project: Project;
+ @Input() server: Server;
+
+ public selectedDrawing: string;
+ public drawTools = {
+ isRectangleChosen: false,
+ isEllipseChosen: false,
+ isLineChosen: false,
+ isTextChosen: false
+ };
+ public isLocked: boolean = false;
+
+ constructor(
+ private toolsService: ToolsService,
+ private mapSettingsService: MapSettingService,
+ private drawingService: DrawingService
+ ) {}
+
+ ngOnInit() {}
+
+ public addDrawing(selectedObject: string) {
+ switch (selectedObject) {
+ case 'rectangle':
+ this.drawTools.isTextChosen = false;
+ this.drawTools.isEllipseChosen = false;
+ this.drawTools.isRectangleChosen = !this.drawTools.isRectangleChosen;
+ this.drawTools.isLineChosen = false;
+ break;
+ case 'ellipse':
+ this.drawTools.isTextChosen = false;
+ this.drawTools.isEllipseChosen = !this.drawTools.isEllipseChosen;
+ this.drawTools.isRectangleChosen = false;
+ this.drawTools.isLineChosen = false;
+ break;
+ case 'line':
+ this.drawTools.isTextChosen = false;
+ this.drawTools.isEllipseChosen = false;
+ this.drawTools.isRectangleChosen = false;
+ this.drawTools.isLineChosen = !this.drawTools.isLineChosen;
+ break;
+ case 'text':
+ this.drawTools.isTextChosen = !this.drawTools.isTextChosen;
+ this.drawTools.isEllipseChosen = false;
+ this.drawTools.isRectangleChosen = false;
+ this.drawTools.isLineChosen = false;
+ this.toolsService.textAddingToolActivation(this.drawTools.isTextChosen);
+ break;
+ }
+
+ this.selectedDrawing = this.selectedDrawing === selectedObject ? '' : selectedObject;
+ }
+
+ public onDrawingSaved() {
+ this.resetDrawToolChoice();
+ }
+
+ public resetDrawToolChoice() {
+ this.drawTools.isRectangleChosen = false;
+ this.drawTools.isEllipseChosen = false;
+ this.drawTools.isLineChosen = false;
+ this.drawTools.isTextChosen = false;
+ this.selectedDrawing = '';
+ this.toolsService.textAddingToolActivation(this.drawTools.isTextChosen);
+ }
+
+ public changeLockValue() {
+ this.isLocked = !this.isLocked;
+ this.mapSettingsService.changeMapLockValue(this.isLocked);
+ }
+
+ public uploadImageFile(event) {
+ this.readImageFile(event.target);
+ }
+
+ private readImageFile(fileInput) {
+ let file: File = fileInput.files[0];
+ let fileReader: FileReader = new FileReader();
+ let imageToUpload = new Image();
+
+ fileReader.onloadend = () => {
+ let image = fileReader.result;
+ let svg = this.createSvgFileForImage(image, imageToUpload);
+ this.drawingService.add(this.server, this.project.project_id, -(imageToUpload.width/2), -(imageToUpload.height/2), svg).subscribe(() => {});
+ }
+
+ imageToUpload.onload = () => { fileReader.readAsDataURL(file) };
+ imageToUpload.src = window.URL.createObjectURL(file);
+ }
+
+ private createSvgFileForImage(image: string|ArrayBuffer, imageToUpload: HTMLImageElement) {
+ return ``
+ }
+
+ ngOnDestroy() {}
+}
diff --git a/src/app/components/project-map/project-map.component.html b/src/app/components/project-map/project-map.component.html
index 745d9fb3..036c470f 100644
--- a/src/app/components/project-map/project-map.component.html
+++ b/src/app/components/project-map/project-map.component.html
@@ -87,77 +87,14 @@
-