export_not_work.diff

Sergey Yakushev, 2011-10-01 11:23 AM

Download (4.95 KB)

View differences:

src/analysis/network/qgsgraph.cpp
107 107
  return mOut;
108 108
}
109 109

  
110
int QgsGraphArc::in() const
111
{
112
  return mIn;
113
}
114

  
115
int QgsGraphArc::out() const
116
{
117
  return mOut;
118
}
119

  
120 110
QgsGraphVertex::QgsGraphVertex( const QgsPoint& point )
121 111
    : mCoordinate( point )
122 112
{
src/analysis/network/qgsgraph.h
18 18
 * Vertex is identified by its geographic coordinates (but you can add two vertex
19 19
 * with unique coordinate), no additional properties it can not be assigned.
20 20
 * Count the number of properties not limited along the arc. Graph may
21
 * be have incidence arcs.
21
 * be have incident arcs.
22 22
 *
23 23
 * \file qgsgraph.h
24 24
 */
......
60 60
    /**
61 61
     * return index of outgoing vertex
62 62
     */
63
    int out() const;
64 63
    int outVertex() const;
65 64

  
66 65
    /**
67 66
     * return index of incoming vertex
68 67
     */
69
    int in() const;
70 68
    int inVertex() const;
71 69

  
72 70
  private:
src/analysis/network/qgsgraphanalyzer.cpp
63 63
      const QgsGraphArc& arc = source->arc( *arcIt );
64 64
      double cost = arc.property( criterionNum ).toDouble() + curCost;
65 65

  
66
      if ( cost < result[ arc.in()].first )
66
      if ( cost < result[ arc.inVertex() ].first )
67 67
      {
68
        result[ arc.in()] = QPair< double, int >( cost, *arcIt );
69
        not_begin.insert( cost, arc.in() );
68
        result[ arc.inVertex() ] = QPair< double, int >( cost, *arcIt );
69
        not_begin.insert( cost, arc.inVertex() );
70 70
      }
71 71
    }
72 72
  }
......
90 90
      {
91 91
        const QgsGraphArc& arc = source->arc( result[i].second );
92 92

  
93
        treeResult->addArc( source2result[ arc.out()], source2result[ i ],
93
        treeResult->addArc( source2result[ arc.outVertex() ], source2result[ i ],
94 94
                            arc.properties() );
95 95
      }
96 96
    }
src/plugins/roadgraph/shortestpathwidget.cpp
324 324
    cost += e.property( 0 ).toDouble();
325 325
    time += e.property( 1 ).toDouble();
326 326

  
327
    p.push_front( path.vertex( e.in() ).point() );
327
    p.push_front( path.vertex( e.inVertex() ).point() );
328 328

  
329
    stopVertexIdx = e.out();
329
    stopVertexIdx = e.outVertex();
330 330
  }
331 331
  p.push_front( p1 );
332 332
  QList< QgsPoint>::iterator it;
......
357 357

  
358 358
void RgShortestPathWidget::exportPath()
359 359
{
360
  /*  RgExportDlg dlg( this );
361
    if ( !dlg.exec() )
362
      return;
360
  RgExportDlg dlg( this );
361
  if ( !dlg.exec() )
362
    return;
363 363

  
364
    QgsPoint p1, p2;
365
    QgsGraph path;
366
    if ( !getPath( path, p1, p2 ) )
367
      return;
364
  QgsPoint p1, p2;
365
  QgsGraph path;
366
  if ( !getPath( &path, p1, p2 ) )
367
    return;
368 368

  
369
    QgsVectorLayer *vl = dlg.mapLayer();
370
    if ( vl == NULL )
371
      return;
369
  QgsVectorLayer *vl = dlg.mapLayer();
370
  if ( vl == NULL )
371
    return;
372 372

  
373
    QgsCoordinateTransform ct( mPlugin->iface()->mapCanvas()->mapRenderer()->destinationCrs(),
373
  QgsCoordinateTransform ct( mPlugin->iface()->mapCanvas()->mapRenderer()->destinationCrs(),
374 374
                               vl->crs() );
375
  
376
  int startVertexIdx = path.findVertex( p1 );
377
  int stopVertexIdx  = path.findVertex( p2 );
378
  
379
  QgsPolyline p;
380
  while ( startVertexIdx != stopVertexIdx )
381
  {
382
    QgsGraphArcIdList l = path.vertex( stopVertexIdx ).inArc();
383
    if ( l.empty() )
384
      break;
385
    const QgsGraphArc& e = path.arc( l.front() );
386
    p.push_front( path.vertex( e.inVertex() ).point() );
387
    stopVertexIdx = e.outVertex();
388
  }
389
  p.push_front( p1 );
375 390

  
376
    while ( it != path.end() )
377
    {
378
      AdjacencyMatrixString::iterator it2 = it->second.begin();
379
      if ( it2 == it->second.end() )
380
        break;
381
      points.append( ct.transform( it2->first ) );
382
      it = path.find( it2->first );
383
    }
384

  
385
    vl->startEditing();
386
    QgsFeature f;
387
    f.setGeometry( QgsGeometry::fromPolyline( points ) );
388
    vl->addFeature( f );
389
    vl->updateExtents();
391
  vl->startEditing();
392
  QgsFeature f;
393
  f.setGeometry( QgsGeometry::fromPolyline( p ) );
394
  vl->addFeature( f );
395
  vl->updateExtents();
390 396

  
391
    mPlugin->iface()->mapCanvas()->update();
392
  */
397
  mPlugin->iface()->mapCanvas()->update();
393 398
}
394 399

  
395 400
void RgShortestPathWidget::helpRequested()