void SVGAnimateElement::clearAnimatedType()
{
    if (!m_animatedProperty)
        return;

    SVGElement* targetElement = this->targetElement();
    if (!targetElement) {
        m_animatedProperty.clear();
        return;
    }

    ShouldApplyAnimationType shouldApply = shouldApplyAnimation(targetElement, attributeName());
    if (shouldApply == ApplyXMLandCSSAnimation) {
        removeCSSPropertyFromTargetAndInstances(targetElement, attributeName());
    } else if (m_animator.isAnimatingCSSProperty()) {
        // CSS properties animation code-path.
        removeCSSPropertyFromTargetAndInstances(targetElement, attributeName());
        m_animatedProperty.clear();
        m_animator.clear();
        return;
    }

    // SVG DOM animVal animation code-path.
    if (m_animatedProperty) {
        SVGElementInstances animatedElements = findElementInstances(targetElement);
        m_animator.stopAnimValAnimation(animatedElements);
        notifyTargetAndInstancesAboutAnimValChange(targetElement, attributeName());
    }

    m_animatedProperty.clear();
    m_animator.clear();
}
Esempio n. 2
0
Scenario::Scenario(BaseLib::Obj* baseLib, xml_node<>* node) : Scenario(baseLib)
{
	for(xml_attribute<>* attr = node->first_attribute(); attr; attr = attr->next_attribute())
	{
		std::string attributeName(attr->name());
		std::string attributeValue(attr->value());
		if(attributeName == "id")
		{
			id = attributeValue;
		}
		else _bl->out.printWarning("Warning: Unknown attribute for \"scenario\": " + attributeName);
	}
	for(xml_node<>* subNode = node->first_node(); subNode; subNode = subNode->next_sibling())
	{
		std::string nodeName(subNode->name());
		std::string parameterId;
		if(nodeName == "parameter")
		{
			for(xml_attribute<>* attr = subNode->first_attribute(); attr; attr = attr->next_attribute())
			{
				std::string attributeName(attr->name());
				if(attributeName == "id") parameterId = std::string(attr->value());
				else _bl->out.printWarning("Warning: Unknown attribute for \"scenario\\parameter\": " + std::string(attr->name()));
			}
			if(parameterId.empty()) continue;
			scenarioEntries[parameterId] = std::string(subNode->value());
		}
		else _bl->out.printWarning("Warning: Unknown node in \"scenario\": " + nodeName);
	}
}
Esempio n. 3
0
void SVGAnimateElement::clearAnimatedType(SVGElement* targetElement)
{
    if (!m_animatedType)
        return;

    if (!targetElement) {
        m_animatedType.clear();
        return;
    }

    if (m_animatedProperties.isEmpty()) {
        // CSS properties animation code-path.
        removeCSSPropertyFromTargetAndInstances(targetElement, attributeName());
        m_animatedType.clear();
        return;
    }

    // SVG DOM animVal animation code-path.
    if (m_animator) {
        m_animator->stopAnimValAnimation(m_animatedProperties);
        notifyTargetAndInstancesAboutAnimValChange(targetElement, attributeName());
    }

    m_animatedProperties.clear();
    m_animatedType.clear();
}
Esempio n. 4
0
void SVGAnimateElement::clearAnimatedType(SVGElement* targetElement)
{
    if (!m_animatedProperty)
        return;

    if (!targetElement) {
        m_animatedProperty.clear();
        return;
    }

    if (ensureAnimator()->isAnimatingCSSProperty()) {
        // CSS properties animation code-path.
        removeCSSPropertyFromTargetAndInstances(targetElement, attributeName());
        m_animatedProperty.clear();
        return;
    }

    // SVG DOM animVal animation code-path.
    if (m_animator) {
        WillBeHeapVector<RawPtrWillBeMember<SVGElement> > animatedElements = findElementInstances(targetElement);
        m_animator->stopAnimValAnimation(animatedElements);
        notifyTargetAndInstancesAboutAnimValChange(targetElement, attributeName());
    }

    m_animatedProperty.clear();
}
void SVGAnimateElement::applyResultsToTarget()
{
    ASSERT(animatedPropertyType() != AnimatedTransformList || isSVGAnimateTransformElement(*this));
    ASSERT(animatedPropertyType() != AnimatedUnknown);

    // Early exit if our animated type got destructed by a previous endedActiveInterval().
    if (!m_animatedProperty)
        return;

    // We do update the style and the animation property independent of each other.
    ShouldApplyAnimationType shouldApply = shouldApplyAnimation(targetElement(), attributeName());
    if (shouldApply == ApplyXMLandCSSAnimation) {
        applyCSSPropertyToTargetAndInstances(targetElement(), attributeName(), m_animatedProperty->valueAsString());
    } else if (m_animator.isAnimatingCSSProperty()) {
        // CSS properties animation code-path.
        // Convert the result of the animation to a String and apply it as CSS property on the target & all instances.
        applyCSSPropertyToTargetAndInstances(targetElement(), attributeName(), m_animatedProperty->valueAsString());
        return;
    }

    // SVG DOM animVal animation code-path.
    // At this point the SVG DOM values are already changed, unlike for CSS.
    // We only have to trigger update notifications here.
    notifyTargetAndInstancesAboutAnimValChange(targetElement(), attributeName());
}
Esempio n. 6
0
Cylinder::Cylinder(const AttributeSet& attributes):capped(false)
{
  for(unsigned int i=0; i<attributes.size(); i++)
  {
    std::string attributeName(attributes[i].attribute);
    if(attributeName == "name")
    {
      name = attributes[i].value;
    }
    else if(attributeName == "radius")
    {
      radius = ParserUtilities::toDouble(attributes[i].value);
    }
    else if(attributeName == "height")
    {
      height = ParserUtilities::toDouble(attributes[i].value);
    }
    else if(attributeName == "canCollide")
    {
      collideBit = ParserUtilities::toBool(attributes[i].value);
    }
    else if(attributeName == "capped")
    {
      capped = ParserUtilities::toBool(attributes[i].value);
    }
  }
  calculateCorners();
  graphicsHandle = graphicsManager->createNewCylinder(radius, height, capped);
}
Esempio n. 7
0
LogicalParameterAction::LogicalParameterAction(BaseLib::Obj* baseLib, xml_node<>* node) : LogicalParameterAction(baseLib)
{
	try
	{
		type = Type::Enum::typeAction;
		for(xml_attribute<>* attr = node->first_attribute(); attr; attr = attr->next_attribute())
		{
			std::string attributeName(attr->name());
			std::string attributeValue(attr->value());
			if(attributeName == "unit") unit = attributeValue;
			else if(attributeName != "type") _bl->out.printWarning("Warning: Unknown attribute for \"logical\" with type boolean: " + attributeName);
		}
	}
    catch(const std::exception& ex)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(const Exception& ex)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(...)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
    }
}
Esempio n. 8
0
void SVGInterpolation::apply(SVGElement& targetElement) const
{
    SVGElement::InstanceUpdateBlocker blocker(&targetElement);
    RefPtrWillBeRawPtr<SVGPropertyBase> value = interpolatedValue(targetElement);
    SVGElementInstances instances = SVGAnimateElement::findElementInstances(&targetElement);

    for (SVGElement* element : instances) {
        RefPtrWillBeRawPtr<SVGAnimatedPropertyBase> animatedProperty =
            element->propertyFromAttribute(attributeName());
        if (animatedProperty) {
            animatedProperty->setAnimatedValue(value);
            element->invalidateSVGAttributes();
            element->svgAttributeChanged(attributeName());
        }
    }
}
LogicalParameterBoolean::LogicalParameterBoolean(BaseLib::Obj* baseLib, xml_node<>* node) : LogicalParameterBoolean(baseLib)
{
	try
	{
		type = Type::Enum::typeBoolean;
		for(xml_attribute<>* attr = node->first_attribute(); attr; attr = attr->next_attribute())
		{
			std::string attributeName(attr->name());
			std::string attributeValue(attr->value());
			if(attributeName == "default")
			{
				if(attributeValue == "true") defaultValue = true;
				defaultValueExists = true;
			}
			else if(attributeName == "unit") unit = attributeValue;
			else if(attributeName != "type") _bl->out.printWarning("Warning: Unknown attribute for \"logical\" with type boolean: " + attributeName);
		}
		for(xml_node<>* logicalNode = node->first_node(); logicalNode; logicalNode = logicalNode->next_sibling())
		{
			_bl->out.printWarning("Warning: Unknown node in \"logical\" with type boolean: " + std::string(logicalNode->name()));
		}
	}
    catch(const std::exception& ex)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(const Exception& ex)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(...)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
    }
}
Esempio n. 10
0
LogicalParameterString::LogicalParameterString(BaseLib::Obj* baseLib, xml_node<>* node) : LogicalParameterString(baseLib)
{
	try
	{
		type = Type::Enum::typeString;
		for(xml_attribute<>* attr = node->first_attribute(); attr; attr = attr->next_attribute())
		{
			std::string attributeName(attr->name());
			std::string attributeValue(attr->value());
			if(attributeName == "default")
			{
				defaultValue = attributeValue;
				defaultValueExists = true;
			}
			else if(attributeName == "unit") unit = attributeValue;
			else if(attributeName == "use_default_on_failure") {} //ignore, not necessary - all values are initialized
			else if(attributeName != "type") _bl->out.printWarning("Warning: Unknown attribute for \"logical\" with type string: " + attributeName);
		}
	}
    catch(const std::exception& ex)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(const Exception& ex)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(...)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
    }
}
Esempio n. 11
0
AnimatedPropertyType SVGAnimateElement::determineAnimatedPropertyType(SVGElement* targetElement) const
{
    ASSERT(targetElement);

    Vector<AnimatedPropertyType> propertyTypes;
    targetElement->animatedPropertyTypeForAttribute(attributeName(), propertyTypes);
    if (propertyTypes.isEmpty())
        return AnimatedUnknown;

    ASSERT(propertyTypes.size() <= 2);
    AnimatedPropertyType type = propertyTypes[0];
    if (hasTagName(SVGNames::animateColorTag) && type != AnimatedColor)
        return AnimatedUnknown;

    // Animations of transform lists are not allowed for <animate> or <set>
    // http://www.w3.org/TR/SVG/animate.html#AnimationAttributesAndProperties
    if (type == AnimatedTransformList && !hasTagName(SVGNames::animateTransformTag))
        return AnimatedUnknown;

    // Fortunately there's just one special case needed here: SVGMarkerElements orientAttr, which
    // corresponds to SVGAnimatedAngle orientAngle and SVGAnimatedEnumeration orientType. We have to
    // figure out whose value to change here.
    if (targetElement->hasTagName(SVGNames::markerTag) && type == AnimatedAngle) {
        ASSERT(propertyTypes.size() == 2);
        ASSERT(propertyTypes[0] == AnimatedAngle);
        ASSERT(propertyTypes[1] == AnimatedEnumeration);
    } else if (propertyTypes.size() == 2)
        ASSERT(propertyTypes[0] == propertyTypes[1]);

    return type;
}
  QVariant OutputAttributeVariable_Impl::toVariant() const {
    QVariantMap variableData = AnalysisObject_Impl::toVariant().toMap();

    variableData["variable_type"] = QString("OutputAttributeVariable");
    variableData["attribute_name"] = toQString(attributeName());

    return QVariant(variableData);
  }
Esempio n. 13
0
void SVGAnimateElement::determinePropertyValueTypes(const String& from, const String& to)
{
    SVGElement* targetElement = this->targetElement();
    ASSERT(targetElement);

    if (inheritsFromProperty(targetElement, attributeName(), from))
        m_fromPropertyValueType = InheritValue;
    if (inheritsFromProperty(targetElement, attributeName(), to))
        m_toPropertyValueType = InheritValue;

    if (m_animatedPropertyType != AnimatedColor)
        return;
    
    if (attributeValueIsCurrentColor(from))
        m_fromPropertyValueType = CurrentColorValue;
    if (attributeValueIsCurrentColor(to))
        m_toPropertyValueType = CurrentColorValue;
}
Esempio n. 14
0
void SVGAnimatedAngle::synchronizeAttribute()
{
    AtomicString value;
    if (m_orientType->currentValue()->enumValue() == SVGMarkerOrientAuto)
        value = "auto";
    else
        value = AtomicString(currentValue()->valueAsString());

    contextElement()->setSynchronizedLazyAttribute(attributeName(), value);
}
Esempio n. 15
0
void SVGAnimatedAngle::synchronizeAttribute()
{
    DEFINE_STATIC_LOCAL(const AtomicString, autoValue, ("auto", AtomicString::ConstructFromLiteral));
    AtomicString value;
    if (m_orientType->currentValue()->enumValue() == SVGMarkerOrientAuto)
        value = autoValue;
    else
        value = AtomicString(currentValue()->valueAsString());

    contextElement()->setSynchronizedLazyAttribute(attributeName(), value);
}
Esempio n. 16
0
bool SVGAnimationElement::targetAttributeIsCSS() const
{
    AttributeType type = attributeType();
    if (type == AttributeTypeCSS) {
        return true;
    }
    if (type == AttributeTypeXML) {
        return false;
    }
    return attributeIsCSS(attributeName());
}
SVGParsingError SVGAnimatedLength::setBaseValueAsString(const String& value)
{
    SVGParsingError parseStatus = baseValue()->setValueAsString(value);

    if (parseStatus != NoError)
        baseValue()->newValueSpecifiedUnits(CSSPrimitiveValue::UnitType::UserUnits, 0);
    else if (SVGLength::negativeValuesForbiddenForAnimatedLengthAttribute(attributeName()) && baseValue()->valueInSpecifiedUnits() < 0)
        parseStatus = NegativeValueForbiddenError;

    return parseStatus;
}
Esempio n. 18
0
ParameterOption::ParameterOption(BaseLib::Obj* baseLib, xml_node<>* node)
{
	for(xml_attribute<>* attr = node->first_attribute(); attr; attr = attr->next_attribute())
	{
		std::string attributeName(attr->name());
		std::string attributeValue(attr->value());
		if(attributeName == "id") id = attributeValue;
		else if(attributeName == "default" && attributeValue == "true") isDefault = true;
		else if(attributeName == "index") index = Math::getNumber(attributeValue);
		else baseLib->out.printWarning("Warning: Unknown attribute for \"option\": " + attributeName);
	}
}
static void TestInterfaceCheckSecurityReplaceableAttributeSetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
    TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(info.Holder());
    v8::Isolate* isolate = info.GetIsolate();
    v8::String::Utf8Value attributeName(name);
    ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "TestInterfaceCheckSecurity", info.Holder(), isolate);
    if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), exceptionState)) {
        exceptionState.throwIfNeeded();
        return;
    }
    if (info.This()->IsObject())
        v8::Handle<v8::Object>::Cast(info.This())->ForceSet(name, v8Value);
}
Esempio n. 20
0
void GrGLVertexProgramEffects::emitAttributes(GrGLFullShaderBuilder* builder,
                                              const GrEffectStage& stage) {
    int numAttributes = stage.getVertexAttribIndexCount();
    const int* attributeIndices = stage.getVertexAttribIndices();
    for (int a = 0; a < numAttributes; ++a) {
        // TODO: Make addAttribute mangle the name.
        SkString attributeName("aAttr");
        attributeName.appendS32(attributeIndices[a]);
        builder->addEffectAttribute(attributeIndices[a],
                                    stage.getEffect()->vertexAttribType(a),
                                    attributeName);
    }
}
LogicalParameterEnum::LogicalParameterEnum(BaseLib::Obj* baseLib, xml_node<>* node) : LogicalParameterEnum(baseLib)
{
	try
	{
		for(xml_attribute<>* attr = node->first_attribute(); attr; attr = attr->next_attribute())
		{
			std::string attributeName(attr->name());
			std::string attributeValue(attr->value());
			if(attributeName == "type") {}
			else if(attributeName == "unit") unit = attributeValue;
			else _bl->out.printWarning("Warning: Unknown attribute for \"logical\" with type enum: " + attributeName);
		}
		int32_t index = 0;
		for(xml_node<>* optionNode = node->first_node(); optionNode; optionNode = optionNode->next_sibling())
		{
			std::string nodeName(optionNode->name());
			if(nodeName == "option")
			{
				ParameterOption option(baseLib, optionNode);
				if(option.index > -1)
				{
					while((unsigned)option.index > options.size()) options.push_back(ParameterOption());
					index = option.index;
				}
				else option.index = index;
				options.push_back(option);
				if(options.back().isDefault)
				{
					defaultValueExists = true;
					defaultValue = index;
				}
				index++;
			}
			else baseLib->out.printWarning("Warning: Unknown node in \"logical\" with type enum: " + nodeName);
		}
		max = index - 1;
	}
    catch(const std::exception& ex)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(const Exception& ex)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(...)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
    }
}
Esempio n. 22
0
void SVGAnimateElement::applyResultsToTarget()
{
    ASSERT(m_animatedPropertyType != AnimatedTransformList || hasTagName(SVGNames::animateTransformTag));
    ASSERT(m_animatedPropertyType != AnimatedUnknown);
    ASSERT(m_animator);

    // Early exit if our animated type got destructed by a previous endedActiveInterval().
    if (!m_animatedType)
        return;

    if (m_animatedProperties.isEmpty()) {
        // CSS properties animation code-path.
        // Convert the result of the animation to a String and apply it as CSS property on the target & all instances.
        applyCSSPropertyToTargetAndInstances(targetElement(), attributeName(), m_animatedType->valueAsString());
        return;
    }

    // SVG DOM animVal animation code-path.
    // At this point the SVG DOM values are already changed, unlike for CSS.
    // We only have to trigger update notifications here.
    m_animator->animValDidChange(m_animatedProperties);
    notifyTargetAndInstancesAboutAnimValChange(targetElement(), attributeName());
}
Esempio n. 23
0
LogicalParameterFloat::LogicalParameterFloat(BaseLib::Obj* baseLib, xml_node<>* node) : LogicalParameterFloat(baseLib)
{
	try
	{
		for(xml_attribute<>* attr = node->first_attribute(); attr; attr = attr->next_attribute())
		{
			std::string attributeName(attr->name());
			std::string attributeValue(attr->value());
			if(attributeName == "type") {}
			else if(attributeName == "min") min = Math::getDouble(attributeValue);
			else if(attributeName == "max") max = Math::getDouble(attributeValue);
			else if(attributeName == "default")
			{
				defaultValue = Math::getDouble(attributeValue);
				defaultValueExists = true;
			}
			else if(attributeName == "unit") unit = attributeValue;
			else _bl->out.printWarning("Warning: Unknown attribute for \"logical\" with type float: " + attributeName);
		}
		for(xml_node<>* logicalNode = node->first_node(); logicalNode; logicalNode = logicalNode->next_sibling())
		{
			std::string nodeName(logicalNode->name());
			if(nodeName == "special_value")
			{
				xml_attribute<>* attr1;
				xml_attribute<>* attr2;
				attr1 = logicalNode->first_attribute("id");
				attr2 = logicalNode->first_attribute("value");
				if(!attr1 || !attr2) continue;
				std::string valueString(attr2->value());
				specialValues[attr1->value()] = Math::getDouble(valueString);
			}
			else _bl->out.printWarning("Warning: Unknown node in \"logical\" with type float: " + nodeName);
		}
	}
    catch(const std::exception& ex)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(const Exception& ex)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(...)
    {
    	_bl->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
    }
}
static void TestInterfaceCheckSecurityOriginSafeMethodSetter(v8::Local<v8::String> name, v8::Local<v8::Value> v8Value, const v8::PropertyCallbackInfo<void>& info)
{
    v8::Isolate* isolate = info.GetIsolate();
    v8::Handle<v8::Object> holder = V8TestInterfaceCheckSecurity::findInstanceInPrototypeChain(info.This(), isolate);
    if (holder.IsEmpty())
        return;
    TestInterfaceCheckSecurity* impl = V8TestInterfaceCheckSecurity::toNative(holder);
    v8::String::Utf8Value attributeName(name);
    ExceptionState exceptionState(ExceptionState::SetterContext, *attributeName, "TestInterfaceCheckSecurity", info.Holder(), isolate);
    if (!BindingSecurity::shouldAllowAccessToFrame(isolate, impl->frame(), exceptionState)) {
        exceptionState.throwIfNeeded();
        return;
    }

    V8HiddenValue::setHiddenValue(isolate, v8::Handle<v8::Object>::Cast(info.This()), name, v8Value);
}
Esempio n. 25
0
PassRefPtrWillBeRawPtr<CSSValue> SVGElement::getPresentationAttribute(const AtomicString& name)
{
    if (!hasAttributesWithoutUpdate())
        return nullptr;

    QualifiedName attributeName(nullAtom, name, nullAtom);
    const Attribute* attr = getAttributeItem(attributeName);
    if (!attr)
        return nullptr;

    RefPtr<MutableStylePropertySet> style = MutableStylePropertySet::create(SVGAttributeMode);
    CSSPropertyID propertyID = SVGElement::cssPropertyIdForSVGAttributeName(attr->name());
    style->setProperty(propertyID, attr->value());
    RefPtrWillBeRawPtr<CSSValue> cssValue = style->getPropertyCSSValue(propertyID);
    return cssValue ? cssValue->cloneForCSSOM() : nullptr;
}
Esempio n. 26
0
bool KPrAnimSet::loadOdf(const KoXmlElement &element, KoShapeLoadingContext &context)
{
    bool retval = false;

    QString attributeName(element.attributeNS(KoXmlNS::smil, "attributeName", QString()));
    if (attributeName == "visibility") {
        m_visible = element.attributeNS(KoXmlNS::smil, "to", "hidden") == "visible";
        retval = true;
        kDebug(33003) << "animate visibility for shape with id" << m_visible;
    }
    else {
        kWarning(33003) << "attributeName" << attributeName << "not yet supported";
    }
    KPrAnimationBase::loadOdf(element, context);

    return retval;
}
QVector<ShaderAttribute> QGraphicsHelperES2::programAttributesAndLocations(GLuint programId)
{
    QVector<ShaderAttribute> attributes;
    GLint nbrActiveAttributes = 0;
    m_funcs->glGetProgramiv(programId, GL_ACTIVE_ATTRIBUTES, &nbrActiveAttributes);
    for (GLint i = 0; i < nbrActiveAttributes; i++) {
        ShaderAttribute attribute;
        QByteArray attributeName(256, '\0');
        // Size is 1 for scalar and more for struct or arrays
        // Type is the GL Type
        m_funcs->glGetActiveAttrib(programId, i, 256, NULL, &attribute.m_size, &attribute.m_type , attributeName.data());
        attribute.m_location = m_funcs->glGetAttribLocation(programId, attributeName.constData());
        attribute.m_name = QString::fromUtf8(attributeName);
        attributes.append(attribute);
    }
    return attributes;
}
Esempio n. 28
0
QString DwarfPrinter::dieRichText(DwarfDie* die)
{
    assert(die);
    QString s;
    s += "TAG: " + QLatin1String(die->tagName()) + "<br/>";
    s += "Name: " + QString::fromUtf8(die->name()).toHtmlEscaped() + "<br/>";
    s += "Offset: " + QString::number(die->offset()) + "<br/>";
    foreach (const auto attrType, die->attributes()) {
        const QVariant attrValue = die->attribute(attrType);
        QString attrValueStr;
        if (DwarfDie *die = attrValue.value<DwarfDie*>())
            attrValueStr = die->displayName();
        else
            attrValueStr = attrValue.toString();
        s += QLatin1String(die->attributeName(attrType)) + ": " + attrValueStr.toHtmlEscaped() + "<br/>";
    }
    return s;
}
void PointCloudSettingsControl::initColorAttribute()
{
	std::string attributeName((const char*)m_choiceColorAttributeName->GetStringSelection().mb_str());

	//on indique le nom de la texture
	m_ptCld.setTextureAttributeName(attributeName);

	double mini, maxi;
	m_ptCld.minmax(attributeName, mini, maxi);
	m_attributeCurrentMinValue=mini;
	m_attributeCurrentMaxValue=maxi;

	wxString miniString;
	miniString<<mini;
	wxString maxiString;
	maxiString<<maxi;
	m_textCtrlAttributeMinValue->SetValue(miniString);
	m_textCtrlAttributeMaxValue->SetValue(maxiString);
}
std::shared_ptr<LogicalParameter> LogicalParameter::fromXML(BaseLib::Obj* baseLib, xml_node<>* node)
{
	std::shared_ptr<LogicalParameter> parameter;
	try
	{
		for(xml_attribute<>* attr = node->first_attribute(); attr; attr = attr->next_attribute())
		{
			std::string attributeName(attr->name());
			std::string attributeValue(attr->value());
			if(attributeName == "type")
			{
				std::string attributeValue(attr->value());
				if(attributeValue == "option") parameter.reset(new LogicalParameterEnum(baseLib, node));
				else if(attributeValue == "integer") parameter.reset(new LogicalParameterInteger(baseLib, node));
				else if(attributeValue == "float") parameter.reset(new LogicalParameterFloat(baseLib, node));
				else if(attributeValue == "boolean") parameter.reset(new LogicalParameterBoolean(baseLib, node));
				else if(attributeValue == "string") parameter.reset(new LogicalParameterString(baseLib, node));
				else if(attributeValue == "action") parameter.reset(new LogicalParameterAction(baseLib, node));
				else baseLib->out.printWarning("Warning: Unknown logical parameter type: " + attributeValue);
			}
		}
		for(xml_node<>* subnode = node->first_node(); subnode; subnode = subnode->next_sibling())
		{
			if(std::string(subnode->name()) != "option" && std::string(subnode->name()) != "special_value") baseLib->out.printWarning("Warning: Unknown node in \"logical\": " + std::string(subnode->name(), subnode->name_size()));
		}
	}
    catch(const std::exception& ex)
    {
    	baseLib->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(const Exception& ex)
    {
    	baseLib->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__, ex.what());
    }
    catch(...)
    {
    	baseLib->out.printEx(__FILE__, __LINE__, __PRETTY_FUNCTION__);
    }
    return parameter;
}