[Marble-bugs] [marble] [Bug 317719] New: Marble can't show several DataLayers in QML applidation

Oleg Lyubimov lyubimov.o.e at gmail.com
Tue Apr 2 09:53:29 UTC 2013


https://bugs.kde.org/show_bug.cgi?id=317719

            Bug ID: 317719
           Summary: Marble can't show several DataLayers in QML
                    applidation
    Classification: Unclassified
           Product: marble
           Version: 1.4.0 (KDE 4.9.0)
          Platform: Other
                OS: Linux
            Status: UNCONFIRMED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: marble-bugs at kde.org
          Reporter: lyubimov.o.e at gmail.com

When you write QML application using MarbleDeclarativeWidget and declare
several (at least two) DataLayers with different list models, Marble shows only
the last dataLayer and doesn't show other layers. 

Reproducible: Always

Steps to Reproduce:
1. Create QML application with 2 dataLayers (see code examples below)
2. Run the application and see only the second layer at the map.
#----------------- QML
files---------------------------------------------------------
//#### Layer.qml #######################################
import QtQuick 1.1
import org.kde.edu.marble 0.11

MarbleWidget {
    id: widget
    width: 800;
    height: 600
    dataLayers: [

        DataLayer{
            id: la1
            // The model defines the data that will appear. The lon and lat
            // property of its items define their position
            // See SevenWondersOfTheAncientWorld.qml for details
            model: Model1 {}
            delegate: Rectangle {
                width: 100;
                height: 20;
                border.color: "darkgray"; border.width: 2
                radius: 4; smooth: true
                Column {
                    id: column; x: 4; y: 4; spacing: 4
                    Text {
                        id: label
                        // "name" is a property defined by items in the model
                        text: "Delegate#2"
                        width: 92
                        wrapMode: Text.Wrap
                        font.bold: true
                    }
                }
            }
        }
       ,

    DataLayer{
        id: la2
        model: Model2{}
        delegate: Rectangle {
            width: 100;
            height: 20;
            color: "blue"
            Text {
                anchors.centerIn: parent
                font.bold: true
                text: "Delegate#1"
            }
        }
    }
   ]
}
//########### Model1.qml #########################
import QtQuick 1.1

ListModel {
    ListElement{
        lon: 44.4275; lat: 32.5355
    }
    ListElement{
        lon: 28.227778; lat: 36.451111
    }
    ListElement{
        lon: 31.134358; lat: 29.979175
    }
}
############## Model2.qml ####################
import QtQuick 1.1

ListModel {

    ListElement{
        lon: 70.424056; lat: 47.037944
    }
    ListElement{
        lon: 75.363889; lat: 47.949722
    }
    ListElement{
        lon: 80.63; lat: 47.637861
    }
}
//######### End ###########
Actual Results:  
You see only the last dataLayer on the map.

Expected Results:  
You should see all dataLayers on the map.

I have spend some time to investigate this bug. and make following conclusions:
    1) function void LayerManager::Private::addPlugins() looks in the variable
m_renderPlugins, and if it is not contain element with current name add this
element to m_renderPlugins.
 In my test application addPlugins() adds the first plugin with dataLayer -
"DeclarativeDataPlugin_1" 
when addPlugins() is called to add the second plugin with dataLayer -
"DeclarativeDataPlugin_2", but the m_renderPlugins contains the element with
name "DeclarativeDataPlugin_2" (instead of  "DeclarativeDataPlugin_1").
"DeclarativeDataPlugin_2 in m_renderPlugins has the same address with 
"DeclarativeDataPlugin_1" . Something change this elent and I don't understand
what is that.
--- So, we need to go deeper---------
   2)  We should look at function "Marble::RenderPlugin
*DeclarativeDataPlugin::newInstance(const Marble::MarbleModel *marbleModel)
const"
if you add qDebug to the start and to the end of this function 
( qDebug() << "Instance NameID Before" << d->m_nameId;
qDebug() << "Instance After NameID" << instance->nameId();)
you see, that the name ID is different.  I have add this "dog-nail" 

Marble::RenderPlugin *DeclarativeDataPlugin::newInstance(const
Marble::MarbleModel *marbleModel) const
{
    QString name_Id_tmp = nameId();
      .
      .
    d->m_modelInstances << dataModel;
     instance->setNameId(name_Id_tmp);
    qDebug() << "Instance After NameID" << instance->nameId();
    return instance;
}

and the becomes not reproducible (I see all dataLayers on the map).
I can't find the reason, why nameId is changed in this function, but this fix
works. 
Dear Marble Developers, could you tell me your mine about this bug. Where I
should look to find the real reason of this bug?

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Marble-bugs mailing list