4343import doIntersectLines , doSelectByLocation , doVectorSplit , doMeanCoords
4444import doPointDistance , doPointsInPolygon , doRandom , doRandPoints , doRegPoints
4545import doSpatialJoin , doSubsetSelect , doSumLines , doVectorGrid , doMergeShapes
46- import doValidate , doSimplify , doDefineProj
46+ import doValidate , doSimplify , doDefineProj , doSpatialIndex
4747
4848class fToolsPlugin :
4949 def __init__ (self ,iface ):
@@ -103,6 +103,7 @@ def updateThemeIcons(self, theme):
103103 self .voronoi .setIcon (QIcon (self .getThemeIcon ("voronoi.png" )))
104104 self .extNodes .setIcon (QIcon (self .getThemeIcon ("extract_nodes.png" )))
105105 self .simplify .setIcon (QIcon (self .getThemeIcon ("simplify.png" )))
106+ self .densify .setIcon (QIcon (self .getThemeIcon ("densify.png" )))
106107 self .multiToSingle .setIcon (QIcon (self .getThemeIcon ("multi_to_single.png" )))
107108 self .singleToMulti .setIcon (QIcon (self .getThemeIcon ("single_to_multi.png" )))
108109 self .polysToLines .setIcon (QIcon (self .getThemeIcon ("to_lines.png" )))
@@ -113,6 +114,7 @@ def updateThemeIcons(self, theme):
113114 self .spatJoin .setIcon (QIcon (self .getThemeIcon ("join_location.png" )))
114115 self .splitVect .setIcon (QIcon (self .getThemeIcon ("split_layer.png" )))
115116 self .mergeShapes .setIcon (QIcon (self .getThemeIcon ("merge_shapes.png" )))
117+ self .spatialIndex .setIcon (QIcon (self .getThemeIcon ("spatial_index.png" )))
116118
117119 def initGui (self ):
118120 if int (self .QgisVersion ) < 1 :
@@ -167,19 +169,22 @@ def initGui(self):
167169 self .voronoi = QAction (QCoreApplication .translate ("fTools" , "Voronoi Polygons" ),self .iface .mainWindow ())
168170 self .extNodes = QAction (QCoreApplication .translate ("fTools" , "Extract nodes" ),self .iface .mainWindow ())
169171 self .simplify = QAction (QCoreApplication .translate ("fTools" , "Simplify geometries" ),self .iface .mainWindow ())
172+ self .densify = QAction (QCoreApplication .translate ("fTools" , "Densify geometries" ),self .iface .mainWindow ())
170173 self .multiToSingle = QAction (QCoreApplication .translate ("fTools" , "Multipart to singleparts" ),self .iface .mainWindow ())
171174 self .singleToMulti = QAction (QCoreApplication .translate ("fTools" , "Singleparts to multipart" ),self .iface .mainWindow ())
172175 self .polysToLines = QAction (QCoreApplication .translate ("fTools" , "Polygons to lines" ),self .iface .mainWindow ())
173176 self .linesToPolys = QAction (QCoreApplication .translate ("fTools" , "Lines to polygons" ),self .iface .mainWindow ())
174177 self .conversionMenu .addActions ([self .checkGeom , self .compGeo , self .centroids , self .delaunay , self .voronoi ,
175- self .simplify , self .multiToSingle , self .singleToMulti , self .polysToLines , self .linesToPolys , self .extNodes ])
178+ self .simplify , self .densify , self .multiToSingle , self .singleToMulti , self .polysToLines , self .linesToPolys ,
179+ self .extNodes ])
176180
177181 self .dataManageMenu = QMenu (QCoreApplication .translate ("fTools" , "&Data Management Tools" ))
178182 self .define = QAction (QCoreApplication .translate ("fTools" , "Define current projection" ), self .iface .mainWindow ())
179183 self .spatJoin = QAction (QCoreApplication .translate ("fTools" , "Join attributes by location" ), self .iface .mainWindow ())
180184 self .splitVect = QAction (QCoreApplication .translate ("fTools" , "Split vector layer" ), self .iface .mainWindow ())
181185 self .mergeShapes = QAction (QCoreApplication .translate ("fTools" , "Merge shapefiles to one" ), self .iface .mainWindow ())
182- self .dataManageMenu .addActions ([self .define , self .spatJoin , self .splitVect , self .mergeShapes ])
186+ self .spatialIndex = QAction (QCoreApplication .translate ("fTools" , "Create spatial index" ), self .iface .mainWindow ())
187+ self .dataManageMenu .addActions ([self .define , self .spatJoin , self .splitVect , self .mergeShapes , self .spatialIndex ])
183188 self .updateThemeIcons ("theme" )
184189
185190 self .menu .addMenu (self .analysisMenu )
@@ -222,7 +227,8 @@ def initGui(self):
222227 QObject .connect (self .multiToSingle , SIGNAL ("triggered()" ), self .domultiToSingle )
223228 QObject .connect (self .singleToMulti , SIGNAL ("triggered()" ), self .dosingleToMulti )
224229 QObject .connect (self .checkGeom , SIGNAL ("triggered()" ), self .docheckGeom )
225- QObject .connect (self .simplify , SIGNAL ("triggered()" ), self .dosimplify )
230+ QObject .connect (self .simplify , SIGNAL ("triggered()" ), self .doSimplify )
231+ QObject .connect (self .densify , SIGNAL ("triggered()" ), self .doDensify )
226232 QObject .connect (self .centroids , SIGNAL ("triggered()" ), self .docentroids )
227233 QObject .connect (self .delaunay , SIGNAL ("triggered()" ), self .dodelaunay )
228234 QObject .connect (self .voronoi , SIGNAL ("triggered()" ), self .dovoronoi )
@@ -235,12 +241,19 @@ def initGui(self):
235241 QObject .connect (self .spatJoin , SIGNAL ("triggered()" ), self .dospatJoin )
236242 QObject .connect (self .splitVect , SIGNAL ("triggered()" ), self .dosplitVect )
237243 QObject .connect (self .mergeShapes , SIGNAL ("triggered()" ), self .doMergeShapes )
244+ QObject .connect (self .spatialIndex , SIGNAL ("triggered()" ), self .doSpatIndex )
238245
239246 def unload (self ):
240247 pass
241248
242- def dosimplify (self ):
243- d = doSimplify .Dialog (self .iface )
249+ def doSimplify (self ):
250+ d = doSimplify .Dialog (self .iface , 1 )
251+ d .show ()
252+ d .exec_ ()
253+
254+ def doDensify (self ):
255+ d = doSimplify .Dialog (self .iface , 2 )
256+ d .show ()
244257 d .exec_ ()
245258
246259 def dopolysToLines (self ):
@@ -319,7 +332,7 @@ def docentroids(self):
319332 def dodelaunay (self ):
320333 d = doGeometry .GeometryDialog (self .iface , 8 )
321334 d .exec_ ()
322-
335+
323336 def dovoronoi (self ):
324337 d = doGeometry .GeometryDialog (self .iface , 10 )
325338 d .exec_ ()
@@ -390,5 +403,10 @@ def dospatJoin(self):
390403
391404 def doMergeShapes (self ):
392405 d = doMergeShapes .Dialog (self .iface )
406+ d .show ()
393407 d .exec_ ()
394408
409+ def doSpatIndex (self ):
410+ d = doSpatialIndex .Dialog (self .iface )
411+ d .show ()
412+ d .exec_ ()
0 commit comments