igniteui-angular-core
Version:
Ignite UI Angular Core logic used in multiple UI components.
363 lines (362 loc) • 13.4 kB
JavaScript
import { EventEmitter } from '@angular/core';
import { delegateCombine } from './type';
import { ShapefileConverter as ShapefileConverter_internal } from "./ShapefileConverter";
import { fromRect, toRect, ensureBool } from "./componentUtil";
import { IgxAsyncCompletedEventArgs } from './igx-async-completed-event-args';
import { IgxShapefileRecord } from './igx-shapefile-record';
import { IgxShapeFilterRecordEventArgs } from './igx-shape-filter-record-event-args';
/**
* Class used to convert Shapefiles into CLR objects.
*/
var IgxShapeDataSource = /** @class */ /*@__PURE__*/ (function () {
function IgxShapeDataSource() {
this._zoneRunner = null;
this._importPending = null;
this._importCompleted = null;
this._filter = null;
this._implementation = this.createImplementation();
this._implementation.externalObject = this;
this.onImplementationCreated();
}
IgxShapeDataSource.prototype.createImplementation = function () {
return new ShapefileConverter_internal();
};
Object.defineProperty(IgxShapeDataSource.prototype, "i", {
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
IgxShapeDataSource.prototype.onImplementationCreated = function () {
};
IgxShapeDataSource.prototype._provideImplementation = function (i) {
this._implementation = i;
this._implementation.externalObject = this;
this.onImplementationCreated();
};
// private _databaseSource: string;
///**
// * Gets the string Uri path of the .dbf portion of the Shapefile
//*/
// get databaseSource(): string {
// return this._databaseSource;
// }
///**
// * Sets the string Uri path of the .dbf portion of the Shapefile
//*/
// set databaseSource(v: string) {
// this._databaseSource = v;
// }
// private _shapefileSource: string;
///**
// * Gets the string Uri path of the .shp portion of the Shapefile
//*/
// get shapefileSource(): string {
// return this._shapefileSource;
// }
///**
// * Sets the string Uri path of the .shp portion of the Shapefile
//*/
// set shapefileSource(v: string) {
// this._shapefileSource = v;
// }
IgxShapeDataSource.prototype.dataBind = function () {
//this.i.shapefileSource = null;
//this.i.databaseSource = null;
//if (this._shapefileSource && this._databaseSource) {
// this.i.shapefileSource = new Uri(0, this._shapefileSource);
// this.i.databaseSource = new Uri(0, this._databaseSource);
//}
};
/**
* Gets the point data.
*/
IgxShapeDataSource.prototype.getPointData = function () {
var list = this.i.getPointData();
var ret = [];
for (var i = 0; i < list.count; i++) {
var shapeRecord = list.item(i);
if (!shapeRecord.externalObject) {
var e = new IgxShapefileRecord();
e._implementation = shapeRecord;
shapeRecord.externalObject = e;
}
ret.push(shapeRecord.externalObject);
}
return ret;
};
Object.defineProperty(IgxShapeDataSource.prototype, "name", {
get: function () {
return this.i.name;
},
set: function (v) {
this.i.name = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxShapeDataSource.prototype, "worldRect", {
/**
* Gets the world bounding rectangle, as read from the header of the Shapefile.
*/
get: function () {
return fromRect(this.i.worldRect);
},
set: function (v) {
this.i.worldRect = toRect(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxShapeDataSource.prototype, "computedWorldRect", {
/**
* Gets the world bounding rectangle, based on the filtered shapes
*/
get: function () {
return fromRect(this.i.computedWorldRect);
},
set: function (v) {
this.i.computedWorldRect = toRect(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxShapeDataSource.prototype, "shapeType", {
/**
* Gets the shape type, as read from the header of the Shapefile.
*/
get: function () {
return this.i.shapeType;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxShapeDataSource.prototype, "shapeHeader", {
/**
* Gets the header of the Shapefile.
*/
get: function () {
return this.i.shapeHeader;
},
set: function (v) {
this.i.shapeHeader = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxShapeDataSource.prototype, "deferImportCompleted", {
/**
* The Uri of the .shp portion of the Shapefile.
*/
get: function () {
return this.i.deferImportCompleted;
},
set: function (v) {
this.i.deferImportCompleted = ensureBool(v);
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxShapeDataSource.prototype, "shapefileSource", {
/**
* The Uri of the .shp portion of the Shapefile.
*/
get: function () {
return this.i.shapefileSource;
},
set: function (v) {
this.i.shapefileSource = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxShapeDataSource.prototype, "databaseSource", {
/**
* The Uri of the .dbf portion of the Shapefile.
*/
get: function () {
return this.i.databaseSource;
},
set: function (v) {
this.i.databaseSource = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxShapeDataSource.prototype, "count", {
/**
* The total number of ShapefileRecords in the collection.
*/
get: function () {
return this.i.count;
},
enumerable: false,
configurable: true
});
IgxShapeDataSource.prototype.findByName = function (name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
};
IgxShapeDataSource.prototype.getWorldBounds = function (useComputed) {
var iv = this.i.getWorldBounds(useComputed);
return fromRect(iv);
};
IgxShapeDataSource.prototype.setWorldBounds = function (setComputed, bounds) {
this.i.setWorldBounds(setComputed, toRect(bounds));
};
IgxShapeDataSource.prototype.sendImportCompleted = function () {
this.i.sendImportCompleted();
};
IgxShapeDataSource.prototype.getRecordsCount = function () {
var iv = this.i.getRecordsCount();
return (iv);
};
IgxShapeDataSource.prototype.getRecord = function (index) {
var iv = this.i.getRecord(index);
var ret = null;
if (iv && iv.externalObject) {
ret = iv.externalObject;
}
else {
if (iv) {
var e = new IgxShapefileRecord();
e._implementation = iv;
iv.externalObject = e;
ret = e;
}
}
return ret;
};
IgxShapeDataSource.prototype.getRecordBounds = function (index) {
var iv = this.i.getRecordBounds(index);
return fromRect(iv);
};
IgxShapeDataSource.prototype.getRecordFieldNames = function (index) {
var iv = this.i.getRecordFieldNames(index);
return (iv);
};
IgxShapeDataSource.prototype.getRecordValue = function (index, fieldName) {
var iv = this.i.getRecordValue(index, fieldName);
return (iv);
};
IgxShapeDataSource.prototype.removeRecord = function (index) {
this.i.removeRecord(index);
};
IgxShapeDataSource.prototype.shiftAllShapes = function (offsetX, offsetY) {
this.i.shiftAllShapes(offsetX, offsetY);
};
IgxShapeDataSource.prototype.shiftShapes = function (recordIndex, offsetX, offsetY) {
this.i.shiftShapes(recordIndex, offsetX, offsetY);
};
IgxShapeDataSource.prototype.getMaxLongitude = function (recordIndex, useLargestShape, fromLongitude, toLongitude) {
var iv = this.i.getMaxLongitude(recordIndex, useLargestShape, fromLongitude, toLongitude);
return (iv);
};
IgxShapeDataSource.prototype.setRecordValue = function (index, fieldName, value) {
this.i.setRecordValue(index, fieldName, value);
};
IgxShapeDataSource.prototype.getRecordValues = function (fieldName) {
var iv = this.i.getRecordValues(fieldName);
return (iv);
};
IgxShapeDataSource.prototype.setRecordValues = function (fieldName, values) {
this.i.setRecordValues(fieldName, values);
};
IgxShapeDataSource.prototype.getLargestShapeBoundsForRecord = function (index) {
var iv = this.i.getLargestShapeBoundsForRecord(index);
return fromRect(iv);
};
IgxShapeDataSource.prototype._runInZone = function (act) {
if (this._zoneRunner != null) {
this._zoneRunner(act);
}
else {
act();
}
};
Object.defineProperty(IgxShapeDataSource.prototype, "importPending", {
/**
* Event raised when the Shapefile has been imported from both the ShapefileSource and DatabaseSource Uris.
*/
get: function () {
var _this = this;
if (this._importPending == null) {
this._importPending = new EventEmitter();
this.i.importPending = delegateCombine(this.i.importPending, function (o, e) {
_this._runInZone(function () {
var outerArgs = new IgxAsyncCompletedEventArgs();
outerArgs._provideImplementation(e);
if (_this.beforeImportPending) {
_this.beforeImportPending(_this, outerArgs);
}
_this._importPending.emit({
sender: _this,
args: outerArgs
});
});
});
}
return this._importPending;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxShapeDataSource.prototype, "importCompleted", {
/**
* Event raised when the Shapefile has been imported from both the ShapefileSource and DatabaseSource Uris.
*/
get: function () {
var _this = this;
if (this._importCompleted == null) {
this._importCompleted = new EventEmitter();
this.i.importCompleted = delegateCombine(this.i.importCompleted, function (o, e) {
_this._runInZone(function () {
var outerArgs = new IgxAsyncCompletedEventArgs();
outerArgs._provideImplementation(e);
if (_this.beforeImportCompleted) {
_this.beforeImportCompleted(_this, outerArgs);
}
_this._importCompleted.emit({
sender: _this,
args: outerArgs
});
});
});
}
return this._importCompleted;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgxShapeDataSource.prototype, "filter", {
get: function () {
var _this = this;
if (this._filter == null) {
this._filter = new EventEmitter();
this.i.filter = delegateCombine(this.i.filter, function (o, e) {
_this._runInZone(function () {
var outerArgs = new IgxShapeFilterRecordEventArgs();
outerArgs._provideImplementation(e);
if (_this.beforeFilter) {
_this.beforeFilter(_this, outerArgs);
}
_this._filter.emit({
sender: _this,
args: outerArgs
});
});
});
}
return this._filter;
},
enumerable: false,
configurable: true
});
return IgxShapeDataSource;
}());
export { IgxShapeDataSource };