OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[#39144] Get viewpoint returns too much data
Eric Schubert695a4196774d
diff --git a/frontend/src/app/features/bim/bcf/api/bcf-api-request.service.ts b/frontend/src/app/features/bim/bcf/api/bcf-api-request.service.tsindex 81084f69fa6..2f4a1ba6458 100644--- a/frontend/src/app/features/bim/bcf/api/bcf-api-request.service.ts+++ b/frontend/src/app/features/bim/bcf/api/bcf-api-request.service.ts@@ -1,3 +1,31 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//+++import { HttpClient, HttpErrorResponse, HttpParams } from '@angular/common/http';import { Injector } from '@angular/core';import { TypedJSON } from 'typedjson';@@ -51,7 +79,7 @@ export class BcfApiRequestService<T> {* @param method request method* @param path API path to request* @param data Request payload (URL params for get, JSON payload otherwise)- * @param data Request payload (URL params for get, JSON payload otherwise)+ * @param headers Request headers*/public request(method:HTTPSupportedMethods, path:string, data:HTTPClientParamMap = {}, headers:HTTPClientHeaders = {}):Observable<T> {// HttpClient requires us to create HttpParams instead of passing data for getdiff --git a/frontend/src/app/features/bim/bcf/api/bcf-api.model.ts b/frontend/src/app/features/bim/bcf/api/bcf-api.model.tsnew file mode 100644index 00000000000..3fb169181a7--- /dev/null+++ b/frontend/src/app/features/bim/bcf/api/bcf-api.model.ts@@ -0,0 +1,103 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//++++export type BcfViewpointData = BcfViewpoint&{+ components:BcfViewpointVisibility&BcfViewpointSelection+};++export type CreateBcfViewpointData = BcfViewpointData&{+ snapshot:{ snapshot_type:string, snapshot_data:string }+};++export interface BcfViewpoint {+ index:number|null+ guid:string+ orthogonal_camera:BcfOrthogonalCamera|null+ perspective_camera:BcfPerspectiveCamera|null+ lines:BcfLine[]|null+ clipping_planes:BcfClippingPlane[]|null+ bitmaps:BcfBitmap[]|null+ snapshot:{ snapshot_type:string }+}++export interface BcfViewpointVisibility {+ visibility:{+ default_visibility:boolean+ exceptions:BcfComponent[]+ view_setup_hints:BcfViewSetupHints|null+ }+}++export interface BcfViewpointSelection {+ selection:BcfComponent[]+}++export interface BcfComponent {+ ifc_guid:string|null+ originating_system:string|null+ authoring_tool_id:string|null+}++export interface BcfViewSetupHints {+ spaces_visible:boolean+ space_boundaries_visible:boolean+ openings_visible:boolean+}++export interface BcfOrthogonalCamera {+ camera_view_point:{ x:number, y:number, z:number }+ camera_direction:{ x:number, y:number, z:number }+ camera_up_vector:{ x:number, y:number, z:number }+ view_to_world_scale:number+}++export interface BcfPerspectiveCamera {+ camera_view_point:{ x:number, y:number, z:number }+ camera_direction:{ x:number, y:number, z:number }+ camera_up_vector:{ x:number, y:number, z:number }+ field_of_view:number+}++export interface BcfBitmap {+ guid:string+ bitmap_type:string+ location:{ x:number, y:number, z:number }+ normal:{ x:number, y:number, z:number }+ up:{ x:number, y:number, z:number }+ height:number+}++export interface BcfClippingPlane {+ location:{ x:number, y:number, z:number }+ direction:{ x:number, y:number, z:number }+}++export interface BcfLine {+ start_point:{ x:number, y:number, z:number }+ end_point:{ x:number, y:number, z:number }+}diff --git a/frontend/src/app/features/bim/bcf/api/topics/bcf-topic.paths.ts b/frontend/src/app/features/bim/bcf/api/topics/bcf-topic.paths.tsindex 2cc1b01ce6d..6429c9980f0 100644--- a/frontend/src/app/features/bim/bcf/api/topics/bcf-topic.paths.ts+++ b/frontend/src/app/features/bim/bcf/api/topics/bcf-topic.paths.ts@@ -1,9 +1,38 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//+++import { BcfResourceCollectionPath, BcfResourcePath } from 'core-app/features/bim/bcf/api/bcf-path-resources';import { BcfTopicResource } from 'core-app/features/bim/bcf/api/topics/bcf-topic.resource';import { BcfApiRequestService } from 'core-app/features/bim/bcf/api/bcf-api-request.service';import { BcfViewpointPaths } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint.paths';import { BcfViewpointCollectionPath } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint-collection.paths';import { HTTPClientHeaders, HTTPClientParamMap } from 'core-app/features/hal/http/http.interfaces';+import { Observable } from 'rxjs';export class BcfTopicPaths extends BcfResourcePath {readonly bcfTopicService = new BcfApiRequestService(this.injector, BcfTopicResource);@@ -14,7 +43,7 @@ export class BcfTopicPaths extends BcfResourcePath {/** /viewpoints */public readonly viewpoints = new BcfViewpointCollectionPath(this.injector, this.path, 'viewpoints', BcfViewpointPaths);- get(params:HTTPClientParamMap = {}, headers:HTTPClientHeaders = {}) {+ get(params:HTTPClientParamMap = {}, headers:HTTPClientHeaders = {}):Observable<BcfTopicResource> {return this.bcfTopicService.get(this.toPath(), params, headers);}}diff --git a/frontend/src/app/features/bim/bcf/api/topics/bcf-topic.resource.ts b/frontend/src/app/features/bim/bcf/api/topics/bcf-topic.resource.tsindex 5234ddf2d8c..543f125d3a5 100644--- a/frontend/src/app/features/bim/bcf/api/topics/bcf-topic.resource.ts+++ b/frontend/src/app/features/bim/bcf/api/topics/bcf-topic.resource.ts@@ -1,3 +1,31 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//+++import { jsonArrayMember, jsonMember, jsonObject } from 'typedjson';import * as moment from 'moment';import { Moment } from 'moment';diff --git a/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-collection.paths.ts b/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-collection.paths.tsindex 21608e48f57..26564ad770a 100644--- a/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-collection.paths.ts+++ b/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-collection.paths.ts@@ -1,20 +1,43 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//+++import { BcfResourceCollectionPath } from 'core-app/features/bim/bcf/api/bcf-path-resources';import { BcfApiRequestService } from 'core-app/features/bim/bcf/api/bcf-api-request.service';-import { BcfViewpointInterface } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint.interface';-import { HTTPClientHeaders, HTTPClientParamMap } from 'core-app/features/hal/http/http.interfaces';import { Observable } from 'rxjs';import { BcfViewpointPaths } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint.paths';+import { CreateBcfViewpointData } from 'core-app/features/bim/bcf/api/bcf-api.model';export class BcfViewpointCollectionPath extends BcfResourceCollectionPath<BcfViewpointPaths> {- readonly bcfTopicService = new BcfApiRequestService<BcfViewpointInterface>(this.injector);-- get(params:HTTPClientParamMap = {}, headers:HTTPClientHeaders = {}) {- throw new Error('Not implemented');- }+ readonly bcfViewpointService = new BcfApiRequestService<CreateBcfViewpointData>(this.injector);- post(viewpoint:BcfViewpointInterface):Observable<BcfViewpointInterface> {+ post(viewpoint:CreateBcfViewpointData):Observable<CreateBcfViewpointData> {return this- .bcfTopicService+ .bcfViewpointService.request('post',this.toPath(),diff --git a/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-item.interface.ts b/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-item.interface.tsindex 77caec61517..aa0745875bb 100644--- a/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-item.interface.ts+++ b/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-item.interface.ts@@ -1,4 +1,32 @@-import { BcfViewpointInterface } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint.interface';+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//++++import { CreateBcfViewpointData } from 'core-app/features/bim/bcf/api/bcf-api.model';export interface BcfViewpointItem {/** The URL of the viewpoint, if persisted */@@ -6,5 +34,5 @@ export interface BcfViewpointItem {/** URL (persisted or data) to the snapshot */snapshotURL:string;/** The loaded snapshot, if exists */- viewpoint?:BcfViewpointInterface;+ viewpoint?:CreateBcfViewpointData;}diff --git a/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-selection.paths.ts b/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-selection.paths.tsnew file mode 100644index 00000000000..50784980d5b--- /dev/null+++ b/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-selection.paths.ts@@ -0,0 +1,41 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//++++import { BcfResourcePath } from 'core-app/features/bim/bcf/api/bcf-path-resources';+import { BcfApiRequestService } from 'core-app/features/bim/bcf/api/bcf-api-request.service';+import { HTTPClientHeaders, HTTPClientParamMap } from 'core-app/features/hal/http/http.interfaces';+import { Observable } from 'rxjs';+import { BcfViewpointSelection } from 'core-app/features/bim/bcf/api/bcf-api.model';++export class BcfViewpointSelectionPath extends BcfResourcePath {+ readonly bcfViewpointsService = new BcfApiRequestService<BcfViewpointSelection>(this.injector);++ get(params:HTTPClientParamMap = {}, headers:HTTPClientHeaders = {}):Observable<BcfViewpointSelection> {+ return this.bcfViewpointsService.get(this.toPath(), params, headers);+ }+}diff --git a/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-visibility.paths.ts b/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-visibility.paths.tsnew file mode 100644index 00000000000..7101db9dcec--- /dev/null+++ b/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-visibility.paths.ts@@ -0,0 +1,41 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//++++import { BcfResourcePath } from 'core-app/features/bim/bcf/api/bcf-path-resources';+import { BcfApiRequestService } from 'core-app/features/bim/bcf/api/bcf-api-request.service';+import { HTTPClientHeaders, HTTPClientParamMap } from 'core-app/features/hal/http/http.interfaces';+import { Observable } from 'rxjs';+import { BcfViewpointVisibility } from 'core-app/features/bim/bcf/api/bcf-api.model';++export class BcfViewpointVisibilityPaths extends BcfResourcePath {+ readonly bcfViewpointsService = new BcfApiRequestService<BcfViewpointVisibility>(this.injector);++ get(params:HTTPClientParamMap = {}, headers:HTTPClientHeaders = {}):Observable<BcfViewpointVisibility> {+ return this.bcfViewpointsService.get(this.toPath(), params, headers);+ }+}diff --git a/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint.interface.ts b/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint.interface.tsdeleted file mode 100644index 44434d118d5..00000000000--- a/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint.interface.ts+++ /dev/null@@ -1,11 +0,0 @@-/** Viewpoints use an interface to avoid (de)serialization of data we don't need */-export interface BcfViewpointInterface {- guid:string;- components:unknown;- bitmaps:unknown[];- snapshot:{ snapshot_type:string, snapshot_data:string };- orthogonal_camera?:unknown;- perspective_camera?:unknown;- clipping_planes?:unknown[];- lines?:unknown[];-}diff --git a/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint.paths.ts b/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint.paths.tsindex 3245fcc895e..a7e496b3e52 100644--- a/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint.paths.ts+++ b/frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint.paths.ts@@ -1,16 +1,58 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//+++import { HTTPClientHeaders, HTTPClientParamMap } from 'core-app/features/hal/http/http.interfaces';import { BcfResourcePath } from 'core-app/features/bim/bcf/api/bcf-path-resources';import { BcfApiRequestService } from 'core-app/features/bim/bcf/api/bcf-api-request.service';-import { BcfViewpointInterface } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint.interface';+import { BcfViewpointSelectionPath } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint-selection.paths';+import { Observable } from 'rxjs';+import { BcfViewpointVisibilityPaths } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint-visibility.paths';+import { BcfViewpoint } from 'core-app/features/bim/bcf/api/bcf-api.model';+import { map } from 'rxjs/operators';export class BcfViewpointPaths extends BcfResourcePath {- readonly bcfTopicService = new BcfApiRequestService<BcfViewpointInterface>(this.injector);+ readonly bcfViewpointsService = new BcfApiRequestService<BcfViewpoint>(this.injector);++ public readonly selection = new BcfViewpointSelectionPath(this.injector, this.path, 'selection');++ public readonly visibility = new BcfViewpointVisibilityPaths(this.injector, this.path, 'visibility');- get(params:HTTPClientParamMap = {}, headers:HTTPClientHeaders = {}) {- return this.bcfTopicService.get(this.toPath(), params, headers);+ get(params:HTTPClientParamMap = {}, headers:HTTPClientHeaders = {}):Observable<BcfViewpoint> {+ return this.bcfViewpointsService.get(this.toPath(), params, headers);}- delete(headers:HTTPClientHeaders = {}) {- return this.bcfTopicService.request('delete', this.toPath(), {}, headers);+ delete(headers:HTTPClientHeaders = {}):Observable<void> {+ return this.bcfViewpointsService+ .request('delete', this.toPath(), {}, headers)+ .pipe(+ map(() => {+ // no expected response payload after delete+ }),+ );}}diff --git a/frontend/src/app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service.ts b/frontend/src/app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service.tsindex 4e802cf4eee..7d1974d11e8 100644--- a/frontend/src/app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service.ts+++ b/frontend/src/app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service.ts@@ -1,9 +1,9 @@import { Injectable, Injector } from '@angular/core';-import { BcfViewpointInterface } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint.interface';import { Observable } from 'rxjs';import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';import { StateService } from '@uirouter/core';+import { CreateBcfViewpointData } from 'core-app/features/bim/bcf/api/bcf-api.model';@Injectable()export abstract class ViewerBridgeService {@@ -28,7 +28,7 @@ export abstract class ViewerBridgeService {/*** Get a viewpoint from the viewer*/- abstract getViewpoint$():Observable<BcfViewpointInterface>;+ abstract getViewpoint$():Observable<CreateBcfViewpointData>;/*** Show the given viewpoint JSON in the viewerdiff --git a/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-new-wp-attribute-group.component.ts b/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-new-wp-attribute-group.component.tsindex c16d29bba4a..2d2d4c02b36 100644--- a/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-new-wp-attribute-group.component.ts+++ b/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-new-wp-attribute-group.component.ts@@ -1,9 +1,36 @@-import { ChangeDetectionStrategy, Component } from '@angular/core';+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//++++import { AfterViewInit, ChangeDetectionStrategy, Component } from '@angular/core';import { BcfWpAttributeGroupComponent } from 'core-app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component';import { switchMap, take } from 'rxjs/operators';import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';import { forkJoin } from 'rxjs';-import { BcfViewpointInterface } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint.interface';import { BcfViewpointItem } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint-item.interface';import isNewResource from 'core-app/features/hal/helpers/is-new-resource';@@ -12,7 +39,7 @@ import isNewResource from 'core-app/features/hal/helpers/is-new-resource';styleUrls: ['./bcf-wp-attribute-group.component.sass'],changeDetection: ChangeDetectionStrategy.OnPush,})-export class BcfNewWpAttributeGroupComponent extends BcfWpAttributeGroupComponent {+export class BcfNewWpAttributeGroupComponent extends BcfWpAttributeGroupComponent implements AfterViewInit {galleryViewpoints:BcfViewpointItem[] = [];ngAfterViewInit():void {@@ -46,23 +73,24 @@ export class BcfNewWpAttributeGroupComponent extends BcfWpAttributeGroupComponenreturn forkJoin(observables);}),)- .subscribe((viewpoints:BcfViewpointInterface[]) => {+ .subscribe(() => {this.showIndex = this.galleryViewpoints.length - 1;});}// Disable show viewpoint functionality- showViewpoint(workPackage:WorkPackageResource, index:number) {+ // eslint-disable-next-line @typescript-eslint/no-unused-vars+ showViewpoint(workPackage:WorkPackageResource, index:number):void {}- deleteViewpoint(workPackage:WorkPackageResource, index:number) {+ deleteViewpoint(workPackage:WorkPackageResource, index:number):void {this.galleryViewpoints = this.galleryViewpoints.filter((_, i) => i !== index);this.setViewpointsOnGallery(this.galleryViewpoints);}- saveViewpoint() {+ saveViewpoint():void {this.viewerBridge.getViewpoint$().subscribe((viewpoint) => {@@ -84,11 +112,11 @@ export class BcfNewWpAttributeGroupComponent extends BcfWpAttributeGroupComponen});}- shouldShowGroup() {+ shouldShowGroup():boolean {return this.createAllowed && this.viewerVisible;}- protected actions() {+ protected actions():{ icon:string, onClick:(evt:any, index:number) => void, titleText:string }[] {// Show only delete buttonreturn super.actions()diff --git a/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts b/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.tsindex 2ca003ba1cd..63b4d0581a1 100644--- a/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts+++ b/frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts@@ -188,7 +188,7 @@ export class BcfWpAttributeGroupComponent extends UntilDestroyedMixin implementsthis.viewpointsService.deleteViewPoint$(workPackage, index)- .subscribe((data) => {+ .subscribe(() => {this.notifications.addSuccess(this.text.notice_successful_delete);this.gallery.preview.close();});diff --git a/frontend/src/app/features/bim/bcf/helper/viewpoints.service.ts b/frontend/src/app/features/bim/bcf/helper/viewpoints.service.tsindex ffa9ce16052..793bd1d86c9 100644--- a/frontend/src/app/features/bim/bcf/helper/viewpoints.service.ts+++ b/frontend/src/app/features/bim/bcf/helper/viewpoints.service.ts@@ -1,3 +1,31 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//+++import { Injectable, Injector } from '@angular/core';import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';import { BcfApiService } from 'core-app/features/bim/bcf/api/bcf-api.service';@@ -6,10 +34,10 @@ import { BcfViewpointPaths } from 'core-app/features/bim/bcf/api/viewpoints/bcf-import { ViewerBridgeService } from 'core-app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service';import { map, switchMap, tap } from 'rxjs/operators';import { forkJoin, Observable, of } from 'rxjs';-import { BcfViewpointInterface } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint.interface';import { BcfTopicResource } from 'core-app/features/bim/bcf/api/topics/bcf-topic.resource';import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';import idFromLink from 'core-app/features/hal/helpers/id-from-link';+import { BcfViewpointData, CreateBcfViewpointData } from 'core-app/features/bim/bcf/api/bcf-api.model';@Injectable()export class ViewpointsService {@@ -21,21 +49,36 @@ export class ViewpointsService {@InjectField() apiV3Service:APIV3Service;- constructor(readonly injector:Injector) {}+ constructor(readonly injector:Injector) {+ }public getViewPointResource(workPackage:WorkPackageResource, index:number):BcfViewpointPaths {- const viewpointHref = workPackage.bcfViewpoints[index].href;+ const viewpointHref = workPackage.bcfViewpoints[index].href as string;return this.bcfApi.parse<BcfViewpointPaths>(viewpointHref);}- public getViewPoint$(workPackage:WorkPackageResource, index:number):Observable<BcfViewpointInterface> {+ public getViewPoint$(workPackage:WorkPackageResource, index:number):Observable<BcfViewpointData> {const viewpointResource = this.getViewPointResource(workPackage, index);- return viewpointResource.get();+ return forkJoin({+ viewpoint: viewpointResource.get(),+ selection: viewpointResource.selection.get(),+ visibility: viewpointResource.visibility.get(),+ })+ .pipe(+ map(({ viewpoint, selection, visibility }) => {+ const data = viewpoint as BcfViewpointData;+ data.components = {+ selection: selection.selection,+ visibility: visibility.visibility,+ };+ return data;+ }),+ );}- public deleteViewPoint$(workPackage:WorkPackageResource, index:number):Observable<BcfViewpointInterface> {+ public deleteViewPoint$(workPackage:WorkPackageResource, index:number):Observable<void> {const viewpointResource = this.getViewPointResource(workPackage, index);return viewpointResource@@ -46,7 +89,7 @@ export class ViewpointsService {);}- public saveViewpoint$(workPackage:WorkPackageResource, viewpoint?:BcfViewpointInterface):Observable<BcfViewpointInterface> {+ public saveViewpoint$(workPackage:WorkPackageResource, viewpoint?:CreateBcfViewpointData):Observable<CreateBcfViewpointData> {const wpProjectId = idFromLink(workPackage.project.href);const topicUUID$ = this.setBcfTopic$(workPackage);// Default to the current viewer's viewpoint@@ -65,11 +108,11 @@ export class ViewpointsService {.viewpoints.post(results.viewpoint)),// Update the work package to reload the viewpoints- tap((results) => this.apiV3Service.work_packages.id(workPackage).requireAndStream(true)),+ tap(() => this.apiV3Service.work_packages.id(workPackage).requireAndStream(true)),);}- public setBcfTopic$(workPackage:WorkPackageResource) {+ public setBcfTopic$(workPackage:WorkPackageResource):Observable<string|number> {if (this.topicUUID) {return of(this.topicUUID);}@@ -78,7 +121,12 @@ export class ViewpointsService {? of(this.bcfApi.parse<BcfViewpointPaths>(topicHref)!.id): this.createBcfTopic$(workPackage);- return topicUUID$.pipe(map((topicUUID) => this.topicUUID = topicUUID));+ return topicUUID$.pipe(+ map((topicUUID) => {+ this.topicUUID = topicUUID;+ return this.topicUUID;+ }),+ );}private createBcfTopic$(workPackage:WorkPackageResource):Observable<string> {diff --git a/frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts b/frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.tsindex ad562e1cce7..8f229d9ce59 100644--- a/frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts+++ b/frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts@@ -1,6 +1,33 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//+++import { Injectable, Injector } from '@angular/core';import { XeokitServer } from 'core-app/features/bim/ifc_models/xeokit/xeokit-server';-import { BcfViewpointInterface } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint.interface';import { ViewerBridgeService } from 'core-app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service';import { BehaviorSubject, Observable, of } from 'rxjs';import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';@@ -11,6 +38,9 @@ import { ViewpointsService } from 'core-app/features/bim/bcf/helper/viewpoints.simport { CurrentProjectService } from 'core-app/core/current-project/current-project.service';import { HttpClient } from '@angular/common/http';import idFromLink from 'core-app/features/hal/helpers/id-from-link';+import { IfcProjectDefinition } from 'core-app/features/bim/ifc_models/pages/viewer/ifc-models-data.service';+import { BIMViewer } from '@xeokit/xeokit-bim-viewer/dist/xeokit-bim-viewer.es';+import { BcfViewpointData, CreateBcfViewpointData } from 'core-app/features/bim/bcf/api/bcf-api.model';export interface XeokitElements {canvasElement:HTMLElement;@@ -46,6 +76,24 @@ export interface BCFLoadOptions {reverseClippingPlanes?:boolean;}+/**+ * Wrapping type from xeokit module. Can be removed after we get a real type package.+ */+type Controller = {+ on:(event:string, callback:(event:unknown) => void) => string+};++/**+ * Wrapping type from xeokit module. Can be removed after we get a real type package.+ */+type BimViewer = Controller&{+ loadProject:(projectId:string) => void,+ saveBCFViewpoint:(options:BCFCreationOptions) => CreateBcfViewpointData,+ loadBCFViewpoint:(bcfViewpoint:BcfViewpointData, options:BCFLoadOptions) => void,+ setKeyboardEnabled:(enabled:boolean) => true,+ destroy:() => void+};+@Injectable()export class IFCViewerService extends ViewerBridgeService {public shouldShowViewer = true;@@ -54,7 +102,7 @@ export class IFCViewerService extends ViewerBridgeService {public inspectorVisible$ = new BehaviorSubject<boolean>(false);- private _viewer:any;+ private bimViewer:BimViewer|undefined;@InjectField() pathHelper:PathHelperService;@@ -70,60 +118,59 @@ export class IFCViewerService extends ViewerBridgeService {super(injector);}- public newViewer(elements:XeokitElements, projects:any[]):void {- void import('@xeokit/xeokit-bim-viewer/dist/xeokit-bim-viewer.es').then((XeokitViewerModule:any) => {- const server = new XeokitServer(this.pathHelper);- const viewerUI = new XeokitViewerModule.BIMViewer(server, elements);-- viewerUI.on('queryPicked', (event:any) => {- alert(`IFC Name = "${event.objectName}"\nIFC class = "${event.objectType}"\nIFC GUID = ${event.objectId}`);- });-- viewerUI.on('modelLoaded', () => this.viewerVisible$.next(true));-- viewerUI.loadProject(projects[0].id);-- viewerUI.on('addModel', (event:Event) => { // "Add" selected in Models tab's context menu- window.location.href = this.pathHelper.ifcModelsNewPath(this.currentProjectService.identifier as string);- });-- viewerUI.on('openInspector', () => {- this.inspectorVisible$.next(true);- });-- viewerUI.on('editModel', (event:{ modelId:number|string }) => { // "Edit" selected in Models tab's context menu- window.location.href = this.pathHelper.ifcModelsEditPath(this.currentProjectService.identifier as string, event.modelId);- });-- viewerUI.on('deleteModel', (event:{ modelId:number|string }) => { // "Delete" selected in Models tab's context menu- // We don't have an API for IFC models yet. We need to use the normal Rails form posts for deletion.- const formData = new FormData();- formData.append(- 'authenticity_token',- jQuery('meta[name=csrf-token]').attr('content') as string,- );- formData.append(- '_method',- 'delete',- );-- this.httpClient.post(- this.pathHelper.ifcModelsDeletePath(- this.currentProjectService.identifier as string, event.modelId,- ),- formData,- )- .subscribe()- .add(() => {- // Ensure we reload after every request.- // We need to reload to get a fresh CSRF token for a successive- // model deletion placed as a META element into the HTML HEAD.- window.location.reload();- });- });-- this.viewer = viewerUI;+ public newViewer(elements:XeokitElements, projects:IfcProjectDefinition[]):void {+ const server = new XeokitServer(this.pathHelper);+ // eslint-disable-next-line @typescript-eslint/no-unsafe-call+ const viewerUI = new BIMViewer(server, elements) as BimViewer;++ viewerUI.on('queryPicked', (event:{ objectName:string, objectType:string, objectId:string }) => {+ alert(`IFC Name = "${event.objectName}"\nIFC class = "${event.objectType}"\nIFC GUID = ${event.objectId}`);+ });++ viewerUI.on('modelLoaded', () => this.viewerVisible$.next(true));++ viewerUI.loadProject(projects[0].id);++ viewerUI.on('addModel', () => { // "Add" selected in Models tab's context menu+ window.location.href = this.pathHelper.ifcModelsNewPath(this.currentProjectService.identifier as string);+ });++ viewerUI.on('openInspector', () => {+ this.inspectorVisible$.next(true);});++ viewerUI.on('editModel', (event:{ modelId:number|string }) => { // "Edit" selected in Models tab's context menu+ window.location.href = this.pathHelper.ifcModelsEditPath(this.currentProjectService.identifier as string, event.modelId);+ });++ viewerUI.on('deleteModel', (event:{ modelId:number|string }) => { // "Delete" selected in Models tab's context menu+ // We don't have an API for IFC models yet. We need to use the normal Rails form posts for deletion.+ const formData = new FormData();+ formData.append(+ 'authenticity_token',+ jQuery('meta[name=csrf-token]').attr('content') as string,+ );+ formData.append(+ '_method',+ 'delete',+ );++ this.httpClient.post(+ this.pathHelper.ifcModelsDeletePath(+ this.currentProjectService.identifier as string, event.modelId,+ ),+ formData,+ )+ .subscribe()+ .add(() => {+ // Ensure we reload after every request.+ // We need to reload to get a fresh CSRF token for a successive+ // model deletion placed as a META element into the HTML HEAD.+ window.location.reload();+ });+ });++ this.viewer = viewerUI;}public destroy():void {@@ -137,24 +184,28 @@ export class IFCViewerService extends ViewerBridgeService {this.viewer = undefined;}- public get viewer():any {- return this._viewer;+ public get viewer():BimViewer|undefined {+ return this.bimViewer;}- public set viewer(viewer:any) {- this._viewer = viewer;+ public set viewer(viewer:BimViewer|undefined) {+ this.bimViewer = viewer;}public setKeyboardEnabled(val:boolean):void {- this.viewer.setKeyboardEnabled(val);+ this.viewer?.setKeyboardEnabled(val);}- public getViewpoint$():Observable<BcfViewpointInterface> {+ public getViewpoint$():Observable<CreateBcfViewpointData> {+ if (!this.viewer) {+ return of();+ }+const opts:BCFCreationOptions = { spacesVisible: true, reverseClippingPlanes: true };const viewpoint = this.viewer.saveBCFViewpoint(opts);// The backend rejects viewpoints with bitmaps- delete viewpoint.bitmaps;+ viewpoint.bitmaps = null;return of(viewpoint);}@@ -167,15 +218,20 @@ export class IFCViewerService extends ViewerBridgeService {const opts:BCFLoadOptions = { updateCompositeObjects: true, reverseClippingPlanes: true };this.viewpointsService.getViewPoint$(workPackage, index)- .subscribe(viewpoint => this.viewer.loadBCFViewpoint(viewpoint, opts));+ .subscribe((viewpoint) => this.viewer?.loadBCFViewpoint(viewpoint, opts));}} else {+ if (!workPackage.id) {+ return;+ }+// Reload the whole app to get the correct menus and GON data// and redirect to a route with a place to show viewer// ('bim.partitioned.split')window.location.href = this.pathHelper.bimDetailsPath(+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-accessidFromLink(workPackage.project.href),- workPackage.id!,+ workPackage.id,index,);}diff --git a/frontend/src/app/features/bim/ifc_models/pages/viewer/ifc-models-data.service.ts b/frontend/src/app/features/bim/ifc_models/pages/viewer/ifc-models-data.service.tsindex e7435aea977..9504d4831ca 100644--- a/frontend/src/app/features/bim/ifc_models/pages/viewer/ifc-models-data.service.ts+++ b/frontend/src/app/features/bim/ifc_models/pages/viewer/ifc-models-data.service.ts@@ -18,7 +18,7 @@ export interface IFCGonDefinition {export interface IfcProjectDefinition {name:string;- id:number;+ id:string;}export interface IfcModelDefinition {diff --git a/frontend/src/app/features/bim/revit_add_in/revit-bridge.service.ts b/frontend/src/app/features/bim/revit_add_in/revit-bridge.service.tsindex 4d540dda539..7bbd0c428a2 100644--- a/frontend/src/app/features/bim/revit_add_in/revit-bridge.service.ts+++ b/frontend/src/app/features/bim/revit_add_in/revit-bridge.service.ts@@ -1,13 +1,41 @@+// -- copyright+// OpenProject is an open source project management software.+// Copyright (C) 2012-2021 the OpenProject GmbH+//+// This program is free software; you can redistribute it and/or+// modify it under the terms of the GNU General Public License version 3.+//+// OpenProject is a fork of ChiliProject, which is a fork of Redmine. The copyright follows:+// Copyright (C) 2006-2013 Jean-Philippe Lang+// Copyright (C) 2010-2013 the ChiliProject Team+//+// 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; either version 2+// of the License, or (at your option) any later version.+//+// 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, write to the Free Software+// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.+//+// See COPYRIGHT and LICENSE files for more details.+//+++import { Injectable, Injector } from '@angular/core';import { BehaviorSubject, Observable, Subject } from 'rxjs';import {distinctUntilChanged, filter, first, map,} from 'rxjs/operators';-import { BcfViewpointInterface } from 'core-app/features/bim/bcf/api/viewpoints/bcf-viewpoint.interface';import { ViewerBridgeService } from 'core-app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service';import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';import { ViewpointsService } from 'core-app/features/bim/bcf/helper/viewpoints.service';import { InjectField } from 'core-app/shared/helpers/angular/inject-field.decorator';+import { BcfViewpointData, CreateBcfViewpointData } from 'core-app/features/bim/bcf/api/bcf-api.model';declare global {interface Window {@@ -45,7 +73,7 @@ export class RevitBridgeService extends ViewerBridgeService {return this.viewerVisible$.getValue();}- public getViewpoint$():Observable<BcfViewpointInterface> {+ public getViewpoint$():Observable<CreateBcfViewpointData> {const trackingId = this.newTrackingId();this.sendMessageToRevit('ViewpointGenerationRequest', trackingId, '');@@ -73,11 +101,11 @@ export class RevitBridgeService extends ViewerBridgeService {public showViewpoint(workPackage:WorkPackageResource, index:number) {this.viewpointsService.getViewPoint$(workPackage, index)- .subscribe((viewpoint:BcfViewpointInterface) =>+ .subscribe((viewpoint:BcfViewpointData) =>this.sendMessageToRevit('ShowViewpoint',this.newTrackingId(),- JSON.stringify(viewpoint)+ JSON.stringify(viewpoint),));}diff --git a/modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rb b/modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rbindex 9da81b6b300..9020fcd17eb 100644--- a/modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rb+++ b/modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rb@@ -36,7 +36,8 @@ module Bim::Bcf::API::V2_1get do@issue.viewpoints- .pluck(:json_viewpoint)+ .select(::Bim::Bcf::API::V2_1::Viewpoints::FullRepresenter.selector)+ .map(&:json_viewpoint)endpost &::Bim::Bcf::API::V2_1::Endpoints::Create@@ -54,18 +55,16 @@ module Bim::Bcf::API::V2_1namespace = key == :/ ? :Full : key.to_s.camelizeget key, &::Bim::Bcf::API::V2_1::Endpoints::Show- .new(model: Bim::Bcf::Viewpoint,- api_name: 'Viewpoints',- render_representer: "::Bim::Bcf::API::V2_1::Viewpoints::#{namespace}Representer".constantize,- instance_generator: ->(*) { @issue.viewpoints.where(uuid: params[:viewpoint_uuid]) })- .mount+ .new(model: Bim::Bcf::Viewpoint,+ render_representer: "::Bim::Bcf::API::V2_1::Viewpoints::#{namespace}Representer".constantize,+ instance_generator: ->(*) { @issue.viewpoints.where(uuid: params[:viewpoint_uuid]) })+ .mountenddelete &::Bim::Bcf::API::V2_1::Endpoints::Delete- .new(model: Bim::Bcf::Viewpoint,- api_name: 'Viewpoints',- instance_generator: ->(*) { @issue.viewpoints.find_by!(uuid: params[:viewpoint_uuid]) })- .mount+ .new(model: Bim::Bcf::Viewpoint,+ instance_generator: ->(*) { @issue.viewpoints.find_by!(uuid: params[:viewpoint_uuid]) })+ .mountget :bitmaps doraise NotImplementedError, 'Bitmaps are not yet implemented.'diff --git a/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/base_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/base_representer.rbindex 2b755c3d472..0c29507f7a0 100644--- a/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/base_representer.rb+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/base_representer.rb@@ -1,5 +1,3 @@-#-- encoding: UTF-8-#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2021 the OpenProject GmbH@@ -30,12 +28,6 @@module Bim::Bcf::API::V2_1class Viewpoints::BaseRepresenter < BaseRepresenter- attr_reader :base_scope-- def initialize(base_scope)- @base_scope = base_scope- end-def to_json(*_args)row = scope.firstraise ::ActiveRecord::RecordNotFound unless rowdiff --git a/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/coloring_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/coloring_representer.rbindex 043a0404b11..129cf626de2 100644--- a/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/coloring_representer.rb+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/coloring_representer.rb@@ -1,5 +1,3 @@-#-- encoding: UTF-8-#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2021 the OpenProject GmbH@@ -35,7 +33,7 @@ module Bim::Bcf::API::V2_1::Viewpointsprotecteddef scope- base_scope+ represented.select "jsonb_build_object('coloring', json_viewpoint #> '{components, coloring}') as json_viewpoint"endenddiff --git a/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/full_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/full_representer.rbindex 01c21a65a0c..4756f2c743f 100644--- a/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/full_representer.rb+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/full_representer.rb@@ -1,5 +1,3 @@-#-- encoding: UTF-8-#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2021 the OpenProject GmbH@@ -31,10 +29,15 @@ require_relative 'base_representer'module Bim::Bcf::API::V2_1::Viewpointsclass FullRepresenter < BaseRepresenter++ def self.selector+ "json_viewpoint - 'components' as json_viewpoint"+ end+protecteddef scope- base_scope.select(:json_viewpoint)+ represented.select(self.class.selector)endendenddiff --git a/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/selection_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/selection_representer.rbindex 55a052a5100..5ee644a0a31 100644--- a/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/selection_representer.rb+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/selection_representer.rb@@ -1,5 +1,3 @@-#-- encoding: UTF-8-#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2021 the OpenProject GmbH@@ -35,7 +33,7 @@ module Bim::Bcf::API::V2_1::Viewpointsprotecteddef scope- base_scope+ represented.select "jsonb_build_object('selection', json_viewpoint #> '{components, selection}') as json_viewpoint"endenddiff --git a/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/single_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/single_representer.rbindex 2256cd1d355..ac90e6ca444 100644--- a/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/single_representer.rb+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/single_representer.rb@@ -1,5 +1,3 @@-#-- encoding: UTF-8-#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2021 the OpenProject GmbHdiff --git a/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/visibility_representer.rb b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/visibility_representer.rbindex 8f7c6272ccb..e228565009a 100644--- a/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/visibility_representer.rb+++ b/modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/visibility_representer.rb@@ -1,5 +1,3 @@-#-- encoding: UTF-8-#-- copyright# OpenProject is an open source project management software.# Copyright (C) 2012-2021 the OpenProject GmbH@@ -35,7 +33,7 @@ module Bim::Bcf::API::V2_1::Viewpointsprotecteddef scope- base_scope+ represented.select "jsonb_build_object('visibility', json_viewpoint #> '{components, visibility}') as json_viewpoint"endend