gis-common 5.1.19 → 5.1.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -137,7 +137,7 @@ class AudioPlayer {
137
137
  }
138
138
  }
139
139
  const ExceptionUtil = {
140
- getException(type, message) {
140
+ getException(type, message = "") {
141
141
  const _Exception = function() {
142
142
  Error.call(this, message);
143
143
  this.name = type;
@@ -153,44 +153,44 @@ const ExceptionUtil = {
153
153
  const _Exception = this.getException("Exception", msg);
154
154
  throw new _Exception(msg);
155
155
  },
156
- throwColorException(msg) {
157
- const _Exception = this.getException("ColorException", ErrorType.DATA_ERROR_COLOR + " -> " + (msg || ""));
156
+ throwColorException(msg = "") {
157
+ const _Exception = this.getException("ColorException", ErrorType.DATA_ERROR_COLOR + (msg ? " -> " + msg : ""));
158
158
  throw new _Exception(msg);
159
159
  },
160
- throwCoordinateException(msg) {
161
- const _Exception = this.getException("CoordinateException", ErrorType.DATA_ERROR_COORDINATE + " -> " + (msg || ""));
160
+ throwCoordinateException(msg = "") {
161
+ const _Exception = this.getException("CoordinateException", ErrorType.DATA_ERROR_COORDINATE + (msg ? " -> " + msg : ""));
162
162
  throw new _Exception(msg);
163
163
  },
164
- throwGeoJsonException(msg) {
165
- const _Exception = this.getException("GeoJsonException", ErrorType.DATA_ERROR_GEOJSON + " -> " + (msg || ""));
164
+ throwGeoJsonException(msg = "") {
165
+ const _Exception = this.getException("GeoJsonException", ErrorType.DATA_ERROR_GEOJSON + (msg ? " -> " + msg : ""));
166
166
  throw new _Exception(msg);
167
167
  },
168
- throwEmptyException(msg) {
169
- const _Exception = this.getException("EmptyException", ErrorType.PARAMETER_ERROR_LACK + " -> " + (msg || ""));
168
+ throwEmptyException(msg = "") {
169
+ const _Exception = this.getException("EmptyException", ErrorType.PARAMETER_ERROR_LACK + (msg ? " -> " + msg : ""));
170
170
  throw new _Exception(msg);
171
171
  },
172
- throwIntegerException(msg) {
173
- const _Exception = this.getException("IntegerException", ErrorType.PARAMETER_ERROR_INTEGER + " -> " + (msg || ""));
172
+ throwIntegerException(msg = "") {
173
+ const _Exception = this.getException("IntegerException", ErrorType.PARAMETER_ERROR_INTEGER + (msg ? " -> " + msg : ""));
174
174
  throw new _Exception(msg);
175
175
  },
176
- throwNumberException(msg) {
177
- const _Exception = this.getException("NumberException", ErrorType.PARAMETER_ERROR_NUMBER + " -> " + (msg || ""));
176
+ throwNumberException(msg = "") {
177
+ const _Exception = this.getException("NumberException", ErrorType.PARAMETER_ERROR_NUMBER + (msg ? " -> " + msg : ""));
178
178
  throw new _Exception(msg);
179
179
  },
180
- throwArrayException(msg) {
181
- const _Exception = this.getException("ArrayException", ErrorType.PARAMETER_ERROR_ARRAY + " -> " + (msg || ""));
180
+ throwArrayException(msg = "") {
181
+ const _Exception = this.getException("ArrayException", ErrorType.PARAMETER_ERROR_ARRAY + (msg ? " -> " + msg : ""));
182
182
  throw new _Exception(msg);
183
183
  },
184
- throwFunctionException(msg) {
185
- const _Exception = this.getException("FunctionException", ErrorType.PARAMETER_ERROR_FUNCTION + " -> " + (msg || ""));
184
+ throwFunctionException(msg = "") {
185
+ const _Exception = this.getException("FunctionException", ErrorType.PARAMETER_ERROR_FUNCTION + (msg ? " -> " + msg : ""));
186
186
  throw new _Exception(msg);
187
187
  },
188
- throwProcessException(msg) {
189
- const _Exception = this.getException("ProcessException", ErrorType.PROCESS_FAIL + " -> " + (msg || ""));
188
+ throwProcessException(msg = "") {
189
+ const _Exception = this.getException("ProcessException", ErrorType.PROCESS_FAIL + (msg ? " -> " + msg : ""));
190
190
  throw new _Exception(msg);
191
191
  },
192
- throwNetworkException(msg) {
193
- const _Exception = this.getException("NetworkException", ErrorType.REQUEST_ERROR_TIMEOUT + " -> " + (msg || ""));
192
+ throwNetworkException(msg = "") {
193
+ const _Exception = this.getException("NetworkException", ErrorType.REQUEST_ERROR_TIMEOUT + (msg ? " -> " + msg : ""));
194
194
  throw new _Exception(msg);
195
195
  }
196
196
  };
@@ -18143,6 +18143,61 @@ __publicField(_Storage, "_getPrefixedKey", function(key, options) {
18143
18143
  }
18144
18144
  });
18145
18145
  let Storage = _Storage;
18146
+ class SVGLoader {
18147
+ constructor(options = {}) {
18148
+ __publicField(this, "cache");
18149
+ __publicField(this, "defaultOptions");
18150
+ this.cache = /* @__PURE__ */ new Map();
18151
+ this.defaultOptions = {
18152
+ useCache: true,
18153
+ clearContainer: true,
18154
+ addClasses: [],
18155
+ onLoad: null,
18156
+ onError: null,
18157
+ ...options
18158
+ };
18159
+ }
18160
+ async load(url, container) {
18161
+ if (this.defaultOptions.useCache && this.cache.has(url)) {
18162
+ this._insertSVG(this.cache.get(url), container);
18163
+ return this.cache.get(url);
18164
+ }
18165
+ try {
18166
+ const response = await fetch(url);
18167
+ if (!response.ok) throw new Error(`HTTP ${response.status}`);
18168
+ const svgText = await response.text();
18169
+ const parser = new DOMParser();
18170
+ const svgDoc = parser.parseFromString(svgText, "image/svg+xml");
18171
+ const svgElement = svgDoc.documentElement;
18172
+ if (this.defaultOptions.addClasses.length) {
18173
+ svgElement.classList.add(...this.defaultOptions.addClasses);
18174
+ }
18175
+ if (this.defaultOptions.useCache) {
18176
+ this.cache.set(url, svgElement.cloneNode(true));
18177
+ }
18178
+ this._insertSVG(svgElement, container);
18179
+ if (typeof this.defaultOptions.onLoad === "function") {
18180
+ this.defaultOptions.onLoad(svgElement, url);
18181
+ }
18182
+ return svgElement;
18183
+ } catch (error) {
18184
+ console.error(`Failed to load SVG from ${url}:`, error);
18185
+ if (typeof this.defaultOptions.onError === "function") {
18186
+ this.defaultOptions.onError(error, url);
18187
+ }
18188
+ return null;
18189
+ }
18190
+ }
18191
+ _insertSVG(svgElement, container) {
18192
+ if (this.defaultOptions.clearContainer) {
18193
+ container.innerHTML = "";
18194
+ }
18195
+ container.appendChild(svgElement.cloneNode(true));
18196
+ }
18197
+ clearCache() {
18198
+ this.cache.clear();
18199
+ }
18200
+ }
18146
18201
  class WebGL {
18147
18202
  constructor(el) {
18148
18203
  __publicField(this, "ctx");
@@ -18275,6 +18330,7 @@ export {
18275
18330
  OptimizeUtil,
18276
18331
  Storage,
18277
18332
  StringUtil,
18333
+ SVGLoader as SvgLoader,
18278
18334
  TreeUtil,
18279
18335
  UrlUtil,
18280
18336
  Util,