コード例 #1
0
TextRepresentation::TextRepresentation(const std::string name) : Representation(name)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(TextRepresentation, std::shared_ptr<SurgSim::Framework::Asset>,
									  Font, getFont, setFont);

	// Enables the alternative use of the font file instead of the actual font object
	DecoderType decoder = std::bind(&TextRepresentation::loadFont, this,
									std::bind(&YAML::Node::as<std::string>, std::placeholders::_1));
	setDecoder("FontFileName", decoder);

	SetterType setter = std::bind(&TextRepresentation::loadFont, this,
								  std::bind(SurgSim::Framework::convert<std::string>, std::placeholders::_1));
	setSetter("FontFileName", setter);

	SURGSIM_ADD_SERIALIZABLE_PROPERTY(TextRepresentation, std::string, Text, getText, setText);

	SURGSIM_ADD_SERIALIZABLE_PROPERTY(TextRepresentation, double, FontSize, getFontSize, setFontSize);

	SURGSIM_ADD_SERIALIZABLE_PROPERTY(TextRepresentation, SurgSim::DataStructures::OptionalValue<double>,
									  MaximumWidth, getOptionalMaximumWidth, setOptionalMaximumWidth);

	SURGSIM_ADD_SERIALIZABLE_PROPERTY(SurgSim::Graphics::TextRepresentation, SurgSim::Math::Vector4d,
									  Color, getColor, setColor);

}
コード例 #2
0
void PropertyDescriptor::setCustomDescriptor(unsigned attributes)
{
    ASSERT(!(attributes & PropertyAttribute::CustomValue));
    m_attributes = attributes | PropertyAttribute::Accessor | PropertyAttribute::CustomAccessor;
    m_attributes &= ~PropertyAttribute::ReadOnly;
    m_seenAttributes = EnumerablePresent | ConfigurablePresent;
    setGetter(jsUndefined());
    setSetter(jsUndefined());
    m_value = JSValue();
}
コード例 #3
0
ファイル: GetterSetter.cpp プロジェクト: biddyweb/switch-oss
GetterSetter* GetterSetter::withSetter(VM& vm, JSGlobalObject* globalObject, JSObject* newSetter)
{
    if (isSetterNull()) {
        setSetter(vm, globalObject, newSetter);
        return this;
    }
    
    GetterSetter* result = GetterSetter::create(vm, globalObject);
    result->setGetter(vm, globalObject, getter());
    result->setSetter(vm, globalObject, newSetter);
    return result;
}
コード例 #4
0
CurveRepresentation::CurveRepresentation(const std::string& name) : Representation(name)
{
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(CurveRepresentation, size_t, Subdivisions, getSubdivisions, setSubdivisions);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(CurveRepresentation, double, Tension, getTension, setTension);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(CurveRepresentation, Math::Vector4d, Color, getColor, setColor);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(CurveRepresentation, double, Width, getWidth, setWidth);
	SURGSIM_ADD_SERIALIZABLE_PROPERTY(CurveRepresentation, bool, AntiAliasing, isAntiAliasing, setAntiAliasing);

	// Provide a common entry point accepting VerticesPlain under the label "Vertices"
	// this can be used by behaviors to address this structure and the point cloud the same way
	auto converter = std::bind(SurgSim::Framework::convert<DataStructures::VerticesPlain>, std::placeholders::_1);
	auto functor = std::bind((void(CurveRepresentation::*)(const DataStructures::VerticesPlain&))
							 &CurveRepresentation::updateControlPoints, this, converter);

	setSetter("Vertices", functor);
}