当前位置: 首页>>代码示例>>C++>>正文


C++ KstViewWindow类代码示例

本文整理汇总了C++中KstViewWindow的典型用法代码示例。如果您正苦于以下问题:C++ KstViewWindow类的具体用法?C++ KstViewWindow怎么用?C++ KstViewWindow使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了KstViewWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: while

bool KstIfaceImpl::setPlotAxes(const QString& plotName,
    int XLower,
    int XUpper,
    int YLower,
    int YUpper) {
  //find the plot
  KstApp *app = KstApp::inst();
  KMdiIterator<KMdiChildView*> *iter = app->createIterator();
  while (iter->currentItem()) {
    KMdiChildView *childview = iter->currentItem();
    KstViewWindow *viewwindow = dynamic_cast<KstViewWindow*>(childview);
    if (viewwindow) {
      Kst2DPlotList plotlist = viewwindow->view()->findChildrenType<Kst2DPlot>(false);
      Kst2DPlotList::Iterator plot_iter=plotlist.findTag(plotName);
      if (plot_iter != plotlist.end()) {
        app->deleteIterator(iter);
      
        (*plot_iter)->setXScaleMode(FIXED);
        (*plot_iter)->setYScaleMode(FIXED);
        (*plot_iter)->setScale(XLower, YLower,
                              XUpper, YUpper);  //set the scale
        
        // repaint the plot 
        (*plot_iter)->setDirty();
        viewwindow->view()->paint(KstPainter::P_PLOT);
        return true;
      }
    }
    iter->next();
  }
  app->deleteIterator(iter);
  return false;
}
开发者ID:,项目名称:,代码行数:33,代码来源:

示例2: placeInPlot

void KstImageDialogI::placeInPlot(KstImagePtr image) {
  KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_w->_curvePlacement->_plotWindow->currentText()));
  if (!w) {
    QString n = KstApp::inst()->newWindow(KST::suggestWinName());
    w = static_cast<KstViewWindow*>(KstApp::inst()->findWindow(n));
  }
  if (w) {
    Kst2DPlotPtr plot;
    if (_w->_curvePlacement->existingPlot()) {
      /* assign image to plot */
      plot = kst_cast<Kst2DPlot>(w->view()->findChild(_w->_curvePlacement->plotName()));
      if (plot) {
        plot->addCurve(KstBaseCurvePtr(image));
      }
    }

    if (_w->_curvePlacement->newPlot()) {
      /* assign image to plot */
      QString name = w->createObject<Kst2DPlot>(KST::suggestPlotName());
      if (_w->_curvePlacement->reGrid()) {
        w->view()->cleanup(_w->_curvePlacement->columns());
      }
      plot = kst_cast<Kst2DPlot>(w->view()->findChild(name));
      if (plot) {
        _w->_curvePlacement->update();
        _w->_curvePlacement->setCurrentPlot(plot->tagName());
        plot->setXScaleMode(AUTO);
        plot->setYScaleMode(AUTO);
        plot->addCurve(KstBaseCurvePtr(image));
        plot->generateDefaultLabels();
      }
    }
  }
}
开发者ID:,项目名称:,代码行数:34,代码来源:

示例3: createSyntaxError

KJS::Object KstBindLegend::construct(KJS::ExecState *exec, const KJS::List& args) {
  if (args.size() == 0 || args.size() > 2) {
    return createSyntaxError(exec);
  }

  KstViewObjectPtr view = extractViewObject(exec, args[0]);
  if (!view) {
    KstViewWindow *w = extractWindow(exec, args[0]);
    if (w) {
      view = w->view();
    } else {
      return createTypeError(exec, 0);
    }
  }

  QString txt;
  if (args.size() == 2) {
    if (args[1].type() != KJS::StringType) {
      return createTypeError(exec, 1);
    }
    txt = args[1].toString(exec).qstring();
  }

  KstViewLegendPtr b = new KstViewLegend;
  view->appendChild(b.data());
  KstApp::inst()->paintAll(KstPainter::P_PAINT);
  return KJS::Object(new KstBindLegend(exec, b));
}
开发者ID:,项目名称:,代码行数:28,代码来源:

示例4: columns

int KstGuiData::columns(const QString& window) {
  KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(window));
  if (w) {
    KstTopLevelViewPtr view = w->view();
    if (view->onGrid()) {
      return view->columns();
    }
  }
  return -1;
}
开发者ID:,项目名称:,代码行数:10,代码来源:

示例5: plotList

QStringList KstIfaceImpl::plotList(const QString& window) {
  QStringList rc;
  KstApp *app = KstApp::inst();
  KMdiChildView *c = app->findWindow(window);
  KstViewWindow *v = dynamic_cast<KstViewWindow*>(c);
  if (v) {
    Kst2DPlotList l = v->view()->findChildrenType<Kst2DPlot>(false);
    for (Kst2DPlotList::Iterator i = l.begin(); i != l.end(); ++i) {
      rc += (*i)->tagName();
    }
  }
  return rc;
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例6: it

void KstObjectItem::paintPlot(Kst2DPlotPtr p) {
  KstApp *app = KstApp::inst();
  QList<KMdiChildView*> childViews = app->childViews();
  QListIterator<KMdiChildView*> it(childViews);
  while (it.hasNext()) {
    KstViewWindow *v = dynamic_cast<KstViewWindow*>(it.next());
    if (v && v->view()->contains(kst_cast<KstViewObject>(p))) {
      v->view()->paint(KstPainter::P_PLOT);
      break;
    }
    it.next();
  }
}
开发者ID:,项目名称:,代码行数:13,代码来源:

示例7: KstVectorPtr

bool KstFilterDialogI::createCurve(KstCPluginPtr plugin) {
  KstVectorPtr xVector;
  KstVectorPtr yVector;

  KST::vectorList.lock().readLock();
  KstVectorList::Iterator it = KST::vectorList.findTag(_xvector);
  if (it != KST::vectorList.end()) {
    xVector = *it;
  }
  KST::vectorList.lock().unlock();

  if (plugin->outputVectors().contains(plugin->plugin()->data()._filterOutputVector)) {
    yVector = plugin->outputVectors()[plugin->plugin()->data()._filterOutputVector];
  }

  if (!xVector || !yVector) {
    return false;
  }
  plugin->setDirty();
  QString c_name = KST::suggestCurveName(plugin->tag(), true);
  QColor color = KstApp::inst()->chooseColorDlg()->getColorForCurve(KstVectorPtr(xVector), KstVectorPtr(yVector));
  if (!color.isValid()) {
    color = _w->_curveAppearance->color();
  }
  KstVCurvePtr fit = new KstVCurve(c_name, KstVectorPtr(xVector), KstVectorPtr(yVector), KstVectorPtr(0L), KstVectorPtr(0L), KstVectorPtr(0L), KstVectorPtr(0L), color);

  fit->setHasPoints(_w->_curveAppearance->showPoints());
  fit->setHasLines(_w->_curveAppearance->showLines());
  fit->setHasBars(_w->_curveAppearance->showBars());
  fit->setLineWidth(_w->_curveAppearance->lineWidth());
  fit->setLineStyle(_w->_curveAppearance->lineStyle());
  fit->setPointStyle(_w->_curveAppearance->pointType());
  fit->setBarStyle(_w->_curveAppearance->barStyle());
  fit->setPointDensity(_w->_curveAppearance->pointDensity());

  KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_window));
  if (w && w->view()->findChild(_plotName)) {
    Kst2DPlotPtr plot = kst_cast<Kst2DPlot>(w->view()->findChild(_plotName));
    if (plot) {
      plot->addCurve(fit.data());
    }
  }

  KST::dataObjectList.lock().writeLock();
  KST::dataObjectList.append(fit.data());
  KST::dataObjectList.lock().unlock();

  return true;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:49,代码来源:kstfilterdialog_i.cpp

示例8: while

bool KstGuiData::viewObjectNameNotUnique(const QString& tag) {
  KstApp *app = KstApp::inst();
  KMdiIterator<KMdiChildView*> *it = app->createIterator();
  if (it) {
    while (it->currentItem()) {
      KstViewWindow *view = dynamic_cast<KstViewWindow*>(it->currentItem());
      if (view) {
        if (view->view()->findChild(tag, true)) {
          return (true);
        }
      }
      it->next();
    }
    app->deleteIterator(it);
  }
  return false;
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:17,代码来源:kstdatacollection-gui.cpp

示例9: deletePlot

bool KstIfaceImpl::deletePlot(const QString& window, const QString& name) {
  KstViewWindow *pView = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(window));
  if (pView) {
    KstTopLevelViewPtr pTLV = pView->view();
    KstViewObjectList objects = pTLV->findChildrenType<KstViewObject>(true);

    for (KstViewObjectList::Iterator it = objects.begin(); it != objects.end(); ++it) {
      KstViewObjectPtr object = *it;
      if (object->tagName() == name) {
        pTLV->removeChild(object, true);
        _doc->forceUpdate();
        _doc->setModified();
        return true;
      }
    }
  }

  return false;
}
开发者ID:,项目名称:,代码行数:19,代码来源:

示例10: construct

KJS::Object KstBindPlot::construct(KJS::ExecState *exec, const KJS::List& args) {
  KstViewWindow *w = 0L;
  if (args.size() == 1) {
    w = extractWindow(exec, args[0]);
    if (!w) {
      return createTypeError(exec, 0);
    }
  } else {
    return createSyntaxError(exec);
  }

  QString n = w->createPlotObject(KST::suggestPlotName(), false);
  Kst2DPlotPtr p = *w->view()->findChildrenType<Kst2DPlot>(true).findTag(n);
  if (!p) {
    return createGeneralError(exec, i18n("Failed to create plot."));
  }

  w->view()->paint(KstPainter::P_PAINT);

  return KJS::Object(new KstBindPlot(exec, p));
}
开发者ID:,项目名称:,代码行数:21,代码来源:

示例11: removeCurveFromPlot

bool KstIfaceImpl::removeCurveFromPlot(KMdiChildView *win, const QString& plot, const QString& curve) {
  KstViewWindow *w = dynamic_cast<KstViewWindow*>(win);

  if (w) {
    KstTopLevelViewPtr view = kst_cast<KstTopLevelView>(w->view());
    if (view) {
      Kst2DPlotList plots = view->findChildrenType<Kst2DPlot>(true);
      if (plots.findTag(plot) != plots.end()) {
        Kst2DPlotPtr p = *(plots.findTag(plot));
        KstBaseCurveList bcl = kstObjectSubList<KstDataObject,KstBaseCurve>(KST::dataObjectList);
        KstBaseCurveList::Iterator ci = bcl.findTag(curve);
        if (p && ci != bcl.end()) {
          p->removeCurve(*ci);
          _doc->forceUpdate();
          return true;
        }
      }
    }
  }

  return false;
}
开发者ID:,项目名称:,代码行数:22,代码来源:

示例12: KPalette

KstImagePtr KstCsdDialogI::createImage(KstCSDPtr csd) {
    KPalette* newPal = new KPalette(_w->_colorPalette->selectedPalette());
    csd->readLock();
    KstImagePtr image = new KstImage(csd->tagName()+"-I", csd->outputMatrix(), 0, 1, true, newPal);
    csd->unlock();

    KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_w->_curvePlacement->_plotWindow->currentText()));
    if (!w) {
        QString n = KstApp::inst()->newWindow(KST::suggestWinName());
        w = static_cast<KstViewWindow*>(KstApp::inst()->findWindow(n));
    }
    if (w) {
        Kst2DPlotPtr plot;
        if (_w->_curvePlacement->existingPlot()) {
            /* assign image to plot */
            plot = kst_cast<Kst2DPlot>(w->view()->findChild(_w->_curvePlacement->plotName()));
            if (plot) {
                plot->addCurve(KstBaseCurvePtr(image));
            }
        }

        if (_w->_curvePlacement->newPlot()) {
            /* assign image to plot */
            QString name = w->createObject<Kst2DPlot>(KST::suggestPlotName());
            if (_w->_curvePlacement->reGrid()) {
                w->view()->cleanup(_w->_curvePlacement->columns());
            }
            plot = kst_cast<Kst2DPlot>(w->view()->findChild(name));
            if (plot) {
                _w->_curvePlacement->update();
                _w->_curvePlacement->setCurrentPlot(plot->tagName());
                plot->addCurve(KstBaseCurvePtr(image));
                plot->generateDefaultLabels();
            }
        }
    }
    return image;
}
开发者ID:,项目名称:,代码行数:38,代码来源:

示例13: extractViewObject

KJS::Object KstBindEllipse::construct(KJS::ExecState *exec, const KJS::List& args) {
  if (args.size() != 1) {
    KJS::Object eobj = KJS::Error::create(exec, KJS::SyntaxError);
    exec->setException(eobj);
    return KJS::Object();
  }

  KstViewObjectPtr view = extractViewObject(exec, args[0]);
  if (!view) {
    KstViewWindow *w = extractWindow(exec, args[0]);
    if (w) {
      view = w->view();
    } else {
      KJS::Object eobj = KJS::Error::create(exec, KJS::TypeError);
      exec->setException(eobj);
      return KJS::Object();
    }
  }

  KstViewEllipsePtr b = new KstViewEllipse;
  view->appendChild(b.data());
  KstApp::inst()->paintAll(KstPainter::P_PAINT);
  return KJS::Object(new KstBindEllipse(exec, b));
}
开发者ID:Kst-plot,项目名称:kst-subversion-archive,代码行数:24,代码来源:bind_ellipse.cpp

示例14: getOptions

void KstCurveDifferentiateI::apply() {
  KstApp *app = KstApp::inst();
  KstViewWindow *window;
  int maxSequences = 0;
  
  getOptions();
  saveProperties();
  
  _seqVect.clear();
  _seqVect.resize(4);
  
  if (_lineColorOrder > -1) {
    _lineColorSeq.setRange(0, KstColorSequence::count());
    _seqVect.insert(_lineColorOrder, &_lineColorSeq);
    maxSequences++;
  }
  if (_pointStyleOrder > -1) {
    _pointStyleSeq.setRange(0, KSTPOINT_MAXTYPE - 1);
    _seqVect.insert(_pointStyleOrder, &_pointStyleSeq);
    maxSequences++;
  }
  if (_lineStyleOrder > -1) {
    _lineStyleSeq.setRange(0, KSTLINESTYLE_MAXTYPE - 1);
    _seqVect.insert(_lineStyleOrder, &_lineStyleSeq);
    maxSequences++;
  }
  if (_lineWidthOrder > -1) {
    _lineWidthSeq.setRange(1, KSTLINEWIDTH_MAX);
    _seqVect.insert(_lineWidthOrder, &_lineWidthSeq);
    maxSequences++;
  }
  
  if (maxSequences > 0) {
    int i;
    
    _seqVect.resize(maxSequences);
    for (i = 0; i < maxSequences-1; i++) {
      _seqVect[i]->hookToNextSequence(_seqVect[i+1]);
    }
    _seqVect[maxSequences-1]->hookToNextSequence(0L);
        
    if (_applyTo == 0) {
      window = dynamic_cast<KstViewWindow*>(app->activeWindow());
      
      if (window) {
        cycleWindow(window);
      }
    } else {
      KMdiIterator<KMdiChildView*> *it = app->createIterator();
      
      if (it) {
        while (it->currentItem()) {
          if (_repeatAcross == 1) {
            _seqVect[0]->reset();
          }

          window = dynamic_cast<KstViewWindow*>(it->currentItem());
          if (window && !window->view()->children().isEmpty()) {
            cycleWindow(window);
          }
          it->next();
        }
        app->deleteIterator(it);
      }
    }
  }

  close();
}
开发者ID:,项目名称:,代码行数:69,代码来源:

示例15: kstdFatal

bool KstEqDialogI::newObject() {
  QString tag_name = _tagName->text();
  QString etext = _w->_equation->text();
  etext.remove(QRegExp("[^a-zA-Z0-9\\(\\)\\+\\-\\*/\\%\\^\\|\\&\\!<>=_.]"));
  if (etext.length() > 12) {
    etext.truncate(12);
    etext += "...";
  }

  if (tag_name == defaultTag) {
    tag_name = KST::suggestEQName(etext);
  }

  /* verify that the curve name is unique */
  if (KstData::self()->dataTagNameNotUnique(tag_name)) {
    _tagName->setFocus();
    return false;
  }

  if (!checkEntries()) {
    return false;
  }

  KST::vectorList.lock().readLock();
  /* find *V */
  KstVectorPtr vp = *KST::vectorList.findTag(_w->_xVectors->selectedVector());
  if (!vp) {
    kstdFatal() << "Bug in kst: the Vector field (Eq) "
                << "refers to a non-existent vector..." << endl;
  }
  KST::vectorList.lock().unlock();

  /** Create the equation here */
  vp->readLock();
  KstEquationPtr eq = new KstEquation(tag_name, _w->_equation->text(), vp, _w->_doInterpolation->isChecked());
  vp->unlock();

  if (!eq->isValid()) {
    eq = 0L;
    QString parseErrors;
    for (QStringList::ConstIterator i = Equation::errorStack.begin(); i != Equation::errorStack.end(); ++i) {
      parseErrors += *i;
      parseErrors += "\n";
    }

    KMessageBox::detailedSorry(this, i18n("There is an error in the equation you entered."), parseErrors);
    return false;
  }

  KstVCurvePtr vc = new KstVCurve(KST::suggestCurveName(tag_name, true), eq->vX(), eq->vY(), 0L, 0L, 0L, 0L, _w->_curveAppearance->color());
  vc->setHasPoints(_w->_curveAppearance->showPoints());
  vc->setHasLines(_w->_curveAppearance->showLines());
  vc->setHasBars(_w->_curveAppearance->showBars());
  vc->setLineWidth(_w->_curveAppearance->lineWidth());
  vc->setLineStyle(_w->_curveAppearance->lineStyle());
  vc->pointType = _w->_curveAppearance->pointType();
  vc->setPointDensity(_w->_curveAppearance->pointDensity());
  vc->setBarStyle(_w->_curveAppearance->barStyle());
  
  QString legend_text = _legendText->text();
  if (legend_text == defaultTag) {
    vc->setLegendText(QString(""));
  } else {
    vc->setLegendText(legend_text);
  }

  KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_w->_curvePlacement->_plotWindow->currentText()));
  if (!w) {
    QString n = KstApp::inst()->newWindow(KST::suggestWinName());
    w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(n));
  }

  if (w) {
    Kst2DPlotPtr plot;
    if (_w->_curvePlacement->existingPlot()) {
      /* assign curve to plot */
      plot = kst_cast<Kst2DPlot>(w->view()->findChild(_w->_curvePlacement->plotName()));
      if (plot) {
        plot->addCurve(vc.data());
      }
    }

    if (_w->_curvePlacement->newPlot()) {
      /* assign curve to plot */
      QString name = w->createObject<Kst2DPlot>(KST::suggestPlotName());
      if (_w->_curvePlacement->reGrid()) {
        w->view()->cleanup(_w->_curvePlacement->columns());
      }
      plot = kst_cast<Kst2DPlot>(w->view()->findChild(name));
      if (plot) {
        _w->_curvePlacement->update();
        _w->_curvePlacement->setCurrentPlot(plot->tagName());
        plot->addCurve(vc.data());
        plot->generateDefaultLabels();
      }
    }
  }

  KST::dataObjectList.lock().writeLock();
  KST::dataObjectList.append(eq.data());
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:


注:本文中的KstViewWindow类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。