IsoProject.js 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /**
  2. * Copyright (c) 2011-2018 by Andrew Mustun. All rights reserved.
  3. *
  4. * This file is part of the QCAD project.
  5. *
  6. * QCAD is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * QCAD is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with QCAD.
  18. */
  19. include("../IsometricProjection.js");
  20. function IsoProject(guiAction) {
  21. Projection.call(this, guiAction);
  22. this.projection = RS.Top;
  23. this.method = RS.Isometric;
  24. this.setUiOptions("IsoProject.ui");
  25. }
  26. IsoProject.prototype = new Projection();
  27. IsoProject.includeBasePath = includeBasePath;
  28. IsoProject.prototype.initUiOptions = function(resume, optionsToolBar) {
  29. Projection.prototype.initUiOptions.call(this, resume, optionsToolBar);
  30. this.method = RSettings.getIntValue("IsoProject/Method", RS.Isometric);
  31. //var optionsToolBar = EAction.getOptionsToolBar();
  32. var methodCombo = optionsToolBar.findChild("Method");
  33. if (isNull(methodCombo)) {
  34. return;
  35. }
  36. methodCombo.blockSignals(true);
  37. methodCombo.clear();
  38. methodCombo.addItem(qsTr("Isometric"), RS.Isometric);
  39. methodCombo.addItem(qsTr("Isometric True Scale"), RS.IsometricTrue);
  40. methodCombo.addItem(qsTr("Planometric"), RS.Planometric);
  41. methodCombo.addItem(qsTr("Dimetric"), RS.Dimetric);
  42. methodCombo.addItem(qsTr("Cabinet"), RS.Cabinet);
  43. methodCombo.addItem(qsTr("Cabinet") + " 30°", RS.Cabinet30);
  44. methodCombo.addItem(qsTr("Cavalier"), RS.Cavalier);
  45. var n;
  46. n = "%1 (%2/%3)"
  47. .arg(RSettings.getStringValue("IsoProject/User1Name", "User 1"))
  48. .arg(RSettings.getDoubleValue("IsoProject/User1A", 45))
  49. .arg(RSettings.getDoubleValue("IsoProject/User1B", 15));
  50. methodCombo.addItem(n, RS.User1);
  51. n = "%1 (%2/%3)"
  52. .arg(RSettings.getStringValue("IsoProject/User2Name", "User 2"))
  53. .arg(RSettings.getDoubleValue("IsoProject/User2A", 15))
  54. .arg(RSettings.getDoubleValue("IsoProject/User2B", 45));
  55. methodCombo.addItem(n, RS.User2);
  56. n = "%1 (%2/%3)"
  57. .arg(RSettings.getStringValue("IsoProject/User3Name", "User 3"))
  58. .arg(RSettings.getDoubleValue("IsoProject/User3A", 22.5))
  59. .arg(RSettings.getDoubleValue("IsoProject/User3B", 22.5));
  60. methodCombo.addItem(n, RS.User3);
  61. n = "%1 (%2/%3)"
  62. .arg(RSettings.getStringValue("IsoProject/User4Name", "User 4"))
  63. .arg(RSettings.getDoubleValue("IsoProject/User4A", 15))
  64. .arg(RSettings.getDoubleValue("IsoProject/User4B", 15));
  65. methodCombo.addItem(n, RS.User4);
  66. methodCombo.blockSignals(false);
  67. methodCombo.currentIndex = methodCombo.findData(this.method);
  68. };
  69. /**
  70. * Isometric projection of a single coordinate.
  71. */
  72. IsoProject.prototype.project = function(p) {
  73. p.isoProject(this.projection|this.method);
  74. };
  75. IsoProject.prototype.slotMethodChanged = function(v) {
  76. var optionsToolBar = EAction.getOptionsToolBar();
  77. var methodCombo = optionsToolBar.findChild("Method");
  78. this.method = methodCombo.itemData(methodCombo.currentIndex);
  79. //qDebug("method: 0x" + this.method.toString(16));
  80. //qDebug("proj: 0x" + (this.projection|this.method).toString(16));
  81. this.clearCache();
  82. this.updatePreview(true);
  83. };
  84. IsoProject.prototype.slotTopChanged = function() {
  85. this.projection = RS.Top;
  86. this.clearCache();
  87. this.updatePreview(true);
  88. };
  89. IsoProject.prototype.slotBottomChanged = function() {
  90. this.projection = RS.Bottom;
  91. this.clearCache();
  92. this.updatePreview(true);
  93. };
  94. IsoProject.prototype.slotLeftChanged = function() {
  95. this.projection = RS.Left;
  96. this.clearCache();
  97. this.updatePreview(true);
  98. };
  99. IsoProject.prototype.slotLeftBackChanged = function() {
  100. this.projection = RS.LeftBack;
  101. this.clearCache();
  102. this.updatePreview(true);
  103. };
  104. IsoProject.prototype.slotRightChanged = function() {
  105. this.projection = RS.Right;
  106. this.clearCache();
  107. this.updatePreview(true);
  108. };
  109. IsoProject.prototype.slotRightBackChanged = function() {
  110. this.projection = RS.RightBack;
  111. this.clearCache();
  112. this.updatePreview(true);
  113. };
  114. //IsoProject.prototype.slotTrueScaleChanged = function(v) {
  115. // this.trueScale = v;
  116. // this.clearCache();
  117. // this.updatePreview(true);
  118. //};