#include <algorithm>#include <cstdio>#include "celestia.h"#include <sstream>#include <celutil/util.h>#include <celutil/debug.h>#include <celmath/mathlib.h>#include <celengine/astro.h>#include "cmdparser.h"#include "glcontext.h"Include dependency graph for cmdparser.cpp:

Go to the source code of this file.
Functions | |
| static astro::CoordinateSystem | parseCoordinateSystem (const string &name) |
| static int | parseLabelFlags (string) |
| static int | parseOrbitFlags (string) |
| static int | parseRenderFlags (string) |
|
|
Definition at line 117 of file cmdparser.cpp. References compareIgnoringCase(). Referenced by CommandParser::parseCommand(). 00118 {
00119 if (compareIgnoringCase(name, "observer") == 0)
00120 return astro::ObserverLocal;
00121 else if (compareIgnoringCase(name, "geographic") == 0)
00122 return astro::Geographic;
00123 else if (compareIgnoringCase(name, "equatorial") == 0)
00124 return astro::Equatorial;
00125 else if (compareIgnoringCase(name, "ecliptical") == 0)
00126 return astro::Ecliptical;
00127 else if (compareIgnoringCase(name, "universal") == 0)
00128 return astro::Universal;
00129 else if (compareIgnoringCase(name, "lock") == 0)
00130 return astro::PhaseLock;
00131 else if (compareIgnoringCase(name, "chase") == 0)
00132 return astro::Chase;
00133 else
00134 return astro::ObserverLocal;
00135 }
|
|
|
Definition at line 713 of file cmdparser.cpp. References compareIgnoringCase(), DPRINTF, Tokenizer::getNameValue(), and Tokenizer::nextToken(). Referenced by CommandParser::parseCommand(). 00714 {
00715 #ifdef HAVE_SSTREAM
00716 istringstream in(s);
00717 #else
00718 istrstream in(s.c_str());
00719 #endif
00720 Tokenizer tokenizer(&in);
00721 int flags = 0;
00722
00723 Tokenizer::TokenType ttype = tokenizer.nextToken();
00724 while (ttype != Tokenizer::TokenEnd)
00725 {
00726 if (ttype == Tokenizer::TokenName)
00727 {
00728 string name = tokenizer.getNameValue();
00729 if (compareIgnoringCase(name, "planets") == 0)
00730 flags |= Renderer::PlanetLabels;
00731 else if (compareIgnoringCase(name, "moons") == 0)
00732 flags |= Renderer::MoonLabels;
00733 else if (compareIgnoringCase(name, "spacecraft") == 0)
00734 flags |= Renderer::SpacecraftLabels;
00735 else if (compareIgnoringCase(name, "asteroids") == 0)
00736 flags |= Renderer::AsteroidLabels;
00737 else if (compareIgnoringCase(name, "comets") == 0)
00738 flags |= Renderer::CometLabels;
00739 else if (compareIgnoringCase(name, "constellations") == 0)
00740 flags |= Renderer::ConstellationLabels;
00741 else if (compareIgnoringCase(name, "stars") == 0)
00742 flags |= Renderer::StarLabels;
00743 else if (compareIgnoringCase(name, "galaxies") == 0)
00744 flags |= Renderer::GalaxyLabels;
00745
00746 ttype = tokenizer.nextToken();
00747 if (ttype == Tokenizer::TokenBar)
00748 ttype = tokenizer.nextToken();
00749 }
00750 else
00751 {
00752 DPRINTF(0, "Command Parser: error parsing label flags\n");
00753 return 0;
00754 }
00755 }
00756
00757 return flags;
00758 }
|
|
|
Definition at line 761 of file cmdparser.cpp. References compareIgnoringCase(), DPRINTF, Tokenizer::getNameValue(), and Tokenizer::nextToken(). Referenced by CommandParser::parseCommand(). 00762 {
00763 #ifdef HAVE_SSTREAM
00764 istringstream in(s);
00765 #else
00766 istrstream in(s.c_str());
00767 #endif
00768 Tokenizer tokenizer(&in);
00769 int flags = 0;
00770
00771 Tokenizer::TokenType ttype = tokenizer.nextToken();
00772 while (ttype != Tokenizer::TokenEnd)
00773 {
00774 if (ttype == Tokenizer::TokenName)
00775 {
00776 string name = tokenizer.getNameValue();
00777 if (compareIgnoringCase(name, "planet") == 0)
00778 flags |= Body::Planet;
00779 else if (compareIgnoringCase(name, "moon") == 0)
00780 flags |= Body::Moon;
00781 else if (compareIgnoringCase(name, "asteroid") == 0)
00782 flags |= Body::Asteroid;
00783 else if (compareIgnoringCase(name, "comet") == 0)
00784 flags |= Body::Comet;
00785 else if (compareIgnoringCase(name, "spacecraft") == 0)
00786 flags |= Body::Spacecraft;
00787
00788 ttype = tokenizer.nextToken();
00789 if (ttype == Tokenizer::TokenBar)
00790 ttype = tokenizer.nextToken();
00791 }
00792 else
00793 {
00794 DPRINTF(0, "Command Parser: error parsing orbit flags\n");
00795 return 0;
00796 }
00797 }
00798
00799 return flags;
00800 }
|
|
|
Definition at line 647 of file cmdparser.cpp. References compareIgnoringCase(), DPRINTF, Tokenizer::getNameValue(), and Tokenizer::nextToken(). Referenced by CommandParser::parseCommand(). 00648 {
00649 #ifdef HAVE_SSTREAM
00650 istringstream in(s);
00651 #else
00652 istrstream in(s.c_str());
00653 #endif
00654 Tokenizer tokenizer(&in);
00655 int flags = 0;
00656
00657 Tokenizer::TokenType ttype = tokenizer.nextToken();
00658 while (ttype != Tokenizer::TokenEnd)
00659 {
00660 if (ttype == Tokenizer::TokenName)
00661 {
00662 string name = tokenizer.getNameValue();
00663 if (compareIgnoringCase(name, "orbits") == 0)
00664 flags |= Renderer::ShowOrbits;
00665 else if (compareIgnoringCase(name, "cloudmaps") == 0)
00666 flags |= Renderer::ShowCloudMaps;
00667 else if (compareIgnoringCase(name, "constellations") == 0)
00668 flags |= Renderer::ShowDiagrams;
00669 else if (compareIgnoringCase(name, "galaxies") == 0)
00670 flags |= Renderer::ShowGalaxies;
00671 else if (compareIgnoringCase(name, "nebulae") == 0)
00672 flags |= Renderer::ShowNebulae;
00673 else if (compareIgnoringCase(name, "planets") == 0)
00674 flags |= Renderer::ShowPlanets;
00675 else if (compareIgnoringCase(name, "stars") == 0)
00676 flags |= Renderer::ShowStars;
00677 else if (compareIgnoringCase(name, "nightmaps") == 0)
00678 flags |= Renderer::ShowNightMaps;
00679 else if (compareIgnoringCase(name, "eclipseshadows") == 0)
00680 flags |= Renderer::ShowEclipseShadows;
00681 else if (compareIgnoringCase(name, "ringshadows") == 0)
00682 flags |= Renderer::ShowRingShadows;
00683 else if (compareIgnoringCase(name, "comettails") == 0)
00684 flags |= Renderer::ShowCometTails;
00685 else if (compareIgnoringCase(name, "boundaries") == 0)
00686 flags |= Renderer::ShowBoundaries;
00687 else if (compareIgnoringCase(name, "markers") == 0)
00688 flags |= Renderer::ShowMarkers;
00689 else if (compareIgnoringCase(name, "automag") == 0)
00690 flags |= Renderer::ShowAutoMag;
00691 else if (compareIgnoringCase(name, "atmospheres") == 0)
00692 flags |= Renderer::ShowAtmospheres;
00693 else if (compareIgnoringCase(name, "grid") == 0)
00694 flags |= Renderer::ShowCelestialSphere;
00695 else if (compareIgnoringCase(name, "partialtrajectories") == 0)
00696 flags |= Renderer::ShowPartialTrajectories;
00697
00698 ttype = tokenizer.nextToken();
00699 if (ttype == Tokenizer::TokenBar)
00700 ttype = tokenizer.nextToken();
00701 }
00702 else
00703 {
00704 DPRINTF(0, "Command Parser: error parsing render flags\n");
00705 return 0;
00706 }
00707 }
00708
00709 return flags;
00710 }
|
1.4.1