@vitrosoftware/common-ui-ts 1.1.74 → 1.1.77
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/css/common.css +2 -1
- package/css/std/controls/action-handler/action-handler.css +3 -2
- package/css/std/controls/bim-viewer/annotation.css +85 -0
- package/css/std/controls/bim-viewer/bim-viewer-index.css +1100 -0
- package/css/std/controls/bim-viewer/bim-viewer.css +53 -0
- package/css/std/controls/bim-viewer/comparison-popup.css +92 -0
- package/css/std/controls/bim-viewer/context-menu.css +54 -0
- package/css/std/controls/bim-viewer/dialog.css +50 -0
- package/css/std/controls/bim-viewer/nav-cube.css +18 -0
- package/css/std/controls/bim-viewer/prop-inspector.css +86 -0
- package/css/std/controls/bim-viewer/section-planes.css +8 -0
- package/css/std/controls/bim-viewer/sidebar.css +226 -0
- package/css/std/controls/bim-viewer/storey-views.css +57 -0
- package/css/std/controls/bim-viewer/style.css +56 -0
- package/css/std/controls/bim-viewer/toolbar.css +208 -0
- package/css/std/controls/bim-viewer/treeview.css +103 -0
- package/css/std/controls/breadcrumbs/breadcrumbs.css +11 -10
- package/css/std/controls/command-menu/command-menu-dropdown-button.css +8 -7
- package/css/std/controls/command-menu/command-menu.css +0 -1
- package/css/std/controls/criterion/criterion.css +9 -8
- package/css/std/controls/date-picker/date-picker.css +1 -1
- package/css/std/controls/dropdown-button/dropdown-button.css +9 -7
- package/css/std/controls/file-version-select/file-version-select.css +160 -0
- package/css/std/controls/input/input.css +1 -1
- package/css/std/controls/lookup-picker/lookup-picker-selected-item.css +0 -1
- package/css/std/controls/lookup-picker/lookup-picker.css +7 -3
- package/css/std/controls/pdf-viewer/custom.css +38 -19
- package/css/std/controls/pdf-viewer/pdf-viewer-index.css +5503 -0
- package/css/std/controls/pdf-viewer/pdf-viewer.css +24 -16
- package/css/std/controls/pdf-viewer/viewer.css +188 -158
- package/css/std/controls/search/search.css +1 -1
- package/css/std/controls/sidebar/sidebar.css +2 -2
- package/css/std/controls/tab-group/tab-group.css +1 -14
- package/css/std/controls/table-view/table-view-custom-lookup-edit.css +2 -2
- package/css/std/controls/table-view/table-view.css +11 -0
- package/css/std/controls/table-view/treegrid.css +105 -37
- package/css/std/controls/time-picker/time-picker.css +1 -1
- package/css/std/controls/tooltip/tooltip.css +2 -1
- package/css/std/controls/uploader/uploader.css +1 -1
- package/css/std/controls/user-profile/user-profile.css +12 -10
- package/css/third-party/jquery-growl/jquery.growl.css +96 -0
- package/css/third-party/uikit/uikit.css +12083 -0
- package/dist/index.css +294 -125
- package/dist/index.js +527 -282
- package/dist/index.js.map +1 -1
- package/dist/src/constants/Control.d.ts +11 -0
- package/dist/src/constants/Ctrl.d.ts +30 -0
- package/dist/src/constants/Event.d.ts +13 -0
- package/dist/src/constants/Factory.d.ts +3 -0
- package/dist/src/constants/KeyCode.d.ts +3 -0
- package/dist/src/constants/Placement.d.ts +7 -0
- package/dist/src/constants/Unit.d.ts +3 -0
- package/dist/src/controls/ActionHandler/ActionHandler.d.ts +31 -0
- package/dist/src/controls/ActionHandler/ActionHandlerConstants.d.ts +32 -0
- package/dist/src/controls/ActionHandler/ActionInfo.d.ts +12 -0
- package/dist/src/controls/ActionHandler/ActionInfoItem.d.ts +13 -0
- package/dist/src/controls/ActionHandler/UpdatingPopover.d.ts +2 -0
- package/dist/src/controls/Activity/Activity.d.ts +9 -0
- package/dist/src/controls/ActivityItem/ActivityItem.d.ts +16 -0
- package/dist/src/controls/ActivityItem/ActivityMessage.d.ts +6 -0
- package/dist/src/controls/Alert/Alert.d.ts +19 -0
- package/dist/src/controls/Alert/AlertConstants.d.ts +5 -0
- package/dist/src/controls/Avatar/Avatar.d.ts +8 -0
- package/dist/src/controls/BimViewer/BimViewer.d.ts +6 -0
- package/dist/src/controls/BimViewer/BimViewerContext.d.ts +20 -0
- package/dist/src/controls/BimViewer/Viewer.d.ts +6 -0
- package/dist/src/controls/Breadcrumbs/Breadcrumbs.d.ts +13 -0
- package/dist/src/controls/Breadcrumbs/Item.d.ts +10 -0
- package/dist/src/controls/Button/Button.d.ts +14 -0
- package/dist/src/controls/Checkbox/Checkbox.d.ts +11 -0
- package/dist/src/controls/CommandMenu/CommandMenu.d.ts +6 -0
- package/dist/src/controls/CommandMenu/CommandMenuButton.d.ts +13 -0
- package/dist/src/controls/CommandMenu/CommandMenuDropdownButton.d.ts +18 -0
- package/dist/src/controls/CommandMenu/CommandMenuItemHeader.d.ts +11 -0
- package/dist/src/controls/CommandMenu/CommandMenuLookupPicker.d.ts +32 -0
- package/dist/src/controls/CommandMenu/CommandMenuSubItem.d.ts +13 -0
- package/dist/src/controls/ComponentLoader/ComponentLoader.d.ts +8 -0
- package/dist/src/controls/ComponentLoader/ComponentLoaderContextImpl.d.ts +11 -0
- package/dist/src/controls/ControlGroup/ControlGroup.d.ts +7 -0
- package/dist/src/controls/Criterion/ConditionSelect.d.ts +9 -0
- package/dist/src/controls/Criterion/Criterion.d.ts +23 -0
- package/dist/src/controls/DatePicker/DatePicker.d.ts +29 -0
- package/dist/src/controls/DatePicker/DatePickerConstants.d.ts +12 -0
- package/dist/src/controls/Dialog/Dialog.d.ts +23 -0
- package/dist/src/controls/Dialog/DialogButton.d.ts +8 -0
- package/dist/src/controls/Dialog/DialogCloseButton.d.ts +8 -0
- package/dist/src/controls/Dialog/DialogComponent.d.ts +8 -0
- package/dist/src/controls/Dialog/DialogConstants.d.ts +5 -0
- package/dist/src/controls/Dialog/DialogContent.d.ts +7 -0
- package/dist/src/controls/Dialog/DialogFooter.d.ts +11 -0
- package/dist/src/controls/Dialog/DialogHeader.d.ts +8 -0
- package/dist/src/controls/DropdownButton/DropdownButton.d.ts +13 -0
- package/dist/src/controls/FieldIterator/FieldIterator.d.ts +24 -0
- package/dist/src/controls/FileVersionSelect/FileVersionItem.d.ts +6 -0
- package/dist/src/controls/FileVersionSelect/FileVersionSelect.d.ts +12 -0
- package/dist/src/controls/FileVersionSelect/Item.d.ts +10 -0
- package/dist/src/controls/Icon/Icon.d.ts +11 -0
- package/dist/src/controls/ImagePicker/ImagePicker.d.ts +16 -0
- package/dist/src/controls/ImagePicker/ImagePickerConstants.d.ts +8 -0
- package/dist/src/controls/Input/Input.d.ts +32 -0
- package/dist/src/controls/Input/InputConstants.d.ts +4 -0
- package/dist/src/controls/IssueTile/IssueTile.d.ts +26 -0
- package/dist/src/controls/IssueTile/IssueTileConstants.d.ts +3 -0
- package/dist/src/controls/IssueTile/IssueTileFooter.d.ts +8 -0
- package/dist/src/controls/IssueTile/IssueTileHeader.d.ts +18 -0
- package/dist/src/controls/Label/Label.d.ts +9 -0
- package/dist/src/controls/Label/LabelConstants.d.ts +3 -0
- package/dist/src/controls/Login/Login.d.ts +16 -0
- package/dist/src/controls/Login/LoginConstants.d.ts +17 -0
- package/dist/src/controls/Login/LoginFooter.d.ts +10 -0
- package/dist/src/controls/LookupPicker/LookupPicker.d.ts +39 -0
- package/dist/src/controls/LookupPicker/LookupPickerConstants.d.ts +3 -0
- package/dist/src/controls/LookupPicker/SelectedValueList.d.ts +14 -0
- package/dist/src/controls/LookupPicker/ValueList.d.ts +22 -0
- package/dist/src/controls/LookupPicker/ValueListItem.d.ts +11 -0
- package/dist/src/controls/MessageInput/MessageInput.d.ts +12 -0
- package/dist/src/controls/MessageInput/MessageInputConstants.d.ts +3 -0
- package/dist/src/controls/MicroFrontend/MicroFrontend.d.ts +8 -0
- package/dist/src/controls/MicroFrontend/MicroFrontendState.d.ts +8 -0
- package/dist/src/controls/MicroFrontend/renderMicrofrontend.d.ts +2 -0
- package/dist/src/controls/NumberInput/NumberInput.d.ts +30 -0
- package/dist/src/controls/NumberInput/NumberInputConstants.d.ts +12 -0
- package/dist/src/controls/PasswordInput/PasswordInput.d.ts +31 -0
- package/dist/src/controls/PasswordInput/PasswordInputConstants.d.ts +4 -0
- package/dist/src/controls/PdfViewer/PdfViewerContext.d.ts +7 -2
- package/dist/src/controls/RouteItem/RouteItem.d.ts +17 -0
- package/dist/src/controls/ScrollBar/ScrollBar.d.ts +9 -0
- package/dist/src/controls/Search/CheckboxList.d.ts +12 -0
- package/dist/src/controls/Search/Filter.d.ts +21 -0
- package/dist/src/controls/Search/Input.d.ts +21 -0
- package/dist/src/controls/Search/Search.d.ts +29 -0
- package/dist/src/controls/Search/SearchConstants.d.ts +4 -0
- package/dist/src/controls/Sidebar/Item.d.ts +9 -0
- package/dist/src/controls/Sidebar/LinkItem.d.ts +17 -0
- package/dist/src/controls/Sidebar/Section.d.ts +11 -0
- package/dist/src/controls/Sidebar/SectionList.d.ts +10 -0
- package/dist/src/controls/Sidebar/Sidebar.d.ts +14 -0
- package/dist/src/controls/Sidebar/SidebarConstants.d.ts +4 -0
- package/dist/src/controls/Splitter/Splitter.d.ts +18 -0
- package/dist/src/controls/Splitter/SplitterConstants.d.ts +9 -0
- package/dist/src/controls/TabGroup/OverflowButton.d.ts +7 -0
- package/dist/src/controls/TabGroup/Tab.d.ts +10 -0
- package/dist/src/controls/TabGroup/TabGroup.d.ts +10 -0
- package/dist/src/controls/TabGroup/TabGroupComponent.d.ts +9 -0
- package/dist/src/controls/TabGroup/TabGroupConstants.d.ts +4 -0
- package/dist/src/controls/TabGroup/TabGroupHeader.d.ts +9 -0
- package/dist/src/controls/TableView/TableView.d.ts +26 -0
- package/dist/src/controls/TableView/TableViewConstants.d.ts +153 -0
- package/dist/src/controls/TableView/TableViewContext.d.ts +1 -0
- package/dist/src/controls/TableView/TreeGrid.d.ts +17 -0
- package/dist/src/controls/TableView/TreeGridTableViewContextImpl.d.ts +92 -0
- package/dist/src/controls/TaskTile/TaskTile.d.ts +18 -0
- package/dist/src/controls/TelerikUploader/TelerikUploader.d.ts +11 -0
- package/dist/src/controls/TelerikUploader/TelerikUploaderConstants.d.ts +16 -0
- package/dist/src/controls/TelerikUploader/TelerikUploaderContextImpl.d.ts +39 -0
- package/dist/src/controls/TimePicker/TimePicker.d.ts +23 -0
- package/dist/src/controls/TimePicker/TimePickerConstants.d.ts +12 -0
- package/dist/src/controls/Tooltip/Tooltip.d.ts +10 -0
- package/dist/src/controls/Tooltip/TooltipConstants.d.ts +6 -0
- package/dist/src/controls/TopLevelMenu/LinkItem.d.ts +9 -0
- package/dist/src/controls/TopLevelMenu/TopLevelMenu.d.ts +9 -0
- package/dist/src/controls/TreeView/JsTreeViewContextImpl.d.ts +35 -0
- package/dist/src/controls/TreeView/TreeView.d.ts +13 -0
- package/dist/src/controls/TreeView/TreeViewConfig.d.ts +34 -0
- package/dist/src/controls/TreeView/TreeViewConstants.d.ts +52 -0
- package/dist/src/controls/UserLookupPicker/UserLookupPicker.d.ts +40 -0
- package/dist/src/controls/UserProfile/UserProfile.d.ts +12 -0
- package/dist/src/controls/UserProfile/UserProfileMenuItem.d.ts +11 -0
- package/dist/src/controls/View/View.d.ts +7 -0
- package/dist/src/controls/ViewPart/ViewPart.d.ts +10 -0
- package/dist/src/exceptions/impl/AbortExceptionImpl.d.ts +3 -0
- package/dist/src/index.d.ts +133 -0
- package/lib/jquery-dialogextend/jquery.dialogextend.min.js +2 -0
- package/lib/jquery-growl/jquery.growl.js +315 -0
- package/lib/jszip/jszip-utils.min.js +1 -0
- package/lib/jszip/jszip.min.js +13 -0
- package/lib/third-party.js +1379 -15
- package/lib/uikit/uikit-icons.min.js +1 -0
- package/lib/uikit/uikit.min.js +1 -0
- package/lib/webL10n/l10n.js +1028 -0
- package/lib/xeokit/VitroFastNavPlugin.js +920 -0
- package/lib/xeokit/VitroTreeViewPlugin.js +650 -0
- package/lib/xeokit/xeokit-sdk.es.js +188506 -0
- package/package.json +6 -4
- package/src/controls/BimViewer/js/bim-viewer.js +2697 -0
- package/src/controls/BimViewer/js/init-viewer-page.js +24 -0
- package/src/controls/PdfViewer/js/init-viewer-page.js +1 -2
- package/src/controls/PdfViewer/js/pdf-viewer.js +60 -56
- package/css/std/controls/pdf-viewer/img/annotation-check.svg +0 -11
- package/css/std/controls/pdf-viewer/img/annotation-comment.svg +0 -16
- package/css/std/controls/pdf-viewer/img/annotation-help.svg +0 -26
- package/css/std/controls/pdf-viewer/img/annotation-insert.svg +0 -10
- package/css/std/controls/pdf-viewer/img/annotation-key.svg +0 -11
- package/css/std/controls/pdf-viewer/img/annotation-newparagraph.svg +0 -11
- package/css/std/controls/pdf-viewer/img/annotation-noicon.svg +0 -7
- package/css/std/controls/pdf-viewer/img/annotation-note.svg +0 -42
- package/css/std/controls/pdf-viewer/img/annotation-paperclip.svg +0 -6
- package/css/std/controls/pdf-viewer/img/annotation-paragraph.svg +0 -16
- package/css/std/controls/pdf-viewer/img/annotation-pushpin.svg +0 -7
- package/css/std/controls/pdf-viewer/img/close-compare-viewer.png +0 -0
- package/css/std/controls/pdf-viewer/img/close-compare-viewer_active.png +0 -0
- package/css/std/controls/pdf-viewer/img/compare-overlay.png +0 -0
- package/css/std/controls/pdf-viewer/img/compare-side-by-side.png +0 -0
- package/css/std/controls/pdf-viewer/img/cursor-editorFreeText.svg +0 -3
- package/css/std/controls/pdf-viewer/img/cursor-editorInk.svg +0 -4
- package/css/std/controls/pdf-viewer/img/delete-active.png +0 -0
- package/css/std/controls/pdf-viewer/img/delete.png +0 -0
- package/css/std/controls/pdf-viewer/img/dlg-compare-ico.png +0 -0
- package/css/std/controls/pdf-viewer/img/do-compare.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-arrow.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-cloud.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-ellipse.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-line.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-polygon.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-rect.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-toolbar-arrow.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-toolbar-cloud.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-toolbar-ellipse.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-toolbar-line.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-toolbar-polygon.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-toolbar-rect.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation-toolbar.png +0 -0
- package/css/std/controls/pdf-viewer/img/draw-annotation.png +0 -0
- package/css/std/controls/pdf-viewer/img/dropdown-arrow.png +0 -0
- package/css/std/controls/pdf-viewer/img/findbarButton-next.svg +0 -3
- package/css/std/controls/pdf-viewer/img/findbarButton-previous.svg +0 -3
- package/css/std/controls/pdf-viewer/img/finish-align.png +0 -0
- package/css/std/controls/pdf-viewer/img/finish-align_active.png +0 -0
- package/css/std/controls/pdf-viewer/img/fit-to-view.png +0 -0
- package/css/std/controls/pdf-viewer/img/fit-to-view_active.png +0 -0
- package/css/std/controls/pdf-viewer/img/gv-toolbarButton-download.svg +0 -3
- package/css/std/controls/pdf-viewer/img/gv-toolbarButton-openinapp.svg +0 -11
- package/css/std/controls/pdf-viewer/img/hide-annotation.png +0 -0
- package/css/std/controls/pdf-viewer/img/hide-colors.png +0 -0
- package/css/std/controls/pdf-viewer/img/hide-colors_active.png +0 -0
- package/css/std/controls/pdf-viewer/img/layer-unvisible.png +0 -0
- package/css/std/controls/pdf-viewer/img/layer-visible.png +0 -0
- package/css/std/controls/pdf-viewer/img/loading-dark.svg +0 -24
- package/css/std/controls/pdf-viewer/img/loading-icon.gif +0 -0
- package/css/std/controls/pdf-viewer/img/loading.svg +0 -1
- package/css/std/controls/pdf-viewer/img/overlay.png +0 -0
- package/css/std/controls/pdf-viewer/img/overlay_active.png +0 -0
- package/css/std/controls/pdf-viewer/img/pan.png +0 -0
- package/css/std/controls/pdf-viewer/img/pan_active.png +0 -0
- package/css/std/controls/pdf-viewer/img/panel-visibility.png +0 -0
- package/css/std/controls/pdf-viewer/img/panel-visibility_active.png +0 -0
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-documentProperties.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-firstPage.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-handTool.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-lastPage.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-rotateCcw.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-rotateCw.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-scrollHorizontal.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-scrollPage.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-scrollVertical.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-scrollWrapped.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-selectTool.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-spreadEven.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-spreadNone.svg +0 -3
- package/css/std/controls/pdf-viewer/img/secondaryToolbarButton-spreadOdd.svg +0 -3
- package/css/std/controls/pdf-viewer/img/shadow.png +0 -0
- package/css/std/controls/pdf-viewer/img/show-annotation.png +0 -0
- package/css/std/controls/pdf-viewer/img/side-by-side.png +0 -0
- package/css/std/controls/pdf-viewer/img/side-by-side_active.png +0 -0
- package/css/std/controls/pdf-viewer/img/sidebar-notes-toggle.png +0 -0
- package/css/std/controls/pdf-viewer/img/spinner.gif +0 -0
- package/css/std/controls/pdf-viewer/img/toolbarButton-bookmark.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-currentOutlineItem.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-download.svg +0 -4
- package/css/std/controls/pdf-viewer/img/toolbarButton-editorFreeText.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-editorInk.svg +0 -4
- package/css/std/controls/pdf-viewer/img/toolbarButton-editorStamp.svg +0 -8
- package/css/std/controls/pdf-viewer/img/toolbarButton-menuArrow.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-openFile.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-pageDown.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-pageUp.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-presentationMode.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-print.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-search.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-secondaryToolbarToggle.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-sidebarToggle.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-viewAttachments.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-viewLayers.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-viewOutline.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-viewThumbnail.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-zoomIn.svg +0 -3
- package/css/std/controls/pdf-viewer/img/toolbarButton-zoomOut.svg +0 -3
- package/css/std/controls/pdf-viewer/img/treeitem-collapsed.svg +0 -1
- package/css/std/controls/pdf-viewer/img/treeitem-expanded.svg +0 -1
- package/css/std/controls/pdf-viewer/img/zoom.png +0 -0
- package/css/std/controls/pdf-viewer/img/zoom_active.png +0 -0
|
@@ -0,0 +1,2697 @@
|
|
|
1
|
+
import { BIMModel, BIMCommon, BIMAnnotation } from '/resource/bimViewer/js/bim-viewer-models.js';
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
Viewer, XKTLoaderPlugin, NavCubePlugin, SectionPlanesPlugin, math, BCFViewpointsPlugin, AnnotationsPlugin,
|
|
5
|
+
ContextMenu, TreeViewPlugin, StoreyViewsPlugin, AngleMeasurementsPlugin, CameraMemento, DistanceMeasurementsPlugin,
|
|
6
|
+
GLTFLoaderPlugin, utils
|
|
7
|
+
}
|
|
8
|
+
from '/resource/bimViewer/js/xeokit/xeokit-sdk.es.js';
|
|
9
|
+
import { VitroTreeViewPlugin } from "/resource/bimViewer/js/xeokit/VitroTreeViewPlugin.js";
|
|
10
|
+
import { VitroFastNavPlugin } from "/resource/bimViewer/js/xeokit/VitroFastNavPlugin.js";window.initBimViewer = function(context) {var angleMeasurementsData = [
|
|
11
|
+
|
|
12
|
+
];
|
|
13
|
+
var bcfData = {};
|
|
14
|
+
var distanceMeasurementsData = [
|
|
15
|
+
|
|
16
|
+
];
|
|
17
|
+
|
|
18
|
+
var notes = [];
|
|
19
|
+
var srcModel = undefined;
|
|
20
|
+
var srcMetaModelData = undefined;
|
|
21
|
+
var fileVersion = undefined;
|
|
22
|
+
var fileVersionPath = undefined;
|
|
23
|
+
|
|
24
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
25
|
+
// Import the modules we need for this example
|
|
26
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
27
|
+
// TODO - PATH!!!
|
|
28
|
+
const modelPathDefault = '';
|
|
29
|
+
const modelPathConverted = '../BIM/assets/models/converted/';
|
|
30
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
31
|
+
// Create a Viewer
|
|
32
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
33
|
+
const viewer = new Viewer({
|
|
34
|
+
canvasId: "xeokitCanvas",
|
|
35
|
+
transparent: true
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
39
|
+
// Arrange the camera
|
|
40
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
41
|
+
|
|
42
|
+
const camera = viewer.camera;
|
|
43
|
+
// TODO
|
|
44
|
+
viewer.camera.eye = [-5.02, 2.22, 15.09];
|
|
45
|
+
viewer.camera.look = [4.97, 2.79, 9.89];
|
|
46
|
+
viewer.camera.up = [-0.05, 0.99, 0.02];
|
|
47
|
+
viewer.camera.project.fov = 70;
|
|
48
|
+
|
|
49
|
+
viewer.camera.zoom(5);
|
|
50
|
+
|
|
51
|
+
viewer.cameraControl.followPointer = true;
|
|
52
|
+
|
|
53
|
+
// For TreeView
|
|
54
|
+
viewer.scene.xrayMaterial.fill = true;
|
|
55
|
+
viewer.scene.xrayMaterial.fillAlpha = 0.1;
|
|
56
|
+
viewer.scene.xrayMaterial.fillColor = [0, 0, 0];
|
|
57
|
+
viewer.scene.xrayMaterial.edgeAlpha = 0.3;
|
|
58
|
+
viewer.scene.xrayMaterial.edgeColor = [0, 0, 0];
|
|
59
|
+
|
|
60
|
+
viewer.scene.highlightMaterial.fill = true;
|
|
61
|
+
viewer.scene.highlightMaterial.edges = true;
|
|
62
|
+
viewer.scene.highlightMaterial.fillAlpha = 0.1;
|
|
63
|
+
viewer.scene.highlightMaterial.edgeAlpha = 0.1;
|
|
64
|
+
viewer.scene.highlightMaterial.edgeColor = [1, 1, 0];
|
|
65
|
+
|
|
66
|
+
viewer.scene.selectedMaterial.fill = true;
|
|
67
|
+
viewer.scene.selectedMaterial.edges = true;
|
|
68
|
+
viewer.scene.selectedMaterial.fillAlpha = 0.5;
|
|
69
|
+
viewer.scene.selectedMaterial.edgeAlpha = 0.6;
|
|
70
|
+
viewer.scene.selectedMaterial.edgeColor = [0, 1, 1];
|
|
71
|
+
|
|
72
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
73
|
+
// Create a tree view
|
|
74
|
+
//----------------------------------------------------------------------------------------------------------------------
|
|
75
|
+
|
|
76
|
+
var treeView = new VitroTreeViewPlugin(viewer, {
|
|
77
|
+
containerElement: document.getElementById("treeViewContainer"),
|
|
78
|
+
autoExpandDepth: 1,
|
|
79
|
+
hierarchy: "containment",
|
|
80
|
+
autoAddModels: false,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
84
|
+
// Create two ContextMenus - one for right-click on empty space, the other for right-click on an Entity
|
|
85
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
86
|
+
|
|
87
|
+
const canvasContextMenu = new ContextMenu({
|
|
88
|
+
enabled: true,
|
|
89
|
+
context: {
|
|
90
|
+
viewer: viewer
|
|
91
|
+
},
|
|
92
|
+
items: [
|
|
93
|
+
[
|
|
94
|
+
{
|
|
95
|
+
getTitle: function (context) { return document.webL10n.get('hide_all') },
|
|
96
|
+
getEnabled: function (context) {
|
|
97
|
+
return (context.viewer.scene.numVisibleObjects > 0);
|
|
98
|
+
},
|
|
99
|
+
doAction: function (context) {
|
|
100
|
+
context.viewer.scene.setObjectsVisible(context.viewer.scene.visibleObjectIds, false);
|
|
101
|
+
}
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
getTitle: function (context) { return document.webL10n.get('show_all') },
|
|
105
|
+
getEnabled: function (context) {
|
|
106
|
+
const scene = context.viewer.scene;
|
|
107
|
+
return (scene.numVisibleObjects < scene.numObjects);
|
|
108
|
+
},
|
|
109
|
+
doAction: function (context) {
|
|
110
|
+
const scene = context.viewer.scene;
|
|
111
|
+
scene.setObjectsVisible(scene.objectIds, true);
|
|
112
|
+
scene.setObjectsXRayed(scene.xrayedObjectIds, false);
|
|
113
|
+
scene.setObjectsSelected(scene.selectedObjectIds, false);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
[
|
|
118
|
+
{
|
|
119
|
+
getTitle: function (context) { return document.webL10n.get('view_fit_all') },
|
|
120
|
+
doAction: function (context) {
|
|
121
|
+
context.viewer.cameraFlight.flyTo({
|
|
122
|
+
aabb: context.viewer.scene.getAABB()
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
]
|
|
127
|
+
]
|
|
128
|
+
});
|
|
129
|
+
|
|
130
|
+
const objectContextMenu = new ContextMenu({
|
|
131
|
+
items: [
|
|
132
|
+
[
|
|
133
|
+
{
|
|
134
|
+
getTitle: function (context) { return document.webL10n.get('inspect_properties') },
|
|
135
|
+
doAction: function (context) {
|
|
136
|
+
if(context.entity && context.entity.id) {
|
|
137
|
+
showPropertyInspector(context);
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
[
|
|
143
|
+
{
|
|
144
|
+
getTitle: function (context) { return document.webL10n.get('view_fit') },
|
|
145
|
+
doAction: function (context) {
|
|
146
|
+
const viewer = context.viewer;
|
|
147
|
+
const scene = viewer.scene;
|
|
148
|
+
const entity = context.entity;
|
|
149
|
+
viewer.cameraFlight.flyTo({
|
|
150
|
+
aabb: entity.aabb,
|
|
151
|
+
duration: 0.5
|
|
152
|
+
}, () => {
|
|
153
|
+
setTimeout(function () {
|
|
154
|
+
scene.setObjectsHighlighted(scene.highlightedObjectIds, false);
|
|
155
|
+
}, 500);
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
getTitle: function (context) { return document.webL10n.get('view_fit_all') },
|
|
161
|
+
doAction: function (context) {
|
|
162
|
+
ViewFitAll(context.viewer);
|
|
163
|
+
}
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
getTitle: function (context) { return document.webL10n.get('show_in_tree') },
|
|
167
|
+
doAction: function (context) {
|
|
168
|
+
const objectId = context.entity.id;
|
|
169
|
+
|
|
170
|
+
context.treeViewPlugin.showInTree(objectId);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
],
|
|
174
|
+
[
|
|
175
|
+
{
|
|
176
|
+
getTitle: function (context) { return document.webL10n.get('hide') },
|
|
177
|
+
getEnabled: function (context) {
|
|
178
|
+
return context.entity.visible;
|
|
179
|
+
},
|
|
180
|
+
doAction: function (context) {
|
|
181
|
+
context.entity.visible = false;
|
|
182
|
+
}
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
getTitle: function (context) { return document.webL10n.get('hide_others') },
|
|
186
|
+
doAction: function (context) {
|
|
187
|
+
const viewer = context.viewer;
|
|
188
|
+
const scene = viewer.scene;
|
|
189
|
+
const entity = context.entity;
|
|
190
|
+
const metaObject = viewer.metaScene.metaObjects[entity.id];
|
|
191
|
+
if (!metaObject) {
|
|
192
|
+
return;
|
|
193
|
+
}
|
|
194
|
+
scene.setObjectsVisible(scene.visibleObjectIds, false);
|
|
195
|
+
scene.setObjectsXRayed(scene.xrayedObjectIds, false);
|
|
196
|
+
scene.setObjectsSelected(scene.selectedObjectIds, false);
|
|
197
|
+
scene.setObjectsHighlighted(scene.highlightedObjectIds, false);
|
|
198
|
+
metaObject.withMetaObjectsInSubtree((metaObject) => {
|
|
199
|
+
const entity = scene.objects[metaObject.id];
|
|
200
|
+
if (entity) {
|
|
201
|
+
entity.visible = true;
|
|
202
|
+
}
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
},
|
|
206
|
+
{
|
|
207
|
+
getTitle: function (context) { return document.webL10n.get('hide_all') },
|
|
208
|
+
getEnabled: function (context) {
|
|
209
|
+
return (context.viewer.scene.numVisibleObjects > 0);
|
|
210
|
+
},
|
|
211
|
+
doAction: function (context) {
|
|
212
|
+
context.viewer.scene.setObjectsVisible(context.viewer.scene.visibleObjectIds, false);
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
getTitle: function (context) { return document.webL10n.get('show_all') },
|
|
217
|
+
getEnabled: function (context) {
|
|
218
|
+
const scene = context.viewer.scene;
|
|
219
|
+
return (scene.numVisibleObjects < scene.numObjects);
|
|
220
|
+
},
|
|
221
|
+
doAction: function (context) {
|
|
222
|
+
const scene = context.viewer.scene;
|
|
223
|
+
scene.setObjectsVisible(scene.objectIds, true);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
],
|
|
227
|
+
[
|
|
228
|
+
{
|
|
229
|
+
getTitle: function (context) { return document.webL10n.get('x_ray') },
|
|
230
|
+
getEnabled: function (context) {
|
|
231
|
+
return (!context.entity.xrayed);
|
|
232
|
+
},
|
|
233
|
+
doAction: function (context) {
|
|
234
|
+
context.entity.xrayed = true;
|
|
235
|
+
}
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
getTitle: function (context) { return document.webL10n.get('x_ray_undo') },
|
|
239
|
+
getEnabled: function (context) {
|
|
240
|
+
return context.entity.xrayed;
|
|
241
|
+
},
|
|
242
|
+
doAction: function (context) {
|
|
243
|
+
context.entity.xrayed = false;
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
getTitle: function (context) { return document.webL10n.get('x_ray_others') },
|
|
248
|
+
doAction: function (context) {
|
|
249
|
+
const viewer = context.viewer;
|
|
250
|
+
const scene = viewer.scene;
|
|
251
|
+
const entity = context.entity;
|
|
252
|
+
const metaObject = viewer.metaScene.metaObjects[entity.id];
|
|
253
|
+
if (!metaObject) {
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
scene.setObjectsVisible(scene.objectIds, true);
|
|
257
|
+
scene.setObjectsXRayed(scene.objectIds, true);
|
|
258
|
+
scene.setObjectsSelected(scene.selectedObjectIds, false);
|
|
259
|
+
scene.setObjectsHighlighted(scene.highlightedObjectIds, false);
|
|
260
|
+
metaObject.withMetaObjectsInSubtree((metaObject) => {
|
|
261
|
+
const entity = scene.objects[metaObject.id];
|
|
262
|
+
if (entity) {
|
|
263
|
+
entity.xrayed = false;
|
|
264
|
+
}
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
},
|
|
268
|
+
{
|
|
269
|
+
getTitle: function (context) { return document.webL10n.get('x_ray_reset') },
|
|
270
|
+
getEnabled: function (context) {
|
|
271
|
+
return (context.viewer.scene.numXRayedObjects > 0);
|
|
272
|
+
},
|
|
273
|
+
doAction: function (context) {
|
|
274
|
+
context.viewer.scene.setObjectsXRayed(context.viewer.scene.xrayedObjectIds, false);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
],
|
|
278
|
+
[
|
|
279
|
+
{
|
|
280
|
+
getTitle: function (context) { return document.webL10n.get('select') },
|
|
281
|
+
getEnabled: function (context) {
|
|
282
|
+
return (!context.entity.selected);
|
|
283
|
+
},
|
|
284
|
+
doAction: function (context) {
|
|
285
|
+
context.entity.selected = true;
|
|
286
|
+
}
|
|
287
|
+
},
|
|
288
|
+
{
|
|
289
|
+
getTitle: function (context) { return document.webL10n.get('deselect') },
|
|
290
|
+
getEnabled: function (context) {
|
|
291
|
+
return context.entity.selected;
|
|
292
|
+
},
|
|
293
|
+
doAction: function (context) {
|
|
294
|
+
context.entity.selected = false;
|
|
295
|
+
}
|
|
296
|
+
},
|
|
297
|
+
{
|
|
298
|
+
getTitle: function (context) { return document.webL10n.get('clear_selection') },
|
|
299
|
+
getEnabled: function (context) {
|
|
300
|
+
return (context.viewer.scene.numSelectedObjects > 0);
|
|
301
|
+
},
|
|
302
|
+
doAction: function (context) {
|
|
303
|
+
context.viewer.scene.setObjectsSelected(context.viewer.scene.selectedObjectIds, false);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
]
|
|
307
|
+
],
|
|
308
|
+
enabled: true
|
|
309
|
+
});
|
|
310
|
+
|
|
311
|
+
viewer.cameraControl.on("rightClick", function (e) {
|
|
312
|
+
|
|
313
|
+
var hit = viewer.scene.pick({
|
|
314
|
+
canvasPos: e.canvasPos
|
|
315
|
+
});
|
|
316
|
+
|
|
317
|
+
if (hit && hit.entity.isObject) {
|
|
318
|
+
|
|
319
|
+
objectContextMenu.context = { // Must set context before showing menu
|
|
320
|
+
viewer: viewer,
|
|
321
|
+
treeViewPlugin: treeView,
|
|
322
|
+
entity: hit.entity
|
|
323
|
+
};
|
|
324
|
+
|
|
325
|
+
objectContextMenu.show(e.event.pageX, e.event.pageY);
|
|
326
|
+
|
|
327
|
+
} else {
|
|
328
|
+
|
|
329
|
+
canvasContextMenu.context = { // Must set context before showing menu
|
|
330
|
+
viewer: viewer
|
|
331
|
+
};
|
|
332
|
+
|
|
333
|
+
canvasContextMenu.show(e.event.pageX, e.event.pageY);
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
e.event.preventDefault();
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
|
|
340
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
341
|
+
// NavCube
|
|
342
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
343
|
+
|
|
344
|
+
const navCube = new NavCubePlugin(viewer, {
|
|
345
|
+
canvasId: "navCubeCanvas",
|
|
346
|
+
visible: true, // Initially visible (default)
|
|
347
|
+
cameraFly: true, // Fly camera to each selected axis/diagonal
|
|
348
|
+
cameraFitFOV: 45, // How much field-of-view the scene takes once camera has fitted it to view
|
|
349
|
+
cameraFlyDuration: 0.5 // How long (in seconds) camera takes to fly to each new axis/diagonal
|
|
350
|
+
});
|
|
351
|
+
|
|
352
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
353
|
+
// Add a SectionPlanesPlugin - we'll use this to create cross-section planes
|
|
354
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
355
|
+
|
|
356
|
+
const sectionPlanes = new SectionPlanesPlugin(viewer, {
|
|
357
|
+
overviewCanvasId: "sectionPlanesOverviewCanvas",
|
|
358
|
+
overviewVisible: true
|
|
359
|
+
});
|
|
360
|
+
|
|
361
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
362
|
+
// Add a GLTFModelsPlugin - we'll use this to load the model geometry and IFC metadata
|
|
363
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
364
|
+
|
|
365
|
+
const xktLoader = new XKTLoaderPlugin(viewer);
|
|
366
|
+
const gltfLoader = new GLTFLoaderPlugin(viewer);
|
|
367
|
+
|
|
368
|
+
|
|
369
|
+
xktLoader.globalizeObjectIds = false; // For multiple models in TreeView
|
|
370
|
+
|
|
371
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
372
|
+
// Add a BCFViewpointsPlugin - we'll use this to load the BCF viewpoint
|
|
373
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
374
|
+
|
|
375
|
+
const bcfViewpoints = new BCFViewpointsPlugin(viewer);
|
|
376
|
+
|
|
377
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
378
|
+
// Load the XKT model and IFC metadata
|
|
379
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
380
|
+
|
|
381
|
+
function getRequestParams() {
|
|
382
|
+
var vars = {};
|
|
383
|
+
window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, (m, key, value) => {
|
|
384
|
+
vars[key] = value;
|
|
385
|
+
});
|
|
386
|
+
return vars;
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
function showXeokitSpinner() {
|
|
390
|
+
$('.sk-fading-circle').parent().css('visibility', 'visible');
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
function hideXeokitSpinner() {
|
|
394
|
+
$('.sk-fading-circle').parent().css('visibility', 'hidden');
|
|
395
|
+
}
|
|
396
|
+
|
|
397
|
+
var isModelAddedToTreeView = false;
|
|
398
|
+
|
|
399
|
+
function openSidebarTreeView() {
|
|
400
|
+
if (!isModelAddedToTreeView) {
|
|
401
|
+
addModelToTreeView();
|
|
402
|
+
}
|
|
403
|
+
else {
|
|
404
|
+
$('body').addClass('treeview-expanded');
|
|
405
|
+
$('#treeViewContainerWrap').show();
|
|
406
|
+
$('#storeyViewsSidebar').hide();
|
|
407
|
+
$('#btnToggleSidebarStoreyViews').removeClass('toggled');
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// $(window).trigger('resize');
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
function addModelToTreeView() {
|
|
414
|
+
|
|
415
|
+
viewer.scene.canvas.spinner.processes++;
|
|
416
|
+
|
|
417
|
+
const callback = (metaObjects, status, jqXHR) =>
|
|
418
|
+
{
|
|
419
|
+
const metaModel = viewer.metaScene.metaModels[window.model.id];
|
|
420
|
+
|
|
421
|
+
treeView.addObjectsToMetaModel(metaObjects, metaModel);
|
|
422
|
+
treeView.addModel(window.model.id);
|
|
423
|
+
|
|
424
|
+
$('body').addClass('treeview-expanded');
|
|
425
|
+
$('#treeViewContainerWrap').show();
|
|
426
|
+
$('#storeyViewsSidebar').hide();
|
|
427
|
+
$('#btnToggleSidebarStoreyViews').removeClass('toggled');
|
|
428
|
+
|
|
429
|
+
isModelAddedToTreeView = true;
|
|
430
|
+
|
|
431
|
+
viewer.scene.canvas.spinner.processes--;
|
|
432
|
+
|
|
433
|
+
};
|
|
434
|
+
|
|
435
|
+
const error = () => {
|
|
436
|
+
viewer.scene.canvas.spinner.processes--;
|
|
437
|
+
};
|
|
438
|
+
|
|
439
|
+
BIMModel.GetChildList(-1, false, null, callback, error);
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
443
|
+
// Create an AnnotationsPlugin, with which we'll create annotations
|
|
444
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
445
|
+
|
|
446
|
+
const annotations = new AnnotationsPlugin(viewer, {
|
|
447
|
+
|
|
448
|
+
markerHTML: "<div class='annotation-marker' style='background-color: {{markerBGColor}};'>{{glyph}}</div>",
|
|
449
|
+
labelHTML: "<div class='annotation-label' style='background-color: {{labelBGColor}};'>\
|
|
450
|
+
<div class='annotation-title'>{{title}}</div>\
|
|
451
|
+
<div class='annotation-desc'>{{description}}</div>\
|
|
452
|
+
</div>",
|
|
453
|
+
|
|
454
|
+
values: {
|
|
455
|
+
markerBGColor: "red",
|
|
456
|
+
labelBGColor: "white",
|
|
457
|
+
glyph: "X",
|
|
458
|
+
title: "Untitled",
|
|
459
|
+
description: "No description"
|
|
460
|
+
}
|
|
461
|
+
});
|
|
462
|
+
|
|
463
|
+
var prevAnnotationClicked = null;
|
|
464
|
+
|
|
465
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
466
|
+
// Annotation onClick
|
|
467
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
468
|
+
annotations.on("markerClicked", (annotation) => {
|
|
469
|
+
//console.log('annotation', annotation.id);
|
|
470
|
+
showNoteDesc(annotation.id);
|
|
471
|
+
|
|
472
|
+
if (prevAnnotationClicked) {
|
|
473
|
+
prevAnnotationClicked.setLabelShown(false);
|
|
474
|
+
}
|
|
475
|
+
annotation.setLabelShown(true);
|
|
476
|
+
viewer.cameraFlight.flyTo(annotation);
|
|
477
|
+
prevAnnotationClicked = annotation;
|
|
478
|
+
});
|
|
479
|
+
|
|
480
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
481
|
+
// Load Model
|
|
482
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
483
|
+
function doLoadModel() {
|
|
484
|
+
var disableCacheStr = getDisableCacheStr();
|
|
485
|
+
var modelUrl = srcModel;// + disableCacheStr; //VitroDelete
|
|
486
|
+
var metaModelDataUrl = srcMetaModelData + disableCacheStr;
|
|
487
|
+
|
|
488
|
+
|
|
489
|
+
window.model = xktLoader.load({
|
|
490
|
+
id: Date.now(),
|
|
491
|
+
src: modelUrl,
|
|
492
|
+
edges: true,
|
|
493
|
+
backfaces: true,
|
|
494
|
+
});
|
|
495
|
+
|
|
496
|
+
window.model.on('loaded', () => {
|
|
497
|
+
modelOnLoaded();
|
|
498
|
+
});
|
|
499
|
+
|
|
500
|
+
|
|
501
|
+
|
|
502
|
+
const vitroFastNavPlugin = new VitroFastNavPlugin(viewer, {
|
|
503
|
+
hideEdges: true, // Don't show edges while we interact (default is true)
|
|
504
|
+
hideSAO: true, // Don't show ambient shadows while we interact (default is true)
|
|
505
|
+
hideColorTexture: true, // No color textures while we interact (default is true)
|
|
506
|
+
hidePBR: true, // No physically-based rendering while we interact (default is true)
|
|
507
|
+
hideTransparentObjects: true, // Hide transparent objects while we interact (default is false)
|
|
508
|
+
scaleCanvasResolution: true, // Scale canvas resolution while we interact (default is false)
|
|
509
|
+
scaleCanvasResolutionFactor: 0.5, // Factor by which we scale canvas resolution when we interact (default is 0.6)
|
|
510
|
+
delayBeforeRestore: true, // When we stop interacting, delay before restoring normal render (default is true)
|
|
511
|
+
delayBeforeRestoreSeconds: 1, // The delay duration, in seconds (default is 0.5)
|
|
512
|
+
hideTempObj: false,
|
|
513
|
+
maxTreeDepth: 20,
|
|
514
|
+
});
|
|
515
|
+
|
|
516
|
+
$('#btnToggleSectionPlan').addClass('toggled');
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
function getDisableCacheStr() {
|
|
520
|
+
var dt = new Date();
|
|
521
|
+
return "?rev=" + dt.getTime();
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
function modelOnLoaded() {
|
|
525
|
+
|
|
526
|
+
window.model.fileVersion = fileVersion;
|
|
527
|
+
window.model.filename = srcModel.substring(srcModel.lastIndexOf('/') + 1).replace('.xkt', '');
|
|
528
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
529
|
+
// Create some Annotations
|
|
530
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
531
|
+
loadAnnotations();
|
|
532
|
+
|
|
533
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
534
|
+
// Custom Colorize Entity
|
|
535
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
536
|
+
viewer.scene.setObjectsColorized(['2O2Fr$t4X7Zf8NOew3FLPP'], [1.0, 0.0, 0.8]); // entityId, color
|
|
537
|
+
|
|
538
|
+
//----------------------------------------------------------------------------------------------------------
|
|
539
|
+
// Angle Measurements
|
|
540
|
+
//----------------------------------------------------------------------------------------------------------
|
|
541
|
+
const angleMeasurements = createAngleMeasurements(angleMeasurementsData);
|
|
542
|
+
|
|
543
|
+
//----------------------------------------------------------------------------------------------------------
|
|
544
|
+
// Storey Views
|
|
545
|
+
//----------------------------------------------------------------------------------------------------------
|
|
546
|
+
// Внимание! Если до initStoreyViews будет вызван SectionPlane -> картинки планов этажей будут сгенерены в "обрезанном" виде
|
|
547
|
+
// на них будет только видимая часть оставленная секущими плоскостями SectionPlane
|
|
548
|
+
initStoreyViews();
|
|
549
|
+
|
|
550
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
551
|
+
// Load predefined SectionPlanes
|
|
552
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
553
|
+
createSectionPlane();
|
|
554
|
+
|
|
555
|
+
//----------------------------------------------------------------------------------------------------------
|
|
556
|
+
// Distance Measurements
|
|
557
|
+
//----------------------------------------------------------------------------------------------------------
|
|
558
|
+
const distanceMeasurements = createDistanceMeasurements(distanceMeasurementsData);
|
|
559
|
+
|
|
560
|
+
ViewFitAll(viewer);
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
564
|
+
// Create a couple of cross-section planes
|
|
565
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
566
|
+
function createSectionPlane() {}
|
|
567
|
+
|
|
568
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
569
|
+
// Clear SectionPlanes
|
|
570
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
571
|
+
function clearSectionPanes() {
|
|
572
|
+
sectionPlanes.clear();
|
|
573
|
+
}
|
|
574
|
+
|
|
575
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
576
|
+
// Load Annotations
|
|
577
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
578
|
+
function loadAnnotations() {
|
|
579
|
+
// TODO -> ajax reqest - get Notes
|
|
580
|
+
// for Test - notes -> get data from notes.data.php
|
|
581
|
+
|
|
582
|
+
BIMAnnotation.GetNote(function (data) {
|
|
583
|
+
|
|
584
|
+
if (data && data.length > 0) {
|
|
585
|
+
var noteList = JSON.parse(data);
|
|
586
|
+
$.each(noteList, function (key, note) {
|
|
587
|
+
notes.push(note);
|
|
588
|
+
});
|
|
589
|
+
$.each(notes, function (key, val) {
|
|
590
|
+
val.entity = viewer.scene.objects[val.entity];
|
|
591
|
+
annotations.createAnnotation(val);
|
|
592
|
+
});
|
|
593
|
+
}
|
|
594
|
+
});
|
|
595
|
+
}
|
|
596
|
+
|
|
597
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
598
|
+
// Only for test
|
|
599
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
600
|
+
var annotationCounter = notes.length + 1; // TODO
|
|
601
|
+
var sectionPlaneCounter = 1; // TODO
|
|
602
|
+
|
|
603
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
604
|
+
//
|
|
605
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
606
|
+
var annotationByClick = false;
|
|
607
|
+
var sectionPlanByClick = false;
|
|
608
|
+
var angleMeasurementsByClick = false;
|
|
609
|
+
var distanceMeasurementsByClick = false;
|
|
610
|
+
var lastVisibleSectionPlanId = false;
|
|
611
|
+
|
|
612
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
613
|
+
// Create annotation by click
|
|
614
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
615
|
+
function createAnnotationByClick(pickResult) {
|
|
616
|
+
if (annotationByClick && pickResult) {
|
|
617
|
+
addNote(pickResult);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
622
|
+
// Create SectionPlane by click
|
|
623
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
624
|
+
function createSectionPlaneByClick(pickResult) {
|
|
625
|
+
if (sectionPlanByClick && pickResult && pickResult.worldNormal) { // Disallow SectionPlanes on point clouds, because points don't have normals
|
|
626
|
+
|
|
627
|
+
const sectionPlane = sectionPlanes.createSectionPlane({
|
|
628
|
+
pos: pickResult.worldPos,
|
|
629
|
+
dir: math.mulVec3Scalar(pickResult.worldNormal, -1)
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
sectionPlanes.showControl(sectionPlane.id);
|
|
633
|
+
sectionPlaneCounter++;
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
640
|
+
// Add Note
|
|
641
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
642
|
+
var dialog, form;
|
|
643
|
+
|
|
644
|
+
function addNote(pickResult) {
|
|
645
|
+
initDlg(pickResult);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
function initDlg(pickResult) {
|
|
649
|
+
createDlgElm();
|
|
650
|
+
|
|
651
|
+
dialog = getDlgElm().dialog({
|
|
652
|
+
autoOpen: true,
|
|
653
|
+
height: 310,
|
|
654
|
+
width: 420,
|
|
655
|
+
modal: true,
|
|
656
|
+
resizable: true,
|
|
657
|
+
buttons: [{
|
|
658
|
+
text: "Save",
|
|
659
|
+
"id": "btnSaveConfirm",
|
|
660
|
+
click: function() {
|
|
661
|
+
saveNote(pickResult);
|
|
662
|
+
closeDlg();
|
|
663
|
+
},
|
|
664
|
+
}, {
|
|
665
|
+
text: "Cancel",
|
|
666
|
+
"id": "btnSaveCancel",
|
|
667
|
+
click: function() {
|
|
668
|
+
closeDlg();
|
|
669
|
+
}
|
|
670
|
+
}],
|
|
671
|
+
close: function() {
|
|
672
|
+
closeDlg();
|
|
673
|
+
},
|
|
674
|
+
open: function(event, ui ) {
|
|
675
|
+
disableXeokitClickEvent();
|
|
676
|
+
}
|
|
677
|
+
});
|
|
678
|
+
|
|
679
|
+
var saveLabel = document.webL10n.get('save');
|
|
680
|
+
var cancelLabel = document.webL10n.get('cancel');
|
|
681
|
+
$("#btnSaveConfirm").html('<span class="ui-button-text">'+ saveLabel +'</span>')
|
|
682
|
+
$("#btnSaveCancel").html('<span class="ui-button-text">'+ cancelLabel +'</span>')
|
|
683
|
+
}
|
|
684
|
+
|
|
685
|
+
function disableXeokitClickEvent() {
|
|
686
|
+
annotationByClick = false;
|
|
687
|
+
$('#dlgNoteTitle').focus();
|
|
688
|
+
}
|
|
689
|
+
|
|
690
|
+
function resetDlgForm() {
|
|
691
|
+
$('#dlgNoteTitle').val('');
|
|
692
|
+
$('#dlgNoteTxt').val('');
|
|
693
|
+
}
|
|
694
|
+
|
|
695
|
+
function getDlgElm() {
|
|
696
|
+
return $("#dialog-form");
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
function closeDlg() {
|
|
700
|
+
resetDlgForm();
|
|
701
|
+
$(this).dialog( "close" );
|
|
702
|
+
$(this).dialog( "destroy" );
|
|
703
|
+
getDlgElm().remove();
|
|
704
|
+
annotationByClick = true;
|
|
705
|
+
}
|
|
706
|
+
|
|
707
|
+
function createDlgElm() {
|
|
708
|
+
var addNoteLabel = document.webL10n.get('note_add');
|
|
709
|
+
var div = $('<div id="dialog-form" title="'+ addNoteLabel + '" style="display: none;"/>');
|
|
710
|
+
var title = $('<input id="dlgNoteTitle" />');
|
|
711
|
+
var txtArea = $('<textarea id="dlgNoteTxt"></textarea>');
|
|
712
|
+
|
|
713
|
+
div.append(title);
|
|
714
|
+
div.append(txtArea);
|
|
715
|
+
$('body').append(div);
|
|
716
|
+
|
|
717
|
+
return div;
|
|
718
|
+
}
|
|
719
|
+
|
|
720
|
+
function createDeleteDlgElm() {
|
|
721
|
+
var noteConfirmDeleteMessage = document.webL10n.get('note_delete_confirm');
|
|
722
|
+
var div = $('<div id="dialog-form" title="'+ noteConfirmDeleteMessage + '" style="display: none;"/>');
|
|
723
|
+
$('body').append(div);
|
|
724
|
+
}
|
|
725
|
+
|
|
726
|
+
function saveNote(pickResult) {
|
|
727
|
+
|
|
728
|
+
var noteTitle = $('#dlgNoteTitle').val();
|
|
729
|
+
var noteTxt = $('#dlgNoteTxt').val();
|
|
730
|
+
|
|
731
|
+
var noteOptions = getNoteOptions(pickResult, noteTxt, noteTitle);
|
|
732
|
+
BIMAnnotation.SaveNote(noteOptions, doAddNote);
|
|
733
|
+
}
|
|
734
|
+
|
|
735
|
+
function doAddNote(noteOptions) {
|
|
736
|
+
notes.push(noteOptions);
|
|
737
|
+
createNote(noteOptions);
|
|
738
|
+
|
|
739
|
+
if($('.sidebar').is(':visible')) {
|
|
740
|
+
initSidebarNotes();
|
|
741
|
+
highlightSidebarNote(noteOptions.id);
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
function createNote(noteOptions) {
|
|
746
|
+
const annotation = annotations.createAnnotation(noteOptions);
|
|
747
|
+
annotationCounter++;
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
function getNoteOptions(pickResult, noteTxt, noteTitle) {
|
|
751
|
+
|
|
752
|
+
var noteId = 0;
|
|
753
|
+
var creator = '';
|
|
754
|
+
var glyph = getNoteGlyph();
|
|
755
|
+
var imageSrc = false;
|
|
756
|
+
var bgColor = getNoteBgColor();
|
|
757
|
+
var options = doGetNoteOptions(noteId, creator, pickResult, glyph, noteTitle, noteTxt, imageSrc, bgColor);
|
|
758
|
+
|
|
759
|
+
return options;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
function getNoteBgColor() {
|
|
763
|
+
var bgColor = "2d9cdb";
|
|
764
|
+
return bgColor;
|
|
765
|
+
}
|
|
766
|
+
|
|
767
|
+
function getNoteGlyph() {
|
|
768
|
+
var glyph = "";
|
|
769
|
+
return glyph;
|
|
770
|
+
}
|
|
771
|
+
|
|
772
|
+
function getCurrentDate() {
|
|
773
|
+
var dateStr = new Date(Date.now());
|
|
774
|
+
var currentDate = dateStr.toLocaleDateString("ru-RU") + ' ' + dateStr.getHours() + ':' + dateStr.getMinutes();
|
|
775
|
+
return currentDate;
|
|
776
|
+
}
|
|
777
|
+
|
|
778
|
+
function doGetNoteOptions(noteId, creator, pickResult, glyph, title, description, imageSrc, bgColor) {
|
|
779
|
+
var options = {
|
|
780
|
+
id: noteId,
|
|
781
|
+
creator: creator,
|
|
782
|
+
pickResult: pickResult,
|
|
783
|
+
worldPos: pickResult.worldPos,
|
|
784
|
+
eye: viewer.camera.eye, // need for camera fly on sidebar click
|
|
785
|
+
look: viewer.camera.look, // need for camera fly on sidebar click
|
|
786
|
+
up: viewer.camera.up, // need for camera fly on sidebar click
|
|
787
|
+
occludable: true,
|
|
788
|
+
markerShown: true,
|
|
789
|
+
labelShown: false,
|
|
790
|
+
version: fileVersion,
|
|
791
|
+
fileVersionPath: fileVersionPath,
|
|
792
|
+
values: {
|
|
793
|
+
glyph: glyph,
|
|
794
|
+
title: title,
|
|
795
|
+
description: description,
|
|
796
|
+
markerBGColor: bgColor,
|
|
797
|
+
imageSrc: imageSrc
|
|
798
|
+
}
|
|
799
|
+
};
|
|
800
|
+
|
|
801
|
+
if(pickResult.entity && pickResult.entity.id) {
|
|
802
|
+
options.entity = pickResult.entity.id;
|
|
803
|
+
}
|
|
804
|
+
|
|
805
|
+
return options;
|
|
806
|
+
}
|
|
807
|
+
|
|
808
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
809
|
+
// Sidebar Notes
|
|
810
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
811
|
+
|
|
812
|
+
function initSidebarNotes() {
|
|
813
|
+
clearSidebarNotes();
|
|
814
|
+
createSidebarNotes();
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
function clearSidebarNotes() {
|
|
818
|
+
$('.sidebar-note-wrap').remove();
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
function createSidebarNotes() {
|
|
822
|
+
$.each(notes, function(index, note) {
|
|
823
|
+
var noteElm = createSidebarNotesItem(note);
|
|
824
|
+
$('.sidebar-content').append(noteElm);
|
|
825
|
+
});
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
function createSidebarNotesItem(noteData) {
|
|
829
|
+
var noteWrap = $('<div class="sidebar-note-wrap" id="noteWrap-'+noteData.id+'" />');
|
|
830
|
+
|
|
831
|
+
var noteHeader = createSidebarNotesItemHeader(noteData);
|
|
832
|
+
var noteBody = createSidebarNotesItemBody(noteData);
|
|
833
|
+
|
|
834
|
+
noteWrap.append(noteHeader);
|
|
835
|
+
noteWrap.append(noteBody);
|
|
836
|
+
|
|
837
|
+
return noteWrap;
|
|
838
|
+
}
|
|
839
|
+
|
|
840
|
+
function createSidebarNotesItemBody(noteData) {
|
|
841
|
+
var noteContent = noteData;
|
|
842
|
+
|
|
843
|
+
var noteBody = $('<div class="sidebar-note-body" />');
|
|
844
|
+
var noteTextarea = $('<textarea data-id="' + noteData.id + '"></textarea>');
|
|
845
|
+
bindTextareaHandlers(noteTextarea, noteData);
|
|
846
|
+
noteTextarea.val(noteContent.values.description);
|
|
847
|
+
|
|
848
|
+
var expandBtnWrap = $('<div class="sidebar-note-expand-wrap"/>');
|
|
849
|
+
var expandBtnWrapInner = $('<div class="sidebar-note-expand-btn collapsed"/>');
|
|
850
|
+
var statusText = noteContent.values.status;
|
|
851
|
+
if (!statusText) {
|
|
852
|
+
statusText = document.webL10n.get('note_status_default');
|
|
853
|
+
}
|
|
854
|
+
var status = $('<span class="sidebar-note-status-mark" style="background-color:' + noteContent.values.markerBGColor + '"></span><span class="sidebar-note-status-text">' + statusText + '</span>');
|
|
855
|
+
var expandLabel=document.webL10n.get('note_expand');
|
|
856
|
+
var collapseLabel=document.webL10n.get('note_collapse');
|
|
857
|
+
var expandBtnExpand = $('<a class="btn-expand">' + expandLabel + '</a>');
|
|
858
|
+
var expandBtnCollapse = $('<a class="btn-collapse">'+ collapseLabel + '</a>');
|
|
859
|
+
bindOnClickTextareaExpand(expandBtnExpand);
|
|
860
|
+
bindOnClickTextareaCollapse(expandBtnCollapse);
|
|
861
|
+
expandBtnWrapInner.append(status);
|
|
862
|
+
expandBtnWrapInner.append(expandBtnExpand);
|
|
863
|
+
expandBtnWrapInner.append(expandBtnCollapse);
|
|
864
|
+
|
|
865
|
+
expandBtnWrap.append(expandBtnWrapInner);
|
|
866
|
+
noteBody.append(noteTextarea);
|
|
867
|
+
noteBody.append(expandBtnWrap);
|
|
868
|
+
|
|
869
|
+
if(noteContent.values.imageSrc) {
|
|
870
|
+
var noteImage = $('<div class="sidebar-note-img-wrap"><img src="' + noteContent.values.imageSrc + '" /><div>');
|
|
871
|
+
noteBody.append(noteImage);
|
|
872
|
+
}
|
|
873
|
+
|
|
874
|
+
return noteBody;
|
|
875
|
+
}
|
|
876
|
+
|
|
877
|
+
function bindTextareaHandlers(textarea, noteData) {
|
|
878
|
+
textarea.on('focus', function() {
|
|
879
|
+
doTextareaOnFocus($(this));
|
|
880
|
+
});
|
|
881
|
+
|
|
882
|
+
textarea.on('change', function() {
|
|
883
|
+
doNoteOnChange($(this), noteData);
|
|
884
|
+
});
|
|
885
|
+
}
|
|
886
|
+
|
|
887
|
+
function doTextareaOnFocus(textarea) {
|
|
888
|
+
$('.sidebar-note-wrap').removeClass('active');
|
|
889
|
+
var wrap = textarea.closest('.sidebar-note-wrap');
|
|
890
|
+
wrap.addClass('active');
|
|
891
|
+
autosize(textarea);
|
|
892
|
+
wrap.find('.sidebar-note-expand-btn').removeClass('collapsed');
|
|
893
|
+
}
|
|
894
|
+
|
|
895
|
+
function doNoteOnChange(textarea, noteData) {
|
|
896
|
+
var noteId = textarea.data('id');
|
|
897
|
+
var noteTitle = noteData.values.title;
|
|
898
|
+
var noteDesc = textarea.val();
|
|
899
|
+
|
|
900
|
+
BIMAnnotation.UpdateNote(noteId, noteTitle, noteDesc, function() {
|
|
901
|
+
var date = getCurrentDate();
|
|
902
|
+
var user = '';
|
|
903
|
+
|
|
904
|
+
$.each(notes, function(index, val) {
|
|
905
|
+
if(val.id == noteId) {
|
|
906
|
+
notes[index]['values']['description'] = noteDesc;
|
|
907
|
+
notes[index]['date'] = date;
|
|
908
|
+
}
|
|
909
|
+
});
|
|
910
|
+
});
|
|
911
|
+
}
|
|
912
|
+
|
|
913
|
+
function bindOnClickTextareaExpand(btnElm) {
|
|
914
|
+
btnElm.on('click', function() {
|
|
915
|
+
doTextareaExpand(btnElm);
|
|
916
|
+
$(this).closest('.sidebar-note-expand-btn').removeClass('collapsed');
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
function doTextareaExpand(btnElm) {
|
|
921
|
+
var textarea = btnElm.closest('.sidebar-note-body').find('textarea');
|
|
922
|
+
autosize(textarea);
|
|
923
|
+
}
|
|
924
|
+
|
|
925
|
+
function bindOnClickTextareaCollapse(btnElm) {
|
|
926
|
+
btnElm.on('click', function() {
|
|
927
|
+
doTextareaCollapse(btnElm);
|
|
928
|
+
$(this).closest('.sidebar-note-expand-btn').addClass('collapsed');
|
|
929
|
+
});
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
function doTextareaCollapse(btnElm) {
|
|
933
|
+
var textarea = btnElm.closest('.sidebar-note-body').find('textarea');
|
|
934
|
+
autosize.destroy(textarea);
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
function createSidebarNotesItemHeader(noteData) {
|
|
938
|
+
var noteContent = noteData;
|
|
939
|
+
|
|
940
|
+
var noteHeader = $('<div class="sidebar-note-header" />');
|
|
941
|
+
var noteName = $('<div class="sidebar-note-name" />');
|
|
942
|
+
noteName.html(noteContent.creator);
|
|
943
|
+
var noteDate = $('<div class="sidebar-note-date" />');
|
|
944
|
+
|
|
945
|
+
var dateStr = getCurrentDate();
|
|
946
|
+
if (noteContent.date) {
|
|
947
|
+
var date = new Date(noteContent.date);
|
|
948
|
+
dateStr = date.toLocaleDateString("ru-RU") + ' ' + date.getHours() + ':' + date.getMinutes();
|
|
949
|
+
}
|
|
950
|
+
|
|
951
|
+
noteDate.html(dateStr);
|
|
952
|
+
|
|
953
|
+
var titleContainer = $('<div class="note-title-container"></div>');
|
|
954
|
+
|
|
955
|
+
var noteTitle = $('<div class="sidebar-note-title">' + noteData.values.title + '</div>');
|
|
956
|
+
noteTitle.on('click', function() {
|
|
957
|
+
goToNoteMarker($(this));
|
|
958
|
+
});
|
|
959
|
+
|
|
960
|
+
var noteId = $('<div class="sidebar-note-id"></div>');
|
|
961
|
+
var goToCommentListLabel = document.webL10n.get('note_go_to_comment_list');
|
|
962
|
+
var noteIdButton = $('<a title="' + goToCommentListLabel + '">' + '#' + noteData.values.glyph + '</a>');
|
|
963
|
+
|
|
964
|
+
if (noteData.version) {
|
|
965
|
+
var noteFileVersionLabel = document.webL10n.get('note_file_version');
|
|
966
|
+
var noteIdFileVersion = $('<a class="fileVersionPath">' + noteFileVersionLabel + ':' + ' ' + noteData.version + '</a>');
|
|
967
|
+
noteId.append(noteIdFileVersion);
|
|
968
|
+
noteIdFileVersion.on('click', function () {
|
|
969
|
+
window.open(noteData.fileVersionPath);
|
|
970
|
+
});
|
|
971
|
+
}
|
|
972
|
+
|
|
973
|
+
noteId.append(noteIdButton);
|
|
974
|
+
noteIdButton.on('click', function () {
|
|
975
|
+
goToCommentList(noteData.values.glyph);
|
|
976
|
+
});
|
|
977
|
+
titleContainer.append(noteTitle);
|
|
978
|
+
|
|
979
|
+
var noteConfirmDeleteMessage = document.webL10n.get('note_delete');
|
|
980
|
+
var deleteBtn = $('<a title="' + noteConfirmDeleteMessage + '" class="sidebar-note-btn-delete"><span>' + noteConfirmDeleteMessage + '</span></a>');
|
|
981
|
+
deleteBtn.data('id', noteData.id);
|
|
982
|
+
bindSidebarNotesBtnDelete(deleteBtn);
|
|
983
|
+
|
|
984
|
+
noteHeader.append(noteName);
|
|
985
|
+
noteHeader.append(noteDate);
|
|
986
|
+
noteHeader.append(noteId);
|
|
987
|
+
noteHeader.append(titleContainer);
|
|
988
|
+
noteHeader.append(deleteBtn);
|
|
989
|
+
|
|
990
|
+
return noteHeader;
|
|
991
|
+
}
|
|
992
|
+
|
|
993
|
+
function goToNoteMarker(noteTitle) {
|
|
994
|
+
var sidebarNoteWrap = noteTitle.closest('.sidebar-note-wrap');
|
|
995
|
+
var sidebarNoteWrapId = sidebarNoteWrap.attr('id');
|
|
996
|
+
var noteId = sidebarNoteWrapId.replace("noteWrap-", "");
|
|
997
|
+
console.log('noteId', noteId);
|
|
998
|
+
|
|
999
|
+
var annotation = annotations.annotations[noteId];
|
|
1000
|
+
console.log('annotation', annotation);
|
|
1001
|
+
viewer.cameraFlight.flyTo(annotation);
|
|
1002
|
+
}
|
|
1003
|
+
|
|
1004
|
+
function goToCommentList(noteId) {
|
|
1005
|
+
BIMAnnotation.GoToCommentList(noteId);
|
|
1006
|
+
}
|
|
1007
|
+
|
|
1008
|
+
function bindSidebarNotesBtnDelete(btn) {
|
|
1009
|
+
btn.on('click', function(e) {
|
|
1010
|
+
$(document).trigger('deleteNote', [$(this)]);
|
|
1011
|
+
});
|
|
1012
|
+
}
|
|
1013
|
+
|
|
1014
|
+
function bindDeleteNoteEventHandler() {
|
|
1015
|
+
$(document).on('deleteNote', function(e, item) {
|
|
1016
|
+
|
|
1017
|
+
createDeleteDlgElm();
|
|
1018
|
+
|
|
1019
|
+
dialog = getDlgElm().dialog({
|
|
1020
|
+
autoOpen: true,
|
|
1021
|
+
height: 130,
|
|
1022
|
+
width: 280,
|
|
1023
|
+
modal: true,
|
|
1024
|
+
resizable: true,
|
|
1025
|
+
buttons: [{
|
|
1026
|
+
text: "Confirm",
|
|
1027
|
+
"id": "btnDeleteConfirm",
|
|
1028
|
+
click: function() {
|
|
1029
|
+
var id = item.attr('id') ? item.attr('id') : item.data('id');
|
|
1030
|
+
BIMAnnotation.DeleteNote(id, deleteNote);
|
|
1031
|
+
closeDlg();
|
|
1032
|
+
},
|
|
1033
|
+
}, {
|
|
1034
|
+
text: "Cancel",
|
|
1035
|
+
"id": "btnDeleteCancel",
|
|
1036
|
+
click: function() {
|
|
1037
|
+
closeDlg();
|
|
1038
|
+
}
|
|
1039
|
+
}],
|
|
1040
|
+
close: function () {
|
|
1041
|
+
closeDlg();
|
|
1042
|
+
}
|
|
1043
|
+
});
|
|
1044
|
+
|
|
1045
|
+
var confirmLabel = document.webL10n.get('confirm');
|
|
1046
|
+
var cancelLabel = document.webL10n.get('cancel');
|
|
1047
|
+
$("#btnDeleteConfirm").html('<span class="ui-button-text">'+ confirmLabel +'</span>')
|
|
1048
|
+
$("#btnDeleteCancel").html('<span class="ui-button-text">'+ cancelLabel +'</span>')
|
|
1049
|
+
});
|
|
1050
|
+
}
|
|
1051
|
+
|
|
1052
|
+
function deleteNote(id) {
|
|
1053
|
+
notes = jQuery.grep(notes, function(elm, index) {
|
|
1054
|
+
return (elm.id != id);
|
|
1055
|
+
});
|
|
1056
|
+
|
|
1057
|
+
annotations.destroyAnnotation(id);
|
|
1058
|
+
|
|
1059
|
+
if($('.sidebar').is(':visible')) {
|
|
1060
|
+
initSidebarNotes();
|
|
1061
|
+
}
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
function fixNotesTextareaBlur() {
|
|
1065
|
+
$('#xeokitCanvas').on('click', function() {
|
|
1066
|
+
if($('.sidebar-content').is(':visible')) {
|
|
1067
|
+
var textareas = $('.sidebar-content').find('textarea');
|
|
1068
|
+
if(textareas.length) {
|
|
1069
|
+
textareas.trigger('blur');
|
|
1070
|
+
}
|
|
1071
|
+
}
|
|
1072
|
+
});
|
|
1073
|
+
}
|
|
1074
|
+
|
|
1075
|
+
function highlightSidebarNote(noteId) {
|
|
1076
|
+
$('.sidebar-note-wrap').removeClass('active');
|
|
1077
|
+
var notetWrap = $('#noteWrap-' + noteId);
|
|
1078
|
+
notetWrap.addClass('active');
|
|
1079
|
+
autosize(notetWrap.find('textarea'));
|
|
1080
|
+
notetWrap.find('.sidebar-note-expand-btn').removeClass('collapsed');
|
|
1081
|
+
var sidebarContent = $('.sidebar-content');
|
|
1082
|
+
var sidebarOffsetTop = parseInt(sidebarContent[0].offsetTop);
|
|
1083
|
+
var sidebarScrollTop = parseInt(sidebarContent[0].scrollTop);
|
|
1084
|
+
sidebarContent.animate({
|
|
1085
|
+
scrollTop: notetWrap.position().top - sidebarOffsetTop + sidebarScrollTop
|
|
1086
|
+
}, 1000);
|
|
1087
|
+
}
|
|
1088
|
+
|
|
1089
|
+
function showNoteDesc(noteId) {
|
|
1090
|
+
if(!$('.sidebar').is(':visible')) {
|
|
1091
|
+
$('#btnToggleSidebarNotes').addClass('toggled');
|
|
1092
|
+
initSidebarNotes();
|
|
1093
|
+
expandSidebarNotes();
|
|
1094
|
+
}
|
|
1095
|
+
highlightSidebarNote(noteId);
|
|
1096
|
+
}
|
|
1097
|
+
|
|
1098
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1099
|
+
// Toolbar
|
|
1100
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1101
|
+
function bindToggleNotes() {
|
|
1102
|
+
$(document).on('click', '#btnToggleNotes', function() {
|
|
1103
|
+
$(this).toggleClass('show');
|
|
1104
|
+
if($(this).hasClass('show')) {
|
|
1105
|
+
hideAnnotationMarkers();
|
|
1106
|
+
} else {
|
|
1107
|
+
showAnnotationMarkers();
|
|
1108
|
+
}
|
|
1109
|
+
});
|
|
1110
|
+
}
|
|
1111
|
+
|
|
1112
|
+
function hideAnnotationMarkers() {
|
|
1113
|
+
$('body').addClass('hide-annotations');
|
|
1114
|
+
}
|
|
1115
|
+
|
|
1116
|
+
function showAnnotationMarkers() {
|
|
1117
|
+
$('body').removeClass('hide-annotations');
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
function bindBtnToggleSidebarNotes() {
|
|
1121
|
+
$(document).on('click', '#btnToggleSidebarNotes', function() {
|
|
1122
|
+
$(this).toggleClass('toggled');
|
|
1123
|
+
|
|
1124
|
+
if($(this).hasClass('toggled')) {
|
|
1125
|
+
if(!$('.sidebar').is(':visible')) {
|
|
1126
|
+
initSidebarNotes();
|
|
1127
|
+
expandSidebarNotes();
|
|
1128
|
+
}
|
|
1129
|
+
} else {
|
|
1130
|
+
$('#navCubeCanvas').css('right', 10);
|
|
1131
|
+
$('#sectionPlanesOverviewCanvas').css('right', 10);
|
|
1132
|
+
$('.sidebar').hide();
|
|
1133
|
+
$('body').removeClass('sidebar-expanded');
|
|
1134
|
+
}
|
|
1135
|
+
});
|
|
1136
|
+
}
|
|
1137
|
+
|
|
1138
|
+
function expandSidebarNotes() {
|
|
1139
|
+
$('#sidebarWrap').show();
|
|
1140
|
+
$('#navCubeCanvas').css('right', $('#sidebarWrap').width() + 10);
|
|
1141
|
+
$('#sectionPlanesOverviewCanvas').css('right', $('#sidebarWrap').width() + 10);
|
|
1142
|
+
var body = $('body');
|
|
1143
|
+
var bodyScrollWidth = body[0].offsetWidth - body[0].scrollWidth;
|
|
1144
|
+
var vScrollWidth = bodyScrollWidth ? bodyScrollWidth : 0;
|
|
1145
|
+
$('.sidebar').css('right', (vScrollWidth + 'px')).show("slide", { direction: "right" }, 200);
|
|
1146
|
+
body.addClass('sidebar-expanded');
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
function bindSidebarNotesClose() {
|
|
1150
|
+
$('.sidebar-close').on('click', function() {
|
|
1151
|
+
$('#navCubeCanvas').css('right', 10);
|
|
1152
|
+
$('#sectionPlanesOverviewCanvas').css('right', $('#sidebarWrap').width() + 10);
|
|
1153
|
+
$('.sidebar').hide();
|
|
1154
|
+
$('#btnToggleSidebarNotes').removeClass('toggled');
|
|
1155
|
+
});
|
|
1156
|
+
}
|
|
1157
|
+
|
|
1158
|
+
function bindBtnCreateAngleMeasurements() {
|
|
1159
|
+
$(document).on('click', '#btnCreateAngleMeasurements', function() {
|
|
1160
|
+
$(this).toggleClass('toggled');
|
|
1161
|
+
|
|
1162
|
+
if($(this).hasClass('toggled')) {
|
|
1163
|
+
$('#btnCreateNotes').removeClass('toggled');
|
|
1164
|
+
annotationByClick = false;
|
|
1165
|
+
|
|
1166
|
+
$('#btnCreateSectionPlan').removeClass('toggled');
|
|
1167
|
+
disableSectionPlanByClick();
|
|
1168
|
+
disableDistanceMeasurementsByClick();
|
|
1169
|
+
|
|
1170
|
+
enableAngleMeasurements();
|
|
1171
|
+
$('#btnToggleAngleMeasurements').removeClass('toggled');
|
|
1172
|
+
|
|
1173
|
+
enableAngleMeasurementsByClick();
|
|
1174
|
+
|
|
1175
|
+
} else {
|
|
1176
|
+
disableAngleMeasurementsByClick();
|
|
1177
|
+
}
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
|
|
1181
|
+
function enableAngleMeasurementsByClick() {
|
|
1182
|
+
angleMeasurementsByClick = true;
|
|
1183
|
+
angleMeasurements.control.activate();
|
|
1184
|
+
}
|
|
1185
|
+
|
|
1186
|
+
function disableAngleMeasurementsByClick() {
|
|
1187
|
+
angleMeasurements.control.deactivate();
|
|
1188
|
+
angleMeasurementsByClick = false;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1191
|
+
/* *** Вариант реализации, если необходима возможность создавать SectionPlan по клику *** */
|
|
1192
|
+
function bindBtnToggleCreateNotes() {
|
|
1193
|
+
$(document).on('click', '#btnCreateNotes', function() {
|
|
1194
|
+
$(this).toggleClass('toggled');
|
|
1195
|
+
|
|
1196
|
+
if($(this).hasClass('toggled')) {
|
|
1197
|
+
$('#btnCreateSectionPlan').removeClass('toggled');
|
|
1198
|
+
disableSectionPlanByClick();
|
|
1199
|
+
disableAngleMeasurementsByClick();
|
|
1200
|
+
disableDistanceMeasurementsByClick();
|
|
1201
|
+
showAnnotationMarkers();
|
|
1202
|
+
$('#btnToggleNotes').removeClass('show');
|
|
1203
|
+
annotationByClick = true;
|
|
1204
|
+
} else {
|
|
1205
|
+
annotationByClick = false;
|
|
1206
|
+
}
|
|
1207
|
+
});
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
function bindBtnCreateSectionPlan() {
|
|
1211
|
+
$(document).on('click', '#btnCreateSectionPlan', function() {
|
|
1212
|
+
$(this).toggleClass('toggled');
|
|
1213
|
+
|
|
1214
|
+
if($(this).hasClass('toggled')) {
|
|
1215
|
+
$('#btnCreateNotes').removeClass('toggled');
|
|
1216
|
+
$('#btnToggleSectionPlan').addClass('toggled');
|
|
1217
|
+
annotationByClick = false;
|
|
1218
|
+
disableAngleMeasurementsByClick();
|
|
1219
|
+
disableDistanceMeasurementsByClick();
|
|
1220
|
+
enableSectionPlanByClick();
|
|
1221
|
+
} else {
|
|
1222
|
+
disableSectionPlanByClick();
|
|
1223
|
+
}
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
function bindBtnClearSectionPlan() {
|
|
1228
|
+
$(document).on('click', '#btnClearSectionPlan', function () {
|
|
1229
|
+
clearSectionPanes();
|
|
1230
|
+
});
|
|
1231
|
+
}
|
|
1232
|
+
|
|
1233
|
+
function bindBtnToggleSectionPlan() {
|
|
1234
|
+
$(document).on('click', '#btnToggleSectionPlan', function() {
|
|
1235
|
+
$(this).toggleClass('toggled');
|
|
1236
|
+
|
|
1237
|
+
if($(this).hasClass('toggled')) {
|
|
1238
|
+
enableSectionPlan();
|
|
1239
|
+
} else {
|
|
1240
|
+
disableSectionPlan();
|
|
1241
|
+
sectionPlanByClick = false;
|
|
1242
|
+
$('#btnCreateSectionPlan').removeClass('toggled');
|
|
1243
|
+
}
|
|
1244
|
+
});
|
|
1245
|
+
}
|
|
1246
|
+
/* *** */
|
|
1247
|
+
|
|
1248
|
+
function enableSectionPlanByClick() {
|
|
1249
|
+
sectionPlanByClick = true;
|
|
1250
|
+
|
|
1251
|
+
if(lastVisibleSectionPlanId) {
|
|
1252
|
+
sectionPlanes.showControl(lastVisibleSectionPlanId); // Shows the 3D editing gizmo for a SectionPlane.
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
sectionPlanes.setOverviewVisible(true); // Shows #sectionPlanesOverviewCanvas
|
|
1256
|
+
}
|
|
1257
|
+
|
|
1258
|
+
function enableSectionPlan() {
|
|
1259
|
+
if(lastVisibleSectionPlanId) {
|
|
1260
|
+
sectionPlanes.showControl(lastVisibleSectionPlanId); // Shows the 3D editing gizmo for a SectionPlane.
|
|
1261
|
+
}
|
|
1262
|
+
|
|
1263
|
+
sectionPlanes.setOverviewVisible(true); // Shows #sectionPlanesOverviewCanvas
|
|
1264
|
+
}
|
|
1265
|
+
|
|
1266
|
+
function disableSectionPlanByClick() {
|
|
1267
|
+
sectionPlanByClick = false;
|
|
1268
|
+
|
|
1269
|
+
lastVisibleSectionPlanId = sectionPlanes.getShownControl();
|
|
1270
|
+
|
|
1271
|
+
sectionPlanes.hideControl(); // Hides the 3D SectionPlane editing gizmo if shown.
|
|
1272
|
+
sectionPlanes.setOverviewVisible(false); // Hides #sectionPlanesOverviewCanvas
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
function disableSectionPlan() {
|
|
1276
|
+
lastVisibleSectionPlanId = sectionPlanes.getShownControl();
|
|
1277
|
+
|
|
1278
|
+
sectionPlanes.hideControl(); // Hides the 3D SectionPlane editing gizmo if shown.
|
|
1279
|
+
sectionPlanes.setOverviewVisible(false); // Hides #sectionPlanesOverviewCanvas
|
|
1280
|
+
}
|
|
1281
|
+
|
|
1282
|
+
function bindBtnToggleSidebarTreeView() {
|
|
1283
|
+
$(document).on('click', '#btnToggleSidebarTreeView', function() {
|
|
1284
|
+
$(this).toggleClass('toggled');
|
|
1285
|
+
|
|
1286
|
+
if($(this).hasClass('toggled')) {
|
|
1287
|
+
openSidebarTreeView();
|
|
1288
|
+
} else {
|
|
1289
|
+
$('#treeViewContainerWrap').hide();
|
|
1290
|
+
$('body').removeClass('treeview-expanded');
|
|
1291
|
+
// $(window).trigger('resize');
|
|
1292
|
+
}
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
|
|
1296
|
+
function bindBtnToggleSidebarStoreyViews() {
|
|
1297
|
+
$(document).on('click', '#btnToggleSidebarStoreyViews', function() {
|
|
1298
|
+
$(this).toggleClass('toggled');
|
|
1299
|
+
|
|
1300
|
+
if($(this).hasClass('toggled')) {
|
|
1301
|
+
$('#treeViewContainerWrap').hide();
|
|
1302
|
+
$('#btnToggleSidebarTreeView').removeClass('toggled');
|
|
1303
|
+
$('body').removeClass('treeview-expanded');
|
|
1304
|
+
|
|
1305
|
+
$('#storeyViewsSidebar').show();
|
|
1306
|
+
} else {
|
|
1307
|
+
$('#storeyViewsSidebar').hide();
|
|
1308
|
+
}
|
|
1309
|
+
});
|
|
1310
|
+
}
|
|
1311
|
+
|
|
1312
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1313
|
+
// Mouse over entities to highlight them
|
|
1314
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1315
|
+
|
|
1316
|
+
var lastEntity = null;
|
|
1317
|
+
|
|
1318
|
+
viewer.cameraControl.on("hover", function (pickResult) {
|
|
1319
|
+
if (pickResult) {
|
|
1320
|
+
if (!lastEntity || pickResult.entity.id !== lastEntity.id) {
|
|
1321
|
+
if (lastEntity) {
|
|
1322
|
+
lastEntity.highlighted = false;
|
|
1323
|
+
}
|
|
1324
|
+
lastEntity = pickResult.entity;
|
|
1325
|
+
pickResult.entity.highlighted = true;
|
|
1326
|
+
}
|
|
1327
|
+
} else {
|
|
1328
|
+
if (lastEntity) {
|
|
1329
|
+
lastEntity.highlighted = false;
|
|
1330
|
+
lastEntity = null;
|
|
1331
|
+
}
|
|
1332
|
+
}
|
|
1333
|
+
});
|
|
1334
|
+
|
|
1335
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1336
|
+
// TreeView Panel resizable
|
|
1337
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1338
|
+
function initTreeViewPanelResizable() {
|
|
1339
|
+
$('#treeViewContainerWrap').resizable({
|
|
1340
|
+
handles: "e",
|
|
1341
|
+
minWidth: 150
|
|
1342
|
+
});
|
|
1343
|
+
}
|
|
1344
|
+
|
|
1345
|
+
function initSidebarResizable() {
|
|
1346
|
+
$('#sidebarWrap').resizable({
|
|
1347
|
+
handles: "w",
|
|
1348
|
+
minWidth: 150,
|
|
1349
|
+
resize: function(event, ui) {
|
|
1350
|
+
$('#navCubeCanvas').css('right', $('#sidebarWrap').width() + 10);
|
|
1351
|
+
$('#sectionPlanesOverviewCanvas').css('right', $('#sidebarWrap').width() + 10);
|
|
1352
|
+
}
|
|
1353
|
+
});
|
|
1354
|
+
}
|
|
1355
|
+
|
|
1356
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1357
|
+
// AngleMeasurementsPlugin
|
|
1358
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1359
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1360
|
+
// Create a AngleMeasurementsPlugin, with which we'll create AngleMeasurements
|
|
1361
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1362
|
+
const angleMeasurements = new AngleMeasurementsPlugin(viewer);
|
|
1363
|
+
|
|
1364
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1365
|
+
// 1. Load Predefined AngleMeasurements (from assets/data/angle.measurements.data.js)
|
|
1366
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1367
|
+
|
|
1368
|
+
function createAngleMeasurements(angleMeasurementsData) {
|
|
1369
|
+
var angleMeasurements = [];
|
|
1370
|
+
$.each(angleMeasurementsData,function(index,value){
|
|
1371
|
+
angleMeasurements.push(createAngleMeasurementItem(value));
|
|
1372
|
+
});
|
|
1373
|
+
|
|
1374
|
+
return angleMeasurements;
|
|
1375
|
+
}
|
|
1376
|
+
|
|
1377
|
+
function createAngleMeasurementItem(angleMeasurementItemData) {
|
|
1378
|
+
var angleMeasurementsItem = angleMeasurements.createMeasurement({
|
|
1379
|
+
id: angleMeasurementItemData.id,
|
|
1380
|
+
origin: {
|
|
1381
|
+
entity: viewer.scene.objects[angleMeasurementItemData.origin.entity],
|
|
1382
|
+
worldPos: angleMeasurementItemData.origin.worldPos
|
|
1383
|
+
},
|
|
1384
|
+
corner: {
|
|
1385
|
+
entity: viewer.scene.objects[angleMeasurementItemData.corner.entity],
|
|
1386
|
+
worldPos: angleMeasurementItemData.corner.worldPos
|
|
1387
|
+
},
|
|
1388
|
+
target: {
|
|
1389
|
+
entity: viewer.scene.objects[angleMeasurementItemData.target.entity],
|
|
1390
|
+
worldPos: angleMeasurementItemData.target.worldPos
|
|
1391
|
+
},
|
|
1392
|
+
visible: true
|
|
1393
|
+
});
|
|
1394
|
+
|
|
1395
|
+
return angleMeasurementsItem;
|
|
1396
|
+
}
|
|
1397
|
+
|
|
1398
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1399
|
+
// 2. Create AngleMeasurements by Click
|
|
1400
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1401
|
+
|
|
1402
|
+
function bindBtnToggleAngleMeasurements() {
|
|
1403
|
+
$(document).on('click', '#btnToggleAngleMeasurements', function() {
|
|
1404
|
+
$(this).toggleClass('toggled');
|
|
1405
|
+
|
|
1406
|
+
if($(this).hasClass('toggled')) {
|
|
1407
|
+
$('#btnCreateAngleMeasurements').removeClass('toggled');
|
|
1408
|
+
disableAngleMeasurementsByClick();
|
|
1409
|
+
disableAngleMeasurements();
|
|
1410
|
+
} else {
|
|
1411
|
+
enableAngleMeasurements();
|
|
1412
|
+
}
|
|
1413
|
+
});
|
|
1414
|
+
}
|
|
1415
|
+
|
|
1416
|
+
function enableAngleMeasurements() {
|
|
1417
|
+
$.each(angleMeasurements.measurements, function(index) {
|
|
1418
|
+
this.visible = true;
|
|
1419
|
+
});
|
|
1420
|
+
}
|
|
1421
|
+
|
|
1422
|
+
function disableAngleMeasurements() {
|
|
1423
|
+
$.each(angleMeasurements.measurements, function(index) {
|
|
1424
|
+
this.visible = false;
|
|
1425
|
+
});
|
|
1426
|
+
}
|
|
1427
|
+
|
|
1428
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1429
|
+
// StoreyViews
|
|
1430
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1431
|
+
const storeyViewsPlugin = new StoreyViewsPlugin(viewer);
|
|
1432
|
+
|
|
1433
|
+
function initStoreyViews() {
|
|
1434
|
+
// Make all doors transparent
|
|
1435
|
+
viewer.scene.setObjectsOpacity(viewer.metaScene.getObjectIDsByType("IfcDoor"), 0.3);
|
|
1436
|
+
createStoreyMapsMenu();
|
|
1437
|
+
}
|
|
1438
|
+
|
|
1439
|
+
function createStoreyMapsMenu() {
|
|
1440
|
+
|
|
1441
|
+
const cameraMemento = new CameraMemento(); // Saves 3D perspective camera to restore
|
|
1442
|
+
cameraMemento.saveCamera(viewer.scene);
|
|
1443
|
+
|
|
1444
|
+
const storeyDiv = document.getElementById("storeyViewsContainer");
|
|
1445
|
+
const storeyIds = Object.keys(storeyViewsPlugin.storeys);
|
|
1446
|
+
|
|
1447
|
+
const canStandOnTypes = { // IFC types we can stand on in first-person mode
|
|
1448
|
+
IfcSlab: true,
|
|
1449
|
+
IfcStair: true,
|
|
1450
|
+
IfcFloor: true,
|
|
1451
|
+
IfcFooting: true
|
|
1452
|
+
};
|
|
1453
|
+
|
|
1454
|
+
for (var i = 0, len = storeyIds.length; i < len; i++) {
|
|
1455
|
+
|
|
1456
|
+
const storeyId = storeyIds[i];
|
|
1457
|
+
|
|
1458
|
+
const storeyMap = storeyViewsPlugin.createStoreyMap(storeyId, {
|
|
1459
|
+
format: "png",
|
|
1460
|
+
width: 300,
|
|
1461
|
+
useObjectStates: true
|
|
1462
|
+
});
|
|
1463
|
+
|
|
1464
|
+
const img = document.createElement("img");
|
|
1465
|
+
img.src = storeyMap.imageData;
|
|
1466
|
+
img.style.border = "1px solid #000000";
|
|
1467
|
+
img.style.background = "lightblue";
|
|
1468
|
+
img.style.width = storeyMap.width + "px";
|
|
1469
|
+
img.style.height = storeyMap.height + "px";
|
|
1470
|
+
img.style.opacity = 0.8;
|
|
1471
|
+
|
|
1472
|
+
storeyDiv.appendChild(img);
|
|
1473
|
+
|
|
1474
|
+
img.onmouseenter = () => {
|
|
1475
|
+
img.style.cursor = "default";
|
|
1476
|
+
};
|
|
1477
|
+
|
|
1478
|
+
img.onmousemove = (e) => {
|
|
1479
|
+
img.style.cursor = "default";
|
|
1480
|
+
const imagePos = [e.offsetX, e.offsetY];
|
|
1481
|
+
const pickResult = storeyViewsPlugin.pickStoreyMap(storeyMap, imagePos, {});
|
|
1482
|
+
if (pickResult) {
|
|
1483
|
+
const entity = pickResult.entity;
|
|
1484
|
+
const metaObject = viewer.metaScene.metaObjects[entity.id];
|
|
1485
|
+
if (metaObject) {
|
|
1486
|
+
if (canStandOnTypes[metaObject.type]) {
|
|
1487
|
+
img.style.cursor = "pointer";
|
|
1488
|
+
}
|
|
1489
|
+
}
|
|
1490
|
+
}
|
|
1491
|
+
};
|
|
1492
|
+
|
|
1493
|
+
img.onmouseleave = (e) => {
|
|
1494
|
+
img.style.cursor = "default";
|
|
1495
|
+
};
|
|
1496
|
+
|
|
1497
|
+
const worldPos = math.vec3();
|
|
1498
|
+
|
|
1499
|
+
img.onclick = (e) => {
|
|
1500
|
+
const imagePos = [e.offsetX, e.offsetY];
|
|
1501
|
+
const pickResult = storeyViewsPlugin.pickStoreyMap(storeyMap, imagePos, {
|
|
1502
|
+
pickSurface: true
|
|
1503
|
+
});
|
|
1504
|
+
|
|
1505
|
+
if (pickResult) {
|
|
1506
|
+
worldPos.set(pickResult.worldPos);
|
|
1507
|
+
|
|
1508
|
+
//pickResult.entity.highlighted = true;
|
|
1509
|
+
|
|
1510
|
+
// Set camera vertical position at the mid point of the storey's vertical
|
|
1511
|
+
// extents - note how this is adapts to whichever of the X, Y or Z axis is
|
|
1512
|
+
// designated the World's "up" axis
|
|
1513
|
+
|
|
1514
|
+
const camera = viewer.scene.camera;
|
|
1515
|
+
const idx = camera.xUp ? 0 : (camera.yUp ? 1 : 2); // Find the right axis for "up"
|
|
1516
|
+
const storey = storeyViewsPlugin.storeys[storeyMap.storeyId];
|
|
1517
|
+
worldPos[idx] = (storey.aabb[idx] + storey.aabb[3 + idx]) / 2;
|
|
1518
|
+
|
|
1519
|
+
viewer.cameraFlight.flyTo({
|
|
1520
|
+
eye: worldPos,
|
|
1521
|
+
up: viewer.camera.worldUp,
|
|
1522
|
+
look: math.addVec3(worldPos, viewer.camera.worldForward, []),
|
|
1523
|
+
projection: "perspective",
|
|
1524
|
+
duration: 1.5
|
|
1525
|
+
}, () => {
|
|
1526
|
+
viewer.cameraControl.navMode = "firstPerson";
|
|
1527
|
+
viewer.cameraControl.followPointer = false;
|
|
1528
|
+
});
|
|
1529
|
+
} else {
|
|
1530
|
+
cameraMemento.restoreCamera(viewer.scene, () => {
|
|
1531
|
+
viewer.cameraControl.navMode = "planView";
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
};
|
|
1535
|
+
}
|
|
1536
|
+
}
|
|
1537
|
+
|
|
1538
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1539
|
+
// BCF Viewpoint JSON
|
|
1540
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1541
|
+
function bindBtnSaveBCFViewpointJSON() {
|
|
1542
|
+
$('#btnSaveBCFViewpointJSON').on('click', function() {
|
|
1543
|
+
saveBCFViewpointJSON();
|
|
1544
|
+
});
|
|
1545
|
+
}
|
|
1546
|
+
|
|
1547
|
+
function saveBCFViewpointJSON() {
|
|
1548
|
+
const viewpoint = bcfViewpoints.getViewpoint({ // Options
|
|
1549
|
+
spacesVisible: false, // Don't force IfcSpace types visible in viewpoint (default)
|
|
1550
|
+
spaceBoundariesVisible: false, // Don't show IfcSpace boundaries in viewpoint (default)
|
|
1551
|
+
openingsVisible: false // Don't force IfcOpening types visible in viewpoint (default)
|
|
1552
|
+
});
|
|
1553
|
+
|
|
1554
|
+
const viewpointStr = JSON.stringify(viewpoint, null, 4);
|
|
1555
|
+
|
|
1556
|
+
// TODO -> save JSON
|
|
1557
|
+
alert(viewpointStr); // Only for Test
|
|
1558
|
+
console.log(viewpointStr); // Only for Test
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1561
|
+
function bindBtnLoadBCFViewpointJSON() {
|
|
1562
|
+
$('#btnLoadBCFViewpointJSON').on('click', function() {
|
|
1563
|
+
loadBCFViewpointJSON();
|
|
1564
|
+
});
|
|
1565
|
+
}
|
|
1566
|
+
|
|
1567
|
+
function getBCFViewpoint() {
|
|
1568
|
+
return bcfData; // Return Test-data from bcf.data.js
|
|
1569
|
+
}
|
|
1570
|
+
|
|
1571
|
+
function loadBCFViewpointJSON() {
|
|
1572
|
+
const bcfViewpoint = getBCFViewpoint();
|
|
1573
|
+
bcfViewpoints.setViewpoint(bcfViewpoint);
|
|
1574
|
+
}
|
|
1575
|
+
|
|
1576
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1577
|
+
// Compare Models
|
|
1578
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1579
|
+
let compareModelsResult;
|
|
1580
|
+
let viewerSceneObjectsNewBeforeCompare;
|
|
1581
|
+
|
|
1582
|
+
function bindBtnCompareOneOverOne() {
|
|
1583
|
+
$(document).on('click', '#btnCompareOneOverOne', function() {
|
|
1584
|
+
if($('#btnCompareSideBySide').hasClass('toggled')) {
|
|
1585
|
+
$('#btnCompareSideBySide').removeClass('toggled');
|
|
1586
|
+
doRemoveComparison();
|
|
1587
|
+
}
|
|
1588
|
+
if(!$(this).hasClass('toggled')) {
|
|
1589
|
+
compareModels(false);
|
|
1590
|
+
}
|
|
1591
|
+
$(this).addClass('toggled');
|
|
1592
|
+
});
|
|
1593
|
+
}
|
|
1594
|
+
|
|
1595
|
+
function bindBtnCompareSideBySide() {
|
|
1596
|
+
$(document).on('click', '#btnCompareSideBySide', function() {
|
|
1597
|
+
if($('#btnCompareOneOverOne').hasClass('toggled')) {
|
|
1598
|
+
$('#btnCompareOneOverOne').removeClass('toggled');
|
|
1599
|
+
doRemoveComparison();
|
|
1600
|
+
}
|
|
1601
|
+
if(!$(this).hasClass('toggled')) {
|
|
1602
|
+
compareModels(true);
|
|
1603
|
+
}
|
|
1604
|
+
$(this).addClass('toggled');
|
|
1605
|
+
});
|
|
1606
|
+
}
|
|
1607
|
+
|
|
1608
|
+
function bindBtnClearComparison() {
|
|
1609
|
+
$(document).on('click', '#btnClearComparison', function() {
|
|
1610
|
+
$('#btnCompareOneOverOne').removeClass('toggled');
|
|
1611
|
+
$('#btnCompareSideBySide').removeClass('toggled');
|
|
1612
|
+
$('#btnToggleCompare').removeClass('toggled');
|
|
1613
|
+
|
|
1614
|
+
doRemoveComparison();
|
|
1615
|
+
});
|
|
1616
|
+
}
|
|
1617
|
+
|
|
1618
|
+
function doRemoveComparison() {
|
|
1619
|
+
if (model2) {
|
|
1620
|
+
model2.destroy();
|
|
1621
|
+
}
|
|
1622
|
+
$('.comparison-popup-wrap').dialog( "destroy" );
|
|
1623
|
+
restoreObjectColorsAfterCompare();
|
|
1624
|
+
}
|
|
1625
|
+
|
|
1626
|
+
function restoreObjectColorsAfterCompare() {
|
|
1627
|
+
if (compareModelsResult && compareModelsResult['new'] && compareModelsResult['new'].length) {
|
|
1628
|
+
for (let i = 0; i < compareModelsResult['new'].length; i++) {
|
|
1629
|
+
if(viewer.scene.objects[compareModelsResult['new'][i]]) {
|
|
1630
|
+
viewer.scene.objects[compareModelsResult['new'][i]].colorize = viewerSceneObjectsNewBeforeCompare[compareModelsResult['new'][i]].colorize;
|
|
1631
|
+
}
|
|
1632
|
+
}
|
|
1633
|
+
}
|
|
1634
|
+
|
|
1635
|
+
compareModelsResult = false;
|
|
1636
|
+
viewerSceneObjectsNewBeforeCompare = false;
|
|
1637
|
+
}
|
|
1638
|
+
|
|
1639
|
+
function compareModels(isSideBySide) {
|
|
1640
|
+
|
|
1641
|
+
var fileItem = BIMCommon.FileItem.FileVersionList[0];
|
|
1642
|
+
|
|
1643
|
+
var disableCacheStr = getDisableCacheStr();
|
|
1644
|
+
var compareModelUrl = fileItem.ModelPath;
|
|
1645
|
+
var modelUrl = compareModelUrl + disableCacheStr;
|
|
1646
|
+
var metaModelDataUrl = fileItem.MetaModelDataPath + disableCacheStr;
|
|
1647
|
+
|
|
1648
|
+
getJSON(compareModelUrl, metaModelDataUrl, function(data) {
|
|
1649
|
+
|
|
1650
|
+
window.model2DataUrl = metaModelDataUrl;
|
|
1651
|
+
|
|
1652
|
+
var settings = {
|
|
1653
|
+
id: Date.now(),
|
|
1654
|
+
src: modelUrl,
|
|
1655
|
+
metaModelJSON: data,
|
|
1656
|
+
edges: true,
|
|
1657
|
+
performance: true,
|
|
1658
|
+
position: [0, 0, 0]
|
|
1659
|
+
};
|
|
1660
|
+
|
|
1661
|
+
if (isSideBySide) {
|
|
1662
|
+
settings.position = [-55, 0, 0];
|
|
1663
|
+
}
|
|
1664
|
+
|
|
1665
|
+
var model2 = undefined;
|
|
1666
|
+
if (srcModel.endsWith('.xkt')) {
|
|
1667
|
+
model2 = xktLoader.load(settings);
|
|
1668
|
+
} else {
|
|
1669
|
+
model2 = gltfLoader.load(settings);
|
|
1670
|
+
}
|
|
1671
|
+
|
|
1672
|
+
var metaObj = data.metaObjects;
|
|
1673
|
+
var result = [];
|
|
1674
|
+
for (var id in metaObj) {
|
|
1675
|
+
if (!metaObj.hasOwnProperty(id)) continue;
|
|
1676
|
+
result[metaObj[id].id] = metaObj[id];
|
|
1677
|
+
}
|
|
1678
|
+
window.model2 = model2;
|
|
1679
|
+
window.model2.customMeta = result;
|
|
1680
|
+
|
|
1681
|
+
model2.on('loaded', () => {
|
|
1682
|
+
viewer.scene.canvas.spinner.processes++;
|
|
1683
|
+
doCompareModels(isSideBySide);
|
|
1684
|
+
});
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
|
|
1688
|
+
function doCompareModels(isSideBySide) {
|
|
1689
|
+
|
|
1690
|
+
BIMModel.Compare(function(result) {
|
|
1691
|
+
var objResult = JSON.parse(result);
|
|
1692
|
+
compareModelsResult = objResult;
|
|
1693
|
+
viewerSceneObjectsNewBeforeCompare = {};
|
|
1694
|
+
|
|
1695
|
+
if(compareModelsResult['new'] && compareModelsResult['new'].length) {
|
|
1696
|
+
for(let i=0; i < compareModelsResult['new'].length; i++) {
|
|
1697
|
+
viewerSceneObjectsNewBeforeCompare[compareModelsResult['new'][i]] = Object.assign({},viewer.scene.objects[compareModelsResult['new'][i]]);
|
|
1698
|
+
}
|
|
1699
|
+
}
|
|
1700
|
+
|
|
1701
|
+
window.objResult = objResult;
|
|
1702
|
+
|
|
1703
|
+
highlightModelsDifference(objResult, isSideBySide);
|
|
1704
|
+
createComparisonResultPopup();
|
|
1705
|
+
viewer.scene.canvas.spinner.processes--;
|
|
1706
|
+
},
|
|
1707
|
+
function() {
|
|
1708
|
+
viewer.scene.canvas.spinner.processes--;
|
|
1709
|
+
});
|
|
1710
|
+
}
|
|
1711
|
+
|
|
1712
|
+
function createComparisonResultPopup() {
|
|
1713
|
+
var popupTitle = document.webL10n.get('version_changes');
|
|
1714
|
+
var labelAll = document.webL10n.get('version_changes_all');
|
|
1715
|
+
var labelAdded = document.webL10n.get('version_changes_added');
|
|
1716
|
+
var labelRemoved = document.webL10n.get('version_changes_removed');
|
|
1717
|
+
|
|
1718
|
+
var countAdded = compareModelsResult['new'].length ? compareModelsResult['new'].length : 0;
|
|
1719
|
+
var countRemoved = compareModelsResult['old']['unique'].length ? compareModelsResult['old']['unique'].length : 0;
|
|
1720
|
+
|
|
1721
|
+
var popupWrap = $('<div class="comparison-popup-wrap"/>');
|
|
1722
|
+
|
|
1723
|
+
var header = createComparisonResultPopupHeader(countAdded, labelAdded, countRemoved, labelRemoved);
|
|
1724
|
+
|
|
1725
|
+
var allItemsList = $('<ul class="list-items"/>');
|
|
1726
|
+
|
|
1727
|
+
if (countAdded) {
|
|
1728
|
+
var addedItemsList = getComparisonResultAddedItemsListElm(allItemsList);
|
|
1729
|
+
}
|
|
1730
|
+
|
|
1731
|
+
if (countRemoved) {
|
|
1732
|
+
var removedItemsList = getComparisonResultRemovedItemsListElm(allItemsList);
|
|
1733
|
+
}
|
|
1734
|
+
|
|
1735
|
+
var body = $('<div class="comparison-popup-body"/>');
|
|
1736
|
+
var ukWrapRelative = $('<div class="uk-position-relative"/>');
|
|
1737
|
+
|
|
1738
|
+
var ukTabHeader = $('<ul uk-tab="swiping: false" class="uk-tab">' +
|
|
1739
|
+
'<li class="uk-active"><a href="#" aria-expanded="true">'+labelAll+'</a></li>' +
|
|
1740
|
+
(countAdded ? '<li class=""><a href="#" aria-expanded="false">'+labelAdded+'</a></li>' : '') +
|
|
1741
|
+
(countRemoved ? '<li class=""><a href="#" aria-expanded="false">'+labelRemoved+'</a></li>' : '') +
|
|
1742
|
+
'</ul>');
|
|
1743
|
+
|
|
1744
|
+
ukWrapRelative.append(ukTabHeader);
|
|
1745
|
+
|
|
1746
|
+
var ukSwitcher = $('<ul class="uk-switcher"/>');
|
|
1747
|
+
|
|
1748
|
+
var liAllElm = $('<li class="uk-active"/>');
|
|
1749
|
+
if (countAdded || countRemoved) {
|
|
1750
|
+
liAllElm.append(allItemsList);
|
|
1751
|
+
}
|
|
1752
|
+
ukSwitcher.append(liAllElm);
|
|
1753
|
+
|
|
1754
|
+
var liAddedElm = $('<li/>');
|
|
1755
|
+
if (countAdded) {
|
|
1756
|
+
liAddedElm.append(addedItemsList);
|
|
1757
|
+
}
|
|
1758
|
+
ukSwitcher.append(liAddedElm);
|
|
1759
|
+
|
|
1760
|
+
var liRemovedElm = $('<li/>');
|
|
1761
|
+
if (countRemoved) {
|
|
1762
|
+
liRemovedElm.append(removedItemsList);
|
|
1763
|
+
}
|
|
1764
|
+
|
|
1765
|
+
ukSwitcher.append(liRemovedElm);
|
|
1766
|
+
ukWrapRelative.append(ukSwitcher);
|
|
1767
|
+
body.append(ukWrapRelative);
|
|
1768
|
+
popupWrap.append(header).append(body);
|
|
1769
|
+
initComparisonResultPopup(popupWrap, popupTitle);
|
|
1770
|
+
}
|
|
1771
|
+
|
|
1772
|
+
function getComparisonResultAddedItemsListElm(allItemsList) {
|
|
1773
|
+
var cssClass = 'item-added';
|
|
1774
|
+
return getComparisonResulItemsListElm(window.model.customMeta, compareModelsResult['new'], cssClass, allItemsList);
|
|
1775
|
+
}
|
|
1776
|
+
|
|
1777
|
+
function getComparisonResultRemovedItemsListElm(allItemsList) {
|
|
1778
|
+
var cssClass = 'item-removed';
|
|
1779
|
+
return getComparisonResulItemsListElm(window.model2.customMeta, compareModelsResult['old']['unique'], cssClass, allItemsList);
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
function getComparisonResulItemsListElm(arCustomMeta, resultData, cssClass, allItemsList) {
|
|
1783
|
+
var itemsList = $('<ul class="list-items">');
|
|
1784
|
+
for (var i=0; i < resultData.length; i++) {
|
|
1785
|
+
var objId = arCustomMeta[resultData[i]]['id'];
|
|
1786
|
+
var objName = arCustomMeta[resultData[i]]['name'];
|
|
1787
|
+
var item = $('<li class="'+cssClass+'"><span class="name">'+objName+'</span><span class="props">'+' [ '+objId+' ]'+'</span></li>');
|
|
1788
|
+
item.data('objId', objId);
|
|
1789
|
+
item.on('click', function() {
|
|
1790
|
+
goToObject($(this).data('objId'));
|
|
1791
|
+
});
|
|
1792
|
+
allItemsList.append(item.clone(true));
|
|
1793
|
+
itemsList.append(item);
|
|
1794
|
+
}
|
|
1795
|
+
|
|
1796
|
+
return itemsList;
|
|
1797
|
+
}
|
|
1798
|
+
|
|
1799
|
+
function initComparisonResultPopup(popupWrap, popupTitle) {
|
|
1800
|
+
var toolbarHeight = $('.toolbar').height();
|
|
1801
|
+
|
|
1802
|
+
popupWrap.dialog({
|
|
1803
|
+
title: popupTitle,
|
|
1804
|
+
classes: {
|
|
1805
|
+
"ui-dialog": "ui-dialog-comparison"
|
|
1806
|
+
},
|
|
1807
|
+
maxHeight: ($(window).height()-toolbarHeight),
|
|
1808
|
+
height: ($(window).height()-toolbarHeight),
|
|
1809
|
+
position: {
|
|
1810
|
+
my: 'right top',
|
|
1811
|
+
at: 'right top',
|
|
1812
|
+
of: '.canvas-wrap',
|
|
1813
|
+
}
|
|
1814
|
+
}).dialogExtend({
|
|
1815
|
+
closable: false,
|
|
1816
|
+
collapsable: true,
|
|
1817
|
+
maximizable: true,
|
|
1818
|
+
minimizable: true,
|
|
1819
|
+
dblclick: "maximize",
|
|
1820
|
+
titlebar: "transparent",
|
|
1821
|
+
minimizeLocation: "left",
|
|
1822
|
+
});
|
|
1823
|
+
}
|
|
1824
|
+
|
|
1825
|
+
function createComparisonResultPopupHeader(countAdded, labelAdded, countRemoved, labelRemoved) {
|
|
1826
|
+
var header = $('<div class="comparison-popup-head">' +
|
|
1827
|
+
'<div class="comparison-popup-head-item added"><div class="count uk-text-large uk-text-bold">'+countAdded+'</div><div class="label uk-text-bold">'+labelAdded+'</div></div>' +
|
|
1828
|
+
'<div class="comparison-popup-head-item removed"><div class="count uk-text-large uk-text-bold">'+countRemoved+'</div><div class="label uk-text-bold">'+labelRemoved+'</div></div>'
|
|
1829
|
+
+ '</div>');
|
|
1830
|
+
|
|
1831
|
+
return header;
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
// Gltf
|
|
1835
|
+
function highlightModelsDifference(result, isSideBySide) {
|
|
1836
|
+
var color, arObjId;
|
|
1837
|
+
|
|
1838
|
+
if(result['old']['unique'].length) {
|
|
1839
|
+
arObjId = result['old']['unique'];
|
|
1840
|
+
var opacity = 0.4; // TODO: old Model unique-objects opacity
|
|
1841
|
+
if (isSideBySide) {
|
|
1842
|
+
color = [1.0, 0.0, 0.8];
|
|
1843
|
+
} else {
|
|
1844
|
+
color = [0.9, 0.9, 0.9]; // TODO: old Model unique-objects color -> gray
|
|
1845
|
+
setOpacityArObject(arObjId, opacity);
|
|
1846
|
+
}
|
|
1847
|
+
colorizeArObject(arObjId, color); // TODO: old Model unique-objects change color
|
|
1848
|
+
}
|
|
1849
|
+
|
|
1850
|
+
// Make old Model not unique-objects unvisible
|
|
1851
|
+
if (result['old']['notUnique'].length && !isSideBySide) {
|
|
1852
|
+
arObjId = result['old']['notUnique'];
|
|
1853
|
+
setVisibilityArObject(arObjId, false);
|
|
1854
|
+
}
|
|
1855
|
+
|
|
1856
|
+
if (result['new'].length) {
|
|
1857
|
+
arObjId = result['new'];
|
|
1858
|
+
color = [1.0, 0.0, 0.8]; // TODO: new Model unique-objects color
|
|
1859
|
+
colorizeArObject(arObjId, color);
|
|
1860
|
+
}
|
|
1861
|
+
}
|
|
1862
|
+
|
|
1863
|
+
// Xkt
|
|
1864
|
+
/*function highlightModelsDifference(result) {
|
|
1865
|
+
var color = [1.0, 0.0, 0.8];
|
|
1866
|
+
$.each(result, function(modelId, arObj) {
|
|
1867
|
+
if(arObj.length > 0) {
|
|
1868
|
+
$.each(arObj, function(index, obj) {
|
|
1869
|
+
colorizeObject(obj.id, color);
|
|
1870
|
+
});
|
|
1871
|
+
}
|
|
1872
|
+
});
|
|
1873
|
+
}*/
|
|
1874
|
+
|
|
1875
|
+
|
|
1876
|
+
function colorizeArObject(arObjId, color) {
|
|
1877
|
+
viewer.scene.setObjectsColorized(arObjId, color);
|
|
1878
|
+
}
|
|
1879
|
+
|
|
1880
|
+
function highlightArObject(arObjId, isHighlight) {
|
|
1881
|
+
viewer.scene.setObjectsHighlighted(arObjId, isHighlight);
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1884
|
+
function setOpacityArObject(arObjId, opacity) {
|
|
1885
|
+
viewer.scene.setObjectsOpacity(arObjId, opacity);
|
|
1886
|
+
}
|
|
1887
|
+
|
|
1888
|
+
function setVisibilityArObject(arObjId, isVisible) {
|
|
1889
|
+
viewer.scene.setObjectsVisible(arObjId, isVisible);
|
|
1890
|
+
}
|
|
1891
|
+
|
|
1892
|
+
function setVisibilityObject(objId, isVisible) {
|
|
1893
|
+
viewer.scene.setObjectsVisible([objId], isVisible);
|
|
1894
|
+
}
|
|
1895
|
+
|
|
1896
|
+
function colorizeObject(objId, color) {
|
|
1897
|
+
viewer.scene.setObjectsColorized([objId], color);
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1900
|
+
function highlightObject(objId, isHighlight) {
|
|
1901
|
+
viewer.scene.setObjectsHighlighted([objId], isHighlight);
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
function setOpacityObject(objId, opacity) {
|
|
1905
|
+
viewer.scene.setObjectsOpacity([objId], opacity);
|
|
1906
|
+
}
|
|
1907
|
+
|
|
1908
|
+
function goToObject(objId) {
|
|
1909
|
+
const scene = viewer.scene;
|
|
1910
|
+
var entity = viewer.scene.objects[objId];
|
|
1911
|
+
viewer.scene.setObjectsSelected(viewer.scene.selectedObjectIds, false);
|
|
1912
|
+
|
|
1913
|
+
if(entity) {
|
|
1914
|
+
entity.selected = true;
|
|
1915
|
+
viewer.cameraFlight.flyTo(entity);
|
|
1916
|
+
}
|
|
1917
|
+
}
|
|
1918
|
+
|
|
1919
|
+
function ViewFitAll(viewer) {
|
|
1920
|
+
viewer.cameraFlight.flyTo({
|
|
1921
|
+
projection: "perspective",
|
|
1922
|
+
aabb: viewer.scene.getAABB({}),
|
|
1923
|
+
duration: 0.5
|
|
1924
|
+
});
|
|
1925
|
+
}
|
|
1926
|
+
|
|
1927
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1928
|
+
// Distance Measurements Plugin
|
|
1929
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1930
|
+
const distanceMeasurements = new DistanceMeasurementsPlugin(viewer);
|
|
1931
|
+
|
|
1932
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1933
|
+
// Preload Distance Measurements
|
|
1934
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1935
|
+
function createDistanceMeasurements(distanceMeasurementsData) {
|
|
1936
|
+
var angleMeasurements = [];
|
|
1937
|
+
$.each(distanceMeasurementsData,function(index,value){
|
|
1938
|
+
angleMeasurements.push(createDistanceMeasurementItem(value));
|
|
1939
|
+
});
|
|
1940
|
+
|
|
1941
|
+
return angleMeasurements;
|
|
1942
|
+
}
|
|
1943
|
+
|
|
1944
|
+
function createDistanceMeasurementItem(measurement) {
|
|
1945
|
+
distanceMeasurements.createMeasurement({
|
|
1946
|
+
id: measurement.id, // TODO
|
|
1947
|
+
origin: {
|
|
1948
|
+
entity: viewer.scene.objects[measurement.origin.entity],
|
|
1949
|
+
worldPos: measurement.origin.worldPos
|
|
1950
|
+
},
|
|
1951
|
+
target: {
|
|
1952
|
+
entity: viewer.scene.objects[measurement.target.entity],
|
|
1953
|
+
worldPos: measurement.target.worldPos
|
|
1954
|
+
},
|
|
1955
|
+
visible: measurement.visible,
|
|
1956
|
+
wireVisible: measurement.wireVisible
|
|
1957
|
+
});
|
|
1958
|
+
}
|
|
1959
|
+
|
|
1960
|
+
|
|
1961
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1962
|
+
// Distance Measurements by Click
|
|
1963
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
1964
|
+
|
|
1965
|
+
function bindBtnCreateDistanceMeasurements() {
|
|
1966
|
+
$(document).on('click', '#btnCreateDistanceMeasurements', function() {
|
|
1967
|
+
$(this).toggleClass('toggled');
|
|
1968
|
+
|
|
1969
|
+
if($(this).hasClass('toggled')) {
|
|
1970
|
+
$('#btnCreateNotes').removeClass('toggled');
|
|
1971
|
+
annotationByClick = false;
|
|
1972
|
+
|
|
1973
|
+
$('#btnCreateSectionPlan').removeClass('toggled');
|
|
1974
|
+
disableSectionPlanByClick();
|
|
1975
|
+
disableAngleMeasurementsByClick();
|
|
1976
|
+
|
|
1977
|
+
enableDistanceMeasurements();
|
|
1978
|
+
$('#btnToggleDistanceMeasurements').removeClass('toggled');
|
|
1979
|
+
|
|
1980
|
+
enableDistanceMeasurementsByClick();
|
|
1981
|
+
|
|
1982
|
+
} else {
|
|
1983
|
+
disableDistanceMeasurementsByClick();
|
|
1984
|
+
}
|
|
1985
|
+
});
|
|
1986
|
+
}
|
|
1987
|
+
|
|
1988
|
+
function enableDistanceMeasurementsByClick() {
|
|
1989
|
+
distanceMeasurementsByClick = true;
|
|
1990
|
+
distanceMeasurements.control.activate();
|
|
1991
|
+
}
|
|
1992
|
+
|
|
1993
|
+
function disableDistanceMeasurementsByClick() {
|
|
1994
|
+
distanceMeasurements.control.deactivate();
|
|
1995
|
+
distanceMeasurementsByClick = false;
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
function bindBtnToggleDistanceMeasurements() {
|
|
1999
|
+
$(document).on('click', '#btnToggleDistanceMeasurements', function() {
|
|
2000
|
+
$(this).toggleClass('toggled');
|
|
2001
|
+
|
|
2002
|
+
if($(this).hasClass('toggled')) {
|
|
2003
|
+
$('#btnCreateDistanceMeasurements').removeClass('toggled');
|
|
2004
|
+
disableDistanceMeasurementsByClick();
|
|
2005
|
+
disableDistanceMeasurements();
|
|
2006
|
+
} else {
|
|
2007
|
+
enableDistanceMeasurements();
|
|
2008
|
+
}
|
|
2009
|
+
});
|
|
2010
|
+
}
|
|
2011
|
+
|
|
2012
|
+
function enableDistanceMeasurements() {
|
|
2013
|
+
$.each(distanceMeasurements.measurements, function(index) {
|
|
2014
|
+
this.visible = true;
|
|
2015
|
+
});
|
|
2016
|
+
}
|
|
2017
|
+
|
|
2018
|
+
function disableDistanceMeasurements() {
|
|
2019
|
+
$.each(distanceMeasurements.measurements, function(index) {
|
|
2020
|
+
this.visible = false;
|
|
2021
|
+
});
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2024
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2025
|
+
// PropertySets
|
|
2026
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2027
|
+
function showPropertyInspector(pickResult) {
|
|
2028
|
+
var metaObject;
|
|
2029
|
+
var model = getPickResultModel(pickResult);
|
|
2030
|
+
var objectId = pickResult.entity.id;
|
|
2031
|
+
|
|
2032
|
+
if (model && model.customMeta) {
|
|
2033
|
+
|
|
2034
|
+
|
|
2035
|
+
if (model.customMeta[objectId]) {
|
|
2036
|
+
metaObject = window.model.customMeta[objectId];
|
|
2037
|
+
} else if (pickResult.entity._parentNode && pickResult.entity._parentNode.id && model.customMeta[pickResult.entity._parentNode.id]) {
|
|
2038
|
+
metaObject = window.model.customMeta[pickResult.entity._parentNode.id];
|
|
2039
|
+
}
|
|
2040
|
+
|
|
2041
|
+
if(metaObject) {
|
|
2042
|
+
setPropertySets(metaObject, model.dictionaryName);
|
|
2043
|
+
} else {
|
|
2044
|
+
return false;
|
|
2045
|
+
}
|
|
2046
|
+
} else {
|
|
2047
|
+
setPropertyBDSets(pickResult.entity.id, model.fileVersion);
|
|
2048
|
+
|
|
2049
|
+
return false;
|
|
2050
|
+
}
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
function getPickResultModel(pickResult) {
|
|
2054
|
+
var modelId = getPickResultModelId(pickResult);
|
|
2055
|
+
if (modelId) {
|
|
2056
|
+
if (window.model.id == modelId) {
|
|
2057
|
+
return window.model;
|
|
2058
|
+
} else if (window.model2 && window.model2.id == modelId) {
|
|
2059
|
+
return window.model2;
|
|
2060
|
+
} else {
|
|
2061
|
+
return false;
|
|
2062
|
+
}
|
|
2063
|
+
} else {
|
|
2064
|
+
return false;
|
|
2065
|
+
}
|
|
2066
|
+
}
|
|
2067
|
+
|
|
2068
|
+
function getPickResultModelId(pickResult) {
|
|
2069
|
+
if (pickResult.entity.model && pickResult.entity.model.id) {
|
|
2070
|
+
return pickResult.entity.model.id;
|
|
2071
|
+
} else if(pickResult.entity._owner && pickResult.entity._owner.id) {
|
|
2072
|
+
return pickResult.entity._owner.id;
|
|
2073
|
+
} else {
|
|
2074
|
+
return false;
|
|
2075
|
+
}
|
|
2076
|
+
}
|
|
2077
|
+
|
|
2078
|
+
function setPropertyBDSets(id, version) {
|
|
2079
|
+
const html = [];
|
|
2080
|
+
|
|
2081
|
+
html.push('<div class="element-attributes">');
|
|
2082
|
+
html.push('</div>');
|
|
2083
|
+
|
|
2084
|
+
BIMModel.GetPropertyList(id,
|
|
2085
|
+
(propertySets) => {
|
|
2086
|
+
addPropertySet(propertySets, html);
|
|
2087
|
+
});
|
|
2088
|
+
|
|
2089
|
+
|
|
2090
|
+
$('#propInspector .prop-inspector-content')[0].innerHTML = html.join("");
|
|
2091
|
+
$('.xeokit-accordion-container').accordion({
|
|
2092
|
+
collapsible: true,
|
|
2093
|
+
heightStyle: "content"
|
|
2094
|
+
});
|
|
2095
|
+
$('#propInspector').show();
|
|
2096
|
+
}
|
|
2097
|
+
|
|
2098
|
+
function addPropertySet(propertySets, html)
|
|
2099
|
+
{
|
|
2100
|
+
if(!propertySets || propertySets.length == 0){
|
|
2101
|
+
html.push('<p class="subtitle">No properties sets found.</p>');
|
|
2102
|
+
}
|
|
2103
|
+
else{
|
|
2104
|
+
html.push('<div class="xeokit-accordion">');
|
|
2105
|
+
for (let i = 0, len = propertySets.length; i < len; i++) {
|
|
2106
|
+
const propertySet = propertySets[i];
|
|
2107
|
+
const properties = propertySet.properties || propertySet.p || [];
|
|
2108
|
+
if (properties.length > 0) {
|
|
2109
|
+
html.push('<div class="xeokit-accordion-container">' +
|
|
2110
|
+
'<h3><span>' + (propertySet.name ? propertySet.name : propertySet.propertySetName) + '</span></h3>' +
|
|
2111
|
+
'<div class="xeokit-accordion-panel">' +
|
|
2112
|
+
'<table class="xeokit-table"><tbody>'
|
|
2113
|
+
);
|
|
2114
|
+
for (let i = 0, len = properties.length; i < len; i++) {
|
|
2115
|
+
const property = properties[i];
|
|
2116
|
+
html.push('<tr><td class="td1">' + (property.Name || property.name || property.label) + ':</td><td class="td2">' + (property.v || property.Value || property.value ) + '</td></tr>');
|
|
2117
|
+
}
|
|
2118
|
+
html.push('</tbody></table>' +
|
|
2119
|
+
'</div>' +
|
|
2120
|
+
'</div>');
|
|
2121
|
+
} else {
|
|
2122
|
+
html.push('<p class="subtitle">No properties sets found.</p>');
|
|
2123
|
+
}
|
|
2124
|
+
}
|
|
2125
|
+
html.push('</div>');
|
|
2126
|
+
}
|
|
2127
|
+
$('#propInspector .prop-inspector-content')[0].innerHTML = html.join("");
|
|
2128
|
+
$('.xeokit-accordion-container').accordion({
|
|
2129
|
+
collapsible: true,
|
|
2130
|
+
heightStyle: "content"
|
|
2131
|
+
});
|
|
2132
|
+
$('#propInspector').show();
|
|
2133
|
+
}
|
|
2134
|
+
function setPropertySets(metaObject, dictionaryName = []) {
|
|
2135
|
+
const html = [];
|
|
2136
|
+
var propertySets = metaObject.propertySets || metaObject.ps;
|
|
2137
|
+
|
|
2138
|
+
html.push('<div class="element-attributes">');
|
|
2139
|
+
if (!metaObject) {
|
|
2140
|
+
html.push('<p class="subsubtitle">No object selected</p>');
|
|
2141
|
+
} else {
|
|
2142
|
+
html.push('<table class="xeokit-table">');
|
|
2143
|
+
html.push('<tr><td class="td1">Name:</td><td class="td2">' + metaObject.name + '</td></tr>');
|
|
2144
|
+
if (metaObject.type) {
|
|
2145
|
+
html.push('<tr><td class="td1">Class:</td><td class="td2">' + metaObject.type + '</td></tr>');
|
|
2146
|
+
}
|
|
2147
|
+
html.push('<tr><td class="td1">UUID:</td><td class="td2">' + metaObject.id + '</td></tr>');
|
|
2148
|
+
html.push('</table>');
|
|
2149
|
+
|
|
2150
|
+
addPropertySet(propertySets, html);
|
|
2151
|
+
}
|
|
2152
|
+
$('#propInspector .prop-inspector-content')[0].innerHTML = html.join("");
|
|
2153
|
+
$('.xeokit-accordion-container').accordion({
|
|
2154
|
+
collapsible: true,
|
|
2155
|
+
heightStyle: "content"
|
|
2156
|
+
});
|
|
2157
|
+
$('#propInspector').show();
|
|
2158
|
+
}
|
|
2159
|
+
|
|
2160
|
+
function bindPropInspectorClose() {
|
|
2161
|
+
$('.prop-inspector-close').on('click', function() {
|
|
2162
|
+
$('#propInspector').hide();
|
|
2163
|
+
})
|
|
2164
|
+
}
|
|
2165
|
+
|
|
2166
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2167
|
+
// PropertySets resizable
|
|
2168
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2169
|
+
function initPropertySetsResizable() {
|
|
2170
|
+
$('#propInspector').resizable({
|
|
2171
|
+
handles: "w",
|
|
2172
|
+
minWidth: 150
|
|
2173
|
+
});
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2177
|
+
//
|
|
2178
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2179
|
+
|
|
2180
|
+
BIMCommon.GetFileItem = (callback) => {
|
|
2181
|
+
|
|
2182
|
+
const item = {
|
|
2183
|
+
ModelPath: context.filePath,
|
|
2184
|
+
SiteId: context.file.siteId,
|
|
2185
|
+
ListId: context.file.listId,
|
|
2186
|
+
UniqueId: context.file.id,
|
|
2187
|
+
FileVersionList: [],
|
|
2188
|
+
Path: context.filePath,
|
|
2189
|
+
...context.file
|
|
2190
|
+
};
|
|
2191
|
+
|
|
2192
|
+
if (callback) {
|
|
2193
|
+
callback(item);
|
|
2194
|
+
}
|
|
2195
|
+
}
|
|
2196
|
+
|
|
2197
|
+
BIMCommon.CreateWebServerUrl = () => {
|
|
2198
|
+
return 'http://79.143.70.197/Design';
|
|
2199
|
+
};
|
|
2200
|
+
|
|
2201
|
+
BIMAnnotation.GetNote = (callback) => {
|
|
2202
|
+
callback([]);
|
|
2203
|
+
}
|
|
2204
|
+
|
|
2205
|
+
BIMModel.GetParentIdList = (elementId, recurse, isGeometry, callback) => {
|
|
2206
|
+
context.getParentIdList(elementId).then(res => {
|
|
2207
|
+
if (callback) {
|
|
2208
|
+
callback(res);
|
|
2209
|
+
}
|
|
2210
|
+
})
|
|
2211
|
+
}
|
|
2212
|
+
|
|
2213
|
+
BIMModel.GetPropertyList = (elementId, callback) => {
|
|
2214
|
+
|
|
2215
|
+
const getValue = (property) => {
|
|
2216
|
+
if (property.ValueBool != null && property.ValueBool != undefined) {
|
|
2217
|
+
return property.ValueBool;
|
|
2218
|
+
}
|
|
2219
|
+
else if (property.ValueInt != null && property.ValueInt != undefined) {
|
|
2220
|
+
return property.ValueInt;
|
|
2221
|
+
}
|
|
2222
|
+
else if (property.ValueText != null && property.ValueText != undefined) {
|
|
2223
|
+
return property.ValueText;
|
|
2224
|
+
}
|
|
2225
|
+
else if (property.ValueReal != null && property.ValueReal != undefined) {
|
|
2226
|
+
return property.ValueReal;
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
|
|
2230
|
+
context.getPropertyList(elementId).then(res => {
|
|
2231
|
+
let groups = [];
|
|
2232
|
+
|
|
2233
|
+
for (let property of res) {
|
|
2234
|
+
let existingGroups = groups.filter(group => group.name == property.GroupName);
|
|
2235
|
+
if (existingGroups.length > 0) {
|
|
2236
|
+
existingGroups[0].properties.push({ name: property.Name, value: getValue(property) });
|
|
2237
|
+
}
|
|
2238
|
+
else {
|
|
2239
|
+
let newGroup = {
|
|
2240
|
+
name: property.GroupName,
|
|
2241
|
+
properties: [],
|
|
2242
|
+
};
|
|
2243
|
+
newGroup.properties.push({ name: property.Name, value: getValue(property) });
|
|
2244
|
+
|
|
2245
|
+
|
|
2246
|
+
groups.push(newGroup);
|
|
2247
|
+
}
|
|
2248
|
+
}
|
|
2249
|
+
|
|
2250
|
+
callback(groups);
|
|
2251
|
+
})
|
|
2252
|
+
}
|
|
2253
|
+
|
|
2254
|
+
BIMModel.GetChildList = (elementId, recurse, isGeometry, callback) => {
|
|
2255
|
+
let data = {
|
|
2256
|
+
recurse: recurse,
|
|
2257
|
+
isGeometry: isGeometry
|
|
2258
|
+
}
|
|
2259
|
+
context.getChildList(elementId, data).then(res => {
|
|
2260
|
+
if (callback) {
|
|
2261
|
+
callback(res);
|
|
2262
|
+
}
|
|
2263
|
+
});
|
|
2264
|
+
}
|
|
2265
|
+
|
|
2266
|
+
BIMModel.GetChildIdList = (elementId, recurse, isGeometry, callback) => {
|
|
2267
|
+
let data = {
|
|
2268
|
+
recurse: recurse,
|
|
2269
|
+
isGeometry: isGeometry
|
|
2270
|
+
};
|
|
2271
|
+
context.getChildIdList(elementId, data).then(res => {
|
|
2272
|
+
if (callback) {
|
|
2273
|
+
callback(res);
|
|
2274
|
+
}
|
|
2275
|
+
});
|
|
2276
|
+
}
|
|
2277
|
+
|
|
2278
|
+
function saveNote(pickResult) {
|
|
2279
|
+
|
|
2280
|
+
}
|
|
2281
|
+
|
|
2282
|
+
function createMarkupData(pickResult) {
|
|
2283
|
+
let markup = {};
|
|
2284
|
+
markup.worldPos = [];
|
|
2285
|
+
markup.worldPos.push(pickResult._worldPos[0]);
|
|
2286
|
+
markup.worldPos.push(pickResult._worldPos[1]);
|
|
2287
|
+
markup.worldPos.push(pickResult._worldPos[2]);
|
|
2288
|
+
|
|
2289
|
+
var eye = viewer.camera.eye;
|
|
2290
|
+
markup.eye = [];
|
|
2291
|
+
markup.eye.push(eye[0]);
|
|
2292
|
+
markup.eye.push(eye[1]);
|
|
2293
|
+
markup.eye.push(eye[2]);
|
|
2294
|
+
|
|
2295
|
+
var look = viewer.camera.look;
|
|
2296
|
+
markup.look = [];
|
|
2297
|
+
markup.look.push(look[0]);
|
|
2298
|
+
markup.look.push(look[1]);
|
|
2299
|
+
markup.look.push(look[2]);
|
|
2300
|
+
|
|
2301
|
+
var up = viewer.camera.up;
|
|
2302
|
+
markup.up = [];
|
|
2303
|
+
markup.up.push(up[0]);
|
|
2304
|
+
markup.up.push(up[1]);
|
|
2305
|
+
markup.up.push(up[2]);
|
|
2306
|
+
|
|
2307
|
+
return markup;
|
|
2308
|
+
}
|
|
2309
|
+
|
|
2310
|
+
function createAnnotationByClick(pickResult) {
|
|
2311
|
+
let data = createMarkupData(pickResult);
|
|
2312
|
+
context.onCreateIssue(data);
|
|
2313
|
+
hidePropInspector();
|
|
2314
|
+
expandSidebarIssueDetail();
|
|
2315
|
+
}
|
|
2316
|
+
|
|
2317
|
+
function bindBtnToggleCreateNotes() {
|
|
2318
|
+
$(document).on('click', '#btnCreateNotes', function () {
|
|
2319
|
+
$(this).toggleClass('toggled');
|
|
2320
|
+
|
|
2321
|
+
if ($(this).hasClass('toggled')) {
|
|
2322
|
+
$('#btnCreateSectionPlan').removeClass('toggled');
|
|
2323
|
+
disableSectionPlanByClick();
|
|
2324
|
+
disableAngleMeasurementsByClick();
|
|
2325
|
+
disableDistanceMeasurementsByClick();
|
|
2326
|
+
showAnnotationMarkers();
|
|
2327
|
+
$('#btnToggleNotes').removeClass('show');
|
|
2328
|
+
collapseSidebarNotes();
|
|
2329
|
+
$('#btnToggleSidebarNotes').removeClass('toggled');
|
|
2330
|
+
annotationByClick = true;
|
|
2331
|
+
} else {
|
|
2332
|
+
annotationByClick = false;
|
|
2333
|
+
}
|
|
2334
|
+
});
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
function bindBtnToggleSidebarNotes() {
|
|
2338
|
+
$(document).on('click', '#btnToggleSidebarNotes', function () {
|
|
2339
|
+
$(this).toggleClass('toggled');
|
|
2340
|
+
|
|
2341
|
+
if ($(this).hasClass('toggled')) {
|
|
2342
|
+
$('#btnCreateNotes').removeClass('toggled');
|
|
2343
|
+
annotationByClick = false;
|
|
2344
|
+
if (!$('.sidebar').is(':visible')) {
|
|
2345
|
+
initSidebarNotes();
|
|
2346
|
+
expandSidebarNotes();
|
|
2347
|
+
}
|
|
2348
|
+
} else {
|
|
2349
|
+
$('#navCubeCanvas').css('right', 10);
|
|
2350
|
+
$('#sectionPlanesOverviewCanvas').css('right', 10);
|
|
2351
|
+
$('.sidebar').hide();
|
|
2352
|
+
$('body').removeClass('sidebar-expanded');
|
|
2353
|
+
}
|
|
2354
|
+
});
|
|
2355
|
+
}
|
|
2356
|
+
|
|
2357
|
+
function expandSidebarNotes() {
|
|
2358
|
+
hidePropInspector();
|
|
2359
|
+
collapseSidebarIssueDetail();
|
|
2360
|
+
|
|
2361
|
+
$('#sidebarWrap').show();
|
|
2362
|
+
$('#navCubeCanvas').css('right', $('#sidebarWrap').width() + 10);
|
|
2363
|
+
$('#sectionPlanesOverviewCanvas').css('right', $('#sidebarWrap').width() + 10);
|
|
2364
|
+
var body = $('body');
|
|
2365
|
+
var bodyScrollWidth = body[0].offsetWidth - body[0].scrollWidth;
|
|
2366
|
+
var vScrollWidth = bodyScrollWidth ? bodyScrollWidth : 0;
|
|
2367
|
+
$('.sidebar').css('right', (vScrollWidth + 'px')).show("slide", { direction: "right" }, 200);
|
|
2368
|
+
body.addClass('sidebar-expanded');
|
|
2369
|
+
}
|
|
2370
|
+
|
|
2371
|
+
function getMarkupData(item) {
|
|
2372
|
+
|
|
2373
|
+
let markup = JSON.parse(item.fieldValueMap.markup);
|
|
2374
|
+
var options = {
|
|
2375
|
+
id: item.fieldValueMap.item_id,
|
|
2376
|
+
creator: item.insUserName,
|
|
2377
|
+
worldPos: markup.worldPos,
|
|
2378
|
+
eye: markup.eye, // need for camera fly on sidebar click
|
|
2379
|
+
look: markup.look, // need for camera fly on sidebar click
|
|
2380
|
+
up: markup.up, // need for camera fly on sidebar click
|
|
2381
|
+
occludable: true,
|
|
2382
|
+
markerShown: true,
|
|
2383
|
+
labelShown: false,
|
|
2384
|
+
version: '',
|
|
2385
|
+
fileVersionPath: '',
|
|
2386
|
+
values: {
|
|
2387
|
+
glyph: item.fieldValueMap.item_id,
|
|
2388
|
+
title: item.fieldValueMap.name,
|
|
2389
|
+
description: item.fieldValueMap.description,
|
|
2390
|
+
markerBGColor: item.fieldValueMap.task_status?.fieldValueMap?.color || '#2d9cdb',
|
|
2391
|
+
imageSrc: ''
|
|
2392
|
+
}
|
|
2393
|
+
};
|
|
2394
|
+
|
|
2395
|
+
if (markup.entity && markup.entity.id) {
|
|
2396
|
+
options.entity = markup.entity.id;
|
|
2397
|
+
}
|
|
2398
|
+
|
|
2399
|
+
return options;
|
|
2400
|
+
}
|
|
2401
|
+
|
|
2402
|
+
function bindUpdatePage() {
|
|
2403
|
+
if (context.deleteIssueEvent) {
|
|
2404
|
+
window.addEventListener(context.deleteIssueEvent, updatePage);
|
|
2405
|
+
}
|
|
2406
|
+
|
|
2407
|
+
if (context.updateIssueEvent) {
|
|
2408
|
+
window.addEventListener(context.updateIssueEvent, updatePage);
|
|
2409
|
+
}
|
|
2410
|
+
}
|
|
2411
|
+
|
|
2412
|
+
bindUpdatePage();
|
|
2413
|
+
|
|
2414
|
+
function updatePage(e) {
|
|
2415
|
+
if (e.type === context.updateIssueEvent) {
|
|
2416
|
+
|
|
2417
|
+
let item = e.detail.itemList[0];
|
|
2418
|
+
let data = getMarkupData(item);
|
|
2419
|
+
annotations.destroyAnnotation(item.fieldValueMap.item_id);
|
|
2420
|
+
createNote(data);
|
|
2421
|
+
|
|
2422
|
+
const itemId = {
|
|
2423
|
+
id: item.id,
|
|
2424
|
+
contentTypeId: item.contentTypeId,
|
|
2425
|
+
listId: item.listId,
|
|
2426
|
+
parentId: item.parentId,
|
|
2427
|
+
siteId: item.siteId
|
|
2428
|
+
};
|
|
2429
|
+
|
|
2430
|
+
let event = new CustomEvent('vitro.item.changed', {
|
|
2431
|
+
detail: {
|
|
2432
|
+
itemIdList: [itemId],
|
|
2433
|
+
listId: item.listId
|
|
2434
|
+
}
|
|
2435
|
+
});
|
|
2436
|
+
window.dispatchEvent(event);
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
if (e.type === context.deleteIssueEvent) {
|
|
2440
|
+
|
|
2441
|
+
let item = e.detail.itemList[0];
|
|
2442
|
+
annotations.destroyAnnotation(item.fieldValueMap.item_id);
|
|
2443
|
+
|
|
2444
|
+
if ($('.sidebar').is(':visible')) {
|
|
2445
|
+
initSidebarNotes();
|
|
2446
|
+
}
|
|
2447
|
+
}
|
|
2448
|
+
}
|
|
2449
|
+
|
|
2450
|
+
function goToNoteMarker(issue) {
|
|
2451
|
+
var annotation = annotations.annotations[issue.id];
|
|
2452
|
+
console.log('annotation', annotation);
|
|
2453
|
+
viewer.cameraFlight.flyTo(annotation);
|
|
2454
|
+
highlightSidebarNote(issue.id);
|
|
2455
|
+
}
|
|
2456
|
+
|
|
2457
|
+
function onIssueShowMoreClick(issue) {
|
|
2458
|
+
const listId = issue.item.listId;
|
|
2459
|
+
const itemId = {
|
|
2460
|
+
id: issue.item.id,
|
|
2461
|
+
contentTypeId: issue.item.contentTypeId,
|
|
2462
|
+
listId: listId,
|
|
2463
|
+
parentId: issue.item.parentId,
|
|
2464
|
+
siteId: issue.item.siteId
|
|
2465
|
+
};
|
|
2466
|
+
|
|
2467
|
+
let event = new CustomEvent('vitro.item.changed', {
|
|
2468
|
+
detail: {
|
|
2469
|
+
itemIdList: [itemId],
|
|
2470
|
+
listId: listId
|
|
2471
|
+
}
|
|
2472
|
+
});
|
|
2473
|
+
window.dispatchEvent(event);
|
|
2474
|
+
collapseSidebarNotes();
|
|
2475
|
+
hidePropInspector();
|
|
2476
|
+
expandSidebarIssueDetail();
|
|
2477
|
+
$('#btnToggleSidebarNotes').removeClass('toggled');
|
|
2478
|
+
}
|
|
2479
|
+
|
|
2480
|
+
function collapseSidebarNotes() {
|
|
2481
|
+
$('#navCubeCanvas').css('right', 10);
|
|
2482
|
+
$('#sectionPlanesOverviewCanvas').css('right', 10);
|
|
2483
|
+
$('.sidebar').hide();
|
|
2484
|
+
$('body').removeClass('sidebar-expanded');
|
|
2485
|
+
}
|
|
2486
|
+
|
|
2487
|
+
function initSidebarNotes() {
|
|
2488
|
+
context.initIssueList(goToNoteMarker, onIssueShowMoreClick);
|
|
2489
|
+
}
|
|
2490
|
+
|
|
2491
|
+
function expandSidebarIssueDetail() {
|
|
2492
|
+
$('#issueDetail').show();
|
|
2493
|
+
$('#navCubeCanvas').css('right', $('#issueDetail').width() + 10);
|
|
2494
|
+
$('#sectionPlanesOverviewCanvas').css('right', $('#issueDetail').width() + 10);
|
|
2495
|
+
$('body').addClass('sidebar-expanded');
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
function collapseSidebarIssueDetail() {
|
|
2499
|
+
$('#issueDetail').hide();
|
|
2500
|
+
$('#navCubeCanvas').css('right', 10);
|
|
2501
|
+
$('#sectionPlanesOverviewCanvas').css('right', 10);
|
|
2502
|
+
$('body').removeClass('sidebar-expanded');
|
|
2503
|
+
}
|
|
2504
|
+
|
|
2505
|
+
function showPropertyInspector(pickResult) {
|
|
2506
|
+
var metaObject;
|
|
2507
|
+
var model = getPickResultModel(pickResult);
|
|
2508
|
+
var objectId = pickResult.entity.id;
|
|
2509
|
+
|
|
2510
|
+
collapseSidebarIssueDetail();
|
|
2511
|
+
collapseSidebarNotes();
|
|
2512
|
+
$('#btnToggleSidebarNotes').removeClass('toggled');
|
|
2513
|
+
|
|
2514
|
+
if (model && model.customMeta) {
|
|
2515
|
+
|
|
2516
|
+
|
|
2517
|
+
if (model.customMeta[objectId]) {
|
|
2518
|
+
metaObject = window.model.customMeta[objectId];
|
|
2519
|
+
} else if (pickResult.entity._parentNode && pickResult.entity._parentNode.id && model.customMeta[pickResult.entity._parentNode.id]) {
|
|
2520
|
+
metaObject = window.model.customMeta[pickResult.entity._parentNode.id];
|
|
2521
|
+
}
|
|
2522
|
+
|
|
2523
|
+
if (metaObject) {
|
|
2524
|
+
setPropertySets(metaObject, model.dictionaryName);
|
|
2525
|
+
} else {
|
|
2526
|
+
return false;
|
|
2527
|
+
}
|
|
2528
|
+
} else {
|
|
2529
|
+
setPropertyBDSets(pickResult.entity.id, model.fileVersion);
|
|
2530
|
+
|
|
2531
|
+
return false;
|
|
2532
|
+
}
|
|
2533
|
+
}
|
|
2534
|
+
|
|
2535
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2536
|
+
// Load Annotations
|
|
2537
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2538
|
+
function loadAnnotations() {
|
|
2539
|
+
context.getIssueList().then(issueList => {
|
|
2540
|
+
issueList.map(issue => {
|
|
2541
|
+
let data = getMarkupData(issue.item);
|
|
2542
|
+
data.entity = viewer.scene.objects[data.entity];
|
|
2543
|
+
annotations.createAnnotation(data);
|
|
2544
|
+
})
|
|
2545
|
+
})
|
|
2546
|
+
}
|
|
2547
|
+
function highlightSidebarNote(noteId) {
|
|
2548
|
+
var noteWrap = $('#vitro-issue-tile-' + noteId);
|
|
2549
|
+
|
|
2550
|
+
if (!noteWrap.position()) {
|
|
2551
|
+
setTimeout(() => {
|
|
2552
|
+
highlightSidebarNote(noteId);
|
|
2553
|
+
}, 500);
|
|
2554
|
+
|
|
2555
|
+
return;
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
doHighlightSidebarNote(noteWrap);
|
|
2559
|
+
}
|
|
2560
|
+
|
|
2561
|
+
function doHighlightSidebarNote(noteWrap) {
|
|
2562
|
+
var sidebarContent = $('.sidebar-content');
|
|
2563
|
+
sidebarContent.children().removeClass('vitro-active');
|
|
2564
|
+
noteWrap.addClass('vitro-active');
|
|
2565
|
+
var sidebarOffsetTop = parseInt(sidebarContent[0].offsetTop);
|
|
2566
|
+
var sidebarScrollTop = parseInt(sidebarContent[0].scrollTop);
|
|
2567
|
+
sidebarContent.animate({
|
|
2568
|
+
scrollTop: noteWrap.position().top - sidebarOffsetTop + sidebarScrollTop
|
|
2569
|
+
}, 1000);
|
|
2570
|
+
}
|
|
2571
|
+
|
|
2572
|
+
function createSidebarNotesItemHeader(noteData) {
|
|
2573
|
+
|
|
2574
|
+
}
|
|
2575
|
+
|
|
2576
|
+
function hidePropInspector() {
|
|
2577
|
+
$('#propInspector').hide();
|
|
2578
|
+
}
|
|
2579
|
+
|
|
2580
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2581
|
+
// Do action wherever we click on an object
|
|
2582
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2583
|
+
|
|
2584
|
+
viewer.scene.input.on("mouseclicked", (coords) => {
|
|
2585
|
+
|
|
2586
|
+
const pickResult = viewer.scene.pick({
|
|
2587
|
+
canvasPos: coords,
|
|
2588
|
+
pickSurface: true, // <<------ This causes picking to find the intersection point on the entity
|
|
2589
|
+
//includeEntities: true,
|
|
2590
|
+
});
|
|
2591
|
+
|
|
2592
|
+
if (pickResult) {
|
|
2593
|
+
if ($('#btnCreateNotes').hasClass('toggled')) {
|
|
2594
|
+
createAnnotationByClick(pickResult);
|
|
2595
|
+
}
|
|
2596
|
+
createSectionPlaneByClick(pickResult);
|
|
2597
|
+
}
|
|
2598
|
+
});
|
|
2599
|
+
|
|
2600
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2601
|
+
// Show Object Properties on Click
|
|
2602
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2603
|
+
viewer.cameraControl.on("picked", (pickResult) => {
|
|
2604
|
+
if (!pickResult.entity) {
|
|
2605
|
+
return;
|
|
2606
|
+
}
|
|
2607
|
+
|
|
2608
|
+
if (pickResult.entity.id && !$('#btnCreateNotes').hasClass('toggled')) {
|
|
2609
|
+
showPropertyInspector(pickResult);
|
|
2610
|
+
}
|
|
2611
|
+
});
|
|
2612
|
+
|
|
2613
|
+
/*viewer.cameraControl.on("pickedNothing", () => {
|
|
2614
|
+
return false;
|
|
2615
|
+
});*/
|
|
2616
|
+
|
|
2617
|
+
//------------------------------------------------------------------------------------------------------------------
|
|
2618
|
+
|
|
2619
|
+
window.viewer = viewer;
|
|
2620
|
+
|
|
2621
|
+
BIMCommon.GetFileItem(function (res) {
|
|
2622
|
+
BIMCommon.FileItem = res;
|
|
2623
|
+
|
|
2624
|
+
var fileItem = BIMCommon.FileItem;
|
|
2625
|
+
|
|
2626
|
+
var versionList = BIMCommon.FileItem.FileVersionList;
|
|
2627
|
+
if (versionList.length == 0) {
|
|
2628
|
+
$('#btnToggleCompare').hide();
|
|
2629
|
+
} else {
|
|
2630
|
+
$('#btnToggleCompare').show();
|
|
2631
|
+
}
|
|
2632
|
+
|
|
2633
|
+
var filePath = fileItem.Path;
|
|
2634
|
+
var fileName = context.file.fieldValueMap?.name;
|
|
2635
|
+
|
|
2636
|
+
document.title += " - " + fileName;
|
|
2637
|
+
|
|
2638
|
+
if (fileItem.FileVersion)
|
|
2639
|
+
{
|
|
2640
|
+
$('#fileVersion').text("[v" + fileItem.FileVersion + "]");
|
|
2641
|
+
}
|
|
2642
|
+
srcModel = fileItem.ModelPath;
|
|
2643
|
+
srcMetaModelData = fileItem.MetaModelDataPath;
|
|
2644
|
+
fileVersion = fileItem.FileVersion;
|
|
2645
|
+
fileVersionPath = filePath;
|
|
2646
|
+
hideXeokitSpinner();
|
|
2647
|
+
doLoadModel();
|
|
2648
|
+
});
|
|
2649
|
+
|
|
2650
|
+
function init() {
|
|
2651
|
+
bindBtnToggleSidebarNotes();
|
|
2652
|
+
bindSidebarNotesClose();
|
|
2653
|
+
bindDeleteNoteEventHandler();
|
|
2654
|
+
|
|
2655
|
+
bindBtnToggleSidebarTreeView();
|
|
2656
|
+
|
|
2657
|
+
fixNotesTextareaBlur();
|
|
2658
|
+
|
|
2659
|
+
bindBtnToggleCreateNotes();
|
|
2660
|
+
bindBtnCreateSectionPlan();
|
|
2661
|
+
bindBtnClearSectionPlan();
|
|
2662
|
+
bindBtnToggleSectionPlan();
|
|
2663
|
+
bindToggleNotes();
|
|
2664
|
+
|
|
2665
|
+
bindBtnCreateAngleMeasurements();
|
|
2666
|
+
bindBtnToggleAngleMeasurements();
|
|
2667
|
+
|
|
2668
|
+
initTreeViewPanelResizable();
|
|
2669
|
+
initSidebarResizable();
|
|
2670
|
+
|
|
2671
|
+
bindBtnToggleSidebarStoreyViews();
|
|
2672
|
+
|
|
2673
|
+
bindBtnSaveBCFViewpointJSON();
|
|
2674
|
+
bindBtnLoadBCFViewpointJSON();
|
|
2675
|
+
|
|
2676
|
+
bindBtnCreateDistanceMeasurements();
|
|
2677
|
+
bindBtnToggleDistanceMeasurements();
|
|
2678
|
+
|
|
2679
|
+
bindPropInspectorClose();
|
|
2680
|
+
initPropertySetsResizable();
|
|
2681
|
+
|
|
2682
|
+
bindBtnCompareOneOverOne();
|
|
2683
|
+
bindBtnCompareSideBySide();
|
|
2684
|
+
bindBtnClearComparison();
|
|
2685
|
+
}
|
|
2686
|
+
|
|
2687
|
+
init();
|
|
2688
|
+
|
|
2689
|
+
var userLocale =
|
|
2690
|
+
navigator.languages && navigator.languages.length
|
|
2691
|
+
? navigator.languages[0]
|
|
2692
|
+
: navigator.language;
|
|
2693
|
+
|
|
2694
|
+
document.webL10n.setLanguage(userLocale, function () {
|
|
2695
|
+
document.webL10n.translate();
|
|
2696
|
+
});
|
|
2697
|
+
}
|