VR-Forces 4.0.4 Class Documentation
include/vrvOsg/Dt3DSegmentedLineModelInstance.h
Go to the documentation of this file.
00001 /******************************************************************************
00002 ** Copyright (c) 2012 MAK Technologies, Inc.
00003 ** All rights reserved.
00004 ******************************************************************************/
00005 
00009 
00010 #pragma once
00011 
00012 #include <vrvOsg/vrvOsg.h>
00013 #include <vrvOsg/DtOsgModelInstance.h>
00014 
00015 #include <osg/Geode>
00016 #include <osg/MatrixTransform>
00017 
00018 #include <boost/unordered_map.hpp>
00019 
00020 namespace makVrv
00021 {
00022    class Dt3DLineModelInstanceSegmentInterface;
00023    class Dt3DLineModelInstanceSegment;
00024    class DtOsgSegmentPickable;
00025 
00028    class DT_DLL_VRVOSG Dt3DSegmentedLineModelInstance
00029       : public DtOsgModelInstance
00030    {
00031    public:
00032 
00034       Dt3DSegmentedLineModelInstance(DtDe& de);
00035 
00037       virtual ~Dt3DSegmentedLineModelInstance();
00038 
00040       virtual void setPosition( int vtx, const DtVector& position );
00041 
00044       virtual DtVector removePosition( int vtx );
00045 
00047       virtual void setWidth(float width);
00048 
00050       virtual void setColor(float r, float g, float b, float a);
00051 
00053       virtual void setStipplePattern( unsigned int pattern, int repeatFactor );
00054 
00057       virtual void setStyleSegments(const std::vector<double>& segmentPercentages);
00058 
00060       virtual void setSegmentColor(unsigned int segmentIndex,
00061          float r, float g, float b, float a);
00062 
00064       virtual void setSegmentLightningStyle(unsigned int segmentIndex,
00065          bool enableLightningStyle);
00066 
00068       virtual void setSegmentStartArrow(unsigned int segmentIndex,
00069          bool enableArrow);
00070 
00072       virtual void setSegmentEndArrow(unsigned int segmentIndex,
00073          bool enableArrow);
00074 
00077       virtual void setSegmentStipplePattern(unsigned int segmentIndex,
00078          unsigned int stipplePattern, int repeatFactor);
00079 
00081       virtual void setSegmentWidth(unsigned int segmentWidth, double width);
00082 
00085       virtual void setSegmentStartColor( unsigned int segmentIndex, float r, 
00086          float g, float b, float a );
00087 
00090       virtual void setSegmentEndColor( unsigned int segmentIndex, float r, 
00091          float g, float b, float a );
00092 
00094       virtual void setTerrainIntersect(bool enabled);
00095       
00097       virtual void setModelSet( int modelSet );
00098 
00101       virtual bool realize(DtModelDefinition& definition);
00102 
00104       virtual void  addToConnector( DtOsgSceneConnector* connector );
00105 
00107       virtual bool removeFromConnector( DtOsgSceneConnector* connector );
00108 
00110       virtual void setDepthTestEnabled(bool enabled);
00111 
00113       virtual void setVisible(bool isVisible);
00114 
00116       virtual void setPickable( bool pickable );
00117 
00119       bool pickable() const;
00120 
00122       virtual void update();
00123 
00124    private:
00125 
00127       Dt3DSegmentedLineModelInstance();
00128 
00130       Dt3DSegmentedLineModelInstance( const Dt3DSegmentedLineModelInstance& );
00131 
00133       Dt3DSegmentedLineModelInstance& operator=( const Dt3DSegmentedLineModelInstance& );
00134 
00135    protected:
00136 
00138       virtual Dt3DLineModelInstanceSegmentInterface* createSegment();
00139 
00141       Dt3DLineModelInstanceSegment& lineSegment( int i);
00142 
00144       const Dt3DLineModelInstanceSegment& lineSegment(int i) const;
00145 
00147       virtual void updatePickableSegments();
00148 
00151       virtual void adjustSegmentVisibility( int vtx, bool visible );
00152 
00154       virtual void resizeSegments(int size);
00155 
00157       virtual void resizeSegmentAttributes(int size);
00158 
00160       virtual void updateGeometry();
00161 
00163       virtual void updateSegmentAttributes();
00164 
00165    protected:
00166       // These are in database coordinates - the segments are in local (line coordinates)
00167       std::vector<osg::Vec3d> myVertices;
00168 
00169       bool myTerrainIntersectMode;
00170       int myModelSet;
00171       bool myVisible;
00172 
00173       std::vector<double> mySegmentPercentages;
00174       std::vector<Dt3DLineModelInstanceSegmentInterface*> mySegments;
00175 
00176       osg::ref_ptr<osg::Group> myGroup;
00177 
00178       // These are for use with DtOsgSegmentPickable
00179       DtOsgSegmentPickable* myPickable;
00181 
00182       double myWidth;
00183       osg::Vec4 myColor;
00184       unsigned int myStipplePattern;
00185       int myStippleRepeat;
00186 
00187       struct SegmentAttributes
00188       {
00189          osg::Vec4 color[2];
00190          bool startArrow;
00191          bool endArrow;
00192          bool lightning;
00193          double width;
00194          unsigned int stipplePattern;
00195          int stippleRepeat;
00196       };
00197 
00198       bool mySegmentAttributesDirty;
00199       bool myGeometryDirty;
00200       std::vector<SegmentAttributes> mySegmentAttributes;
00201    };
00202 }

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)