From 316c646a8f5a9c355de5f95ff82fa82d0345ddf7 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 31 Mar 2004 08:52:47 +0000 Subject: [PATCH] From David Fries, add init() call to SphereSegment constructor, and new get methods for draw mask and color. --- include/osgSim/SphereSegment | 35 ++++++++++++++++++++++++++++++++++- src/osgSim/SphereSegment.cpp | 22 ++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) diff --git a/include/osgSim/SphereSegment b/include/osgSim/SphereSegment index 90d719db3..4771f62e8 100644 --- a/include/osgSim/SphereSegment +++ b/include/osgSim/SphereSegment @@ -82,7 +82,9 @@ public: _elevMin(0.0f), _elevMax(osg::PI/2.0f), _density(10), _drawMask(DrawMask(ALL)) - {} + { + init(); + } /** Construct by angle ranges. Note that the azimuth 'zero' is the Y axis; specifying @@ -164,6 +166,22 @@ public: */ void getArea(osg::Vec3& v, float& azRange, float& elevRange) const; + /** Set the area of the sphere segment + @param azMin azimuth minimum + @param azMin azimuth maximum + @param elevMin elevation minimum + @param elevMax elevation maximum + */ + void setArea(float azMin, float azMax, float elevMin, float elevMax); + + /** Get the area of the sphere segment + @param azMin azimuth minimum + @param azMin azimuth maximum + @param elevMin elevation minimum + @param elevMax elevation maximum + */ + void getArea(float &azMin, float &azMax, float &elevMin, float &elevMax) const; + /** Set the density of the sphere segment */ void setDensity(int d); @@ -177,18 +195,33 @@ public: */ void setDrawMask(DrawMask dm); + /** Get the DrawMask */ + DrawMask getDrawMask() const { return _drawMask; } + /** Set the color of the surface. */ void setSurfaceColor(const osg::Vec4& c); + /** Get the color of the surface. */ + osg::Vec4 getSurfaceColor() const { return _surfaceColor; } + /** Set the color of the spokes. */ void setSpokeColor(const osg::Vec4& c); + /** Get the color of the spokes. */ + osg::Vec4 getSpokeColor() const { return _spokeColor; } + /** Set the color of the edge line. */ void setEdgeLineColor(const osg::Vec4& c); + /** Get the color of the edge line. */ + osg::Vec4 getEdgeLineColor() const { return _edgeLineColor; } + /** Set the color of the planes. */ void setSideColor(const osg::Vec4& c); + /** Get the color of the planes. */ + osg::Vec4 getSideColor() const { return _planeColor; } + /** Set color of all components. */ void setAllColors(const osg::Vec4& c); diff --git a/src/osgSim/SphereSegment.cpp b/src/osgSim/SphereSegment.cpp index 0ea30fe55..ebfe80f0b 100644 --- a/src/osgSim/SphereSegment.cpp +++ b/src/osgSim/SphereSegment.cpp @@ -293,6 +293,28 @@ void SphereSegment::getArea(osg::Vec3& vec, float& azRange, float& elevRange) co vec.set(cos(elev)*sin(az), cos(elev)*cos(az), sin(elev)); } +void SphereSegment::setArea(float azMin, float azMax, + float elevMin, float elevMax) +{ + _azMin=azMin; + _azMax=azMax; + _elevMin=elevMin; + _elevMax=elevMax; + + dirtyAllDrawableDisplayLists(); + dirtyAllDrawableBounds(); + dirtyBound(); +} + +void SphereSegment::getArea(float &azMin, float &azMax, + float &elevMin, float &elevMax) const +{ + azMin=_azMin; + azMax=_azMax; + elevMin=_elevMin; + elevMax=_elevMax; +} + void SphereSegment::setDensity(int density) { _density = density;