示例#1
0
void QgsLockedFeature::replaceVertexMap()
{
  // delete old map
  deleteVertexMap();

  // create new map
  createVertexMap();

  // validate the geometry
  validateGeometry();

  emit vertexMapChanged();
}
示例#2
0
QgsNodeEditorModel::QgsNodeEditorModel( QgsVectorLayer* layer, QgsSelectedFeature* selectedFeature, QgsMapCanvas* canvas, QObject* parent )
    : QAbstractTableModel( parent )
    , mLayer( layer )
    , mSelectedFeature( selectedFeature )
    , mCanvas( canvas )
    , mHasZ( false )
    , mHasM( false )
    , mHasR( true ) //always show for now - avoids scanning whole feature for curves TODO - avoid this
    , mZCol( -1 )
    , mMCol( -1 )
    , mRCol( -1 )
{

  if ( !mSelectedFeature->vertexMap().isEmpty() )
  {
    mHasZ = mSelectedFeature->vertexMap().at( 0 )->point().is3D();
    mHasM = mSelectedFeature->vertexMap().at( 0 )->point().isMeasure();

    if ( mHasZ )
      mZCol = 2;

    if ( mHasM )
      mMCol = 2 + ( mHasZ ? 1 : 0 );

    if ( mHasR )
      mRCol = 2 + ( mHasZ ? 1 : 0 ) + ( mHasM ? 1 : 0 );
  }

  QWidget* parentWidget = dynamic_cast< QWidget* >( parent );
  if ( parentWidget )
  {
    mWidgetFont = parentWidget->font();
  }

  connect( mSelectedFeature, SIGNAL( vertexMapChanged() ), this, SLOT( featureChanged() ) );
}