-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] Port autoincremental field to c++
Also add: - support for setting initial value for field to start at - support for user-set field names (instead of always using 'AUTO')
- Loading branch information
1 parent
61dc8ea
commit 97c1b0d
Showing
10 changed files
with
367 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 0 additions & 60 deletions
60
python/plugins/processing/algs/qgis/AutoincrementalField.py
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
86 changes: 86 additions & 0 deletions
86
python/plugins/processing/tests/testdata/expected/autoincrement_field_field_name.gml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ogr:FeatureCollection | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://ogr.maptools.org/ autoincrement_field_field_name.xsd" | ||
xmlns:ogr="http://ogr.maptools.org/" | ||
xmlns:gml="http://www.opengis.net/gml"> | ||
<gml:boundedBy> | ||
<gml:Box> | ||
<gml:coord><gml:X>0</gml:X><gml:Y>-5</gml:Y></gml:coord> | ||
<gml:coord><gml:X>8</gml:X><gml:Y>3</gml:Y></gml:coord> | ||
</gml:Box> | ||
</gml:boundedBy> | ||
|
||
<gml:featureMember> | ||
<ogr:autoincrement_field_field_name fid="points.0"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1,1</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>1</ogr:id> | ||
<ogr:id2>2</ogr:id2> | ||
<ogr:my_field>0</ogr:my_field> | ||
</ogr:autoincrement_field_field_name> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_field_name fid="points.1"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3,3</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>2</ogr:id> | ||
<ogr:id2>1</ogr:id2> | ||
<ogr:my_field>1</ogr:my_field> | ||
</ogr:autoincrement_field_field_name> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_field_name fid="points.2"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2,2</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>3</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:my_field>2</ogr:my_field> | ||
</ogr:autoincrement_field_field_name> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_field_name fid="points.3"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>5,2</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>4</ogr:id> | ||
<ogr:id2>2</ogr:id2> | ||
<ogr:my_field>3</ogr:my_field> | ||
</ogr:autoincrement_field_field_name> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_field_name fid="points.4"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4,1</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>5</ogr:id> | ||
<ogr:id2>1</ogr:id2> | ||
<ogr:my_field>4</ogr:my_field> | ||
</ogr:autoincrement_field_field_name> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_field_name fid="points.5"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-5</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>6</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:my_field>5</ogr:my_field> | ||
</ogr:autoincrement_field_field_name> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_field_name fid="points.6"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8,-1</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>7</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:my_field>6</ogr:my_field> | ||
</ogr:autoincrement_field_field_name> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_field_name fid="points.7"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-1</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>8</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:my_field>7</ogr:my_field> | ||
</ogr:autoincrement_field_field_name> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_field_name fid="points.8"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-1</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>9</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:my_field>8</ogr:my_field> | ||
</ogr:autoincrement_field_field_name> | ||
</gml:featureMember> | ||
</ogr:FeatureCollection> |
44 changes: 44 additions & 0 deletions
44
python/plugins/processing/tests/testdata/expected/autoincrement_field_field_name.xsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0"> | ||
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/> | ||
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/> | ||
<xs:complexType name="FeatureCollectionType"> | ||
<xs:complexContent> | ||
<xs:extension base="gml:AbstractFeatureCollectionType"> | ||
<xs:attribute name="lockId" type="xs:string" use="optional"/> | ||
<xs:attribute name="scope" type="xs:string" use="optional"/> | ||
</xs:extension> | ||
</xs:complexContent> | ||
</xs:complexType> | ||
<xs:element name="autoincrement_field_field_name" type="ogr:autoincrement_field_field_name_Type" substitutionGroup="gml:_Feature"/> | ||
<xs:complexType name="autoincrement_field_field_name_Type"> | ||
<xs:complexContent> | ||
<xs:extension base="gml:AbstractFeatureType"> | ||
<xs:sequence> | ||
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/> | ||
<xs:element name="id" nillable="true" minOccurs="0" maxOccurs="1"> | ||
<xs:simpleType> | ||
<xs:restriction base="xs:integer"> | ||
<xs:totalDigits value="10"/> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
</xs:element> | ||
<xs:element name="id2" nillable="true" minOccurs="0" maxOccurs="1"> | ||
<xs:simpleType> | ||
<xs:restriction base="xs:integer"> | ||
<xs:totalDigits value="10"/> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
</xs:element> | ||
<xs:element name="my_field" nillable="true" minOccurs="0" maxOccurs="1"> | ||
<xs:simpleType> | ||
<xs:restriction base="xs:long"> | ||
<xs:totalDigits value="20"/> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
</xs:element> | ||
</xs:sequence> | ||
</xs:extension> | ||
</xs:complexContent> | ||
</xs:complexType> | ||
</xs:schema> |
86 changes: 86 additions & 0 deletions
86
python/plugins/processing/tests/testdata/expected/autoincrement_field_start.gml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
<?xml version="1.0" encoding="utf-8" ?> | ||
<ogr:FeatureCollection | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://ogr.maptools.org/ autoincrement_field_start.xsd" | ||
xmlns:ogr="http://ogr.maptools.org/" | ||
xmlns:gml="http://www.opengis.net/gml"> | ||
<gml:boundedBy> | ||
<gml:Box> | ||
<gml:coord><gml:X>0</gml:X><gml:Y>-5</gml:Y></gml:coord> | ||
<gml:coord><gml:X>8</gml:X><gml:Y>3</gml:Y></gml:coord> | ||
</gml:Box> | ||
</gml:boundedBy> | ||
|
||
<gml:featureMember> | ||
<ogr:autoincrement_field_start fid="points.0"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>1,1</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>1</ogr:id> | ||
<ogr:id2>2</ogr:id2> | ||
<ogr:AUTO>10</ogr:AUTO> | ||
</ogr:autoincrement_field_start> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_start fid="points.1"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>3,3</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>2</ogr:id> | ||
<ogr:id2>1</ogr:id2> | ||
<ogr:AUTO>11</ogr:AUTO> | ||
</ogr:autoincrement_field_start> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_start fid="points.2"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>2,2</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>3</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:AUTO>12</ogr:AUTO> | ||
</ogr:autoincrement_field_start> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_start fid="points.3"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>5,2</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>4</ogr:id> | ||
<ogr:id2>2</ogr:id2> | ||
<ogr:AUTO>13</ogr:AUTO> | ||
</ogr:autoincrement_field_start> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_start fid="points.4"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>4,1</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>5</ogr:id> | ||
<ogr:id2>1</ogr:id2> | ||
<ogr:AUTO>14</ogr:AUTO> | ||
</ogr:autoincrement_field_start> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_start fid="points.5"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-5</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>6</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:AUTO>15</ogr:AUTO> | ||
</ogr:autoincrement_field_start> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_start fid="points.6"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>8,-1</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>7</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:AUTO>16</ogr:AUTO> | ||
</ogr:autoincrement_field_start> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_start fid="points.7"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>7,-1</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>8</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:AUTO>17</ogr:AUTO> | ||
</ogr:autoincrement_field_start> | ||
</gml:featureMember> | ||
<gml:featureMember> | ||
<ogr:autoincrement_field_start fid="points.8"> | ||
<ogr:geometryProperty><gml:Point srsName="EPSG:4326"><gml:coordinates>0,-1</gml:coordinates></gml:Point></ogr:geometryProperty> | ||
<ogr:id>9</ogr:id> | ||
<ogr:id2>0</ogr:id2> | ||
<ogr:AUTO>18</ogr:AUTO> | ||
</ogr:autoincrement_field_start> | ||
</gml:featureMember> | ||
</ogr:FeatureCollection> |
44 changes: 44 additions & 0 deletions
44
python/plugins/processing/tests/testdata/expected/autoincrement_field_start.xsd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<xs:schema targetNamespace="http://ogr.maptools.org/" xmlns:ogr="http://ogr.maptools.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:gml="http://www.opengis.net/gml" elementFormDefault="qualified" version="1.0"> | ||
<xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/2.1.2/feature.xsd"/> | ||
<xs:element name="FeatureCollection" type="ogr:FeatureCollectionType" substitutionGroup="gml:_FeatureCollection"/> | ||
<xs:complexType name="FeatureCollectionType"> | ||
<xs:complexContent> | ||
<xs:extension base="gml:AbstractFeatureCollectionType"> | ||
<xs:attribute name="lockId" type="xs:string" use="optional"/> | ||
<xs:attribute name="scope" type="xs:string" use="optional"/> | ||
</xs:extension> | ||
</xs:complexContent> | ||
</xs:complexType> | ||
<xs:element name="autoincrement_field_start" type="ogr:autoincrement_field_start_Type" substitutionGroup="gml:_Feature"/> | ||
<xs:complexType name="autoincrement_field_start_Type"> | ||
<xs:complexContent> | ||
<xs:extension base="gml:AbstractFeatureType"> | ||
<xs:sequence> | ||
<xs:element name="geometryProperty" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/> | ||
<xs:element name="id" nillable="true" minOccurs="0" maxOccurs="1"> | ||
<xs:simpleType> | ||
<xs:restriction base="xs:integer"> | ||
<xs:totalDigits value="10"/> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
</xs:element> | ||
<xs:element name="id2" nillable="true" minOccurs="0" maxOccurs="1"> | ||
<xs:simpleType> | ||
<xs:restriction base="xs:integer"> | ||
<xs:totalDigits value="10"/> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
</xs:element> | ||
<xs:element name="AUTO" nillable="true" minOccurs="0" maxOccurs="1"> | ||
<xs:simpleType> | ||
<xs:restriction base="xs:long"> | ||
<xs:totalDigits value="20"/> | ||
</xs:restriction> | ||
</xs:simpleType> | ||
</xs:element> | ||
</xs:sequence> | ||
</xs:extension> | ||
</xs:complexContent> | ||
</xs:complexType> | ||
</xs:schema> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.