Example #1
0
    QmlMapControl::QmlMapControl (QQuickItem *parent) :
        QQuickPaintedItem(parent)
    {
        setOpaquePainting(true);
        setAcceptHoverEvents(true);
        setAcceptedMouseButtons(Qt::AllButtons);

        layermanager = new LayerManager(this, size);
        screen_middle = QPoint(size.width()/2, size.height()/2);

        mousepressed = false;
        scaleVisible = true;
        crosshairsVisible = true;
        mymousemode = Panning;
        mouse_wheel_events = true;

        connect(ImageManager::instance(), SIGNAL(imageReceived()),
                this, SLOT(updateRequestNew()));

        connect(ImageManager::instance(), SIGNAL(loadingFinished()),
                this, SLOT(loadingFinished()));

        setWidth(size.width()+1);
        setHeight(size.height()+1);

        connect( this, SIGNAL(widthChanged()) , SLOT(sizeChanged()) );
        connect( this, SIGNAL(heightChanged()), SLOT(sizeChanged()) );
    }
void SimulationConnectionController::SimulationDataReceived(QByteArray data)
{
    DATA_HEADER_SET header;

    if(data.length()> sizeof(DATA_HEADER_SET))
    {
        memcpy(&header,data.data(),sizeof(DATA_HEADER_SET));
        data.remove(0,sizeof(DATA_HEADER_SET));
        if(header.type == IMAGE_JPEG)
        {
            if(data.length() >= header.length)
            {
                _simulationViewImageRAW = data;

                QImage img;
                try {
                    img = QImage::fromData(_simulationViewImageRAW,"JPEG");//the second param is format name
                } catch (...) {
                    qDebug() << "SimulationDataReceived -> ImageFailed.";
                }
                emit imageReceived(img);
            }
        }
        else if(header.type == SIMULATION_OUTPUT)
        {
            emit dataReceived(data);
        }
    }
}
Example #3
0
void AxisImage::onImageReceive(QNetworkReply *reply)
{
  const QByteArray& data = reply->readAll();
  qDebug() << "axis image size: " << data.size();

  const auto& image = QImage::fromData(data, "JPG");
  if(!image.isNull())
    emit imageReceived(image);

  reply->deleteLater();
}
void GaduChatImageService::handleEventImageReply(struct gg_event *e)
{
	kdebugm(KDEBUG_INFO, qPrintable(QString("Received image. sender: %1, size: %2, crc32: %3,filename: %4\n")
			.arg(e->event.image_reply.sender).arg(e->event.image_reply.size)
			.arg(e->event.image_reply.crc32).arg(e->event.image_reply.filename)));

	QString fullPath = saveImage(e->event.image_reply.sender,
			e->event.image_reply.size, e->event.image_reply.crc32,
			e->event.image_reply.filename, e->event.image_reply.image);
	if (fullPath.isNull())
		return;

	emit imageReceived(GaduFormater::createImageId(e->event.image_reply.sender,
			e->event.image_reply.size, e->event.image_reply.crc32), fullPath);
}
Example #5
0
int qmapcontrol::ImageManager::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QObject::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: imageReceived(); break;
        case 1: loadingFinished(); break;
        default: ;
        }
        _id -= 2;
    }
    return _id;
}
Example #6
0
    void MapControl::__init()
    {
        layermanager = new LayerManager(this, size);
        screen_middle = QPoint(size.width()/2, size.height()/2);

        mousepressed = false;

        connect(ImageManager::instance(), SIGNAL(imageReceived()),
                this, SLOT(updateRequestNew()));

        connect(ImageManager::instance(), SIGNAL(loadingFinished()),
                this, SLOT(loadingFinished()));

        this->setMaximumSize(size.width()+1, size.height()+1);
        mouse_wheel_events = true;
    }
void MapDownloader::download()
{
    downloadListx->clear();
    downloadListy->clear();
    downloadListz->clear();
    connect(ImageManager::instance(), SIGNAL(imageReceived()),
                   this, SLOT(downloadTileList() ));
    connect(ImageManager::instance(), SIGNAL(loadingFinished()),
                   this, SLOT(downloadfinish() ));
    downloadProgress->setValue(0);
    tilesDownloadCount=0;
    for(int lus=1; lus< comboBoxLayerDepth->currentIndex()+1; lus++)
        downloadLayer(lus);

    labelTileCount->setText("Tiles:"+QVariant(tilesDownloadCount).toString() );
    m_downloadIndex=0;
    downloadTileList();downloadTileList();downloadTileList();downloadTileList();
}
    MapControl::MapControl(QSize size, MouseMode mousemode)
        : size(size), mymousemode(mousemode), scaleVisible(false), cursorPosVisible(false), mapPen(Qt::black)
    {
        layermanager = new LayerManager(this, size);
        screen_middle = QPoint(size.width()/2, size.height()/2);

        mousepressed = false;

        connect(ImageManager::instance(), SIGNAL(imageReceived()),
                this, SLOT(updateRequestNew()));

        connect(ImageManager::instance(), SIGNAL(loadingFinished()),
                this, SLOT(loadingFinished()));

        this->setMaximumSize(size.width()+1, size.height()+1);

        distanceList<<5000000<<2000000<<1000000<<1000000<<1000000<<100000<<100000<<50000<<50000<<10000<<10000<<10000<<1000<<1000<<500<<200<<100<<50<<25;

    }
	void ImageManager::receivedImage(const QPixmap pixmap, const QString& url)
	{
// 	qDebug() << "ImageManager::receivedImage";
		QPixmapCache::insert(url, pixmap);
// 	images[url] = pixmap;
	
// 	((Layer*)this->parent())->imageReceived();
	
		if (!prefetch.contains(url))
		{
			emit(imageReceived());
		}
		else
		{
			
#ifdef Q_WS_QWS
			prefetch.remove(prefetch.indexOf(url));
#endif
		}
	}
Example #10
0
    void ImageManager::receivedImage(const QPixmap pixmap, const QString& url)
    {
        //qDebug() << "ImageManager::receivedImage";
        QPixmapCache::insert(md5hex(url), pixmap);

        if (doPersistentCaching && !tileExist(url))
        {
            saveTile(url,pixmap);
        }

        if (!prefetch.contains(url))
        {
            emit(imageReceived());
        }
        else
        {

#if defined Q_WS_QWS || defined Q_WS_MAEMO_5 || defined Q_WS_S60
            prefetch.remove(prefetch.indexOf(url));
#endif
        }
    }
MapControl::MapControl(QSize size, MouseMode mousemode, QWidget *parent)
	:QWidget(parent),
	size(size), mousemode(mousemode)
{
	layermanager = new LayerManager(this, size);
	MapAdapter *mapadapter = new GoogleMapAdapter();
	layermanager->addLayer(new MapLayer("Map", mapadapter));

	screen_middle = QPoint(size.width()/2, size.height()/2);
	
	mousepressed = false;
	
	connect(ImageManager::instance(), SIGNAL(imageReceived()),
			  this, SLOT(updateRequestNew()));
	
	connect(ImageManager::instance(), SIGNAL(loadingFinished()),
			  this, SLOT(loadingFinished()));
	
	this->setMaximumSize(size.width()+1, size.height()+1);

	// create buttons as controls for zoom
	QPushButton* zoomin = new QPushButton("+");
	QPushButton* zoomout = new QPushButton("-");
	zoomin->setMaximumWidth(30);
	zoomout->setMaximumWidth(30);
	
	connect(zoomin, SIGNAL(clicked(bool)),
			  this, SLOT(zoomIn()));
	connect(zoomout, SIGNAL(clicked(bool)),
			  this, SLOT(zoomOut()));
	
	// add zoom buttons to the layout of the MapControl
	QVBoxLayout* innerlayout = new QVBoxLayout;
	innerlayout->addWidget(zoomin);
	innerlayout->addWidget(zoomout);
	setLayout(innerlayout);

}
Example #12
0
    void ImageManager::receivedImage(const QPixmap pixmap, const QString& url)
    {
        //qDebug() << "ImageManager::receivedImage";
        QPixmapCache::insert(url, pixmap);
        //images[url] = pixmap;

        // needed?
        if (doPersistentCaching && !tileExist(url) )
            saveTile(url,pixmap);

        //((Layer*)this->parent())->imageReceived();

        if (!prefetch.contains(url))
        {
            emit(imageReceived());
        }
        else
        {

#if defined Q_WS_QWS || defined Q_WS_MAEMO_5 || defined Q_WS_S60
            prefetch.remove(prefetch.indexOf(url));
#endif
        }
    }
Example #13
0
/*! Constructs widgets and connections of signals for the main window.
 */
void MPWindow::initUIComponents()
{
    // Initialise view
    m_view = new MPMapView(this);
    connect(m_view, SIGNAL(interactionChanged(Interaction*)), this, SLOT(onInteractionChanged(Interaction*)));
    connect(m_view, SIGNAL(viewportShift()), this, SLOT(onViewShift()));
    connect(m_view, SIGNAL(painted(qlonglong)), this, SLOT(onViewPainted(qlonglong)));
    connect(m_view, SIGNAL(imageRequested(int)), this, SLOT(onViewImageRequested(int)));
    connect(m_view, SIGNAL(imageReceived()), this, SLOT(onViewImageReceived()));
    connect(m_view, SIGNAL(imageFinished()), this, SLOT(onViewImageFinished()));
    connect(m_view, SIGNAL(mouseMove(QMouseEvent*)), this, SLOT(onViewMouseMove(QMouseEvent*)));
    connect(m_view, SIGNAL(featureSnap(Feature*)), this, SLOT(onViewFeatureSnap(Feature*)));

    setCentralWidget(m_view);

    // Docks
    m_infosdock = new InfosDock(this);
    m_infosdock->setAllowedAreas(Qt::RightDockWidgetArea | Qt::LeftDockWidgetArea);
    addDockWidget(Qt::RightDockWidgetArea, m_infosdock);
    connect(m_infosdock, SIGNAL(dockClosed(bool)), this, SLOT(onDisplayInfosDock(bool)));

    // Status bar
    m_coordsLabel = new CoordField(this);
    connect(m_coordsLabel, SIGNAL(centerView(qreal,qreal)), this, SLOT(onCenterView(qreal,qreal)));

    m_meterPerPixelLabel = new QLabel(this);
    m_zoomlevelLabel = new QLabel(this);    
    m_paintTimeLabel = new QLabel(this);
    m_paintTimeLabel->setMinimumWidth(23);

    m_dataProgress = new QProgressBar(this);
    m_dataProgress->setMaximumWidth(200);
    m_dataProgress->setVisible(false);

    m_imagesProgress = new QProgressBar(this);
    m_imagesProgress->setMaximumWidth(200);
    m_imagesProgress->setFormat(tr("tile %v / %m"));

    m_wsProgress = new QProgressBar(this);
    m_wsProgress->setMaximumWidth(200);
    m_wsProgress->setTextVisible(true);
    m_wsProgress->setFormat(tr("Requesting...")); // This has no effects, because max = 0
    m_wsProgress->setVisible(false);
    m_wsProgress->setMaximum(0);

    // Separators
    m_sepCoordZoom = new QFrame(this);
    m_sepCoordZoom->setFrameStyle(QFrame::VLine);
    m_sepZoomScale = new QFrame(this);
    m_sepZoomScale->setFrameStyle(QFrame::VLine);
    m_sepScaleTime = new QFrame(this);
    m_sepScaleTime->setFrameStyle(QFrame::VLine);

    statusBar()->addPermanentWidget(m_imagesProgress);
    statusBar()->addPermanentWidget(m_dataProgress);
    statusBar()->addPermanentWidget(m_wsProgress);
    statusBar()->addPermanentWidget(m_coordsLabel);
    statusBar()->addPermanentWidget(m_sepCoordZoom);
    statusBar()->addPermanentWidget(m_zoomlevelLabel);
    statusBar()->addPermanentWidget(m_sepZoomScale);
    statusBar()->addPermanentWidget(m_meterPerPixelLabel);
    statusBar()->addPermanentWidget(m_sepScaleTime);
    statusBar()->addPermanentWidget(m_paintTimeLabel);
}
void Camera::takeImage()
{
	cv::Mat img;
	if(capture_.isOpened())
	{
		capture_.read(img);// capture a frame
	}
	else if(!images_.empty())
	{
		if(currentImageIndex_ < (unsigned int)images_.size())
		{
			img = cv::imread(images_[currentImageIndex_++]);
		}
	}
	else if(cameraTcpServer_)
	{
		img = cameraTcpServer_->getImage();
		if(cameraTcpServer_->imagesBuffered() > 0 && Settings::getCamera_9queueSize() == 0)
		{
			UWARN("%d images buffered so far...", cameraTcpServer_->imagesBuffered());
		}
	}

	if(img.empty())
	{
		if(cameraTcpServer_)
		{
			if(!cameraTcpServer_->isConnected())
			{
				cameraTcpServer_->waitForNewConnection(100);
			}
		}
		else
		{
			// In case of a directory of images or a video
			this->stop();
			Q_EMIT finished(); // notify that there are no more images
		}
	}
	else
	{
		//resize
		if( Settings::getCamera_2imageWidth() &&
			Settings::getCamera_3imageHeight() &&
			Settings::getCamera_2imageWidth() != img.cols &&
			Settings::getCamera_3imageHeight() != img.rows)
		{
			cv::Mat resampled;
			cv::resize(img, resampled, cv::Size(Settings::getCamera_2imageWidth(), Settings::getCamera_3imageHeight()));
			Q_EMIT imageReceived(resampled);
		}
		else if(capture_.isOpened())
		{
			Q_EMIT imageReceived(img.clone()); // clone required with VideoCapture::read()
		}
		else
		{
			Q_EMIT imageReceived(img); // clone not required with cv::imread()
		}
	}
}