infusion-code/angular-maps

View on GitHub

Showing 344 of 396 total issues

Function CreateMarkers has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

public CreateMarkers(options: Array<IMarkerOptions>, markerIcon?: IMarkerIconInfo): Promise<Array<Marker>> {
const payload = (icon: string, op: Array<IMarkerOptions>): Array<BingMarker> => {
const markers: Array<BingMarker> = op.map(mo => {
let s: string;
const o: Microsoft.Maps.IPushpinOptions = BingConversions.TranslateMarkerOptions(mo);
Severity: Minor
Found in src/services/bing/bing-layer-base.ts - About 2 hrs to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

constructor( @Optional() private _config: GoogleMapAPILoaderConfig, private _windowRef: WindowRef, private _documentRef: DocumentRef) {
super();
if (this._config === null || this._config === undefined) {
this._config = DEFAULT_CONFIGURATION;
}
Severity: Major
Found in src/services/google/google-map-api-loader.service.ts and 1 other location - About 2 hrs to fix
src/services/bing/bing-map.api-loader.service.ts on lines 84..89

Similar blocks of code found in 2 locations. Consider refactoring.
Open

constructor( @Optional() private _config: BingMapAPILoaderConfig, private _windowRef: WindowRef, private _documentRef: DocumentRef) {
super();
if (this._config === null || this._config === undefined) {
this._config = DEFAULT_CONFIGURATION;
}
Severity: Major
Found in src/services/bing/bing-map.api-loader.service.ts and 1 other location - About 2 hrs to fix
src/services/google/google-map-api-loader.service.ts on lines 131..136

Identical blocks of code found in 2 locations. Consider refactoring.
Open

public SetMap(map: Microsoft.Maps.Map): void {
const m: Microsoft.Maps.Map = this.GetMap();
if (map === m) { return; }
if (m) {
m.layers.remove(this);
Severity: Major
Found in src/models/bing/bing-label.ts and 1 other location - About 2 hrs to fix
src/models/bing/bing-canvas-overlay.ts on lines 153..162

Identical blocks of code found in 2 locations. Consider refactoring.
Open

public SetMap(map: Microsoft.Maps.Map): void {
const m: Microsoft.Maps.Map = this.GetMap();
if (map === m) { return; }
if (m) {
m.layers.remove(this);
Severity: Major
Found in src/models/bing/bing-canvas-overlay.ts and 1 other location - About 2 hrs to fix
src/models/bing/bing-label.ts on lines 101..110

Identical blocks of code found in 6 locations. Consider refactoring.
Open

if (iconInfo.id != null && Marker.MarkerCache.has(iconInfo.id)) {
const mi: IMarkerIconCacheEntry = Marker.MarkerCache.get(iconInfo.id);
iconInfo.size = mi.markerSize;
return mi.markerIconString;
}
Severity: Major
Found in src/models/marker.ts and 5 other locations - About 2 hrs to fix
src/models/marker.ts on lines 116..120
src/models/marker.ts on lines 209..213
src/models/marker.ts on lines 261..265
src/models/marker.ts on lines 319..323
src/models/marker.ts on lines 373..377

Identical blocks of code found in 6 locations. Consider refactoring.
Open

if (iconInfo.id != null && Marker.MarkerCache.has(iconInfo.id)) {
const mi: IMarkerIconCacheEntry = Marker.MarkerCache.get(iconInfo.id);
iconInfo.size = mi.markerSize;
return mi.markerIconString;
}
Severity: Major
Found in src/models/marker.ts and 5 other locations - About 2 hrs to fix
src/models/marker.ts on lines 116..120
src/models/marker.ts on lines 162..166
src/models/marker.ts on lines 209..213
src/models/marker.ts on lines 319..323
src/models/marker.ts on lines 373..377

Identical blocks of code found in 6 locations. Consider refactoring.
Open

if (iconInfo.id != null && Marker.MarkerCache.has(iconInfo.id)) {
const mi: IMarkerIconCacheEntry = Marker.MarkerCache.get(iconInfo.id);
iconInfo.size = mi.markerSize;
return mi.markerIconString;
}
Severity: Major
Found in src/models/marker.ts and 5 other locations - About 2 hrs to fix
src/models/marker.ts on lines 116..120
src/models/marker.ts on lines 162..166
src/models/marker.ts on lines 209..213
src/models/marker.ts on lines 261..265
src/models/marker.ts on lines 373..377

Identical blocks of code found in 6 locations. Consider refactoring.
Open

if (iconInfo.id != null && Marker.MarkerCache.has(iconInfo.id)) {
const mi: IMarkerIconCacheEntry = Marker.MarkerCache.get(iconInfo.id);
iconInfo.size = mi.markerSize;
return mi.markerIconString;
}
Severity: Major
Found in src/models/marker.ts and 5 other locations - About 2 hrs to fix
src/models/marker.ts on lines 116..120
src/models/marker.ts on lines 162..166
src/models/marker.ts on lines 209..213
src/models/marker.ts on lines 261..265
src/models/marker.ts on lines 319..323

Identical blocks of code found in 6 locations. Consider refactoring.
Open

if (iconInfo.id != null && Marker.MarkerCache.has(iconInfo.id)) {
const mi: IMarkerIconCacheEntry = Marker.MarkerCache.get(iconInfo.id);
iconInfo.size = mi.markerSize;
return mi.markerIconString;
}
Severity: Major
Found in src/models/marker.ts and 5 other locations - About 2 hrs to fix
src/models/marker.ts on lines 116..120
src/models/marker.ts on lines 162..166
src/models/marker.ts on lines 261..265
src/models/marker.ts on lines 319..323
src/models/marker.ts on lines 373..377

Identical blocks of code found in 6 locations. Consider refactoring.
Open

if (iconInfo.id != null && Marker.MarkerCache.has(iconInfo.id)) {
const mi: IMarkerIconCacheEntry = Marker.MarkerCache.get(iconInfo.id);
iconInfo.size = mi.markerSize;
return mi.markerIconString;
}
Severity: Major
Found in src/models/marker.ts and 5 other locations - About 2 hrs to fix
src/models/marker.ts on lines 162..166
src/models/marker.ts on lines 209..213
src/models/marker.ts on lines 261..265
src/models/marker.ts on lines 319..323
src/models/marker.ts on lines 373..377

Similar blocks of code found in 3 locations. Consider refactoring.
Open

public SetOptions(polygon: MapPolygonDirective, options: IPolygonOptions): Promise<void> {
return this._polygons.get(polygon).then((l: Polygon) => { l.SetOptions(options); });
}
Severity: Major
Found in src/services/google/google-polygon.service.ts and 2 other locations - About 2 hrs to fix
src/services/bing/bing-polygon.service.ts on lines 167..169
src/services/google/google-infobox.service.ts on lines 167..171

Identical blocks of code found in 3 locations. Consider refactoring.
Open

if (b.getCenter().lng() < b.getSouthWest().lng() ||
b.getCenter().lng() > b.getNorthEast().lng()) { crossesDateLine = true; }
Severity: Major
Found in src/services/google/google-map.service.ts and 2 other locations - About 2 hrs to fix
src/services/google/google-map.service.ts on lines 454..455
src/services/google/google-marker.service.ts on lines 191..192

Similar blocks of code found in 3 locations. Consider refactoring.
Open

public SetOptions(polygon: MapPolygonDirective, options: IPolygonOptions): Promise<void> {
return this._polygons.get(polygon).then((l: Polygon) => { l.SetOptions(options); });
}
Severity: Major
Found in src/services/bing/bing-polygon.service.ts and 2 other locations - About 2 hrs to fix
src/services/google/google-infobox.service.ts on lines 167..171
src/services/google/google-polygon.service.ts on lines 152..154

Identical blocks of code found in 3 locations. Consider refactoring.
Open

if (b.getCenter().lng() < b.getSouthWest().lng() ||
b.getCenter().lng() > b.getNorthEast().lng()) { crossesDateLine = true; }
Severity: Major
Found in src/services/google/google-map.service.ts and 2 other locations - About 2 hrs to fix
src/services/google/google-map.service.ts on lines 426..427
src/services/google/google-marker.service.ts on lines 191..192

Identical blocks of code found in 3 locations. Consider refactoring.
Open

if (b.getCenter().lng() < b.getSouthWest().lng() ||
b.getCenter().lng() > b.getNorthEast().lng()) { crossesDateLine = true; }
Severity: Major
Found in src/services/google/google-marker.service.ts and 2 other locations - About 2 hrs to fix
src/services/google/google-map.service.ts on lines 426..427
src/services/google/google-map.service.ts on lines 454..455

Function ngOnChanges has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

public ngOnChanges(changes: { [key: string]: SimpleChange }) {
let shouldSetOptions: boolean = false;
const o: IClusterOptions = {
id: this._id
};
Severity: Minor
Found in src/components/map-marker-layer.ts - About 2 hrs to fix

Similar blocks of code found in 4 locations. Consider refactoring.
Open

public UpdateAnchor(marker: MapMarkerDirective): Promise<void> {
return this._markers.get(marker).then((m: Marker) => {
m.SetAnchor(marker.Anchor);
});
}
Severity: Major
Found in src/services/bing/bing-marker.service.ts and 3 other locations - About 2 hrs to fix
src/services/bing/bing-marker.service.ts on lines 309..311
src/services/google/google-marker.service.ts on lines 234..238
src/services/google/google-marker.service.ts on lines 285..287

Similar blocks of code found in 2 locations. Consider refactoring.
Open

m.AddListener('dragend', (e: MouseEvent) => this.DragEnd.emit({
Marker: m,
Click: e,
Location: this._markerService.GetCoordinatesFromClick(e),
Pixels: this._markerService.GetPixelsFromClick(e)
Severity: Major
Found in src/components/map-marker-layer.ts and 1 other location - About 2 hrs to fix
src/components/map-marker-layer.ts on lines 453..458

Similar blocks of code found in 4 locations. Consider refactoring.
Open

public UpdateLabel(marker: MapMarkerDirective): Promise<void> {
return this._markers.get(marker).then((m: Marker) => { m.SetLabel(marker.Label); });
}
Severity: Major
Found in src/services/bing/bing-marker.service.ts and 3 other locations - About 2 hrs to fix
src/services/bing/bing-marker.service.ts on lines 249..253
src/services/google/google-marker.service.ts on lines 234..238
src/services/google/google-marker.service.ts on lines 285..287
Severity
Category
Status
Source
Language