[#39144] Get viewpoint returns too much data

- https://community.openproject.org/work_packages/39144
- removed components from get viewpoint payload
- fixed linter issues in several bcf services (added types)
- added interface models for bcf viewpoint api
- fixed parsing of attributes when posting viewpoints
- added getter for viewpoint visibility and selection
pull/9783/head
Eric Schubert 3 years ago
parent 077a7cd7c3
commit 695a419677
No known key found for this signature in database
GPG Key ID: 1D346C019BD4BAA2
  1. 30
      frontend/src/app/features/bim/bcf/api/bcf-api-request.service.ts
  2. 103
      frontend/src/app/features/bim/bcf/api/bcf-api.model.ts
  3. 31
      frontend/src/app/features/bim/bcf/api/topics/bcf-topic.paths.ts
  4. 28
      frontend/src/app/features/bim/bcf/api/topics/bcf-topic.resource.ts
  5. 41
      frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-collection.paths.ts
  6. 32
      frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-item.interface.ts
  7. 41
      frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-selection.paths.ts
  8. 41
      frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint-visibility.paths.ts
  9. 11
      frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint.interface.ts
  10. 54
      frontend/src/app/features/bim/bcf/api/viewpoints/bcf-viewpoint.paths.ts
  11. 4
      frontend/src/app/features/bim/bcf/bcf-viewer-bridge/viewer-bridge.service.ts
  12. 46
      frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-new-wp-attribute-group.component.ts
  13. 2
      frontend/src/app/features/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts
  14. 68
      frontend/src/app/features/bim/bcf/helper/viewpoints.service.ts
  15. 184
      frontend/src/app/features/bim/ifc_models/ifc-viewer/ifc-viewer.service.ts
  16. 2
      frontend/src/app/features/bim/ifc_models/pages/viewer/ifc-models-data.service.ts
  17. 36
      frontend/src/app/features/bim/revit_add_in/revit-bridge.service.ts
  18. 19
      modules/bim/app/controllers/bim/bcf/api/v2_1/viewpoints/api.rb
  19. 8
      modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/base_representer.rb
  20. 4
      modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/coloring_representer.rb
  21. 9
      modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/full_representer.rb
  22. 4
      modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/selection_representer.rb
  23. 2
      modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/single_representer.rb
  24. 4
      modules/bim/app/representers/bim/bcf/api/v2_1/viewpoints/visibility_representer.rb

@ -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 get

@ -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 }
}

@ -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);
}
}

@ -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';

@ -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(),

@ -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;
}

@ -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);
}
}

@ -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);
}
}

@ -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[];
}

@ -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
}),
);
}
}

@ -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 viewer

@ -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 BcfWpAttributeGroupComponen
return 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 button
return super
.actions()

@ -188,7 +188,7 @@ export class BcfWpAttributeGroupComponent extends UntilDestroyedMixin implements
this.viewpointsService
.deleteViewPoint$(workPackage, index)
.subscribe((data) => {
.subscribe(() => {
this.notifications.addSuccess(this.text.notice_successful_delete);
this.gallery.preview.close();
});

@ -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> {

@ -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.s
import { 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-access
idFromLink(workPackage.project.href),
workPackage.id!,
workPackage.id,
index,
);
}

@ -18,7 +18,7 @@ export interface IFCGonDefinition {
export interface IfcProjectDefinition {
name:string;
id:number;
id:string;
}
export interface IfcModelDefinition {

@ -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),
)
);
}

@ -36,7 +36,8 @@ module Bim::Bcf::API::V2_1
get do
@issue
.viewpoints
.pluck(:json_viewpoint)
.select(::Bim::Bcf::API::V2_1::Viewpoints::FullRepresenter.selector)
.map(&:json_viewpoint)
end
post &::Bim::Bcf::API::V2_1::Endpoints::Create
@ -54,18 +55,16 @@ module Bim::Bcf::API::V2_1
namespace = key == :/ ? :Full : key.to_s.camelize
get 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]) })
.mount
end
delete &::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]) })
.mount
get :bitmaps do
raise NotImplementedError, 'Bitmaps are not yet implemented.'

@ -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_1
class Viewpoints::BaseRepresenter < BaseRepresenter
attr_reader :base_scope
def initialize(base_scope)
@base_scope = base_scope
end
def to_json(*_args)
row = scope.first
raise ::ActiveRecord::RecordNotFound unless row

@ -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::Viewpoints
protected
def scope
base_scope
represented
.select "jsonb_build_object('coloring', json_viewpoint #> '{components, coloring}') as json_viewpoint"
end
end

@ -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::Viewpoints
class FullRepresenter < BaseRepresenter
def self.selector
"json_viewpoint - 'components' as json_viewpoint"
end
protected
def scope
base_scope.select(:json_viewpoint)
represented.select(self.class.selector)
end
end
end

@ -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::Viewpoints
protected
def scope
base_scope
represented
.select "jsonb_build_object('selection', json_viewpoint #> '{components, selection}') as json_viewpoint"
end
end

@ -1,5 +1,3 @@
#-- encoding: UTF-8
#-- copyright
# OpenProject is an open source project management software.
# Copyright (C) 2012-2021 the OpenProject GmbH

@ -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::Viewpoints
protected
def scope
base_scope
represented
.select "jsonb_build_object('visibility', json_viewpoint #> '{components, visibility}') as json_viewpoint"
end
end

Loading…
Cancel
Save