Exemplo n.º 1
0
void QGVPage::toggleMarkers(bool enable)
{
    QList<QGraphicsItem*> list = scene()->items();
    for (QList<QGraphicsItem*>::iterator it = list.begin(); it != list.end(); ++it) {
        QGIView *itemView = dynamic_cast<QGIView *>(*it);
        if(itemView) {
            itemView->setSelected(false);
            itemView->toggleBorder(enable);
            QGIViewPart *viewPart = dynamic_cast<QGIViewPart *>(*it);
            if(viewPart) {
                viewPart->toggleVertices(enable);
            }
        }
        QGISVGTemplate* itemTemplate = dynamic_cast<QGISVGTemplate*> (*it);
        if (itemTemplate) {
            std::vector<TemplateTextField *> textFields = itemTemplate->getTextFields();
            for (auto& t:textFields) {
                if (enable) {
                    t->show();
                } else {
                    t->hide();
                }
            }
        }
    }
}
Exemplo n.º 2
0
void MDIViewPage::clearSelection()
{
  blockSelection(true);
  std::vector<QGIView *> views = m_view->getViews();

  // Iterate through all views and unselect all
  for (std::vector<QGIView *>::iterator it = views.begin(); it != views.end(); ++it) {
      QGIView *item = *it;
      item->setSelected(false);
      item->updateView();
  }

  blockSelection(false);
}
Exemplo n.º 3
0
//!Update QGVPage's selection based on Selection made outside Drawing Interface
//invoked from VPP
void MDIViewPage::selectFeature(App::DocumentObject *obj, const bool isSelected)
{
    App::DocumentObject* objCopy = obj;
    TechDraw::DrawHatch* hatchObj = dynamic_cast<TechDraw::DrawHatch*>(objCopy);
    if (hatchObj) {                                                    //Hatch does not have a QGIV of it's own. mark parent as selected.
        objCopy = hatchObj->getSourceView();                           //possible to highlight subObject?
    }
    QGIView *view = m_view->findQViewForDocObj(objCopy);

    blockSelection(true);
    if(view) {
        view->setSelected(isSelected);
        view->updateView();
    }
    blockSelection(false);
}