22 template<
typename PropertyClass,
typename NodeType,
typename EdgeType>
23 QVariant StandardPropertyToQVariantConverter<PropertyClass,NodeType,EdgeType>::getValue(
unsigned int id,tlp::ElementType elementType,
tlp::PropertyInterface* property)
const {
24 if(elementType == tlp::NODE) {
25 return QVariant::fromValue<NodeType>(
static_cast<PropertyClass*
>(property)->getNodeValue(
tlp::node(
id)));
28 return QVariant::fromValue<EdgeType>(
static_cast<PropertyClass*
>(property)->getEdgeValue(
tlp::edge(
id)));
32 template<
typename PropertyClass,
typename NodeType,
typename EdgeType>
33 QVariant StandardPropertyToQVariantConverter<PropertyClass,NodeType,EdgeType>::getNormalizedValue(
unsigned int,tlp::ElementType,
tlp::PropertyInterface*,
tlp::Graph*)
const {
37 template<
typename PropertyClass,
typename NodeType,
typename EdgeType>
38 bool StandardPropertyToQVariantConverter<PropertyClass,NodeType,EdgeType>::setValue(
unsigned int id,tlp::ElementType elementType,
tlp::PropertyInterface* property,
const QVariant& data)
const {
39 PropertyClass* p =
static_cast<PropertyClass*
>(property);
41 if(elementType == tlp::NODE) {
42 const NodeType& oldValue = p->getNodeValue(
tlp::node(
id));
43 NodeType newValue = data.value<NodeType>();
45 if(oldValue != newValue) {
51 const EdgeType& oldValue = p->getEdgeValue(
tlp::edge(
id));
52 EdgeType newValue = data.value<EdgeType>();
54 if(oldValue != newValue) {
55 p->setEdgeValue(
tlp::edge(
id),data.value<EdgeType>());
63 template<
typename PropertyClass,
typename NodeType,
typename EdgeType>
64 bool StandardPropertyToQVariantConverter<PropertyClass,NodeType,EdgeType>::setAllValue(tlp::ElementType elementType,
tlp::PropertyInterface* property,
const QVariant& data)
const {
65 PropertyClass* p =
static_cast<PropertyClass*
>(property);
67 if(elementType == tlp::NODE) {
68 p->setAllNodeValue(data.value<NodeType>());
71 p->setAllEdgeValue(data.value<EdgeType>());