Wednesday, August 14, 2013
Very Sleepy
I've used a handful of different performance analysis tools in my time as a coder, but I've never liked one as much as Very Sleepy. The first time that I decided to try it, I had the tool downloaded, installed and working with useful results all within about five minutes. It's simple, it works well, and it tells you most everything you need to know. Windows only. Try it.
Monday, July 22, 2013
Google Maps for Android: From Good to Worse
I recently read In The Plex by Steven Levy. In his book Levy describes a company with vision, long-term vitality, and technical savvy. Hearing about the vision and standards of Google inspired me to be a better researcher in my work at Georgia Tech, and, as proud as I am to be a part of FalconView, I'll even go so far as to admit that I've been tempted (and only tempted) to send Google a resume just to see what happens.
I say all of that to preface my negative comments with the point that I hold nothing against Google. Here in the South if you want to say something negative about someone and still be polite, you have to start off by saying, "bless his heart." Well, bless their hearts, Google has goofed up Maps for Android in some pretty serious ways.
Goodbye, Easy Navigation
Before the latest update if I needed to navigate any place, I would open the navigation application, I'd press, "Speak Destination," I'd speak, and then I'd be off all within about twenty seconds. To find a nearby BBQ place I only had to press a couple of buttons, say, "BBQ" and I was practically there. I loved it.
Maybe I've missed it, but the easy button is now gone. I have to open the navigation application and press about seven buttons before I can speak my destination. If I turn off the screen on the way to conserve battery life, I have to push a few more buttons to return to the navigation screen. The application crashed on me three times yesterday on the way across town. In short, the navigation feature of Google Maps for Android is no longer suited for use while in the car, which pretty much defeats the point.
Goodbye, Latitude
I used Google Reader daily only a few months ago, then Google pulled the plug on the entire application. (Thanks, Feedly, for the great alternative.) Now they are pulling the plug on Latitude. It's already completely removed from Google Maps for Android. My family and I used to keep up with one another using this feature, and I liked exploring my location history. No more. Reader, Latitude, and probably more to come are being sucked in by Google Plus. Here's the kicker. Very few people that I know use Google Plus. Google beats the world in organizing the world's information and making it useful -- they are absolutely awesome in this regard -- but this strategy of forcing all Google users to engage in Google Plus is ill advised. Let's face it (bad pun intended), Google doesn't have the masses in social media. Their strategy to get there is frustrating their biggest fans.
Trust me, I'm one of them.
I say all of that to preface my negative comments with the point that I hold nothing against Google. Here in the South if you want to say something negative about someone and still be polite, you have to start off by saying, "bless his heart." Well, bless their hearts, Google has goofed up Maps for Android in some pretty serious ways.
Goodbye, Easy Navigation
Before the latest update if I needed to navigate any place, I would open the navigation application, I'd press, "Speak Destination," I'd speak, and then I'd be off all within about twenty seconds. To find a nearby BBQ place I only had to press a couple of buttons, say, "BBQ" and I was practically there. I loved it.
Maybe I've missed it, but the easy button is now gone. I have to open the navigation application and press about seven buttons before I can speak my destination. If I turn off the screen on the way to conserve battery life, I have to push a few more buttons to return to the navigation screen. The application crashed on me three times yesterday on the way across town. In short, the navigation feature of Google Maps for Android is no longer suited for use while in the car, which pretty much defeats the point.
Goodbye, Latitude
I used Google Reader daily only a few months ago, then Google pulled the plug on the entire application. (Thanks, Feedly, for the great alternative.) Now they are pulling the plug on Latitude. It's already completely removed from Google Maps for Android. My family and I used to keep up with one another using this feature, and I liked exploring my location history. No more. Reader, Latitude, and probably more to come are being sucked in by Google Plus. Here's the kicker. Very few people that I know use Google Plus. Google beats the world in organizing the world's information and making it useful -- they are absolutely awesome in this regard -- but this strategy of forcing all Google users to engage in Google Plus is ill advised. Let's face it (bad pun intended), Google doesn't have the masses in social media. Their strategy to get there is frustrating their biggest fans.
Trust me, I'm one of them.
Thursday, June 13, 2013
Introducing the FalconView KML Drawing Library
Thanks, Georgia Tech, for funding me to develop a library for drawing KML. The screen captures that you've seen in the last couple of months have shown the library in progress on Windows (via FalconView) and on Linux (via Quantum GIS).
One of the most exciting parts of this project was implementing a KML drawer for Android. This involved making the drawer and its dependencies (including Libkml and Google Test) compile using the Android native development kit, and hooking the Java-coded GUI to the C++ portion via JNI.
More information about the KML Drawing Library, which is used as a part of FalconView, may be found on the FalconView web site. Like all of FalconView Open Source, the KML Drawing Library may be used in third party applications so long as the terms of the FalconView Open Source license are followed. Some instructions for using the library and a link to the source code are available at that link. I'd be glad to answer questions about using the library posted here or on the FalconView web site discussion boards.
One of the most exciting parts of this project was implementing a KML drawer for Android. This involved making the drawer and its dependencies (including Libkml and Google Test) compile using the Android native development kit, and hooking the Java-coded GUI to the C++ portion via JNI.
More information about the KML Drawing Library, which is used as a part of FalconView, may be found on the FalconView web site. Like all of FalconView Open Source, the KML Drawing Library may be used in third party applications so long as the terms of the FalconView Open Source license are followed. Some instructions for using the library and a link to the source code are available at that link. I'd be glad to answer questions about using the library posted here or on the FalconView web site discussion boards.
Thursday, May 9, 2013
FalconView is Going 3D
Starting with FalconView 5.2, users will have the option of viewing data in 3D. Our engine uses osgEarth to render FalconView maps on overlays on a 3D canvas, draped over elevation data.
We probably won't have a beta of this available until later in the year, but stay tuned the the official FalconView web site as we push out code and releases.
Friday, March 22, 2013
A Random KML Generator
For testing KML performance in FalconView, I've written a Random KML Generator. It only does points and squares at the moment, but I will be adding to it over time. Feel free to make good use of it. The source code is on the FalconView web site here (forgive the monolithic Python file).
Monday, January 28, 2013
Quantum GIS KML Overlay
I've put together a KML Overlay for Quantum GIS based on the KML Overlay that I'm working on now for FalconView. You can see a video demonstration of it here. The source code is here.
My purpose in posting this is to demonstrate a KML drawing library that I'm putting together that is intended to be a rendering companion to LibKML. More about this drawing library, which is currently under construction, will be posted here.
My purpose in posting this is to demonstrate a KML drawing library that I'm putting together that is intended to be a rendering companion to LibKML. More about this drawing library, which is currently under construction, will be posted here.
Friday, January 18, 2013
How to Create a QGIS Plugin in C++
FalconView has a rich plugin-architecture that I've been writing to for many years. Though I'm very comfortable writing FalconView plugins, I'm in the process now of writing a plugin that needs to work in FalconView and in Quantum GIS. This post is about my learning experience in writing a plugin for Quantum GIS. I find that the documentation on QGIS plugins is sparse, so perhaps what I've learned will help others who want to do something similar.
The full source code for this plugin may be found here. This is a minimalistic plugin that simply draws a rectangle on the screen using screen coordinates. It demonstrates how to register a plugin with Quantum, how to add an action to a QGIS menu, how to register to receive a callback, and how to draw on the map canvas. I call it the Hello World plugin.
(Before I started this process, I had no experience coding to QGIS or to Qt. I'm sure that some of what I've done here does not reflect best practices with either technology, so I invite members of either community to comment here in order to help me and others to understand best practices. I will note that my plugin does not conform to the Quantum GIS coding standards. Instead, I've conformed to the FalconView coding standards since this project is part of a larger effort related to FalconView.)
[[ EDIT: Most QGIS plugins are done in Python, and there is much better documentation for these plugins. ]]
The Header File
The complete header file may be found here. There are two things of interest in the header file. First, notice that the HelloWorldPlugin is a QObject. This comes by deriving from QObject and by including the QOBJECT macro in the class.
class HelloWorldPlugin : public QObject, public QgisPlugin
{
Q_OBJECT
...
The full source code for this plugin may be found here. This is a minimalistic plugin that simply draws a rectangle on the screen using screen coordinates. It demonstrates how to register a plugin with Quantum, how to add an action to a QGIS menu, how to register to receive a callback, and how to draw on the map canvas. I call it the Hello World plugin.
(Before I started this process, I had no experience coding to QGIS or to Qt. I'm sure that some of what I've done here does not reflect best practices with either technology, so I invite members of either community to comment here in order to help me and others to understand best practices. I will note that my plugin does not conform to the Quantum GIS coding standards. Instead, I've conformed to the FalconView coding standards since this project is part of a larger effort related to FalconView.)
[[ EDIT: Most QGIS plugins are done in Python, and there is much better documentation for these plugins. ]]
The Header File
The complete header file may be found here. There are two things of interest in the header file. First, notice that the HelloWorldPlugin is a QObject. This comes by deriving from QObject and by including the QOBJECT macro in the class.
class HelloWorldPlugin : public QObject, public QgisPlugin
{
Q_OBJECT
...
The next point of interest is the declaration of the Qt slots. These are callback methods.
public slots:
void StartOverlay();
void DrawOverlay(QPainter* painter);
Functions Exported from the Library
There are a handful of functions exported from the library that are required for QGIS to load plugin. These are all in the cpp file, and are all declared with the QGISEXTERN macro.
Adding a Menu Item to a QGIS Menu
We do this in the initGui method. The important thing to note is how we register for a callback using connect(...) and how we call into the QGIS interface to add the action to the Plugin menu.
/*virtual*/ void HelloWorldPlugin::initGui()
{
std::cout << "HelloWorldPlugin::initGui" << std::endl;
// add an action to the menu
m_action = new QAction(QIcon("" ), tr("Hello World"), this);
m_action->setWhatsThis(tr("Draw on the map canvas."));
connect(m_action, SIGNAL(triggered()), this, SLOT(StartOverlay()));
m_qgis_if->addRasterToolBarIcon(m_action);
m_qgis_if->addPluginToMenu(tr("&Hello World"), m_action);
}
Handling the Menu Item Selection Event
StartOverlay() handles this event. It gets the map canvas and connects to the render complete signal. I have some code in this sample that demonstrates how to zoom out the map. This is not necessary for drawing the rectangle, but I've left it in for pedagogical reasons.
void HelloWorldPlugin::StartOverlay()
{
std::cout << "HelloWorldPlugin::StartOverlay" << std::endl;
// get the map canvas
QgsMapCanvas* canvas = m_qgis_if->mapCanvas();
// connect to the render complete signal
connect(canvas, SIGNAL(renderComplete(QPainter*)),
this, SLOT(DrawOverlay(QPainter*)));
// zoom out for fun
canvas->zoomOut(); // wheeeeee!!!
}
Drawing the Rectangle
Now that we are registered to receive calls to DrawOverlay when the canvas refreshes, drawing the rectangle is easy.
void HelloWorldPlugin::DrawOverlay(QPainter* painter)
{
std::cout << "HelloWorldPlugin::DrawOverlay" << std::endl;
painter->drawRect(20, 20, 60, 60);
}
Building the Project
The Qt project file is here. First, run qmake qgis_hello_world.pro to make the Makefile. Next, run make to build the library. Notice that Qt will generate some code files that you will find in the project folder.
Trying it Out
Copy the library to your QGIS plugins folder. The command that I use to do this on my Ubuntu system is sudo cp libqgis_hello_world.so.1.0.0 /usr/lib/qgis/plugins/libqgis_hello_world.so.
The Hello World plugin should now appear in the QGIS plugin manager menu. Turn it on. Next, select the menu item that we added to the Plugin menu. The rectangle should draw.
Finding More Help
Be sure to look at the QGIS header files (in /usr/include/qgis on my system) and API reference (http://www.qgis.org/). Also the samples under src/plugins are helpful.
Subscribe to:
Posts (Atom)