Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@evergis/sgis

Package Overview
Dependencies
Maintainers
6
Versions
87
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@evergis/sgis - npm Package Compare versions

Comparing version 0.5.0-alpha.10 to 0.5.0-temp.0

1

es/renders/StaticImageRender.d.ts

@@ -21,3 +21,2 @@ import { HTMLRasterElement, Offset } from "../baseTypes";

onError?: (err?: ErrorEvent) => void;
readyPromise: Promise<void>;
constructor({src, width, height, onLoad, onError, opacity, offset}: StaticImageRenderParams);

@@ -24,0 +23,0 @@ private _createNode();

11

es/renders/StaticImageRender.js
import { StaticRender } from "./Render";
import { loadImage } from "../utils/utils";
export class StaticImageRender extends StaticRender {

@@ -17,2 +16,10 @@ constructor({ src, width = 0, height = 0, onLoad = null, onError = null, opacity = 1, offset = [0, 0] }) {

this._node = new Image();
this._node.onload = () => {
if (this.onLoad)
this.onLoad();
};
this._node.onerror = (err) => {
if (this.onError)
this.onError(err);
};
if (this._width > 0)

@@ -23,3 +30,3 @@ this._node.width = this._width;

this._node.style.opacity = this._opacity.toString();
this.readyPromise = loadImage(this._node, this._src);
this._node.src = this._src;
}

@@ -26,0 +33,0 @@ get node() {

@@ -63,4 +63,4 @@ import { PolyControl } from "./controls/PolyControl";

export { Control } from "./controls/Control";
export declare const version = "0.5.0-alpha.10";
export declare const releaseDate = "06.10.2020";
export declare const version = "0.5.0-temp.0";
export declare const releaseDate = "07.10.2020";
export declare const controls: {

@@ -67,0 +67,0 @@ Circle: typeof Circle;

@@ -65,4 +65,4 @@ import { PolyControl } from "./controls/PolyControl";

export { Control } from "./controls/Control";
export const version = "0.5.0-alpha.10";
export const releaseDate = "06.10.2020";
export const version = "0.5.0-temp.0";
export const releaseDate = "07.10.2020";
let utilsModulesExt = {};

@@ -69,0 +69,0 @@ Object.assign(utilsModulesExt, utilsModule, { Color: Color });

@@ -49,11 +49,7 @@ import { Symbol } from "../Symbol";

private _mask;
private maskReadyPromise?;
private imageReadyPromise?;
/**
* @param options - key-value list of the properties to be assigned to the instance.
*/
constructor({width, height, angle, anchorPoint, imageSource, maskSource, maskColor, onUpdate}?: MaskedImageSymbolParams);
prepareSymbol(): Promise<void>;
constructor(options?: MaskedImageSymbolParams);
renderFunction(feature: PointFeature, resolution: number, crs: Crs): Render[];
renderFunctionAsync(feature: PointFeature, resolution: number, crs: Crs): Promise<Render[]>;
/**

@@ -71,4 +67,2 @@ * Source of the base image. Can be url or data:url string.

maskColor: string;
setImageSource(src: string): Promise<void>;
setMaskSource(src: string): Promise<void>;
_isLoaded(): boolean;

@@ -75,0 +69,0 @@ _updateMasked(triesNo?: number): void;

import { registerSymbol } from "../../serializers/symbolSerializer";
import { Symbol } from "../Symbol";
import { Color } from "../../utils/Color";
import { warn, loadImage } from "../../utils/utils";
import { warn } from "../../utils/utils";
import { PIN_BACKGROUND, PIN_FOREGROUND } from "../../resourses/images";

@@ -17,3 +17,3 @@ import { PointFeature } from "../../features/PointFeature";

*/
constructor({ width, height, angle, anchorPoint, imageSource, maskSource, maskColor, onUpdate } = {}) {
constructor(options = {}) {
super();

@@ -32,10 +32,7 @@ /** Width of the image. If not set, image will be automatically resized according to height. If both width and height are not set, original image size will be used. */

this._maskColor = '#9bdb00';
this.width = width;
this.height = height;
this.angle = angle;
this.anchorPoint = anchorPoint;
this._maskColor = maskColor;
this.onUpdate = onUpdate;
this.setImageSource(imageSource);
this.setMaskSource(maskSource);
Object.assign(this, options);
if (!this._image)
this.imageSource = this._imageSource;
if (!this._mask)
this.maskSource = this._maskSource;
this._updateMasked();

@@ -61,10 +58,2 @@ }

}
prepareSymbol() {
return Promise.all([
this.imageReadyPromise,
this.maskReadyPromise
]).then(() => {
this._updateMasked();
});
}
renderFunction(feature, resolution, crs) {

@@ -84,5 +73,2 @@ if (!(feature instanceof PointFeature) || !this._maskedSrc)

}
renderFunctionAsync(feature, resolution, crs) {
return this.prepareSymbol().then(() => this.renderFunction(feature, resolution, crs));
}
/**

@@ -126,14 +112,2 @@ * Source of the base image. Can be url or data:url string.

}
setImageSource(src) {
this._imageSource = src;
this._image = new Image();
this.imageReadyPromise = loadImage(this._image, src);
return this.imageReadyPromise;
}
setMaskSource(src) {
this._maskSource = src;
this._mask = new Image();
this.maskReadyPromise = loadImage(this._mask, src);
return this.maskReadyPromise;
}
_isLoaded() { return this._image.complete && this._mask.complete; }

@@ -140,0 +114,0 @@ _updateMasked(triesNo = 0) {

@@ -6,3 +6,2 @@ import { Symbol } from "../Symbol";

import { PointFeature } from "../../features/PointFeature";
import { StaticVectorImageRender } from "../../renders/StaticVectorImageRender";
export interface PointImageSymbolConstructorParams {

@@ -45,4 +44,3 @@ /** @see [[StaticImageSymbol.width]] */

constructor(options?: PointImageSymbolConstructorParams);
renderFunction(feature: PointFeature, resolution: number, crs: Crs): StaticVectorImageRender[];
renderFunctionAsync(feature: PointFeature, resolution: number, crs: Crs): Promise<Render[]>;
renderFunction(feature: PointFeature, resolution: number, crs: Crs): Render[];
}

@@ -62,7 +62,3 @@ import { Symbol } from "../Symbol";

}
async renderFunctionAsync(feature, resolution, crs) {
const renders = this.renderFunction(feature, resolution, crs);
return Promise.all(renders.map(render => render.readyPromise)).then(() => renders);
}
}
registerSymbol(StaticImageSymbol, 'point.Image', ['width', 'height', 'anchorPoint', 'source', 'angle']);

@@ -21,10 +21,2 @@ import { Feature } from "../features/Feature";

/**
* This async function will be called every time the feature has to be drawn. It returns an array of renders that will actually be displayed on the map.
* If the symbol cannot render provided feature, empty array is returned.
* @param feature - feature to be drawn.
* @param resolution - resolution of the render.
* @param crs - target coordinate system of the render.
*/
renderFunctionAsync(feature: T, resolution: number, crs: Crs): Promise<Render[]>;
/**
* Returns a copy of the symbol. Only essential properties are copied.

@@ -48,3 +40,2 @@ */

protected _updateFeatureNode(feature: PointFeature): void;
renderFunctionAsync(feature: PointFeature, resolution: number, crs: Crs): Promise<Render[]>;
}

@@ -12,12 +12,2 @@ import { deserialize, serialize } from "../serializers/symbolSerializer";

/**
* This async function will be called every time the feature has to be drawn. It returns an array of renders that will actually be displayed on the map.
* If the symbol cannot render provided feature, empty array is returned.
* @param feature - feature to be drawn.
* @param resolution - resolution of the render.
* @param crs - target coordinate system of the render.
*/
async renderFunctionAsync(feature, resolution, crs) {
return this.renderFunction(feature, resolution, crs);
}
/**
* Returns a copy of the symbol. Only essential properties are copied.

@@ -88,5 +78,2 @@ */

}
async renderFunctionAsync(feature, resolution, crs) {
return this.renderFunction(feature, resolution, crs);
}
}

@@ -79,7 +79,1 @@ /**

export declare const isTouch: boolean;
/**
* async loadImage function
* @param image
* @param src
*/
export declare function loadImage(image: HTMLImageElement, src: string): Promise<void>;

@@ -200,16 +200,1 @@ /**

}
/**
* async loadImage function
* @param image
* @param src
*/
export function loadImage(image, src) {
image.src = src;
return new Promise((res, rej) => {
if (image.complete) {
return res();
}
image.onload = () => res();
image.onerror = error => rej(error);
});
}
{
"name": "@evergis/sgis",
"version": "0.5.0-alpha.10",
"version": "0.5.0-temp.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "dist/sGis_bundle.js",

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc