當前位置: 首頁>>代碼示例>>C++>>正文


C++ Interval::GetLeft方法代碼示例

本文整理匯總了C++中Interval::GetLeft方法的典型用法代碼示例。如果您正苦於以下問題:C++ Interval::GetLeft方法的具體用法?C++ Interval::GetLeft怎麽用?C++ Interval::GetLeft使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Interval的用法示例。


在下文中一共展示了Interval::GetLeft方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C++代碼示例。

示例1: main

int main()
{
	std::ofstream fout;
	fout.open("out.txt");

	try
	{
		App app;
		app.SetLoggingFile("error.log");

		app.LoadKernel("data/meta.tm");

		app.SetReferenceFrame(Frame::ECLIPJ2000); // Set reference frame to ECLIPJ200, default is J2000
		app.SetDefaultUnits(App::UT_DEFAULT); // Same as UT_METRIC, except Length is measured in km. This is set by default
		//app.SetDefaultUnits(App::UT_METRIC); // Default units are meters, meters per second and kilograms
		//app.SetDefaultUnits(App::UT_IMPERIAL); // Default units are miles, miles per hour and pounds

		//app.LoadSolarSystem(); // Loads Solar System. Optional parameter controls whether to load only planets and Sun or to load entire Solar System
		//app.LoadAllAvailableObjects(); // Loads all objects which were introduced in loaded kernels

		//app.LoadMoons(SpaceObject("Earth")); // Creates SpaceObjects instance and uses it to specify parent body
		//app.LoadMoons("Jupiter"); // Loads moons of Jupiter, internally the same as LoadMoons(SpaceObject("Jupiter"))
		//if(app.CheckObjectExists("Pluto"))
		//	app.LoadMoons(app.RetrieveObject("Pluto")); // Same as LoadMoons(SpaceObject("Pluto")), except this doesn't construct new SpaceObject instance, instead it uses reference to already loaded SpaceObject instance

		app.AddObject(SpaceBody("europa"));
		app.AddObject(SpaceBody("MOON"));
		app.AddObject(SpaceBody("Io"));

		std::vector<SpaceObject*> barycenters = app.GetLoadedBarycenters();
		std::vector<SpaceObject*> planets = app.GetLoadedPlanets();
		std::vector<SpaceObject*> moons = app.GetLoadedMoons();
		std::vector<SpaceObject*> jupiterMoons = app.GetLoadedMoonsOf(SpaceObject("Jupiter"));
		std::vector<SpaceObject*> marsMoons = app.GetLoadedMoonsOf(SpaceObject("mars"));

		app.LoadSolarSystem(true);

		std::vector<KernelData> kernels = CSpiceUtil::GetLoadedKernels();

		fout << "Loaded kernels:" << std::endl;
		for(size_t i = 0; i < kernels.size(); i++)
		{
			KernelData kData = kernels[i];
			fout << "\t" << kData.filename << " (" << kData.type << ")" << std::endl;
		}
		fout << std::endl;

		size_t objectsCount = app.GetObjectsLength();
		for(size_t i = 0; i < objectsCount; i++)
		{
			const SpaceObject& obj = app.GetObjectByIndex(i);

			fout << obj.GetName() << " summary:" << std::endl;

			try
			{
				const SpaceBody& body = dynamic_cast<const SpaceBody&>(obj);

				fout << "Bulk parameters:" << std::endl;

				if(body.HasParameter(SpaceBody::BP_MASS))
					fout << "\tMass: " << body.GetMass().ValueIn(app.MassUnit()) << " " << app.MassUnit().str() << std::endl;
				if(body.HasParameter(SpaceBody::BP_GM))
					fout << "\tGM: " << body.GetGM().ValueIn(app.GMUnit()) << " " << app.GMUnit().str() << std::endl;
				if(body.HasParameter(SpaceBody::BP_ACC))
					fout << "\tg: " << body.GetSurfaceAcceleration().ValueIn(app.AccelerationUnit()) << " " << app.AccelerationUnit().str() << std::endl;
				if(body.HasParameter(SpaceBody::BP_RADIUS))
				{
					Length radius = body.GetRadius();
					std::array<Length, 3> radii = body.GetRadii();
					fout << "\tRadius: " << radius.ValueIn(app.LengthUnit()) << " (" << radii[0].ValueIn(app.LengthUnit()) << ", " << radii[1].ValueIn(app.LengthUnit()) << ", " << radii[2].ValueIn(app.LengthUnit()) << ") " << app.LengthUnit().str() << std::endl;
				}

				fout << std::endl;
			}
			catch(const std::bad_cast&)
			{

			}

			Date t("Aug 17 2000 15:51:01 UTC-5");
			t += Time(1.0, Units::Common::days);

			Window spkCoverage = obj.GetCoverage();
			std::vector<Interval> spkIntervals = spkCoverage.GetIntervals();

			fout << "SPK state:" << std::endl;

			fout << "\tCoverage:" << std::endl;
			if(spkIntervals.size() == 0)
			{
				fout << "\t\tObject does not contain any state data" << std::endl;
			}

			for(size_t i = 0; i < spkIntervals.size(); i++)
			{
				Interval interval = spkIntervals[i];

				Date begin(interval.GetLeft());
				Date end(interval.GetRight());
//.........這裏部分代碼省略.........
開發者ID:SPICEFI,項目名稱:CSpiceApp,代碼行數:101,代碼來源:Main.cpp

示例2: IsIncluded

bool Window::IsIncluded(const Interval& interval) const
{
	return IsIncluded(interval.GetLeft(), interval.GetRight());
}
開發者ID:SPICEFI,項目名稱:CSpiceApp,代碼行數:4,代碼來源:Window.cpp


注:本文中的Interval::GetLeft方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。