osgEarth 2.1.1
Public Member Functions | Public Attributes

StyleEditor Class Reference

List of all members.

Public Member Functions

 StyleEditor (const ::StyleList &styles)
void setPopupContext (PopUpSymbolizerContext *context)
virtual bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &)

Public Attributes

osg::ref_ptr
< PopUpSymbolizerContext
_popupContext
int _state
::StyleList _styles

Detailed Description

Definition at line 352 of file osgearth_symbology.cpp.


Constructor & Destructor Documentation

StyleEditor::StyleEditor ( const ::StyleList styles) [inline]

Definition at line 358 of file osgearth_symbology.cpp.

                                         : _styles(styles)
    {
        _state = 0;
    }

Member Function Documentation

virtual bool StyleEditor::handle ( const osgGA::GUIEventAdapter &  ea,
osgGA::GUIActionAdapter &   
) [inline, virtual]

Definition at line 365 of file osgearth_symbology.cpp.

    {
        switch(ea.getEventType())
        {
        case(osgGA::GUIEventAdapter::KEYUP):
        {
            if (ea.getKey() == 'i') {
                if (_popupContext.valid()) {
                    for (int i = 0; i < _popupContext->_widgetList.size(); ++i) {
                        if (_state) {
                            _popupContext->_widgetList[i]->setDisappear();
                        } else { 
                            _popupContext->_widgetList[i]->setAppear();
                        }
                    }
                    if (_state)
                        _state = 0;
                    else 
                        _state = 1;
                }
                return true;
            } else if (ea.getKey() == 'q') {
                osgEarth::Symbology::Style* style = _styles[0].get();
                PolygonSymbol* p = style->getSymbol<PolygonSymbol>();
                if (p)
                {
                    osg::Vec4 color = p->fill()->color();
                    color[0] = fmod(color[0]+0.5, 1.0);
                    color[2] = fmod(1 + color[0]-0.3, 1.0);
                    p->fill()->color() = color;
                    style->dirty();
                }
                return true;
            } else if (ea.getKey() == 'a') {
                Style* style = _styles[1].get();
                PolygonPointSizeSymbol* p = style->getSymbol<PolygonPointSizeSymbol>();
                if (p)
                {
                    osg::Vec4 color = p->fill()->color();
                    color[0] = fmod(color[0]+0.5, 1.0);
                    color[2] = fmod(1 + color[0]-0.3, 1.0);
                    p->fill()->color() = color;
                    p->size() = 0.1 + color[2] * 10;
                    style->dirty();
                }
                return true;
            } else if (ea.getKey() == 'z') {
                Style* style = _styles[2].get();
                ExtrudedLineSymbol* l = style->getSymbol<ExtrudedLineSymbol>();
                if (l)
                {
                    osg::Vec4 color = l->stroke()->color();
                    color[0] = fmod(color[0]+0.5, 1.0);
                    color[2] = fmod(1 + color[0]-0.3, 1.0);
                    l->stroke()->color() = color;
                    l->extrude()->height() = l->extrude()->height() + 200;
                }
                ExtrudedPolygonSymbol* p = style->getSymbol<ExtrudedPolygonSymbol>();
                if (p)
                {
                    osg::Vec4 color = p->fill()->color();
                    color[0] = fmod(color[0]+0.5, 1.0);
                    color[2] = fmod(1 + color[0]-0.3, 1.0);
                    p->fill()->color() = color;
                    p->extrude()->height() = p->extrude()->height() + 50;
                }
                style->dirty();
                return true;

            } else if (ea.getKey() == 'x') {
                Style* style = _styles[3].get();
                MarkerLineSymbol* l = style->getSymbol<MarkerLineSymbol>();
                if (l)
                {
                    if (l->interval().value() < 10)
                        l->interval() = 15;
                    else
                        l->interval() = 5;
                }

                MarkerPolygonSymbol* p = style->getSymbol<MarkerPolygonSymbol>();
                if (p)
                {
                    if (p->interval().value() < 10) {
                        p->interval() = 15;
                        p->randomRatio() = 0.1;
                    } else {
                        p->interval() = 5;
                        p->randomRatio() = 0.9;
                    }
                }
                style->dirty();
                return true;
            }
        }
        break;
        }
        return false;
    }

Here is the call graph for this function:

void StyleEditor::setPopupContext ( PopUpSymbolizerContext context) [inline]

Definition at line 363 of file osgearth_symbology.cpp.

{ _popupContext = context; }

Here is the caller graph for this function:


Member Data Documentation

Definition at line 355 of file osgearth_symbology.cpp.

Definition at line 356 of file osgearth_symbology.cpp.

Definition at line 465 of file osgearth_symbology.cpp.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines