Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.props.spec.instances.forEach((node, index)=> {
if(!node){
return undefined; // stop processing this iteration
}
if(node.weight){
weightArr.push(node.weight);
}
if(node.hint){
hintArr.push(node.hint);
}
if (node.value.indexOf('POLYGON') !== -1 || node.value.indexOf('Polygon') !== -1 || node.value.indexOf('MULTIPOLYGON') !== -1 || node.value.indexOf('MultiPolygon') !== -1 || node.value.indexOf('LineString') !== -1 || node.value.indexOf('MultiLineString') !== -1) {
let wkt = new Wkt.Wkt();
wkt.read(node.value);
if(wkt.components && wkt.components.length && wkt.components[0].length){
zoomLevel = 8;
if(this.props.zoomLevel){
zoomLevel = this.props.zoomLevel;
}
try {
if(!focusPoint){
focusPoint = self.getFocusPoint(node.value, wkt.components);
}
shapesArr.push(wkt.toJson());
}
catch(err) {
console.log(err.message);
}
if(this.props.config && this.props.config.shapeColor){
shapeColor = this.props.config.shapeColor;
}
let mapHeight, mapWidth;
if(this.props.config){
if(this.props.config.mapHeight){
mapHeight = this.props.config.mapHeight;
}
if(this.props.config.mapWidth){
mapWidth = this.props.config.mapWidth;
}
}
outputDIV = <span> {val} </span>;
//identify the type of geo shape
if (val.indexOf('POLYGON') !== -1 || val.indexOf('Polygon') !== -1 || val.indexOf('MULTIPOLYGON') !== -1 || val.indexOf('MultiPolygon') !== -1 || val.indexOf('LineString') !== -1 || val.indexOf('MultiLineString') !== -1) {
let wkt = new Wkt.Wkt();
wkt.read(val);
if(wkt.components && wkt.components.length && wkt.components[0].length){
zoomLevel = 7;
if(this.props.config && this.props.config.zoomLevel){
zoomLevel = this.props.config.zoomLevel;
}
if(this.props.zoomLevel){
zoomLevel = this.props.zoomLevel;
}
if(this.props.config){
if( this.props.config.simplifyPolyLines){
simplifyPolyLines = this.props.config.simplifyPolyLines;
}
if( this.props.config.simplifyTolerance){
simplifyTolerance = this.props.config.simplifyTolerance;
}