|
24 | 24 | #include "qgsmaplayerregistry.h"
|
25 | 25 | #include "qgsmslayercache.h"
|
26 | 26 | #include "qgsrasterlayer.h"
|
| 27 | +#include "qgsvectorlayerjoinbuffer.h" |
27 | 28 | #include "qgseditorwidgetregistry.h"
|
28 | 29 | #include "qgslayertreegroup.h"
|
29 | 30 | #include "qgslogger.h"
|
@@ -237,7 +238,8 @@ QgsMapLayer* QgsServerProjectParser::createLayerFromElement( const QDomElement&
|
237 | 238 | {
|
238 | 239 | QgsVectorLayer* vlayer = qobject_cast<QgsVectorLayer *>( layer );
|
239 | 240 | addValueRelationLayersForLayer( vlayer );
|
240 |
| - addJoinsToLayer( const_cast<QDomElement&>( elem ), vlayer ); |
| 241 | + QgsVectorLayerJoinBuffer* joinBuffer = vlayer->joinBuffer(); |
| 242 | + joinBuffer->readXml( const_cast<QDomElement&>( elem ) ); |
241 | 243 | }
|
242 | 244 |
|
243 | 245 | return layer;
|
@@ -1552,50 +1554,6 @@ void QgsServerProjectParser::addJoinLayersForElement( const QDomElement& layerEl
|
1552 | 1554 | }
|
1553 | 1555 | }
|
1554 | 1556 |
|
1555 |
| -// Based on QgsVectorLayerJoinBuffer::readXml |
1556 |
| -void QgsServerProjectParser::addJoinsToLayer( const QDomElement& layerElem, QgsVectorLayer *vl ) const |
1557 |
| -{ |
1558 |
| - if ( !vl ) |
1559 |
| - return; |
1560 |
| - |
1561 |
| - QDomElement vectorJoinsElem = layerElem.firstChildElement( "vectorjoins" ); |
1562 |
| - if ( vectorJoinsElem.isNull() ) |
1563 |
| - { |
1564 |
| - return; |
1565 |
| - } |
1566 |
| - |
1567 |
| - QDomNodeList joinList = vectorJoinsElem.elementsByTagName( "join" ); |
1568 |
| - for ( int i = 0; i < joinList.size(); ++i ) |
1569 |
| - { |
1570 |
| - QDomElement infoElem = joinList.at( i ).toElement(); |
1571 |
| - QgsVectorJoinInfo info; |
1572 |
| - info.joinFieldName = infoElem.attribute( "joinFieldName" ); |
1573 |
| - info.joinLayerId = infoElem.attribute( "joinLayerId" ); |
1574 |
| - info.targetFieldName = infoElem.attribute( "targetFieldName" ); |
1575 |
| - info.memoryCache = infoElem.attribute( "memoryCache" ).toInt(); |
1576 |
| - |
1577 |
| - info.joinFieldIndex = infoElem.attribute( "joinField" ).toInt(); //for compatibility with 1.x |
1578 |
| - info.targetFieldIndex = infoElem.attribute( "targetField" ).toInt(); //for compatibility with 1.x |
1579 |
| - |
1580 |
| - QDomElement subsetElem = infoElem.firstChildElement( "joinFieldsSubset" ); |
1581 |
| - if ( !subsetElem.isNull() ) |
1582 |
| - { |
1583 |
| - QStringList* fieldNames = new QStringList; |
1584 |
| - QDomNodeList fieldNodes = infoElem.elementsByTagName( "field" ); |
1585 |
| - for ( int i = 0; i < fieldNodes.count(); ++i ) |
1586 |
| - *fieldNames << fieldNodes.at( i ).toElement().attribute( "name" ); |
1587 |
| - info.setJoinFieldNamesSubset( fieldNames ); |
1588 |
| - } |
1589 |
| - |
1590 |
| - if ( infoElem.attribute( "hasCustomPrefix" ).toInt() ) |
1591 |
| - info.prefix = infoElem.attribute( "customPrefix" ); |
1592 |
| - else |
1593 |
| - info.prefix = QString::null; |
1594 |
| - |
1595 |
| - vl->addJoin( info ); |
1596 |
| - } |
1597 |
| -} |
1598 |
| - |
1599 | 1557 | void QgsServerProjectParser::addValueRelationLayersForLayer( const QgsVectorLayer *vl ) const
|
1600 | 1558 | {
|
1601 | 1559 | if ( !vl )
|
|
0 commit comments