Esempio n. 1
0
void
ElevationSettings::updateHeight()
{
    ElevationMoveHandle *elevationMoveHandle = getFirstSelectedMoveHandle();

    if (elevationMoveHandle)
    {
        ElevationSection *elevationSection = elevationMoveHandle->getLowSlot();

        if (elevationSection)
        {
            double h = elevationSection->getElevation(elevationSection->getSEnd());
            ui->heightBox->setValue(h);
        }

        elevationSection = elevationMoveHandle->getHighSlot();
        if (elevationSection)
        {
            double h = elevationSection->getElevation(elevationSection->getSStart());
            ui->heightBox->setValue(h);
        }

        if (getProjectSettings()->getProjectWidget()->getProfileGraph()->getScene()->selectedItems().count() <= 1)
        {
            enableElevationSettingParams(true);
        }

        return;
    }

    enableElevationSettingParams(false);
}
Esempio n. 2
0
LaneWidthMoveHandle *
LaneSettings::getFirstSelectedLaneWidthHandle()
{
    QList<QGraphicsItem *> selectList = getProjectSettings()->getProjectWidget()->getHeightGraph()->getScene()->selectedItems();

    foreach (QGraphicsItem *item, selectList)
    {
        LaneWidthMoveHandle *laneWidthMoveHandle = dynamic_cast<LaneWidthMoveHandle *>(item);
        if (laneWidthMoveHandle)
        {
            return laneWidthMoveHandle;
        }
    }
Esempio n. 3
0
ElevationMoveHandle *
ElevationSettings::
    getFirstSelectedMoveHandle()
{
    QList<QGraphicsItem *> selectList = getProjectSettings()->getProjectWidget()->getProfileGraph()->getScene()->selectedItems();

    foreach (QGraphicsItem *item, selectList)
    {
        ElevationMoveHandle *elevationMoveHandle = dynamic_cast<ElevationMoveHandle *>(item);
        if (elevationMoveHandle)
        {
            return elevationMoveHandle;
        }
    }
Esempio n. 4
0
void
TrackComponentSettings::on_factorBox_editingFinished()
{
    if (!sparcs_)
    {
        return;
    }
    double newValue = ui->factorBox->value();
    if (newValue != sparcs_->getFactor())
    {
        SetSpArcSFactorCommand *command = new SetSpArcSFactorCommand(sparcs_, newValue, NULL);
        getProjectSettings()->executeCommand(command);
    }
}
Esempio n. 5
0
void
	ObjectSettings::updateS(double s)
{

	MoveRoadSectionCommand *moveSectionCommand = new MoveRoadSectionCommand(object_, s, RSystemElementRoad::DRS_ObjectSection);
	if (moveSectionCommand->isValid())
	{
		getProjectData()->getUndoStack()->beginMacro(QObject::tr("Change Start Values"));
		getProjectSettings()->executeCommand(moveSectionCommand);

		SetObjectPropertiesCommand *setPropertiesCommand = new SetObjectPropertiesCommand(object_, object_->getId(), object_->getName(), object_->getType(), object_->getT(), object_->getzOffset(), object_->getValidLength(), object_->getOrientation(), object_->getLength(), object_->getWidth(), object_->getRadius(), object_->getHeight(), object_->getHeading(), object_->getPitch(), object_->getRoll(), object_->getPole(), object_->getSStart(), object_->getRepeatLength(), object_->getRepeatDistance(), object_->getTextureFileName());
		getProjectSettings()->executeCommand(setPropertiesCommand);

		getProjectData()->getUndoStack()->endMacro();
	}

	valueChanged_ = false;

	QWidget * focusWidget = QApplication::focusWidget();
	if (focusWidget)
	{
		focusWidget->clearFocus();
	}
}
Esempio n. 6
0
void
SignalSettings::on_sSpinBox_editingFinished()
{
    if (valueChanged_)
    {

        MoveRoadSectionCommand *command = new MoveRoadSectionCommand(signal_, ui->sSpinBox->value(), RSystemElementRoad::DRS_SignalSection);
        getProjectSettings()->executeCommand(command);

        valueChanged_ = false;
        QWidget * focusWidget = QApplication::focusWidget();
        if (focusWidget)
        {
            focusWidget->clearFocus();
        }
    }

}
Esempio n. 7
0
RoadSettings::RoadSettings(ProjectSettings *projectSettings, SettingsElement *parentSettingsElement, RSystemElementRoad *road)
    : SettingsElement(projectSettings, parentSettingsElement, road)
    , ui(new Ui::RoadSettings)
    , road_(road)
    , init_(false)
{
    prototypeManager_ = getProjectSettings()->getProjectWidget()->getMainWindow()->getPrototypeManager();

    ui->setupUi(this);
    addLaneSectionPrototypes();

    // Initial Values //
    //
    updateProperties();
    updateRoadLinks();
    //	updateSectionCount();

    connect(ui->nameBox, SIGNAL(editingFinished()), this, SLOT(on_editingFinished()));
    init_ = true;
}
Esempio n. 8
0
void
ObjectSettings::onEditingFinished()
{
    if (valueChanged_)
    {
        QString filename = ui->nameBox->text();
        QString newId = object_->getId();
        RSystemElementRoad * road = object_->getParentRoad();
        if (filename != object_->getName())
        {
            QStringList parts = object_->getId().split("_");

            if (parts.size() > 2)
            {
                newId = QString("%1_%2_%3").arg(parts.at(0)).arg(parts.at(1)).arg(filename); 
            }
            else
            {
                newId = road->getRoadSystem()->getUniqueId(object_->getId(), filename);
            }
        }

        double repeatLength = ui->repeatLengthSpinBox->value();
        if (repeatLength > road->getLength() - ui->repeatSSpinBox->value())
        {
            repeatLength = road->getLength() - ui->repeatSSpinBox->value();
        }

        SetObjectPropertiesCommand *command = new SetObjectPropertiesCommand(object_, newId, filename, ui->typeBox->text(), ui->tSpinBox->value(), ui->zOffsetSpinBox->value(),
            ui->validLengthSpinBox->value(), (Object::ObjectOrientation)ui->orientationComboBox->currentIndex(), ui->lengthSpinBox->value(), ui->widthSpinBox->value(), ui->radiusSpinBox->value(), ui->heightSpinBox->value(), ui->hdgSpinBox->value(),
            ui->pitchSpinBox->value(), ui->rollSpinBox->value(), ui->poleCheckBox->isChecked(), ui->repeatSSpinBox->value(), repeatLength, ui->repeatDistanceSpinBox->value(), ui->textureLineEdit->text());
        getProjectSettings()->executeCommand(command);

        valueChanged_ = false;
        QWidget * focusWidget = QApplication::focusWidget();
        if (focusWidget)
        {
            focusWidget->clearFocus();
        }
    }
}
Esempio n. 9
0
void
SignalSettings::onNameBoxEditingFinished()
{
    QString filename = ui->nameBox->text();

    if (filename != signal_->getName())
    {
        QString newId;
        QStringList parts = signal_->getId().split("_");

        if (parts.size() > 2)
        {
            newId = QString("%1_%2_%3").arg(parts.at(0)).arg(parts.at(1)).arg(filename); 
        }
        else
        {
            newId = signal_->getParentRoad()->getRoadSystem()->getUniqueId(signal_->getId(), filename);
        }
        SetSignalPropertiesCommand *command = new SetSignalPropertiesCommand(signal_, newId, filename, signal_->getProperties(), signal_->getValidity(), signal_->getSignalUserData(), NULL);
        getProjectSettings()->executeCommand(command);
    }
}
Esempio n. 10
0
void
RoadSettings::on_editingFinished()
{
    QString filename = ui->nameBox->text();
    if (filename != road_->getName())
    {
        QString newId;
        QStringList parts = road_->getID().split("_");

        if (parts.size() > 2)
        {
            newId = QString("%1_%2_%3").arg(parts.at(0)).arg(parts.at(1)).arg(filename); 
        }
        else
        {
            newId = road_->getRoadSystem()->getUniqueId(road_->getID(), filename);
        }
        SetRSystemElementIdCommand *command = new SetRSystemElementIdCommand(road_->getRoadSystem(), road_, newId, filename, NULL);
        getProjectSettings()->executeCommand(command);
    }

 
}
Esempio n. 11
0
SignalSettings::SignalSettings(ProjectSettings *projectSettings, SettingsElement *parentSettingsElement, Signal *signal)
    : SettingsElement(projectSettings, parentSettingsElement, signal)
    , ui(new Ui::SignalSettings)
    , signal_(signal)
    , init_(false)
    , valueChanged_(false)
{
    signalManager_ = getProjectSettings()->getProjectWidget()->getMainWindow()->getSignalManager();
	signalEditor_ = dynamic_cast <SignalEditor *> (getProjectSettings()->getProjectWidget()->getProjectEditor());
    ui->setupUi(this);


    // Initial Values //
    //
    updateProperties();

    connect(ui->sSpinBox, SIGNAL(editingFinished()), this, SLOT(on_sSpinBox_editingFinished()));
    connect(ui->sSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->nameBox, SIGNAL(editingFinished()), this, SLOT(onNameBoxEditingFinished()));
    connect(ui->tSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->tSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->zOffsetSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->zOffsetSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->countryBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->countryBox, SIGNAL(textChanged(const QString&)), this, SLOT(onValueChanged()));

    connect(ui->typeSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->typeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onValueChanged()));
    connect(ui->subclassLineEdit, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->subclassLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(onValueChanged()));
    connect(ui->subtypeSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->subtypeSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onValueChanged()));
    connect(ui->valueSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->valueSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->hOffsetSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->hOffsetSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->pitchSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->pitchSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->rollSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->rollSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->dynamicCheckBox, SIGNAL(stateChanged(int)), this, SLOT(onEditingFinished(int)));
    connect(ui->orientationComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onEditingFinished(int)));
    connect(ui->poleCheckBox, SIGNAL(stateChanged(int)), this, SLOT(onEditingFinished(int)));
    connect(ui->sizeComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onEditingFinished(int)));

    connect(ui->fromLaneSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->fromLaneSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onValueChanged()));
    connect(ui->toLaneSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->toLaneSpinBox, SIGNAL(valueChanged(int)), this, SLOT(onValueChanged()));

    //Pedestrian Crossing has ancillary data
    //
    if (signal_->getType() == 293)
    {

        enableCrossingParams(true);

        connect(ui->crossingSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
        connect(ui->crossingSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
        connect(ui->resetTimeSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
        connect(ui->resetTimeSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    }
Esempio n. 12
0
ObjectSettings::ObjectSettings(ProjectSettings *projectSettings, SettingsElement *parentSettingsElement, Object *object)
    : SettingsElement(projectSettings, parentSettingsElement, object)
    , ui(new Ui::ObjectSettings)
    , object_(object)
    , init_(false)
    , valueChanged_(false)
{
    objectManager_ = getProjectSettings()->getProjectWidget()->getMainWindow()->getSignalManager();
    ui->setupUi(this);

	// TreeWidget for repeat parameters //
	//
/*	QList<QTreeWidgetItem *> itemList = ui->repeatTreeWidget->findItems("repeat", Qt::MatchExactly);
	QTreeWidgetItem *repeatItem = itemList.first();
	QTreeWidgetItem *layoutItem = new QTreeWidgetItem(repeatItem);
	ui->repeatTreeWidget->setItemWidget(layoutItem, 0, ui->repeatWidget);*/

    // Initial Values //
    //
    updateProperties();
	activateRepeatWidget(false);

    connect(ui->sSpinBox, SIGNAL(editingFinished()), this, SLOT(on_sSpinBox_editingFinished()));
    connect(ui->sSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->nameBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->nameBox, SIGNAL(textChanged(const QString&)), this, SLOT(onValueChanged()));
    connect(ui->tSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->tSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->zOffsetSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->zOffsetSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->typeBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->typeBox, SIGNAL(textChanged(const QString&)), this, SLOT(onValueChanged()));

    connect(ui->validLengthSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->validLengthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->lengthSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->lengthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->widthSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->widthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->heightSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->heightSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->radiusSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->radiusSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->hdgSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->hdgSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->pitchSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->pitchSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->rollSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->rollSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->poleCheckBox, SIGNAL(stateChanged(int)), this, SLOT(onEditingFinished(int)));
    connect(ui->orientationComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(onEditingFinished(int)));

    connect(ui->repeatSSpinBox, SIGNAL(editingFinished()), this, SLOT(on_repeatSSpinBox_editingFinished()));
    connect(ui->repeatSSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->repeatLengthSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->repeatLengthSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));
    connect(ui->repeatDistanceSpinBox, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->repeatDistanceSpinBox, SIGNAL(valueChanged(double)), this, SLOT(onValueChanged()));

    connect(ui->textureLineEdit, SIGNAL(editingFinished()), this, SLOT(onEditingFinished()));
    connect(ui->textureLineEdit, SIGNAL(textChanged(const QString&)), this, SLOT(onValueChanged()));

	connect(ui->repeatButton, SIGNAL(clicked(bool)), this, SLOT(activateRepeatWidget(bool)));

    init_ = true;
}
Esempio n. 13
0
void
SignalSettings::onEditingFinished()
{
    if (valueChanged_)
    {
		double t = ui->tSpinBox->value();
        int fromLane = ui->fromLaneSpinBox->value();
        int toLane = ui->toLaneSpinBox->value();

		if (toLane > fromLane)
        {
            toLane = fromLane;
        }

        if (signal_->getType() != 293)
        {
            if (((t < 0) && ((fromLane > 0) || (fromLane < signal_->getParentRoad()->getLaneSection(signal_->getSStart())->getRightmostLaneId()))) || ((t > 0) && ((fromLane < 0) || (fromLane > signal_->getParentRoad()->getLaneSection(signal_->getSStart())->getLeftmostLaneId()))))
            {
                fromLane = signal_->getParentRoad()->getValidLane(signal_->getSStart(), t);
            }

            if (((t < 0) && ((toLane > 0) || (toLane < signal_->getParentRoad()->getLaneSection(signal_->getSStart())->getRightmostLaneId()))) || ((t > 0) && ((toLane < 0) || (toLane > signal_->getParentRoad()->getLaneSection(signal_->getSStart())->getLeftmostLaneId()))))
            {
                toLane = signal_->getParentRoad()->getValidLane(signal_->getSStart(), t);
            }
        }
        else
        {
			if ((fromLane != signal_->getValidFromLane()) || (toLane != signal_->getValidToLane()))
			{
				if ((fromLane >= 0) && (toLane >= 0) && (t < 0))
				{
					LaneSection *laneSection = signal_->getParentRoad()->getLaneSection(signal_->getSStart());
					t = laneSection->getLaneSpanWidth(fromLane, toLane, signal_->getSStart());
				}
				else if ((fromLane <= 0) && (toLane <= 0) && (t > 0))
				{
					LaneSection *laneSection = signal_->getParentRoad()->getLaneSection(signal_->getSStart());
					t = -laneSection->getLaneSpanWidth(fromLane, toLane, signal_->getSStart());
				}
			}

            if (fromLane < signal_->getParentRoad()->getLaneSection(signal_->getSStart())->getRightmostLaneId())
            {
                fromLane = signal_->getParentRoad()->getLaneSection(signal_->getSStart())->getRightmostLaneId();
            }
            else if (fromLane > signal_->getParentRoad()->getLaneSection(signal_->getSStart())->getLeftmostLaneId())
            {
                fromLane = signal_->getParentRoad()->getLaneSection(signal_->getSStart())->getLeftmostLaneId();
            }

            if (toLane < signal_->getParentRoad()->getLaneSection(signal_->getSStart())->getRightmostLaneId())
            {
                toLane = signal_->getParentRoad()->getLaneSection(signal_->getSStart())->getRightmostLaneId();
            }
            else if (toLane > signal_->getParentRoad()->getLaneSection(signal_->getSStart())->getLeftmostLaneId())
            {
                toLane = signal_->getParentRoad()->getLaneSection(signal_->getSStart())->getLeftmostLaneId();
            }
        }


		double crossingProb = 0.0;
		double resetTime = 0.0;
		if (ui->crossingProbLabel->isEnabled())
		{
			crossingProb = ui->crossingSpinBox->value();
			resetTime = ui->resetTimeSpinBox->value();
		}

        SetSignalPropertiesCommand *command = new SetSignalPropertiesCommand(signal_, signal_->getId(), signal_->getName(), t, ui->dynamicCheckBox->isChecked(), (Signal::OrientationType)ui->orientationComboBox->currentIndex(), ui->zOffsetSpinBox->value(), ui->countryBox->text(), ui->typeSpinBox->value(), ui->subclassLineEdit->text(), ui->subtypeSpinBox->value(), ui->valueSpinBox->value(), ui->hOffsetSpinBox->value(), ui->pitchSpinBox->value(), ui->rollSpinBox->value(), ui->poleCheckBox->isChecked(), ui->sizeComboBox->currentIndex() + 1, fromLane, toLane, crossingProb, resetTime, NULL);
        getProjectSettings()->executeCommand(command);	

        valueChanged_ = false;
        QWidget * focusWidget = QApplication::focusWidget();
        if (focusWidget)
        {
            focusWidget->clearFocus();
        }
    }
}