TrafficMap::TrafficMap(int width,int height):
	width_(width),
	height_(height),
	enable_reservations_(true){
		weight_map_.resize(width_ * height_);
		populateMap();
}
Example #2
0
void CellAuto::generate(std::string wall, std::string ground)
{
	
	INFO("Generating new CellAuto");
	std::vector< std::vector<bool> > map;
	populateMap(map);

	// Apply rules
	for (int i = 0; i < options.iterations; i++)
	{
		map = step(map);
	}

	//Convert to tiles
	TILEGRID returnMap;
	tiles.resize(_width, std::vector<Tile*>(_height));

	for (int x = 0; x < _width; x++)
	{
		for (int y = 0; y < _height; y++)
		{
			tiles[x][y] = map[x][y] ? new Tile(ground,wall) : new Tile(ground);
		}
	}

	INFO("Generated CellAuto Map!");
}
bool SToplex<C,PS,BT>::makeCellComplex(const vector<Simplex<C,PS,BT>*>& topsimps, MComplex<C,BT>& simpcomp, bool inheritBirths = true)
{
	int topd = populateMap(topsimps, inheritBirths);
	if (topd < 0) return false;
	simpcomp.Init();
	writeComplex(simpcomp); // make cell complex!
	return true;
}
/*!
    \internal
*/
void QDeclarativeGeoMap::componentComplete()
{
    QLOC_TRACE0;

    componentCompleted_ = true;
    populateMap();
    QQuickItem::componentComplete();
}
int main() {
	std::map<std::string, std::string> disneyMap;
	populateMap(disneyMap);
	printFriend("Buzz", disneyMap);
	printFriend("Lady", disneyMap);
	printFriend("Simba", disneyMap);
	printFriend("Gaston", disneyMap);
	printFriend("Belle", disneyMap);

}
Example #6
0
//https://github.com/KHEngineering/SmoothPathPlanner
planner::planner(QWidget *parent) :
    QMainWindow(parent),
    ui(new Ui::planner)
{
    ui->setupUi(this);
    graphInit();
    resolution=0.2; //map resolution
    interval=1;

    plan=new path;

    populateMap();
}
Example #7
0
int main()
{
    std::string make = "\0";
    // Call chplenv.py and collect output into string
    std::string command = "python chplenv.py 2>&1";
    std::string output = exec(command);

    // Parse output of chplenv.py and populate map with env vars
    std::map<std::string, const char*> env = populateMap(output);

    // Iterate over and print key/value pairs in map out for proof that it worked!
    for( std::map<std::string, const char*>::iterator ii=env.begin(); ii!=env.end(); ++ii)
    {
        make = (*ii).first;
        make.insert(5, "MAKE_");
        //std::cout << (*ii).first << ": " << (*ii).second << std::endl;
        std::cout << make << ": " << (*ii).second << std::endl;
    }

    return 0;
}
/*!
    \internal
*/
void QDeclarativeGeoMap::componentComplete()
{
    m_componentCompleted = true;
    populateMap();
    QQuickItem::componentComplete();
}
void QDeclarativeGraphicsGeoMap::setPlugin(QDeclarativeGeoServiceProvider *plugin)
{
    if (plugin_) {
        qmlInfo(this) << tr("Plugin is a write-once property, and cannot be set again.");
        return;
    }

    plugin_ = plugin;

    emit pluginChanged(plugin_);

    serviceProvider_ = new QGeoServiceProvider(plugin_->name(),
            plugin_->parameterMap());

    if (serviceProvider_->error() != QGeoServiceProvider::NoError) {
        qWarning() << serviceProvider_->errorString();
        delete serviceProvider_;
        serviceProvider_ = 0;
        return;
    }

    mappingManager_ = serviceProvider_->mappingManager();
    if (!mappingManager_ || serviceProvider_->error() != QGeoServiceProvider::NoError) {
        qWarning() << serviceProvider_->errorString();
        delete serviceProvider_;
        serviceProvider_ = 0;
        delete mappingManager_;
        mappingManager_ = 0;
        return;
    }

    mapData_ = mappingManager_->createMapData();
    mapData_->init();
    //mapData_->setParentItem(this);

    // setters
    mapData_->setWindowSize(size_);
    mapData_->setZoomLevel(zoomLevel_);

    if (center_)
        mapData_->setCenter(center_->coordinate());
    else
        mapData_->setCenter(*initialCoordinate);

    mapData_->setMapType(QGraphicsGeoMap::MapType(mapType_));
    mapData_->setConnectivityMode(QGraphicsGeoMap::ConnectivityMode(connectivityMode_));

    // Populate the map objects.
    populateMap();
    // setup signals
    connect(mapData_,
            SIGNAL(updateMapDisplay(QRectF)),
            this,
            SLOT(updateMapDisplay(QRectF)));

    connect(mapData_,
            SIGNAL(centerChanged(QGeoCoordinate)),
            this,
            SLOT(internalCenterChanged(QGeoCoordinate)));

    connect(mapData_,
            SIGNAL(mapTypeChanged(QGraphicsGeoMap::MapType)),
            this,
            SLOT(internalMapTypeChanged(QGraphicsGeoMap::MapType)));

    connect(mapData_,
            SIGNAL(connectivityModeChanged(QGraphicsGeoMap::ConnectivityMode)),
            this,
            SLOT(internalConnectivityModeChanged(QGraphicsGeoMap::ConnectivityMode)));

    connect(mapData_,
            SIGNAL(windowSizeChanged(QSizeF)),
            this,
            SIGNAL(sizeChanged(QSizeF)));

    connect(mapData_,
            SIGNAL(zoomLevelChanged(qreal)),
            this,
            SIGNAL(zoomLevelChanged(qreal)));
}
// todo: mixture of mapviews and mapobjects does not preserve the order (z).
// to be addressed when merged with other changes
void QDeclarativeGraphicsGeoMap::componentComplete()
{
    componentCompleted_ = true;
    QDeclarativeItem::componentComplete();
    populateMap();
}