Пример #1
0
int qmapcontrol::MapControl::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QWidget::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        switch (_id) {
        case 0: mouseEventCoordinate((*reinterpret_cast< const QMouseEvent*(*)>(_a[1])),(*reinterpret_cast< const QPointF(*)>(_a[2]))); break;
        case 1: boxDragged((*reinterpret_cast< const QRectF(*)>(_a[1]))); break;
        case 2: geometryClicked((*reinterpret_cast< Geometry*(*)>(_a[1])),(*reinterpret_cast< QPoint(*)>(_a[2]))); break;
        case 3: viewChanged((*reinterpret_cast< const QPointF(*)>(_a[1])),(*reinterpret_cast< int(*)>(_a[2]))); break;
        case 4: zoomIn(); break;
        case 5: zoomOut(); break;
        case 6: setZoom((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 7: scrollLeft((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 8: scrollLeft(); break;
        case 9: scrollRight((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 10: scrollRight(); break;
        case 11: scrollUp((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 12: scrollUp(); break;
        case 13: scrollDown((*reinterpret_cast< int(*)>(_a[1]))); break;
        case 14: scrollDown(); break;
        case 15: scroll((*reinterpret_cast< const QPoint(*)>(_a[1]))); break;
        case 16: updateRequest((*reinterpret_cast< QRect(*)>(_a[1]))); break;
        case 17: updateRequestNew(); break;
        case 18: resize((*reinterpret_cast< const QSize(*)>(_a[1]))); break;
        case 19: tick(); break;
        case 20: loadingFinished(); break;
        case 21: positionChanged((*reinterpret_cast< Geometry*(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 22;
    }
    return _id;
}
Пример #2
0
    bool GeometryWidget::touches(const Geometry* geometry, const int& controller_zoom) const
    {
        // Default return success.
        bool return_touches(false);

        // Check we are visible and the geometry to compare against is valid.
        if(isVisible(controller_zoom) && geometry != nullptr)
        {
            // Switch to the correct geometry type.
            switch(geometry->geometryType())
            {
                case GeometryType::GeometryLineString:
                {
                    /// @todo Line String calculation.

                    // Finished.
                    break;
                }
                case GeometryType::GeometryPoint:
                case GeometryType::GeometryWidget:
                {
                    // Check if the bounding boxes intersect.
                    if(geometry->boundingBox(controller_zoom).rawRect().intersects(boundingBox(controller_zoom).rawRect()))
                    {
                        // Set that we have touched.
                        return_touches = true;
                    }

                    // Finished.
                    break;
                }
                case GeometryType::GeometryPolygon:
                {
                    // Check if the poylgon intersects with our bounding box.
                    if(static_cast<const GeometryPolygon*>(geometry)->toQPolygonF().intersected(boundingBox(controller_zoom).rawRect()).empty() == false)
                    {
                        // Set that we have touched.
                        return_touches = true;
                    }

                    // Finished.
                    break;
                }
            }

            // Have we touched?
            if(return_touches)
            {
                // Emit that the geometry has been clicked.
                emit geometryClicked(this);
            }
        }

        // Return our success.
        return return_touches;
    }
Пример #3
0
int qmapcontrol::Layer::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: geometryClicked((*reinterpret_cast< Geometry*(*)>(_a[1])),(*reinterpret_cast< QPoint(*)>(_a[2]))); break;
        case 1: updateRequest((*reinterpret_cast< QRectF(*)>(_a[1]))); break;
        case 2: updateRequest(); break;
        case 3: setVisible((*reinterpret_cast< bool(*)>(_a[1]))); break;
        default: ;
        }
        _id -= 4;
    }
    return _id;
}
Пример #4
0
	bool LineString::Touches(Point* geom, const MapAdapter* mapadapter)
	{
// 	qDebug() << "LineString::Touches Point";
		touchedPoints.clear();
		bool touches = false;
		for (int i=0; i<vertices.count(); i++)
		{
			// use implementation from Point
			if (vertices.at(i)->Touches(geom, mapadapter))
			{
				touchedPoints.append(vertices.at(i));
			
				touches = true;
			}
		}
		if (touches)
		{
			emit(geometryClicked(this, QPoint(0,0)));
		}
		return touches;
	}
Пример #5
0
	void Layer::mouseEvent(const QMouseEvent* evnt, const QPoint mapmiddle_px)
	{
		if (takesMouseEvents())
		{
			if (evnt->button() == Qt::LeftButton && evnt->type() == QEvent::MouseButtonPress)
			{		
			// check for collision
				QPointF c = mapAdapter->displayToCoordinate(QPoint(evnt->x()-screenmiddle.x()+mapmiddle_px.x(),
						evnt->y()-screenmiddle.y()+mapmiddle_px.y()));
				Point* tmppoint = new Point(c.x(), c.y());
				for (int i=0; i<geometries.count(); i++)
				{
					if (geometries.at(i)->isVisible() && geometries.at(i)->Touches(tmppoint, mapAdapter))
				
// 				if (geometries.at(i)->Touches(c, mapAdapter))
					{
						emit(geometryClicked(geometries.at(i), QPoint(evnt->x(), evnt->y())));
					}
				}
				delete tmppoint;
			}
		}
	}