VR-Forces 4.0.4 Class Documentation
include/vrvOsg/DtOverlaySegmentedLineModelInstance.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 
00016 namespace makVrv
00017 {
00018    class DtSegmentedLine;
00019 
00023    class DT_DLL_VRVOSG DtOverlaySegmentedLineModelInstance
00024       : public DtOsgModelInstance
00025    {
00026    public:
00027 
00029       DtOverlaySegmentedLineModelInstance(DtDe& de);
00030 
00032       virtual ~DtOverlaySegmentedLineModelInstance();
00033 
00035       virtual void setPosition( int vtx, const DtVector& position );
00036 
00038       virtual void removePosition( int vtx );
00039 
00041       virtual void setWidth(float width);
00042 
00044       virtual void setColor(float r, float g, float b, float a);
00045 
00047       virtual void setStipplePattern( unsigned int pattern, int repeatFactor );
00048 
00051       virtual void setStyleSegments(const std::vector<double>& segmentPercentages);
00052 
00054       virtual void setSegmentColor(unsigned int segmentIndex,
00055          float r, float g, float b, float a);
00056 
00058       virtual void setSegmentLightningStyle(unsigned int segmentIndex,
00059          bool enableLightningStyle);
00060 
00062       virtual void setSegmentStartArrow(unsigned int segmentIndex,
00063          bool enableArrow);
00064 
00066       virtual void setSegmentEndArrow(unsigned int segmentIndex,
00067          bool enableArrow);
00068 
00071       virtual void setSegmentStipplePattern(unsigned int segmentIndex,
00072          unsigned int stipplePattern, int repeatFactor);
00073 
00075       virtual void setSegmentWidth(unsigned int segmentIndex, double width);
00076 
00079       virtual void setSegmentStartColor( unsigned int segmentIndex, float r, 
00080          float g, float b, float a );
00081 
00084       virtual void setSegmentEndColor( unsigned int segmentIndex, float r, 
00085          float g, float b, float a );
00086 
00088       virtual void setModelSet( int modelSet );
00089 
00092       virtual bool realize(DtModelDefinition& definition);
00093 
00095       virtual void setVisible(bool isVisible);
00096 
00098       virtual void setEventsEnabled( bool enabled, unsigned long long userData );
00099 
00101       virtual void setEventWidth(float width);
00102 
00104       virtual void update();
00105 
00107       virtual void setRotation(const osg::Quat& quat);
00108 
00109    private:
00110 
00112       DtOverlaySegmentedLineModelInstance();
00113 
00115       DtOverlaySegmentedLineModelInstance( const DtOverlaySegmentedLineModelInstance& );
00116 
00118       DtOverlaySegmentedLineModelInstance& operator=( const DtOverlaySegmentedLineModelInstance& );
00119 
00120    protected:
00121 
00123       virtual void createLineIfNecessary();
00124 
00126       virtual void updateSegments();
00127 
00129       virtual void updateGeometry();
00130 
00132       virtual void resizeSegmentAttributes( int size );
00133 
00135       virtual void set3DVertexPosition( unsigned int index, double x, double y, 
00136          double z );
00137 
00139       virtual void set3DPositionAux( double x, double y, double z, 
00140          float tempPackedCoords[4] );
00141 
00142    protected:
00143 
00144       DtUniqueID mySceneObjectId;
00145 
00146       typedef std::vector<DtVector> Points;
00147 
00148       struct SegmentAttributes
00149       {
00150          float width;
00151          bool startArrow;
00152          bool endArrow;
00153          bool lightning;
00154          unsigned int stipplePattern;
00155          int stippleRepeat;
00156          osg::Vec4 color[2];
00157       };
00158 
00159       typedef std::vector<SegmentAttributes> SegmentAttributesVector;
00160 
00161       // These are the points as set by the model
00162       Points myPoints;
00163 
00164       // These are the actual vertices, which may be different if style segments are used
00165       Points myVertices;
00166 
00167       SegmentAttributesVector mySegmentAttributes;
00168       unsigned int myModelSet;
00169       DtSegmentedLine* myLine;
00170       bool myVisible;
00171 
00172       osg::Vec4 myColor;
00173       float myWidth;
00174       unsigned int myStipplePattern;
00175       int myStippleRepeat;
00176       std::vector<double> mySegmentPercentages;
00177       float myEventWidth;
00178 
00179       bool myGeometryDirty;
00180       bool mySegmentsDirty;
00181       bool myEventsEnabled;
00182 
00183       osg::Vec3d myOrigin;
00184       osg::Quat myRotation;
00185    };
00186 }

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)