PageRenderTime 79ms CodeModel.GetById 72ms app.highlight 4ms RepoModel.GetById 1ms 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
  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
 27#include "llviewerprecompiledheaders.h"
 28
 29#include "llparcelselection.h"
 30
 31#include "llparcel.h"
 32
 33
 34// static
 35LLPointer<LLParcelSelection> LLParcelSelection::sNullSelection;
 36
 37template<>
 38	const LLSafeHandle<LLParcelSelection>::NullFunc
 39		LLSafeHandle<LLParcelSelection>::sNullFunc = LLParcelSelection::getNullParcelSelection;
 40
 41//
 42// LLParcelSelection
 43//
 44LLParcelSelection::LLParcelSelection() :
 45	mParcel(NULL),
 46	mSelectedMultipleOwners(FALSE),
 47	mWholeParcelSelected(FALSE),
 48	mSelectedSelfCount(0),
 49	mSelectedOtherCount(0),
 50	mSelectedPublicCount(0)
 51{
 52}
 53
 54LLParcelSelection::LLParcelSelection(LLParcel* parcel)  :
 55	mParcel(parcel),
 56	mSelectedMultipleOwners(FALSE),
 57	mWholeParcelSelected(FALSE),
 58	mSelectedSelfCount(0),
 59	mSelectedOtherCount(0),
 60	mSelectedPublicCount(0)
 61{
 62}
 63
 64LLParcelSelection::~LLParcelSelection()
 65{
 66}
 67
 68BOOL LLParcelSelection::getMultipleOwners() const
 69{
 70	return mSelectedMultipleOwners;
 71}
 72
 73
 74BOOL LLParcelSelection::getWholeParcelSelected() const
 75{
 76	return mWholeParcelSelected;
 77}
 78
 79
 80S32 LLParcelSelection::getClaimableArea() const
 81{
 82	const S32 UNIT_AREA = S32( PARCEL_GRID_STEP_METERS * PARCEL_GRID_STEP_METERS );
 83	return mSelectedPublicCount * UNIT_AREA;
 84}
 85
 86bool LLParcelSelection::hasOthersSelected() const
 87{
 88	return mSelectedOtherCount != 0;
 89}
 90
 91// static
 92LLParcelSelection* LLParcelSelection::getNullParcelSelection()
 93{
 94	if (sNullSelection.isNull())
 95	{
 96		sNullSelection = new LLParcelSelection;
 97	}
 98
 99	return sNullSelection;
100}