Skip to content

Commit

Permalink
Externalise draw features in a dedicated component
Browse files Browse the repository at this point in the history
  • Loading branch information
MohamedHamouGisaia committed Dec 16, 2024
1 parent 9c0d553 commit 57a7d01
Show file tree
Hide file tree
Showing 18 changed files with 1,227 additions and 861 deletions.
436 changes: 418 additions & 18 deletions package-lock.json

Large diffs are not rendered by default.

21 changes: 11 additions & 10 deletions projects/arlas-map/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,17 @@
"name": "arlas-map",
"version": "27.0.0-map.beta.1",
"peerDependencies": {
"@angular/animations": "^15.2.10",
"@angular/cdk": "^15.2.9",
"@angular/common": "^15.2.10",
"@angular/core": "^15.2.10",
"@angular/forms": "^15.2.10",
"@angular/material": "^15.2.9",
"@angular/platform-browser": "^15.2.10",
"@angular/platform-browser-dynamic": "^15.2.10",
"@angular/router": "^15.2.10",
"@ngx-translate/core": "^14.0.0",
"@angular/animations": "^18.2.13",
"@angular/cdk": "^18.2.14",
"@angular/common": "^18.2.13",
"@angular/compiler": "^18.2.13",
"@angular/core": "^18.2.13",
"@angular/forms": "^18.2.13",
"@angular/material": "^18.2.14",
"@angular/platform-browser": "^18.2.13",
"@angular/platform-browser-dynamic": "^18.2.13",
"@angular/router": "^18.2.13",
"@ngx-translate/core": "^15.0.0",
"@ngx-translate/http-loader": "^7.0.0",
"rxjs": "~7.4.0",
"zone.js": "^0.11.4"
Expand Down
11 changes: 8 additions & 3 deletions projects/arlas-map/src/lib/arlas-map.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,12 @@
<arlas-coordinates *ngIf="displayCurrentCoordinates" [currentLat]="map?.currentLat" [currentLng]="map?.currentLng"
(moveToCoordinates$)="moveToCoordinates($event)"></arlas-coordinates>

<arlas-basemap *ngIf="showBasemapsList" [mapSources]="map.mapSources" [map]="map" (mouseleave)="hideBasemapSwitcher()"
<arlas-basemap *ngIf="showBasemapsList" [mapSources]="mapSources" [map]="map" (mouseleave)="hideBasemapSwitcher()"
(basemapChanged)="onChangeBasemapStyle()"></arlas-basemap>
<div id="polygon-finish-draw-tooltip" class="draw-tooltip--hide" [class.draw-tooltip--show]="drawClickCounter>1">
{{FINISH_DRAWING | translate}}</div>


<arlas-draw *ngIf="!!map" [map]="map" [emptyData]="emptyData" [drawData]="drawData"
[drawButtonEnabled]="drawButtonEnabled" [drawOption]="drawOption"
[drawPolygonVerticesLimit]="drawPolygonVerticesLimit" [preserveDrawingBuffer]="preserveDrawingBuffer"
(onAoiChanged)="onAoiChanged.emit($event)"
(onAoiEdit)="onAoiEdit.emit($event)"></arlas-draw>
671 changes: 51 additions & 620 deletions projects/arlas-map/src/lib/arlas-map.component.ts

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions projects/arlas-map/src/lib/arlas-map.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import { MapSettingsModule } from './map-settings/map-settings.module';
import { MapImportModule } from './map-import/map-import.module';
import { MapImportComponent } from './map-import/map-import.component';
import { MapSettingsComponent } from './map-settings/map-settings.component';
import { ArlasDrawComponent } from './draw/arlas-draw.component';



Expand All @@ -55,6 +56,7 @@ import { MapSettingsComponent } from './map-settings/map-settings.component';
LayerIconComponent,
LegendComponent,
LegendItemComponent,
ArlasDrawComponent,
LayerIdToName,
GetCollectionPipe
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

import { AfterViewInit, ChangeDetectorRef, Component, Inject, OnDestroy, OnInit } from '@angular/core';
import { MAT_DIALOG_DATA, MatDialogRef } from '@angular/material/dialog';
import { marker } from '@colsen1991/ngx-translate-extract-marker';
import { Corner } from '../mapgl/draw/draw.models';
import { MapboxAoiDrawService } from '../mapgl/draw/draw.service';
import { BboxFormGroup } from './bbox-generator.utils';
import { marker } from '@colsen1991/ngx-translate-extract-marker';
import { MapboxAoiDrawService } from '../draw/draw.service';
import { Corner } from '../draw/draw.models';

@Component({
selector: 'arlas-bbox-generator',
Expand Down
2 changes: 2 additions & 0 deletions projects/arlas-map/src/lib/draw/arlas-draw.component.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<div id="polygon-finish-draw-tooltip" class="draw-tooltip--hide" [class.draw-tooltip--show]="drawClickCounter>1">
{{FINISH_DRAWING | translate}}</div>
Original file line number Diff line number Diff line change
Expand Up @@ -16,28 +16,4 @@
* specific language governing permissions and limitations
* under the License.
*/


/**
* This interface proposes all the functions a mapprovider should implement.
* This way prevent changes from impacting other parts of the application in case the mapprovider changes its own interface.
* ex:
* addLayer(){
* provider1.addLayerToMap()
* }
*
* addLayer(){
* provider2.addLayer()
* }
*
* If we change the implementation, as we use addLayer in all our app, the change is transparent.
*/

export interface MapInterface {
addControl(
control: unknown,
position?: 'top-right' | 'top-left' | 'bottom-right' | 'bottom-left',
): this;

getZoom(): number;
}

Loading

0 comments on commit 57a7d01

Please sign in to comment.