Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
hydrogen2oxygen committed Oct 31, 2023
2 parents 1613527 + 93a5eb2 commit 25a92d5
Show file tree
Hide file tree
Showing 8 changed files with 880 additions and 675 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ public class TerritoryInfos {
private Date registerRequest;
private Date returnRequest;

private String simpleFeatureData;

public UUID getUuid() {
return uuid;
}
Expand Down Expand Up @@ -68,4 +70,12 @@ public Date getReturnRequest() {
public void setReturnRequest(Date returnRequest) {
this.returnRequest = returnRequest;
}

public String getSimpleFeatureData() {
return simpleFeatureData;
}

public void setSimpleFeatureData(String simpleFeatureData) {
this.simpleFeatureData = simpleFeatureData;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,8 @@ public int compare(Preacher o1, Preacher o2) {
territoryInfos.setName(territory.getName());
territoryInfos.setAssignDate(lastRegistryEntry.getAssignDate());
territoryInfos.setReturnDate(lastRegistryEntry.getReturnDate());
TerritoryMap territoryMap = getTerritoryMapByNumber(territoryNumber);
territoryInfos.setSimpleFeatureData(territoryMap.getSimpleFeatureData());
dashboard.getTerritories().add(territoryInfos);
}

Expand Down
1,459 changes: 815 additions & 644 deletions server/src/main/territoryMap/package-lock.json

Large diffs are not rendered by default.

5 changes: 2 additions & 3 deletions server/src/main/territoryMap/src/app/app-routing.module.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import {NgModule} from '@angular/core';
import {RouterModule, Routes} from '@angular/router';
import {MapComponent} from "./components/map/map.component";
import {DashboardComponent} from "./components/dashboard/dashboard.component";

const routes: Routes = [
{ path: 'map', component: MapComponent },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ export class MapComponent implements OnInit {
this.id = params['id'];
if (this.id.startsWith("dashboard")) {
this.dashboardMode = true;
this.loadDashboardData(this.id)
} else {
this.loadTerritoryData(this.id);
}
Expand All @@ -165,7 +166,21 @@ export class MapComponent implements OnInit {
});
}

private loadTerritoryData(uuid: string) {
private loadDashboardData(uuid:string) {
this.dataService.loadDashboardData(uuid).subscribe( dashboard => {
dashboard.territories.forEach(terr => {
console.log(terr)
if (terr.simpleFeatureData != null) {
this.readTerritoryMap(terr.number, terr.name, terr.simpleFeatureData);
}
})
this.extent = this.source.getExtent();
this.map?.getView().fit(this.extent);
this.title.setTitle('DASHBOARD TERRITORIES');
})
}

private loadTerritoryData(uuid:string) {

this.dataService.loadTerritoryData(uuid).subscribe(territoryData => {

Expand All @@ -178,28 +193,7 @@ export class MapComponent implements OnInit {
}

if (territoryData.simpleFeatureData != null) {
let feature = this.wktFormat.readFeature(territoryData.simpleFeatureData, {
dataProjection: 'EPSG:3857',
featureProjection: 'EPSG:3857'
});

feature.set('number', territoryData.number);
feature.set('name', '' + territoryData.name);
feature.setId(territoryData.number);
this.source.addFeature(feature);

// @ts-ignore
this.extent = feature.getGeometry().getExtent();
this.map?.getView().fit(this.extent);

this.title.setTitle(territoryData.number + ' ' + territoryData.name);

this.territoryData.streetList.forEach(street => {
let value: boolean = this.local.get(this.territoryData.number + ' ' + street.streetName);
if (value == null) value = false;
street.checked = value;
});

this.readTerritoryMap(territoryData.number, territoryData.name, territoryData.simpleFeatureData);
} else if (territoryData.territories.length > 0) {
this.title.setTitle(territoryData.name);

Expand All @@ -214,11 +208,30 @@ export class MapComponent implements OnInit {
feature.setId(t.number);
this.source.addFeature(feature);
});

this.extent = this.source.getExtent();
this.map?.getView().fit(this.extent);
}

this.extent = this.source.getExtent();
this.map?.getView().fit(this.extent);

});
}

private readTerritoryMap(number:string,name:string,simpleFeatureData:string) {
let feature = this.wktFormat.readFeature(simpleFeatureData, {
dataProjection: 'EPSG:3857',
featureProjection: 'EPSG:3857'
});

feature.set('number', number);
feature.set('name', number + ' ' + name);
feature.setId(number);
this.source.addFeature(feature);
this.title.setTitle(number + ' ' + name);

this.territoryData.streetList.forEach(street => {
let value: boolean = this.local.get(this.territoryData.number + ' ' + street.streetName);
if (value == null) value = false;
street.checked = value;
});
}

Expand Down
1 change: 1 addition & 0 deletions server/src/main/territoryMap/src/app/domains/Dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export class TerritoryInfos {
returnDate:Date|undefined;
registerRequest:Date|undefined;
returnRequest:Date|undefined;
simpleFeatureData: string = '';
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class TerritoryData {
UUID:string = '';
preacherUUID:string = '';
simpleFeatureData: string = '';
number: number = 0;
number: string = '';
name: string = '';
notes: string = '';
lastUpdate: Date = new Date();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,11 @@ export class DesignerComponent implements OnInit, AfterViewInit {

if (!(feature.get('imported') || feature.get('residentialUnit'))) {
// @ts-ignore
if (that.map.getView().getZoom() > 14) {
if (that.map.getView().getZoom() > 14 && feature.get('additionalNote')) {
style.getText().setText(feature.get('name') + "\n" + feature.get('additionalNote'));
} else
// @ts-ignore
if (that.map.getView().getZoom() > 14) {
style.getText().setText(feature.get('name'));
} else {
style.getText().setText('');
Expand Down Expand Up @@ -294,6 +298,9 @@ export class DesignerComponent implements OnInit, AfterViewInit {
this.mapDesign = mapDesign;

let format = new WKT();
let territories = this.congregation.territoriesAssigned;
territories = territories.concat(this.congregation.territoriesOlder4Months)
territories = territories.concat(this.congregation.territoriesOlder8Months)

mapDesign.territoryMapList.forEach(territoryMap => {

Expand All @@ -307,6 +314,8 @@ export class DesignerComponent implements OnInit, AfterViewInit {
feature.set('name', '' + territoryMap.territoryNumber);
feature.set('draft', territoryMap.draft);
feature.setId(territoryMap.territoryNumber);
let territory = territories.find(terr => terr.number == territoryMap.territoryNumber)
if (territory) feature.set('additionalNote', territory.registryEntryList[territory.registryEntryList.length - 1].preacher.name)
this.source.addFeature(feature);

if (territoryMap.residentialUnits) {
Expand Down

0 comments on commit 25a92d5

Please sign in to comment.