igniteui-react-core
Version:
Ignite UI React Core.
369 lines (368 loc) • 13.3 kB
JavaScript
import { delegateCombine, delegateRemove } from './type';
import { ShapefileConverter as ShapefileConverter_internal } from "./ShapefileConverter";
import { fromRect, toRect, ensureBool } from "./componentUtil";
import { IgrAsyncCompletedEventArgs } from './igr-async-completed-event-args';
import { IgrShapefileRecord } from './igr-shapefile-record';
import { IgrShapeFilterRecordEventArgs } from './igr-shape-filter-record-event-args';
/**
* Class used to convert Shapefiles into CLR objects.
*/
var IgrShapeDataSource = /** @class */ /*@__PURE__*/ (function () {
function IgrShapeDataSource() {
//@@ZoneRunner
this._importPending = null;
this._importPending_wrapped = null;
this._importCompleted = null;
this._importCompleted_wrapped = null;
this._filter = null;
this._filter_wrapped = null;
this._implementation = this.createImplementation();
this._implementation.externalObject = this;
this.onImplementationCreated();
}
IgrShapeDataSource.prototype.createImplementation = function () {
return new ShapefileConverter_internal();
};
Object.defineProperty(IgrShapeDataSource.prototype, "i", {
get: function () {
return this._implementation;
},
enumerable: false,
configurable: true
});
IgrShapeDataSource.prototype.onImplementationCreated = function () {
};
IgrShapeDataSource.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;
// }
IgrShapeDataSource.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.
*/
IgrShapeDataSource.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 IgrShapefileRecord();
e._implementation = shapeRecord;
shapeRecord.externalObject = e;
}
ret.push(shapeRecord.externalObject);
}
return ret;
};
Object.defineProperty(IgrShapeDataSource.prototype, "name", {
get: function () {
return this.i.name;
},
set: function (v) {
this.i.name = v;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrShapeDataSource.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(IgrShapeDataSource.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(IgrShapeDataSource.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(IgrShapeDataSource.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(IgrShapeDataSource.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(IgrShapeDataSource.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(IgrShapeDataSource.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(IgrShapeDataSource.prototype, "count", {
/**
* The total number of ShapefileRecords in the collection.
*/
get: function () {
return this.i.count;
},
enumerable: false,
configurable: true
});
IgrShapeDataSource.prototype.findByName = function (name) {
if (this.findEphemera) {
if (name && name.indexOf("@@e:") == 0) {
return this.findEphemera(name);
}
}
return null;
};
IgrShapeDataSource.prototype.getWorldBounds = function (useComputed) {
var iv = this.i.getWorldBounds(useComputed);
return fromRect(iv);
};
IgrShapeDataSource.prototype.setWorldBounds = function (setComputed, bounds) {
this.i.setWorldBounds(setComputed, toRect(bounds));
};
IgrShapeDataSource.prototype.sendImportCompleted = function () {
this.i.sendImportCompleted();
};
IgrShapeDataSource.prototype.getRecordsCount = function () {
var iv = this.i.getRecordsCount();
return (iv);
};
IgrShapeDataSource.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 IgrShapefileRecord();
e._implementation = iv;
iv.externalObject = e;
ret = e;
}
}
return ret;
};
IgrShapeDataSource.prototype.getRecordBounds = function (index) {
var iv = this.i.getRecordBounds(index);
return fromRect(iv);
};
IgrShapeDataSource.prototype.getRecordFieldNames = function (index) {
var iv = this.i.getRecordFieldNames(index);
return (iv);
};
IgrShapeDataSource.prototype.getRecordValue = function (index, fieldName) {
var iv = this.i.getRecordValue(index, fieldName);
return (iv);
};
IgrShapeDataSource.prototype.removeRecord = function (index) {
this.i.removeRecord(index);
};
IgrShapeDataSource.prototype.shiftAllShapes = function (offsetX, offsetY) {
this.i.shiftAllShapes(offsetX, offsetY);
};
IgrShapeDataSource.prototype.shiftShapes = function (recordIndex, offsetX, offsetY) {
this.i.shiftShapes(recordIndex, offsetX, offsetY);
};
IgrShapeDataSource.prototype.getMaxLongitude = function (recordIndex, useLargestShape, fromLongitude, toLongitude) {
var iv = this.i.getMaxLongitude(recordIndex, useLargestShape, fromLongitude, toLongitude);
return (iv);
};
IgrShapeDataSource.prototype.setRecordValue = function (index, fieldName, value) {
this.i.setRecordValue(index, fieldName, value);
};
IgrShapeDataSource.prototype.getRecordValues = function (fieldName) {
var iv = this.i.getRecordValues(fieldName);
return (iv);
};
IgrShapeDataSource.prototype.setRecordValues = function (fieldName, values) {
this.i.setRecordValues(fieldName, values);
};
IgrShapeDataSource.prototype.getLargestShapeBoundsForRecord = function (index) {
var iv = this.i.getLargestShapeBoundsForRecord(index);
return fromRect(iv);
};
Object.defineProperty(IgrShapeDataSource.prototype, "importPending", {
/**
* Event raised when the Shapefile has been imported from both the ShapefileSource and DatabaseSource Uris.
*/
get: function () {
return this._importPending;
},
set: function (ev) {
var _this = this;
if (this._importPending_wrapped !== null) {
this.i.importPending = delegateRemove(this.i.importPending, this._importPending_wrapped);
this._importPending_wrapped = null;
this._importPending = null;
}
this._importPending = ev;
this._importPending_wrapped = function (o, e) {
var outerArgs = new IgrAsyncCompletedEventArgs();
outerArgs._provideImplementation(e);
if (_this.beforeImportPending) {
_this.beforeImportPending(_this, outerArgs);
}
if (_this._importPending) {
_this._importPending(_this, outerArgs);
}
};
this.i.importPending = delegateCombine(this.i.importPending, this._importPending_wrapped);
;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrShapeDataSource.prototype, "importCompleted", {
/**
* Event raised when the Shapefile has been imported from both the ShapefileSource and DatabaseSource Uris.
*/
get: function () {
return this._importCompleted;
},
set: function (ev) {
var _this = this;
if (this._importCompleted_wrapped !== null) {
this.i.importCompleted = delegateRemove(this.i.importCompleted, this._importCompleted_wrapped);
this._importCompleted_wrapped = null;
this._importCompleted = null;
}
this._importCompleted = ev;
this._importCompleted_wrapped = function (o, e) {
var outerArgs = new IgrAsyncCompletedEventArgs();
outerArgs._provideImplementation(e);
if (_this.beforeImportCompleted) {
_this.beforeImportCompleted(_this, outerArgs);
}
if (_this._importCompleted) {
_this._importCompleted(_this, outerArgs);
}
};
this.i.importCompleted = delegateCombine(this.i.importCompleted, this._importCompleted_wrapped);
;
},
enumerable: false,
configurable: true
});
Object.defineProperty(IgrShapeDataSource.prototype, "filter", {
get: function () {
return this._filter;
},
set: function (ev) {
var _this = this;
if (this._filter_wrapped !== null) {
this.i.filter = delegateRemove(this.i.filter, this._filter_wrapped);
this._filter_wrapped = null;
this._filter = null;
}
this._filter = ev;
this._filter_wrapped = function (o, e) {
var outerArgs = new IgrShapeFilterRecordEventArgs();
outerArgs._provideImplementation(e);
if (_this.beforeFilter) {
_this.beforeFilter(_this, outerArgs);
}
if (_this._filter) {
_this._filter(_this, outerArgs);
}
};
this.i.filter = delegateCombine(this.i.filter, this._filter_wrapped);
;
},
enumerable: false,
configurable: true
});
return IgrShapeDataSource;
}());
export { IgrShapeDataSource };