bool BOHUDElement::Initialize(float2 p_position, int2 p_size, HUDAnchor p_anchor)
{
    m_position = p_position;
    m_anchor = p_anchor;
    m_size = p_size;
    m_enabled = true;

    SetRelativePosition(m_anchor);
    return true;
}
Beispiel #2
0
void SceneNode::SetRelativeRotation(float rot)
{
    m_relative.rotation = rot;
    m_absolute.rotation = rot;
    if(m_parent)
    {
        m_absolute.rotation+=m_parent->m_absolute.rotation;
    }
    SetRelativePosition(m_relative.position);
    RotationChanged();
}
void uddTableItemElement::OnEndDrag(const wxPoint& pos)
{
	uddPageElement* pageElement = wxDynamicCast( GetGrandParentShape(), uddPageElement );
	
	wxPoint minPage = pageElement->GetAcceptableRangeMin();
	wxPoint maxPage = pageElement->GetAcceptableRangeMax();
	
	wxPoint minImage( GetAbsolutePosition().x, GetAbsolutePosition().y );
	wxPoint maxImage( minImage.x + GetRectSize().x, minImage.y + GetRectSize().y );
	
	if( minImage.x < minPage.x || minImage.y < minPage.y || 
		maxImage.x > maxPage.x || maxImage.y > maxPage.y )
	{
		wxMessageBox( wxT("Position out of acceptable range!") );
		SetRelativePosition( m_previousAbsolutePosition );
	}
}
Beispiel #4
0
SceneNode::SceneNode(SceneManager* mng, SceneNode* parent)
{
    m_parent=parent;

    m_level=0;
    m_levelReel = this->CalculerLevel();
    m_relative.rotation=0;
    m_relative.scale=sf::Vector2f(1,1);

    m_manager=mng;
    m_manager->AddNodeLevel(m_levelReel, this);
    SetRelativePosition(m_relative.position);
    m_visible=true;
    if(m_parent)
    {
        m_absolute = m_parent->m_absolute;
        m_visible = m_parent->m_visible;
    }
    VisibilityChanged();
}
void VisitorLandsideBehavior::setDestination( const ARCVector3& p ,MobDir emWalk )
{
	//destination is equal to current location
	ASSERT(m_pPerson->getType().GetTypeIndex() != 0);
	
	//carrion that defines relative position should use own relative position
	PaxOnboardBaseBehavior* spCarrionBehavior = m_pPerson->getOnboardBehavior();
	//ASSERT(spCarrionBehavior);
	if (!m_pPerson->m_pGroupInfo->IsFollower())
	{
		PaxVisitor* pVisitor = (PaxVisitor*)m_pPerson;
		Passenger* pOwner = pVisitor->GetOwner();
		if (pOwner && pOwner->GetVisitorItemByType(pVisitor->getType().GetTypeIndex()))//does not separate with passenger
		{
			CGroupLeaderInfo* pGroupLeader = (CGroupLeaderInfo*)(m_pPerson->m_pGroupInfo);
			if (pGroupLeader->isInGroup())//separate with group
			{
				LandsideBaseBehavior* spOwnerBehavior = pOwner->getLandsideBehavior();
				ASSERT(spOwnerBehavior);
				ARCVector3 _OwnerPreLocation = spOwnerBehavior->location;
				ARCVector3 OwnerLocation = spOwnerBehavior->m_ptDestination;

				if (_OwnerPreLocation == OwnerLocation && spOwnerBehavior->getState() != EntryLandside)//can not calculate direction of passenger and current location
				{
					m_ptDestination = p;
					SetFollowerDestination(location,m_ptDestination,Person::m_pRotation);
					return;
				}

				ARCVector3 paxDirection(_OwnerPreLocation, OwnerLocation);
				ARCVector3 paxLogPoint = _OwnerPreLocation;

				Point ptDir(paxDirection[VX],paxDirection[VY],paxDirection[VZ]);
				Point ptCenter(paxLogPoint.n[VX],paxLogPoint.n[VY],paxLogPoint.n[VZ]);

				CNonPaxRelativePosSpec* pNonPaxRelPosSpec = pVisitor->GetTerminal()->GetNonPaxRelativePosSpec();
				ASSERT(pNonPaxRelPosSpec);
				CPoint2008 ptRelatePos;
				ARCVector4 rotation;
				bool bRes = pNonPaxRelPosSpec->GetNonPaxRelatePosition(ptRelatePos, rotation, pVisitor->getType().GetTypeIndex());
				if (bRes)
				{
					Point vectorLat( ptRelatePos.getX(),ptRelatePos.getY(), 0.0);
					double dAngle = GetRotateAngle(emWalk);
					Point dir(paxDirection.n[VX],paxDirection.n[VY],paxDirection.n[VZ]);
					Point ptRotate(paxLogPoint.n[VX],paxLogPoint.n[VY],paxLogPoint.n[VZ]);
					dir.rotate(dAngle);
					dir.Normalize();
					vectorLat.rotate(dir, ptRotate);
					ARCVector3 vectorPt;
					vectorPt.n[VX] = vectorLat.getX();
					vectorPt.n[VY] = vectorLat.getY();
					vectorPt.n[VZ] = paxLogPoint.n[VZ];
					setLocation(vectorPt);

					SetRelativePosition(ptDir,ptCenter,emWalk);
					return;
				}
			}	
		}
		m_ptDestination = p;
		SetFollowerDestination(location,m_ptDestination,Person::m_pRotation);
	}

	//separate with passenger or not in group
	m_ptDestination = p;
	
}
void VisitorLandsideBehavior::writeCurrentLogItem(PaxLandsideBehavior* pOwnerPax,Point _OwnerPreLocation, theVisitorLogNum logNum/* = secondLog*/,MobDir emWalk/* = FORWARD*/)
{
	ASSERT(firstLog == logNum || secondLog == logNum);

	if (pOwnerPax == NULL)
		return;

	Point OwnerLocation;
	OwnerLocation.init(pOwnerPax->getPoint().n[VX],pOwnerPax->getPoint().n[VY],pOwnerPax->getPoint().n[VZ]); 

	if( _OwnerPreLocation == OwnerLocation )return;



	// use vector(_OwnerPreLocation -> OwnerLocation) as passenger direction
	Point paxDirection(_OwnerPreLocation, OwnerLocation);
	Point paxLogPoint = (firstLog == logNum)?_OwnerPreLocation:OwnerLocation;

	CNonPaxRelativePosSpec* pNonPaxRelPosSpec = m_pPerson->GetTerminal()->GetNonPaxRelativePosSpec();
	ASSERT( NULL != pNonPaxRelPosSpec );
	CPoint2008 ptRelatePos;
	ARCVector4 rotation;
	bool bRes = pNonPaxRelPosSpec->GetNonPaxRelatePosition(ptRelatePos, rotation, m_pPerson->getType().GetTypeIndex());
	if (bRes)
	{
		Point vectorLat( ptRelatePos.getX(),ptRelatePos.getY(), 0.0);
		double dAngle = GetRotateAngle(emWalk);
		Point dir(paxDirection);
		dir.rotate(dAngle);
		dir.Normalize();
		vectorLat.rotate(dir, paxLogPoint);

		//	location = vectorLat;
		ARCVector3 vectorPt;
		vectorPt.n[VX] = vectorLat.getX();
		vectorPt.n[VY] = vectorLat.getY();
		vectorPt.n[VZ] = paxLogPoint.getZ();
		setLocation(vectorPt);
		SetRelativePosition(paxDirection,paxLogPoint,emWalk);
	}
	else
	{
		switch( m_pPerson->getType().GetTypeIndex() )
		{
		case 1:	//visitor  // left
			{
				Point vectorLat( paxDirection.perpendicular() );
				vectorLat.length(100.0);
				setLocation(paxLogPoint + vectorLat);
				setDestination(getPoint());
				break;
			}
		case 2:	//checked bag	//front
			{
				paxDirection.length(25.0);//( 150.0 );
				setDestination(paxLogPoint + paxDirection);
				setLocation(paxLogPoint + paxDirection);
				break;
			}
		case 3:	//hand bag	// left
			{
				Point vectorLat( paxDirection.perpendicular() );
				vectorLat.length(20.0);
				setLocation(paxLogPoint + vectorLat);
				setDestination(paxLogPoint + vectorLat);
				break;
			}
		case 4:	//carte		// front
			{
				paxDirection.length( 100.0 );
				setDestination(paxLogPoint + paxDirection);
				setLocation(paxLogPoint + paxDirection);
				break;
			}
		case 6: //dog		//right_front
			{
				Point vectorLat( paxDirection.perpendicular() );
				vectorLat.length(-100.0);
				setDestination(paxLogPoint + vectorLat);
				paxDirection.length( 100.0 );
				setDestination(paxDirection + getDest());
				setLocation(getDest());
				break;
			}
		default: //other visitor
			{
				paxDirection.length(25.0);//( 150.0 );
				setDestination(paxLogPoint + paxDirection);
				setLocation(getDest());
				break;
			}
		}	
		SetFollowerDestination( getPoint(), getDest(), Person::m_pRotation );
	}

}
Beispiel #7
0
void SceneNode::SetRelativePosition(float x, float y)
{
    SetRelativePosition(sf::Vector2f(x,y));
}
void BOHUDElement::SetPosition(float2 p_position)
{
    m_position = p_position;
    SetRelativePosition(m_anchor);
}