Пример #1
0
QWidget *MarbleWidgetPlugin::createWidget(QWidget *parent)
{
    Marble::MarbleWidget* marbleWidget = new Marble::MarbleWidget( parent );
    marbleWidget->setMapThemeId("earth/srtm/srtm.dgml");

    return marbleWidget;
}
Пример #2
0
int KoReportItemMaps::renderSimpleData(OROPage *page, OROSection *section, const QPointF &offset,
                                       const QVariant &data, KRScriptHandler *script)
{
    Q_UNUSED(script)
    
    myDebug() << this << "data:" << data;
    QString dataKey = data.toString();
    QStringList dataList = dataKey.split(QLatin1Char(';'));
    //myDebug() << "splited:" << dataList;
    Marble::MarbleWidget* marble;
    
    if(m_marbles.count(dataKey)==0){ //no such marble yet
        marble = initMarble();
        m_marbles.insert(dataKey, marble);
        connect(marble->model(), SIGNAL(modelChanged()), this, SLOT(requestRedraw()));
        if(dataList.count()==3){
            marble->setCenterLatitude(dataList[0].toDouble());
            marble->setCenterLongitude(dataList[1].toDouble());
            marble->zoomView(dataList[2].toInt());
        }
    }else{
        marble = m_marbles[dataKey];
    }

    marble->render(m_mapImage);
    
    OROImage * id = new OROImage();
    id->setImage(*m_mapImage);
    id->setScaled(false);

    id->setPosition(m_pos.toScene() + offset);
    id->setSize(m_size.toScene());
    OroIds oroIds;
    if (page) {
        page->addPrimitive(id);
        oroIds.pageId = id;
        myDebug() << "page:id=" <<id;
    }
    
    if (section) {
        OROImage *i2 = dynamic_cast<OROImage*>(id->clone());
        i2->setPosition(m_pos.toPoint());
        section->addPrimitive(i2);
        oroIds.sectionId = i2;
        myDebug() << "section:id=" << i2;
    }
    
    if (!page) {
        delete id;
        oroIds.pageId=0;
    }
    oroIds.marbleWidget = marble;
    m_marbleImgs[marble->model()]=oroIds;
    
    return 0; //Item doesn't stretch the section height
}
Пример #3
0
Marble::MarbleWidget* KoReportItemMaps::initMarble()
{
    Marble::MarbleWidget* marble = new Marble::MarbleWidget();
    //marble->setMapThemeId("earth/srtm/srtm.dgml");
    
    marble->setMapThemeId("earth/openstreetmap/openstreetmap.dgml");
    
    marble->centerOn(20.81,52.12, false);
    marble->zoomView(2100);
    marble->setShowOverviewMap(false);
    marble->setFixedSize(m_size.toScene().toSize());
    return marble;
}