Esempio n. 1
0
QgsWMSLayerItem::QgsWMSLayerItem( QgsDataItem *parent, QString name, QString path, const QgsWmsCapabilitiesProperty &capabilitiesProperty, const QgsDataSourceUri &dataSourceUri, const QgsWmsLayerProperty &layerProperty )
  : QgsLayerItem( parent, name, path, QString(), QgsLayerItem::Raster, QStringLiteral( "wms" ) )
  , mCapabilitiesProperty( capabilitiesProperty )
  , mDataSourceUri( dataSourceUri )
  , mLayerProperty( layerProperty )
{
  mSupportedCRS = mLayerProperty.crs;
  mSupportFormats = mCapabilitiesProperty.capability.request.getMap.format;
  QgsDebugMsg( "uri = " + mDataSourceUri.encodedUri() );

  mUri = createUri();

  // Populate everything, it costs nothing, all info about layers is collected
  for ( const QgsWmsLayerProperty &layerProperty : qgis::as_const( mLayerProperty.layer ) )
  {
    // Attention, the name may be empty
    QgsDebugMsg( QString::number( layerProperty.orderId ) + ' ' + layerProperty.name + ' ' + layerProperty.title );
    QString pathName = layerProperty.name.isEmpty() ? QString::number( layerProperty.orderId ) : layerProperty.name;
    QgsWMSLayerItem *layer = new QgsWMSLayerItem( this, layerProperty.title, mPath + '/' + pathName, mCapabilitiesProperty, dataSourceUri, layerProperty );
    //mChildren.append( layer );
    addChildItem( layer );
  }

  mIconName = QStringLiteral( "mIconWms.svg" );

  setState( Populated );
}
Esempio n. 2
0
void SunMenuItemView::childItemAdded(MenuItemModel* newMenu)
{
    MenuItemModel* parent = static_cast<MenuItemModel*>(sender());
    Q_ASSERT(parent == mItemModel);

    addChildItem(newMenu);

    recalculateChildMenusAngles();
}
Esempio n. 3
0
	void ScutCxListItem::addChildItem(CCNode *child)
	{
		LayoutParam layout;
		layout.val_x.t = ABS_WITH_PIXEL;
		layout.val_y.t = ABS_WITH_PIXEL;

		CCPoint point = child->getPosition();
		layout.val_x.val.pixel_val = point.x;
		layout.val_y.val.pixel_val = point.y;

		addChildItem(child,layout);
	}
Esempio n. 4
0
void QgsDataItem::populate()
{
  if ( mPopulated )
    return;

  QgsDebugMsg( "mPath = " + mPath );

  QVector<QgsDataItem*> children = createChildren();
  foreach ( QgsDataItem *child, children )
  {
    // initialization, do not refresh! That would result in infinite loop (beginInsertItems->rowCount->populate)
    addChildItem( child );
  }
Esempio n. 5
0
void QgsCptCityDataItem::populate()
{
  if ( mPopulated )
    return;

  QgsDebugMsg( "mPath = " + mPath );

  QApplication::setOverrideCursor( Qt::WaitCursor );

  QVector<QgsCptCityDataItem *> children = createChildren();
  Q_FOREACH ( QgsCptCityDataItem *child, children )
  {
    // initialization, do not refresh! That would result in infinite loop (beginInsertItems->rowCount->populate)
    addChildItem( child );
  }
Esempio n. 6
0
void SunMenuItemView::initialize()
{
    Q_ASSERT_X(mItemModel != 0 && mItemModel->displayedItem() != 0,
               "MenuItemView::initialize()",
               "You should pass a valid MenuItemModel pointer");

    Q_ASSERT_X(mParentLayer != 0, "MenuItemView::initialize()",
               "Parent layer for item MUST be specified.");

    connect(representation(),SIGNAL(brushChanged(const QBrush&)), this, SLOT(updateBrush(const QBrush&)));
    updateBrush(representation()->brush());

    setAcceptHoverEvents(true);
    setParent(mItemModel);
    setParentItem(mParentItemView);

    // Cache useless in this situation because we don't use transformation and menu doesn't change it's position.
    //It's increases memory usage and greatly reduces the animation performance.
    setCacheMode(QGraphicsItem::NoCache);
    //	setFlag(QGraphicsItem::ItemStacksBehindParent, true);

    if (mItemModel->displayedItem()->graphicsItem())
        mItemModel->displayedItem()->graphicsItem()->setParentItem(this);

    connect(mItemModel, SIGNAL(childAdded(MenuItemModel*)), this,
            SLOT(childItemAdded(MenuItemModel*)));

    mSubLayer = 0;

    mStartAngle = 0;
    mSweepLength = 0;
    mWidth = 0;
    mInnerRadius = 0;

    if (!mItemModel->childMenus().isEmpty())
    {
        foreach(MenuItemModel* mc, mItemModel->childMenus())
            addChildItem(mc);
    }

    updateShape();
    recalculateChildMenusAngles();
}
Esempio n. 7
0
void QgsMssqlConnectionItem::refresh()
{
  QgsDebugMsg( "mPath = " + mPath );

  // read up the schemas and layers from database
  QVector<QgsDataItem*> items = createChildren();

  // Add new items
  foreach ( QgsDataItem *item, items )
  {
    // Is it present in childs?
    int index = findItem( mChildren, item );
    if ( index >= 0 )
    {
      (( QgsMssqlSchemaItem* )mChildren[index] )->addLayers( item );
      delete item;
      continue;
    }
    addChildItem( item, true );
  }
Esempio n. 8
0
void QgsDb2ConnectionItem::refresh()
{
  QgsDebugMsg( "db2 mPath = " + mPath );

  // read up the schemas and layers from database
  QVector<QgsDataItem *> items = createChildren();

  // Add new items
  Q_FOREACH ( QgsDataItem *item, items )
  {
    // Is it present in children?
    int index = findItem( mChildren, item );
    if ( index >= 0 )
    {
      ( ( QgsDb2SchemaItem * )mChildren.at( index ) )->addLayers( item );
      delete item;
      continue;
    }
    addChildItem( item, true );
  }
Esempio n. 9
0
 foreach ( QgsDataItem *item, createChildren() )
 {
   addChildItem( item, true );
 }
Esempio n. 10
0
 Q_FOREACH ( QgsDataItem *item, createChildren() )
 {
   addChildItem( item, true );
 }
Esempio n. 11
0
	void ScutCxListItem::addChildItem(CCNode *child, const LayoutParam &layout)
	{
		addChildItem(child, layout, 0);		
	}
Esempio n. 12
0
 foreach ( QgsDataItem *item, createChildren() )
 {
   QgsDebugMsg( QString( "Adding child %1" ).arg( item->name() ) );
   addChildItem( item, true );
 }