Cleaned up osgWidget::VncClient and osgWidget::Browser so that their implementations are all more consitent with the osgWidget::PdfReader.

This commit is contained in:
Robert Osfield
2008-12-09 11:05:04 +00:00
parent d8c17e4c4c
commit c8190d9c54
11 changed files with 169 additions and 162 deletions

View File

@@ -14,8 +14,7 @@
#ifndef OSGWIDGET_BROWSER
#define OSGWIDGET_BROWSER
#include <osg/Image>
#include <osgWidget/Export>
#include <osgWidget/PdfReader>
namespace osgWidget {
@@ -33,7 +32,6 @@ class OSGWIDGET_EXPORT BrowserManager : public osg::Object
void setApplication(const std::string& application) { _application = application; }
const std::string& getApplication() const { return _application; }
virtual BrowserImage* createBrowserImage(const std::string& url);
virtual BrowserImage* createBrowserImage(const std::string& url, int width, int height);
protected:
@@ -48,21 +46,43 @@ class OSGWIDGET_EXPORT BrowserManager : public osg::Object
};
class OSGWIDGET_EXPORT BrowserImage : public osg::Image
/** Pure virtual base class for that provides the browser inteface for integration with 3rd party implementations.
* Implementation of BrowserImage are provide via the gecko plugin.*/
class BrowserImage : public osg::Image
{
public:
BrowserImage();
BrowserImage() {}
virtual void navigateTo(const std::string& url) = 0;
protected:
virtual ~BrowserImage();
virtual ~BrowserImage() {}
};
/** Convinience class that provides a interactive quad that can be placed directly in the scene.*/
class OSGWIDGET_EXPORT Browser : public osg::Geode
{
public:
Browser() {}
Browser(const std::string& url, const GeometryHints& hints = GeometryHints());
bool assign(BrowserImage* browserImage, const GeometryHints& hints = GeometryHints());
bool open(const std::string& url, const GeometryHints& hints = GeometryHints());
void navigateTo(const std::string& url);
protected:
osg::ref_ptr<BrowserImage> _browserImage;
};
}
#endif

View File

@@ -37,24 +37,35 @@ struct GeometryHints
widthVec(1.0f,0.0f,0.0f),
heightVec(0.0f,1.0f,0.0f),
backgroundColor(1.0f,1.0f,1.0f,1.0f),
aspectRatioPolicy(RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO) {}
aspectRatioPolicy(RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO),
widthResolution(1024),
heightResolution(1024) {}
GeometryHints(const osg::Vec3& pos,
const osg::Vec3& wVec,
const osg::Vec3& hVec,
const osg::Vec4& bColor,
AspectRatioPolicy asp=RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO):
AspectRatioPolicy asp=RESIZE_HEIGHT_TO_MAINTAINCE_ASPECT_RATIO,
unsigned int wRes=1024,
unsigned int hRes=1024):
position(pos),
widthVec(wVec),
heightVec(hVec),
backgroundColor(bColor),
aspectRatioPolicy(asp) {}
aspectRatioPolicy(asp),
widthResolution(wRes),
heightResolution(hRes) {}
osg::Vec3 position;
osg::Vec3 widthVec;
osg::Vec3 heightVec;
osg::Vec4 backgroundColor;
AspectRatioPolicy aspectRatioPolicy;
osg::Vec3 position;
osg::Vec3 widthVec;
osg::Vec3 heightVec;
osg::Vec4 backgroundColor;
AspectRatioPolicy aspectRatioPolicy;
unsigned int widthResolution;
unsigned int heightResolution;
};
@@ -114,11 +125,11 @@ class OSGWIDGET_EXPORT PdfReader : public osg::Geode
PdfReader() {}
PdfReader(const std::string& filename, GeometryHints hints = GeometryHints());
PdfReader(const std::string& filename, const GeometryHints& hints = GeometryHints());
bool assign(PdfImage* pdfImage, GeometryHints hints = GeometryHints());
bool assign(PdfImage* pdfImage, const GeometryHints& hints = GeometryHints());
bool open(const std::string& filename, GeometryHints hints = GeometryHints());
bool open(const std::string& filename, const GeometryHints& hints = GeometryHints());
bool page(int pageNum);

View File

@@ -45,11 +45,11 @@ class OSGWIDGET_EXPORT VncClient : public osg::Geode
VncClient() {}
VncClient(const std::string& hostname, GeometryHints hints = GeometryHints());
VncClient(const std::string& hostname, const GeometryHints& hints = GeometryHints());
bool assign(VncImage* vncImage, GeometryHints hints = GeometryHints());
bool assign(VncImage* vncImage, const GeometryHints& hints = GeometryHints());
bool connect(const std::string& hostname, GeometryHints hints = GeometryHints());
bool connect(const std::string& hostname, const GeometryHints& hints = GeometryHints());
void close();