Skip to content

Commit

Permalink
+ Removido markers do ol-map
Browse files Browse the repository at this point in the history
  • Loading branch information
JamesCodesUFG committed Jan 31, 2025
1 parent c489205 commit af90aa3
Show file tree
Hide file tree
Showing 10 changed files with 41 additions and 144 deletions.
24 changes: 11 additions & 13 deletions client/src/app/@core/components/ol-map/ol-map.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,54 +27,52 @@ export const DEFAULT_LON = -49.4443537;
export const ZOOM_LEVEL = 4.6;

@Component({
standalone: true,
selector: 'app-ol-map',
templateUrl: './ol-map.component.html',
styleUrls: ['./ol-map.component.scss'],
})
export class OlMapComponent implements AfterViewInit {
public map!: Map;

private layersToFilter: string[] = ['layertype', 'swipe-layer'];

constructor(
private mapService: MapService,
private elementRef: ElementRef,
private cdRef: ChangeDetectorRef
) {
this.map = this.mapService.map;
}
) {}

ngAfterViewInit(): void {
const self = this;

this.setSize();

this.map.setTarget('map')
this.mapService.map.setTarget('map')

this.setControlls();
}

private setControlls(): void {
this.map.addControl(
this.mapService.map.addControl(
new FullScreen({ source: 'main' })
);

this.map.addControl(
this.mapService.map.addControl(
new ScaleLine({
units: 'metric',
bar: true,
text: true,
minWidth: 100,
})
);
this.map.addControl(new Zoom());

this.mapService.map.addControl(new Zoom());
}

private setOnMoveEvent(): void {
const self = this;

this.map.on('moveend', function (event: MapEvent) {
self.map.getLayers().forEach((layer: any) => {
this.mapService.map.on('moveend', function (event: MapEvent) {
self.mapService.map.getLayers().forEach((layer: any) => {
let descriptorType = layer.getProperties().descriptorType;

if (descriptorType === null) return;
Expand Down Expand Up @@ -128,12 +126,12 @@ export class OlMapComponent implements AfterViewInit {
public updateLayer(): void {}

public setMarker(vector: any) {
this.map.addLayer(vector);
this.mapService.map.addLayer(vector);
this.cdRef.detectChanges();
}

public setControl(control: any) {
this.map.addControl(control);
this.mapService.map.addControl(control);
}

private formataCoordenada: (coordinate: Coordinate) => string =
Expand Down

This file was deleted.

Empty file.

This file was deleted.

22 changes: 0 additions & 22 deletions client/src/app/@core/ol-maps/ol-maps.module.ts

This file was deleted.

2 changes: 2 additions & 0 deletions client/src/app/@core/services/map.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ class MapService {
}

public addLayer(layer: BaseLayer): void {
if (!this._map.getLayers().getArray().every(element => element.get('key') != layer.get('key'))) return;

this._map.addLayer(layer);
}

Expand Down
5 changes: 2 additions & 3 deletions client/src/app/map-platform/components.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ import { LayersSidebarComponent } from './components/layers-sidebar/layers-sideb
import { DrawAreaComponent } from './components/general-map/draw_area/draw_area.component';
import { SwipeComponent } from './components/general-map/swipe/swipe.component';
import { DialogMessageComponent } from '@core/components/dialog-message/dialog-message.component';

import { OlMapsModule } from '../@core/ol-maps/ol-maps.module';
import { OlMapComponent } from '@core/components/ol-map/ol-map.component';
import { GeneralMapComponent } from './components/general-map/general-map.component';
import { DatePipe, DecimalPipe } from '@angular/common';
import { GoogleAnalyticsService } from '../@core/services';
Expand Down Expand Up @@ -97,6 +96,7 @@ registerLocaleData(localePt);
DrawAreaComponent
],
imports: [
OlMapComponent,
DialogMessageComponent,
UserInfoComponent,
SliderModule,
Expand Down Expand Up @@ -147,7 +147,6 @@ registerLocaleData(localePt);
RippleModule,
TableModule,
GalleriaModule,
OlMapsModule,
ComponentsRoutingModule,
],
exports: [],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/**
* Angular imports.
*/
import { ChangeDetectorRef, OnDestroy } from '@angular/core';
import { OnDestroy } from '@angular/core';
import { ElementRef, HostListener } from '@angular/core';
import { OnInit, ViewChild, Component } from '@angular/core';
import { DecimalPipe } from '@angular/common';
Expand All @@ -25,14 +25,11 @@ import CircleStyle from 'ol/style/Circle';
import VectorSource from 'ol/source/Vector';
import TileGrid from 'ol/tilegrid/TileGrid';
import * as Proj from 'ol/proj';
import { Feature, MapEvent, Overlay } from 'ol';
import { Draw, Interaction, Modify, Snap } from 'ol/interaction';
import { MapEvent, Overlay } from 'ol';
import { Interaction, Modify, Snap } from 'ol/interaction';
import { BingMaps, XYZ } from 'ol/source';
import { GeoJSON } from 'ol/format';
import { Fill, Stroke, Style } from 'ol/style';
import { LinearRing, LineString } from 'ol/geom';
import { MultiLineString, MultiPoint, MultiPolygon } from 'ol/geom';
import { Point, Polygon } from 'ol/geom';
import { transform, transformExtent } from 'ol/proj';
import { Pixel } from 'ol/pixel';
import * as OlExtent from 'ol/extent.js';
Expand All @@ -46,7 +43,7 @@ import { RulerAreaCtrl, RulerCtrl } from '@core/interactions/ruler';
/**
* Interfaces imports.
*/
import { Ruler, TextFilter, Job, RegionFilter } from '@core/interfaces';
import { Ruler, Job, RegionFilter } from '@core/interfaces';
import { DirtyType, LayerLegend } from '@core/interfaces';
import { Control, Descriptor, DescriptorType } from '@core/interfaces';
import { DescriptorGroup, DescriptorLayer } from '@core/interfaces';
Expand All @@ -56,7 +53,6 @@ import { DescriptorGroup, DescriptorLayer } from '@core/interfaces';
*/
import {
DownloadService,
AnalysisService,
MapAPIService,
GalleryService,
} from '../../../@core/services';
Expand Down Expand Up @@ -91,18 +87,15 @@ import { environment } from '../../../../environments/environment';
/**
* RXJS imports.
*/
import { Subject, Subscription } from 'rxjs';
import { Subscription } from 'rxjs';

/**
* NgRecaptcha imports.
*/
import { ReCaptchaV3Service } from 'ng-recaptcha';
import { OlMapComponent } from '@core/components/ol-map/ol-map.component';
import { AutoCompleteCompleteEvent } from 'primeng/autocomplete';
import { LayerService } from '@core/services/layer.service';
import BaseLayer from 'ol/layer/Base';
import { UserInfoComponent } from '@core/components/user-info-dialog/user-info-dialog.component';
import { UserInfo } from '@core/interfaces/user_info';
import { SwipeComponent } from './swipe/swipe.component';
import { DrawAreaComponent } from './draw_area/draw_area.component';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,7 @@ <h4 class="graphicTitle"> {{graph.text}} </h4>
</p-accordion>

<p-dialog [maximizable]="true" [baseZIndex]="10000" [draggable]="false" [resizable]="false" [modal]="true"
[visible]="dialogData != null" [style]="{width: '50vw'}">
<!-- TODO: Fix header -->
<ng-template [ngIf]="dialogData != null">
[visible]="dialogData.visible" [style]="{width: '50vw'}" (visibleChange)="closeFullscreenMode()">
<ng-template pTemplate="header">
{{ dialogData.title }}
</ng-template>
Expand All @@ -154,7 +152,6 @@ <h4 class="graphicTitle"> {{graph.text}} </h4>
[data]="dialogData.data" [options]="dialogData.options">
</p-chart>
</div>
</ng-template>
</p-dialog>

<ng-template #loadingSpinner>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ class StatisticsSidebarComponent implements OnDestroy {
public summaryData: Map<string, any> = new Map<string, any>();
public graphsData: Array<any> = [];
public rankingData: Array<any> = [];
public dialogData: any | null;
public dialogData = {
title: '',
text: '',
type: '',
data: '',
options: '',
visible: false,
};

// TODO: Estatisticas foram setadas para 1 ano antes do correto. DB não esta retornando dados para o ano certo.
public layersForStatistics: any = {
Expand Down Expand Up @@ -240,7 +247,18 @@ class StatisticsSidebarComponent implements OnDestroy {
type: graph.type,
data: graph.data,
options: graph.options,
fullScreen: true,
visible: true,
};
}

public closeFullscreenMode() {
this.dialogData = {
title: '',
text: '',
type: '',
data: '',
options: '',
visible: false,
};
}

Expand Down

0 comments on commit af90aa3

Please sign in to comment.