feat: add core

This commit is contained in:
Karl-Philipp Wulfert
2018-11-29 16:22:57 +01:00
commit 2d770dde44
131 changed files with 41268 additions and 0 deletions

103
src/core/things/Floor.ts Normal file
View File

@@ -0,0 +1,103 @@
/*
* Copyright (C) 2018 StApps
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the Free
* Software Foundation, version 3.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along with
* this program. If not, see <https://www.gnu.org/licenses/>.
*/
import {Feature, FeatureCollection, GeometryObject, LineString} from 'geojson';
import {SCThingInPlace} from '../base/ThingInPlace';
import {SCThing, SCThingMeta, SCThingTranslatableProperties} from '../Thing';
import {SCTranslations} from '../types/i18n';
import {SCPointOfInterestWithoutReferences} from './PointOfInterest';
import {SCRoomWithoutReferences} from './Room';
/**
* Type of a floor
*/
export type SCFloorType = 'floor';
/**
* A floor without references
*/
export interface SCFloorWithoutReferences extends SCThing {
/**
* Floor name in the place it is in e.g. "first floor", "ground floor". This doesn't reference the building name.
*/
floorName: string;
/**
* Floor plan
*/
plan: SCFloorFeatureCollectionWithPlaces<LineString, any>;
/**
* Translated fields of a floor
*/
translations?: SCTranslations<SCFloorTranslatableProperties>;
/**
* Type of a floor
*/
type: SCFloorType;
}
/**
* A floor
*/
export interface SCFloor extends SCFloorWithoutReferences, SCThingInPlace {
/**
* Translated fields of a floor
*/
translations?: SCTranslations<SCFloorTranslatableProperties>;
/**
* Type of a floor
*/
type: SCFloorType;
}
/**
* Meta information about a floor
*/
export class SCFloorMeta extends SCThingMeta {
}
/**
* A feature collection
*/
export interface SCFloorFeatureCollectionWithPlaces<T extends GeometryObject, P = any>
extends FeatureCollection<T, P> {
/**
* Features of the collection
*/
features: Array<SCFloorFeatureWithPlace<T, P>>;
}
/***
* A feature with a place
*/
export interface SCFloorFeatureWithPlace<T extends GeometryObject, P = any>
extends Feature<T, P> {
/**
* The place of the feature
*/
place?: SCRoomWithoutReferences | SCPointOfInterestWithoutReferences;
}
/**
* Translatable properties of a floor
*/
export interface SCFloorTranslatableProperties extends SCThingTranslatableProperties {
/**
* Translation of the floor name
*/
floorName?: string;
}