|
@@ -26,7 +26,11 @@ RoadEditDialog::RoadEditDialog(OpenDrive * pxodr,QWidget *parent) :
|
|
|
|
|
|
painter->end();
|
|
|
|
|
|
- scene = new QGraphicsScene;
|
|
|
+// scene = new QGraphicsScene;
|
|
|
+
|
|
|
+ scene = new QGraphicsScene(-VIEW_WIDTH/2, -VIEW_HEIGHT/2, VIEW_WIDTH, VIEW_HEIGHT);
|
|
|
+ myview->setScene(scene);
|
|
|
+ scene->setBackgroundBrush(Qt::darkGreen);
|
|
|
|
|
|
ui->comboBox_geotype->addItem("Line");
|
|
|
ui->comboBox_geotype->addItem("Spiral");
|
|
@@ -284,6 +288,9 @@ void RoadEditDialog::ExecPainter()
|
|
|
|
|
|
void RoadEditDialog::paintEvent(QPaintEvent * painter)
|
|
|
{
|
|
|
+
|
|
|
+ scene->update();
|
|
|
+ return;
|
|
|
if(mpCurRoad != 0)
|
|
|
{
|
|
|
ExecPainter();
|
|
@@ -310,13 +317,58 @@ void RoadEditDialog::on_comboBox_Road_currentIndexChanged(int index)
|
|
|
|
|
|
mpCurRoad = pRoad;
|
|
|
|
|
|
+ int i;
|
|
|
+ int nsize = mvectorroadview.size();
|
|
|
+ for(i=0;i<nsize;i++)
|
|
|
+ {
|
|
|
+ scene->removeItem(mvectorroadview.at(i));
|
|
|
+ delete mvectorroadview.at(i);
|
|
|
+ }
|
|
|
+ mvectorroadview.clear();
|
|
|
+
|
|
|
+
|
|
|
+ double froad_xmin,froad_ymin,froad_xmax,froad_ymax;
|
|
|
+ ServiceXODRTool.GetRoadMaxMin(pRoad,froad_xmin,froad_ymin,froad_xmax,froad_ymax);
|
|
|
+ roadviewitem * prvw = new roadviewitem(pRoad);
|
|
|
+
|
|
|
+ int nfac;
|
|
|
+ int nkeep = 30;
|
|
|
+ double fac_x,fac_y;
|
|
|
+ fac_x = 100000;
|
|
|
+ fac_y = 100000;
|
|
|
+ if(froad_xmax > froad_xmin)
|
|
|
+ {
|
|
|
+ fac_x = (VIEW_WIDTH-nkeep*2)/(froad_xmax - froad_xmin);
|
|
|
+ }
|
|
|
+
|
|
|
+ if(froad_ymax > froad_ymin)
|
|
|
+ {
|
|
|
+ fac_y = (VIEW_HEIGHT - nkeep*2)/(froad_ymax - froad_ymin);
|
|
|
+ }
|
|
|
+
|
|
|
+ nfac = fac_x;
|
|
|
+ if(fac_y < nfac)nfac = fac_y;
|
|
|
+
|
|
|
+
|
|
|
+ mfViewMoveX = VIEW_WIDTH/2.0 ;
|
|
|
+ mfViewMoveY = VIEW_HEIGHT/2.0;
|
|
|
+
|
|
|
+ mfViewMoveX = 0 - froad_xmin - (froad_xmax - froad_xmin)/2.0;
|
|
|
+ mfViewMoveY = 0 + froad_ymin + (froad_ymax-froad_ymin)/2.0;
|
|
|
+
|
|
|
+ prvw->setPos(mfViewMoveX,mfViewMoveY);
|
|
|
+ // prvw->setPos((froad_xmax - froad_xmin)/2.0, (froad_ymax-froad_ymin)/2.0);
|
|
|
+ mvectorroadview.push_back(prvw);
|
|
|
+ prvw->setratio(1.0);
|
|
|
+ scene->addItem(prvw);
|
|
|
+
|
|
|
mnSelGeo = -1;
|
|
|
|
|
|
ui->lineEdit_roadlen->setText(QString::number(pRoad->GetRoadLength()));
|
|
|
|
|
|
ui->comboBox_Geo->clear();
|
|
|
- int nsize = pRoad->GetGeometryBlockCount();
|
|
|
- int i;
|
|
|
+ nsize = pRoad->GetGeometryBlockCount();
|
|
|
+// int i;
|
|
|
for(i=0;i<nsize;i++)
|
|
|
{
|
|
|
ui->comboBox_Geo->addItem(QString("Geo ")+QString::number(i));
|
|
@@ -330,6 +382,7 @@ void RoadEditDialog::on_comboBox_Geo_currentIndexChanged(int index)
|
|
|
if(mpCurRoad == 0 )return;
|
|
|
if(index<0)return;
|
|
|
mnSelGeo = index;
|
|
|
+
|
|
|
if(index>= mpCurRoad->GetGeometryBlockCount())return;
|
|
|
GeometryBlock * pgb = mpCurRoad->GetGeometryBlock(index);
|
|
|
RoadGeometry * pg = pgb->GetGeometryAt(0);
|