Language/GUI library to make map editor - c++

I'm designing a cross-platform map editor for an application I've developed, and I'm unsure what approach to take regarding language/gui library choice. Just for some basic info, the editor needs to parse and output xml files.
I'm most comfortable with C++, Lua, and Perl, but I'd also be willing to use Python (could use the practice). I'd prefer doing it in a scripting language for productivity.
Any recommendations are appreciated, thanks.
I'd also like support for filling out forms, etc.
P.S. I've tested out extending existing map editors but it isn't really worth it since they don't provide the functionality I need on a fundamental level, requiring me to just re-write the whole thing anyway.

My preference is always Gtk2 and Perl 5, but that combination works best on Linux. What OS are you going to run under?
Here is an example Perl 5 script using Gtk2:
#!/usr/bin/perl
use strict;
use warnings;
use Gtk2;
Gtk2->init;
my $window = Gtk2::Window->new;
my $vbox = Gtk2::VBox->new;
my $label = Gtk2::Label->new("click the button");
my $button = Gtk2::Button->new("click me");
my $i;
$window->signal_connect(destroy => sub { Gtk2->main_quit });
$button->signal_connect(clicked => sub { $label->set_text(++$i) });
$window->add($vbox);
$vbox->add($label);
$vbox->add($button);
$window->show_all;
Gtk2->main;

I can recommend using Python and PyQt for the job. Qt offers a class for scene management (i.e. layered object placement, zooming, hit testing, events,coordinate transformations etc., even collision detection) called QGraphicsScene and a matching control to display it all, called QGraphicsView. It also offers support for drag&drop, thus enabling interactive object placement.
Implementing a map using these classes really is just creating QGraphicItems (Rectangles, Polygons etc.) and adding them to the scene, Qt does the rest. You can have a look at how it all fits together reading the documentation, especially the document "The Graphics View Framework". I had to implement something similar for a client recently and was very pleased with this approach.

Building on the base of Lua, I would recommend IUP for the GUI. It is lightweight, portable to linux and Windows, and well integrated with Lua. For those who like Gtk, IUP includes a driver for Gtk so it can in principle be ported to any system where Gtk can port.
Another plausible choice is wxWidgets, which also has a wrapper integrating it with Lua.
Both IUP and wxWidgets are included in the Lua for Windows bundle.

Related

Popup Text Input Box in C++ with OpenGL

I am trying to create a simple popup box that appears when my C++ program starts that will allow the user to enter the width, height, and length of a cube that will then be displayed in a separate window. I have been searching for a very long time, and I have yet to find a solution that will allow me to do this. Can this be done using C++, OpenGL, and GLUT? Or do I need another library to allow me to do this.
Thank you.
Jordan
Edit: I am programming a cross-platform program and cannot use Win32 to accomplish this, nor any other Window-specific function.
What are you are looking for is a graphical user interface.
There are many libraries available that interface with various input methods (for keyboard and mouse) and provide graphical output. Each one has it's own model.
There are various models, but the most common one is hierarchical.
If you are looking for a learning experience, I suggest you do some Googling on how to make your own GUI.
If you are simply looking for a convenient library that does the hard-yards for you, I strongly recommended AntTweakBar:
AntTweakBar is a small and easy-to-use C/C++ library that allows programmers to quickly add a light and intuitive graphical user interface into graphic applications based on OpenGL, DirectX 9, DirectX 10 or DirectX 11 to interactively tweak parameters on-screen....AntTweakBar works with GNU/Linux, Windows and OSX
It was designed not as a monolithic batteries-included do-all library (such as Qt, another alternative), but as a simple and lightweight tweaking interface (hence the name).
There are several examples available and it's API is quite simple, so it should be reasonably easy to pick up.
There's also GWEN. It is not a well known library, but I find it extremely versatile and easy to use.
Facts- Coded in C++- Fully Namespaced- All standard window controls- Behaves like you'd expect- Lightweight (No XML readers, no font loaders/renderers, no texture loaders - your engine should be doing all this stuff!)- Easy to integrate (comes with renderers for Windows GDI, Allegro, OpenGL, DirectX and SFML)- Totally portable & cross platform- Doesn't need RTTI- Released under a "do whatever you want" MIT license.
Opinionated note: I prefer GLFW over GLUT. It provides a nicer model, and is still in active development (unlike GLUT which has not been updated in a significantly long time). At least use freeGLUT
You need to use another external gui library to do it. If you're doing it for windows, MFC is a good option. Or check library OpenGL User Interface Library.It's cross platform.
Here some libraries
Maybe this link helps you
Your statement saying that you wish to have a popup box implies your wish to use the underlying windowing system, regardless of the OS.
If you want to be cross-platform, there are quite a few libraries you can use that either emulate or actually use the underlying windowing system, such as wxWidgets.
If using such a library is not an option, you can always use the OpenGL window to draw text and emulate your popup yourself, but that's a bit more work, imo.

QML/D text editor and basic considerations

I am going to code a text/code editor (GUI with QML and the rest in D*). But I have several problems:
I code the GUI with QML and C++ and then I connect it with a D-Backend for formatting etc. purposes. What is the best way to connect different Languages? Pipes, Sockets or in D the ability to use C++ Libraries?
IMHO rich text is used to format the text (in most cases). How is it possible to edit this "markup" in an easy way?? Is the formated code like a background image and the user edits an opaque non-formated-text?
Are there common techniques?
*Because QML is cool, platform indepedent and fast. On the other hand D is powerful and easy to use.
As you might know, there is QtD, Qt binding for D. It's not production ready right now, but it might be some day.
Another option would be connecting C++ and D, through C wrapper. This is the most commonly used way of interacting between C++ and D.
extern(C++) interfaces are specific to DigitalMars C++ compiler on Windows and are very limited, so that probably wouldn't help with your problem.
Also you might want to look at SWIG. It's a tool automatically generating glue code for interaction of other languages with C++. It supports D.
If performance is not an issue communications with D code could work through sockets or pipes.
QML isn't for WebApp. It s QtQuick Markup Language. The 'new' way to do UI at Qt. And QWidget will probably be deprecated in favor of QML in Qt5.
I've try to do the same thing. But i fear that qml isn't ready yet to do things like that. Most element available today are just good enought to draw image, rectangle, listview, one line text input and do transition.
I was trying to achieve that by coloring with python and pygments, too slow, using html3.2 style to do that isn't the right way. But it's the only way to style text in qml textedit. ;(
QtQuick 2.0 should bring better text control.

What is best GUI toolkit to rewrite .NET WPF application to C++?

We have existing WPF application with complicated graphics (rounded edges of the window, speedometer style indicators etc).
Since we rely on .NET our application needs .NET framework. Some users are unwilling to install .NET and we want to provide them with a version that does not need .NET and runs of Windows only (XP,Vista,W7).
Which graphical toolkit we should use to for this scenario?
So far I think Codejock Toolkit Pro is a good adept as we already have GUI in XAML and it could be easier to port GUI to C++.
However, another aspect is download size of the toolkit. We don't want to end up in the situation where toolkit size is so big (e.g. 20-40MB) that's comparable with .NET 4.0 framework size.
I know some of you might think that going back from WPF to C++ is a bad idea, but for our scenario it is absolutely crucial to make user's installation process as easy as possible and .NET framework is a big stumbling block which we are trying to remove.
Sorry I do not have the answer to your question (and I would never ever even dream that I might do such a thing), but I am compelled to tell you as an advice
implementing all the WPF functionality in C++ will take 10-20 times more
installation of a C++ would not be necessarily easier
if you need to make installation easier, use SilverLight
We used QT in one of our projects in past which is Object Oriented and Multi Platform, but QT is mostly like WinForms
As I remember QT keeps UI in xml files too, try to write XSLT from xaml to QT xml. But I don't thik you can do it in complex WPF structures like Triggers or Animation
Have you evaluated QT? Since this relies on XML for UI definition too, it might be easier to port the code to.
You've already gotten a couple of answers recommending Qt -- and I'd agree that's probably your first choice. Note, however, that while Qt does support an XML-based UI description, they seem to be moving away from it toward QML, which is based on JavaScript instead.
Another possibility would be wxWidgets, which also supports an XML-based description of the widgets using XRC.

Stock Charts in C++

I am trying to create some charts of data (eg http://www.amibroker.com/). Is there a C++ library that can do this without a lot of extra work? I'm thinking Qt or wxWindows would have something like it, but it wasn't immediately obvious.
Thanks!
FLTK is a light and portable C++ toolkit for GUI. There's a chart class. Sample.
Qwt does at least some of the things you are trying to achieve (basic plots, bar charts and so on), and integrates well with Qt.
I think you need to pick your GUI framework first, then find a charting control for the given framework, since that affects what charting controls you could feasibly use. For example, must this be portable?
For the project I'm working on (a large MFC application) we use Cedric Moonen's ChartCtrl. We've had a pretty good experience with it so far.
I've done some graph plotting with gnuplot lately, which is quite powerful. Although I think it is Linux only, which may or may not be a problem.
Also, believe it or not, some amazing things can be done with LaTeX. I've used the tkz (tikz) library to produce some awesome graphs.
Both solutions plot to a file which you can include in your interface.
They aren't C++ libraries but you can easily create the datafiles and call the necessary programs from within your C++ program (Being creative with system() and possible some shell scripts).

Need a client-side interactive 2D world map: best map package? Or best C++ graphics/canvas library to make one?

I need a 2d political map of the world on which I will draw icons, text, and lines that move around. Users will interact with the map, placing and moving the icons, and they will zoom in and out of the map.
The Google Maps interface isn't very far from what I need, but this is NOT web related; it's a Windows MFC application and I want to talk to a C++ API for a map that lives in the application, not a web interface. Ideally I don't want a separate server, either, and any server MUST run locally (not on the Internet). What canned map package or graphics library should I use to do this? I have no graphics programming experience.
This is strictly 2D, so I don't think something like Google Earth or WorldWind would be appropriate. Good vector graphics support would be cool, and easy drawing of bitmaps is important.
All the canned options seem web oriented. SDL is about all I know of for flexible canvas programming, but it seems like making my own map would be a lot of work for what is probably a common problem. Is there anything higher level? Maybe there's a way to interact with an adobe Flash object? I'm fairly clueless.
Perhaps:
http://www.codeplex.com/SharpMap
ESRI MapObjects
http://www.esri.com/software/mapobjects/index.html
ESRI MapObjects LT
http://www.esri.com/software/mapobjectslt/index.html
See
http://www.esri.com/software/mapobjectslt/about/mo_vs_lt.html
for a comparison of the two MapObjects feature sets.
ESRI may have a replacement to the MapObjects libraries
You could extend your search by using the term GIS (Geographic Information System). I'm sure its gonna be easier. There's a lot of stuff out there on that subject.
Here's a page I found: http://www.ucancode.net/Gis-Source-Code.htm
or: http://opensourcegis.org/
You might want to try the Mapnik C++/Python GIS Toolkit.
You can take a look at the Marble Widget, which is part of KDE's Marble project. There are Windows binaries for this, too, but they might be dependent on Qt.
Yes, Marble has also the advantage that it provides kind of a ready made solution in a single control (called "widget" in Qt's technical terms).
The dependency on Qt (which is the only dependency btw.) might also be seen as an advantage: Qt's upcoming version is licensed under the LGPL, so even if you plan to use this in a proprietary application then there shouldn't be any real worries. And of course Qt and Marble are cross-plattform and provide an API that is very intuitive and easy to understand. Unlike common GIS solutions the Marble API and the usage of the widget is rather focused on people who don't know much about GIS. So its usage is quite easy to understand even if you feel scared by technical terms used in GIS.
Marble offers several interfaces to programming:
You can either create your own Marble plugins and paint inside those or you can subclass the MarbleWidget control. For a simple HelloWorld application see:
http://techbase.kde.org/Projects/Marble/MarbleCPlusPlus