Пример #1
0
void OkcViewDisplay::refreshBrush() {
	OkcVisualMapResult* okvVMR = getOkcVisualMapResult();
	Operator* brushQ = (Operator*)(okvVMR->getBrushOperator());
	PipelineManager* pm = getPipelineManager();
	Brush *brush = okvVMR->getBrush();

	//If the maximum and minimum values for one dimension has the exact same value,
	//they should be adjusted to a little different values,
	//otherwise, some records having the same value as this max/min value
	//cannot be highlighted.

	int i;
	for (i=0; i<brush->getDimSize(); i++) {
		brush->max[i] += XMDV_DBL_EPSILON;
		brush->min[i] -= XMDV_DBL_EPSILON;
	}

	OkcData* brushStorage = brush->toOkcDataStorage();
	std::vector<double> buf;
	brushStorage->getData(buf, 3);
	int pID = getPipelineID();
	// update the assistant input by the reverse pipeline
	pm->updateAssisInput(pID, brushStorage, XmdvTool::ASSISDATA_BRUSH);

	delete brushStorage;
	pm->assemble(pID, brushQ);
	getViewManager()->refreshDisplayByPID(pID);
}
Пример #2
0
void GlyphCustom::on_pushButton_apply_clicked() {
	getOkcPipelineSettings()->m_glyphPlaceMode = m_placeMode;
	PipelineManager* pm = m_mainWnd->getPipelineManager();
	ViewManager * vm = m_mainWnd->getViewManager();
	OkcPipeline* pl = getOkcPipeline();
	Transformation* mainT = pl->getMainTransformation();
	XmdvTool::PLTYPE plType = pl->getPipelineType();
	assert (plType==XmdvTool::PLTYPE_FLATNORMAL ||
			plType==XmdvTool::PLTYPE_SBB);

	SortRowsOperator* sortO = pl->getSortRowsOperator();
	PCADeriveOperator* pcaO = pl->getPCADeriveOperator();

	// Setup the pipeline in terms of the current glyph place mode
	switch (m_placeMode) {
	case XmdvTool::GLYPHPLACE_ORIGINAL :
	{
		// Disable the sort operator
		// Disable the PCA operator
		switch (plType) {
		case XmdvTool::PLTYPE_FLATNORMAL :
			mainT->enableOperator(PL_FN_OP_SORT, false);
			mainT->enableOperator(PL_FN_OP_PCADERIVE, false);
			break;
		case XmdvTool::PLTYPE_SBB :
			mainT->enableOperator(PL_SBB_OP_SORT, false);
			mainT->enableOperator(PL_SBB_OP_PCADERIVE, false);
			break;
		default:
			// The code should not go to here;
			return;
		}
		// Reassemble the pipeline
		pm->assemble(m_pipelineID, sortO);
		// If the current views include the glyphs, refresh the output
		if (vm->willOuputToVis(m_pipelineID, XmdvTool::VISTYPE_GL)) {
			vm->refreshDisplayByPID(m_pipelineID);
		}
	}
	break;
	case XmdvTool::GLYPHPLACE_ORDERED :
	{
		if (m_selectedDimNo<0 || m_selectedDimNo>=ui.listWidget_dims->count()) {
			// If users did not select anything, return immediately
			return;
		}
		// Enable the sort operator
		// Disable the PCA operator
		switch (plType) {
		case XmdvTool::PLTYPE_FLATNORMAL :
			mainT->enableOperator(PL_FN_OP_SORT, true);
			mainT->enableOperator(PL_FN_OP_PCADERIVE, false);
			break;
		case XmdvTool::PLTYPE_SBB :
			mainT->enableOperator(PL_SBB_OP_SORT, true);
			mainT->enableOperator(PL_SBB_OP_PCADERIVE, false);
			break;
		default:
			// The code should not go to here;
			return;
		}
		// Get the sort operator
		// Setup the sort Operator
		sortO->setSortWay (XmdvTool::OKCDIM_ORIGINAL);
		sortO->setSortDimNo (m_selectedDimNo);
		sortO->setSortOrder (m_sortOrder);
		// Reassemble the pipeline
		pm->assemble(m_pipelineID, sortO);
		// If the current views include the glyphs, refresh the output
		if (vm->willOuputToVis(m_pipelineID, XmdvTool::VISTYPE_GL)) {
			vm->refreshDisplayByPID(m_pipelineID);
		}
	}
	break;
	case XmdvTool::GLYPHPLACE_DATA_DRIVEN :
	{
		if (m_XDimNumber<0
				|| m_XDimNumber>=ui.listWidget_dims->count()
				|| m_YDimNumber<0
				|| m_YDimNumber>=ui.listWidget_dims->count()) {
			// If users did not select anything for X dim or Y dim, return immediately
			return;
		}
		// Disable the sort operator
		// Disable the PCA operator
		switch (plType) {
		case XmdvTool::PLTYPE_FLATNORMAL :
			mainT->enableOperator(PL_FN_OP_SORT, false);
			mainT->enableOperator(PL_FN_OP_PCADERIVE, false);
			break;
		case XmdvTool::PLTYPE_SBB :
			mainT->enableOperator(PL_SBB_OP_SORT, false);
			mainT->enableOperator(PL_SBB_OP_PCADERIVE, false);
			break;
		default:
			// The code should not go to here;
			return;
		}
		OkcPipeline* okcpl = getOkcPipeline();
		OkcVisualMap* okcvm = okcpl->getOkcVisualMap();
		GlyphPlace* gp = okcvm->getGlyphPlace();
		gp->setDimX(XmdvTool::OKCDIM_ORIGINAL);
		gp->setDimXNo(m_XDimNumber);
		gp->setDimY(XmdvTool::OKCDIM_ORIGINAL);
		gp->setDimYNo(m_YDimNumber);
		// Reassemble the pipeline
		pm->assemble(m_pipelineID, sortO);
		// If the current views include the glyphs, refresh the output
		if (vm->willOuputToVis(m_pipelineID, XmdvTool::VISTYPE_GL)) {
			vm->refreshDisplayByPID(m_pipelineID);
		}
	}
	break;
	case XmdvTool::GLYPHPLACE_DERIVED :
	{
		if (m_XDimNumber<0 || m_YDimNumber<0 ) {
			// If users did not select anything for X dim or Y dim, return immediately
			return;
		}
		// Disable the sort operator
		// Enable the PCA operator
		switch (plType) {
		case XmdvTool::PLTYPE_FLATNORMAL :
			mainT->enableOperator(PL_FN_OP_SORT, false);
			mainT->enableOperator(PL_FN_OP_PCADERIVE, true);
			break;
		case XmdvTool::PLTYPE_SBB :
			mainT->enableOperator(PL_SBB_OP_SORT, false);
			mainT->enableOperator(PL_SBB_OP_PCADERIVE, true);
			break;
		default:
			// The code should not go to here;
			return;
		}
		OkcPipeline* okcpl = getOkcPipeline();
		OkcVisualMap* okcvm = okcpl->getOkcVisualMap();
		GlyphPlace* gp = okcvm->getGlyphPlace();
		gp->setDimX(m_XDim);
		gp->setDimXNo(m_XDimNumber);
		gp->setDimY(m_YDim);
		gp->setDimYNo(m_YDimNumber);
		// Reassemble the pipeline
		if (okcpl->needRunPCA()) {
			// If the PCA algorithm has been run once,
			// assemble the pipeline from the pca operator
			pm->assemble(m_pipelineID, pcaO);
			okcpl->setNeedRunPCA(false);
		} else {
			// If the PCA algorithm has been run once,
			// we only need to do visual mapping
			pm->assemble(m_pipelineID, -1);
		}
		// If the current views include the glyphs, refresh the output
		if (vm->willOuputToVis(m_pipelineID, XmdvTool::VISTYPE_GL)) {
			vm->refreshDisplayByPID(m_pipelineID);
		}
	}
	break;
	}
}