PageRenderTime 25ms CodeModel.GetById 10ms RepoModel.GetById 0ms app.codeStats 0ms

/indra/newview/llparcelselection.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 100 lines | 53 code | 17 blank | 30 comment | 2 complexity | 806f77f32e02adcdb87851fae7740368 MD5 | raw file
Possible License(s): LGPL-2.1
  1. /**
  2. * @file llparcelselection.cpp
  3. * @brief Information about the currently selected parcel
  4. *
  5. * $LicenseInfo:firstyear=2007&license=viewerlgpl$
  6. * Second Life Viewer Source Code
  7. * Copyright (C) 2010, Linden Research, Inc.
  8. *
  9. * This library is free software; you can redistribute it and/or
  10. * modify it under the terms of the GNU Lesser General Public
  11. * License as published by the Free Software Foundation;
  12. * version 2.1 of the License only.
  13. *
  14. * This library is distributed in the hope that it will be useful,
  15. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  16. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  17. * Lesser General Public License for more details.
  18. *
  19. * You should have received a copy of the GNU Lesser General Public
  20. * License along with this library; if not, write to the Free Software
  21. * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  22. *
  23. * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA
  24. * $/LicenseInfo$
  25. */
  26. #include "llviewerprecompiledheaders.h"
  27. #include "llparcelselection.h"
  28. #include "llparcel.h"
  29. // static
  30. LLPointer<LLParcelSelection> LLParcelSelection::sNullSelection;
  31. template<>
  32. const LLSafeHandle<LLParcelSelection>::NullFunc
  33. LLSafeHandle<LLParcelSelection>::sNullFunc = LLParcelSelection::getNullParcelSelection;
  34. //
  35. // LLParcelSelection
  36. //
  37. LLParcelSelection::LLParcelSelection() :
  38. mParcel(NULL),
  39. mSelectedMultipleOwners(FALSE),
  40. mWholeParcelSelected(FALSE),
  41. mSelectedSelfCount(0),
  42. mSelectedOtherCount(0),
  43. mSelectedPublicCount(0)
  44. {
  45. }
  46. LLParcelSelection::LLParcelSelection(LLParcel* parcel) :
  47. mParcel(parcel),
  48. mSelectedMultipleOwners(FALSE),
  49. mWholeParcelSelected(FALSE),
  50. mSelectedSelfCount(0),
  51. mSelectedOtherCount(0),
  52. mSelectedPublicCount(0)
  53. {
  54. }
  55. LLParcelSelection::~LLParcelSelection()
  56. {
  57. }
  58. BOOL LLParcelSelection::getMultipleOwners() const
  59. {
  60. return mSelectedMultipleOwners;
  61. }
  62. BOOL LLParcelSelection::getWholeParcelSelected() const
  63. {
  64. return mWholeParcelSelected;
  65. }
  66. S32 LLParcelSelection::getClaimableArea() const
  67. {
  68. const S32 UNIT_AREA = S32( PARCEL_GRID_STEP_METERS * PARCEL_GRID_STEP_METERS );
  69. return mSelectedPublicCount * UNIT_AREA;
  70. }
  71. bool LLParcelSelection::hasOthersSelected() const
  72. {
  73. return mSelectedOtherCount != 0;
  74. }
  75. // static
  76. LLParcelSelection* LLParcelSelection::getNullParcelSelection()
  77. {
  78. if (sNullSelection.isNull())
  79. {
  80. sNullSelection = new LLParcelSelection;
  81. }
  82. return sNullSelection;
  83. }