示例#1
0
const WFMath::Polygon<2> PolygonAdapter::getShape()
{
	if (mPolygon) {
		return mPolygon->getShape();
	}
	auto element = getChangedElement();
	if (element.isMap() || element.isList()) {
		return WFMath::Polygon<2>(element);
	}
	return WFMath::Polygon<2>();
}
示例#2
0
void PolygonAdapter::toggleDisplayOfPolygon()
{
	if (!mPolygon) {
		if (!mEntity) {
			S_LOG_WARNING("There's no entity attached to the PolygonAdapter, and the polygon can't thus be shown.");
		} else {
			//It's important that we do the call to getChangedElement before we create and set mPolygon, since if that's set, the values from there will be used instead of the original atlas values.
			::Atlas::Message::Element areaElem(getChangedElement());

			Ogre::SceneNode* entitySceneNode = getEntitySceneNode();
			if (entitySceneNode) {
				if (areaElem.isMap()) {
					try {
						WFMath::Polygon<2> poly(areaElem);
						createNewPolygon(&poly);
					} catch (const WFMath::_AtlasBadParse& ex) {
						createNewPolygon(0);
					}
				} else {
					createNewPolygon(0);
				}

			}
		}
	} else {
		if (mPickListener) {
			EmberOgre::getSingleton().getWorld()->getMainCamera().removeWorldPickListener(mPickListener);
			try {
				delete mPickListener;
			} catch (const std::exception& ex) {
				S_LOG_FAILURE("Error when deleting polygon point pick listener.");
			}
			mPickListener = 0;
		}
		try {
			delete mPolygon;
		} catch (const std::exception& ex) {
			S_LOG_FAILURE("Error when deleting polygon.");
		}
		mPolygon = 0;
	}
}
bool TerrainModAdapter::_hasChanges()
{
	return mOriginalElement != getChangedElement();
}
示例#4
0
bool PolygonAdapter::_hasChanges()
{
	return mOriginalValue != getChangedElement();
}