1
1
package com .conveyal .datatools .editor .jobs ;
2
2
3
3
import com .conveyal .datatools .editor .datastore .FeedTx ;
4
- import com .conveyal .datatools .manager .models .FeedSource ;
5
4
import com .google .common .io .Files ;
6
5
import com .vividsolutions .jts .geom .Coordinate ;
7
6
import com .vividsolutions .jts .geom .GeometryFactory ;
36
35
public class GisExport implements Runnable {
37
36
File file ;
38
37
Type type ;
39
- Collection <String > agencyIds ;
38
+ Collection <String > feedIds ;
40
39
41
- public GisExport (Type type , File file , Collection <String > agencyIds ) {
40
+ public GisExport (Type type , File file , Collection <String > feedIds ) {
42
41
this .type = type ;
43
42
this .file = file ;
44
- this .agencyIds = agencyIds ;
43
+ this .feedIds = feedIds ;
45
44
}
46
45
47
46
@ Override
@@ -50,7 +49,7 @@ public void run() {
50
49
File outShp = new File (outDir , file .getName ().replaceAll ("\\ .zip" , "" ) + ".shp" );
51
50
52
51
GlobalTx gtx = VersionedDataStore .getGlobalTx ();
53
- FeedTx atx = null ;
52
+ FeedTx feedtx = null ;
54
53
try {
55
54
ShapefileDataStoreFactory dataStoreFactory = new ShapefileDataStoreFactory ();
56
55
@@ -98,11 +97,11 @@ public void run() {
98
97
datastore .createSchema (STOP_TYPE );
99
98
featureBuilder = new SimpleFeatureBuilder (STOP_TYPE );
100
99
101
- for (String feedId : agencyIds ) {
100
+ for (String feedId : feedIds ) {
102
101
EditorFeed fs = gtx .feeds .get (feedId );
103
102
104
- atx = VersionedDataStore .getFeedTx (feedId );
105
- for (Stop s : atx .stops .values ()) {
103
+ feedtx = VersionedDataStore .getFeedTx (feedId );
104
+ for (Stop s : feedtx .stops .values ()) {
106
105
featureBuilder .add (s .location );
107
106
featureBuilder .add (s .stopName );
108
107
featureBuilder .add (s .stopCode );
@@ -113,7 +112,7 @@ public void run() {
113
112
features .add (feature );
114
113
}
115
114
116
- atx .rollback ();
115
+ feedtx .rollback ();
117
116
}
118
117
} else if (type .equals (Type .ROUTES )) {
119
118
collectionType = ROUTE_TYPE ;
@@ -122,14 +121,14 @@ public void run() {
122
121
123
122
GeometryFactory gf = new GeometryFactory ();
124
123
125
- for (String feedId : agencyIds ) {
124
+ for (String feedId : feedIds ) {
126
125
EditorFeed fs = gtx .feeds .get (feedId );
127
126
128
- atx = VersionedDataStore .getFeedTx (feedId );
127
+ feedtx = VersionedDataStore .getFeedTx (feedId );
129
128
130
129
// we loop over trip patterns. Note that this will yield several lines for routes that have
131
130
// multiple patterns. There's no real good way to reconcile the shapes of multiple patterns.
132
- for (TripPattern tp : atx .tripPatterns .values ()) {
131
+ for (TripPattern tp : feedtx .tripPatterns .values ()) {
133
132
LineString shape ;
134
133
if (tp .shape != null ) {
135
134
shape = tp .shape ;
@@ -138,13 +137,13 @@ public void run() {
138
137
Coordinate [] coords = new Coordinate [tp .patternStops .size ()];
139
138
140
139
for (int i = 0 ; i < coords .length ; i ++) {
141
- coords [i ] = atx .stops .get (tp .patternStops .get (i ).stopId ).location .getCoordinate ();
140
+ coords [i ] = feedtx .stops .get (tp .patternStops .get (i ).stopId ).location .getCoordinate ();
142
141
}
143
142
144
143
shape = gf .createLineString (coords );
145
144
}
146
145
147
- Route r = atx .routes .get (tp .routeId );
146
+ Route r = feedtx .routes .get (tp .routeId );
148
147
149
148
featureBuilder .add (shape );
150
149
featureBuilder .add (tp .name );
@@ -165,7 +164,7 @@ public void run() {
165
164
features .add (feature );
166
165
}
167
166
168
- atx .rollback ();
167
+ feedtx .rollback ();
169
168
}
170
169
}
171
170
else
@@ -208,9 +207,9 @@ public void run() {
208
207
e .printStackTrace ();
209
208
} finally {
210
209
if (gtx != null ) gtx .rollback ();
211
- if (atx != null ) atx .rollbackIfOpen ();
210
+ if (feedtx != null ) feedtx .rollbackIfOpen ();
212
211
}
213
212
}
214
213
215
- public static enum Type { ROUTES , STOPS };
214
+ public enum Type { ROUTES , STOPS }
216
215
}
0 commit comments