コード例 #1
0
const LLViewerTexLayerSetBuffer* LLViewerTexLayerSet::getViewerComposite() const
{
	return dynamic_cast<const LLViewerTexLayerSetBuffer*> (getComposite());
}
コード例 #2
0
ファイル: label.C プロジェクト: HeyJJ/ball
		String Label::getExpandedText() const
		{
			if (!text_.has('%') || getComposite() == 0)
			{
				return text_;
			}
			
			String result;

			const Atom* atom = dynamic_cast<const Atom*> (getComposite());
			const AtomContainer* ac = dynamic_cast<const AtomContainer*> (getComposite());
			const Residue* residue = dynamic_cast<const Residue*> (getComposite());

			for (Position pos = 0; pos < text_.size(); pos++)
			{
				// normal text
				if (text_[pos] != '%')
				{
					result += text_[pos];
					continue;
				}

				pos++;

				// dont step over the size of the string
				if (pos == text_.size()) break;

				// make it possible to escape %
				if (text_[pos] == '%')
				{
					result += '%';
				}

				// name
				else if (text_[pos] == 'N')
				{
					if (atom) result += atom->getName();
					else 		  result += ac->getName();
				}

				// resiude ID
				else if (text_[pos] == 'I')
				{
					if (residue) result += residue->getID();
					if (atom) 	 result += ((Residue*)atom->getParent())->getID();
				}

				// atom type
				else if (text_[pos] == 'T')
				{
					if (atom) result += String(atom->getType());
				}

				// atom charge
				else if (text_[pos] == 'C')
				{
					if (atom)
					{
						String charge(atom->getCharge());
						charge.trimRight("0");
						if (charge.hasSuffix(".")) charge += '0';
						result += charge;
					}
				}

				// element
				else if (text_[pos] == 'E')
				{
					if (atom)
					{
						result += atom->getElement().getSymbol();
					}
				}
				
				// type name
				else if (text_[pos] == 'Y')
				{
					if (atom)
					{
						result += atom->getTypeName();
					}
				}
			} // for

			return result;
		} // getExpandedText