示例#1
0
std::string
PoseFeatureObs::toString() const
{
    stringstream ss;
    ss << "PSE [r="<<range()<<", b="<<bearing()*180.0/M_PI<<"deg, o="<<orientation()*180.0/M_PI<<"deg]"
       << "(t="<<featureType()<<",pf="<<pFalsePositive()<<",pt="<<pTruePositive()<<",sd="<<rangeSd()<<","<<bearingSd()*180.0/M_PI<<"deg"<<orientationSd()*180.0/M_PI<<"deg)";
    return ss.str();
}
示例#2
0
std::string
LineFeatureObs::toString() const
{
    stringstream ss;
    ss << "LIN s=["<<rangeStart()<<","<<bearingStart()*180.0/M_PI<<"deg],e=["
       << rangeEnd()<<","<<bearingEnd()*180.0/M_PI<<"deg] "
       << "(t="<<featureType()<<",pf="<<pFalsePositive()<<",pt="<<pTruePositive()<<")";
    ss << endl << "  (rho="<<rho()<<",a="<<alpha()*180.0/M_PI<<"deg), sd=("<<rhoSd()<<","<<alphaSd()*180.0/M_PI<<"deg)";
   return ss.str();
}
示例#3
0
/* Load the feature stats */
BOOL loadFeatureStats(const char *pFeatureData, UDWORD bufferSize)
{
	FEATURE_STATS		*psFeature;
	unsigned int		i;
	char				featureName[MAX_STR_LENGTH], GfxFile[MAX_STR_LENGTH],
						type[MAX_STR_LENGTH];

	numFeatureStats = numCR(pFeatureData, bufferSize);

	// Skip descriptive header
	if (strncmp(pFeatureData,"Feature ",8)==0)
	{
		pFeatureData = strchr(pFeatureData,'\n') + 1;
		numFeatureStats--;
	}
	
	asFeatureStats = (FEATURE_STATS*)malloc(sizeof(FEATURE_STATS) * numFeatureStats);

	if (asFeatureStats == NULL)
	{
		debug( LOG_FATAL, "Feature Stats - Out of memory" );
		abort();
		return false;
	}

	psFeature = asFeatureStats;

	for (i = 0; i < numFeatureStats; i++)
	{
		UDWORD Width, Breadth;
		int damageable = 0, tileDraw = 0, allowLOS = 0, visibleAtStart = 0;

		memset(psFeature, 0, sizeof(FEATURE_STATS));

		featureName[0] = '\0';
		GfxFile[0] = '\0';
		type[0] = '\0';

		//read the data into the storage - the data is delimeted using comma's
		sscanf(pFeatureData, "%[^','],%d,%d,%d,%d,%d,%[^','],%[^','],%d,%d,%d",
			featureName, &Width, &Breadth,
			&damageable, &psFeature->armourValue, &psFeature->body,
			GfxFile, type, &tileDraw, &allowLOS,
			&visibleAtStart);

		psFeature->damageable = damageable;
		psFeature->tileDraw = tileDraw;
		psFeature->allowLOS = allowLOS;
		psFeature->visibleAtStart = visibleAtStart;

		// These are now only 16 bits wide - so we need to copy them
		psFeature->baseWidth = Width;
		psFeature->baseBreadth = Breadth;

		psFeature->pName = allocateName(featureName);
		if (!psFeature->pName)
		{
			return false;
		}

		if (psFeature->damageable && psFeature->body == 0)
		{
			debug(LOG_ERROR, "The feature %s, ref %d, is damageable, but has no body points!  The files need to be updated / fixed.  " \
							 "Assigning 1 body point to feature.", psFeature->pName, psFeature->ref);
			psFeature->body = 1;
		}
		//determine the feature type
		featureType(psFeature, type);

		//and the oil resource - assumes only one!
		if (psFeature->subType == FEAT_OIL_RESOURCE)
		{
			oilResFeature = psFeature;
		}

		//get the IMD for the feature
		psFeature->psImd = (iIMDShape *) resGetData("IMD", GfxFile);
		if (psFeature->psImd == NULL)
		{
			debug( LOG_ERROR, "Cannot find the feature PIE for record %s",  getName( psFeature->pName ) );
			return false;
		}

		psFeature->ref = REF_FEATURE_START + i;

		//increment the pointer to the start of the next record
		pFeatureData = strchr(pFeatureData,'\n') + 1;
		//increment the list to the start of the next storage block
		psFeature++;
	}

	return true;
}