Hi Roni,

One way to have a uniqueID is to simply use the View* as the uniqueID
as its guaranteed to be unique.

Another way would be to have a std::map<osg::observer_ptr<View*>, int>.

Finally you could just add a UserData object to the View itself (all
object subclassed from osg::Object have a UserData field), this
UserData would be your own class for representing your uniqueID and
any extra data.

Robert.

On Jan 15, 2008 10:45 AM, Roni Rosenzweig <[EMAIL PROTECTED]> wrote:
> Hi Robert.
> Even if getView() is overriden by me, I'm still using the _views data
> structure, I just need to control the number of views added to the viewer
> and their removal.
> My internal data structures do not influence _views, just adding more data.
> The actual reasons is that I want each view to have its unique number/id,
> without it being changed when removing other views.
> For example, if I add 2 views, the second one is on index 1. If I remove the
> first view, the index changes to 0 (because the _views vector changes) but I
> want it to remain 1.
> I'm managing the views numbers by myself, using a mapping array for a
> "virtual" view number the "actual" view number (its actual position in
> _views).
> Is there another way to do this?
> Roni
>
>
>
>
> On 1/15/08, Robert Osfield <[EMAIL PROTECTED]> wrote:
> > Hi Roni,
> >
> > Making addView() and removedViewe() seems like a reasonable request,
> > but I'm not sure getView should be made anything other than inline.
> > The reason for the later is that there is already the data
> > osgViewer::CompositeViewer::_view data structure that is used
> > internally by CompsotiteViewer, if you create your own version of
> > getView() then you are also declaring that fact that there are now
> > multiple data structures do the same thing, with a real potential for
> > things getting out of sync w.r.t your sublcass and the internals of
> > CompsiteViewer.
> >
> > Could you please explain your motivation for subclassing and
> > overriding all these methods?
> >
> > Robert.
> >
> > On Jan 15, 2008 6:21 AM, Roni Rosenzweig <[EMAIL PROTECTED]> wrote:
> > > Hello
> > >
> > > I'm not sure if I posted in the right forum, but here goes:
> > > I have a class that inherits from osgViewer::CompositeViewer, and I need
> to
> > > override the following 4 functions:
> > >
> > >         void addView(osgViewer::View* view);
> > >         void removeView(osgViewer::View* view);
> > >
> > >         osgViewer::View* getView(unsigned i) { return _views[i].get(); }
> > >         const osgViewer::View* getView(unsigned i) const { return
> > > _views[i].get(); }
> > >
> > >
> > > Is it possible to change those functions to virtual in the next dev
> release?
> > > (I could change them locally in my computer, but then I would have to
> change
> > > it again with every release)
> > >
> > > Thanks, Roni
> > > _______________________________________________
> > > osg-users mailing list
> > > [email protected]
> > >
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> > >
> > >
> > _______________________________________________
> > osg-users mailing list
> > [email protected]
> > http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
> >
>
>
> _______________________________________________
> osg-users mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org
>
>
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

Reply via email to