bool QgsGeometryCollection::deleteVertex( QgsVertexId position )
{
  if ( position.part < 0 || position.part >= mGeometries.size() )
  {
    return false;
  }

  QgsAbstractGeometry *geom = mGeometries.at( position.part );
  if ( !geom )
  {
    return false;
  }

  bool success = geom->deleteVertex( position );

  //remove geometry if no vertices left
  if ( geom->isEmpty() )
  {
    removeGeometry( position.part );
  }

  if ( success )
  {
    clearCache(); //set bounding box invalid
  }
  return success;
}
Example #2
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void GeometryLayer::removeGeometry(const QString& name) {

	int c = _geometries.size();
	for (int i = c - 1; i >= 0; --i)
		if ( _geometries.at(i)->name().contains(name) )
			removeGeometry(_geometries.at(i));
}
Example #3
0
// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
void GeometryLayer::removeGeometries(const Geometry::Type& type) {

	int c = _geometries.size();
	for (int i = c - 1; i >= 0; --i)
		if ( _geometries.at(i)->type() == type )
			removeGeometry(_geometries.at(i));
}
Example #4
0
GeoTabWidget::GeoTabWidget( QWidget* parent /*= 0*/ )
	: QWidget(parent)
{
	setupUi(this);

	connect(this->openGeoPushButton, SIGNAL(clicked()), this->treeView, SLOT(addGeometry()));
	connect(this->saveGeoPushButton, SIGNAL(clicked()), this->treeView, SLOT(writeToFile()));
	connect(this->removeGeoPushButton, SIGNAL(clicked()), this->treeView, SLOT(removeGeometry()));
	connect(this->treeView, SIGNAL(enableSaveButton(bool)), this, SLOT(enableSaveButton(bool)));
	connect(this->treeView, SIGNAL(enableRemoveButton(bool)), this, SLOT(enableRemoveButton(bool)));
}
Example #5
0
void BasicOpenGLView::loadGeometry(std::string m_GeometryPath)
{
    Geometry * newGeometry = new Geometry(m_GeometryPath);
    std::string geometryName = newGeometry->getFileName();

    if(mGeometries.find(geometryName) != mGeometries.end())
    {
        removeGeometry(geometryName);
    }
    mGeometries.insert(std::make_pair(geometryName, newGeometry));

    emit addedNewGeometry(geometryName);
}
Example #6
0
MainWindow::MainWindow(QWidget *parent) :
	QMainWindow(parent)
{
	ui = new Ui::MainWindow();
	rayDialog = 0;

	animationTimer = NULL;

	ui->setupUi(this);

	// we create a simple timer, with the widget being its parent
	animationTimer = new QTimer(this);
	// the timer will send a signal timeout at regular intervals.
	// whenever this timeout signal occurs, we want it to call our drawOpenGL
	// function
	connect(animationTimer, SIGNAL(timeout()), this, SLOT(drawOpenGL()));
	// we start the timer with a timeout interval of 20ms
	animationTimer->start(20);

	connect(ui->oglwidget, SIGNAL(addedNewGeometry(std::string)), this, SLOT(newGeometryAdded(std::string)));
	connect(ui->oglwidget, SIGNAL(removedGeometry(std::string)), this, SLOT(geometryRemoved(std::string)));

	connect(ui->addModel, SIGNAL(clicked()), this, SLOT(addGeometry()));
	connect(ui->removeModel, SIGNAL(clicked()), this, SLOT(removeGeometry()));

	connect(ui->XRotSlider, SIGNAL(valueChanged(int)), this, SLOT(rotateGeometryX(int)));
	connect(ui->YRotSlider, SIGNAL(valueChanged(int)), this, SLOT(rotateGeometryY(int)));
	connect(ui->ZRotSlider, SIGNAL(valueChanged(int)), this, SLOT(rotateGeometryZ(int)));

	connect(ui->XTransSlider, SIGNAL(valueChanged(int)), this, SLOT(translateGeometryX(int)));
	connect(ui->YTransSlider, SIGNAL(valueChanged(int)), this, SLOT(translateGeometryY(int)));
	connect(ui->ZTransSlider, SIGNAL(valueChanged(int)), this, SLOT(translateGeometryZ(int)));

	connect(ui->orthoProj, SIGNAL(stateChanged(int)), this, SLOT(setOrtho(int)));
	connect(ui->postMult, SIGNAL(stateChanged(int)), this, SLOT(setPost(int)));

	connect(ui->traceButton, SIGNAL(clicked()), this, SLOT(addTraceDialog()));
}
Example #7
0
OGRErr OGRGeometryCollection::removeGeometry( int iGeom, int bDelete )

{
    if( iGeom < -1 || iGeom >= nGeomCount )
        return OGRERR_FAILURE;

    // Special case.
    if( iGeom == -1 )
    {
        while( nGeomCount > 0 )
            removeGeometry( nGeomCount-1, bDelete );
        return OGRERR_NONE;
    }

    if( bDelete )
        delete papoGeoms[iGeom];

    memmove( papoGeoms + iGeom, papoGeoms + iGeom + 1,
             sizeof(void*) * (nGeomCount-iGeom-1) );

    nGeomCount--;

    return OGRERR_NONE;
}