UNPKG

thematic-earth

Version:

HTML-based, whole-Earth thematic maps using locally hosted data layers

2 lines 1.65 kB
/* Copyright (c) 2023 Read Write Tools. Legal use subject to the Thematic Earth Software License Agreement. */ import*as LabelGraphics from'../graphics/label-graphics.js';import expect from'../dev/expect.js';export default class ProxyBase{constructor(e,t,a){expect(e,'Number'),expect(t,'Number'),expect(a,'Number'),this.layerId=e,this.spatialId=t,this.featureId=a,this.feature=null,this.featureBoundingBox=null,this.canvasParams=null,this.labelText=null,this.labelBoundingBox=null,this.isDisqualified=!1,this.canvasCoordsPosition=null,this.leftTopPoint=null}getFeatureData(e,t){expect(e,'Catalog'),expect(t,'HTMLCanvasElement'),this.feature=this.getFeature(e),this.canvasParams=this.getCanvasParams(this.feature),this.featureBoundingBox=this.getFeatureBoundingBox(this.feature,t),this.labelText=this.getLabelText(this.feature,this.canvasParams)}getFeature(e){return expect(e,'Catalog'),e.getSpatialFile(this.spatialId).featureLookupMap.get(this.featureId)}getCanvasParams(e){return expect(e,['PointFeature','LineFeature','PolygonFeature']),e.getCanvasParamsPerLayerId(this.layerId)}getFeatureBoundingBox(e,t){return expect(e,['PointFeature','LineFeature','PolygonFeature']),e.getFeatureBoundingBox(t)}getLabelText(e,t){return expect(e,['PointFeature','LineFeature','PolygonFeature']),expect(t,'CanvasParams'),t.getLabelText(e.kvPairs)}computeTextMetrics(e,t){expect(e,'Catalog'),expect(t,'HTMLCanvasElement'),''!=this.labelText&&(this.labelBoundingBox=LabelGraphics.computeTextMetrics(t,this.canvasParams,this.labelText))}disqualificationCriteria(){}possiblePlacements(e){}reserveSymbols(e){}collisionAdjustment(e,t){}drawBoundingBox(e){}drawLabel(e){}}