本文整理汇总了C++中KstMatrixPtr::tag方法的典型用法代码示例。如果您正苦于以下问题:C++ KstMatrixPtr::tag方法的具体用法?C++ KstMatrixPtr::tag怎么用?C++ KstMatrixPtr::tag使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KstMatrixPtr
的用法示例。
在下文中一共展示了KstMatrixPtr::tag方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: QObject
KstObjectItem::KstObjectItem(QListViewItem *parent, KstMatrixPtr x, KstDataManagerI *dm, int localUseCount)
: QObject(), QListViewItem(parent), _rtti(RTTI_OBJ_MATRIX), _tag(x->tag()), _dm(dm) {
assert(x);
_inUse = false;
setText(0, x->tag().tag());
setText(1, i18n("Slave Matrix"));
x = 0L; // keep the counts in sync
update(true, localUseCount);
}
示例2: editObject
bool KstMatrixDialog::editObject() {
//
// if editing multiple objects, edit each one...
//
if (_editMultipleMode) {
// xxx _fileNameDirty = !_w->_fileName->url().isEmpty();
_gradientZAtMinDirty = !_w->_gradientZAtMin->text().isEmpty();
_gradientZAtMaxDirty = !_w->_gradientZAtMax->text().isEmpty();
_minXDirty = !_w->_minX->text().isEmpty();
_minYDirty = !_w->_minY->text().isEmpty();
_yStepDirty = !_w->_yStep->text().isEmpty();
_xStepDirty = !_w->_xStep->text().isEmpty();
_xStartDirty = _w->_xStart->text() != " ";
_yStartDirty = _w->_yStart->text() != " ";
_xNumStepsDirty = _w->_xNumSteps->text() != " ";
_yNumStepsDirty = _w->_yNumSteps->text() != " ";
_skipDirty = _w->_skip->text() != " ";
_nXDirty = _w->_nX->text() != " ";
_nYDirty = _w->_nY->text() != " ";
bool didEdit = false;
int i;
for (i = 0; i < _editMultipleWidget->_objectList->count(); i++) {
if (_editMultipleWidget->_objectList->item(i)->isSelected()) {
KstMatrixPtr mxPtr;
//
// get the pointer to the object...
//
KST::matrixList.lock().readLock();
mxPtr = *KST::matrixList.findTag(_editMultipleWidget->_objectList->item(i)->text());
KST::matrixList.lock().unlock();
if (!mxPtr) {
return false;
}
if (!editSingleObject(mxPtr)) {
return false;
}
didEdit = true;
}
}
if (!didEdit) {
QMessageBox::warning(this, QObject::tr("Kst"), QObject::tr("Select one or more objects to edit."));
return false;
}
} else {
KstMatrixPtr mp;
QString tagName;
mp = kst_cast<KstMatrix>(_dp);
tagName = _tagName->text();
if (!mp || (tagName != mp->tagName() && KstData::self()->dataTagNameNotUnique(tagName))) {
_tagName->setFocus();
return false;
}
mp->writeLock();
mp->setTag(KstObjectTag(tagName, mp->tag().context())); // FIXME: can't change tag context
mp->unlock();
//
// then edit the object...
//
_fileNameDirty = true;
_fieldDirty = true;
_xStartDirty = true;
_xStartCountFromEndDirty = true;
_yStartDirty = true;
_yStartCountFromEndDirty = true;
_xNumStepsDirty = true;
_xNumStepsReadToEndDirty = true;
_yNumStepsDirty = true;
_yNumStepsReadToEndDirty = true;
_gradientXDirty = true;
_gradientYDirty = true;
_gradientZAtMinDirty = true;
_gradientZAtMaxDirty = true;
_minXDirty = true;
_minYDirty = true;
_xStepDirty = true;
_yStepDirty = true;
_doSkipDirty = true;
_skipDirty = true;
_doAveDirty = true;
_nXDirty = true;
_nYDirty = true;
if (!editSingleObject(mp)) {
//.........这里部分代码省略.........
示例3: newObject
bool KstImageDialogI::newObject() {
//if matrixCombo is empty then display an error message
if (_w->_matrix->selectedMatrix().isEmpty()){
KMessageBox::sorry(this, i18n("Matrix is a 2D grid of numbers, used to create image", "New image not made: define matrix first."));
return false;
}
//do some checks on the inputs
double lowerZDouble, upperZDouble;
if (!checkParameters(lowerZDouble, upperZDouble)) {
return false;
}
KST::matrixList.lock().readLock();
KstMatrixPtr matrix = *KST::matrixList.findTag(_w->_matrix->selectedMatrix());
KST::matrixList.lock().unlock();
if (!matrix) {
KMessageBox::sorry(this, i18n("Matrix is a 2D grid of numbers, used to create image", "Could not find matrix."));
return false;
}
KST::dataObjectList.lock().readLock();
matrix->readLock();
//create a unique name
QString tag_name = KST::suggestImageName(matrix->tag());
if (KstData::self()->dataTagNameNotUnique(tag_name)) {
_tagName->setFocus();
matrix->unlock();
KST::dataObjectList.lock().unlock();
return false;
}
KstImagePtr image;
if (_w->_contourOnly->isChecked()) {
//need a contour map only
QColor tempColor = _w->_contourColor->color();
image = new KstImage(tag_name, matrix, _w->_numContourLines->text().toInt(), tempColor,
_w->_useVariableWeight->isChecked() ? -1 : _w->_contourWeight->value());
} else if (_w->_colorOnly->isChecked()) {
//need a color map only
KPalette* newPal = new KPalette(_w->_colorPalette->selectedPalette());
image = new KstImage(tag_name, matrix, lowerZDouble, upperZDouble,
_w->_realTimeAutoThreshold->isChecked(), newPal);
} else {
//need both a contour map and colour map
QColor tempColor = _w->_contourColor->color();
KPalette* newPal = new KPalette(_w->_colorPalette->selectedPalette());
image = new KstImage(tag_name, matrix, lowerZDouble, upperZDouble,
_w->_realTimeAutoThreshold->isChecked(), newPal,
_w->_numContourLines->text().toInt(), tempColor,
_w->_useVariableWeight->isChecked() ? -1 : _w->_contourWeight->value());
}
matrix->unlock();
KST::dataObjectList.lock().unlock();
placeInPlot(image);
KST::dataObjectList.lock().writeLock();
KST::dataObjectList.append(image.data());
KST::dataObjectList.lock().unlock();
image = 0L; // drop the reference
emit modified();
return true;
}
示例4: binnedmap
void BinnedMap::binnedmap() {
KstVectorPtr x = *_inputVectors.find(VECTOR_X);
KstVectorPtr y = *_inputVectors.find(VECTOR_Y);
KstVectorPtr z = *_inputVectors.find(VECTOR_Z);
KstMatrixPtr map = *_outputMatrices.find(MAP);
KstMatrixPtr hitsMap = *_outputMatrices.find(HITSMAP);
if (autoBin()) {
AutoSize(X(),Y(), &_nx, &_xMin, &_xMax, &_ny, &_yMin, &_yMax);
}
bool needsresize = false;
if (_nx<2) {
_nx = 2;
needsresize = true;
}
if (_ny<2) {
_ny = 2;
needsresize = true;
}
if ((map->xNumSteps() != _nx) || (map->yNumSteps() != _ny) ||
(map->minX() != _xMin) || (map->minY() != _yMin)) {
needsresize = true;
}
if (map->xStepSize() != (_xMax - _xMin)/double(_nx-1)) {
needsresize = true;
}
if (map->yStepSize() != (_yMax - _yMin)/double(_ny-1)) {
needsresize = true;
}
if (needsresize) {
map->change(map->tag(), _nx, _ny, _xMin, _yMin,
(_xMax - _xMin)/double(_nx-1), (_yMax - _yMin)/double(_ny-1));
map->resize(_nx, _ny);
hitsMap->change(hitsMap->tag(), _nx, _ny, _xMin, _yMin,
(_xMax - _xMin)/double(_nx-1), (_yMax - _yMin)/double(_ny-1));
hitsMap->resize(_nx, _ny);
}
map->zero();
hitsMap->zero();
int ns = z->length(); // the z vector defines the number of points.
double n,p, x0, y0, z0;
for (int i=0; i<ns; i++) {
x0 = x->interpolate(i, ns);
y0 = y->interpolate(i, ns);
z0 = z->interpolate(i, ns);
p = map->value(x0, y0)+z0;
map->setValue(x0, y0, p);
n = hitsMap->value(x0, y0)+1;
hitsMap->setValue(x0, y0, n);
}
for (int i=0; i<_nx; i++) {
for (int j=0; j<_ny; j++) {
p = map->valueRaw(i,j);
n = hitsMap->valueRaw(i,j);
if (n>0) {
map->setValueRaw(i,j,p/n);
} else {
map->setValueRaw(i,j,KST::NOPOINT);
}
}
}
//calculate here...
}
示例5: binnedmap
void BinnedMap::binnedmap() {
KstVectorPtr x = *_inputVectors.find(VECTOR_X);
KstVectorPtr y = *_inputVectors.find(VECTOR_Y);
KstVectorPtr z = *_inputVectors.find(VECTOR_Z);
KstMatrixPtr map = *_outputMatrices.find(MAP);
KstMatrixPtr hitsMap = *_outputMatrices.find(HITSMAP);
KstScalarPtr autobin = *_inputScalars.find(AUTOBIN);
if (autobin) {
if (autobin->value() != 0.0) {
_autoBin = true;
} else {
_autoBin = false;
}
}
if (_autoBin) {
double minx, miny, maxx, maxy;
int nx, ny;
autoSize(X(), Y(), &nx, &minx, &maxx, &ny, &miny, &maxy);
setNX(nx);
setNY(ny);
setXMin(minx);
setXMax(maxx);
setYMin(miny);
setYMax(maxy);
} else {
KstScalarPtr xmin = *_inputScalars.find(XMIN);
KstScalarPtr xmax = *_inputScalars.find(XMAX);
KstScalarPtr ymin = *_inputScalars.find(YMIN);
KstScalarPtr ymax = *_inputScalars.find(YMAX);
KstScalarPtr nx = *_inputScalars.find(NX);
KstScalarPtr ny = *_inputScalars.find(NY);
if (xmin) {
_xMin = xmin->value();
}
if (xmax) {
_xMax = xmax->value();
}
if (ymin) {
_yMin = ymin->value();
}
if (ymax) {
_yMax = ymax->value();
}
if (nx) {
_nx = (int)nx->value();
}
if (ny) {
_ny = (int)ny->value();
}
}
bool needsresize = false;
if (_nx < 2) {
_nx = 2;
needsresize = true;
}
if (_ny < 2) {
_ny = 2;
needsresize = true;
}
if ((map->xNumSteps() != _nx) || (map->yNumSteps() != _ny) ||
(map->minX() != _xMin) || (map->minY() != _yMin)) {
needsresize = true;
}
if (map->xStepSize() != (_xMax - _xMin)/double(_nx-1)) {
needsresize = true;
}
if (map->yStepSize() != (_yMax - _yMin)/double(_ny-1)) {
needsresize = true;
}
if (needsresize) {
map->change(map->tag(), _nx, _ny, _xMin, _yMin,
(_xMax - _xMin)/double(_nx-1), (_yMax - _yMin)/double(_ny-1));
map->resize(_nx, _ny);
hitsMap->change(hitsMap->tag(), _nx, _ny, _xMin, _yMin,
(_xMax - _xMin)/double(_nx-1), (_yMax - _yMin)/double(_ny-1));
hitsMap->resize(_nx, _ny);
}
map->zero();
hitsMap->zero();
int ns = z->length(); // the z vector defines the number of points.
double n,p, x0, y0, z0;
for (int i=0; i<ns; i++) {
x0 = x->interpolate(i, ns);
y0 = y->interpolate(i, ns);
z0 = z->interpolate(i, ns);
p = map->value(x0, y0)+z0;
map->setValue(x0, y0, p);
//.........这里部分代码省略.........