LoadPointLineGeometry::LoadPointLineGeometry() : Module(0, 0)
{
  // Suppress calls of handleNotification on field changes to
  // avoid side effects during initialization phase.
  handleNotificationOff();

  // Add output field
  (_outPositionsListFld         = addBase("outPositionsList"))->setBaseValueAndAddAllowedType(&_outPositionsList);
  (_outConnectionsListFld       = addBase("outConnectionsList"))->setBaseValueAndAddAllowedType(&_outConnectionsList);
  (_outFibersFld                = addBase("outFibers"))->setBaseValueAndAddAllowedType(&_outFiberSetContainer);
  (_outCachedPositionsListFld   = addBase("outCachedPositionsList"))->setBaseValueAndAddAllowedType(&_outCachedPositionsList);
  (_outCachedConnectionsListFld = addBase("outCachedConnectionsList"))->setBaseValueAndAddAllowedType(&_outCachedConnectionsList);

  // Add parameter fields
   _filenameFld = addString("filename","");
   _filterFld   = addString("filter","");

   _numberDelimiterFld      = addString("numberDelimiter",  ";");
   _numberDelimiterSpaceFld = addBool("numberDelimiterSpace",  true);
   _decimalSeparatorFld     = addString("decimalSeparator", ".");

   _loadFld     = addNotify("load");
   _unloadFld   = addNotify("unload");
   _autoLoadFld = addBool("autoLoad", false);

   _positionsLoadedFld   = addBool("positionsLoaded", false);
   _connectionsLoadedFld = addBool("connectionsLoaded", false);

   _addToCacheFld     = addNotify("addToCache");
   _clearCacheFld     = addNotify("clearCache");
   _autoAddToCacheFld = addBool("autoAddToCache", false);

  // Reactivate calls of handleNotification on field changes.
  handleNotificationOn();
}
예제 #2
0
GraphToFibers::GraphToFibers() : Module(0, 0)
{
  // Suppress calls of handleNotification on field changes to
  // avoid side effects during initialization phase.
  handleNotificationOff();

  // Add fields to the module and set their values.
  (_inGraphFld   = addBase("inGraph"))->setBaseValueAndAddAllowedType(&_inGraph);
  (_outNodePositionsFld = addBase("outNodePositions"))->setBaseValueAndAddAllowedType(&_outNodePositions);
  (_outEdgePositionsFld = addBase("outEdgePositions"))->setBaseValueAndAddAllowedType(&_outEdgePositions);
  (_outEdgeConnectionsFld = addBase("outEdgeConnections"))->setBaseValueAndAddAllowedType(&_outEdgeConnections);
  (_outFibersFld = addBase("outFibers"))->setBaseValueAndAddAllowedType(&_outFiberSetContainer);

  // Reactivate calls of handleNotification on field changes.
  handleNotificationOn();


  // Activate inplace data buffers for output outputIndex and input inputIndex.
  // setOutputImageInplace(outputIndex, inputIndex);

  // Activate page data bypass from input inputIndex to output outputIndex.
  // Note that the module must still be able to calculate the output image.
  // setBypass(outputIndex, inputIndex);

}
DicomSurfaceSegmentationLoad::DicomSurfaceSegmentationLoad(std::string type) : WEMGenerator(type)
{
	//Suppress calls of handleNotification on field changes to
	//avoid side effects during initialization phase.
	handleNotificationOff();

	// Init globals
	_datasetPointer.reset();

	// Output fields 
	(_outPointSetPositionsFld  = addBase("outPointSetPositions"))  ->setBaseValueAndAddAllowedType(&_outPointSetPositions);
	(_outLineSetPositionsFld   = addBase("outLineSetPositions"))   ->setBaseValueAndAddAllowedType(&_outLineSetPositions);
	//(_outLineSetConnectionsFld = addBase("outLineSetConnections")) ->setBaseValueAndAddAllowedType(&_outLineSetConnections);

  // UI fields
	_filenameFld    = addString("filename", "");
	_unloadFld      = addNotify("unload");
  _outputValidFld = addBool("outputValid", false);

	_numPointSetsFld      = addInt("numPointSets", 0);
	_numLineSetsFld       = addInt("numLineSets", 0);
	_numMeshesFld         = addInt("numMeshes", 0);
	_numUnknownObjectsFld = addInt("numUnknownObjects", 0);

	_pointSetsInfoFld      = addString("pointSetsInfo", POINTSETINFOCOLUMNS);
	_lineSetsInfoFld       = addString("lineSetsInfo", LINESETINFOCOLUMNS);
	_meshesInfoFld         = addString("meshesInfo", MESHINFOCOLUMNS);
	_unknownObjectsInfoFld = addString("unknownObjectsInfo", UNKNOWNOBJECTINFOCOLUMNS);

  _pointSetsExportMarkerTypeStartValueFld = addInt("pointSetsExportMarkerTypeStartValue", 1);
  _lineSetsExportMarkerTypeStartValueFld  = addInt("lineSetsExportMarkerTypeStartValue", 1);
  _meshesIDStartValueFld                  = addInt("meshesIDStartValueFld", 1);

  _allDicomTagsFld = addString("allDicomTags", "");

  _tagName0Fld = addString("tagName0", "");
  _tagName1Fld = addString("tagName1", "");
  _tagName2Fld = addString("tagName2", "");
  _tagName3Fld = addString("tagName3", "");
  _tagName4Fld = addString("tagName4", "");
  _tagName5Fld = addString("tagName5", "");
  _tagName6Fld = addString("tagName6", "");
  _tagName7Fld = addString("tagName7", "");
  _tagName8Fld = addString("tagName8", "");
  _tagName9Fld = addString("tagName9", "");

  _tagValue0Fld = addString("tagValue0", "");
  _tagValue1Fld = addString("tagValue1", "");
  _tagValue2Fld = addString("tagValue2", "");
  _tagValue3Fld = addString("tagValue3", "");
  _tagValue4Fld = addString("tagValue4", "");
  _tagValue5Fld = addString("tagValue5", "");
  _tagValue6Fld = addString("tagValue6", "");
  _tagValue7Fld = addString("tagValue7", "");
  _tagValue8Fld = addString("tagValue8", "");
  _tagValue9Fld = addString("tagValue9", "");

	//Reactivate calls of handleNotification on field changes
	handleNotificationOn();
}
예제 #4
0
파일: treemodel.cpp 프로젝트: ahmidou/aphid
void TreeModel::addLights(QList<TreeItem*> & parents)
{
	addBase(parents, "lights", 0);
	addBase(parents, "distant_key", 1);
	addFltAttr(parents, "intensity", 2, 1.1);
	addIntAttr(parents, "samples", 2, 3);
	addBolAttr(parents, "cast_shadow", 2, false);
	QColor col;
	col.setRgbF(1.0, 0.5, 0.4);
	addRGBAttr(parents, "light_color", 2, col);
}
예제 #5
0
void HTMLViewSourceDocument::processTagToken(const String& source, HTMLToken& token)
{
    m_current = addSpanWithClassName("webkit-html-tag");

    AtomicString tagName(token.name().data(), token.name().size());

    unsigned index = 0;
    HTMLToken::AttributeList::const_iterator iter = token.attributes().begin();
    while (index < source.length()) {
        if (iter == token.attributes().end()) {
            // We want to show the remaining characters in the token.
            index = addRange(source, index, source.length(), "");
            ASSERT(index == source.length());
            break;
        }

        AtomicString name(iter->m_name.data(), iter->m_name.size());
        String value(iter->m_value.data(), iter->m_value.size()); 

        index = addRange(source, index, iter->m_nameRange.m_start - token.startIndex(), "");
        index = addRange(source, index, iter->m_nameRange.m_end - token.startIndex(), "webkit-html-attribute-name");

        if (tagName == baseTag && name == hrefAttr)
            m_current = addBase(value);

        index = addRange(source, index, iter->m_valueRange.m_start - token.startIndex(), "");

        bool isLink = name == srcAttr || name == hrefAttr;
        index = addRange(source, index, iter->m_valueRange.m_end - token.startIndex(), "webkit-html-attribute-value", isLink, tagName == aTag);

        ++iter;
    }
    m_current = m_td;
}
ListModifyProperties::ListModifyProperties () : Engine ()
{ 
  ML_TRACE_IN("ListModifyProperties::ListModifyProperties () : Engine (), _needsCompleteRebuild(true)");
    
  handleNotificationOff();

  (_outListFld            = addBase("outList", NULL))->addAllowedType<ListBase>();
  (_inListFld             = addBase("inList", NULL))->addAllowedType<ListBase>();
  _updateFld              = addNotify("update");
  (_autoUpdateModeFld     = addEnum("updateMode", AutoUpdateModeNames, AutoUpdateModeCount))->setEnumValue(AutoUpdateModeAutoUpdate);
  _clearFld               = addNotify("clear");  

  _changeTypeValueFld     = addInt("changeTypeValue", 0);

  handleNotificationOn();
}
void BaseManager::update()
{
  for(std::set<Base*>::iterator b = this->allBases.begin(); b != this->allBases.end(); b++)
  {
    if (!(*b)->isActive())
    {
      if ((*b)->getResourceDepot() == NULL)
      {
        BWAPI::TilePosition tile = (*b)->getBaseLocation()->getTilePosition();
        std::set<BWAPI::Unit*> units = BWAPI::Broodwar->unitsOnTile(tile.x(),tile.y());
        for(std::set<BWAPI::Unit*>::iterator u = units.begin(); u != units.end(); u++)
          if ((*u)->getPlayer() == BWAPI::Broodwar->self() && (*u)->getType().isResourceDepot())
          {
            (*b)->setResourceDepot(*u);
            break;
          }
      }
      if ((*b)->getResourceDepot()!=NULL)
        if ((*b)->getResourceDepot()->isCompleted() || (*b)->getResourceDepot()->getRemainingBuildTime() < 250)
          (*b)->setActive(true);
    }
  }

  //check to see if any new base locations need to be added
  for(std::set<BWTA::BaseLocation*>::const_iterator bl = BWTA::getBaseLocations().begin(); bl != BWTA::getBaseLocations().end(); bl++)
    if (location2base.find(*bl) == location2base.end())
    {
      BWAPI::TilePosition tile = (*bl)->getTilePosition();
      std::set<BWAPI::Unit*> units = BWAPI::Broodwar->unitsOnTile(tile.x(), tile.y());
      for(std::set<BWAPI::Unit*>::iterator u = units.begin(); u != units.end(); u++)
        if ((*u)->getPlayer() == BWAPI::Broodwar->self() && (*u)->getType().isResourceDepot())
          addBase(*bl);
    }
}
예제 #8
0
파일: treemodel.cpp 프로젝트: ahmidou/aphid
void TreeModel::addOptions(QList<TreeItem*> & parents)
{
	addBase(parents, "options", 0);
	addIntAttr(parents, "max_subdiv", 1, 3);
	addIntAttr(parents, "AA_samples", 1, 5);
	addIntAttr(parents, "res_x", 1, 400);
	addIntAttr(parents, "res_y", 1, 300);
}
예제 #9
0
void ComponentRepeat::notePositions(GlushkovBuildState &bs) {
    assert(m_max > 0);
    assert(m_max == NoLimit || m_max < MAX_MAX_BOUND);

    /* Note: We can construct smaller subgraphs if we're not maintaining edge
     * priorities. */

    // We create one copy only through a recursive call to notePositions(),
    // first() and last(). Then we clone its positions and store the
    // appropriate firsts and lasts values for the copies.
    posFirst = bs.getBuilder().numVertices();
    sub_comp->notePositions(bs);

    u32 copies = m_max < NoLimit ? m_max : MAX(m_min, 1);
    DEBUG_PRINTF("building %u copies of repeated region\n", copies);
    m_firsts.clear();
    m_lasts.clear();
    m_firsts.resize(copies);
    m_lasts.resize(copies);

    m_firsts[0] = sub_comp->first();
    m_lasts[0] = sub_comp->last();

    postSubNotePositionHook();

    posLast = bs.getBuilder().numVertices() - 1;
    u32 vcount = posLast + 1 - posFirst;

    // If we're making more than one copy, then our firsts and lasts must only
    // contain vertices inside [posFirst, posLast]: anything else means we have
    // an embedded anchor or otherwise weird situation.
    if (copies > 1) {
        checkPositions(m_firsts[0], bs);
        checkPositions(m_lasts[0], bs);
    }

    // Avoid enormous expansions
    if (vcount * copies > MAX_POSITIONS_EXPANDED) {
        throw ParseError("Bounded repeat is too large.");
    }

    // Add positions for the rest of the copies
    size_t copyPositions = vcount * (copies - 1);
    bs.getBuilder().makePositions(copyPositions);

    // Calculate our firsts and lasts for the copies
    for (u32 i = 1; i < copies; ++i) {
        m_firsts[i] = m_firsts[0];
        m_lasts[i] = m_lasts[0];
        u32 base = i * vcount;
        addBase(base, m_firsts[i], m_lasts[i]);
    }

    recordPosBounds(posFirst, bs.getBuilder().numVertices());
    precalc_firsts(); /* ComponentRepeat requires firsts to be calculated ahead
                       * of time and cached due to expense */
}
BWTA::BaseLocation* BaseManager::expand(BWTA::BaseLocation* location, int priority)
{
  if (location==NULL)
    return NULL;
  addBase(location);
  this->builder->buildAdditional(1,BWAPI::Broodwar->self()->getRace().getCenter(),priority,location->getTilePosition());

  if(!(location->isMineralOnly()))  
  {
    this->RefineryNeeded+=1;

    if (!(this->hasRefinery(location)))
      this->builder->buildAdditional(1,BWAPI::Broodwar->self()->getRace().getRefinery(),priority,location->getTilePosition());
  }
  return location;
}
예제 #11
0
ListInfo::ListInfo () : Engine ()
{ 
  ML_TRACE_IN("ListInfo::ListInfo () : Engine (), _needsCompleteRebuild(true)");
    
  handleNotificationOff();

  (_inListFld           = addBase("inList1", NULL))->addAllowedType<ListBase>();

  _listTypeFld          = addString("listType", "");

  _lengthFld            = addInt("listLength",0);

  _typeMinFld           = addInt("typeMinValue",0);
  _typeMaxFld           = addInt("typeMaxValue",0);
  _numDifferentTypesFld = addInt("numDifferentTypes",0);

  _boundingBoxMinFld    = addVector3("boundingBoxMin",0,0,0);
  _boundingBoxMaxFld    = addVector3("boundingBoxMax",0,0,0);

  handleNotificationOn();
}
예제 #12
0
SavePRC::SavePRC (std::string type)
  : WEMInspector(type)
{
  // Suppress calls of handleNotification on field changes to
  // avoid side effects during initialization phase.
  handleNotificationOff();

  // Add input fields to the module and set allowed types.
  (_inPointPositionsFld  = addBase("inPointPositions"))->setBaseValueAndAddAllowedType(&_inPointPositions);
  (_inLinePositionsFld   = addBase("inLinePositions"))->setBaseValueAndAddAllowedType(&_inLinePositions);
  (_inLineConnectionsFld = addBase("inLineConnections"))->setBaseValueAndAddAllowedType(&_inLineConnections);

  // Add fields for selecting simple, straightforward mode
  (_simpleModePointSetFld = addBool("simpleModePointSet"))->setBoolValue(false);
  (_simpleModeLineSetFld = addBool("simpleModeLineSet"))->setBoolValue(false);
  (_simpleModeMeshFld = addBool("simpleModeMesh"))->setBoolValue(false);

  // Add fields to the module and set their values.
  (_modelPrefixPointCloudsFld = addString("modelPrefixPointClouds"))->setStringValue("PointSet");
  (_modelPrefixLineSetsFld    = addString("modelPrefixLineSets"))->setStringValue("LineSet");
  (_modelPrefixMeshesFld      = addString("modelPrefixMeshes"))->setStringValue("Mesh");
  //(_modelPrefixGlyphsFld      = addString("modelPrefixGlyphs"))->setStringValue("Glyph");       // Not supported by Acrobat

  (_pointCloudSpecificationFld = addString("pointCloudSpecification"))->setStringValue("");
  (_lineSetSpecificationFld    = addString("lineSetSpecification"))->setStringValue("");
  (_meshSpecificationFld       = addString("meshSpecification"))->setStringValue("");
  //(_glyphSpecificationFld      = addString("glyphSpecification"))->setStringValue("");          // Not supported by Acrobat
  //(_viewsSpecificationFld      = addString("viewsSpecification"))->setStringValue("");
  //(_lightsSpecificationFld     = addString("lightsSpecification"))->setStringValue("");
  //(_metaDataSpecificationFld   = addString("metaDataSpecification"))->setStringValue("");

  //(_defaultViewNameFld     = addString("defaultViewName"))->setStringValue("DefaultView");
  //(_defaultLightNameFld    = addString("defaultLightName"))->setStringValue("DefaultAmbientLight");

  //(_defaultMaterialDiffuseColorFld  = addColor("defaultMaterialDiffuseColor"))->setVector3Value(Vector3(0.65f,0.65f,0.65f));
  //(_defaultMaterialSpecularColorFld = addColor("defaultMaterialSpecularColor"))->setVector3Value(Vector3(0.75f,0.75f,0.75f));
  //(_defaultMaterialAmbientColorFld  = addColor("defaultMaterialAmbientColor"))->setVector3Value(Vector3(0.0f,0.0f,0.0f));
  //(_defaultMaterialEmissiveColorFld = addColor("defaultMaterialEmissiveColor"))->setVector3Value(Vector3(0.0f,0.0f,0.0f));
  //(_defaultMaterialTransparencyFld  = addFloat("defaultMaterialTransparency"))->setFloatValue(0.0f);

  //(_defaultLightColorFld = addColor("defaultLightColor"))->setVector3Value(Vector3(1.0f,1.0f,1.0f));
  //(_defaultLightIntensityFld = addDouble("defaultLightIntensity"))->setDoubleValue(1.0f);

  //(_defaultBoundingBoxMetaDataFld = addBool("defaultBoundingBoxMetaData"))->setBoolValue(true);
  //(_addDefaultViewNodeFld         = addBool("addDefaultViewNode"))->setBoolValue(true);
  //(_addDefaultLightNodeFld        = addBool("addDefaultLightNode"))->setBoolValue(true);

  (_mlFileNameFld = addString("filename"))->setStringValue("");

  _mlSaveFld = addNotify("save");

  (_statusFld     = addString("status"))    ->setStringValue("Idle.");
  (_progressFld   = addProgress("progress"))->setFloatValue(0.0f);

  //-------------------------------------------------------------------
  //! Strings for enum field: specification type 
  //-------------------------------------------------------------------
  const char* const NEW_SPECIFICATION_OBJECTTYPE_STRINGS[mlPDF::NUM_OBJECTTYPES] = {
    "OBJECTTYPE_POINTCLOUD",
    "OBJECTTYPE_LINESET",
    "OBJECTTYPE_MESH",
    "OBJECTTYPE_METADATA"
  };

  //-------------------------------------------------------------------
  //! Strings for enum field: model visibility 
  //-------------------------------------------------------------------
  const char* const NEW_SPECIFICATION_MODELVISIBILITY_STRINGS[mlPDF::NUM_MODELVISIBILITY] = {
    "MODELVISIBILITY_NOTVISIBLE",
    "MODELVISIBILITY_FRONTVISIBLE",
    "MODELVISIBILITY_BACKVISIBLE",
    "MODELVISIBILITY_FRONTANDBACKVISIBLE"
  };

  //! Add fields for Specification Generator
  (_newSpecificationFld                        = addString("newSpecification"))->setStringValue("");
  (_newSpecificationSelectedTabFld             = addInt("selectedTab"))->setIntValue(0);
  (_newSpecificationOutputValidFld             = addBool("newSpecificationOutputValid"))->setBoolValue(false);
  _newSpecificationAddFld                      = addNotify("newSpecificationAdd");
  (_newSpecificationTypeFld                    = addEnum("newSpecificationType", NEW_SPECIFICATION_OBJECTTYPE_STRINGS, mlPDF::NUM_OBJECTTYPES))->setEnumValue(mlPDF::OBJECTTYPE_MESH);
  (_newSpecificationObjectNameFld              = addString("newSpecificationObjectName"))->setStringValue("");
  (_newSpecificationGroupPathFld               = addString("newSpecificationGroupPath"))->setStringValue("");
  (_newSpecificationUseDefaultColorFld         = addBool("newSpecificationUseDefaultColor"))->setBoolValue(true);
  (_newSpecificationUseDefaultSpecularColorFld = addBool("newSpecificationUseDefaultSpecularColor"))->setBoolValue(true);
  (_newSpecificationColorFld                   = addColor("newSpecificationColor"))->setVector3Value(Vector3(0.651f,0.651f,0.651f));
  (_newSpecificationColorAlphaFld              = addFloat("newSpecificationColorAlpha"))->setFloatValue(1.0f);
  (_newSpecificationSpecularColorFld           = addColor("newSpecificationSpecularColor"))->setVector3Value(Vector3(0.75f,0.75f,0.75f));
  (_newSpecificationModelVisibilityFld         = addEnum("newSpecificationModelVisibility", NEW_SPECIFICATION_MODELVISIBILITY_STRINGS, mlPDF::NUM_MODELVISIBILITY))->setEnumValue(mlPDF::MODELVISIBILITY_FRONTANDBACKVISIBLE);
  (_newSpecificationMetaDataKeyFld             = addString("newSpecificationMetaDataKey"))->setStringValue("");
  (_newSpecificationMetaDataValueFld           = addString("newSpecificationMetaDataValue"))->setStringValue("");
  (_newSpecificationWEMLabelFld                = addString("newSpecificationWEMLabel"))->setStringValue("");
  (_newSpecificationPositionTypesFld           = addString("newSpecificationPositionTypes"))->setStringValue("");
  (_newSpecificationConnectionTypesFld         = addString("newSpecificationConnectionTypes"))->setStringValue("");

  // Turn off the automatic saving on all notifications
  _listenToFinishingNotificationsFld       ->setBoolValue(false);
  _listenToRepaintNotificationsFld         ->setBoolValue(false);
  _listenToSelectionChangedNotificationsFld->setBoolValue(false);

  _autoUpdateFld->setBoolValue(false);
  _autoApplyFld->setBoolValue(false);

  // Reactivate calls of handleNotification on field changes.
  handleNotificationOn();
}
void BaseManager::expand(BWTA::BaseLocation* location)
{
  addBase(location);
  this->builder->buildAdditional(1,*BWAPI::Broodwar->self()->getRace().getCenter(),100,location->getTilePosition());
}
예제 #14
0
void BaseManager::update()
{
	for(std::set<Base*>::iterator b = this->allBases.begin(); b != this->allBases.end(); b++)
	{
		Base *base = (*b);

		// periodicky check, ci baza pouziva najblizsi resource depot
		if (BWAPI::Broodwar->getFrameCount() % 300 == 231)
		{
			BWAPI::TilePosition tilePosition = base->getBaseLocation()->getTilePosition();
			BWAPI::Position position = BWAPI::Position(tilePosition);

			UnitGroup centers = UnitGroup::getUnitGroup(BWAPI::Broodwar->getUnitsInRadius(position, 600))
			(BWAPI::Broodwar->self())
			(isResourceDepot);
			UnitGroup::iterator it;

			BWAPI::Unit *nearestCenter = NULL;
			double distance = 10000;

			for (it = centers.begin(); it != centers.end(); it++)
			{
				BWAPI::Unit *centerCandidate = (*it);
				dementor::Vector vector = dementor::Vector::fromPositions(position, centerCandidate->getPosition());

				if (vector.getLength() < distance)
				{
					nearestCenter = centerCandidate;
					distance = vector.getLength();
				}
			}

			if (nearestCenter != NULL)
			{
				base->setResourceDepot(nearestCenter);
			}

			if (base->getResourceDepot() != NULL)
			{
				if (!base->getResourceDepot()->exists())
				{
					base->setResourceDepot(NULL);
				}
				else if (base->getResourceDepot()->isCompleted() || base->getResourceDepot()->getRemainingBuildTime() < 250)
				{
					base->setActive(true);
				}
			}
		}

		//Set Refinerys
		if (!base->isActiveGas() && base->hasGas())
		{
			if (base->getRefinery() == NULL)
			{
				std::set<BWAPI::Unit*> baseGeysers = (*b)->getBaseLocation()->getGeysers();

				BWAPI::TilePosition geyserLocation;

				//cycle through geysers & get tile location
				for(std::set<BWAPI::Unit*>::iterator bg = baseGeysers.begin(); bg != baseGeysers.end(); bg++)
				{
					geyserLocation = (*bg)->getTilePosition();
				}

				//check for refinery already on geyser
				std::set<BWAPI::Unit*> unitsOnGeyser = BWAPI::Broodwar->getUnitsOnTile(geyserLocation.x(),geyserLocation.y());

				for(std::set<BWAPI::Unit*>::iterator u = unitsOnGeyser.begin(); u != unitsOnGeyser.end(); u++)
				{
					BWAPI::Unit *unit = (*u);
					if (unit->getPlayer() == BWAPI::Broodwar->self() && unit->getType().isRefinery())
					{
						base->setRefinery(*u);
						break;
					}
				}
			}

			if (base->getRefinery() != NULL)
			{
				if (!base->getRefinery()->exists())
				{
					base->setResourceDepot(NULL);
				}
				else
				{
					if (base->getRefinery()->isCompleted() || base->getRefinery()->getRemainingBuildTime() < 250)
					{
						base->setActiveGas(true);
					}
				}
			}
		}
	}

	//check to see if any new base locations need to be added
	for(std::set<BWTA::BaseLocation*>::const_iterator bl = BWTA::getBaseLocations().begin(); bl != BWTA::getBaseLocations().end(); bl++)
	{
		if (location2base.find(*bl) == location2base.end())
		{
			BWAPI::TilePosition tile = (*bl)->getTilePosition();
			std::set<BWAPI::Unit*> units = BWAPI::Broodwar->getUnitsOnTile(tile.x(), tile.y());

			for(std::set<BWAPI::Unit*>::iterator u = units.begin(); u != units.end(); u++)
			{
				if ((*u)->getPlayer() == BWAPI::Broodwar->self() && (*u)->getType().isResourceDepot())
				{
					addBase(*bl);
				}
			}
		}
	}

	if(BWAPI::Broodwar->getFrameCount() % 500 == 0 && BWAPI::Broodwar->getFrameCount() >= 3000 && refineryBuildPriority > 0)
	{
		updateRefineries();
	}
}
void BaseManager::update()
{
  for(std::set<Base*>::iterator b = this->allBases.begin(); b != this->allBases.end(); b++)
  {
    if (!(*b)->isActive())
    {
      if ((*b)->getResourceDepot() == NULL)
      {
        BWAPI::TilePosition tile = (*b)->getBaseLocation()->getTilePosition();
        std::set<BWAPI::Unit*> units = BWAPI::Broodwar->getUnitsOnTile(tile.x(),tile.y());
        for(std::set<BWAPI::Unit*>::iterator u = units.begin(); u != units.end(); u++)
          if ((*u)->getPlayer() == BWAPI::Broodwar->self() && (*u)->getType().isResourceDepot())
          {
            (*b)->setResourceDepot(*u);
            break;
          }
      }
      if ((*b)->getResourceDepot()!=NULL)
      {
        if ((*b)->getResourceDepot()->exists()==false)
          (*b)->setResourceDepot(NULL);
        else
        {
          if ((*b)->getResourceDepot()->isCompleted() || (*b)->getResourceDepot()->getRemainingBuildTime() < 250)
            (*b)->setActive(true);
        }
      }
    }

    //Set Refinerys
    if (!(*b)->isActiveGas() && (*b)->hasGas())
    {
      if ((*b)->getRefinery() == NULL)
      {
        std::set<BWAPI::Unit*> baseGeysers = (*b)->getBaseLocation()->getGeysers();

        BWAPI::TilePosition geyserLocation;

        //cycle through geysers & get tile location
        for(std::set<BWAPI::Unit*>::iterator bg = baseGeysers.begin(); bg != baseGeysers.end(); bg++)
        {
          geyserLocation = (*bg)->getTilePosition();
        }

        //check for refinery already on geyser
        std::set<BWAPI::Unit*> unitsOnGeyser = BWAPI::Broodwar->getUnitsOnTile(geyserLocation.x(),geyserLocation.y());
        
        for(std::set<BWAPI::Unit*>::iterator u = unitsOnGeyser.begin(); u != unitsOnGeyser.end(); u++)
        {
          if ((*u)->getPlayer() == BWAPI::Broodwar->self() && (*u)->getType().isRefinery())
          {
            (*b)->setRefinery(*u);
            break;
          }
        }
      }

      if ((*b)->getRefinery() != NULL)
      {
        if ((*b)->getRefinery()->exists()==false)
          (*b)->setResourceDepot(NULL);
        else
        {
          if ((*b)->getRefinery()->isCompleted() || (*b)->getRefinery()->getRemainingBuildTime() < 250)
            (*b)->setActiveGas(true);
        }
      }
    }
  }

  //check to see if any new base locations need to be added
  for(std::set<BWTA::BaseLocation*>::const_iterator bl = BWTA::getBaseLocations().begin(); bl != BWTA::getBaseLocations().end(); bl++)
  {
    if (location2base.find(*bl) == location2base.end())
    {
      BWAPI::TilePosition tile = (*bl)->getTilePosition();
      std::set<BWAPI::Unit*> units = BWAPI::Broodwar->getUnitsOnTile(tile.x(), tile.y());
      for(std::set<BWAPI::Unit*>::iterator u = units.begin(); u != units.end(); u++)
        if ((*u)->getPlayer() == BWAPI::Broodwar->self() && (*u)->getType().isResourceDepot())
          addBase(*bl);
    }
  }

  if(BWAPI::Broodwar->getFrameCount() % 500 == 0 && BWAPI::Broodwar->getFrameCount() >= 3000 && refineryBuildPriority > 0)
    updateRefineries();

  if (BWAPI::Broodwar->getFrameCount() %240 == 0 && BWAPI::Broodwar->getFrameCount() >= 5000)
  {
	  updateAddons();
	  updateDepositCenterPosition();
  }
}