Re: [osg-users] osgSim::ScalarBar: supporting the osgText::String title;
Hi Xiadon, And so to a *third* request... Please could you send the files you have modified as a separate attachment, inlined submission cannot be handled as the mail tools breaks the formatting. Robert. On Mon, May 26, 2008 at 9:21 PM, Robert Osfield <[EMAIL PROTECTED]> wrote: > HI Xiadong, > > This is a second request for the files your have modified, could you > please resend them as separate attachements rather than inlined. > Zipping them can get rounds bugs in mail tools over zealous inlining. > > Thanks, > Robert. > > On Wed, Apr 16, 2008 at 10:08 AM, Robert Osfield > <[EMAIL PROTECTED]> wrote: >> HI Xiadong, >> >> I'm not sure what you intend from this email. Is it a code >> submission? If so could you please post it to osg-submissions and >> make sure the files are not inlined in the email itself. zipping the >> files is an easy workaround to mailer bugs that inline text files. >> >> Robert. >> >> On Wed, Apr 16, 2008 at 7:19 AM, Wu Xiaodong <[EMAIL PROTECTED]> wrote: >>> Hi. >>> >>> I try to update the class osgSim::ScalarBar to support for the >>> osgText::String title. >>> >>> it may be very simple. but I hope i can do something to OSG. >>> >>> Thanks. >>> >>> xiaodong >>> >>> >>> >>> >>> >>> >>> // header == >>> /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield >>> * >>> * This library is open source and may be redistributed and/or modified >>> under >>> * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or >>> * (at your option) any later version. The full license is in LICENSE file >>> * included with this distribution, and on the openscenegraph.org website. >>> * >>> * This library is distributed in the hope that it will be useful, >>> * but WITHOUT ANY WARRANTY; without even the implied warranty of >>> * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the >>> * OpenSceneGraph Public License for more details. >>> */ >>> >>> #ifndef OSGSIM_SCALARBAR >>> #define OSGSIM_SCALARBAR 1 >>> >>> #include >>> #include // The default ScalarsToColors is a >>> ColorRange >>> #include >>> #include >>> //adding by the Xiaodong Wu [EMAIL PROTECTED] >>> //to support for the osgText::String title; >>> #include >>> >>> namespace osgSim >>> { >>> /** >>> A ScalarBar is an osg::Geode to render a colored bar representing a range >>> of scalars. The scalar/color ranges are specified by an instance of >>> ScalarsToColors. There are a number of configurable properties on the >>> ScalarBar, such as the orientation, the number of labels to be displayed >>> across the range, the number of distinct colors to use when rendering the >>> bar, text details etc. >>> >>> In summary, the main configurables on the ScalarBar are: >>> >>> -# The range of scalars represented by the bar, and the colors >>> corresponding to this range - these are specified by the >>> ScalarsToColors object. >>> -# The number of colors used when rendering the bar geometry - >>> this may be thought of as the bar 'density'. >>> -# The number of text labels to be used when displaying the bar. >>> >>> The other configurables should be self-explanatory. >>> */ >>> class OSGSIM_EXPORT ScalarBar: public osg::Geode >>> { >>> >>> public: >>> >>> /** ScalarBar orientation specification. */ >>> enum Orientation{ >>> HORIZONTAL, ///< a horizontally ascending scalar bar (x-axis) >>> VERTICAL///< a vertically ascending scalar bar (y-axis) >>> }; >>> >>> /** >>> Users may provide their own ScalarPrinter by deriving from this base >>> class and >>> overriding the printScalar() method. Users may map the scalar float >>> passed in >>> to any string they wish. >>> */ >>> struct OSGSIM_EXPORT ScalarPrinter: public osg::Referenced >>> { >>> virtual std::string printScalar(float scalar); >>> }; >>> >>> /** >>> TextProperties allows users to specify a number of properties for the >>> text used to display the labels & title on the ScalarBar. Specifiying a >>> character >>> size of 0 will cause the ScalarBar to estimate an appropriate size. Note >>> that >>> the attributes are public, and may be set directly. >>> */ >>> struct TextProperties >>> { >>> std::string _fontFile; >>> std::pair _fontResolution; >>> float _characterSize; >>> osg::Vec4 _color; >>> >>> TextProperties(): >>> _fontFile("fonts/arial.ttf"), >>> _fontResolution(40,40), >>> _characterSize(0.0f), >>> _color(1.0f,1.0f,1.0f,1.0f) >>> { >>> } >>> }; >>> >>> /** Default constructor. */ >>> ScalarBar(): osg::Geode(), >>> _numColors(256), >>> _numLabels(11), >>> _stc(new ColorRange(0.0f,1.0f)), >>> _title("Scalar Bar"), >>> _position(0.0f,0.0f,0.0f), >>> _wi
Re: [osg-users] osgSim::ScalarBar: supporting the osgText::String title;
HI Xiadong, I'm not sure what you intend from this email. Is it a code submission? If so could you please post it to osg-submissions and make sure the files are not inlined in the email itself. zipping the files is an easy workaround to mailer bugs that inline text files. Robert. On Wed, Apr 16, 2008 at 7:19 AM, Wu Xiaodong <[EMAIL PROTECTED]> wrote: > Hi. > > I try to update the class osgSim::ScalarBar to support for the > osgText::String title. > > it may be very simple. but I hope i can do something to OSG. > > Thanks. > > xiaodong > > > > > > > // header == > /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield > * > * This library is open source and may be redistributed and/or modified > under > * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or > * (at your option) any later version. The full license is in LICENSE file > * included with this distribution, and on the openscenegraph.org website. > * > * This library is distributed in the hope that it will be useful, > * but WITHOUT ANY WARRANTY; without even the implied warranty of > * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the > * OpenSceneGraph Public License for more details. > */ > > #ifndef OSGSIM_SCALARBAR > #define OSGSIM_SCALARBAR 1 > > #include > #include // The default ScalarsToColors is a > ColorRange > #include > #include > //adding by the Xiaodong Wu [EMAIL PROTECTED] > //to support for the osgText::String title; > #include > > namespace osgSim > { > /** > A ScalarBar is an osg::Geode to render a colored bar representing a range > of scalars. The scalar/color ranges are specified by an instance of > ScalarsToColors. There are a number of configurable properties on the > ScalarBar, such as the orientation, the number of labels to be displayed > across the range, the number of distinct colors to use when rendering the > bar, text details etc. > > In summary, the main configurables on the ScalarBar are: > > -# The range of scalars represented by the bar, and the colors > corresponding to this range - these are specified by the > ScalarsToColors object. > -# The number of colors used when rendering the bar geometry - > this may be thought of as the bar 'density'. > -# The number of text labels to be used when displaying the bar. > > The other configurables should be self-explanatory. > */ > class OSGSIM_EXPORT ScalarBar: public osg::Geode > { > > public: > > /** ScalarBar orientation specification. */ > enum Orientation{ > HORIZONTAL, ///< a horizontally ascending scalar bar (x-axis) > VERTICAL///< a vertically ascending scalar bar (y-axis) > }; > > /** > Users may provide their own ScalarPrinter by deriving from this base > class and > overriding the printScalar() method. Users may map the scalar float > passed in > to any string they wish. > */ > struct OSGSIM_EXPORT ScalarPrinter: public osg::Referenced > { > virtual std::string printScalar(float scalar); > }; > > /** > TextProperties allows users to specify a number of properties for the > text used to display the labels & title on the ScalarBar. Specifiying a > character > size of 0 will cause the ScalarBar to estimate an appropriate size. Note > that > the attributes are public, and may be set directly. > */ > struct TextProperties > { > std::string _fontFile; > std::pair _fontResolution; > float _characterSize; > osg::Vec4 _color; > > TextProperties(): > _fontFile("fonts/arial.ttf"), > _fontResolution(40,40), > _characterSize(0.0f), > _color(1.0f,1.0f,1.0f,1.0f) > { > } > }; > > /** Default constructor. */ > ScalarBar(): osg::Geode(), > _numColors(256), > _numLabels(11), > _stc(new ColorRange(0.0f,1.0f)), > _title("Scalar Bar"), > _position(0.0f,0.0f,0.0f), > _width(1.0f), > _aspectRatio(0.03), > _orientation(HORIZONTAL), > _sp(new ScalarPrinter) > { > createDrawables(); > } > > /** > Construct a ScalarBar with the supplied parameters. > @param numColorsSpecify the number of colors in the scalar bar. > Color > interpolation occurs where necessary. > @param numLabelsSpecify the number of labels in the scalar bar. > @param stc The ScalarsToColors defining the range of scalars > and the colors they map to. > @param titleThe title to be used when displaying the ScalarBar. > Specify "" for no title. > @param orientation The orientation of the ScalarBar. @see Orientation. > @param aspectRatio The aspect ration (y/x) for the displayed bar. Bear > in mind you
[osg-users] osgSim::ScalarBar: supporting the osgText::String title;
Hi. I try to update the class osgSim::ScalarBar to support for the osgText::String title. it may be very simple. but I hope i can do something to OSG. Thanks. xiaodong // header == /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield * * This library is open source and may be redistributed and/or modified under * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or * (at your option) any later version. The full license is in LICENSE file * included with this distribution, and on the openscenegraph.org website. * * This library is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * OpenSceneGraph Public License for more details. */ #ifndef OSGSIM_SCALARBAR #define OSGSIM_SCALARBAR 1 #include #include // The default ScalarsToColors is a ColorRange #include #include *//adding by the Xiaodong Wu [EMAIL PROTECTED] //to support for the osgText::String title; #include * namespace osgSim { /** A ScalarBar is an osg::Geode to render a colored bar representing a range of scalars. The scalar/color ranges are specified by an instance of ScalarsToColors. There are a number of configurable properties on the ScalarBar, such as the orientation, the number of labels to be displayed across the range, the number of distinct colors to use when rendering the bar, text details etc. In summary, the main configurables on the ScalarBar are: -# The range of scalars represented by the bar, and the colors corresponding to this range - these are specified by the ScalarsToColors object. -# The number of colors used when rendering the bar geometry - this may be thought of as the bar 'density'. -# The number of text labels to be used when displaying the bar. The other configurables should be self-explanatory. */ class OSGSIM_EXPORT ScalarBar: public osg::Geode { public: /** ScalarBar orientation specification. */ enum Orientation{ HORIZONTAL, ///< a horizontally ascending scalar bar (x-axis) VERTICAL///< a vertically ascending scalar bar (y-axis) }; /** Users may provide their own ScalarPrinter by deriving from this base class and overriding the printScalar() method. Users may map the scalar float passed in to any string they wish. */ struct OSGSIM_EXPORT ScalarPrinter: public osg::Referenced { virtual std::string printScalar(float scalar); }; /** TextProperties allows users to specify a number of properties for the text used to display the labels & title on the ScalarBar. Specifiying a character size of 0 will cause the ScalarBar to estimate an appropriate size. Note that the attributes are public, and may be set directly. */ struct TextProperties { std::string _fontFile; std::pair _fontResolution; float _characterSize; osg::Vec4 _color; TextProperties(): _fontFile("fonts/arial.ttf"), _fontResolution(40,40), _characterSize(0.0f), _color(1.0f,1.0f,1.0f,1.0f) { } }; /** Default constructor. */ ScalarBar(): osg::Geode(), _numColors(256), _numLabels(11), _stc(new ColorRange(0.0f,1.0f)), _title("Scalar Bar"), _position(0.0f,0.0f,0.0f), _width(1.0f), _aspectRatio(0.03), _orientation(HORIZONTAL), _sp(new ScalarPrinter) { createDrawables(); } /** Construct a ScalarBar with the supplied parameters. @param numColorsSpecify the number of colors in the scalar bar. Color interpolation occurs where necessary. @param numLabelsSpecify the number of labels in the scalar bar. @param stc The ScalarsToColors defining the range of scalars and the colors they map to. @param titleThe title to be used when displaying the ScalarBar. Specify "" for no title. @param orientation The orientation of the ScalarBar. @see Orientation. @param aspectRatio The aspect ration (y/x) for the displayed bar. Bear in mind you may want to change this if you change the orientation. @param sp A ScalarPrinter object for the ScalarBar. For every displayed ScalarBar label, the scalar value will be passed to the ScalarPrinter object to turn it into a string. Users may override the default ScalarPrinter object to map scalars to whatever strings they wish. @see ScalarPrinter */ ScalarBar(int numColors, int numLabels, ScalarsToColors* stc, const osgText::String& title, Orientation orientati