Skip to content

Commit

Permalink
added initial gui to the globe
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Bernasocchi authored and pka committed Jul 5, 2011
1 parent b5997c0 commit eb30bf0
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 28 deletions.
2 changes: 1 addition & 1 deletion src/plugins/globe/CMakeLists.txt
Expand Up @@ -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)
86 changes: 61 additions & 25 deletions src/plugins/globe/globe_plugin.cpp
Expand Up @@ -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;
}
};
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/globe/globe_plugin_dialog_guibase.ui
Expand Up @@ -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">
Expand Down Expand Up @@ -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">
Expand Down
Binary file added src/plugins/globe/images/gui/move-down.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/plugins/globe/images/gui/move-left.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/plugins/globe/images/gui/move-right.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/plugins/globe/images/gui/move-up.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/plugins/globe/images/gui/rotate-ccw.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/plugins/globe/images/gui/rotate-cw.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/plugins/globe/images/gui/zoom-in.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added src/plugins/globe/images/gui/zoom-out.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit eb30bf0

Please sign in to comment.