Implement read transforms for ol.format.IGC
This commit is contained in:
@@ -5,6 +5,7 @@ goog.require('goog.asserts');
|
||||
goog.require('goog.string');
|
||||
goog.require('goog.string.newlines');
|
||||
goog.require('ol.Feature');
|
||||
goog.require('ol.format.Feature');
|
||||
goog.require('ol.format.TextFeature');
|
||||
goog.require('ol.geom.LineString');
|
||||
goog.require('ol.proj');
|
||||
@@ -93,6 +94,7 @@ ol.format.IGC.prototype.getExtensions = function() {
|
||||
*
|
||||
* @function
|
||||
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
|
||||
* @param {olx.format.ReadOptions=} opt_options Read options.
|
||||
* @return {ol.Feature} Feature.
|
||||
* @api
|
||||
*/
|
||||
@@ -102,7 +104,7 @@ ol.format.IGC.prototype.readFeature;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.format.IGC.prototype.readFeatureFromText = function(text) {
|
||||
ol.format.IGC.prototype.readFeatureFromText = function(text, opt_options) {
|
||||
var altitudeMode = this.altitudeMode_;
|
||||
var lines = goog.string.newlines.splitLines(text);
|
||||
/** @type {Object.<string, string>} */
|
||||
@@ -167,7 +169,8 @@ ol.format.IGC.prototype.readFeatureFromText = function(text) {
|
||||
var layout = altitudeMode == ol.format.IGCZ.NONE ?
|
||||
ol.geom.GeometryLayout.XYM : ol.geom.GeometryLayout.XYZM;
|
||||
lineString.setFlatCoordinates(layout, flatCoordinates);
|
||||
var feature = new ol.Feature(lineString);
|
||||
var feature = new ol.Feature(ol.format.Feature.transformWithOptions(
|
||||
lineString, false, false, opt_options));
|
||||
feature.setProperties(properties);
|
||||
return feature;
|
||||
};
|
||||
@@ -179,6 +182,7 @@ ol.format.IGC.prototype.readFeatureFromText = function(text) {
|
||||
*
|
||||
* @function
|
||||
* @param {ArrayBuffer|Document|Node|Object|string} source Source.
|
||||
* @param {olx.format.ReadOptions=} opt_options Read options.
|
||||
* @return {Array.<ol.Feature>} Features.
|
||||
* @api
|
||||
*/
|
||||
@@ -188,8 +192,8 @@ ol.format.IGC.prototype.readFeatures;
|
||||
/**
|
||||
* @inheritDoc
|
||||
*/
|
||||
ol.format.IGC.prototype.readFeaturesFromText = function(text) {
|
||||
var feature = this.readFeatureFromText(text);
|
||||
ol.format.IGC.prototype.readFeaturesFromText = function(text, opt_options) {
|
||||
var feature = this.readFeatureFromText(text, opt_options);
|
||||
if (!goog.isNull(feature)) {
|
||||
return [feature];
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user