Fix code indentation

This commit is contained in:
Frederic Junod
2018-02-14 10:55:11 +01:00
parent 65d898c4fe
commit 096f53e716
3 changed files with 62 additions and 130 deletions

View File

@@ -37,8 +37,7 @@ import {getAllTextContent, getAttributeNS, makeArrayPusher, makeReplacer, parseN
* @extends {ol.format.XMLFeature}
*/
const GMLBase = function(opt_options) {
const options = /** @type {olx.format.GMLOptions} */
(opt_options ? opt_options : {});
const options = /** @type {olx.format.GMLOptions} */ (opt_options ? opt_options : {});
/**
* @protected
@@ -69,10 +68,8 @@ const GMLBase = function(opt_options) {
*/
this.FEATURE_COLLECTION_PARSERS = {};
this.FEATURE_COLLECTION_PARSERS[GMLBase.GMLNS] = {
'featureMember': makeReplacer(
GMLBase.prototype.readFeaturesInternal),
'featureMembers': makeReplacer(
GMLBase.prototype.readFeaturesInternal)
'featureMember': makeReplacer(GMLBase.prototype.readFeaturesInternal),
'featureMembers': makeReplacer(GMLBase.prototype.readFeaturesInternal)
};
XMLFeature.call(this);
@@ -221,8 +218,7 @@ GMLBase.prototype.readGeometryElement = function(node, objectStack) {
*/
GMLBase.prototype.readFeatureElement = function(node, objectStack) {
let n;
const fid = node.getAttribute('fid') ||
getAttributeNS(node, GMLBase.GMLNS, 'id');
const fid = node.getAttribute('fid') || getAttributeNS(node, GMLBase.GMLNS, 'id');
const values = {};
let geometryName;
for (n = node.firstElementChild; n; n = n.nextElementSibling) {
@@ -263,8 +259,7 @@ GMLBase.prototype.readFeatureElement = function(node, objectStack) {
* @return {ol.geom.Point|undefined} Point.
*/
GMLBase.prototype.readPoint = function(node, objectStack) {
const flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack);
const flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) {
const point = new Point(null);
point.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates);
@@ -316,8 +311,7 @@ GMLBase.prototype.readMultiLineString = function(node, objectStack) {
*/
GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
/** @type {Array.<ol.geom.Polygon>} */
const polygons = pushParseAndPop([],
this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
const polygons = pushParseAndPop([], this.MULTIPOLYGON_PARSERS_, node, objectStack, this);
if (polygons) {
const multiPolygon = new MultiPolygon(null);
multiPolygon.setPolygons(polygons);
@@ -334,8 +328,7 @@ GMLBase.prototype.readMultiPolygon = function(node, objectStack) {
* @private
*/
GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
parseNode(this.POINTMEMBER_PARSERS_,
node, objectStack, this);
parseNode(this.POINTMEMBER_PARSERS_, node, objectStack, this);
};
@@ -345,8 +338,7 @@ GMLBase.prototype.pointMemberParser_ = function(node, objectStack) {
* @private
*/
GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack) {
parseNode(this.LINESTRINGMEMBER_PARSERS_,
node, objectStack, this);
parseNode(this.LINESTRINGMEMBER_PARSERS_, node, objectStack, this);
};
@@ -356,8 +348,7 @@ GMLBase.prototype.lineStringMemberParser_ = function(node, objectStack) {
* @private
*/
GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) {
parseNode(this.POLYGONMEMBER_PARSERS_, node,
objectStack, this);
parseNode(this.POLYGONMEMBER_PARSERS_, node, objectStack, this);
};
@@ -367,8 +358,7 @@ GMLBase.prototype.polygonMemberParser_ = function(node, objectStack) {
* @return {ol.geom.LineString|undefined} LineString.
*/
GMLBase.prototype.readLineString = function(node, objectStack) {
const flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack);
const flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) {
const lineString = new LineString(null);
lineString.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates);
@@ -403,8 +393,7 @@ GMLBase.prototype.readFlatLinearRing_ = function(node, objectStack) {
* @return {ol.geom.LinearRing|undefined} LinearRing.
*/
GMLBase.prototype.readLinearRing = function(node, objectStack) {
const flatCoordinates =
this.readFlatCoordinatesFromNode_(node, objectStack);
const flatCoordinates = this.readFlatCoordinatesFromNode_(node, objectStack);
if (flatCoordinates) {
const ring = new LinearRing(null);
ring.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates);
@@ -433,8 +422,7 @@ GMLBase.prototype.readPolygon = function(node, objectStack) {
extend(flatCoordinates, flatLinearRings[i]);
ends.push(flatCoordinates.length);
}
polygon.setFlatCoordinates(
GeometryLayout.XYZ, flatCoordinates, ends);
polygon.setFlatCoordinates(GeometryLayout.XYZ, flatCoordinates, ends);
return polygon;
} else {
return undefined;
@@ -449,9 +437,7 @@ GMLBase.prototype.readPolygon = function(node, objectStack) {
* @return {Array.<number>} Flat coordinates.
*/
GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
return pushParseAndPop(null,
this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node,
objectStack, this);
return pushParseAndPop(null, this.GEOMETRY_FLAT_COORDINATES_PARSERS_, node, objectStack, this);
};
@@ -462,10 +448,8 @@ GMLBase.prototype.readFlatCoordinatesFromNode_ = function(node, objectStack) {
*/
GMLBase.prototype.MULTIPOINT_PARSERS_ = {
'http://www.opengis.net/gml': {
'pointMember': makeArrayPusher(
GMLBase.prototype.pointMemberParser_),
'pointMembers': makeArrayPusher(
GMLBase.prototype.pointMemberParser_)
'pointMember': makeArrayPusher(GMLBase.prototype.pointMemberParser_),
'pointMembers': makeArrayPusher(GMLBase.prototype.pointMemberParser_)
}
};
@@ -477,10 +461,8 @@ GMLBase.prototype.MULTIPOINT_PARSERS_ = {
*/
GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
'http://www.opengis.net/gml': {
'lineStringMember': makeArrayPusher(
GMLBase.prototype.lineStringMemberParser_),
'lineStringMembers': makeArrayPusher(
GMLBase.prototype.lineStringMemberParser_)
'lineStringMember': makeArrayPusher(GMLBase.prototype.lineStringMemberParser_),
'lineStringMembers': makeArrayPusher(GMLBase.prototype.lineStringMemberParser_)
}
};
@@ -492,10 +474,8 @@ GMLBase.prototype.MULTILINESTRING_PARSERS_ = {
*/
GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
'http://www.opengis.net/gml': {
'polygonMember': makeArrayPusher(
GMLBase.prototype.polygonMemberParser_),
'polygonMembers': makeArrayPusher(
GMLBase.prototype.polygonMemberParser_)
'polygonMember': makeArrayPusher(GMLBase.prototype.polygonMemberParser_),
'polygonMembers': makeArrayPusher(GMLBase.prototype.polygonMemberParser_)
}
};
@@ -507,8 +487,7 @@ GMLBase.prototype.MULTIPOLYGON_PARSERS_ = {
*/
GMLBase.prototype.POINTMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': {
'Point': makeArrayPusher(
GMLBase.prototype.readFlatCoordinatesFromNode_)
'Point': makeArrayPusher(GMLBase.prototype.readFlatCoordinatesFromNode_)
}
};
@@ -520,8 +499,7 @@ GMLBase.prototype.POINTMEMBER_PARSERS_ = {
*/
GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': {
'LineString': makeArrayPusher(
GMLBase.prototype.readLineString)
'LineString': makeArrayPusher(GMLBase.prototype.readLineString)
}
};
@@ -533,8 +511,7 @@ GMLBase.prototype.LINESTRINGMEMBER_PARSERS_ = {
*/
GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
'http://www.opengis.net/gml': {
'Polygon': makeArrayPusher(
GMLBase.prototype.readPolygon)
'Polygon': makeArrayPusher(GMLBase.prototype.readPolygon)
}
};
@@ -546,8 +523,7 @@ GMLBase.prototype.POLYGONMEMBER_PARSERS_ = {
*/
GMLBase.prototype.RING_PARSERS = {
'http://www.opengis.net/gml': {
'LinearRing': makeReplacer(
GMLBase.prototype.readFlatLinearRing_)
'LinearRing': makeReplacer(GMLBase.prototype.readFlatLinearRing_)
}
};
@@ -594,7 +570,6 @@ GMLBase.prototype.readFeaturesFromNode = function(node, opt_options) {
* @inheritDoc
*/
GMLBase.prototype.readProjectionFromNode = function(node) {
return getProjection(this.srsName ? this.srsName :
node.firstElementChild.getAttribute('srsName'));
return getProjection(this.srsName ? this.srsName : node.firstElementChild.getAttribute('srsName'));
};
export default GMLBase;

View File

@@ -308,8 +308,7 @@ WMSCapabilities.prototype.readFromNode = function(node) {
* @return {Object|undefined} Attribution object.
*/
function readAttribution(node, objectStack) {
return pushParseAndPop(
{}, ATTRIBUTION_PARSERS, node, objectStack);
return pushParseAndPop({}, ATTRIBUTION_PARSERS, node, objectStack);
}
@@ -377,8 +376,7 @@ function readEXGeographicBoundingBox(node, objectStack) {
* @return {Object|undefined} Capability object.
*/
function readCapability(node, objectStack) {
return pushParseAndPop(
{}, CAPABILITY_PARSERS, node, objectStack);
return pushParseAndPop({}, CAPABILITY_PARSERS, node, objectStack);
}
@@ -388,8 +386,7 @@ function readCapability(node, objectStack) {
* @return {Object|undefined} Service object.
*/
function readService(node, objectStack) {
return pushParseAndPop(
{}, SERVICE_PARSERS, node, objectStack);
return pushParseAndPop({}, SERVICE_PARSERS, node, objectStack);
}
@@ -399,9 +396,7 @@ function readService(node, objectStack) {
* @return {Object|undefined} Contact information object.
*/
function readContactInformation(node, objectStack) {
return pushParseAndPop(
{}, CONTACT_INFORMATION_PARSERS,
node, objectStack);
return pushParseAndPop({}, CONTACT_INFORMATION_PARSERS, node, objectStack);
}
@@ -411,9 +406,7 @@ function readContactInformation(node, objectStack) {
* @return {Object|undefined} Contact person object.
*/
function readContactPersonPrimary(node, objectStack) {
return pushParseAndPop(
{}, CONTACT_PERSON_PARSERS,
node, objectStack);
return pushParseAndPop({}, CONTACT_PERSON_PARSERS, node, objectStack);
}
@@ -423,9 +416,7 @@ function readContactPersonPrimary(node, objectStack) {
* @return {Object|undefined} Contact address object.
*/
function readContactAddress(node, objectStack) {
return pushParseAndPop(
{}, CONTACT_ADDRESS_PARSERS,
node, objectStack);
return pushParseAndPop({}, CONTACT_ADDRESS_PARSERS, node, objectStack);
}
@@ -435,8 +426,7 @@ function readContactAddress(node, objectStack) {
* @return {Array.<string>|undefined} Format array.
*/
function readException(node, objectStack) {
return pushParseAndPop(
[], EXCEPTION_PARSERS, node, objectStack);
return pushParseAndPop([], EXCEPTION_PARSERS, node, objectStack);
}
@@ -446,8 +436,7 @@ function readException(node, objectStack) {
* @return {Object|undefined} Layer object.
*/
function readCapabilityLayer(node, objectStack) {
return pushParseAndPop(
{}, LAYER_PARSERS, node, objectStack);
return pushParseAndPop({}, LAYER_PARSERS, node, objectStack);
}
@@ -460,14 +449,12 @@ function readLayer(node, objectStack) {
const parentLayerObject = /** @type {Object.<string,*>} */
(objectStack[objectStack.length - 1]);
const layerObject = pushParseAndPop(
{}, LAYER_PARSERS, node, objectStack);
const layerObject = pushParseAndPop({}, LAYER_PARSERS, node, objectStack);
if (!layerObject) {
return undefined;
}
let queryable =
XSD.readBooleanString(node.getAttribute('queryable'));
let queryable = XSD.readBooleanString(node.getAttribute('queryable'));
if (queryable === undefined) {
queryable = parentLayerObject['queryable'];
}
@@ -486,22 +473,19 @@ function readLayer(node, objectStack) {
}
layerObject['opaque'] = opaque !== undefined ? opaque : false;
let noSubsets =
XSD.readBooleanString(node.getAttribute('noSubsets'));
let noSubsets = XSD.readBooleanString(node.getAttribute('noSubsets'));
if (noSubsets === undefined) {
noSubsets = parentLayerObject['noSubsets'];
}
layerObject['noSubsets'] = noSubsets !== undefined ? noSubsets : false;
let fixedWidth =
XSD.readDecimalString(node.getAttribute('fixedWidth'));
let fixedWidth = XSD.readDecimalString(node.getAttribute('fixedWidth'));
if (!fixedWidth) {
fixedWidth = parentLayerObject['fixedWidth'];
}
layerObject['fixedWidth'] = fixedWidth;
let fixedHeight =
XSD.readDecimalString(node.getAttribute('fixedHeight'));
let fixedHeight = XSD.readDecimalString(node.getAttribute('fixedHeight'));
if (!fixedHeight) {
fixedHeight = parentLayerObject['fixedHeight'];
}
@@ -540,10 +524,8 @@ function readDimension(node, objectStack) {
'units': node.getAttribute('units'),
'unitSymbol': node.getAttribute('unitSymbol'),
'default': node.getAttribute('default'),
'multipleValues': XSD.readBooleanString(
node.getAttribute('multipleValues')),
'nearestValue': XSD.readBooleanString(
node.getAttribute('nearestValue')),
'multipleValues': XSD.readBooleanString(node.getAttribute('multipleValues')),
'nearestValue': XSD.readBooleanString(node.getAttribute('nearestValue')),
'current': XSD.readBooleanString(node.getAttribute('current')),
'values': XSD.readString(node)
};
@@ -557,9 +539,7 @@ function readDimension(node, objectStack) {
* @return {Object|undefined} Online resource object.
*/
function readFormatOnlineresource(node, objectStack) {
return pushParseAndPop(
{}, FORMAT_ONLINERESOURCE_PARSERS,
node, objectStack);
return pushParseAndPop({}, FORMAT_ONLINERESOURCE_PARSERS, node, objectStack);
}
@@ -569,8 +549,7 @@ function readFormatOnlineresource(node, objectStack) {
* @return {Object|undefined} Request object.
*/
function readRequest(node, objectStack) {
return pushParseAndPop(
{}, REQUEST_PARSERS, node, objectStack);
return pushParseAndPop({}, REQUEST_PARSERS, node, objectStack);
}
@@ -580,8 +559,7 @@ function readRequest(node, objectStack) {
* @return {Object|undefined} DCP type object.
*/
function readDCPType(node, objectStack) {
return pushParseAndPop(
{}, DCPTYPE_PARSERS, node, objectStack);
return pushParseAndPop({}, DCPTYPE_PARSERS, node, objectStack);
}
@@ -591,8 +569,7 @@ function readDCPType(node, objectStack) {
* @return {Object|undefined} HTTP object.
*/
function readHTTP(node, objectStack) {
return pushParseAndPop(
{}, HTTP_PARSERS, node, objectStack);
return pushParseAndPop({}, HTTP_PARSERS, node, objectStack);
}
@@ -602,8 +579,7 @@ function readHTTP(node, objectStack) {
* @return {Object|undefined} Operation type object.
*/
function readOperationType(node, objectStack) {
return pushParseAndPop(
{}, OPERATIONTYPE_PARSERS, node, objectStack);
return pushParseAndPop({}, OPERATIONTYPE_PARSERS, node, objectStack);
}
@@ -613,8 +589,7 @@ function readOperationType(node, objectStack) {
* @return {Object|undefined} Online resource object.
*/
function readSizedFormatOnlineresource(node, objectStack) {
const formatOnlineresource =
readFormatOnlineresource(node, objectStack);
const formatOnlineresource = readFormatOnlineresource(node, objectStack);
if (formatOnlineresource) {
const size = [
XSD.readNonNegativeIntegerString(node.getAttribute('width')),
@@ -633,8 +608,7 @@ function readSizedFormatOnlineresource(node, objectStack) {
* @return {Object|undefined} Authority URL object.
*/
function readAuthorityURL(node, objectStack) {
const authorityObject =
readFormatOnlineresource(node, objectStack);
const authorityObject = readFormatOnlineresource(node, objectStack);
if (authorityObject) {
authorityObject['name'] = node.getAttribute('name');
return authorityObject;
@@ -649,8 +623,7 @@ function readAuthorityURL(node, objectStack) {
* @return {Object|undefined} Metadata URL object.
*/
function readMetadataURL(node, objectStack) {
const metadataObject =
readFormatOnlineresource(node, objectStack);
const metadataObject = readFormatOnlineresource(node, objectStack);
if (metadataObject) {
metadataObject['type'] = node.getAttribute('type');
return metadataObject;
@@ -665,8 +638,7 @@ function readMetadataURL(node, objectStack) {
* @return {Object|undefined} Style object.
*/
function readStyle(node, objectStack) {
return pushParseAndPop(
{}, STYLE_PARSERS, node, objectStack);
return pushParseAndPop({}, STYLE_PARSERS, node, objectStack);
}
@@ -676,8 +648,7 @@ function readStyle(node, objectStack) {
* @return {Array.<string>|undefined} Keyword list.
*/
function readKeywordList(node, objectStack) {
return pushParseAndPop(
[], KEYWORDLIST_PARSERS, node, objectStack);
return pushParseAndPop([], KEYWORDLIST_PARSERS, node, objectStack);
}

View File

@@ -227,8 +227,7 @@ WMTSCapabilities.prototype.readFromNode = function(node) {
return null;
}
WMTSCapabilityObject['version'] = version;
WMTSCapabilityObject = pushParseAndPop(WMTSCapabilityObject,
PARSERS, node, []);
WMTSCapabilityObject = pushParseAndPop(WMTSCapabilityObject, PARSERS, node, []);
return WMTSCapabilityObject ? WMTSCapabilityObject : null;
};
@@ -239,8 +238,7 @@ WMTSCapabilities.prototype.readFromNode = function(node) {
* @return {Object|undefined} Attribution object.
*/
function readContents(node, objectStack) {
return pushParseAndPop({},
CONTENTS_PARSERS, node, objectStack);
return pushParseAndPop({}, CONTENTS_PARSERS, node, objectStack);
}
@@ -250,8 +248,7 @@ function readContents(node, objectStack) {
* @return {Object|undefined} Layers object.
*/
function readLayer(node, objectStack) {
return pushParseAndPop({},
LAYER_PARSERS, node, objectStack);
return pushParseAndPop({}, LAYER_PARSERS, node, objectStack);
}
@@ -261,8 +258,7 @@ function readLayer(node, objectStack) {
* @return {Object|undefined} Tile Matrix Set object.
*/
function readTileMatrixSet(node, objectStack) {
return pushParseAndPop({},
TMS_PARSERS, node, objectStack);
return pushParseAndPop({}, TMS_PARSERS, node, objectStack);
}
@@ -272,8 +268,7 @@ function readTileMatrixSet(node, objectStack) {
* @return {Object|undefined} Style object.
*/
function readStyle(node, objectStack) {
const style = pushParseAndPop({},
STYLE_PARSERS, node, objectStack);
const style = pushParseAndPop({}, STYLE_PARSERS, node, objectStack);
if (!style) {
return undefined;
}
@@ -289,10 +284,8 @@ function readStyle(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} Tile Matrix Set Link object.
*/
function readTileMatrixSetLink(node,
objectStack) {
return pushParseAndPop({},
TMS_LINKS_PARSERS, node, objectStack);
function readTileMatrixSetLink(node, objectStack) {
return pushParseAndPop({}, TMS_LINKS_PARSERS, node, objectStack);
}
@@ -302,8 +295,7 @@ function readTileMatrixSetLink(node,
* @return {Object|undefined} Dimension object.
*/
function readDimensions(node, objectStack) {
return pushParseAndPop({},
DIMENSION_PARSERS, node, objectStack);
return pushParseAndPop({}, DIMENSION_PARSERS, node, objectStack);
}
@@ -336,8 +328,7 @@ function readResourceUrl(node, objectStack) {
* @return {Object|undefined} WGS84 BBox object.
*/
function readWgs84BoundingBox(node, objectStack) {
const coordinates = pushParseAndPop([],
WGS84_BBOX_READERS, node, objectStack);
const coordinates = pushParseAndPop([], WGS84_BBOX_READERS, node, objectStack);
if (coordinates.length != 2) {
return undefined;
}
@@ -383,8 +374,7 @@ function readCoordinates(node, objectStack) {
* @return {Object|undefined} TileMatrix object.
*/
function readTileMatrix(node, objectStack) {
return pushParseAndPop({},
TM_PARSERS, node, objectStack);
return pushParseAndPop({}, TM_PARSERS, node, objectStack);
}
@@ -393,11 +383,8 @@ function readTileMatrix(node, objectStack) {
* @param {Array.<*>} objectStack Object stack.
* @return {Object|undefined} TileMatrixSetLimits Object.
*/
function readTileMatrixLimitsList(node,
objectStack) {
return pushParseAndPop([],
TMS_LIMITS_LIST_PARSERS, node,
objectStack);
function readTileMatrixLimitsList(node, objectStack) {
return pushParseAndPop([], TMS_LIMITS_LIST_PARSERS, node, objectStack);
}
@@ -407,8 +394,7 @@ function readTileMatrixLimitsList(node,
* @return {Object|undefined} TileMatrixLimits Array.
*/
function readTileMatrixLimits(node, objectStack) {
return pushParseAndPop({},
TMS_LIMITS_PARSERS, node, objectStack);
return pushParseAndPop({}, TMS_LIMITS_PARSERS, node, objectStack);
}