00001
00032 #include "llviewerprecompiledheaders.h"
00033
00034 #include "llparcelselection.h"
00035
00036 #include "llparcel.h"
00037
00038
00039
00040 LLPointer<LLParcelSelection> LLParcelSelection::sNullSelection;
00041
00042 template<>
00043 const LLSafeHandle<LLParcelSelection>::NullFunc
00044 LLSafeHandle<LLParcelSelection>::sNullFunc = LLParcelSelection::getNullParcelSelection;
00045
00046
00047
00048
00049 LLParcelSelection::LLParcelSelection() :
00050 mParcel(NULL),
00051 mSelectedMultipleOwners(FALSE),
00052 mWholeParcelSelected(FALSE),
00053 mSelectedSelfCount(0),
00054 mSelectedOtherCount(0),
00055 mSelectedPublicCount(0)
00056 {
00057 }
00058
00059 LLParcelSelection::LLParcelSelection(LLParcel* parcel) :
00060 mParcel(parcel),
00061 mSelectedMultipleOwners(FALSE),
00062 mWholeParcelSelected(FALSE),
00063 mSelectedSelfCount(0),
00064 mSelectedOtherCount(0),
00065 mSelectedPublicCount(0)
00066 {
00067 }
00068
00069 LLParcelSelection::~LLParcelSelection()
00070 {
00071 }
00072
00073 BOOL LLParcelSelection::getMultipleOwners() const
00074 {
00075 return mSelectedMultipleOwners;
00076 }
00077
00078
00079 BOOL LLParcelSelection::getWholeParcelSelected() const
00080 {
00081 return mWholeParcelSelected;
00082 }
00083
00084
00085 S32 LLParcelSelection::getClaimableArea() const
00086 {
00087 const S32 UNIT_AREA = S32( PARCEL_GRID_STEP_METERS * PARCEL_GRID_STEP_METERS );
00088 return mSelectedPublicCount * UNIT_AREA;
00089 }
00090
00091 bool LLParcelSelection::hasOthersSelected() const
00092 {
00093 return mSelectedOtherCount != 0;
00094 }
00095
00096
00097 LLParcelSelection* LLParcelSelection::getNullParcelSelection()
00098 {
00099 if (sNullSelection.isNull())
00100 {
00101 sNullSelection = new LLParcelSelection;
00102 }
00103
00104 return sNullSelection;
00105 }