Skip to content

Commit eb30bf0

Browse files
Marco Bernasocchipka
authored andcommittedJul 5, 2011
added initial gui to the globe
1 parent b5997c0 commit eb30bf0

File tree

11 files changed

+64
-28
lines changed

11 files changed

+64
-28
lines changed
 

‎src/plugins/globe/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,5 +76,5 @@ INSTALL(TARGETS globeplugin
7676
INSTALL (FILES images/world.tif globe.earth
7777
DESTINATION ${QGIS_DATA_DIR}/globe)
7878

79-
INSTALL (DIRECTORY data
79+
INSTALL (DIRECTORY data images/gui
8080
DESTINATION ${QGIS_DATA_DIR}/globe)

‎src/plugins/globe/globe_plugin.cpp

Lines changed: 61 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct MyClickHandler : public ControlEventHandler
108108
{
109109
void onClick( Control* control, int mouseButtonMask )
110110
{
111-
OE_NOTICE << "Thank you for clicking on " << typeid(control).name()
111+
OE_NOTICE << "Thank you for clicking on " << typeid(control).name() << mouseButtonMask
112112
<< std::endl;
113113
}
114114
};
@@ -262,30 +262,66 @@ void GlobePlugin::setupMap()
262262

263263
void GlobePlugin::setupControls()
264264
{
265-
// a centered hbox container along the bottom on the screen.
266-
HBox* bottom = new HBox();
267-
bottom->setFrame( new RoundedFrame() );
268-
bottom->getFrame()->setBackColor(0,0,0,0.5);
269-
bottom->setMargin( 10 );
270-
bottom->setSpacing( 145 );
271-
bottom->setVertAlign( Control::ALIGN_BOTTOM );
272-
bottom->setHorizAlign( Control::ALIGN_CENTER );
273-
274-
for( int i=0; i<4; ++i )
275-
{
276-
LabelControl* label = new LabelControl();
277-
std::stringstream buf;
278-
buf << "Label_" << i;
279-
label->setText( buf.str() );
280-
label->setMargin( 10 );
281-
label->setBackColor( 1,1,1,0.4 );
282-
bottom->addControl( label );
283-
284-
label->setActiveColor(1,.3,.3,1);
285-
label->addEventHandler( new MyClickHandler );
286-
}
287-
288-
mControlCanvas->addControl( bottom );
265+
266+
std::string imgDir = QDir::cleanPath( QgsApplication::pkgDataPath() + "/globe/gui" ).toStdString();
267+
268+
//MOVE CONTROLS
269+
//Horizontal container
270+
HBox* moveHControls = new HBox();
271+
moveHControls->setFrame( new RoundedFrame() );
272+
//moveHControls->getFrame()->setBackColor(0.5,0.5,0.5,0.1);
273+
//moveHControls->setMargin( 10 );
274+
moveHControls->setSpacing( 15 );
275+
moveHControls->setVertAlign( Control::ALIGN_CENTER );
276+
moveHControls->setHorizAlign( Control::ALIGN_CENTER );
277+
moveHControls->setPosition( 20, 40);
278+
279+
//Move Left
280+
osg::Image* moveLeftImg = osgDB::readImageFile( imgDir + "/move-left.png");
281+
ImageControl* moveLeft = new ImageControl(moveLeftImg);
282+
//moveLeft->setPosition( 0, 5 );
283+
moveLeft->addEventHandler( new MyClickHandler );
284+
285+
//Move Right
286+
osg::Image* moveRightImg = osgDB::readImageFile( imgDir + "/move-right.png");
287+
ImageControl* moveRight = new ImageControl(moveRightImg);
288+
//moveRight->setPosition( 10, 5 );
289+
moveRight->addEventHandler( new MyClickHandler );
290+
291+
292+
//Vertical container
293+
VBox* moveVControls = new VBox();
294+
moveVControls->setFrame( new RoundedFrame() );
295+
//moveControls->getFrame()->setBackColor(0.5,0.5,0.5,0.1);
296+
//moveControls->setMargin( 10 );
297+
moveVControls->setSpacing( 15 );
298+
moveVControls->setVertAlign( Control::ALIGN_CENTER );
299+
moveVControls->setHorizAlign( Control::ALIGN_CENTER );
300+
moveVControls->setPosition( 40, 20);
301+
302+
//Move Up
303+
osg::Image* moveUpImg = osgDB::readImageFile( imgDir + "/move-up.png");
304+
ImageControl* moveUp = new ImageControl(moveUpImg);
305+
//moveUp->setPosition( 5, 10 );
306+
moveUp->addEventHandler( new MyClickHandler );
307+
308+
//Move Down
309+
osg::Image* moveDownImg = osgDB::readImageFile( imgDir + "/move-down.png");
310+
ImageControl* moveDown = new ImageControl(moveDownImg);
311+
//moveDown->setPosition( 5, 0 );
312+
moveDown->addEventHandler( new MyClickHandler );
313+
//END MOVE CONTROLS
314+
315+
//add controls to moveControls group
316+
moveHControls->addControl( moveLeft );
317+
moveHControls->addControl( moveRight );
318+
moveVControls->addControl( moveUp );
319+
moveVControls->addControl( moveDown );
320+
321+
//add controls groups to canavas
322+
mControlCanvas->addControl( moveHControls );
323+
mControlCanvas->addControl( moveVControls );
324+
289325
}
290326

291327
void GlobePlugin::setupProxy()

‎src/plugins/globe/globe_plugin_dialog_guibase.ui

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
<item>
3535
<widget class="QTabWidget" name="tabWidget">
3636
<property name="currentIndex">
37-
<number>1</number>
37+
<number>0</number>
3838
</property>
3939
<widget class="QWidget" name="elevation">
4040
<attribute name="title">
@@ -91,7 +91,7 @@
9191
</rect>
9292
</property>
9393
<property name="title">
94-
<string>Elevation Layer</string>
94+
<string>Elevation Layer (NOT implemented yet)</string>
9595
</property>
9696
<layout class="QGridLayout" name="gridLayout_2">
9797
<item row="0" column="0">
826 Bytes

Error rendering embedded code

Invalid image source.

836 Bytes

Error rendering embedded code

Invalid image source.

846 Bytes

Error rendering embedded code

Invalid image source.

824 Bytes

Error rendering embedded code

Invalid image source.

1.07 KB

Error rendering embedded code

Invalid image source.

1.04 KB

Error rendering embedded code

Invalid image source.

879 Bytes

Error rendering embedded code

Invalid image source.

560 Bytes

Error rendering embedded code

Invalid image source.

0 commit comments

Comments
 (0)
Please sign in to comment.