Beispiel #1
0
WatchVector::WatchVector(QWidget *parent) 
    : WatchView(parent)
{
    int i;

    /* Setup GUI */
    setupUi(this);
    fMapping->setVisible(false);

    QGridLayout *gridLayout;
    gridLayout = new QGridLayout(fContent);
    gridLayout->setSpacing(0);
    gridLayout->setMargin(0);

    m_qScrollArea = new QScrollArea();
    m_qScrollArea->setBackgroundRole(QPalette::Dark);
    gridLayout->addWidget(m_qScrollArea);
    
    m_pImageView = new ImageView();
    m_qScrollArea->setWidget(m_pImageView);

	m_viewCenter[0] = -1;
	m_viewCenter[1] = -1;
	
    /* Initialize attachments */
    for (i=0; i<MAX_ATTACHMENTS; i++) {
        m_pData[i] = NULL;
        m_qName[i] = QString("NULL");
    }

    /* Initialize color mapping comboboxes */
    Mapping m;
    m.index = 0;
    m.type  = MAP_TYPE_BLACK;
    cbRed->addItem(QString("black"), 
                   QVariant(getIntFromMapping(m)));
    cbGreen->addItem(QString("black"),
                     QVariant(getIntFromMapping(m)));
    cbBlue->addItem(QString("black"),
                    QVariant(getIntFromMapping(m)));

	m.index = 1;
    m.type = MAP_TYPE_WHITE;
    cbRed->addItem(QString("red"), 
                   QVariant(getIntFromMapping(m)));
    cbGreen->addItem(QString("green"), 
                     QVariant(getIntFromMapping(m)));
    cbBlue->addItem(QString("blue"), 
                    QVariant(getIntFromMapping(m)));
                    
    cbRed->setCurrentIndex(0);
    cbGreen->setCurrentIndex(0);
    cbBlue->setCurrentIndex(0);

	/* initialize range mapping comboboxes */
	RangeMapping rm;
	rm.index = 0;
	rm.range = RANGE_MAP_DEFAULT;
    cbMapRed->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-red-solid_32.png")),
                      QString(""), 
                      QVariant(getIntFromRangeMapping(rm)));
    cbMapGreen->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-green-solid_32.png")),
                        QString(""), 
                        QVariant(getIntFromRangeMapping(rm)));
    cbMapBlue->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-blue-solid_32.png")),
                       QString(""), 
                       QVariant(getIntFromRangeMapping(rm)));
	rm.index = 1;
	rm.range = RANGE_MAP_POSITIVE;
    cbMapRed->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-red-positive_32.png")),
                      QString(""), 
                      QVariant(getIntFromRangeMapping(rm)));
    cbMapGreen->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-green-positive_32.png")),
                        QString(""), 
                        QVariant(getIntFromRangeMapping(rm)));
    cbMapBlue->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-blue-positive_32.png")),
                       QString(""), 
                       QVariant(getIntFromRangeMapping(rm)));
	rm.index = 2;
	rm.range = RANGE_MAP_NEGATIVE;
    cbMapRed->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-red-negative_32.png")),
                      QString(""), 
                      QVariant(getIntFromRangeMapping(rm)));
    cbMapGreen->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-green-negative_32.png")),
                        QString(""), 
                        QVariant(getIntFromRangeMapping(rm)));
    cbMapBlue->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-blue-negative_32.png")),
                       QString(""), 
                       QVariant(getIntFromRangeMapping(rm)));
	rm.index = 3;
	rm.range = RANGE_MAP_ABSOLUTE;
    cbMapRed->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-red-absolute_32.png")),
                      QString(""), 
                      QVariant(getIntFromRangeMapping(rm)));
    cbMapGreen->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-green-absolute_32.png")),
                        QString(""), 
                        QVariant(getIntFromRangeMapping(rm)));
    cbMapBlue->addItem(QIcon(QString::fromUtf8(":/icons/icons/watch-blue-absolute_32.png")),
                       QString(""), 
                       QVariant(getIntFromRangeMapping(rm)));
	
    cbMapRed->setCurrentIndex(0);
    cbMapGreen->setCurrentIndex(0);
    cbMapBlue->setCurrentIndex(0);

    /* Initialize member variables */
    m_bNeedsUpdate = true;
    m_nActiveMappings = 0;

    updateGUI();

	connect(m_pImageView, SIGNAL(mousePosChanged(int, int)),
	        this, SLOT(setMousePos(int, int)));
	connect(m_pImageView, SIGNAL(picked(int, int)),
	        this, SLOT(newSelection(int, int)));
	connect(m_pImageView, SIGNAL(viewCenterChanged(int, int)),
	        this, SLOT(newViewCenter(int, int)));

	m_pImageView->setFocusPolicy(Qt::StrongFocus);
	m_pImageView->setFocus();
}
void WatchGeoDataTree::setupMappingUI()
{
	/* Initialize color mapping comboboxes */
	Mapping m;
	m.index = 0;
	m.type = MAP_TYPE_OFF;
	cbRed->addItem(QString("-"), QVariant(getIntFromMapping(m)));
	cbGreen->addItem(QString("-"), QVariant(getIntFromMapping(m)));
	cbBlue->addItem(QString("-"), QVariant(getIntFromMapping(m)));
	cbX->addItem(QString("-"), QVariant(getIntFromMapping(m)));
	cbY->addItem(QString("-"), QVariant(getIntFromMapping(m)));
	cbZ->addItem(QString("-"), QVariant(getIntFromMapping(m)));

	cbRed->setCurrentIndex(0);
	cbGreen->setCurrentIndex(0);
	cbBlue->setCurrentIndex(0);
	cbX->setCurrentIndex(0);
	cbY->setCurrentIndex(0);
	cbZ->setCurrentIndex(0);

	/* initialize range mapping comboboxes */
	RangeMapping rm;
	rm.index = 0;
	rm.range = RANGE_MAP_DEFAULT;
	cbMapRed->addItem(
			QIcon(QString::fromUtf8(":/icons/icons/watch-red-solid_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapGreen->addItem(
			QIcon(QString::fromUtf8(":/icons/icons/watch-green-solid_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapBlue->addItem(
			QIcon(QString::fromUtf8(":/icons/icons/watch-blue-solid_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapX->addItem(
			QIcon(QString::fromUtf8(":/icons/icons/watch-black-solid_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapY->addItem(
			QIcon(QString::fromUtf8(":/icons/icons/watch-black-solid_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapZ->addItem(
			QIcon(QString::fromUtf8(":/icons/icons/watch-black-solid_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));

	rm.index = 1;
	rm.range = RANGE_MAP_POSITIVE;
	cbMapRed->addItem(
			QIcon(QString::fromUtf8(":/icons/icons/watch-red-positive_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapGreen->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-green-positive_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapBlue->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-blue-positive_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapX->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-black-positive_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapY->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-black-positive_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapZ->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-black-positive_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));

	rm.index = 2;
	rm.range = RANGE_MAP_NEGATIVE;
	cbMapRed->addItem(
			QIcon(QString::fromUtf8(":/icons/icons/watch-red-negative_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapGreen->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-green-negative_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapBlue->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-blue-negative_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapX->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-black-negative_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapY->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-black-negative_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapZ->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-black-negative_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));

	rm.index = 3;
	rm.range = RANGE_MAP_ABSOLUTE;
	cbMapRed->addItem(
			QIcon(QString::fromUtf8(":/icons/icons/watch-red-absolute_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapGreen->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-green-absolute_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapBlue->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-blue-absolute_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapX->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-black-absolute_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapY->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-black-absolute_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));
	cbMapZ->addItem(
			QIcon(
					QString::fromUtf8(
							":/icons/icons/watch-black-absolute_32.png")),
			QString(""), QVariant(getIntFromRangeMapping(rm)));

	cbMapRed->setCurrentIndex(0);
	cbMapGreen->setCurrentIndex(0);
	cbMapBlue->setCurrentIndex(0);
	cbMapX->setCurrentIndex(0);
	cbMapY->setCurrentIndex(0);
	cbMapZ->setCurrentIndex(0);
	on_cbRed_activated(0);
	on_cbGreen_activated(0);
	on_cbBlue_activated(0);
	on_cbX_activated(0);
	on_cbY_activated(0);
	on_cbZ_activated(0);
}