Advertisement
Guest User

Untitled

a guest
Oct 13th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. /*!
  2. * (c) Copyright 2017, Kongsberg Geospatial Ltd.
  3. *
  4. * THIS SOFTWARE IS PROVIDED "AS IS", "WHERE IS" AND "AS AVAILABLE", WITHOUT
  5. * ANY EXPRESS OR IMPLIED WARRANTIES OR CONDITIONS OR GUARANTEES. THE USER
  6. * ASSUMES ALL RISK IN THE USE OF THIS SOFTWARE, INCLUDING COPYRIGHT
  7. * INFRINGEMENT, PATENT INFRINGEMENT, SUITABILITY, ETC. KONGSBERG GEOSPATIAL
  8. * LTD. EXPRESSLY DISCLAIMS ALL EXPRESS, IMPLIED OR STATUTORY WARRANTIES
  9. * OR CONDITIONS, INCLUDING WITHOUT LIMITATION, WARRANTIES OR CONDITIONS OF
  10. * MERCHANTABILITY, MERCHANTABLE QUALITY OR FITNESS FOR A PARTICULAR PURPOSE,
  11. * OR ANY WARRANTY OF TITLE OR NON-INFRINGEMENT, OR THAT THE WORK (OR ANY
  12. * PORTION THEREOF) IS CORRECT, USEFUL, BUG-FREE OR FREE OF VIRUSES.
  13. *
  14. * User agrees to defend, indemnify and hold harmless Kongsberg Geospatial Ltd.
  15. * from and against any claims, suits, losses, damages, liabilities, costs,
  16. * and expenses (including reasonable legal or attorneys' fees) resulting from
  17. * or relating to any use of this software. EXCEPT TO THE EXTENT REQUIRED BY
  18. * APPLICABLE LAW, IN NO EVENT WILL KONGSBERG GEOSPATIAL LTD. BE LIABLE TO THE
  19. * USER UNDER ANY LEGAL THEORY FOR ANY SPECIAL, INCIDENTAL, CONSEQUENTIAL,
  20. * PUNITIVE OR EXEMPLARY DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE OR
  21. * OTHERWISE, EVEN IF KONGSBERG GEOSPATIAL LTD. HAS BEEN ADVISED OF THE
  22. * POSSIBILITY OF SUCH DAMAGES.
  23. *
  24. * This is commercial software not to be released to the open source community.
  25. *
  26. */
  27.  
  28. import QtQuick 2.5
  29. import QtQuick.Controls 1.3
  30. import QtQuick.Layouts 1.0
  31. import QtQuick.Window 2.2
  32.  
  33.  
  34. Rectangle
  35. {
  36. id: mainWindow
  37. anchors.fill: parent
  38.  
  39. Window {
  40. width: magnifier.width;
  41. height: magnifier.height;
  42. id: wnd
  43.  
  44. Rectangle {
  45. id: newWindow
  46. anchors.fill: parent
  47. }
  48.  
  49. onClosing: {
  50. viewportItem.state = "docked"
  51. }
  52. }
  53.  
  54. Viewport2DItem
  55. {
  56. id: viewportItem
  57. anchors.fill: parent
  58. clip: true
  59. isActive: isActive
  60. viewportId: viewportIdentifier
  61. associatedViewportId: magnifier.viewportId
  62. z:100
  63. states: [
  64. State {
  65. name: "undocked"
  66. ParentChange { target: viewportItem; parent: newWindow; x: 10; y: 10 }
  67. },
  68. State {
  69. name: "docked"
  70. ParentChange { target: viewportItem; parent: mainWindow; x: 10; y: 10 }
  71.  
  72. }
  73. ]
  74.  
  75. MouseArea {
  76. anchors.fill: parent
  77. acceptedButtons: Qt.MiddleButton
  78.  
  79. onClicked: {
  80. if( viewportItem.state == "docked" )
  81. {
  82. viewportItem.state = "undocked"
  83. wnd.visible = true
  84. viewportItem.parentState = 3;
  85. }
  86. else
  87. {
  88. viewportItem.state = "docked"
  89. wnd.visible = false
  90. viewportItem.parentState = 2;
  91. }
  92. }
  93. }
  94.  
  95. ViewSidePanel
  96. {
  97. id: viewSidePanel
  98. viewportId: viewportItem.viewportId
  99.  
  100. property bool controlsVisible: ( isActive && !editModeActive )
  101. visible: controlsVisible
  102.  
  103. onControlsVisibleChanged:
  104. {
  105. if( contentPanel.showing && !controlsVisible )
  106. {
  107. contentPanel.showing = false
  108. }
  109. }
  110.  
  111. anchors.left: parent.left
  112. anchors.top: parent.top
  113. anchors.bottom: parent.bottom
  114. z: 0
  115. }
  116.  
  117. SidePanel
  118. {
  119. id: sidePanel
  120. anchors.fill: parent
  121. z: 20000
  122. viewportId: viewportItem.viewportId
  123. }
  124.  
  125. // This is the magnifier frame
  126. Magnifier
  127. {
  128. id : magnifier
  129. viewportId: viewportItem.viewportId + "Mag"
  130. associatedViewportId: viewportItem.viewportId
  131. visible: viewportItem.magnifierEnabled
  132. isActive: viewportItem.isActive
  133.  
  134. // define the size of the magnifier viewport
  135. width : 400
  136. height : 400
  137.  
  138. // define the position of the magnifier viewport
  139. // We place the magnifier window halfway down the right side
  140. y: (parent.height / 2) - (height / 2)
  141. anchors.right: parent.right
  142.  
  143. }
  144.  
  145. }//Viewport2DItem
  146.  
  147. }//Main Window
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement