source: osgVisual/include/vista2D/visual_vista2D.h @ 155

Last change on this file since 155 was 155, checked in by Torben Dannhauer, 14 years ago
File size: 4.4 KB
Line 
1#pragma once
2/* -*-c++-*- osgVisual - Copyright (C) 2009-2010 Torben Dannhauer
3 *
4 * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under
5 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
6 * (at your option) any later version.  The full license is in LICENSE file
7 * included with this distribution, and on the openscenegraph.org website.
8 *
9 * osgVisual requires for some proprietary modules a license from the correspondig manufacturer.
10 * You have to aquire licenses for all used proprietary modules.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 * OpenSceneGraph Public License for more details.
16*/
17
18// Vista 2D
19#include "VistaView.h"
20
21// C++ libraries
22#include <string>
23
24// XML Parser
25#include <stdio.h>
26#include <libxml/parser.h>
27#include <libxml/tree.h>
28
29// OSG Includes
30#include <osg/Drawable>
31#include <osg/Geode>
32#include <osg/Projection>
33#include <osg/MatrixTransform>
34#include <osg/CoordinateSystemNode>
35
36#include <osgDB/FileUtils>
37
38// osgVisual Includes
39#include <visual_util.h>
40
41namespace osgVisual
42{
43
44/**
45 * \brief This class integrates Vista2D by Wetzel Technology into OSG.
46 *
47 * It wraps vista2D's OpenGL interface to be usable as a standart OSG Node. The Vista2D nodekit performs auto-linking
48 * againt the Vista2D library, therefore only three shared libraries have to be copied to the binary folder of the project.
49 *
50 * Vista2D ist a software to design HID. This Nodekit enables OSG to display Vista2D project files.
51 *
52 * Please copy the following files to the binary folder of you application if you intend to use this nodekit:
53 * libView.dll
54 * fontLib.dll
55 * freetype6.dll
56 *
57 * The implementation of this class is based on osg::Drawable. The drawimplementations contains the Vista2D wrap.
58 * 
59 * @author Torben Dannhauer
60 * @date  Sep 2009
61 */ 
62class visual_vista2D : public osg::Drawable
63{
64public:
65        /**
66         * \brief Construtor: Creates a Vista2D environment which should be wrapt by this node.
67         *
68         */ 
69        visual_vista2D(void);
70
71        /**
72         * \brief Empty destructor.
73         *
74         */ 
75        ~visual_vista2D(void);
76
77        /**
78         * \brief This static function must be called to instantiate a vista2D project.
79         *
80         * @param vista2DFilename_ : Vista2D project file to display.
81         * @param sceneGraphRoot_ : Scenegraph to add the vista2D note as child.
82         * @return : True if successful.
83         */ 
84        static bool init( osg::CoordinateSystemNode *sceneGraphRoot_, std::string configFileName );
85
86        /**
87         * \brief This function is requiered by subclassing osg::Drawable.
88         *
89         * @return : Cloned object.
90         */ 
91        osg::Object* cloneType() const;
92
93        /**
94         * \brief This function is requiered by subclassing osg::Drawable.
95         *
96         * @param : Copyoperator how to copy the object
97         * @return : Cloned object.
98         */ 
99        osg::Object* clone(const osg::CopyOp&) const;
100
101private:
102
103        static bool processXMLConfiguration(std::string& configFileName, std::string& vistaProjectfile, bool& paintBackground, int& position_x, int& position_y, float& zoom);
104
105        /**
106         * \brief This function initialized the visual_vista2D object after instantiation by createVistaOverlay()
107         */ 
108        void startVista2D(std::string vistaProjectfile, bool paintBackground, int posX, int posY, float zoom);
109
110        /**
111         * \brief This function implements the pure OpenGL draw by calling Vista2D's draw funtion.
112         *
113         * Because Visrta2D manipulates OpenGLs stateset, this function saves the
114         * OSG statset at the beginning and restores it after the drawing of Vista2D
115         *
116         * @param renderInfo : Renderinfo of the drawing
117         */ 
118        void drawImplementation(osg::RenderInfo& renderInfo) const;
119       
120        /**
121         * Pointer to Vista2D's view instance.
122         */ 
123        Vista2D::VistaView* view;
124
125        ///**
126        // * XML config filename
127        // */
128        //std::string configFileName;
129
130        ///**
131        // * Filename of the Vista2D project file.
132        // */
133        //std::string filename;
134
135        ///**
136        // * Should the background of the Vista2D project be painted?
137        // */
138        //bool paintBackground;
139
140        ///**
141        // * X-Position to draw.
142        // */
143        //int position_x;
144
145        ///**
146        // * Y-Position to draw.
147        // */
148        //int position_y;
149
150        ///**
151        // * Zoom factor to draw the project.
152        // */
153        //double zoom;
154}; 
155
156}       // END NAMESPACE
Note: See TracBrowser for help on using the repository browser.