Skip to content
Permalink
Browse files

added initial gui to the globe

  • Loading branch information
Marco Bernasocchi authored and pka committed Nov 23, 2010
1 parent b5997c0 commit eb30bf0b8973d6b513311169d54cbb512dd67ad1
@@ -76,5 +76,5 @@ INSTALL(TARGETS globeplugin
INSTALL (FILES images/world.tif globe.earth
DESTINATION ${QGIS_DATA_DIR}/globe)

INSTALL (DIRECTORY data
INSTALL (DIRECTORY data images/gui
DESTINATION ${QGIS_DATA_DIR}/globe)
@@ -108,7 +108,7 @@ struct MyClickHandler : public ControlEventHandler
{
void onClick( Control* control, int mouseButtonMask )
{
OE_NOTICE << "Thank you for clicking on " << typeid(control).name()
OE_NOTICE << "Thank you for clicking on " << typeid(control).name() << mouseButtonMask
<< std::endl;
}
};
@@ -262,30 +262,66 @@ void GlobePlugin::setupMap()

void GlobePlugin::setupControls()
{
// a centered hbox container along the bottom on the screen.
HBox* bottom = new HBox();
bottom->setFrame( new RoundedFrame() );
bottom->getFrame()->setBackColor(0,0,0,0.5);
bottom->setMargin( 10 );
bottom->setSpacing( 145 );
bottom->setVertAlign( Control::ALIGN_BOTTOM );
bottom->setHorizAlign( Control::ALIGN_CENTER );

for( int i=0; i<4; ++i )
{
LabelControl* label = new LabelControl();
std::stringstream buf;
buf << "Label_" << i;
label->setText( buf.str() );
label->setMargin( 10 );
label->setBackColor( 1,1,1,0.4 );
bottom->addControl( label );

label->setActiveColor(1,.3,.3,1);
label->addEventHandler( new MyClickHandler );
}

mControlCanvas->addControl( bottom );

std::string imgDir = QDir::cleanPath( QgsApplication::pkgDataPath() + "/globe/gui" ).toStdString();

//MOVE CONTROLS
//Horizontal container
HBox* moveHControls = new HBox();
moveHControls->setFrame( new RoundedFrame() );
//moveHControls->getFrame()->setBackColor(0.5,0.5,0.5,0.1);
//moveHControls->setMargin( 10 );
moveHControls->setSpacing( 15 );
moveHControls->setVertAlign( Control::ALIGN_CENTER );
moveHControls->setHorizAlign( Control::ALIGN_CENTER );
moveHControls->setPosition( 20, 40);

//Move Left
osg::Image* moveLeftImg = osgDB::readImageFile( imgDir + "/move-left.png");
ImageControl* moveLeft = new ImageControl(moveLeftImg);
//moveLeft->setPosition( 0, 5 );
moveLeft->addEventHandler( new MyClickHandler );

//Move Right
osg::Image* moveRightImg = osgDB::readImageFile( imgDir + "/move-right.png");
ImageControl* moveRight = new ImageControl(moveRightImg);
//moveRight->setPosition( 10, 5 );
moveRight->addEventHandler( new MyClickHandler );


//Vertical container
VBox* moveVControls = new VBox();
moveVControls->setFrame( new RoundedFrame() );
//moveControls->getFrame()->setBackColor(0.5,0.5,0.5,0.1);
//moveControls->setMargin( 10 );
moveVControls->setSpacing( 15 );
moveVControls->setVertAlign( Control::ALIGN_CENTER );
moveVControls->setHorizAlign( Control::ALIGN_CENTER );
moveVControls->setPosition( 40, 20);

//Move Up
osg::Image* moveUpImg = osgDB::readImageFile( imgDir + "/move-up.png");
ImageControl* moveUp = new ImageControl(moveUpImg);
//moveUp->setPosition( 5, 10 );
moveUp->addEventHandler( new MyClickHandler );

//Move Down
osg::Image* moveDownImg = osgDB::readImageFile( imgDir + "/move-down.png");
ImageControl* moveDown = new ImageControl(moveDownImg);
//moveDown->setPosition( 5, 0 );
moveDown->addEventHandler( new MyClickHandler );
//END MOVE CONTROLS

//add controls to moveControls group
moveHControls->addControl( moveLeft );
moveHControls->addControl( moveRight );
moveVControls->addControl( moveUp );
moveVControls->addControl( moveDown );

//add controls groups to canavas
mControlCanvas->addControl( moveHControls );
mControlCanvas->addControl( moveVControls );

}

void GlobePlugin::setupProxy()
@@ -34,7 +34,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>1</number>
<number>0</number>
</property>
<widget class="QWidget" name="elevation">
<attribute name="title">
@@ -91,7 +91,7 @@
</rect>
</property>
<property name="title">
<string>Elevation Layer</string>
<string>Elevation Layer (NOT implemented yet)</string>
</property>
<layout class="QGridLayout" name="gridLayout_2">
<item row="0" column="0">
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 comments on commit eb30bf0

Please sign in to comment.
You can’t perform that action at this time.