modify view
This commit is contained in:
parent
1dc7ec9f8b
commit
b900683dbe
@ -6,6 +6,7 @@
|
|||||||
#include <osgWidget/ViewerEventHandlers>
|
#include <osgWidget/ViewerEventHandlers>
|
||||||
|
|
||||||
#include "utils/ImageUtils.h"
|
#include "utils/ImageUtils.h"
|
||||||
|
#include "common/SpdLogger.h"
|
||||||
|
|
||||||
BackGroundWidget::BackGroundWidget(const std::string& name,
|
BackGroundWidget::BackGroundWidget(const std::string& name,
|
||||||
float w,
|
float w,
|
||||||
@ -15,7 +16,8 @@ BackGroundWidget::BackGroundWidget(const std::string& name,
|
|||||||
{
|
{
|
||||||
//osg::Image *image = ImageUtils::readImage(fileName);
|
//osg::Image *image = ImageUtils::readImage(fileName);
|
||||||
|
|
||||||
setImage(fileName, true, true);
|
LOG_INFO("setimage, {}", fileName);
|
||||||
|
setImage(fileName, true);
|
||||||
|
|
||||||
setTexCoord(0.0f, 0.0f, osgWidget::Widget::LOWER_LEFT);
|
setTexCoord(0.0f, 0.0f, osgWidget::Widget::LOWER_LEFT);
|
||||||
setTexCoord(1.0f, 0.0f, osgWidget::Widget::LOWER_RIGHT);
|
setTexCoord(1.0f, 0.0f, osgWidget::Widget::LOWER_RIGHT);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "utils/ImageUtils.h"
|
#include "utils/ImageUtils.h"
|
||||||
#include "CompositeWidgetManager.h"
|
#include "CompositeWidgetManager.h"
|
||||||
|
#include "common/SpdLogger.h"
|
||||||
|
|
||||||
|
|
||||||
CompositeWidget::CompositeWidget(std::string name,
|
CompositeWidget::CompositeWidget(std::string name,
|
||||||
@ -13,7 +14,7 @@ CompositeWidget::CompositeWidget(std::string name,
|
|||||||
CompositeWidgetManager *wm) :osgWidget::Widget(name, w, h)
|
CompositeWidgetManager *wm) :osgWidget::Widget(name, w, h)
|
||||||
{
|
{
|
||||||
//osg::Image *image = ImageUtils::readImage(fileName);
|
//osg::Image *image = ImageUtils::readImage(fileName);
|
||||||
|
LOG_INFO("setimage, {}", fileName);
|
||||||
setImage(fileName, true, true);
|
setImage(fileName, true, true);
|
||||||
|
|
||||||
setTexCoord(0.0f, 0.0f, osgWidget::Widget::LOWER_LEFT);
|
setTexCoord(0.0f, 0.0f, osgWidget::Widget::LOWER_LEFT);
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
#include "ZoomWidget.h"
|
#include "ZoomWidget.h"
|
||||||
#include "utils/ImageUtils.h"
|
#include "utils/ImageUtils.h"
|
||||||
|
#include "common/SpdLogger.h"
|
||||||
|
|
||||||
ZoomWidget::ZoomWidget(std::string name,
|
ZoomWidget::ZoomWidget(std::string name,
|
||||||
float w,
|
float w,
|
||||||
@ -13,14 +14,15 @@ ZoomWidget::ZoomWidget(std::string name,
|
|||||||
:osgWidget::Widget(name, w, h)
|
:osgWidget::Widget(name, w, h)
|
||||||
{
|
{
|
||||||
//osg::Image *image = ImageUtils::readImage(fileName);
|
//osg::Image *image = ImageUtils::readImage(fileName);
|
||||||
setImage(fileName, true, true);
|
LOG_INFO("setimage, {}", fileName);
|
||||||
|
setImage(fileName, true);
|
||||||
setTexCoord(0.0f, 0.0f, osgWidget::Widget::LOWER_LEFT);
|
setTexCoord(0.0f, 0.0f, osgWidget::Widget::LOWER_LEFT);
|
||||||
setTexCoord(1.0f, 0.0f, osgWidget::Widget::LOWER_RIGHT);
|
setTexCoord(1.0f, 0.0f, osgWidget::Widget::LOWER_RIGHT);
|
||||||
setTexCoord(1.0f, 1.0f, osgWidget::Widget::UPPER_RIGHT);
|
setTexCoord(1.0f, 1.0f, osgWidget::Widget::UPPER_RIGHT);
|
||||||
setTexCoord(0.0f, 1.0f, osgWidget::Widget::UPPER_LEFT);
|
setTexCoord(0.0f, 1.0f, osgWidget::Widget::UPPER_LEFT);
|
||||||
setLayer(layer);
|
setLayer(layer);
|
||||||
setEventMask(osgWidget::EVENT_MOUSE_PUSH | osgWidget::EVENT_MOUSE_RELEASE | osgWidget::EVENT_MOUSE_DRAG);
|
setEventMask(osgWidget::EVENT_MOUSE_PUSH | osgWidget::EVENT_MOUSE_RELEASE | osgWidget::EVENT_MOUSE_DRAG);
|
||||||
setColor(1, 1, 1, 0);
|
setColor(1, 1, 1, 1);
|
||||||
|
|
||||||
|
|
||||||
_pointX = _pointY = 0.0;
|
_pointX = _pointY = 0.0;
|
||||||
|
@ -6,7 +6,7 @@
|
|||||||
/// Needed for mixing osg rendering with Qt 2D drawing using QPainter...
|
/// Needed for mixing osg rendering with Qt 2D drawing using QPainter...
|
||||||
/// See http://forum.openscenegraph.org/viewtopic.php?t=15627&view=previous
|
/// See http://forum.openscenegraph.org/viewtopic.php?t=15627&view=previous
|
||||||
|
|
||||||
class GraphicsWindowEx : public osgViewer::GraphicsWindow
|
class GraphicsWindowEx : public osgViewer::GraphicsWindowEmbedded
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
GraphicsWindowEx(osg::GraphicsContext::Traits* traits);
|
GraphicsWindowEx(osg::GraphicsContext::Traits* traits);
|
||||||
|
@ -5,6 +5,7 @@
|
|||||||
#include <QApplication>
|
#include <QApplication>
|
||||||
#include <osg/BlendFunc>
|
#include <osg/BlendFunc>
|
||||||
#include <osgEarth/GLUtils>
|
#include <osgEarth/GLUtils>
|
||||||
|
#include <osgDB/Registry>
|
||||||
|
|
||||||
#include "common/SpdLogger.h"
|
#include "common/SpdLogger.h"
|
||||||
#include "viewer/OsgView.h"
|
#include "viewer/OsgView.h"
|
||||||
@ -20,7 +21,9 @@ OsgViewer::OsgViewer(QObject* parent) noexcept
|
|||||||
, compositeViewer_(new osgViewer::CompositeViewer) {
|
, compositeViewer_(new osgViewer::CompositeViewer) {
|
||||||
LOG_INFO("actor, self={}", fmt::ptr(this));
|
LOG_INFO("actor, self={}", fmt::ptr(this));
|
||||||
compositeViewer_->setKeyEventSetsDone(0);
|
compositeViewer_->setKeyEventSetsDone(0);
|
||||||
|
compositeViewer_->getDatabasePager()->setUnrefImageDataAfterApplyPolicy(true, false);
|
||||||
osgEarth::initialize();
|
osgEarth::initialize();
|
||||||
|
osgDB::Registry::instance()->getObjectWrapperManager()->findWrapper("osg::Image");
|
||||||
compositeViewer_->setThreadingModel(osgViewer::ViewerBase::ThreadingModel::SingleThreaded);
|
compositeViewer_->setThreadingModel(osgViewer::ViewerBase::ThreadingModel::SingleThreaded);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user