Exemple #1
0
		DrawableLine* XmlBuilder::CreateDrawableLine(
			XMLNode& node,
			const Registry<JourneyPattern>& lines
		){
			// assert ("drawableLine" == node.getName ());

			util::RegistryKeyType lineId (GetLongLongAttr (node, "lineId"));

			boost::shared_ptr<const JourneyPattern> line = lines.get (lineId);

			const vector<Edge*>& lineStops = line->getEdges ();

			assert (lineStops.size () >= 2);

			int fromLineStopIndex (GetIntAttr (node, "fromLineStopId", 0));
			int toLineStopIndex (GetIntAttr (node, "toLineStopId", (int) lineStops.size () - 1));

			bool withPhysicalStops (GetBoolAttr (node, "withPhysicalStops", false));

			return new DrawableLine(
				line.get(),
				fromLineStopIndex,
				toLineStopIndex,
				withPhysicalStops
			);
		}
// Unbreakable flag
BOOL Obj_Character::IsUnbreakable(VOID)
{
	if(TRUE==GetUnbreakableDirtyFlag())
	{
		BOOL bValue = FALSE;//default value should be FALSE
		if(TRUE==Impact_GetBoolAttrRefix(CharBoolAttrs_T::ATTR_UNBREAKABLE, bValue))
		{
			SetBoolAttr(CharBoolAttrs_T::ATTR_UNBREAKABLE, bValue);
		}
		else
		{
			SetBoolAttr(CharBoolAttrs_T::ATTR_UNBREAKABLE, FALSE);//default value should be FALSE
		}
		ClearUnbreakableDirtyFlag();
	}
	return GetBoolAttr(CharBoolAttrs_T::ATTR_UNBREAKABLE);
}
// Can Action flag 2
BOOL Obj_Character::CanActionFlag2(VOID)
{
	if(TRUE==GetCanAction2DirtyFlag())
	{
		BOOL bValue = TRUE;
		if(TRUE==Impact_GetBoolAttrRefix(CharBoolAttrs_T::ATTR_CAN_ACTION2, bValue))
		{
			SetBoolAttr(CharBoolAttrs_T::ATTR_CAN_ACTION2, bValue);
		}
		else
		{
			SetBoolAttr(CharBoolAttrs_T::ATTR_CAN_ACTION2, TRUE);
		}
		ClearCanAction2DirtyFlag();
	}
	return GetBoolAttr(CharBoolAttrs_T::ATTR_CAN_ACTION2);
}
// Can move flag
BOOL Obj_Character::CanMove(VOID)
{
	if(TRUE==GetCanMoveDirtyFlag())
	{
		BOOL bValue = TRUE;
		if(TRUE==Impact_GetBoolAttrRefix(CharBoolAttrs_T::ATTR_CAN_MOVE, bValue))
		{
			SetBoolAttr(CharBoolAttrs_T::ATTR_CAN_MOVE, bValue);
		}
		else
		{
			SetBoolAttr(CharBoolAttrs_T::ATTR_CAN_MOVE, TRUE);
		}
		ClearCanMoveDirtyFlag();
	}
	return GetBoolAttr(CharBoolAttrs_T::ATTR_CAN_MOVE);
}
//Alive flag
BOOL Obj_Character::IsAlive(VOID)
{
	if(0>=GetHP())
	{
		return FALSE;
	}
	if(TRUE==GetAliveDirtyFlag())
	{
		BOOL bValue = TRUE;
		if(TRUE==Impact_GetBoolAttrRefix(CharBoolAttrs_T::ATTR_ALIVE, bValue))
		{
			SetBoolAttr(CharBoolAttrs_T::ATTR_ALIVE, bValue);
		}
		else
		{
			SetBoolAttr(CharBoolAttrs_T::ATTR_ALIVE, TRUE);
		}
		ClearAliveDirtyFlag();
	}
	return GetBoolAttr(CharBoolAttrs_T::ATTR_ALIVE);
}
Exemple #6
0
wxObject *wxRadioBoxXmlHandler::DoCreateResource()
{
    if ( m_class == wxT("wxRadioBox"))
    {
        // find the selection
        long selection = GetLong( wxT("selection"), -1 );

        // need to build the list of strings from children
        m_insideBox = true;
        CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));

        XRC_MAKE_INSTANCE(control, wxRadioBox)

        control->Create(m_parentAsWindow,
                        GetID(),
                        GetText(wxT("label")),
                        GetPosition(), GetSize(),
                        m_labels,
                        GetLong(wxT("dimension"), 1),
                        GetStyle(),
                        wxDefaultValidator,
                        GetName());

        if (selection != -1)
            control->SetSelection(selection);

        SetupWindow(control);

        const unsigned count = m_labels.size();
        for( unsigned i = 0; i < count; i++ )
        {
#if wxUSE_TOOLTIPS
            if ( !m_tooltips[i].empty() )
                control->SetItemToolTip(i, m_tooltips[i]);
#endif // wxUSE_TOOLTIPS
#if wxUSE_HELP
            if ( m_helptextSpecified[i] )
                control->SetItemHelpText(i, m_helptexts[i]);
#endif // wxUSE_HELP

            if ( !m_isShown[i] )
                control->Show(i, false);
            if ( !m_isEnabled[i] )
                control->Enable(i, false);
        }


        // forget information about the items of this radiobox, we should start
        // afresh for the next one
        m_labels.clear();

#if wxUSE_TOOLTIPS
        m_tooltips.clear();
#endif // wxUSE_TOOLTIPS

#if wxUSE_HELP
        m_helptexts.clear();
        m_helptextSpecified.clear();
#endif // wxUSE_HELP

        m_isShown.clear();
        m_isEnabled.clear();

        return control;
    }
    else // inside the radiobox element
    {
        // we handle handle <item>Label</item> constructs here, and the item
        // tag can have tooltip, helptext, enabled and hidden attributes

        wxString label = GetNodeContent(m_node);

        wxString tooltip;
        m_node->GetAttribute(wxT("tooltip"), &tooltip);

        wxString helptext;
        bool hasHelptext = m_node->GetAttribute(wxT("helptext"), &helptext);

        if (m_resource->GetFlags() & wxXRC_USE_LOCALE)
        {
            label = wxGetTranslation(label, m_resource->GetDomain());
            if ( !tooltip.empty() )
                tooltip = wxGetTranslation(tooltip, m_resource->GetDomain());
            if ( hasHelptext )
                helptext = wxGetTranslation(helptext, m_resource->GetDomain());
        }

        m_labels.push_back(label);
#if wxUSE_TOOLTIPS
        m_tooltips.push_back(tooltip);
#endif // wxUSE_TOOLTIPS
#if wxUSE_HELP
        m_helptexts.push_back(helptext);
        m_helptextSpecified.push_back(hasHelptext);
#endif // wxUSE_HELP
        m_isEnabled.push_back(GetBoolAttr("enabled", 1));
        m_isShown.push_back(!GetBoolAttr("hidden", 0));

        return NULL;
    }

}
bool
SVGStyleElement::Scoped() const
{
  return GetBoolAttr(nsGkAtoms::scoped);
}
Exemple #8
0
wxObject *wxRadioBoxXmlHandler::DoCreateResource()
{
    if ( m_class == wxT("wxRadioBox"))
    {
        // find the selection
        long selection = GetLong( wxT("selection"), -1 );

        // need to build the list of strings from children
        m_insideBox = true;
        CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));

        XRC_MAKE_INSTANCE(control, wxRadioBox)

        control->Create(m_parentAsWindow,
                        GetID(),
                        GetText(wxT("label")),
                        GetPosition(), GetSize(),
                        m_labels,
                        GetLong(wxT("dimension"), 1),
                        GetStyle(),
                        wxDefaultValidator,
                        GetName());

        if (selection != -1)
            control->SetSelection(selection);

        SetupWindow(control);

        const unsigned count = m_labels.size();
        for( unsigned i = 0; i < count; i++ )
        {
#if wxUSE_TOOLTIPS
            if ( !m_tooltips[i].empty() )
                control->SetItemToolTip(i, m_tooltips[i]);
#endif // wxUSE_TOOLTIPS
#if wxUSE_HELP
            if ( m_helptextSpecified[i] )
                control->SetItemHelpText(i, m_helptexts[i]);
#endif // wxUSE_HELP

            if ( !m_isShown[i] )
                control->Show(i, false);
            if ( !m_isEnabled[i] )
                control->Enable(i, false);
        }


        // forget information about the items of this radiobox, we should start
        // afresh for the next one
        m_labels.clear();

#if wxUSE_TOOLTIPS
        m_tooltips.clear();
#endif // wxUSE_TOOLTIPS

#if wxUSE_HELP
        m_helptexts.clear();
        m_helptextSpecified.clear();
#endif // wxUSE_HELP

        m_isShown.clear();
        m_isEnabled.clear();

        return control;
    }
    else // inside the radiobox element
    {
        // we handle handle <item>Label</item> constructs here, and the item
        // tag can have tooltip, helptext, enabled and hidden attributes

        // For compatibility, labels are not escaped in XRC by default and
        // label="1" attribute needs to be explicitly specified to handle them
        // consistently with the other labels.
        m_labels.push_back(GetNodeText(m_node,
                                       GetBoolAttr("label", 0)
                                        ? 0
                                        : wxXRC_TEXT_NO_ESCAPE));
#if wxUSE_TOOLTIPS
        m_tooltips.push_back(GetNodeText(GetParamNode(wxT("tooltip")),
                                         wxXRC_TEXT_NO_ESCAPE));
#endif // wxUSE_TOOLTIPS
#if wxUSE_HELP
        const wxXmlNode* const nodeHelp = GetParamNode(wxT("helptext"));
        m_helptexts.push_back(GetNodeText(nodeHelp, wxXRC_TEXT_NO_ESCAPE));
        m_helptextSpecified.push_back(nodeHelp != NULL);
#endif // wxUSE_HELP
        m_isEnabled.push_back(GetBoolAttr("enabled", 1));
        m_isShown.push_back(!GetBoolAttr("hidden", 0));

        return NULL;
    }

}
/**
Parse a Sequence XML element.
*/
void U2FrameXmlParser::ParseFrameSequence(TiXmlElement* elem, 
										  U2FramePhase* phase)
{
	U2ASSERT(elem && phase);
	U2FrameSequence* pNewSeq = U2_NEW U2FrameSequence;
#ifdef UNICODE 
	pNewSeq->SetShaderAlias(ToUnicode(elem->Attribute("shader")));
#else 
	pNewSeq->SetShaderAlias(elem->Attribute("shader"));
#endif

	if(HasAttr(elem, "technique"))
	{
#ifdef UNICODE 
		pNewSeq->SetTechnique(ToUnicode(elem->Attribute("technique")));
#else 
		pNewSeq->SetTechnique(elem->Attribute("technique"));
#endif 	
	}
	pNewSeq->SetShaderUpdateEnabled(GetBoolAttr(elem, "shaderUpdates", true));
	pNewSeq->SetFirstLightAlphaEnabled(GetBoolAttr(elem, "firstLightAlpha", false));
	pNewSeq->SetModelViewProjOnlyHint(GetBoolAttr(elem, "mvpOnly", false));

	TiXmlElement* pChild;
	for(pChild = elem->FirstChildElement(); pChild; 
		pChild = pChild->NextSiblingElement())
	{
#ifdef UNICODE 
		if(pChild->Value() == U2DynString(L"Float"))
		{
			ParseShaderState(U2FxShaderState::Float, pChild, pNewSeq);
		}
		else if(pChild->Value() == U2DynString(L"Float4"))
		{
			ParseShaderState(U2FxShaderState::Float4, pChild, pNewSeq);
		}
		else if(pChild->Value() == U2DynString(L"Int"))
		{
			ParseShaderState(U2FxShaderState::Int, pChild, pNewSeq);
		}
		else if(pChild->Value() == U2DynString(L"Texture"))
		{
			ParseShaderState(U2FxShaderState::Texture, pChild, pNewSeq);
		}	
#else 
		if(pChild->Value() == U2DynString("Float"))
		{
			ParseShaderState(U2FxShaderState::Float, pChild, pNewSeq);
		}
		else if(pChild->Value() == U2DynString("Float4"))
		{
			ParseShaderState(U2FxShaderState::Float4, pChild, pNewSeq);
		}
		else if(pChild->Value() == U2DynString("Int"))
		{
			ParseShaderState(U2FxShaderState::Int, pChild, pNewSeq);
		}
		else if(pChild->Value() == U2DynString("Texture"))
		{
			ParseShaderState(U2FxShaderState::Texture, pChild, pNewSeq);
		}	
#endif 
	}
	phase->AddFrameSeq(pNewSeq);
}
/**
Parse a Pass element inside a Section element.
*/
void U2FrameXmlParser::ParseFramePass(TiXmlElement* elem, U2FrameSection* section)
{
	U2ASSERT(elem && section);

	U2FramePass* pNewPass = U2_NEW U2FramePass;
	pNewPass->SetFrame(section->GetFrame());

#ifdef UNICODE 
	pNewPass->SetName(ToUnicode(elem->Attribute("name")));
	pNewPass->SetShaderAlias(ToUnicode(elem->Attribute("shader")));
#else 
	pNewPass->SetName(elem->Attribute("name"));
	pNewPass->SetShaderAlias(elem->Attribute("shader"));
#endif 
	U2DynString szRenderTarget(_T("renderTarget"));	
	int i=0;

	unsigned int uClearFlag = 0;
#ifdef UNICODE 
	while(HasAttr(elem, ToAscii(szRenderTarget.Str())))
	{

		//pNewPass->SetRenderTargetName(i, ToUnicode(elem->Attribute(szRenderTarget.Str()));
		szRenderTarget = L("renderTarget");
		szRenderTarget.AppendInt(++i);
	}
#else
	while(HasAttr(elem, szRenderTarget.Str()))
	{
		pNewPass->SetRenderTargetName(i, elem->Attribute(szRenderTarget.Str()));
		szRenderTarget = "renderTarget";
		szRenderTarget.AppendInt(++i);
	}
#endif 

	if(HasAttr(elem, "stats"))
	{
		//pNewPass->SetStatsEnabled(GetBoolAttr(elem, "stats", true));
	}
	int clearFlags = 0;
	if(HasAttr(elem, "clearColor"))
	{
		uClearFlag |= U2Dx9Renderer::CLEAR_BACKBUFFER;		

		D3DXVECTOR4 color = GetVector4Attr(elem, "clearColor", 
			D3DXVECTOR4(0.f, 0.f, 0.f, 1.f));
		pNewPass->SetBackgroundColor(D3DXCOLOR(color.x, color.y, color.z, color.w));
	}

	if(HasAttr(elem, "clearDepth"))
	{
		uClearFlag |= U2Dx9Renderer::CLEAR_ZBUFFER;
		pNewPass->SetDepthClear(GetFloatAttr(elem, "clearDepth", 1.0f));
	}
	if(HasAttr(elem, "clearStencil"))
	{
		uClearFlag |= U2Dx9Renderer::CLEAR_STENCIL;
		pNewPass->SetStencilClear(GetIntAttr(elem, "clearStencil", 0));
	}

	pNewPass->SetClearFlags(uClearFlag);
	
	if(HasAttr(elem, "drawQuad"))
	{
		pNewPass->SetDrawFullscreenQuad(GetBoolAttr(elem, "drawQuad", false));
		// CreateQuad 
		if (pNewPass->GetDrawFullscreenQuad())
			pNewPass->CreateScreenQuad();

	}
	if(HasAttr(elem, "drawShadows"))
	{
#ifdef UNICODE 
		pNewPass->SetShadowTechnique(ToUnicode(U2FramePass::StringToShadowTechnique(elem->Attribute("drawShadows"))));
#else 
pNewPass->SetShadowTechnique(U2FramePass::StringToShadowTechnique(elem->Attribute("drawShadows")));
#endif

	}
	if(HasAttr(elem, "occlusionQuery"))
	{
		pNewPass->SetOcclusionQuery(GetBoolAttr(elem, "occlusionQuery", false));
	}
	if(HasAttr(elem, "drawGui"))
	{
		pNewPass->SetDrawGui(GetBoolAttr(elem, "drawGui", false));

	}
	if(HasAttr(elem, "technique"))
	{
#ifdef UNICODE 
		pNewPass->SetTechnique(ToUnicode(elem->Attribute("technique")));
#else 
		pNewPass->SetTechnique(elem->Attribute("technique"));
#endif 
	}
	if(HasAttr(elem, "shadowEnabledCondition"))
	{
		pNewPass->SetShadowEnabled(GetBoolAttr(elem, "shadowEnabledCondition", false));
	}

	if(HasAttr(elem, "addDepthStencil"))
	{
		pNewPass->SetDepthStencil(GetBoolAttr(elem, "addDepthStencil", false));
	}


	TiXmlElement* pChild;
	for(pChild = elem->FirstChildElement(); pChild; pChild = pChild->NextSiblingElement())
	{
#ifdef UNICODE 
		if(pChild->Value() == U2DynString(L"Float"))
		{
			ParseShaderState(U2FxShaderState::Float, pChild, pNewPass);
		}
		else if(pChild->Value() == U2DynString(L"Float4"))
		{
			ParseShaderState(U2FxShaderState::Float4, pChild, pNewPass);
		}
		else if(pChild->Value() == U2DynString(L"Int"))
		{
			ParseShaderState(U2FxShaderState::Int, pChild, pNewPass);
		}
		else if(pChild->Value() == U2DynString(L"Texture"))
		{
			ParseShaderState(U2FxShaderState::Texture, pChild, pNewPass);
		}
		else if(pChild->Value() == U2DynString(L"FramePhase"))
		{
			ParseFramePhase(pChild, pNewPass);
		}
#else 
		if(pChild->Value() == U2DynString("Float"))
		{
			ParseShaderState(U2FxShaderState::Float, pChild, pNewPass);
		}
		else if(pChild->Value() == U2DynString("Float4"))
		{
			ParseShaderState(U2FxShaderState::Float4, pChild, pNewPass);
		}
		else if(pChild->Value() == U2DynString("Int"))
		{
			ParseShaderState(U2FxShaderState::Int, pChild, pNewPass);
		}
		else if(pChild->Value() == U2DynString("Texture"))
		{
			ParseShaderState(U2FxShaderState::Texture, pChild, pNewPass);
		}
		else if(pChild->Value() == U2DynString("Phase"))
		{
			ParseFramePhase(pChild, pNewPass);
		}
#endif 
	}
	section->AddFramePass(pNewPass);
}
bool
HTMLScriptElement::Async()
{
  return mForceAsync || GetBoolAttr(nsGkAtoms::async);
}
bool
HTMLScriptElement::Defer()
{
  return GetBoolAttr(nsGkAtoms::defer);
}
Exemple #13
0
		Map*
		XmlBuilder::CreateMap (XMLNode& node, const Registry<JourneyPattern>& lines)
		{
			// assert ("map" == node.getName ());


			int outputWidth (GetIntAttr (node, "outputWidth", -1));
			int outputHeight (GetIntAttr (node, "outputHeight", -1));

			// Drawable lines
			std::set<DrawableLine*> selectedLines;
			int nbDrawableLines = node.nChildNode ("drawableLine");
			for (int i=0; i<nbDrawableLines; ++i)
			{
			XMLNode drawableLineNode = node.getChildNode ("drawableLine", i);
			selectedLines.insert (CreateDrawableLine (drawableLineNode, lines));
			}

			const MapBackgroundManager* mbm = 0;

			std::string backgroundId (GetStringAttr (node, "backgroundId", ""));
			if (backgroundId != "")
			{
			try
			{
				mbm = MapBackgroundManager::GetMapBackgroundManager (backgroundId);
			}
			catch (synthese::Exception& ex)
			{
				Log::GetInstance ().warn ("Cannot find background", ex);
			}
			}

			std::string urlPattern (GetStringAttr (node, "urlPattern", ""));

			Map* map = 0;

			bool preserveRatio (GetBoolAttr (node, "preserveRatio", true));

			double neighborhood (GetDoubleAttr (node, "neighborhood", 0.0));

			// If one of the 4 coordinates is missing, let the autofit
			// feature process the right rectangle
			if (
			(HasAttr (node, "lowerLeftLatitude") == false) ||
			(HasAttr (node, "lowerLeftLongitude") == false) ||
			(HasAttr (node, "upperRightLatitude") == false) ||
			(HasAttr (node, "upperRightLongitude") == false)
			)
			{
			map = new Map (selectedLines,
					outputWidth,
					outputHeight,
					neighborhood,
					preserveRatio,
					mbm, urlPattern);

			}
			else
			{
			double lowerLeftLatitude (GetDoubleAttr (node, "lowerLeftLatitude"));
			double lowerLeftLongitude (GetDoubleAttr (node, "lowerLeftLongitude"));
			double upperRightLatitude (GetDoubleAttr (node, "upperRightLatitude"));
			double upperRightLongitude (GetDoubleAttr (node, "upperRightLongitude"));

				map = new Map (selectedLines,
					Rectangle (lowerLeftLatitude,
						lowerLeftLongitude,
						upperRightLatitude - lowerLeftLatitude,
						upperRightLongitude - lowerLeftLongitude),
					outputWidth,
					outputHeight,
					preserveRatio,
					mbm, urlPattern);


			}


			bool lineGrouping (GetBoolAttr (node, "lineGrouping", true));
			if (lineGrouping) map->setLineGrouping (lineGrouping);

			return map;
		}
//Obj_Character::In Combat flag
BOOL Obj_Character::InCombat(VOID) const
{
	return GetBoolAttr(CharBoolAttrs_T::ATTR_IN_COMBAT);
}