Ejemplo n.º 1
0
void
TextAttribute::initialize(QXmlStreamReader& xml)
{
  m_value = getStringAttribute(xml, "TextAttribute", "value");
  QString name = getStringAttribute(xml, "TextAttribute", "name");
  if (name == "bit") {
    m_name = TextAttribute::bit;
  }
  else if (name == "geometry") {
    m_name = TextAttribute::geometry;
  }
  else if (name == "area_name") {
    m_name = TextAttribute::area_name;
  }
  else if (name == "customer") {
    m_name = TextAttribute::customer;
  }
  else if (name == "comment") {
    m_name = TextAttribute::comment;
  }
  else if (name == "technology") {
    m_name = TextAttribute::technology;
  }
  else if (name == "eda_layers") {
    m_name = TextAttribute::eda_layers;
  }
  else {
    throw new InvalidAttributeError("TextAttribute", "name");
  }
}
Ejemplo n.º 2
0
void
StackupLayer::initialize(QXmlStreamReader& xml)
{
  m_layerOrGroupRef =
      getStringAttribute(xml, "StackupLayer", "layerOrGroupRef");
  m_materialType = getStringAttribute(xml, "StackupLayer", "materialType");
  m_thickness = getNonNegativeDoubleAttribute(xml, "StackupLayer", "thickness");
  if (hasAttribute(xml, "weight")) {
    m_weight = getNonNegativeDoubleAttribute(xml, "StackupLayer", "weight");
  }
  if (hasAttribute(xml, "coating")) {
    m_coating = getStringAttribute(xml, "StackupLayer", "coating");
  }
  if (hasAttribute(xml, "comment")) {
    m_comment = getStringAttribute(xml, "StackupLayer", "comment");
  }

  while (!xml.atEnd() && !xml.hasError()) {
    xml.readNext();
    if (xml.isStartElement()) {
      if (isSubstitutionGroupAttribute(xml.name())) {
        Attribute *a = AttributeFactory().create(xml.name());
        a->initialize(xml);
        m_attributes.append(a);
      }
    }
    else if (isEndElementWithName(xml, "StackupLayer")) { // </StackupLayer>
      return;
    }
  }
}
void
DictionaryUserHandler::run(QXmlStreamReader& xml)
{
    m_units = getUnitAttribute(xml, "DictionaryUser", "units");
    while (!xml.atEnd() && !xml.hasError()) {
        xml.readNext();
        if (xml.isStartElement()) {
            if (xml.name() == "EntryUser") {
                QString id = getStringAttribute(xml, "EntryUser", "id");
                // id must be unique
                if (g_entryUsers.contains(id)) {
                    throw new DuplicateIdError("EntryUser", id);
                }
                // create element and insert to hash table
                xml.readNextStartElement(); // <Simple>, <Text>, <UserSpecial>
                UserPrimitive* u = UserPrimitiveFactory().create(xml.name());
                u->initialize(xml, m_units);
                g_entryUsers.insert(id, u);
            }
        }
        else if (isEndElementWithName(xml, "DictionaryUser")) {
            break;
        }
    }
}
void
DictionaryLineDescHandler::run(QXmlStreamReader& xml)
{
  m_units = getUnitAttribute(xml, "DictionaryLineDesc", "units");
  while (!xml.atEnd() && !xml.hasError()) {
    xml.readNext();
    if (xml.isStartElement()) {
      if (xml.name() == "EntryLineDesc") {
        QString id = getStringAttribute(xml, "EntryLineDesc", "id");
        // id must be unique
        if (g_entryLineDescs.contains(id)) {
          throw new DuplicateIdError("DictionaryLineDesc", id);
        }
        // create element and insert to hash table
        xml.readNextStartElement(); // <LineDesc>
        LineDesc l;
        l.initialize(xml, m_units);
        g_entryLineDescs.insert(id, l);
      }
    }
    else if (isEndElementWithName(xml, "DictionaryLineDesc")) {
      break;
    }
  }
}
Ejemplo n.º 5
0
void
IntegerAttribute::initialize(QXmlStreamReader& xml)
{
  m_value = getIntAttribute(xml, "IntegerAttribute", "value");
  QString name = getStringAttribute(xml, "IntegerAttribute", "name");
  if (name == "cut_line") {
    m_name = IntegerAttribute::cut_line;
  }
  else if (name == "design_origin_x") {
    m_name = IntegerAttribute::design_origin_x;
  }
  else if (name == "design_origin_y") {
    m_name = IntegerAttribute::design_origin_y;
  }
  else if (name == "num_local_fiducials") {
    m_name = IntegerAttribute::num_local_fiducials;
  }
  else if (name == "pilot_hole") {
    m_name = IntegerAttribute::pilot_hole;
  }
  else if (name == "testpoint_count") {
    m_name = IntegerAttribute::testpoint_count;
  }
  else {
    throw new InvalidAttributeError("IntegerAttribute", "name");
  }
}
Ejemplo n.º 6
0
std::string VsUnstructuredMesh::getPointsDatasetName(int i)  {
  
  std::string attributeName;
  switch (i) {
    case 0: attributeName = VsSchema::Unstructured::vsPoints0;
      break;
    case 1: attributeName = VsSchema::Unstructured::vsPoints1;
      break;
    case 2: attributeName = VsSchema::Unstructured::vsPoints2;
      break;
    default:

      VsLog::debugLog() << __CLASS__ << __FUNCTION__ << "  " << __LINE__ << "  "  
                        << "Requested index (" << i << ") is out of range."
                        << std::endl;
      return "";
  }
  
  std::string fullName;
  getStringAttribute(attributeName, &fullName); //might be empty
  //if the name was found, make sure it's fully qualified
  if (!fullName.empty()) {
    fullName = makeCanonicalName(getFullName(), fullName);
  }

  return fullName;
}
Ejemplo n.º 7
0
void
Package::initialize(QXmlStreamReader& xml, UnitsType units)
{
  m_name = getStringAttribute(xml, "Package", "name");
  m_type = decidePackageType(xml);
  m_pinOne = NULL;
  if (hasAttribute(xml, "pinOne")) {
    m_pinOne = new QString(getStringAttribute(xml, "Package", "pinOne"));
  }
  m_height = NULL;
  if (hasAttribute(xml, "height")) {
    m_height =
        new qreal(getNonNegativeDoubleAttribute(xml, "Package", "height"));
  }

  m_landPattern = NULL;
  while (!xml.atEnd() && !xml.hasError()) {
    xml.readNext();
    if (xml.isStartElement()) {
      if (xml.name() == "Outline") {
        m_outline.initialize(xml, units);
      }
      else if (xml.name() == "LandPattern") {
        m_landPattern = new LandPattern();
        m_landPattern->initialize(xml, units);
      }
      else if (xml.name() == "SilkScreen") {
// TODO skipped
        //throw new NonImplementedError("SilkScreen");
      }
      else if (xml.name() == "AssemblyDrawing") {
// TODO skipped
        //throw new NonImplementedError("AssemblyDrawing");
      }
      else if (xml.name() == "Pin") {
// TODO skipped
        //throw new NonImplementedError("Pin");
      }
    }
    else if (isEndElementWithName(xml, "Package")) { // </Package>
      return;
    }
  }
}
Ejemplo n.º 8
0
std::string VsUnstructuredMesh::getPrismsDatasetName()   {
  //First see if the user has specified a name for the dataset
  std::string prismsName;
  getStringAttribute(VsSchema::Unstructured::vsPrisms, &prismsName);
  if (!prismsName.empty()) {
    return makeCanonicalName(getFullName(), prismsName);
  }

  return makeCanonicalName(getFullName(), VsSchema::Unstructured::defaultPrismsName);
}
Ejemplo n.º 9
0
/**
* Store the value of the integer attribute with name into buffer_ptr
* 
* @param buffer_prt The buffer to store the value
* @param name The name of the attribute 
*
* @return None
*/
void getIntegerAttribute(unsigned int* int_ptr, const char* name) {
	char* buffer=NULL;

	getStringAttribute((char **) &buffer, name);
	if(buffer)
		*int_ptr = atoi(buffer);
	else
		*int_ptr = 0;

}
Ejemplo n.º 10
0
std::string VsUnstructuredMesh::getHexahedralsDatasetName()   {
  //First see if the user has specified a name for the dataset
  std::string hexahedralsName;
  getStringAttribute(VsSchema::Unstructured::vsHexahedrals, &hexahedralsName);
  if (!hexahedralsName.empty()) {
    return makeCanonicalName(getFullName(), hexahedralsName);
  }

  return makeCanonicalName(getFullName(), VsSchema::Unstructured::defaultHexahedralsName);
}
Ejemplo n.º 11
0
std::string VsUnstructuredMesh::getPointsDatasetName()  {
  //First see if the user has specified a name for the dataset
  std::string pointsName;
  getStringAttribute(VsSchema::Unstructured::vsPoints, &pointsName);
  if (!pointsName.empty()) {
    return makeCanonicalName(getFullName(), pointsName);
  }

  //if we didn't find vsPoints, try the default name
  return makeCanonicalName(getFullName(),
                           VsSchema::Unstructured::defaultPointsName);
}
Ejemplo n.º 12
0
void
StepRepeat::initialize(QXmlStreamReader& xml)
{
  m_stepRef = getStringAttribute(xml, "StepRepeat", "stepRef");
  m_x = getDoubleAttribute(xml, "StepRepeat", "x");
  m_y = getDoubleAttribute(xml, "StepRepeat", "y");
  m_nx = getNonNegativeIntAttribute(xml, "StepRepeat", "nx");
  m_ny = getNonNegativeIntAttribute(xml, "StepRepeat", "ny");
  m_dx = getNonNegativeDoubleAttribute(xml, "StepRepeat", "dx");
  m_dy = getNonNegativeDoubleAttribute(xml, "StepRepeat", "dy");
  m_angle = getDoubleAttribute(xml, "StepRepeat", "angle");
  m_mirror = getBoolAttribute(xml, "mirror");
}
void
NonstandardAttribute::initialize(QXmlStreamReader& xml)
{
  m_name = getStringAttribute(xml, "NonstandardAttribute", "name");
  m_value = getStringAttribute(xml, "NonstandardAttribute", "value");
  QString type = getStringAttribute(xml, "NonstandardAttribute", "type");
  if (type == "DOUBLE") {
    m_type = NonstandardAttribute::DOUBLE;
  }
  else if (type == "INTEGER") {
    m_type = NonstandardAttribute::INTEGER;
  }
  else if (type == "BOOLEAN") {
    m_type = NonstandardAttribute::BOOLEAN;
  }
  else if (type == "STRING") {
    m_type = NonstandardAttribute::STRING;
  }
  else {
    throw new InvalidAttributeError("NonstandardAttribute", "type");
  }
}
Ejemplo n.º 14
0
void TextRenderer::loadAttributes() {
    std::string position = getStringAttribute("position");
    if(position == "center") {
        setPosition(POSITION_CENTER);
    } else if(position == "top_left") {
        setPosition(POSITION_TOP_LEFT);
    } else if(position == "top_right") {
        setPosition(POSITION_TOP_RIGHT);
    } else if(position == "bottom_left") {
        setPosition(POSITION_BOTTOM_LEFT);
    } else if(position == "bottom_right") {
        setPosition(POSITION_BOTTOM_RIGHT);
    } else {
        throw Exception("Uknown position for TextRenderer: " + position);
    }
    setFontSize(getIntegerAttribute("font_size"));
}
Ejemplo n.º 15
0
void
EcadHandler::run(QXmlStreamReader& xml)
{
  m_name = getStringAttribute(xml, "Ecad", "name");
  while (!xml.atEnd() && !xml.hasError()) {
    xml.readNext();
    if (xml.isStartElement()) {
      if (xml.name() == "CadHeader") {
        m_cadHeaderHandler.run(xml);
      }
      else if (xml.name() == "CadData") {
        m_cadDataHandler.run(xml, m_cadHeaderHandler.units());
      }
    }
    else if (isEndElementWithName(xml, "Ecad")) { // </Ecad>
      return;
    }
  }
}
Ejemplo n.º 16
0
LogicalNet::NetClassType
LogicalNet::decideNetClassType(QXmlStreamReader& xml)
{
  QString netClass = getStringAttribute(xml, "LogicalNet", "NetClass");
  if (netClass == "CLK") {
    return LogicalNet::CLK;
  }
  else if (netClass == "FIXED") {
    return LogicalNet::FIXED;
  }
  else if (netClass == "GROUND") {
    return LogicalNet::GROUND;
  }
  else if (netClass == "SIGNAL") {
    return LogicalNet::SIGNAL;
  }
  else if (netClass == "POWER") {
    return LogicalNet::POWER;
  }
  return LogicalNet::UNUSED;
}
Ejemplo n.º 17
0
void
StackupGroup::initialize(QXmlStreamReader& xml, UnitsType units)
{
  m_name = getStringAttribute(xml, "StackupGroup", "name");
  m_thickness = getNonNegativeDoubleAttribute(xml, "StackupGroup", "thickness");
  m_tolPlus = getNonNegativeDoubleAttribute(xml, "StackupGroup", "tolPlus");
  m_tolMinus = getNonNegativeDoubleAttribute(xml, "StackupGroup", "tolMinus");
  
  while (!xml.atEnd() && !xml.hasError()) {
    xml.readNext();
    if (xml.isStartElement()) {
      if (xml.name() == "StackupLayer") {
        StackupLayer stackupLayer;
        stackupLayer.initialize(xml);
        m_stackupLayers.append(stackupLayer);
      }
    }
    else if (isEndElementWithName(xml, "StackupGroup")) { // </StackupGroup>
      return;
    }
  }
}
Ejemplo n.º 18
0
void GammaWidget::resetFromFilm (bool useDefaults)
{
    m_CRF_enabled = retrieveParam( useDefaults, LUX_FILM, LUX_FILM_CAMERA_RESPONSE_ENABLED) != 0.0;

    //ui->checkBox_CRF->setChecked(m_CRF_enabled);

    m_CRF_file = getStringAttribute("film", "CameraResponse");

    // not ideal as this will reset gamma
    // which wont happen if CRF was defined in the scene file
    // and eg luxconsole is used
    if (m_CRF_enabled)
        activateCRF();
    else
        deactivateCRF();

    // gamma must be handled after CRF
    // as (de)activateCRF modifies the gamma values
    m_TORGB_gamma = retrieveParam( useDefaults, LUX_FILM, LUX_FILM_TORGB_GAMMA);

    luxSetParameterValue(LUX_FILM, LUX_FILM_TORGB_GAMMA, m_TORGB_gamma);
}
Ejemplo n.º 19
0
void
LogicalNet::initialize(QXmlStreamReader& xml)
{
  m_name = getStringAttribute(xml, "LogicalNet", "name");
  m_netClass = decideNetClassType(xml);
  while (!xml.atEnd() && !xml.hasError()) {
    xml.readNext();
    if (xml.isStartElement()) {
      if (xml.name() == "Attribute") {
// TODO skipped
        //throw new NonImplementedError("LogicalNet::Attribute");
      }
      else if (xml.name() == "PinRef") {
        PinRef pinRef;
        pinRef.initialize(xml);
        m_pinRefs.append(pinRef);
      }
    }
    else if (isEndElementWithName(xml, "LogicalNet")) { // </LogicalNet>
      return;
    }
  }
}
Ejemplo n.º 20
0
bool ItemAttributes::hasStringAttribute(const std::string& key) const
{
  return getStringAttribute(key) != NULL;
}
Ejemplo n.º 21
0
std::string MultiplexNetwork::getStringAttribute(const std::string& global_name, const std::string& attribute_name) const {
	if (!containsGlobalName(global_name)) throw ElementNotFoundException("Global name " + global_name);
	return getStringAttribute(identity_name_to_id.at(global_name), attribute_name);
}
Ejemplo n.º 22
0
void
LineDescRef::initialize(QXmlStreamReader& xml, UnitsType units)
{
  m_id = getStringAttribute(xml, "LineDescRef", "id");
}
Ejemplo n.º 23
0
Package::PackageType
Package::decidePackageType(QXmlStreamReader& xml)
{
  QString packageType = getStringAttribute(xml, "Package", "type");
  if (packageType == "AXIAL_LEADED") {
    return Package::AXIAL_LEADED;
  }
  else if (packageType == "BARE_DIE") {
    return Package::BARE_DIE;
  }
  else if (packageType == "CERAMIC_BGA") {
    return Package::CERAMIC_BGA;
  }
  else if (packageType == "CERAMIC_DIP") {
    return Package::CERAMIC_DIP;
  }
  else if (packageType == "CERAMIC_FLATPACK") {
    return Package::CERAMIC_FLATPACK;
  }
  else if (packageType == "CERAMIC_QUAD_FLATPACK") {
    return Package::CERAMIC_QUAD_FLATPACK;
  }
  else if (packageType == "CERAMIC_SIP") {
    return Package::CERAMIC_SIP;
  }
  else if (packageType == "CHIP") {
    return Package::CHIP;
  }
  else if (packageType == "CHIP_SCALE") {
    return Package::CHIP_SCALE;
  }
  else if (packageType == "CHOKE_SWITCH_SM") {
    return Package::CHOKE_SWITCH_SM;
  }
  else if (packageType == "COIL") {
    return Package::COIL;
  }
  else if (packageType == "CONNECTOR_SM") {
    return Package::CONNECTOR_SM;
  }
  else if (packageType == "CONNECTOR_TH") {
    return Package::CONNECTOR_TH;
  }
  else if (packageType == "EMBEDDED") {
    return Package::EMBEDDED;
  }
  else if (packageType == "FINEPITCH_BGA") {
    return Package::FINEPITCH_BGA;
  }
  else if (packageType == "FLIPCHIP") {
    return Package::FLIPCHIP;
  }
  else if (packageType == "HERMETIC_HYBRID") {
    return Package::HERMETIC_HYBRID;
  }
  else if (packageType == "LEADLESS_CERAMIC_CHIP_CARRIER") {
    return Package::LEADLESS_CERAMIC_CHIP_CARRIER;
  }
  else if (packageType == "MCM") {
    return Package::MCM;
  }
  else if (packageType == "MELF") {
    return Package::MELF;
  }
  else if (packageType == "MOLDED") {
    return Package::MOLDED;
  }
  else if (packageType == "NETWORK") {
    return Package::NETWORK;
  }
  else if (packageType == "OTHER") {
    return Package::OTHER;
  }
  else if (packageType == "PGA") {
    return Package::PGA;
  }
  else if (packageType == "PLASTIC_BGA") {
    return Package::PLASTIC_BGA;
  }
  else if (packageType == "PLASTIC_CHIP_CARRIER") {
    return Package::PLASTIC_CHIP_CARRIER;
  }
  else if (packageType == "PLASTIC_DIP") {
    return Package::PLASTIC_DIP;
  }
  else if (packageType == "PLASTIC_SIP") {
    return Package::PLASTIC_SIP;
  }
  else if (packageType == "POWER_TRANSISTOR") {
    return Package::POWER_TRANSISTOR;
  }
  else if (packageType == "RADIAL_LEADED") {
    return Package::RADIAL_LEADED;
  }
  else if (packageType == "RECTANGULAR_QUAD_FLATPACK") {
    return Package::RECTANGULAR_QUAD_FLATPACK;
  }
  else if (packageType == "RELAY_SM") {
    return Package::RELAY_SM;
  }
  else if (packageType == "RELAY_TH") {
    return Package::RELAY_TH;
  }
  else if (packageType == "SOD123") {
    return Package::SOD123;
  }
  else if (packageType == "SOIC") {
    return Package::SOIC;
  }
  else if (packageType == "SOJ") {
    return Package::SOJ;
  }
  else if (packageType == "SOPIC") {
    return Package::SOPIC;
  }
  else if (packageType == "SOT143") {
    return Package::SOT143;
  }
  else if (packageType == "SOT23") {
    return Package::SOT23;
  }
  else if (packageType == "SOT52") {
    return Package::SOT52;
  }
  else if (packageType == "SOT89") {
    return Package::SOT89;
  }
  else if (packageType == "SQUARE_QUAD_FLATPACK") {
    return Package::SQUARE_QUAD_FLATPACK;
  }
  else if (packageType == "SSOIC") {
    return Package::SSOIC;
  }
  else if (packageType == "SWITCH_TH") {
    return Package::SWITCH_TH;
  }
  else if (packageType == "TANTALUM") {
    return Package::TANTALUM;
  }
  else if (packageType == "TO_TYPE") {
    return Package::TO_TYPE;
  }
  else if (packageType == "TRANSFORMER") {
    return Package::TRANSFORMER;
  }
  else if (packageType == "TRIMPOT_SM") {
    return Package::TRIMPOT_SM;
  }
  else if (packageType == "TRIMPOT_TH") {
    return Package::TRIMPOT_TH;
  }
  throw new InvalidAttributeError("Package", "type");
}
Ejemplo n.º 24
0
void
UserPrimitiveRef::initialize(QXmlStreamReader& xml, UnitsType units)
{
  m_id = getStringAttribute(xml, "UserPrimitiveRef", "id");
}
Ejemplo n.º 25
0
void SBCollisionManager::afterUpdate(double time)
{	
	// determine if any of the characters are currently in collision
	// horribly inefficient n^2 implementation for characters only
	SBScene* scene = SmartBody::SBScene::getScene();
	double timeDt = scene->getSimulationManager()->getTimeDt();
	if (timeDt == 0.0)
		timeDt = .016;
	
	const std::vector<std::string>& characters = scene->getCharacterNames();
	for (std::vector<std::string>::const_iterator iter = characters.begin();
		 iter != characters.end();
		 iter++)
	{
		SBCharacter* character =  scene->getCharacter((*iter));
		SrVec position = character->getPosition();
		position[1] = 0.0;
		SrVec& oldPosition = _positions[(*iter)];		
		_velocities[(*iter)] = (position - oldPosition) / (float) timeDt;		
		_positions[(*iter)] = position;
	}

	int curIteration = 0;
	bool needMoreIterations = true;	

	SBEventManager* eventManager = SmartBody::SBScene::getScene()->getEventManager();	

	const std::string& collisionResMethod = getStringAttribute("collisionResolutionType");	

	while (needMoreIterations && curIteration < _maxIterations)
	{
		needMoreIterations = false;
		SbmCollisionPairList potentialCollisions;		
		collisionSpace->getPotentialCollisionPairs(potentialCollisions);

		for (unsigned int i=0;i<potentialCollisions.size();i++)
		{
			// unfiltered
			//LOG("Collision Pair = %s %s",potentialCollisions[i].first.c_str(), potentialCollisions[i].second.c_str());
			SBGeomObject* g1 = getCollisionObject(potentialCollisions[i].first);
			SBGeomObject* g2 = getCollisionObject(potentialCollisions[i].second);

			// skip self-collision within skeleton/character's joints
			if(!_singleChrCapsuleMode) 
			{
			SBJoint* j1 = dynamic_cast<SBJoint*>(g1->getAttachObj());
			SBJoint* j2 = dynamic_cast<SBJoint*>(g2->getAttachObj());
			if(j1 && j2)
				if(j1->skeleton() == j2->skeleton()) continue; // belong to same character
			}
			
			// filtered, exclude all collisions within each character/skeleton
			//LOG("Potential Collision Pair: %s %s",potentialCollisions[i].first.c_str(), potentialCollisions[i].second.c_str());

			std::vector<SBGeomContact> contactPts;
			SBCollisionUtil::collisionDetection(g1,g2,contactPts);
			if (contactPts.size() > 0)	
			{
				// collision handling here
				if(_singleChrCapsuleMode)
				{
					SBCharacter* c1 = dynamic_cast<SBCharacter*>(g1->getAttachObj());
					SBCharacter* c2 = dynamic_cast<SBCharacter*>(g2->getAttachObj());
					if (c1 && c2)
					{
						SBEvent* collisionEvent = eventManager->createEvent("collision",c1->getName()+"/"+c2->getName());
						eventManager->handleEvent(collisionEvent, time);
						//LOG("Collision detected between character %s and character %s",c1->getName().c_str(), c2->getName().c_str());
						delete collisionEvent; // free the memory

						// collision resolution
						if (collisionResMethod == "default")
						{						
							SrVec v1 = _velocities[c1->getName()];
							v1[1] = 0.0;
							SrVec v2 = _velocities[c2->getName()];
							v2[1] = 0.0;
							//LOG("v1 len = %f, v2 len = %f",v1.len(),v2.len());
							SBCharacter* cMove = (v1.len() > v2.len()) ? c1 : c2;				
							SBGeomContact& contact = contactPts[0];
							SrVec normalDir = (v1.len() > v2.len()) ? contact.contactNormal : -contact.contactNormal;
							normalDir[1] = 0.0;

							SrVec newPos = cMove->getPosition() + normalDir*contact.penetrationDepth;
							cMove->setPosition(newPos);
						}
						else if (collisionResMethod == "none")
						{
							// no collision resolution
						}
						else
						{
							// default ? 
						}					
					}
					needMoreIterations = true;
				}
				else 
				{
					// character joint <==> character joint (capsule) collision only
					//bool createEvent = true;
					//std::string obj1, obj2;
					//SBJoint* j1 = dynamic_cast<SBJoint*>(g1->getAttachObj());
					//if(j1) obj1 = j1->getName();
					//else
					//{
					//	SBCharacter* c1 = dynamic_cast<SBCharacter*>(g1->getAttachObj());
					//	if(c1) obj1 = c1->getName();
					//	else
					//		createEvent = false;
					//}
					//SBJoint* j2 = dynamic_cast<SBJoint*>(g2->getAttachObj());
					//if(j2) obj2 = j2->getName();
					//else
					//{
					//	SBCharacter* c2 = dynamic_cast<SBCharacter*>(g2->getAttachObj());
					//	if(c2) obj2 = c2->getName();
					//	else
					//		createEvent = false;
					//}
					//if(createEvent)
					//{
					//	Event* collisionEvent = eventManager->createEvent("collision",obj1+"/"+obj2);
					//	eventManager->handleEvent(collisionEvent, time);
					//	LOG("Collision detected between %s and %s", obj1.c_str(), obj2.c_str());
					//	delete collisionEvent; // free the memory
					//}

					const std::string& obj1 = potentialCollisions[i].first;
					const std::string& obj2 = potentialCollisions[i].second;

					//LOG("Collision detected between %s and %s", obj1.c_str(), obj2.c_str());

					SBEvent* collisionEvent = eventManager->createEvent("collision",obj1+"/"+obj2);
					eventManager->handleEvent(collisionEvent, time);
					delete collisionEvent; // free the memory
				}
			}
		}
		curIteration++;
	}

		

#if 0
		for (std::vector<std::string>::iterator iter = characters.begin();
			 iter != characters.end();
			 iter++)
		{
			SBCharacter* character1 =  scene->getCharacter((*iter));
			SrVec position1 = character1->getPosition();
			position1[1] = 0.0;
			
			for (std::vector<std::string>::iterator iter2 = iter + 1;
			 iter2 != characters.end();
			 iter2++)
			{
				SBCharacter* character2 =  scene->getCharacter((*iter2));
				// determine if the two characters are in collision
				std::vector<SBGeomContact> contactPts;
				SBCollisionUtil::collisionDetection(character1->getGeomObject(),character2->getGeomObject(),contactPts);
				
				if (contactPts.size() > 0)
				{
					//LOG("Collision between character %s and character %s",character1->getName().c_str(), character2->getName().c_str());

				}

				
				SrVec position2 = character2->getPosition();
				position2[1] = 0.0;
				float distance = dist(position1, position2);
				if (distance < _characterRadius * 2)
				{
					float penetration = _characterRadius * 2 - distance;
					needMoreIterations = true;
					curIteration++;
					// collision resolution
					// who is moving faster?
					SrVec& velocity1 = _velocities[(*iter)];
					SrVec& velocity2 = _velocities[(*iter2)];
					float magnitude1 = velocity1.len();
					float magnitude2 = velocity2.len();
					// move the object with greater velocity
					if (magnitude1 > magnitude2)
					{
						SrVec diff = position1 - position2;
						diff.normalize();
						// move character1 in that direction
						position1 += diff * penetration;
						_positions[(*iter)] = position1;
						SrVec curPosition = character1->getPosition();
						curPosition.x = position1[0];
						curPosition.z = position1[2];
						character1->setPosition(curPosition);
					}
					else
					{
						SrVec diff = position2 - position1;
						diff.normalize();
						// move character1 in that direction
						position2 += diff * penetration;
						_positions[(*iter2)] = position2;
						SrVec curPosition = character2->getPosition();
						curPosition.x = position2[0];
						curPosition.z = position2[2];
						character2->setPosition(curPosition);
					}
				}				
				
			}			
		}
#endif
	

}