<commit_before>goog.provide('ngeo.Attribute');


/**
 * Set the `type` and `geomType` properties of an attribute if the given
 * type is a geometry one.
 *
 * @param {ngeox.AttributeBase} attribute Attribute.
 * @param {string} type Type.
 * @return {boolean} Whether both attribute type and geomType were set.
 */
ngeo.Attribute.setGeometryType = function(attribute, type) {
  const geomRegex =
    /gml:((Multi)?(Point|Line|Polygon|Curve|Surface|Geometry)).*/;
  if (geomRegex.exec(type)) {
    attribute.type = ngeo.AttributeType.GEOMETRY;
    if (/^gml:Point/.exec(type)) {
      attribute.geomType = ol.geom.GeometryType.POINT;
    } else if (/^gml:LineString/.exec(type)) {
      attribute.geomType = ol.geom.GeometryType.LINE_STRING;
    } else if (/^gml:Polygon/.exec(type)) {
      attribute.geomType = ol.geom.GeometryType.POLYGON;
    } else if (/^gml:MultiPoint/.exec(type)) {
      attribute.geomType = ol.geom.GeometryType.MULTI_POINT;
    } else if (/^gml:MultiLineString/.exec(type)) {
      attribute.geomType = ol.geom.GeometryType.MULTI_LINE_STRING;
    } else if (/^gml:MultiPolygon/.exec(type)) {
      attribute.geomType = ol.geom.GeometryType.MULTI_POLYGON;
    }
  }
  return !!attribute.type && !!attribute.geomType;
};<commit_msg>Support GML 3.2 geometry types in attributes definition<commit_after>goog.provide('ngeo.Attribute');


/**
 * Set the `type` and `geomType` properties of an attribute if the given
 * type is a geometry one.
 *
 * @param {ngeox.AttributeBase} attribute Attribute.
 * @param {string} type Type.
 * @return {boolean} Whether both attribute type and geomType were set.
 */
ngeo.Attribute.setGeometryType = function(attribute, type) {
  const geomRegex =
    /gml:((Multi)?(Point|Line|Polygon|Curve|Surface|Geometry)).*/;
  if (geomRegex.exec(type)) {
    attribute.type = ngeo.AttributeType.GEOMETRY;
    if (/^gml:Point/.exec(type)) {
      attribute.geomType = ol.geom.GeometryType.POINT;
    } else if (/^gml:LineString|^gml:Curve/.exec(type)) {
      attribute.geomType = ol.geom.GeometryType.LINE_STRING;
    } else if (/^gml:Polygon|^gml:Surface/.exec(type)) {
      attribute.geomType = ol.geom.GeometryType.POLYGON;
    } else if (/^gml:MultiPoint/.exec(type)) {
      attribute.geomType = ol.geom.GeometryType.MULTI_POINT;
    } else if (/^gml:MultiLineString|^gml:MultiCurve/.exec(type)) {
      attribute.geomType = ol.geom.GeometryType.MULTI_LINE_STRING;
    } else if (/^gml:MultiPolygon|^gml:MultiSurface/.exec(type)) {
      attribute.geomType = ol.geom.GeometryType.MULTI_POLYGON;
    }
  }
  return !!attribute.type && !!attribute.geomType;
};
{'fraction_non_alphanumeric': 0.1504594180704441, 'fraction_numerical': 0.0007656967840735069, 'mean_word_length': 3.902439024390244, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5727344', 'n_tokens_mistral': 914, 'n_tokens_neox': 894, 'n_words': 163}