void MindMap::createTargetMeta_defineCircuit( Xml xml , TargetAreaDef *areaDef , bool sensors ) {
	if( sensors )
		areaDef -> defineSensorArea();
	else
		areaDef -> defineEffectorArea();

	mindAreaMap.add( areaDef -> getAreaId() , areaDef );

	// create sensor meta
	String itemsElement = ( sensors )? "sensors" :  "effectors";
	String itemElement = ( sensors )? "sensor" :  "effector";

	Xml config = xml.getChildNode( itemsElement );
	for( Xml xmlChild = config.getFirstChild( itemElement ); xmlChild.exists(); xmlChild = xmlChild.getNextChild( itemElement ) ) {
		TargetRegionDef *regionInfo = new TargetRegionDef( areaDef );

		if( sensors )
			regionInfo -> defineSensorRegion( xmlChild );
		else
			regionInfo -> defineEffectorRegion( xmlChild );

		// add to maps
		areaDef -> addRegion( regionInfo );
		mindRegionMap.add( regionInfo -> getId() , regionInfo );
		TargetRegionTypeDef *regionTypeInfo = ( TargetRegionTypeDef * )regionInfo -> getType();
		regionTypeMap.add( regionTypeInfo -> getName() , regionTypeInfo );

		TargetCircuitDef *circuitInfo = regionTypeInfo -> getCircuitInfo();
		mindCircuitMap.add( circuitInfo -> getName() , circuitInfo );

		regionInfo -> setCircuitDef( circuitInfo );
	}
}
Example #2
0
void Sensors::createSensors()
{
	AIBodyImpl *body = AIBodyImpl::getInstance();
	Xml config = body -> getConfigService();
	Xml configSensors = config.getChildNode( "sensors" );

	addSensor( configSensors , Sensor::createFileSysWalker( this ) );
	addSensor( configSensors , Sensor::createEye( this ) );
}