<commit_before>import { Input } from '@angular/core';
import { BasicDesc } from '../basic-desc/basic-desc.service';
import { LayerService } from '../layer-service/layer-service.service';
import { ComputationCache } from '../computation-cache/computation-cache.service';
import { CesiumProperties } from '../cesium-properties/cesium-properties.service';
import { StaticPrimitiveDrawer } from '../static-primitive-drawer/static-primitive-drawer.service';

export class BasicStaticPrimitiveDesc extends BasicDesc {
	@Input()
	geometryProps: any;
	@Input()
	instanceProps: any;
	@Input()
	primitiveProps: any;

	private _geometryPropsEvaluator: Function;
	private _instancePropsEvaluator: Function;
	private _primitivePropsEvaluator: Function;

	constructor(protected _staticPrimitiveDrawer: StaticPrimitiveDrawer, layerService: LayerService,
	            computationCache: ComputationCache, cesiumProperties: CesiumProperties) {
		super(_staticPrimitiveDrawer, layerService, computationCache, cesiumProperties);
	}

	ngOnInit(): void {
		this._layerService.registerDescription(this);

		this._geometryPropsEvaluator = this._cesiumProperties.createEvaluator(this.geometryProps);
		this._instancePropsEvaluator = this._cesiumProperties.createEvaluator(this.instanceProps);
		this._primitivePropsEvaluator = this._cesiumProperties.createEvaluator(this.primitiveProps);
	}

	draw(context, id): any {
		const geometryProps = this._geometryPropsEvaluator(this._computationCache, context);
		const instanceProps = this._instancePropsEvaluator(this._computationCache, context);
		const primitiveProps = this._primitivePropsEvaluator(this._computationCache, context);

		if (!this._primitiveMap.has(id)) {
			const primitive = this._staticPrimitiveDrawer.add(geometryProps, instanceProps, primitiveProps);

			this._primitiveMap.set(id, primitive);
		} else {
			const primitive = this._primitiveMap.get(id);
			this._staticPrimitiveDrawer.update(primitive, geometryProps, instanceProps, primitiveProps);
		}
	}
}<commit_msg>Static primitives bug - no entity set on the primitives<commit_after>import { Input } from '@angular/core';
import { BasicDesc } from '../basic-desc/basic-desc.service';
import { LayerService } from '../layer-service/layer-service.service';
import { ComputationCache } from '../computation-cache/computation-cache.service';
import { CesiumProperties } from '../cesium-properties/cesium-properties.service';
import { StaticPrimitiveDrawer } from '../static-primitive-drawer/static-primitive-drawer.service';
import { AcEntity } from '../../models/ac-entity';

export class BasicStaticPrimitiveDesc extends BasicDesc {
	@Input()
	geometryProps: any;
	@Input()
	instanceProps: any;
	@Input()
	primitiveProps: any;

	private _geometryPropsEvaluator: Function;
	private _instancePropsEvaluator: Function;
	private _primitivePropsEvaluator: Function;

	constructor(protected _staticPrimitiveDrawer: StaticPrimitiveDrawer, layerService: LayerService,
	            computationCache: ComputationCache, cesiumProperties: CesiumProperties) {
		super(_staticPrimitiveDrawer, layerService, computationCache, cesiumProperties);
	}

	ngOnInit(): void {
		this._layerService.registerDescription(this);

		this._geometryPropsEvaluator = this._cesiumProperties.createEvaluator(this.geometryProps);
		this._instancePropsEvaluator = this._cesiumProperties.createEvaluator(this.instanceProps);
		this._primitivePropsEvaluator = this._cesiumProperties.createEvaluator(this.primitiveProps);
	}

	draw(context, id, entity: AcEntity): any {
		const geometryProps = this._geometryPropsEvaluator(this._computationCache, context);
		const instanceProps = this._instancePropsEvaluator(this._computationCache, context);
		const primitiveProps = this._primitivePropsEvaluator(this._computationCache, context);

		if (!this._primitiveMap.has(id)) {
			const primitive = this._staticPrimitiveDrawer.add(geometryProps, instanceProps, primitiveProps);
			primitive.acEntity = entity; // set the entity on the primitive for later usage
			this._primitiveMap.set(id, primitive);
		} else {
			const primitive = this._primitiveMap.get(id);
			this._staticPrimitiveDrawer.update(primitive, geometryProps, instanceProps, primitiveProps);
		}
	}
}
{'fraction_non_alphanumeric': 0.10547523109741645, 'fraction_numerical': 0.0, 'mean_word_length': 6.213675213675214, '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': '4234588', 'n_tokens_mistral': 1226, 'n_tokens_neox': 1176, 'n_words': 227}