Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #18954 add&rename vector fields #8982

Merged
merged 2 commits into from Jan 31, 2019
Merged

Conversation

PeterPetrik
Copy link
Contributor

@PeterPetrik PeterPetrik commented Jan 25, 2019

Crashed QGIS when you

  • rename existing field
  • add new field with the same name as was renamed
  • apply ---->>> BOOOOM

There were 2 problems fixed

  1. QgsFields has now new rename functions (since just changing the name of qgs field does not update nameToIndex)
  2. logic in qgssourcefieldsproperties.cpp reworked a bit. Indexed Widgets must be reindexed before insertion of the new field
  3. undo/redo commands for renaming were updated to allow renaming newly added attribute in clean way

Tested with a layers with joined, virtual and "normal" fields

@PeterPetrik PeterPetrik added this to the 3.6.0 milestone Jan 25, 2019
@PeterPetrik PeterPetrik changed the title [bugfix] fix #18954 add&rename vector fields fix #18954 add&rename vector fields Jan 25, 2019
@PeterPetrik PeterPetrik added the Requires Changes! Waiting on the submitter to make requested changes label Jan 30, 2019
@PeterPetrik PeterPetrik removed the Requires Changes! Waiting on the submitter to make requested changes label Jan 30, 2019
@PeterPetrik
Copy link
Contributor Author

@wonder-sk tested with project with joined and virtual fields and now it works nicely

Copy link
Member

@wonder-sk wonder-sk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me

@PeterPetrik PeterPetrik merged commit ebcc694 into qgis:master Jan 31, 2019
PeterPetrik added a commit to PeterPetrik/QGIS that referenced this pull request Jan 31, 2019
fix qgis#18954 add&rename vector fields at the same time

(cherry picked from commit ebcc694)
@PeterPetrik PeterPetrik deleted the fix-18954 branch January 31, 2019 08:35
PeterPetrik added a commit that referenced this pull request Jan 31, 2019
fix #18954 add&rename vector fields at the same time
roya0045 added a commit to roya0045/QGIS_1 that referenced this pull request Feb 7, 2019
* add mesh layer in app>layers>add layer

* Add JSON format in WMS parameters

* Add GetFeatureInfo in JSON for vector layers

* Add unit test

* Json exporter use the field's alias if necessary

* Add unit test for json exporter and alias

* Add unit test for getfeatureinfo with alias in json

* Export json without excluded attributes

* Add unit test for excluded attributes

* Do not add geometry if not necessary in json export

* Add unit test for with_geometry and json export

* Add unit test for GetFeatureInfo on raster layer in xml

* Add layers tag and their names in exported json

* Update testdata with layers' names

* Add unit test with multiple layers and features for json

* Add an expected file

* Add json export for raster layers

* Add unit test for raster layers and json export

* Update method's name and add doc

* Update sip

* Some cleaning

* Add QStringLiteral

* Fix comment

* Some cleaning

* Add application/geo+json format

* Add unit test for application/geo+json format

* Export aliases is an option

* Update sip

* Update expected files for unit tests

* Fix unit test

* Insensitive string comparison

* GeoServer compatibility

* Update sip

* Update tests

* Use CRS in json geometry

* Update test

* Remove left over

* Add json format in gGetCapabilities document

* Update GetCapabilities tests with new json format

* Small fix

* Update expected file

* Case insensitive

* Fix url query

* Fix unit test

* don't allow to change style of the embedded layers from the Layer
Styling panel (fix qgis#16339)

* move QgsDefaultValue to moc headers (qgis#9000)

* move QgsDefaultValue to moc headers

because it is a Q_GADGET

* sip include

* add QgsField::isDateTime (qgis#9007)

* add QgsField::isDateTime

* use QgsField::isDateTime

* rename to isDateOrTime

* Always use the same subset of field types for virtual fields

* [Minor] Reserve vector - to minimize reallocation costs

Reserving vector to save on reallocation costs, where we know the size in advance.

* [processing] avoid exception when listing DB schemas

do not fail if cert file cannot be deleted when creating GeoDB object

fixes qgis#21099

* show mesh layer icon in layer tree qgis#20722

* Partially revert ab3adc6

The deselect action applies to ALL map layers, so it should always
be enabled, even when a vector layer isn't the current selection

* [layouts] Use polyline shape instead of bounding box for selection, makes polylines selectable via single click

Fixes qgis#20940

* [processing][needs-docs] native vector split algorithm now outputs
GeoPackages instead of shapefiles (refs qgis#20557)

Also remove default output extension Processing settings as they are not
used anymore.

* [processing] show warning when file-based layer could not be loaded and dependent params updated

For algorithms with multiple parameters depending on a vector layer parameter, the code that loads the layer in the background is called repeatedly, impacting performance. A small layer cache is implemented with these changes, so the dialog only tries to load the layer once.

* declare metatype for QgsDefaultValue (qgis#9011)

* declare metatype for QgsDefaultValue

* sipify

* [wcs] improve CRS handling when parsing DescribeCoverage responce (refs qgis#21045)

* [wcs] exclude invalid CRSs from the coverage metadata

* const correctness

* [processing] handle Processing.TEMPORARY_OUTPUT in the
parameterAsString() method which is used also for folder outputs

* [processing][needs-docs] Add friendlier API for running algorithms as sub-steps
of main algorithm

Using code like:

    buffered_layer = processing.run(..., context, feedback)['OUTPUT']
    ...
    return {'OUTPUT': buffered_layer}

can cause issues if done as a sub-step of a larger processing algorithm. This
is because ownership of the generated layer is transferred to the caller
(Python) by processing.run. When the algorithm returns, Processing
attempts to move ownership of the layer from the context to the caller,
resulting in a crash.

(This is by design, because processing.run has been optimised for the
most common use case, which is one-off execution of algorithms as part
of a script, not as part of another processing algorithm. Accordingly
by design it returns layers and ownership to the caller, making things
easier for callers as they do not then have to resolve the layer reference
from the context object and handle ownership themselves)

This commit adds a new "is_child_algorithm" argument to processing.run.
For algorithms which are executed as sub-steps of a larger algorithm
is_child_algorithm should be set to True to avoid any ownership issues
with layers. E.g.

    buffered_layer = processing.run(..., context, feedback, is_child_algorithm=True)['OUTPUT']
    ...
    return {'OUTPUT': buffered_layer}

* Add method to convert QgsProcessing::SourceType to string representation

* [processing] Add API to convert a parameter definition to an equivalent
Python constructor string

* [processing] Correct parameter type for Map Layer parameters

* Fix test

* fix qgis#15984 color ramps on MacOS (qgis#9009)

fix qgis#15984 color ramps on MacOS

* fix crash when print from qgis processing algorithm while the python console is displayed

* add test for temporary directory output

* fix typo which caused issues with temporary file outputs also fix
related tests

* Use switch instead of multiple if blocks for layer type logic

* Q_FOREACH -> for

* [BUGFIX] fix qgsRound for negative numbers. Fixes qgis#20861

* Fix empty strings in proxy exclude list results in proxy being skipped for ALL hosts

Fixes qgis#20213

* New Shapefile Layer dialog: avoid warning message on user cancel

Also add better error message reporting, and deprecate horrible API.

* Fix inconsistent use of layout render context flags

* [needs-docs][layouts] Add checkbox to disable raster tiling for PDF/SVG exports

This setting, which is disabled by default and placed into an
"advanced" group on PDF/SFG export, disables the built-in
raster layer tiled rendering. While the tiling is good for
memory usage, it can cause visible "seams" in the rasters
for generated PDF/SVG files.

The setting has a tooltip warning users that disabling the
tiling results in high memory usage during exports.

Fixes qgis#19500

* [processing] don't show cancel button in the task manager for algorithms that can not be cancelled (refs qgis#20441)

* fix build

* osgeo4w: rely on GRASS' GISBASE environment variable instead of
detecting the path (ie. use the same version for processing as the
version that the grass plugin uses)

* [ui] Remove black background for the browser panel DB2 icon

* do not always use the -c flag to export vectors from GRASS

* fix formatting

* set default value for newly added parameter

* Followup  1f8708f, fix src / scheme detection

Thanks @nirvn for finding this bug

* allow to drop 2dm files from system file browser (qgis#8987)

* allow to drop 2dm files from system file browser
* support non-ascii files for mesh layer

* don't export features without category by default

* [vertex tool] Fix vertex addition to polygon's first segment (fixes qgis#20774)

With topo editing mode enabled, addition of extra points to keep the topology
correct wasn't working correctly because for the first segment we were getting
two matches due to duplicated first and last vertex in the ring. The fix
ensures that only one match will be returned for the first duplicated vertex.

* Fix "Allow null" in range widget (fixes qgis#20831)

By default a range widget is built with a minimum value set to the
minimal integer that is possible to represent. When "allow null" is
enabled, a new value (minvalue - 1) is inserted. With the default
value, we then had an integer overflow.

* Fix vertex marker display for multipolygon (fixes qgis#19909)

The i == 0 test was wrong, and a test is actually not needed.

* [Processing][Grass] Add the possibility to return a shp if ogr is not compiled with gpkg

* Reserve vector - to minimize reallocation costs

Reserving vector to save on reallocation costs, where we know the size in advance.

* [layouts] Show an explicit warning when exporting a layout which contains a broken image

* [processing] do not show geometryless layers in extent selector

Fixes qgis#21129

* [processing] Fixes to distance inputs for models

- fix parameter can get converted to plain number parameter after edits
- allow parameter to be linked to parent parameters, so that the
correct distance unit and choices are shown for the parameter

* fix qgis#17652 Impossible to rename a layer style from the Styling Panel

* fix qgis#18954 add&rename vector fields (qgis#8982)

fix qgis#18954 add&rename vector fields at the same time

* [processing][needs-docs] Extract binary field algorithm should use
an expression parameter instead of string for destination file name

It makes no sense to enter a constant string value here!

* [processing] snap points to network by default (fix qgis#19904)

Kudos to Pedro Venâncio for finding solution for this bug

* [processing] add test for v.net.distance algorithm

* [processing] fix output generation in v.net and add test

* [processing] fix broken stdout handling in GRASS algs (fix qgis#21142)

* [processing] fix v.net.report and v.net.nreport

* fix when GDALGetRasterScale returns 0 (gdal 2.3 affected for some datasets)

* fix typo in method name

rename method but keep old one in Python for API compatibility

* remove Q_FOREACH

* add SIP_DEPRECATED

* Fix misleading dox

* [processing] Add util to convert QVariant value to Python literal

* Update QgsProcessingModelChildParameterSource::asPythonCode

* Update QgsProcessingModelChildAlgorithm::asPythonCode for 3.x API

* [processing] Update QgsProcessingModelAlgorithm::asPythonCode for 3.x API

* [processing] Formalise object design for ContextAction, allow icons to be set

* Fix multiline description strings

* [processing][needs-docs] Resurrect ability to convert models to scripts

Brings back QGIS 2.18's ability to directly convert a Processing model
to an equivalent Processing Python script algorithm, correctly
updated and working in the 3.x API.

Available from the model dialog, and from the right-click context
menu on an existing model.

Sponsored by Solspec

* [RPM] Add support for GRASS 7.6 as required by F30+

* [RPM] Add a TODO about deprecated scriptlets

* [processing][saga] Fix definition of Multiple regression points/grids alg

Fixes qgis#21146

* Allow vector rendering cancelation to also cancel feature iteration for that request

Connect the cancel rendering signal to the iteration cancelation.
This allows providers (e.g. WFS, AFS) to abort slow network requests
when they have been triggered by a render request and that request
is no longer required.

Allows much faster quit, render cancelation when using WFS/AFS layers.

* Make network authentication request handling thread safe, avoid
races and crashes when auth requests occur in non-main thread

Like the recent SSL error handling, this commit abstracts out
the network authentication handling into a thread safe approach.

* Add signal for logging after network authentication details have been added

* Import more useful libraries into console by default

* Fix timeout in network timeout tests

* Dox++

* Nicer API for network timeouts

* Allow use of local httpbin instances in unit tests

* Update WFS request to accomodate changes in QgsNetworkAccessManager

Because the manager now handles waking up worker threads after
an authentication request, the WFS request handler no longer needs
to do this itself.

* Revert "Revert QgsBlockingNetworkRequest"

With recent changes in QgsNetworkAccessManager this should be
safe to resurrect (fingers crossed!). Also simplify code a lot,
because now QgsNetworkAccessManager handles waking the worker
thread after the auth request is handled.

Add a lot more tests

* Dox

* [afs] Don't render in preview jobs

These servers can be sloooooooow, and unpredictable.
The previous preview job may have been fast to render,
but the next may take minutes or worse to download...

* Only show host (not lengthy url) in message bar timeout messages

* Remove leftover buffer size code (credit to @nirvn)

* Fix blocking request cancelation after a redirect occurs

* Avoid undefined behaviour with signed integer overflow

* fix identify for mesh layers (qgis#9047)

* Small code cleanup to warm up

* Improvements to the right-click behavior to pick locked feature

- unlock feature on right-click in an empty area
- allow selection of locked feature by right-click on polygon interior
  (in addition to polygon rings)
- highlight polygons when mouse moves in their interior - this should also
  decrease the blinking effect as the highlight is more consistent

* Add #spellok for a false positive in spelling test

* Enable/disable actions for mesh layer in main app window

* fix typo and HIG

* fix some PEP8 in Processing Model as python code

* avoid OSRFixup with GDAL >= 2.5

* [opencl] Fix hillshade renderer with 16bit rasters

Fixes qgis#21121

* Remove debug output

* Quote field name identifiers in ORDER BY and MAX/MIN queries

Fixes qgis#21100

* Spellok

* Add testdata file

* Fix some label settings hidpi issues

* use upper camel case for the class name

* [ui] Make vertex tool markers and rubber bands hidpi-friendly

* Fix hang when WMS credentials requested

Remove responsibility for credentials mutex locking from external
callers and handle appropriate locks internally. This allows the
mutex lock to be much "tighter" and avoids deadlocks when
credentials are requested while an existing credentials dialog
is being shown.

(No mutex is required protecting the credentials dialog itself
as this is ALWAYS shown in the main thread)

Fixes qgis#20826

* Unit tests for QgsCredentials

* Dox++

* Last weaks to blend of gray prior to its initial release

* fix pasting features into vector layer from clipboard (fix qgis#21154)

* allow to build against separate PROJ.4 and GDAL installs

* Deprecate QgsGeometry::set for usage in Python

When a new QgsAbstractGeometry is set on a geometry object, the previous child is deleted.
If the previous object was constructed by Python, it's wrapper will still be alive for
as long as the QgsGeometry is alive. If a new QgsAbstractGeometry is constructed at the same
memory address as the old one, the wrapper will be reused with wrong type (and other)
information, leading to all kind of weird issues.

See also https://www.riverbankcomputing.com/pipermail/pyqt/2019-January/041251.html

* Clearer phrasing

* HIG string fixes

* Hidpi icon size fixes

* translation fix

* [processing] Pep8 fixes for model to script

* [processing] Reorganise python script generated from model, to
move "guts" of script to top (initAlgorithm/processAlgorithm)
and boilerplate methods (createInstance, etc) to end

* [ui] More hidpi-compatibility work for the vertex tool

* [ui] Improve 3D map scene config dialog (fixes qgis#20685)

* [ui] Fix tiny vertex marker on hidpi

* Quick and dirty patch to DB-Manager after PR 8831

The "comments" PR 8831 added support for postgres only
(and broke all the others backends).

I'd be in favor of a revert of the whole original PR but
this patch restores functionality and could be an acceptable
temporary fix until the comments PR is reworked in a more
maintainable and elegant way.

Fixes qgis#21151 btw

* Slight improvements to Python docs

* Minor improvements to PyQGIS returns for SIP_OUT params

* fix error in scale optimization (qgis#9081)

* some minor code cleanup in dbmanager

* fix some HIG and add missing translations in dbmanager

* Allow for exact calculation of symbol sizes with mixed layer units

Fixes qgis#21143

* [MetaSearch] OWS GetCapabilities checking regression (fixes qgis#19787) [needs-docs]

* Fix incorrect 'not available in Python' dox

* [processing][gdal] Fix incorrect definition of gdal_warp extra_param parameter

* [processing][gdal] Ensure that GDAL algs output the CORRECT
generated filename for outputs

Previously they were just echoing the input parameter value,
which isn't always a string and accordingly was broken for
temporary outputs. This caused models to break when the output
of a GDAL algorithm was used in a subsequent model step.

* [processing][needs-docs] Make Find Projection algorithm simpler to use

We no longer require the seperate CRS parameter, because the extent
parameter contains the CRS information itself. This means the algorithm
is simplified to just picking the layer and drawing the desired area
on the canvas.

* [processing] Port matrix widget wrapper to newer c++ API

Allows matrix parameters to be correctly set for model child algorithms

Fixes qgis#20914

* [themes] Get rid of the check mark in combo box drop down lists

* Strip file:// from local files path before resolving

Fixes qgis#21150 - Delimitedtext layer saves absolute path
when project in relative path mode

* Code style (I had autopep8 installed btw)

* [vertex tool] right-click to loop through editable features

Until now mouse right-click could only select and deselect the highlighted
feature to "lock" vertex tool (and numerical editor) to it, so that it is
easier to focus only on editing of the particular feature. It was however
still difficult to pick the right feature in case there were multiple
features in one location or very close to each other. This is now solved
by the fact that repeated right button clicks will loop through the editable
features. So if there are two features in one location (A, B) then repeated
right-clicks will select: A - B - nothing - A - B - nothing ...

* Make coverage test happy

* Allow maximum number of entries to show in relation reference widget
to be configurable via an advanced setting configuration option

In some circumstances 100 is not enough

* Fix relationship between scale<->extent in the save [canvas] as image/pdf dialog

* follow up 4f77477 : fix hasty pasting error

* Astyle again

* [processing] If model name starts with a digit, we need to remove that when generating a class name

* Const correctnes for QgsFeature in labeling

A feature is not modified while it's sent through the labeling pipeline.

* Add docstrings and modernize code

* [processing][gdal] Fix polygonize field name is ignored

* Banned keywords

* allow QGZ files in selections

* Resurrect dedicated action to create virtual layers in main window

This was removed when the data source manager was created, but
new virtual layers are a "creation" action, so it belongs alongside
the other "Create" actions like new shapefile, new gpkg, etc

It "feels" more natural then using the open data source dialog
to create a new virtual layer

* Do not remove parameters from virtual methods which should be used in python

These methods did not actually override their parent methods but just coexisted and were never called.

Fixes compilation with SIP version: 4.19.14

* [WFS provider] Ensure stability of QGIS FeatureId when reloading layer (fixes qgis#20865)

* [themes] Better style tool buttons in the tab bar for Blend of Gray

* [themes] Properly style autoRaise state in Blend of Gray

* [themes] Properly style autoRaise state in  Night Mapping

* Make sure Python wrappers of quasi-singletons are kept alive

If they are deleted, any other python wrappers which have been parented to these singletons are deleted too.

One of the most common issues with this is, that subclasses of registry items are deleted and lost.

* Add registry keepreference test

* Deprecate for sip

* Append ? to WMTS GetCapabilities

This makes WMTS behave equal to the WMS implementation which already appends a ? in case there is no query string supplied.

Some parsers rely on a terminating ? to work properly.

* Remove space before line number in log messages

Because this means you can copy the filename:linenumber combo and
enter it directly in QtCreator's locator without having to manually
remove that extra space.

It's the little things...

* Silence some noisy debug messages

* Deprecate QgsDataItem API for setting item CRS

This is no longer used by QGIS (it was only ever used by the standalone
browser)

* [browser] Avoid always opening every file using gdal to test for
update capabilities

This is no longer required - it was previously done in order to
detect if the item should expose the SetCrs capability, but
that's deprecated and unused.

Fixes qgis#16807, fixes qgis#20411, and avoids QGIS opening every file encountered in
the browser even when the Data Source setting is set to the
default (fast) "Check Extension" setting only.

* Fix some hidpi layout issues in options dialog

* Fix test

* Fix test

* More test fixes

* Even more test fixes

* [WFS provider] Correctly compute layer extent when zooming out layer (fixes qgis#20742)

* New Shapefile Layer: reorganise additional dimensions checkboxes

because shapefiles could only be
- plain X,Y
- with M values: X,Y,M
- with Z and M values: X,Y,Z,M

* Add actionVertexToolActiveLayer to iface

* [themes] Insure groupbox checkbox indicator size equals that of normal checkbox

* [ui] Fix undersized color buttons in the 3D map config dialog

* Correct crash when read from ogr file in thread (QgsProcessing for instance)

fixes qgis#20581

* qgsRound: places should be of integer type instead of double

* remove 'multithreading is not supp in server text'

* Consistently use multi thread instead of multithread

* Don't add extra linebreak in print composer tables

Check if remaining text is short enough to go in one line. Fixes qgis#20546

* fix substr help (fixes qgis#21192)

* [vertex tool] "current layer" mode default + locked feature improvements

When a feature is locked:
- vertex tool will not highlight other features
- vertex tool will not allow selection of vertices from other features

* [processing] Fix evaluation of linked parameters in batch mode

e.g. missing fields after selecting a layer parameter
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants