mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 09:03:02 +00:00
feat: add core
This commit is contained in:
103
src/core/things/Floor.ts
Normal file
103
src/core/things/Floor.ts
Normal 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;
|
||||
}
|
||||
Reference in New Issue
Block a user