예제 #1
0
파일: BotShape.cpp 프로젝트: bruian/AutoBot
//**************************************************
wxRealPoint wxSFBotLineShape::GetSrcPoint()
{
	wxRealPoint pt1, pt2;
	
	wxSFShapeBase* pSrcShape = GetShapeManager()->FindShape(m_nSrcShapeId);
	
	if( pSrcShape && !m_lstPoints.IsEmpty() )
	{
		RealPointList::compatibility_iterator node = m_lstPoints.GetFirst();
		if( node )
		{	
			pt1 = *node->GetData();
			if(pSrcShape->IsKindOf(CLASSINFO(wxSFIfShape)))
			{
				wxSFIfShape *ifShape = (wxSFIfShape *)pSrcShape;
				if(GetCondition() == 1)
					return ifShape->GetBorderPoint(true);
				else
					return ifShape->GetBorderPoint(false);
			}
			else
				return wxRealPoint(pSrcShape->GetBoundingBox().x + pSrcShape->GetBoundingBox().GetWidth() / 2, pSrcShape->GetBoundingBox().GetBottom());
		}
	}
	else
	{
		if( m_nMode != modeUNDERCONSTRUCTION )
			GetDirectLine( pt1, pt2 );
		else
			pt1 = wxRealPoint(pSrcShape->GetBoundingBox().x + pSrcShape->GetBoundingBox().GetWidth() / 2, pSrcShape->GetBoundingBox().GetBottom());
		return pt1;
	}

	return wxRealPoint();
}
예제 #2
0
파일: BotShape.cpp 프로젝트: bruian/AutoBot
//**************************************************
wxRealPoint wxSFBotLineShape::GetTrgPoint()
{
	wxRealPoint pt1, pt2;
	
	wxSFShapeBase* pTrgShape = GetShapeManager()->FindShape(m_nTrgShapeId);
	
	if( pTrgShape && !m_lstPoints.IsEmpty() )
	{
		RealPointList::compatibility_iterator node = m_lstPoints.GetLast();
		if( node )
		{	
			pt2 = *node->GetData();
			wxRect trgBB = pTrgShape->GetBoundingBox();
			return wxRealPoint(trgBB.x + trgBB.GetWidth() / 2, trgBB.GetTop());
		}
	}
	else
	{
		if( m_nMode != modeUNDERCONSTRUCTION )
			GetDirectLine( pt1, pt2 );
		else
			pt2 = Conv2RealPoint( m_nUnfinishedPoint );
			
		return pt2;
	}

	return wxRealPoint();
}
예제 #3
0
wxString xsListRealPointPropIO::ToString(RealPointList value)
{
	wxString out = wxT("[ ");

	RealPointList::compatibility_iterator node = value.GetFirst();
	while( node )
	{
		out << xsRealPointPropIO::ToString(*(wxRealPoint*)node->GetData());
		if( node != value.GetLast() ) out << wxT(" | ");

		node = node->GetNext();
	}

	out << wxT(" ]");

	return out;
}
예제 #4
0
void xsListRealPointPropIO::Write(xsProperty *property, wxXmlNode *target)
{
    RealPointList *list = (RealPointList*)property->m_pSourceVariable;

    if(list->GetCount() > 0)
    {
        wxXmlNode *newNode = new wxXmlNode(wxXML_ELEMENT_NODE, wxT("property"));
		RealPointList::compatibility_iterator listNode = list->GetFirst();
        while(listNode)
        {
            AddPropertyNode(newNode, wxT("item"), xsRealPointPropIO::ToString(*(wxRealPoint*)listNode->GetData()));
            listNode = listNode->GetNext();
        }

        target->AddChild(newNode);
        AppendPropertyType(property, newNode);
    }
}