void tst_QMailMessagePart::setContentLocation()
{
    QMailMessagePart part;

    QString location1("Some content-location");
    QString location2("Some other content-location");

    QCOMPARE( part.contentLocation(), QString() );

    part.setContentLocation(location1);
    QCOMPARE( part.contentLocation(), location1 );

    part.setContentLocation(location2);
    QCOMPARE( part.contentLocation(), location2 );
}
Beispiel #2
0
void Hexapod(DemoEntityManager* const scene)
{
	// load the sky box
	scene->CreateSkyBox();

	CreateLevelMesh (scene, "flatPlane.ngd", true);
	//CreateHeightFieldTerrain(scene, HEIGHTFIELD_DEFAULT_SIZE, HEIGHTFIELD_DEFAULT_CELLSIZE, 1.5f, 0.3f, 200.0f, -50.0f);

	NewtonWorld* const world = scene->GetNewton();
	int defaultMaterialID = NewtonMaterialGetDefaultGroupID(world);
	dHexapodManager* const robotManager = new dHexapodManager(scene);
	NewtonMaterialSetDefaultFriction(world, defaultMaterialID, defaultMaterialID, 1.0f, 1.0f);
	NewtonMaterialSetDefaultElasticity(world, defaultMaterialID, defaultMaterialID, 0.1f);

	dMatrix location (dGetIdentityMatrix());
	location.m_posit = dVector(FindFloor(world, dVector(-0.0f, 50.0f, 0.0f, 1.0f), 2.0f * 50.0f));
	location.m_posit.m_y += 1.0f;

	int count = 5;
//count = 1;
	dMatrix location1(location);
	dFloat x0 = location.m_posit.m_x;
	for (int j = 0; j < 1; j++) {
		location.m_posit.m_z += 2.0f;
		location.m_posit.m_x = x0;
		for (int i = 0; i < count; i++) {
			location.m_posit.m_x += 2.0f;
			//location1.m_posit.m_x += 2.0f;
			robotManager->MakeHexapod(scene, location);
			//robotManager->MakeHexapod (scene, location1);
		}
	}

	location.m_posit = dVector(FindFloor(scene->GetNewton(), dVector(-0.0f, 50.0f, 0.0f, 1.0f), 2.0f * 50.0f));
	dVector origin(FindFloor(world, dVector(-4.0f, 50.0f, 0.0f, 1.0f), 2.0f * 50.0f));
	origin.m_y  += 2.5f;

//	dVector size(3.0f, 0.125f, 3.0f, 0.0f);
//	dMatrix shapeOffsetMatrix (dGetIdentityMatrix());
//	AddPrimitiveArray(scene, 50.0f, location.m_posit, size, count, count, 6.0f, _BOX_PRIMITIVE, defaultMaterialID, shapeOffsetMatrix);

	dQuaternion rot;
	scene->SetCameraMatrix(rot, origin);
}
int main(int /*argc*/, char** /*argv*/)
{
	// Distance:
	//    43135.331925721744 m
	//    43.135331925721744 km
	//    23.291215942614333 nm
	osmscout::GeoCoord location1(51.43170928, 6.80131361);
	osmscout::GeoCoord location2(51.48510151, 7.4160216);
	double distance_km = location2 - location1;
	std::cout << "Distance between " << location1.GetDisplayText() << " and " << location2.GetDisplayText() << ": " << distance_km << " km" << std::endl;

	// Target:
	//    Latitude: 51°27'48" N (51.463397)
	//    Longitude: 7°0'22" E (7.006078)
	double distance = 14665.298166863819; // [m]
	double angle = 76.010085273091411718093847668127; // [deg]
	osmscout::GeoCoord target = location1.Add(angle, distance);
	std::cout << "Go " << distance << " m in direction " << angle << " degree: " << target.GetDisplayText() << std::endl;

	return 0;
}
int
main(int argc, char **argv)
{
  plan_tests(14);

  TCHAR buffer[256];
  GeoPoint location1(Angle::Degrees(8.466322),
                     Angle::Degrees(49.487153));

  GeoPoint location2(Angle::Degrees(-70.011667),
                     Angle::Degrees(-32.653333));

  // Test DD.ddddd
  FormatGeoPoint(location1, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::DD_DDDDD);
  ok1(StringIsEqual(buffer, _T("49.48715° N 008.46632° E")));

  FormatGeoPoint(location2, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::DD_DDDDD);
  ok1(StringIsEqual(buffer, _T("32.65333° S 070.01167° W")));


  // Test DDMM.mmm
  FormatGeoPoint(location1, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::DDMM_MMM);
  ok1(StringIsEqual(buffer, _T("49°29.229' N 008°27.979' E")));

  FormatGeoPoint(location2, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::DDMM_MMM);
  ok1(StringIsEqual(buffer, _T("32°39.200' S 070°00.700' W")));


  // Test DDMMSS
  FormatGeoPoint(location1, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::DDMMSS);
  ok1(StringIsEqual(buffer, _T("49°29'14\" N 008°27'59\" E")));

  FormatGeoPoint(location2, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::DDMMSS);
  ok1(StringIsEqual(buffer, _T("32°39'12\" S 070°00'42\" W")));


  // Test DDMMSS.s
  FormatGeoPoint(location1, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::DDMMSS_S);
  ok1(StringIsEqual(buffer, _T("49°29'13.8\" N 008°27'58.8\" E")));

  FormatGeoPoint(location2, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::DDMMSS_S);
  ok1(StringIsEqual(buffer, _T("32°39'12.0\" S 070°00'42.0\" W")));

  // Test UTM
  FormatGeoPoint(location1, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::UTM);
  ok1(StringIsEqualWildcard(buffer, _T("32U 4613** 5481***")));

  FormatGeoPoint(location2, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::UTM);
  ok1(StringIsEqualWildcard(buffer, _T("19H 4051** 6386***")));

  // Test seperator
  FormatGeoPoint(location1, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::DDMMSS, _T('\n'));
  ok1(StringIsEqual(buffer, _T("49°29'14\" N\n008°27'59\" E")));

  FormatGeoPoint(location2, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::DDMMSS, _T('\n'));
  ok1(StringIsEqual(buffer, _T("32°39'12\" S\n070°00'42\" W")));

  FormatGeoPoint(location1, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::UTM, _T('\n'));
  ok1(StringIsEqualWildcard(buffer, _T("32U\n4613**\n5481***")));

  FormatGeoPoint(location2, buffer, ARRAY_SIZE(buffer),
                 CoordinateFormat::UTM, _T('\n'));
  ok1(StringIsEqualWildcard(buffer, _T("19H\n4051**\n6386***")));


  return exit_status();
}
static void AddPathFollow (DemoEntityManager* const scene, const dVector& origin)
{
	// create a Bezier Spline path for AI car to drive
	DemoEntity* const rollerCosterPath = new DemoEntity(dGetIdentityMatrix(), NULL);
	scene->Append(rollerCosterPath);
	
	dBezierSpline spline;
	dFloat64 knots[] = {0.0f, 1.0f / 5.0f, 2.0f / 5.0f, 3.0f / 5.0f, 4.0f / 5.0f, 1.0f};

	dBigVector o (origin[0], origin[1],  origin[2],  0.0f);
	dBigVector control[] =
	{
		dBigVector(100.0f - 100.0f, 20.0f, 200.0f - 250.0f, 1.0f) + o,
		dBigVector(150.0f - 100.0f, 10.0f, 150.0f - 250.0f, 1.0f) + o,
		dBigVector(175.0f - 100.0f, 30.0f, 250.0f - 250.0f, 1.0f) + o,
		dBigVector(200.0f - 100.0f, 70.0f, 250.0f - 250.0f, 1.0f) + o,
		dBigVector(215.0f - 100.0f, 20.0f, 250.0f - 250.0f, 1.0f) + o,
		dBigVector(150.0f - 100.0f, 50.0f, 350.0f - 250.0f, 1.0f) + o,
		dBigVector( 50.0f - 100.0f, 30.0f, 250.0f - 250.0f, 1.0f) + o,
		dBigVector(100.0f - 100.0f, 20.0f, 200.0f - 250.0f, 1.0f) + o,
	};

	spline.CreateFromKnotVectorAndControlPoints(3, sizeof (knots) / sizeof (knots[0]), knots, control);

	DemoBezierCurve* const mesh = new DemoBezierCurve (spline);
	rollerCosterPath->SetMesh(mesh, dGetIdentityMatrix());
	
	mesh->SetVisible(true);
	mesh->SetRenderResolution(500);
	mesh->Release();
	
	const int count = 32;
	NewtonBody* bodies[count];

	dBigVector point0;
	
	dVector positions[count + 1];
	dFloat64 knot = spline.FindClosestKnot(point0, origin + dVector(100.0f - 100.0f, 20.0f, 200.0f - 250.0f, 0.0f), 4);
	positions[0] = dVector (point0.m_x, point0.m_y, point0.m_z, 0.0);
	dFloat average = 0.0f;
	for (int i = 0; i < count; i ++) {
		dBigVector point1;
		average += positions[i].m_y;
		dBigVector tangent(spline.CurveDerivative(knot));
		tangent = tangent.Scale (1.0 / sqrt (tangent % tangent));
		knot = spline.FindClosestKnot(point1, dBigVector (point0 + tangent.Scale (2.0f)), 4);
		point0 = point1;
		positions[i + 1] = dVector (point0.m_x, point0.m_y, point0.m_z, 0.0);
	}

	average /= count;
	for (int i = 0; i < count + 1; i ++) {
		positions[i].m_y = average;
	}

	dFloat attachmentOffset = 0.8f;
	for (int i = 0; i < count; i ++) {
		dMatrix matrix;
		dVector location0 (positions[i].m_x, positions[i].m_y, positions[i].m_z, 0.0);
		bodies[i] = CreateWheel(scene, location0, 1.0f, 0.5f);
		NewtonBodySetLinearDamping(bodies[i], 0.0f);
		NewtonBody* const box = bodies[i];
		NewtonBodyGetMatrix(box, &matrix[0][0]);

		dVector location1 (positions[i + 1].m_x, positions[i + 1].m_y, positions[i + 1].m_z, 0.0);
		dVector dir (location1 - location0);
		matrix.m_front = dir.Scale (1.0f / dSqrt (dir % dir));
		matrix.m_right = matrix.m_front * matrix.m_up;
		dMatrix matrix1 (dYawMatrix(0.5f * 3.141692f) * matrix);
		NewtonBodySetMatrix(box, &matrix1[0][0]);
		matrix.m_posit.m_y += attachmentOffset;		
		new MyPathFollow(matrix, box, rollerCosterPath);

		dVector veloc (dir.Scale (20.0f));
		NewtonBodySetVelocity(box, &veloc[0]);
	}
	
	for (int i = 1; i < count; i ++) {
		NewtonBody* const box0 = bodies[i - 1];
		NewtonBody* const box1 = bodies[i];

		dMatrix matrix0;
		dMatrix matrix1;
		NewtonBodyGetMatrix(box0, &matrix0[0][0]);
		NewtonBodyGetMatrix(box1, &matrix1[0][0]);
		matrix0.m_posit.m_y += attachmentOffset;
		matrix1.m_posit.m_y += attachmentOffset;
		new CustomDistanceRope (matrix1.m_posit, matrix0.m_posit, box1, box0);
	}
	
	void* const aggregate = NewtonCollisionAggregateCreate (scene->GetNewton());
	for (int i = 0; i < count; i ++) {
		NewtonCollisionAggregateAddBody(aggregate, bodies[i]);
	}
	NewtonCollisionAggregateSetSelfCollision (aggregate, false);

#ifdef _USE_HARD_JOINTS
	NewtonSkeletonContainer* const skeleton = NewtonSkeletonContainerCreate(scene->GetNewton(), bodies[0], NULL);
	for (int i = 1; i < count; i++) {
		NewtonSkeletonContainerAttachBone(skeleton, bodies[i], bodies[i - 1]);
	}
	NewtonSkeletonContainerFinalize(skeleton);
#endif
}