VR-Forces 4.0.4 Class Documentation
include/vrvOsg/DtOsgTerrainPatchObject.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2007 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 /******************************************************************************
00006 ** $RCSfile: DtOsgTerrainPatchObject.h,v $ $Revision: 1.49 $ $State: Exp $
00007 ******************************************************************************/
00008 
00012 
00013 #pragma once
00014 #include <vrvOsg/vrvOsg.h>
00015 #include <vrvOsg/DtOsgTerrainOverlayManager.h>
00016 #include <vrvCore/DtTerrainPatchObject.h>
00017 #include <vrvOsg/DtFastGroup.h>
00018 #include <osg/ref_ptr>
00019 
00020 namespace osgEarth
00021 {
00022    class MapNode;
00023 }
00024 
00025 namespace osgEarth
00026 {
00027    namespace Util
00028    {
00029       class ElevationManager;
00030    }
00031 }
00032 
00033 namespace makVrv
00034 {
00035 
00036    class DtDe;
00037    class DtTerrainPatchGroup;
00038 
00043    class DT_DLL_VRVOSG DtOsgTerrainPatchObject : public DtTerrainPatchObject
00044    {
00045    public:
00046 
00048       DtOsgTerrainPatchObject(DtDe& de, DtUniqueID id);
00049 
00051       virtual ~DtOsgTerrainPatchObject();
00052 
00054       //
00055 
00057       virtual void setTerrainDefinition(const std::string& modelDefinitionName);
00058 
00060       virtual void enableOverlay(int type, const std::string& definition);
00061 
00063       virtual void disableOverlay(int type);
00064 
00066       virtual void disableAllOverlays();
00067 
00069       virtual void setOverlayScale(int type, double x, double y);
00070 
00072       virtual void setWrapMode(int type, int);
00073 
00075       virtual void setBlendMode(int type, int);
00076 
00078       virtual void setOverlayOffset(int type, double x, double y);
00079 
00081       virtual void setLayerEnabled(const std::string& rule, bool status);
00082 
00084       virtual void setRasterLayerPosition(int type, int pos);
00085 
00086       //
00088 
00089       virtual std::string overlayDefinition(int type);
00090 
00091       virtual std::vector<double> overlayScale(int type);
00092       virtual std::vector<double> overlayOffset(int type);
00093       virtual DtTerrainOverlayOperation defaultOverlay(int type);
00094       virtual DtTerrainOverlayOperation currentOverlay(int type);
00095 
00097       virtual void getTerrainExtents(DtVector& nw, DtVector& ne, DtVector& sw, DtVector& se) const;
00098 
00100       virtual DtVector getDatabaseOrigin() const;
00101       
00103       virtual void getBoundingBoxCenter(float& x, float& y, float& z) const;
00104 
00105       //Get the terrain group node.
00106       osg::Group* terrainGroupNode();
00107 
00109       virtual void extractNodes(const std::string& ruleset, bool isRegEx);
00110      
00113       virtual int countNodes(const std::string& rule) const;
00114 
00117       virtual bool getExtractedNodePosition(const std::string& rule, 
00118          unsigned int index, double& x, double& y, double& z) const;
00119 
00122       virtual bool getExtractedNodeOrientation( const std::string& rule, 
00123          unsigned int index, double& x, double& y, double& z, double& w) const;
00124 
00127       virtual void moveNode(DtSceneObject* object,
00128          DtModel* model,const std::string& rule, unsigned int index);
00129 
00131       virtual osg::Node* findNode(const std::string& rule, unsigned int index);
00132 
00134       virtual bool isGlobalScaleTerrain() const;
00135 
00137       virtual bool getTerrainIntersection(double x, double y, double z,
00138          double vx, double vy, double vz, double& retX, double& retY, double& retZ );
00139          
00143       virtual void clearElevationCache();
00144 
00145       bool isOsgEarth() const
00146       {
00147          return myMapNode != 0;
00148       }
00149 
00150    private:
00152       DtOsgTerrainPatchObject(const DtOsgTerrainPatchObject&);
00153       DtOsgTerrainPatchObject& operator=(const DtOsgTerrainPatchObject&);
00154 
00155    protected:
00156 
00158       void removeChildNodesAndCache();
00159 
00160       static void graphBoundingBox(const osg::Node* node, osg::BoundingBox &bbox);
00161 
00162       //Remove the node from it's parent, and if the parent has no other
00163       //Children remove it from it's parent too recursively.
00164       void removeEmptyParent(osg::Node* node);
00165       void updateBounds();
00166 
00168       virtual bool getElevation(double lonRadians, double latRadians,
00169          double& retElevation );
00170       
00171    protected:
00172 
00173       struct ExtractedNode
00174       {
00175          osg::Vec3 location;
00176          osg::Vec3 scale;
00177          osg::Quat orientation;
00178          osg::Quat orientationScale;
00179          osg::ref_ptr<osg::Node> node;
00180          osg::Node::ParentList parents;
00181       };
00182 
00183 
00185       osg::ref_ptr<DtTerrainPatchGroup> myRoot;
00186 
00188       osg::ref_ptr<DtFastGroup> myTerrainGroup;
00189 
00190       osgEarth::Util::ElevationManager* myElevationManager;
00191       osgEarth::MapNode* myMapNode;
00192 
00193       typedef std::vector<ExtractedNode> NodeList;
00194       typedef std::map<std::string, NodeList > ExtractedNodeListMap;
00195       ExtractedNodeListMap myExtractedNodes;
00196       
00197       DtOsgTerrainOverlayManager myOverlayManager;
00198 
00199       bool myGlobalFlag;
00200    };   
00201 }

Document ID: Generated on Fri Jun 29 16:33:32 EDT 2012 from SVN revision 116588
Copyright © 2005-2012 VT MÄK Inc. All Rights Reserved (www.mak.com)