Example #1
0
RideFile*
RouteItem::ride()
{
    if (ride_ != NULL) return ride_;

    // open the ride file
    qDebug() << "path" << path;
    qDebug() << "fileName" << fileName;

    qDebug() << path << "/" << fileName;
    QFile file(path + "/" + fileName);

    ride_ = RideFileFactory::instance().openRideFile(context, file, errors_);
    if (ride_ == NULL) return NULL; // failed to read ride

    setDirty(false); // we're gonna use on-disk so by
                     // definition it is clean - but do it *after*
                     // we read the file since it will almost
                     // certainly be referenced by consuming widgets

    // stay aware of state changes to our ride
    // MainWindow saves and RideFileCommand modifies
    connect(ride_, SIGNAL(modified()), this, SLOT(modified()));
    connect(ride_, SIGNAL(saved()), this, SLOT(saved()));
    connect(ride_, SIGNAL(reverted()), this, SLOT(reverted()));

    return ride_;
}
Example #2
0
	void document::add_segment(svg::location l1, svg::location l2)
	{
		if (points_.count(l1) == 0)
			points_.insert(std::make_pair(l1, svg::point(l1)));
		if (points_.count(l2) == 0)
			points_.insert(std::make_pair(l2, svg::point(l2)));

		auto edge = std::make_shared<svg::segment>(points_.at(l1), points_.at(l2));
		edges_.push_back(edge);
		points_.at(l1).add_edge(edge);
		points_.at(l2).add_edge(edge->reverted());

	}
Example #3
0
//----------------------------------------------------------------------
// The public interface to the commands
//----------------------------------------------------------------------
RideFileCommand::RideFileCommand(RideFile *ride) : ride(ride), stackptr(0), inLUW(false), luw(NULL)
{
    connect(ride, SIGNAL(saved()), this, SLOT(clearHistory()));
    connect(ride, SIGNAL(reverted()), this, SLOT(clearHistory()));
}