void ImagerySection::writeXMLToStream(XMLSerializer& xml_stream) const
    {
        // output opening tag
        xml_stream.openTag(Falagard_xmlHandler::ImagerySectionElement)
            .attribute(Falagard_xmlHandler::NameAttribute, d_name);

        // output modulative colours for this section
        if (!d_colourPropertyName.empty())
        {
            xml_stream.openTag(Falagard_xmlHandler::ColourRectPropertyElement);
            xml_stream.attribute(Falagard_xmlHandler::NameAttribute, d_colourPropertyName)
                .closeTag();
        }
        else if (!d_masterColours.isMonochromatic() || d_masterColours.d_top_left != Colour(1,1,1,1))
        {
            xml_stream.openTag(Falagard_xmlHandler::ColoursElement)
                .attribute(Falagard_xmlHandler::TopLeftAttribute, PropertyHelper<Colour>::toString(d_masterColours.d_top_left))
                .attribute(Falagard_xmlHandler::TopRightAttribute, PropertyHelper<Colour>::toString(d_masterColours.d_top_right))
                .attribute(Falagard_xmlHandler::BottomLeftAttribute, PropertyHelper<Colour>::toString(d_masterColours.d_bottom_left))
                .attribute(Falagard_xmlHandler::BottomRightAttribute, PropertyHelper<Colour>::toString(d_masterColours.d_bottom_right))
                .closeTag();
        }

        // output all frame components.
        for(FrameComponentList::const_iterator frame = d_frames.begin(); frame != d_frames.end(); ++frame)
        {
            (*frame).writeXMLToStream(xml_stream);
        }

        // output all imagery components
        for(ImageryComponentList::const_iterator image = d_images.begin(); image != d_images.end(); ++image)
        {
            (*image).writeXMLToStream(xml_stream);
        }

        // output all text components
        for(TextComponentList::const_iterator text = d_texts.begin(); text != d_texts.end(); ++text)
        {
            (*text).writeXMLToStream(xml_stream);
        }

        // output closing tag
        xml_stream.closeTag();
    }
예제 #2
0
    void ImageryComponent::writeXMLToStream(XMLSerializer& xml_stream) const
    {
        // opening tag
        xml_stream.openTag("ImageryComponent");
        // write out area
        d_area.writeXMLToStream(xml_stream);

        // write image
        if (isImageFetchedFromProperty())
            xml_stream.openTag("ImageProperty")
                .attribute("name", d_imagePropertyName)
                .closeTag();
        else
            xml_stream.openTag("Image")
                .attribute("imageset", d_image->getImagesetName())
                .attribute("image", d_image->getName())
                .closeTag();

        // get base class to write colours
        writeColoursXML(xml_stream);

        // write vert format, allowing base class to do this for us if a propety is in use
        if (!writeVertFormatXML(xml_stream))
        {
            // was not a property, so write out explicit formatting in use
            xml_stream.openTag("VertFormat")
                .attribute("type", FalagardXMLHelper::vertFormatToString(d_vertFormatting))
                .closeTag();
        }

        // write horz format, allowing base class to do this for us if a propety is in use
        if (!writeHorzFormatXML(xml_stream))
        {
            // was not a property, so write out explicit formatting in use
            xml_stream.openTag("HorzFormat")
                .attribute("type", FalagardXMLHelper::horzFormatToString(d_horzFormatting))
                .closeTag();
        }

        // closing tag
        xml_stream.closeTag();
    }
예제 #3
0
//----------------------------------------------------------------------------//
void Property::writeXMLToStream(const PropertyReceiver* receiver, XMLSerializer& xml_stream) const
{
	if (d_writeXML)
	{
		xml_stream.openTag(XMLElementName)
			.attribute(NameXMLAttributeName,  d_name);
		// Detect wether it is a long property or not
		// Long property are needed if
		const String& value = get(receiver);
		if (value.find((String::value_type)'\n') != String::npos)
		{
			xml_stream.text(value);
		}
		else
		{
			xml_stream.attribute(ValueXMLAttributeName, get(receiver));
		}
		xml_stream.closeTag();
	}
}
    void SectionSpecification::writeXMLToStream(XMLSerializer& xml_stream) const
    {
        xml_stream.openTag("Section");

        if (!d_owner.empty())
            xml_stream.attribute("look", d_owner);

        xml_stream.attribute("section", d_sectionName);

        // render controlling property name if needed
        if (!d_renderControlProperty.empty())
            xml_stream.attribute("controlProperty", d_renderControlProperty);

        if (d_usingColourOverride)
        {
            // output modulative colours for this section
            if (!d_colourPropertyName.empty())
            {
                if (d_colourProperyIsRect)
                    xml_stream.openTag("ColourRectProperty");
                else
                    xml_stream.openTag("ColourProperty");

                xml_stream.attribute("name", d_colourPropertyName)
                    .closeTag();
            }
            else if (!d_coloursOverride.isMonochromatic() || d_coloursOverride.d_top_left != colour(1,1,1,1))
            {
                xml_stream.openTag("Colours")
                    .attribute("topLeft", PropertyHelper::colourToString(d_coloursOverride.d_top_left))
                    .attribute("topRight", PropertyHelper::colourToString(d_coloursOverride.d_top_right))
                    .attribute("bottomLeft", PropertyHelper::colourToString(d_coloursOverride.d_bottom_left))
                    .attribute("bottomRight", PropertyHelper::colourToString(d_coloursOverride.d_bottom_right))
                    .closeTag();
            }

        }
        // close section element 
        xml_stream.closeTag();
    }
    void SectionSpecification::writeXMLToStream(XMLSerializer& xml_stream) const
    {
        xml_stream.openTag(Falagard_xmlHandler::SectionElement);

        if (!d_owner.empty())
            xml_stream.attribute(Falagard_xmlHandler::LookAttribute, d_owner);

        xml_stream.attribute(Falagard_xmlHandler::SectionNameAttribute, d_sectionName);

        // render controlling property name if needed
        if (!d_renderControlProperty.empty())
            xml_stream.attribute(Falagard_xmlHandler::ControlPropertyAttribute, d_renderControlProperty);
        if (!d_renderControlValue.empty())
            xml_stream.attribute(Falagard_xmlHandler::ControlValueAttribute, d_renderControlValue);
        if (!d_renderControlWidget.empty())
            xml_stream.attribute(Falagard_xmlHandler::ControlWidgetAttribute, d_renderControlWidget);

        if (d_usingColourOverride)
        {
            // output modulative colours for this section
            if (!d_colourPropertyName.empty())
            {
                xml_stream.openTag(Falagard_xmlHandler::ColourRectPropertyElement);
                xml_stream.attribute(Falagard_xmlHandler::NameAttribute, d_colourPropertyName)
                    .closeTag();
            }
            else if (!d_coloursOverride.isMonochromatic() || d_coloursOverride.d_top_left != Colour(1,1,1,1))
            {
                xml_stream.openTag(Falagard_xmlHandler::ColoursElement)
                    .attribute(Falagard_xmlHandler::TopLeftAttribute, PropertyHelper<Colour>::toString(d_coloursOverride.d_top_left))
                    .attribute(Falagard_xmlHandler::TopRightAttribute, PropertyHelper<Colour>::toString(d_coloursOverride.d_top_right))
                    .attribute(Falagard_xmlHandler::BottomLeftAttribute, PropertyHelper<Colour>::toString(d_coloursOverride.d_bottom_left))
                    .attribute(Falagard_xmlHandler::BottomRightAttribute, PropertyHelper<Colour>::toString(d_coloursOverride.d_bottom_right))
                    .closeTag();
            }

        }
        // close section element 
        xml_stream.closeTag();
    }
예제 #6
0
/*************************************************************************
    Writes an xml representation of this Font to \a out_stream.
*************************************************************************/
void Font::writeXMLToStream(XMLSerializer& xml_stream) const
{
    // output starting <Font ... > element
    xml_stream.openTag("Font")
        .attribute(FontNameAttribute, d_name)
        .attribute(FontFilenameAttribute, d_fileName);

    if (!d_resourceGroup.empty ())
        xml_stream.attribute (FontResourceGroupAttribute, d_resourceGroup);

    if (d_nativeHorzRes != DefaultNativeHorzRes)
        xml_stream.attribute(FontNativeHorzResAttribute, PropertyHelper::uintToString(static_cast<uint>(d_nativeHorzRes)));

    if (d_nativeVertRes != DefaultNativeVertRes)
        xml_stream.attribute(FontNativeVertResAttribute, PropertyHelper::uintToString(static_cast<uint>(d_nativeVertRes)));

    if (d_autoScale)
        xml_stream.attribute(FontAutoScaledAttribute, "True");

    writeXMLToStream_impl (xml_stream);

    // output closing </Font> element.
    xml_stream.closeTag();
}
    void WidgetComponent::writeXMLToStream(XMLSerializer& xml_stream) const
    {
        // output opening tag
        xml_stream.openTag("Child")
            .attribute("type", d_baseType)
            .attribute("nameSuffix", d_nameSuffix);

        if (!d_imageryName.empty())
            xml_stream.attribute("look", d_imageryName);

        if (!d_rendererType.empty())
            xml_stream.attribute("renderer", d_rendererType);


        // output target area
        d_area.writeXMLToStream(xml_stream);

        // output vertical alignment
        xml_stream.openTag("VertAlignment")
            .attribute("type", FalagardXMLHelper::vertAlignmentToString(d_vertAlign))
            .closeTag();

        // output horizontal alignment
        xml_stream.openTag("HorzAlignment")
            .attribute("type", FalagardXMLHelper::horzAlignmentToString(d_horzAlign))
            .closeTag();

        //output property initialisers
        for (PropertiesList::const_iterator prop = d_properties.begin(); prop != d_properties.end(); ++prop)
        {
            (*prop).writeXMLToStream(xml_stream);
        }

        // output closing tag
        xml_stream.closeTag();
    }
//----------------------------------------------------------------------------//
void FrameComponent::writeXMLToStream(XMLSerializer& xml_stream) const
{
    // opening tag
    xml_stream.openTag(Falagard_xmlHandler::FrameComponentElement);
    // write out area
    d_area.writeXMLToStream(xml_stream);

    // write images
    for (int i = 0; i < FIC_FRAME_IMAGE_COUNT; ++i)
    {
        if (d_frameImages[i].d_specified)
        {
            if (d_frameImages[i].d_propertyName.empty())
                xml_stream.openTag(Falagard_xmlHandler::ImageElement)
                    .attribute(Falagard_xmlHandler::ComponentAttribute, FalagardXMLHelper<FrameImageComponent>::toString(static_cast<FrameImageComponent>(i)))
                    .attribute(Falagard_xmlHandler::NameAttribute, d_frameImages[i].d_image->getName())
                    .closeTag();
            else
                xml_stream.openTag(Falagard_xmlHandler::ImagePropertyElement)
                    .attribute(Falagard_xmlHandler::ComponentAttribute, FalagardXMLHelper<FrameImageComponent>::toString(static_cast<FrameImageComponent>(i)))
                    .attribute(Falagard_xmlHandler::NameAttribute, d_frameImages[i].d_propertyName)
                    .closeTag();
        }
    }

    // get base class to write colours
    writeColoursXML(xml_stream);

    if(d_leftEdgeFormatting.getValue() != VerticalFormattingDefault)
    {
        d_leftEdgeFormatting.writeXMLTagToStream(xml_stream);
        xml_stream.attribute(Falagard_xmlHandler::ComponentAttribute, FalagardXMLHelper<FrameImageComponent>::LeftEdge);
        d_leftEdgeFormatting.writeXMLAttributesToStream(xml_stream);
        xml_stream.closeTag();
    }

    if(d_rightEdgeFormatting.getValue() != VerticalFormattingDefault)
    {
        d_rightEdgeFormatting.writeXMLTagToStream(xml_stream);
        xml_stream.attribute(Falagard_xmlHandler::ComponentAttribute, FalagardXMLHelper<FrameImageComponent>::RightEdge);
        d_rightEdgeFormatting.writeXMLAttributesToStream(xml_stream);
        xml_stream.closeTag();
    }

    if(d_backgroundHorzFormatting.getValue() != HorizontalFormattingDefault)
    {
        d_backgroundHorzFormatting.writeXMLTagToStream(xml_stream);
        xml_stream.attribute(Falagard_xmlHandler::ComponentAttribute, FalagardXMLHelper<FrameImageComponent>::Background);
        d_backgroundHorzFormatting.writeXMLAttributesToStream(xml_stream);
        xml_stream.closeTag();
    }

    if(d_topEdgeFormatting.getValue() != HorizontalFormattingDefault)
    {
        d_topEdgeFormatting.writeXMLTagToStream(xml_stream);
        xml_stream.attribute(Falagard_xmlHandler::ComponentAttribute, FalagardXMLHelper<FrameImageComponent>::TopEdge);
        d_topEdgeFormatting.writeXMLAttributesToStream(xml_stream);
        xml_stream.closeTag();
    }

    if(d_bottomEdgeFormatting.getValue() != HorizontalFormattingDefault)
    {
        d_bottomEdgeFormatting.writeXMLTagToStream(xml_stream);
        xml_stream.attribute(Falagard_xmlHandler::ComponentAttribute, FalagardXMLHelper<FrameImageComponent>::BottomEdge);
        d_bottomEdgeFormatting.writeXMLAttributesToStream(xml_stream);
        xml_stream.closeTag();
    }

    if(d_backgroundVertFormatting.getValue() != VerticalFormattingDefault)
    {
        d_backgroundVertFormatting.writeXMLTagToStream(xml_stream);
        xml_stream.attribute(Falagard_xmlHandler::ComponentAttribute, FalagardXMLHelper<FrameImageComponent>::Background);
        d_backgroundVertFormatting.writeXMLAttributesToStream(xml_stream);
        xml_stream.closeTag();
    }

    // closing tag
    xml_stream.closeTag();
}