Ejemplo n.º 1
0
bool GBox2dComponent::VInit(Json::Value& jcomponent)
{
	
	mWorld = GGameApp::getInstance()->getCurrentBox2dWorld();



	if(	mGameObject->IsPrototype() || 
	  (!mGameObject->IsPrototype() && !mGameObject->IsCloned()))
	{
		Json::Value jresult(-1);
		Json::Value jfixtures = jcomponent.get("aFixtures", jresult);

		mBodyDef.type = GetBodyTypeFromStr(jcomponent["iBodyType"].asString().c_str());
			
		if(jfixtures.isArray())
		{
			int size = jfixtures.size();

			for (int i =0; i < size; i++ )
			{
				Json::Value jfixture =jfixtures[i];

				b2FixtureDef fd = CreateFixtureDefinition(jfixture);
				mFixtureDefs.push_back(fd);
			}
		}	

		
		
	}		
							
	return true;
}
Ejemplo n.º 2
0
void
tws::wtss::prepare_timeseries_response(const timeseries_request_parameters& parameters,
                                       const timeseries_validated_parameters& vparameters,
                                       rapidjson::Document& doc,
                                       rapidjson::Value& jattributes,
                                       rapidjson::Document::AllocatorType& allocator)
{
// prepare result part in response
  rapidjson::Value jresult(rapidjson::kObjectType);

  jresult.AddMember("attributes", jattributes, allocator);

// add timeline in the response
  rapidjson::Value jtimeline(rapidjson::kArrayType);

  std::size_t init_pos = vparameters.timeline->pos(vparameters.start_time_idx);
  std::size_t fin_pos = vparameters.timeline->pos(vparameters.end_time_idx);

  tws::core::copy_string_array(std::begin(vparameters.timeline->time_points()) + init_pos,
                               std::begin(vparameters.timeline->time_points()) + (fin_pos + 1),
                               jtimeline, allocator);

  jresult.AddMember("timeline", jtimeline, allocator);

// add the pixel center location in response
  rapidjson::Value jcenter(rapidjson::kObjectType);
  jcenter.AddMember("latitude", vparameters.pixel_center_latitude, allocator);
  jcenter.AddMember("longitude", vparameters.pixel_center_longitude, allocator);
  jresult.AddMember("center_coordinates", jcenter, allocator);

// prepare the query part in response
  rapidjson::Value jquery(rapidjson::kObjectType);

  jquery.AddMember("coverage", parameters.cv_name.c_str(), allocator);

  rapidjson::Value jqattributes(rapidjson::kArrayType);

  tws::core::copy_string_array(parameters.queried_attributes.begin(), parameters.queried_attributes.end(), jqattributes, allocator);

  jquery.AddMember("attributes", jqattributes, allocator);

  jquery.AddMember("latitude", parameters.latitude, allocator);

  jquery.AddMember("longitude", parameters.longitude, allocator);

  doc.AddMember("result", jresult, allocator);
  doc.AddMember("query", jquery, allocator);
}