23 #include <QDomElement>
86 QList< QgsVectorJoinInfo>::const_iterator joinIt =
mVectorJoins.constBegin();
87 for (
int joinIdx = 0 ; joinIt !=
mVectorJoins.constEnd(); ++joinIt, ++joinIdx )
96 QString joinFieldName;
97 if ( joinIt->joinFieldName.isEmpty() && joinIt->joinFieldIndex >= 0 && joinIt->joinFieldIndex < joinFields.
count() )
98 joinFieldName = joinFields.
field( joinIt->joinFieldIndex ).
name();
100 joinFieldName = joinIt->joinFieldName;
102 for (
int idx = 0; idx < joinFields.
count(); ++idx )
105 if ( joinFields[idx].name() != joinFieldName )
117 QList< QgsVectorJoinInfo >::iterator joinIt =
mVectorJoins.begin();
127 QDomElement vectorJoinsElem = document.createElement(
"vectorjoins" );
128 layer_node.appendChild( vectorJoinsElem );
129 QList< QgsVectorJoinInfo >::const_iterator joinIt =
mVectorJoins.constBegin();
132 QDomElement joinElem = document.createElement(
"join" );
134 if ( joinIt->targetFieldName.isEmpty() )
135 joinElem.setAttribute(
"targetField", joinIt->targetFieldIndex );
137 joinElem.setAttribute(
"targetFieldName", joinIt->targetFieldName );
139 joinElem.setAttribute(
"joinLayerId", joinIt->joinLayerId );
140 if ( joinIt->joinFieldName.isEmpty() )
141 joinElem.setAttribute(
"joinField", joinIt->joinFieldIndex );
143 joinElem.setAttribute(
"joinFieldName", joinIt->joinFieldName );
145 joinElem.setAttribute(
"memoryCache", !joinIt->cachedAttributes.isEmpty() );
146 vectorJoinsElem.appendChild( joinElem );
153 QDomElement vectorJoinsElem = layer_node.firstChildElement(
"vectorjoins" );
154 if ( !vectorJoinsElem.isNull() )
156 QDomNodeList joinList = vectorJoinsElem.elementsByTagName(
"join" );
157 for (
int i = 0; i < joinList.size(); ++i )
159 QDomElement infoElem = joinList.at( i ).toElement();
162 info.
joinLayerId = infoElem.attribute(
"joinLayerId" );
164 info.
memoryCache = infoElem.attribute(
"memoryCache" ).toInt();
180 int sourceJoinIndex = originIndex / 1000;
181 sourceFieldIndex = originIndex % 1000;
183 if ( sourceJoinIndex < 0 || sourceJoinIndex >=
mVectorJoins.count() )