//introduced in 1.8
void QgsMapLayerRegistry::removeMapLayers( QStringList theLayerIds )
{
  if ( theLayerIds.isEmpty() )
  {
    return;
  }
  emit layersWillBeRemoved( theLayerIds );

  foreach ( const QString &myId, theLayerIds )
  {
    QgsMapLayer* lyr = mMapLayers[myId];
    if ( mOwnedLayers.contains( lyr ) )
    {
      emit layerWillBeRemoved( myId );
      if ( lyr == mRedliningLayer )
      {
        mRedliningLayer = nullptr;
      }
      else if ( lyr == mGpsRoutesLayer )
      {
        mGpsRoutesLayer = nullptr;
      }
      delete lyr;
      mOwnedLayers.remove( lyr );
    }
    mMapLayers.remove( myId );
    emit layerRemoved( myId );
  }
Example #2
0
int Tiled::Internal::MapScene::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QGraphicsScene::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: setGridVisible((*reinterpret_cast< bool(*)>(_a[1]))); break;
        case 1: refreshScene(); break;
        case 2: repaintRegion((*reinterpret_cast< const QRegion(*)>(_a[1]))); break;
        case 3: currentLayerIndexChanged(); break;
        case 4: mapChanged(); break;
        case 5: tilesetChanged((*reinterpret_cast< Tileset*(*)>(_a[1]))); break;
        case 6: layerAdded((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: layerRemoved((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 8: layerChanged((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 9: objectsAdded((*reinterpret_cast< const QList<MapObject*>(*)>(_a[1]))); break;
        case 10: objectsRemoved((*reinterpret_cast< const QList<MapObject*>(*)>(_a[1]))); break;
        case 11: objectsChanged((*reinterpret_cast< const QList<MapObject*>(*)>(_a[1]))); break;
        case 12: updateSelectedObjectItems(); break;
        default: ;
        }
        _id -= 13;
    }
    return _id;
}
Example #3
0
//introduced in 1.8
void QgsMapLayerRegistry::removeMapLayers( QStringList theLayerIds )
{
  emit layersWillBeRemoved( theLayerIds );

  foreach ( const QString &myId, theLayerIds )
  {
    QgsMapLayer* lyr = mMapLayers[myId];
    emit layerWillBeRemoved( myId );
    if ( mOwnedLayers.contains( lyr ) )
    {
      delete lyr;
      mOwnedLayers.remove( lyr );
    }
    mMapLayers.remove( myId );
    emit layerRemoved( myId );
  }
bool LayerContainer::removeLayerRaw(Layer* layer)
{
    int index = layerIndex(layer);

    if ( index < 0 || index > layers_.size() )
        return false;

    layers_.removeAt(index);

    onRemoveLayer(layer);

    disconnect(layer, &LayerContainer::layerAdded, this, &LayerContainer::layerAdded);
    disconnect(layer, &LayerContainer::layerRemoved, this, &LayerContainer::layerRemoved);

    emit layerRemoved(layer, this, index);

    return true;
}
void medViewContainer::setView(medAbstractView *view)
{
    if(d->view)
    {
        d->view->viewWidget()->hide();
        this->removeInternView();
    }
    if(view)
    {
        d->view = view;
        connect(d->view, SIGNAL(destroyed()), this, SLOT(removeInternView()));
        connect(d->view, SIGNAL(selectedRequest(bool)), this, SLOT(setSelected(bool)));

        if(medAbstractLayeredView* layeredView = dynamic_cast<medAbstractLayeredView*>(view))
        {
            connect(layeredView, SIGNAL(currentLayerChanged()), this, SIGNAL(currentLayerChanged()));
            connect(layeredView, SIGNAL(currentLayerChanged()), this, SLOT(updateToolBar()));
            connect(layeredView, SIGNAL(layerAdded(uint)), this, SIGNAL(viewContentChanged()));
            connect(layeredView, SIGNAL(layerRemoved(uint)), this, SIGNAL(viewContentChanged()));
        }

        if (medAbstractImageView* imageView = dynamic_cast <medAbstractImageView*> (view))
        {
            if (!d->userSplittable)
                imageView->fourViewsParameter()->hide();
        }
        
        d->maximizedAction->setEnabled(true);
        d->defaultWidget->hide();
        d->mainLayout->addWidget(d->view->viewWidget(), 2, 0, 1, 1);
        d->view->viewWidget()->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::MinimumExpanding);
        d->view->viewWidget()->show();

        emit viewChanged();
    }
}